From patchwork Tue Jul 6 22:45:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 58072 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]) by ozlabs.org (Postfix) with SMTP id 8DBFAB6ED0 for ; Wed, 7 Jul 2010 08:45:44 +1000 (EST) Received: (qmail 18382 invoked by alias); 6 Jul 2010 22:45:42 -0000 Received: (qmail 18367 invoked by uid 22791); 6 Jul 2010 22:45:37 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Jul 2010 22:45:25 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o66MjOjs008251 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Jul 2010 18:45:24 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o66MjNJQ005970; Tue, 6 Jul 2010 18:45:23 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o66MjM6G019191; Tue, 6 Jul 2010 18:45:23 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 68F55508090; Tue, 6 Jul 2010 16:45:22 -0600 (MDT) From: Tom Tromey To: Richard Henderson Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek Subject: Re: RFA: don't emit .debug_pub* References: <4C293E85.8090305@redhat.com> <4C2A8505.5060902@redhat.com> Date: Tue, 06 Jul 2010 16:45:22 -0600 In-Reply-To: <4C2A8505.5060902@redhat.com> (Richard Henderson's message of "Tue, 29 Jun 2010 16:43:01 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 >>>>> "rth" == Richard Henderson writes: rth> But now the patch needs to be re-written, since Joern has rth> committed a patch that re-works the target hooks. Which rth> will also force you to write documentation, which you had rth> forgotten for this new hook. ;-) Here's a new version, bootstrapped & regtested on x86-64 (compile farm). As before, I can't actually test this on Darwin. However, I think any possible bug would be trivial. Tom 2010-07-06 Tom Tromey * doc/tm.texi: Update. * doc/tm.texi.in (SDB and DWARF) : Add @hook. * target.def (want_debug_pub_sections): New hook. * config/darwin.h (TARGET_WANT_DEBUG_PUB_SECTIONS): Define. * dwarf2out.c (add_pubname_string): Check targetm.want_debug_pub_sections. (add_pubname): Likewise. (add_pubtype): Likewise. 2010-07-06 Tom Tromey * g++.dg/debug/dwarf2/pubnames-1.C: Make darwin-specific. Index: gcc/doc/tm.texi =================================================================== --- gcc/doc/tm.texi (revision 161742) +++ gcc/doc/tm.texi (working copy) @@ -9276,6 +9276,10 @@ tables, and hence is desirable if it works. @end defmac +@deftypevr {Target Hook} bool TARGET_WANT_DEBUG_PUB_SECTIONS +True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted. These sections are not used on most platforms, and in particular GDB does not use them. +@end deftypevr + @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference @var{lab1} minus @var{lab2}, using an integer of the given @var{size}. Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in (revision 161742) +++ gcc/doc/tm.texi.in (working copy) @@ -9275,6 +9275,8 @@ tables, and hence is desirable if it works. @end defmac +@hook TARGET_WANT_DEBUG_PUB_SECTIONS + @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference @var{lab1} minus @var{lab2}, using an integer of the given @var{size}. Index: gcc/target.def =================================================================== --- gcc/target.def (revision 161742) +++ gcc/target.def (working copy) @@ -2335,6 +2335,13 @@ "", bool, false) +DEFHOOKPOD +(want_debug_pub_sections, + "True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections\ + should be emitted. These sections are not used on most platforms, and\ + in particular GDB does not use them.", + bool, false) + /* Leave the boolean fields at the end. */ /* Empty macro arguments are undefined in C90, so use an empty macro. */ Index: gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C =================================================================== --- gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C (revision 161742) +++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C (working copy) @@ -1,7 +1,7 @@ // Contributed by Dodji Seketeli // Origin PR debug/39706 +// { dg-do compile { target *-*-darwin* } } // { dg-options "-g -dA -fno-merge-debug-strings" } -// { dg-do compile } // // There should be one debug_pubnames section generated. // On Darwin though, there is also a label pointing at the begining of the Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 161742) +++ gcc/dwarf2out.c (working copy) @@ -11238,17 +11238,20 @@ static void add_pubname_string (const char *str, dw_die_ref die) { - pubname_entry e; + if (targetm.want_debug_pub_sections) + { + pubname_entry e; - e.die = die; - e.name = xstrdup (str); - VEC_safe_push (pubname_entry, gc, pubname_table, &e); + e.die = die; + e.name = xstrdup (str); + VEC_safe_push (pubname_entry, gc, pubname_table, &e); + } } static void add_pubname (tree decl, dw_die_ref die) { - if (TREE_PUBLIC (decl)) + if (targetm.want_debug_pub_sections && TREE_PUBLIC (decl)) { const char *name = dwarf2_name (decl, 1); if (name) @@ -11263,6 +11266,9 @@ { pubname_entry e; + if (!targetm.want_debug_pub_sections) + return; + e.name = NULL; if ((TREE_PUBLIC (decl) || die->die_parent == comp_unit_die) Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 161742) +++ gcc/config/darwin.h (working copy) @@ -471,6 +471,8 @@ #define DEBUG_STR_SECTION "__DWARF,__debug_str,regular,debug" #define DEBUG_RANGES_SECTION "__DWARF,__debug_ranges,regular,debug" +#define TARGET_WANT_DEBUG_PUB_SECTIONS true + /* When generating stabs debugging, use N_BINCL entries. */ #define DBX_USE_BINCL