aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorBrad Smith <brad@comstyle.com>2024-09-09 06:34:42 -0400
committerBrad Smith <brad@comstyle.com>2024-09-09 07:17:49 -0400
commita3f79fd22a367207097c78e0a5d2bc213efe9f80 (patch)
tree6804b5a594319fb4ed0d78a3c127cbd6c9b9bf27 /libavutil
parent1709f3830e14d5f1a6c1ec78097545af1fcb45e8 (diff)
downloadffmpeg-a3f79fd22a367207097c78e0a5d2bc213efe9f80.tar.gz
aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support elf_aux_info(3). Signed-off-by: Brad Smith <brad@comstyle.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/aarch64/cpu.c2
-rw-r--r--libavutil/cpu.c9
2 files changed, 9 insertions, 2 deletions
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 <stdint.h>
#include <sys/auxv.h>
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 <unistd.h>
#endif
-#if HAVE_GETAUXVAL
+#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
#include <sys/auxv.h>
#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;