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-22 01:37:32+02:00
log0700ec35bda705fccb61cb3f28734ce11166fda5
tree1cda0d7385705b69cd59e838584688a3b5607949
parent4d8dcccbd416ec49bcd681374c90bbe9a11ed5ca
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
...@@ -238,7 +238,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {...@@ -238,7 +238,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {
238pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {238pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
239 if (target.cpu.arch.isSpirV()) return true;239 if (target.cpu.arch.isSpirV()) return true;
240 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {240 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {
241 if (target.os.tag == .netbsd or target.os.tag == .openbsd) {241 if (target.os.tag.isBSD()) {
242 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341242 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341
243 return false;243 return false;
244 }244 }
test/src/StackTrace.zig+1-1
...@@ -45,7 +45,7 @@ fn addCaseInner(self: *StackTrace, config: Config, use_llvm: bool) void {...@@ -45,7 +45,7 @@ fn addCaseInner(self: *StackTrace, config: Config, use_llvm: bool) void {
45fn shouldTestNonLlvm(target: *const std.Target) bool {45fn shouldTestNonLlvm(target: *const std.Target) bool {
46 return switch (target.cpu.arch) {46 return switch (target.cpu.arch) {
47 .x86_64 => switch (target.ofmt) {47 .x86_64 => switch (target.ofmt) {
48 .elf => true,48 .elf => !target.os.tag.isBSD(),
49 else => false,49 else => false,
50 },50 },
51 else => false,51 else => false,
test/tests.zig+2-1
...@@ -2451,8 +2451,9 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt...@@ -2451,8 +2451,9 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt
2451 else => return true,2451 else => return true,
2452 }2452 }
2453 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;2453 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
2454 const os_tag = query.os_tag orelse builtin.os.tag;
2454 switch (cpu_arch) {2455 switch (cpu_arch) {
2455 .x86_64 => if (std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,2456 .x86_64 => if (os_tag.isBSD() or std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,
2456 .spirv32, .spirv64 => return false,2457 .spirv32, .spirv64 => return false,
2457 else => return true,2458 else => return true,
2458 }2459 }