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.
This commit is contained in:
Tristan Ross 2024-02-08 14:28:20 -08:00 committed by Veikka Tuominen
parent ddcea2cad4
commit 2a3e601f77

View File

@ -3,9 +3,6 @@
pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
const macho_step = b.step("test-macho", "Run MachO tests"); const macho_step = b.step("test-macho", "Run MachO tests");
const default_target = b.resolveTargetQuery(.{
.os_tag = .macos,
});
const x86_64_target = b.resolveTargetQuery(.{ const x86_64_target = b.resolveTargetQuery(.{
.cpu_arch = .x86_64, .cpu_arch = .x86_64,
.os_tag = .macos, .os_tag = .macos,
@ -15,6 +12,13 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
.os_tag = .macos, .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) // Exercise linker with self-hosted backend (no LLVM)
macho_step.dependOn(testHelloZig(b, .{ .use_llvm = false, .target = x86_64_target })); 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 })); macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .strip = true, .target = x86_64_target }));