This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: DWARF compaction
- From: "Cary Coutant" <ccoutant at google dot com>
- To: "Roland McGrath" <roland at redhat dot com>
- Cc: "Thiago Jung Bauermann" <bauerman at br dot ibm dot com>, "Project Archer" <archer at sourceware dot org>
- Date: Fri, 1 Aug 2008 09:57:16 -0700
- Subject: Re: DWARF compaction
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1217609838; bh=j+hKfCFd4sAYvXWjytvm72W+4Xg=;h=DomainKey-Signature:Message-ID:Date:From:To:Subject:Cc: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-Disposition:References; b=xK3rY1U2CS7PKsctNHApDUZLVH6IZvlVnkHiblgzbKf/tQrZ335K59QGFazPXgteM2N0ylL/UyQuaMwKgIc5dQ==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;b=TOG4b2RBbE/aclKL0zup/pVgKPP0swlQmq0MsCYVUdK/rpoAf4cVw6ON4ULtP8toFfyQLLo6Z+af49fXrP6S0g==
- References: <m363qtg0ey.fsf@fleche.redhat.com> <1217273774.20082.19.camel@localhost.localdomain> <20080801021108.EFDE715427E@magilla.localdomain>
> This subject is well-understood among DWARF experts and the solutions long
> planned. Indeed the great bulk of the work here is on the producer side.
> There are ways that involve new compiler and linker smarts cooperating
> (this scheme is described in an appendix to the DWARF spec), as well as
> ways done in a pure post-processing step without the compiler or linker
> doing anything different (though post-processing integrated into linking is
> also an offshoot of this option).
I've actually been working on this problem recently, and I submitted a
draft proposal last month to the DWARF workgroup to add features that
allow each type to be placed in its own comdat section, using an MD5
hash of the type info as a type signature. Apple apparently tried
something similar a couple of years ago, but it looks like they've
given up on it. I'm very nearly done with a gcc patch to try this out
and see how much space I can really save.
The solution described in the DWARF appendix is, I believe, already
implemented in gcc as -fdwarf2-eliminate-dups, but it doesn't appear
to have ever gained much traction, and gdb may not yet work well with
the result. When I was at HP, we considered implementing this scheme,
but found a couple of problems. In order for the per-header debug
information to truly be identical across compilations, the compiler is
obligated to output the debug info for all declarations in the header
file. Even though it may result in a significant space savings in the
final executable, it still results in a significant (and, in our
opinion, unacceptable) extra cost in the size of the relocatables. In
addition, #ifdefs within the header file often caused the information
to differ across compilations anyway, reducing the effectiveness of
the comdat elimination.
I also wrote a post-processing tool at HP (unfortunately never
open-sourced) to do the duplicate elimination. It's not the only one
of its kind out there, so that's clearly a viable solution, but it
does add extra time to the link step. I've also seen proposals to
integrate the post-processing step into the gold linker, but I'd
prefer an approach that lets the linker do the job using its existing
comdat processing ability.
-cary