aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2010-03-24 18:49:49 +0000
committerRainer Orth <ro@gcc.gnu.org>2010-03-24 18:49:49 +0000
commitf1c26cad132b285586863242c4bb6b5f551fae41 (patch)
treeef6a9e9fc1a86c9ee173f222db3bc79d9f53eddf
parentd2af65b9bc0c020a647859b553eac045410d0181 (diff)
downloadgcc-f1c26cad132b285586863242c4bb6b5f551fae41.zip
gcc-f1c26cad132b285586863242c4bb6b5f551fae41.tar.gz
gcc-f1c26cad132b285586863242c4bb6b5f551fae41.tar.bz2
re PR target/38118 (gcc emits non-TLS data as TLS on Solaris 11/SPARC)
* configure.ac (i[34567]86-*-*): Handle Solaris 2/x86 TLS support and Sun as TLS syntax. (TLS_SECTION_ASM_FLAG) [on_solaris && !gas_flag]: Define. * configure: Regenerate. * config.in: Regenerate. * varasm.c (TLS_SECTION_ASM_FLAG): Define default. (default_elf_asm_named_section): Use it. * config/i386/i386.c (output_pic_addr_const): Lowercase @DTPOFF. (i386_output_dwarf_dtprel): Likewise. (output_addr_const_extra): Likewise. (output_pic_addr_const): Lowercase @GOTTPOFF. (output_addr_const_extra): Likewise. (output_pic_addr_const): Lowercase @GOTNTPOFF. (output_addr_const_extra): Likewise. (output_pic_addr_const): Lowercase @INDNTPOFF. (output_addr_const_extra): Likewise. (output_pic_addr_const): Lowercase @NTPOFF. (output_addr_const_extra): Likewise. (output_pic_addr_const): Lowercase @TPOFF. (output_addr_const_extra): Likewise. * config/i386/i386.md (*tls_global_dynamic_32_gnu): Lowercase @TLSGD. (*tls_global_dynamic_64): Likewise. (*tls_local_dynamic_base_32_gnu): Lowercase @TLSLDM. (*tls_local_dynamic_base_64): Lowercase @TLSLD. * defaults.h (TLS_COMMON_ASM_OP): Provide default. (ASM_OUTPUT_TLS_COMMON): Use it. * config/i386/sol2-gas.h (TLS_COMMON_ASM_OP): Undef. PR target/38118 * config.gcc (sparc*-*-solaris2*) [$gas=yes]: Add usegas.h to tm_file. * config/sparc/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Move ... * config/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): ... here. * config/i386/sol2-10.h (ASM_OUTPUT_ALIGNED_COMMON): Redefine. * config/i386/sol2.h (TARGET_SUN_TLS): Redefine. From-SVN: r157705
-rw-r--r--gcc/ChangeLog41
-rw-r--r--gcc/config.gcc3
-rw-r--r--gcc/config.in7
-rw-r--r--gcc/config/i386/i386.c34
-rw-r--r--gcc/config/i386/i386.md8
-rw-r--r--gcc/config/i386/sol2-10.h15
-rw-r--r--gcc/config/i386/sol2-gas.h3
-rw-r--r--gcc/config/i386/sol2.h37
-rw-r--r--gcc/config/sol2.h21
-rw-r--r--gcc/config/sparc/sol2.h18
-rwxr-xr-xgcc/configure60
-rw-r--r--gcc/configure.ac63
-rw-r--r--gcc/defaults.h8
-rw-r--r--gcc/varasm.c6
14 files changed, 248 insertions, 76 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1bbb9d8..bff16dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,46 @@
2010-03-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+ * configure.ac (i[34567]86-*-*): Handle Solaris 2/x86 TLS support
+ and Sun as TLS syntax.
+ (TLS_SECTION_ASM_FLAG) [on_solaris && !gas_flag]: Define.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * varasm.c (TLS_SECTION_ASM_FLAG): Define default.
+ (default_elf_asm_named_section): Use it.
+ * config/i386/i386.c (output_pic_addr_const): Lowercase @DTPOFF.
+ (i386_output_dwarf_dtprel): Likewise.
+ (output_addr_const_extra): Likewise.
+ (output_pic_addr_const): Lowercase @GOTTPOFF.
+ (output_addr_const_extra): Likewise.
+ (output_pic_addr_const): Lowercase @GOTNTPOFF.
+ (output_addr_const_extra): Likewise.
+ (output_pic_addr_const): Lowercase @INDNTPOFF.
+ (output_addr_const_extra): Likewise.
+ (output_pic_addr_const): Lowercase @NTPOFF.
+ (output_addr_const_extra): Likewise.
+ (output_pic_addr_const): Lowercase @TPOFF.
+ (output_addr_const_extra): Likewise.
+ * config/i386/i386.md (*tls_global_dynamic_32_gnu): Lowercase
+ @TLSGD.
+ (*tls_global_dynamic_64): Likewise.
+ (*tls_local_dynamic_base_32_gnu): Lowercase @TLSLDM.
+ (*tls_local_dynamic_base_64): Lowercase @TLSLD.
+
+ * defaults.h (TLS_COMMON_ASM_OP): Provide default.
+ (ASM_OUTPUT_TLS_COMMON): Use it.
+ * config/i386/sol2-gas.h (TLS_COMMON_ASM_OP): Undef.
+
+ PR target/38118
+ * config.gcc (sparc*-*-solaris2*) [$gas=yes]: Add usegas.h to
+ tm_file.
+ * config/sparc/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Move ...
+ * config/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): ... here.
+ * config/i386/sol2-10.h (ASM_OUTPUT_ALIGNED_COMMON): Redefine.
+ * config/i386/sol2.h (TARGET_SUN_TLS): Redefine.
+ (ASM_DECLARE_OBJECT_NAME) [!USE_GAS]: Redefine.
+
+2010-03-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
* config/i386/i386.c (override_options): Don't accept
-mtls-dialect=sun any longer.
* config/i386/i386.h (TARGET_SUN_TLS): Define as 0.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 2178206..d4e733c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2412,6 +2412,9 @@ sparc*-*-solaris2*)
else
tmake_file="$tmake_file t-slibgcc-sld"
fi
+ if test x$gas = xyes; then
+ tm_file="usegas.h ${tm_file}"
+ fi
c_target_objs="sol2-c.o"
cxx_target_objs="sol2-c.o"
extra_objs="sol2.o"
diff --git a/gcc/config.in b/gcc/config.in
index 98dffa7..a9e208f 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1634,6 +1634,13 @@
#endif
+/* Define to the flag used to mark TLS sections if the default (`T') doesn't
+ work. */
+#ifndef USED_FOR_TARGET
+#undef TLS_SECTION_ASM_FLAG
+#endif
+
+
/* Define if your assembler mis-optimizes .eh_frame data. */
#ifndef USED_FOR_TARGET
#undef USE_AS_TRADITIONAL_FORMAT
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2179b5a..a6ffc19 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10863,29 +10863,29 @@ output_pic_addr_const (FILE *file, rtx x, int code)
break;
case UNSPEC_GOTTPOFF:
/* FIXME: This might be @TPOFF in Sun ld too. */
- fputs ("@GOTTPOFF", file);
+ fputs ("@gottpoff", file);
break;
case UNSPEC_TPOFF:
- fputs ("@TPOFF", file);
+ fputs ("@tpoff", file);
break;
case UNSPEC_NTPOFF:
if (TARGET_64BIT)
- fputs ("@TPOFF", file);
+ fputs ("@tpoff", file);
else
- fputs ("@NTPOFF", file);
+ fputs ("@ntpoff", file);
break;
case UNSPEC_DTPOFF:
- fputs ("@DTPOFF", file);
+ fputs ("@dtpoff", file);
break;
case UNSPEC_GOTNTPOFF:
if (TARGET_64BIT)
fputs (ASSEMBLER_DIALECT == ASM_ATT ?
- "@GOTTPOFF(%rip)": "@GOTTPOFF[rip]", file);
+ "@gottpoff(%rip)": "@gottpoff[rip]", file);
else
- fputs ("@GOTNTPOFF", file);
+ fputs ("@gotntpoff", file);
break;
case UNSPEC_INDNTPOFF:
- fputs ("@INDNTPOFF", file);
+ fputs ("@indntpoff", file);
break;
#if TARGET_MACHO
case UNSPEC_MACHOPIC_OFFSET:
@@ -10912,7 +10912,7 @@ i386_output_dwarf_dtprel (FILE *file, int size, rtx x)
{
fputs (ASM_LONG, file);
output_addr_const (file, x);
- fputs ("@DTPOFF", file);
+ fputs ("@dtpoff", file);
switch (size)
{
case 4:
@@ -12189,34 +12189,34 @@ output_addr_const_extra (FILE *file, rtx x)
case UNSPEC_GOTTPOFF:
output_addr_const (file, op);
/* FIXME: This might be @TPOFF in Sun ld. */
- fputs ("@GOTTPOFF", file);
+ fputs ("@gottpoff", file);
break;
case UNSPEC_TPOFF:
output_addr_const (file, op);
- fputs ("@TPOFF", file);
+ fputs ("@tpoff", file);
break;
case UNSPEC_NTPOFF:
output_addr_const (file, op);
if (TARGET_64BIT)
- fputs ("@TPOFF", file);
+ fputs ("@tpoff", file);
else
- fputs ("@NTPOFF", file);
+ fputs ("@ntpoff", file);
break;
case UNSPEC_DTPOFF:
output_addr_const (file, op);
- fputs ("@DTPOFF", file);
+ fputs ("@dtpoff", file);
break;
case UNSPEC_GOTNTPOFF:
output_addr_const (file, op);
if (TARGET_64BIT)
fputs (ASSEMBLER_DIALECT == ASM_ATT ?
- "@GOTTPOFF(%rip)" : "@GOTTPOFF[rip]", file);
+ "@gottpoff(%rip)" : "@gottpoff[rip]", file);
else
- fputs ("@GOTNTPOFF", file);
+ fputs ("@gotntpoff", file);
break;
case UNSPEC_INDNTPOFF:
output_addr_const (file, op);
- fputs ("@INDNTPOFF", file);
+ fputs ("@indntpoff", file);
break;
#if TARGET_MACHO
case UNSPEC_MACHOPIC_OFFSET:
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index da28f1c..9adf0a6 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -14491,7 +14491,7 @@
(clobber (match_scratch:SI 5 "=c"))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_GNU_TLS"
- "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
+ "lea{l}\t{%a2@tlsgd(,%1,1), %0|%0, %a2@tlsgd[%1*1]}\;call\t%P3"
[(set_attr "type" "multi")
(set_attr "length" "12")])
@@ -14530,7 +14530,7 @@
(unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
UNSPEC_TLS_GD)]
"TARGET_64BIT"
- { return ASM_BYTE "0x66\n\tlea{q}\t{%a1@TLSGD(%%rip), %%rdi|rdi, %a1@TLSGD[rip]}\n" ASM_SHORT "0x6666\n\trex64\n\tcall\t%P2"; }
+ { return ASM_BYTE "0x66\n\tlea{q}\t{%a1@tlsgd(%%rip), %%rdi|rdi, %a1@tlsgd[rip]}\n" ASM_SHORT "0x6666\n\trex64\n\tcall\t%P2"; }
[(set_attr "type" "multi")
(set_attr "length" "16")])
@@ -14559,7 +14559,7 @@
(clobber (match_scratch:SI 4 "=c"))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_GNU_TLS"
- "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
+ "lea{l}\t{%&@tlsldm(%1), %0|%0, %&@tlsldm[%1]}\;call\t%P2"
[(set_attr "type" "multi")
(set_attr "length" "11")])
@@ -14594,7 +14594,7 @@
(match_operand:DI 2 "" "")))
(unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)]
"TARGET_64BIT"
- "lea{q}\t{%&@TLSLD(%%rip), %%rdi|rdi, %&@TLSLD[rip]}\;call\t%P1"
+ "lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}\;call\t%P1"
[(set_attr "type" "multi")
(set_attr "length" "12")])
diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-10.h
index 6e7f13d..a15ada3 100644
--- a/gcc/config/i386/sol2-10.h
+++ b/gcc/config/i386/sol2-10.h
@@ -50,6 +50,21 @@ along with GCC; see the file COPYING3. If not see
} while (0)
#endif
+/* As in sol2.h, override the default from i386/x86-64.h to work around
+ Sun as TLS bug. */
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
+ do \
+ { \
+ if (TARGET_SUN_TLS \
+ && in_section \
+ && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS)) \
+ == (SECTION_TLS | SECTION_BSS))) \
+ switch_to_section (bss_section); \
+ x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); \
+ } \
+ while (0)
+
#undef NO_PROFILE_COUNTERS
#undef MCOUNT_NAME
diff --git a/gcc/config/i386/sol2-gas.h b/gcc/config/i386/sol2-gas.h
index c357396..8d15b9d 100644
--- a/gcc/config/i386/sol2-gas.h
+++ b/gcc/config/i386/sol2-gas.h
@@ -26,3 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Undefine this so that BNSYM/ENSYM pairs are emitted by STABS+. */
#undef NO_DBX_BNSYM_ENSYM
+
+/* Restore default; gas doesn't understand Sun as .tcomm. */
+#undef TLS_COMMON_ASM_OP
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index addaf81..70c8a8f 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -96,6 +96,43 @@ along with GCC; see the file COPYING3. If not see
#undef TARGET_SUN_TLS
#define TARGET_SUN_TLS 1
+/* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
+ syntax. */
+#undef TARGET_SUN_TLS
+#define TARGET_SUN_TLS 1
+
+/* The Sun assembler uses .tcomm for TLS common sections. */
+#define TLS_COMMON_ASM_OP ".tcomm"
+
+/* Similar to the Sun assembler on SPARC, the native assembler requires
+ TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
+ gas doesn't understand this variant. */
+#ifndef USE_GAS
+#undef ASM_DECLARE_OBJECT_NAME
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do \
+ { \
+ HOST_WIDE_INT size; \
+ \
+ if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
+ else \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
+ \
+ size_directive_output = 0; \
+ if (!flag_inhibit_size_directive \
+ && (DECL) && DECL_SIZE (DECL)) \
+ { \
+ size_directive_output = 1; \
+ size = int_size_in_bytes (TREE_TYPE (DECL)); \
+ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
+ } \
+ \
+ ASM_OUTPUT_LABEL (FILE, NAME); \
+ } \
+ while (0)
+#endif
+
/* The Solaris assembler cannot grok .stabd directives. */
#undef NO_DBX_BNSYM_ENSYM
#define NO_DBX_BNSYM_ENSYM 1
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index a65276c0..a20c3b9 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -1,6 +1,7 @@
/* Operating system specific defines to be used when targeting GCC for any
Solaris 2 system.
- Copyright 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -265,6 +266,24 @@ __enable_execute_stack (void *addr) \
} \
while (0)
+/* Solaris 'as' has a bug: a .common directive in .tbss section
+ behaves as .tls_common rather than normal non-TLS .common. */
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
+ do \
+ { \
+ if (TARGET_SUN_TLS \
+ && in_section \
+ && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS)) \
+ == (SECTION_TLS | SECTION_BSS))) \
+ switch_to_section (bss_section); \
+ fprintf ((FILE), "%s", COMMON_ASM_OP); \
+ assemble_name ((FILE), (NAME)); \
+ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
+ (SIZE), (ALIGN) / BITS_PER_UNIT); \
+ } \
+ while (0)
+
extern GTY(()) tree solaris_pending_aligns;
extern GTY(()) tree solaris_pending_inits;
extern GTY(()) tree solaris_pending_finis;
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
index 21882ae..294f987 100644
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -177,24 +177,6 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-/* Solaris 'as' has a bug: a .common directive in .tbss section
- behaves as .tls_common rather than normal non-TLS .common. */
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
- do \
- { \
- if (TARGET_SUN_TLS \
- && in_section \
- && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS)) \
- == (SECTION_TLS | SECTION_BSS))) \
- switch_to_section (bss_section); \
- fprintf ((FILE), "%s", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
- (SIZE), (ALIGN) / BITS_PER_UNIT); \
- } \
- while (0)
-
/* Use Solaris ELF section syntax. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section
diff --git a/gcc/configure b/gcc/configure
index 6934b1c..f5cb4fe 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -21946,25 +21946,53 @@ foo: .long 25
tls_first_minor=17
;;
i[34567]86-*-*)
- conftest_s='
- .section ".tdata","awT",@progbits
+ case "$target" in
+ i[34567]86-*-solaris2.[56789]*)
+ # TLS was introduced in the Solaris 9 4/04 release but
+ # we do not enable it by default on Solaris 9 either.
+ if test "x$enable_tls" = xyes ; then
+ on_solaris=yes
+ else
+ enable_tls=no;
+ fi
+ ;;
+ i[34567]86-*-solaris2.*)
+ on_solaris=yes
+ ;;
+ *)
+ on_solaris=no
+ ;;
+ esac
+ if test x$on_solaris = xyes && test x$gas_flag = xno; then
+ conftest_s='
+ .section .tdata,"awt",@progbits'
+ tls_first_major=0
+ tls_first_minor=0
+
+$as_echo "#define TLS_SECTION_ASM_FLAG 't'" >>confdefs.h
+
+ else
+ conftest_s='
+ .section ".tdata","awT",@progbits'
+ tls_first_major=2
+ tls_first_minor=14
+ tls_as_opt="--fatal-warnings"
+ fi
+ conftest_s="$conftest_s
foo: .long 25
.text
movl %gs:0, %eax
- leal foo@TLSGD(,%ebx,1), %eax
- leal foo@TLSLDM(%ebx), %eax
- leal foo@DTPOFF(%eax), %edx
- movl foo@GOTTPOFF(%ebx), %eax
- subl foo@GOTTPOFF(%ebx), %eax
- addl foo@GOTNTPOFF(%ebx), %eax
- movl foo@INDNTPOFF, %eax
- movl $foo@TPOFF, %eax
- subl $foo@TPOFF, %eax
- leal foo@NTPOFF(%ecx), %eax'
- tls_first_major=2
- tls_first_minor=14
- tls_as_opt=--fatal-warnings
- ;;
+ leal foo@tlsgd(,%ebx,1), %eax
+ leal foo@tlsldm(%ebx), %eax
+ leal foo@dtpoff(%eax), %edx
+ movl foo@gottpoff(%ebx), %eax
+ subl foo@gottpoff(%ebx), %eax
+ addl foo@gotntpoff(%ebx), %eax
+ movl foo@indntpoff, %eax
+ movl \$foo@tpoff, %eax
+ subl \$foo@tpoff, %eax
+ leal foo@ntpoff(%ecx), %eax"
+ ;;
x86_64-*-*)
conftest_s='
.section ".tdata","awT",@progbits
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 15ce300..6eee49b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to generate a configuration script.
# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009 Free Software Foundation, Inc.
+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#This file is part of GCC.
@@ -2573,25 +2573,54 @@ foo: .long 25
tls_first_minor=17
;;
i[34567]86-*-*)
- conftest_s='
- .section ".tdata","awT",@progbits
+ case "$target" in
+ i[34567]86-*-solaris2.[56789]*)
+ # TLS was introduced in the Solaris 9 4/04 release but
+ # we do not enable it by default on Solaris 9 either.
+ if test "x$enable_tls" = xyes ; then
+ on_solaris=yes
+ else
+ enable_tls=no;
+ fi
+ ;;
+ i[34567]86-*-solaris2.*)
+ on_solaris=yes
+ ;;
+ *)
+ on_solaris=no
+ ;;
+ esac
+ if test x$on_solaris = xyes && test x$gas_flag = xno; then
+ conftest_s='
+ .section .tdata,"awt",@progbits'
+ tls_first_major=0
+ tls_first_minor=0
+changequote([,])dnl
+ AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
+[Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
+changequote(,)dnl
+ else
+ conftest_s='
+ .section ".tdata","awT",@progbits'
+ tls_first_major=2
+ tls_first_minor=14
+ tls_as_opt="--fatal-warnings"
+ fi
+ conftest_s="$conftest_s
foo: .long 25
.text
movl %gs:0, %eax
- leal foo@TLSGD(,%ebx,1), %eax
- leal foo@TLSLDM(%ebx), %eax
- leal foo@DTPOFF(%eax), %edx
- movl foo@GOTTPOFF(%ebx), %eax
- subl foo@GOTTPOFF(%ebx), %eax
- addl foo@GOTNTPOFF(%ebx), %eax
- movl foo@INDNTPOFF, %eax
- movl $foo@TPOFF, %eax
- subl $foo@TPOFF, %eax
- leal foo@NTPOFF(%ecx), %eax'
- tls_first_major=2
- tls_first_minor=14
- tls_as_opt=--fatal-warnings
- ;;
+ leal foo@tlsgd(,%ebx,1), %eax
+ leal foo@tlsldm(%ebx), %eax
+ leal foo@dtpoff(%eax), %edx
+ movl foo@gottpoff(%ebx), %eax
+ subl foo@gottpoff(%ebx), %eax
+ addl foo@gotntpoff(%ebx), %eax
+ movl foo@indntpoff, %eax
+ movl \$foo@tpoff, %eax
+ subl \$foo@tpoff, %eax
+ leal foo@ntpoff(%ecx), %eax"
+ ;;
x86_64-*-*)
conftest_s='
.section ".tdata","awT",@progbits
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 8ca8896..26f90ed 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1,6 +1,6 @@
/* Definitions of various defaults for tm.h macros.
Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2007, 2008, 2009
+ 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@monkeys.com)
@@ -118,11 +118,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
#endif
+#ifndef TLS_COMMON_ASM_OP
+#define TLS_COMMON_ASM_OP ".tls_common"
+#endif
+
#if defined (HAVE_AS_TLS) && !defined (ASM_OUTPUT_TLS_COMMON)
#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE) \
do \
{ \
- fprintf ((FILE), "\t.tls_common\t"); \
+ fprintf ((FILE), "\t%s\t", TLS_COMMON_ASM_OP); \
assemble_name ((FILE), (NAME)); \
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
(SIZE), DECL_ALIGN (DECL) / BITS_PER_UNIT); \
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 424d704..ba4e612 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6067,6 +6067,10 @@ default_no_named_section (const char *name ATTRIBUTE_UNUSED,
gcc_unreachable ();
}
+#ifndef TLS_SECTION_ASM_FLAG
+#define TLS_SECTION_ASM_FLAG 'T'
+#endif
+
void
default_elf_asm_named_section (const char *name, unsigned int flags,
tree decl ATTRIBUTE_UNUSED)
@@ -6097,7 +6101,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
if (flags & SECTION_STRINGS)
*f++ = 'S';
if (flags & SECTION_TLS)
- *f++ = 'T';
+ *f++ = TLS_SECTION_ASM_FLAG;
if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
*f++ = 'G';
*f = '\0';