* [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
@ 2026-06-30 20:54 Andrii Nakryiko
2026-07-01 12:53 ` Quentin Monnet
2026-07-01 18:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2026-06-30 20:54 UTC (permalink / raw)
To: bpf, qmo; +Cc: andrii, kernel-team
Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
started building the bootstrap libbpf with HOST_CFLAGS, stripping the
warning options that are unsuitable for that build by filtering out
-W -Wall -Wextra -Wformat -Wformat-signedness.
HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
what actually enables -Wformat), but leaves those two -Wformat-* children
in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
warns:
cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
cc1: warning: '-Wformat-security' ignored without '-Wformat'
The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
for the libbpf objects, so only libbpf's feature-detection probe (which
uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
so -Wall is never re-added and every bootstrap object warns.
Use a -Wformat% wildcard in the filter-out so the orphaned children are
removed together with the parent.
Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/bpf/bpftool/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 271a7dc77273..b0f7168e7943 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -99,7 +99,7 @@ endif
HOST_LDFLAGS := $(LDFLAGS)
# Remove warnings for libbpf bootstrap build
-LIBBPF_BOOTSTRAP_CFLAGS := $(filter-out -W -Wall -Wextra -Wformat -Wformat-signedness,$(HOST_CFLAGS))
+LIBBPF_BOOTSTRAP_CFLAGS := $(filter-out -W -Wall -Wextra -Wformat%,$(HOST_CFLAGS))
INSTALL ?= install
RM ?= rm -f
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
2026-06-30 20:54 [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build Andrii Nakryiko
@ 2026-07-01 12:53 ` Quentin Monnet
2026-07-01 18:15 ` Andrii Nakryiko
2026-07-01 18:20 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 6+ messages in thread
From: Quentin Monnet @ 2026-07-01 12:53 UTC (permalink / raw)
To: Andrii Nakryiko, bpf; +Cc: kernel-team
2026-06-30 13:54 UTC-0700 ~ Andrii Nakryiko <andrii@kernel.org>
> Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> started building the bootstrap libbpf with HOST_CFLAGS, stripping the
> warning options that are unsuitable for that build by filtering out
> -W -Wall -Wextra -Wformat -Wformat-signedness.
>
> HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
> and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
> what actually enables -Wformat), but leaves those two -Wformat-* children
> in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
> warns:
>
> cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
> cc1: warning: '-Wformat-security' ignored without '-Wformat'
>
> The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
> re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
> for the libbpf objects, so only libbpf's feature-detection probe (which
> uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
> libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
> instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
> so -Wall is never re-added and every bootstrap object warns.
>
> Use a -Wformat% wildcard in the filter-out so the orphaned children are
> removed together with the parent.
>
> Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Looks good, thank you.
Acked-by: Quentin Monnet <qmo@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
2026-07-01 12:53 ` Quentin Monnet
@ 2026-07-01 18:15 ` Andrii Nakryiko
2026-07-02 14:57 ` Quentin Monnet
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Nakryiko @ 2026-07-01 18:15 UTC (permalink / raw)
To: Quentin Monnet; +Cc: Andrii Nakryiko, bpf, kernel-team
On Wed, Jul 1, 2026 at 5:54 AM Quentin Monnet <qmo@kernel.org> wrote:
>
> 2026-06-30 13:54 UTC-0700 ~ Andrii Nakryiko <andrii@kernel.org>
> > Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> > started building the bootstrap libbpf with HOST_CFLAGS, stripping the
> > warning options that are unsuitable for that build by filtering out
> > -W -Wall -Wextra -Wformat -Wformat-signedness.
> >
> > HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
> > and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
> > what actually enables -Wformat), but leaves those two -Wformat-* children
> > in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
> > warns:
> >
> > cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
> > cc1: warning: '-Wformat-security' ignored without '-Wformat'
> >
> > The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
> > re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
> > for the libbpf objects, so only libbpf's feature-detection probe (which
> > uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
> > libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
> > instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
> > so -Wall is never re-added and every bootstrap object warns.
> >
> > Use a -Wformat% wildcard in the filter-out so the orphaned children are
> > removed together with the parent.
> >
> > Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> > Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>
>
> Looks good, thank you.
>
> Acked-by: Quentin Monnet <qmo@kernel.org>
thanks, applied to bpf-next, please do another bpftool sync when you
get a chance
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
2026-06-30 20:54 [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build Andrii Nakryiko
2026-07-01 12:53 ` Quentin Monnet
@ 2026-07-01 18:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-01 18:20 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, qmo, kernel-team
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 30 Jun 2026 13:54:18 -0700 you wrote:
> Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> started building the bootstrap libbpf with HOST_CFLAGS, stripping the
> warning options that are unsuitable for that build by filtering out
> -W -Wall -Wextra -Wformat -Wformat-signedness.
>
> HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
> and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
> what actually enables -Wformat), but leaves those two -Wformat-* children
> in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
> warns:
>
> [...]
Here is the summary with links:
- [bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
https://git.kernel.org/bpf/bpf-next/c/a954c9e3168c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
2026-07-01 18:15 ` Andrii Nakryiko
@ 2026-07-02 14:57 ` Quentin Monnet
2026-07-02 16:21 ` Andrii Nakryiko
0 siblings, 1 reply; 6+ messages in thread
From: Quentin Monnet @ 2026-07-02 14:57 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: Andrii Nakryiko, bpf, kernel-team
2026-07-01 11:15 UTC-0700 ~ Andrii Nakryiko <andrii.nakryiko@gmail.com>
> On Wed, Jul 1, 2026 at 5:54 AM Quentin Monnet <qmo@kernel.org> wrote:
>>
>> 2026-06-30 13:54 UTC-0700 ~ Andrii Nakryiko <andrii@kernel.org>
>>> Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
>>> started building the bootstrap libbpf with HOST_CFLAGS, stripping the
>>> warning options that are unsuitable for that build by filtering out
>>> -W -Wall -Wextra -Wformat -Wformat-signedness.
>>>
>>> HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
>>> and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
>>> what actually enables -Wformat), but leaves those two -Wformat-* children
>>> in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
>>> warns:
>>>
>>> cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
>>> cc1: warning: '-Wformat-security' ignored without '-Wformat'
>>>
>>> The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
>>> re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
>>> for the libbpf objects, so only libbpf's feature-detection probe (which
>>> uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
>>> libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
>>> instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
>>> so -Wall is never re-added and every bootstrap object warns.
>>>
>>> Use a -Wformat% wildcard in the filter-out so the orphaned children are
>>> removed together with the parent.
>>>
>>> Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
>>> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>>
>>
>> Looks good, thank you.
>>
>> Acked-by: Quentin Monnet <qmo@kernel.org>
>
> thanks, applied to bpf-next, please do another bpftool sync when you
> get a chance
Done now, it should be all sorted in the GitHub mirror. Thanks!
Quentin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build
2026-07-02 14:57 ` Quentin Monnet
@ 2026-07-02 16:21 ` Andrii Nakryiko
0 siblings, 0 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2026-07-02 16:21 UTC (permalink / raw)
To: Quentin Monnet; +Cc: Andrii Nakryiko, bpf, kernel-team
On Thu, Jul 2, 2026 at 7:57 AM Quentin Monnet <qmo@kernel.org> wrote:
>
> 2026-07-01 11:15 UTC-0700 ~ Andrii Nakryiko <andrii.nakryiko@gmail.com>
> > On Wed, Jul 1, 2026 at 5:54 AM Quentin Monnet <qmo@kernel.org> wrote:
> >>
> >> 2026-06-30 13:54 UTC-0700 ~ Andrii Nakryiko <andrii@kernel.org>
> >>> Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> >>> started building the bootstrap libbpf with HOST_CFLAGS, stripping the
> >>> warning options that are unsuitable for that build by filtering out
> >>> -W -Wall -Wextra -Wformat -Wformat-signedness.
> >>>
> >>> HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
> >>> and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
> >>> what actually enables -Wformat), but leaves those two -Wformat-* children
> >>> in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
> >>> warns:
> >>>
> >>> cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
> >>> cc1: warning: '-Wformat-security' ignored without '-Wformat'
> >>>
> >>> The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
> >>> re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
> >>> for the libbpf objects, so only libbpf's feature-detection probe (which
> >>> uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
> >>> libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
> >>> instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
> >>> so -Wall is never re-added and every bootstrap object warns.
> >>>
> >>> Use a -Wformat% wildcard in the filter-out so the orphaned children are
> >>> removed together with the parent.
> >>>
> >>> Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
> >>> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> >>
> >>
> >> Looks good, thank you.
> >>
> >> Acked-by: Quentin Monnet <qmo@kernel.org>
> >
> > thanks, applied to bpf-next, please do another bpftool sync when you
> > get a chance
>
>
> Done now, it should be all sorted in the GitHub mirror. Thanks!
>
Nice, finally warning-free wprof build :) Thanks!
> Quentin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-02 16:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 20:54 [PATCH bpf-next] bpftool: Strip all -Wformat* flags from bootstrap libbpf build Andrii Nakryiko
2026-07-01 12:53 ` Quentin Monnet
2026-07-01 18:15 ` Andrii Nakryiko
2026-07-02 14:57 ` Quentin Monnet
2026-07-02 16:21 ` Andrii Nakryiko
2026-07-01 18:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox