From patchwork Fri Jan 18 11:14:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 213577 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 EB4A12C0079 for ; Fri, 18 Jan 2013 22:45:01 +1100 (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=1359114302; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:From:To:Cc:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=1SI554FmoLPmmxMmUKtb vKl1pag=; b=TZm/kbflILXEZH+KL+3lZYH0CeQSFj1uRKhu+8RnbKiYOAxC7kGN mh85NURNiBDusfrdwoz9tt+gG1VqY2VE3nf+RG8F143hFAvREVF5mNyMVIAS71jm 4w1wiIjNYQUe1d4fP/gWXXcIqAshSGeU+qfSkNQw7kVNM4OirU0izdY= 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:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=C02oPTb+LN+behVn4XGUgAgqKNkZ7ctVUZeNMe41NZ9ORcfW4++Zx70LapnEzw No6bZHQa/yqHhR13dQ/Yy3q4aJz3khsNkY2Zd9XFuDiFwDpyJbO6mDkL+kecvgkL gdbphYhSy6NSvB5I5b2xB+T8vsv8trudJgWtWQRLB2nA0=; Received: (qmail 26176 invoked by alias); 18 Jan 2013 11:44:38 -0000 Received: (qmail 26130 invoked by uid 22791); 18 Jan 2013 11:44:36 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, T_TVD_MIME_NO_HEADERS 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; Fri, 18 Jan 2013 11:44:25 +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 r0IBiMOG026896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jan 2013 06:44:25 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0IBF6ss004298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Jan 2013 06:15:08 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.5/8.14.5) with ESMTP id r0IBF136026360; Fri, 18 Jan 2013 09:15:01 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id r0IBF0KS024316; Fri, 18 Jan 2013 09:15:00 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id r0IBExGO024314; Fri, 18 Jan 2013 09:14:59 -0200 From: Alexandre Oliva To: Jan Hubicka Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PR libmudflap/53359] don't register symbols not emitted References: <20130116102428.GD5949@kam.mff.cuni.cz> Date: Fri, 18 Jan 2013 09:14:59 -0200 In-Reply-To: <20130116102428.GD5949@kam.mff.cuni.cz> (Jan Hubicka's message of "Wed, 16 Jan 2013 11:24:28 +0100") 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 On Jan 16, 2013, Jan Hubicka wrote: > For 2) the symtab_get_node test seems resonable to me. It is what > dwarf2out does, too. We keep nodes for external vars that are > refereed but we remove all optimized out nodes. Since you agreed this was the right approach and richi said he didn't care much, I went ahead and installed the patch I'd proposed at first. don't let mudflap register global symbols that won't be emitted From: Alexandre Oliva for gcc/ChangeLog PR libmudflap/53359 * tree-mudflap.c (mudflap_finish_file): Skip deferred decls not found in the symtab. --- gcc/tree-mudflap.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 3c866bc..b250bfe 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -1334,6 +1334,16 @@ mudflap_finish_file (void) if (! TREE_PUBLIC (obj) && ! TREE_ADDRESSABLE (obj)) continue; + /* If we're neither emitting nor referencing the symbol, + don't register it. We have to register external symbols + if they happen to be in other files not compiled with + mudflap (say system libraries), and we must not register + internal symbols that we don't emit or they'll become + dangling references or force symbols to be emitted that + didn't have to. */ + if (!symtab_get_node (obj)) + continue; + if (! COMPLETE_TYPE_P (TREE_TYPE (obj))) { warning (OPT_Wmudflap,