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]

Avoid duplicate symbols produced by emutls


Hi,
this patch fixes issue with emutls outputting duplicate ddeifnitions of the vars
it creates becuase it sometimes inserts variable twice (once as alias target and
once as real var).

Bootstrapped/regtested x86_64-linux and HP regtested at at cris-elf.
	PR ipa/61548
	* tree-emutls.c (ipa_lower_emutls): Avoid duplicates in TLS_VARS.
Index: tree-emutls.c
===================================================================
--- tree-emutls.c	(revision 220547)
+++ tree-emutls.c	(working copy)
@@ -753,17 +753,19 @@ ipa_lower_emutls (void)
   cgraph_node *func;
   bool any_aliases = false;
   tree ctor_body = NULL;
-
+  hash_set <varpool_node *> visited;
   auto_vec <varpool_node *> tls_vars;
 
   /* Examine all global variables for TLS variables.  */
   FOR_EACH_VARIABLE (var)
-    if (DECL_THREAD_LOCAL_P (var->decl))
+    if (DECL_THREAD_LOCAL_P (var->decl)
+	&& !visited.add (var))
       {
 	gcc_checking_assert (TREE_STATIC (var->decl)
 			     || DECL_EXTERNAL (var->decl));
 	tls_vars.safe_push (var);
-	if (var->alias && var->definition)
+	if (var->alias && var->definition
+	    && !visited.add (var->ultimate_alias_target ()))
 	  tls_vars.safe_push (var->ultimate_alias_target ());
       }
 


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