[Bug target/44132] [4.6 Regression] emutls is broken under a range of circumstances.
iains at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue May 18 01:40:00 GMT 2010
------- Comment #16 from iains at gcc dot gnu dot org 2010-05-18 01:40 -------
the patch below helps...
I also suspect we might have to check for emutls vars twice - because they can
be introduced by profiling code
just for the sake of a trial - I've put the emutls_final into toplev.c twice:
-- before lang_hooks.decls.final_write_globals ();
-- and before .. varpool_assemble_pending_decls ();
with all of that (but output disabled from expr.c)
torture/tls/thr-init-1.c fails lto/whopr
BUT torture/tls/thr-init-2.c passes :-)
and libgomp looks *much* better...
still there must be other places that output is being produced...
===
Index: gcc/varpool.c
===================================================================
--- gcc/varpool.c (revision 159523)
+++ gcc/varpool.c (working copy)
@@ -297,6 +297,14 @@ varpool_mark_needed_node (struct varpool_node *nod
&& !TREE_ASM_WRITTEN (node->decl))
varpool_enqueue_needed_node (node);
node->needed = 1;
+ /* If we need the var, and it's an emulated TLS entity, that
+ means we need the control var. */
+ if (!targetm.have_tls && DECL_THREAD_LOCAL_P (node->decl))
+ {
+ struct varpool_node *cv_node;
+ cv_node = varpool_node (emutls_decl (node->decl)) ;
+ varpool_mark_needed_node (cv_node);
+ }
}
/* Reset the queue of needed nodes. */
@@ -366,11 +374,7 @@ varpool_finalize_decl (tree decl)
or local (in C, has internal linkage). So do nothing more
if this function has already run. */
if (node->finalized)
- {
- if (cgraph_global_info_ready)
- varpool_assemble_pending_decls ();
return;
- }
if (node->needed)
varpool_enqueue_needed_node (node);
node->finalized = true;
@@ -384,8 +388,6 @@ varpool_finalize_decl (tree decl)
there. */
else if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
varpool_mark_needed_node (node);
- if (cgraph_global_info_ready)
- varpool_assemble_pending_decls ();
}
/* Return variable availability. See cgraph.h for description of individual
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44132
More information about the Gcc-bugs
mailing list