bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug binutils/152] New: dwarf2 + special link technique causes "DW_F


From: Nick Clifton
Subject: Re: [Bug binutils/152] New: dwarf2 + special link technique causes "DW_FORM_strp pointing outside of .debug_str section" in GDB
Date: Mon, 24 May 2004 17:42:53 +0100
User-agent: Mozilla Thunderbird 0.6 (X11/20040502)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]