diff --git a/lib/std/build.zig b/lib/std/build.zig index 4c05586159..76744b12d2 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1623,6 +1623,7 @@ pub const LibExeObjStep = struct { /// Overrides the default stack size stack_size: ?u64 = null, + use_unwind_tables: ?bool = null, want_lto: ?bool = null, use_stage1: ?bool = null, use_llvm: ?bool = null, @@ -2505,6 +2506,14 @@ pub const LibExeObjStep = struct { } } + if (self.use_unwind_tables) |use_unwind_tables| { + if (use_unwind_tables) { + try zig_args.append("-funwind-tables"); + } else { + try zig_args.append("-fno-unwind-tables"); + } + } + if (self.ofmt) |ofmt| { try zig_args.append(try std.fmt.allocPrint(builder.allocator, "-ofmt={s}", .{@tagName(ofmt)})); } diff --git a/test/tests.zig b/test/tests.zig index a329233199..f46a3acbb5 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -108,6 +108,14 @@ const test_targets = blk: { }, .backend = .stage2_x86_64, }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .windows, + .abi = .gnu, + }, + .backend = .stage2_x86_64, + }, .{ .target = .{ @@ -693,6 +701,13 @@ pub fn addPkgTests( else => { these_tests.use_stage1 = false; these_tests.use_llvm = false; + + if (test_target.target.getOsTag() == .windows) { + // TODO: We set these to no so that we don't fallback to LLD for incremental linking context. This is because + // our own COFF linker doesn't yet support these options. + these_tests.emit_implib = .no_emit; + these_tests.use_unwind_tables = false; + } }, };