std.debug.SelfInfo: mark ARM unwinding as unsupported

We need to parse the `.ARM.exidx` section to be able to reliably unwind
the stack on ARM.
This commit is contained in:
mlugg 2025-09-22 15:39:16 +01:00
parent 950a9d2a10
commit dbda011ae6
No known key found for this signature in database
GPG key ID: 3F5B7DCCBF4AF02E
2 changed files with 9 additions and 3 deletions

View file

@ -266,8 +266,10 @@ pub fn unwindFrame(module: *const ElfModule, gpa: Allocator, di: *DebugInfo, con
}
pub const UnwindContext = std.debug.SelfInfo.DwarfUnwindContext;
pub const supports_unwinding: bool = s: {
// Notably, we are yet to support unwinding on ARM. There, unwinding is not done through
// `.eh_frame`, but instead with the `.ARM.exidx` section, which has a different format.
const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) {
.linux => &.{ .x86, .x86_64, .arm, .armeb, .thumb, .thumbeb, .aarch64, .aarch64_be },
.linux => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
.netbsd => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
.freebsd => &.{ .x86_64, .aarch64, .aarch64_be },
.openbsd => &.{.x86_64},

View file

@ -62,8 +62,12 @@ fn addCaseTarget(
// On aarch64-macos, FP unwinding is blessed by Apple to always be reliable, and std.debug knows this.
const fp_unwind_is_safe = target.result.cpu.arch == .aarch64 and target.result.os.tag.isDarwin();
// On x86-windows, only FP unwinding is available.
const supports_unwind_tables = target.result.os.tag != .windows or target.result.cpu.arch != .x86;
const supports_unwind_tables = switch (target.result.os.tag) {
// x86-windows just has no way to do stack unwinding other then using frame pointers.
.windows => target.result.cpu.arch != .x86,
// We do not yet implement support for the AArch32 exception table section `.ARM.exidx`.
else => !target.result.cpu.arch.isArm(),
};
const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true};
const pie_vals: []const ?bool = if (both_pie) &.{ true, false } else &.{null};