1 ; REQUIRES: cxx-shared-library
2 ; RUN: %lli -jit-kind=mcjit -relocation-model=pic -code-model=large %s
3 ; XFAIL: target={{.*-(cygwin|windows-msvc|windows-gnu)}}
4 ; XFAIL: target={{(mips|mipsel)-.*}}, target={{(i686|i386).*}}, target={{(aarch64|arm).*}}
5 declare ptr @__cxa_allocate_exception(i64)
6 declare void @__cxa_throw(ptr, ptr, ptr)
7 declare i32 @__gxx_personality_v0(...)
8 declare void @__cxa_end_catch()
9 declare ptr @__cxa_begin_catch(ptr)
11 @_ZTIi = external constant ptr
13 define void @throwException() {
14 %exception = tail call ptr @__cxa_allocate_exception(i64 4)
15 call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
19 ; Make an internal function so we exercise R_X86_64_GOTOFF64 relocations.
20 define internal dso_local void @use_gotoff() {
24 define i32 @main() personality ptr @__gxx_personality_v0 {
26 call void @use_gotoff()
27 invoke void @throwException()
28 to label %try.cont unwind label %lpad
31 %p = landingpad { ptr, i32 }
33 %e = extractvalue { ptr, i32 } %p, 0
34 call ptr @__cxa_begin_catch(ptr %e)
35 call void @__cxa_end_catch()