diff options
| author | Leonard Chan <leonardchan@google.com> | 2025-07-16 13:09:04 -0700 |
|---|---|---|
| committer | Leonard Chan <leonardchan@google.com> | 2025-07-16 13:12:28 -0700 |
| commit | 94382c8e56e878d1b6a8cf317e3632df5352e23e (patch) | |
| tree | 82d93c97fd4769ea73d412b6ffdca88666f8e232 /llvm/lib/CodeGen/StackProtector.cpp | |
| parent | 3a6ef8b359fc3f2459ef60013b8938ebe847831b (diff) | |
[llvm][StackProtector] Add noreturn to __stack_chk_fail call (#143976)
This is a reland for 99e53cb4139eda491f97cb33ee42ea424d352200 with the
appropriate test fixes.
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.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 9cc9af88c5e4..b79911bcf3c4 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -731,8 +731,8 @@ BasicBlock *CreateFailBB(Function *F, const TargetLowering &TLI) { } if (StackChkFail) { - cast<Function>(StackChkFail.getCallee())->addFnAttr(Attribute::NoReturn); - B.CreateCall(StackChkFail, Args); + CallInst *Call = B.CreateCall(StackChkFail, Args); + Call->addFnAttr(Attribute::NoReturn); } B.CreateUnreachable(); |
