From 0f56d7afe298ae8f2b49d6c3b14fd935c971f1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 3 Oct 2025 03:24:21 +0200 Subject: [PATCH] std.debug: use correct return address offset for s390x Makes FP-based unwinding work. --- lib/std/debug.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 2b1ea3492f..6d705f3c86 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -952,6 +952,9 @@ const StackIterator = union(enum) { /// Offset of the saved return address wrt the frame pointer. const ra_offset = off: { if (native_arch == .powerpc64le) break :off 2 * @sizeOf(usize); + // On s390x, r14 is the link register and we need to grab it from its customary slot in the + // register save area (ELF ABI s390x Supplement ยง1.2.2.2). + if (native_arch == .s390x) break :off 14 * @sizeOf(usize); break :off @sizeOf(usize); };