-
Notifications
You must be signed in to change notification settings - Fork 107
Read and write dylib metadata #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/metadata.rs
Outdated
DeflateEncoder::new(&mut compressed, Compression::fast()) | ||
.write_all(&metadata.raw_data).unwrap(); | ||
|
||
artifact.declare_with(".rustc", faerie::Decl::debug_section(), compressed).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used it here.
7f7343d
to
b802e9d
Compare
For MachO, |
Yea we need to add explicit section ability, it’s unfortunately not implemented yet to my knowledge. I don’t think it will be a lot of work since we already write out sections so the machinery is there. Someone just needs to add the api :) @bjorn3 would you like to try out a PR? :D |
cg_llvm puts it in
Sure |
1ef9319
to
8d590bc
Compare
Blocked on rust-lang/rust#59564 to stop the duplication of the linker code between cg_clif and cg_llvm. |
8d590bc
to
fc94af2
Compare
fc94af2
to
5240aca
Compare
5240aca
to
ba1659d
Compare
The |
acb414d
to
d59234b
Compare
d59234b
to
a6821a2
Compare
Seems like there should be a symbol names like |
@bjorn3 Sorry missed your ping, did your recent PR to faerie resolve the issue about dylibs having sections discarded ? |
No problem.
No, cg_llvm seems to also create a symbol referencing the metadata. Doing that here too may solve the problem. Unfortunately faerie doesnt support symbols in custom sections. |
909acc6
to
e242671
Compare
Yup adding a global symbol pointing to the start of the section fixes it:
|
In what way should faerie expose this? Specify the section a normal decl is put in? Or specify the symbols for a section decl? |
Gentle ping @m4b |
e242671
to
fceab41
Compare
@bjorn3 given your results, it seems reasonable for the user to specify symbol + data + optional section, and create the section if it isn’t there ? I suspect it’s going to complicate some of the setup logic, but maybe not. Will require another PR :( is this blocking you right now ? |
Did you see m4b/faerie#83? I chose the "Specify the symbols for a section decl?" route. This is not really blocking me. |
949086b
to
07bb89a
Compare
This has a patch section, because m4b/faerie#83 and gimli-rs/object#109 haven't landed in a version published on crates.io. |
@m4b I (mis)used
Decl::debug_section()
to add a.rustc
section. Is this supported or may future versions of faerie break this?Fixes #412