From cbe9a51518db6f4e77a4f8c72e8cd9cd02fa7f49 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 21 Jan 2020 22:01:24 -0500 Subject: don't trust llvm's GetHostCPUName comment from this commit reproduced here: I have observed the CPU name reported by LLVM being incorrect. On the SourceHut build services, LLVM 9.0 reports the CPU as "athlon-xp", which is a 32-bit CPU, even though the system is 64-bit and the reported CPU features include, among other things, +64bit. So the strategy taken here is that we observe both reported CPU, and the reported CPU features. The features are trusted more; but if the features match exactly the features of the reported CPU, then we trust the reported CPU. --- lib/std/target.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/std') diff --git a/lib/std/target.zig b/lib/std/target.zig index 49913de2ee..e72a1a8452 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -637,6 +637,10 @@ pub const Target = union(enum) { pub fn asBytes(set: *const Set) *const [byte_count]u8 { return @ptrCast(*const [byte_count]u8, &set.ints); } + + pub fn eql(set: Set, other: Set) bool { + return mem.eql(usize, &set.ints, &other.ints); + } }; pub fn feature_set_fns(comptime F: type) type { -- cgit v1.2.3