[llvm-branch-commits] MC: Emit symbols for R_X86_64_PLT32 relocation pointing to symbols with non-zero values. (PR #138795)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 8 01:06:17 PDT 2025
MaskRay wrote:
> The alternative fix, which I think I'm now leaning towards, would be to change how the branch-to-branch optimization handles relocations to STT_SECTION symbols. A relocation pointing to the STT_SECTION for .text with addend 1 would be treated as a branch to .text+5 and it would be invalid to assemble a relative vtable relocation that points to STT_SECTION. It would also be consistent with how we process relocations for string tail merging and ICF among other places, e.g. [here](https://github.com/llvm/llvm-project/blob/8602a655a8150753542b0237fcca16d9ee1cd981/lld/ELF/ICF.cpp#L304). The downside is that it adds another special case for STT_SECTION but I guess that's fine.
Thanks for the explanation. I haven't read through the lld branch-to-branch optimization patch. However, I agree that adding a special case for STT_SECTION to the linker might be the right solution. Changing the assembler regarding PLT32 looks fishy.
https://github.com/llvm/llvm-project/pull/138795
More information about the llvm-branch-commits
mailing list