diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2025-04-17 15:55:14 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2025-06-02 08:03:24 +0000 |
commit | 8287861f7ca7418cd924ea2491c743c72ddb55dd (patch) | |
tree | 16bd0cbf3351123bfe31d6ef579650c5ff232073 | |
parent | b0dc2324980bbb600ab178dacfe5455365a52645 (diff) | |
download | gcc-8287861f7ca7418cd924ea2491c743c72ddb55dd.zip gcc-8287861f7ca7418cd924ea2491c743c72ddb55dd.tar.gz gcc-8287861f7ca7418cd924ea2491c743c72ddb55dd.tar.bz2 |
testsuite: Add tls_link effective target
Some tests have 'dg-do link' but currently require 'tls' which is a
compile-only check.
In some configurations of arm-none-eabi, the 'tls' effective-target
can be successful although these tests fail to link with
undefined reference to `__aeabi_read_tp'
This patch as a new tls_link effective target which makes sure we can
build an executable.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_effective_target_tls_link): New.
* g++.dg/tls/pr102496-1.C: Require tls_link.
* g++.dg/tls/pr77285-1.C: Likewise.
gcc/ChangeLog:
* doc/sourcebuild.texi (tls_link): Add documentation.
-rw-r--r-- | gcc/doc/sourcebuild.texi | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tls/pr102496-1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tls/pr77285-1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 10 |
4 files changed, 15 insertions, 2 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 9043002..6c5586e 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1976,6 +1976,9 @@ at plain @option{-O2}. @item tls Target supports thread-local storage. +@item tls_link +Target supports linking TLS executables. + @item tls_native Target supports native (rather than emulated) thread-local storage. diff --git a/gcc/testsuite/g++.dg/tls/pr102496-1.C b/gcc/testsuite/g++.dg/tls/pr102496-1.C index 8220e1e..e015ae9 100644 --- a/gcc/testsuite/g++.dg/tls/pr102496-1.C +++ b/gcc/testsuite/g++.dg/tls/pr102496-1.C @@ -1,6 +1,6 @@ // PR c++/102496 // { dg-do link { target c++11 } } -// { dg-require-effective-target tls } +// { dg-require-effective-target tls_link } // { dg-add-options tls } // { dg-additional-sources pr102496-2.C } diff --git a/gcc/testsuite/g++.dg/tls/pr77285-1.C b/gcc/testsuite/g++.dg/tls/pr77285-1.C index 7a93414..340c88b 100644 --- a/gcc/testsuite/g++.dg/tls/pr77285-1.C +++ b/gcc/testsuite/g++.dg/tls/pr77285-1.C @@ -1,5 +1,5 @@ // { dg-do link { target c++11 } } -// { dg-require-effective-target tls } +// { dg-require-effective-target tls_link } // { dg-add-options tls } // { dg-additional-sources pr77285-2.C } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 75d723c..dfffe3a 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1098,6 +1098,16 @@ proc check_effective_target_tls {} { }] } +# Return 1 if we can link using TLS, 0 otherwise. + +proc check_effective_target_tls_link {} { + return [check_no_compiler_messages tls_link executable { + __thread int i; + int main (void) { return i; } + void g (int j) { i = j; } + }] +} + # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise. proc check_effective_target_tls_native {} { |