authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-03 05:22:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-03 19:32:54+02:00
logf5de2770e587a93fd17a2c5e7f472d146281d5eb
tree31ba3edc8fe1433db12f67401fdc240506aa8d4b
parentd128f5c0bb06b9485f37145e24bc99cbba27087c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Merge pull request #23445 from alexrp/external-executor-fixes


1 files changed, 17 insertions(+), 24 deletions(-)

lib/std/zig/system.zig+17-24
......@@ -125,40 +125,33 @@ pub fn getExternalExecutor(
125125 };
126126 }
127127
128 if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) {
129 return Executor{ .wasmtime = "wasmtime" };
130 }
131
128132 switch (candidate.os.tag) {
129133 .windows => {
130134 if (options.allow_wine) {
131 // x86_64 wine does not support emulating aarch64-windows and
132 // vice versa.
133 if (candidate.cpu.arch != builtin.cpu.arch and
134 !(candidate.cpu.arch == .thumb and builtin.cpu.arch == .aarch64) and
135 !(candidate.cpu.arch == .x86 and builtin.cpu.arch == .x86_64))
136 {
137 return bad_result;
138 }
139 switch (candidate.ptrBitWidth()) {
140 32 => return Executor{ .wine = "wine" },
141 64 => return Executor{ .wine = "wine64" },
142 else => return bad_result,
143 }
144 }
145 return bad_result;
146 },
147 .wasi => {
148 if (options.allow_wasmtime) {
149 switch (candidate.ptrBitWidth()) {
150 32 => return Executor{ .wasmtime = "wasmtime" },
151 else => return bad_result,
152 }
135 const wine_supported = switch (candidate.cpu.arch) {
136 .thumb => switch (host.cpu.arch) {
137 .arm, .thumb, .aarch64 => true,
138 else => false,
139 },
140 .aarch64 => host.cpu.arch == .aarch64,
141 .x86 => host.cpu.arch.isX86(),
142 .x86_64 => host.cpu.arch == .x86_64,
143 else => false,
144 };
145 return if (wine_supported) Executor{ .wine = "wine" } else bad_result;
153146 }
154147 return bad_result;
155148 },
156 .macos => {
149 .driverkit, .macos => {
157150 if (options.allow_darling) {
158151 // This check can be loosened once darling adds a QEMU-based emulation
159152 // layer for non-host architectures:
160153 // https://github.com/darlinghq/darling/issues/863
161 if (candidate.cpu.arch != builtin.cpu.arch) {
154 if (candidate.cpu.arch != host.cpu.arch) {
162155 return bad_result;
163156 }
164157 return Executor{ .darling = "darling" };