std.zig.system.linux: don't arbitrarily limit sparc CPU detection to 64-bit

This commit is contained in:
Alex Rønne Petersen 2025-11-20 06:38:51 +01:00
parent 534370c4de
commit 47df2f9abe
No known key found for this signature in database

View file

@ -11,7 +11,6 @@ const assert = std.debug.assert;
const SparcCpuinfoImpl = struct { const SparcCpuinfoImpl = struct {
model: ?*const Target.Cpu.Model = null, model: ?*const Target.Cpu.Model = null,
is_64bit: bool = false,
const cpu_names = .{ const cpu_names = .{
.{ "SuperSparc", &Target.sparc.cpu.supersparc }, .{ "SuperSparc", &Target.sparc.cpu.supersparc },
@ -41,17 +40,12 @@ const SparcCpuinfoImpl = struct {
break; break;
} }
} }
} else if (mem.eql(u8, key, "type")) {
self.is_64bit = mem.eql(u8, value, "sun4u") or mem.eql(u8, value, "sun4v");
} }
return true; return true;
} }
fn finalize(self: *const SparcCpuinfoImpl, arch: Target.Cpu.Arch) ?Target.Cpu { fn finalize(self: *const SparcCpuinfoImpl, arch: Target.Cpu.Arch) ?Target.Cpu {
// At the moment we only support 64bit SPARC systems.
assert(self.is_64bit);
const model = self.model orelse return null; const model = self.model orelse return null;
return Target.Cpu{ return Target.Cpu{
.arch = arch, .arch = arch,
@ -411,7 +405,7 @@ pub fn detectNativeCpuAndFeatures(io: Io) ?Target.Cpu {
const core = @import("arm.zig").aarch64.detectNativeCpuAndFeatures(current_arch, registers); const core = @import("arm.zig").aarch64.detectNativeCpuAndFeatures(current_arch, registers);
return core; return core;
}, },
.sparc64 => { .sparc, .sparc64 => {
return SparcCpuinfoParser.parse(current_arch, &file_reader.interface) catch null; return SparcCpuinfoParser.parse(current_arch, &file_reader.interface) catch null;
}, },
.powerpc, .powerpcle, .powerpc64, .powerpc64le => { .powerpc, .powerpcle, .powerpc64, .powerpc64le => {