This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch testsuite/39790: gcc.dg/tls/alias-1.c,opt-2.c fail if TLS is not supported by C library


This patch is to fix testsuite issue 39790.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39790

Basically, gcc.dg/tls/alias-1.c and gcc.dg/tls/opt-2.c fail because
symbol '__aeabi_read_tp' is missing in newlib C. I think we should
mark these two test cases unsupported instead of letting them fail.

gcc.dg/tls/alias-1.c does linking, and requires test target "tls".
However, the rule of "tls" is just checking whether a piece of code can be
compiled quietly. The rule does not check whether the code can be linked
quietly.

Similarly, the gcc.dg/tls/opt-2.c does linking, and requires test
target "tls_native".
However, the rule of "tls_native" only checks compilation, not linking.

My patch is adding a new effective target called "tls_link". The rule
"tls_link" tests whether a piece of code with __thread can be linked
quietly. For the tls tests that do linking, I add "tls_link" to their
target.

        PR testsuite/39790
        * lib/target-supports.exp: Add a new effective target tls_link.
        * 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.

I have tested the patch on arm target, these two test cases become
unsupported. Other test result does not change.

Welcome if you have other way of fixing the failures.

Thanks,
Jing
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;
 
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp	(revision 146221)
+++ testsuite/lib/target-supports.exp	(working copy)
@@ -555,6 +555,18 @@ proc check_effective_target_tls {} {
     }]
 }
 
+# Return 1 if thread local storage (TLS) is supported at compile time and link time,
+# 0 otherwise.
+# This won't change for different subtargets so cache the result.
+
+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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]