Personality function for llvm.gcroot


Why does LLVM use __gcc_personality_v0 instead of __gxx_personality_v0 function when it lowers llvm.gcroot intrinsic? For my try-catch codegen I use last one (so does clang) and it conflicts with __gcc_personality_v0 produced by LLVM? I know how to solve it with my own GC plug-in, just wondering…

And what’s the difference between these two functions anyway?



__gcc_personality_v0 is for C code, which uses it for the cleanup
attribute. __cxx_personality_v0 is for C++ code and associated


Thanks, Joerg!

Why I can't catch exception with gcc_personality? I have lpad block:

lpad: ; preds = %while.body
  %lpad1 = landingpad { i8*, i32 } personality i32 (...)*
          catch i8* null
  %exn = extractvalue { i8*, i32 } %lpad1, 0
  store i8* %exn, i8** %exn.slot
  %ehselector = extractvalue { i8*, i32 } %lpad1, 1
  store i32 %ehselector, i32* %ehselector.slot
  br label %catch

but exception just falls through. With @__gxx_personality_v0 instead
everything works fine. Throwing code is like this:

  %0 = call i8* @__cxa_allocate_exception(i64 8)
  %1 = bitcast i8* %0 to i8**
  store i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i8** %1
  invoke void @__cxa_throw(i8* %0, i8* null, i8* null)
          to label %unreachable unwind label %lpad

I don't think it is supposed to. As mentioned, it is only meant for
providing destructor handling.