[PATCH] D54145: [ELF] - Fix R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX when target is IFUNC.

Mark Johnston via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 08:09:03 PST 2020


markj added a comment.

In D54145#1868678 <https://reviews.llvm.org/D54145#1868678>, @MaskRay wrote:

> 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.


I can't see an easy solution other than to further constrain the use of -zifunc-noplt to require !-static || --export-dynamic. This would be fine for FreeBSD's use of the option.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54145/new/

https://reviews.llvm.org/D54145





More information about the llvm-commits mailing list