]> git.ipfire.org Git - thirdparty/glibc.git/commit
x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212] release/2.37/master
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 14 Aug 2025 14:03:20 +0000 (07:03 -0700)
committerSam James <sam@gentoo.org>
Fri, 15 Aug 2025 22:19:27 +0000 (23:19 +0100)
commitdf5072615e9fb1c6dfd06bd35f20f28d1ac2808d
treeee06e41c5ed92b862c8dd95ded8d9aab859ebf01
parentd0d5736bbb918acd86eaaed5549dfb4cc2409e3d
x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]

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.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 399384e0c8193e31aea014220ccfa24300ae5938)
sysdeps/x86_64/Makefile
sysdeps/x86_64/Versions