[PATCH] x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]

H.J. Lu hjl.tools@gmail.com
Thu Aug 14 14:05:03 GMT 2025


On Thu, Aug 14, 2025 at 6:19 AM Sam James <sam@gentoo.org> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > When the linker -z mark-plt option is used to add DT_X86_64_PLT,
> > DT_X86_64_PLTSZ and DT_X86_64_PLTENT, the r_addend field of the
> > R_X86_64_JUMP_SLOT relocation stores the offset of the indirect
> > branch instruction.  However, glibc versions without the commit:
> >
> > commit f8587a61892cbafd98ce599131bf4f103466f084
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date:   Fri May 20 19:21:48 2022 -0700
> >
> >     x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
> >
> >     According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
> >     and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
> >     can ignore their r_addends.
> >
> >     Reviewed-by: Fangrui Song <maskray@google.com>
> >
> > won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
> > Such programs and shared libraries will fail at run-time randomly.
> >
> > Add GLIBC_ABI_DT_X86_64_PLT version to indicate that glibc is compatible
> > with DT_X86_64_PLT.
> >
> > The linker can add the glibc GLIBC_ABI_DT_X86_64_PLT version dependency
> > whenever -z mark-plt is passed to the linker.  The resulting programs and
> > shared libraries will fail to load at run-time against libc.so without the
> > GLIBC_ABI_DT_X86_64_PLT version, instead of fail randomly.
> >
> > This fixes BZ #33212.
> >
>
> Sorry, I thought this had landed. It both looks good to me and Carlos
> acked it on the bug too.
>
> Reviewed-by: Sam James <sam@gentoo.org>

This is the rebased patch I am checking in.

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-64-Add-GLIBC_ABI_DT_X86_64_PLT-BZ-33212.patch
Type: text/x-patch
Size: 2902 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250814/479c8544/attachment.bin>


More information about the Libc-alpha mailing list