Commit ef5f8bd7c6

Andrew Kelley <andrew@ziglang.org>
2023-03-12 08:38:01
getExternalExecutor: fix aarch64 windows
std.zig.system.NativeTargetInfo.getExternalExecutor previously would incorrectly communicate that wine could be used to run aarch64-windows binaries on x86_64-linux, and x86_64-windows binaries on aarch64-linux. Neither of these things are true.
1 parent 98299e7
Changed files (1)
lib
std
lib/std/zig/system/NativeTargetInfo.zig
@@ -1090,6 +1090,11 @@ pub fn getExternalExecutor(
     switch (candidate.target.os.tag) {
         .windows => {
             if (options.allow_wine) {
+                // x86_64 wine does not support emulating aarch64-windows and
+                // vice versa.
+                if (candidate.target.cpu.arch != builtin.cpu.arch) {
+                    return bad_result;
+                }
                 switch (candidate.target.cpu.arch.ptrBitWidth()) {
                     32 => return Executor{ .wine = "wine" },
                     64 => return Executor{ .wine = "wine64" },