llvm-project
9b020dda - [lld][WebAssembly] Don't export deps for unused stub symbols (#173422)

Commit
12 days ago
[lld][WebAssembly] Don't export deps for unused stub symbols (#173422) When a stub .so file contains ``` A: B ``` And `A` is defined in bitcode that's pulled in for LTO, but both `A` and `B` are removed in `LTO::linkRegularLTO` due to not being dead: https://github.com/llvm/llvm-project/blob/24297bea9672722d8fbaaff137b301b0becaae9c/llvm/lib/LTO/LTO.cpp#L1042-L1054 Then the symbol `A` becomes undefined after LTO, `processStubLibraries` tries to import `A` from JS, and tries to export its dependency `B`: https://github.com/llvm/llvm-project/blob/24297bea9672722d8fbaaff137b301b0becaae9c/lld/wasm/Driver.cpp#L1108-L1109 But `B` is gone, causing this error: ```console wasm-ld: error: ....: undefined symbol: B. Required by A ``` This PR checks if the symbol is used in regular objects before trying to exporrt its dependences, ensuring the case above doesn't crash the linker.
Author
Parents
Loading