[PATCH] Add --generate-unused-section-symbols=[yes|no]
H.J. Lu
hjl.tools@gmail.com
Mon Dec 28 03:25:12 GMT 2020
For ELF targets, section symbols are required only for relocations.
With -ffunction-sections -fdata-sections, there can be many unused
section symbols. Sizes of libstdc++.a on Linux/x86-64 in GCC 11 are
With unused section symbols : 39411698 bytes
Without unused section symbols: 39227002 bytes
The unused section symbols in libstdc++.a occupy more than 180 KB.
Add --generate-unused-section-symbols=[yes|no] to assembler, linker and
objcopy. For assembler and linker, it controls whether to generate
unused section symbols. For objcopy, section symbols in relocatable
inputs are always kept and --generate-unused-section-symbols=[yes|no]
controls whether to generate unused section symbols in non-relocatable
outputs. Default can be controlled by the configure option,
--enable-generate-section-symbols. Default to no for Linux/x86 targets.
Add BSF_SECTION_SYM_USED to indicate if a section symbol should be
included in the symbol table. The BSF_SECTION_SYM_USED should be set
if the section symbol is used for relocation or the section symbol is
always included in the symbol table.
bfd/ChangeLog:
PR 27109
* elf.c (ignore_section_sym): Return TRUE if BSF_SECTION_SYM_USED
isn't set.
(elf_map_symbols): Don't include ignored section symbols.
* elfcode.h (elf_slurp_symbol_table): Also set
BSF_SECTION_SYM_USED on STT_SECTION symbols.
* elflink.c (bfd_elf_final_link): Generated section symbols only
when asked or emitting relocations
* syms.c (BSF_SECTION_SYM_USED): New.
* bfd-in2.h: Regenerated.
binutils/ChangeLog:
PR 27109
* NEWS: Mention --generate-unused-section-symbols=[yes|no].
* configure.ac: Add --enable-generate-unused-section-symbols.
* configure.tgt: Enable --generate-unused-section-symbols=no
by default for Linux/x86 targets.
* objcopy.c (generate_unused_section_symbols): New.
(enum command_line_switch): Add
OPTION_GENERATE_UNUSED_SECTION_SYMBOLS.
(copy_options): Add --generate-unused-section-symbols=[yes|no].
(copy_usage): Likewise.
(copy_object): Handle section symbols for non-relocatable inputs.
(copy_main): Handle OPTION_GENERATE_UNUSED_SECTION_SYMBOLS.
* config.in: Regenerated.
* configure: Likewise.
* doc/binutils.texi: Document
--generate-unused-section-symbols=[yes|no].
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Pass
$gcc_gas_flag to target_compile.
* testsuite/binutils-all/readelf.exp: Pass
--generate-unused-section-symbols=no to assembler.
* testsuite/binutils-all/readelf.s-64: Updated.
* testsuite/binutils-all/readelf.ss: Likewise.
* testsuite/binutils-all/readelf.ss-64: Likewise.
* testsuite/binutils-all/readelf.ss-mips: Likewise.
* testsuite/binutils-all/readelf.ss-tmips: Likewise.
gas/ChangeLog:
PR 27109
* NEWS: Mention --generate-unused-section-symbols=[yes|no].
* as.c (flag_generate_unused_section_symbols): New.
(show_usage): Add --generate-unused-section-symbols=[yes|no].
(parse_args): Handle --generate-unused-section-symbols=[yes|no].
* as.h (flag_generate_unused_section_symbols): New.
* configure.ac: Add --enable-generate-unused-section-symbols.
* config.in: Regenerated.
* configure: Likewise.
* config/obj-elf.c (elf_adjust_symtab): Call
symbol_mark_used_in_reloc on the group signature symbol.
* doc/as.texi: Document --generate-unused-section-symbols=[no|yes].
* read.c (s_reloc): Call symbol_mark_used_in_reloc on the
section symbol.
* subsegs.c (subseg_new): Set BSF_SECTION_SYM_USED if needed.
* write.c (adjust_reloc_syms): Call symbol_mark_used_in_reloc
on the section symbol.
(set_symtab): Only generate unused section symbols if asked.
(maybe_generate_build_notes): Call symbol_mark_used_in_reloc
on the section symbol.
* testsuite/gas/cfi/cfi-label.d: Pass
--generate-unused-section-symbols=no to assembler and remove
unused section symbols from expected output.
* testsuite/gas/elf/elf.exp: Pass
--generate-unused-section-symbols=yes to assembler for section2.
* testsuite/gas/elf/symver.d: Remove unused section symbols.
* testsuite/gas/i386/ilp32/elf/symver.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-1.d: Pass
--generate-unused-section-symbols=no to assembler and remove
unused section symbols from expected output.
* testsuite/gas/i386/ilp32/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/size-1.d: Likewise.
* testsuite/gas/i386/size-3.d: Likewise.
* testsuite/gas/i386/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
include/ChangeLog:
PR 27109
* bfdlink.h (struct bfd_link_info): Add unused_section_symbols.
ld/ChangeLog:
PR 27109
* NEWS: Mention --generate-unused-section-symbols=[yes|no].
* configure.ac: Add --enable-generate-unused-section-symbols.
* configure.tgt: Enable --generate-unused-section-symbols=no
by default for Linux/x86 targets.
* ld.texi: Document --generate-unused-section-symbols=[yes|no].
* ldlex.h (enum option_values): Add
OPTION_GENERATE_UNUSED_SECTION_SYMBOLS.
* ldmain.c (main): Initialize link_info.unused_section_symbols.
* lexsup.c (ld_options): Add
OPTION_GENERATE_UNUSED_SECTION_SYMBOLS.
(parse_args): Handle OPTION_GENERATE_UNUSED_SECTION_SYMBOLS.
* config.in: Regenerated.
* configure: Likewise.
* testsuite/ld-elf/binutils.exp (binutils_test): Add a
prog_options argument.
Add --generate-unused-section-symbols=[yes|no] tests for objcopy
and ld.
* testsuite/ld-elf/elf.exp (objcopy_test_emit_relocs): New.
Add --generate-unused-section-symbols=[yes|no] tests for objcopy
and ld with --emit-relocs.
* testsuite/ld-elf/export-class.exp: Pass
--generate-unused-section-symbols=no to ld.
* testsuite/ld-elf/export-class.sd: Updated.
* testsuite/ld-elf/loadaddr3b.d: Likewise.
* testsuite/ld-elf/sec64k.exp: Pass
--generate-unused-section-symbols=yes to ld.
* testsuite/ld-i386/i386.exp: Pass
--generate-unused-section-symbols=no to ld.
* testsuite/ld-i386/ibt-plt-1.d: Pass
--generate-unused-section-symbols=no to ld and adjust the
expected output.
* testsuite/ld-i386/ibt-plt-2a.d: Likewise.
* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
* testsuite/ld-i386/ibt-plt-3a.d: Likewise.
* testsuite/ld-i386/ibt-plt-3c.d: Likewise.
* testsuite/ld-i386/pr19636-1d.d: Likewise.
* testsuite/ld-i386/pr19636-1l.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
* testsuite/ld-x86-64/pr19609-4e.d: Likewise.
* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
* testsuite/ld-x86-64/pr19609-6b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
* testsuite/ld-x86-64/pr21038b.d: Likewise.
* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c.d: Likewise.
* testsuite/ld-x86-64/pr23854.d: Likewise.
* testsuite/ld-x86-64/pr25416-3.d: Likewise.
* testsuite/ld-x86-64/pr25416-4.d: Likewise.
* testsuite/ld-i386/plt-pic.pd: Adjust the expected output.
* testsuite/ld-i386/plt-pic2.dd: Likewise.
* testsuite/ld-i386/plt.pd: Likewise.
* testsuite/ld-i386/plt2.dd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbin2.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-i386/tlspic2.rd: Likewise.
* testsuite/ld-x86-64/mpx3.dd: Likewise.
* testsuite/ld-x86-64/mpx3n.dd: Likewise.
* testsuite/ld-x86-64/mpx4.dd: Likewise.
* testsuite/ld-x86-64/mpx4n.dd: Likewise.
* testsuite/ld-x86-64/pe-x86-64-1.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4.od: Likewise.
* testsuite/ld-x86-64/plt.pd: Likewise.
* testsuite/ld-x86-64/plt2.dd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-x86-64/tlspic2.rd: Likewise.
* testsuite/ld-x86-64/mpx.exp: Pass
--generate-unused-section-symbols=no to ld.
* testsuite/ld-x86-64/pe-x86-64.exp: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
---
bfd/bfd-in2.h | 3 +
bfd/elf.c | 15 ++-
bfd/elfcode.h | 8 +-
bfd/elflink.c | 61 ++++++-----
bfd/syms.c | 3 +
binutils/NEWS | 6 ++
binutils/config.in | 4 +
binutils/configure | 27 ++++-
binutils/configure.ac | 19 ++++
binutils/configure.tgt | 9 ++
binutils/doc/binutils.texi | 7 ++
binutils/objcopy.c | 54 +++++++++-
binutils/testsuite/binutils-all/compress.exp | 11 +-
binutils/testsuite/binutils-all/readelf.exp | 7 +-
binutils/testsuite/binutils-all/readelf.s-64 | 2 +-
binutils/testsuite/binutils-all/readelf.ss | 10 +-
binutils/testsuite/binutils-all/readelf.ss-64 | 9 +-
.../testsuite/binutils-all/readelf.ss-mips | 25 ++---
.../testsuite/binutils-all/readelf.ss-tmips | 25 ++---
gas/NEWS | 5 +
gas/as.c | 22 ++++
gas/as.h | 3 +
gas/config.in | 3 +
gas/config/obj-elf.c | 3 +
gas/configure | 35 +++++-
gas/configure.ac | 26 ++++-
gas/doc/as.texi | 7 ++
gas/read.c | 3 +
gas/subsegs.c | 3 +
gas/testsuite/gas/cfi/cfi-label.d | 6 +-
gas/testsuite/gas/elf/elf.exp | 3 +-
gas/testsuite/gas/elf/symver.d | 4 -
gas/testsuite/gas/i386/ilp32/elf/symver.d | 4 -
gas/testsuite/gas/i386/ilp32/x86-64-size-1.d | 26 ++---
gas/testsuite/gas/i386/ilp32/x86-64-size-3.d | 18 ++--
gas/testsuite/gas/i386/ilp32/x86-64-size-5.d | 14 +--
gas/testsuite/gas/i386/ilp32/x86-64-unwind.d | 8 +-
gas/testsuite/gas/i386/size-1.d | 26 ++---
gas/testsuite/gas/i386/size-3.d | 18 ++--
gas/testsuite/gas/i386/x86-64-size-1.d | 26 ++---
gas/testsuite/gas/i386/x86-64-size-3.d | 18 ++--
gas/testsuite/gas/i386/x86-64-size-5.d | 14 +--
gas/testsuite/gas/i386/x86-64-unwind.d | 12 +--
gas/write.c | 43 +++++---
include/bfdlink.h | 3 +
ld/NEWS | 5 +
ld/config.in | 3 +
ld/configure | 27 ++++-
ld/configure.ac | 17 +++
ld/configure.tgt | 6 +-
ld/ld.texi | 6 ++
ld/ldlex.h | 1 +
ld/ldmain.c | 2 +
ld/lexsup.c | 18 ++++
ld/testsuite/ld-elf/binutils.exp | 101 ++++++++++++++----
ld/testsuite/ld-elf/elf.exp | 47 +++++++-
ld/testsuite/ld-elf/export-class.exp | 5 +-
ld/testsuite/ld-elf/export-class.sd | 2 -
ld/testsuite/ld-elf/loadaddr3b.d | 5 +-
ld/testsuite/ld-elf/sec64k.exp | 6 +-
ld/testsuite/ld-i386/i386.exp | 89 ++++++++-------
ld/testsuite/ld-i386/ibt-plt-1.d | 6 +-
ld/testsuite/ld-i386/ibt-plt-2a.d | 6 +-
ld/testsuite/ld-i386/ibt-plt-2c.d | 6 +-
ld/testsuite/ld-i386/ibt-plt-3a.d | 6 +-
ld/testsuite/ld-i386/ibt-plt-3c.d | 6 +-
ld/testsuite/ld-i386/plt-pic.pd | 8 +-
ld/testsuite/ld-i386/plt-pic2.dd | 6 +-
ld/testsuite/ld-i386/plt.pd | 8 +-
ld/testsuite/ld-i386/plt2.dd | 8 +-
ld/testsuite/ld-i386/pr19636-1d.d | 4 +-
ld/testsuite/ld-i386/pr19636-1l.d | 4 +-
ld/testsuite/ld-i386/pr19636-2c.d | 4 +-
ld/testsuite/ld-i386/tlsbin.rd | 13 ---
ld/testsuite/ld-i386/tlsbin2.rd | 11 --
ld/testsuite/ld-i386/tlsbindesc.rd | 11 --
ld/testsuite/ld-i386/tlsdesc.rd | 11 --
ld/testsuite/ld-i386/tlsgdesc.rd | 10 --
ld/testsuite/ld-i386/tlsnopic.rd | 9 --
ld/testsuite/ld-i386/tlspic.rd | 12 ---
ld/testsuite/ld-i386/tlspic2.rd | 10 --
ld/testsuite/ld-ifunc/ifunc-2-i386-now.d | 2 +-
.../ld-ifunc/ifunc-2-local-i386-now.d | 6 +-
.../ld-ifunc/ifunc-2-local-x86-64-now.d | 6 +-
ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d | 6 +-
ld/testsuite/ld-ifunc/ifunc-21-x86-64.d | 12 +--
ld/testsuite/ld-ifunc/ifunc-22-x86-64.d | 12 +--
ld/testsuite/ld-ifunc/pr17154-i386-now.d | 12 +--
ld/testsuite/ld-ifunc/pr17154-i386.d | 10 +-
ld/testsuite/ld-ifunc/pr17154-x86-64-now.d | 12 +--
ld/testsuite/ld-ifunc/pr17154-x86-64.d | 10 +-
ld/testsuite/ld-x86-64/bnd-branch-1-now.d | 12 +--
ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d | 4 +-
ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d | 10 +-
ld/testsuite/ld-x86-64/bnd-ifunc-2.d | 10 +-
ld/testsuite/ld-x86-64/bnd-plt-1-now.d | 10 +-
ld/testsuite/ld-x86-64/bnd-plt-1.d | 10 +-
ld/testsuite/ld-x86-64/ibt-plt-1-x32.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-1.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-2a.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-2c.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-3a.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d | 6 +-
ld/testsuite/ld-x86-64/ibt-plt-3c.d | 6 +-
ld/testsuite/ld-x86-64/mpx.exp | 8 +-
ld/testsuite/ld-x86-64/mpx3.dd | 2 +-
ld/testsuite/ld-x86-64/mpx3n.dd | 2 +-
ld/testsuite/ld-x86-64/mpx4.dd | 2 +-
ld/testsuite/ld-x86-64/mpx4n.dd | 2 +-
ld/testsuite/ld-x86-64/pe-x86-64-1.od | 5 -
ld/testsuite/ld-x86-64/pe-x86-64-2.od | 5 -
ld/testsuite/ld-x86-64/pe-x86-64-3.od | 5 -
ld/testsuite/ld-x86-64/pe-x86-64-4.od | 6 --
ld/testsuite/ld-x86-64/pe-x86-64.exp | 8 +-
ld/testsuite/ld-x86-64/plt.pd | 6 +-
ld/testsuite/ld-x86-64/plt2.dd | 6 +-
ld/testsuite/ld-x86-64/pr19609-4e.d | 6 +-
ld/testsuite/ld-x86-64/pr19609-6a.d | 4 +-
ld/testsuite/ld-x86-64/pr19609-6b.d | 4 +-
ld/testsuite/ld-x86-64/pr19609-7b.d | 4 +-
ld/testsuite/ld-x86-64/pr19609-7d.d | 4 +-
ld/testsuite/ld-x86-64/pr19636-2l.d | 8 +-
ld/testsuite/ld-x86-64/pr20253-1d.d | 14 +--
ld/testsuite/ld-x86-64/pr20253-1h.d | 14 +--
ld/testsuite/ld-x86-64/pr21038b-now.d | 4 +-
ld/testsuite/ld-x86-64/pr21038b.d | 4 +-
ld/testsuite/ld-x86-64/pr21038c-now.d | 4 +-
ld/testsuite/ld-x86-64/pr21038c.d | 4 +-
ld/testsuite/ld-x86-64/pr23854.d | 38 +++----
ld/testsuite/ld-x86-64/pr25416-3.d | 6 +-
ld/testsuite/ld-x86-64/pr25416-4.d | 6 +-
ld/testsuite/ld-x86-64/tlsbin.rd | 13 ---
ld/testsuite/ld-x86-64/tlsbin2.rd | 11 --
ld/testsuite/ld-x86-64/tlsbindesc.rd | 11 --
ld/testsuite/ld-x86-64/tlsdesc.rd | 12 ---
ld/testsuite/ld-x86-64/tlsgdesc.rd | 10 --
ld/testsuite/ld-x86-64/tlspic.rd | 12 ---
ld/testsuite/ld-x86-64/tlspic2.rd | 12 ---
ld/testsuite/ld-x86-64/x86-64.exp | 11 +-
142 files changed, 938 insertions(+), 696 deletions(-)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index f1bef5742a..cb6e7cc855 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6413,6 +6413,9 @@ typedef struct bfd_symbol
with this name and type in use. BSF_OBJECT must also be set. */
#define BSF_GNU_UNIQUE (1 << 23)
+ /* This section symbol should be included in the symbol table. */
+#define BSF_SECTION_SYM_USED (1 << 24)
+
flagword flags;
/* A pointer to the section to which this symbol is
diff --git a/bfd/elf.c b/bfd/elf.c
index 9c82912aeb..d1cf1a621a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4061,6 +4061,10 @@ ignore_section_sym (bfd *abfd, asymbol *sym)
if ((sym->flags & BSF_SECTION_SYM) == 0)
return FALSE;
+ /* Ignore the section symbol if it isn't used. */
+ if ((sym->flags & BSF_SECTION_SYM_USED) == 0)
+ return TRUE;
+
if (sym->section == NULL)
return TRUE;
@@ -4148,7 +4152,10 @@ elf_map_symbols (bfd *abfd, unsigned int *pnum_locals)
at least in that case. */
for (asect = abfd->sections; asect; asect = asect->next)
{
- if (sect_syms[asect->index] == NULL)
+ asymbol *sym = asect->symbol;
+ /* Don't include ignored section symbols. */
+ if (!ignore_section_sym (abfd, sym)
+ && sect_syms[asect->index] == NULL)
{
if (!sym_is_global (abfd, asect->symbol))
num_locals++;
@@ -4170,6 +4177,7 @@ elf_map_symbols (bfd *abfd, unsigned int *pnum_locals)
if (sym_is_global (abfd, sym))
i = num_locals + num_globals2++;
+ /* Don't include ignored section symbols. */
else if (!ignore_section_sym (abfd, sym))
i = num_locals2++;
else
@@ -4179,9 +4187,10 @@ elf_map_symbols (bfd *abfd, unsigned int *pnum_locals)
}
for (asect = abfd->sections; asect; asect = asect->next)
{
- if (sect_syms[asect->index] == NULL)
+ asymbol *sym = asect->symbol;
+ if (!ignore_section_sym (abfd, sym)
+ && sect_syms[asect->index] == NULL)
{
- asymbol *sym = asect->symbol;
unsigned int i;
sect_syms[asect->index] = sym;
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 072220e220..b8c92fc792 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1347,7 +1347,13 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
switch (ELF_ST_TYPE (isym->st_info))
{
case STT_SECTION:
- sym->symbol.flags |= BSF_SECTION_SYM | BSF_DEBUGGING;
+ /* Mark the input section symbol as used since it may be
+ used for relocation and section group.
+ NB: BSF_SECTION_SYM_USED is ignored by linker and may
+ be cleared by objcopy for non-relocatable inputs. */
+ sym->symbol.flags |= (BSF_SECTION_SYM
+ | BSF_DEBUGGING
+ | BSF_SECTION_SYM_USED);
break;
case STT_FILE:
sym->symbol.flags |= BSF_FILE | BSF_DEBUGGING;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 1b3398126f..e52c083e6d 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12475,9 +12475,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (info->strip != strip_all || emit_relocs)
{
- bfd_boolean name_local_sections;
- const char *name;
-
file_ptr off = elf_next_file_pos (abfd);
_bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE);
@@ -12498,36 +12495,38 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_und_section_ptr, NULL) != 1)
goto error_return;
- /* Output a symbol for each section. We output these even if we are
- discarding local symbols, since they are used for relocs. These
- symbols usually have no names. We store the index of each one in
- the index field of the section, so that we can find it again when
- outputting relocs. */
+ /* Output a symbol for each section if asked or they are used for
+ relocs. These symbols usually have no names. We store the
+ index of each one in the index field of the section, so that
+ we can find it again when outputting relocs. */
- name_local_sections
- = (bed->elf_backend_name_local_section_symbols
- && bed->elf_backend_name_local_section_symbols (abfd));
+ if (info->unused_section_symbols || emit_relocs)
+ {
+ bfd_boolean name_local_sections
+ = (bed->elf_backend_name_local_section_symbols
+ && bed->elf_backend_name_local_section_symbols (abfd));
+ const char *name = NULL;
- name = NULL;
- elfsym.st_size = 0;
- elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- elfsym.st_other = 0;
- elfsym.st_value = 0;
- elfsym.st_target_internal = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- o = bfd_section_from_elf_index (abfd, i);
- if (o != NULL)
- {
- o->target_index = bfd_get_symcount (abfd);
- elfsym.st_shndx = i;
- if (!bfd_link_relocatable (info))
- elfsym.st_value = o->vma;
- if (name_local_sections)
- name = o->name;
- if (elf_link_output_symstrtab (&flinfo, name, &elfsym, o,
- NULL) != 1)
- goto error_return;
+ elfsym.st_size = 0;
+ elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+ elfsym.st_other = 0;
+ elfsym.st_value = 0;
+ elfsym.st_target_internal = 0;
+ for (i = 1; i < elf_numsections (abfd); i++)
+ {
+ o = bfd_section_from_elf_index (abfd, i);
+ if (o != NULL)
+ {
+ o->target_index = bfd_get_symcount (abfd);
+ elfsym.st_shndx = i;
+ if (!bfd_link_relocatable (info))
+ elfsym.st_value = o->vma;
+ if (name_local_sections)
+ name = o->name;
+ if (elf_link_output_symstrtab (&flinfo, name, &elfsym, o,
+ NULL) != 1)
+ goto error_return;
+ }
}
}
}
diff --git a/bfd/syms.c b/bfd/syms.c
index cb25af17fa..fe2ac10c1c 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -307,6 +307,9 @@ CODE_FRAGMENT
. with this name and type in use. BSF_OBJECT must also be set. *}
.#define BSF_GNU_UNIQUE (1 << 23)
.
+. {* This section symbol should be included in the symbol table. *}
+.#define BSF_SECTION_SYM_USED (1 << 24)
+.
. flagword flags;
.
. {* A pointer to the section to which this symbol is
diff --git a/binutils/NEWS b/binutils/NEWS
index 20b73f503d..e33978f394 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,5 +1,11 @@
-*- text -*-
+* Add --generate-unused-section-symbols=[yes|no] to objcopy and strip.
+ This option controls whether to keep unused section symbols for
+ non-relocatable outputs. Default can be controlled by the configure
+ option, --enable-generate-section-symbols. Default to no for
+ Linux/x86 targets.
+
* Update elfedit and readelf with LAM_U48 and LAM_U57 support.
* Nm has a new command line option: --ifunc-chars=CHARS. This specifies a
diff --git a/binutils/config.in b/binutils/config.in
index 4d67447371..4720951e72 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -21,6 +21,10 @@
/* Have nm use F and f for global and local ifunc symbols */
#undef DEFAULT_F_FOR_IFUNC_SYMBOLS
+/* Define to 1 if you want to generate unused section symbols for
+ non-relocatable outputs by default. */
+#undef DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS
+
/* Should strings use -a behavior by default? */
#undef DEFAULT_STRINGS_ALL
diff --git a/binutils/configure b/binutils/configure
index c000966308..d8335c1af7 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -823,6 +823,7 @@ enable_deterministic_archives
enable_default_strings_all
enable_f_for_ifunc_symbols
with_debuginfod
+enable_generate_unused_section_symbols
enable_libctf
enable_werror
enable_build_warnings
@@ -1489,6 +1490,8 @@ Optional Features:
--enable-f-for-ifunc-symbols
Have nm use F and f for global and local ifunc
symbols
+ --enable-generate-unused-section-symbols
+ generate unused section symbols by default
--enable-libctf Handle .ctf type-info sections [default=yes]
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
@@ -11556,7 +11559,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11559 "configure"
+#line 11562 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11662,7 +11665,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11665 "configure"
+#line 11668 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12586,6 +12589,17 @@ $as_echo "$as_me: WARNING: debuginfod support disabled; some features may be una
fi
+# Decide if objcopy and strip should generate unused section symbols
+# for non-relocatable outputs.
+ac_default_generate_unused_section_symbols=unset
+# Provide a configure time option to override our default.
+# Check whether --enable-generate-unused-section-symbols was given.
+if test "${enable_generate_unused_section_symbols+set}" = set; then :
+ enableval=$enable_generate_unused_section_symbols; case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+esac
+fi
+
# Check whether --enable-libctf was given.
if test "${enable_libctf+set}" = set; then :
enableval=$enable_libctf;
@@ -15545,6 +15559,15 @@ EMULATION_VECTOR=$targ_emul_vector
+if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS $ac_default_generate_unused_section_symbols
+_ACEOF
+
+
# Required for html and install-html
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 24bf102019..a951780764 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -84,6 +84,17 @@ AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
AC_DEBUGINFOD
+# Decide if objcopy and strip should generate unused section symbols
+# for non-relocatable outputs.
+ac_default_generate_unused_section_symbols=unset
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE(generate-unused-section-symbols,
+ AS_HELP_STRING([--enable-generate-unused-section-symbols],
+ [generate unused section symbols by default]),
+[case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+esac])dnl
+
GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
if test "${enable_libctf}" = yes; then
AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
@@ -486,6 +497,14 @@ EMULATION_VECTOR=$targ_emul_vector
AC_SUBST(EMULATION)
AC_SUBST(EMULATION_VECTOR)
+if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS,
+ $ac_default_generate_unused_section_symbols,
+ [Define to 1 if you want to generate unused section symbols for
+ non-relocatable outputs by default.])
+
# Required for html and install-html
AC_SUBST(datarootdir)
AC_SUBST(docdir)
diff --git a/binutils/configure.tgt b/binutils/configure.tgt
index dfce1d4fe2..237fb3c80c 100644
--- a/binutils/configure.tgt
+++ b/binutils/configure.tgt
@@ -40,3 +40,12 @@ case "${targ}" in
targ_emul_vector=bin_vanilla_emulation
;;
esac
+
+# Enable --generate-unused-section-symbols=no by default for Linux/x86.
+case "${targ}" in
+i[3-7]86-*-linux-* | x86_64-*-linux-*)
+ if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=0
+ fi
+ ;;
+esac
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 0ed3548d95..3cbb2547f8 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -1243,6 +1243,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{--redefine-sym} @var{old}=@var{new}]
[@option{--redefine-syms=}@var{filename}]
[@option{--weaken}]
+ [@option{--generate-unused-section-symbols=@var{val}}]
[@option{--keep-symbols=}@var{filename}]
[@option{--strip-symbols=}@var{filename}]
[@option{--strip-unneeded-symbols=}@var{filename}]
@@ -2118,6 +2119,12 @@ converted to the @code{STT_COMMON} or @code{STT_OBJECT} type.
@code{STT_COMMON}. @option{--elf-stt-common=no} converts common symbol
type to @code{STT_OBJECT}.
+@item --generate-unused-section-symbols=no
+@itemx --generate-unused-section-symbols=yes
+These options control whether to generate unused section symbols for
+non-relocatable outputs. The default can be controlled by a configure
+option @option{--enable-generate-unused-section-symbols}.
+
@item --merge-notes
@itemx --no-merge-notes
For ELF files, attempt (or do not attempt) to reduce the size of any
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 0ea3ea137a..66cf72b786 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -249,6 +249,10 @@ static bfd_boolean wildcard = FALSE;
/* True if --localize-hidden is in effect. */
static bfd_boolean localize_hidden = FALSE;
+/* True if --generate-unused-section-symbols=yes is in effect. */
+static int generate_unused_section_symbols
+ = DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS;
+
/* List of symbols to strip, keep, localize, keep-global, weaken,
or redefine. */
static htab_t strip_specific_htab = NULL;
@@ -326,6 +330,7 @@ enum command_line_switch
OPTION_FILE_ALIGNMENT,
OPTION_FORMATS_INFO,
OPTION_GAP_FILL,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS,
OPTION_GLOBALIZE_SYMBOL,
OPTION_GLOBALIZE_SYMBOLS,
OPTION_HEAP,
@@ -447,6 +452,8 @@ static struct option copy_options[] =
{"file-alignment", required_argument, 0, OPTION_FILE_ALIGNMENT},
{"format", required_argument, 0, 'F'}, /* Obsolete */
{"gap-fill", required_argument, 0, OPTION_GAP_FILL},
+ {"generate-unused-section-symbols", required_argument, 0,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS},
{"globalize-symbol", required_argument, 0, OPTION_GLOBALIZE_SYMBOL},
{"globalize-symbols", required_argument, 0, OPTION_GLOBALIZE_SYMBOLS},
{"heap", required_argument, 0, OPTION_HEAP},
@@ -679,8 +686,16 @@ copy_usage (FILE *stream, int exit_status)
--elf-stt-common=[yes|no] Generate ELF common symbols with STT_COMMON\n\
type\n\
--verilog-data-width <number> Specifies data width, in bytes, for verilog output\n\
- -M --merge-notes Remove redundant entries in note sections\n\
- --no-merge-notes Do not attempt to remove redundant notes (default)\n\
+ -M --merge-notes Remove redundant entries in note sections\n\
+ --no-merge-notes Do not attempt to remove redundant notes (default)\n\
+ --generate-unused-section-symbols=[yes|no]\n"));
+ if (DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS)
+ fprintf (stream, _("\
+ Generate unused section symbols (default: yes)"));
+ else
+ fprintf (stream, _("\
+ Generate unused section symbols (default: no)"));
+ fprintf (stream, _("\
-v --verbose List all object files modified\n\
@<file> Read options from <file>\n\
-V --version Display this program's version number\n\
@@ -3204,6 +3219,31 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
if (convert_debugging)
dhandle = read_debugging_info (ibfd, isympp, symcount, FALSE);
+ if ((obfd->flags & (EXEC_P | DYNAMIC)) != 0
+ && (obfd->flags & HAS_RELOC) == 0)
+ {
+ /* NB: Symbol table is optional in non-relocatable files. */
+ if (generate_unused_section_symbols)
+ {
+ /* Non-relocatable inputs may not have the unused section
+ symbols. Mark all section symbols as used to generate
+ section symbols. */
+ asection *asect;
+ for (asect = obfd->sections; asect != NULL; asect = asect->next)
+ if (asect->symbol)
+ asect->symbol->flags |= BSF_SECTION_SYM_USED;
+ }
+ else
+ {
+ /* Non-relocatable inputs may have the unused section symbols.
+ Mark all section symbols as unused to excluded them. */
+ long s;
+ for (s = 0; s < symcount; s++)
+ if ((isympp[s]->flags & BSF_SECTION_SYM_USED))
+ isympp[s]->flags &= ~BSF_SECTION_SYM_USED;
+ }
+ }
+
if (strip_symbols == STRIP_DEBUG
|| strip_symbols == STRIP_ALL
|| strip_symbols == STRIP_UNNEEDED
@@ -5665,6 +5705,16 @@ copy_main (int argc, char *argv[])
fatal (_("unknown long section names option '%s'"), optarg);
break;
+ case OPTION_GENERATE_UNUSED_SECTION_SYMBOLS:
+ if (strcasecmp (optarg, "no") == 0)
+ generate_unused_section_symbols = 0;
+ else if (strcasecmp (optarg, "yes") == 0)
+ generate_unused_section_symbols = 1;
+ else
+ fatal (_("invalid --generate-unused-section-symbols= option: `%s'"),
+ optarg);
+ break;
+
case OPTION_GLOBALIZE_SYMBOLS:
use_globalize = TRUE;
add_specific_symbols (optarg, globalize_specific_htab,
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 831192c7ac..a1dd8d32b8 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -680,10 +680,19 @@ proc test_gnu_debuglink {} {
global STRIP
global OBJCOPY
global OBJDUMP
+ global gcc_gas_flag
set test "gnu-debuglink"
- if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug] != "" } {
+ # Use the newly built assembler and linker.
+ set flags debug
+ if { [istarget *-*-linux*]
+ || [istarget *-*-gnu*] } {
+ foreach i $gcc_gas_flag {
+ set flags "additional_flags=$i $flags"
+ }
+ }
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable $flags] != "" } {
unsupported "$test (build)"
return
}
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 9d1d496e5c..aef884f078 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -318,8 +318,11 @@ if ![is_remote host] {
send_user "Version [binutil_version $READELF]"
-# Assemble the test file.
-if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
+# Assemble the test file. Don't generate unused section symbols
+# regardless whether --enable-generate-section-symbols is used to
+# configure binutils.
+if {![binutils_assemble_flags $srcdir/$subdir/bintest.s \
+ tmpdir/bintest.o --generate-unused-section-symbols=no]} then {
unresolved "readelf -h bintest (failed to assemble)"
unresolved "readelf -S bintest (failed to assemble)"
unresolved "readelf -s bintest (failed to assemble)"
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index a1e6cd1bbd..5582d77c37 100644
--- a/binutils/testsuite/binutils-all/readelf.s-64
+++ b/binutils/testsuite/binutils-all/readelf.s-64
@@ -18,7 +18,7 @@ Section Headers:
+\[ .\] .symtab +SYMTAB +0000000000000000 +0+.*
# aarch64-elf targets have one more data symbol.
# x86 targets may have .note.gnu.property.
- +0+.* +0000000000000018 +(6|7) +(6|7) +8
+ +0+.* +0000000000000018 +(6|7) +(3|4) +8
+\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
+0+.* +0000000000000000 .* +0 +0 +1
+\[ .\] .shstrtab +STRTAB +0000000000000000 +[0-9a-f]+
diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss
index acc6d9390c..8be600bbd9 100644
--- a/binutils/testsuite/binutils-all/readelf.ss
+++ b/binutils/testsuite/binutils-all/readelf.ss
@@ -2,17 +2,11 @@
Symbol table '.symtab' contains .* entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +[34]
- +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +[45]
- +4: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
+ +1: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
# ARM targets add the $d mapping symbol here...
# NDS32 targets add the $d2 mapping symbol here...
#...
- +.: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +[34] static_data_symbol
-# v850 targets include extra SECTION symbols here for the .call_table_data
-# and .call_table_text sections.
-#...
+ +[0-9]+: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +[34] static_data_symbol
+[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
+[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +[34] data_symbol
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64 b/binutils/testsuite/binutils-all/readelf.ss-64
index bd10cabef3..965c878691 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64
+++ b/binutils/testsuite/binutils-all/readelf.ss-64
@@ -2,16 +2,11 @@
Symbol table '.symtab' contains .* entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +3
- +3: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +4
- +4: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
+ +1: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
# aarch64-elf targets add the $d mapping symbol here...
#...
+.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
-# ... or here ...
-#...
-.* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+ +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
+.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
+[0-9]+: 0000000000000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +COM common_symbol
diff --git a/binutils/testsuite/binutils-all/readelf.ss-mips b/binutils/testsuite/binutils-all/readelf.ss-mips
index c49416bab4..ee4fa41b7f 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-mips
+++ b/binutils/testsuite/binutils-all/readelf.ss-mips
@@ -1,19 +1,12 @@
-Symbol table '.symtab' contains 16 entries:
+Symbol table '.symtab' contains 9 entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.text)
- +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.data)
- +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.bss)
- +4: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.reginfo)
- +5: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.MIPS\.abiflags)
- +6: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.pdr)
- +7: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.gnu\.attributes)
- +8: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol
- +9: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_text_symbol
- +10: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
- +11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. data_symbol
- +12: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_data_symbol
- +13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
- +14: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
- +15: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
+ +1: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol
+ +2: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_text_symbol
+ +3: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
+ +4: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. data_symbol
+ +5: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_data_symbol
+ +6: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
+ +7: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
+ +8: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
diff --git a/binutils/testsuite/binutils-all/readelf.ss-tmips b/binutils/testsuite/binutils-all/readelf.ss-tmips
index 4fd7fe0278..4e8ed3c399 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-tmips
+++ b/binutils/testsuite/binutils-all/readelf.ss-tmips
@@ -1,19 +1,12 @@
-Symbol table '.symtab' contains 16 entries:
+Symbol table '.symtab' contains 9 entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +3
- +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +4
- +4: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
- +5: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
- +6: 00000000 +0 +SECTION +LOCAL +DEFAULT +5
- +7: 00000000 +0 +SECTION +LOCAL +DEFAULT +6
- +8: 00000000 +0 +SECTION +LOCAL +DEFAULT +7
- +9: 00000000 +0 +SECTION +LOCAL +DEFAULT +8
- +10: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
- +11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
- +12: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
- +13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
- +14: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
- +15: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
+ +1: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
+ +2: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
+ +3: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+ +4: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
+ +5: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
+ +6: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
+ +7: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
+ +8: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
diff --git a/gas/NEWS b/gas/NEWS
index 3105f46f5e..65db41ee7e 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,10 @@
-*- text -*-
+* Add --generate-unused-section-symbols=[yes|no] to control whether to
+ generate unused section symbols. Default can be controlled by the
+ configure option, --enable-generate-section-symbols. Default to no for
+ Linux/x86 targets.
+
* Add support for Intel AVX VNNI instructions.
* Add support for Intel HRESET instruction.
diff --git a/gas/as.c b/gas/as.c
index eda7594523..d715aed3ed 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -111,6 +111,9 @@ int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON;
bfd_boolean flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES;
#endif
+int flag_generate_unused_section_symbols
+ = DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS;
+
/* Keep the output file. */
static int keep_it = 0;
@@ -321,6 +324,12 @@ Options:\n\
generate ELF common symbols with STT_COMMON type\n"));
fprintf (stream, _("\
--sectname-subst enable section name substitution sequences\n"));
+ fprintf (stream, _("\
+ --generate-unused-section-symbols=[no|yes] "));
+ if (DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS)
+ fprintf (stream, _("(default: yes)\n"));
+ else
+ fprintf (stream, _("(default: no)\n"));
fprintf (stream, _("\
--generate-missing-build-notes=[no|yes] "));
@@ -495,6 +504,7 @@ parse_args (int * pargc, char *** pargv)
OPTION_SIZE_CHECK,
OPTION_ELF_STT_COMMON,
OPTION_ELF_BUILD_NOTES,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS,
OPTION_SECTNAME_SUBST,
OPTION_ALTERNATE,
OPTION_AL,
@@ -532,6 +542,8 @@ parse_args (int * pargc, char *** pargv)
,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}
,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK}
,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON}
+ ,{"generate-unused-section-symbols", required_argument, NULL,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS}
,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
#endif
@@ -978,6 +990,16 @@ This program has absolutely no warranty.\n"));
optarg);
break;
+ case OPTION_GENERATE_UNUSED_SECTION_SYMBOLS:
+ if (strcasecmp (optarg, "no") == 0)
+ flag_generate_unused_section_symbols = 0;
+ else if (strcasecmp (optarg, "yes") == 0)
+ flag_generate_unused_section_symbols = 1;
+ else
+ as_fatal (_("Invalid --generate-unused-section-symbols= option: `%s'"),
+ optarg);
+ break;
+
case OPTION_SECTNAME_SUBST:
flag_sectname_subst = 1;
break;
diff --git a/gas/as.h b/gas/as.h
index bc27822b0c..4d7ce21513 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -615,6 +615,9 @@ extern bfd_boolean flag_generate_build_notes;
COMMON int flag_sectname_subst;
#endif
+/* If we should generate unused section symbols. */
+extern int flag_generate_unused_section_symbols;
+
#ifndef DOLLAR_AMBIGU
#define DOLLAR_AMBIGU 0
#endif
diff --git a/gas/config.in b/gas/config.in
index bd125047d5..2252e6a7d0 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -47,6 +47,9 @@
type by default. */
#undef DEFAULT_GENERATE_ELF_STT_COMMON
+/* Define to 1 if you want to generate unused section symbols by defaul. */
+#undef DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS
+
/* Define to 1 if you want to generate x86 relax relocations by default. */
#undef DEFAULT_GENERATE_X86_RELAX_RELOCATIONS
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index d030b548fb..15d3d21405 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2839,6 +2839,9 @@ elf_adjust_symtab (void)
symbol_table_insert (sy);
}
elf_group_id (s) = symbol_get_bfdsym (sy);
+ /* Mark the group signature symbol as used so that it will be
+ included in the symbol table. */
+ symbol_mark_used_in_reloc (sy);
}
}
diff --git a/gas/configure b/gas/configure
index 813ed93f14..9d58408b3d 100755
--- a/gas/configure
+++ b/gas/configure
@@ -808,6 +808,7 @@ enable_checking
enable_compressed_debug_sections
enable_x86_relax_relocations
enable_elf_stt_common
+enable_generate_unused_section_symbols
enable_generate_build_notes
enable_mips_fix_loongson3_llsc
enable_x86_used_note
@@ -1470,6 +1471,8 @@ Optional Features:
generate x86 relax relocations by default
--enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
default
+ --enable-generate-unused-section-symbols
+ generate unused section symbols by default
--enable-generate-build-notes
generate GNU Build notes if none are provided by the
input
@@ -11344,7 +11347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11347 "configure"
+#line 11350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11450,7 +11453,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11453 "configure"
+#line 11456 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12146,6 +12149,15 @@ if test "${enable_elf_stt_common+set}" = set; then :
esac
fi
+# Decide if assembler should generate unused section symbols.
+ac_default_generate_unused_section_symbols=unset
+# Provide a configure time option to override our default.
+# Check whether --enable-generate-unused-section-symbols was given.
+if test "${enable_generate_unused_section_symbols+set}" = set; then :
+ enableval=$enable_generate_unused_section_symbols; case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+esac
+fi
# Decide if the ELF assembler should default to generating
# GNU Build notes if none are provided by the input.
@@ -12679,9 +12691,13 @@ $as_echo "#define STRICTCOFF 1" >>confdefs.h
;;
i386-*-linux-* | x86_64-*-linux-*)
- if test ${this_target} = $target \
- && test ${ac_default_generate_x86_used_note} = unset; then
- ac_default_generate_x86_used_note=1
+ if test ${this_target} = $target; then
+ if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=0
+ fi
+ if test ${ac_default_generate_x86_used_note} = unset; then
+ ac_default_generate_x86_used_note=1
+ fi
fi
;;
@@ -13222,6 +13238,15 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS $ac_default_generate_unused_section_symbols
+_ACEOF
+
+
cat >>confdefs.h <<_ACEOF
#define DEFAULT_GENERATE_BUILD_NOTES $ac_default_generate_build_notes
diff --git a/gas/configure.ac b/gas/configure.ac
index 8d968defb6..efab654303 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -98,6 +98,15 @@ AC_ARG_ENABLE(elf_stt_common,
yes) ac_default_elf_stt_common=1 ;;
esac])dnl
+# Decide if assembler should generate unused section symbols.
+ac_default_generate_unused_section_symbols=unset
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE(generate-unused-section-symbols,
+ AS_HELP_STRING([--enable-generate-unused-section-symbols],
+ [generate unused section symbols by default]),
+[case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+esac])dnl
# Decide if the ELF assembler should default to generating
# GNU Build notes if none are provided by the input.
@@ -243,9 +252,13 @@ for this_target in $target $canon_targets ; do
;;
i386-*-linux-* | x86_64-*-linux-*)
- if test ${this_target} = $target \
- && test ${ac_default_generate_x86_used_note} = unset; then
- ac_default_generate_x86_used_note=1
+ if test ${this_target} = $target; then
+ if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=0
+ fi
+ if test ${ac_default_generate_x86_used_note} = unset; then
+ ac_default_generate_x86_used_note=1
+ fi
fi
;;
@@ -714,6 +727,13 @@ AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_ELF_STT_COMMON,
[Define to 1 if you want to generate ELF common symbols with the
STT_COMMON type by default.])
+if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS,
+ $ac_default_generate_unused_section_symbols,
+ [Define to 1 if you want to generate unused section symbols by defaul.])
+
AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_BUILD_NOTES,
$ac_default_generate_build_notes,
[Define to 1 if you want to generate GNU Build attribute notes
diff --git a/gas/doc/as.texi b/gas/doc/as.texi
index 983cec3cbf..042ca4a1a0 100644
--- a/gas/doc/as.texi
+++ b/gas/doc/as.texi
@@ -244,6 +244,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@b{-Z}] [@b{@@@var{FILE}}]
[@b{--sectname-subst}] [@b{--size-check=[error|warning]}]
[@b{--elf-stt-common=[no|yes]}]
+ [@b{--generate-unused-section-symbols=[no|yes]}]
[@b{--generate-missing-build-notes=[no|yes]}]
[@b{--target-help}] [@var{target-options}]
[@b{--}|@var{files} @dots{}]
@@ -811,6 +812,12 @@ These options control whether the ELF assembler should generate common
symbols with the @code{STT_COMMON} type. The default can be controlled
by a configure option @option{--enable-elf-stt-common}.
+@item --generate-unused-section-symbols=no
+@itemx --generate-unused-section-symbols=yes
+These options control whether the assembler should generate unused
+section symbols. The default can be controlled by a configure option
+@option{--enable-generate-unused-section-symbols}.
+
@item --generate-missing-build-notes=yes
@itemx --generate-missing-build-notes=no
These options control whether the ELF assembler should generate GNU Build
diff --git a/gas/read.c b/gas/read.c
index a4c6e4ed83..b296c002a1 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4207,6 +4207,9 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
goto err_out;
case O_constant:
exp.X_add_symbol = section_symbol (now_seg);
+ /* Mark the section symbol used in relocation so that it will be
+ included in the symbol table. */
+ symbol_mark_used_in_reloc (exp.X_add_symbol);
exp.X_op = O_symbol;
/* Fallthru */
case O_symbol:
diff --git a/gas/subsegs.c b/gas/subsegs.c
index e07cef0595..accab1f58c 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -177,6 +177,9 @@ subseg_new (const char *segname, subsegT subseg)
secptr = subseg_get (segname, 0);
subseg_set_rest (secptr, subseg);
+ /* Always generate the section symbol if needed. */
+ if (flag_generate_unused_section_symbols)
+ secptr->symbol->flags |= BSF_SECTION_SYM_USED;
return secptr;
}
diff --git a/gas/testsuite/gas/cfi/cfi-label.d b/gas/testsuite/gas/cfi/cfi-label.d
index 0350b57f13..65c8108037 100644
--- a/gas/testsuite/gas/cfi/cfi-label.d
+++ b/gas/testsuite/gas/cfi/cfi-label.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#objdump: -tWf
#name: .cfi_label directive
@@ -6,11 +6,9 @@
SYMBOL TABLE:
0*00 l d \.text 0*00 \.text
-0*00 l d \.data 0*00 \.data
-0*00 l d \.bss 0*00 \.bss
+#...
0*00 l F \.text 0*04 cfilabel
0*2f l \.eh_frame 0*00 cfi2
-0*00 l d \.eh_frame 0*00 \.eh_frame
0*2b g \.eh_frame 0*00 cfi1
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 80dec4effc..721079abff 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -200,7 +200,8 @@ if { [is_elf_format] } then {
set as_flags "$as_flags -march-attr"
}
}
- run_elf_list_test "section2" "$target_machine" "$as_flags" "-s" ""
+ run_elf_list_test "section2" "$target_machine" \
+ "$as_flags --generate-unused-section-symbols=yes" "-s" ""
}
run_dump_test "section3"
run_dump_test "section4"
diff --git a/gas/testsuite/gas/elf/symver.d b/gas/testsuite/gas/elf/symver.d
index 7fcc62a5ca..2292e3267d 100644
--- a/gas/testsuite/gas/elf/symver.d
+++ b/gas/testsuite/gas/elf/symver.d
@@ -8,10 +8,6 @@
.*: file format .*
SYMBOL TABLE:
-
-0+000 l.*d.*\.text.*0+000.*
-0+000 l.*d.*\.data.*0+000.*
-0+000 l.*d.*\.bss.*0+000.*
#...
0+000 l.*O.*\.data.*0+004 x
#...
diff --git a/gas/testsuite/gas/i386/ilp32/elf/symver.d b/gas/testsuite/gas/i386/ilp32/elf/symver.d
index 7f69d660b3..3acf1487b3 100644
--- a/gas/testsuite/gas/i386/ilp32/elf/symver.d
+++ b/gas/testsuite/gas/i386/ilp32/elf/symver.d
@@ -9,10 +9,6 @@
.*: file format .*
SYMBOL TABLE:
-
-0+000 l.*d.*\.text.*0+000.*
-0+000 l.*d.*\.data.*0+000.*
-0+000 l.*d.*\.bss.*0+000.*
#...
0+000 l.*O.*\.data.*0+004 x
#...
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d b/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
index e5b74fa5c9..84b35d0645 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x32 size 1
#source: ../size-1.s
#readelf: -r
@@ -6,19 +6,19 @@
Relocation section '.rela.text' at offset .* contains 9 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+1 00000420 R_X86_64_SIZE32 00000000 xxx \+ 0
-0+6 00000420 R_X86_64_SIZE32 00000000 xxx - 8
-0+b 00000420 R_X86_64_SIZE32 00000000 xxx \+ 8
-0+10 00000520 R_X86_64_SIZE32 00000000 yyy \+ 0
-0+15 00000520 R_X86_64_SIZE32 00000000 yyy - 10
-0+1a 00000520 R_X86_64_SIZE32 00000000 yyy \+ 10
-0+1f 00000620 R_X86_64_SIZE32 00000020 zzz \+ 0
-0+24 00000620 R_X86_64_SIZE32 00000020 zzz - 20
-0+29 00000620 R_X86_64_SIZE32 00000020 zzz \+ 20
+0+1 00000120 R_X86_64_SIZE32 00000000 xxx \+ 0
+0+6 00000120 R_X86_64_SIZE32 00000000 xxx - 8
+0+b 00000120 R_X86_64_SIZE32 00000000 xxx \+ 8
+0+10 00000220 R_X86_64_SIZE32 00000000 yyy \+ 0
+0+15 00000220 R_X86_64_SIZE32 00000000 yyy - 10
+0+1a 00000220 R_X86_64_SIZE32 00000000 yyy \+ 10
+0+1f 00000320 R_X86_64_SIZE32 00000020 zzz \+ 0
+0+24 00000320 R_X86_64_SIZE32 00000020 zzz - 20
+0+29 00000320 R_X86_64_SIZE32 00000020 zzz \+ 20
Relocation section '.rela.data' at offset .* contains 3 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+50 00000420 R_X86_64_SIZE32 00000000 xxx - 1
-0+54 00000520 R_X86_64_SIZE32 00000000 yyy \+ 2
-0+58 00000620 R_X86_64_SIZE32 00000020 zzz \+ 0
+0+50 00000120 R_X86_64_SIZE32 00000000 xxx - 1
+0+54 00000220 R_X86_64_SIZE32 00000000 yyy \+ 2
+0+58 00000320 R_X86_64_SIZE32 00000020 zzz \+ 0
#pass
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d b/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
index 6f96134f13..ea906a863f 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x32 size 3
#source: ../size-3.s
#readelf: -r
@@ -6,15 +6,15 @@
Relocation section '.rela.text' at offset .* contains 6 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+1 00000620 R_X86_64_SIZE32 00000000 xxx \+ 0
-0+6 00000620 R_X86_64_SIZE32 00000000 xxx - 8
-0+b 00000620 R_X86_64_SIZE32 00000000 xxx \+ 8
-0+10 00000720 R_X86_64_SIZE32 00000000 yyy \+ 0
-0+15 00000720 R_X86_64_SIZE32 00000000 yyy - 10
-0+1a 00000720 R_X86_64_SIZE32 00000000 yyy \+ 10
+0+1 00000120 R_X86_64_SIZE32 00000000 xxx \+ 0
+0+6 00000120 R_X86_64_SIZE32 00000000 xxx - 8
+0+b 00000120 R_X86_64_SIZE32 00000000 xxx \+ 8
+0+10 00000220 R_X86_64_SIZE32 00000000 yyy \+ 0
+0+15 00000220 R_X86_64_SIZE32 00000000 yyy - 10
+0+1a 00000220 R_X86_64_SIZE32 00000000 yyy \+ 10
Relocation section '.rela.tdata' at offset .* contains 2 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+50 00000620 R_X86_64_SIZE32 00000000 xxx - 1
-0+54 00000720 R_X86_64_SIZE32 00000000 yyy \+ 2
+0+50 00000120 R_X86_64_SIZE32 00000000 xxx - 1
+0+54 00000220 R_X86_64_SIZE32 00000000 yyy \+ 2
#pass
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d b/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
index 8ce06b0f84..e0b02bbf98 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x32 size 5
#source: ../x86-64-size-5.s
#readelf: -r
@@ -6,13 +6,13 @@
Relocation section '.rela.text' at offset .* contains 3 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+2 00000421 R_X86_64_SIZE64 00000000 xxx \+ 0
-0+c 00000421 R_X86_64_SIZE64 00000000 xxx - 8
-0+16 00000421 R_X86_64_SIZE64 00000000 xxx \+ 8
+0+2 00000121 R_X86_64_SIZE64 00000000 xxx \+ 0
+0+c 00000121 R_X86_64_SIZE64 00000000 xxx - 8
+0+16 00000121 R_X86_64_SIZE64 00000000 xxx \+ 8
Relocation section '.rela.data' at offset .* contains 3 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend
-0+50 00000421 R_X86_64_SIZE64 00000000 xxx - 1
-0+58 00000621 R_X86_64_SIZE64 00000000 yyy \+ c8
-0+60 00000521 R_X86_64_SIZE64 00000020 zzz \+ 0
+0+50 00000121 R_X86_64_SIZE64 00000000 xxx - 1
+0+58 00000321 R_X86_64_SIZE64 00000000 yyy \+ c8
+0+60 00000221 R_X86_64_SIZE64 00000020 zzz \+ 0
#pass
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d b/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
index bd532b73e8..f56804e946 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
@@ -1,9 +1,9 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#source: ../x86-64-unwind.s
#readelf: -S
#name: x86-64 (ILP32) unwind
-There are 8 section headers, starting at offset 0x[0-9a-f]+:
+There are 6 section headers, starting at offset 0x[0-9a-f]+:
Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
@@ -12,8 +12,6 @@ Section Headers:
\[ 2\] .data PROGBITS 00000000 000034 000000 00 WA 0 0 1
\[ 3\] .bss NOBITS 00000000 000034 000000 00 WA 0 0 1
\[ 4\] .eh_frame X86_64_UNWIND 00000000 000034 000008 00 A 0 0 1
- \[ 5\] .symtab SYMTAB 00000000 [0-9a-f]+ 000050 10 6 5 4
- \[ 6\] .strtab STRTAB 00000000 [0-9a-f]+ 000001 00 . 0 0 1
- \[ 7\] .shstrtab STRTAB 00000000 [0-9a-f]+ 000036 00 . 0 0 1
+ \[ 5\] .shstrtab STRTAB 00000000 [0-9a-f]+ 000026 00 . 0 0 1
Key to Flags:
#pass
diff --git a/gas/testsuite/gas/i386/size-1.d b/gas/testsuite/gas/i386/size-1.d
index d582bbecc9..be6c36e755 100644
--- a/gas/testsuite/gas/i386/size-1.d
+++ b/gas/testsuite/gas/i386/size-1.d
@@ -1,23 +1,23 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: i386 size 1
#readelf: -r
Relocation section '.rel.text' at offset .* contains 9 entries:
Offset Info Type Sym.Value Sym. Name
-0+1 00000426 R_386_SIZE32 00000000 xxx
-0+6 00000426 R_386_SIZE32 00000000 xxx
-0+b 00000426 R_386_SIZE32 00000000 xxx
-0+10 00000526 R_386_SIZE32 00000000 yyy
-0+15 00000526 R_386_SIZE32 00000000 yyy
-0+1a 00000526 R_386_SIZE32 00000000 yyy
-0+1f 00000626 R_386_SIZE32 00000020 zzz
-0+24 00000626 R_386_SIZE32 00000020 zzz
-0+29 00000626 R_386_SIZE32 00000020 zzz
+0+1 00000126 R_386_SIZE32 00000000 xxx
+0+6 00000126 R_386_SIZE32 00000000 xxx
+0+b 00000126 R_386_SIZE32 00000000 xxx
+0+10 00000226 R_386_SIZE32 00000000 yyy
+0+15 00000226 R_386_SIZE32 00000000 yyy
+0+1a 00000226 R_386_SIZE32 00000000 yyy
+0+1f 00000326 R_386_SIZE32 00000020 zzz
+0+24 00000326 R_386_SIZE32 00000020 zzz
+0+29 00000326 R_386_SIZE32 00000020 zzz
Relocation section '.rel.data' at offset .* contains 3 entries:
Offset Info Type Sym.Value Sym. Name
-0+50 00000426 R_386_SIZE32 00000000 xxx
-0+54 00000526 R_386_SIZE32 00000000 yyy
-0+58 00000626 R_386_SIZE32 00000020 zzz
+0+50 00000126 R_386_SIZE32 00000000 xxx
+0+54 00000226 R_386_SIZE32 00000000 yyy
+0+58 00000326 R_386_SIZE32 00000020 zzz
#pass
diff --git a/gas/testsuite/gas/i386/size-3.d b/gas/testsuite/gas/i386/size-3.d
index 2b08707f43..c2905258f0 100644
--- a/gas/testsuite/gas/i386/size-3.d
+++ b/gas/testsuite/gas/i386/size-3.d
@@ -1,19 +1,19 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: i386 size 3
#readelf: -r
Relocation section '.rel.text' at offset .* contains 6 entries:
Offset Info Type Sym.Value Sym. Name
-0+1 00000626 R_386_SIZE32 00000000 xxx
-0+6 00000626 R_386_SIZE32 00000000 xxx
-0+b 00000626 R_386_SIZE32 00000000 xxx
-0+10 00000726 R_386_SIZE32 00000000 yyy
-0+15 00000726 R_386_SIZE32 00000000 yyy
-0+1a 00000726 R_386_SIZE32 00000000 yyy
+0+1 00000126 R_386_SIZE32 00000000 xxx
+0+6 00000126 R_386_SIZE32 00000000 xxx
+0+b 00000126 R_386_SIZE32 00000000 xxx
+0+10 00000226 R_386_SIZE32 00000000 yyy
+0+15 00000226 R_386_SIZE32 00000000 yyy
+0+1a 00000226 R_386_SIZE32 00000000 yyy
Relocation section '.rel.tdata' at offset .* contains 2 entries:
Offset Info Type Sym.Value Sym. Name
-0+50 00000626 R_386_SIZE32 00000000 xxx
-0+54 00000726 R_386_SIZE32 00000000 yyy
+0+50 00000126 R_386_SIZE32 00000000 xxx
+0+54 00000226 R_386_SIZE32 00000000 yyy
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-size-1.d b/gas/testsuite/gas/i386/x86-64-size-1.d
index 657408cf73..2fe49bdf62 100644
--- a/gas/testsuite/gas/i386/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/x86-64-size-1.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x86-64 size 1
#source: size-1.s
#readelf: -r
@@ -6,19 +6,19 @@
Relocation section '.rela.text' at offset .* contains 9 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+1 000400000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 0
-0+6 000400000020 R_X86_64_SIZE32 0000000000000000 xxx - 8
-0+b 000400000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 8
-0+10 000500000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 0
-0+15 000500000020 R_X86_64_SIZE32 0000000000000000 yyy - 10
-0+1a 000500000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 10
-0+1f 000600000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 0
-0+24 000600000020 R_X86_64_SIZE32 0000000000000020 zzz - 20
-0+29 000600000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 20
+0+1 000100000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 0
+0+6 000100000020 R_X86_64_SIZE32 0000000000000000 xxx - 8
+0+b 000100000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 8
+0+10 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 0
+0+15 000200000020 R_X86_64_SIZE32 0000000000000000 yyy - 10
+0+1a 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 10
+0+1f 000300000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 0
+0+24 000300000020 R_X86_64_SIZE32 0000000000000020 zzz - 20
+0+29 000300000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 20
Relocation section '.rela.data' at offset .* contains 3 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+50 000400000020 R_X86_64_SIZE32 0000000000000000 xxx - 1
-0+54 000500000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 2
-0+58 000600000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 0
+0+50 000100000020 R_X86_64_SIZE32 0000000000000000 xxx - 1
+0+54 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 2
+0+58 000300000020 R_X86_64_SIZE32 0000000000000020 zzz \+ 0
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-size-3.d b/gas/testsuite/gas/i386/x86-64-size-3.d
index 943a64e9ac..68395acb47 100644
--- a/gas/testsuite/gas/i386/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/x86-64-size-3.d
@@ -1,4 +1,4 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x86-64 size 3
#source: size-3.s
#readelf: -r
@@ -6,15 +6,15 @@
Relocation section '.rela.text' at offset .* contains 6 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+1 000600000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 0
-0+6 000600000020 R_X86_64_SIZE32 0000000000000000 xxx - 8
-0+b 000600000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 8
-0+10 000700000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 0
-0+15 000700000020 R_X86_64_SIZE32 0000000000000000 yyy - 10
-0+1a 000700000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 10
+0+1 000100000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 0
+0+6 000100000020 R_X86_64_SIZE32 0000000000000000 xxx - 8
+0+b 000100000020 R_X86_64_SIZE32 0000000000000000 xxx \+ 8
+0+10 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 0
+0+15 000200000020 R_X86_64_SIZE32 0000000000000000 yyy - 10
+0+1a 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 10
Relocation section '.rela.tdata' at offset .* contains 2 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+50 000600000020 R_X86_64_SIZE32 0000000000000000 xxx - 1
-0+54 000700000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 2
+0+50 000100000020 R_X86_64_SIZE32 0000000000000000 xxx - 1
+0+54 000200000020 R_X86_64_SIZE32 0000000000000000 yyy \+ 2
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-size-5.d b/gas/testsuite/gas/i386/x86-64-size-5.d
index c34d0eedaa..7d70bffb05 100644
--- a/gas/testsuite/gas/i386/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/x86-64-size-5.d
@@ -1,17 +1,17 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#name: x86-64 size 5
#readelf: -r
Relocation section '.rela.text' at offset .* contains 3 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+2 000400000021 R_X86_64_SIZE64 0000000000000000 xxx \+ 0
-0+c 000400000021 R_X86_64_SIZE64 0000000000000000 xxx - 8
-0+16 000400000021 R_X86_64_SIZE64 0000000000000000 xxx \+ 8
+0+2 000100000021 R_X86_64_SIZE64 0000000000000000 xxx \+ 0
+0+c 000100000021 R_X86_64_SIZE64 0000000000000000 xxx - 8
+0+16 000100000021 R_X86_64_SIZE64 0000000000000000 xxx \+ 8
Relocation section '.rela.data' at offset .* contains 3 entries:
Offset Info Type Sym. Value Sym. Name \+ Addend
-0+50 000400000021 R_X86_64_SIZE64 0000000000000000 xxx - 1
-0+58 000600000021 R_X86_64_SIZE64 0000000000000000 yyy \+ c8
-0+60 000500000021 R_X86_64_SIZE64 0000000000000020 zzz \+ 0
+0+50 000100000021 R_X86_64_SIZE64 0000000000000000 xxx - 1
+0+58 000300000021 R_X86_64_SIZE64 0000000000000000 yyy \+ c8
+0+60 000200000021 R_X86_64_SIZE64 0000000000000020 zzz \+ 0
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-unwind.d b/gas/testsuite/gas/i386/x86-64-unwind.d
index 7f8d94fe86..e8110bd144 100644
--- a/gas/testsuite/gas/i386/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/x86-64-unwind.d
@@ -1,8 +1,8 @@
-#as: -mx86-used-note=no --generate-missing-build-notes=no
+#as: -mx86-used-note=no --generate-missing-build-notes=no --generate-unused-section-symbols=no
#readelf: -S
#name: x86-64 unwind
-There are 8 section headers, starting at offset 0x[0-9a-f]+:
+There are 6 section headers, starting at offset 0x[0-9a-f]+:
Section Headers:
\[Nr\] Name Type Address Offset
@@ -17,11 +17,7 @@ Section Headers:
0000000000000000 0000000000000000 WA 0 0 1
\[ 4\] \.eh_frame X86_64_UNWIND 0000000000000000 00000040
0000000000000008 0000000000000000 A 0 0 1
- \[ 5\] \.symtab SYMTAB 0000000000000000 [0-9a-f]+
- 0000000000000078 0000000000000018 6 5 8
- \[ 6\] \.strtab STRTAB 0000000000000000 [0-9a-f]+
- 0000000000000001 0000000000000000 . 0 0 1
- \[ 7\] \.shstrtab STRTAB 0000000000000000 [0-9a-f]+
- 0000000000000036 0000000000000000 . 0 0 1
+ \[ 5\] \.shstrtab STRTAB 0000000000000000 [0-9a-f]+
+ 0000000000000026 0000000000000000 . 0 0 1
Key to Flags:
#...
diff --git a/gas/write.c b/gas/write.c
index 054f27987d..84094857a4 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -848,7 +848,12 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED,
/* Since we're reducing to section symbols, don't attempt to reduce
anything that's already using one. */
if (symbol_section_p (sym))
- continue;
+ {
+ /* Mark the section symbol used in relocation so that it will
+ be included in the symbol table. */
+ symbol_mark_used_in_reloc (sym);
+ continue;
+ }
symsec = S_GET_SEGMENT (sym);
if (symsec == NULL)
@@ -1747,10 +1752,13 @@ set_symtab (void)
/* Count symbols. We can't rely on a count made by the loop in
write_object_file, because *_frob_file may add a new symbol or
- two. */
+ two. Only generate unused section symbols if asked. */
nsyms = 0;
for (symp = symbol_rootP; symp; symp = symbol_next (symp))
- nsyms++;
+ if (flag_generate_unused_section_symbols
+ || !symbol_section_p (symp)
+ || symbol_used_in_reloc_p (symp))
+ nsyms++;
if (nsyms)
{
@@ -1759,15 +1767,22 @@ set_symtab (void)
asympp = (asymbol **) bfd_alloc (stdoutput, amt);
symp = symbol_rootP;
- for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
- {
- asympp[i] = symbol_get_bfdsym (symp);
- if (asympp[i]->flags != BSF_SECTION_SYM
- || !(bfd_is_const_section (asympp[i]->section)
- && asympp[i]->section->symbol == asympp[i]))
- asympp[i]->flags |= BSF_KEEP;
- symbol_mark_written (symp);
- }
+ for (i = 0; i < nsyms; symp = symbol_next (symp))
+ if (flag_generate_unused_section_symbols
+ || !symbol_section_p (symp)
+ || symbol_used_in_reloc_p (symp))
+ {
+ asympp[i] = symbol_get_bfdsym (symp);
+ if (asympp[i]->flags != BSF_SECTION_SYM
+ || !(bfd_is_const_section (asympp[i]->section)
+ && asympp[i]->section->symbol == asympp[i]))
+ asympp[i]->flags |= BSF_KEEP;
+ symbol_mark_written (symp);
+ /* Include this section symbol in the symbol table. */
+ if (symbol_section_p (symp))
+ asympp[i]->flags |= BSF_SECTION_SYM_USED;
+ i++;
+ }
}
else
asympp = 0;
@@ -2058,6 +2073,10 @@ maybe_generate_build_notes (void)
bfd_section_size (bsym->section),
note);
+ /* Mark the section symbol used in relocation so that it will be
+ included in the symbol table. */
+ symbol_mark_used_in_reloc (sym);
+
total_size += note_size;
/* FIXME: Maybe add a note recording the assembler command line and version ? */
}
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 6b179ec112..940fc48004 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -421,6 +421,9 @@ struct bfd_link_info
/* TRUE if separate code segment should be created. */
unsigned int separate_code: 1;
+ /* TRUE if unused section symbols should be generated. */
+ unsigned int unused_section_symbols: 1;
+
/* Nonzero if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
should be created. 1 for DWARF2 tables, 2 for compact tables. */
unsigned int eh_frame_hdr_type: 2;
diff --git a/ld/NEWS b/ld/NEWS
index a5c0d7a2f6..23ac90ebdb 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,10 @@
-*- text -*-
+* Add --generate-unused-section-symbols=[yes|no] to generate unused
+ section symbols. Default can be controlled by the configure option,
+ --enable-generate-section-symbols. Default to no for Linux/x86
+ targets.
+
* Add libdep plugin, for linking dependencies of static libraries that
were recorded by ar in the __.LIBDEP archive member.
diff --git a/ld/config.in b/ld/config.in
index 7b60d77858..5f0bf59ce5 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -16,6 +16,9 @@
/* Define if you want compressed debug sections by default. */
#undef DEFAULT_FLAG_COMPRESS_DEBUG
+/* Define to 1 if you want to generate unused section symbols by default. */
+#undef DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS
+
/* The default method for DT_TEXTREL check in ELF linker. */
#undef DEFAULT_LD_TEXTREL_CHECK
diff --git a/ld/configure b/ld/configure
index afe52ef5ef..3d50488249 100755
--- a/ld/configure
+++ b/ld/configure
@@ -835,6 +835,7 @@ enable_new_dtags
enable_relro
enable_textrel_check
enable_separate_code
+enable_generate_unused_section_symbols
enable_error_handling_script
enable_default_hash_style
enable_libctf
@@ -1506,6 +1507,8 @@ Optional Features:
--enable-textrel-check=[yes|no|warning|error]
enable DT_TEXTREL check in ELF linker
--enable-separate-code enable -z separate-code in ELF linker by default
+ --enable-generate-unused-section-symbols
+ generate unused section symbols by default
--enable-error-handling-script
enable/disable support for the
--error-handling-script option
@@ -12043,7 +12046,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12046 "configure"
+#line 12049 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12149,7 +12152,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12152 "configure"
+#line 12155 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15949,6 +15952,17 @@ esac
fi
+# Decide if linker should generate unused section symbols by default.
+ac_default_generate_unused_section_symbols=unset
+# Check whether --enable-generate-unused-section-symbols was given.
+if test "${enable_generate_unused_section_symbols+set}" = set; then :
+ enableval=$enable_generate_unused_section_symbols; case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+ no) ac_default_generate_unused_section_symbols=0 ;;
+esac
+fi
+
+
# Decide if --error-handling-script should be supported.
ac_support_error_handling_script=unset
# Check whether --enable-error-handling-script was given.
@@ -17754,6 +17768,15 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+if test "${ac_default_generate_unused_section_symbols}" = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS $ac_default_generate_unused_section_symbols
+_ACEOF
+
+
if test "${ac_support_error_handling_script}" = unset; then
ac_support_error_handling_script=1
fi
diff --git a/ld/configure.ac b/ld/configure.ac
index 7676009d91..0bfd858238 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -195,6 +195,16 @@ AC_ARG_ENABLE(separate-code,
no) ac_default_ld_z_separate_code=0 ;;
esac])
+# Decide if linker should generate unused section symbols by default.
+ac_default_generate_unused_section_symbols=unset
+AC_ARG_ENABLE(generate-unused-section-symbols,
+ AS_HELP_STRING([--enable-generate-unused-section-symbols],
+ [generate unused section symbols by default]),
+[case "${enableval}" in
+ yes) ac_default_generate_unused_section_symbols=1 ;;
+ no) ac_default_generate_unused_section_symbols=0 ;;
+esac])
+
# Decide if --error-handling-script should be supported.
ac_support_error_handling_script=unset
AC_ARG_ENABLE(error-handling-script,
@@ -499,6 +509,13 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_SEPARATE_CODE,
$ac_default_ld_z_separate_code,
[Define to 1 if you want to enable -z separate-code in ELF linker by default.])
+if test "${ac_default_generate_unused_section_symbols}" = unset; then
+ ac_default_generate_unused_section_symbols=1
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS,
+ $ac_default_generate_unused_section_symbols,
+ [Define to 1 if you want to generate unused section symbols by default.])
+
if test "${ac_support_error_handling_script}" = unset; then
ac_support_error_handling_script=1
fi
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 70359301b5..c9822202f8 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -1096,12 +1096,16 @@ frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*)
;;
esac
-# Enable -z separate-code and --warn-textrel by default for Linux/x86.
+# Enable -z separate-code, --generate-unused-section-symbols=no and
+# --warn-textrel by default for Linux/x86.
case "${target}" in
i[3-7]86-*-linux-* | x86_64-*-linux-*)
if test ${ac_default_ld_z_separate_code} = unset; then
ac_default_ld_z_separate_code=1
fi
+ if test ${ac_default_generate_unused_section_symbols} = unset; then
+ ac_default_generate_unused_section_symbols=0
+ fi
if test ${ac_default_ld_textrel_check} = unset; then
ac_default_ld_textrel_check=yes
fi
diff --git a/ld/ld.texi b/ld/ld.texi
index 98609a0af2..a6e97c4a14 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2771,6 +2771,12 @@ involved and the configure options used to build the toolchain. The
default can be determined by examining the output from the linker's
@option{--help} option.
+@item --generate-unused-section-symbols=yes
+@itemx --generate-unused-section-symbols=no
+Generate unused section symbols in linker output. The default can be
+controlled by a configure option
+@option{--enable-generate-unused-section-symbols}.
+
@kindex --reduce-memory-overheads
@item --reduce-memory-overheads
This option reduces memory requirements at ld runtime, at the expense of
diff --git a/ld/ldlex.h b/ld/ldlex.h
index bb38cca4d6..9893c232ec 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -83,6 +83,7 @@ enum option_values
OPTION_DYNAMIC_LIST_DATA,
OPTION_EXPORT_DYNAMIC_SYMBOL,
OPTION_EXPORT_DYNAMIC_SYMBOL_LIST,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS,
OPTION_WARN_COMMON,
OPTION_WARN_CONSTRUCTORS,
OPTION_WARN_FATAL,
diff --git a/ld/ldmain.c b/ld/ldmain.c
index f8a03c6648..60311abb82 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -336,6 +336,8 @@ main (int argc, char **argv)
link_info.combreloc = TRUE;
link_info.strip_discarded = TRUE;
link_info.prohibit_multiple_definition_absolute = FALSE;
+ link_info.unused_section_symbols
+ = DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS;
link_info.textrel_check = DEFAULT_LD_TEXTREL_CHECK;
link_info.emit_hash = DEFAULT_EMIT_SYSV_HASH;
link_info.emit_gnu_hash = DEFAULT_EMIT_GNU_HASH;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 1d01833b31..f03ce6113b 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -522,6 +522,15 @@ static const struct ld_option ld_options[] =
'\0', N_("SYMBOL"), N_("Export the specified symbol"), EXACTLY_TWO_DASHES },
{ {"export-dynamic-symbol-list", required_argument, NULL, OPTION_EXPORT_DYNAMIC_SYMBOL_LIST},
'\0', N_("FILE"), N_("Read export dynamic symbol list"), EXACTLY_TWO_DASHES },
+ { {"generate-unused-section-symbols", required_argument, NULL,
+ OPTION_GENERATE_UNUSED_SECTION_SYMBOLS},
+ '\0', N_("=[yes|no]"),
+#if DEFAULT_GENERATE_UNUSED_SECTION_SYMBOLS
+ N_("Generate unused section symbols (default: yes)"),
+#else
+ N_("Generate unused section symbols (default: no)"),
+#endif
+ EXACTLY_TWO_DASHES },
{ {"warn-common", no_argument, NULL, OPTION_WARN_COMMON},
'\0', NULL, N_("Warn about duplicate common symbols"), TWO_DASHES },
{ {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS},
@@ -1502,6 +1511,15 @@ parse_args (unsigned argc, char **argv)
yyparse ();
}
break;
+ case OPTION_GENERATE_UNUSED_SECTION_SYMBOLS:
+ if (strcasecmp (optarg, "no") == 0)
+ link_info.unused_section_symbols = FALSE;
+ else if (strcasecmp (optarg, "yes") == 0)
+ link_info.unused_section_symbols = TRUE;
+ else
+ einfo (_("%F%P: invalid --generate-unused-section-symbols= option: `%s'\n"),
+ optarg);
+ break;
case OPTION_WARN_COMMON:
config.warn_common = TRUE;
break;
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 7813ad36ee..333ba0bde6 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -36,7 +36,7 @@ if { !([istarget *-*-linux*]
# from the prog_name and ld_options and we do not want absolute paths
# to appear in the test_name. The optional readelf_options can be
# used to specify different options for readelf.
-proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "-l"}} {
+proc binutils_test { prog_name prog_options ld_options test {test_name ""} {readelf_options "-l"}} {
global as
global ld
global READELF
@@ -49,7 +49,7 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
eval set prog \$$prog_name
if { "$test_name" == "" } {
- set test_name "$prog_name $ld_options ($test)"
+ set test_name "$prog_name $prog_options $ld_options ($test)"
}
if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
@@ -68,6 +68,33 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
return
}
+ if [string match "*--generate-unused-section-symbols*" $ld_options] {
+ send_log "$READELF -s --wide tmpdir/$test > tmpdir/$test-s.exp\n"
+ set got [remote_exec host "$READELF -s --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test-s.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ unresolved "$test_name (ld)"
+ return
+ }
+ # Check if section symbols are generated.
+ set got [remote_exec host "egrep \"SECTION +LOCAL +DEFAULT\" tmpdir/$test-s.exp"]
+ if [string match "*--generate-unused-section-symbols=yes*" $ld_options] {
+ if { ![string match "*SECTION*" $got] } then {
+ # Fail if section symbols aren't generated, but should.
+ send_log "$got\n"
+ fail "$test_name (ld)"
+ return
+ }
+ } else {
+ if { [string match "*SECTION*" $got] } then {
+ # Fail if section symbols are generated, but shouldn't.
+ send_log "$got\n"
+ fail "$test_name (ld)"
+ return
+ }
+ }
+ }
+
send_log "$READELF $readelf_options --wide tmpdir/$test > tmpdir/$test.exp\n"
set got [remote_exec host "$READELF $readelf_options --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
@@ -122,14 +149,41 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
}
}
- send_log "$prog tmpdir/$test\n"
- set got [remote_exec host "$prog tmpdir/$test"]
+ send_log "$prog $prog_options tmpdir/$test\n"
+ set got [remote_exec host "$prog $prog_options tmpdir/$test"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
fail "$test_name"
return
}
+ if [string match "*--generate-unused-section-symbols*" $prog_options] {
+ send_log "$READELF -s --wide tmpdir/$test > tmpdir/$test-s.exp\n"
+ set got [remote_exec host "$READELF -s --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test-s.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ unresolved "$test_name ($prog_name)"
+ return
+ }
+ # Check if section symbols are generated.
+ set got [remote_exec host "egrep \"SECTION +LOCAL +DEFAULT\" tmpdir/$test-s.exp"]
+ if [string match "*--generate-unused-section-symbols=yes*" $prog_options] {
+ if { ![string match "*SECTION*" $got] } then {
+ # Fail if section symbols aren't generated, but should.
+ send_log "$got\n"
+ fail "$test_name ($prog_name)"
+ return
+ }
+ } else {
+ if { [string match "*SECTION*" $got] } then {
+ # Fail if section symbols are generated, but shouldn't.
+ send_log "$got\n"
+ fail "$test_name ($prog_name)"
+ return
+ }
+ }
+ }
+
send_log "$READELF $readelf_options --wide tmpdir/$test > tmpdir/$test.out\n"
set got [remote_exec host "$READELF $readelf_options --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
@@ -147,30 +201,35 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
pass "$test_name"
}
-binutils_test strip "-z max-page-size=0x200000" maxpage1
-binutils_test strip "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
-binutils_test strip "-z max-page-size=0x100000" maxpage1
-binutils_test strip "-z max-page-size=0x100000 -z common-page-size=0x1000" maxpage1
+binutils_test strip "" "-z max-page-size=0x200000" maxpage1
+binutils_test strip "" "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
+binutils_test strip "" "-z max-page-size=0x100000" maxpage1
+binutils_test strip "" "-z max-page-size=0x100000 -z common-page-size=0x1000" maxpage1
+
+binutils_test strip "" "" maxpage1
+binutils_test strip "" "-shared" maxpage1
+binutils_test objcopy "" "" maxpage1
+binutils_test objcopy "" "-shared" maxpage1
-binutils_test strip "" maxpage1
-binutils_test strip "-shared" maxpage1
-binutils_test objcopy "" maxpage1
-binutils_test objcopy "-shared" maxpage1
+binutils_test objcopy "--generate-unused-section-symbols=no" "--generate-unused-section-symbols=no" maxpage1
+binutils_test objcopy "--generate-unused-section-symbols=yes" "--generate-unused-section-symbols=no" maxpage1
+binutils_test objcopy "--generate-unused-section-symbols=no" "--generate-unused-section-symbols=yes" maxpage1
+binutils_test objcopy "--generate-unused-section-symbols=yes" "--generate-unused-section-symbols=yes" maxpage1
-binutils_test strip "-z relro" relro1
-binutils_test strip "-z relro -shared" relro1
-binutils_test objcopy "-z relro" relro1
-binutils_test objcopy "-z relro -shared" relro1
+binutils_test strip "" "-z relro" relro1
+binutils_test strip "" "-z relro -shared" relro1
+binutils_test objcopy "" "-z relro" relro1
+binutils_test objcopy "" "-z relro -shared" relro1
if { ([istarget "i?86-*-elf*"]
|| [istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
|| [istarget "x86_64-*-linux*"]
|| [istarget "amd64-*-linux*"]) } {
- binutils_test strip "-z relro -shared" relro2
- binutils_test objcopy "-z relro -shared" relro2
+ binutils_test strip "" "-z relro -shared" relro2
+ binutils_test objcopy "" "-z relro -shared" relro2
}
-binutils_test strip "-T ${srcdir}/${subdir}/lma.lnk" lma "strip -T lma.lnk"
+binutils_test strip "" "-T ${srcdir}/${subdir}/lma.lnk" lma "strip -T lma.lnk"
set tls_tests { "tdata1" "tdata2" }
# hppa64 has its own .tbss section, with different flags.
@@ -190,8 +249,8 @@ set tls_opts {
foreach testitem $tls_tests {
foreach testopt $tls_opts {
- binutils_test objcopy $testopt $testitem
+ binutils_test objcopy "" $testopt $testitem
}
}
-binutils_test strip "-s" gap "" "-lS"
+binutils_test strip "" "-s" gap "" "-lS"
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index a58b17b512..b488231687 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -392,7 +392,8 @@ run_cc_link_tests [list \
] \
[list \
"Build pr26391-3" \
- "-Wl,-z,unique-symbol,--emit-relocs" \
+ "-Wl,-z,unique-symbol,--emit-relocs \
+ -Wl,--generate-unused-section-symbols=yes" \
"-fno-function-sections" \
{pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \
{{nm "" pr26391.nd}} \
@@ -400,7 +401,8 @@ run_cc_link_tests [list \
] \
[list \
"Build pr26391-4" \
- "-Wl,-z,unique-symbol,--emit-relocs" \
+ "-Wl,-z,unique-symbol,--emit-relocs \
+ -Wl,--generate-unused-section-symbols=no" \
"-ffunction-sections" \
{pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \
{{nm "" pr26391.nd}} \
@@ -497,4 +499,45 @@ run_ld_link_exec_tests [list \
] \
]
+proc objcopy_test_emit_relocs {test options} {
+ global objcopy
+ global READELF
+
+ send_log "$READELF -r --wide $test > $test.out\n"
+ set got [remote_exec host "$READELF -r --wide $test" "" "/dev/null" "$test.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ unresolved "objcopy $options on $test"
+ return
+ }
+
+ set cmd "$objcopy $options $test $test-copy"
+ send_log "$cmd\n"
+ set got [remote_exec host "$cmd"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ fail "objcopy $options on $test"
+ return
+ }
+
+ send_log "$READELF -r --wide $test-copy > $test-copy.out\n"
+ set got [remote_exec host "$READELF -r --wide $test-copy" "" "/dev/null" "$test-copy.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ fail "objcopy $options on $test"
+ return
+ }
+
+ if { [catch {exec cmp $test.exp $test-copy.out}] } then {
+ send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
+ fail "objcopy $options on $test"
+ return
+ }
+}
+
+objcopy_test_emit_relocs tmpdir/pr26391-3 --generate-unused-section-symbols=yes
+objcopy_test_emit_relocs tmpdir/pr26391-3 --generate-unused-section-symbols=no
+objcopy_test_emit_relocs tmpdir/pr26391-4 --generate-unused-section-symbols=yes
+objcopy_test_emit_relocs tmpdir/pr26391-4 --generate-unused-section-symbols=no
+
catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini tmpdir/init-mixed" status
diff --git a/ld/testsuite/ld-elf/export-class.exp b/ld/testsuite/ld-elf/export-class.exp
index 01a008524a..f99e7b881b 100644
--- a/ld/testsuite/ld-elf/export-class.exp
+++ b/ld/testsuite/ld-elf/export-class.exp
@@ -76,8 +76,9 @@ run_ld_link_tests [list \
run_ld_link_tests [list \
[list \
"$testname (final shared object)" \
- "-shared -Tdata=0x12340000 tmpdir/export-class-ref-r.o tmpdir/export-class-lib.so" "" \
- "" \
+ "-shared -Tdata=0x12340000 --generate-unused-section-symbols=no \
+ tmpdir/export-class-ref-r.o tmpdir/export-class-lib.so" \
+ "" "" \
{ export-class-dep.s export-class-def.s } \
{ \
{ readelf -s export-class.sd } \
diff --git a/ld/testsuite/ld-elf/export-class.sd b/ld/testsuite/ld-elf/export-class.sd
index bd5c5491d9..e71248268c 100644
--- a/ld/testsuite/ld-elf/export-class.sd
+++ b/ld/testsuite/ld-elf/export-class.sd
@@ -9,8 +9,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
#...
Symbol table '\.symtab' contains [0-9]+ entries:
* Num: * Value * Size * Type * Bind * Vis * Ndx * Name
-#...
- * [0-9a-f]+: * 0*12340000 * 0 * SECTION * LOCAL * DEFAULT * [0-9]+ *
#...
* [0-9a-f]+: * 0*123400a0 * 0 * NOTYPE * LOCAL * DEFAULT * [0-9]+ * hidden_foo
#...
diff --git a/ld/testsuite/ld-elf/loadaddr3b.d b/ld/testsuite/ld-elf/loadaddr3b.d
index ac4b5178d8..ad399b4cbb 100644
--- a/ld/testsuite/ld-elf/loadaddr3b.d
+++ b/ld/testsuite/ld-elf/loadaddr3b.d
@@ -1,11 +1,8 @@
#source: loadaddr.s
-#ld: -T loadaddr3.t -z max-page-size=0x200000
+#ld: -T loadaddr3.t -z max-page-size=0x200000 --generate-unused-section-symbols=no
#objdump: -t
#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
-#...
-0+0000100 l d .text 0+0000000 .text
-0+0000200 l d .data 0+0000000 .data
#...
0+0000110 g \*ABS\* 0+0000000 data_load
#...
diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp
index f17a11890d..a98d03d95a 100644
--- a/ld/testsuite/ld-elf/sec64k.exp
+++ b/ld/testsuite/ld-elf/sec64k.exp
@@ -178,11 +178,11 @@ if { ![istarget "d10v-*-*"]
&& ![istarget "pru-*-*"] } {
foreach sfile $sfiles { puts $ofd "#source: $sfile" }
if { [istarget spu*-*-*] } {
- puts $ofd "#ld: --local-store 0:0"
+ puts $ofd "#ld: --local-store 0:0 --generate-unused-section-symbols=yes"
} elseif { [istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
- puts $ofd "#ld: -z noseparate-code"
+ puts $ofd "#ld: -z noseparate-code --generate-unused-section-symbols=yes"
} else {
- puts $ofd "#ld:"
+ puts $ofd "#ld: --generate-unused-section-symbols=yes"
}
#force z80 target to compile for eZ80 in ADL mode
if { [istarget "z80-*-*"] } then {
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 0620721559..f35156052b 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -124,99 +124,112 @@ if { !([istarget "i?86-*-elf*"]
set i386tests {
{"Helper shared library (basic PLT test)"
- "-shared -melf_i386" "" "--32" {pltlib.s} {} "libpltlib.so"}
+ "-shared --generate-unused-section-symbols=no -melf_i386"
+ "" "--32" {pltlib.s} {} "libpltlib.so"}
{"basic PLT generation (non-PIC)"
- "-melf_i386 tmpdir/libpltlib.so" "" "--32" {plt.s}
+ "-melf_i386 --generate-unused-section-symbols=no tmpdir/libpltlib.so"
+ "" "--32" {plt.s}
{{objdump -drj.plt plt.pd}} "plt"}
{"basic PLT generation (PIC)"
- "-shared -melf_i386 tmpdir/libpltlib.so" "" "--32" {plt-pic.s}
+ "-shared -melf_i386 --generate-unused-section-symbols=no tmpdir/libpltlib.so"
+ "" "--32" {plt-pic.s}
{{objdump -drj.plt plt-pic.pd}} "libplt-pic.so"}
{"TLS -fpic -shared transitions"
"-shared -melf_i386 --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlspic1.s tlspic2.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlspic1.s tlspic2.s}
{{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd}
{objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
"libtlspic.so"}
{"TLS -fpic -shared transitions without PLT"
"-shared -melf_i386 --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "-mrelax-relocations=yes --32"
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "-mrelax-relocations=yes --32"
{tlspic3.s tlspic2.s}
{{readelf -Ssrl tlspic2.rd} {objdump -drj.text tlspic2.dd}
{objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
"libtlspic2.so"}
{"TLS descriptor -fpic -shared transitions"
"-shared -melf_i386 --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsdesc.s tlspic2.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlsdesc.s tlspic2.s}
{{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
{objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
"libtlsdesc.so"}
- {"Helper shared library" "-shared -melf_i386" ""
- "--32" {tlslib.s} {} "libtlslib.so"}
+ {"Helper shared library"
+ "-shared -melf_i386 --generate-unused-section-symbols=no"
+ "" "--32" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
"-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsbinpic.s tlsbin.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlsbinpic.s tlsbin.s}
{{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
{objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
"tlsbin"}
{"TLS -fpic and -fno-pic exec transitions without PLT"
"-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "-mrelax-relocations=yes --32"
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "-mrelax-relocations=yes --32"
{tlsbinpic2.s tlsbin.s}
{{readelf -Ssrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd}
{objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}}
"tlsbin2"}
{"TLS descriptor -fpic and -fno-pic exec transitions"
"-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsbindesc.s tlsbin.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlsbindesc.s tlsbin.s}
{{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
{objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
"tlsbindesc"}
{"TLS -fno-pic -shared"
"-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsnopic1.s tlsnopic2.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlsnopic1.s tlsnopic2.s}
{{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
{objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
{"TLS with global dynamic and descriptors"
"-shared -melf_i386 --no-ld-generated-unwind-info \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsgdesc.s}
+ --generate-unused-section-symbols=no -z noseparate-code --hash-style=sysv"
+ "" "--32" {tlsgdesc.s}
{{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
"libtlsgdesc.so"}
- {"TLS in debug sections" "-melf_i386" ""
- "--32" {tlsg.s}
+ {"TLS in debug sections"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "--32" {tlsg.s}
{{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
{"TLS @indntpoff with %eax" "-melf_i386" "" "--32" {tlsindntpoff.s}
{{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
{"Reloc section order"
"-shared -melf_i386 -z nocombreloc -z notext" "" "--32"
{reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
- {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "" "--32"
+ {"Basic --emit-relocs support"
+ "-shared -melf_i386 --emit-relocs --generate-unused-section-symbols=no"
+ "" "--32"
{emit-relocs.s} {{readelf --relocs emit-relocs.rd}} "emit-relocs.so"}
- {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc" ""
- "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
- {"TLS GD->LE transition" "-melf_i386" ""
- "--32" {tlsgd1.s}
+ {"-z combreloc relocation sections"
+ "-shared -melf_i386 -z combreloc --generate-unused-section-symbols=no"
+ "" "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
+ {"TLS GD->LE transition"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "--32" {tlsgd1.s}
{{objdump -dwr tlsgd1.dd}} "tlsgd1"}
- {"TLS GD->LE transition without PLT" "-melf_i386" ""
- "-mrelax-relocations=yes --32"
+ {"TLS GD->LE transition without PLT"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "-mrelax-relocations=yes --32"
{tlsgd3.s}
{{objdump -dwr tlsgd3.dd}} "tlsgd3"}
- {"TLS LD->LE transition" "-melf_i386" ""
- "--32" {tlsld1.s}
+ {"TLS LD->LE transition"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "--32" {tlsld1.s}
{{objdump -dwr tlsld1.dd}} "tlsld1"}
- {"TLS LD->LE transition without PLT" "-melf_i386" ""
- "-mrelax-relocations=yes --32"
+ {"TLS LD->LE transition without PLT"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "-mrelax-relocations=yes --32"
{tlsld2.s}
{{objdump -dwr tlsld2.dd}} "tlsld2"}
- {"TLS IE->LE transition" "-melf_i386" ""
- "--32" {tlsie1.s}
+ {"TLS IE->LE transition"
+ "-melf_i386 --generate-unused-section-symbols=no"
+ "" "--32" {tlsie1.s}
{{objdump -dwr tlsie1.dd}} "tlsie1"}
{"PR ld/17313 (1)" "-melf_i386" ""
"--32 -mx86-used-note=yes" {zero.s} {} ""}
@@ -1461,6 +1474,7 @@ run_ld_link_tests [list \
[list \
"basic PLT generation (non-PIC, -z now)" \
"-z now -melf_i386 --hash-style=sysv \
+ --generate-unused-section-symbols=no \
-z noseparate-code tmpdir/libpltlib.so" \
"" \
"--32" \
@@ -1470,7 +1484,8 @@ run_ld_link_tests [list \
] \
[list \
"basic PLT generation (PIC, -z now)" \
- "-z now -shared -melf_i386 tmpdir/libpltlib.so" \
+ "-z now -shared -melf_i386 tmpdir/libpltlib.so \
+ --generate-unused-section-symbols=no" \
"" \
"--32 -mx86-used-note=yes" \
{plt-pic.s} \
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d
index a7eaa1f77d..a03d41c9ba 100644
--- a/ld/testsuite/ld-i386/ibt-plt-1.d
+++ b/ld/testsuite/ld-i386/ibt-plt-1.d
@@ -1,5 +1,5 @@
#as: --32
-#ld: -shared -m elf_i386 --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -13,11 +13,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d
index 9c8f5996a7..bff52bac3a 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-i386/ibt-plt-2c.d b/ld/testsuite/ld-i386/ibt-plt-2c.d
index a9c8642ced..38adb2a4cf 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2c.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibt --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d
index b4366c9315..0d66883e31 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d
index b4366c9315..0d66883e31 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fb endbr32
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-i386/plt-pic.pd b/ld/testsuite/ld-i386/plt-pic.pd
index 5c047d4deb..a40cdcfbe6 100644
--- a/ld/testsuite/ld-i386/plt-pic.pd
+++ b/ld/testsuite/ld-i386/plt-pic.pd
@@ -1,6 +1,6 @@
#source: plt.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --generate-unused-section-symbols=no
#objdump: -drj.plt
#target: i?86-*-*
@@ -8,7 +8,7 @@
Disassembly of section .plt:
-[0-9a-f]+ <.plt>:
+[0-9a-f]+ <fn1@plt-0x10>:
+[0-9a-f]+: ff b3 04 00 00 00 push 0x4\(%ebx\)
+[0-9a-f]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
#...
@@ -16,9 +16,9 @@ Disassembly of section .plt:
[0-9a-f]+ <fn1@plt>:
+[0-9a-f]+: ff a3 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+\(%ebx\)
+[0-9a-f]+: 68 00 00 00 00 push \$0x0
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
[0-9a-f]+ <fn2@plt>:
+[0-9a-f]+: ff a3 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+\(%ebx\)
+[0-9a-f]+: 68 08 00 00 00 push \$0x8
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
diff --git a/ld/testsuite/ld-i386/plt-pic2.dd b/ld/testsuite/ld-i386/plt-pic2.dd
index 8162234aab..c9af97203a 100644
--- a/ld/testsuite/ld-i386/plt-pic2.dd
+++ b/ld/testsuite/ld-i386/plt-pic2.dd
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-.* <.plt>:
+.* <fn1@plt-0x10>:
+[a-f0-9]+: ff b3 04 00 00 00 push 0x4\(%ebx\)
+[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+[a-f0-9]+: 00 00 add %al,\(%eax\)
@@ -18,12 +18,12 @@ Disassembly of section .plt:
.* <fn1@plt>:
+[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp .* <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp .* <fn1@plt-0x10>
.* <fn2@plt>:
+[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d0 ff ff ff jmp .* <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp .* <fn1@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-i386/plt.pd b/ld/testsuite/ld-i386/plt.pd
index efcd8a1b1d..ae188994aa 100644
--- a/ld/testsuite/ld-i386/plt.pd
+++ b/ld/testsuite/ld-i386/plt.pd
@@ -1,6 +1,6 @@
#source: plt.s
#as: --32
-#ld: -melf_i386
+#ld: -melf_i386 --generate-unused-section-symbols=no
#objdump: -drj.plt
#target: i?86-*-*
@@ -8,7 +8,7 @@
Disassembly of section .plt:
-[0-9a-f]+ <.plt>:
+[0-9a-f]+ <fn1@plt-0x10>:
+[0-9a-f]+: ff 35 ([0-9a-f]{2} ){4} * push 0x[0-9a-f]+
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+
#...
@@ -16,9 +16,9 @@ Disassembly of section .plt:
[0-9a-f]+ <fn1@plt>:
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+
+[0-9a-f]+: 68 00 00 00 00 push \$0x0
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
[0-9a-f]+ <fn2@plt>:
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+
+[0-9a-f]+: 68 08 00 00 00 push \$0x8
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
diff --git a/ld/testsuite/ld-i386/plt2.dd b/ld/testsuite/ld-i386/plt2.dd
index c9d673f65a..6919d4542e 100644
--- a/ld/testsuite/ld-i386/plt2.dd
+++ b/ld/testsuite/ld-i386/plt2.dd
@@ -1,6 +1,6 @@
#source: plt2.s
#as: --32
-#ld: -z now -melf_i386
+#ld: -z now -melf_i386 --generate-unused-section-symbols=no
#objdump: -dwr
#target: i?86-*-*
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+8048160 <.plt>:
+0+8048160 <fn1@plt-0x10>:
+[a-f0-9]+: ff 35 40 92 04 08 push 0x8049240
+[a-f0-9]+: ff 25 44 92 04 08 jmp \*0x8049244
+[a-f0-9]+: 00 00 add %al,\(%eax\)
@@ -18,12 +18,12 @@ Disassembly of section .plt:
0+8048170 <fn1@plt>:
+[a-f0-9]+: ff 25 48 92 04 08 jmp \*0x8049248
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 8048160 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 8048160 <fn1@plt-0x10>
0+8048180 <fn2@plt>:
+[a-f0-9]+: ff 25 4c 92 04 08 jmp \*0x804924c
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d0 ff ff ff jmp 8048160 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 8048160 <fn1@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-i386/pr19636-1d.d b/ld/testsuite/ld-i386/pr19636-1d.d
index b7e6aba92c..167f124747 100644
--- a/ld/testsuite/ld-i386/pr19636-1d.d
+++ b/ld/testsuite/ld-i386/pr19636-1d.d
@@ -1,6 +1,6 @@
#source: pr19636-1.s
#as: --32 -mrelax-relocations=no
-#ld: -pie -m elf_i386 --no-dynamic-linker
+#ld: -pie -m elf_i386 --no-dynamic-linker --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -22,4 +22,4 @@ Disassembly of section .text:
.* <_start>:
[ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax
[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\)
-[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10>
+[ ]*[a-f0-9]+: e8 df ff ff ff call .* <_start-0x10>
diff --git a/ld/testsuite/ld-i386/pr19636-1l.d b/ld/testsuite/ld-i386/pr19636-1l.d
index 8f2a8e5127..fbcf578530 100644
--- a/ld/testsuite/ld-i386/pr19636-1l.d
+++ b/ld/testsuite/ld-i386/pr19636-1l.d
@@ -1,6 +1,6 @@
#source: pr19636-1.s
#as: --32 -mrelax-relocations=no
-#ld: -pie -m elf_i386 --no-dynamic-linker -z dynamic-undefined-weak
+#ld: -pie -m elf_i386 --no-dynamic-linker -z dynamic-undefined-weak --generate-unused-section-symbols=no
#objdump: -dw
#warning: -z dynamic-undefined-weak ignored
@@ -23,4 +23,4 @@ Disassembly of section .text:
.* <_start>:
[ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax
[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\)
-[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10>
+[ ]*[a-f0-9]+: e8 df ff ff ff call .* <_start-0x10>
diff --git a/ld/testsuite/ld-i386/pr19636-2c.d b/ld/testsuite/ld-i386/pr19636-2c.d
index 4b49c81755..78004e3c1b 100644
--- a/ld/testsuite/ld-i386/pr19636-2c.d
+++ b/ld/testsuite/ld-i386/pr19636-2c.d
@@ -1,6 +1,6 @@
#source: pr19636-2.s
#as: --32 -mrelax-relocations=no
-#ld: -pie -m elf_i386 -z notext
+#ld: -pie -m elf_i386 -z notext --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -22,6 +22,6 @@ Disassembly of section .text:
.* <_start>:
[ ]*[a-f0-9]+: 3b 80 fc ff ff ff cmp -0x4\(%eax\),%eax
[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\)
-[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10>
+[ ]*[a-f0-9]+: e8 df ff ff ff call .* <_start-0x10>
[ ]*[a-f0-9]+: 3d 00 00 00 00 cmp \$0x0,%eax
[ ]*[a-f0-9]+: e8 fc ff ff ff call .* <_start\+0x17>
diff --git a/ld/testsuite/ld-i386/tlsbin.rd b/ld/testsuite/ld-i386/tlsbin.rd
index ee272f631e..26aaf8dddd 100644
--- a/ld/testsuite/ld-i386/tlsbin.rd
+++ b/ld/testsuite/ld-i386/tlsbin.rd
@@ -84,19 +84,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +13 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbinpic.o
+[0-9]+: 00000020 +0 +TLS +LOCAL +DEFAULT +9 sl1
+[0-9]+: 00000024 +0 +TLS +LOCAL +DEFAULT +9 sl2
diff --git a/ld/testsuite/ld-i386/tlsbin2.rd b/ld/testsuite/ld-i386/tlsbin2.rd
index 5abf9ea665..6fc41662da 100644
--- a/ld/testsuite/ld-i386/tlsbin2.rd
+++ b/ld/testsuite/ld-i386/tlsbin2.rd
@@ -79,17 +79,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbinpic2.o
+[0-9]+: 00000020 +0 +TLS +LOCAL +DEFAULT +7 sl1
+[0-9]+: 00000024 +0 +TLS +LOCAL +DEFAULT +7 sl2
diff --git a/ld/testsuite/ld-i386/tlsbindesc.rd b/ld/testsuite/ld-i386/tlsbindesc.rd
index cd3c06e202..997411de47 100644
--- a/ld/testsuite/ld-i386/tlsbindesc.rd
+++ b/ld/testsuite/ld-i386/tlsbindesc.rd
@@ -77,17 +77,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbindesc.o
+[0-9]+: 00000020 +0 +TLS +LOCAL +DEFAULT +7 sl1
+[0-9]+: 00000024 +0 +TLS +LOCAL +DEFAULT +7 sl2
diff --git a/ld/testsuite/ld-i386/tlsdesc.rd b/ld/testsuite/ld-i386/tlsdesc.rd
index d47d2e94f2..5ebd1c24be 100644
--- a/ld/testsuite/ld-i386/tlsdesc.rd
+++ b/ld/testsuite/ld-i386/tlsdesc.rd
@@ -92,17 +92,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsdesc.o
+[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1
+[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2
diff --git a/ld/testsuite/ld-i386/tlsgdesc.rd b/ld/testsuite/ld-i386/tlsgdesc.rd
index ef131ef857..0744aeb78b 100644
--- a/ld/testsuite/ld-i386/tlsgdesc.rd
+++ b/ld/testsuite/ld-i386/tlsgdesc.rd
@@ -73,16 +73,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
+[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +8 _DYNAMIC
+[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
diff --git a/ld/testsuite/ld-i386/tlsnopic.rd b/ld/testsuite/ld-i386/tlsnopic.rd
index 4856c64f70..fea497392f 100644
--- a/ld/testsuite/ld-i386/tlsnopic.rd
+++ b/ld/testsuite/ld-i386/tlsnopic.rd
@@ -80,15 +80,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsnopic1.o
+[0-9]+: 0+00 +0 +TLS +LOCAL +DEFAULT +6 bl1
+[0-9]+: 0+04 +0 +TLS +LOCAL +DEFAULT +6 bl2
diff --git a/ld/testsuite/ld-i386/tlspic.rd b/ld/testsuite/ld-i386/tlspic.rd
index ae920583a4..2d93797786 100644
--- a/ld/testsuite/ld-i386/tlspic.rd
+++ b/ld/testsuite/ld-i386/tlspic.rd
@@ -96,18 +96,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlspic1.o
+[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +8 sl1
+[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +8 sl2
diff --git a/ld/testsuite/ld-i386/tlspic2.rd b/ld/testsuite/ld-i386/tlspic2.rd
index 59f1cdd187..c8a2efe65c 100644
--- a/ld/testsuite/ld-i386/tlspic2.rd
+++ b/ld/testsuite/ld-i386/tlspic2.rd
@@ -91,16 +91,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlspic3.o
+[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +6 sl1
+[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +6 sl2
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
index 2c917fa293..10beb59ff9 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
@@ -1,5 +1,5 @@
#source: ifunc-2-i386.s
-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=yes
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
index 01f6a78146..3ffaed3005 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
@@ -1,5 +1,5 @@
#source: ifunc-2-local-i386.s
-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
@@ -10,7 +10,7 @@
Disassembly of section .plt:
-0+e0 <.plt>:
+0+e0 <\*ABS\*@plt-0x10>:
+[a-f0-9]+: ff b3 04 00 00 00 push 0x4\(%ebx\)
+[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+[a-f0-9]+: 00 00 add %al,\(%eax\)
@@ -19,7 +19,7 @@ Disassembly of section .plt:
0+f0 <\*ABS\*@plt>:
+[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp e0 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp e0 <\*ABS\*@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
index 375cecd6f2..6d016d51be 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
@@ -1,6 +1,6 @@
#source: ifunc-2-local-x86-64.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+170 <.plt>:
+0+170 <\*ABS\*\+0x190@plt-0x10>:
+[a-f0-9]+: ff 35 42 01 20 00 push 0x200142\(%rip\) # 2002b8 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 44 01 20 00 jmp \*0x200144\(%rip\) # 2002c0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -17,7 +17,7 @@ Disassembly of section .plt:
0+180 <\*ABS\*\+0x190@plt>:
+[a-f0-9]+: ff 25 42 01 20 00 jmp \*0x200142\(%rip\) # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 170 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 170 <\*ABS\*\+0x190@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
index 9cd35181b8..1550a66f3c 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
@@ -1,6 +1,6 @@
#source: ifunc-2-x86-64.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+170 <.plt>:
+0+170 <\*ABS\*\+0x190@plt-0x10>:
+[a-f0-9]+: ff 35 42 01 20 00 push 0x200142\(%rip\) # 2002b8 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 44 01 20 00 jmp \*0x200144\(%rip\) # 2002c0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -17,7 +17,7 @@ Disassembly of section .plt:
0+180 <\*ABS\*\+0x190@plt>:
+[a-f0-9]+: ff 25 42 01 20 00 jmp \*0x200142\(%rip\) # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 170 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 170 <\*ABS\*\+0x190@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
index de12e9f543..4bf2921abd 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -1,5 +1,5 @@
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -z max-page-size=0x200000 -z noseparate-code
+#ld: -melf_x86_64 -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -9,11 +9,11 @@
Disassembly of section .text:
0+4000c8 <__start>:
- +[a-f0-9]+: ff 15 2a 00 20 00 call \*0x20002a\(%rip\) # 6000f8 <.got>
- +[a-f0-9]+: ff 25 24 00 20 00 jmp \*0x200024\(%rip\) # 6000f8 <.got>
- +[a-f0-9]+: 48 03 05 1d 00 20 00 add 0x20001d\(%rip\),%rax # 6000f8 <.got>
- +[a-f0-9]+: 48 8b 05 16 00 20 00 mov 0x200016\(%rip\),%rax # 6000f8 <.got>
- +[a-f0-9]+: 48 85 05 0f 00 20 00 test %rax,0x20000f\(%rip\) # 6000f8 <.got>
+ +[a-f0-9]+: ff 15 2a 00 20 00 call \*0x20002a\(%rip\) # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: ff 25 24 00 20 00 jmp \*0x200024\(%rip\) # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 03 05 1d 00 20 00 add 0x20001d\(%rip\),%rax # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 8b 05 16 00 20 00 mov 0x200016\(%rip\),%rax # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 85 05 0f 00 20 00 test %rax,0x20000f\(%rip\) # 6000f8 <bar\+0x200007>
+[a-f0-9]+: 48 c7 c0 f1 00 40 00 mov \$0x4000f1,%rax
0+4000f0 <foo>:
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
index de12e9f543..4bf2921abd 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -1,5 +1,5 @@
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -z max-page-size=0x200000 -z noseparate-code
+#ld: -melf_x86_64 -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -9,11 +9,11 @@
Disassembly of section .text:
0+4000c8 <__start>:
- +[a-f0-9]+: ff 15 2a 00 20 00 call \*0x20002a\(%rip\) # 6000f8 <.got>
- +[a-f0-9]+: ff 25 24 00 20 00 jmp \*0x200024\(%rip\) # 6000f8 <.got>
- +[a-f0-9]+: 48 03 05 1d 00 20 00 add 0x20001d\(%rip\),%rax # 6000f8 <.got>
- +[a-f0-9]+: 48 8b 05 16 00 20 00 mov 0x200016\(%rip\),%rax # 6000f8 <.got>
- +[a-f0-9]+: 48 85 05 0f 00 20 00 test %rax,0x20000f\(%rip\) # 6000f8 <.got>
+ +[a-f0-9]+: ff 15 2a 00 20 00 call \*0x20002a\(%rip\) # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: ff 25 24 00 20 00 jmp \*0x200024\(%rip\) # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 03 05 1d 00 20 00 add 0x20001d\(%rip\),%rax # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 8b 05 16 00 20 00 mov 0x200016\(%rip\),%rax # 6000f8 <bar\+0x200007>
+ +[a-f0-9]+: 48 85 05 0f 00 20 00 test %rax,0x20000f\(%rip\) # 6000f8 <bar\+0x200007>
+[a-f0-9]+: 48 c7 c0 f1 00 40 00 mov \$0x4000f1,%rax
0+4000f0 <foo>:
diff --git a/ld/testsuite/ld-ifunc/pr17154-i386-now.d b/ld/testsuite/ld-ifunc/pr17154-i386-now.d
index 082d067422..76e6713d09 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d
@@ -1,5 +1,5 @@
#source: pr17154-x86.s
-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
@@ -10,7 +10,7 @@
Disassembly of section .plt:
-0+180 <.plt>:
+0+180 <\*ABS\*@plt-0x10>:
+[a-f0-9]+: ff b3 04 00 00 00 push 0x4\(%ebx\)
+[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+[a-f0-9]+: 00 00 add %al,\(%eax\)
@@ -19,22 +19,22 @@ Disassembly of section .plt:
0+190 <\*ABS\*@plt>:
+[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[a-f0-9]+: 68 18 00 00 00 push \$0x18
- +[a-f0-9]+: e9 e0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1a0 <func1@plt>:
+[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 d0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1b0 <func2@plt>:
+[a-f0-9]+: ff a3 14 00 00 00 jmp \*0x14\(%ebx\)
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 c0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 c0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1c0 <\*ABS\*@plt>:
+[a-f0-9]+: ff a3 18 00 00 00 jmp \*0x18\(%ebx\)
+[a-f0-9]+: 68 10 00 00 00 push \$0x10
- +[a-f0-9]+: e9 b0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 b0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/pr17154-i386.d b/ld/testsuite/ld-ifunc/pr17154-i386.d
index 68123bf0ca..9f8bead0e7 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386.d
@@ -1,5 +1,5 @@
#source: pr17154-x86.s
-#ld: -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -m elf_i386 -shared --hash-style=sysv -z noseparate-code --generate-unused-section-symbols=no
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
@@ -15,22 +15,22 @@
0+190 <\*ABS\*@plt>:
[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
[ ]*[a-f0-9]+: 68 18 00 00 00 push \$0x18
-[ ]*[a-f0-9]+: e9 e0 ff ff ff jmp 180 <.plt>
+[ ]*[a-f0-9]+: e9 e0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1a0 <func1@plt>:
[ ]*[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: e9 d0 ff ff ff jmp 180 <.plt>
+[ ]*[a-f0-9]+: e9 d0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1b0 <func2@plt>:
[ ]*[a-f0-9]+: ff a3 14 00 00 00 jmp \*0x14\(%ebx\)
[ ]*[a-f0-9]+: 68 08 00 00 00 push \$0x8
-[ ]*[a-f0-9]+: e9 c0 ff ff ff jmp 180 <.plt>
+[ ]*[a-f0-9]+: e9 c0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
0+1c0 <\*ABS\*@plt>:
[ ]*[a-f0-9]+: ff a3 18 00 00 00 jmp \*0x18\(%ebx\)
[ ]*[a-f0-9]+: 68 10 00 00 00 push \$0x10
-[ ]*[a-f0-9]+: e9 b0 ff ff ff jmp 180 <.plt>
+[ ]*[a-f0-9]+: e9 b0 ff ff ff jmp 180 <\*ABS\*@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
index 928a6a78d7..739ae4de42 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
@@ -1,6 +1,6 @@
#source: pr17154-x86.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+240 <.plt>:
+0+240 <\*ABS\*\+0x29a@plt-0x10>:
+[a-f0-9]+: ff 35 7a 01 20 00 push 0x20017a\(%rip\) # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 7c 01 20 00 jmp \*0x20017c\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -17,22 +17,22 @@ Disassembly of section .plt:
0+250 <\*ABS\*\+0x29a@plt>:
+[a-f0-9]+: ff 25 7a 01 20 00 jmp \*0x20017a\(%rip\) # 2003d0 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
- +[a-f0-9]+: e9 e0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+260 <func1@plt>:
+[a-f0-9]+: ff 25 72 01 20 00 jmp \*0x200172\(%rip\) # 2003d8 <func1>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 d0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+270 <func2@plt>:
+[a-f0-9]+: ff 25 6a 01 20 00 jmp \*0x20016a\(%rip\) # 2003e0 <func2>
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 c0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 c0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+280 <\*ABS\*\+0x290@plt>:
+[a-f0-9]+: ff 25 62 01 20 00 jmp \*0x200162\(%rip\) # 2003e8 <_GLOBAL_OFFSET_TABLE_\+0x30>
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
- +[a-f0-9]+: e9 b0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 b0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
index 8a6861dcde..cfb5264198 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
@@ -1,6 +1,6 @@
#source: pr17154-x86.s
#as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#target: x86_64-*-*
@@ -13,22 +13,22 @@
0+250 <\*ABS\*\+0x29a@plt>:
+[a-f0-9]+: ff 25 5a 01 20 00 jmp \*0x20015a\(%rip\) # 2003b0 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
- +[a-f0-9]+: e9 e0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+260 <func1@plt>:
+[a-f0-9]+: ff 25 52 01 20 00 jmp \*0x200152\(%rip\) # 2003b8 <func1>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 d0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+270 <func2@plt>:
+[a-f0-9]+: ff 25 4a 01 20 00 jmp \*0x20014a\(%rip\) # 2003c0 <func2>
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 c0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 c0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
0+280 <\*ABS\*\+0x290@plt>:
+[a-f0-9]+: ff 25 42 01 20 00 jmp \*0x200142\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x30>
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
- +[a-f0-9]+: e9 b0 ff ff ff jmp 240 <.plt>
+ +[a-f0-9]+: e9 b0 ff ff ff jmp 240 <\*ABS\*\+0x29a@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
index 9640beac2d..8a5a27e3ab 100644
--- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s -mx86-used-note=no
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -8,7 +8,7 @@
Disassembly of section .plt:
-0+230 <.plt>:
+0+230 <foo2@plt-0x10>:
+[a-f0-9]+: ff 35 82 01 20 00 push 0x200182\(%rip\) # 2003b8 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 84 01 20 00 jmp \*0x200184\(%rip\) # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -16,22 +16,22 @@ Disassembly of section .plt:
0+240 <foo2@plt>:
+[a-f0-9]+: ff 25 82 01 20 00 jmp \*0x200182\(%rip\) # 2003c8 <foo2>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 230 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 230 <foo2@plt-0x10>
0+250 <foo3@plt>:
+[a-f0-9]+: ff 25 7a 01 20 00 jmp \*0x20017a\(%rip\) # 2003d0 <foo3>
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d0 ff ff ff jmp 230 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 230 <foo2@plt-0x10>
0+260 <foo1@plt>:
+[a-f0-9]+: ff 25 72 01 20 00 jmp \*0x200172\(%rip\) # 2003d8 <foo1>
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
- +[a-f0-9]+: e9 c0 ff ff ff jmp 230 <.plt>
+ +[a-f0-9]+: e9 c0 ff ff ff jmp 230 <foo2@plt-0x10>
0+270 <foo4@plt>:
+[a-f0-9]+: ff 25 6a 01 20 00 jmp \*0x20016a\(%rip\) # 2003e0 <foo4>
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
- +[a-f0-9]+: e9 b0 ff ff ff jmp 230 <.plt>
+ +[a-f0-9]+: e9 b0 ff ff ff jmp 230 <foo2@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
index 25af7f81d4..cffcd8ef1f 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
@@ -1,6 +1,6 @@
#source: bnd-ifunc-1.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -13,7 +13,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 4b 01 20 00 bnd jmp \*0x20014b\(%rip\) # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 170 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 170 <\*ABS\*\+0x198@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
index 634940d5b1..901da7f874 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
@@ -1,6 +1,6 @@
#source: bnd-ifunc-2.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -13,16 +13,16 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 9b 01 20 00 bnd jmp \*0x20019b\(%rip\) # 2003e8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 240 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 240 <.plt>
+ +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 240 <.plt>
+ +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
- +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 240 <.plt>
+ +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
index 7a0356cc69..784ad061e6 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
@@ -1,5 +1,5 @@
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#...
@@ -8,16 +8,16 @@
[ ]*[a-f0-9]+: f2 ff 25 7b 01 20 00 bnd jmp \*0x20017b\(%rip\)[ ]*(#.*)?
[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
[ ]*[a-f0-9]+: 68 03 00 00 00 push \$0x3
-[ ]*[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 240 <.plt>
+[ ]*[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 240 <.plt>
+[ ]*[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 01 00 00 00 push \$0x1
-[ ]*[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 240 <.plt>
+[ ]*[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 02 00 00 00 push \$0x2
-[ ]*[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 240 <.plt>
+[ ]*[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 240 <\*ABS\*\+0x2bc@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
index be5392c45f..6d369f08f8 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s
#as: --64 -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -13,16 +13,16 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 a3 01 20 00 bnd jmp \*0x2001a3\(%rip\) # 2003e0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 230 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 230 <.plt>
+ +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
- +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 230 <.plt>
+ +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
- +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 230 <.plt>
+ +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1.d b/ld/testsuite/ld-x86-64/bnd-plt-1.d
index cca370527a..0df8be5e7c 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s -mx86-used-note=no
#as: --64
-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -13,16 +13,16 @@ Disassembly of section .plt:
[ ]*[a-f0-9]+: f2 ff 25 83 01 20 00 bnd jmp \*0x200183\(%rip\)[ ]*(#.*)?
[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 230 <.plt>
+[ ]*[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 01 00 00 00 push \$0x1
-[ ]*[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 230 <.plt>
+[ ]*[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 02 00 00 00 push \$0x2
-[ ]*[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 230 <.plt>
+[ ]*[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 68 03 00 00 00 push \$0x3
-[ ]*[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 230 <.plt>
+[ ]*[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmp 230 <foo2@plt-0x50>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
index 2018b11936..5866c75334 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
@@ -1,6 +1,6 @@
#source: ibt-plt-1.s
#as: --x32
-#ld: -shared -m elf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.d b/ld/testsuite/ld-x86-64/ibt-plt-1.d
index d556ec13f6..2ad0e7ab4a 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d
@@ -1,6 +1,6 @@
#source: ibt-plt-1.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
index 5168a31c74..5732fe6497 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
index 01401ba141..cc8dab9528 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.*>
+[a-f0-9]+: 90 nop
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.*>
+[a-f0-9]+: 90 nop
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
index 9f9663cca3..bea900ffed 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c.d b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
index aa81fb9ddb..b03207dec9 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
index bf185d548f..8e3e7f90a7 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 140 <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
index 27dd93c8e5..a9a087c626 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.*>
+[a-f0-9]+: 90 nop
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.*>
+[a-f0-9]+: 90 nop
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
index 66f4705124..f5320b9297 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <bar1@plt-0x30>
+[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c.d b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
index 5c918b8b4d..6526d220ec 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -14,11 +14,11 @@ Disassembly of section .plt:
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.plt>
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
+[a-f0-9]+: 90 nop
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/mpx.exp b/ld/testsuite/ld-x86-64/mpx.exp
index 3a0f4b1469..eb69c36466 100644
--- a/ld/testsuite/ld-x86-64/mpx.exp
+++ b/ld/testsuite/ld-x86-64/mpx.exp
@@ -107,21 +107,25 @@ run_ld_link_tests {
"-m elf_x86_64 -shared -z bndplt" ""
"--64" {mpx3b.s} {} "libcall.so"}
{"Build mpx3"
- "-m elf_x86_64 -z bndplt tmpdir/libcall.so" ""
- "--64" {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"}
+ "-m elf_x86_64 -z bndplt --generate-unused-section-symbols=no \
+ tmpdir/libcall.so"
+ "" "--64" {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"}
{"Build libcall1.so"
"-m elf_x86_64 -shared -z bndplt" ""
"--64" {mpx4b.s} {} "libcall1.so"}
{"Build mpx4"
"-m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
+ --generate-unused-section-symbols=no \
-z max-page-size=0x200000 -z noseparate-code" ""
"--64 -mx86-used-note=no" {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"}
{"Build mpx3 (-z now)"
"-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall.so \
+ --generate-unused-section-symbols=no \
-z max-page-size=0x200000 -z noseparate-code" ""
"--64 -mx86-used-note=no" {mpx3a.s} {{objdump -dw mpx3n.dd}} "mpx3n"}
{"Build mpx4 (-z now)"
"-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
+ --generate-unused-section-symbols=no \
-z max-page-size=0x200000 -z noseparate-code" ""
"--64 -mx86-used-note=no" {mpx4a.s} {{objdump -dw mpx4n.dd}} "mpx4n"}
}
diff --git a/ld/testsuite/ld-x86-64/mpx3.dd b/ld/testsuite/ld-x86-64/mpx3.dd
index 96e56fc5e0..729b1cf4e9 100644
--- a/ld/testsuite/ld-x86-64/mpx3.dd
+++ b/ld/testsuite/ld-x86-64/mpx3.dd
@@ -8,7 +8,7 @@ Disassembly of section .plt:
[ ]*[a-f0-9]+: f2 ff ([0-9a-f]{2} ){5} bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: f2 e9 ([0-9a-f]{2} ){4} bnd jmp [a-f0-9]+ <.plt>
+[ ]*[a-f0-9]+: f2 e9 ([0-9a-f]{2} ){4} bnd jmp [a-f0-9]+ <call1@plt-0x20>
[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/mpx3n.dd b/ld/testsuite/ld-x86-64/mpx3n.dd
index f4609d5ed6..a1eba8e975 100644
--- a/ld/testsuite/ld-x86-64/mpx3n.dd
+++ b/ld/testsuite/ld-x86-64/mpx3n.dd
@@ -8,7 +8,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 a3 01 20 00 bnd jmp \*0x2001a3\(%rip\) # 6003d0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 400220 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 400220 <call1@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/mpx4.dd b/ld/testsuite/ld-x86-64/mpx4.dd
index 35f6869bad..50a0fbca50 100644
--- a/ld/testsuite/ld-x86-64/mpx4.dd
+++ b/ld/testsuite/ld-x86-64/mpx4.dd
@@ -8,7 +8,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 43 01 20 00 bnd jmp \*0x200143\(%rip\) # 600340 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 4001f0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 4001f0 <call1@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/mpx4n.dd b/ld/testsuite/ld-x86-64/mpx4n.dd
index 5585610767..92177bb121 100644
--- a/ld/testsuite/ld-x86-64/mpx4n.dd
+++ b/ld/testsuite/ld-x86-64/mpx4n.dd
@@ -8,7 +8,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 63 01 20 00 bnd jmp \*0x200163\(%rip\) # 600360 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 4001f0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 4001f0 <call1@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-1.od b/ld/testsuite/ld-x86-64/pe-x86-64-1.od
index 1ff644ee9c..4966d55fb5 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64-1.od
+++ b/ld/testsuite/ld-x86-64/pe-x86-64-1.od
@@ -2,11 +2,6 @@
.*: +file format .*
SYMBOL TABLE:
-0+401000 l d .text\$mn 0000000000000000 .text\$mn
-0+402000 l d .xdata 0000000000000000 .xdata
-0+402008 l d .pdata 0000000000000000 .pdata
-0+403014 l d .bss 0000000000000000 .bss
-0+ l d .debug\$S 0000000000000000 .debug\$S
0+401000 g .text\$mn 0000000000000000 getaddr1
0+401020 g .text\$mn 0000000000000000 begin
0+403014 g .bss 0000000000000000 __bss_start
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-2.od b/ld/testsuite/ld-x86-64/pe-x86-64-2.od
index 1ff644ee9c..4966d55fb5 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64-2.od
+++ b/ld/testsuite/ld-x86-64/pe-x86-64-2.od
@@ -2,11 +2,6 @@
.*: +file format .*
SYMBOL TABLE:
-0+401000 l d .text\$mn 0000000000000000 .text\$mn
-0+402000 l d .xdata 0000000000000000 .xdata
-0+402008 l d .pdata 0000000000000000 .pdata
-0+403014 l d .bss 0000000000000000 .bss
-0+ l d .debug\$S 0000000000000000 .debug\$S
0+401000 g .text\$mn 0000000000000000 getaddr1
0+401020 g .text\$mn 0000000000000000 begin
0+403014 g .bss 0000000000000000 __bss_start
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3.od b/ld/testsuite/ld-x86-64/pe-x86-64-3.od
index 1ff644ee9c..4966d55fb5 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64-3.od
+++ b/ld/testsuite/ld-x86-64/pe-x86-64-3.od
@@ -2,11 +2,6 @@
.*: +file format .*
SYMBOL TABLE:
-0+401000 l d .text\$mn 0000000000000000 .text\$mn
-0+402000 l d .xdata 0000000000000000 .xdata
-0+402008 l d .pdata 0000000000000000 .pdata
-0+403014 l d .bss 0000000000000000 .bss
-0+ l d .debug\$S 0000000000000000 .debug\$S
0+401000 g .text\$mn 0000000000000000 getaddr1
0+401020 g .text\$mn 0000000000000000 begin
0+403014 g .bss 0000000000000000 __bss_start
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-4.od b/ld/testsuite/ld-x86-64/pe-x86-64-4.od
index 302a345b2e..e0bde11d84 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64-4.od
+++ b/ld/testsuite/ld-x86-64/pe-x86-64-4.od
@@ -2,12 +2,6 @@
.*: +file format .*
SYMBOL TABLE:
-0+401000 l d .text\$mn 0000000000000000 .text\$mn
-0+402000 l d .xdata 0000000000000000 .xdata
-0+402008 l d .pdata 0000000000000000 .pdata
-0+403018 l d .data 0000000000000000 .data
-0+403038 l d .bss 0000000000000000 .bss
-0+ l d .debug\$S 0000000000000000 .debug\$S
0+403038 g .bss 0000000000000000 c
0+401000 g .text\$mn 0000000000000000 begin
0+403038 g .bss 0000000000000000 __bss_start
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64.exp b/ld/testsuite/ld-x86-64/pe-x86-64.exp
index 74d06e015b..ce409676d7 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64.exp
+++ b/ld/testsuite/ld-x86-64/pe-x86-64.exp
@@ -27,7 +27,7 @@ if {![istarget "x86_64-*-linux*"] } {
run_ld_link_tests [list \
[list \
"Build pe-x86-64-1" \
- "-m elf_x86_64 --entry=begin" \
+ "-m elf_x86_64 --entry=begin --generate-unused-section-symbols=no" \
"" \
"" \
{pe-x86-64-1a.obj.bz2 pe-x86-64-1b.obj.bz2 pe-x86-64-1c.obj.bz2} \
@@ -36,7 +36,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-2" \
- "-m elf_x86_64 --entry=begin" \
+ "-m elf_x86_64 --entry=begin --generate-unused-section-symbols=no" \
"" \
"" \
{pe-x86-64-2a.obj.bz2 pe-x86-64-2b.obj.bz2 pe-x86-64-2c.obj.bz2} \
@@ -45,7 +45,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-3" \
- "-m elf_x86_64 --entry=begin" \
+ "-m elf_x86_64 --entry=begin --generate-unused-section-symbols=no" \
"" \
"" \
{pe-x86-64-3a.obj.bz2 pe-x86-64-3b.obj.bz2 pe-x86-64-3c.obj.bz2 \
@@ -55,7 +55,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-4" \
- "-m elf_x86_64 --entry=begin" \
+ "-m elf_x86_64 --entry=begin --generate-unused-section-symbols=no" \
"" \
"" \
{pe-x86-64-4a.obj.bz2 pe-x86-64-4b.obj.bz2 pe-x86-64-4c.obj.bz2 \
diff --git a/ld/testsuite/ld-x86-64/plt.pd b/ld/testsuite/ld-x86-64/plt.pd
index 54a00dffc4..6b4024c5c9 100644
--- a/ld/testsuite/ld-x86-64/plt.pd
+++ b/ld/testsuite/ld-x86-64/plt.pd
@@ -8,7 +8,7 @@
Disassembly of section .plt:
-[0-9a-f]+ <.plt>:
+[0-9a-f]+ <fn1@plt-0x10>:
+[0-9a-f]+: ff 35 ([0-9a-f]{2} ){4} * push 0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
+[0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -16,9 +16,9 @@ Disassembly of section .plt:
[0-9a-f]+ <fn1@plt>:
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <fn1>
+[0-9a-f]+: 68 00 00 00 00 push \$0x0
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
[0-9a-f]+ <fn2@plt>:
+[0-9a-f]+: ff 25 ([0-9a-f]{2} ){4} * jmp \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <fn2>
+[0-9a-f]+: 68 01 00 00 00 push \$0x1
- +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <.plt>
+ +[0-9a-f]+: e9 ([0-9a-f]{2} ){4} * jmp [0-9a-f]+ <fn1@plt-0x10>
diff --git a/ld/testsuite/ld-x86-64/plt2.dd b/ld/testsuite/ld-x86-64/plt2.dd
index 663ec98192..454bc060dd 100644
--- a/ld/testsuite/ld-x86-64/plt2.dd
+++ b/ld/testsuite/ld-x86-64/plt2.dd
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+400220 <.plt>:
+0+400220 <fn1@plt-0x10>:
+[a-f0-9]+: ff 35 7a 01 20 00 push 0x20017a\(%rip\) # 6003a0 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 7c 01 20 00 jmp \*0x20017c\(%rip\) # 6003a8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
@@ -17,12 +17,12 @@ Disassembly of section .plt:
0+400230 <fn1@plt>:
+[a-f0-9]+: ff 25 7a 01 20 00 jmp \*0x20017a\(%rip\) # 6003b0 <fn1>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 400220 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp 400220 <fn1@plt-0x10>
0+400240 <fn2@plt>:
+[a-f0-9]+: ff 25 72 01 20 00 jmp \*0x200172\(%rip\) # 6003b8 <fn2>
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: e9 d0 ff ff ff jmp 400220 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp 400220 <fn1@plt-0x10>
Disassembly of section .text:
diff --git a/ld/testsuite/ld-x86-64/pr19609-4e.d b/ld/testsuite/ld-x86-64/pr19609-4e.d
index f2634947d6..880dfa2fa1 100644
--- a/ld/testsuite/ld-x86-64/pr19609-4e.d
+++ b/ld/testsuite/ld-x86-64/pr19609-4e.d
@@ -1,6 +1,6 @@
#source: pr19609-4.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,5 +9,5 @@
Disassembly of section .text:
0+70000000 <_start>:
-[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <.got>
-[ ]*[a-f0-9]+: 4c 8b 1d ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.got>
+[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_start\+0x1000>
+[ ]*[a-f0-9]+: 4c 8b 1d ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <_start\+0x1000>
diff --git a/ld/testsuite/ld-x86-64/pr19609-6a.d b/ld/testsuite/ld-x86-64/pr19609-6a.d
index b340287f48..bd30e9dfe2 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6a.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6a.d
@@ -1,6 +1,6 @@
#source: pr19609-6.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000
+#ld: -melf_x86_64 --defsym foobar=0x80000000 --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,5 +9,5 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
-[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <.got>
+[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_start\+0x1000>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-6b.d b/ld/testsuite/ld-x86-64/pr19609-6b.d
index 810023b2b9..7f1a4443cb 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6b.d
@@ -1,6 +1,6 @@
#source: pr19609-6.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax
+#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,5 +9,5 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
-[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <.got>
+[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_start\+0x1000>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-7b.d b/ld/testsuite/ld-x86-64/pr19609-7b.d
index 20b42e838d..bb64ac7aff 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7b.d
@@ -1,6 +1,6 @@
#source: pr19609-7.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax
+#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,5 +9,5 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
-[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} * call \*-?0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <.got>
+[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} * call \*-?0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_start\+0x1000>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-7d.d b/ld/testsuite/ld-x86-64/pr19609-7d.d
index 034a57b1e0..c3fe767be3 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7d.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7d.d
@@ -1,6 +1,6 @@
#source: pr19609-7.s
#as: --x32 -mrelax-relocations=yes
-#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax
+#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,5 +9,5 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
-[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} * call \*-?0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <.got>
+[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} * call \*-?0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_start\+0x1000>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr19636-2l.d b/ld/testsuite/ld-x86-64/pr19636-2l.d
index c9b256dd44..336bd21885 100644
--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
@@ -1,6 +1,6 @@
#source: pr19636-2.s
#as: --64 -mrelax-relocations=no
-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
#warning: -z dynamic-undefined-weak ignored
@@ -20,7 +20,7 @@ Disassembly of section .plt:
Disassembly of section .text:
0+140 <_start>:
- +[a-f0-9]+: 48 3b 05 f1 00 20 00 cmp 0x2000f1\(%rip\),%rax # 200238 <.got>
- +[a-f0-9]+: ff 25 f3 00 20 00 jmp \*0x2000f3\(%rip\) # 200240 <.got\+0x8>
- +[a-f0-9]+: e8 de ff ff ff call 130 <.plt\+0x10>
+ +[a-f0-9]+: 48 3b 05 f1 00 20 00 cmp 0x2000f1\(%rip\),%rax # 200238 <_DYNAMIC\+0xe0>
+ +[a-f0-9]+: ff 25 f3 00 20 00 jmp \*0x2000f3\(%rip\) # 200240 <_DYNAMIC\+0xe8>
+ +[a-f0-9]+: e8 de ff ff ff call 130 <_start-0x10>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr20253-1d.d b/ld/testsuite/ld-x86-64/pr20253-1d.d
index 28fbc998ea..897a02cd14 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1d.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1d.d
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --64
-#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -15,10 +15,10 @@ Disassembly of section .text:
+[a-f0-9]+: c3 ret *
0+1ca <_start>:
- +[a-f0-9]+: ff 15 28 01 20 00 call \*0x200128\(%rip\) # 2002f8 <.got>
- +[a-f0-9]+: ff 25 2a 01 20 00 jmp \*0x20012a\(%rip\) # 200300 <.got\+0x8>
- +[a-f0-9]+: 48 c7 05 1f 01 20 00 00 00 00 00 movq \$0x0,0x20011f\(%rip\) # 200300 <.got\+0x8>
- +[a-f0-9]+: 48 83 3d 0f 01 20 00 00 cmpq \$0x0,0x20010f\(%rip\) # 2002f8 <.got>
- +[a-f0-9]+: 48 3b 0d 08 01 20 00 cmp 0x200108\(%rip\),%rcx # 2002f8 <.got>
- +[a-f0-9]+: 48 3b 0d 09 01 20 00 cmp 0x200109\(%rip\),%rcx # 200300 <.got\+0x8>
+ +[a-f0-9]+: ff 15 28 01 20 00 call \*0x200128\(%rip\) # 2002f8 <_DYNAMIC\+0x100>
+ +[a-f0-9]+: ff 25 2a 01 20 00 jmp \*0x20012a\(%rip\) # 200300 <_DYNAMIC\+0x108>
+ +[a-f0-9]+: 48 c7 05 1f 01 20 00 00 00 00 00 movq \$0x0,0x20011f\(%rip\) # 200300 <_DYNAMIC\+0x108>
+ +[a-f0-9]+: 48 83 3d 0f 01 20 00 00 cmpq \$0x0,0x20010f\(%rip\) # 2002f8 <_DYNAMIC\+0x100>
+ +[a-f0-9]+: 48 3b 0d 08 01 20 00 cmp 0x200108\(%rip\),%rcx # 2002f8 <_DYNAMIC\+0x100>
+ +[a-f0-9]+: 48 3b 0d 09 01 20 00 cmp 0x200109\(%rip\),%rcx # 200300 <_DYNAMIC\+0x108>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr20253-1h.d b/ld/testsuite/ld-x86-64/pr20253-1h.d
index 132fa03afc..4bd11147c7 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1h.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1h.d
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --x32
-#ld: -melf32_x86_64 -z max-page-size=0x200000 -z noseparate-code
+#ld: -melf32_x86_64 -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -15,10 +15,10 @@ Disassembly of section .text:
+[a-f0-9]+: c3 ret *
0+40008e <_start>:
- +[a-f0-9]+: ff 15 2c 00 20 00 call \*0x20002c\(%rip\) # 6000c0 <.got>
- +[a-f0-9]+: ff 25 2e 00 20 00 jmp \*0x20002e\(%rip\) # 6000c8 <.got\+0x8>
- +[a-f0-9]+: 48 c7 05 23 00 20 00 00 00 00 00 movq \$0x0,0x200023\(%rip\) # 6000c8 <.got\+0x8>
- +[a-f0-9]+: 48 83 3d 13 00 20 00 00 cmpq \$0x0,0x200013\(%rip\) # 6000c0 <.got>
- +[a-f0-9]+: 48 3b 0d 0c 00 20 00 cmp 0x20000c\(%rip\),%rcx # 6000c0 <.got>
- +[a-f0-9]+: 48 3b 0d 0d 00 20 00 cmp 0x20000d\(%rip\),%rcx # 6000c8 <.got\+0x8>
+ +[a-f0-9]+: ff 15 2c 00 20 00 call \*0x20002c\(%rip\) # 6000c0 <_start\+0x200032>
+ +[a-f0-9]+: ff 25 2e 00 20 00 jmp \*0x20002e\(%rip\) # 6000c8 <_start\+0x20003a>
+ +[a-f0-9]+: 48 c7 05 23 00 20 00 00 00 00 00 movq \$0x0,0x200023\(%rip\) # 6000c8 <_start\+0x20003a>
+ +[a-f0-9]+: 48 83 3d 13 00 20 00 00 cmpq \$0x0,0x200013\(%rip\) # 6000c0 <_start\+0x200032>
+ +[a-f0-9]+: 48 3b 0d 0c 00 20 00 cmp 0x20000c\(%rip\),%rcx # 6000c0 <_start\+0x200032>
+ +[a-f0-9]+: 48 3b 0d 0d 00 20 00 cmp 0x20000d\(%rip\),%rcx # 6000c8 <_start\+0x20003a>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr21038b-now.d b/ld/testsuite/ld-x86-64/pr21038b-now.d
index 62e80dc06b..42b477d45a 100644
--- a/ld/testsuite/ld-x86-64/pr21038b-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038b-now.d
@@ -1,7 +1,7 @@
#name: PR ld/21038 (.plt.sec, -z now)
#source: pr21038b.s
#as: --64
-#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw -Wf
.*: +file format .*
@@ -54,7 +54,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 33 0e 20 00 bnd jmp \*0x200e33\(%rip\) # 200ff0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1b0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1b0 <func@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/pr21038b.d b/ld/testsuite/ld-x86-64/pr21038b.d
index 126c1d2efe..1af6e71255 100644
--- a/ld/testsuite/ld-x86-64/pr21038b.d
+++ b/ld/testsuite/ld-x86-64/pr21038b.d
@@ -1,6 +1,6 @@
#name: PR ld/21038 (.plt.sec)
#as: --64
-#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw -Wf
.*: +file format .*
@@ -53,7 +53,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 53 0e 20 00 bnd jmp \*0x200e53\(%rip\) # 201010 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1b0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1b0 <func@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.sec:
diff --git a/ld/testsuite/ld-x86-64/pr21038c-now.d b/ld/testsuite/ld-x86-64/pr21038c-now.d
index 19a4ea8fcb..1d9bb3aafb 100644
--- a/ld/testsuite/ld-x86-64/pr21038c-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038c-now.d
@@ -1,7 +1,7 @@
#name: PR ld/21038 (.plt.got and .plt.sec, -z now)
#source: pr21038c.s
#as: --64
-#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw -Wf
.*: +file format .*
@@ -63,7 +63,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 eb 0d 20 00 bnd jmp \*0x200deb\(%rip\) # 200fe8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1f0 <func1@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.got:
diff --git a/ld/testsuite/ld-x86-64/pr21038c.d b/ld/testsuite/ld-x86-64/pr21038c.d
index 35e7d83c4e..0e55c281e7 100644
--- a/ld/testsuite/ld-x86-64/pr21038c.d
+++ b/ld/testsuite/ld-x86-64/pr21038c.d
@@ -1,6 +1,6 @@
#name: PR ld/21038 (.plt.got and .plt.sec)
#as: --64
-#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code --generate-unused-section-symbols=no
#objdump: -dw -Wf
.*: +file format .*
@@ -62,7 +62,7 @@ Disassembly of section .plt:
+[a-f0-9]+: f2 ff 25 13 0e 20 00 bnd jmp \*0x200e13\(%rip\) # 201010 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1f0 <.plt>
+ +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1f0 <func1@plt-0x20>
+[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
Disassembly of section .plt.got:
diff --git a/ld/testsuite/ld-x86-64/pr23854.d b/ld/testsuite/ld-x86-64/pr23854.d
index 95770d3cef..fe2f5fc283 100644
--- a/ld/testsuite/ld-x86-64/pr23854.d
+++ b/ld/testsuite/ld-x86-64/pr23854.d
@@ -1,5 +1,5 @@
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64
+#ld: -melf_x86_64 --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -7,22 +7,22 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
- +[a-f0-9]+: 66 13 05 ([0-9a-f]{2} ){4} * adc 0x[a-f0-9]+\(%rip\),%ax # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 03 1d ([0-9a-f]{2} ){4} * add 0x[a-f0-9]+\(%rip\),%bx # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 23 0d ([0-9a-f]{2} ){4} * and 0x[a-f0-9]+\(%rip\),%cx # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 3b 15 ([0-9a-f]{2} ){4} * cmp 0x[a-f0-9]+\(%rip\),%dx # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 0b 3d ([0-9a-f]{2} ){4} * or 0x[a-f0-9]+\(%rip\),%di # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 1b 35 ([0-9a-f]{2} ){4} * sbb 0x[a-f0-9]+\(%rip\),%si # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 2b 2d ([0-9a-f]{2} ){4} * sub 0x[a-f0-9]+\(%rip\),%bp # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 44 33 05 ([0-9a-f]{2} ){4} * xor 0x[a-f0-9]+\(%rip\),%r8w # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 85 0d ([0-9a-f]{2} ){4} * test %cx,0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <.got>
- +[a-f0-9]+: 66 13 05 ([0-9a-f]{2} ){4} * adc 0x[a-f0-9]+\(%rip\),%ax # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 03 1d ([0-9a-f]{2} ){4} * add 0x[a-f0-9]+\(%rip\),%bx # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 23 0d ([0-9a-f]{2} ){4} * and 0x[a-f0-9]+\(%rip\),%cx # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 3b 15 ([0-9a-f]{2} ){4} * cmp 0x[a-f0-9]+\(%rip\),%dx # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 0b 3d ([0-9a-f]{2} ){4} * or 0x[a-f0-9]+\(%rip\),%di # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 1b 35 ([0-9a-f]{2} ){4} * sbb 0x[a-f0-9]+\(%rip\),%si # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 2b 2d ([0-9a-f]{2} ){4} * sub 0x[a-f0-9]+\(%rip\),%bp # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 44 33 05 ([0-9a-f]{2} ){4} * xor 0x[a-f0-9]+\(%rip\),%r8w # [a-f0-9]+ <.got\+0x8>
- +[a-f0-9]+: 66 85 0d ([0-9a-f]{2} ){4} * test %cx,0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <.got\+0x8>
+ +[a-f0-9]+: 66 13 05 ([0-9a-f]{2} ){4} * adc 0x[a-f0-9]+\(%rip\),%ax # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 03 1d ([0-9a-f]{2} ){4} * add 0x[a-f0-9]+\(%rip\),%bx # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 23 0d ([0-9a-f]{2} ){4} * and 0x[a-f0-9]+\(%rip\),%cx # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 3b 15 ([0-9a-f]{2} ){4} * cmp 0x[a-f0-9]+\(%rip\),%dx # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 0b 3d ([0-9a-f]{2} ){4} * or 0x[a-f0-9]+\(%rip\),%di # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 1b 35 ([0-9a-f]{2} ){4} * sbb 0x[a-f0-9]+\(%rip\),%si # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 2b 2d ([0-9a-f]{2} ){4} * sub 0x[a-f0-9]+\(%rip\),%bp # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 44 33 05 ([0-9a-f]{2} ){4} * xor 0x[a-f0-9]+\(%rip\),%r8w # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 85 0d ([0-9a-f]{2} ){4} * test %cx,0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_start\+0x1000>
+ +[a-f0-9]+: 66 13 05 ([0-9a-f]{2} ){4} * adc 0x[a-f0-9]+\(%rip\),%ax # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 03 1d ([0-9a-f]{2} ){4} * add 0x[a-f0-9]+\(%rip\),%bx # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 23 0d ([0-9a-f]{2} ){4} * and 0x[a-f0-9]+\(%rip\),%cx # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 3b 15 ([0-9a-f]{2} ){4} * cmp 0x[a-f0-9]+\(%rip\),%dx # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 0b 3d ([0-9a-f]{2} ){4} * or 0x[a-f0-9]+\(%rip\),%di # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 1b 35 ([0-9a-f]{2} ){4} * sbb 0x[a-f0-9]+\(%rip\),%si # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 2b 2d ([0-9a-f]{2} ){4} * sub 0x[a-f0-9]+\(%rip\),%bp # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 44 33 05 ([0-9a-f]{2} ){4} * xor 0x[a-f0-9]+\(%rip\),%r8w # [a-f0-9]+ <_start\+0x1008>
+ +[a-f0-9]+: 66 85 0d ([0-9a-f]{2} ){4} * test %cx,0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_start\+0x1008>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-3.d b/ld/testsuite/ld-x86-64/pr25416-3.d
index 9c1da13484..28a3920f17 100644
--- a/ld/testsuite/ld-x86-64/pr25416-3.d
+++ b/ld/testsuite/ld-x86-64/pr25416-3.d
@@ -1,6 +1,6 @@
#name: X32 GDesc -> IE 1
#as: --x32
-#ld: -melf32_x86_64 -shared
+#ld: -melf32_x86_64 -shared --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,8 +9,8 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
- +[a-f0-9]+: 40 8b 05 ([0-9a-f]{2} ){4}[ \t]+rex mov 0x[a-f0-9]+\(%rip\),%eax[ \t]+# [a-f0-9]+ <.got>
+ +[a-f0-9]+: 40 8b 05 ([0-9a-f]{2} ){4}[ \t]+rex mov 0x[a-f0-9]+\(%rip\),%eax[ \t]+# [a-f0-9]+ <_DYNAMIC\+0x84>
+[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+[a-f0-9]+: 64 8b 0c 25 00 00 00 00 mov %fs:0x0,%ecx
- +[a-f0-9]+: 40 03 0d ([0-9a-f]{2} ){4}[ \t]+rex add 0x[a-f0-9]+\(%rip\),%ecx[ \t]+# [a-f0-9]+ <.got>
+ +[a-f0-9]+: 40 03 0d ([0-9a-f]{2} ){4}[ \t]+rex add 0x[a-f0-9]+\(%rip\),%ecx[ \t]+# [a-f0-9]+ <_DYNAMIC\+0x84>
#pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-4.d b/ld/testsuite/ld-x86-64/pr25416-4.d
index 8d91fbc0a6..f1a8a893b9 100644
--- a/ld/testsuite/ld-x86-64/pr25416-4.d
+++ b/ld/testsuite/ld-x86-64/pr25416-4.d
@@ -1,6 +1,6 @@
#name: X32 GDesc -> IE 2
#as: --x32
-#ld: -melf32_x86_64 -shared
+#ld: -melf32_x86_64 -shared --generate-unused-section-symbols=no
#objdump: -dw
.*: +file format .*
@@ -9,8 +9,8 @@
Disassembly of section .text:
[a-f0-9]+ <_start>:
- +[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4}[ \t]+mov 0x[a-f0-9]+\(%rip\),%rax[ \t]+# [a-f0-9]+ <.got>
+ +[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4}[ \t]+mov 0x[a-f0-9]+\(%rip\),%rax[ \t]+# [a-f0-9]+ <_DYNAMIC\+0x84>
+[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: 64 8b 0c 25 00 00 00 00 mov %fs:0x0,%ecx
- +[a-f0-9]+: 40 03 0d ([0-9a-f]{2} ){4}[ \t]+rex add 0x[a-f0-9]+\(%rip\),%ecx[ \t]+# [a-f0-9]+ <.got>
+ +[a-f0-9]+: 40 03 0d ([0-9a-f]{2} ){4}[ \t]+rex add 0x[a-f0-9]+\(%rip\),%ecx[ \t]+# [a-f0-9]+ <_DYNAMIC\+0x84>
#pass
diff --git a/ld/testsuite/ld-x86-64/tlsbin.rd b/ld/testsuite/ld-x86-64/tlsbin.rd
index 02b05d98a0..9cc6286733 100644
--- a/ld/testsuite/ld-x86-64/tlsbin.rd
+++ b/ld/testsuite/ld-x86-64/tlsbin.rd
@@ -75,19 +75,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
-.* SECTION +LOCAL +DEFAULT +1 *
-.* SECTION +LOCAL +DEFAULT +2 *
-.* SECTION +LOCAL +DEFAULT +3 *
-.* SECTION +LOCAL +DEFAULT +4 *
-.* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
-.* SECTION +LOCAL +DEFAULT +8 *
-.* SECTION +LOCAL +DEFAULT +9 *
-.* SECTION +LOCAL +DEFAULT +10 *
-.* SECTION +LOCAL +DEFAULT +11 *
-.* SECTION +LOCAL +DEFAULT +12 *
-.* SECTION +LOCAL +DEFAULT +13 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbinpic.o
.* TLS +LOCAL +DEFAULT +9 sl1
.* TLS +LOCAL +DEFAULT +9 sl2
diff --git a/ld/testsuite/ld-x86-64/tlsbin2.rd b/ld/testsuite/ld-x86-64/tlsbin2.rd
index 26cce6aa7f..dedbcc8959 100644
--- a/ld/testsuite/ld-x86-64/tlsbin2.rd
+++ b/ld/testsuite/ld-x86-64/tlsbin2.rd
@@ -70,17 +70,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
-.* SECTION +LOCAL +DEFAULT +1 *
-.* SECTION +LOCAL +DEFAULT +2 *
-.* SECTION +LOCAL +DEFAULT +3 *
-.* SECTION +LOCAL +DEFAULT +4 *
-.* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
-.* SECTION +LOCAL +DEFAULT +8 *
-.* SECTION +LOCAL +DEFAULT +9 *
-.* SECTION +LOCAL +DEFAULT +10 *
-.* SECTION +LOCAL +DEFAULT +11 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbinpic2.o
.* TLS +LOCAL +DEFAULT +7 sl1
.* TLS +LOCAL +DEFAULT +7 sl2
diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.rd b/ld/testsuite/ld-x86-64/tlsbindesc.rd
index 13978b7b67..b7170ee83b 100644
--- a/ld/testsuite/ld-x86-64/tlsbindesc.rd
+++ b/ld/testsuite/ld-x86-64/tlsbindesc.rd
@@ -68,17 +68,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsbindesc.o
+[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1
+[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2
diff --git a/ld/testsuite/ld-x86-64/tlsdesc.rd b/ld/testsuite/ld-x86-64/tlsdesc.rd
index 4fcd8826ae..a044dd4ad3 100644
--- a/ld/testsuite/ld-x86-64/tlsdesc.rd
+++ b/ld/testsuite/ld-x86-64/tlsdesc.rd
@@ -100,18 +100,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlsdesc.o
+[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +8 sl1
+[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +8 sl2
diff --git a/ld/testsuite/ld-x86-64/tlsgdesc.rd b/ld/testsuite/ld-x86-64/tlsgdesc.rd
index 77e8ae3d81..ca8f19bf3f 100644
--- a/ld/testsuite/ld-x86-64/tlsgdesc.rd
+++ b/ld/testsuite/ld-x86-64/tlsgdesc.rd
@@ -73,16 +73,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
- +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
+[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +8 _DYNAMIC
+[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
diff --git a/ld/testsuite/ld-x86-64/tlspic.rd b/ld/testsuite/ld-x86-64/tlspic.rd
index b3547eb945..9cd966203f 100644
--- a/ld/testsuite/ld-x86-64/tlspic.rd
+++ b/ld/testsuite/ld-x86-64/tlspic.rd
@@ -84,18 +84,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
-.* SECTION +LOCAL +DEFAULT +1 *
-.* SECTION +LOCAL +DEFAULT +2 *
-.* SECTION +LOCAL +DEFAULT +3 *
-.* SECTION +LOCAL +DEFAULT +4 *
-.* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
-.* SECTION +LOCAL +DEFAULT +8 *
-.* SECTION +LOCAL +DEFAULT +9 *
-.* SECTION +LOCAL +DEFAULT +10 *
-.* SECTION +LOCAL +DEFAULT +11 *
-.* SECTION +LOCAL +DEFAULT +12 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlspic1.o
.* TLS +LOCAL +DEFAULT +8 sl1
.* TLS +LOCAL +DEFAULT +8 sl2
diff --git a/ld/testsuite/ld-x86-64/tlspic2.rd b/ld/testsuite/ld-x86-64/tlspic2.rd
index e02c33a6ae..ee4a3d416c 100644
--- a/ld/testsuite/ld-x86-64/tlspic2.rd
+++ b/ld/testsuite/ld-x86-64/tlspic2.rd
@@ -81,18 +81,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
-.* SECTION +LOCAL +DEFAULT +1 *
-.* SECTION +LOCAL +DEFAULT +2 *
-.* SECTION +LOCAL +DEFAULT +3 *
-.* SECTION +LOCAL +DEFAULT +4 *
-.* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
-.* SECTION +LOCAL +DEFAULT +8 *
-.* SECTION +LOCAL +DEFAULT +9 *
-.* SECTION +LOCAL +DEFAULT +10 *
-.* SECTION +LOCAL +DEFAULT +11 *
-.* SECTION +LOCAL +DEFAULT +12 *
.* FILE +LOCAL +DEFAULT +ABS tmpdir/tlspic3.o
.* TLS +LOCAL +DEFAULT +8 sl1
.* TLS +LOCAL +DEFAULT +8 sl2
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index a548a325a3..eb1431d31a 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -43,10 +43,12 @@ set x86_64tests {
{"Helper shared library (basic PLT test)"
"-shared -melf_x86_64" "" "--64" {pltlib.s} {} "libpltlib.so"}
{"basic PLT generation"
- "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
+ "-melf_x86_64 tmpdir/libpltlib.so --generate-unused-section-symbols=no"
+ "" "--64" {plt.s}
{{objdump -drj.plt plt.pd}} "plt"}
{"TLS -fpic -shared transitions"
"-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64" {tlspic1.s tlspic2.s}
{{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd}
@@ -54,6 +56,7 @@ set x86_64tests {
"libtlspic.so"}
{"TLS -fpic -shared transitions with r15 as GOT base"
"-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64 -mrelax-relocations=yes"
{tlspic3.s tlspic2.s}
@@ -62,6 +65,7 @@ set x86_64tests {
"libtlspic2.so"}
{"TLS descriptor -fpic -shared transitions"
"-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64" {tlsdesc.s tlspic2.s}
{{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
@@ -71,6 +75,7 @@ set x86_64tests {
"--64" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
"-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64" {tlsbinpic.s tlsbin.s}
{{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
@@ -78,6 +83,7 @@ set x86_64tests {
"tlsbin"}
{"TLS -fpic and -fno-pic exec transitions without PLT"
"-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"-mrelax-relocations=yes --64" {tlsbinpic2.s tlsbin.s}
{{readelf -WSsrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd}
@@ -85,6 +91,7 @@ set x86_64tests {
"tlsbin2"}
{"TLS descriptor -fpic and -fno-pic exec transitions"
"-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64" {tlsbindesc.s tlsbin.s}
{{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
@@ -92,6 +99,7 @@ set x86_64tests {
"tlsbindesc"}
{"TLS with global dynamic and descriptors"
"-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
"--64" {tlsgdesc.s}
{{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text\ -Mintel64 tlsgdesc.dd}}
@@ -2104,6 +2112,7 @@ run_ld_link_tests [list \
[list \
"basic PLT generation (-z now)" \
"-z now -melf_x86_64 --hash-style=sysv tmpdir/libpltlib.so \
+ --generate-unused-section-symbols=no \
-z noseparate-code -z max-page-size=0x200000" \
"" \
"--64" \
--
2.29.2
More information about the Binutils
mailing list