From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 05:34:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg01277.txt.bz2 --=-=-= Content-length: 565 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=mudflap-global-init-check-symtab-pr53359.patch Content-length: 816 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, --=-=-= Content-length: 258 -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer --=-=-=--