aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorXiang1 Zhang <xiang1.zhang@intel.com>2023-01-11 16:54:07 +0800
committerXiang1 Zhang <xiang1.zhang@intel.com>2023-01-13 08:28:38 +0800
commit593e17648eb217312e224daa38ea4f40ca697b0b (patch)
tree9b9a29c22bdbfd8641733ea2a7c10f44cbf4fc12 /llvm/lib/CodeGen/StackProtector.cpp
parent8efb8f776abf1cb66107c42b47e6a127828c4db0 (diff)
downloadllvm-593e17648eb217312e224daa38ea4f40ca697b0b.zip
llvm-593e17648eb217312e224daa38ea4f40ca697b0b.tar.gz
llvm-593e17648eb217312e224daa38ea4f40ca697b0b.tar.bz2
Add -disable-check-noreturn-call for stack protect
Differential Revision: https://reviews.llvm.org/D141556 Reviewed By: lanza
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index f76877f..46685f7 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -60,6 +60,8 @@ STATISTIC(NumAddrTaken, "Number of local variables that have their address"
static cl::opt<bool> EnableSelectionDAGSP("enable-selectiondag-sp",
cl::init(true), cl::Hidden);
+static cl::opt<bool> DisableCheckNoReturn("disable-check-noreturn-call",
+ cl::init(false), cl::Hidden);
char StackProtector::ID = 0;
@@ -453,7 +455,7 @@ bool StackProtector::InsertStackProtectors() {
if (&BB == FailBB)
continue;
Instruction *CheckLoc = dyn_cast<ReturnInst>(BB.getTerminator());
- if (!CheckLoc) {
+ if (!CheckLoc && !DisableCheckNoReturn) {
for (auto &Inst : BB) {
auto *CB = dyn_cast<CallBase>(&Inst);
if (!CB)