compiler: don't use self-hosted backends on big-endian hosts

https://github.com/ziglang/zig/issues/25961
This commit is contained in:
Alex Rønne Petersen 2025-11-17 20:35:04 +01:00
parent 959a3612c2
commit 4b99e3718b
No known key found for this signature in database
4 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,4 @@
const builtin = @import("builtin");
const std = @import("std");
const assert = std.debug.assert;
@ -255,6 +256,7 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C
/// debug mode. A given target should only return true here if it is passing greater
/// than or equal to the number of behavior tests as the respective LLVM backend.
pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
if (comptime builtin.cpu.arch.endian() == .big) return false; // https://github.com/ziglang/zig/issues/25961
if (target.cpu.arch.isSpirV()) return true;
if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {
if (target.os.tag == .illumos) {

View file

@ -39,6 +39,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void {
}
fn shouldTestNonLlvm(target: *const std.Target) bool {
if (comptime builtin.cpu.arch.endian() == .big) return false; // https://github.com/ziglang/zig/issues/25961
return switch (target.cpu.arch) {
.x86_64 => switch (target.ofmt) {
.elf => !target.os.tag.isBSD() and target.os.tag != .illumos,

View file

@ -44,12 +44,15 @@ fn addCaseTarget(
target: *const std.Build.ResolvedTarget,
triple: ?[]const u8,
) void {
const both_backends = switch (target.result.cpu.arch) {
.x86_64 => switch (target.result.ofmt) {
.elf => !target.result.os.tag.isBSD() and target.result.os.tag != .illumos,
const both_backends = b: {
if (comptime builtin.cpu.arch.endian() == .big) break :b false; // https://github.com/ziglang/zig/issues/25961
break :b switch (target.result.cpu.arch) {
.x86_64 => switch (target.result.ofmt) {
.elf => !target.result.os.tag.isBSD() and target.result.os.tag != .illumos,
else => false,
},
else => false,
},
else => false,
};
};
const both_pie = switch (target.result.os.tag) {
.fuchsia, .openbsd => false,

View file

@ -2500,6 +2500,7 @@ fn addOneModuleTest(
}
pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: OptimizeMode) bool {
if (comptime builtin.cpu.arch.endian() == .big) return true; // https://github.com/ziglang/zig/issues/25961
if (use_llvm) |x| return x;
if (query.ofmt == .c) return false;
switch (optimize_mode) {