[X86] Don't emit R_X86_64_[REX_]GOTPCRELX for a GOT load with an offset
clang may produce `movl x@GOTPCREL+4(%rip), %eax` when loading the high 32 bits of the address of a global variable in -fpic/-fpie mode. If assembled by GNU as, the fixup emits R_X86_64_GOTPCRELX with an addend != -4. The instruction loads from the GOT entry with an offset and thus it is incorrect to relax the instruction. This patch does not emit a relaxable relocation for a GOT load with an offset because R_X86_64_[REX_]GOTPCRELX do not make sense for instructions which cannot be relaxed. The result is good enough for LLD to work. GNU ld relaxes mov+GOTPCREL as well, but it suppresses the relaxation if addend != -4. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D92114
Loading
Please sign in to comment