binutils-gdb/ld/testsuite
H.J. Lu 9167304255 elf: Add elf_backend_add_glibc_version_dependency
When -z mark-plt 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 which don't have this commit in glibc 2.36:

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.
Although this commit has been backported to glibc 2.33/2.34/2.35 release
branches, it is safer to require glibc 2.36 for such binaries.

Extend the glibc version dependency of GLIBC_ABI_DT_RELR for DT_RELR to
also add GLIBC_2.36 version dependency for -z mark-plt on the shared C
library if it provides a GLIBC_2.XX symbol version.

	* elflink.c (elf_find_verdep_info): Moved to ...
	* elf-bfd.h (elf_find_verdep_info): Here.
	(elf_backend_data): Add elf_backend_add_glibc_version_dependency.
	(_bfd_elf_link_add_glibc_version_dependency): New function.
	(_bfd_elf_link_add_dt_relr_dependency): Likewise.
	* elf64-x86-64.c (elf_x86_64_add_glibc_version_dependency):
	Likewise.
	(elf_backend_add_glibc_version_dependency): New.
	* elflink.c (elf_link_add_dt_relr_dependency): Renamed to ...
	(elf_link_add_glibc_verneed): This.  Modified to support other
	glibc dependencies.
	(_bfd_elf_link_add_glibc_version_dependency): Likewise.
	(_bfd_elf_link_add_dt_relr_dependency): Likewise.
	(bfd_elf_size_dynamic_sections): Call
	elf_backend_add_glibc_version_dependency instead of
	elf_link_add_dt_relr_dependency.
	* elfxx-target.h (elf_backend_add_glibc_version_dependency): New.
	(elfNN_bed): Add elf_backend_add_glibc_version_dependency.

ld/

	* testsuite/ld-x86-64/mark-plt-1a.rd: New file.
	* testsuite/ld-x86-64/mark-plt-1b.rd: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run -z mark-plt test for
	GLIBC_2.36 dependency.
2024-01-09 06:45:38 -08:00
..
config Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-aarch64 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-alpha Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-arc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-arm Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-auto-import Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-avr Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-bootstrap Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-bpf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-cdtest Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-checks Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-cris Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-crx Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-csky
ld-ctf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-cygwin Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-d10v Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-discard Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-dynamic Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-elf ld: Adjust x86 and x86-64 tests for -z mark-plt 2024-01-06 07:10:15 -08:00
ld-elfcomm Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-elfvers Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-elfweak Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-fastcall Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-frv Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-gc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-h8300 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-i386 x86: Don't check R_386_NONE nor R_X86_64_NONE 2024-01-09 06:39:42 -08:00
ld-ia64 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-ifunc ld: Adjust x86 and x86-64 tests for -z mark-plt 2024-01-06 07:10:15 -08:00
ld-kvx Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-libs Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-linkonce Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-loongarch-elf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-m68hc11 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-m68k Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-mep Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-metag Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-mips-elf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-misc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-mmix Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-mn10300 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-msp430-elf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-nds32 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-nios2
ld-or1k Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-pdp11 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-pe Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-pie Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-plugin Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-powerpc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-pru
ld-riscv-elf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-s12z Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-s390 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-scripts Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-selective Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-sframe Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-sh Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-shared Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-size Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-sparc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-spu Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-srec Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-tic6x Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-tilegx Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-tilepro Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-undefined Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-unique Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-v850 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-vax-elf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-visium Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-vsb Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-vxworks Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-x86-64 elf: Add elf_backend_add_glibc_version_dependency 2024-01-09 06:45:38 -08:00
ld-xstormy16 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-xtensa Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-z8k Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ld-z80 Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
lib Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303