diff options
author | Uros Bizjak <uros@kss-loka.si> | 2005-12-01 07:52:11 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2005-12-01 07:52:11 +0100 |
commit | ada8006795ce5c3d1486c9b39c2f52dd39e71b97 (patch) | |
tree | 5d63ea409e6d0b5e515b924b076cc49a901d8823 | |
parent | d1a478d4442d4e09fc424e511bddd069ee2d9941 (diff) | |
download | gcc-ada8006795ce5c3d1486c9b39c2f52dd39e71b97.zip gcc-ada8006795ce5c3d1486c9b39c2f52dd39e71b97.tar.gz gcc-ada8006795ce5c3d1486c9b39c2f52dd39e71b97.tar.bz2 |
re PR target/24475 (gcc.dg/tls/pr24428.c execution test and gcc.dg/tls/pr24428-2.c execution test fail on IA32)
PR target/24475
* lib/target-supports.exp (check_effective_target_tls): New.
(check_effective_target_tls_runtime): New.
* gcc.dg/tls/tls.exp, g++.dg/tls/tls.exp: Remove check
for TLS support.
* gcc.dg/tls/opt-1.c, gcc.dg/tls/opt-2.c, gcc.dg/tls/opt-3.c,
gcc.dg/tls/opt-4.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
gcc.dg/tls/opt-7.c, gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c,
gcc.dg/tls/opt-10.c, gcc.dg/tls/diag-1.c, gcc.dg/tls/diag-2.c,
gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c, gcc.dg/tls/diag-5.c,
gcc.dg/tls/alias-1.c, gcc.dg/tls/alpha-1.c, gcc.dg/tls/asm-1.c,
gcc.dg/tls/debug-1.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c,
gcc.dg/tls/pic-1.c, gcc.dg/tls/section-1.c, gcc.dg/tls/struct-1.c,
gcc.dg/tls/trivial.c, g++.dg/tls/diag-1.C, g++.dg/tls/diag-2.C,
g++.dg/tls/diag-3.C, g++.dg/tls/diag-4.C, g++.dg/tls/init-1.C,
g++.dg/tls/init-2.C, g++.dg/tls/trivial.C: Require
effective-target TLS.
* gcc.dg/tls/pr24428-2.c, gcc.dg/tls/pr24428.c, gcc.dg/tls/opt-11.c,
g++.dg/tls/static-1a.cc, g++.dg/tls/static-1.C: Require
effective-target TLS runtime.
From-SVN: r107804
41 files changed, 143 insertions, 23 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce4d728..d55401d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,28 @@ 2005-12-01 Uros Bizjak <uros@kss-loka.si> + PR target/24475 + * lib/target-supports.exp (check_effective_target_tls): New. + (check_effective_target_tls_runtime): New. + * gcc.dg/tls/tls.exp, g++.dg/tls/tls.exp: Remove check + for TLS support. + * gcc.dg/tls/opt-1.c, gcc.dg/tls/opt-2.c, gcc.dg/tls/opt-3.c, + gcc.dg/tls/opt-4.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c, + gcc.dg/tls/opt-7.c, gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, + gcc.dg/tls/opt-10.c, gcc.dg/tls/diag-1.c, gcc.dg/tls/diag-2.c, + gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c, gcc.dg/tls/diag-5.c, + gcc.dg/tls/alias-1.c, gcc.dg/tls/alpha-1.c, gcc.dg/tls/asm-1.c, + gcc.dg/tls/debug-1.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c, + gcc.dg/tls/pic-1.c, gcc.dg/tls/section-1.c, gcc.dg/tls/struct-1.c, + gcc.dg/tls/trivial.c, g++.dg/tls/diag-1.C, g++.dg/tls/diag-2.C, + g++.dg/tls/diag-3.C, g++.dg/tls/diag-4.C, g++.dg/tls/init-1.C, + g++.dg/tls/init-2.C, g++.dg/tls/trivial.C: Require + effective-target TLS. + * gcc.dg/tls/pr24428-2.c, gcc.dg/tls/pr24428.c, gcc.dg/tls/opt-11.c, + g++.dg/tls/static-1a.cc, g++.dg/tls/static-1.C: Require + effective-target TLS runtime. + +2005-12-01 Uros Bizjak <uros@kss-loka.si> + * lib/gcov.exp (clean-gcov): Also remove $base.h.gcov files. 2005-12-01 Hans-Peter Nilsson <hp@axis.com> diff --git a/gcc/testsuite/g++.dg/tls/diag-1.C b/gcc/testsuite/g++.dg/tls/diag-1.C index 697d0b1..af53871 100644 --- a/gcc/testsuite/g++.dg/tls/diag-1.C +++ b/gcc/testsuite/g++.dg/tls/diag-1.C @@ -1,4 +1,5 @@ -/* Valid __thread specifiers. */ +// Valid __thread specifiers. +// { dg-require-effective-target tls } __thread int g1; extern __thread int g2; diff --git a/gcc/testsuite/g++.dg/tls/diag-2.C b/gcc/testsuite/g++.dg/tls/diag-2.C index 293409d..484b188 100644 --- a/gcc/testsuite/g++.dg/tls/diag-2.C +++ b/gcc/testsuite/g++.dg/tls/diag-2.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */ diff --git a/gcc/testsuite/g++.dg/tls/diag-3.C b/gcc/testsuite/g++.dg/tls/diag-3.C index ae2b6ce..ea5158b 100644 --- a/gcc/testsuite/g++.dg/tls/diag-3.C +++ b/gcc/testsuite/g++.dg/tls/diag-3.C @@ -1,4 +1,5 @@ // Report invalid extern and __thread combinations. +// { dg-require-effective-target tls } extern int j; // { dg-error "previously declared here" } __thread int j; // { dg-error "follows non-thread-local" } diff --git a/gcc/testsuite/g++.dg/tls/diag-4.C b/gcc/testsuite/g++.dg/tls/diag-4.C index 3b840f1..55e985e 100644 --- a/gcc/testsuite/g++.dg/tls/diag-4.C +++ b/gcc/testsuite/g++.dg/tls/diag-4.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread typedef int g4; /* { dg-error "multiple storage classes" } */ diff --git a/gcc/testsuite/g++.dg/tls/init-1.C b/gcc/testsuite/g++.dg/tls/init-1.C index 74f7641..9786712 100644 --- a/gcc/testsuite/g++.dg/tls/init-1.C +++ b/gcc/testsuite/g++.dg/tls/init-1.C @@ -1,4 +1,5 @@ /* Valid initializations. */ +/* { dg-require-effective-target tls } */ __thread int i = 42; diff --git a/gcc/testsuite/g++.dg/tls/init-2.C b/gcc/testsuite/g++.dg/tls/init-2.C index 4cc31c9..c9f646d 100644 --- a/gcc/testsuite/g++.dg/tls/init-2.C +++ b/gcc/testsuite/g++.dg/tls/init-2.C @@ -1,4 +1,5 @@ /* Invalid initializations. */ +/* { dg-require-effective-target tls } */ extern __thread int i; __thread int *p = &i; /* { dg-error "dynamically initialized" } */ diff --git a/gcc/testsuite/g++.dg/tls/static-1.C b/gcc/testsuite/g++.dg/tls/static-1.C index 3cbcbec..2392c63 100644 --- a/gcc/testsuite/g++.dg/tls/static-1.C +++ b/gcc/testsuite/g++.dg/tls/static-1.C @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } extern "C" void abort (); extern int test (); diff --git a/gcc/testsuite/g++.dg/tls/static-1a.cc b/gcc/testsuite/g++.dg/tls/static-1a.cc index c87efdb..636f935 100644 --- a/gcc/testsuite/g++.dg/tls/static-1a.cc +++ b/gcc/testsuite/g++.dg/tls/static-1a.cc @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } struct A { diff --git a/gcc/testsuite/g++.dg/tls/tls.exp b/gcc/testsuite/g++.dg/tls/tls.exp index 20c2bd3..85e7a36 100644 --- a/gcc/testsuite/g++.dg/tls/tls.exp +++ b/gcc/testsuite/g++.dg/tls/tls.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,16 +19,6 @@ # Load support procs. load_lib g++-dg.exp -# Test for thread-local data supported by the platform. If it -# isn't, everything will fail with the "not supported" message. - -set comp_output [g++_target_compile \ - "$srcdir/$subdir/trivial.C" "trivialx.S" assembly ""] -remove-build-file "trivialx.S" -if { [string match "*not supported*" $comp_output] } { - return 0 -} - # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { diff --git a/gcc/testsuite/g++.dg/tls/trivial.C b/gcc/testsuite/g++.dg/tls/trivial.C index 1fd7063..e2b8f45 100644 --- a/gcc/testsuite/g++.dg/tls/trivial.C +++ b/gcc/testsuite/g++.dg/tls/trivial.C @@ -1 +1,3 @@ +// { dg-require-effective-target tls } + __thread int i; diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c index 1098190..28cb47e 100644 --- a/gcc/testsuite/gcc.dg/tls/alias-1.c +++ b/gcc/testsuite/gcc.dg/tls/alias-1.c @@ -1,6 +1,7 @@ /* { dg-do link } */ /* { dg-require-alias "" } */ /* { dg-require-visibility "" } */ +/* { dg-require-effective-target tls } */ /* Test that encode_section_info handles the change from externally defined to locally defined (via hidden). Extracted from glibc. */ diff --git a/gcc/testsuite/gcc.dg/tls/alpha-1.c b/gcc/testsuite/gcc.dg/tls/alpha-1.c index 4bb911f..1d15cb1 100644 --- a/gcc/testsuite/gcc.dg/tls/alpha-1.c +++ b/gcc/testsuite/gcc.dg/tls/alpha-1.c @@ -1,6 +1,7 @@ /* Make sure that we honor initial-exec. */ /* { dg-do compile { target alpha*-*-* } } */ /* { dg-options "" } */ +/* { dg-require-effective-target tls } */ static __thread int xyzzy __attribute__ ((tls_model ("initial-exec"))); int foo(void) { return xyzzy; } diff --git a/gcc/testsuite/gcc.dg/tls/asm-1.c b/gcc/testsuite/gcc.dg/tls/asm-1.c index 476fe7c..b77e550 100644 --- a/gcc/testsuite/gcc.dg/tls/asm-1.c +++ b/gcc/testsuite/gcc.dg/tls/asm-1.c @@ -1,4 +1,5 @@ /* { dg-options "-Werror" } */ +/* { dg-require-effective-target tls } */ __thread int i; int foo () diff --git a/gcc/testsuite/gcc.dg/tls/debug-1.c b/gcc/testsuite/gcc.dg/tls/debug-1.c index 719f064..67d7be6 100644 --- a/gcc/testsuite/gcc.dg/tls/debug-1.c +++ b/gcc/testsuite/gcc.dg/tls/debug-1.c @@ -1,4 +1,5 @@ /* { dg-do assemble } */ /* { dg-options "-g" } */ +/* { dg-require-effective-target tls } */ __thread int i; diff --git a/gcc/testsuite/gcc.dg/tls/diag-1.c b/gcc/testsuite/gcc.dg/tls/diag-1.c index ae4f3d4..56b570c 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-1.c +++ b/gcc/testsuite/gcc.dg/tls/diag-1.c @@ -1,4 +1,5 @@ /* Valid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread int g1; extern __thread int g2; diff --git a/gcc/testsuite/gcc.dg/tls/diag-2.c b/gcc/testsuite/gcc.dg/tls/diag-2.c index 5e7e17b..8276cb3 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-2.c +++ b/gcc/testsuite/gcc.dg/tls/diag-2.c @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-3.c b/gcc/testsuite/gcc.dg/tls/diag-3.c index f1ce06b..45d89b4 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-3.c +++ b/gcc/testsuite/gcc.dg/tls/diag-3.c @@ -1,4 +1,5 @@ /* Report invalid extern and __thread combinations. */ +/* { dg-require-effective-target tls } */ extern int j; /* { dg-error "previous declaration" } */ __thread int j; /* { dg-error "follows non-thread-local" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-4.c b/gcc/testsuite/gcc.dg/tls/diag-4.c index df3705d..fed2f3a 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-4.c +++ b/gcc/testsuite/gcc.dg/tls/diag-4.c @@ -1,5 +1,6 @@ /* Invalid __thread specifiers. As diag-4.c but some cases in different orders. */ +/* { dg-require-effective-target tls } */ __thread typedef int g4; /* { dg-error "'__thread' used with 'typedef'" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-5.c b/gcc/testsuite/gcc.dg/tls/diag-5.c index 623832c..219396d 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-5.c +++ b/gcc/testsuite/gcc.dg/tls/diag-5.c @@ -1,3 +1,4 @@ /* __thread specifiers on empty declarations. */ +/* { dg-require-effective-target tls } */ __thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */ diff --git a/gcc/testsuite/gcc.dg/tls/init-1.c b/gcc/testsuite/gcc.dg/tls/init-1.c index 9725864..fa4208d 100644 --- a/gcc/testsuite/gcc.dg/tls/init-1.c +++ b/gcc/testsuite/gcc.dg/tls/init-1.c @@ -1,4 +1,5 @@ /* Invalid initializations. */ +/* { dg-require-effective-target tls } */ extern __thread int i; int *p = &i; /* { dg-error "initializer element is not constant" } */ diff --git a/gcc/testsuite/gcc.dg/tls/nonpic-1.c b/gcc/testsuite/gcc.dg/tls/nonpic-1.c index 0896df6..9c592a9 100644 --- a/gcc/testsuite/gcc.dg/tls/nonpic-1.c +++ b/gcc/testsuite/gcc.dg/tls/nonpic-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -ftls-model=initial-exec" } */ +/* { dg-require-effective-target tls } */ extern __thread long e1; extern __thread int e2; diff --git a/gcc/testsuite/gcc.dg/tls/opt-1.c b/gcc/testsuite/gcc.dg/tls/opt-1.c index f7dccee..5bada6e 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-1.c +++ b/gcc/testsuite/gcc.dg/tls/opt-1.c @@ -2,6 +2,7 @@ /* { dg-options "-O2 -fPIC" } */ /* { dg-options "-O2 -fPIC -mtune=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O2 -fPIC -mtune=i686" { target { x86_64-*-* && ilp32 } } } */ +/* { dg-require-effective-target tls } */ extern __thread int thr; diff --git a/gcc/testsuite/gcc.dg/tls/opt-10.c b/gcc/testsuite/gcc.dg/tls/opt-10.c index f31c1ff..a710a06 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-10.c +++ b/gcc/testsuite/gcc.dg/tls/opt-10.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fpic" } */ +/* { dg-require-effective-target tls } */ /* The web pass was creating unrecognisable pic_load_dot_plus_four insns on ARM. */ diff --git a/gcc/testsuite/gcc.dg/tls/opt-11.c b/gcc/testsuite/gcc.dg/tls/opt-11.c index 5b2cd5c..3739645 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-11.c +++ b/gcc/testsuite/gcc.dg/tls/opt-11.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ extern void abort (void); extern void *memset (void *, int, __SIZE_TYPE__); diff --git a/gcc/testsuite/gcc.dg/tls/opt-2.c b/gcc/testsuite/gcc.dg/tls/opt-2.c index dde54f0..fd781eb 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-2.c +++ b/gcc/testsuite/gcc.dg/tls/opt-2.c @@ -6,6 +6,7 @@ /* { dg-options "-O2 -ftls-model=initial-exec" } */ /* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { x86_64-*-* && ilp32 } } } */ +/* { dg-require-effective-target tls } */ __thread int thr; diff --git a/gcc/testsuite/gcc.dg/tls/opt-3.c b/gcc/testsuite/gcc.dg/tls/opt-3.c index 8e476f6..e59e511 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-3.c +++ b/gcc/testsuite/gcc.dg/tls/opt-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fpic" } */ /* { dg-options "-O2 -fpic -mregparm=3" { target i?86-*-* } } */ +/* { dg-require-effective-target tls } */ extern __thread int i, j, k; extern void bar(int *, int *, int *); diff --git a/gcc/testsuite/gcc.dg/tls/opt-4.c b/gcc/testsuite/gcc.dg/tls/opt-4.c index 3a95688..aa59ee7 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-4.c +++ b/gcc/testsuite/gcc.dg/tls/opt-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ struct A { diff --git a/gcc/testsuite/gcc.dg/tls/opt-5.c b/gcc/testsuite/gcc.dg/tls/opt-5.c index d8a686d..0604f32 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-5.c +++ b/gcc/testsuite/gcc.dg/tls/opt-5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ /* Sched1 moved {load_tp} pattern between strlen call and the copy of the hard return value to its pseudo. This resulted in a reload abort, since the hard register was not spillable. */ diff --git a/gcc/testsuite/gcc.dg/tls/opt-6.c b/gcc/testsuite/gcc.dg/tls/opt-6.c index de04c1c..8a01c01 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-6.c +++ b/gcc/testsuite/gcc.dg/tls/opt-6.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/tls/opt-7.c b/gcc/testsuite/gcc.dg/tls/opt-7.c index beb2c26..c345068 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-7.c +++ b/gcc/testsuite/gcc.dg/tls/opt-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fPIC" } */ +/* { dg-require-effective-target tls } */ static __thread void *baz [4] __attribute__((tls_model ("initial-exec"))); void foo (void) diff --git a/gcc/testsuite/gcc.dg/tls/opt-8.c b/gcc/testsuite/gcc.dg/tls/opt-8.c index dec0eab..a733111 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-8.c +++ b/gcc/testsuite/gcc.dg/tls/opt-8.c @@ -1,6 +1,7 @@ /* PR 18910 */ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ static __thread void *foo [2]; void diff --git a/gcc/testsuite/gcc.dg/tls/opt-9.c b/gcc/testsuite/gcc.dg/tls/opt-9.c index 3829c66..cc62ef5 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-9.c +++ b/gcc/testsuite/gcc.dg/tls/opt-9.c @@ -1,6 +1,7 @@ /* PR 21412 */ /* { dg-do compile */ /* { dg-options "-O2 -fPIC" } */ +/* { dg-require-effective-target tls } */ struct S { int x[10]; }; extern __thread struct S s; diff --git a/gcc/testsuite/gcc.dg/tls/pic-1.c b/gcc/testsuite/gcc.dg/tls/pic-1.c index f5b020b..bcd42bd 100644 --- a/gcc/testsuite/gcc.dg/tls/pic-1.c +++ b/gcc/testsuite/gcc.dg/tls/pic-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */ +/* { dg-require-effective-target tls } */ extern __thread long e1; extern __thread int e2; diff --git a/gcc/testsuite/gcc.dg/tls/pr24428-2.c b/gcc/testsuite/gcc.dg/tls/pr24428-2.c index 828943c..a0ceecc 100644 --- a/gcc/testsuite/gcc.dg/tls/pr24428-2.c +++ b/gcc/testsuite/gcc.dg/tls/pr24428-2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls_runtime } */ __thread double thrtest[81]; int main () diff --git a/gcc/testsuite/gcc.dg/tls/pr24428.c b/gcc/testsuite/gcc.dg/tls/pr24428.c index 53b1245..ecb747e 100644 --- a/gcc/testsuite/gcc.dg/tls/pr24428.c +++ b/gcc/testsuite/gcc.dg/tls/pr24428.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls_runtime } */ __thread double thrtest[81]; int main () diff --git a/gcc/testsuite/gcc.dg/tls/section-1.c b/gcc/testsuite/gcc.dg/tls/section-1.c index 741eadb..4fc5066 100644 --- a/gcc/testsuite/gcc.dg/tls/section-1.c +++ b/gcc/testsuite/gcc.dg/tls/section-1.c @@ -1,5 +1,6 @@ /* Verify that we get errors for trying to put TLS data in sections which can't work. */ +/* { dg-require-effective-target tls } */ #define A(X) __attribute__((section(X))) diff --git a/gcc/testsuite/gcc.dg/tls/struct-1.c b/gcc/testsuite/gcc.dg/tls/struct-1.c index 1115123..5fd6be4 100644 --- a/gcc/testsuite/gcc.dg/tls/struct-1.c +++ b/gcc/testsuite/gcc.dg/tls/struct-1.c @@ -2,6 +2,7 @@ to allow addends for @dtpoff relocs or not. */ /* { dg-do compile } */ /* { dg-options "-O2 -fpic" } */ +/* { dg-require-effective-target tls } */ struct S { int s0, s1, s2, s3; diff --git a/gcc/testsuite/gcc.dg/tls/tls.exp b/gcc/testsuite/gcc.dg/tls/tls.exp index b168a1e..cd86231 100644 --- a/gcc/testsuite/gcc.dg/tls/tls.exp +++ b/gcc/testsuite/gcc.dg/tls/tls.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,16 +19,6 @@ # Load support procs. load_lib gcc-dg.exp -# Test for thread-local data supported by the platform. If it -# isn't, everything will fail with the "not supported" message. - -set comp_output [gcc_target_compile \ - "$srcdir/$subdir/trivial.c" "trivial.S" assembly ""] -remove-build-file "trivial.S" -if { [string match "*not supported*" $comp_output] } { - return 0 -} - # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS if ![info exists DEFAULT_CFLAGS] then { diff --git a/gcc/testsuite/gcc.dg/tls/trivial.c b/gcc/testsuite/gcc.dg/tls/trivial.c index 1fd7063..96b8e49 100644 --- a/gcc/testsuite/gcc.dg/tls/trivial.c +++ b/gcc/testsuite/gcc.dg/tls/trivial.c @@ -1 +1,3 @@ +/* { dg-require-effective-target tls } */ + __thread int i; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index bb6352f..d240095 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -384,6 +384,84 @@ proc check_effective_target_pcc_bitfield_type_matters { } { return $et_pcc_bitfield_type_matters_saved } +# Return 1 if thread local storage (TLS) is supported, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_tls {} { + global et_tls_saved + + if [info exists et_tls_saved] { + verbose "check_effective_target_tls: using cached result" 2 + } else { + set et_tls_saved 1 + + set src tls[pid].c + set asm tls[pid].S + verbose "check_effective_target_tls: compiling testfile $src" 2 + set f [open $src "w"] + # Compile a small test program. + puts $f "__thread int i;\n" + close $f + + # Test for thread-local data supported by the platform. + set comp_output \ + [target_compile $src $asm assembly ""] + file delete $src + if { [string match "*not supported*" $comp_output] } { + set et_tls_saved 0 + } + remove-build-file $asm + } + verbose "check_effective_target_tls: returning $et_tls_saved" 2 + return $et_tls_saved +} + +# Return 1 if TLS executables can run correctly, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_tls_runtime {} { + global et_tls_runtime_saved + + if [info exists et_tls_runtime_saved] { + verbose "check_effective_target_tls_runtime: using cached result" 2 + } else { + set et_tls_runtime_saved 0 + + set src tls_runtime[pid].c + set exe tls_runtime[pid].x + verbose "check_effective_target_tls_runtime: compiling testfile $src" 2 + set f [open $src "w"] + # Compile a small test program. + puts $f "__thread int thr = 0;\n" + puts $f "int main(void)\n {\n return thr;\n}" + close $f + + set comp_output \ + [target_compile $src $exe executable ""] + file delete $src + + if [string match "" $comp_output] then { + # No error messages, everything is OK. + + set result [remote_load target "./$exe" "" ""] + set status [lindex $result 0] + remote_file build delete $exe + + verbose "check_effective_target_tls_runtime status is <$status>" 2 + + if { $status == "pass" } { + set et_tls_runtime_saved 1 + } + + verbose "check_effective_target_tls_runtime: returning $et_tls_runtime_saved" 2 + } + } + + return $et_tls_runtime_saved +} + # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors # emitted, 0 otherwise. Whether a shared library can actually be built is # out of scope for this test. |