This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Small fix for the handling of weak decls


If we see first a WEAKUNDEF  and then a WEAKDEF, we should use the
second. Also, the resolution of WEAKUNDEF should be LDPR_RESOLVED_IR.

2008-12-09  Rafael Avila de Espindola  <espindola@google.com>

	* lto-function-in.c (get_resolution): Fix handling of weak decls.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto-function-in.c b/gcc/lto-function-in.c
index 5c62247..5c12d7c 100644
--- a/gcc/lto-function-in.c
+++ b/gcc/lto-function-in.c
@@ -2827,10 +2827,16 @@ get_resolution (struct data_in *data_in, unsigned index)
 	 be the prevailing definition.  */
       if (DECL_WEAK (t))
 	{
+	  tree prevailing_decl;
+	  if (DECL_EXTERNAL (t))
+	    return LDPR_RESOLVED_IR;
+
 	  /* If this is the first time we see T, it won't have a
 	     prevailing definition yet.  */
-	  tree prevailing_decl = lto_symtab_prevailing_decl (t);
-	  if (prevailing_decl == t || prevailing_decl == NULL_TREE)
+	  prevailing_decl = lto_symtab_prevailing_decl (t);
+	  if (prevailing_decl == t
+	      || prevailing_decl == NULL_TREE
+	      || DECL_EXTERNAL (prevailing_decl))
 	    return LDPR_PREVAILING_DEF;
 	  else
 	    return LDPR_PREEMPTED_IR;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]