public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add --generate-unused-section-symbols=[yes|no]
@ 2020-12-28  3:25 H.J. Lu
  2021-01-03 23:33 ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2020-12-28  3:25 UTC (permalink / raw)
  To: binutils

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add --generate-unused-section-symbols=[yes|no]
  2020-12-28  3:25 [PATCH] Add --generate-unused-section-symbols=[yes|no] H.J. Lu
@ 2021-01-03 23:33 ` Alan Modra
  2021-01-04  0:51   ` H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2021-01-03 23:33 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

On Sun, Dec 27, 2020 at 07:25:12PM -0800, H.J. Lu via Binutils wrote:
> 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.

Hi HJ,
I'm inclined to think that removing unused section symbols is a good
idea, but that --generate-unused-section-symbols and certainly the
configure option --enable-generate-section-symbols is undesirable.
I'd rather not see more configure options that change binutils default
behaviour, making binutils bug reports more difficult to reproduce.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add --generate-unused-section-symbols=[yes|no]
  2021-01-03 23:33 ` Alan Modra
@ 2021-01-04  0:51   ` H.J. Lu
  2021-01-04 18:43     ` [PATCH] ELF: Don't generate unused section symbols H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2021-01-04  0:51 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils

On Sun, Jan 3, 2021 at 3:33 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Sun, Dec 27, 2020 at 07:25:12PM -0800, H.J. Lu via Binutils wrote:
> > 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.
>
> Hi HJ,
> I'm inclined to think that removing unused section symbols is a good
> idea, but that --generate-unused-section-symbols and certainly the
> configure option --enable-generate-section-symbols is undesirable.
> I'd rather not see more configure options that change binutils default
> behaviour, making binutils bug reports more difficult to reproduce.
>

Removing unused section symbols means updating many binutils tests
as well as many assembler backends.  I can submit a patch to remove
unused section symbols and fix all tests on x86.  But I can't cover other
backends.

-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] ELF: Don't generate unused section symbols
  2021-01-04  0:51   ` H.J. Lu
@ 2021-01-04 18:43     ` H.J. Lu
  2021-01-05  1:23       ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2021-01-04 18:43 UTC (permalink / raw)
  To: Alan Modra, Nick Clifton; +Cc: Binutils

[-- Attachment #1: Type: text/plain, Size: 1980 bytes --]

On Sun, Jan 3, 2021 at 4:51 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sun, Jan 3, 2021 at 3:33 PM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Sun, Dec 27, 2020 at 07:25:12PM -0800, H.J. Lu via Binutils wrote:
> > > 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.
> >
> > Hi HJ,
> > I'm inclined to think that removing unused section symbols is a good
> > idea, but that --generate-unused-section-symbols and certainly the
> > configure option --enable-generate-section-symbols is undesirable.
> > I'd rather not see more configure options that change binutils default
> > behaviour, making binutils bug reports more difficult to reproduce.
> >
>
> Removing unused section symbols means updating many binutils tests
> as well as many assembler backends.  I can submit a patch to remove
> unused section symbols and fix all tests on x86.  But I can't cover other
> backends.

Here is the patch.

Tested on Linux/x86.  Other ELF backends need:

1. Mark used section symbols in assembler backend.
2. Remove unused section symbols from expected assembler and linker
outputs.

-- 
H.J.

[-- Attachment #2: 0001-ELF-Don-t-generate-unused-section-symbols.patch --]
[-- Type: text/x-patch, Size: 127325 bytes --]

From aaa773d79bbef5310f8fbb9ead003dd4b874eabc Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 26 Dec 2020 10:02:14 -0800
Subject: [PATCH] ELF: Don't generate unused section symbols

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 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.

Tested on Linux/x86.  Other ELF backends need:

1. Mark used section symbols in assembler backend.
2. Remove unused section symbols from expected assembler and linker
outputs.

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 emitting relocations
	* syms.c (BSF_SECTION_SYM_USED): New.
	* bfd-in2.h: Regenerated.

binutils/ChangeLog:

	PR 27109
	* objcopy.c (copy_object): Handle section symbols for
	non-relocatable inputs.
	* 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
	* read.c (s_reloc): Call symbol_mark_used_in_reloc on the
	section symbol.
	* subsegs.c (subseg_set_rest): Set BSF_SECTION_SYM_USED if needed.
	* write.c (adjust_reloc_syms): Call symbol_mark_used_in_reloc
	on the section symbol.
	(set_symtab): Don't generate unused section symbols.
	(maybe_generate_build_notes): Call symbol_mark_used_in_reloc
	on the section symbol.
	* config/obj-elf.c (elf_adjust_symtab): Call
	symbol_mark_used_in_reloc on the group signature symbol.
	* testsuite/gas/cfi/cfi-label.d: Remove unused section symbols
	from expected output.
	* testsuite/gas/elf/section2.s: Add a local symbol.
	* testsuite/gas/elf/section2.e: Updated.
	* testsuite/gas/elf/section2.l: Likewise.
	* 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: Likewise.
	* 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.

ld/ChangeLog:

	PR 27109
	* testsuite/ld-elf/export-class.sd: Adjust the expected output.
	* testsuite/ld-elf/loadaddr3b.d: Likewise.
	* testsuite/ld-elf/sec64k.exp: Likewise.
	* testsuite/ld-i386/ibt-plt-1.d: Likewise.
	* 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: Likewise.
	* 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.
---
 bfd/bfd-in2.h                                 |  3 +
 bfd/elf.c                                     | 15 ++++-
 bfd/elfcode.h                                 |  8 ++-
 bfd/elflink.c                                 | 61 +++++++++----------
 bfd/syms.c                                    |  3 +
 binutils/objcopy.c                            | 11 ++++
 binutils/testsuite/binutils-all/readelf.s-64  |  2 +-
 binutils/testsuite/binutils-all/readelf.ss    |  5 +-
 binutils/testsuite/binutils-all/readelf.ss-64 |  5 +-
 .../testsuite/binutils-all/readelf.ss-mips    | 25 +++-----
 .../testsuite/binutils-all/readelf.ss-tmips   | 25 +++-----
 gas/config/obj-elf.c                          |  3 +
 gas/read.c                                    |  3 +
 gas/testsuite/gas/cfi/cfi-label.d             |  4 +-
 gas/testsuite/gas/elf/section2.e              |  7 +--
 gas/testsuite/gas/elf/section2.l              |  3 +-
 gas/testsuite/gas/elf/section2.s              |  1 +
 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  | 24 ++++----
 gas/testsuite/gas/i386/ilp32/x86-64-size-3.d  | 16 ++---
 gas/testsuite/gas/i386/ilp32/x86-64-size-5.d  | 12 ++--
 gas/testsuite/gas/i386/ilp32/x86-64-unwind.d  |  6 +-
 gas/testsuite/gas/i386/size-1.d               | 24 ++++----
 gas/testsuite/gas/i386/size-3.d               | 16 ++---
 gas/testsuite/gas/i386/x86-64-size-1.d        | 24 ++++----
 gas/testsuite/gas/i386/x86-64-size-3.d        | 16 ++---
 gas/testsuite/gas/i386/x86-64-size-5.d        | 12 ++--
 gas/testsuite/gas/i386/x86-64-unwind.d        | 10 +--
 gas/write.c                                   | 39 ++++++++----
 ld/testsuite/ld-elf/export-class.sd           |  2 -
 ld/testsuite/ld-elf/loadaddr3b.d              |  3 -
 ld/testsuite/ld-elf/sec64k.exp                |  6 +-
 ld/testsuite/ld-i386/ibt-plt-1.d              |  4 +-
 ld/testsuite/ld-i386/ibt-plt-2a.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-2c.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-3a.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-3c.d             |  4 +-
 ld/testsuite/ld-i386/plt-pic.pd               |  6 +-
 ld/testsuite/ld-i386/plt-pic2.dd              |  6 +-
 ld/testsuite/ld-i386/plt.pd                   |  6 +-
 ld/testsuite/ld-i386/plt2.dd                  |  6 +-
 ld/testsuite/ld-i386/pr19636-1d.d             |  2 +-
 ld/testsuite/ld-i386/pr19636-1l.d             |  2 +-
 ld/testsuite/ld-i386/pr19636-2c.d             |  2 +-
 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      |  4 +-
 .../ld-ifunc/ifunc-2-local-i386-now.d         |  4 +-
 .../ld-ifunc/ifunc-2-local-x86-64-now.d       |  4 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    |  4 +-
 ld/testsuite/ld-ifunc/ifunc-21-x86-64.d       | 10 +--
 ld/testsuite/ld-ifunc/ifunc-22-x86-64.d       | 10 +--
 ld/testsuite/ld-ifunc/pr17154-i386-now.d      | 10 +--
 ld/testsuite/ld-ifunc/pr17154-i386.d          |  8 +--
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    | 10 +--
 ld/testsuite/ld-ifunc/pr17154-x86-64.d        |  8 +--
 ld/testsuite/ld-x86-64/bnd-branch-1-now.d     | 10 +--
 ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d      |  2 +-
 ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d      |  8 +--
 ld/testsuite/ld-x86-64/bnd-ifunc-2.d          |  8 +--
 ld/testsuite/ld-x86-64/bnd-plt-1-now.d        |  8 +--
 ld/testsuite/ld-x86-64/bnd-plt-1.d            |  8 +--
 ld/testsuite/ld-x86-64/ibt-plt-1-x32.d        |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-1.d            |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2a.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2c.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3a.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3c.d           |  4 +-
 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/plt.pd                 |  6 +-
 ld/testsuite/ld-x86-64/plt2.dd                |  6 +-
 ld/testsuite/ld-x86-64/pr19609-4e.d           |  4 +-
 ld/testsuite/ld-x86-64/pr19609-6a.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-6b.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7b.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7d.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19636-2l.d           |  6 +-
 ld/testsuite/ld-x86-64/pr20253-1d.d           | 12 ++--
 ld/testsuite/ld-x86-64/pr20253-1h.d           | 12 ++--
 ld/testsuite/ld-x86-64/pr21038b-now.d         |  2 +-
 ld/testsuite/ld-x86-64/pr21038b.d             |  2 +-
 ld/testsuite/ld-x86-64/pr21038c-now.d         |  2 +-
 ld/testsuite/ld-x86-64/pr21038c.d             |  2 +-
 ld/testsuite/ld-x86-64/pr23854.d              | 36 +++++------
 ld/testsuite/ld-x86-64/pr25416-3.d            |  4 +-
 ld/testsuite/ld-x86-64/pr25416-4.d            |  4 +-
 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 ----
 111 files changed, 364 insertions(+), 547 deletions(-)

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 5196bb6940d..ed82a847bab 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 3f4ccd20559..ab19bdb4530 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 b40fb4a1f5d..4e99fcc6b9b 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 448989a2827..fbde9f9a9f2 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12477,9 +12477,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);
@@ -12500,36 +12497,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 (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 9559ab45805..10ea8bd7b89 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/objcopy.c b/binutils/objcopy.c
index 560e7c648d1..161ac2c3b55 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3204,6 +3204,17 @@ 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)
+    {
+      /* 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
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index a1e6cd1bbd8..5582d77c372 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 acc6d9390c5..5fbb5d002e3 100644
--- a/binutils/testsuite/binutils-all/readelf.ss
+++ b/binutils/testsuite/binutils-all/readelf.ss
@@ -2,10 +2,7 @@
 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...
 #...
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64 b/binutils/testsuite/binutils-all/readelf.ss-64
index bd10cabef35..99a732f71f5 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64
+++ b/binutils/testsuite/binutils-all/readelf.ss-64
@@ -2,10 +2,7 @@
 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
diff --git a/binutils/testsuite/binutils-all/readelf.ss-mips b/binutils/testsuite/binutils-all/readelf.ss-mips
index c49416bab40..ee4fa41b7fb 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 4fd7fe02786..4e8ed3c399c 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/config/obj-elf.c b/gas/config/obj-elf.c
index bf79b05743d..bb050ec7425 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/read.c b/gas/read.c
index 9d0ba27ea8c..be6e3e03d45 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/testsuite/gas/cfi/cfi-label.d b/gas/testsuite/gas/cfi/cfi-label.d
index 0350b57f134..c6507138b43 100644
--- a/gas/testsuite/gas/cfi/cfi-label.d
+++ b/gas/testsuite/gas/cfi/cfi-label.d
@@ -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/section2.e b/gas/testsuite/gas/elf/section2.e
index 9b50798bcfa..b2f6e3eabb8 100644
--- a/gas/testsuite/gas/elf/section2.e
+++ b/gas/testsuite/gas/elf/section2.e
@@ -1,8 +1,5 @@
 
-Symbol table '.symtab' contains 5 entries:
+Symbol table '.symtab' contains 2 entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
  +0: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND 
- +1: 0+0 +0 +SECTION +LOCAL +DEFAULT +1 
- +2: 0+0 +0 +SECTION +LOCAL +DEFAULT +2 
- +3: 0+0 +0 +SECTION +LOCAL +DEFAULT +3 
- +4: 0+0 +0 +SECTION +LOCAL +DEFAULT +4 
+ +1: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ foo
diff --git a/gas/testsuite/gas/elf/section2.l b/gas/testsuite/gas/elf/section2.l
index c311ff94947..1ae50358dfc 100644
--- a/gas/testsuite/gas/elf/section2.l
+++ b/gas/testsuite/gas/elf/section2.l
@@ -5,4 +5,5 @@
 
 [ 	]+1[ 	]+.section AAA
 [ 	]+2[ 	]+.global AAA
-[ 	]+3 0000 31[ 	]+.byte 49
+[ 	]+3[ 	]+foo:
+[ 	]+4 0000 31[ 	]+.byte 49
diff --git a/gas/testsuite/gas/elf/section2.s b/gas/testsuite/gas/elf/section2.s
index 2c181e53991..1616f870db3 100644
--- a/gas/testsuite/gas/elf/section2.s
+++ b/gas/testsuite/gas/elf/section2.s
@@ -1,3 +1,4 @@
           .section AAA
           .global AAA
+foo:
 	  .byte 49
diff --git a/gas/testsuite/gas/elf/symver.d b/gas/testsuite/gas/elf/symver.d
index 7fcc62a5caa..2292e3267d9 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 7f69d660b37..3acf1487b38 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 e5b74fa5c98..64b052dc935 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
@@ -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 6f96134f136..65f6890dae7 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
@@ -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 8ce06b0f848..4571a484ea9 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
@@ -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 bd532b73e88..274ddb06274 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
@@ -3,7 +3,7 @@
 #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 d582bbecc94..b187e5d4a3f 100644
--- a/gas/testsuite/gas/i386/size-1.d
+++ b/gas/testsuite/gas/i386/size-1.d
@@ -5,19 +5,19 @@
 
 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 2b08707f432..b45811c5d8e 100644
--- a/gas/testsuite/gas/i386/size-3.d
+++ b/gas/testsuite/gas/i386/size-3.d
@@ -5,15 +5,15 @@
 
 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 657408cf733..57db8994372 100644
--- a/gas/testsuite/gas/i386/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/x86-64-size-1.d
@@ -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 943a64e9ac6..4688dc938b3 100644
--- a/gas/testsuite/gas/i386/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/x86-64-size-3.d
@@ -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 c34d0eedaab..d18ffcd3a41 100644
--- a/gas/testsuite/gas/i386/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/x86-64-size-5.d
@@ -5,13 +5,13 @@
 
 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 7f8d94fe86e..ca3047277e7 100644
--- a/gas/testsuite/gas/i386/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/x86-64-unwind.d
@@ -2,7 +2,7 @@
 #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 ca14b3734bd..87eee205d1a 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,11 @@ 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.  Don't generate unused section symbols.  */
   nsyms = 0;
   for (symp = symbol_rootP; symp; symp = symbol_next (symp))
-    nsyms++;
+    if (!symbol_section_p (symp) || symbol_used_in_reloc_p (symp))
+      nsyms++;
 
   if (nsyms)
     {
@@ -1759,15 +1765,20 @@ 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 (!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 +2069,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/ld/testsuite/ld-elf/export-class.sd b/ld/testsuite/ld-elf/export-class.sd
index bd5c5491d93..e71248268cb 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 ac4b5178d8b..aa5e9515248 100644
--- a/ld/testsuite/ld-elf/loadaddr3b.d
+++ b/ld/testsuite/ld-elf/loadaddr3b.d
@@ -3,9 +3,6 @@
 #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 70c467af2a8..584359a44b4 100644
--- a/ld/testsuite/ld-elf/sec64k.exp
+++ b/ld/testsuite/ld-elf/sec64k.exp
@@ -196,11 +196,7 @@ if { ![istarget "d10v-*-*"]
     puts $ofd "  \\\[65279\\\] \\.foo\\.\[0-9\]+ .*"
     puts $ofd "  \\\[65280\\\] \\.foo\\.\[0-9\]+ .*"
     puts $ofd "#..."
-    puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+SECTION\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. "
-    puts $ofd "#..."
-    puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+\[0-9\] bar_1$"
-    puts $ofd "#..."
-    puts $ofd ".* bar_66000$"
+    puts $ofd " 66...: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. bar_66000$"
     puts $ofd "#..."
     # Global symbols are not in "alphanumeric" order, so we just check
     # that the first and the last are present in any order (assuming no
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d
index a7eaa1f77d9..b0648ae9e03 100644
--- a/ld/testsuite/ld-i386/ibt-plt-1.d
+++ b/ld/testsuite/ld-i386/ibt-plt-1.d
@@ -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 9c8f5996a72..42aa2ce7410 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
@@ -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 a9c8642ced2..445e08fa8b3 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2c.d
@@ -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 b4366c93150..b357a74a33b 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
@@ -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 b4366c93150..b357a74a33b 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
@@ -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 5c047d4debd..fe0f3efb1be 100644
--- a/ld/testsuite/ld-i386/plt-pic.pd
+++ b/ld/testsuite/ld-i386/plt-pic.pd
@@ -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 8162234aab4..c9af97203ab 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 efcd8a1b1d7..9c395c3b8d3 100644
--- a/ld/testsuite/ld-i386/plt.pd
+++ b/ld/testsuite/ld-i386/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]+
  +[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 c9d673f65a7..5623fe9685b 100644
--- a/ld/testsuite/ld-i386/plt2.dd
+++ b/ld/testsuite/ld-i386/plt2.dd
@@ -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 b7e6aba92c9..f294c9c707a 100644
--- a/ld/testsuite/ld-i386/pr19636-1d.d
+++ b/ld/testsuite/ld-i386/pr19636-1d.d
@@ -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 8f2a8e5127f..a7568aa74a9 100644
--- a/ld/testsuite/ld-i386/pr19636-1l.d
+++ b/ld/testsuite/ld-i386/pr19636-1l.d
@@ -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 4b49c817555..92b241073cb 100644
--- a/ld/testsuite/ld-i386/pr19636-2c.d
+++ b/ld/testsuite/ld-i386/pr19636-2c.d
@@ -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 20e4c5ed361..39afcd0b5b7 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 .*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 5177f4d30dd..fcbecc31966 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 .*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 1c9c4f2cb2a..b831f89133c 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 .*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 a5b4fb83c0e..ec418d1a1fc 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 .*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 ef131ef8576..0744aeb78b0 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 661f1c46c6b..229ce23a9af 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 .*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 3425c951bd0..135d74907d1 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 .*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 274445db842..ce85a55be45 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 .*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 2c917fa2936..0d3f7b80d06 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
@@ -10,7 +10,7 @@
 
 Disassembly of section .plt:
 
-0+f0 <.plt>:
+0+f0 <\*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+100 <\*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    f0 <.plt>
+ +[a-f0-9]+:	e9 e0 ff ff ff       	jmp    f0 <\*ABS\*@plt-0x10>
 
 Disassembly of section .text:
 
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 01f6a781467..48d2084d38f 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
@@ -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 375cecd6f25..14866a8f6cc 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
@@ -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 9cd35181b81..1cd60941ac0 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
@@ -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 de12e9f5433..69a4ade87f4 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -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 de12e9f5433..69a4ade87f4 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -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 082d0674227..6747b3408dd 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d
@@ -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 68123bf0ca7..0b9817d4372 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386.d
@@ -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 928a6a78d75..4cc1dc206d5 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
@@ -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 8a6861dcde3..9fb23d410e3 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
@@ -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 9640beac2d1..b7bc4e526cc 100644
--- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
@@ -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 25af7f81d45..15ecfe1cc50 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
@@ -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 634940d5b1e..211d72d2335 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
@@ -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 7a0356cc695..f80ba15aa35 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
@@ -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 be5392c45f9..24e28210a0a 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
@@ -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 cca370527a6..ab3ab45faaf 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d
@@ -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 2018b119362..b011e3f158a 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
@@ -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 d556ec13f65..15563b432d1 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d
@@ -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 5168a31c743..a19cece98e8 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
@@ -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 01401ba1417..92785929092 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
@@ -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 9f9663cca32..b00ab920c0e 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
@@ -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 aa81fb9ddb8..b7969d8c574 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
@@ -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 bf185d548fb..d6f8bb3afbe 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
@@ -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 27dd93c8e52..9c15ed4f928 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
@@ -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 66f47051244..f09b1a666ad 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
@@ -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 5c918b8b4d5..5c19e3dc96d 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
@@ -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/mpx3.dd b/ld/testsuite/ld-x86-64/mpx3.dd
index 96e56fc5e08..729b1cf4e97 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 f4609d5ed6e..a1eba8e975b 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 35f6869bad4..50a0fbca502 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 55856107675..92177bb1216 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 1ff644ee9c8..4966d55fb5a 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 1ff644ee9c8..4966d55fb5a 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 1ff644ee9c8..4966d55fb5a 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 302a345b2e2..e0bde11d84e 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/plt.pd b/ld/testsuite/ld-x86-64/plt.pd
index 54a00dffc4d..6b4024c5c93 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 663ec98192b..454bc060dd4 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 f2634947d62..48adc947e75 100644
--- a/ld/testsuite/ld-x86-64/pr19609-4e.d
+++ b/ld/testsuite/ld-x86-64/pr19609-4e.d
@@ -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 b340287f48b..265825d4c6c 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6a.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6a.d
@@ -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 810023b2b96..1f769eff4d3 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6b.d
@@ -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 20b42e838db..d85e5e9425d 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7b.d
@@ -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 034a57b1e00..6eb511080dd 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7d.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7d.d
@@ -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 c9b256dd449..1b894b3e97c 100644
--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
@@ -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 28fbc998eaa..f9f03ba8403 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1d.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1d.d
@@ -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 132fa03afc3..7d9b1475d5c 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1h.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1h.d
@@ -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 62e80dc06b4..c042b6cf702 100644
--- a/ld/testsuite/ld-x86-64/pr21038b-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038b-now.d
@@ -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 126c1d2efee..144ed44cccf 100644
--- a/ld/testsuite/ld-x86-64/pr21038b.d
+++ b/ld/testsuite/ld-x86-64/pr21038b.d
@@ -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 19a4ea8fcb7..2058512b74e 100644
--- a/ld/testsuite/ld-x86-64/pr21038c-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038c-now.d
@@ -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 35e7d83c4e0..a62d43a7bc0 100644
--- a/ld/testsuite/ld-x86-64/pr21038c.d
+++ b/ld/testsuite/ld-x86-64/pr21038c.d
@@ -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 95770d3cefd..5113a2c44a3 100644
--- a/ld/testsuite/ld-x86-64/pr23854.d
+++ b/ld/testsuite/ld-x86-64/pr23854.d
@@ -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\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 03 1d ([0-9a-f]{2} ){4} *	add    0x[a-f0-9]+\(%rip\),%bx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 23 0d ([0-9a-f]{2} ){4} *	and    0x[a-f0-9]+\(%rip\),%cx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 3b 15 ([0-9a-f]{2} ){4} *	cmp    0x[a-f0-9]+\(%rip\),%dx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 0b 3d ([0-9a-f]{2} ){4} *	or     0x[a-f0-9]+\(%rip\),%di        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 1b 35 ([0-9a-f]{2} ){4} *	sbb    0x[a-f0-9]+\(%rip\),%si        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 2b 2d ([0-9a-f]{2} ){4} *	sub    0x[a-f0-9]+\(%rip\),%bp        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 44 33 05 ([0-9a-f]{2} ){4} *	xor    0x[a-f0-9]+\(%rip\),%r8w        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 85 0d ([0-9a-f]{2} ){4} *	test   %cx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 13 05 ([0-9a-f]{2} ){4} *	adc    0x[a-f0-9]+\(%rip\),%ax        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 03 1d ([0-9a-f]{2} ){4} *	add    0x[a-f0-9]+\(%rip\),%bx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 23 0d ([0-9a-f]{2} ){4} *	and    0x[a-f0-9]+\(%rip\),%cx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 3b 15 ([0-9a-f]{2} ){4} *	cmp    0x[a-f0-9]+\(%rip\),%dx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 0b 3d ([0-9a-f]{2} ){4} *	or     0x[a-f0-9]+\(%rip\),%di        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 1b 35 ([0-9a-f]{2} ){4} *	sbb    0x[a-f0-9]+\(%rip\),%si        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 2b 2d ([0-9a-f]{2} ){4} *	sub    0x[a-f0-9]+\(%rip\),%bp        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 44 33 05 ([0-9a-f]{2} ){4} *	xor    0x[a-f0-9]+\(%rip\),%r8w        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 85 0d ([0-9a-f]{2} ){4} *	test   %cx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-3.d b/ld/testsuite/ld-x86-64/pr25416-3.d
index 9c1da134847..26927d99562 100644
--- a/ld/testsuite/ld-x86-64/pr25416-3.d
+++ b/ld/testsuite/ld-x86-64/pr25416-3.d
@@ -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\+0x[a-f0-9]+>
  +[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\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-4.d b/ld/testsuite/ld-x86-64/pr25416-4.d
index 8d91fbc0a66..d98121f1f31 100644
--- a/ld/testsuite/ld-x86-64/pr25416-4.d
+++ b/ld/testsuite/ld-x86-64/pr25416-4.d
@@ -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\+0x[a-f0-9]+>
  +[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\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/tlsbin.rd b/ld/testsuite/ld-x86-64/tlsbin.rd
index c535732b759..54fe876ecc2 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 .*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 b1205fe49a7..495115eb708 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 .*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 9e46ca1d0fc..682c4a066a2 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 .*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 a15c6e0f22a..58feb20e55a 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 .*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 77e8ae3d819..ca8f19bf3f7 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 024e124e515..2e44dc6ac6b 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 .*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 a39a8fe0d0d..60decd2787b 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 .*tlspic3.o
 .* TLS +LOCAL +DEFAULT +8 sl1
 .* TLS +LOCAL +DEFAULT +8 sl2
-- 
2.29.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ELF: Don't generate unused section symbols
  2021-01-04 18:43     ` [PATCH] ELF: Don't generate unused section symbols H.J. Lu
@ 2021-01-05  1:23       ` Alan Modra
  2021-01-05 16:21         ` V2 " H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2021-01-05  1:23 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Nick Clifton, Binutils

On Mon, Jan 04, 2021 at 10:43:20AM -0800, H.J. Lu wrote:
> On Sun, Jan 3, 2021 at 4:51 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sun, Jan 3, 2021 at 3:33 PM Alan Modra <amodra@gmail.com> wrote:
> > >
> > > On Sun, Dec 27, 2020 at 07:25:12PM -0800, H.J. Lu via Binutils wrote:
> > > > 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.
> > >
> > > Hi HJ,
> > > I'm inclined to think that removing unused section symbols is a good
> > > idea, but that --generate-unused-section-symbols and certainly the
> > > configure option --enable-generate-section-symbols is undesirable.
> > > I'd rather not see more configure options that change binutils default
> > > behaviour, making binutils bug reports more difficult to reproduce.
> > >
> >
> > Removing unused section symbols means updating many binutils tests
> > as well as many assembler backends.  I can submit a patch to remove
> > unused section symbols and fix all tests on x86.  But I can't cover other
> > backends.
> 
> Here is the patch.
> 
> Tested on Linux/x86.  Other ELF backends need:
> 
> 1. Mark used section symbols in assembler backend.
> 2. Remove unused section symbols from expected assembler and linker
> outputs.

In that case definitely not something we want before 2.36 goes out the
door.

aarch64_be-linux-gnu_ilp32  +FAIL: gas/aarch64/advsimd-mov-bad
aarch64_be-linux-gnu_ilp32  +FAIL: gas/aarch64/dwarf
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols for miscellaneous directives
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols Test 2
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols Test 3
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols Test 4
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols Test 5
aarch64_be-linux-gnu_ilp32  +FAIL: AArch64 Mapping Symbols Test 6
aarch64_be-linux-gnu_ilp32  +FAIL: gas/aarch64/symbol-variant_pcs-2
aarch64_be-linux-gnu_ilp32  +FAIL: gas/aarch64/symbol-variant_pcs-3
aarch64_be-linux-gnu_ilp32  +FAIL: aarch64-farcall-b-plt
aarch64_be-linux-gnu_ilp32  +FAIL: aarch64-farcall-bl-plt
aarch64_be-linux-gnu_ilp32  +FAIL: ld-aarch64/variant_pcs-shared
aarch64_be-linux-gnu_ilp32  +FAIL: ld-aarch64/variant_pcs-now
aarch64_be-linux-gnu_ilp32  +FAIL: ld-elf/64ksec
aarch64-elf  +FAIL: gas/aarch64/advsimd-mov-bad
aarch64-elf  +FAIL: gas/aarch64/dwarf
aarch64-elf  +FAIL: AArch64 Mapping Symbols for miscellaneous directives
aarch64-elf  +FAIL: AArch64 Mapping Symbols
aarch64-elf  +FAIL: AArch64 Mapping Symbols Test 2
aarch64-elf  +FAIL: AArch64 Mapping Symbols Test 3
aarch64-elf  +FAIL: AArch64 Mapping Symbols Test 4
aarch64-elf  +FAIL: AArch64 Mapping Symbols Test 5
aarch64-elf  +FAIL: AArch64 Mapping Symbols Test 6
aarch64-elf  +FAIL: gas/aarch64/symbol-variant_pcs-1
aarch64-elf  +FAIL: gas/aarch64/symbol-variant_pcs-2
aarch64-elf  +FAIL: gas/aarch64/symbol-variant_pcs-3
aarch64-elf  +FAIL: aarch64-farcall-b-plt
aarch64-elf  +FAIL: aarch64-farcall-bl-plt
aarch64-elf  +FAIL: ld-aarch64/gc-got-relocs
aarch64-elf  +FAIL: ld-aarch64/gc-tls-relocs
aarch64-elf  +FAIL: ld-aarch64/variant_pcs-shared
aarch64-elf  +FAIL: ld-aarch64/variant_pcs-now
aarch64-elf  +FAIL: ld-aarch64/pac-plt-2
aarch64-elf  +FAIL: ld-elf/64ksec
aarch64-linux  +FAIL: gas/aarch64/advsimd-mov-bad
aarch64-linux  +FAIL: gas/aarch64/dwarf
aarch64-linux  +FAIL: AArch64 Mapping Symbols for miscellaneous directives
aarch64-linux  +FAIL: AArch64 Mapping Symbols
aarch64-linux  +FAIL: AArch64 Mapping Symbols Test 2
aarch64-linux  +FAIL: AArch64 Mapping Symbols Test 3
aarch64-linux  +FAIL: AArch64 Mapping Symbols Test 4
aarch64-linux  +FAIL: AArch64 Mapping Symbols Test 5
aarch64-linux  +FAIL: AArch64 Mapping Symbols Test 6
aarch64-linux  +FAIL: gas/aarch64/symbol-variant_pcs-1
aarch64-linux  +FAIL: gas/aarch64/symbol-variant_pcs-2
aarch64-linux  +FAIL: gas/aarch64/symbol-variant_pcs-3
aarch64-linux  +FAIL: aarch64-farcall-b-plt
aarch64-linux  +FAIL: aarch64-farcall-bl-plt
aarch64-linux  +FAIL: ld-aarch64/gc-got-relocs
aarch64-linux  +FAIL: ld-aarch64/gc-tls-relocs
aarch64-linux  +FAIL: ld-aarch64/variant_pcs-shared
aarch64-linux  +FAIL: ld-aarch64/variant_pcs-now
aarch64-linux  +FAIL: ld-aarch64/pac-plt-2
aarch64-linux  +FAIL: ld-elf/64ksec
alpha-linux  +FAIL: alpha elf-usepv-1
alpha-linux  +FAIL: TLS -fpic -shared
alpha-linux  +FAIL: TLS -fpic and -fno-pic exec
alpha-linux  +FAIL: TLS -fpic and -fno-pic exec -relax
alpha-netbsd  +FAIL: alpha elf-usepv-1
alpha-unknown-freebsd4.7  +FAIL: alpha elf-usepv-1
am33_2.0-linux  +FAIL: readelf -n version (reason: unexpected output)
arc-elf  +FAIL: elf section2 list
arc-linux-uclibc  +FAIL: elf section2 list
armeb-linuxeabi  +FAIL: R_ARM_GOT_PREL relocation
armeb-linuxeabi  +FAIL: ARM Mapping Symbols for .arm/.thumb
armeb-linuxeabi  +FAIL: ARM Mapping Symbols for miscellaneous directives
armeb-linuxeabi  +FAIL: ARM Mapping Symbols
armeb-linuxeabi  +FAIL: ARM Mapping Symbols Test 2
armeb-linuxeabi  +FAIL: ARM Mapping Symbols Test 3
armeb-linuxeabi  +FAIL: ARM Mapping Symbols Test 4
armeb-linuxeabi  +FAIL: ARM Mapping Symbols with multiple sections
armeb-linuxeabi  +FAIL: ARM Mapping Symbols for .short (EABI version)
armeb-linuxeabi  +FAIL: ARM Mapping Symbols for .short (ELF version)
armeb-linuxeabi  +FAIL: gas/arm/thumbver
armeb-linuxeabi  +FAIL: elf section2 list
armeb-linuxeabi  +FAIL: script-type
armeb-linuxeabi  +FAIL: Data only mapping symbols for merged sections
armeb-linuxeabi  +FAIL: Simple non-PIC shared library
armeb-linuxeabi  +FAIL: Simple PIC shared library
armeb-linuxeabi  +FAIL: Simple dynamic application
armeb-linuxeabi  +FAIL: Non-pcrel function reference
armeb-linuxeabi  +FAIL: Thumb shared library with ARM entry points
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb shared library
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb dynamic application
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb arch5 dynamic application
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb dynamic application with farcalls
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb arch5 dynamic application with farcalls
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb shared library with long branches (v4t)
armeb-linuxeabi  +FAIL: Mixed ARM/Thumb shared library with long branches (v5t)
armeb-linuxeabi  +FAIL: TLS gnu shared library negative addend
armeb-linuxeabi  +FAIL: TLS long plt library
armeb-linuxeabi  +FAIL: TLS thumb1
armeb-linuxeabi  +FAIL: Cortex-A8 erratum fix, bl.w to PLT
armeb-linuxeabi  +FAIL: Cortex-A8 erratum fix, bcc.w to PLT
armeb-linuxeabi  +FAIL: Cortex-A8 erratum fix, blx.w to PLT
armeb-linuxeabi  +FAIL: Cortex-A8 erratum fix, relocate bl.w to PLT
armeb-linuxeabi  +FAIL: IFUNC test 3
armeb-linuxeabi  +FAIL: IFUNC test 4
armeb-linuxeabi  +FAIL: IFUNC test 9
armeb-linuxeabi  +FAIL: IFUNC test 10
armeb-linuxeabi  +FAIL: IFUNC test 14
armeb-linuxeabi  +FAIL: IFUNC test 15
armeb-linuxeabi  +FAIL: Long PLT entries in executables
armeb-linuxeabi  +FAIL: non-contiguous-arm2
armeb-linuxeabi  +FAIL: non-contiguous-arm3
armeb-linuxeabi  +FAIL: non-contiguous-arm5
armeb-linuxeabi  +FAIL: non-contiguous-arm6
armeb-linuxeabi  +FAIL: ld-elf/64ksec
arm-elf  +FAIL: R_ARM_GOT_PREL relocation
arm-elf  +FAIL: ARM Mapping Symbols for .arm/.thumb
arm-elf  +FAIL: ARM Mapping Symbols for miscellaneous directives
arm-elf  +FAIL: ARM Mapping Symbols
arm-elf  +FAIL: ARM Mapping Symbols Test 2
arm-elf  +FAIL: ARM Mapping Symbols Test 3
arm-elf  +FAIL: ARM Mapping Symbols Test 4
arm-elf  +FAIL: ARM Mapping Symbols with multiple sections
arm-elf  +FAIL: ARM Mapping Symbols for .short (EABI version)
arm-elf  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-elf  +FAIL: gas/arm/thumbver
arm-elf  +FAIL: elf section2 list
arm-elf  +FAIL: Data only mapping symbols for merged sections
arm-elf  +FAIL: Simple non-PIC shared library
arm-elf  +FAIL: Simple PIC shared library
arm-elf  +FAIL: Simple dynamic application
arm-elf  +FAIL: Non-pcrel function reference
arm-elf  +FAIL: Thumb shared library with ARM entry points
arm-elf  +FAIL: Mixed ARM/Thumb shared library
arm-elf  +FAIL: Mixed ARM/Thumb dynamic application
arm-elf  +FAIL: Mixed ARM/Thumb arch5 dynamic application
arm-elf  +FAIL: ld-elf/64ksec
arm-linuxeabi  +FAIL: R_ARM_GOT_PREL relocation
arm-linuxeabi  +FAIL: ARM Mapping Symbols for .arm/.thumb
arm-linuxeabi  +FAIL: ARM Mapping Symbols for miscellaneous directives
arm-linuxeabi  +FAIL: ARM Mapping Symbols
arm-linuxeabi  +FAIL: ARM Mapping Symbols Test 2
arm-linuxeabi  +FAIL: ARM Mapping Symbols Test 3
arm-linuxeabi  +FAIL: ARM Mapping Symbols Test 4
arm-linuxeabi  +FAIL: ARM Mapping Symbols with multiple sections
arm-linuxeabi  +FAIL: ARM Mapping Symbols for .short (EABI version)
arm-linuxeabi  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-linuxeabi  +FAIL: gas/arm/thumbver
arm-linuxeabi  +FAIL: elf section2 list
arm-linuxeabi  +FAIL: script-type
arm-linuxeabi  +FAIL: Data only mapping symbols for merged sections
arm-linuxeabi  +FAIL: Simple non-PIC shared library
arm-linuxeabi  +FAIL: Simple PIC shared library
arm-linuxeabi  +FAIL: Simple dynamic application
arm-linuxeabi  +FAIL: Non-pcrel function reference
arm-linuxeabi  +FAIL: Thumb shared library with ARM entry points
arm-linuxeabi  +FAIL: Mixed ARM/Thumb shared library
arm-linuxeabi  +FAIL: Mixed ARM/Thumb dynamic application
arm-linuxeabi  +FAIL: Mixed ARM/Thumb arch5 dynamic application
arm-linuxeabi  +FAIL: Mixed ARM/Thumb dynamic application with farcalls
arm-linuxeabi  +FAIL: Mixed ARM/Thumb arch5 dynamic application with farcalls
arm-linuxeabi  +FAIL: Mixed ARM/Thumb shared library with long branches (v4t)
arm-linuxeabi  +FAIL: Mixed ARM/Thumb shared library with long branches (v5t)
arm-linuxeabi  +FAIL: TLS gnu shared library negative addend
arm-linuxeabi  +FAIL: TLS long plt library
arm-linuxeabi  +FAIL: TLS thumb1
arm-linuxeabi  +FAIL: Cortex-A8 erratum fix, bl.w to PLT
arm-linuxeabi  +FAIL: Cortex-A8 erratum fix, bcc.w to PLT
arm-linuxeabi  +FAIL: Cortex-A8 erratum fix, blx.w to PLT
arm-linuxeabi  +FAIL: Cortex-A8 erratum fix, relocate bl.w to PLT
arm-linuxeabi  +FAIL: IFUNC test 3
arm-linuxeabi  +FAIL: IFUNC test 4
arm-linuxeabi  +FAIL: IFUNC test 9
arm-linuxeabi  +FAIL: IFUNC test 10
arm-linuxeabi  +FAIL: IFUNC test 14
arm-linuxeabi  +FAIL: IFUNC test 15
arm-linuxeabi  +FAIL: Long PLT entries in executables
arm-linuxeabi  +FAIL: non-contiguous-arm2
arm-linuxeabi  +FAIL: non-contiguous-arm3
arm-linuxeabi  +FAIL: non-contiguous-arm5
arm-linuxeabi  +FAIL: non-contiguous-arm6
arm-linuxeabi  +FAIL: Thumb only PLT and GOT
arm-linuxeabi  +FAIL: ld-elf/64ksec
arm-nacl  +FAIL: R_ARM_GOT_PREL relocation
arm-nacl  +FAIL: ARM Mapping Symbols for .arm/.thumb
arm-nacl  +FAIL: ARM Mapping Symbols for miscellaneous directives
arm-nacl  +FAIL: ARM Mapping Symbols
arm-nacl  +FAIL: ARM Mapping Symbols Test 2
arm-nacl  +FAIL: ARM Mapping Symbols Test 3
arm-nacl  +FAIL: ARM Mapping Symbols Test 4
arm-nacl  +FAIL: ARM Mapping Symbols with multiple sections
arm-nacl  +FAIL: ARM Mapping Symbols for .short (EABI version)
arm-nacl  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-nacl  +FAIL: gas/arm/thumbver
arm-nacl  +FAIL: elf section2 list
arm-nacl  +FAIL: script-type
arm-nacl  +FAIL: Data only mapping symbols for merged sections
arm-nacl  +FAIL: non-contiguous-arm2
arm-nacl  +FAIL: non-contiguous-arm5
arm-nacl  +FAIL: ld-elf/64ksec
arm-netbsdelf  +FAIL: ARM Mapping Symbols
arm-netbsdelf  +FAIL: ARM Mapping Symbols Test 2
arm-netbsdelf  +FAIL: ARM Mapping Symbols Test 3
arm-netbsdelf  +FAIL: ARM Mapping Symbols Test 4
arm-netbsdelf  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-netbsdelf  +FAIL: gas/arm/thumbver
arm-netbsdelf  +FAIL: elf section2 list
arm-netbsdelf  +FAIL: Data only mapping symbols for merged sections
arm-netbsdelf  +FAIL: Simple non-PIC shared library
arm-netbsdelf  +FAIL: Simple PIC shared library
arm-netbsdelf  +FAIL: Simple dynamic application
arm-netbsdelf  +FAIL: Non-pcrel function reference
arm-netbsdelf  +FAIL: Thumb shared library with ARM entry points
arm-netbsdelf  +FAIL: Mixed ARM/Thumb shared library
arm-netbsdelf  +FAIL: Mixed ARM/Thumb dynamic application
arm-netbsdelf  +FAIL: Mixed ARM/Thumb arch5 dynamic application
arm-netbsdelf  +FAIL: ld-elf/64ksec
arm-nto  +FAIL: ARM Mapping Symbols
arm-nto  +FAIL: ARM Mapping Symbols Test 2
arm-nto  +FAIL: ARM Mapping Symbols Test 3
arm-nto  +FAIL: ARM Mapping Symbols Test 4
arm-nto  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-nto  +FAIL: gas/arm/thumbver
arm-nto  +FAIL: elf section2 list
arm-nto  +FAIL: Data only mapping symbols for merged sections
arm-nto  +FAIL: Simple non-PIC shared library
arm-nto  +FAIL: Simple PIC shared library
arm-nto  +FAIL: Simple dynamic application
arm-nto  +FAIL: Non-pcrel function reference
arm-nto  +FAIL: Thumb shared library with ARM entry points
arm-nto  +FAIL: Mixed ARM/Thumb shared library
arm-nto  +FAIL: Mixed ARM/Thumb dynamic application
arm-nto  +FAIL: Mixed ARM/Thumb arch5 dynamic application
arm-nto  +FAIL: ld-elf/64ksec
arm-pe  +FAIL: ARMv6T2 THUMB mode
arm-pe  +FAIL: ARMv6T2 ARM mode
arm-pe  +FAIL: ARM Integer division instructions
arm-pe  +FAIL: Valid v8-A barrier (ARM)
arm-pe  +FAIL: Valid v8-R barrier (ARM)
arm-pe  +FAIL: Make sure .fpu does not reset MVE feature bits
arm-pe  +FAIL: Make sure .fpu does not reset MVE feature bits but still adds extra bits
arm-pe  +FAIL: Barrier Instruction Operands
arm-pe  +FAIL: Half-precision neon instructions
arm-pe  +FAIL: Half-precision instructions (programmer's syntax)
arm-pe  +FAIL: Half-precision vfpv3 instructions
arm-pe  +FAIL: ldr - arm
arm-pe  +FAIL: ARM load/store with pc base register
arm-pe  +FAIL: ARM local label relocs to section symbol relocs (COFF)
arm-pe  +FAIL: Load pseudo-operation for Cortex-M0
arm-pe  +FAIL: Load pseudo-operation for Cortex-M23
arm-pe  +FAIL: Load pseudo-operation for Cortex-M33
arm-pe  +FAIL: MRS/MSR test, architecture v6, ARM mode
arm-pe  +FAIL: MRS/MSR test, architecture v7-A, ARM mode
arm-pe  +FAIL: MSR immediate operands
arm-pe  +FAIL: MSR register operands
arm-pe  +FAIL: MVE context sensitive .arch_extension under no -march
arm-pe  +FAIL: MVE context sensitive .arch_extension
arm-pe  +FAIL: MVE Floating point load multiple and store multiple instructions.
arm-pe  +FAIL: Armv8.1-M Mainline scalar vmul instructions in it blocks (with MVE)
arm-pe  +FAIL: MVE vabs and vneg instructions
arm-pe  +FAIL: MVE vabd instructions
arm-pe  +FAIL: MVE vabs and vneg instructions
arm-pe  +FAIL: MVE vadc instructions
arm-pe  +FAIL: MVE vaddlv instructions
arm-pe  +FAIL: Armv8.1-M Mainline vadd/vsub instructions in it blocks (with MVE)
arm-pe  +FAIL: MVE vadd and vsub instructions
arm-pe  +FAIL: MVE vaddv instructions
arm-pe  +FAIL: MVE vand instructions
arm-pe  +FAIL: MVE vbic instructions
arm-pe  +FAIL: MVE vbrsr instructions
arm-pe  +FAIL: MVE vcadd instructions
arm-pe  +FAIL: MVE vcls instructions
arm-pe  +FAIL: MVE vclz instructions
arm-pe  +FAIL: MVE vcmla instructions
arm-pe  +FAIL: MVE vcmp instructions
arm-pe  +FAIL: MVE vcmul instructions
arm-pe  +FAIL: MVE vctp instructions
arm-pe  +FAIL: MVE vcvt instructions, part 1
arm-pe  +FAIL: MVE vcvt instructions, part 2
arm-pe  +FAIL: MVE vcvt instructions, part 3
arm-pe  +FAIL: MVE vcvt instructions, part 4
arm-pe  +FAIL: Armv8.1-M Mainline vcvt instruction in it block (with MVE)
arm-pe  +FAIL: MVE vddup, vdwdup, vidup and viwdup instructions
arm-pe  +FAIL: MVE vdup instructions
arm-pe  +FAIL: MVE veor instructions
arm-pe  +FAIL: MVE vfma and vfms instructions
arm-pe  +FAIL: MVE vfmas instructions
arm-pe  +FAIL: MVE vhadd, vhsub and vhradd instructions
arm-pe  +FAIL: MVE vhcadd instructions
arm-pe  +FAIL: MVE vmax and vmin instructions
arm-pe  +FAIL: MVE vmaxa and vmina instructions
arm-pe  +FAIL: MVE vmaxnm, vmaxnma, vminnm and vminnma instructions, part 4
arm-pe  +FAIL: MVE vmaxnmv, vmaxnmav, vminnmv and vminnmav instructions
arm-pe  +FAIL: MVE vmaxv and vminv instructions
arm-pe  +FAIL: MVE vmla instructions
arm-pe  +FAIL: MVE vmladav instructions
arm-pe  +FAIL: MVE vmlaldav instructions
arm-pe  +FAIL: MVE vmlalv instructions
arm-pe  +FAIL: MVE vmlas instructions
arm-pe  +FAIL: MVE vmlav instructions
arm-pe  +FAIL: MVE vmlsdav instructions
arm-pe  +FAIL: MVE vmlsdav instructions
arm-pe  +FAIL: MVE vmov instructions (Integer)
arm-pe  +FAIL: MVE vmov instructions (Integer & FP)
arm-pe  +FAIL: MVE vmul instructions
arm-pe  +FAIL: MVE vmulh and vrmulh instructions
arm-pe  +FAIL: MVE vmull instructions
arm-pe  +FAIL: MVE vmvn instructions
arm-pe  +FAIL: MVE vorr instructions
arm-pe  +FAIL: MVE vorr instructions
arm-pe  +FAIL: MVE vpnot instructions
arm-pe  +FAIL: MVE vpsel instructions
arm-pe  +FAIL: MVE vpt and vpst instructions
arm-pe  +FAIL: MVE vqadd and vqsub instructions
arm-pe  +FAIL: MVE vqdmladh(x) and vqrdmladh(x) instructions
arm-pe  +FAIL: MVE vqdmlah and vqrdmlah instructions
arm-pe  +FAIL: MVE vqdmlash and vqrdmlash instructions
arm-pe  +FAIL: MVE vqdmlsdh(x) and vqrdmlsdh(x) instructions
arm-pe  +FAIL: MVE vqdmlash and vqrdmlash instructions
arm-pe  +FAIL: MVE vqdmullt and vqdmullb instructions
arm-pe  +FAIL: MVE vqmovnt, vqmovnb, vqmovunt and vqmovunb instructions
arm-pe  +FAIL: MVE vqrshl instructions
arm-pe  +FAIL: MVE vqrshrnt, vqrshrnb, vqrshrunt and vqrshrunb instructions
arm-pe  +FAIL: MVE vqshl and vqshlu instructions
arm-pe  +FAIL: MVE vrev16, vrev32 and vrev64 instructions
arm-pe  +FAIL: MVE vrint instructions
arm-pe  +FAIL: MVE vrmlaldavh(a)(x), vrmlalvh(a), vrmlsldavh(a)(x) instructions
arm-pe  +FAIL: MVE vrmlaldavh(a)(x), vrmlalvh(a), vrmlsldavh(a)(x) instructions
arm-pe  +FAIL: MVE vsbc instructions
arm-pe  +FAIL: MVE vshl instructions
arm-pe  +FAIL: MVE vshlc instructions
arm-pe  +FAIL: MVE vshllt and vshllb instructions
arm-pe  +FAIL: MVE vshr and vrshr instructions
arm-pe  +FAIL: MVE vshr and vrshr instructions
arm-pe  +FAIL: MVE vsli instructions
arm-pe  +FAIL: MVE vsri instructions
arm-pe  +FAIL: MVE vst2, vst4, vld2 and vld4 instructions
arm-pe  +FAIL: MVE vstr and vldr instructions, part 1
arm-pe  +FAIL: MVE vstr and vldr instructions, part 2
arm-pe  +FAIL: MVE vstr and vldr instructions, part 3
arm-pe  +FAIL: MVE fp context sensitive .arch_extension
arm-pe  +FAIL: Conditional Neon instructions
arm-pe  +FAIL: Neon floating-point constants
arm-pe  +FAIL: Neon instruction coverage
arm-pe  +FAIL: Neon FMA instruction coverage
arm-pe  +FAIL: Neon element and structure loads and stores
arm-pe  +FAIL: Neon logic insns with two and three operands including imm. values
arm-pe  +FAIL: Neon optional register operands
arm-pe  +FAIL: Neon programmers syntax
arm-pe  +FAIL: Armv8.1-M Mainline vadd/vsub instructions in it blocks (without MVE)
arm-pe  +FAIL: MINUS ZERO OFFSET
arm-pe  +FAIL: PR26858
arm-pe  +FAIL: Execution and Data Prediction Restriction instructions
arm-pe  +FAIL: Execution and Data Prediction Restriction instructions with +predres
arm-pe  +FAIL: PUSH and POP
arm-pe  +FAIL: SB instruction (Thumb)
arm-pe  +FAIL: SB instruction (Thumb) with +sb
arm-pe  +FAIL: SB instruction
arm-pe  +FAIL: SB instruction with +sb
arm-pe  +FAIL: STM and LDM
arm-pe  +FAIL: UAL vcmp with 0
arm-pe  +FAIL: VCVT
arm-pe  +FAIL: VFP check vmov supports integer immediates
arm-pe  +FAIL: VFP/Neon overlapping instructions
arm-pe  +FAIL: VFPv3 extra D registers
arm-pe  +FAIL: VFPv3 additional constant and conversion ops
arm-pe  +FAIL: VFP Double-precision load/store
arm-pe  +FAIL: pr26103
arm-symbianelf  +FAIL: R_ARM_GOT_PREL relocation
arm-symbianelf  +FAIL: ARM Mapping Symbols for .arm/.thumb
arm-symbianelf  +FAIL: ARM Mapping Symbols for miscellaneous directives
arm-symbianelf  +FAIL: ARM Mapping Symbols
arm-symbianelf  +FAIL: ARM Mapping Symbols Test 2
arm-symbianelf  +FAIL: ARM Mapping Symbols Test 3
arm-symbianelf  +FAIL: ARM Mapping Symbols Test 4
arm-symbianelf  +FAIL: ARM Mapping Symbols with multiple sections
arm-symbianelf  +FAIL: ARM Mapping Symbols for .short (EABI version)
arm-symbianelf  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-symbianelf  +FAIL: gas/arm/thumbver
arm-symbianelf  +FAIL: elf section2 list
arm-symbianelf  +FAIL: Data only mapping symbols for merged sections
arm-vxworks  +FAIL: ARM Mapping Symbols
arm-vxworks  +FAIL: ARM Mapping Symbols Test 2
arm-vxworks  +FAIL: ARM Mapping Symbols Test 3
arm-vxworks  +FAIL: ARM Mapping Symbols Test 4
arm-vxworks  +FAIL: ARM Mapping Symbols for .short (ELF version)
arm-vxworks  +FAIL: gas/arm/thumbver
arm-wince-pe  +FAIL: ARMv6T2 THUMB mode
arm-wince-pe  +FAIL: ARMv6T2 ARM mode
arm-wince-pe  +FAIL: ARM Integer division instructions
arm-wince-pe  +FAIL: Valid v8-A barrier (ARM)
arm-wince-pe  +FAIL: Valid v8-R barrier (ARM)
arm-wince-pe  +FAIL: Make sure .fpu does not reset MVE feature bits
arm-wince-pe  +FAIL: Make sure .fpu does not reset MVE feature bits but still adds extra bits
arm-wince-pe  +FAIL: Barrier Instruction Operands
arm-wince-pe  +FAIL: Half-precision neon instructions
arm-wince-pe  +FAIL: Half-precision instructions (programmer's syntax)
arm-wince-pe  +FAIL: Half-precision vfpv3 instructions
arm-wince-pe  +FAIL: ldr - arm
arm-wince-pe  +FAIL: ARM load/store with pc base register
arm-wince-pe  +FAIL: ARM local label relocs to section symbol relocs (WinCE)
arm-wince-pe  +FAIL: Load pseudo-operation for Cortex-M0
arm-wince-pe  +FAIL: Load pseudo-operation for Cortex-M23
arm-wince-pe  +FAIL: Load pseudo-operation for Cortex-M33
arm-wince-pe  +FAIL: MRS/MSR test, architecture v6, ARM mode
arm-wince-pe  +FAIL: MRS/MSR test, architecture v7-A, ARM mode
arm-wince-pe  +FAIL: MSR immediate operands
arm-wince-pe  +FAIL: MSR register operands
arm-wince-pe  +FAIL: MVE context sensitive .arch_extension under no -march
arm-wince-pe  +FAIL: MVE context sensitive .arch_extension
arm-wince-pe  +FAIL: MVE Floating point load multiple and store multiple instructions.
arm-wince-pe  +FAIL: Armv8.1-M Mainline scalar vmul instructions in it blocks (with MVE)
arm-wince-pe  +FAIL: MVE vabs and vneg instructions
arm-wince-pe  +FAIL: MVE vabd instructions
arm-wince-pe  +FAIL: MVE vabs and vneg instructions
arm-wince-pe  +FAIL: MVE vadc instructions
arm-wince-pe  +FAIL: MVE vaddlv instructions
arm-wince-pe  +FAIL: Armv8.1-M Mainline vadd/vsub instructions in it blocks (with MVE)
arm-wince-pe  +FAIL: MVE vadd and vsub instructions
arm-wince-pe  +FAIL: MVE vaddv instructions
arm-wince-pe  +FAIL: MVE vand instructions
arm-wince-pe  +FAIL: MVE vbic instructions
arm-wince-pe  +FAIL: MVE vbrsr instructions
arm-wince-pe  +FAIL: MVE vcadd instructions
arm-wince-pe  +FAIL: MVE vcls instructions
arm-wince-pe  +FAIL: MVE vclz instructions
arm-wince-pe  +FAIL: MVE vcmla instructions
arm-wince-pe  +FAIL: MVE vcmp instructions
arm-wince-pe  +FAIL: MVE vcmul instructions
arm-wince-pe  +FAIL: MVE vctp instructions
arm-wince-pe  +FAIL: MVE vcvt instructions, part 1
arm-wince-pe  +FAIL: MVE vcvt instructions, part 2
arm-wince-pe  +FAIL: MVE vcvt instructions, part 3
arm-wince-pe  +FAIL: MVE vcvt instructions, part 4
arm-wince-pe  +FAIL: Armv8.1-M Mainline vcvt instruction in it block (with MVE)
arm-wince-pe  +FAIL: MVE vddup, vdwdup, vidup and viwdup instructions
arm-wince-pe  +FAIL: MVE vdup instructions
arm-wince-pe  +FAIL: MVE veor instructions
arm-wince-pe  +FAIL: MVE vfma and vfms instructions
arm-wince-pe  +FAIL: MVE vfmas instructions
arm-wince-pe  +FAIL: MVE vhadd, vhsub and vhradd instructions
arm-wince-pe  +FAIL: MVE vhcadd instructions
arm-wince-pe  +FAIL: MVE vmax and vmin instructions
arm-wince-pe  +FAIL: MVE vmaxa and vmina instructions
arm-wince-pe  +FAIL: MVE vmaxnm, vmaxnma, vminnm and vminnma instructions, part 4
arm-wince-pe  +FAIL: MVE vmaxnmv, vmaxnmav, vminnmv and vminnmav instructions
arm-wince-pe  +FAIL: MVE vmaxv and vminv instructions
arm-wince-pe  +FAIL: MVE vmla instructions
arm-wince-pe  +FAIL: MVE vmladav instructions
arm-wince-pe  +FAIL: MVE vmlaldav instructions
arm-wince-pe  +FAIL: MVE vmlalv instructions
arm-wince-pe  +FAIL: MVE vmlas instructions
arm-wince-pe  +FAIL: MVE vmlav instructions
arm-wince-pe  +FAIL: MVE vmlsdav instructions
arm-wince-pe  +FAIL: MVE vmlsdav instructions
arm-wince-pe  +FAIL: MVE vmov instructions (Integer)
arm-wince-pe  +FAIL: MVE vmov instructions (Integer & FP)
arm-wince-pe  +FAIL: MVE vmul instructions
arm-wince-pe  +FAIL: MVE vmulh and vrmulh instructions
arm-wince-pe  +FAIL: MVE vmull instructions
arm-wince-pe  +FAIL: MVE vmvn instructions
arm-wince-pe  +FAIL: MVE vorr instructions
arm-wince-pe  +FAIL: MVE vorr instructions
arm-wince-pe  +FAIL: MVE vpnot instructions
arm-wince-pe  +FAIL: MVE vpsel instructions
arm-wince-pe  +FAIL: MVE vpt and vpst instructions
arm-wince-pe  +FAIL: MVE vqadd and vqsub instructions
arm-wince-pe  +FAIL: MVE vqdmladh(x) and vqrdmladh(x) instructions
arm-wince-pe  +FAIL: MVE vqdmlah and vqrdmlah instructions
arm-wince-pe  +FAIL: MVE vqdmlash and vqrdmlash instructions
arm-wince-pe  +FAIL: MVE vqdmlsdh(x) and vqrdmlsdh(x) instructions
arm-wince-pe  +FAIL: MVE vqdmlash and vqrdmlash instructions
arm-wince-pe  +FAIL: MVE vqdmullt and vqdmullb instructions
arm-wince-pe  +FAIL: MVE vqmovnt, vqmovnb, vqmovunt and vqmovunb instructions
arm-wince-pe  +FAIL: MVE vqrshl instructions
arm-wince-pe  +FAIL: MVE vqrshrnt, vqrshrnb, vqrshrunt and vqrshrunb instructions
arm-wince-pe  +FAIL: MVE vqshl and vqshlu instructions
arm-wince-pe  +FAIL: MVE vrev16, vrev32 and vrev64 instructions
arm-wince-pe  +FAIL: MVE vrint instructions
arm-wince-pe  +FAIL: MVE vrmlaldavh(a)(x), vrmlalvh(a), vrmlsldavh(a)(x) instructions
arm-wince-pe  +FAIL: MVE vrmlaldavh(a)(x), vrmlalvh(a), vrmlsldavh(a)(x) instructions
arm-wince-pe  +FAIL: MVE vsbc instructions
arm-wince-pe  +FAIL: MVE vshl instructions
arm-wince-pe  +FAIL: MVE vshlc instructions
arm-wince-pe  +FAIL: MVE vshllt and vshllb instructions
arm-wince-pe  +FAIL: MVE vshr and vrshr instructions
arm-wince-pe  +FAIL: MVE vshr and vrshr instructions
arm-wince-pe  +FAIL: MVE vsli instructions
arm-wince-pe  +FAIL: MVE vsri instructions
arm-wince-pe  +FAIL: MVE vst2, vst4, vld2 and vld4 instructions
arm-wince-pe  +FAIL: MVE vstr and vldr instructions, part 1
arm-wince-pe  +FAIL: MVE vstr and vldr instructions, part 2
arm-wince-pe  +FAIL: MVE vstr and vldr instructions, part 3
arm-wince-pe  +FAIL: MVE fp context sensitive .arch_extension
arm-wince-pe  +FAIL: Conditional Neon instructions
arm-wince-pe  +FAIL: Neon floating-point constants
arm-wince-pe  +FAIL: Neon instruction coverage
arm-wince-pe  +FAIL: Neon FMA instruction coverage
arm-wince-pe  +FAIL: Neon element and structure loads and stores
arm-wince-pe  +FAIL: Neon logic insns with two and three operands including imm. values
arm-wince-pe  +FAIL: Neon optional register operands
arm-wince-pe  +FAIL: Neon programmers syntax
arm-wince-pe  +FAIL: Armv8.1-M Mainline vadd/vsub instructions in it blocks (without MVE)
arm-wince-pe  +FAIL: MINUS ZERO OFFSET
arm-wince-pe  +FAIL: PR26858
arm-wince-pe  +FAIL: Execution and Data Prediction Restriction instructions
arm-wince-pe  +FAIL: Execution and Data Prediction Restriction instructions with +predres
arm-wince-pe  +FAIL: PUSH and POP
arm-wince-pe  +FAIL: SB instruction (Thumb)
arm-wince-pe  +FAIL: SB instruction (Thumb) with +sb
arm-wince-pe  +FAIL: SB instruction
arm-wince-pe  +FAIL: SB instruction with +sb
arm-wince-pe  +FAIL: STM and LDM
arm-wince-pe  +FAIL: UAL vcmp with 0
arm-wince-pe  +FAIL: VCVT
arm-wince-pe  +FAIL: VFP check vmov supports integer immediates
arm-wince-pe  +FAIL: VFP/Neon overlapping instructions
arm-wince-pe  +FAIL: VFPv3 extra D registers
arm-wince-pe  +FAIL: VFPv3 additional constant and conversion ops
arm-wince-pe  +FAIL: VFP Double-precision load/store
arm-wince-pe  +FAIL: pr26103
bfin-elf  +FAIL: loop_temps
bfin-linux-uclibc  +FAIL: loop_temps
cris-elf  +FAIL: gas/cris/rd-bcnst-pic
cris-elf  +FAIL: ld-cris/libdso-2
cris-elf  +FAIL: ld-cris/dso12-pltdis
cris-elf  +FAIL: ld-cris/hiddef1
cris-elf  +FAIL: ld-cris/tls-e-20
cris-elf  +FAIL: ld-cris/tls-e-20a
cris-elf  +FAIL: ld-cris/tls-e-80
cris-elf  +FAIL: ld-cris/tls-e-tpoffcomm1
cris-elf  +FAIL: ld-cris/tls-gc-68
cris-elf  +FAIL: ld-cris/tls-gc-69
cris-elf  +FAIL: ld-cris/tls-gc-70
cris-elf  +FAIL: ld-cris/tls-gc-75
cris-elf  +FAIL: ld-cris/tls-gc-76
cris-elf  +FAIL: ld-cris/tls-gc-79
cris-elf  +FAIL: ld-cris/tls-local-63
cris-elf  +FAIL: ld-cris/tls-und-38
cris-elf  +FAIL: ld-cris/tls-und-42
cris-elf  +FAIL: ld-cris/tls-und-46
cris-elf  +FAIL: ld-cris/tls-und-50
cris-linux  +FAIL: gas/cris/rd-bcnst-pic
cris-linux  +FAIL: ld-cris/libdso-2
cris-linux  +FAIL: ld-cris/dso12-pltdis
cris-linux  +FAIL: ld-cris/hiddef1
cris-linux  +FAIL: ld-cris/tls-e-20
cris-linux  +FAIL: ld-cris/tls-e-20a
cris-linux  +FAIL: ld-cris/tls-e-80
cris-linux  +FAIL: ld-cris/tls-e-tpoffcomm1
cris-linux  +FAIL: ld-cris/tls-gc-68
cris-linux  +FAIL: ld-cris/tls-gc-69
cris-linux  +FAIL: ld-cris/tls-gc-70
cris-linux  +FAIL: ld-cris/tls-gc-75
cris-linux  +FAIL: ld-cris/tls-gc-76
cris-linux  +FAIL: ld-cris/tls-gc-79
cris-linux  +FAIL: ld-cris/tls-local-63
cris-linux  +FAIL: ld-cris/tls-und-38
cris-linux  +FAIL: ld-cris/tls-und-42
cris-linux  +FAIL: ld-cris/tls-und-46
cris-linux  +FAIL: ld-cris/tls-und-50
csky-elf  +FAIL: elf section2 list
csky-linux  +FAIL: elf section2 list
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols, static linking
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols, pie linking
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to global symbols, static linking
frv-elf  +FAIL: FRV uClinux PIC relocs to global symbols, pie linking
frv-elf  +FAIL: FRV uClinux PIC relocs to (mostly) global symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to forced-local symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to hidden symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to protected symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to undefined symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, static linking
frv-elf  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, pie linking
frv-elf  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols with addends, static linking
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols with addends, pie linking
frv-elf  +FAIL: FRV uClinux PIC relocs to local symbols with addends, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to global symbols with addends, static linking
frv-elf  +FAIL: FRV uClinux PIC relocs to global symbols with addends, pie linking
frv-elf  +FAIL: FRV uClinux PIC relocs to (mostly) global symbols with addends, shared linking
frv-elf  +FAIL: FRV uClinux PIC relocs to forced-local symbols with addends, shared linking
frv-elf  +FAIL: FRV TLS relocs, static linking
frv-elf  +FAIL: FRV TLS relocs, dynamic linking
frv-elf  +FAIL: FRV TLS relocs, pie linking
frv-elf  +FAIL: FRV TLS relocs, shared linking with local binding
frv-elf  +FAIL: FRV TLS relocs, shared linking with relaxation
frv-elf  +FAIL: FRV TLS relocs with addends, dynamic linking
frv-elf  +FAIL: FRV TLS relocs with addends, shared linking
frv-elf  +FAIL: FRV TLS relocs with addends, shared linking with static TLS
frv-elf  +FAIL: FRV TLS relocs with addends, dynamic linking, relaxing
frv-elf  +FAIL: FRV TLS relocs with addends, shared linking, relaxing
frv-elf  +FAIL: FRV TLS relocs with addends, shared linking with static TLS, relaxing
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols, static linking
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols, pie linking
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to global symbols, static linking
frv-linux  +FAIL: FRV uClinux PIC relocs to global symbols, pie linking
frv-linux  +FAIL: FRV uClinux PIC relocs to (mostly) global symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to forced-local symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to hidden symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to protected symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to undefined symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, static linking
frv-linux  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, pie linking
frv-linux  +FAIL: FRV uClinux PIC relocs to weak undefined symbols, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols with addends, static linking
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols with addends, pie linking
frv-linux  +FAIL: FRV uClinux PIC relocs to local symbols with addends, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to global symbols with addends, static linking
frv-linux  +FAIL: FRV uClinux PIC relocs to global symbols with addends, pie linking
frv-linux  +FAIL: FRV uClinux PIC relocs to (mostly) global symbols with addends, shared linking
frv-linux  +FAIL: FRV uClinux PIC relocs to forced-local symbols with addends, shared linking
frv-linux  +FAIL: FRV TLS relocs, static linking
frv-linux  +FAIL: FRV TLS relocs, dynamic linking
frv-linux  +FAIL: FRV TLS relocs, pie linking
frv-linux  +FAIL: FRV TLS relocs, shared linking with local binding
frv-linux  +FAIL: FRV TLS relocs, shared linking with relaxation
frv-linux  +FAIL: FRV TLS relocs with addends, dynamic linking
frv-linux  +FAIL: FRV TLS relocs with addends, shared linking
frv-linux  +FAIL: FRV TLS relocs with addends, shared linking with static TLS
frv-linux  +FAIL: FRV TLS relocs with addends, dynamic linking, relaxing
frv-linux  +FAIL: FRV TLS relocs with addends, shared linking, relaxing
frv-linux  +FAIL: FRV TLS relocs with addends, shared linking with static TLS, relaxing
ft32-elf  +FAIL: insnsc
i386-lynxos  +FAIL: SVR4 comment char escape handling
i686-nto  +FAIL: SVR4 comment char escape handling
i686-pc-elf  +FAIL: SVR4 comment char escape handling
i686-pe  +FAIL: cofftag
i686-pe  +FAIL: pr26103
i686-vxworks  +FAIL: SVR4 comment char escape handling
ia64-elf  +FAIL: ia64 global label
ia64-elf  +FAIL: ia64 section name
ia64-elf  +FAIL: ia64 unwind section
ia64-elf  +FAIL: ia64 alias and secalias
ia64-elf  +FAIL: ia64 xdata
ia64-elf  +FAIL: ia64 group
ia64-elf  +FAIL: ia64 unwind group
ia64-elf  +FAIL: TLS -fpic -shared
ia64-elf  +FAIL: TLS -fpic and -fno-pic exec
ia64-elf  +FAIL: ld-ia64/merge1
ia64-elf  +FAIL: ld-ia64/merge2
ia64-elf  +FAIL: ld-ia64/merge3
ia64-elf  +FAIL: ld-ia64/merge4
ia64-elf  +FAIL: ld-ia64/merge5
ia64-freebsd5  +FAIL: ia64 global label
ia64-freebsd5  +FAIL: ia64 section name
ia64-freebsd5  +FAIL: ia64 unwind section
ia64-freebsd5  +FAIL: ia64 alias and secalias
ia64-freebsd5  +FAIL: ia64 xdata
ia64-freebsd5  +FAIL: ia64 group
ia64-freebsd5  +FAIL: ia64 unwind group
ia64-hpux  +FAIL: ia64 global label
ia64-hpux  +FAIL: ia64 section name (ilp32)
ia64-hpux  +FAIL: ia64 unwind section (ilp32)
ia64-hpux  +FAIL: ia64 alias and secalias (ilp32)
ia64-linux  +FAIL: ia64 global label
ia64-linux  +FAIL: ia64 section name
ia64-linux  +FAIL: ia64 unwind section
ia64-linux  +FAIL: ia64 alias and secalias
ia64-linux  +FAIL: ia64 xdata
ia64-linux  +FAIL: ia64 group
ia64-linux  +FAIL: ia64 unwind group
ia64-linux  +FAIL: TLS -fpic -shared
ia64-linux  +FAIL: TLS -fpic and -fno-pic exec
ia64-linux  +FAIL: ld-ia64/merge1
ia64-linux  +FAIL: ld-ia64/merge2
ia64-linux  +FAIL: ld-ia64/merge3
ia64-linux  +FAIL: ld-ia64/merge4
ia64-linux  +FAIL: ld-ia64/merge5
ia64-netbsd  +FAIL: ia64 global label
ia64-netbsd  +FAIL: ia64 section name
ia64-netbsd  +FAIL: ia64 unwind section
ia64-netbsd  +FAIL: ia64 alias and secalias
ia64-netbsd  +FAIL: ia64 xdata
ia64-netbsd  +FAIL: ia64 group
ia64-netbsd  +FAIL: ia64 unwind group
m32r-elf  +FAIL: elf section2 list
m32r-linux  +FAIL: elf section2 list
m68hc11-elf  +FAIL: verify hex prefixes present and not duplicated (hexprefix)
m68hc12-elf  +FAIL: verify hex prefixes present and not duplicated (hexprefix)
m68k-elf  +FAIL: PLT 1a (68020)
m68k-elf  +FAIL: PLT 1a (cpu32)
m68k-elf  +FAIL: PLT 1a (isab)
m68k-elf  +FAIL: PLT 1a (isac)
m68k-elf  +FAIL: PLT 1b (68020)
m68k-elf  +FAIL: PLT 1b (cpu32)
m68k-elf  +FAIL: PLT 1b (isab)
m68k-elf  +FAIL: PLT 1b (isac)
m68k-linux  +FAIL: PLT 1a (68020)
m68k-linux  +FAIL: PLT 1a (cpu32)
m68k-linux  +FAIL: PLT 1a (isab)
m68k-linux  +FAIL: PLT 1a (isac)
m68k-linux  +FAIL: PLT 1b (68020)
m68k-linux  +FAIL: PLT 1b (cpu32)
m68k-linux  +FAIL: PLT 1b (isab)
m68k-linux  +FAIL: PLT 1b (isac)
mcore-pe  +FAIL: cofftag
mcore-pe  +FAIL: pr26103
metag-linux  +FAIL: Simple PIC shared library
metag-linux  +FAIL: Long branch stub (PIC, app)
microblaze-elf  +FAIL: matching relax_size.elf
microblaze-elf  +FAIL: matching relax_size2.elf
mips64el-openbsd  +FAIL: MIPS global/local symbol table split (n64)
mips64el-openbsd  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mips64el-openbsd  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips64el-openbsd  +FAIL: elf section2 list
mips64el-openbsd  +FAIL: MIPS16 reloc
mips64el-openbsd  +FAIL: MIPS16 reloc 2
mips64el-openbsd  +FAIL: MIPS .insn default file options
mips64el-openbsd  +FAIL: MIPS global/local symbol table split (o32)
mips64el-openbsd  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mips64el-openbsd  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips64-linux  +FAIL: MIPS global/local symbol table split (o32)
mips64-linux  +FAIL: MIPS global/local symbol table split (n32)
mips64-linux  +FAIL: MIPS global/local symbol table split (n64)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips64-linux  +FAIL: elf section2 list
mips64-linux  +FAIL: MIPS16 reloc
mips64-linux  +FAIL: MIPS16 reloc 2
mips64-linux  +FAIL: MIPS .insn default file options
mips64-linux  +FAIL: MIPS global/local symbol table split (o32)
mips64-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mips64-linux  +FAIL: MIPS global/local symbol table split (n32)
mips64-linux  +FAIL: MIPS global/local symbol table split (n64)
mips64-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n32)
mips64-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n64)
mips64-linux  +FAIL: o32 PLTs for MIPS16 branches
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips64-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips64-openbsd  +FAIL: MIPS global/local symbol table split (n64)
mips64-openbsd  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mips64-openbsd  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips64-openbsd  +FAIL: elf section2 list
mips64-openbsd  +FAIL: MIPS16 reloc
mips64-openbsd  +FAIL: MIPS16 reloc 2
mips64-openbsd  +FAIL: MIPS .insn default file options
mips64-openbsd  +FAIL: MIPS global/local symbol table split (o32)
mips64-openbsd  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mips64-openbsd  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (o32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (n32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (n64)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mipsel-linux-gnu  +FAIL: elf section2 list
mipsel-linux-gnu  +FAIL: MIPS16 reloc
mipsel-linux-gnu  +FAIL: MIPS16 reloc 2
mipsel-linux-gnu  +FAIL: MIPS .insn default file options
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (o32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (n32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table split (n64)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table sort and section symbol names (n32)
mipsel-linux-gnu  +FAIL: MIPS global/local symbol table sort and section symbol names (n64)
mipsel-linux-gnu  +FAIL: o32 PLTs for MIPS16 branches
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsel-linux-gnu  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (o32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (n32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (n64)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mipsisa32el-linux  +FAIL: elf section2 list
mipsisa32el-linux  +FAIL: MIPS16 reloc
mipsisa32el-linux  +FAIL: MIPS16 reloc 2
mipsisa32el-linux  +FAIL: MIPS .insn default file options
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (o32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (n32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table split (n64)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n32)
mipsisa32el-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n64)
mipsisa32el-linux  +FAIL: o32 PLTs for MIPS16 branches
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mipsisa32el-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips-linux  +FAIL: MIPS global/local symbol table split (o32)
mips-linux  +FAIL: MIPS global/local symbol table split (n32)
mips-linux  +FAIL: MIPS global/local symbol table split (n64)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips-linux  +FAIL: elf section2 list
mips-linux  +FAIL: MIPS16 reloc
mips-linux  +FAIL: MIPS16 reloc 2
mips-linux  +FAIL: MIPS .insn default file options
mips-linux  +FAIL: MIPS global/local symbol table split (o32)
mips-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mips-linux  +FAIL: MIPS global/local symbol table split (n32)
mips-linux  +FAIL: MIPS global/local symbol table split (n64)
mips-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n32)
mips-linux  +FAIL: MIPS global/local symbol table sort and section symbol names (n64)
mips-linux  +FAIL: o32 PLTs for MIPS16 branches
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-linux  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (o32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (n32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (n64)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (n64)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mips-sgi-irix6  +FAIL: MIPS .insn default file options
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (o32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (n32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table split (n64)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table sort and section symbol names (n32)
mips-sgi-irix6  +FAIL: MIPS global/local symbol table sort and section symbol names (n64)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mips-sgi-irix6  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n64)
mipstx39-elf  +FAIL: MIPS global/local symbol table split (o32)
mipstx39-elf  +FAIL: MIPS symbol table sort and section symbol names (relocatable) (o32)
mipstx39-elf  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (o32)
mipstx39-elf  +FAIL: elf section2 list
mipstx39-elf  +FAIL: MIPS16 reloc
mipstx39-elf  +FAIL: MIPS16 reloc 2
mipstx39-elf  +FAIL: MIPS .insn default file options
mipstx39-elf  +FAIL: MIPS global/local symbol table split (o32)
mipstx39-elf  +FAIL: MIPS global/local symbol table sort and section symbol names (o32)
mipstx39-elf  +FAIL: MIPS symbol table sort and section symbol names (fully linked) (n32)
mmix  +FAIL: gas/mmix/align-1
mmix  +FAIL: gas/mmix/basep-1
mmix  +FAIL: gas/mmix/basep-10
mmix  +FAIL: gas/mmix/basep-11
mmix  +FAIL: gas/mmix/basep-1b
mmix  +FAIL: gas/mmix/basep-2
mmix  +FAIL: gas/mmix/basep-2b
mmix  +FAIL: gas/mmix/basep-3
mmix  +FAIL: gas/mmix/basep-3b
mmix  +FAIL: gas/mmix/basep-7
mmix  +FAIL: gas/mmix/basep-8
mmix  +FAIL: gas/mmix/basep-9
mmix  +FAIL: gas/mmix/bspec-1
mmix  +FAIL: gas/mmix/bspec-2
mmix  +FAIL: gas/mmix/builtin1
mmix  +FAIL: gas/mmix/builtin2
mmix  +FAIL: gas/mmix/builtin3
mmix  +FAIL: gas/mmix/byte-1
mmix  +FAIL: gas/mmix/bz-c
mmix  +FAIL: gas/mmix/comment-1
mmix  +FAIL: gas/mmix/comment-2
mmix  +FAIL: gas/mmix/comment-3
mmix  +FAIL: gas/mmix/cons-2
mmix  +FAIL: gas/mmix/fb-1
mmix  +FAIL: gas/mmix/fb-2
mmix  +FAIL: gas/mmix/geta-c
mmix  +FAIL: gas/mmix/greg1
mmix  +FAIL: gas/mmix/greg1a
mmix  +FAIL: gas/mmix/greg2
mmix  +FAIL: gas/mmix/greg2a
mmix  +FAIL: gas/mmix/greg3
mmix  +FAIL: gas/mmix/greg4
mmix  +FAIL: gas/mmix/greg5
mmix  +FAIL: gas/mmix/greg6
mmix  +FAIL: gas/mmix/greg7
mmix  +FAIL: gas/mmix/greg8
mmix  +FAIL: gas/mmix/is-1
mmix  +FAIL: gas/mmix/jump-c
mmix  +FAIL: gas/mmix/loc-1
mmix  +FAIL: gas/mmix/loc-2
mmix  +FAIL: gas/mmix/loc-3
mmix  +FAIL: gas/mmix/loc-4
mmix  +FAIL: gas/mmix/loc-5
mmix  +FAIL: gas/mmix/local-1
mmix  +FAIL: gas/mmix/locall1
mmix  +FAIL: gas/mmix/odd-1
mmix  +FAIL: gas/mmix/op-0-1
mmix  +FAIL: gas/mmix/op-0-1s
mmix  +FAIL: gas/mmix/op-0-2
mmix  +FAIL: gas/mmix/prefix1
mmix  +FAIL: gas/mmix/prefix2
mmix  +FAIL: gas/mmix/prefix3
mmix  +FAIL: gas/mmix/pseudo-1
mmix  +FAIL: gas/mmix/pushj-c
mmix  +FAIL: gas/mmix/pushj-cs
mmix  +FAIL: gas/mmix/sym-1
mmix  +FAIL: gas/mmix/weak1-s
mmix  +FAIL: gas/mmix/weak1
mmix  +FAIL: gas/mmix/zerop-1
mmix  +FAIL: ld-mmix/bpo-1
mmix  +FAIL: ld-mmix/bpo-10
mmix  +FAIL: ld-mmix/bpo-11
mmix  +FAIL: ld-mmix/bpo-14
mmix  +FAIL: ld-mmix/bpo-16
mmix  +FAIL: ld-mmix/bpo-17
mmix  +FAIL: ld-mmix/bpo-18
mmix  +FAIL: ld-mmix/bpo-19
mmix  +FAIL: ld-mmix/bpo-2
mmix  +FAIL: ld-mmix/bpo-22
mmix  +FAIL: ld-mmix/bpo-3
mmix  +FAIL: ld-mmix/bpo-4
mmix  +FAIL: ld-mmix/bpo-5
mmix  +FAIL: ld-mmix/bpo-6
mmix  +FAIL: ld-mmix/bpo-9
mmix  +FAIL: ld-mmix/bspec1
mmix  +FAIL: ld-mmix/bspec2
mmix  +FAIL: ld-mmix/greg-1
mmix  +FAIL: ld-mmix/greg-19
mmix  +FAIL: ld-mmix/greg-2
mmix  +FAIL: ld-mmix/greg-3
mmix  +FAIL: ld-mmix/greg-4
mmix  +FAIL: ld-mmix/greg-5
mmix  +FAIL: ld-mmix/greg-5s
mmix  +FAIL: ld-mmix/greg-6
mmix  +FAIL: ld-mmix/greg-7
mmix  +FAIL: ld-mmix/loc1
mmix  +FAIL: ld-mmix/loc2
mmix  +FAIL: ld-mmix/loc3
mmix  +FAIL: ld-mmix/loc4
mmix  +FAIL: ld-mmix/loc6
mmix  +FAIL: ld-mmix/local1
mmix  +FAIL: ld-mmix/local3
mmix  +FAIL: ld-mmix/local5
mmix  +FAIL: ld-mmix/local5m
mmix  +FAIL: ld-mmix/local7
mmix  +FAIL: ld-mmix/local7m
mmix  +FAIL: ld-mmix/local8
mmix  +FAIL: ld-mmix/local8m
mmix  +FAIL: ld-mmix/locdo-1
mmix  +FAIL: ld-mmix/loct-1
mmix  +FAIL: ld-mmix/locto-1
mmix  +FAIL: ld-mmix/start-1
mmix  +FAIL: ld-mmix/undef-3
mn10300-elf  +FAIL: readelf -n version (reason: unexpected output)
msp430-elf  +FAIL: elf section2 list
or1k-linux  +FAIL: PLTA -fpic -shared
or1k-linux  +FAIL: PLT -fpic -shared
or1k-linux  +FAIL: PLT -fno-pic exec -relax
powerpc64-freebsd  +FAIL: PowerPC Test 1, 64 bit elf
powerpc64-freebsd  +FAIL: Power4 instructions
powerpc64-freebsd  +FAIL: TLS32 dynamic exec
powerpc64-freebsd  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc64-freebsd  +FAIL: TLS32 shared
powerpc64-freebsd  +FAIL: TLS static exec (markers)
powerpc64-freebsd  +FAIL: TLS static exec
powerpc64-freebsd  +FAIL: TLS static exec (--no-tls-optimize)
powerpc64-freebsd  +FAIL: TLS dynamic exec
powerpc64-freebsd  +FAIL: TLS dynamic old
powerpc64-freebsd  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc64-freebsd  +FAIL: TLS shared
powerpc64-freebsd  +FAIL: TLSTOC dynamic exec
powerpc64-freebsd  +FAIL: TLSTOC dynamic old
powerpc64-freebsd  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc64-freebsd  +FAIL: TLSTOC shared
powerpc64-freebsd  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc64-freebsd  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64-freebsd  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc64-freebsd  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64-freebsd  +FAIL: TLS opt 1
powerpc64-freebsd  +FAIL: TLS opt 2
powerpc64-freebsd  +FAIL: TLS opt 3
powerpc64-freebsd  +FAIL: TLS opt 4
powerpc64-freebsd  +FAIL: tlsget
powerpc64-freebsd  +FAIL: tlsget2
powerpc64-freebsd  +FAIL: tocsave1 shared
powerpc64-freebsd  +FAIL: tocsave1 static
powerpc64-freebsd  +FAIL: ld-powerpc/relbrlt
powerpc64le-linux  +FAIL: PowerPC Test 1, 64 bit elf
powerpc64le-linux  +FAIL: Power4 instructions
powerpc64le-linux  +FAIL: TLS32 dynamic exec
powerpc64le-linux  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc64le-linux  +FAIL: TLS32 shared
powerpc64le-linux  +FAIL: TLS static exec (markers)
powerpc64le-linux  +FAIL: TLS static exec
powerpc64le-linux  +FAIL: TLS static exec (--no-tls-optimize)
powerpc64le-linux  +FAIL: TLS dynamic exec
powerpc64le-linux  +FAIL: TLS dynamic old
powerpc64le-linux  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc64le-linux  +FAIL: TLS shared
powerpc64le-linux  +FAIL: TLSTOC dynamic exec
powerpc64le-linux  +FAIL: TLSTOC dynamic old
powerpc64le-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc64le-linux  +FAIL: TLSTOC shared
powerpc64le-linux  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc64le-linux  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64le-linux  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc64le-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64le-linux  +FAIL: TLS opt 1
powerpc64le-linux  +FAIL: TLS opt 2
powerpc64le-linux  +FAIL: TLS opt 3
powerpc64le-linux  +FAIL: TLS opt 4
powerpc64le-linux  +FAIL: tlsget
powerpc64le-linux  +FAIL: tlsget2
powerpc64le-linux  +FAIL: tocsave1 shared
powerpc64le-linux  +FAIL: tocsave1 static
powerpc64le-linux  +FAIL: ld-powerpc/relbrlt
powerpc64-linux  +FAIL: PowerPC Test 1, 64 bit elf
powerpc64-linux  +FAIL: Power4 instructions
powerpc64-linux  +FAIL: TLS32 dynamic exec
powerpc64-linux  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc64-linux  +FAIL: TLS32 shared
powerpc64-linux  +FAIL: TLS static exec (markers)
powerpc64-linux  +FAIL: TLS static exec
powerpc64-linux  +FAIL: TLS static exec (--no-tls-optimize)
powerpc64-linux  +FAIL: TLS dynamic exec
powerpc64-linux  +FAIL: TLS dynamic old
powerpc64-linux  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc64-linux  +FAIL: TLS shared
powerpc64-linux  +FAIL: TLSTOC dynamic exec
powerpc64-linux  +FAIL: TLSTOC dynamic old
powerpc64-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc64-linux  +FAIL: TLSTOC shared
powerpc64-linux  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc64-linux  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64-linux  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc64-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc64-linux  +FAIL: TLS opt 1
powerpc64-linux  +FAIL: TLS opt 2
powerpc64-linux  +FAIL: TLS opt 3
powerpc64-linux  +FAIL: TLS opt 4
powerpc64-linux  +FAIL: tlsget
powerpc64-linux  +FAIL: tlsget2
powerpc64-linux  +FAIL: tocsave1 shared
powerpc64-linux  +FAIL: tocsave1 static
powerpc64-linux  +FAIL: ld-powerpc/relbrlt
powerpc-eabisim  +FAIL: PowerPC Test 1, 32 bit elf
powerpc-eabisim  +FAIL: TLS32 dynamic exec
powerpc-eabisim  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc-eabisim  +FAIL: TLS32 shared
powerpc-eabisim  +FAIL: TLS static exec (markers)
powerpc-eabisim  +FAIL: TLS static exec
powerpc-eabisim  +FAIL: TLS static exec (--no-tls-optimize)
powerpc-eabisim  +FAIL: TLS dynamic exec
powerpc-eabisim  +FAIL: TLS dynamic old
powerpc-eabisim  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc-eabisim  +FAIL: TLS shared
powerpc-eabisim  +FAIL: TLSTOC dynamic exec
powerpc-eabisim  +FAIL: TLSTOC dynamic old
powerpc-eabisim  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc-eabisim  +FAIL: TLSTOC shared
powerpc-eabisim  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc-eabisim  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-eabisim  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc-eabisim  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-eabisim  +FAIL: TLS opt 1
powerpc-eabisim  +FAIL: TLS opt 2
powerpc-eabisim  +FAIL: TLS opt 3
powerpc-eabisim  +FAIL: TLS opt 4
powerpc-eabisim  +FAIL: tlsget
powerpc-eabisim  +FAIL: tlsget2
powerpc-eabisim  +FAIL: tocsave1 shared
powerpc-eabisim  +FAIL: tocsave1 static
powerpc-eabisim  +FAIL: ld-powerpc/relbrlt
powerpc-eabivle  +FAIL: PowerPC Test 1, 32 bit elf
powerpc-eabivle  +FAIL: TLS32 dynamic exec
powerpc-eabivle  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc-eabivle  +FAIL: TLS32 shared
powerpc-eabivle  +FAIL: TLS static exec (markers)
powerpc-eabivle  +FAIL: TLS static exec
powerpc-eabivle  +FAIL: TLS static exec (--no-tls-optimize)
powerpc-eabivle  +FAIL: TLS dynamic exec
powerpc-eabivle  +FAIL: TLS dynamic old
powerpc-eabivle  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc-eabivle  +FAIL: TLS shared
powerpc-eabivle  +FAIL: TLSTOC dynamic exec
powerpc-eabivle  +FAIL: TLSTOC dynamic old
powerpc-eabivle  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc-eabivle  +FAIL: TLSTOC shared
powerpc-eabivle  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc-eabivle  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-eabivle  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc-eabivle  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-eabivle  +FAIL: TLS opt 1
powerpc-eabivle  +FAIL: TLS opt 2
powerpc-eabivle  +FAIL: TLS opt 3
powerpc-eabivle  +FAIL: TLS opt 4
powerpc-eabivle  +FAIL: tlsget
powerpc-eabivle  +FAIL: tlsget2
powerpc-eabivle  +FAIL: tocsave1 shared
powerpc-eabivle  +FAIL: tocsave1 static
powerpc-eabivle  +FAIL: ld-powerpc/relbrlt
powerpc-freebsd  +FAIL: PowerPC Test 1, 32 bit elf
powerpc-freebsd  +FAIL: TLS32 dynamic exec
powerpc-freebsd  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc-freebsd  +FAIL: TLS32 shared
powerpcle-elf  +FAIL: PowerPC Test 1, 32 bit elf
powerpcle-elf  +FAIL: TLS32 dynamic exec
powerpcle-elf  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpcle-elf  +FAIL: TLS32 shared
powerpcle-elf  +FAIL: TLS static exec (markers)
powerpcle-elf  +FAIL: TLS static exec
powerpcle-elf  +FAIL: TLS static exec (--no-tls-optimize)
powerpcle-elf  +FAIL: TLS dynamic exec
powerpcle-elf  +FAIL: TLS dynamic old
powerpcle-elf  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpcle-elf  +FAIL: TLS shared
powerpcle-elf  +FAIL: TLSTOC dynamic exec
powerpcle-elf  +FAIL: TLSTOC dynamic old
powerpcle-elf  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpcle-elf  +FAIL: TLSTOC shared
powerpcle-elf  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpcle-elf  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpcle-elf  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpcle-elf  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpcle-elf  +FAIL: TLS opt 1
powerpcle-elf  +FAIL: TLS opt 2
powerpcle-elf  +FAIL: TLS opt 3
powerpcle-elf  +FAIL: TLS opt 4
powerpcle-elf  +FAIL: tlsget
powerpcle-elf  +FAIL: tlsget2
powerpcle-elf  +FAIL: tocsave1 shared
powerpcle-elf  +FAIL: tocsave1 static
powerpcle-elf  +FAIL: ld-powerpc/relbrlt
powerpc-linux  +FAIL: PowerPC Test 1, 32 bit elf
powerpc-linux  +FAIL: TLS32 dynamic exec
powerpc-linux  +FAIL: TLS32 dynamic exec (--no-tls-optimize)
powerpc-linux  +FAIL: TLS32 shared
powerpc-linux  +FAIL: TLS static exec (markers)
powerpc-linux  +FAIL: TLS static exec
powerpc-linux  +FAIL: TLS static exec (--no-tls-optimize)
powerpc-linux  +FAIL: TLS dynamic exec
powerpc-linux  +FAIL: TLS dynamic old
powerpc-linux  +FAIL: TLS dynamic exec (--no-tls-optimize)
powerpc-linux  +FAIL: TLS shared
powerpc-linux  +FAIL: TLSTOC dynamic exec
powerpc-linux  +FAIL: TLSTOC dynamic old
powerpc-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize)
powerpc-linux  +FAIL: TLSTOC shared
powerpc-linux  +FAIL: TLS dynamic exec (--tls-get-addr-regsave)
powerpc-linux  +FAIL: TLS dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-linux  +FAIL: TLSTOC dynamic exec (--tls-get-addr-regsave)
powerpc-linux  +FAIL: TLSTOC dynamic exec (--no-tls-optimize --tls-get-addr-regsave)
powerpc-linux  +FAIL: TLS opt 1
powerpc-linux  +FAIL: TLS opt 2
powerpc-linux  +FAIL: TLS opt 3
powerpc-linux  +FAIL: TLS opt 4
powerpc-linux  +FAIL: tlsget
powerpc-linux  +FAIL: tlsget2
powerpc-linux  +FAIL: tocsave1 shared
powerpc-linux  +FAIL: tocsave1 static
powerpc-linux  +FAIL: ld-powerpc/relbrlt
powerpc-nto  +FAIL: PowerPC Test 1, 32 bit elf
riscv32-elf  +FAIL: elf section2 list
riscv64-linux  +FAIL: elf section2 list
riscv64-linux  +FAIL: Link with zlib-gnu compressed debug output 1
riscv64-linux  +FAIL: ifunc-reloc-call-01 (rv32-exe)
riscv64-linux  +FAIL: ifunc-reloc-call-02 (rv32-exe)
riscv64-linux  +FAIL: ifunc-reloc-pcrel (rv32-exe)
riscv64-linux  +FAIL: ifunc-reloc-pcrel (rv64-exe)
riscv64-linux  +FAIL: ifunc-plt-01 (rv32-exe)
riscv64-linux  +FAIL: ifunc-plt-02 (rv32-exe)
riscv64-linux  +FAIL: ifunc-plt-01 (rv64-exe)
riscv64-linux  +FAIL: ifunc-plt-02 (rv64-exe)
riscv64-linux  +FAIL: ifunc-plt-got-overwrite (rv32-exe)
riscv64-linux  +FAIL: ifunc-plt-got-overwrite (rv32-pic)
riscv64-linux  +FAIL: ifunc-plt-got-overwrite (rv64-exe)
riscv64-linux  +FAIL: ifunc-plt-got-overwrite (rv64-pic)
rl78-elf  +FAIL: elf section2 list
rx-elf  +FAIL: elf section2 list
s12z-elf  +FAIL: PC relative branches (close to the limit)
s12z-elf  +FAIL: OPR addressing mode: symbols in its direct submode
s12z-elf  +FAIL: gas/s12z/brclr-symbols
s12z-elf  +FAIL: gas/s12z/dbCC
s390-linux  +FAIL: TLS -fpic -shared transitions
s390-linux  +FAIL: TLS -fpic and -fno-pic exec transitions
s390x-linux  +FAIL: TLS -fpic -shared transitions
s390x-linux  +FAIL: TLS -fpic and -fno-pic exec transitions
s390x-linux  +FAIL: TLS -fpic -shared transitions
s390x-linux  +FAIL: TLS -fpic and -fno-pic exec transitions
score-elf  +FAIL: elf section2 list
shle-unknown-netbsdelf  +FAIL: SH4a non-FP constructs
shle-unknown-netbsdelf  +FAIL: SH4a FP constructs
shle-unknown-netbsdelf  +FAIL: SH4al-dsp constructs shared with sh4a (and sh4)
shle-unknown-netbsdelf  +FAIL: SH4al DSP constructs
sh-linux  +FAIL: SH4a non-FP constructs
sh-linux  +FAIL: SH4a FP constructs
sh-linux  +FAIL: SH4al-dsp constructs shared with sh4a (and sh4)
sh-linux  +FAIL: SH4al DSP constructs
sh-pe  +FAIL: cofftag
sh-pe  +FAIL: pr26103
sparc64-linux  +FAIL: 32-bit: TLS -fpic -shared transitions
sparc64-linux  +FAIL: 32-bit: TLS -fpic and -fno-pic exec transitions
sparc64-linux  +FAIL: 32-bit: TLS -fno-pic -shared
sparc64-linux  +FAIL: 32-bit: GOTDATA relocations
sparc64-linux  +FAIL: 64-bit: TLS -fpic -shared transitions
sparc64-linux  +FAIL: 64-bit: TLS -fpic and -fno-pic exec transitions
sparc64-linux  +FAIL: 64-bit: TLS -fno-pic -shared
sparc64-linux  +FAIL: 64-bit: GOTDATA relocations
sparc-elf  +FAIL: 32-bit: TLS -fpic -shared transitions
sparc-elf  +FAIL: 32-bit: TLS -fpic and -fno-pic exec transitions
sparc-elf  +FAIL: 32-bit: TLS -fno-pic -shared
sparc-elf  +FAIL: 32-bit: GOTDATA relocations
sparc-linux  +FAIL: 32-bit: TLS -fpic -shared transitions
sparc-linux  +FAIL: 32-bit: TLS -fpic and -fno-pic exec transitions
sparc-linux  +FAIL: 32-bit: TLS -fno-pic -shared
sparc-linux  +FAIL: 32-bit: GOTDATA relocations
sparc-linux  +FAIL: 64-bit: TLS -fpic -shared transitions
sparc-linux  +FAIL: 64-bit: TLS -fpic and -fno-pic exec transitions
sparc-linux  +FAIL: 64-bit: TLS -fno-pic -shared
sparc-linux  +FAIL: 64-bit: GOTDATA relocations
spu-elf  +FAIL: ld-spu/ovl
spu-elf  +FAIL: ld-spu/ovl2
tic30-unknown-coff  +FAIL: cofftag
tic54x-coff  +XPASS: objcopy object (simple copy)
tic54x-coff  +FAIL: c54x align
tic54x-coff  +FAIL: c54x loop directive
tic54x-coff  +FAIL: c54x set/equ directive
tic6x-elf  +FAIL: elf section2 list
tic6x-elf  +FAIL: C6X .scomm directive 4
tic6x-elf  +FAIL: C6X common symbols
tic6x-elf  +FAIL: C6X shared library without --dsbt-index
tic6x-elf  +FAIL: C6X shared library, LE, RELA
tic6x-elf  +FAIL: C6X nonstatic app using shared library, LE, RELA
tic6x-elf  +FAIL: C6X shared library, LE, REL
tic6x-elf  +FAIL: C6X nonstatic app using shared library, LE, REL
tic6x-elf  +FAIL: C6X shared library, BE, RELA
tic6x-elf  +FAIL: C6X nonstatic app using shared library, BE, RELA
tic6x-elf  +FAIL: C6X shared library, BE, REL
tic6x-elf  +FAIL: C6X nonstatic app using shared library, BE, REL
tic6x-elf  +FAIL: C6X static app, LE, RELA
tic6x-elf  +FAIL: C6X static app, LE, REL
tic6x-elf  +FAIL: C6X static app, BE, RELA
tic6x-elf  +FAIL: C6X static app, BE, REL
v850-elf  +FAIL: elf section2 list
vax-netbsdelf  +FAIL: PLT test (shared library)
vax-netbsdelf  +FAIL: PLT test (executable)
vax-netbsdelf  +FAIL: GOT test (executable hidden reference with offset)
vax-netbsdelf  +FAIL: GOT test (shared library hidden reference with offset)
vax-netbsdelf  +FAIL: GOT test (executable visible reference with offset)
x86_64-cloudabi  +FAIL: SVR4 comment char escape handling
x86_64-w64-mingw32  +FAIL: cofftag
x86_64-w64-mingw32  +FAIL: pr26103
xtensa-elf  +FAIL: elf section2 list
z80-coff  +FAIL: cofftag
z8k-coff  +FAIL: cofftag
z8k-coff  +FAIL: jr forward
z8k-coff  +FAIL: jmp cc
z8k-coff  +FAIL: return on condition code
z8k-coff  +FAIL: Z8001 backward calr just in range
z8k-coff  +FAIL: Z8002 backward calr just in range
z8k-coff  +FAIL: Z8001 forward calr just in range
z8k-coff  +FAIL: Z8002 forward calr just in range
z8k-coff  +FAIL: Z8001 forward dbjnz just in range
z8k-coff  +FAIL: Z8002 forward dbjnz just in range
z8k-coff  +FAIL: Z8001 backward djnz just in range
z8k-coff  +FAIL: Z8002 backward djnz just in range
z8k-coff  +FAIL: Z8001 forward djnz just in range
z8k-coff  +FAIL: Z8002 forward djnz just in range
z8k-coff  +FAIL: Z8001 backward jr just in range
z8k-coff  +FAIL: Z8002 backward jr just in range
z8k-coff  +FAIL: Z8001 forward jr just in range
z8k-coff  +FAIL: Z8002 forward jr just in range
z8k-coff  +FAIL: Z8001 backward relative load just in range
z8k-coff  +FAIL: Z8002 backward relative load just in range
z8k-coff  +FAIL: Z8001 forward relative load just in range
z8k-coff  +FAIL: Z8002 forward relative load just in range
z8k-coff  +FAIL: Z8001 forward relative byte load just in range
z8k-coff  +FAIL: Z8002 forward relative byte load just in range

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* V2 [PATCH] ELF: Don't generate unused section symbols
  2021-01-05  1:23       ` Alan Modra
@ 2021-01-05 16:21         ` H.J. Lu
  2021-01-07 14:35           ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2021-01-05 16:21 UTC (permalink / raw)
  To: Alan Modra; +Cc: Nick Clifton, Binutils

[-- Attachment #1: Type: text/plain, Size: 2444 bytes --]

On Mon, Jan 4, 2021 at 5:24 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Jan 04, 2021 at 10:43:20AM -0800, H.J. Lu wrote:
> > On Sun, Jan 3, 2021 at 4:51 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sun, Jan 3, 2021 at 3:33 PM Alan Modra <amodra@gmail.com> wrote:
> > > >
> > > > On Sun, Dec 27, 2020 at 07:25:12PM -0800, H.J. Lu via Binutils wrote:
> > > > > 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.
> > > >
> > > > Hi HJ,
> > > > I'm inclined to think that removing unused section symbols is a good
> > > > idea, but that --generate-unused-section-symbols and certainly the
> > > > configure option --enable-generate-section-symbols is undesirable.
> > > > I'd rather not see more configure options that change binutils default
> > > > behaviour, making binutils bug reports more difficult to reproduce.
> > > >
> > >
> > > Removing unused section symbols means updating many binutils tests
> > > as well as many assembler backends.  I can submit a patch to remove
> > > unused section symbols and fix all tests on x86.  But I can't cover other
> > > backends.
> >
> > Here is the patch.
> >
> > Tested on Linux/x86.  Other ELF backends need:
> >
> > 1. Mark used section symbols in assembler backend.
> > 2. Remove unused section symbols from expected assembler and linker
> > outputs.
>
> In that case definitely not something we want before 2.36 goes out the
> door.
>

Here is the updated patch to make the new behavior opt-in.

OK for master?

Thanks.

-- 
H.J.

[-- Attachment #2: 0001-ELF-Don-t-generate-unused-section-symbols.patch --]
[-- Type: text/x-patch, Size: 166803 bytes --]

From 3b3deed27bcb9cc645ed53286648e07dcb7a5a40 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 26 Dec 2020 10:02:14 -0800
Subject: [PATCH] ELF: Don't generate unused section symbols

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 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.

Add keep_unused_section_symbols to bfd_target to indicate if unused
section symbols should be kept.  If TARGET_KEEP_UNUSED_SECTION_SYMBOLS
is defined as FALSE, unused ection symbols will be removed.

Tested on Linux/x86.  Other ELF backends need:

1. Define TARGET_KEEP_UNUSED_SECTION_SYMBOLS to FALSE.
2. Mark used section symbols in assembler backend.
3. Remove unused section symbols from expected assembler and linker
outputs.

bfd/ChangeLog:

	PR 27109
	* aix386-core.c (core_aix386_vec): Initialize
	keep_unused_section_symbol to TARGET_KEEP_UNUSED_SECTION_SYMBOLS.
	* aout-target.h (MY (vec)): Likewise.
	* binary.c (binary_vec): Likewise.
	* cisco-core.c (core_cisco_be_vec): Likewise.
	(core_cisco_le_vec): Likewise.
	* coff-alpha.c (alpha_ecoff_le_vec): Likewise.
	* coff-i386.c (TARGET_SYM): Likewise.
	(TARGET_SYM_BIG): Likewise.
	* coff-ia64.c (TARGET_SYM): Likewise.
	* coff-mips.c (mips_ecoff_le_vec): Likewise.
	(mips_ecoff_be_vec): Likewise.
	(mips_ecoff_bele_vec): Likewise.
	* coff-rs6000.c (rs6000_xcoff_vec): Likewise.
	(powerpc_xcoff_vec): Likewise.
	* coff-sh.c (sh_coff_small_vec): Likewise.
	(sh_coff_small_le_vec): Likewise.
	* coff-tic30.c (tic30_coff_vec): Likewise.
	* coff-tic54x.c (tic54x_coff0_vec): Likewise.
	(tic54x_coff0_beh_vec): Likewise.
	(tic54x_coff1_vec): Likewise.
	(tic54x_coff1_beh_vec): Likewise.
	(tic54x_coff2_vec): Likewise.
	(tic54x_coff2_beh_vec): Likewise.
	* coff-x86_64.c (TARGET_SYM): Likewise.
	(TARGET_SYM_BIG): Likewise.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Likewise.
	(rs6000_xcoff64_aix_vec): Likewise.
	* coffcode.h (CREATE_BIG_COFF_TARGET_VEC): Likewise.
	(CREATE_BIGHDR_COFF_TARGET_VEC): Likewise.
	(CREATE_LITTLE_COFF_TARGET_VEC): Likewise.
	* elfxx-target.h (TARGET_BIG_SYM): Likewise.
	(TARGET_LITTLE_SYM): Likewise.
	* hppabsd-core.c (core_hppabsd_vec): Likewise.
	* hpux-core.c (core_hpux_vec): Likewise.
	* i386msdos.c (i386_msdos_vec): Likewise.
	* ihex.c (ihex_vec): Likewise.
	* irix-core.c (core_irix_vec): Likewise.
	* mach-o-target.c (TARGET_NAME): Likewise.
	* mmo.c (mmix_mmo_vec): Likewise.
	* netbsd-core.c (core_netbsd_vec): Likewise.
	* osf-core.c (core_osf_vec): Likewise.
	* pdp11.c (MY (vec)): Likewise.
	* pef.c (pef_vec): Likewise.
	(pef_xlib_vec): Likewise.
	* plugin.c (plugin_vec): Likewise.
	* ppcboot.c (powerpc_boot_vec): Likewise.
	* ptrace-core.c (core_ptrace_vec): Likewise.
	* sco5-core.c (core_sco5_vec): Likewise.
	* som.c (hppa_som_vec): Likewise.
	* srec.c (srec_vec): Likewise.
	(symbolsrec_vec): Likewise.
	* tekhex.c (tekhex_vec): Likewise.
	* trad-core.c (core_trad_vec): Likewise.
	* verilog.c (verilog_vec): Likewise.
	* vms-alpha.c (alpha_vms_vec): Likewise.
	* vms-lib.c (alpha_vms_lib_txt_vec): Likewise.
	* wasm-module.c (wasm_vec): Likewise.
	* xsym.c (sym_vec): Likewise.
	* 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 emitting relocations or reqired.
	* elfxx-x86.h (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
	* syms.c (BSF_SECTION_SYM_USED): New.
	* targets.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
	(bfd_target): Add keep_unused_section_symbols.
	(bfd_keep_unused_section_symbols): New.
	* bfd-in2.h: Regenerated.

binutils/ChangeLog:

	PR 27109
	* objcopy.c (copy_object): Handle section symbols for
	non-relocatable inputs.
	* testsuite/binutils-all/readelf.exp (readelf_test): Check
	is_elf_unused_section_symbols.
	* testsuite/binutils-all/readelf.s-64: Updated.
	* testsuite/binutils-all/readelf.ss: Likewise.
	* testsuite/binutils-all/readelf.ss-64: Likewise.
	* testsuite/binutils-all/readelf.s-64-unused: New file.
	* testsuite/binutils-all/readelf.ss-64-unused: Likewise.
	* testsuite/binutils-all/readelf.ss-unused: Likewise.
	* testsuite/lib/binutils-common.exp
	(is_elf_unused_section_symbols): New proc.

gas/ChangeLog:

	PR 27109
	* read.c (s_reloc): Call symbol_mark_used_in_reloc on the
	section symbol.
	* subsegs.c (subseg_set_rest): Set BSF_SECTION_SYM_USED if needed.
	* write.c (adjust_reloc_syms): Call symbol_mark_used_in_reloc
	on the section symbol.
	(set_symtab): Don't generate unused section symbols.
	(maybe_generate_build_notes): Call symbol_mark_used_in_reloc
	on the section symbol.
	* config/obj-elf.c (elf_adjust_symtab): Call
	symbol_mark_used_in_reloc on the group signature symbol.
	* testsuite/gas/cfi/cfi-label.d: Remove unused section symbols
	from expected output.
	* testsuite/gas/elf/elf.exp (run_elf_list_test): Check
	is_elf_unused_section_symbols.
	* testsuite/gas/elf/section2.e: Updated.
	* testsuite/gas/elf/section2.e-unused: New file.
	* 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: Likewise.
	* 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/svr4.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.

ld/ChangeLog:

	PR 27109
	* testsuite/ld-elf/export-class.sd: Adjust the expected output.
	* testsuite/ld-elf/loadaddr3b.d: Likewise.
	* testsuite/ld-i386/ibt-plt-1.d: Likewise.
	* 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: Likewise.
	* 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-elf/sec64k.exp: Check
	is_elf_unused_section_symbols.
---
 bfd/aix386-core.c                             |  1 +
 bfd/aout-target.h                             |  1 +
 bfd/bfd-in2.h                                 | 17 ++++++
 bfd/binary.c                                  |  1 +
 bfd/cisco-core.c                              |  2 +
 bfd/coff-alpha.c                              |  1 +
 bfd/coff-i386.c                               |  4 +-
 bfd/coff-ia64.c                               |  1 +
 bfd/coff-mips.c                               |  3 +
 bfd/coff-rs6000.c                             |  2 +
 bfd/coff-sh.c                                 |  2 +
 bfd/coff-tic30.c                              |  1 +
 bfd/coff-tic54x.c                             | 26 ++++++++
 bfd/coff-x86_64.c                             |  2 +
 bfd/coff64-rs6000.c                           |  2 +
 bfd/coffcode.h                                |  3 +
 bfd/elf.c                                     | 15 ++++-
 bfd/elfcode.h                                 |  8 ++-
 bfd/elflink.c                                 | 61 +++++++++----------
 bfd/elfxx-target.h                            |  6 ++
 bfd/elfxx-x86.h                               |  3 +
 bfd/hppabsd-core.c                            |  1 +
 bfd/hpux-core.c                               |  1 +
 bfd/i386msdos.c                               |  1 +
 bfd/ihex.c                                    |  1 +
 bfd/irix-core.c                               |  1 +
 bfd/mach-o-target.c                           |  1 +
 bfd/mmo.c                                     |  1 +
 bfd/netbsd-core.c                             |  1 +
 bfd/osf-core.c                                |  1 +
 bfd/pdp11.c                                   |  1 +
 bfd/pef.c                                     |  2 +
 bfd/plugin.c                                  |  1 +
 bfd/ppcboot.c                                 |  1 +
 bfd/ptrace-core.c                             |  1 +
 bfd/sco5-core.c                               |  1 +
 bfd/som.c                                     |  1 +
 bfd/srec.c                                    |  2 +
 bfd/syms.c                                    |  3 +
 bfd/targets.c                                 | 14 +++++
 bfd/tekhex.c                                  |  1 +
 bfd/trad-core.c                               |  1 +
 bfd/verilog.c                                 |  1 +
 bfd/vms-alpha.c                               |  1 +
 bfd/vms-lib.c                                 |  1 +
 bfd/wasm-module.c                             |  1 +
 bfd/xsym.c                                    |  1 +
 binutils/objcopy.c                            | 24 ++++++++
 binutils/testsuite/binutils-all/readelf.exp   |  6 +-
 binutils/testsuite/binutils-all/readelf.s-64  |  2 +-
 .../binutils-all/readelf.s-64-unused          | 27 ++++++++
 binutils/testsuite/binutils-all/readelf.ss    |  5 +-
 binutils/testsuite/binutils-all/readelf.ss-64 |  5 +-
 .../binutils-all/readelf.ss-64-unused         | 18 ++++++
 .../testsuite/binutils-all/readelf.ss-unused  | 20 ++++++
 binutils/testsuite/lib/binutils-common.exp    | 31 ++++++++++
 gas/config/obj-elf.c                          |  3 +
 gas/read.c                                    |  3 +
 gas/subsegs.c                                 |  4 ++
 gas/testsuite/gas/cfi/cfi-label.d             |  4 +-
 gas/testsuite/gas/elf/elf.exp                 |  6 +-
 gas/testsuite/gas/elf/section2.e              |  8 ---
 gas/testsuite/gas/elf/section2.e-unused       |  8 +++
 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  | 24 ++++----
 gas/testsuite/gas/i386/ilp32/x86-64-size-3.d  | 16 ++---
 gas/testsuite/gas/i386/ilp32/x86-64-size-5.d  | 12 ++--
 gas/testsuite/gas/i386/ilp32/x86-64-unwind.d  |  6 +-
 gas/testsuite/gas/i386/size-1.d               | 24 ++++----
 gas/testsuite/gas/i386/size-3.d               | 16 ++---
 gas/testsuite/gas/i386/svr4.d                 |  3 -
 gas/testsuite/gas/i386/x86-64-size-1.d        | 24 ++++----
 gas/testsuite/gas/i386/x86-64-size-3.d        | 16 ++---
 gas/testsuite/gas/i386/x86-64-size-5.d        | 12 ++--
 gas/testsuite/gas/i386/x86-64-unwind.d        | 10 +--
 gas/write.c                                   | 43 +++++++++----
 ld/testsuite/ld-elf/export-class.sd           |  2 -
 ld/testsuite/ld-elf/loadaddr3b.d              |  3 -
 ld/testsuite/ld-elf/sec64k.exp                | 14 +++--
 ld/testsuite/ld-i386/ibt-plt-1.d              |  4 +-
 ld/testsuite/ld-i386/ibt-plt-2a.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-2c.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-3a.d             |  4 +-
 ld/testsuite/ld-i386/ibt-plt-3c.d             |  4 +-
 ld/testsuite/ld-i386/plt-pic.pd               |  6 +-
 ld/testsuite/ld-i386/plt-pic2.dd              |  6 +-
 ld/testsuite/ld-i386/plt.pd                   |  6 +-
 ld/testsuite/ld-i386/plt2.dd                  |  6 +-
 ld/testsuite/ld-i386/pr19636-1d.d             |  2 +-
 ld/testsuite/ld-i386/pr19636-1l.d             |  2 +-
 ld/testsuite/ld-i386/pr19636-2c.d             |  2 +-
 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      |  4 +-
 .../ld-ifunc/ifunc-2-local-i386-now.d         |  4 +-
 .../ld-ifunc/ifunc-2-local-x86-64-now.d       |  4 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    |  4 +-
 ld/testsuite/ld-ifunc/ifunc-21-x86-64.d       | 10 +--
 ld/testsuite/ld-ifunc/ifunc-22-x86-64.d       | 10 +--
 ld/testsuite/ld-ifunc/pr17154-i386-now.d      | 10 +--
 ld/testsuite/ld-ifunc/pr17154-i386.d          |  8 +--
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    | 10 +--
 ld/testsuite/ld-ifunc/pr17154-x86-64.d        |  8 +--
 ld/testsuite/ld-x86-64/bnd-branch-1-now.d     | 10 +--
 ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d      |  2 +-
 ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d      |  8 +--
 ld/testsuite/ld-x86-64/bnd-ifunc-2.d          |  8 +--
 ld/testsuite/ld-x86-64/bnd-plt-1-now.d        |  8 +--
 ld/testsuite/ld-x86-64/bnd-plt-1.d            |  8 +--
 ld/testsuite/ld-x86-64/ibt-plt-1-x32.d        |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-1.d            |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2a.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-2c.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3a.d           |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d       |  4 +-
 ld/testsuite/ld-x86-64/ibt-plt-3c.d           |  4 +-
 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/plt.pd                 |  6 +-
 ld/testsuite/ld-x86-64/plt2.dd                |  6 +-
 ld/testsuite/ld-x86-64/pr19609-4e.d           |  4 +-
 ld/testsuite/ld-x86-64/pr19609-6a.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-6b.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7b.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7d.d           |  2 +-
 ld/testsuite/ld-x86-64/pr19636-2l.d           |  6 +-
 ld/testsuite/ld-x86-64/pr20253-1d.d           | 12 ++--
 ld/testsuite/ld-x86-64/pr20253-1h.d           | 12 ++--
 ld/testsuite/ld-x86-64/pr21038b-now.d         |  2 +-
 ld/testsuite/ld-x86-64/pr21038b.d             |  2 +-
 ld/testsuite/ld-x86-64/pr21038c-now.d         |  2 +-
 ld/testsuite/ld-x86-64/pr21038c.d             |  2 +-
 ld/testsuite/ld-x86-64/pr23854.d              | 36 +++++------
 ld/testsuite/ld-x86-64/pr25416-3.d            |  4 +-
 ld/testsuite/ld-x86-64/pr25416-4.d            |  4 +-
 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 ----
 158 files changed, 598 insertions(+), 523 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/readelf.s-64-unused
 create mode 100644 binutils/testsuite/binutils-all/readelf.ss-64-unused
 create mode 100644 binutils/testsuite/binutils-all/readelf.ss-unused
 create mode 100644 gas/testsuite/gas/elf/section2.e-unused

diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c
index d641b810319..68cd642952f 100644
--- a/bfd/aix386-core.c
+++ b/bfd/aix386-core.c
@@ -239,6 +239,7 @@ const bfd_target core_aix386_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   NO_GET64, NO_GETS64, NO_PUT64,
   NO_GET, NO_GETS, NO_PUT,
   NO_GET, NO_GETS, NO_PUT,	/* data */
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 8c27bb1007e..92fc3ed4dd2 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -660,6 +660,7 @@ const bfd_target MY (vec) =
   AR_PAD_CHAR,			/* AR_pad_char.  */
   15,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 #ifdef TARGET_IS_BIG_ENDIAN_P
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
      bfd_getb32, bfd_getb_signed_32, bfd_putb32,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 43ead185c19..0670ec89d55 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6416,6 +6416,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
@@ -7291,6 +7294,11 @@ bfd_boolean generic_core_file_matches_executable_p
    (bfd_assert (__FILE__,__LINE__), NULL))
 #endif
 
+/* Defined to TRUE if unused section symbol should be kept.  */
+#ifndef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS TRUE
+#endif
+
 enum bfd_flavour
 {
   /* N.B. Update bfd_flavour_name if you change this.  */
@@ -7364,6 +7372,9 @@ typedef struct bfd_target
      possible targets when more than one target matches.  */
   unsigned char match_priority;
 
+ /* TRUE if unused section symbols should be kept.  */
+  bfd_boolean keep_unused_section_symbols;
+
   /* Entries for byte swapping for data. These are different from the
      other entry points, since they don't take a BFD as the first argument.
      Certain other handlers could do the same.  */
@@ -7794,6 +7805,12 @@ bfd_asymbol_flavour (const asymbol *sy)
   return sy->the_bfd->xvec->flavour;
 }
 
+static inline char
+bfd_keep_unused_section_symbols (const bfd *abfd)
+{
+  return abfd->xvec->keep_unused_section_symbols;
+}
+
 bfd_boolean bfd_set_default_target (const char *name);
 
 const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
diff --git a/bfd/binary.c b/bfd/binary.c
index db1bec02b68..942c66bbd68 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -335,6 +335,7 @@ const bfd_target binary_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   255,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index 1b77829c15a..c0e68ade481 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -329,6 +329,7 @@ const bfd_target core_cisco_be_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
@@ -384,6 +385,7 @@ const bfd_target core_cisco_le_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   0,				/* match_priority */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 50b2f973a5d..db26587feae 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2427,6 +2427,7 @@ const bfd_target alpha_ecoff_le_vec =
   ' ',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index 5048df9daf4..e02519564d1 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -651,6 +651,7 @@ const bfd_target
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
@@ -729,6 +730,7 @@ const bfd_target
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
@@ -772,4 +774,4 @@ const bfd_target
 
   &bigobj_swap_table
 };
-#endif
\ No newline at end of file
+#endif
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index 24a4a7c1331..887c7aae77c 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -170,6 +170,7 @@ const bfd_target
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 38376b23d7b..d20f4b46597 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1446,6 +1446,7 @@ const bfd_target mips_ecoff_le_vec =
   ' ',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -1504,6 +1505,7 @@ const bfd_target mips_ecoff_be_vec =
   ' ',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
      bfd_getb32, bfd_getb_signed_32, bfd_putb32,
      bfd_getb16, bfd_getb_signed_16, bfd_putb16,
@@ -1562,6 +1564,7 @@ const bfd_target mips_ecoff_bele_vec =
   ' ',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index a71791e3f9d..fbc1aed3118 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4201,6 +4201,7 @@ const bfd_target rs6000_xcoff_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
     /* data */
     bfd_getb64,
@@ -4382,6 +4383,7 @@ const bfd_target powerpc_xcoff_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
     /* data */
     bfd_getb64,
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index 99541a76e05..04ef99b777c 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -3134,6 +3134,7 @@ const bfd_target sh_coff_small_vec =
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
@@ -3191,6 +3192,7 @@ const bfd_target sh_coff_small_le_vec =
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c
index f3e7df0a3dc..f4d3a13ef45 100644
--- a/bfd/coff-tic30.c
+++ b/bfd/coff-tic30.c
@@ -192,6 +192,7 @@ const bfd_target tic30_coff_vec =
   '/',				/* ar_pad_char */
   15,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c
index 914bb2a3907..3c18221d248 100644
--- a/bfd/coff-tic54x.c
+++ b/bfd/coff-tic54x.c
@@ -415,6 +415,7 @@ const bfd_target tic54x_coff0_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
@@ -472,6 +473,11 @@ const bfd_target tic54x_coff0_beh_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+    TRUE,			/* keep unused section symbols.  */
+#else
+    FALSE,			/* keep unused section symbols.  */
+#endif
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
@@ -530,6 +536,11 @@ const bfd_target tic54x_coff1_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+    TRUE,			/* keep unused section symbols.  */
+#else
+    FALSE,			/* keep unused section symbols.  */
+#endif
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
@@ -588,6 +599,11 @@ const bfd_target tic54x_coff1_beh_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+    TRUE,			/* keep unused section symbols.  */
+#else
+    FALSE,			/* keep unused section symbols.  */
+#endif
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
@@ -646,6 +662,11 @@ const bfd_target tic54x_coff2_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+    TRUE,			/* keep unused section symbols.  */
+#else
+    FALSE,			/* keep unused section symbols.  */
+#endif
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
@@ -704,6 +725,11 @@ const bfd_target tic54x_coff2_beh_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+    TRUE,			/* keep unused section symbols.  */
+#else
+    FALSE,			/* keep unused section symbols.  */
+#endif
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 0279ce23c86..adab60cd113 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -782,6 +782,7 @@ const bfd_target
   '/',				/* Ar_pad_char.  */
   15,				/* Ar_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
@@ -854,6 +855,7 @@ const bfd_target
   '/',				/* Ar_pad_char.  */
   15,				/* Ar_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index a3b17020c17..9aa0304ec9f 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2665,6 +2665,7 @@ const bfd_target rs6000_xcoff64_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
     /* data */
     bfd_getb64,
@@ -2928,6 +2929,7 @@ const bfd_target rs6000_xcoff64_aix_vec =
     '/',			/* ar_pad_char */
     15,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
     /* data */
     bfd_getb64,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 21820da453a..2fd699ff1b8 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5820,6 +5820,7 @@ const bfd_target VAR =							\
   '/',				/* AR_pad_char.  */			\
   15,				/* AR_max_namelen.  */			\
   0,				/* match priority.  */			\
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */ \
 									\
   /* Data conversion functions.  */					\
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
@@ -5881,6 +5882,7 @@ const bfd_target VAR =							\
   '/',				/* AR_pad_char.  */			\
   15,				/* AR_max_namelen.  */			\
   0,				/* match priority.  */			\
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */ \
 									\
   /* Data conversion functions.  */					\
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
@@ -5942,6 +5944,7 @@ const bfd_target VAR =							\
   '/',				/* AR_pad_char.  */			\
   15,				/* AR_max_namelen.  */			\
   0,				/* match priority.  */			\
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */ \
 									\
   /* Data conversion functions.  */					\
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,				\
diff --git a/bfd/elf.c b/bfd/elf.c
index 3f4ccd20559..ab19bdb4530 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 b40fb4a1f5d..4e99fcc6b9b 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 4c54b1a1591..a7c952b6fc1 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12527,9 +12527,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);
@@ -12550,36 +12547,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 (bfd_keep_unused_section_symbols (abfd) || 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/elfxx-target.h b/bfd/elfxx-target.h
index cae1fbf0bb9..c930b767bfb 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -1007,6 +1007,9 @@ const bfd_target TARGET_BIG_SYM =
 
   elf_match_priority,
 
+  /* TRUE if unused section symbols should be kept.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS,
+
   /* Routines to byte-swap various sized integers from the data sections */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
@@ -1108,6 +1111,9 @@ const bfd_target TARGET_LITTLE_SYM =
 
   elf_match_priority,
 
+  /* TRUE if unused section symbols should be kept.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS,
+
   /* Routines to byte-swap various sized integers from the data sections */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index cc8149d06bd..e11e06bdad6 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -18,6 +18,9 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
+/* Don't generate unused section symbols.  */
+#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS FALSE
+
 #include "sysdep.h"
 #include "bfd.h"
 #include "bfdlink.h"
diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c
index d2c8a94b946..c36e467ae1d 100644
--- a/bfd/hppabsd-core.c
+++ b/bfd/hppabsd-core.c
@@ -230,6 +230,7 @@ const bfd_target core_hppabsd_vec =
     0,							   /* symbol prefix */
     ' ',						   /* ar_pad_char */
     16,							   /* ar_max_namelen */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index 42f84247d89..03d0de33822 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -392,6 +392,7 @@ const bfd_target core_hpux_vec =
     ' ',			/* ar_pad_char */
     16,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 526561e3ae6..6254b2aa2eb 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -279,6 +279,7 @@ const bfd_target i386_msdos_vec =
     ' ',				/* ar_pad_char */
     16,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
     bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 65431025ea0..13dd106817b 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -981,6 +981,7 @@ const bfd_target ihex_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/irix-core.c b/bfd/irix-core.c
index d00f4917c1a..e4fb622d694 100644
--- a/bfd/irix-core.c
+++ b/bfd/irix-core.c
@@ -293,6 +293,7 @@ const bfd_target core_irix_vec =
     ' ',						   /* ar_pad_char */
     16,							   /* ar_max_namelen */
     0,							   /* match_priority */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 993c9747b5c..3b454336539 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -136,6 +136,7 @@ const bfd_target TARGET_NAME =
   ' ',				/* ar_pad_char.  */
   16,				/* ar_max_namelen.  */
   TARGET_PRIORITY,	/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
 #if TARGET_BIG_ENDIAN
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
diff --git a/bfd/mmo.c b/bfd/mmo.c
index a31ddef81e1..4ba62d0bc69 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3344,6 +3344,7 @@ const bfd_target mmix_mmo_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c
index a1f88207b1a..60fa69d1423 100644
--- a/bfd/netbsd-core.c
+++ b/bfd/netbsd-core.c
@@ -276,6 +276,7 @@ const bfd_target core_netbsd_vec =
     ' ',			/* ar_pad_char.  */
     16,				/* ar_max_namelen.  */
     0,				/* Match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data.  */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data.  */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data.  */
diff --git a/bfd/osf-core.c b/bfd/osf-core.c
index f91b2aac14b..17cc532396a 100644
--- a/bfd/osf-core.c
+++ b/bfd/osf-core.c
@@ -187,6 +187,7 @@ const bfd_target core_osf_vec =
     ' ',			/* ar_pad_char */
     16,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 914dcaa5de1..8992f4e5432 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -4689,6 +4689,7 @@ const bfd_target MY (vec) =
   AR_PAD_CHAR,			/* AR_pad_char.  */
   15,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getp32, bfd_getp_signed_32, bfd_putp32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data.  */
diff --git a/bfd/pef.c b/bfd/pef.c
index 85030e5463c..93bc933eec1 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -1015,6 +1015,7 @@ const bfd_target pef_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
@@ -1159,6 +1160,7 @@ const bfd_target pef_xlib_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/plugin.c b/bfd/plugin.c
index d733f6afdf1..d1767b01345 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -719,6 +719,7 @@ const bfd_target plugin_vec =
   '/',				/* ar_pad_char.  */
   15,				/* ar_max_namelen.  */
   255,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
 
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index e3ade1cdf0c..5cdd7adbbde 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -495,6 +495,7 @@ const bfd_target powerpc_boot_vec =
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c
index 7cf47af10be..d21a61ce3f4 100644
--- a/bfd/ptrace-core.c
+++ b/bfd/ptrace-core.c
@@ -177,6 +177,7 @@ const bfd_target core_ptrace_vec =
     0,							   /* symbol prefix */
     ' ',						   /* ar_pad_char */
     16,							   /* ar_max_namelen */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c
index c543c38be10..167dba9f321 100644
--- a/bfd/sco5-core.c
+++ b/bfd/sco5-core.c
@@ -358,6 +358,7 @@ const bfd_target core_sco5_vec =
     ' ',			/* ar_pad_char */
     16,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/som.c b/bfd/som.c
index 5897ae6c5b7..872e93341d1 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6859,6 +6859,7 @@ const bfd_target hppa_som_vec =
   '/',				/* AR_pad_char.  */
   14,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/srec.c b/bfd/srec.c
index e21d7f8b808..92faf3dc824 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1295,6 +1295,7 @@ const bfd_target srec_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
@@ -1351,6 +1352,7 @@ const bfd_target symbolsrec_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/syms.c b/bfd/syms.c
index 9559ab45805..10ea8bd7b89 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/bfd/targets.c b/bfd/targets.c
index e9d76ef8c7a..e0a50df163d 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -132,6 +132,11 @@ DESCRIPTION
 .   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
 .   (bfd_assert (__FILE__,__LINE__), NULL))
 .#endif
+.
+.{* Defined to TRUE if unused section symbol should be kept.  *}
+.#ifndef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
+.#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS TRUE
+.#endif
 .
 	This is the structure which defines the type of BFD this is.  The
 	<<xvec>> member of the struct <<bfd>> itself points here.  Each
@@ -215,6 +220,9 @@ DESCRIPTION
 .     possible targets when more than one target matches.  *}
 .  unsigned char match_priority;
 .
+. {* TRUE if unused section symbols should be kept.  *}
+.  bfd_boolean keep_unused_section_symbols;
+.
 .  {* Entries for byte swapping for data. These are different from the
 .     other entry points, since they don't take a BFD as the first argument.
 .     Certain other handlers could do the same.  *}
@@ -655,6 +663,12 @@ to find an alternative output format that is suitable.
 .  return sy->the_bfd->xvec->flavour;
 .}
 .
+.static inline char
+.bfd_keep_unused_section_symbols (const bfd *abfd)
+.{
+.  return abfd->xvec->keep_unused_section_symbols;
+.}
+.
 */
 
 /* All known xvecs (even those that don't compile on all systems).
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 99d54dbdb8e..6599a4f3f47 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -1008,6 +1008,7 @@ const bfd_target tekhex_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/trad-core.c b/bfd/trad-core.c
index 1a4dbe6bf81..14627cb72ec 100644
--- a/bfd/trad-core.c
+++ b/bfd/trad-core.c
@@ -279,6 +279,7 @@ const bfd_target core_trad_vec =
     ' ',			/* ar_pad_char */
     16,				/* ar_max_namelen */
     0,				/* match priority.  */
+    TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
diff --git a/bfd/verilog.c b/bfd/verilog.c
index a54f6b04ebb..94a9cc80459 100644
--- a/bfd/verilog.c
+++ b/bfd/verilog.c
@@ -405,6 +405,7 @@ const bfd_target verilog_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 72d89e518f6..94001cc3bf9 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -9792,6 +9792,7 @@ const bfd_target alpha_vms_vec =
   ' ',				/* ar_pad_char.  */
   15,				/* ar_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
   bfd_getl16, bfd_getl_signed_16, bfd_putl16,
diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c
index 3752b911391..eaac8af2a22 100644
--- a/bfd/vms-lib.c
+++ b/bfd/vms-lib.c
@@ -2403,6 +2403,7 @@ const bfd_target alpha_vms_lib_txt_vec =
   ' ',				/* ar_pad_char.  */
   15,				/* ar_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
   bfd_getl16, bfd_getl_signed_16, bfd_putl16,
diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c
index 1fde4a57ab0..dc135645f4a 100644
--- a/bfd/wasm-module.c
+++ b/bfd/wasm-module.c
@@ -794,6 +794,7 @@ const bfd_target wasm_vec =
   ' ',				/* AR_pad_char.  */
   255,				/* AR_max_namelen.  */
   0,				/* Match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   /* Routines to byte-swap various sized integers from the data sections.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
diff --git a/bfd/xsym.c b/bfd/xsym.c
index ea266031410..e9283f63ad7 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -2298,6 +2298,7 @@ const bfd_target sym_vec =
   ' ',				/* AR_pad_char.  */
   16,				/* AR_max_namelen.  */
   0,				/* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 560e7c648d1..62ee22202ff 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3204,6 +3204,30 @@ 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)
+    {
+      if (bfd_keep_unused_section_symbols (obfd))
+	{
+	  /* 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
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 4834233ad31..51d26b762b3 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -100,7 +100,11 @@ proc readelf_test { options binary_file regexp_file xfails } {
 	return
     }
 
-    set target_machine ""
+    if { [is_elf_unused_section_symbols ] } {
+	set target_machine unused
+    } else {
+	set target_machine ""
+    }
     if [istarget "mips*-*-*"] then {
 	if [is_bad_symtab] then {
 	    set target_machine mips
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index a1e6cd1bbd8..5582d77c372 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.s-64-unused b/binutils/testsuite/binutils-all/readelf.s-64-unused
new file mode 100644
index 00000000000..a1e6cd1bbd8
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.s-64-unused
@@ -0,0 +1,27 @@
+There are .* section headers, starting at offset .*:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Offset
+ +Size +EntSize +Flags +Link +Info +Align
+ +\[ 0\] +NULL +0000000000000000 +00000000
+ +0000000000000000 +0000000000000000 +0 +0 +0
+ +\[ 1\] .text +PROGBITS +0000000000000000 +00000040
+ +00000000000000.. +0000000000000000 +AX +0 +0 +.*
+ +\[ 2\] .rel.+text +REL. +0+ +0+.*
+ +000000000000001. +000000000000001. +I +. +1 +8
+ +\[ 3\] .data +PROGBITS +0000000000000000 +000000(48|50)
+ +000000000000000[48] +0000000000000000 +WA +0 +0 +.*
+ +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
+ +0000000000000000 +0000000000000000 +WA +0 +0 +.*
+# x86 targets may put .note.gnu.property here.
+#...
+ +\[ .\] .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
+ +\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
+ +0+.* +0000000000000000 .* +0 +0 +1
+ +\[ .\] .shstrtab +STRTAB +0000000000000000 +[0-9a-f]+
+ +00000000000000.. +0000000000000000 .* +0 +0 +.*
+Key to Flags:
+#...
diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss
index acc6d9390c5..5fbb5d002e3 100644
--- a/binutils/testsuite/binutils-all/readelf.ss
+++ b/binutils/testsuite/binutils-all/readelf.ss
@@ -2,10 +2,7 @@
 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...
 #...
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64 b/binutils/testsuite/binutils-all/readelf.ss-64
index bd10cabef35..99a732f71f5 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64
+++ b/binutils/testsuite/binutils-all/readelf.ss-64
@@ -2,10 +2,7 @@
 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
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64-unused b/binutils/testsuite/binutils-all/readelf.ss-64-unused
new file mode 100644
index 00000000000..bd10cabef35
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.ss-64-unused
@@ -0,0 +1,18 @@
+
+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
+# 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 +UND external_symbol
+ +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
+ +[0-9]+: 0000000000000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +COM common_symbol
+#pass
diff --git a/binutils/testsuite/binutils-all/readelf.ss-unused b/binutils/testsuite/binutils-all/readelf.ss-unused
new file mode 100644
index 00000000000..acc6d9390c5
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.ss-unused
@@ -0,0 +1,20 @@
+
+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
+# 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 +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
+ +[0-9]+: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(COM|ANSI_COM) common_symbol
+#...
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 6552d302649..0fbf74c040e 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -248,6 +248,37 @@ proc is_generic { } {
     return 0
 }
 
+# True if the object format is ELF with unused section symbols.
+proc is_elf_unused_section_symbols {} {
+    global AS ASFLAGS READELF
+
+    if { ![is_elf_format] } {
+	return 0
+    }
+
+    set base "empty[pid]"
+    set src "$base.s"
+    set obj "$base.obj"
+    set f [open $src "w"]
+    close $f
+    set cmd "$AS $ASFLAGS -o $obj $src"
+    send_log "$cmd\n"
+    set cmdret [remote_exec host $cmd]
+    set cmdret [lindex $cmdret 0]
+    set unused_section_symbols 1
+    if { $cmdret == 0 } {
+	set cmd "$READELF -sW $obj"
+	send_log "$cmd\n"
+	set got [remote_exec host $cmd]
+	if { ![string match "*SECTION*" $got] }  {
+	    set unused_section_symbols 0
+	}
+    }
+    file delete $obj
+    file delete $src
+    return $unused_section_symbols
+}
+
 # True if the ELF target supports STB_GNU_UNIQUE.
 #
 # This require ELFOSABI_GNU, and `bfd_elf_final_link'.
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 94fa8051a0b..6c0a6ae9ee2 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2841,6 +2841,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/read.c b/gas/read.c
index 9d0ba27ea8c..be6e3e03d45 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 8e4b310afeb..191879eb08e 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -89,6 +89,10 @@ subseg_set_rest (segT seg, subsegT subseg)
 
   seginfo = seg_info (seg);
 
+  /* Should the section symbol be kept?  */
+  if (bfd_keep_unused_section_symbols (stdoutput))
+    seg->symbol->flags |= BSF_SECTION_SYM_USED;
+
   /* Attempt to find or make a frchain for that subsection.
      We keep the list sorted by subsection number.  */
   for (frcP = *(lastPP = &seginfo->frchainP);
diff --git a/gas/testsuite/gas/cfi/cfi-label.d b/gas/testsuite/gas/cfi/cfi-label.d
index 0350b57f134..c6507138b43 100644
--- a/gas/testsuite/gas/cfi/cfi-label.d
+++ b/gas/testsuite/gas/cfi/cfi-label.d
@@ -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 5cfb7a6237e..a0f98eddd67 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -54,7 +54,11 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
 
 # We're testing bits in obj-elf -- don't run on anything else.
 if { [is_elf_format] } then {
-    set target_machine ""
+    if { [is_elf_unused_section_symbols ] } {
+	set target_machine -unused
+    } else {
+	set target_machine ""
+    }
     set dump_opts ""
     if {[istarget "arc*-*-*"]} {
 	set target_machine -arc
diff --git a/gas/testsuite/gas/elf/section2.e b/gas/testsuite/gas/elf/section2.e
index 9b50798bcfa..e69de29bb2d 100644
--- a/gas/testsuite/gas/elf/section2.e
+++ b/gas/testsuite/gas/elf/section2.e
@@ -1,8 +0,0 @@
-
-Symbol table '.symtab' contains 5 entries:
- +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
- +0: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND 
- +1: 0+0 +0 +SECTION +LOCAL +DEFAULT +1 
- +2: 0+0 +0 +SECTION +LOCAL +DEFAULT +2 
- +3: 0+0 +0 +SECTION +LOCAL +DEFAULT +3 
- +4: 0+0 +0 +SECTION +LOCAL +DEFAULT +4 
diff --git a/gas/testsuite/gas/elf/section2.e-unused b/gas/testsuite/gas/elf/section2.e-unused
new file mode 100644
index 00000000000..9b50798bcfa
--- /dev/null
+++ b/gas/testsuite/gas/elf/section2.e-unused
@@ -0,0 +1,8 @@
+
+Symbol table '.symtab' contains 5 entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +0: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND 
+ +1: 0+0 +0 +SECTION +LOCAL +DEFAULT +1 
+ +2: 0+0 +0 +SECTION +LOCAL +DEFAULT +2 
+ +3: 0+0 +0 +SECTION +LOCAL +DEFAULT +3 
+ +4: 0+0 +0 +SECTION +LOCAL +DEFAULT +4 
diff --git a/gas/testsuite/gas/elf/symver.d b/gas/testsuite/gas/elf/symver.d
index 7fcc62a5caa..2292e3267d9 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 7f69d660b37..3acf1487b38 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 e5b74fa5c98..64b052dc935 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-1.d
@@ -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 6f96134f136..65f6890dae7 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-3.d
@@ -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 8ce06b0f848..4571a484ea9 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-size-5.d
@@ -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 bd532b73e88..274ddb06274 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-unwind.d
@@ -3,7 +3,7 @@
 #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 d582bbecc94..b187e5d4a3f 100644
--- a/gas/testsuite/gas/i386/size-1.d
+++ b/gas/testsuite/gas/i386/size-1.d
@@ -5,19 +5,19 @@
 
 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 2b08707f432..b45811c5d8e 100644
--- a/gas/testsuite/gas/i386/size-3.d
+++ b/gas/testsuite/gas/i386/size-3.d
@@ -5,15 +5,15 @@
 
 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/svr4.d b/gas/testsuite/gas/i386/svr4.d
index 3a463541928..28205066684 100644
--- a/gas/testsuite/gas/i386/svr4.d
+++ b/gas/testsuite/gas/i386/svr4.d
@@ -4,9 +4,6 @@
 .*: +file format .*
 
 SYMBOL TABLE:
-0+00 .* \.text[ 	]+0+ \.text
-0+00 .* \.data[ 	]+0+ \.data
-0+00 .* \.bss[ 	]+0+ \.bss
 0+00 .* \.text[ 	]+0+ svr4
 0+04 .* \*ABS\*[ 	]+0+ a
 0+03 .* \*ABS\*[ 	]+0+ b
diff --git a/gas/testsuite/gas/i386/x86-64-size-1.d b/gas/testsuite/gas/i386/x86-64-size-1.d
index 657408cf733..57db8994372 100644
--- a/gas/testsuite/gas/i386/x86-64-size-1.d
+++ b/gas/testsuite/gas/i386/x86-64-size-1.d
@@ -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 943a64e9ac6..4688dc938b3 100644
--- a/gas/testsuite/gas/i386/x86-64-size-3.d
+++ b/gas/testsuite/gas/i386/x86-64-size-3.d
@@ -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 c34d0eedaab..d18ffcd3a41 100644
--- a/gas/testsuite/gas/i386/x86-64-size-5.d
+++ b/gas/testsuite/gas/i386/x86-64-size-5.d
@@ -5,13 +5,13 @@
 
 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 7f8d94fe86e..ca3047277e7 100644
--- a/gas/testsuite/gas/i386/x86-64-unwind.d
+++ b/gas/testsuite/gas/i386/x86-64-unwind.d
@@ -2,7 +2,7 @@
 #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 ca14b3734bd..75ba971eb4b 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.  Generate unused section symbols only if needed.  */
   nsyms = 0;
   for (symp = symbol_rootP; symp; symp = symbol_next (symp))
-    nsyms++;
+    if (bfd_keep_unused_section_symbols (stdoutput)
+	|| !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 (bfd_keep_unused_section_symbols (stdoutput)
+	    || !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/ld/testsuite/ld-elf/export-class.sd b/ld/testsuite/ld-elf/export-class.sd
index bd5c5491d93..e71248268cb 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 ac4b5178d8b..aa5e9515248 100644
--- a/ld/testsuite/ld-elf/loadaddr3b.d
+++ b/ld/testsuite/ld-elf/loadaddr3b.d
@@ -3,9 +3,6 @@
 #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 70c467af2a8..0a6b1d01621 100644
--- a/ld/testsuite/ld-elf/sec64k.exp
+++ b/ld/testsuite/ld-elf/sec64k.exp
@@ -196,11 +196,15 @@ if { ![istarget "d10v-*-*"]
     puts $ofd "  \\\[65279\\\] \\.foo\\.\[0-9\]+ .*"
     puts $ofd "  \\\[65280\\\] \\.foo\\.\[0-9\]+ .*"
     puts $ofd "#..."
-    puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+SECTION\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. "
-    puts $ofd "#..."
-    puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+\[0-9\] bar_1$"
-    puts $ofd "#..."
-    puts $ofd ".* bar_66000$"
+    if { [is_elf_unused_section_symbols ] } {
+	puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+SECTION\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. "
+	puts $ofd "#..."
+	puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+\[0-9\] bar_1$"
+	puts $ofd "#..."
+	puts $ofd ".* bar_66000$"
+    } else {
+	puts $ofd " 66...: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. bar_66000$"
+    }
     puts $ofd "#..."
     # Global symbols are not in "alphanumeric" order, so we just check
     # that the first and the last are present in any order (assuming no
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d
index a7eaa1f77d9..b0648ae9e03 100644
--- a/ld/testsuite/ld-i386/ibt-plt-1.d
+++ b/ld/testsuite/ld-i386/ibt-plt-1.d
@@ -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 9c8f5996a72..42aa2ce7410 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
@@ -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 a9c8642ced2..445e08fa8b3 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2c.d
@@ -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 b4366c93150..b357a74a33b 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3a.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
@@ -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 b4366c93150..b357a74a33b 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
@@ -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 5c047d4debd..fe0f3efb1be 100644
--- a/ld/testsuite/ld-i386/plt-pic.pd
+++ b/ld/testsuite/ld-i386/plt-pic.pd
@@ -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 8162234aab4..c9af97203ab 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 efcd8a1b1d7..9c395c3b8d3 100644
--- a/ld/testsuite/ld-i386/plt.pd
+++ b/ld/testsuite/ld-i386/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]+
  +[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 c9d673f65a7..5623fe9685b 100644
--- a/ld/testsuite/ld-i386/plt2.dd
+++ b/ld/testsuite/ld-i386/plt2.dd
@@ -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 b7e6aba92c9..f294c9c707a 100644
--- a/ld/testsuite/ld-i386/pr19636-1d.d
+++ b/ld/testsuite/ld-i386/pr19636-1d.d
@@ -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 8f2a8e5127f..a7568aa74a9 100644
--- a/ld/testsuite/ld-i386/pr19636-1l.d
+++ b/ld/testsuite/ld-i386/pr19636-1l.d
@@ -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 4b49c817555..92b241073cb 100644
--- a/ld/testsuite/ld-i386/pr19636-2c.d
+++ b/ld/testsuite/ld-i386/pr19636-2c.d
@@ -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 20e4c5ed361..39afcd0b5b7 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 .*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 5177f4d30dd..fcbecc31966 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 .*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 1c9c4f2cb2a..b831f89133c 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 .*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 a5b4fb83c0e..ec418d1a1fc 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 .*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 ef131ef8576..0744aeb78b0 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 661f1c46c6b..229ce23a9af 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 .*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 3425c951bd0..135d74907d1 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 .*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 274445db842..ce85a55be45 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 .*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 2c917fa2936..0d3f7b80d06 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
@@ -10,7 +10,7 @@
 
 Disassembly of section .plt:
 
-0+f0 <.plt>:
+0+f0 <\*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+100 <\*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    f0 <.plt>
+ +[a-f0-9]+:	e9 e0 ff ff ff       	jmp    f0 <\*ABS\*@plt-0x10>
 
 Disassembly of section .text:
 
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 01f6a781467..48d2084d38f 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
@@ -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 375cecd6f25..14866a8f6cc 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
@@ -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 9cd35181b81..1cd60941ac0 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
@@ -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 de12e9f5433..69a4ade87f4 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -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 de12e9f5433..69a4ade87f4 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -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 082d0674227..6747b3408dd 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d
@@ -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 68123bf0ca7..0b9817d4372 100644
--- a/ld/testsuite/ld-ifunc/pr17154-i386.d
+++ b/ld/testsuite/ld-ifunc/pr17154-i386.d
@@ -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 928a6a78d75..4cc1dc206d5 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
@@ -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 8a6861dcde3..9fb23d410e3 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
@@ -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 9640beac2d1..b7bc4e526cc 100644
--- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
@@ -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 25af7f81d45..15ecfe1cc50 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
@@ -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 634940d5b1e..211d72d2335 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
@@ -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 7a0356cc695..f80ba15aa35 100644
--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
@@ -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 be5392c45f9..24e28210a0a 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
@@ -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 cca370527a6..ab3ab45faaf 100644
--- a/ld/testsuite/ld-x86-64/bnd-plt-1.d
+++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d
@@ -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 2018b119362..b011e3f158a 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
@@ -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 d556ec13f65..15563b432d1 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d
@@ -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 5168a31c743..a19cece98e8 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
@@ -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 01401ba1417..92785929092 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
@@ -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 9f9663cca32..b00ab920c0e 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
@@ -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 aa81fb9ddb8..b7969d8c574 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
@@ -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 bf185d548fb..d6f8bb3afbe 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
@@ -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 27dd93c8e52..9c15ed4f928 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
@@ -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 66f47051244..f09b1a666ad 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
@@ -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 5c918b8b4d5..5c19e3dc96d 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
@@ -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/mpx3.dd b/ld/testsuite/ld-x86-64/mpx3.dd
index 96e56fc5e08..729b1cf4e97 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 f4609d5ed6e..a1eba8e975b 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 35f6869bad4..50a0fbca502 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 55856107675..92177bb1216 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 1ff644ee9c8..4966d55fb5a 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 1ff644ee9c8..4966d55fb5a 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 1ff644ee9c8..4966d55fb5a 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 302a345b2e2..e0bde11d84e 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/plt.pd b/ld/testsuite/ld-x86-64/plt.pd
index 54a00dffc4d..6b4024c5c93 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 663ec98192b..454bc060dd4 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 f2634947d62..48adc947e75 100644
--- a/ld/testsuite/ld-x86-64/pr19609-4e.d
+++ b/ld/testsuite/ld-x86-64/pr19609-4e.d
@@ -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 b340287f48b..265825d4c6c 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6a.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6a.d
@@ -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 810023b2b96..1f769eff4d3 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6b.d
@@ -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 20b42e838db..d85e5e9425d 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7b.d
@@ -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 034a57b1e00..6eb511080dd 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7d.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7d.d
@@ -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 c9b256dd449..1b894b3e97c 100644
--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
@@ -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 28fbc998eaa..f9f03ba8403 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1d.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1d.d
@@ -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 132fa03afc3..7d9b1475d5c 100644
--- a/ld/testsuite/ld-x86-64/pr20253-1h.d
+++ b/ld/testsuite/ld-x86-64/pr20253-1h.d
@@ -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 62e80dc06b4..c042b6cf702 100644
--- a/ld/testsuite/ld-x86-64/pr21038b-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038b-now.d
@@ -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 126c1d2efee..144ed44cccf 100644
--- a/ld/testsuite/ld-x86-64/pr21038b.d
+++ b/ld/testsuite/ld-x86-64/pr21038b.d
@@ -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 19a4ea8fcb7..2058512b74e 100644
--- a/ld/testsuite/ld-x86-64/pr21038c-now.d
+++ b/ld/testsuite/ld-x86-64/pr21038c-now.d
@@ -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 35e7d83c4e0..a62d43a7bc0 100644
--- a/ld/testsuite/ld-x86-64/pr21038c.d
+++ b/ld/testsuite/ld-x86-64/pr21038c.d
@@ -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 95770d3cefd..5113a2c44a3 100644
--- a/ld/testsuite/ld-x86-64/pr23854.d
+++ b/ld/testsuite/ld-x86-64/pr23854.d
@@ -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\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 03 1d ([0-9a-f]{2} ){4} *	add    0x[a-f0-9]+\(%rip\),%bx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 23 0d ([0-9a-f]{2} ){4} *	and    0x[a-f0-9]+\(%rip\),%cx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 3b 15 ([0-9a-f]{2} ){4} *	cmp    0x[a-f0-9]+\(%rip\),%dx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 0b 3d ([0-9a-f]{2} ){4} *	or     0x[a-f0-9]+\(%rip\),%di        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 1b 35 ([0-9a-f]{2} ){4} *	sbb    0x[a-f0-9]+\(%rip\),%si        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 2b 2d ([0-9a-f]{2} ){4} *	sub    0x[a-f0-9]+\(%rip\),%bp        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 44 33 05 ([0-9a-f]{2} ){4} *	xor    0x[a-f0-9]+\(%rip\),%r8w        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 85 0d ([0-9a-f]{2} ){4} *	test   %cx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 13 05 ([0-9a-f]{2} ){4} *	adc    0x[a-f0-9]+\(%rip\),%ax        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 03 1d ([0-9a-f]{2} ){4} *	add    0x[a-f0-9]+\(%rip\),%bx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 23 0d ([0-9a-f]{2} ){4} *	and    0x[a-f0-9]+\(%rip\),%cx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 3b 15 ([0-9a-f]{2} ){4} *	cmp    0x[a-f0-9]+\(%rip\),%dx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 0b 3d ([0-9a-f]{2} ){4} *	or     0x[a-f0-9]+\(%rip\),%di        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 1b 35 ([0-9a-f]{2} ){4} *	sbb    0x[a-f0-9]+\(%rip\),%si        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 2b 2d ([0-9a-f]{2} ){4} *	sub    0x[a-f0-9]+\(%rip\),%bp        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 44 33 05 ([0-9a-f]{2} ){4} *	xor    0x[a-f0-9]+\(%rip\),%r8w        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+ +[a-f0-9]+:	66 85 0d ([0-9a-f]{2} ){4} *	test   %cx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-3.d b/ld/testsuite/ld-x86-64/pr25416-3.d
index 9c1da134847..26927d99562 100644
--- a/ld/testsuite/ld-x86-64/pr25416-3.d
+++ b/ld/testsuite/ld-x86-64/pr25416-3.d
@@ -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\+0x[a-f0-9]+>
  +[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\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/pr25416-4.d b/ld/testsuite/ld-x86-64/pr25416-4.d
index 8d91fbc0a66..d98121f1f31 100644
--- a/ld/testsuite/ld-x86-64/pr25416-4.d
+++ b/ld/testsuite/ld-x86-64/pr25416-4.d
@@ -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\+0x[a-f0-9]+>
  +[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\+0x[a-f0-9]+>
 #pass
diff --git a/ld/testsuite/ld-x86-64/tlsbin.rd b/ld/testsuite/ld-x86-64/tlsbin.rd
index c535732b759..54fe876ecc2 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 .*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 b1205fe49a7..495115eb708 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 .*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 9e46ca1d0fc..682c4a066a2 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 .*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 a15c6e0f22a..58feb20e55a 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 .*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 77e8ae3d819..ca8f19bf3f7 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 024e124e515..2e44dc6ac6b 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 .*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 a39a8fe0d0d..60decd2787b 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 .*tlspic3.o
 .* TLS +LOCAL +DEFAULT +8 sl1
 .* TLS +LOCAL +DEFAULT +8 sl2
-- 
2.29.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: V2 [PATCH] ELF: Don't generate unused section symbols
  2021-01-05 16:21         ` V2 " H.J. Lu
@ 2021-01-07 14:35           ` Nick Clifton
  2021-01-07 20:32             ` Fangrui Song
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2021-01-07 14:35 UTC (permalink / raw)
  To: H.J. Lu, Alan Modra; +Cc: Binutils

Hi H.J.

>>> Tested on Linux/x86.  Other ELF backends need:
>>>
>>> 1. Mark used section symbols in assembler backend.
>>> 2. Remove unused section symbols from expected assembler and linker
>>> outputs.
>>
>> In that case definitely not something we want before 2.36 goes out the
>> door.
>>
> 
> Here is the updated patch to make the new behavior opt-in.
> OK for master?

Yes - approved - please apply.

Cheers
   Nick




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: V2 [PATCH] ELF: Don't generate unused section symbols
  2021-01-07 14:35           ` Nick Clifton
@ 2021-01-07 20:32             ` Fangrui Song
  0 siblings, 0 replies; 8+ messages in thread
From: Fangrui Song @ 2021-01-07 20:32 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Alan Modra, Nick Clifton, Binutils

On 2021-01-07, Nick Clifton via Binutils wrote:
>Hi H.J.
>
>>>>Tested on Linux/x86.  Other ELF backends need:
>>>>
>>>>1. Mark used section symbols in assembler backend.
>>>>2. Remove unused section symbols from expected assembler and linker
>>>>outputs.
>>>
>>>In that case definitely not something we want before 2.36 goes out the
>>>door.
>>>
>>
>>Here is the updated patch to make the new behavior opt-in.
>>OK for master?
>
>Yes - approved - please apply.
>

Hi, H.J.

Thanks for the patch. This will save a lot of space in .o/.a files.

For some differences, I think there is an objdump -d problem:

- +[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>

.got+0x8 (a small offset) should be preferred over _DYNAMIC+0x108 (a large offset),
regardless of whether STT_SECTION .got exists (I don't check how ld behaves differently with the gas change).

I think this is an existing objdump issue (https://sourceware.org/bugzilla/show_bug.cgi?id=24702).
The commit just reveals more instances.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-07 20:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28  3:25 [PATCH] Add --generate-unused-section-symbols=[yes|no] H.J. Lu
2021-01-03 23:33 ` Alan Modra
2021-01-04  0:51   ` H.J. Lu
2021-01-04 18:43     ` [PATCH] ELF: Don't generate unused section symbols H.J. Lu
2021-01-05  1:23       ` Alan Modra
2021-01-05 16:21         ` V2 " H.J. Lu
2021-01-07 14:35           ` Nick Clifton
2021-01-07 20:32             ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).