[llvm-commits] [llvm] r140277 - /llvm/trunk/lib/CodeGen/ShadowStackGC.cpp

Duncan Sands baldrick at free.fr
Thu Sep 22 01:02:57 PDT 2011


Hi Bill,

> Attempt to update the shadow stack GC pass to the new EH model.
>
> This inserts a cleanup landingpad instruction and a resume to mimic the old
> unwind instruction.

> --- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original)
> +++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Wed Sep 21 17:14:28 2011
> @@ -141,9 +141,21 @@
>             return 0;
>
>           // Create a cleanup block.
> -        BasicBlock *CleanupBB = BasicBlock::Create(F.getContext(),
> -                                                   CleanupBBName,&F);
> -        UnwindInst *UI = new UnwindInst(F.getContext(), CleanupBB);
> +        LLVMContext&C = F.getContext();
> +        BasicBlock *CleanupBB = BasicBlock::Create(C, CleanupBBName,&F);
> +        Type *ExnTy = StructType::get(Type::getInt8PtrTy(C),
> +                                      Type::getInt32Ty(C), NULL);
> +        // FIXME: Assuming the C++ personality function probably isn't the best
> +        //        thing in the world.
> +        Constant *PersFn =
> +          F.getParent()->
> +          getOrInsertFunction("__gxx_personality_v0",

you should use the C personality function.  It can handle cleanups and is
provided by libgcc.  It's called __gcc_personality_v0.

Ciao, Duncan.



More information about the llvm-commits mailing list