<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 21, 2010, at 3:50 PM, James Williams wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>I'm trying to get exception handling working in my compiler targetting LLVM. I've been working from the LLVM exception handling documentation (including <a href="http://llvm.org/docs/ExceptionHandling.html">http://llvm.org/docs/ExceptionHandling.html</a> and <a href="http://wiki.llvm.org/HowTo:_Build_JIT_based_Exception_mechanism">http://wiki.llvm.org/HowTo:_Build_JIT_based_Exception_mechanism</a>) and looking at g++-llvm's output.<br>
<br>I've been trying to get a minimal test function to work, which simply invokes _Unwind_RaiseException with a single clean-up landing pad. However. when I run it my personality function is not getting called - _Unwind_RaiseException simply returns apparently doing nothing. Looking at the x86-64 assembly output from llc, I can see this is happening because the personality function is not getting into the DWARF eh table (the landing pad is there though). <br>
<br>I'm stumped as to why not. I'd be grateful if anyone can point out what I'm doing wrong here:<br><br>define i32 @_ZN4N0014Main5test5EN2IO6WriterEiA_l(%6*, %4*, i32, %33*) {<br>entry:<br>  %err = alloca %4*                               ; <%4**> [#uses=1]<br>
  %count = alloca i32                             ; <i32*> [#uses=1]<br>  %e = alloca %33*                                ; <%33**> [#uses=2]<br>  %this = alloca %6*                              ; <%6**> [#uses=1]<br>
  %.ex_value = alloca i8*                         ; <i8**> [#uses=1]<br>  %.ex_value_l = alloca i8*                       ; <i8**> [#uses=0]<br>  %.ex_type = alloca i64                          ; <i64*> [#uses=1]<br>
  br label %4<br><br>; <label>:4                                       ; preds = %entry<br>  store %6* %0, %6** %this<br>  store %4* %1, %4** %err<br>  store i32 %2, i32* %count<br>  store %33* %3, %33** %e<br>  br label %.try_body<br>
<br>.try_body:                                        ; preds = %4<br>  %5 = load %33** %e                              ; <%33*> [#uses=1]<br>  %6 = getelementptr inbounds %33* %5, i32 0, i32 2, i32 0 ; <i64*> [#uses=1]<br>
  %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* @_Unwind_RaiseException to i8* (...)*)(i64* %6)<br>          to label %8 unwind label %.finally_pad  ; <i8*> [#uses=0]<br><br>; <label>:8                                       ; preds = %.try_body<br>
  br label %.finally_handler<br><br>.finally_pad:                                     ; preds = %.try_body<br>  %9 = call i8* @llvm.eh.exception()              ; <i8*> [#uses=2]<br>  store i8* %9, i8** %.ex_value<br>
  %10 = call i64 (i8*, i8*, ...)* @llvm.eh.selector.i64(i8* %9, i8* bitcast (i32 (i32, i32, i64, %struct._Unwind_Exception*, %struct._Unwind_Context*)* @__l_personality to i8*)) ; <i64> [#uses=1]<br></blockquote><div><br></div><div>I think you'll need a "i8* null" at the end of this @llvm.eh.selector.i64 call.</div><div><br></div><div>-bw</div><div><br></div></div></body></html>