arm_cpu_runtime_detection_code_on_openbsd.patch (1422B)
1 # HG changeset patch 2 # User Chun-Min Chang <chun.m.chang@gmail.com> 3 4 Bug 1888772 - Allow ARM CPU runtime detection code to build on OpenBSD 5 6 diff --git a/vpx_ports/aarch64_cpudetect.c b/vpx_ports/aarch64_cpudetect.c 7 --- a/vpx_ports/aarch64_cpudetect.c 8 +++ b/vpx_ports/aarch64_cpudetect.c 9 @@ -11,30 +11,30 @@ 10 #include "./vpx_config.h" 11 #include "vpx_ports/arm.h" 12 #include "vpx_ports/arm_cpudetect.h" 13 14 #if defined(__APPLE__) 15 #include <sys/sysctl.h> 16 #endif 17 18 -#if !CONFIG_RUNTIME_CPU_DETECT 19 +#if !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__) 20 21 static int arm_get_cpu_caps(void) { 22 // This function should actually be a no-op. There is no way to adjust any of 23 // these because the RTCD tables do not exist: the functions are called 24 // statically. 25 int flags = 0; 26 #if HAVE_NEON 27 flags |= HAS_NEON; 28 #endif // HAVE_NEON 29 return flags; 30 } 31 32 -#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT 33 +#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__) 34 35 // sysctlbyname() parameter documentation for instruction set characteristics: 36 // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics 37 static INLINE int64_t have_feature(const char *feature) { 38 int64_t feature_present = 0; 39 size_t size = sizeof(feature_present); 40 if (sysctlbyname(feature, &feature_present, &size, NULL, 0) != 0) { 41 return 0;