[lld] [lld] enable fixup chains by default (PR #79894)
Daniel Bertalan via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 09:18:25 PST 2024
BertalanD wrote:
Original author of our fixup-chains support is here. I had a quick (sorry, school et al.) look at it.
It looks like we are trying to find the address of `__RNvCsiLjxBhyzEAX_4curl9INIT_CTOR` (`curl[da8bc63371d5233d]::INIT_CTOR`). This is actually a symbol defined *in* the `__mod_init_func` section. The problem is that this section is not emitted when chained fixups are used, but instead, `__init_offsets` is synthetized from it (389e0a81a15ca). So, the data this symbol points to simply does not exist in the final binary.
Now, *obviously* people shouldn't be defining *exported* symbols in `__mod_init_func` (which is just an array of function pointers to static initializers) willy-nilly. I assume the value does not matter, it's just that they want it to be a root for the section GC (which is an earlier pass than where we're crashing), we could get away with simply omitting this symbol from the exports trie.
The relevant "offending" code is here:
https://github.com/alexcrichton/curl-rust/blob/dbf8d87ecb93c0f3069742e351d35de120189760/src/lib.rs#L123-L151
https://github.com/llvm/llvm-project/pull/79894
More information about the llvm-commits
mailing list