ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH] endian_switch01: Add HAVE_GETAUXVAL guarder
@ 2023-05-05 16:28 Petr Vorel
  2023-05-05 16:34 ` Jan Stancek
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2023-05-05 16:28 UTC (permalink / raw)
  To: ltp

From: Petr Vorel <petr.vorel@gmail.com>

This fixes compilation on uClibc / uClibc-ng (and also older glibc),
which does not provide this header.

Fixes: 03b76a20c ("endian_switch01.c: drop unused main4()")
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
Hi Jan,

can you please have a look, I'd prefer to merge this before release
(build fix on Buildroot).

Kind regards,
Petr

 testcases/kernel/syscalls/switch/endian_switch01.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/switch/endian_switch01.c b/testcases/kernel/syscalls/switch/endian_switch01.c
index d965aed56..fac9e2382 100644
--- a/testcases/kernel/syscalls/switch/endian_switch01.c
+++ b/testcases/kernel/syscalls/switch/endian_switch01.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) International Business Machines Corp., 2008
  * Copyright (c) Paul Mackerras, IBM Corp., 2008
- * Copyright (c) 2018 Linux Test Project
+ * Copyright (c) 2018-2023 Linux Test Project
  */
 
 /*
@@ -15,16 +15,20 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <elf.h>
-#include <sys/auxv.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+
 #include "tst_test.h"
 
 #if defined(__powerpc64__) || defined(__powerpc__)
+
 # ifndef PPC_FEATURE_TRUE_LE
-# define PPC_FEATURE_TRUE_LE              0x00000002
+#  define PPC_FEATURE_TRUE_LE              0x00000002
 # endif
 
+# ifdef HAVE_GETAUXVAL
+#  include <sys/auxv.h>
+
 /*
  * Make minimal call to 0x1ebe. If we get ENOSYS then syscall is not
  * available, likely because of:
@@ -98,6 +102,10 @@ static struct tst_test test = {
 	.forks_child = 1,
 };
 
+# else
+TST_TEST_TCONF("Toolchain does not have <sys/auxv.h>");
+# endif /* HAVE_GETAUXVAL */
+
 #else /* defined (__powerpc64__) || (__powerpc__) */
 TST_TEST_TCONF("This system does not support running of switch() syscall");
 #endif
-- 
2.40.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-12  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 16:28 [LTP] [PATCH] endian_switch01: Add HAVE_GETAUXVAL guarder Petr Vorel
2023-05-05 16:34 ` Jan Stancek
2023-05-05 16:36   ` Petr Vorel
2023-05-12  6:37     ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).