| ... | @@ -250,6 +250,24 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c | ... | @@ -250,6 +250,24 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c |
| 250 | resetSegfaultHandler(); | 250 | resetSegfaultHandler(); |
| 251 | } | 251 | } |
| 252 | | 252 | |
| | 253 | if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) |
| | 254 | nosuspend { |
| | 255 | // As a workaround for not having threadlocal variable support in LLD for this target, |
| | 256 | // we have a simpler panic implementation that does not use threadlocal variables. |
| | 257 | // TODO https://github.com/ziglang/zig/issues/7527 |
| | 258 | const stderr = io.getStdErr().writer(); |
| | 259 | if (@atomicRmw(u8, &panicking, .Add, 1, .SeqCst) == 0) { |
| | 260 | stderr.print("panic: " ++ format ++ "\n", args) catch os.abort(); |
| | 261 | if (trace) |t| { |
| | 262 | dumpStackTrace(t.*); |
| | 263 | } |
| | 264 | dumpCurrentStackTrace(first_trace_addr); |
| | 265 | } else { |
| | 266 | stderr.print("Panicked during a panic. Aborting.\n", .{}) catch os.abort(); |
| | 267 | } |
| | 268 | os.abort(); |
| | 269 | }; |
| | 270 | |
| 253 | nosuspend switch (panic_stage) { | 271 | nosuspend switch (panic_stage) { |
| 254 | 0 => { | 272 | 0 => { |
| 255 | panic_stage = 1; | 273 | panic_stage = 1; |