sol2.h (ASM_DECLARE_OBJECT_NAME): New.

* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): New.  Emit
	"tls_object" for thread-local objects.
	* config/sparc/sparc.c (sparc_elf_asm_named_section): Emit
	"#tls" for thread-local sections.
	* configure.ac (thread-local checks): Specify --fatal-warnings in
	every binutils-specific checks.  For sparc*-*-*, test whether the
	OS is Solaris and the tools are native and act accordingly.
	* configure: Rebuild.

From-SVN: r76156
This commit is contained in:
Eric Botcazou 2004-01-19 17:57:05 +01:00 committed by Eric Botcazou
parent 6fe37bc4be
commit 2f3321ca81
5 changed files with 134 additions and 15 deletions

View File

@ -1,3 +1,14 @@
2004-01-19 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): New. Emit
"tls_object" for thread-local objects.
* config/sparc/sparc.c (sparc_elf_asm_named_section): Emit
"#tls" for thread-local sections.
* configure.ac (thread-local checks): Specify --fatal-warnings in
every binutils-specific checks. For sparc*-*-*, test whether the
OS is Solaris and the tools are native and act accordingly.
* configure: Rebuild.
2004-01-19 Jeff Law <law@redhat.com>
* contrib.texi: Update Paolo Carlini's entry. New entries for

View File

@ -81,6 +81,33 @@ Boston, MA 02111-1307, USA. */
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
/* The native TLS-enabled assembler requires the directive #tls_object
to be put on objects in TLS sections (as of v7.1). This is not
required by the GNU assembler but supported on SPARC. */
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
do \
{ \
HOST_WIDE_INT size; \
\
if (DECL_THREAD_LOCAL (DECL)) \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_object"); \
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)
#undef ENDFILE_SPEC

View File

@ -8478,6 +8478,8 @@ sparc_elf_asm_named_section (const char *name, unsigned int flags)
fputs (",#alloc", asm_out_file);
if (flags & SECTION_WRITE)
fputs (",#write", asm_out_file);
if (flags & SECTION_TLS)
fputs (",#tls", asm_out_file);
if (flags & SECTION_CODE)
fputs (",#execinstr", asm_out_file);

54
gcc/configure vendored
View File

@ -10138,6 +10138,7 @@ foo: .long 25
lda $4,foo($29) !tprel'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
i[34567]86-*-*)
conftest_s='
@ -10157,6 +10158,7 @@ foo: .long 25
leal foo@NTPOFF(%ecx), %eax'
tls_first_major=2
tls_first_minor=14
tls_as_opt=--fatal-warnings
;;
x86_64-*-*)
conftest_s='
@ -10171,6 +10173,7 @@ foo: .long 25
movq $foo@TPOFF, %rax'
tls_first_major=2
tls_first_minor=14
tls_as_opt=--fatal-warnings
;;
ia64-*-*)
conftest_s='
@ -10188,6 +10191,7 @@ foo: data8 25
movl r24 = @tprel(foo#)'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
powerpc-*-*)
conftest_s='
@ -10213,7 +10217,7 @@ x3: .space 4
addi 9,9,x2@tprel@l'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-a32
tls_as_opt="-a32 --fatal-warnings"
;;
powerpc64-*-*)
conftest_s='
@ -10247,7 +10251,7 @@ x3: .space 8
nop'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-a64
tls_as_opt="-a64 --fatal-warnings"
;;
s390-*-*)
conftest_s='
@ -10266,7 +10270,7 @@ foo: .long 25
bas %r14,0(%r1,%r13):tls_ldcall:foo'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-m31
tls_as_opt="-m31 --fatal-warnings"
;;
s390x-*-*)
conftest_s='
@ -10284,7 +10288,7 @@ foo: .long 25
brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
tls_first_major=2
tls_first_minor=14
tls_as_opt="-m64 -Aesame"
tls_as_opt="-m64 -Aesame --fatal-warnings"
;;
sh-*-* | sh[34]-*-*)
conftest_s='
@ -10298,9 +10302,44 @@ foo: .long 25
.long foo@TPOFF'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
sparc*-*-*)
conftest_s='
case "$target" in
sparc*-sun-solaris2.*)
on_solaris=yes
;;
*)
on_solaris=no
;;
esac
if test x$on_solaris = xyes && test x$gas_flag = xno; then
conftest_s='
.section ".tdata",#alloc,#write,#tls
foo: .long 25
.text
sethi %tgd_hi22(foo), %o0
add %o0, %tgd_lo10(foo), %o1
add %l7, %o1, %o0, %tgd_add(foo)
call __tls_get_addr, %tgd_call(foo)
sethi %tldm_hi22(foo), %l1
add %l1, %tldm_lo10(foo), %l2
add %l7, %l2, %o0, %tldm_add(foo)
call __tls_get_addr, %tldm_call(foo)
sethi %tldo_hix22(foo), %l3
xor %l3, %tldo_lox10(foo), %l4
add %o0, %l4, %l5, %tldo_add(foo)
sethi %tie_hi22(foo), %o3
add %o3, %tie_lo10(foo), %o3
ld [%l7 + %o3], %o2, %tie_ld(foo)
add %g7, %o2, %o4, %tie_add(foo)
sethi %tle_hix22(foo), %l1
xor %l1, %tle_lox10(foo), %o5
ld [%g7 + %o5], %o1'
tls_first_major=0
tls_first_minor=0
else
conftest_s='
.section ".tdata","awT",@progbits
foo: .long 25
.text
@ -10324,7 +10363,8 @@ foo: .long 25
ld [%g7 + %o5], %o1'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-32
tls_as_opt="-32 --fatal-warnings"
fi
;;
esac
if test -z "$tls_first_major"; then
@ -10342,7 +10382,7 @@ else
fi
elif test x$gcc_cv_as != x; then
echo "$conftest_s" > conftest.s
if { ac_try='$gcc_cv_as $tls_as_opt --fatal-warnings -o conftest.o conftest.s >&5'
if { ac_try='$gcc_cv_as $tls_as_opt -o conftest.o conftest.s >&5'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?

View File

@ -2060,6 +2060,7 @@ foo: .long 25
lda $4,foo($29) !tprel'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
i[34567]86-*-*)
conftest_s='
@ -2079,6 +2080,7 @@ foo: .long 25
leal foo@NTPOFF(%ecx), %eax'
tls_first_major=2
tls_first_minor=14
tls_as_opt=--fatal-warnings
;;
x86_64-*-*)
conftest_s='
@ -2093,6 +2095,7 @@ foo: .long 25
movq $foo@TPOFF, %rax'
tls_first_major=2
tls_first_minor=14
tls_as_opt=--fatal-warnings
;;
ia64-*-*)
conftest_s='
@ -2110,6 +2113,7 @@ foo: data8 25
movl r24 = @tprel(foo#)'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
powerpc-*-*)
conftest_s='
@ -2135,7 +2139,7 @@ x3: .space 4
addi 9,9,x2@tprel@l'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-a32
tls_as_opt="-a32 --fatal-warnings"
;;
powerpc64-*-*)
conftest_s='
@ -2169,7 +2173,7 @@ x3: .space 8
nop'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-a64
tls_as_opt="-a64 --fatal-warnings"
;;
s390-*-*)
conftest_s='
@ -2188,7 +2192,7 @@ foo: .long 25
bas %r14,0(%r1,%r13):tls_ldcall:foo'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-m31
tls_as_opt="-m31 --fatal-warnings"
;;
s390x-*-*)
conftest_s='
@ -2206,7 +2210,7 @@ foo: .long 25
brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
tls_first_major=2
tls_first_minor=14
tls_as_opt="-m64 -Aesame"
tls_as_opt="-m64 -Aesame --fatal-warnings"
;;
sh-*-* | sh[34]-*-*)
conftest_s='
@ -2220,9 +2224,44 @@ foo: .long 25
.long foo@TPOFF'
tls_first_major=2
tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
sparc*-*-*)
conftest_s='
case "$target" in
sparc*-sun-solaris2.*)
on_solaris=yes
;;
*)
on_solaris=no
;;
esac
if test x$on_solaris = xyes && test x$gas_flag = xno; then
conftest_s='
.section ".tdata",#alloc,#write,#tls
foo: .long 25
.text
sethi %tgd_hi22(foo), %o0
add %o0, %tgd_lo10(foo), %o1
add %l7, %o1, %o0, %tgd_add(foo)
call __tls_get_addr, %tgd_call(foo)
sethi %tldm_hi22(foo), %l1
add %l1, %tldm_lo10(foo), %l2
add %l7, %l2, %o0, %tldm_add(foo)
call __tls_get_addr, %tldm_call(foo)
sethi %tldo_hix22(foo), %l3
xor %l3, %tldo_lox10(foo), %l4
add %o0, %l4, %l5, %tldo_add(foo)
sethi %tie_hi22(foo), %o3
add %o3, %tie_lo10(foo), %o3
ld [%l7 + %o3], %o2, %tie_ld(foo)
add %g7, %o2, %o4, %tie_add(foo)
sethi %tle_hix22(foo), %l1
xor %l1, %tle_lox10(foo), %o5
ld [%g7 + %o5], %o1'
tls_first_major=0
tls_first_minor=0
else
conftest_s='
.section ".tdata","awT",@progbits
foo: .long 25
.text
@ -2246,7 +2285,8 @@ foo: .long 25
ld [%g7 + %o5], %o1'
tls_first_major=2
tls_first_minor=14
tls_as_opt=-32
tls_as_opt="-32 --fatal-warnings"
fi
;;
changequote([,])dnl
esac
@ -2254,8 +2294,7 @@ if test -z "$tls_first_major"; then
: # If we don't have a check, assume no support.
else
gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
[$tls_first_major,$tls_first_minor,0], [$tls_as_opt --fatal-warnings],
[$conftest_s],,
[$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
[AC_DEFINE(HAVE_AS_TLS, 1,
[Define if your assembler supports thread-local storage.])])
fi