[PATCH] i386: Issue an error for baseless @GOT relocation with relaxation

H.J. Lu hjl.tools@gmail.com
Mon Oct 27 09:31:09 GMT 2025


On Mon, Oct 27, 2025 at 4:41 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 26.10.2025 00:28, H.J. Lu wrote:
> > When -mrelax-relocations=no is used, don't generate baseless R_386_GOT32X
> > relocation.  Issue an error instead.
> >
> > PR gas/33552
> > * config/tc-i386.c (output_disp): Issue an error for baseless @GOT
> > relocation without relaxation in 32-bit.
> > * testsuite/gas/i386/got-no-relax-error.l: New file.
> > * testsuite/gas/i386/got-no-relax-error.s: Likewise.
> > * testsuite/gas/i386/got-no-relax.d: Don't use got.s.  Remove
> > R_386_GOT32X entries.
> > * testsuite/gas/i386/i386.exp: Run got-no-relax-error.
> >
>
> Please can you add a reference to the part of the spec that puts in place
> this restriction?
>

It is more of an ISA restriction.  In i386 psABI, there are 2 kinds of PLTs,
one with EBX for PIC and the other without EBX for non-PIC.  The baseless
@GOT reloc can only be used with non-PIC PLT.

-- 
H.J.


More information about the Binutils mailing list