From 593e17648eb217312e224daa38ea4f40ca697b0b Mon Sep 17 00:00:00 2001 From: Xiang1 Zhang Date: Wed, 11 Jan 2023 16:54:07 +0800 Subject: Add -disable-check-noreturn-call for stack protect Differential Revision: https://reviews.llvm.org/D141556 Reviewed By: lanza --- llvm/lib/CodeGen/StackProtector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/StackProtector.cpp') 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 EnableSelectionDAGSP("enable-selectiondag-sp", cl::init(true), cl::Hidden); +static cl::opt 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(BB.getTerminator()); - if (!CheckLoc) { + if (!CheckLoc && !DisableCheckNoReturn) { for (auto &Inst : BB) { auto *CB = dyn_cast(&Inst); if (!CB) -- cgit v1.1