Re: [PATCH v3 27/30] selftests/bpf: Append extra cflags
From: Leo Yan
Date: Tue Mar 10 2026 - 13:54:17 EST
On Sun, Mar 08, 2026 at 04:46:32PM +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
>
> Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
FWIW, this patch causes bpf selftest build failure and was reported in:
https://github.com/kernel-patches/bpf/actions/runs/22825654003
The Makefile reuses CFLAGS for clang to build urandom_read, which may
cause GCC specific flags to feed to clang and causes errors.
The updated patch will introduce a new variable URANDOM_READ_CFLAGS,
without appending EXTRA_CFLAGS, this can effectively avoid incompatible
options.
Thanks,
Leo
> ---
> tools/testing/selftests/bpf/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 72a9ba41f95ebb825d25799c07ba3f0311243e45..29dfcdbe98c781b53f1e87dcebecf2027bafcd5d 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -49,6 +49,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
> srctree := $(patsubst %/,%,$(dir $(srctree)))
> endif
>
> +CFLAGS += $(EXTRA_CFLAGS)
> CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11 \
> -Wall -Werror -fno-omit-frame-pointer \
> -Wno-unused-but-set-variable \
>
> --
> 2.34.1
>