[PATCH] D15367: Cross-DSO control flow integrity (Clang part)

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 14:45:27 PST 2015


eugenis added inline comments.

================
Comment at: lib/CodeGen/CGExpr.cpp:3871
@@ +3870,3 @@
+        isa<llvm::MDNode>(MD) && dyn_cast<llvm::MDNode>(MD)->isDistinct();
+    if (CGM.getCodeGenOpts().SanitizeCfiCrossDso && !hasLocalScope) {
+      EmitCfiSlowPathCheck(BitSetTest, MD, CastedCallee);
----------------
pcc wrote:
> Early return.
It's too early to return.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:996
@@ +995,3 @@
+      !(isa<CXXMethodDecl>(FD) && !cast<CXXMethodDecl>(FD)->isStatic()) &&
+      !(CodeGenOpts.SanitizeCfiCrossDso && !FD->hasBody() &&
+        !(getContext().GetGVALinkageForFunction(FD) ==
----------------
pcc wrote:
> This is a little hard to read and probably needs to go back into a function with early returns. Sorry, my bad. I also think the logic for `available_externally` is wrong (please add a test case).
Moved out to a function. Added a testcase. Looks like available_externally is handled correctly.


Repository:
  rL LLVM

http://reviews.llvm.org/D15367





More information about the cfe-commits mailing list