-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Set .llvmbc and .llvmcmd sections as allocatable #77961
Conversation
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
Please note that I'm not entirely sure what side effects this may have on rust. I just noticed this didn't match what clang does because I was trying to extract the bytecode with |
Uh... I have no idea what this all is.. Do you know anyone who could review this? |
This would mean that these sections are loaded into memory when the rust built-code is executed. Alternatively, and more critically, this would mean that contents of these sections would end up being written into the program memory on embedded devices, despite it having no functional purpose in a running program, thus wasting the already precious bytes. I think your use-case would be served sufficiently by marking these sections as r? @nagisa |
Huh, looks like ELF assembly does not support the |
With the |
Checking the clang produced output, it seems like this data is indeed loaded into binary memory. I'd consider it a clang bug, but I guess, this PR matches clang's behaviour. @bors r+ |
📌 Commit 684d142 has been approved by |
Set .llvmbc and .llvmcmd sections as allocatable This marks both sections as allocatable rather than excluded, which matches what clang does with the equivalent `-fembed-bitcode` flag.
Rollup of 6 pull requests Successful merges: - rust-lang#76199 (Permit uninhabited enums to cast into ints) - rust-lang#77751 (liballoc: VecDeque: Add binary search functions) - rust-lang#77785 (Remove compiler-synthesized reexports when documenting) - rust-lang#77932 (BTreeMap: improve gdb introspection of BTreeMap with ZST keys or values) - rust-lang#77961 (Set .llvmbc and .llvmcmd sections as allocatable) - rust-lang#77985 (llvm: backport SystemZ fix for AGR clobbers) Failed merges: r? `@ghost`
@nagisa @glandium The libc build for
Any thoughts on this? |
I don't think this change was correct. According to the PR description it only matches clang's behavior when We observed a huge increase in the size of libstd.so from 1.3M to 17.5M that was bisected to this change (or one of the other changes in the rollup, but probably this one.) |
There are a couple situations where bitcode may be embedded:
I suspect that |
Sorry, I didn't expand the diff context enough to see that this was in the I think we're building libstd wrong in that case. If LTO is enabled it should terminate at a dylib boundary unless |
That could be the case, but ultimately I think it is fine to revert this first (if this PR is indeed confirmed to be the issue) and then think about how to introduce it without causing a regression. |
I agree. |
Repro:
I assume this is not intended, but I'll leave it to the experts. Full output:
|
This marks both sections as allocatable rather than excluded, which matches what
clang does with the equivalent
-fembed-bitcode
flag.