Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/hwcaps_freebsd_or_openbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ const char* CpuFeatures_GetBasePlatformPointer(void);
#include <sys/auxv.h>

static unsigned long GetElfHwcapFromElfAuxInfo(int hwcap_type) {
unsigned long hwcap;
elf_aux_info(hwcap_type, &hwcap, sizeof(hwcap));
unsigned long hwcap = 0;
// elf_aux_info() leaves the output buffer untouched and returns non-zero when
// the requested entry is absent (e.g. AT_HWCAP2 on some arch/kernel combos),
// so return 0 instead of an indeterminate value.
if (elf_aux_info(hwcap_type, &hwcap, sizeof(hwcap)) != 0) return 0;
return hwcap;
}

Expand Down