Commit 945111ae92

Jakub Konka <kubkon@jakubkonka.com>
2022-09-06 17:53:21
enable testing of x86_64-windows-gnu using self-hosted backend and linker
1 parent 7b8cc59
Changed files (2)
lib
test
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)}));
         }
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;
+                }
             },
         };