[llvm-branch-commits] MC: Emit symbols for R_X86_64_PLT32 relocation pointing to symbols with non-zero values. (PR #138795)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 6 21:10:06 PDT 2025
pcc wrote:
With relative vtables we have
```
.4byte foo at plt - .
```
This becomes a PLT32 pointing to foo with addend 0. This should not be treated as a branch to foo+4 if a PLT/thunk is needed.
We can also have
```
.section .text.a,"ax", at progbits
jmp .Lfoo
.text
nop
nop
nop
nop
.Lfoo:
ret
```
With the current implementation that creates a PLT32 with addend 0 for branching to .text+4 this is not distinguishable from the relative vtable case except via SHF_EXECINSTR or STT_SECTION on the target symbol. Since we generally want relocation processing to be independent of this kind of context, I think the right way to reconcile these two cases is that a PLT32 can only be treated as a reference to the symbol itself. GNU as already does this and this change makes MC do the same.
https://github.com/llvm/llvm-project/pull/138795
More information about the llvm-branch-commits
mailing list