[PATCH] D85782: [X86][ELF] Prefer lowering MC_GlobalAddress operands to .Lfoo$local only for STV_DEFAULT globals

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 01:35:52 PDT 2020


skan added a comment.

In D85782#2236493 <https://reviews.llvm.org/D85782#2236493>, @MaskRay wrote:

> Longer answer:
>
> binutils 2.26 introduced a regression: R_X86_64_PC32 can no longer be used against a protected symbol https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=ca3fe95e469b9daec153caa2c90665f5daaec2b5
>
> The original issue is "Copy relocation against protected symbol doesn't work".
> I agree with Rich Felker (https://gcc.gnu.org/ml/gcc/2016-04/msg00168.html) and
> Cary Coutant (https://sourceware.org/ml/binutils/2016-03/msg00407.html https://gcc.gnu.org/ml/gcc/2016-04/msg00158.html https://gcc.gnu.org/ml/gcc/2016-04/msg00169.html) that we should
> keep using direct access against protected symbols and disallow copy relocations against protected symbols.
>
> I appreciate that Cary Coutant and Rafael Ávila de Espíndola added diagnostics to gold and lld, respectively:
>
> - gold (https://sourceware.org/bugzilla/show_bug.cgi?id=19823)
> - lld (https://bugs.llvm.org/show_bug.cgi?id=31476)
>
> @skan Perhaps you are in a good position to change the resolutions to the following issues:)
>
> GCC 5 x86-64 introduced a regression (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248) I suggested a fix in May, 2019: https://sourceware.org/pipermail/gcc/2019-May/229309.html
> i386 was flagged as a reproduce (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55012)
>
>   __attribute__((visibility("protected"))) int a;
>   int foo() { return a; } // GCC>=5 uses R_X86_64_GOTPCREL/R_X86_64_REX_GOTPCRELX instead of R_X86_64_PC32
>
> binutils 2.26 introduced a regression R_X86_64_PC32 can no longer be used against a protected symbol https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=ca3fe95e469b9daec153caa2c90665f5daaec2b5

Thanks, this information is helpful to me.   @MaskRay  What's resolution do you want me to change? Change the relocation type for protected symbol from R_X86_64_PC32 to R_X86_64_GOTPCREL/R_X86_64_REX_GOTPCRELX?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85782



More information about the llvm-commits mailing list