[PATCH] D20346: [stack-protection] Add support for MSVC buffer security check

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 14:30:35 PDT 2016


rnk added a comment.

In http://reviews.llvm.org/D20346#444442, @etienneb wrote:

> I had few examples where the choice of 'personality' is changed from version 3 to version 4 when /GS is on.
>  Also, the stack/EH security cookies must be added to the structure when using version 3.


I actually thought all functions using SEH got upgraded to _except_handler4. So, maybe we should change clang to use _except_handler4 when -fstack-protector is on.


================
Comment at: lib/CodeGen/StackProtector.cpp:358-364
@@ +357,9 @@
+    // providing.
+    if (Value* GuardCheck = TLI->getSSPStackGuardCheck(*M)) {
+      // Generate the function-based epilogue instrumentation.
+      // The target provides a guard check function, generate a call to it.
+      IRBuilder<> B(RI);
+      LoadInst *Guard = B.CreateLoad(AI, true, "Guard");
+      CallInst *Call = B.CreateCall(GuardCheck, {Guard});
+      llvm::Function* Function = cast<llvm::Function>(GuardCheck);
+      Call->setAttributes(Function->getAttributes());
----------------
Not actually done?


http://reviews.llvm.org/D20346





More information about the llvm-commits mailing list