Maamoun TK maamoun.tk@googlemail.com writes:
the variables were never initialized to zero.
Current code:
fat-arm64.c:
--> unsigned long hwcap = 0;
#if USE_GETAUXVAL hwcap = getauxval(AT_HWCAP); #elif defined(HAVE_ELF_AUX_INFO) elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); #endif
fat-ppc.c:
--> unsigned long hwcap = 0; --> unsigned long hwcap2 = 0; # if USE_GETAUXVAL hwcap = getauxval(AT_HWCAP); hwcap2 = getauxval(AT_HWCAP2); # elif defined(HAVE_ELF_AUX_INFO) elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)); # elif defined(__FreeBSD__) size_t len; len = sizeof(hwcap); sysctlbyname("hw.cpu_features", &hwcap, &len, NULL, 0); len = sizeof(hwcap2); sysctlbyname("hw.cpu_features2", &hwcap2, &len, NULL, 0);
So I think this should work, under the assumption that elf_aux_info and sysctlbyname don't clobber their output buffers on error. Am I missing something?
Regards, /Niels