Skip to content

Commit

Permalink
Add MCJIT test case for running global constructors.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168149 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
aemerson committed Nov 16, 2012
1 parent 098d6d5 commit 4372f00
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/ExecutionEngine/MCJIT/test-global-ctors.ll
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 4372f00

Please sign in to comment.