public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR libmudflap/53359] don't register symbols not emitted
@ 2012-12-21  5:34 Alexandre Oliva
  2012-12-21  9:51 ` Richard Biener
  0 siblings, 1 reply; 13+ messages in thread
From: Alexandre Oliva @ 2012-12-21  5:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mudflap-global-init-check-symtab-pr53359.patch --]
[-- Type: text/x-diff, Size: 816 bytes --]

don't let mudflap register global symbols that won't be emitted

From: Alexandre Oliva <aoliva@redhat.com>

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,

[-- Attachment #3: Type: text/plain, Size: 258 bytes --]



-- 
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-01-18 11:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-21  5:34 [PR libmudflap/53359] don't register symbols not emitted Alexandre Oliva
2012-12-21  9:51 ` Richard Biener
2012-12-21  9:55   ` Jakub Jelinek
2012-12-21 10:42     ` Jan Hubicka
2012-12-30  0:23   ` Alexandre Oliva
2013-01-02 14:53     ` Richard Biener
2013-01-06 19:48       ` Alexandre Oliva
2013-01-07  9:28         ` Richard Biener
2013-01-16  9:29           ` Alexandre Oliva
2013-01-16 10:24             ` Jan Hubicka
2013-01-16 13:17               ` Alexandre Oliva
2013-01-16 13:48                 ` Richard Biener
2013-01-18 11:44               ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).