Re: [PATCH v4 06/30] libbpf: Remove duplicate $(CLANG_CROSS_FLAGS)
From: Leo Yan
Date: Wed Mar 11 2026 - 05:46:36 EST
On Wed, Mar 11, 2026 at 09:02:13AM +0000, bot+bpf-ci@xxxxxxxxxx wrote:
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index 168140f8e646..b1fbd0211c5e 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -84,7 +84,6 @@ 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)
>
> At this commit, doesn't this removal lose CLANG_CROSS_FLAGS entirely
> from the libbpf build?
>
> The libbpf Makefile includes Makefile.include at the top, which does
> append CLANG_CROSS_FLAGS to CFLAGS. But then the libbpf Makefile
> overwrites CFLAGS with :=
>
> CFLAGS := -g -O2
>
> which destroys everything Makefile.include appended. The removed line
> above was the only thing that re-added the cross-compile flags after
> that overwrite.
>
> The next commit in the series (233d70853154 "libbpf: Initialize CFLAGS
> before including Makefile.include") fixes this by moving the CFLAGS
> initialization before the include, so Makefile.include's addition
> survives. But at this commit, cross-compilation with Clang appears
> broken.
>
> Could these two patches be squashed or reordered so that the
> initialization move comes first?
To be honest, I feel much more comfortable being corrected by a human
rather than a bot :)
The comment is fair enough, I will squash the two patches.
Thanks,
Leo