aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-06 12:46:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-12-06 12:46:59 -0700
commit3f693cf5d51fbc53d32203e5a5faf69d4a49a099 (patch)
treea366069fc741101c36cdcbbb42296464c82d4f81 /src/main.zig
parentbf316e550671cc71eb498b3cf799493627bb0fdc (diff)
downloadzig-3f693cf5d51fbc53d32203e5a5faf69d4a49a099.tar.gz
zig-3f693cf5d51fbc53d32203e5a5faf69d4a49a099.zip
CLI: quality of life enhancement for windows CBE behavior tests
When testing with ``` stage4/bin/zig test ../test/behavior.zig -I../test -ofmt=c -target x86_64-windows ``` previously, one would see this message: ``` error: lld-link: subsystem must be defined ``` Now, `--subsystem console` as well as `-lntdll -lkernel32` are on the `zig run` line, producing a binary.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 45d6b5bffc..c1bf8c88d1 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -3059,7 +3059,15 @@ fn buildOutputType(
try test_exec_args.appendSlice(&.{ "-I", p });
}
- if (link_libc) try test_exec_args.append("-lc");
+ if (link_libc) {
+ try test_exec_args.append("-lc");
+ } else if (target_info.target.os.tag == .windows) {
+ try test_exec_args.appendSlice(&.{
+ "--subsystem", "console",
+ "-lkernel32", "-lntdll",
+ });
+ }
+
if (!mem.eql(u8, target_arch_os_abi, "native")) {
try test_exec_args.append("-target");
try test_exec_args.append(target_arch_os_abi);