[PATCH] D21231: [StackProtector] Fix computation of GSCookieOffset and EHCookieOffset with SEH4

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 12:53:20 PDT 2016


majnemer added inline comments.

================
Comment at: lib/CodeGen/AsmPrinter/WinException.cpp:968
@@ +967,3 @@
+    // Retrieve the EH Guard slot.
+    int EHCookieOffset = 9999;
+    if (FuncInfo.EHGuardFrameIndex != INT_MAX) {
----------------
Is it possible for this value to actually make it into the object file?

================
Comment at: lib/Target/X86/X86WinEHState.cpp:302-304
@@ -292,6 +301,5 @@
 
     CxxLongjmpUnwind = TheModule->getOrInsertFunction(
         "__CxxLongjmpUnwind",
-        FunctionType::get(Type::getVoidTy(TheModule->getContext()), Int8PtrType,
-                          /*isVarArg=*/false));
+        FunctionType::get(VoidTy, Int8PtrType, /*isVarArg=*/false));
     cast<Function>(CxxLongjmpUnwind->stripPointerCasts())
----------------
Is __CxxLongjmpUnwind still used if we are using C++ exceptions + /GS?

================
Comment at: lib/Target/X86/X86WinEHState.cpp:643
@@ +642,3 @@
+  if (EHGuardNode) {
+    IRBuilder<> Builder(EHGuardNode->getParent(), std::next(EHGuardNode->getIterator()));
+    Value *EHGuardNodeI8 = Builder.CreateBitCast(EHGuardNode, Builder.getInt8PtrTy());
----------------
You could just do `EHGuardNode->getNextNode()`


http://reviews.llvm.org/D21231





More information about the llvm-commits mailing list