Restore detection of unsupported TLS.

2007-09-18  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite
	Restore detection of unsupported TLS.

	Revert this patch:
	2007-02-10  Richard Henderson  <rth@redhat.com>

	* lib/target-supports.exp (check_effective_target_tls): Redefine
	to mean non-emulated tls.
	* gcc.dg/tls/alias-1.c: Remove tls requirement.
	* gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.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/init-1.c, gcc.dg/tls/nonpic-1.c,
	gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
	gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
	gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.

	And then:
	* lib/target-supports.exp (check_effective_target_tls): Use
	stronger test for compiler support for TLS.
	(check_effective_target_tls_native): New, to test for non-emulated
	TLS support.
	* g++.dg/gomp/clause-3.C: Use dg-require-effective-target tls_native
	instead of dg-require-effective-target tls.
	* g++.dg/gomp/copyin-1.C: Likewise.
	* g++.dg/gomp/sharing-1.C: Likewise.
	* g++.dg/gomp/tls-1.C: Likewise.
	* g++.dg/gomp/tls-2.C: Likewise.
	* g++.dg/gomp/tls-3.C: Likewise.
	* g++.dg/tls/diag-1.C: Likewise.
	* g++.dg/tls/diag-2.C: Likewise.
	* g++.dg/tls/diag-3.C: Likewise.
	* g++.dg/tls/diag-4.C: Likewise.
	* g++.dg/tls/diag-5.C: Likewise.
	* g++.dg/tls/init-1.C: Likewise.
	* g++.dg/tls/init-2.C: Likewise.
	* g++.dg/tls/trivial.C: Likewise.
	* gcc.dg/gomp/appendix-a/a.22.1.c: Likewise.
	* gcc.dg/gomp/appendix-a/a.22.2.c: Likewise.
	* gcc.dg/gomp/appendix-a/a.24.1.c: Likewise.
	* gcc.dg/gomp/appendix-a/a.32.1.c: Likewise.
	* gcc.dg/gomp/appendix-a/a.33.1.c: Likewise.
	* gcc.dg/gomp/clause-1.c: Likewise.
	* gcc.dg/gomp/copyin-1.c: Likewise.
	* gcc.dg/gomp/sharing-1.c: Likewise.
	* gcc.dg/gomp/tls-1.c: Likewise.
	* gcc.dg/gomp/tls-2.c: Likewise.
	* gcc.dg/tls/alpha-1.c: Likewise.
	* gcc.dg/tls/opt-1.c: Likewise.
	* gcc.dg/tls/opt-13.c: Likewise.
	* gcc.dg/tls/opt-14.c: Likewise.
	* gcc.dg/tls/opt-2.c: Likewise.
	* gcc.dg/tls/opt-3.c: Likewise.
	* gcc.dg/tls/opt-4.c: Likewise.
	* gcc.dg/tls/opt-7.c: Likewise.
	* gcc.dg/tls/section-1.c: Likewise.
	* gfortran.dg/gomp/appendix-a/a.22.1.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.22.4.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.22.5.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.22.6.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.24.1.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.32.1.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.33.1.f90: Likewise.
	* gfortran.dg/gomp/crayptr2.f90: Likewise.
	* gfortran.dg/gomp/fixed-1.f: Likewise.
	* gfortran.dg/gomp/free-1.f90: Likewise.
	* gfortran.dg/gomp/omp_threadprivate1.f90: Likewise.
	* gfortran.dg/gomp/omp_threadprivate2.f90: Likewise.
	* gfortran.dg/gomp/reduction1.f90: Likewise.
	* gfortran.dg/gomp/sharing-1.f90: Likewise.

From-SVN: r128595
This commit is contained in:
Sandra Loosemore 2007-09-18 22:35:29 -04:00 committed by Sandra Loosemore
parent 8fcded4011
commit 19bfb9361e
67 changed files with 192 additions and 62 deletions

View File

@ -1,3 +1,74 @@
2007-09-18 Sandra Loosemore <sandra@codesourcery.com>
Restore detection of unsupported TLS.
Revert this patch:
2007-02-10 Richard Henderson <rth@redhat.com>
* lib/target-supports.exp (check_effective_target_tls): Redefine
to mean non-emulated tls.
* gcc.dg/tls/alias-1.c: Remove tls requirement.
* gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.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/init-1.c, gcc.dg/tls/nonpic-1.c,
gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.
And then:
* lib/target-supports.exp (check_effective_target_tls): Use
stronger test for compiler support for TLS.
(check_effective_target_tls_native): New, to test for non-emulated
TLS support.
* g++.dg/gomp/clause-3.C: Use dg-require-effective-target tls_native
instead of dg-require-effective-target tls.
* g++.dg/gomp/copyin-1.C: Likewise.
* g++.dg/gomp/sharing-1.C: Likewise.
* g++.dg/gomp/tls-1.C: Likewise.
* g++.dg/gomp/tls-2.C: Likewise.
* g++.dg/gomp/tls-3.C: Likewise.
* g++.dg/tls/diag-1.C: Likewise.
* g++.dg/tls/diag-2.C: Likewise.
* g++.dg/tls/diag-3.C: Likewise.
* g++.dg/tls/diag-4.C: Likewise.
* g++.dg/tls/diag-5.C: Likewise.
* g++.dg/tls/init-1.C: Likewise.
* g++.dg/tls/init-2.C: Likewise.
* g++.dg/tls/trivial.C: Likewise.
* gcc.dg/gomp/appendix-a/a.22.1.c: Likewise.
* gcc.dg/gomp/appendix-a/a.22.2.c: Likewise.
* gcc.dg/gomp/appendix-a/a.24.1.c: Likewise.
* gcc.dg/gomp/appendix-a/a.32.1.c: Likewise.
* gcc.dg/gomp/appendix-a/a.33.1.c: Likewise.
* gcc.dg/gomp/clause-1.c: Likewise.
* gcc.dg/gomp/copyin-1.c: Likewise.
* gcc.dg/gomp/sharing-1.c: Likewise.
* gcc.dg/gomp/tls-1.c: Likewise.
* gcc.dg/gomp/tls-2.c: Likewise.
* gcc.dg/tls/alpha-1.c: Likewise.
* gcc.dg/tls/opt-1.c: Likewise.
* gcc.dg/tls/opt-13.c: Likewise.
* gcc.dg/tls/opt-14.c: Likewise.
* gcc.dg/tls/opt-2.c: Likewise.
* gcc.dg/tls/opt-3.c: Likewise.
* gcc.dg/tls/opt-4.c: Likewise.
* gcc.dg/tls/opt-7.c: Likewise.
* gcc.dg/tls/section-1.c: Likewise.
* gfortran.dg/gomp/appendix-a/a.22.1.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.22.4.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.22.5.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.22.6.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.24.1.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.32.1.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.33.1.f90: Likewise.
* gfortran.dg/gomp/crayptr2.f90: Likewise.
* gfortran.dg/gomp/fixed-1.f: Likewise.
* gfortran.dg/gomp/free-1.f90: Likewise.
* gfortran.dg/gomp/omp_threadprivate1.f90: Likewise.
* gfortran.dg/gomp/omp_threadprivate2.f90: Likewise.
* gfortran.dg/gomp/reduction1.f90: Likewise.
* gfortran.dg/gomp/sharing-1.f90: Likewise.
2007-09-18 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31119

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
#define p parallel

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
int i, j;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
int thrglobalvar;
#pragma omp threadprivate (thrglobalvar)

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
int tp1;
static int tp2;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
extern char buf[];
#pragma omp threadprivate (buf) /* { dg-error "has incomplete type" } */

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
#define thr threadprivate

View File

@ -1,5 +1,5 @@
// Valid __thread specifiers.
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
__thread int g1;
extern __thread int g2;

View File

@ -1,5 +1,5 @@
/* Invalid __thread specifiers. */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
__thread static int g2; /* { dg-error "'__thread' before 'static'" } */

View File

@ -1,5 +1,5 @@
// Report invalid extern and __thread combinations.
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
extern int j; // { dg-error "previously declared here" }
__thread int j; // { dg-error "follows non-thread-local" }

View File

@ -1,5 +1,5 @@
/* Invalid __thread specifiers. */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
__thread typedef int g4; /* { dg-error "multiple storage classes" } */

View File

@ -1,5 +1,5 @@
// PR c++/30536
// Invalid __thread specifiers.
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
struct A { __thread register int i; }; // { dg-error "multiple storage classes|storage class specified" }

View File

@ -1,5 +1,5 @@
/* Valid initializations. */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
__thread int i = 42;

View File

@ -1,5 +1,5 @@
/* Invalid initializations. */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
extern __thread int i;
__thread int *p = &i; /* { dg-error "dynamically initialized" } */

View File

@ -1,3 +1,3 @@
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
__thread int i;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
int counter = 0;
#pragma omp threadprivate(counter)

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
int
increment_counter_2 ()

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
extern int omp_get_num_threads (void);
int x, y, t, z[1000];

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
#include <stdlib.h>
float *work;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
#include <stdio.h>
float x, y;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
#define p parallel

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
int i, j;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target tls }
// { dg-require-effective-target tls_native }
int tp1;
static int tp2;

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
extern char buf[];
#pragma omp threadprivate (buf) /* { dg-error "has incomplete type" } */

View File

@ -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. */

View File

@ -1,7 +1,7 @@
/* Make sure that we honor initial-exec. */
/* { dg-do compile { target alpha*-*-* } } */
/* { dg-options "" } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
static __thread int xyzzy __attribute__ ((tls_model ("initial-exec")));
int foo(void) { return xyzzy; }

View File

@ -1,4 +1,5 @@
/* { dg-options "-Werror" } */
/* { dg-require-effective-target tls } */
__thread int i;
int foo ()

View File

@ -1,4 +1,5 @@
/* { dg-do assemble } */
/* { dg-options "-g" } */
/* { dg-require-effective-target tls } */
__thread int i;

View File

@ -1,4 +1,5 @@
/* Valid __thread specifiers. */
/* { dg-require-effective-target tls } */
__thread int g1;
extern __thread int g2;

View File

@ -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'" } */

View File

@ -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" } */

View File

@ -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'" } */

View File

@ -1,3 +1,4 @@
/* __thread specifiers on empty declarations. */
/* { dg-require-effective-target tls } */
__thread struct foo; /* { dg-warning "useless '__thread' in empty declaration" } */

View File

@ -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" } */

View File

@ -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;

View File

@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fPIC" } */
/* { dg-options "-O2 -fPIC -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
/* { dg-require-effective-target fpic } */
extern __thread int thr;

View File

@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O3 -fpic" } */
/* { dg-require-effective-target tls } */
/* The web pass was creating unrecognisable pic_load_dot_plus_four insns
on ARM. */

View File

@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
__thread struct
{

View File

@ -3,7 +3,7 @@
used. */
/* { dg-do assemble } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
struct __res_state
{

View File

@ -5,7 +5,7 @@
/* { dg-do link } */
/* { dg-options "-O2 -ftls-model=initial-exec" } */
/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
__thread int thr;

View File

@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fpic" } */
/* { dg-options "-O2 -fpic -mregparm=3" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
/* { dg-require-effective-target fpic } */
extern __thread int i, j, k;

View File

@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
struct A
{

View File

@ -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. */

View File

@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
extern void abort (void);
extern void exit (int);

View File

@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fPIC" } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
/* { dg-require-effective-target fpic } */
static __thread void *baz [4] __attribute__((tls_model ("initial-exec")));

View File

@ -1,6 +1,7 @@
/* PR 18910 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
static __thread void *foo [2];
void

View File

@ -2,6 +2,7 @@
/* { dg-do compile */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fPIC" } */
/* { dg-require-effective-target tls } */
struct S { int x[10]; };
extern __thread struct S s;

View File

@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */
/* { dg-require-effective-target tls } */
extern __thread long e1;
extern __thread int e2;

View File

@ -1,6 +1,6 @@
/* Verify that we get errors for trying to put TLS data in
sections which can't work. */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target tls_native } */
#define A(X) __attribute__((section(X)))

View File

@ -3,6 +3,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic" } */
/* { dg-require-effective-target tls } */
struct S {
int s0, s1, s2, s3;

View File

@ -1 +1,3 @@
/* { dg-require-effective-target tls } */
__thread int i;

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
INTEGER FUNCTION INCREMENT_COUNTER()
COMMON/A22_COMMON/COUNTER

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
MODULE A22_MODULE
COMMON /T/ A

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
SUBROUTINE A22_5_WRONG()
COMMON /T/ A

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
SUBROUTINE A22_6_GOOD()
COMMON /T/ A

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
SUBROUTINE A24(A)
INTEGER A

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
MODULE M
REAL, POINTER, SAVE :: WORK(:)

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
SUBROUTINE INIT(A,B)
REAL A, B

View File

@ -1,6 +1,6 @@
! { dg-do compile }
! { dg-options "-fopenmp -fcray-pointer" }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
module crayptr2
integer :: e ! { dg-error "CRAY POINTEE attribute conflicts with THREADPRIVATE" }

View File

@ -1,6 +1,6 @@
C PR fortran/24493
C { dg-do compile }
C { dg-require-effective-target tls }
C { dg-require-effective-target tls_native }
INTEGER I, J, K, L, M
C$OMP THREADPRIVATE(I)
C SOME COMMENT

View File

@ -1,4 +1,4 @@
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
subroutine foo
integer, save :: i ! Some comment

View File

@ -1,4 +1,4 @@
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
module omp_threadprivate1
common /T/ a
end module omp_threadprivate1

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
subroutine bad1
double precision :: d ! { dg-error "isn't SAVEd" }
!$omp threadprivate (d)

View File

@ -1,6 +1,6 @@
! { dg-do compile }
! { dg-options "-fopenmp -fmax-errors=100" }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
subroutine foo (ia1)
integer :: i1, i2, i3

View File

@ -1,5 +1,5 @@
! { dg-do compile }
! { dg-require-effective-target tls }
! { dg-require-effective-target tls_native }
integer :: thrpriv, thr, i, j, s, g1, g2, m
integer, dimension (6) :: p

View File

@ -411,7 +411,7 @@ proc check_effective_target_pcc_bitfield_type_matters { } {
}]
}
# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
#
# This won't change for different subtargets so cache the result.
@ -422,30 +422,26 @@ proc check_effective_target_tls {} {
if [info exists et_tls_saved] {
verbose "check_effective_target_tls: using cached result" 2
} else {
set et_tls_saved 1
set et_tls_saved 0
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.
# Compile a small test program. Make sure that we test accesses
# as well as declarations.
puts $f "__thread int i;\n"
puts $f "int f (void) { return i; }\n"
puts $f "void g (int j) { i = j; }\n"
close $f
# Test for thread-local data supported by the platform.
set comp_output [${tool}_target_compile $src $asm assembly ""]
set comp_output \
[${tool}_target_compile $src $asm assembly ""]
file delete $src
if { [string match "*not supported*" $comp_output] } {
set et_tls_saved 0
} else {
set fd [open $asm r]
set text [read $fd]
close $fd
if { [string match "*emutls*" $text]} {
set et_tls_saved 0
} else {
set et_tls_saved 1
}
if { [string match "" $comp_output] } {
# No error messages, everything is OK.
set et_tls_saved 1
}
remove-build-file $asm
}
@ -453,6 +449,50 @@ proc check_effective_target_tls {} {
return $et_tls_saved
}
# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
#
# This won't change for different subtargets so cache the result.
proc check_effective_target_tls_native {} {
global et_tls_native_saved
global tool
if [info exists et_tls_saved] {
verbose "check_effective_target_tls_native: using cached result" 2
} else {
set et_tls_native_saved 0
set src tls[pid].c
set asm tls[pid].S
verbose "check_effective_target_tls_native: compiling testfile $src" 2
set f [open $src "w"]
# Compile a small test program. Make sure that we test accesses
# as well as declarations.
puts $f "__thread int i;\n"
puts $f "int f (void) { return i; }\n"
puts $f "void g (int j) { i = j; }\n"
close $f
# Test for thread-local data supported by the platform.
set comp_output [${tool}_target_compile $src $asm assembly ""]
file delete $src
if { [string match "" $comp_output] } {
# No error messages, everything is OK.
set fd [open $asm r]
set text [read $fd]
close $fd
if { [string match "*emutls*" $text]} {
set et_tls_native_saved 0
} else {
set et_tls_native_saved 1
}
}
remove-build-file $asm
}
verbose "check_effective_target_tls_native: returning $et_tls_native_saved" 2
return $et_tls_native_saved
}
# Return 1 if TLS executables can run correctly, 0 otherwise.
#
# This won't change for different subtargets so cache the result.