aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorPiJoules <6019989+PiJoules@users.noreply.github.com>2025-06-16 15:47:43 -0700
committerGitHub <noreply@github.com>2025-06-16 15:47:43 -0700
commit99e53cb4139eda491f97cb33ee42ea424d352200 (patch)
tree5ec16e47cac601f2b4731a25c07c3ce697c007a0 /llvm/lib/CodeGen/StackProtector.cpp
parent6e124423546e5d22b4b6dc64d6cedfe93e627d58 (diff)
downloadllvm-99e53cb4139eda491f97cb33ee42ea424d352200.zip
llvm-99e53cb4139eda491f97cb33ee42ea424d352200.tar.gz
llvm-99e53cb4139eda491f97cb33ee42ea424d352200.tar.bz2
[llvm][StackProtector] Add noreturn to __stack_chk_fail call (#143976)
It's possible for __stack_chk_fail to be an alias when using CrossDSOCFI since it will make a jump table entry for this function and replace it with an alias. StackProtector can crash since it always expects this to be a regular function. Instead add the noreturn attribute to the call.
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index 5f866ee..dda392d 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -725,8 +725,8 @@ BasicBlock *CreateFailBB(Function *F, const Triple &Trip) {
StackChkFail =
M->getOrInsertFunction("__stack_chk_fail", Type::getVoidTy(Context));
}
- cast<Function>(StackChkFail.getCallee())->addFnAttr(Attribute::NoReturn);
- B.CreateCall(StackChkFail, Args);
+ CallInst *Call = B.CreateCall(StackChkFail, Args);
+ Call->addFnAttr(Attribute::NoReturn);
B.CreateUnreachable();
return FailBB;
}