This is an archive of the discontinued LLVM Phabricator instance.

[cfi] Cross-DSO CFI diagnostic mode (llvm part)
ClosedPublic

Authored by eugenis on Dec 18 2015, 6:25 PM.

Details

Reviewers
kcc
pcc
Summary
  • __cfi_check gets a 3rd argument: ubsan handler data
  • instead of trapping on failure, call __cfi_check_fail which must be present in the module (generated in the frontend).

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis updated this revision to Diff 43291.Dec 18 2015, 6:25 PM
eugenis retitled this revision from to [cfi] Cross-DSO CFI diagnostic mode (llvm part).
eugenis updated this object.
eugenis added reviewers: pcc, kcc.
eugenis set the repository for this revision to rL LLVM.
eugenis added a subscriber: llvm-commits.
pcc edited edge metadata.Jan 12 2016, 5:14 PM

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.

lib/Transforms/IPO/CrossDSOCFI.cpp
116

Type::getInt8PtrTy

135

Use getOrCreateFunction, the function could be defined externally or have a different signature.

test/Transforms/CrossDSOCFI/basic.ll
16

CHECK-NEXT

eugenis updated this revision to Diff 44804.Jan 13 2016, 3:42 PM
eugenis edited edge metadata.
eugenis marked 3 inline comments as done.
pcc accepted this revision.Jan 25 2016, 1:58 PM
pcc edited edge metadata.

LGTM

lib/Transforms/IPO/CrossDSOCFI.cpp
138

You no longer need to assert here.

This revision is now accepted and ready to land.Jan 25 2016, 1:58 PM
eugenis updated this revision to Diff 45916.Jan 25 2016, 2:36 PM
eugenis edited edge metadata.
eugenis marked an inline comment as done.