https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94391
--- Comment #15 from Yuxuan Shui <yshuiv7 at gmail dot com> --- (In reply to H.J. Lu from comment #12) > (In reply to Yuxuan Shui from comment #11) > > (In reply to Andrew Pinski from comment #8) > > > Also it is wrong for a person to assume a normal C variable could be > > > SHN_ABS; that is the bug here. It is a bug in the user code. > > > I showed up to fix it by using an top level inline-asm. > > > > Why is this wrong? Is it written down somewhere that a C variable can never > > be SHN_ABS, perhaps in the standard, or in the X86-psABI? > > > > If this is wrong, then what is the correct way to access a SHN_ABS symbol? > > Is it just no way to do it? If so, what's the purpose of objcopy generating > > such symbols? > > Have you tried my way with ld? Lld bug is a different issue. 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.