From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBAD933A9E9 for ; Tue, 17 Mar 2026 11:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773745253; cv=none; b=ZcV//M/2gitw2VaP420J+UjgbT0NDRP5qqi9/DN9Mp9tflkggZ1qj6+CWhSl2srt5iMR+A9Uvt8y2PGxbjRm0SkTS8i7XeEldhFiZ/sG83YZK280utiv4N68t6oZpqG9AOmCgeuLY1Wh6UK82iXIS1Lu8nySfUFLVjgYrT6uPDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773745253; c=relaxed/simple; bh=BR9kW5ZjiDDsV4GsKjKcwmYxCRLsI3jocIzjmmAqAm8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JpfsOPMyzzK/IgrNlslBGlSwXZ6IUTINvT2PKhXr3YeT5E+rhMlb0bYmQFSrm1xlUDJkAyPZC5Up/aCs3VzCtXYO8YFCbnxPYvjCguoMSFEIM+MpfLIbBZ8qCY0wI9f+otEKktbIbnwueJnC7YUtqUtAUfoLcOb/Nxsed26EB80= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4ABDF16F2; Tue, 17 Mar 2026 04:00:45 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 180843F7BD; Tue, 17 Mar 2026 04:00:51 -0700 (PDT) Date: Tue, 17 Mar 2026 11:00:49 +0000 From: Leo Yan To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim , James Clark , Kees Cook , Quentin Monnet , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Adrian Hunter , Masami Hiramatsu , William Breathitt Gray , Barry Song , Qinxin Xia , Bartosz Golaszewski , Kent Gibson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Andrew Morton , Willy Tarreau , Josh Poimboeuf , Robert Moore , Len Brown , Srinivas Pandruvada , Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Mark Brown , Steven Rostedt , Gabriele Monaco , Shuah Khan , Jiri Kosina , Benjamin Tissoires , 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 Message-ID: <20260317110049.GJ8048@e132581.arm.com> References: <20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com> <20260311-tools_build_fix_zero_init-v4-29-9e35bdb99cb3@arm.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 > > --- > > 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