Uh oh!
There was an error while loading. Please reload this page.
Enable function sections with windows-gnu - #75604
Conversation
rust-highfive
commented
Aug 16, 2020
(rust_highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
With MinGW and specific flags symbol may end up in multiple sections in some cases like: 0000000000000000 p .pdata$_ZN20stable_symbol_names113mono_function17hd4880e88dec8766dE 0000000000000000 t .text$_ZN20stable_symbol_names113mono_function17hd4880e88dec8766dE 0000000000000000 r .xdata$_ZN20stable_symbol_names113mono_function17hd4880e88dec8766dE 0000000000000000 T _ZN20stable_symbol_names113mono_function17hd4880e88dec8766dE This will cause an error when comparing that output directly with other library that only imports the symbol since it will appear only once. To avoid the issue pass "-g" to nm so only the global symbol (the one with "T" letter) will be listed.
14ee44a to
b655027Comparenagisa
commented
Aug 16, 2020
IIRC the reason it was disabled until now was because on Windows there's an egregiously small limit on sections in object files, which then leads to compilation failures. Is |
Apparently it was disabled because of the LLVM assertions: #13846 I have tried enabling it some time ago but got ui tests crashes. |
mstorsjo
commented
Aug 17, 2020
FWIW, the limit on sections in an object file is higher if compiling in "big object" mode. IIRC GCC and/or MSVC require you to pass specific flags for enabling this, while LLVM enables this format automatically as needed. |
ecstatic-morse
commented
Aug 19, 2020
r? @nagisa |
nagisa
commented
Aug 21, 2020
@bors r+ |
bors
commented
Aug 21, 2020
📌 Commit b655027 has been approved by |
bors
commented
Aug 21, 2020
⌛ Testing commit b655027 with merge 18dd0795f6aecafa408c6b35e9b28d2798a6ea8a... |
bors
commented
Aug 21, 2020
💔 Test failed - checks-actions |
mati865
commented
Aug 21, 2020
Appears to be bug fixed in binutils 2.32 I'll look for a workaround. |
mati865
commented
Aug 22, 2020
I can reproduce it locally with the same Binutils version as on CI, Binutils 2.34 are not affected. @mstorsjo do you remember if this is easily workaroundable in LLVM? |
mstorsjo
commented
Aug 22, 2020
What issue in particular are you referring to here? |
@mstorsjo I apologize I thought I had included the link. Here is ld.bfd bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=23872 |
mstorsjo
commented
Aug 23, 2020
Ah, that one. I have one potential fix in mind - appending a final object file that contains .rdata contents that is aligned to 4 bytes, included as the last object file in the link command. The object file can be assembled from e.g. this: That should take care to make sure the end of the .rdata section is aligned to 4 bytes, avoiding that particular ld bug. |
mati865
commented
Aug 24, 2020
Unfortunately that didn't work. I'll just close it for now. |
The comment here was a bit misleading, #13846 was about an LLVM assertion that failed when `-Zfunction-sections` was enabled. However, that bug has been fixed for a long time and the actual issue was that older `ld` versions would not correctly link binaries (see #75604 for the prior attempt at this change). This bug was fixed in version 2.32 of binutils and Rust now ships binutils 2.42 as of #119229 so we can remove this workaround!
Passed tests locally on x86_64 with LLVM assertions enabled.