BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leo Yan" <leo.yan@arm.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 4/8] libbpf: Initialize CFLAGS before including Makefile.include
Date: Tue, 02 Jun 2026 15:11:34 +0000	[thread overview]
Message-ID: <20260602151135.29F3D1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602-tools_build_fix_zero_init_bpf_only-v2-4-c76e5250ea1c@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Removal of `override CFLAGS += $(CLANG_CROSS_FLAGS)` breaks Clang cross-compilation when `CFLAGS` is overridden on the command line.
--

commit 6aa5adddfad905f5f29ccfe28312c5a00d2d1082
Author: Leo Yan <leo.yan@arm.com>

libbpf: Initialize CFLAGS before including Makefile.include

This commit reorders CFLAGS initialization to happen before including
Makefile.include so it is not affected by expanded EXTRA_CFLAGS. It also
removes the appending of CLANG_CROSS_FLAGS, citing redundancy with the
include file.

> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 168140f8e6461..eca584fb061e1 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile

[ ... ]

> @@ -84,7 +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 += $(CLANG_CROSS_FLAGS)
> +override CFLAGS += $(EXTRA_CFLAGS)

[Severity: Medium]
Does removing this override directive break Clang cross-compilation when
CFLAGS is overridden on the command line?

While tools/scripts/Makefile.include already appends $(CLANG_CROSS_FLAGS),
it uses a standard assignment. According to GNU Make semantics, standard
assignments are ignored if a variable is overridden via the command line
(e.g., make CFLAGS="-O3").

By removing the override directive here, the build system might fail to
unconditionally append cross-compilation flags (like --target= and
--sysroot=), causing Clang to fall back to compiling for the host
architecture instead of the intended target.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-tools_build_fix_zero_init_bpf_only-v2-0-c76e5250ea1c@arm.com?part=4

  reply	other threads:[~2026-06-02 15:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 14:47 [PATCH bpf-next v2 0/8] tools build: bpf: Append EXTRA_CFLAGS and HOST_EXTRACFLAGS Leo Yan
2026-06-02 14:47 ` [PATCH bpf-next v2 1/8] bpftool: Pass host flags to bootstrap libbpf Leo Yan
2026-06-03  9:21   ` Quentin Monnet
2026-06-02 14:47 ` [PATCH bpf-next v2 2/8] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
2026-06-02 14:47 ` [PATCH bpf-next v2 3/8] bpftool: Append extra host flags Leo Yan
2026-06-02 14:47 ` [PATCH bpf-next v2 4/8] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
2026-06-02 15:11   ` sashiko-bot [this message]
2026-06-02 14:47 ` [PATCH bpf-next v2 5/8] tools/bpf: build: Append extra cflags Leo Yan
2026-06-13  1:09   ` Ihor Solodrai
2026-06-02 14:47 ` [PATCH bpf-next v2 6/8] selftests/bpf: Initialize operation name before use Leo Yan
2026-06-13  1:11   ` Ihor Solodrai
2026-06-02 14:47 ` [PATCH bpf-next v2 7/8] selftests/bpf: Use common CFLAGS for urandom_read Leo Yan
2026-06-02 15:32   ` bot+bpf-ci
2026-06-02 17:25   ` sashiko-bot
2026-06-13  1:37     ` Ihor Solodrai
2026-06-02 14:47 ` [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds Leo Yan
2026-06-02 17:33   ` sashiko-bot

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=20260602151135.29F3D1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leo.yan@arm.com \
    --cc=sashiko-reviews@lists.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