[PATCH] D15660: [cfi] Cross-DSO CFI diagnostic mode (llvm part)
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 12 17:14:11 PST 2016
pcc added a comment.
It doesn't need to be done now, but I think we should consider moving most of the functionality from this pass to Clang. We could consider introducing an intrinsic that looks like this:
`i1 @llvm.bitset.test.i64(i8* %addr, i64 %id)`
Then Clang can emit a `__cfi_check` function with weak-odr linkage that uses this intrinsic.
================
Comment at: lib/Transforms/IPO/CrossDSOCFI.cpp:116
@@ +115,3 @@
+ {Type::getInt64Ty(Ctx),
+ PointerType::getUnqual(Type::getInt8Ty(Ctx)),
+ PointerType::getUnqual(Type::getInt8Ty(Ctx))},
----------------
`Type::getInt8PtrTy`
================
Comment at: lib/Transforms/IPO/CrossDSOCFI.cpp:135
@@ +134,3 @@
+ IRBuilder<> IRBFail(TrapBB);
+ Function *CFICheckFailFn = M->getFunction("__cfi_check_fail");
+ assert(CFICheckFailFn || "Module is missing a __cfi_check_fail function");
----------------
Use `getOrCreateFunction`, the function could be defined externally or have a different signature.
================
Comment at: test/Transforms/CrossDSOCFI/basic.ll:16
@@ +15,3 @@
+; CHECK-NEXT: call void @__cfi_check_fail(i8* %[[DATA]], i8* %[[ADDR]])
+; CHECK-MEXT: br label %[[EXIT]]
+
----------------
CHECK-NEXT
Repository:
rL LLVM
http://reviews.llvm.org/D15660
More information about the llvm-commits
mailing list