[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/152] dwarf2 + special link technique causes "DW_FORM_strp
From: |
nickc at redhat dot com |
Subject: |
[Bug binutils/152] dwarf2 + special link technique causes "DW_FORM_strp pointing outside of .debug_str section" in GDB |
Date: |
24 May 2004 16:37:55 -0000 |
------- Additional Comments From nickc at redhat dot com 2004-05-24 16:37
-------
Subject: Re: New: dwarf2 + special link technique causes
"DW_FORM_strp pointing outside of .debug_str section" in GDB
Hi Bart,
> main: main.o bios.o
> ld $^ -o $@
>
> bios.o: bios.S
> as --gdwarf2 bios.S -o tmp.o
> ld -Ttext 0 -e 0 tmp.o -o bios.o
The problem here is that you are taking a fully linked executable
(bios.o)(1) with its own, already setup debug info, and you are
attempting to link it into another executable (main). The linker will
merge the sections containing the debug information, but because there
are no relocations left in bios.o it will not be able to fix up the
offsets into the abbreviations table and hence you will get the errors
you encountered.
This is also why using STABS or no debugging works. With different (or
no) debug sections in your bios.o executable there is no problem merging
it into the main program. You could use the -r linker switch to avoid
this problem, but as you already know this would stop the -Ttext 0 and
-e 0 switches from performing their tasks.
One simple solution is to reorder the final link so that bios.o is
linked in first. This way its (already relocated) debug information
will be the first entries in the debug sections and the debug
information from main.o (which can be relocated) will be appended to the
end of the sections. ie change your makefile like this:
- main: main.o bios.o
+ main: bios.o main.o
Cheers
Nick
(1) Just because the file is called "bios.o" does not mean that it is an
object file. You used the -o option to the linker to override the
default output name (a.out) but you still created an executable file.
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=152
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.