FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support elf_aux_info(3).
Unified · Split
| @@ -2367,6 +2367,7 @@ SYSTEM_FUNCS=" · 2366 unmodified lines | ||
| 2367 | 2367 | clock_gettime |
| 2368 | 2368 | closesocket |
| 2369 | 2369 | CommandLineToArgvW |
| 2370 | + elf_aux_info | |
| 2370 | 2371 | fcntl |
| 2371 | 2372 | getaddrinfo |
| 2372 | 2373 | getauxval |
| @@ -6579,6 +6580,7 @@ check_func_headers mach/mach_time.h mach_absolute_time · 4206 unmodified lines | ||
| 6579 | 6580 | check_func_headers stdlib.h getenv |
| 6580 | 6581 | check_func_headers sys/stat.h lstat |
| 6581 | 6582 | check_func_headers sys/auxv.h getauxval |
| 6583 | +check_func_headers sys/auxv.h elf_aux_info | |
| 6582 | 6584 | check_func_headers sys/sysctl.h sysctlbyname |
| 6583 | 6585 | |
| 6584 | 6586 | check_func_headers windows.h GetModuleHandle |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include "libavutil/cpu_internal.h" |
| 21 | 21 | #include "config.h" |
| 22 | 22 | |
| 23 | −#if (defined(__linux__) || defined(__ANDROID__)) && HAVE_GETAUXVAL | |
| 23 | +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO | |
| 24 | 24 | #include <stdint.h> |
| 25 | 25 | #include <sys/auxv.h> |
| 26 | 26 | |
| @@ -49,7 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #include <unistd.h> |
| 50 | 50 | #endif |
| 51 | 51 | |
| 52 | −#if HAVE_GETAUXVAL | |
| 52 | +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO | |
| 53 | 53 | #include <sys/auxv.h> |
| 54 | 54 | #endif |
| 55 | 55 | |
| @@ -292,6 +292,13 @@ unsigned long ff_getauxval(unsigned long type) · 236 unmodified lines | ||
| 292 | 292 | { |
| 293 | 293 | #if HAVE_GETAUXVAL |
| 294 | 294 | return getauxval(type); |
| 295 | +#elif HAVE_ELF_AUX_INFO | |
| 296 | + unsigned long aux = 0; | |
| 297 | + int ret = elf_aux_info(type, &aux, sizeof(aux)); | |
| 298 | + if (ret != 0) { | |
| 299 | + errno = ret; | |
| 300 | + } | |
| 301 | + return aux; | |
| 295 | 302 | #else |
| 296 | 303 | errno = ENOSYS; |
| 297 | 304 | return 0; |