kumquat-buildroot/package/aircrack-ng/0001-Fix-compilation-without-getauxval.patch

82 lines
1.9 KiB
Diff
Raw Normal View History

From 0017bae95dbcf336495e36ac83c868ca1d7f2846 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 26 May 2018 22:52:30 +0200
Subject: [PATCH] Fix compilation without getauxval
Protect getauxval call and sys/auxv.h include by #ifdef HAS_AUXV in
trampoline_arm.c and trampoline_ppc.c.
Indeed, auxv is not available on some toolchains such as uclibc
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: merged (https://github.com/aircrack-ng/aircrack-ng/pull/1896)]
---
src/trampoline_arm.c | 4 ++++
src/trampoline_ppc.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/trampoline_arm.c b/src/trampoline_arm.c
index 45db82db..e653109a 100644
--- a/src/trampoline_arm.c
+++ b/src/trampoline_arm.c
@@ -17,8 +17,10 @@
*/
#if defined(__arm__) || defined(__aarch64__)
+#ifdef HAS_AUXV
#include <sys/auxv.h>
#include <asm/hwcap.h>
+#endif
#else
#error "The wrong CPU architecture file has been included."
#endif
@@ -39,6 +41,7 @@ int
simd_get_supported_features (void)
{
int result = 0;
+#ifdef HAS_AUXV
long hwcaps = getauxval (AT_HWCAP);
#if defined(HWCAP_ASIMD)
@@ -53,6 +56,7 @@ simd_get_supported_features (void)
{
result |= SIMD_SUPPORTS_NEON;
}
+#endif
#endif
return (result);
diff --git a/src/trampoline_ppc.c b/src/trampoline_ppc.c
index 0d439776..b5c0cb2b 100644
--- a/src/trampoline_ppc.c
+++ b/src/trampoline_ppc.c
@@ -17,8 +17,10 @@
*/
#if defined(__ppc__) || defined(__PPC__)
+#ifdef HAS_AUXV
#include <sys/auxv.h>
#include <bits/hwcap.h>
+#endif
#else
#error "The wrong CPU architecture file has been included."
#endif
@@ -39,6 +41,7 @@ int
simd_get_supported_features (void)
{
int result = 0;
+#ifdef HAS_AUXV
long hwcaps = getauxval (AT_HWCAP2);
#if defined(PPC_FEATURE2_ARCH_2_07)
@@ -46,6 +49,7 @@ simd_get_supported_features (void)
{
result |= SIMD_SUPPORTS_POWER8;
}
+#endif
#endif
return (result);
--
2.14.1