From 3c9458e9534287bda2ab643e6c39b0008595a493 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 8 Oct 2004 14:54:04 +0000 Subject: [PATCH] Implement a new BFD API function: bfd_is_target_special_symbol. Use this in nm and objdump to skip the displaying of ARM Mapping symbols unless specifically requested. --- bfd/ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ bfd/aout-target.h | 4 ++++ bfd/aout-tic30.c | 5 +++++ bfd/bfd-in2.h | 8 +++++++- bfd/binary.c | 1 + bfd/coffcode.h | 4 ++++ bfd/configure | 2 +- bfd/configure.in | 2 +- bfd/elf32-arm.h | 12 +++++++++++- bfd/elfxx-target.h | 4 ++++ bfd/i386msdos.c | 1 + bfd/ieee.c | 2 ++ bfd/ihex.c | 1 + bfd/libaout.h | 5 +++++ bfd/libbfd-in.h | 2 ++ bfd/libbfd.h | 2 ++ bfd/libecoff.h | 2 ++ bfd/mach-o.c | 2 ++ bfd/mmo.c | 2 ++ bfd/nlm-target.h | 2 ++ bfd/oasys.c | 1 + bfd/pef.c | 1 + bfd/ppcboot.c | 2 ++ bfd/srec.c | 1 + bfd/syms.c | 17 +++++++++++++++++ bfd/targets.c | 3 ++- bfd/tekhex.c | 1 + bfd/versados.c | 2 ++ bfd/vms.c | 1 + bfd/xcoff-target.h | 1 + bfd/xsym.c | 1 + binutils/ChangeLog | 12 ++++++++++++ binutils/NEWS | 6 ++++++ binutils/doc/binutils.texi | 16 +++++++++++++++- binutils/nm.c | 8 ++++++++ binutils/objdump.c | 7 +++++++ 36 files changed, 175 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9f24c81..a0d5663 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,41 @@ +2004-10-08 Nick Clifton + + * configure.in: (AM_INIT_AUTOMAKE): Set version to 2.15.93. + * configure: Regenerate. + * bfd-in2.h: Regenerate. + * syms.c (bfd_is_target_special_symbol): New interface function. + Returns true when a symbol should be considered to be special. + * targets.h (bfd_target): Include bfd_is_target_special_symbol in + the symbol jump table. + * elf32-arm.h (elf32_arm_is_target_special_symbol): New function. + Return true iff the symbol is a mapping symbol. + (bfd_elf32_bfd_is_target_special_symbol): Define. + * elfxx-target.h: Provide a default definition for + bfd_is_target_special_symbol. + * aout-target.h: Likewise. + * aout-tic30.c: Likewise. + * binary.c: LIkewise. + * coffcode.h: Likewise. + * i386msdos.c: Likewise. + * ieee.c: Likewise. + * ihex.c: LIkewise. + * libaout.h: Likewise. + * libbfd-in.h: Likewise + * libecoff.h: Likewise. + * mach-o.c: Likewise. + * mmo.c: Likewise. + * nlm-target.h: Likewise. + * oasys.c: Likewise. + * pef.c: Likewise. + * ppcboot.c: Likewise. + * srec.c: Likewise. + * tekhex.c: Likewise. + * versados.c: Likewise. + * vms.c: Likewise. + * xcoff-target.h: Likewise. + * xsym.c: Likewise. + * libbfd.h: Regenerate. + 2004-10-08 Daniel Jacobowitz * config.bfd: Include 64-bit support for i[3-7]86-*-solaris2*. diff --git a/bfd/aout-target.h b/bfd/aout-target.h index a169704..913339f 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -579,6 +579,10 @@ MY_bfd_final_link (abfd, info) #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name #endif +#ifndef MY_bfd_is_target_special_symbol +#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef MY_bfd_free_cached_info #define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index a9c06ff..850c558 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1036,6 +1036,11 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name #endif +#ifndef MY_bfd_is_target_special_symbol +#define MY_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef MY_bfd_free_cached_info #define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 2e851a9..2e13704 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3828,6 +3828,11 @@ bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); #define bfd_is_local_label_name(abfd, name) \ BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) +bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); + +#define bfd_is_target_special_symbol(abfd, sym) \ + BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) + #define bfd_canonicalize_symtab(abfd, location) \ BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) @@ -4443,6 +4448,7 @@ typedef struct bfd_target NAME##_print_symbol, \ NAME##_get_symbol_info, \ NAME##_bfd_is_local_label_name, \ + NAME##_bfd_is_target_special_symbol, \ NAME##_get_lineno, \ NAME##_find_nearest_line, \ NAME##_bfd_make_debug_symbol, \ @@ -4461,7 +4467,7 @@ typedef struct bfd_target (bfd *, struct bfd_symbol *, symbol_info *); #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); alent * (*_get_lineno) (bfd *, struct bfd_symbol *); bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, diff --git a/bfd/binary.c b/bfd/binary.c index 4335a28..4528672 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -234,6 +234,7 @@ binary_get_symbol_info (ignore_abfd, symbol, ret) bfd_symbol_info (symbol, ret); } +#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name #define binary_get_lineno _bfd_nosymbols_get_lineno #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 51d00c6..9d78c25 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5547,6 +5547,10 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_is_local_label_name _bfd_coff_is_local_label_name #endif +#ifndef coff_bfd_is_target_special_symbol +#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef coff_read_minisymbols #define coff_read_minisymbols _bfd_generic_read_minisymbols #endif diff --git a/bfd/configure b/bfd/configure index 6710ec6..f249bb2 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2834,7 +2834,7 @@ fi # Define the identity of the package. PACKAGE=bfd - VERSION=2.15.92 + VERSION=2.15.93 cat >>confdefs.h <<_ACEOF diff --git a/bfd/configure.in b/bfd/configure.in index c5fe78e..cc8afcf 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c]) AC_CANONICAL_TARGET AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.15.92) +AM_INIT_AUTOMAKE(bfd, 2.15.93) dnl These must be called before AM_PROG_LIBTOOL, because it may want dnl to call AC_CHECK_PROG. diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index be6391c..a0695c1 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -25,7 +25,7 @@ typedef unsigned long int insn32; typedef unsigned short int insn16; -/* In leiu of proper flags, assume all EABIv3 objects are interworkable. */ +/* In lieu of proper flags, assume all EABIv3 objects are interworkable. */ #define INTERWORK_FLAG(abfd) \ (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER3 \ || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)) @@ -2328,6 +2328,7 @@ elf32_arm_object_p (bfd *abfd) } /* Function to keep ARM specific flags in the ELF header. */ + static bfd_boolean elf32_arm_set_private_flags (bfd *abfd, flagword flags) { @@ -3163,6 +3164,14 @@ is_arm_mapping_symbol_name (const char * name) && (name[2] == 0); } +/* Treat mapping symbols as special target symbols. */ + +static bfd_boolean +elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym) +{ + return is_arm_mapping_symbol_name (sym->name); +} + /* This is a copy of elf_find_function() from elf.c except that ARM mapping symbols are ignored when looking for function names and STT_ARM_TFUNC is considered to a function type. */ @@ -4462,6 +4471,7 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec, #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line #define bfd_elf32_new_section_hook elf32_arm_new_section_hook +#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol #define elf_backend_get_symbol_type elf32_arm_get_symbol_type #define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 18a8d0f..81202f8 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -188,6 +188,10 @@ #ifndef bfd_elfNN_bfd_is_local_label_name #define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name #endif +#ifndef bfd_elfNN_bfd_is_target_special_symbol +#define bfd_elfNN_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound #define bfd_elfNN_get_dynamic_reloc_upper_bound \ diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index aedcef0..a1a7baa 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -193,6 +193,7 @@ msdos_set_section_contents (abfd, section, location, offset, count) #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line #define msdos_get_lineno _bfd_nosymbols_get_lineno +#define msdos_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define msdos_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define msdos_read_minisymbols _bfd_nosymbols_read_minisymbols diff --git a/bfd/ieee.c b/bfd/ieee.c index aaf1f11..c16a1ed 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -4018,6 +4018,8 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_update_armap_timestamp bfd_true #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index +#define ieee_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name #define ieee_get_lineno _bfd_nosymbols_get_lineno #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff --git a/bfd/ihex.c b/bfd/ihex.c index 1392178..c692b03 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -968,6 +968,7 @@ ihex_sizeof_headers (abfd, exec) #define ihex_make_empty_symbol _bfd_generic_make_empty_symbol #define ihex_print_symbol _bfd_nosymbols_print_symbol #define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info +#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define ihex_get_lineno _bfd_nosymbols_get_lineno #define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/libaout.h b/bfd/libaout.h index a762895..ef9eae1 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -606,6 +606,11 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info) #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name #endif +#ifndef aout_32_bfd_is_target_special_symbol +#define aout_32_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef WRITE_HEADERS #define WRITE_HEADERS(abfd, execp) \ { \ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 7b6ca76..95399dc 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -299,6 +299,8 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ ((bfd_boolean (*) (bfd *, const char *)) bfd_false) +#define _bfd_nosymbols_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index c811de5..81f03c9 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -304,6 +304,8 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ ((bfd_boolean (*) (bfd *, const char *)) bfd_false) +#define _bfd_nosymbols_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ diff --git a/bfd/libecoff.h b/bfd/libecoff.h index b809f3a..495be63 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -272,6 +272,8 @@ extern bfd_boolean _bfd_ecoff_write_armap #define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index #define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt #define _bfd_ecoff_update_armap_timestamp bfd_true +#define _bfd_ecoff_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation)); diff --git a/bfd/mach-o.c b/bfd/mach-o.c index c4c05ab..19a19d4 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -44,6 +44,8 @@ #define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook #define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window #define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name +#define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno #define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line #define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff --git a/bfd/mmo.c b/bfd/mmo.c index 1b7eb86..a7745c1 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -3255,6 +3255,8 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) /* Perhaps we need to adjust this one; mmo labels (originally) without a leading ':' might more appropriately be called local. */ #define mmo_bfd_is_local_label_name bfd_generic_is_local_label_name +#define mmo_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) /* Is this one really used or defined by anyone? */ #define mmo_get_lineno _bfd_nosymbols_get_lineno diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 30ae4b1..1c727ed 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define nlm_print_symbol nlmNAME(print_symbol) #define nlm_get_symbol_info nlmNAME(get_symbol_info) #define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name +#define nlm_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define nlm_get_lineno _bfd_nosymbols_get_lineno #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff --git a/bfd/oasys.c b/bfd/oasys.c index c99919a..16f6b6d 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1489,6 +1489,7 @@ oasys_sizeof_headers (abfd, exec) #define oasys_update_armap_timestamp bfd_true #define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name +#define oasys_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define oasys_get_lineno _bfd_nosymbols_get_lineno #define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define oasys_read_minisymbols _bfd_generic_read_minisymbols diff --git a/bfd/pef.c b/bfd/pef.c index b52ae65..9bb3a76 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -37,6 +37,7 @@ #define bfd_pef_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define bfd_pef_new_section_hook _bfd_generic_new_section_hook #define bfd_pef_bfd_is_local_label_name bfd_generic_is_local_label_name +#define bfd_pef_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define bfd_pef_get_lineno _bfd_nosymbols_get_lineno #define bfd_pef_find_nearest_line _bfd_nosymbols_find_nearest_line #define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 49f8140..3444caa 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -345,6 +345,8 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret) bfd_symbol_info (symbol, ret); } +#define ppcboot_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name #define ppcboot_get_lineno _bfd_nosymbols_get_lineno #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/srec.c b/bfd/srec.c index 19dfaa9..e184a20 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1262,6 +1262,7 @@ srec_print_symbol (abfd, afile, symbol, how) #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define srec_new_section_hook _bfd_generic_new_section_hook +#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name #define srec_get_lineno _bfd_nosymbols_get_lineno #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/syms.c b/bfd/syms.c index e78f5ec..245369d 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -382,6 +382,23 @@ DESCRIPTION /* FUNCTION + bfd_is_target_special_symbol + +SYNOPSIS + bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); + +DESCRIPTION + Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something + special to the particular target represented by the BFD. Such symbols + should normally not be mentioned to the user. + +.#define bfd_is_target_special_symbol(abfd, sym) \ +. BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) +. +*/ + +/* +FUNCTION bfd_canonicalize_symtab DESCRIPTION diff --git a/bfd/targets.c b/bfd/targets.c index 05832d8..6b5c00c 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -338,6 +338,7 @@ BFD_JUMP_TABLE macros. . NAME##_print_symbol, \ . NAME##_get_symbol_info, \ . NAME##_bfd_is_local_label_name, \ +. NAME##_bfd_is_target_special_symbol, \ . NAME##_get_lineno, \ . NAME##_find_nearest_line, \ . NAME##_bfd_make_debug_symbol, \ @@ -356,7 +357,7 @@ BFD_JUMP_TABLE macros. . (bfd *, struct bfd_symbol *, symbol_info *); .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) . bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); -. +. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); . alent * (*_get_lineno) (bfd *, struct bfd_symbol *); . bfd_boolean (*_bfd_find_nearest_line) . (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, diff --git a/bfd/tekhex.c b/bfd/tekhex.c index a7a9254..df1dab5 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -989,6 +989,7 @@ tekhex_print_symbol (abfd, filep, symbol, how) #define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define tekhex_new_section_hook _bfd_generic_new_section_hook +#define tekhex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name #define tekhex_get_lineno _bfd_nosymbols_get_lineno #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/versados.c b/bfd/versados.c index 50b3487..68678c8 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -855,6 +855,8 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define versados_new_section_hook _bfd_generic_new_section_hook +#define versados_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name #define versados_get_lineno _bfd_nosymbols_get_lineno #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line diff --git a/bfd/vms.c b/bfd/vms.c index 640d0eb..15ab5b0 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -164,6 +164,7 @@ static bfd_boolean vms_bfd_merge_private_bfd_data static bfd_boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); +#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define vms_make_empty_symbol _bfd_generic_make_empty_symbol #define vms_bfd_link_just_syms _bfd_generic_link_just_syms #define vms_bfd_is_group_section bfd_generic_is_group_section diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h index 9b80e3c..78de54a 100644 --- a/bfd/xcoff-target.h +++ b/bfd/xcoff-target.h @@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define coff_mkobject _bfd_xcoff_mkobject #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup #define coff_relocate_section _bfd_ppc_xcoff_relocate_section diff --git a/bfd/xsym.c b/bfd/xsym.c index 3c4c84d..252be99 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -27,6 +27,7 @@ #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define bfd_sym_new_section_hook _bfd_generic_new_section_hook #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name +#define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 12196c6..ab1c857 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2004-10-08 Nick Clifton + + * nm.c: Add a new switch --special-syms which, if enabled, will + include the ARM Mapping symbols in nm's output. + (usage): Mention the switch. + (filter_symbols): Handle the switch. + * objdump.c: Add a similar switch. + (usage): Mention the switch. + (dump_symbols): Handle the switch. + * doc/binutils.texi: Document the new switches. + * NEWS: Mention the new switches. + 2004-10-08 Daniel Jacobowitz * readelf.c (get_x86_64_section_type_name): New function. diff --git a/binutils/NEWS b/binutils/NEWS index a753312..f7c2dd7 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,11 @@ -*- text -*- +* nm and objdump now have a switch "--special-syms" to enable the displaying of + symbols which the target considers to be special. By default these symbols + are no longer displayed. Currently the only special symbols are the Mapping + symbols used by the ARM port to mark transitions between text and data and + between ARM and THUMB code. + * dlltool has a switch "--ext-prefix-alias " to generate additional import and export symbols with prepended to them. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 0a80a0d..97a6538 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -663,7 +663,7 @@ The @sc{gnu} linker @command{ld} is now described in a separate manual. nm [@option{-a}|@option{--debug-syms}] [@option{-g}|@option{--extern-only}] [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}] [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}] - [@option{-A}|@option{-o}|@option{--print-file-name}] + [@option{-A}|@option{-o}|@option{--print-file-name}][@option{--special-syms}] [@option{-n}|@option{-v}|@option{--numeric-sort}] [@option{-p}|@option{--no-sort}] [@option{-r}|@option{--reverse-sort}] [@option{--size-sort}] [@option{-u}|@option{--undefined-only}] [@option{-t} @var{radix}|@option{--radix=}@var{radix}] [@option{-P}|@option{--portability}] @@ -879,6 +879,14 @@ value. If the @code{bsd} output format is used the size of the symbol is printed, rather than the value, and @samp{-S} must be used in order both size and value to be printed. +@item --special-syms +Display symbols which have a target-specific special meaning. These +symbols are usually used by the target for some special processing and +are not normally helpful when included included in the normal symbol +lists. For example for ARM targets this option would skip the mapping +symbols used to mark transistions between ARM code, THUMB code and +data. + @item -t @var{radix} @itemx --radix=@var{radix} Use @var{radix} as the radix for printing the symbol values. It must be @@ -1495,6 +1503,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{--prefix-addresses}] [@option{--[no-]show-raw-insn}] [@option{--adjust-vma=}@var{offset}] + [@option{--special-syms}] [@option{-V}|@option{--version}] [@option{-H}|@option{--help}] @var{objfile}@dots{} @@ -1837,6 +1846,11 @@ meaningful for dynamic objects, such as certain types of shared libraries. This is similar to the information provided by the @samp{nm} program when given the @option{-D} (@option{--dynamic}) option. +@item --special-syms +When displaying symbols include those which the target considers to be +special in some way and which would not normally be of interest to the +user. + @item -V @itemx --version Print the version number of @command{objdump} and exit. diff --git a/binutils/nm.c b/binutils/nm.c index be89cec..c35f7c8 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -152,6 +152,7 @@ static int show_version = 0; /* Show the version number. */ static int show_stats = 0; /* Show statistics. */ static int show_synthetic = 0; /* Display synthesized symbols too. */ static int line_numbers = 0; /* Print line numbers for symbols. */ +static int allow_special_symbols = 0; /* Allow special symbols. */ /* When to print the names of files. Not mutually exclusive in SYSV format. */ static int filename_per_file = 0; /* Once per file, on its own line. */ @@ -205,6 +206,7 @@ static struct option long_options[] = {"radix", required_argument, 0, 't'}, {"reverse-sort", no_argument, &reverse_sort, 1}, {"size-sort", no_argument, &sort_by_size, 1}, + {"special-syms", no_argument, &allow_special_symbols, 1}, {"stats", no_argument, &show_stats, 1}, {"synthetic", no_argument, &show_synthetic, 1}, {"target", required_argument, 0, OPTION_TARGET}, @@ -246,6 +248,7 @@ usage (FILE *stream, int status) -S, --print-size Print size of defined symbols\n\ -s, --print-armap Include index for symbols from archive members\n\ --size-sort Sort symbols by size\n\ + --skip-special Ignore special symbols\n\ --synthetic Display synthetic symbols as well\n\ -t, --radix=RADIX Use RADIX for printing symbol values\n\ --target=BFDNAME Specify the target object format as BFDNAME\n\ @@ -446,6 +449,11 @@ filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, keep = 0; } + if (keep + && bfd_is_target_special_symbol (abfd, sym) + && ! allow_special_symbols) + keep = 0; + if (keep) { memcpy (to, from, size); diff --git a/binutils/objdump.c b/binutils/objdump.c index e56bf36..73af429 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -102,6 +102,7 @@ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ static int dump_debugging; /* --debugging */ static int dump_debugging_tags; /* --debugging-tags */ +static int dump_special_syms = 0; /* --special-syms */ static bfd_vma adjust_section_vma = 0; /* --adjust-vma */ static int file_start_context = 0; /* --file-start-context */ @@ -217,6 +218,7 @@ usage (FILE *stream, int status) --prefix-addresses Print complete address alongside disassembly\n\ --[no-]show-raw-insn Display hex alongside symbolic disassembly\n\ --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\ + --special-syms Include special symbols in symbol dumps\n\ \n")); list_supported_targets (program_name, stream); list_supported_architectures (program_name, stream); @@ -268,6 +270,7 @@ static struct option long_options[]= {"section-headers", no_argument, NULL, 'h'}, {"show-raw-insn", no_argument, &show_raw_insn, 1}, {"source", no_argument, NULL, 'S'}, + {"special-syms", no_argument, &dump_special_syms, 1}, {"include", required_argument, NULL, 'I'}, {"stabs", no_argument, NULL, 'G'}, {"start-address", required_argument, NULL, OPTION_START_ADDRESS}, @@ -2283,6 +2286,10 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) printf (_("could not determine the type of the %ld'th symbol"), count); + else if (! dump_special_syms + && bfd_is_target_special_symbol (cur_bfd, *current)) + continue; + else { const char *name = (*current)->name; -- 2.7.4