Le 03/02/2025 à 14:50, Thomas Weißschuh a écrit :
On Mon, Feb 03, 2025 at 12:23:29PM +0100, Christophe Leroy wrote:
Le 03/02/2025 à 10:05, Thomas Weißschuh a écrit :
For testing the functionality of the vDSO, it is necessary to build userspace programs for multiple different architectures. It is additional work to acquire matching userspace cross-compilers with full C libraries and then building root images out of those. The kernel tree already contains nolibc, a small, header-only C library. By using it, it is possible to build userspace programs without any additional dependencies. For example the kernel.org crosstools or multi-target clang can be used to build test programs for a multitude of architectures. While nolibc is very limited, it is enough for many selftests. With some minor adjustments it is possible to make parse_vdso.c compatible with nolibc. As an example, vdso_standalone_test_x86 is now built from the same C code as the regular vdso_test_gettimeofday, while still being completely standalone.
This should probably go through the kselftest tree.
Not sure what are the expectations with this series.
In general it should also work for PPC, thanks for testing it.
I gave it a try with vdso_test_gettimeofday and get the following:
$ powerpc64-linux-gcc -nostdlib -nostdinc -ffreestanding -fno-asynchronous-unwind-tables -fno-stack-protector -include /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/nolibc.h -I/home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/ -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../usr/include -std=gnu99 -O2 -D_GNU_SOURCE= -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/uapi vdso_test_gettimeofday.c parse_vdso.c -o /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_gettimeofday
make: Entering directory '/home/chleroy/linux-powerpc/tools/testing/selftests/vDSO' powerpc64-linux-gcc -nostdlib -nostdinc -ffreestanding -fno-asynchronous-unwind-tables -fno-stack-protector -include /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/nolibc.h -I/home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/ -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../usr/include -std=gnu99 -O2 -D_GNU_SOURCE= -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/uapi vdso_test_gettimeofday.c parse_vdso.c -o /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_gettimeofday
This log is confusing. It contains traces of "make" output but no "make" invocation. I'm also not sure if there were two different compilations or only one. Can you give the full commandline? For your testing it should be enough to enable "vdso_test_standalone_x86" in the Makefile for PPC.
Well, yes I copied/pasted too much.
I made some hacky modifications to the Makefile but I forgot the '| header' pattern. With it added it works as expected.
Do you have any plan to get it work with nolibc for all test programs in selftests/vDSO, not only the standalone x86 test ?
Christophe