From patchwork Sat May 4 21:20:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 241480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B4F9D2C00D7 for ; Sun, 5 May 2013 07:20:20 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=R4I7G7jCzZscXmgR TMhqwqKZ9ZKS51DYKCzoSs/HAp81qv5XXSwZL6w5e93r79nJZ4RQKfzfNtjpTxUU aqv1lnOC30MBb7J61rF+XiwQx9HFkbVDxp5JMzHkM0bMmsTTymqTS/HHcUkf60Dm 1VpdKT3Ym3wQXHVgpQbEeDnOw/E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=DbYWMunmpk24e1zSzqNdzD 420h8=; b=fyVnNF+HZE6T/AigK1l6GGGx8kriQ7NG7k6bQ8hyRV1PK9pgd4kdGb WQOVxmBrgBtfAQ2DjHsuid40ZCP+ge5HGdxPts3cx2OpZJdm9rxgAAB5Gl7+1Qw9 bQhokf4NAPGjtV12CEFX0MYg/ul+pzVpp7HUehA+FILgfHs8BxFOA= Received: (qmail 29126 invoked by alias); 4 May 2013 21:20:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 29116 invoked by uid 89); 4 May 2013 21:20:14 -0000 X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_VIAGRA1, RP_MATCHES_RCVD, TW_BJ, TW_DB, TW_GD, T_TVD_MIME_NO_HEADERS autolearn=no version=3.3.1 Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 04 May 2013 21:20:12 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 896EDCDD; Sat, 4 May 2013 23:20:09 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OXxRg2dL5Rs6; Sat, 4 May 2013 23:20:06 +0200 (CEST) Received: from masaya.CeBiTec.Uni-Bielefeld.DE (p4FEF4BF1.dip0.t-ipconnect.de [79.239.75.241]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id A14EFCDC; Sat, 4 May 2013 23:20:05 +0200 (CEST) From: Rainer Orth To: "Joseph S. Myers" Cc: , Paolo Bonzini Subject: Re: [build, driver] RFC: Support compressed debug sections References: Date: Sat, 04 May 2013 23:20:01 +0200 In-Reply-To: (Joseph S. Myers's message of "Fri, 3 May 2013 20:01:45 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-Virus-Found: No "Joseph S. Myers" writes: > On Tue, 30 Apr 2013, Rainer Orth wrote: > >> * gcc.c (LINK_COMPRESS_DEBUG_SPEC, ASM_COMPRESS_DEBUG_SPEC): >> Define. >> (LINK_COMMAND_SPEC): Invoke LINK_COMPRESS_DEBUG_SPEC. >> (asm_options): Invoke ASM_COMPRESS_DEBUG_SPEC. > > Note that there are separate copies of LINK_COMMAND_SPEC in darwin.h and > i386/djgpp.h, which maybe should include the new spec. I hadn't thought about that. Here's what I found: * Darwin is Mach-O, but current gas supports DWARF-in-Mach-O. Unfortunately, current gcc mainline only supports Apple as: i386/darwin.h hardcodes as-only options in ASM_SPEC, which causes gas to barf. If you manually invoke gas on gcc -gdwarf output, you get compressed debug sections, though objdump cannot handle them. * DJGPP is COFF, but again gas seems to support DWARF. Unfortunately, current gcc mainline doesn't even build: gcc/config/i386/i386.c: In function 'void ix86_code_end()': gcc/config/i386/i386.c:8667: error: 'ASM_DECLARE_FUNCTION_NAME' was not declared in this scope I didn't look further from here. Anyway, I tried a i386-pc-solaris2.11 x i686-pc-darwin build with the following patch to check it doesn't break the build: * config/darwin.h (LINK_COMMAND_SPEC_A): Invoke LINK_COMPRESS_DEBUG_SPEC. * config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise. Especially darwin.h LINK_COMMAND_SPEC_A is a total mess: it's a copy of gcc.c LINK_COMMAND_SPEC with various changes not carried forward and other parts done in a slightly different syntax for no apparent reason. I'm pretty sure the two could be merged to avoid problems from duplication in the future, but I'll leave that to the Darwin maintainers. I can include the snippet above for symmetry, if only to reject -gz as on ELF targets without the toolchain support, if you prefer. > It's not clear to me from the documentation added by this patch whether > users are meant to specify their -gz options when compiling, when linking, > or both - and whether there might be cases when such an option is accepted > for one of compiling and linking but not the other (which would be > especially confusing). The goal is to have -gz work for both compilation and linking, but unfortunately, the current situation very much depends on both the toolchain used and your intentions. The following matrix shows read and write support in the GNU and Solaris toolchains. For the latter, full support for zlib and zlib-gnu formats is being worked on, with ld already there. GNU Solaris gas gld gold gdb as ld dbx w r w r w r w r w r none x x x x x x x x x x zlib-gnu x x x x x x x zlib x x I plan to add zlib support first to gas and gdb, eventually to gld (which also means adding support for compression on output, though I had a very hard time finding my way through bfd and gld in the past), but will rely on Cary Coutant and/or Ian, who were involved in the zlib/ELF gABI format design, to handle gold. Right now, the gas/gold combination supports -gz just fine (producing the zlib-gnu format), while gas/gld only support -gz in the assemble step. I know this is highly undesirable, but whether or not it's acceptable depends on your goals: * If you mean to trade compilation/assembly speed for disk usage, -gz for compilation only is ok. * If your primary goal is space savings for executables and shared objects while still allowing debugability, you need to use gold for -gz at link time to work. Rainer diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -171,7 +171,8 @@ extern GTY(()) int darwin_ms_struct; LINK_PLUGIN_SPEC \ "%{flto*:%