summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-04-23 18:22:11 +0000
committerReid Kleckner <reid@kleckner.net>2014-04-23 18:22:11 +0000
commite9591b33e29cf72c6b3bab60d9625c706dc00d87 (patch)
tree053e4de4a440918a73c19438ddf9259189d53bb3 /clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
parent5b21db89d04f6b0923e333b55f8c500e968243f7 (diff)
downloadbcm5719-llvm-e9591b33e29cf72c6b3bab60d9625c706dc00d87.tar.gz
bcm5719-llvm-e9591b33e29cf72c6b3bab60d9625c706dc00d87.zip
MS ABI: Use a different guard variable for each weak global
We were using the same guard variable and failing to initialize the second global. Clang is still not MS ABI compatible in this area. Fixing that is PR16959, which will require LLVM changes to @llvm.global_ctors. llvm-svn: 207008
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
index 021356e8fa2..0d336cf42ce 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
// CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()* }]
// CHECK: [{ i32, void ()* } { i32 65535, void ()* @"\01??__Efoo@?$B@H@@2VA@@A@YAXXZ"
@@ -20,6 +20,17 @@ S s;
// CHECK: call x86_thiscallcc void @"\01??1S@@QAE@XZ"
// CHECK: ret void
+// These globals should use distinct guard variables, and not different bits of
+// the same global.
+__declspec(selectany) S selectany1;
+__declspec(selectany) S selectany2;
+// CHECK: define internal void @"\01??__Eselectany1@@YAXXZ"() [[NUW:#[0-9]+]]
+// CHECK: load i32* @"\01??_Bselectany1@@3US@@A@5"
+// CHECK: ret void
+// CHECK: define internal void @"\01??__Eselectany2@@YAXXZ"() [[NUW:#[0-9]+]]
+// CHECK: load i32* @"\01??_Bselectany2@@3US@@A@5"
+// CHECK: ret void
+
void StaticLocal() {
static S TheS;
}
OpenPOWER on IntegriCloud