]> granicus.if.org Git - clang/commitdiff
TLS is not supported on OpenBSD
authorHans Wennborg <hans@hanshq.net>
Wed, 1 Aug 2012 18:53:19 +0000 (18:53 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 1 Aug 2012 18:53:19 +0000 (18:53 +0000)
This fixes PR13502 and adds a test to keep track of which
targets support TLS and which do not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161124 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Sema/tls.c [new file with mode: 0644]

index 193241361da3e5653cc63a60476f23c7d04c431a..171a857a6a6b0e434275638ae9f050b5063504a7 100644 (file)
@@ -373,6 +373,7 @@ public:
   OpenBSDTargetInfo(const std::string &triple)
     : OSTargetInfo<Target>(triple) {
       this->UserLabelPrefix = "";
+      this->TLSSupported = false;
 
       llvm::Triple Triple(triple);
       switch (Triple.getArch()) {
diff --git a/test/Sema/tls.c b/test/Sema/tls.c
new file mode 100644 (file)
index 0000000..0953577
--- /dev/null
@@ -0,0 +1,20 @@
+// Test that TLS is correctly considered supported or unsupported for the
+// different targets.
+
+// Linux supports TLS.
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu %s
+
+// Darwin supports TLS since 10.7.
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 %s
+
+// FIXME: I thought it was supported actually?
+// RUN: %clang_cc1 -verify -triple x86_64-pc-win32 %s
+// RUN: %clang_cc1 -verify -triple i386-pc-win32 %s
+
+// OpenBSD does not suppport TLS.
+// RUN: %clang_cc1 -verify -triple x86_64-pc-openbsd %s
+// RUN: %clang_cc1 -verify -triple i386-pc-openbsd %s
+
+__thread int x; // expected-error {{thread-local storage is unsupported for the current target}}