| ... | ... | @@ -55,7 +55,7 @@ fn addCaseTarget( |
| 55 | 55 | }; |
| 56 | 56 | }; |
| 57 | 57 | const both_pie = switch (target.result.os.tag) { |
| 58 | | .fuchsia, .openbsd => false, |
| 58 | .fuchsia => false, |
| 59 | 59 | else => true, |
| 60 | 60 | }; |
| 61 | 61 | const both_libc = switch (target.result.os.tag) { |
| ... | ... | @@ -63,8 +63,30 @@ fn addCaseTarget( |
| 63 | 63 | else => !target.result.requiresLibC(), |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | | // On aarch64-macos, FP unwinding is blessed by Apple to always be reliable, and std.debug knows this. |
| 67 | | const fp_unwind_is_safe = target.result.cpu.arch == .aarch64 and target.result.os.tag.isDarwin(); |
| 66 | // See `std.debug.StackIterator.fp_usability` logic. |
| 67 | const fp_usability: enum { useless, unsafe, safe, ideal } = switch (target.result.cpu.arch) { |
| 68 | .alpha, |
| 69 | .csky, |
| 70 | .microblaze, |
| 71 | .microblazeel, |
| 72 | .mips, |
| 73 | .mipsel, |
| 74 | .mips64, |
| 75 | .mips64el, |
| 76 | .sh, |
| 77 | .sheb, |
| 78 | => .useless, |
| 79 | .hexagon, |
| 80 | .powerpc, |
| 81 | .powerpcle, |
| 82 | .powerpc64, |
| 83 | .powerpc64le, |
| 84 | .sparc, |
| 85 | .sparc64, |
| 86 | => .ideal, |
| 87 | .aarch64 => if (target.result.os.tag.isDarwin()) .safe else .unsafe, |
| 88 | else => .unsafe, |
| 89 | }; |
| 68 | 90 | const supports_unwind_tables = switch (target.result.os.tag) { |
| 69 | 91 | // x86-windows just has no way to do stack unwinding other then using frame pointers. |
| 70 | 92 | .windows => target.result.cpu.arch != .x86, |
| ... | ... | @@ -86,10 +108,24 @@ fn addCaseTarget( |
| 86 | 108 | const only_fp: @This() = .{ .tables = false, .fp = true }; |
| 87 | 109 | }; |
| 88 | 110 | const unwind_info_vals: []const UnwindInfo = switch (config.unwind) { |
| 89 | | .none => &.{.none}, |
| 90 | | .any => &.{ .only_tables, .only_fp, .both }, |
| 91 | | .safe => if (fp_unwind_is_safe) &.{ .only_tables, .only_fp, .both } else &.{ .only_tables, .both }, |
| 92 | | .no_safe => if (fp_unwind_is_safe) &.{.none} else &.{ .none, .only_fp }, |
| 111 | .none => switch (fp_usability) { |
| 112 | .useless => &.{ .none, .only_fp }, |
| 113 | .unsafe, .safe => &.{.none}, |
| 114 | .ideal => &.{}, |
| 115 | }, |
| 116 | .any => switch (fp_usability) { |
| 117 | .useless => &.{ .only_tables, .both }, |
| 118 | .unsafe, .safe, .ideal => &.{ .only_tables, .only_fp, .both }, |
| 119 | }, |
| 120 | .safe => switch (fp_usability) { |
| 121 | .useless, .unsafe => &.{ .only_tables, .both }, |
| 122 | .safe, .ideal => &.{ .only_tables, .only_fp, .both }, |
| 123 | }, |
| 124 | .no_safe => switch (fp_usability) { |
| 125 | .useless, .unsafe => &.{ .none, .only_fp }, |
| 126 | .safe => &.{.none}, |
| 127 | .ideal => &.{}, |
| 128 | }, |
| 93 | 129 | }; |
| 94 | 130 | |
| 95 | 131 | for (use_llvm_vals) |use_llvm| { |