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 DB8F383A14; Mon, 16 Mar 2026 10:18:03 +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=1773656285; cv=none; b=J2Nz/a/yUeKqcibAXiiFL1N3WA30do6PLq/rz/7Omp043mbxbWOV5gXCrrROiee+1I/HmPfO1wdQDDPtB6H2tgvwdBqfL32l7N4A4QFdN+LYxr1kN6wdv2x/HrCSk68/EQXOoTqE3Zka5G0lEkxipyiXuSWb5jEFUTiM6ZycYMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773656285; c=relaxed/simple; bh=c30q8cP+1tW7hMgKrmZODRuHGnO1oWLiLKKYH9vT2C8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tXVqCkEs09iLDfzGD7rSTlXB9+bIGIJCHgdgUKGRNap6YpVsr4TtR+e7xHDKZxe0PgZvRn26LAv8BOihsHpri5dZZjXj7cJBYQuX0bvVDTYMAk7GLLnBETHcotVlv5Y9kKDy4lJeZ36zYdXUQKTEcS3wCf45+z1B6BMqE9UAl+o= 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 422051477; Mon, 16 Mar 2026 03:17:57 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CAD483F73B; Mon, 16 Mar 2026 03:18:02 -0700 (PDT) Date: Mon, 16 Mar 2026 10:18:00 +0000 From: Leo Yan To: 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 , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , 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 Cc: 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 07/30] libbpf: Initialize CFLAGS before including Makefile.include Message-ID: <20260316101800.GB8048@e132581.arm.com> References: <20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com> <20260311-tools_build_fix_zero_init-v4-7-9e35bdb99cb3@arm.com> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260311-tools_build_fix_zero_init-v4-7-9e35bdb99cb3@arm.com> Hi BPF maintainers, On Wed, Mar 11, 2026 at 08:29:32AM +0000, Leo Yan wrote: > tools/scripts/Makefile.include may expand EXTRA_CFLAGS in a future > change. This could alter the initialization of CFLAGS, as the default > options "-g -O2" would never be set once EXTRA_CFLAGS is expanded. > > Prepare for this by moving the CFLAGS initialization before including > tools/scripts/Makefile.include, so it is not affected by the extended > EXTRA_CFLAGS. > > Append EXTRA_CFLAGS to CFLAGS only after including Makefile.include and > place it last so that the extra flags propagate properly and can > override the default options. > > Signed-off-by: Leo Yan Before sending a new version, I'd check if you have a chance to review the libbpf patches. The libbpf change is crucial for this series. Another reason for pinging because I received a bpf-ci report about test failures for this series [1]. The failures looks to be unrelated, as the tests fail starting from the first patch, which is irrelevant to BPF code [2]. I tried reaching kernel-ci@meta.com last week but haven't received a response yet. If bpf-ci testing is mandatory for libbpf patches, could you advise me on the correct workflow (e.g., whether the patches should be based on a specific branch)? Thanks. [1] https://github.com/kernel-patches/bpf/actions/runs/22944268645 [2] https://patchwork.kernel.org/project/netdevbpf/patch/20260311-tools_build_fix_zero_init-v4-1-9e35bdb99cb3@arm.com/ > --- > tools/lib/bpf/Makefile | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile > index b1fbd0211c5edde7be3d98630b16e53e028d9116..eca584fb061e16013e76827e4203f6be0477a73e 100644 > --- a/tools/lib/bpf/Makefile > +++ b/tools/lib/bpf/Makefile > @@ -49,6 +49,14 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))' > export man_dir man_dir_SQ INSTALL > export DESTDIR DESTDIR_SQ > > +# Defer assigning EXTRA_CFLAGS to CFLAGS until after including > +# tools/scripts/Makefile.include, as it may add flags to EXTRA_CFLAGS. > +ifdef EXTRA_CFLAGS > + CFLAGS := > +else > + CFLAGS := -g -O2 > +endif > + > include $(srctree)/tools/scripts/Makefile.include > > # copy a bit from Linux kbuild > @@ -70,13 +78,6 @@ LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION) > LIB_FILE = libbpf.a libbpf.so* > PC_FILE = libbpf.pc > > -# Set compile option CFLAGS > -ifdef EXTRA_CFLAGS > - CFLAGS := $(EXTRA_CFLAGS) > -else > - CFLAGS := -g -O2 > -endif > - > # Append required CFLAGS > override CFLAGS += -std=gnu89 > override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum > @@ -84,6 +85,7 @@ override CFLAGS += -Werror -Wall > override CFLAGS += $(INCLUDES) > override CFLAGS += -fvisibility=hidden > override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 > +override CFLAGS += $(EXTRA_CFLAGS) > > # flags specific for shared library > SHLIB_FLAGS := -DSHARED -fPIC > > -- > 2.34.1 >