authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-03 05:22:37+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-04-03 05:22:37+02:00
logbfbf4badd57c7fe0618391ea08c60e485beda18a
treedf5a5e38c398b4602fb1b46b9e9c01f25becee5a
parentde62dc884edb1205e1aac799e0a3b4273be999a1
parent171cea74b64d4d2c6f7379cebc6b0b7162bb7b99
signaturebadge-check Signed by PGP key B5690EEEBB952194

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(...@@ -125,40 +125,33 @@ pub fn getExternalExecutor(
125 };125 };
126 }126 }
127127
128 if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) {
129 return Executor{ .wasmtime = "wasmtime" };
130 }
131
128 switch (candidate.os.tag) {132 switch (candidate.os.tag) {
129 .windows => {133 .windows => {
130 if (options.allow_wine) {134 if (options.allow_wine) {
131 // x86_64 wine does not support emulating aarch64-windows and135 const wine_supported = switch (candidate.cpu.arch) {
132 // vice versa.136 .thumb => switch (host.cpu.arch) {
133 if (candidate.cpu.arch != builtin.cpu.arch and137 .arm, .thumb, .aarch64 => true,
134 !(candidate.cpu.arch == .thumb and builtin.cpu.arch == .aarch64) and138 else => false,
135 !(candidate.cpu.arch == .x86 and builtin.cpu.arch == .x86_64))139 },
136 {140 .aarch64 => host.cpu.arch == .aarch64,
137 return bad_result;141 .x86 => host.cpu.arch.isX86(),
138 }142 .x86_64 => host.cpu.arch == .x86_64,
139 switch (candidate.ptrBitWidth()) {143 else => false,
140 32 => return Executor{ .wine = "wine" },144 };
141 64 => return Executor{ .wine = "wine64" },145 return if (wine_supported) Executor{ .wine = "wine" } else bad_result;
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 }
153 }146 }
154 return bad_result;147 return bad_result;
155 },148 },
156 .macos => {149 .driverkit, .macos => {
157 if (options.allow_darling) {150 if (options.allow_darling) {
158 // This check can be loosened once darling adds a QEMU-based emulation151 // This check can be loosened once darling adds a QEMU-based emulation
159 // layer for non-host architectures:152 // layer for non-host architectures:
160 // https://github.com/darlinghq/darling/issues/863153 // https://github.com/darlinghq/darling/issues/863
161 if (candidate.cpu.arch != builtin.cpu.arch) {154 if (candidate.cpu.arch != host.cpu.arch) {
162 return bad_result;155 return bad_result;
163 }156 }
164 return Executor{ .darling = "darling" };157 return Executor{ .darling = "darling" };