http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46510

--- Comment #25 from Dominique d'Humieres <dominiq at lps dot ens.fr> 
2010-11-21 18:37:09 UTC ---
This seems to work:


--- ../_clean/gcc/tree-emutls.c    2010-11-19 18:13:00.000000000 +0100
+++ gcc/tree-emutls.c    2010-11-21 19:34:11.000000000 +0100
@@ -257,7 +257,12 @@ get_emutls_init_templ_addr (tree decl)
             targetm.emutls.tmpl_section);
     }

-  varpool_finalize_decl (to);
+  /* Create varpool node for the new variable and finalize it if it is
+     not external one.  */
+  if (DECL_EXTERNAL (to))
+    varpool_node (to);
+  else
+    varpool_finalize_decl (to);
   return build_fold_addr_expr (to);
 }

@@ -324,7 +329,12 @@ new_emutls_decl (tree decl)
       record_references_in_initializer (to, false);
     }

-  varpool_finalize_decl (to);
+  /* Create varpool node for the new variable and finalize it if it is
+     not external one.  */
+  if (DECL_EXTERNAL (to))
+    varpool_node (to);
+  else
+    varpool_finalize_decl (to);
   return to;
 }

Reply via email to