diff mbox

Fix tls model dumping

Message ID 20150128195622.GB12782@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Jan. 28, 2015, 7:56 p.m. UTC
Hi,
this patch fixes dumping of tls models. tls-real is not really a model,
just equivalent of tls-global-dynamic.

Comitted as obvious.

Honza

Comments

Alan Modra Jan. 29, 2015, 3:35 a.m. UTC | #1
On Wed, Jan 28, 2015 at 08:56:22PM +0100, Jan Hubicka wrote:
> -const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
> -				      "tls-global-dynamic", "tls-local-dynamic",
> -				      "tls-initial-exec", "tls-local-exec"};
> +const char * const tls_model_names[]={"none", "emulated",
> +				      "global-dynamic", "local-dynamic",
> +				      "initial-exec", "local-exec"};

I just made the same mistake in a binutils commit message.  The proper
term is general-dynamic, not global-dynamic.  See Drepper's TLS paper,
section 4.  http://www.akkadia.org/drepper/tls.pdf
Jan Hubicka Jan. 29, 2015, 5:07 a.m. UTC | #2
> On Wed, Jan 28, 2015 at 08:56:22PM +0100, Jan Hubicka wrote:
> > -const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
> > -				      "tls-global-dynamic", "tls-local-dynamic",
> > -				      "tls-initial-exec", "tls-local-exec"};
> > +const char * const tls_model_names[]={"none", "emulated",
> > +				      "global-dynamic", "local-dynamic",
> > +				      "initial-exec", "local-exec"};
> 
> I just made the same mistake in a binutils commit message.  The proper
> term is general-dynamic, not global-dynamic.  See Drepper's TLS paper,
> section 4.  http://www.akkadia.org/drepper/tls.pdf

Hmm, this seems to disagree with our attribute:
@item -ftls-model=@var{model}                                                   
@opindex ftls-model                                                             
Alter the thread-local storage model to be used (@pxref{Thread-Local}).         
The @var{model} argument should be one of @code{global-dynamic},                
@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.                 
Note that the choice is subject to optimization: the compiler may use           
a more efficient model for symbols not visible outside of the translation       
unit, or if @option{-fpic} is not given on the command line.                    
                                                                                
The default without @option{-fpic} is @code{initial-exec}; with                 
@option{-fpic} the default is @code{global-dynamic}.                            

If it is indeed a mistake, I guess we can just support both names.

Honza
Alan Modra Jan. 29, 2015, 5:43 a.m. UTC | #3
On Thu, Jan 29, 2015 at 06:07:16AM +0100, Jan Hubicka wrote:
> > On Wed, Jan 28, 2015 at 08:56:22PM +0100, Jan Hubicka wrote:
> > > -const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
> > > -				      "tls-global-dynamic", "tls-local-dynamic",
> > > -				      "tls-initial-exec", "tls-local-exec"};
> > > +const char * const tls_model_names[]={"none", "emulated",
> > > +				      "global-dynamic", "local-dynamic",
> > > +				      "initial-exec", "local-exec"};
> >
> > I just made the same mistake in a binutils commit message.  The proper
> > term is general-dynamic, not global-dynamic.  See Drepper's TLS paper,
> > section 4.  http://www.akkadia.org/drepper/tls.pdf
>
> Hmm, this seems to disagree with our attribute:
> @item -ftls-model=@var{model}
> @opindex ftls-model
> Alter the thread-local storage model to be used (@pxref{Thread-Local}).
> The @var{model} argument should be one of @code{global-dynamic},
> @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.

Huh, it must have been Drepper that made the mistake.  :-)

--
Alan Modra
Australia Development Lab, IBM
Jakub Jelinek Jan. 29, 2015, 8:03 a.m. UTC | #4
On Thu, Jan 29, 2015 at 04:13:38PM +1030, Alan Modra wrote:
> On Thu, Jan 29, 2015 at 06:07:16AM +0100, Jan Hubicka wrote:
> > > On Wed, Jan 28, 2015 at 08:56:22PM +0100, Jan Hubicka wrote:
> > > > -const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
> > > > -				      "tls-global-dynamic", "tls-local-dynamic",
> > > > -				      "tls-initial-exec", "tls-local-exec"};
> > > > +const char * const tls_model_names[]={"none", "emulated",
> > > > +				      "global-dynamic", "local-dynamic",
> > > > +				      "initial-exec", "local-exec"};
> > >
> > > I just made the same mistake in a binutils commit message.  The proper
> > > term is general-dynamic, not global-dynamic.  See Drepper's TLS paper,
> > > section 4.  http://www.akkadia.org/drepper/tls.pdf
> >
> > Hmm, this seems to disagree with our attribute:
> > @item -ftls-model=@var{model}
> > @opindex ftls-model
> > Alter the thread-local storage model to be used (@pxref{Thread-Local}).
> > The @var{model} argument should be one of @code{global-dynamic},
> > @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
> 
> Huh, it must have been Drepper that made the mistake.  :-)

Even the tls.pdf mentions sometimes Global Dynamic and sometimes General
Dynamic.  But the Global Dynamic is in additions made by me apparently.

Anyway, I think it is too late to change this now on the GCC side,
we it is part of options and attributes.

	Jakub
Jan Hubicka Jan. 29, 2015, 4:31 p.m. UTC | #5
> On Thu, Jan 29, 2015 at 04:13:38PM +1030, Alan Modra wrote:
> > On Thu, Jan 29, 2015 at 06:07:16AM +0100, Jan Hubicka wrote:
> > > > On Wed, Jan 28, 2015 at 08:56:22PM +0100, Jan Hubicka wrote:
> > > > > -const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
> > > > > -				      "tls-global-dynamic", "tls-local-dynamic",
> > > > > -				      "tls-initial-exec", "tls-local-exec"};
> > > > > +const char * const tls_model_names[]={"none", "emulated",
> > > > > +				      "global-dynamic", "local-dynamic",
> > > > > +				      "initial-exec", "local-exec"};
> > > >
> > > > I just made the same mistake in a binutils commit message.  The proper
> > > > term is general-dynamic, not global-dynamic.  See Drepper's TLS paper,
> > > > section 4.  http://www.akkadia.org/drepper/tls.pdf
> > >
> > > Hmm, this seems to disagree with our attribute:
> > > @item -ftls-model=@var{model}
> > > @opindex ftls-model
> > > Alter the thread-local storage model to be used (@pxref{Thread-Local}).
> > > The @var{model} argument should be one of @code{global-dynamic},
> > > @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
> > 
> > Huh, it must have been Drepper that made the mistake.  :-)
> 
> Even the tls.pdf mentions sometimes Global Dynamic and sometimes General
> Dynamic.  But the Global Dynamic is in additions made by me apparently.
> 
> Anyway, I think it is too late to change this now on the GCC side,
> we it is part of options and attributes.

One thing we can do is to add alias and accept both names...

Honza
> 
> 	Jakub
Jakub Jelinek Jan. 29, 2015, 4:32 p.m. UTC | #6
On Thu, Jan 29, 2015 at 05:31:14PM +0100, Jan Hubicka wrote:
> > Even the tls.pdf mentions sometimes Global Dynamic and sometimes General
> > Dynamic.  But the Global Dynamic is in additions made by me apparently.
> > 
> > Anyway, I think it is too late to change this now on the GCC side,
> > we it is part of options and attributes.
> 
> One thing we can do is to add alias and accept both names...

That would be fine with me.

	Jakub
diff mbox

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 220212)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2015-01-28  Jan Hubicka  <hubicka@ucw.cz>
+
+	* varpool.c (tls_model_names): Fix names.
+	(varpool_node::dump): Dump tls- prefix for tls models.
+
 2015-01-28  Thomas Schwinge  <thomas@codesourcery.com>
 	    Bernd Schmidt  <bernds@codesourcery.com>
 	    Nathan Sidwell  <nathan@codesourcery.com>
Index: varpool.c
===================================================================
--- varpool.c	(revision 220212)
+++ varpool.c	(working copy)
@@ -58,9 +58,9 @@  along with GCC; see the file COPYING3.
 #include "context.h"
 #include "omp-low.h"
 
-const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
-				      "tls-global-dynamic", "tls-local-dynamic",
-				      "tls-initial-exec", "tls-local-exec"};
+const char * const tls_model_names[]={"none", "emulated",
+				      "global-dynamic", "local-dynamic",
+				      "initial-exec", "local-exec"};
 
 /* List of hooks triggered on varpool_node events.  */
 struct varpool_node_hook_list {
@@ -251,7 +251,7 @@  varpool_node::dump (FILE *f)
   if (writeonly)
     fprintf (f, " write-only");
   if (tls_model)
-    fprintf (f, " %s", tls_model_names [tls_model]);
+    fprintf (f, " tls-%s", tls_model_names [tls_model]);
   fprintf (f, "\n");
 }