[RFA] Define elf_symbol_leading_char in elf32-h8300.c

Kevin Buettner kevinb@redhat.com
Fri Jun 11 23:35:00 GMT 2010

The patch below vastly improves GDB test results for h8300-elf.

When evaluating an expression containing a global, GDB consults the
linker symbols (or minimal symbols in GDB parlance).  For the h8300,
many of these symbols have the underscore character (_) prepended to
them.  These same symbols (some of them anyway) appear in the DWARF
debug info without the prepended underscore.  Due to this mismatch
between linker symbols and symbols obtained from DWARF, GDB fails to
find the global.

GDB can be made to strip off the leading character, in this case
the underscore, by defining elf_symbol_leading_char in bfd.  The
patch below does this for the h8300.


	* elf32-h8300.c (elf_symbol_leading_char): Define.

Index: elf32-h8300.c
RCS file: /cvs/src/src/bfd/elf32-h8300.c,v
retrieving revision 1.55
diff -u -p -r1.55 elf32-h8300.c
--- elf32-h8300.c	2 Sep 2009 07:18:36 -0000	1.55
+++ elf32-h8300.c	11 Jun 2010 22:58:12 -0000
@@ -1641,5 +1641,6 @@ elf32_h8_get_relocated_section_contents 
 #define bfd_elf32_bfd_get_relocated_section_contents \
+#define elf_symbol_leading_char '_'
 #include "elf32-target.h"

More information about the Binutils mailing list