From 2a3e601f7779c921b05ae5df424f36101622b656 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 8 Feb 2024 14:28:20 -0800 Subject: [PATCH] test.link.macho: fix for non-x86 and arm architectures This fix is requires to make the build runner even compile when building Zig on architectures like RISC-V. --- test/link/macho.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/link/macho.zig b/test/link/macho.zig index 7bc83b2276..6d8a6062de 100644 --- a/test/link/macho.zig +++ b/test/link/macho.zig @@ -3,9 +3,6 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { const macho_step = b.step("test-macho", "Run MachO tests"); - const default_target = b.resolveTargetQuery(.{ - .os_tag = .macos, - }); const x86_64_target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .macos, @@ -15,6 +12,13 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { .os_tag = .macos, }); + const default_target = switch (builtin.cpu.arch) { + .x86_64, .aarch64 => b.resolveTargetQuery(.{ + .os_tag = .macos, + }), + else => aarch64_target, + }; + // Exercise linker with self-hosted backend (no LLVM) macho_step.dependOn(testHelloZig(b, .{ .use_llvm = false, .target = x86_64_target })); macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .strip = true, .target = x86_64_target }));