diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-01-05 19:21:45 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-01-12 06:08:47 -0800 |
commit | 72aa81732b3aff00e5bf1f69bb794513b3b37464 (patch) | |
tree | 13cdfb51891320c3ff5b56652c50b499e2617c3c /ld/ld.texi | |
parent | 4d9e2e53b9f93b0ae33ba948ae3d2825b3424441 (diff) | |
download | gdb-72aa81732b3aff00e5bf1f69bb794513b3b37464.zip gdb-72aa81732b3aff00e5bf1f69bb794513b3b37464.tar.gz gdb-72aa81732b3aff00e5bf1f69bb794513b3b37464.tar.bz2 |
ld: Add glibc dependency for DT_RELR
When DT_RELR is enabled, to avoid random run-time crash with older glibc
binaries without DT_RELR support, add a GLIBC_ABI_DT_RELR symbol version,
which is provided by glibc with DT_RELR support, dependency on the shared
C library if it provides a GLIBC_2.XX symbol version.
bfd/
* elflink.c (elf_link_add_dt_relr_dependency): New function.
(bfd_elf_size_dynamic_sections): Call
elf_link_add_dt_relr_dependency if DT_RELR is enabled.
ld/
* ld.texi: Mention GLIBC_ABI_DT_RELR in -z pack-relative-relocs
entry.
* testsuite/ld-elf/dt-relr-glibc-1.c: New file.
* testsuite/ld-elf/dt-relr-glibc-1a.rd: Likewise.
* testsuite/ld-elf/dt-relr-glibc-1b.rd: Likewise.
* testsuite/ld-elf/dt-relr.exp: Likewise.
Diffstat (limited to 'ld/ld.texi')
-rw-r--r-- | ld/ld.texi | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1437,7 +1437,9 @@ and shared library. It adds @code{DT_RELR}, @code{DT_RELRSZ} and @code{DT_RELRENT} entries to the dynamic section. It is ignored when building position-dependent executable and relocatable output. @option{nopack-relative-relocs} is the default, which disables compact -relative relocation. Supported for i386 and x86-64. +relative relocation. When linked against the GNU C Library, a +GLIBC_ABI_DT_RELR symbol version dependency on the shared C Library is +added to the output. Supported for i386 and x86-64. @item relro @itemx norelro |