[PATCH] D54145: [ELF] - Fix R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX when target is IFUNC.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 22:49:16 PST 2020
MaskRay added subscribers: markj, MaskRay.
MaskRay added a comment.
@grimar D57371 <https://reviews.llvm.org/D57371> fixed the "R_X86_64_REX_GOTPCRELX referencing ifunc should not be relaxed" bug, via the following line:
> if (!Sym.IsPreemptible && !Sym.isGnuIFunc()) {
`Target::adjustRelaxExpr` is not called for a non-preemptible ifunc. I think this patch is not needed.
`clang -fuse-ld=lld -Wa,-mrelax-relocations=yes a.c b.c -fPIC -static -o a`
I know one issue, which is unrelated to this patch: `config->hasDynSymTab = !sharedFiles.empty() || config->isPic || config->exportDynamic;`
This condition does not take dynamic relocations into account.
So, `clang -fuse-ld=lld -Wa,-mrelax-relocations=yes a.c b.c -fPIC -static -o a -z ifunc-noplt -z notext` does not generate a dynamic R_X86_64_REX_GOTPCRELX.
Adding `-Wl,--export-dynamic` will produce a dynamic R_X86_64_REX_GOTPCRELX.
`config->hasDynSymTab` can affect `Symbol::includeInDynSym`, which can be called before Writer. So I don't know an easy fix.
@markj
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54145/new/
https://reviews.llvm.org/D54145
More information about the llvm-commits
mailing list