diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c03408368f..87907fdd6fd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-19 Jan Hubicka + + * ipa-visibility.c (varpool_node::externally_visible_p): Do not + privatize dynamic TLS variables. + 2014-09-19 Jan Hubicka * diagnostic.c (warning_n): New function. diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index 32199af252f..ea6052f8861 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -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))