[PATCH] D65995: [ELF] Don't special case symbolic relocations with 0 addend to ifunc in writable locations
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 9 00:23:21 PDT 2019
MaskRay added a comment.
In D65995#1622445 <https://reviews.llvm.org/D65995#1622445>, @ruiu wrote:
> > Currently the following 3 relocation types do not trigger the creation of a canonical PLT:
> >
> > - GOT-generating
> > - PLT-generating
> > - symbolic relocation with 0 addend in a writable location
>
> Is it a typo that a PLT-generating relocation do *not* trigger the creation a canonical PLT, or am I missing something?
It isn't a typo. The creation of a canonical PLT refers to this piece of code:
} else if (!needsPlt(expr)) {
// Make the ifunc's PLT entry canonical by changing the value of its
// symbol to redirect all references to point to it.
unsigned entryOffset = sym.pltIndex * target->pltEntrySize;
if (config->zRetpolineplt)
entryOffset += target->pltHeaderSize;
auto &d = cast<Defined>(sym);
d.section = in.iplt;
d.value = entryOffset;
d.size = 0;
// It's important to set the symbol type here so that dynamic loaders
// don't try to call the PLT as if it were an ifunc resolver.
d.type = STT_FUNC;
It changes the type from STT_GNU_IFUNC to STT_FUNC.
If a non-preemptable ifunc just has PLT-generating and GOT-generating relocations. The type doesn't need a change.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65995/new/
https://reviews.llvm.org/D65995
More information about the llvm-commits
mailing list