summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-11-30 22:41:21 +0000
committerReid Kleckner <rnk@google.com>2017-11-30 22:41:21 +0000
commita4d647d52ac02d958258c90398d12e6252f37147 (patch)
treeadcf4f5a6e407a195ee1a734fd6409a639a01215 /include
parent2b1b9e5ead1e07380d9e6ecba279c0e5166b567e (diff)
XOR the frame pointer with the stack cookie when protecting the stack
Summary: This strengthens the guard and matches MSVC. Reviewers: hans, etienneb Subscribers: hiraditya, JDevlieghere, vlad.tsyrklevich, llvm-commits Differential Revision: https://reviews.llvm.org/D40622 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/TargetLowering.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/TargetLowering.h b/include/llvm/CodeGen/TargetLowering.h
index 4210f58ddb0..f9a61b8bf1a 100644
--- a/include/llvm/CodeGen/TargetLowering.h
+++ b/include/llvm/CodeGen/TargetLowering.h
@@ -1360,6 +1360,12 @@ public:
/// getIRStackGuard returns nullptr.
virtual Value *getSDagStackGuard(const Module &M) const;
+ /// If this function returns true, stack protection checks should XOR the
+ /// frame pointer (or whichever pointer is used to address locals) into the
+ /// stack guard value before checking it. getIRStackGuard must return nullptr
+ /// if this returns true.
+ virtual bool useStackGuardXorFP() const { return false; }
+
/// If the target has a standard stack protection check function that
/// performs validation and error handling, returns the function. Otherwise,
/// returns nullptr. Must be previously inserted by insertSSPDeclarations.
@@ -3487,6 +3493,11 @@ public:
return false;
}
+ virtual SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val,
+ const SDLoc &DL) const {
+ llvm_unreachable("not implemented for this target");
+ }
+
/// Lower TLS global address SDNode for target independent emulated TLS model.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA,
SelectionDAG &DAG) const;