------- Comment #20 from developer at sandoe-acoustics dot co dot uk
2010-04-02 21:15 -------
(In reply to comment #18)
> TREE_USED then?
It looks to me like the problem is more subtle.
I think it is to do with the fact that the emutls variables are proxies for the
actual ones and that the proxies are not being finalized.
I've patched current tree (+ the tree-profile.c patch) with the one below ...
... this fixes the unresolved vars problems .. but, maybe causes one
regression in g++ and a few in libgomp.fortran,
I'm looking into those -- but would really welcome input from people who know
more about emutls.
Index: gcc/varpool.c
===================================================================
--- gcc/varpool.c (revision 157942)
+++ gcc/varpool.c (working copy)
@@ -281,6 +281,17 @@
varpool_finalize_decl (tree decl)
{
struct varpool_node *node = varpool_node (decl);
+
+ /* When emulating tls, we actually see references to the control
+ variable, rather than the user-level variable. Make sure that
+ these control variables are finalized. */
+ if (!targetm.have_tls
+ && TREE_CODE (decl) == VAR_DECL
+ && DECL_THREAD_LOCAL_P (decl))
+ {
+ tree control = emutls_decl (decl);
+ varpool_finalize_decl (control);
+ }
/* FIXME: We don't really stream varpool datastructure and instead rebuild
it
by varpool_finalize_decl. This is not quite correct since this way we
can't
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43553