[lld] [llvm] IRSymTab: Record _GLOBAL_OFFSET_TABLE_ for ELF x86 (PR #89463)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 19:24:48 PDT 2024


MaskRay wrote:

We want the symbol table to be complete before `compileBitcodeFiles<ELFT>(skipLinkedOutput);`. In the false positive cases, `_GLOBAL_OFFSET_TABLE_` was not in the symbol table, so lld did not know the symbol would later be used by generated relocatable files. This cannot be fixed by reordering some passes in the linker.

This could be solved by making the linker try probing `_GLOBAL_OFFSET_TABLE_` after LTO compilation, but it doesn't feel right to me...

For runtime library symbols, ideally we the solution should be in LLVMLTO instead of linkers. However, given that we have to be very conservative, that'd cause a lot of overhead in bitcode files, so we accepted to workaround in linkers.

https://github.com/llvm/llvm-project/pull/89463


More information about the llvm-commits mailing list