[Bug target/106834] GCC creates R_X86_64_GOTOFF64 for 4-bytes immediate
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 6 17:53:18 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106834
--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
We can't use
movq _GLOBAL_OFFSET_TABLE_@GOTPCREL(%rip), %rax
to get the address of _GLOBAL_OFFSET_TABLE_ since there is no entry for
_GLOBAL_OFFSET_TABLE_ in GOT. We can't use
movl $_GLOBAL_OFFSET_TABLE_, %eax
either since it generates R_X86_64_GOTPC32 relocation. The reliable way to get
the address of _GLOBAL_OFFSET_TABLE_ is to use
leaq _GLOBAL_OFFSET_TABLE_(%rip), %rsi
More information about the Gcc-bugs
mailing list