Commit ada80067 by Uros Bizjak Committed by Uros Bizjak

re PR target/24475 (gcc.dg/tls/pr24428.c execution test and…

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
parent d1a478d4
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>
/* Valid __thread specifiers. */
// Valid __thread specifiers.
// { dg-require-effective-target tls }
__thread int g1;
extern __thread int g2;
......
/* 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'" } */
......
// 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" }
......
/* Invalid __thread specifiers. */
/* { dg-require-effective-target tls } */
__thread typedef int g4; /* { dg-error "multiple storage classes" } */
......
/* Valid initializations. */
/* { dg-require-effective-target tls } */
__thread int i = 42;
......
/* Invalid initializations. */
/* { dg-require-effective-target tls } */
extern __thread int i;
__thread int *p = &i; /* { dg-error "dynamically initialized" } */
......
// { 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 ();
......
// { dg-do run }
// { dg-options "-O2" }
// { dg-additional-sources "static-1a.cc" }
// { dg-require-effective-target tls_runtime }
struct A
{
......
# 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 {
......
// { dg-require-effective-target tls }
__thread int i;
/* { 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. */
......
/* 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; }
......
/* { dg-options "-Werror" } */
/* { dg-require-effective-target tls } */
__thread int i;
int foo ()
......
/* { dg-do assemble } */
/* { dg-options "-g" } */
/* { dg-require-effective-target tls } */
__thread int i;
/* Valid __thread specifiers. */
/* { dg-require-effective-target tls } */
__thread int g1;
extern __thread int g2;
......
/* 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'" } */
......
/* 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" } */
......
/* 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'" } */
......
/* __thread specifiers on empty declarations. */
/* { dg-require-effective-target tls } */
__thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */
/* Invalid initializations. */
/* { dg-require-effective-target tls } */
extern __thread int i;
int *p = &i; /* { dg-error "initializer element is not constant" } */
/* { dg-do compile } */
/* { dg-options "-O2 -ftls-model=initial-exec" } */
/* { dg-require-effective-target tls } */
extern __thread long e1;
extern __thread int e2;
......
......@@ -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;
......
/* { 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. */
......
/* { dg-do run } */
/* { dg-require-effective-target tls_runtime } */
extern void abort (void);
extern void *memset (void *, int, __SIZE_TYPE__);
......
......@@ -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;
......
/* { 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 *);
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
struct A
{
......
/* { 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. */
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
extern void abort (void);
extern void exit (int);
......
/* { 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)
......
/* PR 18910 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls } */
static __thread void *foo [2];
void
......
/* PR 21412 */
/* { dg-do compile */
/* { dg-options "-O2 -fPIC" } */
/* { dg-require-effective-target tls } */
struct S { int x[10]; };
extern __thread struct S s;
......
/* { dg-do compile } */
/* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */
/* { dg-require-effective-target tls } */
extern __thread long e1;
extern __thread int e2;
......
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls_runtime } */
__thread double thrtest[81];
int main ()
......
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls_runtime } */
__thread double thrtest[81];
int main ()
......
/* 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)))
......
......@@ -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;
......
# 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 {
......
/* { dg-require-effective-target tls } */
__thread int i;
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment