[PATCH 13/14] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers"

Thomas Weißschuh posted 14 patches 3 months, 1 week ago
[PATCH 13/14] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers"
Posted by Thomas Weißschuh 3 months, 1 week ago
This reverts commit c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers")

The kernel headers were used to make parse_vdso.c compatible with nolibc.
Unfortunately linux/elf.h is incompatible with glibc's sys/auxv.h.
When using glibc it is therefore not possible build parse_vdso.c as part of the
same compilation unit as its caller as sys/auxv.h is needed for getauxval().

In the meantime nolibc gained its own elf.h, providing compatibility with the
documented libc interfaces.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 tools/testing/selftests/vDSO/Makefile     | 2 --
 tools/testing/selftests/vDSO/parse_vdso.c | 3 +--
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index 12a0614b9fd4983deffe5d6a7cfa06ba8d92a516..67ead1ba6cb9c6d6088680a9c4d24a9d19f7231f 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -20,8 +20,6 @@ endif
 
 include ../lib.mk
 
-CFLAGS += $(TOOLS_INCLUDES)
-
 CFLAGS_NOLIBC := -nostdlib -nostdinc -ffreestanding -fno-asynchronous-unwind-tables \
 		 -fno-stack-protector -include $(top_srcdir)/tools/include/nolibc/nolibc.h \
 		 -I$(top_srcdir)/tools/include/nolibc/ $(KHDR_INCLUDES)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 3ff00fb624a44b964cc54954f1f088cabe11a901..c6ff4413ea367ae57bc6a60073314b29f938c99d 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -19,8 +19,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <limits.h>
-#include <linux/auxvec.h>
-#include <linux/elf.h>
+#include <elf.h>
 
 #include "parse_vdso.h"
 

-- 
2.50.0

Re: [PATCH 13/14] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers"
Posted by Thomas Gleixner 3 months ago
On Tue, Jul 01 2025 at 10:58, Thomas Weißschuh wrote:
> This reverts commit c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers")
>
> The kernel headers were used to make parse_vdso.c compatible with nolibc.
> Unfortunately linux/elf.h is incompatible with glibc's sys/auxv.h.
> When using glibc it is therefore not possible build parse_vdso.c as part of the
> same compilation unit as its caller as sys/auxv.h is needed for getauxval().
>
> In the meantime nolibc gained its own elf.h, providing compatibility with the
> documented libc interfaces.

I'm kinda surprised to find this here in this series. Isn't that commit
c9fbaa879508 obsolete since nolibc got it's own elf.h?

So this should just go straight to Linus, no?

Thanks,

        tglx
Re: [PATCH 13/14] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers"
Posted by Thomas Weißschuh 3 months ago
On Sun, Jul 06, 2025 at 10:43:47PM +0200, Thomas Gleixner wrote:
> On Tue, Jul 01 2025 at 10:58, Thomas Weißschuh wrote:
> > This reverts commit c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers")
> >
> > The kernel headers were used to make parse_vdso.c compatible with nolibc.
> > Unfortunately linux/elf.h is incompatible with glibc's sys/auxv.h.
> > When using glibc it is therefore not possible build parse_vdso.c as part of the
> > same compilation unit as its caller as sys/auxv.h is needed for getauxval().
> >
> > In the meantime nolibc gained its own elf.h, providing compatibility with the
> > documented libc interfaces.
> 
> I'm kinda surprised to find this here in this series. Isn't that commit
> c9fbaa879508 obsolete since nolibc got it's own elf.h?

Correct.

> So this should just go straight to Linus, no?

It could. But the next patch of this series depends on it for now.
So to avoid ordering issues I kept both patches together.


Thomas