From patchwork Tue May 1 19:37:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 156194 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 03B65B6FAB for ; Wed, 2 May 2012 05:38:15 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336505896; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=F6WjKyL prBKYFQstN1e/GYmSW3I=; b=KFiwwwI0zfINU/cHUkS0PYcO+APl3a2cmdCW5CK gv3FmNGGLJ54dRhngrZ78y5DwcilCBjoF5GCZ0wdVemrkxDDBRPtac7dUzodePby RV1Ay3kfs5uPVmTcK0B1AI/VUv6Rsw41wVQhJ9hEDth1K4bmC+woCDBQNrbo30rf 5eSM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=MdPB2TPWaYDojuSATQU2yMWPtzLbVV+KR2r7n86HsfIvV+l6mqt4JDM02OmsD1 9pdrML5Dca2UtNEE/P6W9X1e3VlEq/n8ubMrw9GnvfH/4GYAJ/Eno+R40AKlysKY hSKWi3bFtNgI12Tl/3/O4wNIiuCoqRRJ3zKFGBOCYGeZw=; Received: (qmail 4073 invoked by alias); 1 May 2012 19:38:12 -0000 Received: (qmail 4060 invoked by uid 22791); 1 May 2012 19:38:11 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, 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, 01 May 2012 19:37:55 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q41JbsFm021301 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 May 2012 15:37:55 -0400 Received: from [10.3.113.104] (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q41Jbsbh001517; Tue, 1 May 2012 15:37:54 -0400 Message-ID: <4FA03B91.9070304@redhat.com> Date: Tue, 01 May 2012 15:37:53 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Richard Henderson CC: gcc-patches List Subject: RFA (i386): PATCH to ix86_code_end to set DECL_IGNORED_P on the PC thunk 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 While working on another DWARF patch I ran into a crash because we didn't set DECL_IGNORED_P on the PC thunk, but we also don't emit any debug info for it. Since there's no debug info, we should set DECL_IGNORED_P, and we shouldn't add ignored functions to .debug_aranges or .debug_ranges. OK for trunk? commit 1c8822f0eba9797ca937fd899c960a1b355d0563 Author: Jason Merrill Date: Mon Apr 23 16:29:36 2012 -0400 * config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the pc thunk. * dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions. (dwarf2out_finish): Likewise. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 903683e..43d8b8b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8612,6 +8612,7 @@ ix86_code_end (void) NULL_TREE, void_type_node); TREE_PUBLIC (decl) = 1; TREE_STATIC (decl) = 1; + DECL_IGNORED_P (decl) = 1; #if TARGET_MACHO if (TARGET_MACHO) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8bbf954..311914a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -8085,6 +8085,8 @@ output_aranges (unsigned long aranges_length) FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde) { + if (DECL_IGNORED_P (fde->decl)) + continue; if (!fde->in_std_section) { dw2_asm_output_addr (DWARF2_ADDR_SIZE, fde->dw_fde_begin, @@ -21895,6 +21897,8 @@ dwarf2out_finish (const char *filename) FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde) { + if (DECL_IGNORED_P (fde->decl)) + continue; if (!fde->in_std_section) add_ranges_by_labels (comp_unit_die (), fde->dw_fde_begin, fde->dw_fde_end, &range_list_added); diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C b/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C new file mode 100644 index 0000000..c34373e --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C @@ -0,0 +1,11 @@ +// Test that we don't add the x86 PC thunk to .debug_ranges +// { dg-do compile { target i?86-*-* } } +// { dg-options "-g -fpic" } +// { dg-final { scan-assembler-times "LFB3" 1 } } + +template void f(T t) { } + +int main() +{ + f(42); +}