From 8e1ba78f1b8eedd6c65c6f0e6d6d09a801de5d3d Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 20 Sep 2014 05:11:04 +0200 Subject: [PATCH] ipa-visibility.c (varpool_node::externally_visible_p): Do not privatize dynamic TLS variables. * ipa-visibility.c (varpool_node::externally_visible_p): Do not privatize dynamic TLS variables. From-SVN: r215417 --- gcc/ChangeLog | 5 +++++ gcc/ipa-visibility.c | 7 +++++++ 2 files changed, 12 insertions(+) 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))