------- Comment #5 from iains at gcc dot gnu dot org 2010-05-15 08:59 ------- (In reply to comment #4) > Subject: Re: [4.6 Regression] emutls is broken under a > range of circumstances. > > The problem is because emultls is handling declarations in a way so references > are not visible to > middle end. I guess we need to put DECL_PRESERVE at the emultls variable so > it > stays innert.
Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 159429) +++ gcc/varasm.c (working copy) @@ -386,6 +386,7 @@ emutls_decl (tree decl) DECL_TLS_MODEL (to) = TLS_MODEL_EMULATED; DECL_ARTIFICIAL (to) = 1; DECL_IGNORED_P (to) = 1; + DECL_PRESERVE_P (to) = 1; TREE_READONLY (to) = 0; SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to)); if (DECL_ONE_ONLY (decl)) looks good so far .. I'll have to wait for the bootstrap on x86_64 to succeed/fail to try it there too (PR44146 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44132