[Bug target/94391] gcc refers to absolute symbols with R_X86_64_PC32 relocation

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 30 20:15:32 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94391

--- Comment #16 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Yuxuan Shui from comment #15)
> Your code is going to dereference the value stored in the ABS symbol as an
> address (e.g. if the symbol has value 10, your code will access (*(char
> *)10), barring the unwanted relocation), which is not the intention here.

This works in all cases:

unsigned long
size2 (void)
{
  return ((unsigned long) &_binary_a_c_end
          - (unsigned long) &_binary_a_c_start);
}


More information about the Gcc-bugs mailing list