summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2015-07-28 16:27:56 +0000
committerChih-Hung Hsieh <chh@google.com>2015-07-28 16:27:56 +0000
commit2c656c9417d5f384815c382130813addd87f2551 (patch)
tree8396848187fa9e47b849a4e79e198067992406ca /clang/test/CodeGen
parent9938310ab3357137ec5629dad3ed2ace12500764 (diff)
downloadbcm5719-llvm-2c656c9417d5f384815c382130813addd87f2551.tar.gz
bcm5719-llvm-2c656c9417d5f384815c382130813addd87f2551.zip
Add -femulated-tls flag to select the emulated TLS model.
This will be used for old targets like Android that do not support ELF TLS models. Differential Revision: http://reviews.llvm.org/D10524 llvm-svn: 243441
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/tls-model.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGen/tls-model.c b/clang/test/CodeGen/tls-model.c
index b5bae77e97f..41c8de0b0e8 100644
--- a/clang/test/CodeGen/tls-model.c
+++ b/clang/test/CodeGen/tls-model.c
@@ -3,7 +3,12 @@
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=local-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LD
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=initial-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-IE
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=local-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LE
+//
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -femulated-tls -emit-llvm -o - 2>&1 | \
+// RUN: FileCheck %s -check-prefix=CHECK-GD
+int z1 = 0;
+int z2;
int __thread x;
int f() {
static int __thread y;
@@ -11,18 +16,29 @@ int f() {
}
int __thread __attribute__((tls_model("initial-exec"))) z;
+// Note that unlike normal C uninitialized global variables,
+// uninitialized TLS variables do NOT have COMMON linkage.
+
+// CHECK-GD: @z1 = global i32 0
// CHECK-GD: @f.y = internal thread_local global i32 0
+// CHECK-GD: @z2 = common global i32 0
// CHECK-GD: @x = thread_local global i32 0
// CHECK-GD: @z = thread_local(initialexec) global i32 0
+// CHECK-LD: @z1 = global i32 0
// CHECK-LD: @f.y = internal thread_local(localdynamic) global i32 0
+// CHECK-LD: @z2 = common global i32 0
// CHECK-LD: @x = thread_local(localdynamic) global i32 0
// CHECK-LD: @z = thread_local(initialexec) global i32 0
+// CHECK-IE: @z1 = global i32 0
// CHECK-IE: @f.y = internal thread_local(initialexec) global i32 0
+// CHECK-IE: @z2 = common global i32 0
// CHECK-IE: @x = thread_local(initialexec) global i32 0
// CHECK-IE: @z = thread_local(initialexec) global i32 0
+// CHECK-LE: @z1 = global i32 0
// CHECK-LE: @f.y = internal thread_local(localexec) global i32 0
+// CHECK-LE: @z2 = common global i32 0
// CHECK-LE: @x = thread_local(localexec) global i32 0
// CHECK-LE: @z = thread_local(initialexec) global i32 0
OpenPOWER on IntegriCloud