dwarf2 problem
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Thu Jun 29 10:40:00 GMT 2000
At 19:22 29.06.00, Richard Henderson wrote:
>On Thu, Jun 29, 2000 at 08:21:11AM -0400, Ed Hepler wrote:
> > It is compiled using:
> >
> > m68k-elf-gcc -m68000 -gdwarf-2 -O2 -Tv68k.ld -o hello hello.c
>[...]
> > it returns:Reading symbols from hello... Dwarf Error: bad offset
> > (0x1677c) in compilation unit header (offset 0x0 + 6).
>
>It's quite obvious from your typescript what the problem is:
>
> 3 .debug_abbrev 000028ac 00018068 00018068 0000a060 2**0
> CONTENTS, READONLY, DEBUGGING
> 4 .debug_info 00018a17 0001a914 0001a914 0000c90c 2**0
> CONTENTS, READONLY, DEBUGGING
> 5 .debug_line 000093fa 0003332b 0003332b 00025323 2**0
> CONTENTS, READONLY, DEBUGGING
> 6 .debug_pubnames 00000921 0003c725 0003c725 0002e71d 2**0
> CONTENTS, READONLY, DEBUGGING
> 7 .debug_aranges 000004e0 0003d046 0003d046 0002f03e 2**0
> CONTENTS, READONLY, DEBUGGING
>
>All the dwarf[12] sections should be forced to address zero in
>your linker script. If you'll examine one of the distributed
>link scripts you'll find
>
> /* DWARF 1 */
> .debug 0 : { *(.debug) }
> .line 0 : { *(.line) }
> /* GNU DWARF 1 extensions */
> .debug_srcinfo 0 : { *(.debug_srcinfo) }
> .debug_sfnames 0 : { *(.debug_sfnames) }
> /* DWARF 1.1 and DWARF 2 */
> .debug_aranges 0 : { *(.debug_aranges) }
> .debug_pubnames 0 : { *(.debug_pubnames) }
> /* DWARF 2 */
> .debug_info 0 : { *(.debug_info) }
> .debug_abbrev 0 : { *(.debug_abbrev) }
> .debug_line 0 : { *(.debug_line) }
> .debug_frame 0 : { *(.debug_frame) }
> .debug_str 0 : { *(.debug_str) }
> .debug_loc 0 : { *(.debug_loc) }
> .debug_macinfo 0 : { *(.debug_macinfo) }
> /* SGI/MIPS DWARF 2 extensions */
> .debug_weaknames 0 : { *(.debug_weaknames) }
> .debug_funcnames 0 : { *(.debug_funcnames) }
> .debug_typenames 0 : { *(.debug_typenames) }
> .debug_varnames 0 : { *(.debug_varnames) }
Binutils in CVS (not binutils-2.10) or hjl's binutils-2.10.0.9 are smart
enough to handle this without help from a linker script. I discovered this
bug a while ago when I tried to load an PPC860 linux kernel compiled with
-gdwarf-2 with our emulator. Our ELF loader complained with a warning. Alan
Modra then fixed it soon afterwards.
Franz.
More information about the Gcc-bugs
mailing list