Go to file
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
bfd elf: Add elf_backend_add_glibc_version_dependency 2024-01-09 06:45:38 -08:00
binutils MAINTAINERS: Update my email address 2024-01-08 18:55:03 +00:00
config libiberty: Disable hwcaps for sha1.o 2023-11-30 10:14:30 +01:00
contrib
cpu sim: cris: change temp var name slightly to avoid shadowing 2024-01-06 23:30:43 -05:00
elfcpp Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
etc Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
gas x86: add missing APX logic to cpu_flags_match() 2024-01-09 13:50:27 +01:00
gdb Use unrelocated_addr in dwarf2_base_index_functions::find_per_cu 2024-01-09 06:58:51 -07:00
gdbserver Fix two bugs in gdbserver thread name handling 2024-01-09 07:07:41 -07:00
gdbsupport Back out some parallel_for_each features 2024-01-08 18:40:22 -07:00
gnulib gnulib: mark configure +x 2023-11-28 12:55:29 -05:00
gold Enforce C++11 as a minimum for building gold [PR30867] 2024-01-05 13:00:11 +10:30
gprof Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
gprofng Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
include Synchronize sourceware version of the libiberty sources with the master gcc versions. 2024-01-09 12:34:00 +00:00
ld elf: Add elf_backend_add_glibc_version_dependency 2024-01-09 06:45:38 -08:00
libbacktrace
libctf Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
libdecnumber
libiberty Synchronize sourceware version of the libiberty sources with the master gcc versions. 2024-01-09 12:34:00 +00:00
libsframe Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
opcodes x86: add missing APX logic to cpu_flags_match() 2024-01-09 13:50:27 +01:00
readline
sim sim: warnings: compile build tools with -Werror too 2024-01-08 21:36:44 -05:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ar-lib
ChangeLog Finalized intl-update patches 2023-11-15 12:53:04 +00:00
compile
config-ml.in
config.guess Synchronize config.sub and config.guess with their upstream master versions. 2024-01-04 12:00:34 +00:00
config.rpath
config.sub Synchronize config.sub and config.guess with their upstream master versions. 2024-01-04 12:00:34 +00:00
configure Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure.ac Finalized intl-update patches 2023-11-15 12:53:04 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def gettext: disable install, docs targets, libasprintf, threads 2023-12-18 09:39:17 -07:00
Makefile.in gettext: disable install, docs targets, libasprintf, threads 2023-12-18 09:39:17 -07:00
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
SECURITY.txt
setup.com
src-release.sh Finalized intl-update patches 2023-11-15 12:53:04 +00:00
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.