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

--- Comment #14 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #13)
> (In reply to Michael Matz from comment #11)
> 
> > access to the respective GOT slot).  Upstream binutils now silently do emit 
> > a
> > route via PLT, our binutils complain.  I'm not sure that upstream behaviour
> > is 
> > indeed better.
> 
> PLT32 relocation is used by ld to distinguish call/jump vs other PC relative
> accesses.  Linker allocates a PLT slot only if it is needed.  If it isn't the
> case, please open a binutils bug report.

I'm aware of that, and that's fine.  I don't think there's a binutils
bug per se here.  Older binutils simply always used a PC32 reloc for naked
symbol
refs, and newer binutils use a PLT32 reloc when the context of the naked
reference is a call instruction.  (Older binutils then sometimes would have to
allocate a PLT slot even when not strictly necessary).

If anything, then binutils could become even _more_ strict, and simply not
invent
any specific PIC-related relocation at all for undecorated symbols, but that
discussion is for another time and a different bug tracker :-)

In this specific case the bug lies within GCC in emitting a naked symbol ref
under -fPIC.

Reply via email to