[llvm] 0da6d91 - RuntimeLibcalls: Fix stacksmash on arm64ec (#152116)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 04:04:39 PDT 2025


Author: Matt Arsenault
Date: 2025-08-05T20:04:36+09:00
New Revision: 0da6d91ad9dd769b2d9f97d9f9249f5523a11023

URL: https://github.com/llvm/llvm-project/commit/0da6d91ad9dd769b2d9f97d9f9249f5523a11023
DIFF: https://github.com/llvm/llvm-project/commit/0da6d91ad9dd769b2d9f97d9f9249f5523a11023.diff

LOG: RuntimeLibcalls: Fix stacksmash on arm64ec (#152116)

Fix after 5478da9

Added: 
    llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll

Modified: 
    llvm/include/llvm/IR/RuntimeLibcalls.td

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 4905c8a420dcc..5d1015e585e47 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1247,9 +1247,12 @@ defset list<RuntimeLibcallImpl> WinArm64ECDefaultRuntimeLibcallImpls = {
   }
 }
 
+def arm64ec___stack_chk_fail : DuplicateLibcallImplWithPrefix<__stack_chk_fail, "#">;
+
 def WindowsARM64ECSystemLibrary
     : SystemRuntimeLibrary<isWindowsArm64EC,
-                           (add WinArm64ECDefaultRuntimeLibcallImpls)>;
+                           (add WinArm64ECDefaultRuntimeLibcallImpls,
+                                arm64ec___stack_chk_fail)>;
 
 //===----------------------------------------------------------------------===//
 // AMDGPU Runtime Libcalls

diff  --git a/llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll b/llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll
new file mode 100644
index 0000000000000..0960133d7d054
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll
@@ -0,0 +1,16 @@
+; RUN: llc -mtriple=arm64ec-unknown-windows-gnu < %s | FileCheck %s
+
+; CHECK-LABEL: func = "#func"
+; CHECK: bl "#other"
+; CHECK: bl "#__stack_chk_fail"
+define void @func() #0 {
+entry:
+  %buf = alloca [10 x i8], align 1
+  call void @other(ptr %buf) #1
+  ret void
+}
+
+declare void @other(ptr) #1
+
+attributes #0 = { nounwind sspstrong }
+attributes #1 = { nounwind }


        


More information about the llvm-commits mailing list