aboutsummaryrefslogtreecommitdiff
path: root/test/ExecutionEngine
diff options
context:
space:
mode:
authorAmara Emerson <amara.emerson@arm.com>2012-11-16 11:17:00 +0000
committerAmara Emerson <amara.emerson@arm.com>2012-11-16 11:17:00 +0000
commit4372f00373843526728dec3af4323c2aff1cd379 (patch)
treeba746250da919f43ac204fbf8e5afa64c7db3f71 /test/ExecutionEngine
parent098d6d57346322c7f71f4e3e45bbea81039386c4 (diff)
Add MCJIT test case for running global constructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ExecutionEngine')
-rw-r--r--test/ExecutionEngine/MCJIT/test-global-ctors.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ExecutionEngine/MCJIT/test-global-ctors.ll b/test/ExecutionEngine/MCJIT/test-global-ctors.ll
new file mode 100644
index 0000000000..fbe9118d53
--- /dev/null
+++ b/test/ExecutionEngine/MCJIT/test-global-ctors.ll
@@ -0,0 +1,21 @@
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+@var = global i32 1, align 4
+@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @ctor_func }]
+@llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @dtor_func }]
+
+define i32 @main() nounwind {
+entry:
+ %0 = load i32* @var, align 4
+ ret i32 %0
+}
+
+define internal void @ctor_func() section ".text.startup" {
+entry:
+ store i32 0, i32* @var, align 4
+ ret void
+}
+
+define internal void @dtor_func() section ".text.startup" {
+entry:
+ ret void
+}