diff --git a/configure b/configure index a8e67d230c..d3bd46f382 100755 --- a/configure +++ b/configure @@ -2367,6 +2367,7 @@ SYSTEM_FUNCS=" clock_gettime closesocket CommandLineToArgvW + elf_aux_info fcntl getaddrinfo getauxval @@ -6579,6 +6580,7 @@ check_func_headers mach/mach_time.h mach_absolute_time check_func_headers stdlib.h getenv check_func_headers sys/stat.h lstat check_func_headers sys/auxv.h getauxval +check_func_headers sys/auxv.h elf_aux_info check_func_headers sys/sysctl.h sysctlbyname check_func_headers windows.h GetModuleHandle diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c index 084c81e999..7631d13de0 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -20,7 +20,7 @@ #include "libavutil/cpu_internal.h" #include "config.h" -#if (defined(__linux__) || defined(__ANDROID__)) && HAVE_GETAUXVAL +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO #include #include diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 61c1cf3faf..df00bd541f 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -49,7 +49,7 @@ #include #endif -#if HAVE_GETAUXVAL +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO #include #endif @@ -292,6 +292,13 @@ unsigned long ff_getauxval(unsigned long type) { #if HAVE_GETAUXVAL return getauxval(type); +#elif HAVE_ELF_AUX_INFO + unsigned long aux = 0; + int ret = elf_aux_info(type, &aux, sizeof(aux)); + if (ret != 0) { + errno = ret; + } + return aux; #else errno = ENOSYS; return 0;