authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-21 08:47:21+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-24 01:11:42+02:00
loge526d65f5e11df3093cc2000611c9a6438f847fe
treeb059110e91ee28d43d9e71b50b612c5e75e21f5d
parent0e673fdab22eafa5099b21ec66c50ba491811ce7
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

compiler: don't use self-hosted backend on any BSD yet

There are some blocking bugs in the self-hosted ELF linker.

3 files changed, 4 insertions(+), 3 deletions(-)

src/target.zig+1-1
...@@ -236,7 +236,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {...@@ -236,7 +236,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {
236pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {236pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
237 if (target.cpu.arch.isSpirV()) return true;237 if (target.cpu.arch.isSpirV()) return true;
238 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {238 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {
239 if (target.os.tag == .netbsd or target.os.tag == .openbsd) {239 if (target.os.tag.isBSD()) {
240 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341240 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341
241 return false;241 return false;
242 }242 }
test/src/StackTrace.zig+1-1
...@@ -44,7 +44,7 @@ fn addCaseInner(self: *StackTrace, config: Config, use_llvm: bool) void {...@@ -44,7 +44,7 @@ fn addCaseInner(self: *StackTrace, config: Config, use_llvm: bool) void {
44fn shouldTestNonLlvm(target: *const std.Target) bool {44fn shouldTestNonLlvm(target: *const std.Target) bool {
45 return switch (target.cpu.arch) {45 return switch (target.cpu.arch) {
46 .x86_64 => switch (target.ofmt) {46 .x86_64 => switch (target.ofmt) {
47 .elf => true,47 .elf => !target.os.tag.isBSD(),
48 else => false,48 else => false,
49 },49 },
50 else => false,50 else => false,
test/tests.zig+2-1
...@@ -2488,8 +2488,9 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt...@@ -2488,8 +2488,9 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt
2488 else => return true,2488 else => return true,
2489 }2489 }
2490 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;2490 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
2491 const os_tag = query.os_tag orelse builtin.os.tag;
2491 switch (cpu_arch) {2492 switch (cpu_arch) {
2492 .x86_64 => if (std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,2493 .x86_64 => if (os_tag.isBSD() or std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,
2493 .spirv32, .spirv64 => return false,2494 .spirv32, .spirv64 => return false,
2494 else => return true,2495 else => return true,
2495 }2496 }