| author | |
| committer | |
| log | 661028a907a66ad94b6c052286a59da3bcd6f287 |
| tree | 867d916f3cc0158f19a847a0258cd42697506b0a |
| parent | f2aab12a8627b3afd1a4d9c38157968b2f012e0c |
3 files changed, 20 insertions(+), 9 deletions(-)
lib/std/dwarf.zig+1-1| ... | ... | @@ -1656,7 +1656,7 @@ pub const DwarfInfo = struct { |
| 1656 | 1656 | /// `explicit_fde_offset` is for cases where the FDE offset is known, such as when __unwind_info |
| 1657 | 1657 | /// defers unwinding to DWARF. This is an offset into the `.eh_frame` section. |
| 1658 | 1658 | pub fn unwindFrame(di: *const DwarfInfo, context: *UnwindContext, explicit_fde_offset: ?usize) !usize { |
| 1659 | if (!comptime abi.isSupportedArch(builtin.target.cpu.arch)) return error.UnsupportedCpuArchitecture; | |
| 1659 | if (!comptime abi.supportsUnwinding(builtin.target)) return error.UnsupportedCpuArchitecture; | |
| 1660 | 1660 | if (context.pc == 0) return 0; |
| 1661 | 1661 | |
| 1662 | 1662 | // Find the FDE and CIE |
lib/std/dwarf/abi.zig+18-7| ... | ... | @@ -3,13 +3,24 @@ const std = @import("../std.zig"); |
| 3 | 3 | const os = std.os; |
| 4 | 4 | const mem = std.mem; |
| 5 | 5 | |
| 6 | pub fn isSupportedArch(arch: std.Target.Cpu.Arch) bool { | |
| 7 | return switch (arch) { | |
| 8 | .x86, | |
| 9 | .x86_64, | |
| 10 | .arm, | |
| 11 | .aarch64, | |
| 12 | => true, | |
| 6 | pub fn supportsUnwinding(target: std.Target) bool { | |
| 7 | return switch (target.cpu.arch) { | |
| 8 | .x86 => switch (target.os.tag) { | |
| 9 | .linux, .netbsd, .solaris => true, | |
| 10 | else => false, | |
| 11 | }, | |
| 12 | .x86_64 => switch (target.os.tag) { | |
| 13 | .linux, .netbsd, .freebsd, .openbsd, .macos, .solaris => true, | |
| 14 | else => false, | |
| 15 | }, | |
| 16 | .arm => switch (target.os.tag) { | |
| 17 | .linux => true, | |
| 18 | else => false, | |
| 19 | }, | |
| 20 | .aarch64 => switch (target.os.tag) { | |
| 21 | .linux, .netbsd, .freebsd, .macos => true, | |
| 22 | else => false, | |
| 23 | }, | |
| 13 | 24 | else => false, |
| 14 | 25 | }; |
| 15 | 26 | } |
src/target.zig+1-1| ... | ... | @@ -510,7 +510,7 @@ pub fn clangAssemblerSupportsMcpuArg(target: std.Target) bool { |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | pub fn needUnwindTables(target: std.Target) bool { |
| 513 | return target.os.tag == .windows or target.isDarwin(); | |
| 513 | return target.os.tag == .windows or target.isDarwin() or std.dwarf.abi.supportsUnwinding(target); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | pub fn defaultAddressSpace( |