[PATCH] D40622: XOR the frame pointer with the stack cookie when protecting the stack

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 14:13:29 PST 2017


hans added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2136
+  const TargetRegisterInfo *TRI = DAG.getSubtarget().getRegisterInfo();
+  unsigned FrameReg = TRI->getFrameRegister(MF);
+  MVT PtrVT = TLI.getPointerTy(DAG.getDataLayout(), 0);
----------------
Is there some way we could assert the register we use here stays the same from entry to exit? This is the only part that sounds potentially scary, the rest looks pretty straight-forward.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:1692
+  // Currently only MSVC CRTs XOR the frame pointer into the stack guard value.
+  return Subtarget.getTargetTriple().isOSMSVCRT();
+}
----------------
It doesn't really matter what the CRT does though, right? I mean, we could do this for non-MSVC targets too, it's just that it's not common practice?


https://reviews.llvm.org/D40622





More information about the llvm-commits mailing list