From a583d26e7016a6111c2d1f9dbe34aeedf810c63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 25 Aug 2026 13:48:36 +0200 Subject: [PATCH] compiler: disable self-hosted backend for x86_64-macos by default https://codeberg.org/ziglang/zig/issues/35267 This was already the case before b66fe565db650bbac17c7fd6559734f7d658f36d since isBSD() includes isDarwin() - a great example of why that function is bad, because it was not intended for Darwin platforms to be included in that check. Anyway, we now *do* want to disable the self-hosted backend for this target due to the aforementioned linker bug, but let's actually be intentional about it. --- src/target.zig | 3 ++- test/tests.zig | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/target.zig b/src/target.zig index 6b57484254ce1e2fc697e3e0b1baea1f71ab6ba9..fda6a4cbf6e45b6b398320d237293cb3965beab5 100644 --- a/src/target.zig +++ b/src/target.zig @@ -313,7 +313,8 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { else => {}, } return switch (target.ofmt) { - .elf, .macho => true, + .elf => true, + .macho => false, // https://codeberg.org/ziglang/zig/issues/35267 else => false, }; } diff --git a/test/tests.zig b/test/tests.zig index bc25011eb5c0029c46fcbc84c9ad8165e976dfba..2ebb7447a4a184fef81b3ec1e9931a9f8adbb74b 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -3051,7 +3051,8 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt else => {}, } return switch (ofmt) { - .elf, .macho => return false, + .elf => return false, + .macho => return true, // https://codeberg.org/ziglang/zig/issues/35267 else => return true, }; }, -- 2.54.0