aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog45
-rw-r--r--ld/Makefile.am3
-rw-r--r--ld/Makefile.in6
-rw-r--r--ld/NEWS11
-rw-r--r--ld/config.in8
-rwxr-xr-xld/configure53
-rw-r--r--ld/configure.ac38
-rw-r--r--ld/configure.tgt5
-rw-r--r--ld/emulparams/aarch64cloudabi.sh37
-rw-r--r--ld/emulparams/aarch64cloudabib.sh2
-rw-r--r--ld/emulparams/elf32_x86_64.sh4
-rw-r--r--ld/emulparams/elf64_sparc.sh10
-rw-r--r--ld/emulparams/elf64_sparc_sol2.sh1
-rw-r--r--ld/emulparams/elf_i386.sh4
-rw-r--r--ld/emulparams/elf_i386_fbsd.sh1
-rw-r--r--ld/emulparams/elf_i386_haiku.sh1
-rw-r--r--ld/emulparams/elf_x86_64.sh4
-rw-r--r--ld/emulparams/elf_x86_64_cloudabi.sh2
-rw-r--r--ld/emulparams/elf_x86_64_fbsd.sh1
-rw-r--r--ld/emulparams/elf_x86_64_haiku.sh1
-rw-r--r--ld/emultempl/elf-i386-glibc.em77
-rw-r--r--ld/emultempl/elf-x86-64-glibc.em37
-rw-r--r--ld/emultempl/elf-x86-64.em68
-rw-r--r--ld/emultempl/elf-x86-glibc.em70
-rw-r--r--ld/emultempl/elf-x86.em58
-rw-r--r--ld/emultempl/solaris2-x86-64.em23
-rw-r--r--ld/emultempl/solaris2.em5
-rw-r--r--ld/ld.texi28
-rw-r--r--ld/ldfile.c82
-rw-r--r--ld/ldlang.c107
-rw-r--r--ld/ldlang.h2
-rw-r--r--ld/ldlex.h8
-rw-r--r--ld/ldmain.c8
-rw-r--r--ld/lexsup.c27
-rw-r--r--ld/libdep_plugin.c2
-rw-r--r--ld/pe-dll.c13
-rw-r--r--ld/plugin.c2
-rw-r--r--ld/po/BLD-POTFILES.in3
-rw-r--r--ld/scripttempl/elf.sc2
-rw-r--r--ld/testplug.c2
-rw-r--r--ld/testplug2.c2
-rw-r--r--ld/testplug3.c2
-rw-r--r--ld/testplug4.c2
-rw-r--r--ld/testsuite/config/default.exp15
-rw-r--r--ld/testsuite/ld-aarch64/protections/bti-far.ld2
-rw-r--r--ld/testsuite/ld-aarch64/protections/bti-plt.ld2
-rw-r--r--ld/testsuite/ld-cris/tls-local-63.d9
-rw-r--r--ld/testsuite/ld-cris/tls-local-64.d9
-rw-r--r--ld/testsuite/ld-cris/tls-und-38.d5
-rw-r--r--ld/testsuite/ld-cris/tls-und-42.d5
-rw-r--r--ld/testsuite/ld-cris/tls-und-46.d5
-rw-r--r--ld/testsuite/ld-cris/tls-und-50.d5
-rw-r--r--ld/testsuite/ld-cris/weakref3.d4
-rw-r--r--ld/testsuite/ld-cris/weakref4.d4
-rw-r--r--ld/testsuite/ld-ctf/ctf.exp7
-rw-r--r--ld/testsuite/ld-elf/dwarf.exp6
-rw-r--r--ld/testsuite/ld-elf/elf.exp43
-rw-r--r--ld/testsuite/ld-elf/gnu_execstack.err3
-rw-r--r--ld/testsuite/ld-elf/linux-x86.exp14
-rw-r--r--ld/testsuite/ld-elf/missing-execstack.err3
-rw-r--r--ld/testsuite/ld-elf/pr33291.d9
-rw-r--r--ld/testsuite/ld-elf/pr33291a.s8
-rw-r--r--ld/testsuite/ld-elf/pr33291b.s7
-rw-r--r--ld/testsuite/ld-elf/rwx-segments-3.err3
-rw-r--r--ld/testsuite/ld-elf/rwx-segments-4.err3
-rw-r--r--ld/testsuite/ld-elf/shared.exp12
-rw-r--r--ld/testsuite/ld-elf/z_execstack.err4
-rw-r--r--ld/testsuite/ld-elfvers/vers.exp19
-rw-r--r--ld/testsuite/ld-i386/binutils.exp45
-rw-r--r--ld/testsuite/ld-i386/dt-relr-1c.d26
-rw-r--r--ld/testsuite/ld-i386/dt-relr-1d.d26
-rw-r--r--ld/testsuite/ld-i386/export-class.exp15
-rw-r--r--ld/testsuite/ld-i386/gnu-tls-1.s9
-rw-r--r--ld/testsuite/ld-i386/gnu-tls-1a.rd7
-rw-r--r--ld/testsuite/ld-i386/gnu-tls-1b.rd4
-rw-r--r--ld/testsuite/ld-i386/gnu2-tls-1.s11
-rw-r--r--ld/testsuite/ld-i386/gnu2-tls-1a.rd7
-rw-r--r--ld/testsuite/ld-i386/gnu2-tls-1b.rd4
-rw-r--r--ld/testsuite/ld-i386/got-1.s7
-rw-r--r--ld/testsuite/ld-i386/i386-export-class.rd6
-rw-r--r--ld/testsuite/ld-i386/i386-export-class.xd6
-rw-r--r--ld/testsuite/ld-i386/i386.exp75
-rw-r--r--ld/testsuite/ld-i386/libgot-1a.rd9
-rw-r--r--ld/testsuite/ld-i386/libgot-1b.rd119
-rw-r--r--ld/testsuite/ld-i386/libgot-1c.rd12
-rw-r--r--ld/testsuite/ld-i386/libgot-1d.rd12
-rw-r--r--ld/testsuite/ld-i386/libno-plt-1b.dd4
-rw-r--r--ld/testsuite/ld-i386/no-plt-1a.dd6
-rw-r--r--ld/testsuite/ld-i386/no-plt-1b.dd14
-rw-r--r--ld/testsuite/ld-i386/no-plt-1c.dd10
-rw-r--r--ld/testsuite/ld-i386/no-plt-1e.dd6
-rw-r--r--ld/testsuite/ld-i386/no-plt-1f.dd14
-rw-r--r--ld/testsuite/ld-i386/no-plt-1g.dd12
-rw-r--r--ld/testsuite/ld-i386/no-plt.exp40
-rw-r--r--ld/testsuite/ld-i386/pr17057.d7
-rw-r--r--ld/testsuite/ld-i386/pr28387.d35
-rw-r--r--ld/testsuite/ld-i386/pr28387.s12
-rw-r--r--ld/testsuite/ld-i386/pr33260-2.d6
-rw-r--r--ld/testsuite/ld-i386/pr33260-2.s30
-rw-r--r--ld/testsuite/ld-i386/pr33260.d9
-rw-r--r--ld/testsuite/ld-i386/pr33260.s46
-rw-r--r--ld/testsuite/ld-i386/tlsdesc.rd106
-rw-r--r--ld/testsuite/ld-i386/tlsdesc2.d3
-rw-r--r--ld/testsuite/ld-i386/tlsgdesc.rd8
-rw-r--r--ld/testsuite/ld-ifunc/ifunc.exp9
-rw-r--r--ld/testsuite/ld-loongarch-elf/pic.exp30
-rw-r--r--ld/testsuite/ld-pe/pe-aarch64.d2
-rw-r--r--ld/testsuite/ld-pe/pe-aarch64.s5
-rw-r--r--ld/testsuite/ld-plugin/lto-binutils.exp36
-rw-r--r--ld/testsuite/ld-plugin/plugin.exp10
-rw-r--r--ld/testsuite/ld-plugin/strip-1a-s-all.nd5
-rw-r--r--ld/testsuite/ld-scripts/libpr33265-1.a1
-rw-r--r--ld/testsuite/ld-scripts/libpr33265-2.a1
-rw-r--r--ld/testsuite/ld-scripts/libpr33265-3a.a1
-rw-r--r--ld/testsuite/ld-scripts/libpr33265-3b.a1
-rw-r--r--ld/testsuite/ld-scripts/libpr33265-3c.a1
-rw-r--r--ld/testsuite/ld-scripts/pr24576-1.d3
-rw-r--r--ld/testsuite/ld-scripts/pr24576-2.d3
-rw-r--r--ld/testsuite/ld-scripts/pr33265-1.d3
-rw-r--r--ld/testsuite/ld-scripts/pr33265-2.d3
-rw-r--r--ld/testsuite/ld-scripts/pr33265-3.d3
-rw-r--r--ld/testsuite/ld-scripts/script.exp6
-rw-r--r--ld/testsuite/ld-shared/shared.exp35
-rw-r--r--ld/testsuite/ld-srec/srec.exp31
-rw-r--r--ld/testsuite/ld-vsb/vsb.exp14
-rw-r--r--ld/testsuite/ld-x86-64/binutils.exp59
-rw-r--r--ld/testsuite/ld-x86-64/dt-relr-1c-x32.d26
-rw-r--r--ld/testsuite/ld-x86-64/dt-relr-1c.d26
-rw-r--r--ld/testsuite/ld-x86-64/dt-relr-1d-x32.d26
-rw-r--r--ld/testsuite/ld-x86-64/dt-relr-1d.d26
-rw-r--r--ld/testsuite/ld-x86-64/gnu2-tls-1.s11
-rw-r--r--ld/testsuite/ld-x86-64/gnu2-tls-1a.rd7
-rw-r--r--ld/testsuite/ld-x86-64/gnu2-tls-1b.rd4
-rw-r--r--ld/testsuite/ld-x86-64/got-1.s7
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1a-x32.rd9
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1a.rd9
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1b-x32.rd119
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1b.rd119
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1c-x32.rd12
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1c.rd12
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1d-x32.rd12
-rw-r--r--ld/testsuite/ld-x86-64/libgot-1d.rd12
-rw-r--r--ld/testsuite/ld-x86-64/mark-plt-1a.rd2
-rw-r--r--ld/testsuite/ld-x86-64/mark-plt-2.rd7
-rw-r--r--ld/testsuite/ld-x86-64/mark-plt-2.s13
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1a.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1b.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1c.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1d.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1e.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1f.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-1g.dd5
-rw-r--r--ld/testsuite/ld-x86-64/no-plt-check1.S6
-rw-r--r--ld/testsuite/ld-x86-64/no-plt.exp28
-rw-r--r--ld/testsuite/ld-x86-64/pr28387-x32.d36
-rw-r--r--ld/testsuite/ld-x86-64/pr28387.d35
-rw-r--r--ld/testsuite/ld-x86-64/pr28387.s11
-rw-r--r--ld/testsuite/ld-x86-64/pr33260-2-x32.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr33260-2.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr33260-2.s19
-rw-r--r--ld/testsuite/ld-x86-64/pr33260-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr33260.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr33260.s40
-rw-r--r--ld/testsuite/ld-x86-64/pr33292-x32.d10
-rw-r--r--ld/testsuite/ld-x86-64/pr33292.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr33292.s34
-rw-r--r--ld/testsuite/ld-x86-64/tlsdesc.pd8
-rw-r--r--ld/testsuite/ld-x86-64/tlsdesc.rd141
-rw-r--r--ld/testsuite/ld-x86-64/tlsdesc2.d4
-rw-r--r--ld/testsuite/ld-x86-64/tlsgdesc.rd8
-rw-r--r--ld/testsuite/ld-x86-64/x86-64-64-export-class.rd6
-rw-r--r--ld/testsuite/ld-x86-64/x86-64-x32-export-class.rd6
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp116
-rw-r--r--ld/testsuite/lib/ld-lib.exp28
174 files changed, 2470 insertions, 702 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7b03989..cefb100 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,48 @@
+2025-08-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * emulparams/elf64_sparc.sh (TEXT_START_ADDR): Move ...
+ * emulparams/elf64_sparc_sol2.sh (TEXT_START_ADDR): ... here.
+
+2025-08-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/ld-shared/shared.exp (shared (non PIC)): Update
+ comment. xfail on 64-bit Solaris only.
+ (shared (PIC main, non PIC so)): Likewise.
+ (shared (non PIC, load offset)): Update comment.
+
+2025-08-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/ld-shared/shared.exp: Enable on *-*-solaris2* rather
+ than sparc*-*-solaris2* only.
+
+2025-08-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/ld-elfvers/vers.exp (vers26b3): Mark unsupported on
+ Linux/x86_64 and Solaris/amd64.
+
+2025-08-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * emultempl/solaris2.em (elf_solaris2_before_allocation): Mark
+ global symbols as generated by linker script.
+ * testsuite/ld-elfvers/vers.exp: Enable on *-*-solaris2* rather
+ than sparc*-*-solaris2* only.
+
+2025-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/ld-i386/libno-plt-1b.dd: Allow for positive GOT
+ offsets.
+ * testsuite/ld-i386/no-plt-1a.dd: Likewise.
+ * testsuite/ld-i386/no-plt-1b.dd: Likewise.
+ * testsuite/ld-i386/no-plt-1c.dd: Likewise.
+ * testsuite/ld-i386/no-plt-1e.dd: Likewise.
+ * testsuite/ld-i386/no-plt-1f.dd: Likewise.
+ * testsuite/ld-i386/no-plt-1g.dd: Likewise.
+
+2025-08-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/ld-ctf/ctf.exp (ASFLAGS): Append -Av8plus on
+ sparc-*-*.
+
2025-07-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/ld-elfweak/elfweak.exp: Enable on *-*-solaris2* rather
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 90897a7..c006448 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -373,8 +373,6 @@ ALL_EMULATION_SOURCES = \
ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
- eaarch64cloudabi.c \
- eaarch64cloudabib.c \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elf32b.c \
@@ -457,7 +455,6 @@ ALL_64_EMULATION_SOURCES = \
eelf64tilegx_be.c \
eelf_mipsel_haiku.c \
eelf_x86_64.c \
- eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_haiku.c \
eelf_x86_64_sol2.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index b3d88f0..3e8f287 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -883,8 +883,6 @@ ALL_EMULATION_SOURCES = \
ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
- eaarch64cloudabi.c \
- eaarch64cloudabib.c \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elf32b.c \
@@ -967,7 +965,6 @@ ALL_64_EMULATION_SOURCES = \
eelf64tilegx_be.c \
eelf_mipsel_haiku.c \
eelf_x86_64.c \
- eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_haiku.c \
eelf_x86_64_sol2.c \
@@ -1267,8 +1264,6 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deffilep.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64cloudabi.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64cloudabib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32b.Po@am__quote@
@@ -1482,7 +1477,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
diff --git a/ld/NEWS b/ld/NEWS
index 54c1df5..8794e88 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,16 @@
-*- text -*-
+* Add --gnu-tls-tag/--no-gnu-tls-tag options to i386 ELF linker to add
+ the GLIBC_ABI_GNU_TLS version dependency in output if input object
+ files call ___tls_get_addr. Also added --enable-gnu-tls-tag configure
+ option to enable --gnu-tls-tag by default.
+
+* Add --gnu2-tls-tag/--no-gnu2-tls-tag options to i386 and x86-64 ELF
+ linkers to add the GLIBC_ABI_GNU2_TLS version dependency in output if
+ input object files have R_386_TLS_DESC_CALL or R_X86_64_TLSDESC_CALL
+ relocation. Also added --enable-gnu2-tls-tag configure option to
+ enable --gnu2-tls-tag by default.
+
* NaCl target support is removed.
Changes in 2.45:
diff --git a/ld/config.in b/ld/config.in
index 3781224..790efd3 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -31,6 +31,14 @@
when a .note-GNU-stack section is missing. */
#undef DEFAULT_LD_EXECSTACK
+/* Define to 1 if you want to enable --gnu2-tls-tag in ELF i386/x86-64 linker
+ by default. */
+#undef DEFAULT_LD_GNU2_TLS_TAG
+
+/* Define to 1 if you want to enable --gnu-tls-tag in ELF i386 linker by
+ default. */
+#undef DEFAULT_LD_GNU_TLS_TAG
+
/* Define to 1 if you want to enable --rosegment in the ELF linker by default.
*/
#undef DEFAULT_LD_ROSEGMENT
diff --git a/ld/configure b/ld/configure
index 124b441..fe23178 100755
--- a/ld/configure
+++ b/ld/configure
@@ -851,6 +851,8 @@ enable_textrel_check
enable_separate_code
enable_rosegment
enable_mark_plt
+enable_gnu2_tls_tag
+enable_gnu_tls_tag
enable_memory_seal
enable_warn_execstack
enable_error_execstack
@@ -1548,6 +1550,9 @@ Optional Features:
--enable-separate-code enable -z separate-code in ELF linker by default
--enable-rosegment enable --rosegment in the ELF linker by default
--enable-mark-plt enable -z mark-plt in ELF x86-64 linker by default
+ --enable-gnu2-tls-tag enable --gnu2-tls-tag in ELF i386/x86-64 linker by
+ default
+ --enable-gnu-tls-tag enable --gnu-tls-tag in ELF i386 linker by default
--enable-memory-seal enable -z memory-seal in ELF linker by default
--enable-warn-execstack enable warnings when creating an executable stack
--enable-error-execstack
@@ -11514,7 +11519,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11517 "configure"
+#line 11522 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11620,7 +11625,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11623 "configure"
+#line 11628 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15507,6 +15512,29 @@ esac
fi
+# Decide if --gnu2-tls-tag should be enabled in ELF i386 and x86-64
+# linkers by default.
+ac_default_ld_enable_gnu2_tls_tag=unset
+# Check whether --enable-gnu2-tls-tag was given.
+if test "${enable_gnu2_tls_tag+set}" = set; then :
+ enableval=$enable_gnu2_tls_tag; case "${enableval}" in
+ yes) ac_default_ld_enable_gnu2_tls_tag=1 ;;
+ no) ac_default_ld_enable_gnu2_tls_tag=0 ;;
+esac
+fi
+
+
+# Decide if --gnu-tls-tag should be enabled in ELF i386 linker by default.
+ac_default_ld_enable_gnu_tls_tag=unset
+# Check whether --enable-gnu-tls-tag was given.
+if test "${enable_gnu_tls_tag+set}" = set; then :
+ enableval=$enable_gnu_tls_tag; case "${enableval}" in
+ yes) ac_default_ld_enable_gnu_tls_tag=1 ;;
+ no) ac_default_ld_enable_gnu_tls_tag=0 ;;
+esac
+fi
+
+
# Decide if -z memory-seal should be enabled in ELF linker by default.
ac_default_ld_z_memory_seal=unset
# Check whether --enable-memory-seal was given.
@@ -18981,6 +19009,27 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+if test "${ac_default_ld_enable_gnu2_tls_tag}" = unset; then
+ # Default to enable --gnu2-tls-tag if libc.so has the GLIBC_ABI_GNU2_TLS
+ # version.
+ ac_default_ld_enable_gnu2_tls_tag=2
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LD_GNU2_TLS_TAG $ac_default_ld_enable_gnu2_tls_tag
+_ACEOF
+
+
+if test "${ac_default_ld_enable_gnu_tls_tag}" = unset; then
+ # Default to enable --gnu-tls-tag if libc.so has the GLIBC_ABI_GNU_TLS
+ # version.
+ ac_default_ld_enable_gnu_tls_tag=2
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LD_GNU_TLS_TAG $ac_default_ld_enable_gnu_tls_tag
+_ACEOF
+
cat >>confdefs.h <<_ACEOF
diff --git a/ld/configure.ac b/ld/configure.ac
index e306c1d..3e44e33 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -245,6 +245,27 @@ AC_ARG_ENABLE(mark-plt,
no) ac_default_ld_z_mark_plt=0 ;;
esac])
+# Decide if --gnu2-tls-tag should be enabled in ELF i386 and x86-64
+# linkers by default.
+ac_default_ld_enable_gnu2_tls_tag=unset
+AC_ARG_ENABLE(gnu2-tls-tag,
+ AS_HELP_STRING([--enable-gnu2-tls-tag],
+ [enable --gnu2-tls-tag in ELF i386/x86-64 linker by default]),
+[case "${enableval}" in
+ yes) ac_default_ld_enable_gnu2_tls_tag=1 ;;
+ no) ac_default_ld_enable_gnu2_tls_tag=0 ;;
+esac])
+
+# Decide if --gnu-tls-tag should be enabled in ELF i386 linker by default.
+ac_default_ld_enable_gnu_tls_tag=unset
+AC_ARG_ENABLE(gnu-tls-tag,
+ AS_HELP_STRING([--enable-gnu-tls-tag],
+ [enable --gnu-tls-tag in ELF i386 linker by default]),
+[case "${enableval}" in
+ yes) ac_default_ld_enable_gnu_tls_tag=1 ;;
+ no) ac_default_ld_enable_gnu_tls_tag=0 ;;
+esac])
+
# Decide if -z memory-seal should be enabled in ELF linker by default.
ac_default_ld_z_memory_seal=unset
AC_ARG_ENABLE(memory-seal,
@@ -646,6 +667,23 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_MEMORY_SEAL,
$ac_default_ld_z_memory_seal,
[Define to 1 if you want to enable -z memory_seal in ELF linker by default.])
+if test "${ac_default_ld_enable_gnu2_tls_tag}" = unset; then
+ # Default to enable --gnu2-tls-tag if libc.so has the GLIBC_ABI_GNU2_TLS
+ # version.
+ ac_default_ld_enable_gnu2_tls_tag=2
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_LD_GNU2_TLS_TAG,
+ $ac_default_ld_enable_gnu2_tls_tag,
+ [Define to 1 if you want to enable --gnu2-tls-tag in ELF i386/x86-64 linker by default.])
+
+if test "${ac_default_ld_enable_gnu_tls_tag}" = unset; then
+ # Default to enable --gnu-tls-tag if libc.so has the GLIBC_ABI_GNU_TLS
+ # version.
+ ac_default_ld_enable_gnu_tls_tag=2
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_LD_GNU_TLS_TAG,
+ $ac_default_ld_enable_gnu_tls_tag,
+ [Define to 1 if you want to enable --gnu-tls-tag in ELF i386 linker by default.])
AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_EXECSTACK,
$ac_default_ld_warn_execstack,
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 3f49485..0343010 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -89,9 +89,6 @@ aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
targ_emul=aarch64elf
targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb"
;;
-aarch64-*-cloudabi*) targ_emul=aarch64cloudabi
- targ_extra_emuls=aarch64cloudabib
- ;;
aarch64-*-freebsd*) targ_emul=aarch64fbsd
targ_extra_emuls="aarch64fbsdb aarch64elf"
;;
@@ -992,8 +989,6 @@ visium-*-elf) targ_emul=elf32visium
;;
x86_64-*-rdos*) targ_emul=elf64rdos
;;
-x86_64-*-cloudabi*) targ_emul=elf_x86_64_cloudabi
- ;;
x86_64-*-haiku*) targ_emul=elf_x86_64_haiku
targ_extra_emuls="elf_x86_64 elf_i386_haiku"
;;
diff --git a/ld/emulparams/aarch64cloudabi.sh b/ld/emulparams/aarch64cloudabi.sh
deleted file mode 100644
index 0e6f834..0000000
--- a/ld/emulparams/aarch64cloudabi.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-ARCH=aarch64
-MACHINE=
-NOP=0x1f2003d5
-
-SCRIPT_NAME=elf
-ELFSIZE=64
-OUTPUT_FORMAT="elf64-littleaarch64-cloudabi"
-BIG_OUTPUT_FORMAT="elf64-bigaarch64-cloudabi"
-LITTLE_OUTPUT_FORMAT="elf64-littleaarch64-cloudabi"
-NO_REL_RELOCS=yes
-
-TEMPLATE_NAME=elf
-EXTRA_EM_FILE=aarch64elf
-
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
-
-MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-SEPARATE_GOTPLT=24
-IREL_IN_PLT=
-
-TEXT_START_ADDR=0x400000
-
-DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
-
-# AArch64 does not support .s* sections.
-NO_SMALL_DATA=yes
-
-OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
-OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
-OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
-
-OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
-ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
-# Ensure each PLT entry is aligned to a cache line.
-PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
diff --git a/ld/emulparams/aarch64cloudabib.sh b/ld/emulparams/aarch64cloudabib.sh
deleted file mode 100644
index a7d1b62..0000000
--- a/ld/emulparams/aarch64cloudabib.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-source_sh ${srcdir}/emulparams/aarch64cloudabi.sh
-OUTPUT_FORMAT="elf64-bigaarch64-cloudabi"
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index 6a92eec..8a07f50 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -20,7 +20,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="i386:x64-32"
MACHINE=
TEMPLATE_NAME=elf
-EXTRA_EM_FILE="elf-x86"
+EXTRA_EM_FILE="elf-x86-64-glibc"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
@@ -33,6 +33,8 @@ OTHER_PLT_SECTIONS="
.plt.got ${RELOCATING-0} : { *(.plt.got) }
.plt.sec ${RELOCATING-0} : { *(.plt.sec) }
"
+OTHER_GOT_RELOC_SECTIONS="
+ .rela.tls ${RELOCATING-0} : { *(.rela.tls) }"
if [ "x${host}" = "x${target}" ]; then
case " $EMULATION_LIBPATH " in
diff --git a/ld/emulparams/elf64_sparc.sh b/ld/emulparams/elf64_sparc.sh
index 8ae29ad..afbf2e6 100644
--- a/ld/emulparams/elf64_sparc.sh
+++ b/ld/emulparams/elf64_sparc.sh
@@ -12,15 +12,7 @@ GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NOP=0x01000000
NO_SMALL_DATA=yes
-
-case "$target" in
- sparc*-solaris*)
- TEXT_START_ADDR=0x100000000
- ;;
- *)
- TEXT_START_ADDR=0x100000
- ;;
-esac
+TEXT_START_ADDR=0x100000
# Treat a host that matches the target with the possible exception of "64"
# and "v7", "v8", "v9" in the name as if it were native.
diff --git a/ld/emulparams/elf64_sparc_sol2.sh b/ld/emulparams/elf64_sparc_sol2.sh
index b32c5be..e17f787 100644
--- a/ld/emulparams/elf64_sparc_sol2.sh
+++ b/ld/emulparams/elf64_sparc_sol2.sh
@@ -1,4 +1,5 @@
source_sh ${srcdir}/emulparams/elf64_sparc.sh
source_sh ${srcdir}/emulparams/solaris2.sh
+TEXT_START_ADDR=0x100000000
EXTRA_EM_FILE=solaris2
OUTPUT_FORMAT="elf64-sparc-sol2"
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index 6f698bb..12d71f5 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -17,7 +17,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH=i386
MACHINE=
TEMPLATE_NAME=elf
-EXTRA_EM_FILE="elf-x86"
+EXTRA_EM_FILE="elf-i386-glibc"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
@@ -28,6 +28,8 @@ OTHER_PLT_SECTIONS="
.plt.got ${RELOCATING-0} : { *(.plt.got) }
.plt.sec ${RELOCATING-0} : { *(.plt.sec) }
"
+OTHER_GOT_RELOC_SECTIONS="
+ .rel.tls ${RELOCATING-0} : { *(.rel.tls) }"
# Linux modify the default library search path to first include
# a 32-bit specific directory.
diff --git a/ld/emulparams/elf_i386_fbsd.sh b/ld/emulparams/elf_i386_fbsd.sh
index d1d6604..d39a5cf 100644
--- a/ld/emulparams/elf_i386_fbsd.sh
+++ b/ld/emulparams/elf_i386_fbsd.sh
@@ -1,3 +1,4 @@
source_sh ${srcdir}/emulparams/elf_i386.sh
source_sh ${srcdir}/emulparams/elf_fbsd.sh
+EXTRA_EM_FILE="elf-x86"
OUTPUT_FORMAT="elf32-i386-freebsd"
diff --git a/ld/emulparams/elf_i386_haiku.sh b/ld/emulparams/elf_i386_haiku.sh
index 6c4001e..c931c0e 100644
--- a/ld/emulparams/elf_i386_haiku.sh
+++ b/ld/emulparams/elf_i386_haiku.sh
@@ -1,5 +1,6 @@
source_sh ${srcdir}/emulparams/elf_i386.sh
source_sh ${srcdir}/emulparams/elf_haiku.sh
+EXTRA_EM_FILE="elf-x86"
TEXT_START_ADDR=0x200000
NONPAGED_TEXT_START_ADDR=0x200000
MAXPAGESIZE=0x1000
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index 9244974..4bab148 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -21,7 +21,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="i386:x86-64"
MACHINE=
TEMPLATE_NAME=elf
-EXTRA_EM_FILE="elf-x86"
+EXTRA_EM_FILE="elf-x86-64-glibc"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
@@ -34,6 +34,8 @@ OTHER_PLT_SECTIONS="
.plt.got ${RELOCATING-0} : { *(.plt.got) }
.plt.sec ${RELOCATING-0} : { *(.plt.sec) }
"
+OTHER_GOT_RELOC_SECTIONS="
+ .rela.tls ${RELOCATING-0} : { *(.rela.tls) }"
if [ "x${host}" = "x${target}" ]; then
case " $EMULATION_LIBPATH " in
diff --git a/ld/emulparams/elf_x86_64_cloudabi.sh b/ld/emulparams/elf_x86_64_cloudabi.sh
deleted file mode 100644
index 1f8732e..0000000
--- a/ld/emulparams/elf_x86_64_cloudabi.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-source_sh ${srcdir}/emulparams/elf_x86_64.sh
-OUTPUT_FORMAT="elf64-x86-64-cloudabi"
diff --git a/ld/emulparams/elf_x86_64_fbsd.sh b/ld/emulparams/elf_x86_64_fbsd.sh
index 7ef974a..17fdc83 100644
--- a/ld/emulparams/elf_x86_64_fbsd.sh
+++ b/ld/emulparams/elf_x86_64_fbsd.sh
@@ -1,3 +1,4 @@
source_sh ${srcdir}/emulparams/elf_x86_64.sh
source_sh ${srcdir}/emulparams/elf_fbsd.sh
+EXTRA_EM_FILE="elf-x86-64"
OUTPUT_FORMAT="elf64-x86-64-freebsd"
diff --git a/ld/emulparams/elf_x86_64_haiku.sh b/ld/emulparams/elf_x86_64_haiku.sh
index e6231cd..7b03384 100644
--- a/ld/emulparams/elf_x86_64_haiku.sh
+++ b/ld/emulparams/elf_x86_64_haiku.sh
@@ -1,2 +1,3 @@
source_sh ${srcdir}/emulparams/elf_x86_64.sh
source_sh ${srcdir}/emulparams/elf_haiku.sh
+EXTRA_EM_FILE="elf-x86-64"
diff --git a/ld/emultempl/elf-i386-glibc.em b/ld/emultempl/elf-i386-glibc.em
new file mode 100644
index 0000000..26a7296
--- /dev/null
+++ b/ld/emultempl/elf-i386-glibc.em
@@ -0,0 +1,77 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf.em, and defines i386 glibc specific
+# routines.
+#
+
+source_em ${srcdir}/emultempl/elf-x86.em
+source_em ${srcdir}/emultempl/elf-x86-glibc.em
+
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+
+fragment <<EOF
+static void
+elf_i386_glibc_before_parse (void)
+{
+ elf_x86_before_parse ();
+ elf_x86_glibc_before_parse ();
+ params.gnu_tls_version_tag = DEFAULT_LD_GNU_TLS_TAG;
+}
+EOF
+
+LDEMUL_BEFORE_PARSE=elf_i386_glibc_before_parse
+
+PARSE_AND_LIST_LONGOPTS_386='
+ { "gnu-tls-tag", no_argument, NULL, OPTION_GNU_TLS_VERSION_TAG },
+ { "no-gnu-tls-tag", no_argument, NULL, OPTION_NO_GNU_TLS_VERSION_TAG },
+'
+
+PARSE_AND_LIST_OPTIONS_386='
+ if (DEFAULT_LD_GNU_TLS_TAG == 0)
+ fprintf (file, _("\
+ --gnu-tls-tag Add GLIBC_ABI_GNU_TLS dependency\n\
+ --no-gnu-tls-tag Do not add GLIBC_ABI_GNU_TLS dependency (default)\n"));
+ else if (DEFAULT_LD_GNU_TLS_TAG == 1)
+ fprintf (file, _("\
+ --gnu-tls-tag Add GLIBC_ABI_GNU_TLS dependency (default)\n\
+ --no-gnu-tls-tag Do not add GLIBC_ABI_GNU_TLS dependency\n"));
+ else
+ fprintf (file, _("\
+ --gnu-tls-tag Add GLIBC_ABI_GNU_TLS dependency (auto)\n\
+ when no options are specified (default)\n\
+ --no-gnu-tls-tag Do not add GLIBC_ABI_GNU_TLS dependency\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES_386='
+ case OPTION_GNU_TLS_VERSION_TAG:
+ params.gnu_tls_version_tag = 1;
+ break;
+
+ case OPTION_NO_GNU_TLS_VERSION_TAG:
+ params.gnu_tls_version_tag = 0;
+ break;
+'
+
+PARSE_AND_LIST_LONGOPTS="$PARSE_AND_LIST_LONGOPTS $PARSE_AND_LIST_LONGOPTS_386"
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_386"
+PARSE_AND_LIST_ARGS_CASES="$PARSE_AND_LIST_ARGS_CASES $PARSE_AND_LIST_ARGS_CASES_386"
diff --git a/ld/emultempl/elf-x86-64-glibc.em b/ld/emultempl/elf-x86-64-glibc.em
new file mode 100644
index 0000000..1e62d4f
--- /dev/null
+++ b/ld/emultempl/elf-x86-64-glibc.em
@@ -0,0 +1,37 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf.em, and defines x86-64 glibc specific
+# routines.
+#
+
+source_em ${srcdir}/emultempl/elf-x86-64.em
+source_em ${srcdir}/emultempl/elf-x86-glibc.em
+
+fragment <<EOF
+static void
+elf_x86_64_glibc_before_parse (void)
+{
+ elf_x86_64_before_parse ();
+ elf_x86_glibc_before_parse ();
+}
+EOF
+
+LDEMUL_BEFORE_PARSE=elf_x86_64_glibc_before_parse
diff --git a/ld/emultempl/elf-x86-64.em b/ld/emultempl/elf-x86-64.em
new file mode 100644
index 0000000..ca7ccc0
--- /dev/null
+++ b/ld/emultempl/elf-x86-64.em
@@ -0,0 +1,68 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf.em, and defines x86-64 specific routines.
+#
+
+source_em ${srcdir}/emultempl/elf-x86.em
+
+fragment <<EOF
+static void
+elf_x86_64_before_parse (void)
+{
+ params.mark_plt = DEFAULT_LD_Z_MARK_PLT;
+
+ elf_x86_before_parse ();
+}
+
+static void
+elf_x86_64_before_allocation (void)
+{
+ if (!bfd_link_relocatable (&link_info)
+ && is_elf_hash_table (link_info.hash)
+ && expld.phase != lang_mark_phase_enum)
+ {
+ struct elf_link_hash_table *htab = elf_hash_table (&link_info);
+ /* Run one_lang_size_sections_pass to estimate the output section
+ layout before sizing dynamic sections. */
+ expld.dataseg.phase = exp_seg_none;
+ expld.phase = lang_mark_phase_enum;
+ /* NB: Exclude linker created GOT setions when estimating output
+ section layout as sizing dynamic sections may change linker
+ created GOT sections. */
+ if (htab->sgot != NULL)
+ htab->sgot->flags |= SEC_EXCLUDE;
+ if (htab->sgotplt != NULL)
+ htab->sgotplt->flags |= SEC_EXCLUDE;
+ one_lang_size_sections_pass (NULL, false);
+ /* Restore linker created GOT setions. */
+ if (htab->sgot != NULL)
+ htab->sgot->flags &= ~SEC_EXCLUDE;
+ if (htab->sgotplt != NULL)
+ htab->sgotplt->flags &= ~SEC_EXCLUDE;
+ lang_reset_memory_regions ();
+ }
+
+ gld${EMULATION_NAME}_before_allocation ();
+}
+EOF
+
+LDEMUL_BEFORE_PARSE=elf_x86_64_before_parse
+LDEMUL_BEFORE_ALLOCATION=elf_x86_64_before_allocation
diff --git a/ld/emultempl/elf-x86-glibc.em b/ld/emultempl/elf-x86-glibc.em
new file mode 100644
index 0000000..0fc37a6
--- /dev/null
+++ b/ld/emultempl/elf-x86-glibc.em
@@ -0,0 +1,70 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf.em, and defines x86 glibc specific
+# routines.
+#
+
+fragment <<EOF
+static void
+elf_x86_glibc_before_parse (void)
+{
+ params.gnu2_tls_version_tag = DEFAULT_LD_GNU2_TLS_TAG;
+}
+EOF
+
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+
+PARSE_AND_LIST_LONGOPTS_X86='
+ { "gnu2-tls-tag", no_argument, NULL, OPTION_GNU2_TLS_VERSION_TAG },
+ { "no-gnu2-tls-tag", no_argument, NULL, OPTION_NO_GNU2_TLS_VERSION_TAG },
+'
+
+PARSE_AND_LIST_OPTIONS_X86='
+ if (DEFAULT_LD_GNU2_TLS_TAG == 0)
+ fprintf (file, _("\
+ --gnu2-tls-tag Add GNU2_ABI_GNU2_TLS dependency\n\
+ --no-gnu2-tls-tag Do not add GNU2_ABI_GNU2_TLS dependency (default)\n"));
+ else if (DEFAULT_LD_GNU2_TLS_TAG == 1)
+ fprintf (file, _("\
+ --gnu2-tls-tag Add GNU2_ABI_GNU2_TLS dependency (default)\n\
+ --no-gnu2-tls-tag Do not add GNU2_ABI_GNU2_TLS dependency\n"));
+ else
+ fprintf (file, _("\
+ --gnu2-tls-tag Add GNU2_ABI_GNU2_TLS dependency (auto)\n\
+ when no options are specified (default)\n\
+ --no-gnu2-tls-tag Do not add GNU2_ABI_GNU2_TLS dependency\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES_X86='
+ case OPTION_GNU2_TLS_VERSION_TAG:
+ params.gnu2_tls_version_tag = 1;
+ break;
+
+ case OPTION_NO_GNU2_TLS_VERSION_TAG:
+ params.gnu2_tls_version_tag = 0;
+ break;
+'
+
+PARSE_AND_LIST_LONGOPTS="$PARSE_AND_LIST_LONGOPTS $PARSE_AND_LIST_LONGOPTS_X86"
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_X86"
+PARSE_AND_LIST_ARGS_CASES="$PARSE_AND_LIST_ARGS_CASES $PARSE_AND_LIST_ARGS_CASES_X86"
diff --git a/ld/emultempl/elf-x86.em b/ld/emultempl/elf-x86.em
index f72a0cd..411a4d6 100644
--- a/ld/emultempl/elf-x86.em
+++ b/ld/emultempl/elf-x86.em
@@ -56,61 +56,3 @@ EOF
LDEMUL_BEFORE_PARSE=elf_x86_before_parse
fi
-
-case x${OUTPUT_FORMAT}${CALL_NOP_BYTE} in
- x*x86-64*0x67)
-fragment <<EOF
-
-static void
-elf_x86_64_before_parse (void)
-{
- params.mark_plt = DEFAULT_LD_Z_MARK_PLT;
-
- elf_x86_before_parse ();
-}
-EOF
-
- LDEMUL_BEFORE_PARSE=elf_x86_64_before_parse
- ;;
-esac
-
-case x${OUTPUT_FORMAT} in
- x*x86-64*)
-fragment <<EOF
-
-static void
-elf_x86_64_before_allocation (void)
-{
- if (!bfd_link_relocatable (&link_info)
- && is_elf_hash_table (link_info.hash)
- && expld.phase != lang_mark_phase_enum)
- {
- struct elf_link_hash_table *htab = elf_hash_table (&link_info);
- /* Run one_lang_size_sections_pass to estimate the output section
- layout before sizing dynamic sections. */
- expld.dataseg.phase = exp_seg_none;
- expld.phase = lang_mark_phase_enum;
- /* NB: Exclude linker created GOT setions when estimating output
- section layout as sizing dynamic sections may change linker
- created GOT sections. */
- if (htab->sgot != NULL)
- htab->sgot->flags |= SEC_EXCLUDE;
- if (htab->sgotplt != NULL)
- htab->sgotplt->flags |= SEC_EXCLUDE;
- one_lang_size_sections_pass (NULL, false);
- /* Restore linker created GOT setions. */
- if (htab->sgot != NULL)
- htab->sgot->flags &= ~SEC_EXCLUDE;
- if (htab->sgotplt != NULL)
- htab->sgotplt->flags &= ~SEC_EXCLUDE;
- lang_reset_memory_regions ();
- }
-
- gld${EMULATION_NAME}_before_allocation ();
-}
-
-EOF
-
-LDEMUL_BEFORE_ALLOCATION=elf_x86_64_before_allocation
- ;;
-esac
diff --git a/ld/emultempl/solaris2-x86-64.em b/ld/emultempl/solaris2-x86-64.em
new file mode 100644
index 0000000..788b3cf
--- /dev/null
+++ b/ld/emultempl/solaris2-x86-64.em
@@ -0,0 +1,23 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+source_em "${srcdir}/emultempl/elf-x86-64.em"
+source_em "${srcdir}/emultempl/solaris2.em"
diff --git a/ld/emultempl/solaris2.em b/ld/emultempl/solaris2.em
index 6198a82..29a436e 100644
--- a/ld/emultempl/solaris2.em
+++ b/ld/emultempl/solaris2.em
@@ -117,6 +117,11 @@ elf_solaris2_before_allocation (void)
/* Create a version pattern for this symbol. Some of them start
off as local, others as global, so try both. */
globals = lang_new_vers_pattern (globals, *sym, NULL, true);
+
+ /* Treat basever symbols as if from a linker script to
+ appease --no-undefined-version. */
+ globals->script = 1;
+
locals = lang_new_vers_pattern (locals, *sym, NULL, true);
}
diff --git a/ld/ld.texi b/ld/ld.texi
index 413335a..cf750d1 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1745,6 +1745,34 @@ Supported for Linux/i386 and Linux/x86_64.
Other keywords are ignored for Solaris compatibility.
+@item --gnu-tls-tag
+@itemx --no-gnu-tls-tag
+Add @code{GLIBC_ABI_GNU_TLS} version tag dependency in output programs
+and shared libraries when linking against glibc if input relocatable
+object files call @code{___tls_get_addr}. The output will fail to load
+and run at run-time against glibc which doesn't define the
+@code{GLIBC_ABI_GNU_TLS} version tag. Unless disabled by the
+@option{--disable-gnu-tls-tag} configure option at the linker build
+time, when no options are specified, linker will add the
+@code{GLIBC_ABI_GNU_TLS} version tag dependency if inputs have
+@code{___tls_get_addr} call and libc.so defines the
+@code{GLIBC_ABI_GNU_TLS} version tag. Supported for Linux/i386.
+
+@item --gnu2-tls-tag
+@itemx --no-gnu2-tls-tag
+Add @code{GLIBC_ABI_GNU2_TLS} version tag dependency in output programs
+and shared libraries when linking against glibc if input relocatable
+object files have @code{R_386_TLS_DESC_CALL} or
+@code{R_X86_64_TLSDESC_CALL} relocation. The output will fail to load
+and run at run-time against glibc which doesn't define the
+@code{GLIBC_ABI_GNU2_TLS} version tag. Unless disabled by the
+@option{--disable-gnu2-tls-tag} configure option at the linker build
+time, when no options are specified, linker will add the
+@code{GLIBC_ABI_GNU2_TLS} version tag dependency if inputs have
+@code{R_386_TLS_DESC_CALL} or @code{R_X86_64_TLSDESC_CALL} relocation
+and libc.so defines the @code{GLIBC_ABI_GNU2_TLS} version tag.
+Supported for Linux/i386 and Linux/x86_64.
+
@kindex -(
@cindex groups of archives
@item -( @var{archives} -)
diff --git a/ld/ldfile.c b/ld/ldfile.c
index e642c7f..bed04fb 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -35,9 +35,8 @@
#include "libiberty.h"
#include "filenames.h"
#include <fnmatch.h>
-#if BFD_SUPPORTS_PLUGINS
+#include "same-inode.h"
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
bool ldfile_assumed_script = false;
const char *ldfile_output_machine_name = "";
@@ -365,9 +364,7 @@ ldfile_try_open_bfd (const char *attempt,
}
/* PR 30568: Do not track lto generated temporary object files. */
-#if BFD_SUPPORTS_PLUGINS
if (!entry->flags.lto_output)
-#endif
track_dependency_files (attempt);
/* Linker needs to decompress sections. */
@@ -376,10 +373,8 @@ ldfile_try_open_bfd (const char *attempt,
/* This is a linker input BFD. */
entry->the_bfd->is_linker_input = 1;
-#if BFD_SUPPORTS_PLUGINS
if (entry->flags.lto_output)
entry->the_bfd->lto_output = 1;
-#endif
/* If we are searching for this file, see if the architecture is
compatible with the output file. If it isn't, keep searching.
@@ -517,7 +512,6 @@ ldfile_try_open_bfd (const char *attempt,
}
}
success:
-#if BFD_SUPPORTS_PLUGINS
/* If plugins are active, they get first chance to claim
any successfully-opened input file. We skip archives
here; the plugin wants us to offer it the individual
@@ -533,7 +527,6 @@ ldfile_try_open_bfd (const char *attempt,
plugin_maybe_claim (entry);
else
cmdline_check_object_only_section (entry->the_bfd, false);
-#endif /* BFD_SUPPORTS_PLUGINS */
/* It opened OK, the format checked out, and the plugins have had
their chance to claim it, so this is success. */
@@ -828,19 +821,26 @@ find_scripts_dir (void)
static FILE *
ldfile_find_command_file (const char *name,
- bool default_only,
+ enum script_open_style open_how,
bool *sysrooted)
{
search_dirs_type *search;
FILE *result = NULL;
- char *path;
+ char *path = NULL;
+ const char *filename = NULL;
+ struct script_name_list *script;
+ size_t len;
+ struct stat sbuf1;
- if (!default_only)
+ if (open_how != script_defaultT)
{
/* First try raw name. */
result = try_open (name, sysrooted);
if (result != NULL)
- return result;
+ {
+ filename = name;
+ goto success;
+ }
}
if (!script_search)
@@ -861,20 +861,47 @@ ldfile_find_command_file (const char *name,
*search_tail_ptr = script_search;
/* Try now prefixes. */
- for (search = default_only ? script_search : search_head;
+ for (search = open_how == script_defaultT ? script_search : search_head;
search != NULL;
search = search->next)
{
path = concat (search->name, slash, name, (const char *) NULL);
result = try_open (path, sysrooted);
- free (path);
if (result)
- break;
+ {
+ filename = path;
+ break;
+ }
}
/* Restore the original path list. */
*search_tail_ptr = NULL;
+ success:
+ /* PR 24576: Catch the case where the user has accidentally included
+ the same linker script twice. */
+ if (stat (filename, &sbuf1) == 0)
+ {
+ struct stat sbuf2;
+ for (script = processed_scripts;
+ script != NULL;
+ script = script->next)
+ if ((open_how != script_nonT || script->open_how != script_nonT)
+ && stat (script->name, &sbuf2) == 0
+ && SAME_INODE (sbuf1, sbuf2))
+ fatal (_("%P: error: linker script file '%s (%s)'"
+ " appears multiple times\n"), filename, script->name);
+ }
+
+ len = strlen (filename);
+ script = xmalloc (sizeof (*script) + len);
+ script->next = processed_scripts;
+ script->open_how = open_how;
+ memcpy (script->name, filename, len + 1);
+ processed_scripts = script;
+
+ free (path);
+
return result;
}
@@ -886,31 +913,8 @@ ldfile_open_command_file_1 (const char *name, enum script_open_style open_how)
{
FILE *ldlex_input_stack;
bool sysrooted;
- struct script_name_list *script;
- size_t len;
-
- /* PR 24576: Catch the case where the user has accidentally included
- the same linker script twice. */
- for (script = processed_scripts; script != NULL; script = script->next)
- {
- if ((open_how != script_nonT || script->open_how != script_nonT)
- && strcmp (name, script->name) == 0)
- {
- fatal (_("%P: error: linker script file '%s'"
- " appears multiple times\n"), name);
- return;
- }
- }
-
- len = strlen (name);
- script = xmalloc (sizeof (*script) + len);
- script->next = processed_scripts;
- script->open_how = open_how;
- memcpy (script->name, name, len + 1);
- processed_scripts = script;
- ldlex_input_stack = ldfile_find_command_file (name,
- open_how == script_defaultT,
+ ldlex_input_stack = ldfile_find_command_file (name, open_how,
&sysrooted);
if (ldlex_input_stack == NULL)
{
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 6e31c35..3c57bf7 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -44,13 +44,7 @@
#include "elf-bfd.h"
#include "bfdver.h"
#include <errno.h>
-
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
-
-/* FIXME: Put it here to avoid NAME conflict from ldgram.h. */
-#include "elf-bfd.h"
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
@@ -62,6 +56,9 @@
#define TO_ADDR(X) ((X) >> opb_shift)
#define TO_SIZE(X) ((X) << opb_shift)
+/* The maximum nested group depth. */
+#define MAX_NESTED_GROUP_DEPTH 100
+
/* Local variables. */
static struct obstack stat_obstack;
static struct obstack map_obstack;
@@ -2857,14 +2854,24 @@ lang_add_section (lang_statement_list_type *ptr,
/* Only set SEC_READONLY flag on the first input section. */
flags &= ~ SEC_READONLY;
- /* Keep SEC_MERGE and SEC_STRINGS only if they are the same. */
- if ((output->bfd_section->flags & (SEC_MERGE | SEC_STRINGS))
- != (flags & (SEC_MERGE | SEC_STRINGS))
- || ((flags & SEC_MERGE) != 0
- && output->bfd_section->entsize != section->entsize))
+ /* Keep entry size, SEC_MERGE, and SEC_STRINGS only if entry sizes are
+ the same. */
+ if (output->bfd_section->entsize != section->entsize)
+ {
+ output->bfd_section->entsize = 0;
+ flags &= ~(SEC_MERGE | SEC_STRINGS);
+ }
+
+ /* Keep SEC_MERGE and SEC_STRINGS (each) only if they are the same. */
+ if ((output->bfd_section->flags ^ flags) & SEC_MERGE)
+ {
+ output->bfd_section->flags &= ~SEC_MERGE;
+ flags &= ~SEC_MERGE;
+ }
+ if ((output->bfd_section->flags ^ flags) & SEC_STRINGS)
{
- output->bfd_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
- flags &= ~ (SEC_MERGE | SEC_STRINGS);
+ output->bfd_section->flags &= ~SEC_STRINGS;
+ flags &= ~SEC_STRINGS;
}
}
output->bfd_section->flags |= flags;
@@ -2879,8 +2886,7 @@ lang_add_section (lang_statement_list_type *ptr,
link_info.output_bfd,
output->bfd_section,
&link_info);
- if ((flags & SEC_MERGE) != 0)
- output->bfd_section->entsize = section->entsize;
+ output->bfd_section->entsize = section->entsize;
}
if ((flags & SEC_TIC54X_BLOCK) != 0
@@ -3630,26 +3636,27 @@ enum open_bfd_mode
OPEN_BFD_FORCE = 1,
OPEN_BFD_RESCAN = 2
};
-#if BFD_SUPPORTS_PLUGINS
static lang_input_statement_type *plugin_insert = NULL;
static struct bfd_link_hash_entry *plugin_undefs = NULL;
-#endif
static void
open_input_bfds (lang_statement_union_type *s,
lang_output_section_statement_type *os,
- enum open_bfd_mode mode)
+ enum open_bfd_mode mode,
+ unsigned int *nested_group_count_p)
{
for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
case lang_constructors_statement_enum:
- open_input_bfds (constructor_list.head, os, mode);
+ open_input_bfds (constructor_list.head, os, mode,
+ nested_group_count_p);
break;
case lang_output_section_statement_enum:
os = &s->output_section_statement;
- open_input_bfds (os->children.head, os, mode);
+ open_input_bfds (os->children.head, os, mode,
+ nested_group_count_p);
break;
case lang_wild_statement_enum:
/* Maybe we should load the file's symbols. */
@@ -3658,36 +3665,35 @@ open_input_bfds (lang_statement_union_type *s,
&& !wildcardp (s->wild_statement.filename)
&& !archive_path (s->wild_statement.filename))
lookup_name (s->wild_statement.filename);
- open_input_bfds (s->wild_statement.children.head, os, mode);
+ open_input_bfds (s->wild_statement.children.head, os, mode,
+ nested_group_count_p);
break;
case lang_group_statement_enum:
{
struct bfd_link_hash_entry *undefs;
-#if BFD_SUPPORTS_PLUGINS
lang_input_statement_type *plugin_insert_save;
-#endif
/* We must continually search the entries in the group
until no new symbols are added to the list of undefined
symbols. */
+ ++*nested_group_count_p;
+
do
{
-#if BFD_SUPPORTS_PLUGINS
plugin_insert_save = plugin_insert;
-#endif
undefs = link_info.hash->undefs_tail;
open_input_bfds (s->group_statement.children.head, os,
- mode | OPEN_BFD_FORCE);
+ mode | OPEN_BFD_FORCE,
+ nested_group_count_p);
}
while (undefs != link_info.hash->undefs_tail
-#if BFD_SUPPORTS_PLUGINS
/* Objects inserted by a plugin, which are loaded
before we hit this loop, may have added new
undefs. */
- || (plugin_insert != plugin_insert_save && plugin_undefs)
-#endif
- );
+ || (plugin_insert != plugin_insert_save && plugin_undefs));
+
+ --*nested_group_count_p;
}
break;
case lang_target_statement_enum:
@@ -3700,6 +3706,10 @@ open_input_bfds (lang_statement_union_type *s,
lang_statement_list_type add;
bfd *abfd;
+ if (*nested_group_count_p >= MAX_NESTED_GROUP_DEPTH)
+ fatal (_("%P: group nested too deeply in linker script '%s'\n"),
+ s->input_statement.filename);
+
s->input_statement.target = current_target;
/* If we are being called from within a group, and this
@@ -3708,10 +3718,8 @@ open_input_bfds (lang_statement_union_type *s,
has been loaded already. Do the same for a rescan.
Likewise reload --as-needed shared libs. */
if (mode != OPEN_BFD_NORMAL
-#if BFD_SUPPORTS_PLUGINS
&& ((mode & OPEN_BFD_RESCAN) == 0
|| plugin_insert == NULL)
-#endif
&& s->input_statement.flags.loaded
&& (abfd = s->input_statement.the_bfd) != NULL
&& ((bfd_get_format (abfd) == bfd_archive
@@ -3755,12 +3763,10 @@ open_input_bfds (lang_statement_union_type *s,
}
}
}
-#if BFD_SUPPORTS_PLUGINS
/* If we have found the point at which a plugin added new
files, clear plugin_insert to enable archive rescan. */
if (&s->input_statement == plugin_insert)
plugin_insert = NULL;
-#endif
break;
case lang_assignment_statement_enum:
if (s->assignment_statement.exp->type.node_class != etree_assert)
@@ -7346,11 +7352,9 @@ lang_check (void)
file != NULL;
file = file->next)
{
-#if BFD_SUPPORTS_PLUGINS
/* Don't check format of files claimed by plugin. */
if (file->flags.claimed)
continue;
-#endif /* BFD_SUPPORTS_PLUGINS */
input_bfd = file->the_bfd;
compatible
= bfd_arch_get_compatible (input_bfd, link_info.output_bfd,
@@ -7877,10 +7881,8 @@ lang_gc_sections (void)
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
asection *sec;
-#if BFD_SUPPORTS_PLUGINS
if (f->flags.claimed)
continue;
-#endif
for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_DEBUGGING) == 0
|| strcmp (sec->name, ".stabstr") != 0)
@@ -8024,7 +8026,6 @@ lang_relax_sections (bool need_layout)
}
}
-#if BFD_SUPPORTS_PLUGINS
/* Find the insert point for the plugin's replacement files. We
place them after the first claimed real object file, or if the
first claimed object is an archive member, after the last real
@@ -8152,7 +8153,6 @@ find_next_input_statement (lang_statement_union_type **s)
}
return s;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Insert SRCLIST into DESTLIST after given element by chaining
on FIELD as the next-pointer. (Counterintuitively does not need
@@ -8289,6 +8289,8 @@ lang_os_merge_sort_children (void)
void
lang_process (void)
{
+ unsigned int nested_group_count = 0;
+
lang_os_merge_sort_children ();
/* Finalize dynamic list. */
@@ -8320,7 +8322,8 @@ lang_process (void)
/* Create a bfd for each input file. */
current_target = default_target;
lang_statement_iteration++;
- open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL);
+ open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL,
+ &nested_group_count);
/* Now that open_input_bfds has processed assignments and provide
statements we can give values to symbolic origin/length now. */
@@ -8328,7 +8331,6 @@ lang_process (void)
ldemul_before_plugin_all_symbols_read ();
-#if BFD_SUPPORTS_PLUGINS
if (link_info.lto_plugin_active)
{
lang_statement_list_type added;
@@ -8355,7 +8357,8 @@ lang_process (void)
last_os = ((lang_output_section_statement_type *)
((char *) lang_os_list.tail
- offsetof (lang_output_section_statement_type, next)));
- open_input_bfds (*added.tail, last_os, OPEN_BFD_NORMAL);
+ open_input_bfds (*added.tail, last_os, OPEN_BFD_NORMAL,
+ &nested_group_count);
if (plugin_undefs == link_info.hash->undefs_tail)
plugin_undefs = NULL;
/* Restore the global list pointer now they have all been added. */
@@ -8406,7 +8409,8 @@ lang_process (void)
/* Rescan archives in case new undefined symbols have appeared. */
files = file_chain;
lang_statement_iteration++;
- open_input_bfds (statement_list.head, NULL, OPEN_BFD_RESCAN);
+ open_input_bfds (statement_list.head, NULL, OPEN_BFD_RESCAN,
+ &nested_group_count);
lang_list_remove_tail (&file_chain, &files);
while (files.head != NULL)
{
@@ -8439,9 +8443,7 @@ lang_process (void)
}
}
}
- else
-#endif /* BFD_SUPPORTS_PLUGINS */
- if (bfd_link_relocatable (&link_info))
+ else if (bfd_link_relocatable (&link_info))
{
/* Check if .gnu_object_only section should be created. */
bfd *p;
@@ -10696,6 +10698,9 @@ cmdline_add_object_only_section (bfd_byte *contents, size_t size)
goto loser;
}
+ /* This is a linker input BFD. */
+ ibfd->is_linker_input = 1;
+
if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
{
err = bfd_errmsg (bfd_get_error ());
@@ -10844,7 +10849,7 @@ cmdline_add_object_only_section (bfd_byte *contents, size_t size)
/* ibfd needs to be closed *after* obfd, otherwise ld may crash with a
segmentation fault. */
if (!bfd_close (ibfd))
- einfo (_("%P%F: failed to close input\n"));
+ fatal (_("%P: failed to close input\n"));
/* Must be freed after bfd_close (). */
free (isympp);
@@ -10852,7 +10857,7 @@ cmdline_add_object_only_section (bfd_byte *contents, size_t size)
/* Must unlink to ensure rename works on Windows. */
if (unlink (output_filename) && errno != ENOENT)
- einfo (_("%P%F: failed to unlink %s\n"), output_filename);
+ fatal (_("%P: failed to unlink %s\n"), output_filename);
if (rename (ofilename, output_filename))
{
@@ -10890,6 +10895,7 @@ cmdline_emit_object_only_section (void)
size_t size, off;
bfd_byte *contents;
struct stat st;
+ unsigned int nested_group_count = 0;
/* Get a temporary object-only file. */
output_filename = make_temp_file (".obj-only.o");
@@ -10926,7 +10932,8 @@ cmdline_emit_object_only_section (void)
cmdline_get_object_only_input_files ();
/* Open object-only input files. */
- open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL);
+ open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL,
+ &nested_group_count);
ldemul_after_open ();
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 8d905f0..a9607be 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -287,7 +287,6 @@ struct lang_input_statement_flags
/* Set if reloading an archive or --as-needed lib. */
unsigned int reload : 1;
-#if BFD_SUPPORTS_PLUGINS
/* Set if the file was claimed by a plugin. */
unsigned int claimed : 1;
@@ -296,7 +295,6 @@ struct lang_input_statement_flags
/* Set if added by the lto plugin add_input_file callback. */
unsigned int lto_output : 1;
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Head of list of pushed flags. */
struct lang_input_statement_flags *pushed;
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 815da76..24cac1c 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -146,11 +146,9 @@ enum option_values
OPTION_WARN_ALTERNATE_EM,
OPTION_REDUCE_MEMORY_OVERHEADS,
OPTION_MAX_CACHE_SIZE,
-#if BFD_SUPPORTS_PLUGINS
OPTION_PLUGIN,
OPTION_PLUGIN_OPT,
OPTION_PLUGIN_SAVE_TEMPS,
-#endif /* BFD_SUPPORTS_PLUGINS */
OPTION_DEFAULT_SCRIPT,
OPTION_PRINT_OUTPUT_FORMAT,
OPTION_PRINT_SYSROOT,
@@ -471,6 +469,12 @@ enum option_values
OPTION_NO_LITERAL_MOVEMENT,
OPTION_ABI_WINDOWED,
OPTION_ABI_CALL0,
+ /* Used by emultempl/elf-x86-glibc.em. */
+ OPTION_GNU2_TLS_VERSION_TAG,
+ OPTION_NO_GNU2_TLS_VERSION_TAG,
+ /* Used by emultempl/elf-i386-glibc.em. */
+ OPTION_GNU_TLS_VERSION_TAG,
+ OPTION_NO_GNU_TLS_VERSION_TAG,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 13b8e3d..157f205 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -40,9 +40,7 @@
#include "ldfile.h"
#include "ldemul.h"
#include "ldctor.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Somewhere above, sys/stat.h got included. */
#if !defined(S_ISDIR) && defined(S_IFDIR)
@@ -227,13 +225,11 @@ ld_cleanup (void)
inext = ibfd->link.next;
bfd_close_all_done (ibfd);
}
-#if BFD_SUPPORTS_PLUGINS
/* Note - we do not call ld_plugin_start (PHASE_PLUGINS) here as this
function is only called when the linker is exiting - ie after any
stats may have been reported, and potentially in the middle of a
phase where we have already started recording plugin stats. */
plugin_call_cleanup ();
-#endif
if (output_filename && delete_output_file_on_failure)
unlink_if_ordinary (output_filename);
}
@@ -724,12 +720,10 @@ main (int argc, char **argv)
ld_stop_phase (PHASE_PARSE);
-#if BFD_SUPPORTS_PLUGINS
ld_start_phase (PHASE_PLUGINS);
/* Now all the plugin arguments have been gathered, we can load them. */
plugin_load_plugins ();
ld_stop_phase (PHASE_PLUGINS);
-#endif /* BFD_SUPPORTS_PLUGINS */
ld_start_phase (PHASE_PARSE);
@@ -1307,7 +1301,6 @@ add_archive_element (struct bfd_link_info *info,
(if enabled) may possibly alter it to point to a replacement
BFD, but we still want to output the original BFD filename. */
orig_input = *input;
-#if BFD_SUPPORTS_PLUGINS
/* Don't claim a fat IR object if no IR object should be claimed. */
if (link_info.lto_plugin_active
&& (!no_more_claiming
@@ -1336,7 +1329,6 @@ add_archive_element (struct bfd_link_info *info,
}
else
cmdline_check_object_only_section (input->the_bfd, false);
-#endif /* BFD_SUPPORTS_PLUGINS */
if (link_info.input_bfds_tail == &input->the_bfd->link.next
|| input->the_bfd->link.next != NULL)
diff --git a/ld/lexsup.c b/ld/lexsup.c
index bde2046..5cb7799 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -41,9 +41,7 @@
#include "ldver.h"
#include "ldemul.h"
#include "demangle.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
#ifndef PATH_SEPARATOR
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
@@ -182,7 +180,6 @@ static const struct ld_option ld_options[] =
'O', NULL, N_("Optimize output file"), ONE_DASH },
{ {"out-implib", required_argument, NULL, OPTION_OUT_IMPLIB},
'\0', N_("FILE"), N_("Generate import library"), TWO_DASHES },
-#if BFD_SUPPORTS_PLUGINS
{ {"plugin", required_argument, NULL, OPTION_PLUGIN},
'\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
{ {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
@@ -196,12 +193,6 @@ static const struct ld_option ld_options[] =
{ {"flto-partition=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC LTO option compatibility"),
ONE_DASH },
-#else
- { {"plugin", required_argument, NULL, OPTION_IGNORE},
- '\0', N_("PLUGIN"), N_("Load named plugin (ignored)"), ONE_DASH },
- { {"plugin-opt", required_argument, NULL, OPTION_IGNORE},
- '\0', N_("ARG"), N_("Send arg to last-loaded plugin (ignored)"), ONE_DASH },
-#endif /* BFD_SUPPORTS_PLUGINS */
{ {"fuse-ld=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC linker option compatibility"),
ONE_DASH },
@@ -1213,18 +1204,18 @@ parse_args (unsigned argc, char **argv)
case OPTION_PRINT_OUTPUT_FORMAT:
command_line.print_output_format = true;
break;
-#if BFD_SUPPORTS_PLUGINS
case OPTION_PLUGIN:
- plugin_opt_plugin (optarg);
+ if (bfd_plugin_enabled ())
+ plugin_opt_plugin (optarg);
break;
case OPTION_PLUGIN_OPT:
- if (plugin_opt_plugin_arg (optarg))
+ if (bfd_plugin_enabled ()
+ && plugin_opt_plugin_arg (optarg))
fatal (_("%P: bad -plugin-opt option\n"));
break;
case OPTION_PLUGIN_SAVE_TEMPS:
config.plugin_save_temps = true;
break;
-#endif /* BFD_SUPPORTS_PLUGINS */
case 'q':
link_info.emitrelocations = true;
break;
@@ -1543,9 +1534,7 @@ parse_args (unsigned argc, char **argv)
int level ATTRIBUTE_UNUSED = strtoul (optarg, &end, 0);
if (*end)
fatal (_("%P: invalid number `%s'\n"), optarg);
-#if BFD_SUPPORTS_PLUGINS
report_plugin_symbols = level > 1;
-#endif /* BFD_SUPPORTS_PLUGINS */
}
break;
case 'v':
@@ -2474,7 +2463,13 @@ help (void)
for (; len < 30; len++)
putchar (' ');
- printf ("%s\n", _(ld_options[i].doc));
+ printf ("%s", _(ld_options[i].doc));
+ if ((ld_options[i].opt.val == OPTION_PLUGIN
+ || ld_options[i].opt.val == OPTION_PLUGIN_OPT)
+ && !bfd_plugin_enabled ())
+ puts (_(" (ignored)"));
+ else
+ putchar ('\n');
}
}
printf (_(" @FILE"));
diff --git a/ld/libdep_plugin.c b/ld/libdep_plugin.c
index 605d597..e1dbf18 100644
--- a/ld/libdep_plugin.c
+++ b/ld/libdep_plugin.c
@@ -20,7 +20,6 @@
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include <ctype.h> /* For isspace. */
@@ -340,4 +339,3 @@ onload (struct ld_plugin_tv *tv)
fflush (NULL);
return LDPS_OK;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 210b77e..c730b54 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1630,9 +1630,8 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
const struct bfd_link_hash_entry *blhe
= bfd_wrapped_link_hash_lookup (abfd, info, sym->name,
false, false, false);
-
/* Don't create relocs for undefined weak symbols. */
- if (sym->flags == BSF_WEAK)
+ if (sym->flags & BSF_WEAK)
{
if (blhe && blhe->type == bfd_link_hash_undefweak)
{
@@ -1657,7 +1656,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
continue;
}
/* Nor for Dwarf FDE references to discarded sections. */
- else if (bfd_is_abs_section (sym->section->output_section))
+ if (bfd_is_abs_section (sym->section->output_section))
{
/* We only ignore relocs from .eh_frame sections, as
they are discarded by the final link rather than
@@ -1666,10 +1665,10 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
continue;
}
/* Nor for absolute symbols. */
- else if (blhe && ldexp_is_final_sym_absolute (blhe)
- && (!blhe->linker_def
- || (strcmp (sym->name, "__image_base__")
- && strcmp (sym->name, U ("__ImageBase")))))
+ if (blhe && ldexp_is_final_sym_absolute (blhe)
+ && (!blhe->linker_def
+ || (strcmp (sym->name, "__image_base__")
+ && strcmp (sym->name, U ("__ImageBase")))))
continue;
reloc_data[total_relocs].vma = sec_vma + relocs[i]->address;
diff --git a/ld/plugin.c b/ld/plugin.c
index dedd1a0..08d827c 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -21,7 +21,6 @@
#include "sysdep.h"
#include "libiberty.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "bfdlink.h"
#include "bfdver.h"
#include "ctf-api.h"
@@ -1536,4 +1535,3 @@ plugin_notice (struct bfd_link_info *info,
abfd, section, value, flags);
return true;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/po/BLD-POTFILES.in b/ld/po/BLD-POTFILES.in
index 7daf1d7..94bd7b0 100644
--- a/ld/po/BLD-POTFILES.in
+++ b/ld/po/BLD-POTFILES.in
@@ -1,5 +1,3 @@
-eaarch64cloudabi.c
-eaarch64cloudabib.c
eaarch64elf.c
eaarch64elf32.c
eaarch64elf32b.c
@@ -213,7 +211,6 @@ eelf_iamcu.c
eelf_mipsel_haiku.c
eelf_s390.c
eelf_x86_64.c
-eelf_x86_64_cloudabi.c
eelf_x86_64_fbsd.c
eelf_x86_64_haiku.c
eelf_x86_64_sol2.c
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index be8d19f..6d34912 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -734,7 +734,7 @@ cat <<EOF
data, but this is not guaranteed to always be the case. */
.note.build-id : { *(.note.build-id) } ${RELOCATING+${REGION}}
.note.GNU-stack : { *(.note.GNU-stack) } ${RELOCATING+${REGION}}
- .note.gnu-property : { *(.note.gnu-property) } ${RELOCATING+${REGION}}
+ .note.gnu.property : { *(.note.gnu.property) } ${RELOCATING+${REGION}}
.note.ABI-tag : { *(.note.ABI-tag) } ${RELOCATING+${REGION}}
.note.package : { *(.note.package) } ${RELOCATING+${REGION}}
.note.dlopen : { *(.note.dlopen) } ${RELOCATING+${REGION}}
diff --git a/ld/testplug.c b/ld/testplug.c
index ffb7787..e5c3ec2 100644
--- a/ld/testplug.c
+++ b/ld/testplug.c
@@ -20,7 +20,6 @@
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
#include "libiberty.h"
@@ -673,4 +672,3 @@ oncleanup (void)
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/testplug2.c b/ld/testplug2.c
index f792383..788d193 100644
--- a/ld/testplug2.c
+++ b/ld/testplug2.c
@@ -21,7 +21,6 @@
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
@@ -675,4 +674,3 @@ oncleanup (void)
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/testplug3.c b/ld/testplug3.c
index 0373534..91a9661 100644
--- a/ld/testplug3.c
+++ b/ld/testplug3.c
@@ -21,7 +21,6 @@
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
@@ -633,4 +632,3 @@ oncleanup (void)
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/testplug4.c b/ld/testplug4.c
index 71eaf59..21a2cd1 100644
--- a/ld/testplug4.c
+++ b/ld/testplug4.c
@@ -21,7 +21,6 @@
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
@@ -681,4 +680,3 @@ oncleanup (void)
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 1c12ce6..3619f52 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -117,12 +117,18 @@ if {![info exists CC_FOR_TARGET]} {
if {![info exists CFLAGS_FOR_TARGET]} {
set CFLAGS_FOR_TARGET "-g -O2"
}
+if {![info exists CFLAGS_FOR_TARGET_TEST]} {
+ set CFLAGS_FOR_TARGET_TEST ""
+}
if {![info exists CXX_FOR_TARGET]} {
set CXX_FOR_TARGET [find_g++]
}
if {![info exists CXXFLAGS_FOR_TARGET]} {
set CXXFLAGS_FOR_TARGET ""
}
+if {![info exists CXXFLAGS_FOR_TARGET_TEST]} {
+ set CXXFLAGS_FOR_TARGET_TEST ""
+}
# This allows us to run the linker testsuite with clang as the compilation
# driver instead of gcc. The syntax of the overrides are as follows, one
@@ -450,6 +456,15 @@ if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
}
}
+if { ![info exists DIRECT_EXTERN_ACCESS_CFLAGS] } then {
+ set DIRECT_EXTERN_ACCESS_CFLAGS ""
+ if [compiler_supports "-mdirect-extern-access"] {
+ set DIRECT_EXTERN_ACCESS_CFLAGS "-mdirect-extern-access"
+ } elseif [compiler_supports "-fdirect-access-external-data"] {
+ set DIRECT_EXTERN_ACCESS_CFLAGS "-fdirect-access-external-data"
+ }
+}
+
if { ![info exists NOCF_PROTECTION_CFLAGS] } then {
set NOCF_PROTECTION_CFLAGS ""
if [compiler_supports "-fcf-protection=none"] {
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far.ld b/ld/testsuite/ld-aarch64/protections/bti-far.ld
index 1568f18..d3ed904 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far.ld
+++ b/ld/testsuite/ld-aarch64/protections/bti-far.ld
@@ -19,7 +19,7 @@ SECTIONS
. = 0x12340000;
.far : { *(.far) }
/* Start of the Read Only Data region. */
- .note.gnu-property : { *(.note.gnu-property) }
+ .note.gnu.property : { *(.note.gnu.property) }
/* Start of the Read Write Data region. */
. = ALIGN (CONSTANT (MAXPAGESIZE));
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt.ld b/ld/testsuite/ld-aarch64/protections/bti-plt.ld
index c930fc8..fffb8a98 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt.ld
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt.ld
@@ -17,7 +17,7 @@ SECTIONS
. = 0x20000;
.text : { *(.text) }
/* Start of the Read Only Data region. */
- .note.gnu-property : { *(.note.gnu-property) }
+ .note.gnu.property : { *(.note.gnu.property) }
/* Start of the Read Write Data region. */
. = ALIGN (CONSTANT (MAXPAGESIZE));
diff --git a/ld/testsuite/ld-cris/tls-local-63.d b/ld/testsuite/ld-cris/tls-local-63.d
index 4dcdb2e..d0841fb 100644
--- a/ld/testsuite/ld-cris/tls-local-63.d
+++ b/ld/testsuite/ld-cris/tls-local-63.d
@@ -2,18 +2,15 @@
#source: tls-hx.s
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 6 -x 8 -x 5
+#readelf: -r -s -x 6 -x 8 -x 5
# A R_CRIS_16_GOT_TPREL in a DSO against a hidden symbol. Make sure
# the relocation, GOT, .text and .tdata have the right contents.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset Info Type Sym.Value Sym. Name \+ Addend
000021a0 0000001c R_CRIS_32_TPREL[ ]+0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
#...
@@ -23,9 +20,9 @@ Symbol table '.symtab' contains 13 entries:
#...
Hex dump of section '.text':
0x00000114 5fae0c00 .*
-#...
+
Hex dump of section '.tdata':
0x00002118 280+ .*
-#...
+
Hex dump of section '.got':
0x0+2194 1c210000 0+ 0+ 0+ .*
diff --git a/ld/testsuite/ld-cris/tls-local-64.d b/ld/testsuite/ld-cris/tls-local-64.d
index 38f90c8..68989d3 100644
--- a/ld/testsuite/ld-cris/tls-local-64.d
+++ b/ld/testsuite/ld-cris/tls-local-64.d
@@ -3,19 +3,16 @@
#source: tls-hx.s
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 6 -x 8 -x 5
+#readelf: -r -s -x 6 -x 8 -x 5
# A R_CRIS_16_GOT_TPREL in a DSO against a hidden symbol, at an offset
# into .data. Make sure the relocation, GOT, .text and .tdata have
# the right contents.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset Info Type Sym.Value Sym. Name \+ Addend
00002220 0000001c R_CRIS_32_TPREL[ ]+80
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
#...
@@ -25,13 +22,13 @@ Symbol table '.symtab' contains [0-9]+ entries:
#...
Hex dump of section '.text':
0x00000114 5fae0c00 .*
-#...
+
Hex dump of section '.tdata':
0x00002118 2f0+ 0+ 0+ 0+ .*
0x00002128 0+ 0+ 0+ 0+ .*
#...
0x00002188 0+ 0+ 0+ 0+ .*
0x00002198 280+ .*
-#...
+
Hex dump of section '.got':
0x0+2214 9c210000 0+ 0+ 80+ .*
diff --git a/ld/testsuite/ld-cris/tls-und-38.d b/ld/testsuite/ld-cris/tls-und-38.d
index 07c0662..1174658 100644
--- a/ld/testsuite/ld-cris/tls-und-38.d
+++ b/ld/testsuite/ld-cris/tls-und-38.d
@@ -1,20 +1,17 @@
#source: tls-gd-2.s --pic
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 7
+#readelf: -r -s -x 7
# Undefined reference for a R_CRIS_32_GOT_GD in a DSO. Not an error;
# it's ok for a DSO to have undefined references upon creation for
# global symbols that can be overridden. Just make sure GOT, dynsyms
# and dynrelocs look right.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
00002190 +00000217 R_CRIS_DTP +00000000 +x \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
#...
diff --git a/ld/testsuite/ld-cris/tls-und-42.d b/ld/testsuite/ld-cris/tls-und-42.d
index b7309a7..0fe1dfa 100644
--- a/ld/testsuite/ld-cris/tls-und-42.d
+++ b/ld/testsuite/ld-cris/tls-und-42.d
@@ -1,20 +1,17 @@
#source: tls-ie-10.s --pic
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 7
+#readelf: -r -s -x 7
# Undefined reference for a R_CRIS_32_GOT_TPREL in a DSO. Not an
# error; it's ok for a DSO to have undefined references upon creation
# for global symbols that can be overridden. Just make sure GOT,
# dynsyms and dynrelocs look right.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
00002198 +0000021c R_CRIS_32_TPREL +0+ +x \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
#...
diff --git a/ld/testsuite/ld-cris/tls-und-46.d b/ld/testsuite/ld-cris/tls-und-46.d
index 1088e42..d536844 100644
--- a/ld/testsuite/ld-cris/tls-und-46.d
+++ b/ld/testsuite/ld-cris/tls-und-46.d
@@ -1,20 +1,17 @@
#source: tls-gd-1.s --pic
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 7
+#readelf: -r -s -x 7
# Undefined reference for a R_CRIS_16_GOT_GD in a DSO. Not an error;
# it's ok for a DSO to have undefined references upon creation for
# global symbols that can be overridden. Just make sure GOT, dynsyms
# and dynrelocs look right.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
0000218c +00000217 R_CRIS_DTP +00000000 +x \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
#...
diff --git a/ld/testsuite/ld-cris/tls-und-50.d b/ld/testsuite/ld-cris/tls-und-50.d
index 2b22a21..fd6ff4c 100644
--- a/ld/testsuite/ld-cris/tls-und-50.d
+++ b/ld/testsuite/ld-cris/tls-und-50.d
@@ -1,20 +1,17 @@
#source: tls-ie-8.s --pic
#as: --no-underscore --emulation=criself
#ld: -m crislinux --shared --hash-style=sysv
-#readelf: -a -x 7
+#readelf: -r -s -x 7
# Undefined reference for a R_CRIS_16_GOT_TPREL in a DSO. Not an
# error; it's ok for a DSO to have undefined references upon creation
# for global symbols that can be overridden. Just make sure GOT,
# dynsyms and dynrelocs look right.
-#...
Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
00002190 +0000021c R_CRIS_32_TPREL +0+ +x \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
#...
diff --git a/ld/testsuite/ld-cris/weakref3.d b/ld/testsuite/ld-cris/weakref3.d
index a4a55b4..ffb9955 100644
--- a/ld/testsuite/ld-cris/weakref3.d
+++ b/ld/testsuite/ld-cris/weakref3.d
@@ -3,7 +3,7 @@
#as: --no-underscore --emulation=criself
#ld: -m crislinux --hash-style=sysv
#ld_after_inputfiles: tmpdir/libdso-15.so
-#readelf: -a -x 10
+#readelf: -S -r -s -x 10
# Like libdso-15b.d, but referencing the weak symbol and function from
# a program. At some time we broke emitting a copy reloc for the
@@ -22,8 +22,6 @@ Relocation section '.rela.plt' at offset 0x... contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
.* R_CRIS_JUMP_SLOT .* expfn2@TST3 \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
#...
+.: [0-9a-f]* +4 +OBJECT +GLOBAL +DEFAULT +13 __expobj2@TST3 \(2\)
diff --git a/ld/testsuite/ld-cris/weakref4.d b/ld/testsuite/ld-cris/weakref4.d
index 9012bdc..a52f86a 100644
--- a/ld/testsuite/ld-cris/weakref4.d
+++ b/ld/testsuite/ld-cris/weakref4.d
@@ -3,7 +3,7 @@
#as: --no-underscore --emulation=criself
#ld: -m crislinux --hash-style=sysv
#ld_after_inputfiles: tmpdir/libdso-15.so
-#readelf: -a -x 11
+#readelf: -S -r -s -x 11
# Like weakref3.d, but just the expobj2 referenced from .data. We
# should avoid a copy reloc (instead emitting a R_CRIS_GLOB_DAT or
@@ -19,8 +19,6 @@ Relocation section '.rela.dyn' at offset 0x... contains 1 entry:
#...
.* R_CRIS_COPY .* __expobj2@TST3 \+ 0
-The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
-
Symbol table '.dynsym' contains . entries:
#...
+.: [0-9a-f]* +4 +OBJECT +GLOBAL +DEFAULT +12 __expobj2@TST3 \(2\)
diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp
index c314f29..3ce5e1e 100644
--- a/ld/testsuite/ld-ctf/ctf.exp
+++ b/ld/testsuite/ld-ctf/ctf.exp
@@ -38,6 +38,11 @@ if {[info exists env(LC_ALL)]} {
}
set env(LC_ALL) "C"
+set saved_ASFLAGS "$ASFLAGS"
+if [istarget "sparc-*-*"] {
+ append ASFLAGS " -Av8plus"
+}
+
set ctf_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach ctf_test $ctf_test_list {
@@ -50,6 +55,8 @@ foreach ctf_test $ctf_test_list {
run_dump_test [file rootname $ctf_test] { { cc "-gctf -fPIC" } }
}
+set ASFLAGS "$saved_ASFLAGS"
+
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp
index c7b2915..4f79635 100644
--- a/ld/testsuite/ld-elf/dwarf.exp
+++ b/ld/testsuite/ld-elf/dwarf.exp
@@ -69,11 +69,11 @@ set run_tests {
}
# Disable all sanitizers.
-set old_CFLAGS "$CFLAGS_FOR_TARGET"
-append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS"
+set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+append CFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS"
run_cc_link_tests $build_tests
run_ld_link_exec_tests $run_tests
-set CFLAGS_FOR_TARGET "$old_CFLAGS"
+set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
proc strip_test {} {
global ld
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 1ae1af9..098e712 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -86,6 +86,9 @@ run_ld_link_tests [list \
if [is_elf64 tmpdir/symbol3w.a] {
set ASFLAGS "$ASFLAGS --defsym ALIGN=3"
+ if { [istarget powerpc*-*-linux*] } {
+ set LDFLAGS "$LDFLAGS --no-ld-generated-unwind-info"
+ }
set pr23900_1_exp "pr23900-1-64.rd"
set pr25490_2_exp "pr25490-2-64.rd"
set pr25490_3_exp "pr25490-3-64.rd"
@@ -285,6 +288,13 @@ if { [istarget *-*-*linux*]
{pr29072-a.s} \
{{ld pr29072.a.warn}} \
"pr29072-a.exe"] \
+ [list "Test --error-execstack with an executable .note.GNU-stack" \
+ "--warn-execstack --error-execstack" \
+ "" \
+ "" \
+ {pr29072-a.s} \
+ {{ld gnu_execstack.err}} \
+ "gnu_execstack.exe"] \
[list "PR 29072 (warn about -z execstack)" \
"-z execstack --warn-execstack --no-error-execstack" \
"" \
@@ -292,6 +302,13 @@ if { [istarget *-*-*linux*]
{stack.s} \
{{ld pr29072.c.warn}} \
"pr29072-c.exe"] \
+ [list "Test --error-execstack with -z execstack" \
+ "-z execstack --warn-execstack --error-execstack" \
+ "" \
+ "" \
+ {stack.s} \
+ {{ld z_execstack.err}} \
+ "execstack.exe"] \
[list "PR ld/29072 (suppress warnings about executable stack)" \
"-e 0 --no-warn-execstack" \
"" \
@@ -299,13 +316,20 @@ if { [istarget *-*-*linux*]
{pr29072-a.s} \
{} \
"pr29072-d.exe"] \
- [list "Ensure that a warning issued when creating a segment with RWX permissions" \
+ [list "Ensure that a warning is issued when creating a segment with RWX permissions" \
"-e 0 -Tnobits-1.t --warn-rwx-segments --no-error-rwx-segments" \
"" \
"" \
{nobits-1.s} \
{{ld rwx-segments-1.l}} \
"rwx-segments-1.exe"] \
+ [list "Ensure that a error can be issued when creating a segment with RWX permissions" \
+ "-e 0 -Tnobits-1.t --warn-rwx-segments --error-rwx-segments" \
+ "" \
+ "" \
+ {nobits-1.s} \
+ {{ld rwx-segments-3.err}} \
+ "rwx-segments-3.exe"] \
[list "Ensure that a warning issued when creating a TLS segment with execute permission" \
"-e 0 -T rwx-segments-2.t --warn-rwx-segments --no-error-rwx-segments" \
"" \
@@ -313,6 +337,13 @@ if { [istarget *-*-*linux*]
{size-2.s} \
{{ld rwx-segments-2.l}} \
"rwx-segments-2.exe"] \
+ [list "Ensure that an error cn be issued when creating a TLS segment with execute permission" \
+ "-e 0 -T rwx-segments-2.t --warn-rwx-segments --error-rwx-segments" \
+ "" \
+ "" \
+ {size-2.s} \
+ {{ld rwx-segments-4.err}} \
+ "rwx-segments-4.exe"] \
[list "Ensure that the RWX warning can be suppressed" \
"-e 0 -Tnobits-1.t --no-warn-rwx-segments" \
"" \
@@ -334,6 +365,16 @@ if { [istarget *-*-*linux*]
{{ld pr29072.b.warn}} \
"pr29072-b.exe"] \
]
+
+ run_ld_link_tests [list \
+ [list "error when .note.GNU-stack is absent" \
+ "-e 0 -z stack-size=0x123400 --warn-execstack --error-execstack" \
+ "" \
+ "" \
+ {pr29072-b.s} \
+ {{ld missing-execstack.err}} \
+ "missing-execstack.exe"] \
+ ]
} else {
run_ld_link_tests [list \
[list "PR ld/29072 (ignore absent .note.GNU-stack)" \
diff --git a/ld/testsuite/ld-elf/gnu_execstack.err b/ld/testsuite/ld-elf/gnu_execstack.err
new file mode 100644
index 0000000..be70b63
--- /dev/null
+++ b/ld/testsuite/ld-elf/gnu_execstack.err
@@ -0,0 +1,3 @@
+#...
+.*: error: .*: is triggering the generation of an executable stack \(because it has an executable .note.GNU-stack section\)
+#...
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
index 27173b9..a4dfc8a 100644
--- a/ld/testsuite/ld-elf/linux-x86.exp
+++ b/ld/testsuite/ld-elf/linux-x86.exp
@@ -84,9 +84,9 @@ run_cc_link_tests [list \
] \
[list \
"Build indirect-extern-access-1a without PIE" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed -z noexecstack \
+ "$NOPIE_LDFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS -Wl,--no-as-needed -z noexecstack \
tmpdir/indirect-extern-access-1.so" \
- "$NOPIE_CFLAGS" \
+ "$NOPIE_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS" \
{ indirect-extern-access.S indirect-extern-access-1b.c } \
{{readelf -rn indirect-extern-access-1.rd}} \
"indirect-extern-access-1a" \
@@ -101,9 +101,9 @@ run_cc_link_tests [list \
] \
[list \
"Build indirect-extern-access-2a without PIE" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed -z noexecstack \
+ "$NOPIE_LDFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS -Wl,--no-as-needed -z noexecstack \
tmpdir/indirect-extern-access-2.so" \
- "$NOPIE_CFLAGS" \
+ "$NOPIE_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS" \
{ indirect-extern-access.S indirect-extern-access-1b.c } \
{{readelf -rn indirect-extern-access-2.rd}} \
"indirect-extern-access-2a" \
@@ -375,11 +375,11 @@ proc check_pr25749a {testname srcfilea srcfileb cflags ldflags lderror} {
check_pr25749a "pr25749-1a" "pr25749-1.c" "pr25749-1a.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
check_pr25749a "pr25749-1a" "pr25749-1.c" "pr25749-1a.c" "-fPIE" "-pie" ""
-check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
+check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "$NOPIE_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS" "$NOPIE_LDFLAGS" ""
if { [istarget "i?86-*-linux*"] || ![at_least_gcc_version 5 1] } {
- check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE" "-pie" ""
+ check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE $DIRECT_EXTERN_ACCESS_CFLAGS" "-pie" ""
} else {
- check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE" "-pie" "pr25749-1b.err"
+ check_pr25749a "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE $DIRECT_EXTERN_ACCESS_CFLAGS" "-pie" "pr25749-1b.err"
}
check_pr25749a "pr25749-1c" "pr25749-1.c" "pr25749-1c.c" "-fPIC" "-shared" "pr25749-1b.err"
check_pr25749a "pr25749-2a" "pr25749-2.c" "pr25749-2a.s" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
diff --git a/ld/testsuite/ld-elf/missing-execstack.err b/ld/testsuite/ld-elf/missing-execstack.err
new file mode 100644
index 0000000..9549cf5
--- /dev/null
+++ b/ld/testsuite/ld-elf/missing-execstack.err
@@ -0,0 +1,3 @@
+#...
+.*: error: .*\.o: is triggering the generation of an executable stack because it does not have a .note.GNU-stack section
+#...
diff --git a/ld/testsuite/ld-elf/pr33291.d b/ld/testsuite/ld-elf/pr33291.d
new file mode 100644
index 0000000..22a8336
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr33291.d
@@ -0,0 +1,9 @@
+#source: pr33291a.s
+#source: pr33291b.s
+#ld: -shared
+#readelf: -S --wide
+#xfail: ![check_shared_lib_support]
+
+#...
+ \[[ 0-9]+\] \.rodata[ ]+PROGBITS[ ]+[0-9a-f]+ [0-9a-f]+ 0+9 00 +A +0 +0 +8
+#...
diff --git a/ld/testsuite/ld-elf/pr33291a.s b/ld/testsuite/ld-elf/pr33291a.s
new file mode 100644
index 0000000..587c0fb
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr33291a.s
@@ -0,0 +1,8 @@
+ .globl foo
+ .section .rodata.cst8,"aM",%progbits,8
+ .p2align 3
+ .type foo, %object
+ .size foo, 8
+foo:
+ .quad 131073
+ .section .note.GNU-stack,"",%progbits
diff --git a/ld/testsuite/ld-elf/pr33291b.s b/ld/testsuite/ld-elf/pr33291b.s
new file mode 100644
index 0000000..69f6b3d
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr33291b.s
@@ -0,0 +1,7 @@
+ .globl bar
+ .section .rodata.cst1,"aM",%progbits,1
+ .type bar, %object
+ .size bar, 1
+bar:
+ .byte 1
+ .section .note.GNU-stack,"",%progbits
diff --git a/ld/testsuite/ld-elf/rwx-segments-3.err b/ld/testsuite/ld-elf/rwx-segments-3.err
new file mode 100644
index 0000000..5a584db
--- /dev/null
+++ b/ld/testsuite/ld-elf/rwx-segments-3.err
@@ -0,0 +1,3 @@
+#...
+.* error: .* has a LOAD segment with RWX permissions
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-elf/rwx-segments-4.err b/ld/testsuite/ld-elf/rwx-segments-4.err
new file mode 100644
index 0000000..2603f57
--- /dev/null
+++ b/ld/testsuite/ld-elf/rwx-segments-4.err
@@ -0,0 +1,3 @@
+#...
+.*: error: .* has a TLS segment with execute permission
+#...
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index ee881c2..a24525a 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -972,7 +972,13 @@ append build_tests {
{pr26580-b.c} {} "libpr26580-2.so"}
}
+set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+set old_CXXFLAGS "$CXXFLAGS_FOR_TARGET_TEST"
+append CFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS"
+append CXXFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS"
run_cc_link_tests $build_tests
+set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
+set CXXFLAGS_FOR_TARGET_TEST "$old_CXXFLAGS"
run_cc_link_tests [list \
[list \
@@ -1259,10 +1265,10 @@ if [check_libdl_available] {
# XFAIL on NetBSD ELF systems as they do not currently support the .*_array
# sections.
# Disable all sanitizers.
- set old_CFLAGS "$CFLAGS_FOR_TARGET"
- append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS"
+ set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+ append CFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS"
run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsd*"
- set CFLAGS_FOR_TARGET "$old_CFLAGS"
+ set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
}
# Check --no-add-needed and --no-copy-dt-needed-entries
diff --git a/ld/testsuite/ld-elf/z_execstack.err b/ld/testsuite/ld-elf/z_execstack.err
new file mode 100644
index 0000000..703b42a
--- /dev/null
+++ b/ld/testsuite/ld-elf/z_execstack.err
@@ -0,0 +1,4 @@
+#...
+.*: error: creating an executable stack because of -z execstack command line option
+#...
+
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index d5cfc75..80faaa0 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -35,7 +35,8 @@ if { ![check_shared_lib_support] } {
# This test can only be run on a couple of ELF platforms.
# Square bracket expressions seem to confuse istarget.
# This is similar to the test that is used in ld-shared, BTW.
-if { ![istarget hppa*64*-*-hpux*]
+if { ![istarget *-*-solaris2*]
+ && ![istarget hppa*64*-*-hpux*]
&& ![istarget hppa*-*-linux*]
&& ![istarget i?86-*-elf*]
&& ![istarget i?86-*-linux*]
@@ -48,7 +49,6 @@ if { ![istarget hppa*64*-*-hpux*]
&& ![istarget powerpc*-*-linux*]
&& ![istarget powerpc*-*-sysv4*]
&& ![istarget sparc*-*-elf]
- && ![istarget sparc*-*-solaris2*]
&& ![istarget sparc*-*-linux*]
&& ![istarget aarch64*-*-linux*]
&& ![istarget arm*-*-linux*]
@@ -60,6 +60,13 @@ if { ![istarget hppa*64*-*-hpux*]
return
}
+set need_direct_extern_access ""
+if { [istarget i?86-*-linux*]
+ || [istarget i?86-*-gnu*] } then {
+ # These targets need direct extern access in some tests.
+ set need_direct_extern_access "$DIRECT_EXTERN_ACCESS_CFLAGS"
+}
+
set diff diff
set tmpdir tmpdir
set VOBJDUMP_FLAGS --private-headers
@@ -558,7 +565,8 @@ proc build_vers_lib_no_pic { test source libname other mapfile verexp versymexp
global shared
# Make sure that PLT is used since PLT is expected.
global PLT_CFLAGS
- build_binary "$shared -z notext" $PLT_CFLAGS $test $source $libname $other $mapfile $verexp $versymexp $symexp ""
+ global need_direct_extern_access
+ build_binary "$shared -z notext" "$PLT_CFLAGS $need_direct_extern_access" $test $source $libname $other $mapfile $verexp $versymexp $symexp ""
}
proc build_vers_lib_pic { test source libname other mapfile verexp versymexp symexp } {
@@ -961,7 +969,10 @@ if [string match "yes" $pic] then {
build_vers_lib_pic "vers26a" vers26a.c vers26a "" vers26a.map vers26a.ver vers26a.dsym ""
build_vers_lib_pic "vers26b1" vers26b.c vers26b1 "" "" vers26b.ver vers26b.dsym ""
build_vers_lib_pic "vers26b2" vers26b.c vers26b2 "vers26a.so vers26b1.so vers26a.o" "" vers26b.ver vers26b.dsym ""
-if [string match "yes" $pic] then {
+if { [istarget x86_64-*-linux*] || [istarget x86_64-*-solaris2*] } then {
+ # gcc -fPIC generates code that ld rejects.
+ unsupported "vers26b3"
+} elseif [string match "yes" $pic] then {
xfail "vers26b3"
} else {
build_vers_lib_no_pic "vers26b3" vers26b.c vers26b3 "vers26a.so vers26b1.so vers26a.o" "" vers26b.ver vers26b.dsym ""
diff --git a/ld/testsuite/ld-i386/binutils.exp b/ld/testsuite/ld-i386/binutils.exp
new file mode 100644
index 0000000..5069c59
--- /dev/null
+++ b/ld/testsuite/ld-i386/binutils.exp
@@ -0,0 +1,45 @@
+# Expect script for ELF/i386 binutils tests on linker outputs.
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+if ![is_elf_format] {
+ return
+}
+
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
+ return
+}
+
+run_ld_link_tests [list \
+ [list \
+ "Build libgot-1.so" \
+ "-shared -melf_i386 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ $NO_DT_RELR_LDFLAGS" \
+ "" \
+ "--32 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a.rd} \
+ {readelf -aW libgot-1b.rd} \
+ {readelf --got-contents libgot-1c.rd} \
+ {readelf {--got-contents -W} libgot-1d.rd}} \
+ "libgot-1.so" \
+ ] \
+]
diff --git a/ld/testsuite/ld-i386/dt-relr-1c.d b/ld/testsuite/ld-i386/dt-relr-1c.d
new file mode 100644
index 0000000..b64860f
--- /dev/null
+++ b/ld/testsuite/ld-i386/dt-relr-1c.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --32
+#ld: -shared -melf_i386 $DT_RELR_LDFLAGS --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux* i?86-*-linux-gnu i?86-*-gnu*
+
+'REL' relocation section at offset [0x0-9a-f]+ contains 16 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 8 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 8 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func1
+
+Symbol table for image contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-i386/dt-relr-1d.d b/ld/testsuite/ld-i386/dt-relr-1d.d
new file mode 100644
index 0000000..37df7c5
--- /dev/null
+++ b/ld/testsuite/ld-i386/dt-relr-1d.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --32
+#ld: -shared -melf_i386 $DT_RELR_LDFLAGS -z nocombreloc --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux* i?86-*-linux-gnu i?86-*-gnu*
+
+'REL' relocation section at offset [0x0-9a-f]+ contains 16 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 8 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 8 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func1
+
+Symbol table for image contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-i386/export-class.exp b/ld/testsuite/ld-i386/export-class.exp
index a06a091..919925e 100644
--- a/ld/testsuite/ld-i386/export-class.exp
+++ b/ld/testsuite/ld-i386/export-class.exp
@@ -31,8 +31,9 @@ if { ![is_elf_format] } {
# Exclude some more targets; feel free to include your favorite one
# if you like.
-if { !([istarget i?86-*-linux*]
- || [istarget i?86-*-gnu*]) } {
+if { !([istarget "i?86-*-linux*"]
+ || [istarget "i?86-*-gnu*"]
+ || [istarget "x86_64-*-linux*"]) } {
return
}
@@ -43,8 +44,9 @@ set testname "i386 symbol export class test"
run_ld_link_tests [list \
[list \
"$testname (auxiliary shared object)" \
- "-shared -version-script ../ld-elf/export-class-lib.ver" "" \
+ "-melf_i386 -shared -version-script ../ld-elf/export-class-lib.ver" \
"" \
+ "--32" \
{ ../ld-elf/export-class-lib.s } \
{} \
"i386-export-class-lib.so" \
@@ -57,8 +59,8 @@ run_ld_link_tests [list \
run_ld_link_tests [list \
[list \
"$testname (initial static object)" \
- "-r" "" \
- "" \
+ "-r -melf_i386" "" \
+ "--32" \
{ ../ld-elf/export-class-ref.s } \
{} \
"i386-export-class-ref-r.o" \
@@ -74,8 +76,9 @@ run_ld_link_tests [list \
run_ld_link_tests [list \
[list \
"$testname (final shared object)" \
- "-shared $NO_DT_RELR_LDFLAGS -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
+ "-shared -melf_i386 $NO_DT_RELR_LDFLAGS -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" \
"" \
+ "--32" \
{ ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
{ \
{ readelf -r i386-export-class.rd } \
diff --git a/ld/testsuite/ld-i386/gnu-tls-1.s b/ld/testsuite/ld-i386/gnu-tls-1.s
new file mode 100644
index 0000000..02ae207
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu-tls-1.s
@@ -0,0 +1,9 @@
+ .text
+ .p2align 4
+ .globl func
+ .type func, @function
+func:
+ leal foo@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@PLT
+ ret
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/gnu-tls-1a.rd b/ld/testsuite/ld-i386/gnu-tls-1a.rd
new file mode 100644
index 0000000..65d889d
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu-tls-1a.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains [0-9]+ entries:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU_TLS Flags: none Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-i386/gnu-tls-1b.rd b/ld/testsuite/ld-i386/gnu-tls-1b.rd
new file mode 100644
index 0000000..02006e4
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu-tls-1b.rd
@@ -0,0 +1,4 @@
+#failif
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU_TLS Flags: none Version: [0-9]+
+#...
diff --git a/ld/testsuite/ld-i386/gnu2-tls-1.s b/ld/testsuite/ld-i386/gnu2-tls-1.s
new file mode 100644
index 0000000..e3841c7
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu2-tls-1.s
@@ -0,0 +1,11 @@
+ .section .text.startup,"ax",@progbits
+ .p2align 4
+ .globl main
+ .type main, @function
+main:
+ leal ld@TLSDESC(%ebx), %eax
+ call *ld@TLSCALL(%eax)
+ addl %gs:0, %eax
+ ret
+ .size main, .-main
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/gnu2-tls-1a.rd b/ld/testsuite/ld-i386/gnu2-tls-1a.rd
new file mode 100644
index 0000000..3eb926a
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu2-tls-1a.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains 1 entry:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU2_TLS Flags: none Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-i386/gnu2-tls-1b.rd b/ld/testsuite/ld-i386/gnu2-tls-1b.rd
new file mode 100644
index 0000000..33ef8ac
--- /dev/null
+++ b/ld/testsuite/ld-i386/gnu2-tls-1b.rd
@@ -0,0 +1,4 @@
+#failif
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU2_TLS Flags: none Version: [0-9]+
+#...
diff --git a/ld/testsuite/ld-i386/got-1.s b/ld/testsuite/ld-i386/got-1.s
new file mode 100644
index 0000000..30e45f9
--- /dev/null
+++ b/ld/testsuite/ld-i386/got-1.s
@@ -0,0 +1,7 @@
+ .text
+ .globl func
+ .type func, @function
+func:
+ call *foo@GOT(%ebx)
+ jmp bar@PLT
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/i386-export-class.rd b/ld/testsuite/ld-i386/i386-export-class.rd
index d7beade..7ec0825 100644
--- a/ld/testsuite/ld-i386/i386-export-class.rd
+++ b/ld/testsuite/ld-i386/i386-export-class.rd
@@ -1,11 +1,11 @@
Relocation section '\.rel\.dyn' at offset 0x[0-9a-f]+ contains [0-9]+ entries:
* Offset * Info * Type * Sym\. *Value * Sym\. * Name
+12340000 00000008 R_386_RELATIVE *
12340010 00000008 R_386_RELATIVE *
12340020 00000008 R_386_RELATIVE *
+12340040 00000008 R_386_RELATIVE *
+12340050 00000008 R_386_RELATIVE *
12340060 00000008 R_386_RELATIVE *
12340070 00000008 R_386_RELATIVE *
12340080 00000008 R_386_RELATIVE *
12340090 00000008 R_386_RELATIVE *
-12340000 [0-9a-f]+01 R_386_32 123400a0 protected_baz
-12340040 [0-9a-f]+01 R_386_32 123400a0 protected_foo
-12340050 [0-9a-f]+01 R_386_32 123400a0 protected_bar
diff --git a/ld/testsuite/ld-i386/i386-export-class.xd b/ld/testsuite/ld-i386/i386-export-class.xd
index a797f20..31f011f 100644
--- a/ld/testsuite/ld-i386/i386-export-class.xd
+++ b/ld/testsuite/ld-i386/i386-export-class.xd
@@ -1,10 +1,10 @@
Hex dump of section '\.data':
- 0x12340000 00000000 00000000 00000000 00000000 .*
+ 0x12340000 a0003412 00000000 00000000 00000000 .*
0x12340010 a0003412 00000000 00000000 00000000 .*
0x12340020 a0003412 00000000 00000000 00000000 .*
0x12340030 00000000 00000000 00000000 00000000 .*
- 0x12340040 00000000 00000000 00000000 00000000 .*
- 0x12340050 00000000 00000000 00000000 00000000 .*
+ 0x12340040 a0003412 00000000 00000000 00000000 .*
+ 0x12340050 a0003412 00000000 00000000 00000000 .*
0x12340060 a0003412 00000000 00000000 00000000 .*
0x12340070 a0003412 00000000 00000000 00000000 .*
0x12340080 a0003412 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6366457..44ba418 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -515,11 +515,16 @@ run_dump_test "pr27491-3"
run_dump_test "pr27491-4"
run_dump_test "dt-relr-1a"
run_dump_test "dt-relr-1b"
+run_dump_test "dt-relr-1c"
+run_dump_test "dt-relr-1d"
run_dump_test "pr28870"
run_dump_test "pr28894"
run_dump_test "pr30787"
run_dump_test "pr31047"
run_dump_test "pr32191"
+run_dump_test "pr33260"
+run_dump_test "pr33260-2"
+run_dump_test "pr28387"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
@@ -710,7 +715,7 @@ if { [isnative]
[list \
"Build pr17689.so" \
"-shared" \
- "-fPIC -Wa,-mrelax-relocations=yes" \
+ "-fPIC $DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ pr17689a.c } \
{} \
"pr17689.so" \
@@ -734,7 +739,7 @@ if { [isnative]
[list \
"Build pr17689.a" \
"" \
- "-Wa,-mrelax-relocations=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ pr17689b.S } \
{} \
"pr17689.a" \
@@ -742,7 +747,7 @@ if { [isnative]
[list \
"Build pr17689 with PIE and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
- "-Wa,-mrelax-relocations=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ dummy.c } \
{{readelf {-Wr} pr17689.rd}} \
"pr17689" \
@@ -750,7 +755,7 @@ if { [isnative]
[list \
"Build pr17689 with PIE, -z now and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \
- "-Wa,-mrelax-relocations=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ dummy.c } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now" \
@@ -758,7 +763,7 @@ if { [isnative]
[list \
"Build pr17689ver with PIE and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \
- "-Wa,-mrelax-relocations=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ dummy.c } \
{{readelf {-Wr} pr17689ver.rd}} \
"pr17689ver" \
@@ -766,7 +771,7 @@ if { [isnative]
[list \
"Build pr17827 with PIE and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
- "-Wa,-mrelax-relocations=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mrelax-relocations=yes" \
{ dummy.c } \
{{readelf {-Wr} pr17827.rd}} \
"pr17827" \
@@ -872,7 +877,7 @@ if { [isnative]
[list \
"Build property 1 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-no-copy.S} \
{{readelf {-n} property-1a.r}} \
"property-1.o" \
@@ -896,7 +901,7 @@ if { [isnative]
[list \
"Build property 2 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-stack.S} \
{{readelf {-n} property-2a.r}} \
"property-2.o" \
@@ -920,7 +925,7 @@ if { [isnative]
[list \
"Build property 3 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-x86-1.S property-stack.S} \
{{readelf {-n} property-3a.r}} \
"property-3.o" \
@@ -944,7 +949,7 @@ if { [isnative]
[list \
"Build property 4 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-x86-2.S property-x86-1.S property-stack.S} \
{{readelf {-n} property-4a.r}} \
"property-4.o" \
@@ -976,7 +981,7 @@ if { [isnative]
[list \
"Build property 5 (.o)" \
"-r -nostdlib -Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-x86-2.S property-x86-1.S property-stack.S} \
{{readelf {-n} property-5a.r}} \
"property-5.o" \
@@ -1000,7 +1005,7 @@ if { [isnative]
[list \
"Build property-6.o" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{property-6b.c property-stack.S} \
{{readelf {-n} property-2a.r}} \
"property-6.o" \
@@ -1067,6 +1072,7 @@ if { [isnative]
{ dummy.c } \
"pr17689" \
"pr17689.out" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS" \
] \
[list \
"Run pr17689 with PIE, -z now and GOTOFF" \
@@ -1075,6 +1081,7 @@ if { [isnative]
{ dummy.c } \
"pr17689now" \
"pr17689.out" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS" \
] \
[list \
"Run pr17689ver with PIE and GOTOFF" \
@@ -1083,6 +1090,7 @@ if { [isnative]
{ dummy.c } \
"pr17689ver" \
"pr17689.out" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS" \
] \
[list \
"Run pr18900" \
@@ -1318,7 +1326,7 @@ if { [isnative]
[list \
"Build pr28875" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr28875.so" \
- "$NOPIE_CFLAGS" \
+ "$NOPIE_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS" \
{ pr28875b.c } \
{{error_output "pr28875.err"}} \
"pr28875" \
@@ -1326,7 +1334,7 @@ if { [isnative]
[list \
"Build pr21997-1" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$NOPIE_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr21997-1b.c } \
{{error_output "pr21997-1.err"}} \
"pr21997-1" \
@@ -1514,6 +1522,45 @@ run_ld_link_tests [list \
] \
]
+# The musl C library does not support --gnu-tls-tag nor --gnu2-tls-tag.
+if { ![istarget *-*-musl]
+ && [check_compiler_available] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build gnu-tls-1a.so" \
+ "-shared -Wl,--no-as-needed,--gnu-tls-tag" \
+ "-fPIC" \
+ { gnu-tls-1.s } \
+ {{readelf {-W --version-info} gnu-tls-1a.rd}} \
+ "gnu-tls-1a.so" \
+ ] \
+ [list \
+ "Build gnu-tls-1b.so" \
+ "-shared -Wl,--no-as-needed,--no-gnu-tls-tag" \
+ "-fPIC" \
+ { gnu-tls-1.s } \
+ {{readelf {-W --version-info} gnu-tls-1b.rd}} \
+ "gnu-tls-1b.so" \
+ ] \
+ [list \
+ "Build gnu2-tls-1a.so" \
+ "-shared -Wl,--no-as-needed,--gnu2-tls-tag" \
+ "-fPIC" \
+ { gnu2-tls-1.s } \
+ {{readelf {-W --version-info} gnu2-tls-1a.rd}} \
+ "gnu2-tls-1a.so" \
+ ] \
+ [list \
+ "Build gnu2-tls-1b.so" \
+ "-shared -Wl,--no-as-needed,--no-gnu2-tls-tag" \
+ "-fPIC" \
+ { gnu2-tls-1.s } \
+ {{readelf {-W --version-info} gnu2-tls-1b.rd}} \
+ "gnu2-tls-1b.so" \
+ ] \
+ ]
+}
+
# Linux only tests
run_dump_test "pltgot-1"
run_dump_test "pltgot-2"
diff --git a/ld/testsuite/ld-i386/libgot-1a.rd b/ld/testsuite/ld-i386/libgot-1a.rd
new file mode 100644
index 0000000..b8609b8
--- /dev/null
+++ b/ld/testsuite/ld-i386/libgot-1a.rd
@@ -0,0 +1,9 @@
+
+Relocation section '.rel.dyn' at offset 0x128 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+0+2001fc 00000206 R_386_GLOB_DAT 00000000 foo
+
+Relocation section '.rel.plt' at offset 0x130 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+0+20020c 00000307 R_386_JUMP_SLOT 00000000 bar
+#pass
diff --git a/ld/testsuite/ld-i386/libgot-1b.rd b/ld/testsuite/ld-i386/libgot-1b.rd
new file mode 100644
index 0000000..faebdb4
--- /dev/null
+++ b/ld/testsuite/ld-i386/libgot-1b.rd
@@ -0,0 +1,119 @@
+ELF Header:
+ Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, little endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: DYN \(Shared object file\)
+ Machine: Intel 80386
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 52 \(bytes into file\)
+ Start of section headers: 768 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 32 \(bytes\)
+ Number of program headers: 4
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 14
+ Section header string table index: 13
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] .hash HASH 000000b4 0000b4 000024 04 A 2 0 4
+ \[ 2\] .dynsym DYNSYM 000000d8 0000d8 000040 10 A 3 1 4
+ \[ 3\] .dynstr STRTAB 00000118 000118 00000e 00 A 0 0 1
+ \[ 4\] .rel.dyn REL 00000128 000128 000008 08 A 2 0 4
+ \[ 5\] .rel.plt REL 00000130 000130 000008 08 AI 2 10 4
+ \[ 6\] .plt PROGBITS 00000140 000140 000020 04 AX 0 0 16
+ \[ 7\] .text PROGBITS 00000160 000160 00000b 00 AX 0 0 1
+ \[ 8\] .dynamic DYNAMIC 0020016c 00016c 000090 08 WA 3 0 4
+ \[ 9\] .got PROGBITS 002001fc 0001fc 000004 04 WA 0 0 4
+ \[10\] .got.plt PROGBITS 00200200 000200 000010 04 WA 0 0 4
+ \[11\] .symtab SYMTAB 00000000 000210 000060 10 12 3 4
+ \[12\] .strtab STRTAB 00000000 000270 00002d 00 0 0 1
+ \[13\] .shstrtab STRTAB 00000000 00029d 000060 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), I \(info\),
+ L \(link order\), O \(extra OS processing required\), G \(group\), T \(TLS\),
+ C \(compressed\), x \(unknown\), o \(OS specific\), E \(exclude\),
+ D \(mbind\), p \(processor specific\)
+
+There are no section groups in this file.
+
+Program Headers:
+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+ LOAD 0x000000 0x00000000 0x00000000 0x0016b 0x0016b R E 0x200000
+ LOAD 0x00016c 0x0020016c 0x0020016c 0x000a4 0x000a4 RW 0x200000
+ DYNAMIC 0x00016c 0x0020016c 0x0020016c 0x00090 0x00090 RW 0x4
+ GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
+
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .hash .dynsym .dynstr .rel.dyn .rel.plt .plt .text
+ 01 .dynamic .got .got.plt
+ 02 .dynamic
+ 03
+
+Dynamic section at offset 0x16c contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) 0xb4
+ 0x00000005 \(STRTAB\) 0x118
+ 0x00000006 \(SYMTAB\) 0xd8
+ 0x0000000a \(STRSZ\) 14 \(bytes\)
+ 0x0000000b \(SYMENT\) 16 \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x200200
+ 0x00000002 \(PLTRELSZ\) 8 \(bytes\)
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x130
+ 0x00000011 \(REL\) 0x128
+ 0x00000012 \(RELSZ\) 8 \(bytes\)
+ 0x00000013 \(RELENT\) 8 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rel.dyn' at offset 0x128 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+0+2001fc 00000206 R_386_GLOB_DAT 00000000 foo
+
+Relocation section '.rel.plt' at offset 0x130 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+0+20020c 00000307 R_386_JUMP_SLOT 00000000 bar
+No processor specific unwind information to decode
+
+Symbol table '.dynsym' contains 4 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 00000160 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Symbol table '.symtab' contains 6 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 0020016c 0 OBJECT LOCAL DEFAULT 8 _DYNAMIC
+ +[a-f0-9]+: 00200200 0 OBJECT LOCAL DEFAULT 10 _GLOBAL_OFFSET_TABLE_
+ +[a-f0-9]+: 00000160 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Histogram for bucket list length \(total of 3 buckets\):
+ Length Number % of total Coverage
+ 0 1 \( 33.3%\)
+ 1 1 \( 33.3%\) 33.3%
+ 2 1 \( 33.3%\) 100.0%
+
+No version information found in this file.
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 002001fc R_386_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 20016c
+ +[0-9]+: 00200204 0
+ +[0-9]+: 00200208 0
+ +[0-9]+: 0020020c R_386_JUMP_SLOT bar \+ 156
+#pass
diff --git a/ld/testsuite/ld-i386/libgot-1c.rd b/ld/testsuite/ld-i386/libgot-1c.rd
new file mode 100644
index 0000000..374b03f
--- /dev/null
+++ b/ld/testsuite/ld-i386/libgot-1c.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 002001fc R_386_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 20016c
+ +[0-9]+: 00200204 0
+ +[0-9]+: 00200208 0
+ +[0-9]+: 0020020c R_386_JUMP_SLOT bar \+ 156
+#pass
diff --git a/ld/testsuite/ld-i386/libgot-1d.rd b/ld/testsuite/ld-i386/libgot-1d.rd
new file mode 100644
index 0000000..632b47b
--- /dev/null
+++ b/ld/testsuite/ld-i386/libgot-1d.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 002001fc R_386_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 20016c
+ +[0-9]+: 00200204 0
+ +[0-9]+: 00200208 0
+ +[0-9]+: 0020020c R_386_JUMP_SLOT bar \+ 156
+#pass
diff --git a/ld/testsuite/ld-i386/libno-plt-1b.dd b/ld/testsuite/ld-i386/libno-plt-1b.dd
index eec9d4a..d2f3e93 100644
--- a/ld/testsuite/ld-i386/libno-plt-1b.dd
+++ b/ld/testsuite/ld-i386/libno-plt-1b.dd
@@ -9,11 +9,11 @@ Disassembly of section .text:
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
+[a-f0-9]+: 05 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%eax
- +[a-f0-9]+: 8b 80 ([0-9a-f]{2} ){4}[ ]+mov +-0x[a-f0-9]+\(%eax\),%eax
+ +[a-f0-9]+: 8b 80 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[a-f0-9]+\(%eax\),%eax
+[a-f0-9]+: c3 ret
#...
[0-9a-f]+ <call_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
+[a-f0-9]+: 05 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%eax
- +[a-f0-9]+: ff a0 ([0-9a-f]{2} ){4}[ ]+jmp +\*-0x[0-9a-f]+\(%eax\)
+ +[a-f0-9]+: ff a0 ([0-9a-f]{2} ){4}[ ]+jmp +\*-?0x[0-9a-f]+\(%eax\)
#pass
diff --git a/ld/testsuite/ld-i386/no-plt-1a.dd b/ld/testsuite/ld-i386/no-plt-1a.dd
index 8c76d9b..9d32b85 100644
--- a/ld/testsuite/ld-i386/no-plt-1a.dd
+++ b/ld/testsuite/ld-i386/no-plt-1a.dd
@@ -23,14 +23,14 @@ Disassembly of section .text:
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <call_func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+ +[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#...
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
diff --git a/ld/testsuite/ld-i386/no-plt-1b.dd b/ld/testsuite/ld-i386/no-plt-1b.dd
index 431011c..1318353 100644
--- a/ld/testsuite/ld-i386/no-plt-1b.dd
+++ b/ld/testsuite/ld-i386/no-plt-1b.dd
@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
- +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+ +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass
diff --git a/ld/testsuite/ld-i386/no-plt-1c.dd b/ld/testsuite/ld-i386/no-plt-1c.dd
index ae31742..5422040 100644
--- a/ld/testsuite/ld-i386/no-plt-1c.dd
+++ b/ld/testsuite/ld-i386/no-plt-1c.dd
@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+ +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass
diff --git a/ld/testsuite/ld-i386/no-plt-1e.dd b/ld/testsuite/ld-i386/no-plt-1e.dd
index 56b1a76..af7d9d9 100644
--- a/ld/testsuite/ld-i386/no-plt-1e.dd
+++ b/ld/testsuite/ld-i386/no-plt-1e.dd
@@ -12,7 +12,7 @@ Disassembly of section .text:
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <get_func>
- +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+ +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 93 ([0-9a-f]{2} ){4}[ ]+lea +0x[a-f0-9]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
@@ -26,11 +26,11 @@ Disassembly of section .text:
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#...
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
diff --git a/ld/testsuite/ld-i386/no-plt-1f.dd b/ld/testsuite/ld-i386/no-plt-1f.dd
index 431011c..1318353 100644
--- a/ld/testsuite/ld-i386/no-plt-1f.dd
+++ b/ld/testsuite/ld-i386/no-plt-1f.dd
@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
- +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+ +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass
diff --git a/ld/testsuite/ld-i386/no-plt-1g.dd b/ld/testsuite/ld-i386/no-plt-1g.dd
index 4f18453..cca995b 100644
--- a/ld/testsuite/ld-i386/no-plt-1g.dd
+++ b/ld/testsuite/ld-i386/no-plt-1g.dd
@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
- +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+ +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass
diff --git a/ld/testsuite/ld-i386/no-plt.exp b/ld/testsuite/ld-i386/no-plt.exp
index e0b00ba..42f6def 100644
--- a/ld/testsuite/ld-i386/no-plt.exp
+++ b/ld/testsuite/ld-i386/no-plt.exp
@@ -72,7 +72,7 @@ run_cc_link_tests [list \
"libno-plt-1b.so" \
] \
[list \
- "No PLT (dynamic 1a)" \
+ "Build no PLT (dynamic 1a)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o -Wl,-z,lazy" \
"-Wa,-mx86-used-note=yes" \
@@ -81,7 +81,7 @@ run_cc_link_tests [list \
"no-plt-1a" \
] \
[list \
- "No PLT (dynamic 1b)" \
+ "Build no PLT (dynamic 1b)" \
"-Wl,-z,lazy tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -90,7 +90,7 @@ run_cc_link_tests [list \
"no-plt-1b" \
] \
[list \
- "No PLT (dynamic 1c)" \
+ "Build no PLT (dynamic 1c)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so -Wl,-z,lazy" \
"-Wa,-mx86-used-note=yes" \
@@ -99,7 +99,7 @@ run_cc_link_tests [list \
"no-plt-1c" \
] \
[list \
- "No PLT (static 1d)" \
+ "Build no PLT (static 1d)" \
"-static tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"-Wa,-mx86-used-note=yes" \
@@ -108,7 +108,7 @@ run_cc_link_tests [list \
"no-plt-1d" \
] \
[list \
- "No PLT (PIE 1e)" \
+ "Build no PLT (PIE 1e)" \
"-pie -Wl,-z,lazy tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"-Wa,-mx86-used-note=yes" \
@@ -117,7 +117,7 @@ run_cc_link_tests [list \
"no-plt-1e" \
] \
[list \
- "No PLT (PIE 1f)" \
+ "Build no PLT (PIE 1f)" \
"-pie -Wl,-z,lazy tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -126,7 +126,7 @@ run_cc_link_tests [list \
"no-plt-1f" \
] \
[list \
- "No PLT (PIE 1g)" \
+ "Build no PLT (PIE 1g)" \
"-pie -Wl,-z,lazy tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -135,7 +135,7 @@ run_cc_link_tests [list \
"no-plt-1g" \
] \
[list \
- "No PLT (dynamic 1h)" \
+ "Build no PLT (dynamic 1h)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"-Wa,-mx86-used-note=yes" \
@@ -144,7 +144,7 @@ run_cc_link_tests [list \
"no-plt-1h" \
] \
[list \
- "No PLT (dynamic 1i)" \
+ "Build no PLT (dynamic 1i)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"-Wa,-mx86-used-note=yes" \
@@ -153,7 +153,7 @@ run_cc_link_tests [list \
"no-plt-1i" \
] \
[list \
- "No PLT (static 1j)" \
+ "Build no PLT (static 1j)" \
"-static tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"-Wa,-mx86-used-note=yes" \
@@ -165,7 +165,7 @@ run_cc_link_tests [list \
run_ld_link_exec_tests [list \
[list \
- "No PLT (dynamic 1a)" \
+ "Run no PLT (dynamic 1a)" \
"tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"-Wa,-mx86-used-note=yes" \
@@ -174,7 +174,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1b)" \
+ "Run no PLT (dynamic 1b)" \
"tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -183,7 +183,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1c)" \
+ "Run no PLT (dynamic 1c)" \
"tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -192,7 +192,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (static 1d)" \
+ "Run no PLT (static 1d)" \
"-static tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"-Wa,-mx86-used-note=yes" \
@@ -201,7 +201,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1e)" \
+ "Run no PLT (PIE 1e)" \
"-pie tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"-Wa,-mx86-used-note=yes" \
@@ -210,7 +210,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1f)" \
+ "Run no PLT (PIE 1f)" \
"-pie tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -219,7 +219,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1g)" \
+ "Run no PLT (PIE 1g)" \
"-pie tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -228,7 +228,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1h)" \
+ "Run no PLT (dynamic 1h)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"-Wa,-mx86-used-note=yes" \
@@ -237,7 +237,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1i)" \
+ "Run no PLT (dynamic 1i)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"-Wa,-mx86-used-note=yes" \
@@ -246,7 +246,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (static 1j)" \
+ "Run no PLT (static 1j)" \
"-static tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"-Wa,-mx86-used-note=yes" \
diff --git a/ld/testsuite/ld-i386/pr17057.d b/ld/testsuite/ld-i386/pr17057.d
index 29cc676..af4e6c9 100644
--- a/ld/testsuite/ld-i386/pr17057.d
+++ b/ld/testsuite/ld-i386/pr17057.d
@@ -3,7 +3,10 @@
#ld: -shared -melf_i386
#readelf: -r --wide
-Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 2 entries:
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
Offset Info Type Sym. Value Symbol's Name
-[0-9a-f ]+R_386_JUMP_SLOT +0+ +foo
[0-9a-f ]+R_386_TLS_DESC +0+ +my_tls
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f ]+R_386_JUMP_SLOT +0+ +foo
diff --git a/ld/testsuite/ld-i386/pr28387.d b/ld/testsuite/ld-i386/pr28387.d
new file mode 100644
index 0000000..fd1e980
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr28387.d
@@ -0,0 +1,35 @@
+#as: --32
+#ld: -shared -melf_i386 -z nocombreloc -z noseparate-code --no-ld-generated-unwind-info --hash-style=sysv
+#readelf: -d -r -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+#...
+ +\[[ 0-9]+\] .rel.data +REL +0+128 0+128 0+8 08 +AI +2 +11 +4
+ +\[[ 0-9]+\] .rel.tls +REL +0+130 0+130 0+8 08 +AI +2 +10 +4
+ +\[[ 0-9]+\] .rel.plt +REL +0+138 0+138 0+8 08 +AI +2 +10 +4
+#...
+Dynamic section at offset 0x[0-9a-f]+ contains [0-9]+ entries:
+ +Tag +Type +Name/Value
+#...
+ 0x[0-9a-f]+ +\(PLTRELSZ\) +8 \(bytes\)
+ 0x[0-9a-f]+ +\(PLTREL\) +REL
+ 0x[0-9a-f]+ +\(JMPREL\) +0x138
+#...
+ 0x[0-9a-f]+ +\(REL\) +0x128
+ 0x[0-9a-f]+ +\(RELSZ\) +16 \(bytes\)
+ 0x[0-9a-f]+ +\(RELENT\) +8 \(bytes\)
+#...
+Relocation section '.rel.data' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +foo
+
+Relocation section '.rel.tls' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_TLS_DESC +0+ +foo
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +bar
diff --git a/ld/testsuite/ld-i386/pr28387.s b/ld/testsuite/ld-i386/pr28387.s
new file mode 100644
index 0000000..beb3189
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr28387.s
@@ -0,0 +1,12 @@
+ .text
+ .p2align 4
+ .globl main
+ .type main, @function
+main:
+ leal foo@TLSDESC(%ebx), %eax
+ call *foo@TLSCALL(%eax)
+ call bar@PLT
+ ret
+ .data
+ .dc.a foo
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/pr33260-2.d b/ld/testsuite/ld-i386/pr33260-2.d
new file mode 100644
index 0000000..d84442b
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr33260-2.d
@@ -0,0 +1,6 @@
+#source: pr33260-2.s
+#as: -mrelax-relocations=yes --32
+#ld: -melf_i386 -shared
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-i386/pr33260-2.s b/ld/testsuite/ld-i386/pr33260-2.s
new file mode 100644
index 0000000..0fcd388
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr33260-2.s
@@ -0,0 +1,30 @@
+ .text
+ .p2align 4
+ .globl my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ call __x86.get_pc_thunk.ax
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ movl my_data@GOT(%eax), %eax
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
+ .globl __x86.get_pc_thunk.ax
+ .hidden __x86.get_pc_thunk.ax
+ .type __x86.get_pc_thunk.ax, @function
+__x86.get_pc_thunk.ax:
+ .cfi_startproc
+ movl (%esp), %eax
+ ret
+ .cfi_endproc
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/pr33260.d b/ld/testsuite/ld-i386/pr33260.d
new file mode 100644
index 0000000..fc05e4c
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr33260.d
@@ -0,0 +1,9 @@
+#source: pr33260.s
+#as: -mrelax-relocations=yes --32
+#ld: -melf_i386 -shared
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
diff --git a/ld/testsuite/ld-i386/pr33260.s b/ld/testsuite/ld-i386/pr33260.s
new file mode 100644
index 0000000..9d779f2
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr33260.s
@@ -0,0 +1,46 @@
+ .text
+ .p2align 4
+ .globl my_func
+ .protected my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .p2align 4
+ .globl f
+ .type f, @function
+f:
+ .cfi_startproc
+ call __x86.get_pc_thunk.ax
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ leal vtable@GOTOFF(%eax), %eax
+ ret
+ .cfi_endproc
+ .size f, .-f
+ .section .data.rel,"aw"
+ .align 4
+ .type vtable, @object
+ .size vtable, 8
+vtable:
+ .long my_func
+ .long my_data
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
+ .globl __x86.get_pc_thunk.ax
+ .hidden __x86.get_pc_thunk.ax
+ .type __x86.get_pc_thunk.ax, @function
+__x86.get_pc_thunk.ax:
+ .cfi_startproc
+ movl (%esp), %eax
+ ret
+ .cfi_endproc
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/tlsdesc.rd b/ld/testsuite/ld-i386/tlsdesc.rd
index ec418d1..ebd80b1 100644
--- a/ld/testsuite/ld-i386/tlsdesc.rd
+++ b/ld/testsuite/ld-i386/tlsdesc.rd
@@ -14,7 +14,6 @@ Section Headers:
+\[[ 0-9]+\] \.dynsym +.*
+\[[ 0-9]+\] \.dynstr +.*
+\[[ 0-9]+\] \.rel.dyn +.*
- +\[[ 0-9]+\] \.rel.plt +.*
+\[[ 0-9]+\] \.text +.*
+\[[ 0-9]+\] \.tdata +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000060 00 WAT +0 +0 +1
+\[[ 0-9]+\] \.tbss +NOBITS +[0-9aa-f]+ [0-9a-f]+ 000020 00 WAT +0 +0 +1
@@ -40,12 +39,12 @@ Program Headers:
Section to Segment mapping:
+Segment Sections...
- +00 +.hash .dynsym .dynstr .rel.dyn .rel.plt .text *
+ +00 +.hash .dynsym .dynstr .rel.dyn .text *
+01 +.tdata .dynamic .got .got.plt *
+02 +.dynamic *
+03 +.tdata .tbss *
-Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 25 entries:
Offset +Info +Type +Sym.Value +Sym. Name
[0-9a-f ]+R_386_TLS_TPOFF32
[0-9a-f ]+R_386_TLS_TPOFF *
@@ -62,71 +61,68 @@ Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
[0-9a-f ]+R_386_TLS_TPOFF *
[0-9a-f ]+R_386_TLS_TPOFF *
[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
[0-9a-f ]+R_386_TLS_TPOFF +0+8 +sg3
[0-9a-f ]+R_386_TLS_TPOFF32 0+c +sg4
[0-9a-f ]+R_386_TLS_TPOFF +0+c +sg4
[0-9a-f ]+R_386_TLS_TPOFF +0+10 +sg5
[0-9a-f ]+R_386_TLS_TPOFF32 0+4 +sg2
-
-Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 5 entries:
- Offset +Info +Type +Sym.Value +Sym. Name
[0-9a-f ]+R_386_TLS_DESC * 0+ +sg1
-[0-9a-f ]+R_386_TLS_DESC *
-[0-9a-f ]+R_386_TLS_DESC *
-[0-9a-f ]+R_386_TLS_DESC *
-[0-9a-f ]+R_386_TLS_DESC *
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
- +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
- +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
- +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
- +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
- +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +6 fn1
- +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
- +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6
- +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +6 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +6 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +6 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +6 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +6 sg1
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +5 fn1
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +6 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +6 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +6 sg7
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* FILE +LOCAL +DEFAULT +ABS .*tlsdesc.o
- +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1
- +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2
- +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +7 sl3
- +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +7 sl4
- +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +7 sl5
- +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +7 sl6
- +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +7 sl7
- +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +7 sl8
+ +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +6 sl1
+ +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +6 sl2
+ +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +6 sl3
+ +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +6 sl4
+ +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +6 sl5
+ +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +6 sl6
+ +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +6 sl7
+ +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +6 sl8
.* FILE +LOCAL +DEFAULT +ABS
- +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +8 sH1
- +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_
- +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
- +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +7 sh3
- +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +8 sH2
- +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +8 sH7
- +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +7 sh7
- +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +7 sh8
- +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +8 sH4
- +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +7 sh4
- +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +8 sH3
- +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +7 sh5
- +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +8 sH5
- +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +8 sH6
- +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +8 sH8
- +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +7 sh1
- +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_
- +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +7 sh2
- +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +7 sh6
- +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
- +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
- +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
- +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
- +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
- +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +6 fn1
- +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
- +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6
- +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7
+ +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +7 sH1
+ +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +6 _TLS_MODULE_BASE_
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +8 _DYNAMIC
+ +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +6 sh3
+ +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +7 sH2
+ +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +7 sH7
+ +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +6 sh7
+ +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +6 sh8
+ +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +7 sH4
+ +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +6 sh4
+ +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +7 sH3
+ +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +6 sh5
+ +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +7 sH5
+ +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +7 sH6
+ +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +7 sH8
+ +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +6 sh1
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +6 sh2
+ +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +6 sh6
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +6 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +6 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +6 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +6 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +6 sg1
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +5 fn1
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +6 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +6 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +6 sg7
diff --git a/ld/testsuite/ld-i386/tlsdesc2.d b/ld/testsuite/ld-i386/tlsdesc2.d
index b8569e8..c37557a 100644
--- a/ld/testsuite/ld-i386/tlsdesc2.d
+++ b/ld/testsuite/ld-i386/tlsdesc2.d
@@ -3,8 +3,9 @@
#ld: -melf_i386 -shared -z now
#readelf: -d --wide
+#failif
#...
.*\(PLTRELSZ\).*
.*\(PLTREL\).*
.*\(JMPREL\).*
-#pass
+#...
diff --git a/ld/testsuite/ld-i386/tlsgdesc.rd b/ld/testsuite/ld-i386/tlsgdesc.rd
index 0744aeb..a129bf6 100644
--- a/ld/testsuite/ld-i386/tlsgdesc.rd
+++ b/ld/testsuite/ld-i386/tlsgdesc.rd
@@ -41,22 +41,22 @@ Program Headers:
+01 +.dynamic .got .got.plt *
+02 +.dynamic *
-Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 10 entries:
Offset +Info +Type +Sym.Value +Sym. Name
[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG3
[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG5
[0-9a-f ]+R_386_TLS_DTPMOD3 0+ +sG2
[0-9a-f ]+R_386_TLS_DTPOFF3 0+ +sG2
+[0-9a-f ]+R_386_TLS_DESC +0+ +sG2
[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG4
[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG6
[0-9a-f ]+R_386_TLS_DTPMOD3 0+ +sG1
[0-9a-f ]+R_386_TLS_DTPOFF3 0+ +sG1
+[0-9a-f ]+R_386_TLS_DESC +0+ +sG1
-Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 3 entries:
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entry:
Offset +Info +Type +Sym.Value +Sym. Name
[0-9a-f ]+R_386_JUMP_SLOT +0+ +___tls_get_addr
-[0-9a-f ]+R_386_TLS_DESC +0+ +sG1
-[0-9a-f ]+R_386_TLS_DESC +0+ +sG2
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
index e8b93b3..07a8a2f 100644
--- a/ld/testsuite/ld-ifunc/ifunc.exp
+++ b/ld/testsuite/ld-ifunc/ifunc.exp
@@ -54,6 +54,13 @@ if ![check_shared_lib_support] {
return
}
+set need_direct_extern_access ""
+if { [istarget i?86-*-linux*]
+ || [istarget i?86-*-gnu*] } then {
+ # These targets need direct extern access in some tests.
+ set need_direct_extern_access "$DIRECT_EXTERN_ACCESS_CFLAGS"
+}
+
set saved_ASFLAGS "$ASFLAGS"
if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
set ASFLAGS "$ASFLAGS -mx86-used-note=no"
@@ -497,6 +504,7 @@ if { [check_ifunc_available] } {
{ ifunc-main.c } \
"ifunc-main" \
"ifunc-main.out" \
+ "$need_direct_extern_access" \
] \
[list \
"Run ifunc-main with -fpic" \
@@ -514,6 +522,7 @@ if { [check_ifunc_available] } {
{ ifunc-main.c } \
"ifunc-mainn" \
"ifunc-main.out" \
+ "$need_direct_extern_access" \
] \
[list \
"Run ifunc-main with PIE (-z now)" \
diff --git a/ld/testsuite/ld-loongarch-elf/pic.exp b/ld/testsuite/ld-loongarch-elf/pic.exp
index e449a33..510c3fd 100644
--- a/ld/testsuite/ld-loongarch-elf/pic.exp
+++ b/ld/testsuite/ld-loongarch-elf/pic.exp
@@ -115,31 +115,33 @@ run_ld_link_tests $link_tests
set link_tests_libc [list \
[list \
"$testname readelf -s/-r nopic-global-so" \
- "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
+ "-Wl,--no-as-needed" "" \
{nopic-global.s} \
{{readelf {-s} nopic-global-so.sd} \
{readelf {-r} nopic-global-so.rd}} \
"nopic-global-so" \
+ "" "-L./tmpdir -lnopic-global" \
] \
[list \
"$testname readelf -s/-x nopic-weak-global-so" \
- "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
+ "-Wl,--no-as-needed" "" \
{nopic-weak-global.s} \
{{readelf {-s} nopic-weak-global-so.sd} \
{readelf {-r} nopic-weak-global-so.rd}} \
"nopic-weak-global-so" \
+ "" "-L./tmpdir -lnopic-global" \
] \
]
# 0:name
-# 1:ld/ar leading options, placed before object files
-# 2:ld/ar trailing options, placed after object files
-# 3:assembler options
-# 4:filenames of assembler files
-# 5:list of actions, options and expected outputs.
-# 6:name of output file
-# 7:compiler flags (optional)
+# 1:leading ld or ar options
+# 2:compile options
+# 3:filenames of source files
+# 4:action and options.
+# 5:name of output file
+# 6:language (optional)
+# 7:trailing ld options (optional), placed after object files
run_cc_link_tests $link_tests_libc
@@ -170,10 +172,11 @@ set link_exec_tests [list \
] \
[list \
"$testname" \
- "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \
+ "-Wl,--no-as-needed" "" \
{ nopic-global.s } \
"nopic-global-so" \
- "nopic-global.out" \
+ "nopic-global.out" "" "" "" \
+ "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" \
] \
[list \
"$testname" \
@@ -184,10 +187,11 @@ set link_exec_tests [list \
] \
[list \
"$testname" \
- "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \
+ "-Wl,--no-as-needed" "" \
{ nopic-weak-global.s } \
"nopic-weak-global-so" \
- "nopic-weak-global.out" \
+ "nopic-weak-global.out" "" "" "" \
+ "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" \
] \
]
diff --git a/ld/testsuite/ld-pe/pe-aarch64.d b/ld/testsuite/ld-pe/pe-aarch64.d
index 18b1c9b..ac287a6 100644
--- a/ld/testsuite/ld-pe/pe-aarch64.d
+++ b/ld/testsuite/ld-pe/pe-aarch64.d
@@ -6,7 +6,7 @@
Disassembly of section .text:
-0000000140001000 <___tls_end__>:
+0000000140001000 <_start>:
140001000: d2800281 mov x1, #0x14 // #20
140001004: 14000001 b 140001008 <foo>
diff --git a/ld/testsuite/ld-pe/pe-aarch64.s b/ld/testsuite/ld-pe/pe-aarch64.s
index 5d49350..b9e7dae 100644
--- a/ld/testsuite/ld-pe/pe-aarch64.s
+++ b/ld/testsuite/ld-pe/pe-aarch64.s
@@ -4,6 +4,11 @@
.section .text
+ .global _start
+ .def _start
+ .scl 2 /* C_EXT */
+ .type 32 /* DT_FUNC */
+ .endef
_start:
mov x1, 20
b foo
diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
index de017f0..1e156e4 100644
--- a/ld/testsuite/ld-plugin/lto-binutils.exp
+++ b/ld/testsuite/ld-plugin/lto-binutils.exp
@@ -125,7 +125,7 @@ proc run_lto_binutils_test { lto_tests } {
objdump
{ set dump_prog $objdump }
nm
- { set dump_prog $nm }
+ { set dump_prog "$nm $plug_opt" }
readelf
{ set dump_prog $READELF }
default
@@ -254,24 +254,22 @@ run_lto_binutils_test [list \
] \
]
-if { [check_lto_fat_available] } {
- run_lto_binutils_test [list \
- [list \
- "strip" \
- "-R .gnu.*lto_* -N __gnu_lto_v1" \
- "strip-1a.o" \
- "strip-1a-s-all.o" \
- {{nm -n strip-1a-s-all.nd}} \
- ] \
- [list \
- "strip" \
- "-R .gnu.*lto_* -N __gnu_lto_v1" \
- "libstrip-1a.a" \
- "libstrip-1a-s-all.a" \
- {{nm -n strip-1a-s-all.nd}} \
- ] \
- ]
-}
+run_lto_binutils_test [list \
+ [list \
+ "strip" \
+ "-R .gnu.*lto_* -N __gnu_lto_v1" \
+ "strip-1a.o" \
+ "strip-1a-s-all.o" \
+ {{nm -n strip-1a-s-all.nd}} \
+ ] \
+ [list \
+ "strip" \
+ "-R .gnu.*lto_* -N __gnu_lto_v1" \
+ "libstrip-1a.a" \
+ "libstrip-1a-s-all.a" \
+ {{nm -n strip-1a-s-all.nd}} \
+ ] \
+]
run_cc_link_tests [list \
[list \
diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp
index 38a4036..2e148e4 100644
--- a/ld/testsuite/ld-plugin/plugin.exp
+++ b/ld/testsuite/ld-plugin/plugin.exp
@@ -87,11 +87,11 @@ set regcln "-plugin-opt registercleanup"
set failed_compile 0
set _ ""
set plugin_nm_output ""
-set old_CFLAGS "$CFLAGS_FOR_TARGET"
-append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
+set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+append CFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] || [istarget m9s12x*-*-*] } {
# otherwise get FAILS due to _.frame
- append CFLAGS_FOR_TARGET " -fomit-frame-pointer"
+ append CFLAGS_FOR_TARGET_TEST " -fomit-frame-pointer"
}
if { $can_compile && \
@@ -291,7 +291,7 @@ if { !$can_compile || $failed_compile } {
unsupported [lindex $testitem 0]
}
}
- set CFLAGS_FOR_TARGET "$old_CFLAGS"
+ set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
return
}
@@ -394,4 +394,4 @@ if [ar_simple_create $ar "--plugin $plugin4_path" "tmpdir/libpr20070.a" \
unsupported "PR ld/20070"
}
-set CFLAGS_FOR_TARGET "$old_CFLAGS"
+set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
diff --git a/ld/testsuite/ld-plugin/strip-1a-s-all.nd b/ld/testsuite/ld-plugin/strip-1a-s-all.nd
index 612ba6a..52265c2 100644
--- a/ld/testsuite/ld-plugin/strip-1a-s-all.nd
+++ b/ld/testsuite/ld-plugin/strip-1a-s-all.nd
@@ -1,3 +1,6 @@
#...
-[0-9a-f]* C _?__gnu_lto_slim
+ + U foo2
+ + U foo3
+0+ T foo1
+0+ T main
#pass
diff --git a/ld/testsuite/ld-scripts/libpr33265-1.a b/ld/testsuite/ld-scripts/libpr33265-1.a
new file mode 100644
index 0000000..eab1008
--- /dev/null
+++ b/ld/testsuite/ld-scripts/libpr33265-1.a
@@ -0,0 +1 @@
+GROUP ( libpr33265-1.a )
diff --git a/ld/testsuite/ld-scripts/libpr33265-2.a b/ld/testsuite/ld-scripts/libpr33265-2.a
new file mode 100644
index 0000000..10f4b91
--- /dev/null
+++ b/ld/testsuite/ld-scripts/libpr33265-2.a
@@ -0,0 +1 @@
+GROUP ( ./././././/libpr33265-2.a )
diff --git a/ld/testsuite/ld-scripts/libpr33265-3a.a b/ld/testsuite/ld-scripts/libpr33265-3a.a
new file mode 100644
index 0000000..bdd4f9a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/libpr33265-3a.a
@@ -0,0 +1 @@
+GROUP ( ./././././/libpr33265-3b.a )
diff --git a/ld/testsuite/ld-scripts/libpr33265-3b.a b/ld/testsuite/ld-scripts/libpr33265-3b.a
new file mode 100644
index 0000000..7458328
--- /dev/null
+++ b/ld/testsuite/ld-scripts/libpr33265-3b.a
@@ -0,0 +1 @@
+GROUP ( ./././././/libpr33265-3c.a )
diff --git a/ld/testsuite/ld-scripts/libpr33265-3c.a b/ld/testsuite/ld-scripts/libpr33265-3c.a
new file mode 100644
index 0000000..4583c09
--- /dev/null
+++ b/ld/testsuite/ld-scripts/libpr33265-3c.a
@@ -0,0 +1 @@
+GROUP ( libpr33265-3a.a )
diff --git a/ld/testsuite/ld-scripts/pr24576-1.d b/ld/testsuite/ld-scripts/pr24576-1.d
new file mode 100644
index 0000000..6cc7621
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr24576-1.d
@@ -0,0 +1,3 @@
+#source: default-script.s
+#ld: -defsym _START=0x800 -T default-script.t -T default-script.t
+#error: .*default-script.t\)' appears multiple times
diff --git a/ld/testsuite/ld-scripts/pr24576-2.d b/ld/testsuite/ld-scripts/pr24576-2.d
new file mode 100644
index 0000000..2d26ab3
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr24576-2.d
@@ -0,0 +1,3 @@
+#source: default-script.s
+#ld: -defsym _START=0x800 -T ././/default-script.t -T default-script.t
+#error: .*default-script.t\)' appears multiple times
diff --git a/ld/testsuite/ld-scripts/pr33265-1.d b/ld/testsuite/ld-scripts/pr33265-1.d
new file mode 100644
index 0000000..b0df33d
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr33265-1.d
@@ -0,0 +1,3 @@
+#source: start.s
+#ld: -r --whole-archive -lpr33265-1
+#error: .*group nested too deeply.*
diff --git a/ld/testsuite/ld-scripts/pr33265-2.d b/ld/testsuite/ld-scripts/pr33265-2.d
new file mode 100644
index 0000000..6e9da74
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr33265-2.d
@@ -0,0 +1,3 @@
+#source: start.s
+#ld: -r --whole-archive -lpr33265-2
+#error: .*group nested too deeply.*
diff --git a/ld/testsuite/ld-scripts/pr33265-3.d b/ld/testsuite/ld-scripts/pr33265-3.d
new file mode 100644
index 0000000..a2f42fa
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr33265-3.d
@@ -0,0 +1,3 @@
+#source: start.s
+#ld: -r --whole-archive -lpr33265-3a
+#error: .*group nested too deeply.*
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 5206563..40bfe1a 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -233,9 +233,15 @@ run_dump_test "pr20302"
run_dump_test "output-section-types"
run_dump_test "ld-version"
run_dump_test "ld-version-2"
+run_dump_test "pr24576-1"
+run_dump_test "pr24576-2"
run_dump_test "segment-start" {{name (default)}}
run_dump_test "segment-start" {{name (overridden)} \
{ld -Ttext-segment=0x10000000}}
+run_dump_test "pr33265-1"
+run_dump_test "pr33265-2"
+run_dump_test "pr33265-3"
+
set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 29de93a..c67084c 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -37,7 +37,8 @@ if { ![check_shared_lib_support] } {
# This test can only be run on a couple of ELF platforms.
# Square bracket expressions seem to confuse istarget.
-if { ![istarget hppa*64*-*-hpux*] \
+if { ![istarget *-*-solaris2*] \
+ && ![istarget hppa*64*-*-hpux*] \
&& ![istarget hppa*-*-linux*] \
&& ![istarget i?86-*-elf*] \
&& ![istarget i?86-*-linux*] \
@@ -51,7 +52,6 @@ if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget powerpc*-*-linux*] \
&& ![istarget powerpc*-*-sysv4*] \
&& ![istarget sparc*-*-elf] \
- && ![istarget sparc*-*-solaris2*] \
&& ![istarget sparc*-*-linux*] \
&& ![istarget arm*-*-linux*] \
&& ![istarget alpha*-*-linux*] \
@@ -62,13 +62,20 @@ if { ![istarget hppa*64*-*-hpux*] \
return
}
+set need_direct_extern_access ""
+if { [istarget i?86-*-linux*]
+ || [istarget i?86-*-gnu*] } then {
+ # These targets need direct extern access in some tests.
+ set need_direct_extern_access "$DIRECT_EXTERN_ACCESS_CFLAGS"
+}
+
set tmpdir tmpdir
set SHCFLAG ""
set shared_needs_pic "no"
# Disable all sanitizers.
-set old_CFLAGS "$CFLAGS_FOR_TARGET"
-append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS"
+set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+append CFLAGS_FOR_TARGET_TEST " $NOSANITIZE_CFLAGS"
if { [is_xcoff_format] } {
# Not all the useful features are available with AIX shared
@@ -104,7 +111,7 @@ if [istarget arm*-*-linux*] {
set file [open $tmpdir/movw-detect.c w]
puts $file "void foo(void) { __asm (\"movw r0, #0\"); }"
close $file
- if [run_host_cmd_yesno "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET -c $tmpdir/movw-detect.c -o $tmpdir/movw-detect.o"] {
+ if [run_host_cmd_yesno "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET_TEST -c $tmpdir/movw-detect.c -o $tmpdir/movw-detect.o"] {
set shared_needs_pic "yes"
}
}
@@ -217,14 +224,15 @@ if ![ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- if { ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG $need_direct_extern_access" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG $need_direct_extern_access" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "shared (non PIC)"
} else { if { [is_xcoff_format] } {
shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
} else {
- # Solaris defaults to -z text.
- setup_xfail "*-*-solaris2*"
+ # 64-bit Solaris requires PIC.
+ setup_xfail "sparcv9*-*-solaris2*"
+ setup_xfail "x86_64-*-solaris2*"
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
setup_xfail "powerpc-*-linux-musl"
@@ -270,7 +278,7 @@ if ![ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $
setup_xfail "arm*-*-linux*"
}
setup_xfail "aarch64*-*-linux*"
- # Solaris defaults to -z text.
+ # Solaris refuses to map shared objects with non-zero load addresses.
setup_xfail "*-*-solaris2*"
shared_test shnp "shared (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o shared \
@@ -305,8 +313,9 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
if { [is_xcoff_format] } {
shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
} else {
- # Solaris defaults to -z text.
- setup_xfail "*-*-solaris2*"
+ # 64-bit Solaris requires PIC.
+ setup_xfail "sparcv9*-*-solaris2*"
+ setup_xfail "x86_64-*-solaris2*"
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
setup_xfail "powerpc-*-linux-musl"
@@ -343,4 +352,4 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
}
}
-set CFLAGS_FOR_TARGET "$old_CFLAGS"
+set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index bec5913..227411a 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -364,25 +364,26 @@ if { ![check_compiler_available] } {
# Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records
# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
# with S-records. Also add $NOCF_PROTECTION_CFLAGS for S-records.
-# Also add $NOSANITIZE_CFLAGS for S-records.
-set old_CFLAGS "$CFLAGS_FOR_TARGET"
-append CFLAGS_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
-set old_CXXFLAGS "$CXXFLAGS_FOR_TARGET"
-append CXXFLAGS_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
+# Also add $NOSANITIZE_CFLAGS for S-records. Also add
+# $DIRECT_EXTERN_ACCESS_CFLAGS.
+set old_CFLAGS "$CFLAGS_FOR_TARGET_TEST"
+append CFLAGS_FOR_TARGET_TEST " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS"
+set old_CXXFLAGS "$CXXFLAGS_FOR_TARGET_TEST"
+append CXXFLAGS_FOR_TARGET_TEST " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS $DIRECT_EXTERN_ACCESS_CFLAGS"
# S-records can't handle .note.gnu.property sections.
if { [is_elf_format] \
&& ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
- append CFLAGS_FOR_TARGET " -Wa,-mx86-used-note=no"
- append CXXFLAGS_FOR_TARGET " -Wa,-mx86-used-note=no"
+ append CFLAGS_FOR_TARGET_TEST " -Wa,-mx86-used-note=no"
+ append CXXFLAGS_FOR_TARGET_TEST " -Wa,-mx86-used-note=no"
}
if { ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
unsupported $test1
unsupported $test2
- set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
+ set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
+ set CXXFLAGS_FOR_TARGET_TEST "$old_CXXFLAGS"
return
}
@@ -454,15 +455,15 @@ run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
if { ![is_remote host] && [which $CXX_FOR_TARGET] == 0 } {
untested $test2
- set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
+ set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
+ set CXXFLAGS_FOR_TARGET_TEST "$old_CXXFLAGS"
return
}
if ![ld_compile "$CXX_FOR_TARGET -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/sr3.o] {
unsupported $test2
- set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
+ set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
+ set CXXFLAGS_FOR_TARGET_TEST "$old_CXXFLAGS"
return
}
@@ -488,5 +489,5 @@ setup_xfail "bpf-*-*"
run_srec_test $test2 "tmpdir/sr3.o"
-set CFLAGS_FOR_TARGET "$old_CFLAGS"
-set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
+set CFLAGS_FOR_TARGET_TEST "$old_CFLAGS"
+set CXXFLAGS_FOR_TARGET_TEST "$old_CXXFLAGS"
diff --git a/ld/testsuite/ld-vsb/vsb.exp b/ld/testsuite/ld-vsb/vsb.exp
index 84ae1ed..8eff759 100644
--- a/ld/testsuite/ld-vsb/vsb.exp
+++ b/ld/testsuite/ld-vsb/vsb.exp
@@ -50,6 +50,13 @@ if { ![istarget hppa*64*-*-hpux*] \
return
}
+set need_direct_extern_access ""
+if { [istarget i?86-*-linux*]
+ || [istarget i?86-*-gnu*] } then {
+ # These targets need direct extern access in some tests.
+ set need_direct_extern_access "$DIRECT_EXTERN_ACCESS_CFLAGS"
+}
+
if [is_xcoff_format] {
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*-xcoff*.d]]
} else {
@@ -238,6 +245,7 @@ proc visibility_run {visibility} {
global COMPRESS_LDFLAG
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
+ global need_direct_extern_access
if [ string match $visibility "hidden" ] {
set VSBCFLAG "-DHIDDEN_TEST"
@@ -284,7 +292,7 @@ proc visibility_run {visibility} {
} else {
# Compile the main program. Make sure that PLT is used since PLT
# is expected.
- if ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+ if ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS $need_direct_extern_access" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "visibility ($visibility) (non PIC)"
unsupported "visibility ($visibility)"
} else {
@@ -294,8 +302,8 @@ proc visibility_run {visibility} {
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- if { ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS $need_direct_extern_access" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS $need_direct_extern_access" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "visibility ($visibility) (non PIC)"
} else {
# SunOS non PIC shared libraries don't permit some cases of
diff --git a/ld/testsuite/ld-x86-64/binutils.exp b/ld/testsuite/ld-x86-64/binutils.exp
new file mode 100644
index 0000000..fef9973
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/binutils.exp
@@ -0,0 +1,59 @@
+# Expect script for ELF/x86-64 binutils tests on linker outputs.
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+if ![is_elf_format] {
+ return
+}
+
+if { ![istarget "x86_64-*-*"] } {
+ return
+}
+
+run_ld_link_tests [list \
+ [list \
+ "Build libgot-1.so" \
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ -z nomark-plt $NO_DT_RELR_LDFLAGS" \
+ "" \
+ "--64 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a.rd} \
+ {readelf -aW libgot-1b.rd} \
+ {readelf --got-contents libgot-1c.rd} \
+ {readelf {--got-contents -W} libgot-1d.rd}} \
+ "libgot-1.so" \
+ ] \
+ [list \
+ "Build libgot-1-x32.so" \
+ "-shared -melf32_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ -z nomark-plt $NO_DT_RELR_LDFLAGS" \
+ "" \
+ "--x32 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a-x32.rd} \
+ {readelf -aW libgot-1b-x32.rd} \
+ {readelf --got-contents libgot-1c-x32.rd} \
+ {readelf {--got-contents -W} libgot-1d-x32.rd}} \
+ "libgot-1-x32.so" \
+ ] \
+]
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1c-x32.d b/ld/testsuite/ld-x86-64/dt-relr-1c-x32.d
new file mode 100644
index 0000000..7e3ce293
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/dt-relr-1c-x32.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --x32
+#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS -z nomark-plt --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux*
+
+'RELA' relocation section at offset 0x[0-9a-f]+ contains 24 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +0+ +data1 \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +0+ +data1 \+ 0
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 8 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 12 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func1 \+ 0
+
+Symbol table for image contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1c.d b/ld/testsuite/ld-x86-64/dt-relr-1c.d
new file mode 100644
index 0000000..12fb99e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/dt-relr-1c.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --64
+#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS -z nomark-plt --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux*
+
+'RELA' relocation section at offset 0x[0-9a-f]+ contains 48 bytes:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ +data1 \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ +data1 \+ 0
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 16 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 24 bytes:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func1 \+ 0
+
+Symbol table for image contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1d-x32.d b/ld/testsuite/ld-x86-64/dt-relr-1d-x32.d
new file mode 100644
index 0000000..2327796
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/dt-relr-1d-x32.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --x32
+#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS -z nocombreloc -z nomark-plt --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux*
+
+'RELA' relocation section at offset 0x[0-9a-f]+ contains 24 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +0+ +data1 \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +0+ +data1 \+ 0
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 8 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 12 bytes:
+ +Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func1 \+ 0
+
+Symbol table for image contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1d.d b/ld/testsuite/ld-x86-64/dt-relr-1d.d
new file mode 100644
index 0000000..15b9f56
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/dt-relr-1d.d
@@ -0,0 +1,26 @@
+#source: dt-relr-1.s
+#as: --64
+#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS -z nocombreloc -z nomark-plt --hash-style=sysv
+#readelf: -D -r -s --wide
+#target: x86_64-*-linux*
+
+'RELA' relocation section at offset 0x[0-9a-f]+ contains 48 bytes:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ +data1 \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ +data1 \+ 0
+
+'RELR' relocation section at offset 0x[a-f0-9]+ contains 16 bytes:
+#...
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
+ +[0-9a-f]+ +.*
+#...
+'PLT' relocation section at offset 0x[0-9a-f]+ contains 24 bytes:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func1 \+ 0
+
+Symbol table for image contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +func1
+#pass
diff --git a/ld/testsuite/ld-x86-64/gnu2-tls-1.s b/ld/testsuite/ld-x86-64/gnu2-tls-1.s
new file mode 100644
index 0000000..eca788c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/gnu2-tls-1.s
@@ -0,0 +1,11 @@
+ .section .text.startup,"ax",@progbits
+ .p2align 4
+ .globl main
+ .type main, @function
+main:
+ leaq foo@TLSDESC(%rip), %rax
+ call *foo@TLSCALL(%rax)
+ movl %fs:(%rax), %eax
+ ret
+ .size main, .-main
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/gnu2-tls-1a.rd b/ld/testsuite/ld-x86-64/gnu2-tls-1a.rd
new file mode 100644
index 0000000..3eb926a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/gnu2-tls-1a.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains 1 entry:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU2_TLS Flags: none Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-x86-64/gnu2-tls-1b.rd b/ld/testsuite/ld-x86-64/gnu2-tls-1b.rd
new file mode 100644
index 0000000..33ef8ac
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/gnu2-tls-1b.rd
@@ -0,0 +1,4 @@
+#failif
+#...
+ 0x[a-f0-9]+: Name: GLIBC_ABI_GNU2_TLS Flags: none Version: [0-9]+
+#...
diff --git a/ld/testsuite/ld-x86-64/got-1.s b/ld/testsuite/ld-x86-64/got-1.s
new file mode 100644
index 0000000..7637069
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/got-1.s
@@ -0,0 +1,7 @@
+ .text
+ .globl func
+ .type func, @function
+func:
+ call *foo@GOTPCREL(%rip)
+ jmp bar@PLT
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/libgot-1a-x32.rd b/ld/testsuite/ld-x86-64/libgot-1a-x32.rd
new file mode 100644
index 0000000..6861d65
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1a-x32.rd
@@ -0,0 +1,9 @@
+
+Relocation section '.rela.dyn' at offset 0x128 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+0+200200 00000206 R_X86_64_GLOB_DAT 00000000 foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x134 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+0+200220 00000307 R_X86_64_JUMP_SLOT 00000000 bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1a.rd b/ld/testsuite/ld-x86-64/libgot-1a.rd
new file mode 100644
index 0000000..8ed4470
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1a.rd
@@ -0,0 +1,9 @@
+
+Relocation section '.rela.dyn' at offset 0x1b8 contains 1 entry:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0+200340 0000000200000006 R_X86_64_GLOB_DAT 0000000000000000 foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x1d0 contains 1 entry:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0+200360 0000000300000007 R_X86_64_JUMP_SLOT 0000000000000000 bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1b-x32.rd b/ld/testsuite/ld-x86-64/libgot-1b-x32.rd
new file mode 100644
index 0000000..f900303
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1b-x32.rd
@@ -0,0 +1,119 @@
+ELF Header:
+ Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, little endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: DYN \(Shared object file\)
+ Machine: Advanced Micro Devices X86-64
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 52 \(bytes into file\)
+ Start of section headers: 792 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 32 \(bytes\)
+ Number of program headers: 4
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 14
+ Section header string table index: 13
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] .hash HASH 000000b4 0000b4 000024 04 A 2 0 4
+ \[ 2\] .dynsym DYNSYM 000000d8 0000d8 000040 10 A 3 1 4
+ \[ 3\] .dynstr STRTAB 00000118 000118 00000e 00 A 0 0 1
+ \[ 4\] .rela.dyn RELA 00000128 000128 00000c 0c A 2 0 4
+ \[ 5\] .rela.plt RELA 00000134 000134 00000c 0c AI 2 10 4
+ \[ 6\] .plt PROGBITS 00000140 000140 000020 10 AX 0 0 16
+ \[ 7\] .text PROGBITS 00000160 000160 00000b 00 AX 0 0 1
+ \[ 8\] .dynamic DYNAMIC 0020016c 00016c 000090 08 WA 3 0 4
+ \[ 9\] .got PROGBITS 00200200 000200 000008 08 WA 0 0 8
+ \[10\] .got.plt PROGBITS 00200208 000208 000020 08 WA 0 0 8
+ \[11\] .symtab SYMTAB 00000000 000228 000060 10 12 3 4
+ \[12\] .strtab STRTAB 00000000 000288 00002d 00 0 0 1
+ \[13\] .shstrtab STRTAB 00000000 0002b5 000062 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), I \(info\),
+ L \(link order\), O \(extra OS processing required\), G \(group\), T \(TLS\),
+ C \(compressed\), x \(unknown\), o \(OS specific\), E \(exclude\),
+ D \(mbind\), l \(large\), p \(processor specific\)
+
+There are no section groups in this file.
+
+Program Headers:
+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+ LOAD 0x000000 0x00000000 0x00000000 0x0016b 0x0016b R E 0x200000
+ LOAD 0x00016c 0x0020016c 0x0020016c 0x000bc 0x000bc RW 0x200000
+ DYNAMIC 0x00016c 0x0020016c 0x0020016c 0x00090 0x00090 RW 0x4
+ GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
+
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text
+ 01 .dynamic .got .got.plt
+ 02 .dynamic
+ 03
+
+Dynamic section at offset 0x16c contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) 0xb4
+ 0x00000005 \(STRTAB\) 0x118
+ 0x00000006 \(SYMTAB\) 0xd8
+ 0x0000000a \(STRSZ\) 14 \(bytes\)
+ 0x0000000b \(SYMENT\) 16 \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x200208
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x134
+ 0x00000007 \(RELA\) 0x128
+ 0x00000008 \(RELASZ\) 12 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x128 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+0+200200 00000206 R_X86_64_GLOB_DAT 00000000 foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x134 contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+0+200220 00000307 R_X86_64_JUMP_SLOT 00000000 bar \+ 0
+No processor specific unwind information to decode
+
+Symbol table '.dynsym' contains 4 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 00000160 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Symbol table '.symtab' contains 6 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 0020016c 0 OBJECT LOCAL DEFAULT 8 _DYNAMIC
+ +[a-f0-9]+: 00200208 0 OBJECT LOCAL DEFAULT 10 _GLOBAL_OFFSET_TABLE_
+ +[a-f0-9]+: 00000160 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 00000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Histogram for bucket list length \(total of 3 buckets\):
+ Length Number % of total Coverage
+ 0 1 \( 33.3%\)
+ 1 1 \( 33.3%\) 33.3%
+ 2 1 \( 33.3%\) 100.0%
+
+No version information found in this file.
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200208 20016c
+ +[0-9]+: 00200210 0
+ +[0-9]+: 00200218 0
+ +[0-9]+: 00200220 R_X86_64_JUMP_SLOT bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1b.rd b/ld/testsuite/ld-x86-64/libgot-1b.rd
new file mode 100644
index 0000000..18e4324
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1b.rd
@@ -0,0 +1,119 @@
+ELF Header:
+ Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
+ Class: ELF64
+ Data: 2's complement, little endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: DYN \(Shared object file\)
+ Machine: Advanced Micro Devices X86-64
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 64 \(bytes into file\)
+ Start of section headers: 1160 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 64 \(bytes\)
+ Size of program headers: 56 \(bytes\)
+ Number of program headers: 4
+ Size of section headers: 64 \(bytes\)
+ Number of section headers: 14
+ Section header string table index: 13
+
+Section Headers:
+ \[Nr\] Name Type Address Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 0000000000000000 000000 000000 00 0 0 0
+ \[ 1\] .hash HASH 0000000000000120 000120 000024 04 A 2 0 8
+ \[ 2\] .dynsym DYNSYM 0000000000000148 000148 000060 18 A 3 1 8
+ \[ 3\] .dynstr STRTAB 00000000000001a8 0001a8 00000e 00 A 0 0 1
+ \[ 4\] .rela.dyn RELA 00000000000001b8 0001b8 000018 18 A 2 0 8
+ \[ 5\] .rela.plt RELA 00000000000001d0 0001d0 000018 18 AI 2 10 8
+ \[ 6\] .plt PROGBITS 00000000000001f0 0001f0 000020 10 AX 0 0 16
+ \[ 7\] .text PROGBITS 0000000000000210 000210 00000b 00 AX 0 0 1
+ \[ 8\] .dynamic DYNAMIC 0000000000200220 000220 000120 10 WA 3 0 8
+ \[ 9\] .got PROGBITS 0000000000200340 000340 000008 08 WA 0 0 8
+ \[10\] .got.plt PROGBITS 0000000000200348 000348 000020 08 WA 0 0 8
+ \[11\] .symtab SYMTAB 0000000000000000 000368 000090 18 12 3 8
+ \[12\] .strtab STRTAB 0000000000000000 0003f8 00002d 00 0 0 1
+ \[13\] .shstrtab STRTAB 0000000000000000 000425 000062 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), I \(info\),
+ L \(link order\), O \(extra OS processing required\), G \(group\), T \(TLS\),
+ C \(compressed\), x \(unknown\), o \(OS specific\), E \(exclude\),
+ D \(mbind\), l \(large\), p \(processor specific\)
+
+There are no section groups in this file.
+
+Program Headers:
+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+ LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00021b 0x00021b R E 0x200000
+ LOAD 0x000220 0x0000000000200220 0x0000000000200220 0x000148 0x000148 RW 0x200000
+ DYNAMIC 0x000220 0x0000000000200220 0x0000000000200220 0x000120 0x000120 RW 0x8
+ GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10
+
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text
+ 01 .dynamic .got .got.plt
+ 02 .dynamic
+ 03
+
+Dynamic section at offset 0x220 contains 13 entries:
+ Tag Type Name/Value
+ 0x0000000000000004 \(HASH\) 0x120
+ 0x0000000000000005 \(STRTAB\) 0x1a8
+ 0x0000000000000006 \(SYMTAB\) 0x148
+ 0x000000000000000a \(STRSZ\) 14 \(bytes\)
+ 0x000000000000000b \(SYMENT\) 24 \(bytes\)
+ 0x0000000000000003 \(PLTGOT\) 0x200348
+ 0x0000000000000002 \(PLTRELSZ\) 24 \(bytes\)
+ 0x0000000000000014 \(PLTREL\) RELA
+ 0x0000000000000017 \(JMPREL\) 0x1d0
+ 0x0000000000000007 \(RELA\) 0x1b8
+ 0x0000000000000008 \(RELASZ\) 24 \(bytes\)
+ 0x0000000000000009 \(RELAENT\) 24 \(bytes\)
+ 0x0000000000000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x1b8 contains 1 entry:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0+200340 0000000200000006 R_X86_64_GLOB_DAT 0000000000000000 foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x1d0 contains 1 entry:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0+200360 0000000300000007 R_X86_64_JUMP_SLOT 0000000000000000 bar \+ 0
+No processor specific unwind information to decode
+
+Symbol table '.dynsym' contains 4 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 0000000000000210 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Symbol table '.symtab' contains 6 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ +[a-f0-9]+: 0000000000200220 0 OBJECT LOCAL DEFAULT 8 _DYNAMIC
+ +[a-f0-9]+: 0000000000200348 0 OBJECT LOCAL DEFAULT 10 _GLOBAL_OFFSET_TABLE_
+ +[a-f0-9]+: 0000000000000210 0 FUNC GLOBAL DEFAULT 7 func
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo
+ +[a-f0-9]+: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar
+
+Histogram for bucket list length \(total of 3 buckets\):
+ Length Number % of total Coverage
+ 0 1 \( 33.3%\)
+ 1 1 \( 33.3%\) 33.3%
+ 2 1 \( 33.3%\) 100.0%
+
+No version information found in this file.
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 0000000000200340 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 0000000000200348 200220
+ +[0-9]+: 0000000000200350 0
+ +[0-9]+: 0000000000200358 0
+ +[0-9]+: 0000000000200360 R_X86_64_JUMP_SLOT bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1c-x32.rd b/ld/testsuite/ld-x86-64/libgot-1c-x32.rd
new file mode 100644
index 0000000..a3bdacf
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1c-x32.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200208 20016c
+ +[0-9]+: 00200210 0
+ +[0-9]+: 00200218 0
+ +[0-9]+: 00200220 R_X86_64_JUMP_SLO bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1c.rd b/ld/testsuite/ld-x86-64/libgot-1c.rd
new file mode 100644
index 0000000..fc1a260
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1c.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 000000200340 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 000000200348 200220
+ +[0-9]+: 000000200350 0
+ +[0-9]+: 000000200358 0
+ +[0-9]+: 000000200360 R_X86_64_JUMP_SLO bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1d-x32.rd b/ld/testsuite/ld-x86-64/libgot-1d-x32.rd
new file mode 100644
index 0000000..3e2693e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1d-x32.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200200 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 00200208 20016c
+ +[0-9]+: 00200210 0
+ +[0-9]+: 00200218 0
+ +[0-9]+: 00200220 R_X86_64_JUMP_SLOT bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/libgot-1d.rd b/ld/testsuite/ld-x86-64/libgot-1d.rd
new file mode 100644
index 0000000..341840e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/libgot-1d.rd
@@ -0,0 +1,12 @@
+
+Global Offset Table '.got' contains 1 entry:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 0000000000200340 R_X86_64_GLOB_DAT foo \+ 0
+
+Global Offset Table '.got.plt' contains 4 entries:
+ Index: Address Reloc Sym. Name \+ Addend/Value
+ +[0-9]+: 0000000000200348 200220
+ +[0-9]+: 0000000000200350 0
+ +[0-9]+: 0000000000200358 0
+ +[0-9]+: 0000000000200360 R_X86_64_JUMP_SLOT bar \+ 0
+#pass
diff --git a/ld/testsuite/ld-x86-64/mark-plt-1a.rd b/ld/testsuite/ld-x86-64/mark-plt-1a.rd
index 1234fbe..b0ed702 100644
--- a/ld/testsuite/ld-x86-64/mark-plt-1a.rd
+++ b/ld/testsuite/ld-x86-64/mark-plt-1a.rd
@@ -3,5 +3,5 @@ Version needs section '.gnu.version_r' contains 1 entry:
Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
#...
- 0x[a-f0-9]+: Name: GLIBC_2.36 Flags: none Version: [0-9]+
+ 0x[a-f0-9]+: Name: (GLIBC_2.36|GLIBC_ABI_DT_X86_64_PLT) Flags: none Version: [0-9]+
#pass
diff --git a/ld/testsuite/ld-x86-64/mark-plt-2.rd b/ld/testsuite/ld-x86-64/mark-plt-2.rd
new file mode 100644
index 0000000..b0ed702
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mark-plt-2.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains 1 entry:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+ 0x[a-f0-9]+: Name: (GLIBC_2.36|GLIBC_ABI_DT_X86_64_PLT) Flags: none Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-x86-64/mark-plt-2.s b/ld/testsuite/ld-x86-64/mark-plt-2.s
new file mode 100644
index 0000000..c816567
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mark-plt-2.s
@@ -0,0 +1,13 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ subq $8, %rsp
+ leaq xxx@TLSDESC(%rip), %rax
+ .nops 10
+ call *xxx@TLSCALL(%rax)
+ movl %fs:(%rax), %eax
+ addq $8, %rsp
+ call bar
+ ret
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/no-plt-1a.dd b/ld/testsuite/ld-x86-64/no-plt-1a.dd
index b1d5d7e..89bfaa1 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1a.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1a.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <get_func>
+[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <func_p>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) c7 c2 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +\$0x[0-9a-f]+,%(e|r)dx
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1b.dd b/ld/testsuite/ld-x86-64/no-plt-1b.dd
index 2ab8da5..1f430b8 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1b.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1b.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <.*>
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) 8b 15 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +0x[0-9a-f]+\(%rip\),%(e|r)dx +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1c.dd b/ld/testsuite/ld-x86-64/no-plt-1c.dd
index 1f6ea27..ef772af 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1c.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1c.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) 8b 15 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +0x[0-9a-f]+\(%rip\),%(e|r)dx +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1d.dd b/ld/testsuite/ld-x86-64/no-plt-1d.dd
index 49f34ad..cd500bd 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1d.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1d.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <get_func>
+[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <func_p>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) c7 c2 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +\$0x[0-9a-f]+,%(e|r)dx
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1e.dd b/ld/testsuite/ld-x86-64/no-plt-1e.dd
index 465574f..0180dd3 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1e.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1e.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <get_func>
+[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <.*>
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <func_p>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) 8d 15 ([0-9a-f]{2} ){4}[ ]+(rex |)lea +0x[0-9a-f]+\(%rip\),%(e|r)dx +# [a-f0-9]+ <func_p>
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1f.dd b/ld/testsuite/ld-x86-64/no-plt-1f.dd
index 2ab8da5..1f430b8 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1f.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1f.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <.*>
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) 8b 15 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +0x[0-9a-f]+\(%rip\),%(e|r)dx +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-1g.dd b/ld/testsuite/ld-x86-64/no-plt-1g.dd
index 0526fb0..b6adc0d 100644
--- a/ld/testsuite/ld-x86-64/no-plt-1g.dd
+++ b/ld/testsuite/ld-x86-64/no-plt-1g.dd
@@ -10,8 +10,9 @@ Disassembly of section .text:
+[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <.*>
+[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <.*>
- +[a-f0-9]+: 75 34 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
- +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: 75 37 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+ +[a-f0-9]+: 4(0|8) 8b 15 ([0-9a-f]{2} ){4}[ ]+(rex |)mov +0x[0-9a-f]+\(%rip\),%(e|r)dx +# [a-f0-9]+ <.*>
+ +[a-f0-9]+: (48|67) 39 02[ ]+cmp +%(e|r)ax,\(%(e|r)dx\)
+[a-f0-9]+: 75 2b jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
diff --git a/ld/testsuite/ld-x86-64/no-plt-check1.S b/ld/testsuite/ld-x86-64/no-plt-check1.S
index 61d32b1..4526e5e 100644
--- a/ld/testsuite/ld-x86-64/no-plt-check1.S
+++ b/ld/testsuite/ld-x86-64/no-plt-check1.S
@@ -11,10 +11,12 @@ check:
cmpq func@GOTPCREL(%rip), %rax
jne .L3
#ifdef __LP64__
- cmpq %rax, func_p(%rip)
+ movq func_p@GOTPCREL(%rip), %rdx
+ cmpq %rax, (%rdx)
#else
rex
- cmpl %eax, func_p(%rip)
+ movl func_p@GOTPCREL(%rip), %edx
+ cmpl %eax, (%edx)
#endif
jne .L3
call *func@GOTPCREL(%rip)
diff --git a/ld/testsuite/ld-x86-64/no-plt.exp b/ld/testsuite/ld-x86-64/no-plt.exp
index e78d09a..eb63670 100644
--- a/ld/testsuite/ld-x86-64/no-plt.exp
+++ b/ld/testsuite/ld-x86-64/no-plt.exp
@@ -70,7 +70,7 @@ run_cc_link_tests [list \
"libno-plt-1b.so" \
] \
[list \
- "No PLT (dynamic 1a)" \
+ "Build no PLT (dynamic 1a)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -79,7 +79,7 @@ run_cc_link_tests [list \
"no-plt-1a" \
] \
[list \
- "No PLT (dynamic 1b)" \
+ "Build no PLT (dynamic 1b)" \
"tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -88,7 +88,7 @@ run_cc_link_tests [list \
"no-plt-1b" \
] \
[list \
- "No PLT (dynamic 1c)" \
+ "Build no PLT (dynamic 1c)" \
"$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -97,7 +97,7 @@ run_cc_link_tests [list \
"no-plt-1c" \
] \
[list \
- "No PLT (static 1d)" \
+ "Build no PLT (static 1d)" \
"-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -106,7 +106,7 @@ run_cc_link_tests [list \
"no-plt-1d" \
] \
[list \
- "No PLT (PIE 1e)" \
+ "Build no PLT (PIE 1e)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -115,7 +115,7 @@ run_cc_link_tests [list \
"no-plt-1e" \
] \
[list \
- "No PLT (PIE 1f)" \
+ "Build no PLT (PIE 1f)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -124,7 +124,7 @@ run_cc_link_tests [list \
"no-plt-1f" \
] \
[list \
- "No PLT (PIE 1g)" \
+ "Build no PLT (PIE 1g)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -136,7 +136,7 @@ run_cc_link_tests [list \
run_ld_link_exec_tests [list \
[list \
- "No PLT (dynamic 1a)" \
+ "Run no PLT (dynamic 1a)" \
"tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -145,7 +145,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1b)" \
+ "Run no PLT (dynamic 1b)" \
"tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -154,7 +154,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (dynamic 1c)" \
+ "Run no PLT (dynamic 1c)" \
"tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -163,7 +163,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (static 1d)" \
+ "Run no PLT (static 1d)" \
"-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -172,7 +172,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1e)" \
+ "Run no PLT (PIE 1e)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"-Wa,-mx86-used-note=yes" \
@@ -181,7 +181,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1f)" \
+ "Run no PLT (PIE 1f)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
@@ -190,7 +190,7 @@ run_ld_link_exec_tests [list \
"pass.out" \
] \
[list \
- "No PLT (PIE 1g)" \
+ "Run no PLT (PIE 1g)" \
"-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"-Wa,-mx86-used-note=yes" \
diff --git a/ld/testsuite/ld-x86-64/pr28387-x32.d b/ld/testsuite/ld-x86-64/pr28387-x32.d
new file mode 100644
index 0000000..0302126
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr28387-x32.d
@@ -0,0 +1,36 @@
+#source: pr28387.s
+#as: --x32
+#ld: -shared -melf32_x86_64 -z nocombreloc -z nomark-plt -z noseparate-code -z max-page-size=0x200000 --no-ld-generated-unwind-info --hash-style=sysv
+#readelf: -d -r -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+#...
+ +\[[ 0-9]+\] .rela.data +RELA +0+128 0+128 0+c 0c +AI +2 +12 +4
+ +\[[ 0-9]+\] .rela.tls +RELA +0+134 0+134 0+c 0c +AI +2 +11 +4
+ +\[[ 0-9]+\] .rela.plt +RELA +0+140 0+140 0+c 0c +AI +2 +11 +4
+#...
+Dynamic section at offset 0x[0-9a-f]+ contains [0-9]+ entries:
+ +Tag +Type +Name/Value
+#...
+ 0x[0-9a-f]+ +\(PLTRELSZ\) +12 \(bytes\)
+ 0x[0-9a-f]+ +\(PLTREL\) +RELA
+ 0x[0-9a-f]+ +\(JMPREL\) +0x140
+#...
+ 0x[0-9a-f]+ +\(RELA\) +0x128
+ 0x[0-9a-f]+ +\(RELASZ\) +24 \(bytes\)
+ 0x[0-9a-f]+ +\(RELAENT\) +12 \(bytes\)
+#...
+Relocation section '.rela.data' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +0+ +foo \+ 0
+
+Relocation section '.rela.tls' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_TLSDESC +0+ +foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +bar \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr28387.d b/ld/testsuite/ld-x86-64/pr28387.d
new file mode 100644
index 0000000..07df0fb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr28387.d
@@ -0,0 +1,35 @@
+#as: --64
+#ld: -shared -melf_x86_64 -z nocombreloc -z nomark-plt -z noseparate-code -z max-page-size=0x200000 --no-ld-generated-unwind-info --hash-style=sysv
+#readelf: -d -r -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+#...
+ +\[[ 0-9]+\] .rela.data +RELA +0+1b8 0+1b8 0+18 18 +AI +2 +12 +8
+ +\[[ 0-9]+\] .rela.tls +RELA +0+1d0 0+1d0 0+18 18 +AI +2 +11 +8
+ +\[[ 0-9]+\] .rela.plt +RELA +0+1e8 0+1e8 0+18 18 +AI +2 +11 +8
+#...
+Dynamic section at offset 0x[0-9a-f]+ contains [0-9]+ entries:
+ +Tag +Type +Name/Value
+#...
+ 0x[0-9a-f]+ +\(PLTRELSZ\) +24 \(bytes\)
+ 0x[0-9a-f]+ +\(PLTREL\) +RELA
+ 0x[0-9a-f]+ +\(JMPREL\) +0x1e8
+#...
+ 0x[0-9a-f]+ +\(RELA\) +0x1b8
+ 0x[0-9a-f]+ +\(RELASZ\) +48 \(bytes\)
+ 0x[0-9a-f]+ +\(RELAENT\) +24 \(bytes\)
+#...
+Relocation section '.rela.data' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ +foo \+ 0
+
+Relocation section '.rela.tls' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_TLSDESC +0+ +foo \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +bar \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr28387.s b/ld/testsuite/ld-x86-64/pr28387.s
new file mode 100644
index 0000000..bbfa7b5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr28387.s
@@ -0,0 +1,11 @@
+ .text
+ .globl main
+ .type main, @function
+main:
+ leaq foo@TLSDESC(%rip), %rax
+ call *foo@TLSCALL(%rax)
+ call bar@PLT
+ ret
+ .data
+ .dc.a foo
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/pr33260-2-x32.d b/ld/testsuite/ld-x86-64/pr33260-2-x32.d
new file mode 100644
index 0000000..383129a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260-2-x32.d
@@ -0,0 +1,6 @@
+#source: pr33260-2.s
+#as: -mrelax-relocations=yes --x32
+#ld: -melf32_x86_64 -shared
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr33260-2.d b/ld/testsuite/ld-x86-64/pr33260-2.d
new file mode 100644
index 0000000..7f237c8
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260-2.d
@@ -0,0 +1,6 @@
+#source: pr33260-2.s
+#as: -mrelax-relocations=yes --64
+#ld: -melf_x86_64 -shared
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr33260-2.s b/ld/testsuite/ld-x86-64/pr33260-2.s
new file mode 100644
index 0000000..061137d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260-2.s
@@ -0,0 +1,19 @@
+ .text
+ .p2align 4
+ .globl my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ movq my_data@GOTPCREL(%rip), %rax
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/pr33260-x32.d b/ld/testsuite/ld-x86-64/pr33260-x32.d
new file mode 100644
index 0000000..42088fb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260-x32.d
@@ -0,0 +1,9 @@
+#source: pr33260.s
+#as: -mrelax-relocations=yes --x32
+#ld: -melf32_x86_64 -shared
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr33260.d b/ld/testsuite/ld-x86-64/pr33260.d
new file mode 100644
index 0000000..18b5472
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260.d
@@ -0,0 +1,9 @@
+#source: pr33260.s
+#as: -mrelax-relocations=yes --64 -defsym __x86_64__=1
+#ld: -melf_x86_64 -shared
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr33260.s b/ld/testsuite/ld-x86-64/pr33260.s
new file mode 100644
index 0000000..e48c3ce
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33260.s
@@ -0,0 +1,40 @@
+ .text
+ .p2align 4
+ .globl my_func
+ .protected my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .p2align 4
+ .globl f
+ .type f, @function
+f:
+ .cfi_startproc
+ leaq vtable(%rip), %rax
+ ret
+ .cfi_endproc
+ .size f, .-f
+ .section .data.rel,"aw"
+ .type vtable, @object
+.ifdef __x86_64__
+ .align 16
+ .size vtable, 16
+.else
+ .align 8
+ .size vtable, 8
+.endif
+vtable:
+ .dc.a my_func
+ .dc.a my_data
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/pr33292-x32.d b/ld/testsuite/ld-x86-64/pr33292-x32.d
new file mode 100644
index 0000000..0d6cf81
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33292-x32.d
@@ -0,0 +1,10 @@
+#source: pr33292.s
+#as: --x32 -mx86-used-note=yes
+#ld: -shared -m elf32_x86_64 -z noindirect-extern-access
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used: x86-64-baseline
diff --git a/ld/testsuite/ld-x86-64/pr33292.d b/ld/testsuite/ld-x86-64/pr33292.d
new file mode 100644
index 0000000..456b849
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33292.d
@@ -0,0 +1,9 @@
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -shared -m elf_x86_64 -z noindirect-extern-access
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used: x86-64-baseline
diff --git a/ld/testsuite/ld-x86-64/pr33292.s b/ld/testsuite/ld-x86-64/pr33292.s
new file mode 100644
index 0000000..8d14e88
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr33292.s
@@ -0,0 +1,34 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xb0008000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
+
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ ret
+ .section .note.GNU-stack
diff --git a/ld/testsuite/ld-x86-64/tlsdesc.pd b/ld/testsuite/ld-x86-64/tlsdesc.pd
index 490fc90..7e124ea 100644
--- a/ld/testsuite/ld-x86-64/tlsdesc.pd
+++ b/ld/testsuite/ld-x86-64/tlsdesc.pd
@@ -10,10 +10,10 @@
Disassembly of section .plt:
[0-9a-f]+ <.plt>:
- [0-9a-f]+: ff 35 .. .. 20 00 push .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
- [0-9a-f]+: ff 25 .. .. 20 00 jmp \*.*\(%rip\) # 201360 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ [0-9a-f]+: ff 35 .. .. 20 00 push .*\(%rip\) # 201328 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ [0-9a-f]+: ff 25 .. .. 20 00 jmp \*.*\(%rip\) # 201330 <_GLOBAL_OFFSET_TABLE_\+0x10>
[0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)
[0-9a-f]+: f3 0f 1e fa endbr64
- [0-9a-f]+: ff 35 .. .. 20 00 push .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
- [0-9a-f]+: ff 25 .. .. 20 00 jmp \*.*\(%rip\) # 201348 <.*>
+ [0-9a-f]+: ff 35 .. .. 20 00 push .*\(%rip\) # 201328 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ [0-9a-f]+: ff 25 .. .. 20 00 jmp \*.*\(%rip\) # 201318 <.*>
diff --git a/ld/testsuite/ld-x86-64/tlsdesc.rd b/ld/testsuite/ld-x86-64/tlsdesc.rd
index 98bda5b..14e945a 100644
--- a/ld/testsuite/ld-x86-64/tlsdesc.rd
+++ b/ld/testsuite/ld-x86-64/tlsdesc.rd
@@ -14,14 +14,13 @@ Section Headers:
+\[[ 0-9]+\] .dynsym +.*
+\[[ 0-9]+\] .dynstr +.*
+\[[ 0-9]+\] .rela.dyn +.*
- +\[[ 0-9]+\] .rela.plt +.*
+\[[ 0-9]+\] .plt +PROGBITS +0+3b0 0+3b0 0+20 10 +AX +0 +0 +(4|16)
+\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+153 00 +AX +0 +0 4096
+\[[ 0-9]+\] .tdata +PROGBITS +0+201153 0+1153 0+60 00 WAT +0 +0 +1
+\[[ 0-9]+\] .tbss +NOBITS +0+2011b3 0+11b3 0+20 00 WAT +0 +0 +1
- +\[[ 0-9]+\] .dynamic +DYNAMIC +0+2011b8 0+11b8 0+150 10 +WA +3 +0 +8
- +\[[ 0-9]+\] .got +PROGBITS +0+201308 0+1308 0+48 08 +WA +0 +0 +8
- +\[[ 0-9]+\] .got.plt +PROGBITS +0+201350 0+1350 0+68 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+2011b8 0+11b8 0+120 10 +WA +3 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+2012d8 0+12d8 0+48 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .got.plt +PROGBITS +0+201320 0+1320 0+68 08 +WA +0 +0 +8
+\[[ 0-9]+\] .symtab +.*
+\[[ 0-9]+\] .strtab +.*
+\[[ 0-9]+\] .shstrtab +.*
@@ -35,18 +34,18 @@ There are [0-9]+ program headers, starting at offset [0-9]+
Program Headers:
+Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x200000
- +LOAD +0x0+1153 0x0+201153 0x0+201153 0x0+265 0x0+265 RW +0x200000
- +DYNAMIC +0x0+11b8 0x0+2011b8 0x0+2011b8 0x0+150 0x0+150 RW +0x8
+ +LOAD +0x0+1153 0x0+201153 0x0+201153 0x0+235 0x0+235 RW +0x200000
+ +DYNAMIC +0x0+11b8 0x0+2011b8 0x0+2011b8 0x0+120 0x0+120 RW +0x8
+TLS +0x0+1153 0x0+201153 0x0+201153 0x0+60 0x0+80 R +0x1
Section to Segment mapping:
+Segment Sections...
- +00 +.hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
+ +00 +.hash .dynsym .dynstr .rela.dyn .plt .text *
+01 +.tdata .dynamic .got .got.plt *
+02 +.dynamic *
+03 +.tdata .tbss *
-Dynamic section at offset 0x[0-9a-f]+ contains 16 entries:
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+Tag +Type +Name/Value
0x[0-9a-f]+ +\(HASH\).*
0x[0-9a-f]+ +\(STRTAB\).*
@@ -54,87 +53,81 @@ Dynamic section at offset 0x[0-9a-f]+ contains 16 entries:
0x[0-9a-f]+ +\(STRSZ\).*
0x[0-9a-f]+ +\(SYMENT\).*
0x[0-9a-f]+ +\(PLTGOT\).*
- 0x[0-9a-f]+ +\(PLTRELSZ\).*
- 0x[0-9a-f]+ +\(PLTREL\).*
- 0x[0-9a-f]+ +\(JMPREL\).*
0x[0-9a-f]+ +\(TLSDESC_PLT\) +0x3c0
- 0x[0-9a-f]+ +\(TLSDESC_GOT\) +0x201348
+ 0x[0-9a-f]+ +\(TLSDESC_GOT\) +0x201318
0x[0-9a-f]+ +\(RELA\).*
0x[0-9a-f]+ +\(RELASZ\).*
0x[0-9a-f]+ +\(RELAENT\).*
0x[0-9a-f]+ +\(FLAGS\).*
0x[0-9a-f]+ +\(NULL\).*
-Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 13 entries:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
-0+201308 +[0-9a-f]+ R_X86_64_TPOFF64 +24
-0+201310 +[0-9a-f]+ R_X86_64_TPOFF64 +30
-0+201318 +[0-9a-f]+ R_X86_64_TPOFF64 +64
-0+201328 +[0-9a-f]+ R_X86_64_TPOFF64 +50
-0+201330 +[0-9a-f]+ R_X86_64_TPOFF64 +70
-0+201340 +[0-9a-f]+ R_X86_64_TPOFF64 +44
-0+201320 +[0-9a-f]+ R_X86_64_TPOFF64 +0+10 sg5 \+ 0
-0+201338 +[0-9a-f]+ R_X86_64_TPOFF64 +0+4 sg2 \+ 0
-
-Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 5 entries:
- +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
-0+201398 +[0-9a-f]+ R_X86_64_TLSDESC +0+ sg1 \+ 0
-0+201368 +[0-9a-f]+ R_X86_64_TLSDESC +20
-0+2013a8 +[0-9a-f]+ R_X86_64_TLSDESC +40
-0+201378 +[0-9a-f]+ R_X86_64_TLSDESC +60
-0+201388 +[0-9a-f]+ R_X86_64_TLSDESC +0
+0+2012d8 +[0-9a-f]+ R_X86_64_TPOFF64 +24
+0+2012e0 +[0-9a-f]+ R_X86_64_TPOFF64 +30
+0+2012e8 +[0-9a-f]+ R_X86_64_TPOFF64 +64
+0+2012f8 +[0-9a-f]+ R_X86_64_TPOFF64 +50
+0+201300 +[0-9a-f]+ R_X86_64_TPOFF64 +70
+0+201310 +[0-9a-f]+ R_X86_64_TPOFF64 +44
+0+201338 +[0-9a-f]+ R_X86_64_TLSDESC +20
+0+201348 +[0-9a-f]+ R_X86_64_TLSDESC +60
+0+201358 +[0-9a-f]+ R_X86_64_TLSDESC +0
+0+201378 +[0-9a-f]+ R_X86_64_TLSDESC +40
+0+2012f0 +[0-9a-f]+ R_X86_64_TPOFF64 +0+10 sg5 \+ 0
+0+201308 +[0-9a-f]+ R_X86_64_TPOFF64 +0+4 sg2 \+ 0
+0+201368 +[0-9a-f]+ R_X86_64_TLSDESC +0+ sg1 \+ 0
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +8 sg8
- +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +8 sg3
- +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +8 sg4
- +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +8 sg5
- +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +8 sg1
- +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +7 fn1
- +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +8 sg2
- +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +8 sg6
- +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +8 sg7
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +6 fn1
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* FILE +LOCAL +DEFAULT +ABS .*tlsdesc.o
- +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +8 sl1
- +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +8 sl2
- +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +8 sl3
- +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +8 sl4
- +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +8 sl5
- +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +8 sl6
- +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +8 sl7
- +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +8 sl8
+ +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1
+ +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2
+ +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +7 sl3
+ +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +7 sl4
+ +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +7 sl5
+ +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +7 sl6
+ +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +7 sl7
+ +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +7 sl8
.* FILE +LOCAL +DEFAULT +ABS
- +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +9 sH1
- +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +8 _TLS_MODULE_BASE_
- +[0-9]+: 0+2011b8 +0 +OBJECT +LOCAL +DEFAULT +10 _DYNAMIC
- +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +8 sh3
- +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +9 sH2
- +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +9 sH7
- +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +8 sh7
- +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +8 sh8
- +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +9 sH4
- +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +8 sh4
- +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +9 sH3
- +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +8 sh5
- +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +9 sH5
- +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +9 sH6
- +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +9 sH8
- +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +8 sh1
- +[0-9]+: 0+201350 +0 +OBJECT +LOCAL +DEFAULT +12 _GLOBAL_OFFSET_TABLE_
- +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +8 sh2
- +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +8 sh6
- +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +8 sg8
- +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +8 sg3
- +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +8 sg4
- +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +8 sg5
- +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +8 sg1
- +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +7 fn1
- +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +8 sg2
- +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +8 sg6
- +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +8 sg7
+ +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +8 sH1
+ +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_
+ +[0-9]+: 0+2011b8 +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
+ +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +7 sh3
+ +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +8 sH2
+ +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +8 sH7
+ +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +7 sh7
+ +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +7 sh8
+ +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +8 sH4
+ +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +7 sh4
+ +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +8 sH3
+ +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +7 sh5
+ +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +8 sH5
+ +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +8 sH6
+ +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +8 sH8
+ +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +7 sh1
+ +[0-9]+: 0+201320 +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +7 sh2
+ +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +7 sh6
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +6 fn1
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7
diff --git a/ld/testsuite/ld-x86-64/tlsdesc2.d b/ld/testsuite/ld-x86-64/tlsdesc2.d
index 8679757..d0f5ebf 100644
--- a/ld/testsuite/ld-x86-64/tlsdesc2.d
+++ b/ld/testsuite/ld-x86-64/tlsdesc2.d
@@ -3,8 +3,8 @@
#ld: -melf_x86_64 -shared -z now
#readelf: -d --wide
-#...
+#failif
.*\(PLTRELSZ\).*
.*\(PLTREL\).*
.*\(JMPREL\).*
-#pass
+#...
diff --git a/ld/testsuite/ld-x86-64/tlsgdesc.rd b/ld/testsuite/ld-x86-64/tlsgdesc.rd
index ca8f19b..ef15ce9 100644
--- a/ld/testsuite/ld-x86-64/tlsgdesc.rd
+++ b/ld/testsuite/ld-x86-64/tlsgdesc.rd
@@ -41,22 +41,22 @@ Program Headers:
+01 +.dynamic .got .got.plt *
+02 +.dynamic *
-Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 10 entries:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +0+100000012 R_X86_64_TPOFF64 +0+ sG3 \+ 0
[0-9a-f]+ +0+200000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
[0-9a-f]+ +0+300000010 R_X86_64_DTPMOD64 +0+ sG2 \+ 0
[0-9a-f]+ +0+300000011 R_X86_64_DTPOFF64 +0+ sG2 \+ 0
+[0-9a-f]+ +0+300000024 R_X86_64_TLSDESC +0+ sG2 \+ 0
[0-9a-f]+ +0+400000012 R_X86_64_TPOFF64 +0+ sG4 \+ 0
[0-9a-f]+ +0+600000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
[0-9a-f]+ +0+800000010 R_X86_64_DTPMOD64 +0+ sG1 \+ 0
[0-9a-f]+ +0+800000011 R_X86_64_DTPOFF64 +0+ sG1 \+ 0
+[0-9a-f]+ +0+800000024 R_X86_64_TLSDESC +0+ sG1 \+ 0
-Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 3 entries:
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +0+500000007 R_X86_64_JUMP_SLOT +0+ __tls_get_addr \+ 0
-[0-9a-f]+ +0+800000024 R_X86_64_TLSDESC +0+ sG1 \+ 0
-[0-9a-f]+ +0+300000024 R_X86_64_TLSDESC +0+ sG2 \+ 0
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
diff --git a/ld/testsuite/ld-x86-64/x86-64-64-export-class.rd b/ld/testsuite/ld-x86-64/x86-64-64-export-class.rd
index 308e307..4a0bfa1 100644
--- a/ld/testsuite/ld-x86-64/x86-64-64-export-class.rd
+++ b/ld/testsuite/ld-x86-64/x86-64-64-export-class.rd
@@ -1,11 +1,11 @@
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains [0-9]+ entries:
* Offset * Info * Type * Sym\. *Value * Sym\. * Name * \+ * Addend
+000012340000 000000000008 R_X86_64_RELATIVE 123400a0
000012340010 000000000008 R_X86_64_RELATIVE 123400a0
000012340020 000000000008 R_X86_64_RELATIVE 123400a0
+000012340040 000000000008 R_X86_64_RELATIVE 123400a0
+000012340050 000000000008 R_X86_64_RELATIVE 123400a0
000012340060 000000000008 R_X86_64_RELATIVE 123400a0
000012340070 000000000008 R_X86_64_RELATIVE 123400a0
000012340080 000000000008 R_X86_64_RELATIVE 123400a0
000012340090 000000000008 R_X86_64_RELATIVE 123400a0
-000012340000 [0-9a-f]+00000001 R_X86_64_64 00000000123400a0 protected_baz \+ 0
-000012340040 [0-9a-f]+00000001 R_X86_64_64 00000000123400a0 protected_foo \+ 0
-000012340050 [0-9a-f]+00000001 R_X86_64_64 00000000123400a0 protected_bar \+ 0
diff --git a/ld/testsuite/ld-x86-64/x86-64-x32-export-class.rd b/ld/testsuite/ld-x86-64/x86-64-x32-export-class.rd
index 4ea93ba..5018229 100644
--- a/ld/testsuite/ld-x86-64/x86-64-x32-export-class.rd
+++ b/ld/testsuite/ld-x86-64/x86-64-x32-export-class.rd
@@ -1,11 +1,11 @@
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains [0-9]+ entries:
* Offset * Info * Type * Sym\. *Value * Sym\. * Name * \+ * Addend
+12340000 00000008 R_X86_64_RELATIVE 123400a0
12340010 00000008 R_X86_64_RELATIVE 123400a0
12340020 00000008 R_X86_64_RELATIVE 123400a0
+12340040 00000008 R_X86_64_RELATIVE 123400a0
+12340050 00000008 R_X86_64_RELATIVE 123400a0
12340060 00000008 R_X86_64_RELATIVE 123400a0
12340070 00000008 R_X86_64_RELATIVE 123400a0
12340080 00000008 R_X86_64_RELATIVE 123400a0
12340090 00000008 R_X86_64_RELATIVE 123400a0
-12340000 [0-9a-f]+0a R_X86_64_32 123400a0 protected_baz \+ 0
-12340040 [0-9a-f]+0a R_X86_64_32 123400a0 protected_foo \+ 0
-12340050 [0-9a-f]+0a R_X86_64_32 123400a0 protected_bar \+ 0
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 3d873a7..acdcbaf 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -534,6 +534,10 @@ run_dump_test "dt-relr-1a"
run_dump_test "dt-relr-1a-x32"
run_dump_test "dt-relr-1b"
run_dump_test "dt-relr-1b-x32"
+run_dump_test "dt-relr-1c"
+run_dump_test "dt-relr-1c-x32"
+run_dump_test "dt-relr-1d"
+run_dump_test "dt-relr-1d-x32"
run_dump_test "pr30787"
run_dump_test "pr31047"
run_dump_test "pr31047-x32"
@@ -564,6 +568,14 @@ run_dump_test "pr32591-3-x32"
run_dump_test "pr32591-4"
run_dump_test "pr32591-4-x32"
run_dump_test "pr32809"
+run_dump_test "pr33260"
+run_dump_test "pr33260-x32"
+run_dump_test "pr33260-2"
+run_dump_test "pr33260-2-x32"
+run_dump_test "pr33292"
+run_dump_test "pr33292-x32"
+run_dump_test "pr28387"
+run_dump_test "pr28387-x32"
if { ![skip_sframe_tests] } {
run_dump_test "sframe-simple-1"
@@ -1001,7 +1013,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr17689.so" \
"-shared" \
- "-fPIC -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -fPIC -Wa,-mx86-used-note=yes" \
{ pr17689a.c } \
{} \
"pr17689.so" \
@@ -1009,7 +1021,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr17689now.so with -z now" \
"-shared -Wl,-z,now" \
- "-fPIC -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -fPIC -Wa,-mx86-used-note=yes" \
{ pr17689a.c } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now.so" \
@@ -1017,30 +1029,30 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr17689b.o" \
"" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr17689b.S } \
{} \
] \
[list \
"Build pr17689 with PIE without -fPIE" \
- "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
- "-Wa,-mx86-used-note=yes" \
+ "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,noindirect-extern-access" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
{{readelf {-Wr} pr17689.rd}} \
"pr17689" \
] \
[list \
"Build pr17689 with PIE -z now without -fPIE" \
- "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \
- "-Wa,-mx86-used-note=yes" \
+ "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now -Wl,-z,noindirect-extern-access" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now" \
] \
[list \
"Build pr17827 with PIE without -fPIE" \
- "-Wl,--as-needed tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
- "-Wa,-mx86-used-note=yes" \
+ "-Wl,--as-needed tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,noindirect-extern-access" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
{{readelf {-Wr} pr17827.rd}} \
"pr17827" \
@@ -1145,7 +1157,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build property 1 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-no-copy.S} \
{{readelf {-n} property-1a.r}} \
"property-1.o" \
@@ -1169,7 +1181,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build property 2 (.o)" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{pass.c property-stack.S} \
{{readelf {-n} property-2a.r}} \
"property-2.o" \
@@ -1193,7 +1205,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build property-6.o" \
"-r -nostdlib" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{property-6b.c property-stack.S} \
{{readelf {-n} property-2a.r}} \
"property-6.o" \
@@ -1224,16 +1236,16 @@ if { [isnative] && [check_compiler_available] } {
] \
[list \
"Build pr22001-1.so" \
- "-shared" \
- "-fPIC -Wa,-mx86-used-note=yes" \
+ "-shared -Wl,-z,noindirect-extern-access" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -fPIC -Wa,-mx86-used-note=yes" \
{ pr22001-1a.c } \
{} \
"pr22001-1.so" \
] \
[list \
"Build pr22001-1a" \
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext,-z,noindirect-extern-access tmpdir/pr22001-1.so" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1b.c } \
{{error_output "pr22001-1a.err"}} \
"pr22001-1a" \
@@ -1241,7 +1253,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr21997-1.so" \
"-shared" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ property-stack.S property-no-copy.S pr21997-1a.S } \
{} \
"pr21997-1.so" \
@@ -1249,7 +1261,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr21997-1a" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr21997-1b.c } \
{{error_output "pr21997-1a.err"}} \
"pr21997-1a" \
@@ -1395,7 +1407,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build protected-func-2 without PIE" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2b.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ protected-func-1b.c } \
{{error_output "pr28875-func.err"}} \
"protected-func-2" \
@@ -1411,7 +1423,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build protected-func-2a without PIE" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2c.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ protected-func-1b.c } \
{{error_output "pr28875-func.err"}} \
"protected-func-2a" \
@@ -1435,7 +1447,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build protected-data-1 without PIE" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-data-1b.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ protected-data-1b.c } \
{{error_output "pr28875-data.err"}} \
"protected-data-1" \
@@ -1529,7 +1541,7 @@ if { [isnative] && [check_compiler_available] } {
{ pr22001-1c.c } \
"pr22001-1b" \
"pass.out" \
- "$NOPIE_CFLAGS" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS" \
] \
[list \
"Run pr25416-5a (GDesc -> IE -maddress-mode=short)" \
@@ -1597,8 +1609,8 @@ if { [isnative] && [check_compiler_available] } {
run_cc_link_tests [list \
[list \
"Build pr22001-1b" \
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext,-z,noindirect-extern-access tmpdir/pr22001-1.so" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1c.c } \
{{error_output "pr22001-1b.err"}} \
"pr22001-1b" \
@@ -1606,14 +1618,14 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Build pr21997-1b" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr21997-1c.c } \
{{error_output "pr21997-1b.err"}} \
"pr21997-1b" \
] \
[list \
"Build lam-u48.so" \
- "-shared -Wl,-z,lam-u48" \
+ "-shared -Wl,-z,lam-u48,-z,noindirect-extern-access" \
"" \
{dummy.s} \
{{readelf -n lam-u48.rd}} \
@@ -1621,7 +1633,7 @@ if { [isnative] && [check_compiler_available] } {
] \
[list \
"Build lam-u57.so" \
- "-shared -Wl,-z,lam-u57" \
+ "-shared -Wl,-z,lam-u57,-z,noindirect-extern-access" \
"" \
{dummy.s} \
{{readelf -n lam-u57.rd}} \
@@ -1653,23 +1665,23 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Run copyreloc-main with PIE without -fPIE" \
"-Wl,--as-needed -pie tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
"copyreloc-main" \
"copyreloc-main.out" \
] \
[list \
"Run pr17689 with PIE without -fPIE" \
- "-Wl,--no-as-needed -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
- "-Wa,-mx86-used-note=yes" \
+ "-Wl,--no-as-needed,-z,noindirect-extern-access -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
"pr17689" \
"pr17689.out" \
] \
[list \
"Run pr17689 with PIE -z now without -fPIE" \
- "-Wl,--as-needed,-z,now -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
- "-Wa,-mx86-used-note=yes" \
+ "-Wl,--as-needed,-z,now,-z,noindirect-extern-access -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ dummy.s } \
"pr17689now" \
"pr17689.out" \
@@ -1744,25 +1756,25 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Run pr22001-1a (PIC 1)" \
"$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1b.c } \
"pr22001-1a-pic-1" \
"pass.out" \
- "-fPIC" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -fPIC" \
] \
[list \
"Run pr22001-1a (PIC 2)" \
"-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1b.c } \
"pr22001-1a-pic-2" \
"pass.out" \
- "-fPIC" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -fPIC" \
] \
[list \
"Run pr22001-1b (PIC 1)" \
"$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1c.c } \
"pr22001-1b-pic-1" \
"pass.out" \
@@ -1771,7 +1783,7 @@ if { [isnative] && [check_compiler_available] } {
[list \
"Run pr22001-1b (PIC 2)" \
"-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "-Wa,-mx86-used-note=yes" \
+ "$DIRECT_EXTERN_ACCESS_CFLAGS -Wa,-mx86-used-note=yes" \
{ pr22001-1c.c } \
"pr22001-1b-pic-2" \
"pass.out" \
@@ -2190,7 +2202,7 @@ if { [isnative] && [check_compiler_available] } {
}
}
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
+ undefined_weak "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie"
undefined_weak "-fPIE" "$NOPIE_LDFLAGS -Wl,-z,nodynamic-undefined-weak"
@@ -2354,7 +2366,7 @@ run_dump_test "ibt-plt-3b-x32"
run_dump_test "ibt-plt-3c-x32"
run_dump_test "ibt-plt-3d-x32"
-# Skip -z mark-plt tests on MUSL.
+# Skip -z mark-plt and --gnu2-tls-tag tests on MUSL.
if { [istarget "x86_64-*-musl*"]} {
set ASFLAGS "$saved_ASFLAGS"
return
@@ -2380,6 +2392,30 @@ if { [check_compiler_available] } {
{readelf {-W --version-info} mark-plt-1b.rd}} \
"mark-plt-1.so" \
] \
+ [list \
+ "Build mark-plt-2.so" \
+ "-shared -Wl,--no-as-needed,-z,mark-plt,-z,nopack-relative-relocs" \
+ "-fPIC" \
+ { mark-plt-2.s } \
+ {{readelf {-W --version-info} mark-plt-2.rd}} \
+ "mark-plt-2.so" \
+ ] \
+ [list \
+ "Build gnu2-tls-1a.so" \
+ "-shared -Wl,--no-as-needed,--gnu2-tls-tag" \
+ "-fPIC" \
+ { gnu2-tls-1.s } \
+ {{readelf {-W --version-info} gnu2-tls-1a.rd}} \
+ "gnu2-tls-1a.so" \
+ ] \
+ [list \
+ "Build gnu2-tls-1b.so" \
+ "-shared -Wl,--no-as-needed,--no-gnu2-tls-tag" \
+ "-fPIC" \
+ { gnu2-tls-1.s } \
+ {{readelf {-W --version-info} gnu2-tls-1b.rd}} \
+ "gnu2-tls-1b.so" \
+ ] \
]
}
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 22d2f98..d1343eb 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -253,6 +253,8 @@ proc default_ld_link { ld target objects } {
proc default_ld_compile { cc source object } {
global CFLAGS_FOR_TARGET
global CXXFLAGS_FOR_TARGET
+ global CFLAGS_FOR_TARGET_TEST
+ global CXXFLAGS_FOR_TARGET_TEST
global srcdir
global subdir
global host_triplet
@@ -286,10 +288,14 @@ proc default_ld_compile { cc source object } {
}
set ccexe [string replace $ccexe 0 [string last "/" $ccexe] ""]
+ set cflag_test ""
+ set cxxflag_test ""
if {[string match "*++*" $ccexe]} {
append flags " $CXXFLAGS_FOR_TARGET"
+ set cflag_test "$CXXFLAGS_FOR_TARGET_TEST"
} else {
append flags " $CFLAGS_FOR_TARGET"
+ set cflag_test "$CFLAGS_FOR_TARGET_TEST"
}
if [board_info [target_info name] exists cflags] {
@@ -300,7 +306,7 @@ proc default_ld_compile { cc source object } {
append flags " [board_info [target_info name] multilib_flags]"
}
- set cmd "$cc $flags $ccflags -c $source -o $object"
+ set cmd "$cc $flags $ccflags $cflag_test -c $source -o $object"
verbose -log "$cmd"
set status [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
@@ -727,6 +733,8 @@ proc run_ld_link_exec_tests { ldtests args } {
global env
global CC_FOR_TARGET
global CXX_FOR_TARGET
+ global CFLAGS_FOR_TARGET_TEST
+ global CXXFLAGS_FOR_TARGET_TEST
global errcnt
global exec_output
global STATIC_LDFLAGS
@@ -780,9 +788,9 @@ proc run_ld_link_exec_tests { ldtests args } {
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX_FOR_TARGET -c $cflags"
+ set cmd "$CXX_FOR_TARGET -c $cflags $CXXFLAGS_FOR_TARGET_TEST"
} else {
- set cmd "$CC_FOR_TARGET -c $cflags"
+ set cmd "$CC_FOR_TARGET -c $cflags $CFLAGS_FOR_TARGET_TEST"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
@@ -799,10 +807,10 @@ proc run_ld_link_exec_tests { ldtests args } {
set link_cmd $ld
} elseif { [ string match "c++" $lang ] } {
set link_proc ld_link
- set link_cmd $CXX_FOR_TARGET
+ set link_cmd "$CXX_FOR_TARGET $CXXFLAGS_FOR_TARGET_TEST"
} else {
set link_proc ld_link
- set link_cmd $CC_FOR_TARGET
+ set link_cmd "$CC_FOR_TARGET $CFLAGS_FOR_TARGET_TEST"
}
if { $binfile eq "tmpdir/" } {
@@ -888,6 +896,8 @@ proc run_cc_link_tests { ldtests } {
global env
global CC_FOR_TARGET
global CXX_FOR_TARGET
+ global CFLAGS_FOR_TARGET_TEST
+ global CXXFLAGS_FOR_TARGET_TEST
global ar
global exec_output
global STATIC_LDFLAGS
@@ -969,9 +979,9 @@ proc run_cc_link_tests { ldtests } {
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX_FOR_TARGET -c $cflags"
+ set cmd "$CXX_FOR_TARGET $CXXFLAGS_FOR_TARGET_TEST -c $cflags"
} else {
- set cmd "$CC_FOR_TARGET -c $cflags"
+ set cmd "$CC_FOR_TARGET $CFLAGS_FOR_TARGET_TEST -c $cflags"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
@@ -987,9 +997,9 @@ proc run_cc_link_tests { ldtests } {
reset_vars
if { [ string match "c++" $lang ] } {
- set cc_cmd $CXX_FOR_TARGET
+ set cc_cmd "$CXX_FOR_TARGET $CXXFLAGS_FOR_TARGET_TEST"
} else {
- set cc_cmd $CC_FOR_TARGET
+ set cc_cmd "$CC_FOR_TARGET $CFLAGS_FOR_TARGET_TEST"
}
if { $binfile eq "tmpdir/" } {