
Re-enables compact-unwind support in JITLink, which was reverted in b04847b427d due to buildbot failures. The underlying cause for the failures on the buildbots was the lack of compact-unwind registration support on older Darwin OSes. Since the CompactUnwindManager pass now removes eh-frames by default we were left with unwind-info that could not be registered. On x86-64, where eh-frame info is produced by default the solution is to fall back to using eh-frames. On arm64 we simply can't support exceptions on older OSes. This patch updates the EHFrameRegistrationPlugin to remove the compact-unwind section (__LD,__compact_unwind) when installed, forcing use of eh-frames when the EHFrameRegistrationPlugin is used. In LLJIT, the EHFrameRegistrationPlugin continues to be used for all non-Darwin platform, and will be added on Darwin platforms when the a CompactUnwindRegistrationPlugin instance can't be created (e.g. due to missing support for compact-unwind info registration). The lit.cfg.py script is updated to check whether the host OSes default unwind info supports JIT registration, allowing tests to be disabled for older Darwin OSes on arm64.
53 lines
1.4 KiB
LLVM
53 lines
1.4 KiB
LLVM
; REQUIRES: system-darwin && host-unwind-supports-jit
|
|
; RUN: lli -jit-kind=orc-lazy %s
|
|
;
|
|
; Basic correctness testing for eh-frame processing and registration.
|
|
|
|
@_ZTIi = external constant ptr
|
|
|
|
declare ptr @__cxa_allocate_exception(i64)
|
|
declare void @__cxa_throw(ptr, ptr, ptr)
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|
|
declare i32 @llvm.eh.typeid.for(ptr)
|
|
declare ptr @__cxa_begin_catch(ptr)
|
|
declare void @__cxa_end_catch()
|
|
|
|
define void @explode() {
|
|
entry:
|
|
%exception = tail call ptr @__cxa_allocate_exception(i64 4)
|
|
store i32 42, ptr %exception, align 16
|
|
tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
|
|
unreachable
|
|
}
|
|
|
|
define i32 @main(i32 %argc, ptr %argv) personality ptr @__gxx_personality_v0 {
|
|
entry:
|
|
invoke void @explode()
|
|
to label %return unwind label %lpad
|
|
|
|
lpad:
|
|
%0 = landingpad { ptr, i32 }
|
|
catch ptr @_ZTIi
|
|
%1 = extractvalue { ptr, i32 } %0, 1
|
|
%2 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
|
|
%matches = icmp eq i32 %1, %2
|
|
br i1 %matches, label %catch, label %eh.resume
|
|
|
|
catch:
|
|
%3 = extractvalue { ptr, i32 } %0, 0
|
|
%4 = tail call ptr @__cxa_begin_catch(ptr %3)
|
|
%5 = load i32, ptr %4, align 4
|
|
%cmp = icmp ne i32 %5, 42
|
|
%cond = zext i1 %cmp to i32
|
|
tail call void @__cxa_end_catch()
|
|
br label %return
|
|
|
|
return:
|
|
%retval.0 = phi i32 [ %cond, %catch ], [ 2, %entry ]
|
|
ret i32 %retval.0
|
|
|
|
eh.resume:
|
|
resume { ptr, i32 } %0
|
|
}
|