cpu_features: fix build on SunOS

This commit is contained in:
tnn 2022-01-09 22:03:17 +00:00
parent 69b9f4cba9
commit eef1bfa568
2 changed files with 23 additions and 4 deletions

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.4 2021/10/26 10:14:27 nia Exp $
$NetBSD: distinfo,v 1.5 2022/01/09 22:03:17 tnn Exp $
BLAKE2s (cpu_features-0.6.0.tar.gz) = 4c59c3a8b3f9b5beefa5a39fb9cd760eec0f8e95b599954efe11c955042d6296
SHA512 (cpu_features-0.6.0.tar.gz) = 006a2e05253712cf605ecabccdda63dd9325445f8d145d5e2432c4342332e652f318810997321849be131082db435d88143020fdc85268fba204586cf37eef0d
Size (cpu_features-0.6.0.tar.gz) = 63255 bytes
SHA1 (patch-CMakeLists.txt) = a2eace73c45b85fac81b14d3e14b26b89cba74f2
SHA1 (patch-include_cpu__features__macros.h) = 4d93afe4ac314895f0823b992af463bf39d67379
SHA1 (patch-src_cpuinfo__x86.c) = 948cba79e96fdabfe5ec48780d5f6d5077018b4e
SHA1 (patch-src_cpuinfo__x86.c) = 91d43472c195f1db377231136725be676419bd0c

View file

@ -1,6 +1,7 @@
$NetBSD: patch-src_cpuinfo__x86.c,v 1.1 2020/12/14 15:07:49 tnn Exp $
$NetBSD: patch-src_cpuinfo__x86.c,v 1.2 2022/01/09 22:03:17 tnn Exp $
Use /proc/cpuinfo on NetBSD/x86 for now.
fix build on SunOS (just don't report any SSE support for now)
--- src/cpuinfo_x86.c.orig 2020-10-15 09:09:51.000000000 +0000
+++ src/cpuinfo_x86.c
@ -18,7 +19,16 @@ Use /proc/cpuinfo on NetBSD/x86 for now.
#include "internal/filesystem.h" // Needed to parse /proc/cpuinfo
#include "internal/stack_line_reader.h" // Needed to parse /proc/cpuinfo
#include "internal/string_view.h" // Needed to parse /proc/cpuinfo
@@ -1239,7 +1240,7 @@ static void DetectSseViaOs(X86Features*
@@ -106,6 +107,8 @@
#error "Darwin needs support for sysctlbyname"
#endif
#include <sys/sysctl.h>
+#elif defined(__sun__)
+#warning No support for SunOS
#else
#error "Unsupported OS"
#endif // CPU_FEATURES_OS
@@ -1239,7 +1242,7 @@ static void DetectSseViaOs(X86Features*
features->ssse3 = GetDarwinSysCtlByName("hw.optional.supplementalsse3");
features->sse4_1 = GetDarwinSysCtlByName("hw.optional.sse4_1");
features->sse4_2 = GetDarwinSysCtlByName("hw.optional.sse4_2");
@ -27,3 +37,12 @@ Use /proc/cpuinfo on NetBSD/x86 for now.
// Handling Linux platform through /proc/cpuinfo.
const int fd = CpuFeatures_OpenFile("/proc/cpuinfo");
if (fd >= 0) {
@@ -1264,6 +1267,8 @@ static void DetectSseViaOs(X86Features*
}
CpuFeatures_CloseFile(fd);
}
+#elif defined(__sun__)
+#warning No support for SunOS
#else
#error "Unsupported fallback detection of SSE OS support."
#endif