From patchwork Fri Dec 21 05:33:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 207761 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 EEBB82C0084 for ; Fri, 21 Dec 2012 16:34:06 +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=1356672847; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:From:To:Cc:Subject:Date: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=2JeOGGz/6A4M1oYaxihtHgwz/ik=; b=aS7nKYfk+A8wMlc PyHc7TSQDTLZQ42mZzeA49xsL86vRY6O2zNi3nEEdQTuCvL4/r1CqeQ7JIhOC1Qp B8saEbSH7eC5sPSwCdAe3MXW6e+T+BKY6mhYTO0xwIzRNz9c/IvcPV//KNJ+wzCU V4VaXL76/vkpm797Ho01u/b9P7hk= 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:Date: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=m8nfZtxZmgXbYu8fd/7nP9+fRLuTq3fEI8tefUEnxVOEXk3dIBjuYH9Nmhh4IU BPwfh63iBzqZPXPrQacm1nfz3yagEfJcZLRSQpmwR7CxrOWJT1G887PDwcul9tk6 /tqboOL7xY6t8fxmabQDvKJAYbqaDP4ojQGApiKnkjDHM=; Received: (qmail 11050 invoked by alias); 21 Dec 2012 05:34:01 -0000 Received: (qmail 11041 invoked by uid 22791); 21 Dec 2012 05:33:59 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, 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, 21 Dec 2012 05:33:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBL5Xn8k015775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Dec 2012 00:33:49 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qBL5XkiL000783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Dec 2012 00:33:49 -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 qBL5XdMs014305; Fri, 21 Dec 2012 03:33:40 -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 qBL5XcQI012347; Fri, 21 Dec 2012 03:33:39 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id qBL5XbfF012345; Fri, 21 Dec 2012 03:33:37 -0200 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Jan Hubicka Subject: [PR libmudflap/53359] don't register symbols not emitted Date: Fri, 21 Dec 2012 03:33:37 -0200 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 libmudflap emits a global initializer that registers memory ranges for global data symbols. However, even if IPA decides not to emit a symbol because it's unused, we'd still emit registration sequences for them in some cases, which, in the PR testcase, would result in TOC references to the undefined symbols. This patch fixes the problem, avoiding registration for symbols that are not present in the varpool. Regstrapped on x86_64-linux-gnu and i686-linux-gnu; I've also verified that it removes the TOC references on a ppc64-linux-gnu cross. Ok to install? 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 | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 90d0448..a9caaf2 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -1335,6 +1335,10 @@ mudflap_finish_file (void) if (! TREE_PUBLIC (obj) && ! TREE_ADDRESSABLE (obj)) continue; + /* If we're not emitting the symbol, don't register it. */ + if (!symtab_get_node (obj)) + continue; + if (! COMPLETE_TYPE_P (TREE_TYPE (obj))) { warning (OPT_Wmudflap,