On Tue, Aug 27, 2024 at 04:50:59PM +0200, Christophe Leroy wrote:
Le 27/08/2024 à 16:41, Xi Ruoyao a écrit :
On Tue, 2024-08-27 at 16:15 +0200, Jason A. Donenfeld wrote:
/* snip */
gcc -std=gnu99 -D_GNU_SOURCE= -isystem /home/zx2c4/Projects/random-linux/tools/testing/selftests/../../../tools/include -isystem /home/zx2c4/Projects/random-linux/tools/testing/selftests/../../../usr/include vdso_test_getrandom.c parse_vdso.c -o /home/zx2c4/Projects/random-linux/tools/testing/selftests/vDSO/vdso_test_getrandom vdso_test_getrandom.c:43:41: error: field ‘params’ has incomplete type 43 | struct vgetrandom_opaque_params params; | ^~~~~~
$ ls /home/zx2c4/Projects/random-linux/tools/testing/selftests/../../../usr/include headers_check.pl Makefile
Since I don't build in there, this directory is empty.
In the toplevel Makefile:
kselftest-%: headers FORCE $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
So running "make kselftest-all" to build the self tests should have already caused make to build the "headers" target, which puts the headers into usr/include.
I don't think it's supported to build self tests w/o invoking the toplevel Makefile: many other self tests use KHDR_INCLUDES as well, so generally building with something like "make -C tools/testing/selftests" just won't work.
My usr/include/ is also empty (only Makefile and headers_check.pl) and building directly in tools/testing/selftests/vDSO works for me.
The command is:
ppc-linux-gcc -std=gnu99 -D_GNU_SOURCE= -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../include/uapi vdso_test_getrandom.c parse_vdso.c -o /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_getrandom
I believe I get the needed headers through : -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../include/uapi
The effect of this patch is to replace include/uapi with usr/include, so it will break for you too.
What I'm wondering is why yours and mine work like that, while Ruoyao's breaks. He makes a good argument as to why this patch is the "right way", even if it breaks our workflow...
Christophe
PS: By the way, did you see the -DBULID_VDSO for the chacha test ? Don't know the impact though ....
Yes and https://lore.kernel.org/all/20240827145454.3317093-1-Jason@zx2c4.com/