diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-10-04 04:10:00 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-10-05 07:18:50 +0200 |
| commit | e6e4792a585d4fb462749d78fa73d1403c97caf0 (patch) | |
| tree | e943d5eb8cd5e8e50bcae3c5534acb367f3559a3 /lib/std/debug.zig | |
| parent | 30f5258fe60cd5209fdfb44bd060f36435cb47b0 (diff) | |
| download | zig-e6e4792a585d4fb462749d78fa73d1403c97caf0.tar.gz zig-e6e4792a585d4fb462749d78fa73d1403c97caf0.zip | |
std.debug: completely disable FP-based unwinding on mips
Diffstat (limited to 'lib/std/debug.zig')
| -rw-r--r-- | lib/std/debug.zig | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 5b4c5c873c..4f464420ff 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -855,6 +855,18 @@ const StackIterator = union(enum) { } } + /// Some architectures make FP unwinding too impractical. For example, due to its very silly ABI + /// design decisions, it's not possible to do generic FP unwinding on MIPS; we would need to do + /// a complicated code scanning algorithm instead. At that point, we may as well just use DWARF. + const fp_unwind_is_impossible = switch (builtin.cpu.arch) { + .mips, + .mipsel, + .mips64, + .mips64el, + => true, + else => false, + }; + /// <https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Respect-the-purpose-of-specific-CPU-registers> const fp_unwind_is_safe = builtin.cpu.arch == .aarch64 and builtin.os.tag.isDarwin(); @@ -879,7 +891,14 @@ const StackIterator = union(enum) { // immediately regardless of anything. But FPs could also be omitted from a different // linked object, so it's not guaranteed to be safe, unless the target specifically // requires it. - .fp => abi_requires_backchain or (!builtin.omit_frame_pointer and (fp_unwind_is_safe or allow_unsafe)), + .fp => s: { + if (fp_unwind_is_impossible) break :s false; + if (abi_requires_backchain) break :s true; + if (builtin.omit_frame_pointer) break :s false; + if (fp_unwind_is_safe) break :s true; + if (allow_unsafe) break :s true; + break :s false; + }, }; } |
