public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Avoid privatization of TLS variables
@ 2014-09-20  3:16 Jan Hubicka
  2014-09-24 17:53 ` Markus Trippelsdorf
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Hubicka @ 2014-09-20  3:16 UTC (permalink / raw)
  To: gcc-patches

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  <hubicka@ucw.cz>
 
+	* ipa-visibility.c (varpool_node::externally_visible_p): Do not
+	privatize dynamic TLS variables.
+
+2014-09-19  Jan Hubicka  <hubicka@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))

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-09-27  8:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-20  3:16 Avoid privatization of TLS variables Jan Hubicka
2014-09-24 17:53 ` Markus Trippelsdorf
2014-09-24 18:18   ` Jan Hubicka
2014-09-24 19:10     ` Markus Trippelsdorf
2014-09-25  0:48     ` Ian Lance Taylor
2014-09-25  1:58       ` Jan Hubicka
2014-09-25 15:24         ` Ian Lance Taylor
2014-09-25 15:37           ` H.J. Lu
2014-09-25 16:24             ` Ian Lance Taylor
2014-09-25 16:30               ` Jan Hubicka
2014-09-26  2:09                 ` Cary Coutant
2014-09-26  2:17                   ` Jan Hubicka
2014-09-26  2:42                     ` Cary Coutant
2014-09-26  2:50                       ` Jan Hubicka
2014-09-26  3:03                         ` Markus Trippelsdorf
2014-09-26 13:07                     ` Alan Modra
2014-09-26 19:16                       ` Jan Hubicka
2014-09-25 16:05           ` Jan Hubicka
2014-09-27  7:56       ` Andrew Haley
2014-09-27  8:53         ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).