From abd848c1c4182e3a1c8e7018565550e401a2cd6b Mon Sep 17 00:00:00 2001 From: Robert Clausecker Date: Sun, 21 Sep 2025 11:47:34 +0200 Subject: devel/cpu_features: port to aarch64 and armv7 These platforms works largely the same way as Linux, so adapt the existing Linux code path. Approved by: portmgr (build fix blanket) MFH: 2025Q3 --- devel/cpu_features/files/patch-src_hwcaps.c | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 devel/cpu_features/files/patch-src_hwcaps.c (limited to 'devel/cpu_features/files/patch-src_hwcaps.c') diff --git a/devel/cpu_features/files/patch-src_hwcaps.c b/devel/cpu_features/files/patch-src_hwcaps.c new file mode 100644 index 000000000000..4213c3b732de --- /dev/null +++ b/devel/cpu_features/files/patch-src_hwcaps.c @@ -0,0 +1,44 @@ +--- src/hwcaps.c.orig 2023-09-14 12:15:33 UTC ++++ src/hwcaps.c +@@ -55,12 +55,16 @@ const char* CpuFeatures_GetBasePlatformPointer(void); + // Implementation of GetElfHwcapFromGetauxval + //////////////////////////////////////////////////////////////////////////////// + +-#define AT_HWCAP 16 +-#define AT_HWCAP2 26 +-#define AT_PLATFORM 15 +-#define AT_BASE_PLATFORM 24 ++#if defined(CPU_FEATURES_OS_FREEBSD) ++#include ++static unsigned long GetElfHwcapFromGetauxval(uint32_t hwcap_type) { ++ unsigned long val = 0; + +-#if defined(HAVE_STRONG_GETAUXVAL) ++ elf_aux_info(hwcap_type, &val, sizeof val); ++ ++ return val; ++} ++#elif defined(HAVE_STRONG_GETAUXVAL) + #include + static unsigned long GetElfHwcapFromGetauxval(uint32_t hwcap_type) { + return getauxval(hwcap_type); +@@ -159,11 +163,19 @@ const char *CpuFeatures_GetPlatformPointer(void) { + } + + const char *CpuFeatures_GetPlatformPointer(void) { ++#ifdef AT_PLATFORM + return (const char *)GetHardwareCapabilitiesFor(AT_PLATFORM); ++#else ++ return NULL; ++#endif + } + + const char *CpuFeatures_GetBasePlatformPointer(void) { ++#ifdef AT_BASE_PLATFORM + return (const char *)GetHardwareCapabilitiesFor(AT_BASE_PLATFORM); ++#else ++ return NULL; ++#endif + } + + #endif // CPU_FEATURES_TEST -- cgit v1.2.3