Re: [PATCH v3 27/30] selftests/bpf: Append extra cflags

From: Ian Rogers

Date: Mon Mar 09 2026 - 14:10:27 EST


On Sun, Mar 8, 2026 at 9:50 AM Leo Yan <leo.yan@xxxxxxx> wrote:
>
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
>
> Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
> ---
> 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 \

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

> --
> 2.34.1
>