Re: [PATCH net-next 2/2] selftests: drv-net: Use cross-compilation environment for the io_uring check

From: Matthieu Baerts

Date: Tue Sep 01 2026 - 13:43:36 EST


Hi Maxime,

Thank you for looking at that.

On 01/09/2026 18:41, Maxime Chevallier (Netdev Foundation) wrote:
> To test for the presence of zerocopy support in the available liburing,
> a small check program is compiled.
>
> The CC value used for the io_uring library check defaults to the host
> compiler, which will fail in cross-compiling environments.
>
> Normally the CC for cross-compile is set in lib.mk, but this also
> requires the test list to be set when we include it, and this check
> needs to run first.
>
> Note that this doesn't cover the LLVM cross-compiling case though.

Maybe it is enough to just check if LLVM is set?
> Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@xxxxxxxxxxx>
> ---
> tools/testing/selftests/drivers/net/hw/Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
> index 78bb0169350b..0ebb4767cd57 100644
> --- a/tools/testing/selftests/drivers/net/hw/Makefile
> +++ b/tools/testing/selftests/drivers/net/hw/Makefile
> @@ -1,5 +1,8 @@
> # SPDX-License-Identifier: GPL-2.0+ OR MIT
>
> +# Set CC for the io_uring check
> +CC := $(CROSS_COMPILE)gcc

Could we have something similar to
tools/testing/selftests/riscv/cfi/Makefile:

# Set CC for the io_uring check done before including lib.mk
ifeq ($(LLVM)$(CC),cc)
CC := $(CROSS_COMPILE)gcc
endif

WDYT?

But that's possibly not needed for this simple check? I guess if gcc can
find liburing.h, clang should look at the same places.

> # Check if io_uring supports zero-copy receive
> HAS_IOURING_ZCRX := $(shell \
> echo -e '#include <liburing.h>\n' \

Cheers,
Matt