diff --git a/lib/std/debug.zig b/lib/std/debug.zig index e00c0a21a2c0d87ce953e8701f87be57d014afb4..6a0d4dac939a3a20fc7085f5cd9ad4d39a6e66c4 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -114,6 +114,10 @@ pub fn detectTTYConfig() TTY.Config { pub fn dumpCurrentStackTrace(start_addr: ?usize) void { nosuspend { const stderr = io.getStdErr().writer(); + if (comptime builtin.target.isWasm()) { + stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; + return; + } if (builtin.strip_debug_info) { stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; return; diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp index 40e444010231110ad36588f08c483b6c0b0a4799..3a83d93310a6c216f8a1528faf62840675a3852e 100644 --- a/src/stage1/codegen.cpp +++ b/src/stage1/codegen.cpp @@ -2645,6 +2645,9 @@ static LLVMValueRef ir_render_save_err_ret_addr(CodeGen *g, Stage1Air *executabl Stage1AirInstSaveErrRetAddr *save_err_ret_addr_instruction) { assert(g->have_err_ret_tracing); + if ((target_is_wasm(g->zig_target) && g->zig_target->os != OsEmscripten) || target_is_bpf(g->zig_target)) { + return nullptr; + } LLVMValueRef return_err_fn = get_return_err_fn(g); bool is_llvm_alloca; diff --git a/src/stage1/target.cpp b/src/stage1/target.cpp index 7ff300891103e830d0fa667ae9c57f8c93ac2493..da6565f0be3b6cc9e5857e6601b7350270a4d4ab 100644 --- a/src/stage1/target.cpp +++ b/src/stage1/target.cpp @@ -1000,7 +1000,7 @@ ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) { } bool target_has_debug_info(const ZigTarget *target) { - return !target_is_wasm(target); + return true; } bool target_long_double_is_f128(const ZigTarget *target) { diff --git a/src/target.zig b/src/target.zig index aafd65e3271984db562d56c4a72287ea6a674159..27ed1118dbbc1eae9eb4cbb68b4328f408e61e6f 100644 --- a/src/target.zig +++ b/src/target.zig @@ -455,7 +455,8 @@ pub fn classifyCompilerRtLibName(target: std.Target, name: []const u8) CompilerR } pub fn hasDebugInfo(target: std.Target) bool { - return !target.cpu.arch.isWasm(); + _ = target; + return true; } pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode {