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 to: 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/ 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/ 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/ 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.
This commit is contained in:
parent
3b288c8e2e
commit
d1bcae833b
@ -1,3 +1,79 @@
|
||||
2021-01-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
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.
|
||||
|
||||
2021-01-07 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR 25713
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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 bfd_boolean
|
||||
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);
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
#endif
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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, \
|
||||
|
15
bfd/elf.c
15
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;
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
||||
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++)
|
||||
if (bfd_keep_unused_section_symbols (abfd) || emit_relocs)
|
||||
{
|
||||
o = bfd_section_from_elf_index (abfd, i);
|
||||
if (o != NULL)
|
||||
bfd_boolean name_local_sections
|
||||
= (bed->elf_backend_name_local_section_symbols
|
||||
&& bed->elf_backend_name_local_section_symbols (abfd));
|
||||
const char *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->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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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. */
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
@ -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 bfd_boolean
|
||||
.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).
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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. */
|
||||
|
@ -1,3 +1,19 @@
|
||||
2021-01-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
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.
|
||||
|
||||
2021-01-06 Reuben Thomas <rrt@sc3d.org>
|
||||
|
||||
* binutils/readelf.c: Correct grammar in comment.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]+
|
||||
|
27
binutils/testsuite/binutils-all/readelf.s-64-unused
Normal file
27
binutils/testsuite/binutils-all/readelf.s-64-unused
Normal file
@ -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:
|
||||
#...
|
@ -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...
|
||||
#...
|
||||
|
@ -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
|
||||
|
18
binutils/testsuite/binutils-all/readelf.ss-64-unused
Normal file
18
binutils/testsuite/binutils-all/readelf.ss-64-unused
Normal file
@ -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
|
20
binutils/testsuite/binutils-all/readelf.ss-unused
Normal file
20
binutils/testsuite/binutils-all/readelf.ss-unused
Normal file
@ -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
|
||||
#...
|
@ -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 {![info exists elf_unused_section_symbols_saved]} {
|
||||
set elf_unused_section_symbols_saved 1
|
||||
if { [is_elf_format] } {
|
||||
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]
|
||||
if { $cmdret == 0 } {
|
||||
set cmd "$READELF -sW $obj"
|
||||
send_log "$cmd\n"
|
||||
set got [remote_exec host $cmd]
|
||||
if { ![string match "*SECTION*" $got] } {
|
||||
set elf_unused_section_symbols_saved 0
|
||||
}
|
||||
}
|
||||
file delete $obj
|
||||
file delete $src
|
||||
}
|
||||
}
|
||||
return $elf_unused_section_symbols_saved
|
||||
}
|
||||
|
||||
# True if the ELF target supports STB_GNU_UNIQUE.
|
||||
#
|
||||
# This require ELFOSABI_GNU, and `bfd_elf_final_link'.
|
||||
|
@ -1,3 +1,36 @@
|
||||
2021-01-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
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.
|
||||
|
||||
2021-01-07 Philipp Tomsich <prt@gnu.org>
|
||||
|
||||
* config/tc-riscv.c (riscv_multi_subset_supports): Added
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,8 +1 @@
|
||||
|
||||
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
|
||||
|
8
gas/testsuite/gas/elf/section2.e-unused
Normal file
8
gas/testsuite/gas/elf/section2.e-unused
Normal file
@ -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
|
@ -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
|
||||
#...
|
||||
|
@ -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
|
||||
#...
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
#...
|
||||
|
43
gas/write.c
43
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 ? */
|
||||
}
|
||||
|
86
ld/ChangeLog
86
ld/ChangeLog
@ -1,3 +1,89 @@
|
||||
2021-01-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
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.
|
||||
|
||||
2021-01-07 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* testsuite/ld-scripts/fill.d: Skip sh-*-pe rather than xfail.
|
||||
|
@ -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
|
||||
#...
|
||||
|
@ -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
|
||||
#...
|
||||
|
@ -198,11 +198,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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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>
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user