diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-05 20:43:10 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-05 20:43:10 +0000 |
commit | a2e40fbd624916c187a95ed76939ca7f02ed3e53 (patch) | |
tree | a2123a8cee6f7edaf0bb085625c018314e4e46fd /test | |
parent | 9f2bebbc288354f0818f3a319a91cc7efd09ef93 (diff) |
Add EH support to the MCJIT.
This gets exception handling working on ELF and Macho (x86-64 at least).
Other than the EH frame registration, this patch also implements support
for GOT relocations which are used to locate the personality function on
MachO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/ExecutionEngine/MCJIT/eh.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ExecutionEngine/MCJIT/eh.ll b/test/ExecutionEngine/MCJIT/eh.ll new file mode 100644 index 0000000000..b7a9ca96dd --- /dev/null +++ b/test/ExecutionEngine/MCJIT/eh.ll @@ -0,0 +1,26 @@ +; RUN: %lli_mcjit %s +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) + +@_ZTIi = external constant i8* + +define void @throwException() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @main() { +entry: + invoke void @throwException() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + br label %try.cont + +try.cont: + ret i32 0 +} |