public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Ian Rogers" <irogers@google.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"James Clark" <james.clark@linaro.org>,
	"Kees Cook" <kees@kernel.org>, "Quentin Monnet" <qmo@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@fomichev.me>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@kernel.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Lukasz Luba" <lukasz.luba@arm.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"William Breathitt Gray" <wbg@kernel.org>,
	"Barry Song" <baohua@kernel.org>,
	"Qinxin Xia" <xiaqinxin@huawei.com>,
	"Bartosz Golaszewski" <brgl@kernel.org>,
	"Kent Gibson" <warthog618@gmail.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	"Wei Liu" <wei.liu@kernel.org>,
	"Dexuan Cui" <decui@microsoft.com>,
	"Long Li" <longli@microsoft.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Willy Tarreau" <w@1wt.eu>,
	"Josh Poimboeuf" <jpoimboe@kernel.org>,
	"Robert Moore" <robert.moore@intel.com>,
	"Len Brown" <lenb@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	"Tejun Heo" <tj@kernel.org>, "David Vernet" <void@manifault.com>,
	"Andrea Righi" <arighi@nvidia.com>,
	"Changwoo Min" <changwoo@igalia.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Gabriele Monaco" <gmonaco@redhat.com>,
	"Shuah Khan" <shuah@kernel.org>, "Jiri Kosina" <jikos@kernel.org>,
	"Benjamin Tissoires" <bentiss@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, bpf@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v4 29/30] selftests/nolibc: Append extra cflags
Date: Tue, 17 Mar 2026 11:00:49 +0000	[thread overview]
Message-ID: <20260317110049.GJ8048@e132581.arm.com> (raw)
In-Reply-To: <aacd52ed-4ef6-49f1-90a4-0affeea908e6@t-8ch.de>

On Mon, Mar 16, 2026 at 11:27:41PM +0100, Thomas Weißschuh wrote:
> On 2026-03-11 08:29:54+0000, Leo Yan wrote:
> > Include tools/scripts/Makefile.include, which may provide additional
> > flags in EXTRA_CFLAGS, and append to CFLAGS.
> > 
> > Since Makefile.include already defines cc-option, remove the redundant
> > definition and include.
> > 
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> >  tools/testing/selftests/nolibc/Makefile | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
> > index 0370489d938b540721a4fb814ebb68c463760e73..d1a9c1d5988bdc6a8778ef418aaa4c5ac1d26a10 100644
> > --- a/tools/testing/selftests/nolibc/Makefile
> > +++ b/tools/testing/selftests/nolibc/Makefile
> > @@ -3,15 +3,13 @@
> >  TEST_GEN_PROGS := nolibc-test libc-test
> >  
> >  include ../lib.mk
> > -include $(top_srcdir)/scripts/Makefile.compiler
> > -
> > -cc-option = $(call __cc-option, $(CC),,$(1),$(2))
> > +include $(top_srcdir)/tools/scripts/Makefile.include
> >  
> >  include Makefile.include
> >  
> >  $(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
> >  	 -isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
> > -	 $(CFLAGS_NOLIBC_TEST)
> > +	 $(CFLAGS_NOLIBC_TEST) $(EXTRA_CFLAGS)
> >  $(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
> >  $(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers
> 
> The rule for "libc-test", which uses the standard $(LINK.c) to invoke
> the compiler, does not respect $(EXTRA_CFLAGS) automatically.
> Is this intentional?

Thanks for the review. Is the change below OK with you? I can update it
before sending a new series.

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 0370489d938b..7b65e6f9840b 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -3,18 +3,17 @@
 TEST_GEN_PROGS := nolibc-test libc-test

 include ../lib.mk
-include $(top_srcdir)/scripts/Makefile.compiler
-
-cc-option = $(call __cc-option, $(CC),,$(1),$(2))
+include $(top_srcdir)/tools/scripts/Makefile.include

 include Makefile.include

 $(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
         -isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
-        $(CFLAGS_NOLIBC_TEST)
+        $(CFLAGS_NOLIBC_TEST) $(EXTRA_CFLAGS)
 $(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
 $(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers

+$(OUTPUT)/libc-test: CFLAGS += $(EXTRA_CFLAGS)
 $(OUTPUT)/libc-test: nolibc-test.c nolibc-test-linkage.c
        $(call msg,CC,,$@)
        $(Q)$(LINK.c) $^ -o $@

> It also affects all other users of lib.mk which
> don't have any custom cflags handling.

Many projects include lib.mk, but most do not include
tools/scripts/Makefile.include.  Without it, the appended EXTRA_CFLAGS
cannot be inherited.  This is why I did not touch those projects.

Appending EXTRA_CFLAGS in lib.mk may not be a good idea ? as such a
global change could break some builds.

Thanks,
Leo

  reply	other threads:[~2026-03-17 11:00 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11  8:29 [PATCH v4 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-11  8:29 ` [PATCH v4 01/30] tools: lib: thermal: Fix typo Leo Yan
2026-03-16 11:50   ` Daniel Lezcano
2026-03-11  8:29 ` [PATCH v4 02/30] tools/thermal: " Leo Yan
2026-03-16 11:51   ` Daniel Lezcano
2026-03-11  8:29 ` [PATCH v4 03/30] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
2026-03-16 11:51   ` Daniel Lezcano
2026-03-11  8:29 ` [PATCH v4 04/30] tools/thermal: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 05/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
2026-03-12 17:19   ` Ian Rogers
2026-03-13 15:56     ` Leo Yan
2026-03-13 16:07       ` Quentin Monnet
2026-03-13 16:24         ` Leo Yan
2026-03-13 16:26           ` Quentin Monnet
2026-03-11  8:29 ` [PATCH v4 06/30] libbpf: Remove duplicate $(CLANG_CROSS_FLAGS) Leo Yan
2026-03-11  9:02   ` bot+bpf-ci
2026-03-11  9:35     ` Leo Yan
2026-03-11  8:29 ` [PATCH v4 07/30] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
2026-03-16 10:18   ` Leo Yan
2026-03-16 14:17     ` Alexei Starovoitov
2026-03-11  8:29 ` [PATCH v4 08/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
2026-03-12 18:31   ` Namhyung Kim
2026-03-11  8:29 ` [PATCH v4 09/30] bpftool: Append extra host flags Leo Yan
2026-03-11  8:29 ` [PATCH v4 10/30] perf build: " Leo Yan
2026-03-12 18:31   ` Namhyung Kim
2026-03-11  8:29 ` [PATCH v4 11/30] tools/bpf: build: Append extra cflags Leo Yan
2026-03-11  8:29 ` [PATCH v4 12/30] tools build: Append extra host cflags Leo Yan
2026-03-12  0:29   ` Ian Rogers
2026-03-11  8:29 ` [PATCH v4 13/30] tools: bootconfig: Append extra cflags Leo Yan
2026-03-11  8:29 ` [PATCH v4 14/30] tools: counter: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 15/30] tools: dma: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 16/30] tools: gpio: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 17/30] tools: hv: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 18/30] tools: iio: " Leo Yan
2026-03-22 12:00   ` Jonathan Cameron
2026-03-11  8:29 ` [PATCH v4 19/30] tools: mm: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 20/30] tools: objtool: Append extra host cflags Leo Yan
2026-03-11  8:29 ` [PATCH v4 21/30] tools: power: acpi: Append extra cflags Leo Yan
2026-03-11  8:29 ` [PATCH v4 22/30] tools: power: x86/intel-speed-select: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 23/30] tools: sched_ext: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 24/30] tools: spi: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 25/30] tools: tracing: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 26/30] tools: usb: " Leo Yan
2026-03-11  8:29 ` [PATCH v4 27/30] selftests/bpf: " Leo Yan
2026-03-12 17:24   ` Ian Rogers
2026-03-13 16:11     ` Leo Yan
2026-03-11  8:29 ` [PATCH v4 28/30] selftests/hid: " Leo Yan
2026-03-13 13:33   ` Benjamin Tissoires
2026-03-11  8:29 ` [PATCH v4 29/30] selftests/nolibc: " Leo Yan
2026-03-16 22:27   ` Thomas Weißschuh
2026-03-17 11:00     ` Leo Yan [this message]
2026-03-11  8:29 ` [PATCH v4 30/30] selftests/sched_ext: " Leo Yan
2026-03-11  8:44 ` [PATCH v4 00/30] tools build: Append -fzero-init-padding-bits=all option Daniel Lezcano
2026-03-11  8:52   ` Jonathan Cameron
2026-03-11  9:23     ` Leo Yan
2026-03-11 18:35       ` Andrew Morton
2026-03-11  9:15   ` Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260317110049.GJ8048@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=andy@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=ast@kernel.org \
    --cc=baohua@kernel.org \
    --cc=bentiss@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brgl@kernel.org \
    --cc=broonie@kernel.org \
    --cc=changwoo@igalia.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=decui@microsoft.com \
    --cc=dlechner@baylibre.com \
    --cc=eddyz87@gmail.com \
    --cc=gmonaco@redhat.com \
    --cc=haiyangz@microsoft.com \
    --cc=haoluo@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kys@microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=llvm@lists.linux.dev \
    --cc=longli@microsoft.com \
    --cc=lukasz.luba@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=peterz@infradead.org \
    --cc=qmo@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rui.zhang@intel.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=w@1wt.eu \
    --cc=warthog618@gmail.com \
    --cc=wbg@kernel.org \
    --cc=wei.liu@kernel.org \
    --cc=xiaqinxin@huawei.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox