[llvm] r299805 - [cfi] Take over existing __cfi_check in CrossDSOCFI.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 7 16:00:20 PDT 2017


Author: eugenis
Date: Fri Apr  7 18:00:20 2017
New Revision: 299805

URL: http://llvm.org/viewvc/llvm-project?rev=299805&view=rev
Log:
[cfi] Take over existing __cfi_check in CrossDSOCFI.

https://reviews.llvm.org/D31796 will emit a dummy __cfi_check in the
frontend.

Modified:
    llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp

Modified: llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp?rev=299805&r1=299804&r2=299805&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp Fri Apr  7 18:00:20 2017
@@ -100,6 +100,9 @@ void CrossDSOCFI::buildCFICheck(Module &
       "__cfi_check", Type::getVoidTy(Ctx), Type::getInt64Ty(Ctx),
       Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx), nullptr);
   Function *F = dyn_cast<Function>(C);
+  // Take over the existing function. The frontend emits a weak stub so that the
+  // linker knows about the symbol; this pass replaces the function body.
+  F->deleteBody();
   F->setAlignment(4096);
   auto args = F->arg_begin();
   Value &CallSiteTypeId = *(args++);




More information about the llvm-commits mailing list