https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61436
--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> --- Hi, it seems that get_emutls_init_templ_addr just create the comdat too early and we trigger sanity check that symbols are static and not automatic variables. I have busy day tomorrow, so won't beat if anyone beats me in testing if this fix works. Honza Index: tree-emutls.c =================================================================== --- tree-emutls.c (revision 211363) +++ tree-emutls.c (working copy) @@ -250,10 +250,10 @@ get_emutls_init_templ_addr (tree decl) DECL_WEAK (to) = DECL_WEAK (decl); if (DECL_ONE_ONLY (decl)) { - make_decl_one_only (to, DECL_ASSEMBLER_NAME (to)); TREE_STATIC (to) = TREE_STATIC (decl); TREE_PUBLIC (to) = TREE_PUBLIC (decl); DECL_VISIBILITY (to) = DECL_VISIBILITY (decl); + make_decl_one_only (to, DECL_ASSEMBLER_NAME (to)); } else TREE_STATIC (to) = 1;