This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[drow@mvista.com: Re: _bfd_dwarf2_find_nearest_line returns wrong filename]
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 31 Mar 2003 23:45:38 -0500
- Subject: [drow@mvista.com: Re: _bfd_dwarf2_find_nearest_line returns wrong filename]
Before I forget about it again... this patch should probably go in also
now that I've checked in the other. It prevents some interesting
looking assertion failures in the testsuite logs for ld. OK?
[I think the assertion failures are justified; garbage in...]
----- Forwarded message from Daniel Jacobowitz <drow at mvista dot com> -----
Date: Fri, 3 Jan 2003 01:08:14 -0500
From: Daniel Jacobowitz <drow at mvista dot com>
Subject: Re: _bfd_dwarf2_find_nearest_line returns wrong filename
To: Andreas Schwab <schwab at suse dot de>
Cc: binutils at sources dot redhat dot com
Mail-Followup-To: Andreas Schwab <schwab at suse dot de>,
binutils at sources dot redhat dot com
On Wed, Jan 01, 2003 at 07:53:27PM +0100, Andreas Schwab wrote:
> Daniel Jacobowitz <drow at false dot org> writes:
>
> > It seems that the easiest way to avoid all this hassle would be to fix
> > bfd_simple_get_relocated_section_contents to work while linking. This
> > was one of the uses it's intended for, I just hadn't figured out how to
> > make it work yet. Probably you can solve most of the problem by saving
> > and restoring the section output offsets, output sections, and
> > reloc_done value within that function.
>
> Do you have a testcase where this does not work? The patch below is
> tested on ppc-linux (native) and m68k-linux (cross), I haven't noticed
> something wrong yet, apart from a problem with the symbol table which
> I have solved by passing it down to
> bfd_simple_get_relocated_section_contents.
>
> Andreas.
>
> 2003-01-01 Andreas Schwab <schwab at suse dot de>
>
> * simple.c (bfd_simple_get_relocated_section_contents): Add
> parameter symbol_table, use it instead of the symbol table from
> abfd.
> * bfd-in2.h: Regenerate.
> * dwarf2.c (read_abbrevs): Use
> bfd_simple_get_relocated_section_contents instead of
> bfd_get_section_contents.
> (decode_line_info): Likewise.
> (_bfd_dwarf2_find_nearest_line): Likewise. Don't call
> find_rela_addend.
> (find_rela_addend): Remove.
No regressions, but some pertinent facts:
- Examine the ld.log with this patch applied. Grep for BFD. You'll
find several assertion failures indicating that the DWARF-2 data
is incorrect. It's kind of sad that the testsuite doesn't notice any
of these.
The debug info is pretty bogus even without this, since we have
things like:
.section .debug_info
.long text
which is about as wrong as it gets. I don't know what that's
supposed to be testing. The fact that it worked before is dumb
luck; the value in the section contents was 0, it was taken as a
length, the DWARF-2 code was never called.
This is easily worked around by adding some .long 0's in the tests.
It's attached.
- Corrupt DWARF-2 information causes us to read past allocated memory.
Annoying, but not new.
- there are no .gnu.warning tests in the ld testsuite, which is one of
the cases I'm concerned about. Sigh. Testing by hand it appears to
work.
- I'm still worried about clobbering reloc_done... it doesn't come up
anywhere in the testsuite, however, and it isn't used much, so this
is probably OK.
- I also have concerns about the fact that output_offset's may be set
at this point for some of the sections being relocated, which is
inappropriate, since we'll be pulling .debug_abbrev from the input
file rather than from the output file. We can cross that bridge
later when we come to it. Shouldn't be too hard.
I'm OK with this if you'll add back code to hangle a NULL symbol table
argument. That's more useful for GDB's purposes, and maybe readelf's.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2002-01-03 Daniel Jacobowitz <drow at mvista dot com>
* ld-discard/extern.s, ld-discard/start.s, ld-discard/static.s,
ld-sh/refdbg.s: Add leading 0 to .debug_info to prevent parsing it
for error messages.
Index: ld-discard/extern.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-discard/extern.s,v
retrieving revision 1.2
diff -u -p -r1.2 extern.s
--- ld-discard/extern.s 30 Jul 2002 07:41:10 -0000 1.2
+++ ld-discard/extern.s 3 Jan 2003 05:59:58 -0000
@@ -9,4 +9,5 @@ text:
_start:
.long data
.section .debug_info
+ .long 0
.long text
Index: ld-discard/start.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-discard/start.s,v
retrieving revision 1.2
diff -u -p -r1.2 start.s
--- ld-discard/start.s 30 Jul 2002 07:41:10 -0000 1.2
+++ ld-discard/start.s 3 Jan 2003 05:59:58 -0000
@@ -3,4 +3,5 @@
_start:
.long data
.section .debug_info
+ .long 0
.long text
Index: ld-discard/static.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-discard/static.s,v
retrieving revision 1.2
diff -u -p -r1.2 static.s
--- ld-discard/static.s 30 Jul 2002 07:41:10 -0000 1.2
+++ ld-discard/static.s 3 Jan 2003 05:59:58 -0000
@@ -7,4 +7,5 @@ text:
_start:
.long data
.section .debug_info
+ .long 0
.long text
Index: ld-sh/refdbg.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-sh/refdbg.s,v
retrieving revision 1.1
diff -u -p -r1.1 refdbg.s
--- ld-sh/refdbg.s 28 Nov 2002 08:37:15 -0000 1.1
+++ ld-sh/refdbg.s 3 Jan 2003 05:59:59 -0000
@@ -8,4 +8,5 @@ _start:
.comm foo,4,4
.section .debug_info,"",@progbits
+ .long 0
.ualong foo
----- End forwarded message -----
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer