Commit 97ecb6c551

Alex Rønne Petersen <alex@alexrp.com>
2025-07-06 14:32:06
compiler: Disable self-hosted x86_64 backend on NetBSD
https://github.com/ziglang/zig/issues/24341
1 parent b461d07
Changed files (1)
src/target.zig
@@ -222,10 +222,16 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {
 /// than or equal to the number of behavior tests as the respective LLVM backend.
 pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
     if (target.cpu.arch.isSpirV()) return true;
-    if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) return switch (target.ofmt) {
-        .elf, .macho => true,
-        else => false,
-    };
+    if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {
+        if (target.os.tag == .netbsd) {
+            // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341
+            return false;
+        }
+        return switch (target.ofmt) {
+            .elf, .macho => true,
+            else => false,
+        };
+    }
     return false;
 }