This is the mail archive of the
mailing list for the GCC project.
[PATCH, committed] Fix TLS and -fstack-protector on sparc64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Feb 2006 17:50:55 -0500
- Subject: [PATCH, committed] Fix TLS and -fstack-protector on sparc64
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
%g7 register is fixed thread pointer register both in Linux and to my
knowledge in Solaris as well, used for TLS (and on Linux for
-fstack-protector as well).
But, if in some source we want to read the thread pointer register
and do something like:
register void *tp __asm ("%g7");
then ld won't allow mixing such objects with other objects that
use %g7 solely for TLS (or -fstack-protector).
The patch below just instructs as/ld to not issue any warnings about that,
no checking is IMHO needed for %g7 - GCC has hardcoded %g7 in many places
as thread pointer register and so does Linux (and presumably Solaris)
libc as well.
2006-02-02 Jakub Jelinek <email@example.com>
* config/sparc/sparc.c (sparc_output_scratch_registers): Use
#ignore instead of #scratch for %g7 .register directive.
--- gcc/config/sparc/sparc.c.jj 2006-01-31 23:32:07.000000000 +0100
+++ gcc/config/sparc/sparc.c 2006-02-02 00:23:25.000000000 +0100
@@ -3693,7 +3693,10 @@ sparc_output_scratch_registers (FILE *fi
&& ! sparc_hard_reg_printed [i])
sparc_hard_reg_printed [i] = 1;
- fprintf (file, "\t.register\t%%g%d, #scratch\n", i);
+ /* %g7 is used as TLS base register, use #ignore
+ for it instead of #scratch. */
+ fprintf (file, "\t.register\t%%g%d, #%s\n", i,
+ i == 7 ? "ignore" : "scratch");
if (i == 3) i = 5;