Hi, libreoffice fails to build with TLS because of "Cannot load any more object with static TLS". Iant pointed out to me the difference that the initial exec TLS model is also used by static TLS variables.
This patch prevents turning TLS variables into static that lets me to finish libreoffice build. Can the conditional be strenghtened somewhat? decl_default_tls_model has: if (!flag_shlib) { if (is_local) kind = TLS_MODEL_LOCAL_EXEC; else kind = TLS_MODEL_INITIAL_EXEC; } /* Local dynamic is inefficient when we're not combining the parts of the address. */ else if (optimize && is_local) kind = TLS_MODEL_LOCAL_DYNAMIC; else kind = TLS_MODEL_GLOBAL_DYNAMIC; perhaps we should have fake TLS_MODEL_EXEC and TLS_MODE_DYNAMIC modes that get more specified later once the visibility is finalized instead of deciding it at compile time? Bootstrapped/regtested x86_64-linux, comitted for now until we get better solution (if it exists). Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 215416) +++ ChangeLog (working copy) @@ -1,5 +1,10 @@ 2014-09-19 Jan Hubicka <hubi...@ucw.cz> + * ipa-visibility.c (varpool_node::externally_visible_p): Do not + privatize dynamic TLS variables. + +2014-09-19 Jan Hubicka <hubi...@ucw.cz> + * diagnostic.c (warning_n): New function. * diagnostic-core.h (warning_n): Declare. * ipa-devirt.c (ipa_devirt): Handle singulars correctly; Index: ipa-visibility.c =================================================================== --- ipa-visibility.c (revision 215415) +++ ipa-visibility.c (working copy) @@ -277,6 +277,13 @@ varpool_node::externally_visible_p (void if (used_from_object_file_p ()) return true; + /* Bringing TLS variables local may cause dynamic linker failures + on limits of static TLS vars. */ + if (DECL_THREAD_LOCAL_P (decl) + && (DECL_TLS_MODEL (decl) != TLS_MODEL_EMULATED + && DECL_TLS_MODEL (decl) != TLS_MODEL_INITIAL_EXEC)) + return true; + if (DECL_HARD_REGISTER (decl)) return true; if (DECL_PRESERVE_P (decl))