[llvm] RuntimeLibcalls: Fix stacksmash on arm64ec (PR #152116)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 03:21:53 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/152116
Fix after 5478da9
>From 958565443d6f06556e1dcc36de9e875a80cfa3b1 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 5 Aug 2025 19:11:51 +0900
Subject: [PATCH] RuntimeLibcalls: Fix stacksmash on arm64ec
Fix after 5478da9
---
llvm/include/llvm/IR/RuntimeLibcalls.td | 5 ++++-
llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/CodeGen/AArch64/stacksmash-arm64ec.ll
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