This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Should the section address be ignored when processing DWARF information ?
- From: Nick Clifton <nickc at redhat dot com>
- To: echristo at apple dot com
- Cc: vinschen at redhat dot com, binutils at sourceware dot org
- Date: Tue, 17 Apr 2007 11:59:38 +0100
- Subject: Should the section address be ignored when processing DWARF information ?
Hi Eric,
Does Mach-O need to have the section address added in to the offset
calculation when processing DWARF information ?
Currently the code in binutils/dwarf.c adds the section address to
the offsets it calculates when processing DWARF information. For
ELF based systems this is a no-op since the section address will be
0. For COFF based systems, and in particular for Cygwin, the
section addresses will not be zero, but adding in the section
address results in bogus offsets. The offsets are meant to be
section relative, so it would seem to me that adding in the section
address is the wrong thing to do.
The patch below removes this addition of the section address, and
although I have tested it locally with lots of different toolchains,
I have not been able to test in under Mach-O. Would this patch
break Mach-O compatibility ? If so, do you think that it would it be
appropriate to add special case code for Mach-O ?
Cheers
Nick
2007-04-17 Corinna Vinschen <vinschen@redhat.com>
* dwarf.c (display_debug_str):
Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 dwarf.c
*** binutils/dwarf.c 9 Apr 2007 14:36:59 -0000 1.12
--- binutils/dwarf.c 17 Apr 2007 10:49:36 -0000
*************** process_debug_info (struct dwarf_section
*** 1673,1679 ****
else
process_abbrev_section
((unsigned char *) debug_displays [abbrev].section.start
! + compunit.cu_abbrev_offset - debug_displays [abbrev].section.address,
(unsigned char *) debug_displays [abbrev].section.start
+ debug_displays [abbrev].section.size);
--- 1673,1679 ----
else
process_abbrev_section
((unsigned char *) debug_displays [abbrev].section.start
! + compunit.cu_abbrev_offset,
(unsigned char *) debug_displays [abbrev].section.start
+ debug_displays [abbrev].section.size);
*************** display_debug_loc (struct dwarf_section
*** 2377,2383 ****
{
has_frame_base = debug_information [i].have_frame_base [j];
/* DWARF sections under Mach-O have non-zero addresses. */
! offset = debug_information [i].loc_offsets [j] - section->address;
next = section_begin + offset;
base_address = debug_information [i].base_address;
--- 2377,2383 ----
{
has_frame_base = debug_information [i].have_frame_base [j];
/* DWARF sections under Mach-O have non-zero addresses. */
! offset = debug_information [i].loc_offsets [j];
next = section_begin + offset;
base_address = debug_information [i].base_address;