https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100593
--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Thanks. I agree that inferring address significance on the linker side is
problematic.
Thinking about your original request, I was about to say that it would be very
reasonable to do under -fno-plt flag, but then I found it was already
implemented for x86-64 in gcc-7 and for 32-bit x86 in gcc-8. Compiling
int f();
void *g()
{
return f;
}
with -fno-pic -fno-plt yields
g:
movq f@GOTPCREL(%rip), %rax
ret
(yields GOTPCRELX relocation) and
g:
movl f@GOT, %eax
ret
on 32-bit (yields GOT32X relocation), so on x86 it's already implemented?