linker and debug section question
Nicholas Clifton
nickc@redhat.com
Mon Feb 23 16:13:00 GMT 2015
Hi Steve,
> I noticed a change in the linker behaviour between binutils 2.24 and
> top-of-tree and was wondering if it was intentional or accidental.
> I noticed that some test programs I was compiling with the latest GCC
> and binutils were much larger then before and after some digging I found
> the difference was that executables compiled with -O2 or -O3 (no -g) and
> linked with a top-of-tree ld had these sections:
>
> [29] .debug_aranges MIPS_DWARF 00000000 000918 0000a8 00 0 0 8
> [30] .debug_info MIPS_DWARF 00000000 0009c0 0002e2 00 0 0 1
> [31] .debug_abbrev MIPS_DWARF 00000000 000ca2 000172 00 0 0 1
> [32] .debug_line MIPS_DWARF 00000000 000e14 00020a 00 0 0 1
> [33] .debug_frame MIPS_DWARF 00000000 001020 000050 00 0 0 4
> [34] .debug_str MIPS_DWARF 00000000 001070 000243 01 MS 0 0 1
> [35] .debug_loc MIPS_DWARF 00000000 0012b3 0000bb 00 0 0 1
> [36] .debug_ranges MIPS_DWARF 00000000 001370 000040 00 0 0 8
>
> But a program compiled with the latest GCC and linked with the 2.24 ld
> only has:
>
> [28] .debug_frame MIPS_DWARF 00000000 00089c 000050 00 0 0 4
This is an intentional change I think. Basically the executables
created by the old 2.24 linker appear to be missing a lot of important
debug information/debug sections.
I suspect that the problem is the result of this patch:
2013-04-15 Nick Clifton <nickc@redhat.com>
* Makefile.am (ELF_DEPS): Add a dependency upon
scripttempl/DWARF.sc.
(ELF_GEN_DEPS): Likewise.
(emmo.c): Likewise.
* Makefile.in: Regenerate.
* scripttempl/armbpabi.sc: Replace DWARF sections with an
inclusion of DWARF.sc.
* scripttempl/avr.sc: Likewise.
* scripttempl/elf.sc: Likewise.
[...]
So now most linker scripts use a single DWARF.sc file to specify the
dwarf sections to be included in the executable, and this change meant
that for some targets, eg yours, new debug sections started appearing in
the files.
Cheers
Nick
More information about the Binutils
mailing list