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

yshuiv7 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 30 23:27:33 GMT 2020


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

--- Comment #17 from Yuxuan Shui <yshuiv7 at gmail dot com> ---
(In reply to H.J. Lu from comment #16)
> (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);
> }

Sorry, I am here to report a bug, not to find a workaround for my use case.


More information about the Gcc-bugs mailing list