Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags

From: Thomas Weißschuh

Date: Mon Mar 09 2026 - 18:25:06 EST


Hi Leo,

On 2026-03-08 16:46:34+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>
> ---
> tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
> index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
> --- a/tools/testing/selftests/nolibc/Makefile.nolibc
> +++ b/tools/testing/selftests/nolibc/Makefile.nolibc
> @@ -252,6 +252,9 @@ endif
> # Modify CFLAGS based on LLVM=
> include $(srctree)/tools/scripts/Makefile.include
>
> +# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
> +CFLAGS += $(EXTRA_CFLAGS)

Makefile.nolibc here is completely self-contained. It is not expected to
inherit any flags from the regular selftests. So I don't think this makes
sense. There is a similar, custom "CFLAGS_EXTRA" variable, which could
be aligned, but probably not as part of this series.

There is a regular 'Makefile' in this directory which *is* integrated
with the regular selftest build system. If you could make sure that
it works correctly with what you are doing, that would be great.


Thomas

> +
> REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
> /^Total number of errors:/{done++} \
> END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
>
> --
> 2.34.1
>