[2.3 BRANCH]: gstabs issue
Mark Wielaard
mjw at redhat.com
Wed Aug 8 11:48:51 PDT 2012
On Wed, 2012-08-08 at 11:11 -0700, Kelly O'Hair wrote:
> I'm just lurking on this alias, but I have a dbx developer history, and in particular debug formats.
>
> I suspect the reason for using stabs is that they aren't necessarily smaller in the .o files than Dwarf, but when the
> .so file is created, the Dwarf debug info is very significantly larger than stabs due to the stabs size optimizations
> that happens at link time and NO Dwarf size optimizations at link time.
> I'm not 100% up on what Linux/gcc/ld is doing at link time, but when Dwarf came on the scene
> many years ago, the plan was to have the linker process the debug information and do some folding of the
> graph a bit so the size would be significantly reduced, similar to what has always happened with stabs.
> I have no idea what the status of that is, it never happened in the Solaris world, just not sure about Linux.
There are a couple of efforts to do something like you suggest. I assume
the linker could easily "optimize" STABS since it was basically all
encoded as symbol table entries, so duplicates could just be handled as
normal symbols in the linker. But DWARF is more expressive and cannot
easily be expressed as just a fancy symbol (it has a tree structure).
Having the linker do even more work seems not popular. The linker is
already a bottleneck.
But there is a way to encode part of the type DIE tree in elf COMDAT
sections, which the linker could merge. This isn't enabled everywhere
though, since there are a couple of corner cases that seem
underspecified. But most tools have been updated to work
with .debug_types now if they are there (at least elfutils/systemtap,
valgrind and gdb). See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo
and appendix E in the DWARF4 standard.
To ease the linker pain, there are also some ways in newer DWARF to just
have less relocations to process in the .debug sections (newer DWARF
allows you to express more with offsets and less with addresses).
There is a DWARF compressor that works post-linker, dwz, which picks out
common DIE subtrees. This is being experimented with in Fedora for the
next release. See
https://fedoraproject.org/wiki/Features/DwarfCompressor
And there is an effort to keep a lot of the .debug sections outside of
the linker itself and store some parts completely separately from the
(linked) object files (kind of what is done now with separate debuginfo
after the link phase, but so that the linker can just leave it behind).
See http://gcc.gnu.org/wiki/DebugFission
Cheers,
Mark
More information about the distro-pkg-dev
mailing list