This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: as/ld silently creates programs with undefined references/symbols
- From: Nick Clifton <nickc at redhat dot com>
- To: Russell King <rmk at arm dot linux dot org dot uk>, Richard Earnshaw <rearnsha at arm dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 29 Sep 2004 10:00:14 +0100
- Subject: Re: as/ld silently creates programs with undefined references/symbols
- References: <20040702123710.A24028@flint.arm.linux.org.uk> <40E66B86.4000200@redhat.com> <20040711121944.B13616@flint.arm.linux.org.uk> <40F243E2.2070506@redhat.com> <1089620642.8278.68.camel@pc960.cambridge.arm.com> <20040712092625.A2623@flint.arm.linux.org.uk> <1089621632.8278.72.camel@pc960.cambridge.arm.com> <20040808165653.B17968@flint.arm.linux.org.uk> <411CF9DA.5090202@redhat.com> <4121BE71.6060508@redhat.com> <20040923104005.A18950@flint.arm.linux.org.uk>
Hi Russell, Hi Richard,
The Linux kernel is an example of a build system which parses the output
from "nm" in order to build an internal symbol table. As I highlighted
before, this whole "mapping symbol" business is severly affecting the
usefulness of the toolchain and it is imperative that this problem is
fully resolved before binutils 2.16.
I have a prototype solution to this problem, but I would like more input
from anyone who is interested. My idea is to provide a new function in
the BFD ABI:
bfd_boolean bfd_is_target_special_symbol (bfd *, asymbol *);
This function will determine if a given symbol symbol in a symbol table
is "special" in some target specific sense. I decided that this would
be a safer approach, rather than adding code to make BFD produce
abbreviated symbol tables with the special symbols stripped. In my
experience modifying symbol tables in BFD is very tricky.
I am attaching a proof of concept patch which applied to today's
mainline binutils sources. It uses this new function to implement a new
command line switch to nm: "--skip-special" which will successfully
remove any of the ARM mapping symbols from its output.
Does anyone have any comments on this proposed solution ? One thing I
wondered was whether bfd_is_target_special_symbol() should return a
string instead of a boolean. It could return a NULL pointer for normal
symbols and some kind of description for special symbols. Then the
caller could decide to print this description if it was displaying the
symbol to a user.
Cheers
Nick
Index: bfd/aout-target.h
===================================================================
RCS file: /cvs/src/src/bfd/aout-target.h,v
retrieving revision 1.26
diff -c -3 -p -r1.26 aout-target.h
*** bfd/aout-target.h 21 Jul 2004 15:42:56 -0000 1.26
--- bfd/aout-target.h 29 Sep 2004 08:30:32 -0000
*************** MY_bfd_final_link (abfd, info)
*** 579,584 ****
--- 579,588 ----
#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
Index: bfd/aout-tic30.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-tic30.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 aout-tic30.c
*** bfd/aout-tic30.c 21 Jul 2004 15:42:56 -0000 1.26
--- bfd/aout-tic30.c 29 Sep 2004 08:30:32 -0000
*************** tic30_aout_set_arch_mach (abfd, arch, ma
*** 1036,1041 ****
--- 1036,1046 ----
#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
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.301
diff -c -3 -p -r1.301 bfd-in2.h
*** bfd/bfd-in2.h 17 Sep 2004 12:34:54 -0000 1.301
--- bfd/bfd-in2.h 29 Sep 2004 08:30:34 -0000
*************** bfd_boolean bfd_is_local_label_name (bfd
*** 3780,3785 ****
--- 3780,3790 ----
#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))
*************** typedef struct bfd_target
*** 4395,4400 ****
--- 4400,4406 ----
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, \
*************** typedef struct bfd_target
*** 4413,4418 ****
--- 4419,4425 ----
(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)
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 binary.c
*** bfd/binary.c 21 Jul 2004 15:42:57 -0000 1.23
--- bfd/binary.c 29 Sep 2004 08:30:34 -0000
*************** binary_get_symbol_info (ignore_abfd, sym
*** 234,239 ****
--- 234,240 ----
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
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.111
diff -c -3 -p -r1.111 coffcode.h
*** bfd/coffcode.h 3 Sep 2004 14:11:38 -0000 1.111
--- bfd/coffcode.h 29 Sep 2004 08:30:35 -0000
*************** static const bfd_coff_backend_data ticof
*** 5547,5552 ****
--- 5547,5556 ----
#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
Index: bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.185
diff -c -3 -p -r1.185 configure
*** bfd/configure 16 Sep 2004 14:52:09 -0000 1.185
--- bfd/configure 29 Sep 2004 08:30:38 -0000
*************** fi
*** 2834,2840 ****
# Define the identity of the package.
PACKAGE=bfd
! VERSION=2.15.92
cat >>confdefs.h <<_ACEOF
--- 2834,2840 ----
# Define the identity of the package.
PACKAGE=bfd
! VERSION=2.15.93
cat >>confdefs.h <<_ACEOF
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.161
diff -c -3 -p -r1.161 configure.in
*** bfd/configure.in 16 Sep 2004 14:52:09 -0000 1.161
--- bfd/configure.in 29 Sep 2004 08:30:39 -0000
*************** AC_CONFIG_SRCDIR([libbfd.c])
*** 8,14 ****
AC_CANONICAL_TARGET
AC_ISC_POSIX
! AM_INIT_AUTOMAKE(bfd, 2.15.92)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
--- 8,14 ----
AC_CANONICAL_TARGET
AC_ISC_POSIX
! 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.
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.144
diff -c -3 -p -r1.144 elf32-arm.h
*** bfd/elf32-arm.h 17 Sep 2004 12:34:54 -0000 1.144
--- bfd/elf32-arm.h 29 Sep 2004 08:30:40 -0000
***************
*** 25,30 ****
--- 25,32 ----
typedef unsigned long int insn32;
typedef unsigned short int insn16;
+ bfd_boolean elf32_arm_is_local_label_name (bfd *, const char *);
+
/* In leiu 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 \
*************** elf32_arm_object_p (bfd *abfd)
*** 2326,2331 ****
--- 2328,2334 ----
}
/* Function to keep ARM specific flags in the ELF header. */
+
static bfd_boolean
elf32_arm_set_private_flags (bfd *abfd, flagword flags)
{
*************** is_arm_mapping_symbol_name (const char *
*** 3161,3166 ****
--- 3164,3177 ----
&& (name[2] == 0);
}
+ /* Treat mapping symbols as special target symbols. */
+
+ 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. */
*************** elf32_arm_write_section (bfd *output_bfd
*** 4407,4412 ****
--- 4418,4424 ----
#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
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.72
diff -c -3 -p -r1.72 elfxx-target.h
*** bfd/elfxx-target.h 3 Sep 2004 17:15:34 -0000 1.72
--- bfd/elfxx-target.h 29 Sep 2004 08:30:40 -0000
***************
*** 188,193 ****
--- 188,197 ----
#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 \
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 ieee.c
*** bfd/ieee.c 13 Aug 2004 03:16:00 -0000 1.40
--- bfd/ieee.c 29 Sep 2004 08:30:41 -0000
*************** ieee_bfd_debug_info_accumulate (abfd, se
*** 4018,4023 ****
--- 4018,4025 ----
#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
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.25
diff -c -3 -p -r1.25 ihex.c
*** bfd/ihex.c 13 Aug 2004 03:16:00 -0000 1.25
--- bfd/ihex.c 29 Sep 2004 08:30:41 -0000
*************** ihex_sizeof_headers (abfd, exec)
*** 968,973 ****
--- 968,974 ----
#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
Index: bfd/libaout.h
===================================================================
RCS file: /cvs/src/src/bfd/libaout.h,v
retrieving revision 1.17
diff -c -3 -p -r1.17 libaout.h
*** bfd/libaout.h 24 Jun 2004 04:46:24 -0000 1.17
--- bfd/libaout.h 29 Sep 2004 08:30:41 -0000
*************** extern bfd_boolean NAME(aout,bfd_free_ca
*** 606,611 ****
--- 606,616 ----
#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) \
{ \
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.42
diff -c -3 -p -r1.42 libbfd-in.h
*** bfd/libbfd-in.h 28 Aug 2004 03:05:18 -0000 1.42
--- bfd/libbfd-in.h 29 Sep 2004 08:30:42 -0000
*************** extern bfd_boolean _bfd_archive_coff_con
*** 299,304 ****
--- 299,306 ----
((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 \
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.33
diff -c -3 -p -r1.33 libbfd.c
*** bfd/libbfd.c 13 Aug 2004 03:16:00 -0000 1.33
--- bfd/libbfd.c 29 Sep 2004 08:30:42 -0000
*************** bfd_generic_is_local_label_name (bfd *ab
*** 810,815 ****
--- 810,821 ----
return name[0] == locals_prefix;
}
+ bfd_boolean
+ bfd_generic_is_target_special_symbol (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym ATTRIBUTE_UNUSED)
+ {
+ return FALSE;
+ }
+
/* Can be used from / for bfd_merge_private_bfd_data to check that
endianness matches between input and output file. Returns
TRUE for a match, otherwise returns FALSE and emits an error. */
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.125
diff -c -3 -p -r1.125 libbfd.h
*** bfd/libbfd.h 17 Sep 2004 12:34:55 -0000 1.125
--- bfd/libbfd.h 29 Sep 2004 08:30:42 -0000
*************** extern bfd_boolean _bfd_archive_coff_con
*** 304,309 ****
--- 304,311 ----
((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 \
Index: bfd/libecoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libecoff.h,v
retrieving revision 1.16
diff -c -3 -p -r1.16 libecoff.h
*** bfd/libecoff.h 17 May 2004 16:40:00 -0000 1.16
--- bfd/libecoff.h 29 Sep 2004 08:30:42 -0000
*************** extern bfd_boolean _bfd_ecoff_write_arma
*** 272,277 ****
--- 272,279 ----
#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));
Index: bfd/mmo.c
===================================================================
RCS file: /cvs/src/src/bfd/mmo.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 mmo.c
*** bfd/mmo.c 21 Jul 2004 15:42:57 -0000 1.20
--- bfd/mmo.c 29 Sep 2004 08:30:43 -0000
*************** mmo_canonicalize_reloc (abfd, section, r
*** 3255,3260 ****
--- 3255,3262 ----
/* 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
Index: bfd/nlm-target.h
===================================================================
RCS file: /cvs/src/src/bfd/nlm-target.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 nlm-target.h
*** bfd/nlm-target.h 21 Jul 2004 15:42:57 -0000 1.12
--- bfd/nlm-target.h 29 Sep 2004 08:30:43 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 26,31 ****
--- 26,33 ----
#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
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 ppcboot.c
*** bfd/ppcboot.c 21 Jul 2004 15:42:57 -0000 1.20
--- bfd/ppcboot.c 29 Sep 2004 08:30:43 -0000
*************** ppcboot_get_symbol_info (ignore_abfd, sy
*** 345,350 ****
--- 345,352 ----
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
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 srec.c
*** bfd/srec.c 13 Aug 2004 03:16:00 -0000 1.31
--- bfd/srec.c 29 Sep 2004 08:30:43 -0000
*************** srec_print_symbol (abfd, afile, symbol,
*** 1262,1267 ****
--- 1262,1268 ----
#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
Index: bfd/syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 syms.c
*** bfd/syms.c 24 Jun 2004 04:46:26 -0000 1.36
--- bfd/syms.c 29 Sep 2004 08:30:44 -0000
*************** DESCRIPTION
*** 382,387 ****
--- 382,404 ----
/*
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
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 targets.c
*** bfd/targets.c 3 Sep 2004 17:15:34 -0000 1.117
--- bfd/targets.c 29 Sep 2004 08:30:44 -0000
*************** BFD_JUMP_TABLE macros.
*** 338,343 ****
--- 338,344 ----
. 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, \
*************** BFD_JUMP_TABLE macros.
*** 356,361 ****
--- 357,364 ----
. (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 *);
+ .#ifndef _bfd_nosymbols_bfd_is_target_special_symbol
.
. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
. bfd_boolean (*_bfd_find_nearest_line)
Index: bfd/tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 tekhex.c
*** bfd/tekhex.c 21 Jul 2004 15:42:58 -0000 1.21
--- bfd/tekhex.c 29 Sep 2004 08:30:44 -0000
*************** tekhex_print_symbol (abfd, filep, symbol
*** 989,994 ****
--- 989,995 ----
#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
Index: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 versados.c
*** bfd/versados.c 21 Jul 2004 15:42:58 -0000 1.23
--- bfd/versados.c 29 Sep 2004 08:30:44 -0000
*************** versados_canonicalize_reloc (abfd, secti
*** 855,860 ****
--- 855,862 ----
#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
Index: bfd/xcoff-target.h
===================================================================
RCS file: /cvs/src/src/bfd/xcoff-target.h,v
retrieving revision 1.10
diff -c -3 -p -r1.10 xcoff-target.h
*** bfd/xcoff-target.h 21 Jul 2004 15:42:58 -0000 1.10
--- bfd/xcoff-target.h 29 Sep 2004 08:30:44 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 43,48 ****
--- 43,49 ----
#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
Index: binutils/ChangeLog
===================================================================
RCS file: /cvs/src/src/binutils/ChangeLog,v
retrieving revision 1.802
diff -c -3 -p -r1.802 ChangeLog
*** binutils/ChangeLog 28 Sep 2004 16:26:39 -0000 1.802
--- binutils/ChangeLog 29 Sep 2004 08:30:45 -0000
***************
*** 1,6 ****
2004-09-28 Nick Clifton <nickc@redhat.com>
! * nm.c: Reoder functions to eliminate most of the static function
prototypes.
2004-09-22 Alan Modra <amodra@bigpond.net.au>
--- 1,6 ----
2004-09-28 Nick Clifton <nickc@redhat.com>
! * nm.c: Reorder functions to eliminate most of the static function
prototypes.
2004-09-22 Alan Modra <amodra@bigpond.net.au>
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.41
diff -c -3 -p -r1.41 nm.c
*** binutils/nm.c 28 Sep 2004 16:26:39 -0000 1.41
--- binutils/nm.c 29 Sep 2004 08:30:45 -0000
*************** static int show_version = 0; /* Show the
*** 152,157 ****
--- 152,158 ----
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 skip_special_symbols = 0; /* Ignore 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. */
*************** static struct option long_options[] =
*** 205,210 ****
--- 206,212 ----
{"radix", required_argument, 0, 't'},
{"reverse-sort", no_argument, &reverse_sort, 1},
{"size-sort", no_argument, &sort_by_size, 1},
+ {"skip-special", no_argument, &skip_special_symbols, 1},
{"stats", no_argument, &show_stats, 1},
{"synthetic", no_argument, &show_synthetic, 1},
{"target", required_argument, 0, OPTION_TARGET},
*************** usage (FILE *stream, int status)
*** 246,251 ****
--- 248,254 ----
-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\
*************** filter_symbols (bfd *abfd, bfd_boolean d
*** 446,451 ****
--- 449,459 ----
keep = 0;
}
+ if (keep
+ && skip_special_symbols
+ && bfd_is_target_special_symbol (abfd, sym))
+ keep = 0;
+
if (keep)
{
memcpy (to, from, size);
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.56
diff -c -3 -p -r1.56 binutils.texi
*** binutils/doc/binutils.texi 6 Sep 2004 20:00:55 -0000 1.56
--- binutils/doc/binutils.texi 29 Sep 2004 08:30:46 -0000
*************** The @sc{gnu} linker @command{ld} is now
*** 663,669 ****
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{-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}]
--- 663,669 ----
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{--skip-special}]
[@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}]
*************** value. If the @code{bsd} output format
*** 879,884 ****
--- 879,891 ----
is printed, rather than the value, and @samp{-S} must be used in order
both size and value to be printed.
+ @item --skip-special
+ Ignore symbols which have a target-specific special meaning. These
+ symbols are usually used by the target for some special processing and
+ are not 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