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).*}} 5declare ptr @__cxa_allocate_exception(i64) 6declare void @__cxa_throw(ptr, ptr, ptr) 7declare i32 @__gxx_personality_v0(...) 8declare void @__cxa_end_catch() 9declare ptr @__cxa_begin_catch(ptr) 10 11@_ZTIi = external constant ptr 12 13define void @throwException() { 14 %exception = tail call ptr @__cxa_allocate_exception(i64 4) 15 call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) 16 unreachable 17} 18 19; Make an internal function so we exercise R_X86_64_GOTOFF64 relocations. 20define internal dso_local void @use_gotoff() { 21 ret void 22} 23 24define i32 @main() personality ptr @__gxx_personality_v0 { 25entry: 26 call void @use_gotoff() 27 invoke void @throwException() 28 to label %try.cont unwind label %lpad 29 30lpad: 31 %p = landingpad { ptr, i32 } 32 catch ptr @_ZTIi 33 %e = extractvalue { ptr, i32 } %p, 0 34 call ptr @__cxa_begin_catch(ptr %e) 35 call void @__cxa_end_catch() 36 br label %try.cont 37 38try.cont: 39 ret i32 0 40} 41