aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug/Dwarf.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-10-01 23:24:53 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-10-01 23:47:47 +0200
commit97de46dc16b584f5bd7aa2ae9afb2bb77970cd22 (patch)
tree67cdb1aaf5dc90c873c6b0c36b53a80c8856a67f /lib/std/debug/Dwarf.zig
parent8520e9312eed3b3b8d7f95d4844c83105c91ead1 (diff)
downloadzig-97de46dc16b584f5bd7aa2ae9afb2bb77970cd22.tar.gz
zig-97de46dc16b584f5bd7aa2ae9afb2bb77970cd22.zip
std.debug: add riscv32-linux and riscv64-linux unwind support
Diffstat (limited to 'lib/std/debug/Dwarf.zig')
-rw-r--r--lib/std/debug/Dwarf.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig
index 3283e59aea..ab064617ea 100644
--- a/lib/std/debug/Dwarf.zig
+++ b/lib/std/debug/Dwarf.zig
@@ -1432,6 +1432,7 @@ pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 {
.aarch64, .aarch64_be => 32,
.arm, .armeb, .thumb, .thumbeb => 15,
.loongarch32, .loongarch64 => 32,
+ .riscv32, .riscv32be, .riscv64, .riscv64be => 32,
.x86 => 8,
.x86_64 => 16,
else => null,
@@ -1443,6 +1444,7 @@ pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 {
.aarch64, .aarch64_be => 29,
.arm, .armeb, .thumb, .thumbeb => 11,
.loongarch32, .loongarch64 => 22,
+ .riscv32, .riscv32be, .riscv64, .riscv64be => 8,
.x86 => 5,
.x86_64 => 6,
else => unreachable,
@@ -1454,6 +1456,7 @@ pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 {
.aarch64, .aarch64_be => 31,
.arm, .armeb, .thumb, .thumbeb => 13,
.loongarch32, .loongarch64 => 3,
+ .riscv32, .riscv32be, .riscv64, .riscv64be => 2,
.x86 => 4,
.x86_64 => 7,
else => unreachable,
@@ -1473,10 +1476,6 @@ pub fn supportsUnwinding(target: *const std.Target) bool {
.spirv64,
=> false,
- // Enabling this causes relocation errors such as:
- // error: invalid relocation type R_RISCV_SUB32 at offset 0x20
- .riscv64, .riscv64be, .riscv32, .riscv32be => false,
-
// Conservative guess. Feel free to update this logic with any targets
// that are known to not support Dwarf unwinding.
else => true,