diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-10-09 14:14:19 +0100 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-10-09 19:31:44 +0100 |
| commit | 80f6b8c4b3a6dcb17dcd9bb3ecaf528b3da9c54e (patch) | |
| tree | a3d7e036a042b687b9995c3054f467673c9c0b68 /lib/std | |
| parent | c383cd50d5eb3b677493ab0058d860a9177a2679 (diff) | |
| download | zig-80f6b8c4b3a6dcb17dcd9bb3ecaf528b3da9c54e.tar.gz zig-80f6b8c4b3a6dcb17dcd9bb3ecaf528b3da9c54e.zip | |
std.debug: fix incorrect FP unwinding on RISC-V and SPARC
I broke this when porting this logic for the `std.debug` rework in
https://github.com/ziglang/zig/pull/25227. The offset that I copied was
actually being treated as relative to the address of the *saved* base
pointer. I think it makes more sense to do what I did and just treat all
offsets as relative to this frame's base.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/debug.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 51c0cf24ca..2ae9a23f85 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -993,6 +993,8 @@ const StackIterator = union(enum) { /// Offset of the saved return address wrt the frame pointer. const ra_offset = off: { + if (native_arch.isRISCV()) break :off -1 * @sizeOf(usize); + if (native_arch.isSPARC()) break :off 15 * @sizeOf(usize); if (native_arch.isPowerPC64()) 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). |
