aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorXiang1 Zhang <xiang1.zhang@intel.com>2020-10-22 09:46:42 +0800
committerXiang1 Zhang <xiang1.zhang@intel.com>2020-10-22 10:08:14 +0800
commit7c3fea7721e421de235917d9454d448f976500fc (patch)
tree7a0295552af02255aa73b6c4be8c1bec2efe9a4f /llvm/lib/CodeGen/StackProtector.cpp
parent007ffdc18c503094e705ffcdd3ad51b829b77348 (diff)
downloadllvm-7c3fea7721e421de235917d9454d448f976500fc.zip
llvm-7c3fea7721e421de235917d9454d448f976500fc.tar.gz
llvm-7c3fea7721e421de235917d9454d448f976500fc.tar.bz2
[X86] Support customizing stack protector guard
Reviewed By: nickdesaulniers, MaskRay Differential Revision: https://reviews.llvm.org/D88631
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index 3d961af..8074793 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -381,7 +381,10 @@ bool StackProtector::RequiresStackProtector() {
static Value *getStackGuard(const TargetLoweringBase *TLI, Module *M,
IRBuilder<> &B,
bool *SupportsSelectionDAGSP = nullptr) {
- if (Value *Guard = TLI->getIRStackGuard(B))
+ Value *Guard = TLI->getIRStackGuard(B);
+ auto GuardMode = TLI->getTargetMachine().Options.StackProtectorGuard;
+ if ((GuardMode == llvm::StackProtectorGuards::TLS ||
+ GuardMode == llvm::StackProtectorGuards::None) && Guard)
return B.CreateLoad(B.getInt8PtrTy(), Guard, true, "StackGuard");
// Use SelectionDAG SSP handling, since there isn't an IR guard.