This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch testsuite/39790: gcc.dg/tls/alias-1.c,opt-2.c fail if TLS is not supported by C library
You are right.
I remove this comment line "# This won't change for different
subtargets so cache the result" from tls_link rule, tls rule,
tls_native rule and tls_runtime rule.
* lib/target-supports.exp (check_effective_target_tls_link): New
function.
(check_effective_target_tls): Remove comment of caching.
(check_effective_target_tls_native): Likewise.
(check_effective_target_tls_runtime): Likewise.
* gcc.dg/tls/alias-1.c (dg-require-effective-target): Change tls to
tls_link.
* gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_link.
Is it ok now?
Thanks,
Jing
On Fri, Apr 17, 2009 at 2:59 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Thu, 16 Apr 2009, Jing Yu wrote:
>
>> +# This won't change for different subtargets so cache the result.
>
> I don't believe this comment in this case; you can have both glibc and
> uClibc multilibs in one toolchain, for example, with the glibc multilibs
> supporting linking TLS code and the uClibc multilibs not supporting doing
> so.
>
> Since the function does caching indirectly through functions that check
> for changes of target, I don't actually think there is a problem; avoiding
> any mention of caching here might be better (and in many of the other
> places that currently repeat the same comment).
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 146221)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,15 @@
+2009-04-17 Jing Yu <jingyu@google.com>
+
+ PR testsuite/39790
+ * lib/target-supports.exp (check_effective_target_tls_link): New
+ function.
+ (check_effective_target_tls): Remove comment of caching.
+ (check_effective_target_tls_native): Likewise.
+ (check_effective_target_tls_runtime): Likewise.
+ * gcc.dg/tls/alias-1.c (dg-require-effective-target): Change tls to
+ tls_link.
+ * gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_link.
+
2009-04-16 Andrew Pinski <pinskia@gmail.com>
PR C++/17570
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp (revision 146221)
+++ testsuite/lib/target-supports.exp (working copy)
@@ -544,8 +544,6 @@ proc check_effective_target_pcc_bitfield
}
# 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 {} {
return [check_no_compiler_messages tls assembly {
@@ -555,9 +553,18 @@ proc check_effective_target_tls {} {
}]
}
+# Return 1 if thread local storage (TLS) is supported at compile time and link time,
+# 0 otherwise.
+
+proc check_effective_target_tls_link {} {
+ return [check_no_compiler_messages tls_link executable {
+ __thread int i;
+ int f (void) { return i; }
+ void g (int j) { i = j; }
+ }]
+}
+
# 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 {} {
# VxWorks uses emulated TLS machinery, but with non-standard helper
@@ -575,8 +582,6 @@ proc check_effective_target_tls_native {
}
# 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 {} {
return [check_runtime tls_runtime {
Index: testsuite/gcc.dg/tls/alias-1.c
===================================================================
--- testsuite/gcc.dg/tls/alias-1.c (revision 146221)
+++ testsuite/gcc.dg/tls/alias-1.c (working copy)
@@ -1,7 +1,7 @@
/* { dg-do link } */
/* { dg-require-alias "" } */
/* { dg-require-visibility "" } */
-/* { dg-require-effective-target tls } */
+/* { dg-require-effective-target tls_link } */
/* Test that encode_section_info handles the change from externally
defined to locally defined (via hidden). Extracted from glibc. */
Index: testsuite/gcc.dg/tls/opt-2.c
===================================================================
--- testsuite/gcc.dg/tls/opt-2.c (revision 146221)
+++ testsuite/gcc.dg/tls/opt-2.c (working copy)
@@ -6,6 +6,7 @@
/* { 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_native } */
+/* { dg-require-effective-target tls_link } */
__thread int thr;