[PATCH] i386: Allow GOT32 relocations against ABS symbols

H.J. Lu hjl.tools@gmail.com
Tue Feb 8 13:02:47 GMT 2022


On Tue, Feb 8, 2022 at 12:37 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 08.02.2022 01:03, H.J. Lu via Binutils wrote:
> > GOT32 relocations are allowed since absolute value + addend is stored in
> > the GOT slot.
>
> Before permitting this and with you specifically mentioning addends
> here, I think it needs to be clarified what ...
>
> > --- /dev/null
> > +++ b/ld/testsuite/ld-i386/pr28870.s
> > @@ -0,0 +1,6 @@
> > +     .text
> > +     .globl _start
> > +_start:
> > +     addl    foo@GOT(%ebx), %eax
> > +     cmpl    $0, foo@GOT(%ebx)
> > +foo = 2
>
> ... missing (here) variants thereof actually mean (and whether the use
> of addends actually works as intended):
>
>         mov     $v@got+3, %eax                          # bogus, meaningless operand
>         mov     $(v+3)@got, %eax                        # wrong (gets treated same as above)
>
> Comments are my own, preliminary judgement.

GOT relocations should only be used as @got or @got(%reg).
Other variants are undefined.

-- 
H.J.


More information about the Binutils mailing list