[PATCH] x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

Sunil Pandey skpgkp2@gmail.com
Thu Jul 14 00:06:12 GMT 2022


On Thu, May 26, 2022 at 2:00 PM H.J. Lu via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Wed, May 25, 2022 at 1:24 PM Fangrui Song <maskray@google.com> wrote:
> >
> > On 2022-05-25, H.J. Lu via Libc-alpha wrote:
> > >On Wed, May 25, 2022 at 11:28 AM Adhemerval Zanella via Libc-alpha
> > ><libc-alpha@sourceware.org> wrote:
> > >>
> > >>
> > >>
> > >> On 25/05/2022 15:19, Florian Weimer via Libc-alpha wrote:
> > >> > * H. J. Lu:
> > >> >
> > >> >> Linker always sets r_addend to 0 for R_X86_64_GLOB_DAT and
> > >> >> R_X86_64_JUMP_SLOT.
> > >> >
> > >> > Okay, so it's very unlikely that we see non-zero addends.
> > >> > Maybe you can add this to the commit message?
> > >> >
> > >> > Given that, I think the change should be safe.
> > >> >
> > >> > Thanks,
> > >> > Florian
> > >> >
> > >>
> > >> Maybe assert that r_addend is always zero?
> > >
> > >I don't think it is necessary since r_addend has never been non-zero.
> >
> > I agree that an assert is unnecessary. Linkers just guarantee zero
> > addends.
> >
> > It seems that by omitting reloc->r_addend, the GCC generated assembler
> > is slightly shorter. I've tried placing GLOB_DAT/JUMP_SLOT near 64
> > and don't get simplified assembly.
> >
> > Reviewed-by: Fangrui Song <maskray@google.com>
>
> Here is the patch I am checking in.
>
> Thanks.
>
> --
> H.J.

I would like to backport this patch to release branches.
Any comments or objections?

--Sunil


More information about the Libc-alpha mailing list