From patchwork Thu Feb 19 16:45:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 441686 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 91F4114012A for ; Fri, 20 Feb 2015 03:45:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=XN6yllrV334uTwc7q q27m6oNp7X7Uy6aQCdysVY92Wl3xsaspRwvHAe65PneRryuToHoNfKotW5+DHlCy SduAaOSo5z+Lqzxzy0rh5PYUblcfoPbRCynRL+kxjEZzAqwATQD+qgHMDQ89gYK0 dwb6LXiw6PXFj+woe9L0BHhmfc= 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 :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=Is2gpBmSYNANuyEIYPl/RyQ oZNc=; b=stA2DqGhtHnHSBySmVB45rLSddg4KPo/hrQRrvl9KYhBxUSkLh6lYsR iN5ATtHVOkUIGSxaYHzNOhIcrZhCNkcumum4cLFjYvvyrwlae1sGtBRff1iYzcUG 6AUDJIKRyFYctdoEanFKUvTSkvxIqybVjpqZsQhrl5jgEvQHHDSY= Received: (qmail 8235 invoked by alias); 19 Feb 2015 16:45: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 8214 invoked by uid 89); 19 Feb 2015 16:45:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 19 Feb 2015 16:45:12 +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 t1JGjA2A006369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 19 Feb 2015 11:45:11 -0500 Received: from reynosa.quesejoda.com (vpn-61-7.rdu2.redhat.com [10.10.61.7]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1JGj9DK025024; Thu, 19 Feb 2015 11:45:09 -0500 Message-ID: <54E61314.9070805@redhat.com> Date: Thu, 19 Feb 2015 08:45:08 -0800 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: jason merrill , Jakub Jelinek , gcc-patches Subject: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH References: <54E6129C.5060706@redhat.com> In-Reply-To: <54E6129C.5060706@redhat.com> X-Forwarded-Message-Id: <54E6129C.5060706@redhat.com> [And this time, actually CCing the list :)]. Gentlemen! Reading in the compiler state for pch (gt_pch_restore) obliterates the DIE table, and consequently the DW_TAG_GNU_[BE]INCL* DIEs that may have been in it. This causes inconsistencies when reading in _any_ pre-compiled header into a source file that uses -feliminate-dwarf2-dups, and consequently already has some DW_TAG_GNU_[BE]INCL* DIEs. Normally the DIE table should be empty this early on, especially since mainline generates dwarf at the end of the compilation unit, but the DIE table may have DW_TAG_GNU_[BE]INCL* DIEs that were created early by dwarf2out_start_source_file/etc or it may have the DW_TAG_compile_unit. I suppose we could merge incoming DIEs with existing DIEs and complicate our lives, but considering we will probably have to tackle this in the debug-early work, I propose we disable this combination for now (and possibly permanently, unless we really care about it). OK for mainline pending tests? Aldy commit c0814b101417a5639fe70b41526b4e2d7a56ee52 Author: Aldy Hernandez Date: Thu Feb 19 07:35:59 2015 -0800 PR debug/46102 * c-pch.c (c_common_read_pch): Disable -feliminate-dwarf2-dups if reading a pre-compiled header. diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c index 0ede92a..6b442e2 100644 --- a/gcc/c-family/c-pch.c +++ b/gcc/c-family/c-pch.c @@ -381,6 +381,23 @@ c_common_read_pch (cpp_reader *pfile, const char *name, timevar_pop (TV_PCH_CPP_RESTORE); gt_pch_restore (f); + + /* At pre-compiled header output time, we may have outputted a few + DIEs corresponding to DW_TAG_GNU_[BE]INCL. Reading the compiler + state above will read in these DIEs, and obliterate any + DW_TAG_GNU_[BE]INCL so far generated. + + Disable this combination for now. When early debug generation is + implemented, we can probably get this combo to work. */ + if (flag_eliminate_dwarf2_dups) + { + warning_at (UNKNOWN_LOCATION, 0, + "Pre-compiled headers cannot be used with -feliminate-dwarf2-dups."); + warning_at (UNKNOWN_LOCATION, 0, + "-feliminate-dwarf2-dups has been disabled."); + flag_eliminate_dwarf2_dups = 0; + } + cpp_set_line_map (pfile, line_table); rebuild_location_adhoc_htab (line_table);