From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12081 invoked by alias); 6 Jan 2013 19:48:16 -0000 Received: (qmail 12068 invoked by uid 22791); 6 Jan 2013 19:48:15 -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 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; Sun, 06 Jan 2013 19:48:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r06Jm7pR021723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 6 Jan 2013 14:48:07 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r06Jm0dA017164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Jan 2013 14:48:05 -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 r06Jlues009727; Sun, 6 Jan 2013 17:47:57 -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 r06Jlseg026037; Sun, 6 Jan 2013 17:47:54 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id r06JlqHd026034; Sun, 6 Jan 2013 17:47:52 -0200 From: Alexandre Oliva To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Jan Hubicka Subject: Re: [PR libmudflap/53359] don't register symbols not emitted References: Date: Sun, 06 Jan 2013 19:48:00 -0000 In-Reply-To: (Richard Biener's message of "Wed, 2 Jan 2013 15:53:38 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2013-01/txt/msg00263.txt.bz2 On Jan 2, 2013, Richard Biener wrote: > On Sun, Dec 30, 2012 at 1:22 AM, Alexandre Oliva wrote: >> On Dec 21, 2012, Richard Biener wrote: >> >>> On Fri, Dec 21, 2012 at 6:33 AM, Alexandre Oliva wrote: >>>> 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. >> >>> Hmm, I think that at this point of the compilation you are looking for >>> TREE_ASM_WRITTEN instead. >> >> That doesn't work, several mudflap regressions show up because accesses >> to global library symbols that are accessed by template methods compiled >> with mudflap (say cout) are then verified but not registered. We have >> to register symbols that are not emitted but that referenced. > Ehm, how can something be not emitted but still referenced? You mean if > it's external? Yeah. > if (!TREE_ASM_WRITTEN (obj) || DECL_EXTERNAL (obj)) > instead? Then we're back to the original bug. How does the test above tell whether we're actually referencing the object? Only when we are do we want to register it with mudflap. If it's referenced and we don't register it, we get mudflap runtime errors. If it's not referenced but we register it, we get link-time errors if the symbol is one we'd have emitted if it was referenced. -- 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