From patchwork Tue May 3 09:39:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 93760 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 CB80A1007D1 for ; Tue, 3 May 2011 19:40:09 +1000 (EST) Received: (qmail 14494 invoked by alias); 3 May 2011 09:40:07 -0000 Received: (qmail 14466 invoked by uid 22791); 3 May 2011 09:40:06 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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, 03 May 2011 09:39:48 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p439dmQY023654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 May 2011 05:39:48 -0400 Received: from [10.3.113.42] (ovpn-113-42.phx2.redhat.com [10.3.113.42]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p439dl5Z014243; Tue, 3 May 2011 05:39:47 -0400 Subject: PING: [debug] PR42288 emit empty .debug_aranges section From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: rth@redhat.com, Tom Tromey In-Reply-To: <1303809055.4928.10.camel@springer.wildebeest.org> References: <1303809055.4928.10.camel@springer.wildebeest.org> Date: Tue, 03 May 2011 11:39:46 +0200 Message-ID: <1304415586.32294.15.camel@springer.wildebeest.org> 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 On Tue, 2011-04-26 at 11:10 +0200, Mark Wielaard wrote: > This PR was put on hold for a while since gdb didn't immediately need > it. But the consensus seemed that it was a good idea to always output > the address ranges (.debug_arange section) information if a CU > (.debug_info section) was emitted. Because the consumer has no way to > tell the difference between an empty table that we omitted and failure > to generate a table that would have contained data. We recently > discussed this again (see PR), and it still seems like a good thing. So > here it a patch to just do that: > > 2011-04-26 Mark Wielaard > > PR42288 > * dwarf2out.c (dwarf2out_finish): Always call output_aranges () > when info_section_emitted. > > Tested on i686-pc-linux-gnu, no changes in test results. Ping. Thanks, Mark diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index f3c4c09..520d7a2 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23812,21 +23812,17 @@ dwarf2out_finish (const char *filename) } } - /* Output the address range information. We only put functions in the - arange table, so don't write it out if we don't have any. */ + /* Output the address range information if a CU (.debug_info section) + was emitted. We output an empty table even if we had no functions + to put in it. This because the consumer has no way to tell the + difference between an empty table that we omitted and failure to + generate a table that would have contained data. */ if (info_section_emitted) { unsigned long aranges_length = size_of_aranges (); - /* Empty .debug_aranges would contain just header and - terminating 0,0. */ - if (aranges_length - != (unsigned long) (DWARF_ARANGES_HEADER_SIZE - + 2 * DWARF2_ADDR_SIZE)) - { - switch_to_section (debug_aranges_section); - output_aranges (aranges_length); - } + switch_to_section (debug_aranges_section); + output_aranges (aranges_length); } /* Output ranges section if necessary. */