From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Alexei Starovoitov <ast@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 1/1] bpf: Disable -Wsuggest-attribute=format
Date: Mon, 15 Dec 2025 16:53:12 -0800 [thread overview]
Message-ID: <d80c77cf-c570-4f3b-960f-bbd2d0316fac@linux.dev> (raw)
In-Reply-To: <982ded3a-a973-4c2e-ae7e-af01d346d582@linux.dev>
On 12/15/25 4:11 PM, Ihor Solodrai wrote:
> On 12/10/25 5:12 AM, Andy Shevchenko wrote:
>> [...]
>> -obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o liveness.o
>> +obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o tnum.o log.o token.o liveness.o
>> +
>> +obj-$(CONFIG_BPF_SYSCALL) += helpers.o stream.o
>> +# The ____bpf_snprintf() uses the format string that triggers a compiler warning.
>> +CFLAGS_helpers.o += -Wno-suggest-attribute=format
>> +# The bpf_stream_vprintk_impl() uses the format string that triggers a compiler warning.
>> +CFLAGS_stream.o += -Wno-suggest-attribute=format
>
> Hi Andy,
>
> This flag does not exist in clang:
>
> $ LLVM=1 make -j$(nproc)
> [...]
> $ LLVM=1 make
> CALL scripts/checksyscalls.sh
> DESCEND objtool
> INSTALL libsubcmd_headers
> DESCEND bpf/resolve_btfids
> INSTALL libsubcmd_headers
> CC kernel/trace/bpf_trace.o
> error: unknown warning option '-Wno-suggest-attribute=format'; did you mean '-Wno-property-attribute-mismatch'? [-Werror,-Wunknown-warning-option]
> make[4]: *** [scripts/Makefile.build:287: kernel/trace/bpf_trace.o] Error 1
> make[3]: *** [scripts/Makefile.build:556: kernel/trace] Error 2
> make[2]: *** [scripts/Makefile.build:556: kernel] Error 2
> make[1]: *** [/home/isolodrai/kernels/bpf-next/Makefile:2030: .] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> We should probably conditionalize the flag addition in the makefile.
Just confirmed that the patch below fixes LLVM=1 build:
From 842b31ff3384df65bb6f13763464daa03ba4f025 Mon Sep 17 00:00:00 2001
From: Ihor Solodrai <isolodrai@meta.com>
Date: Mon, 15 Dec 2025 16:45:19 -0800
Subject: [PATCH] bpf: Ensure CC is set to GCC for
-Wno-suggest-attribute=format
LLVM=1 kernel build got broken because clang does not have
-Wno-suggest-attribute=format option.
Check for CONFIG_CC_IS_GCC before setting this option.
Fixes: ba34388912b5 ("bpf: Disable false positive -Wsuggest-attribute=format warning")
Closes: https://lore.kernel.org/bpf/20251210131234.3185985-1-andriy.shevchenko@linux.intel.com/
Signed-off-by: Ihor Solodrai <isolodrai@meta.com>
---
kernel/bpf/Makefile | 2 ++
kernel/trace/Makefile | 2 ++
2 files changed, 4 insertions(+)
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index d7bcdb1fd35a..7a33c701e5fb 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -17,8 +17,10 @@ obj-$(CONFIG_BPF_JIT) += trampoline.o
obj-$(CONFIG_BPF_SYSCALL) += btf.o memalloc.o rqspinlock.o stream.o
# Disable incorrect warning. bpf printf-like helpers cannot use
# gnu_printf attribute.
+ifeq ($(CONFIG_CC_IS_GCC),y)
CFLAGS_helpers.o += -Wno-suggest-attribute=format
CFLAGS_stream.o += -Wno-suggest-attribute=format
+endif
ifeq ($(CONFIG_MMU)$(CONFIG_64BIT),yy)
obj-$(CONFIG_BPF_SYSCALL) += arena.o range_tree.o
endif
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 5869c1f1af89..06705d6fed2c 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -90,7 +90,9 @@ obj-$(CONFIG_USER_EVENTS) += trace_events_user.o
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
# Disable incorrect warning. bpf printf-like helpers cannot use
# gnu_printf attribute.
+ifeq ($(CONFIG_CC_IS_GCC),y)
CFLAGS_bpf_trace.o += -Wno-suggest-attribute=format
+endif
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
obj-$(CONFIG_TRACEPOINTS) += error_report-traces.o
obj-$(CONFIG_TRACEPOINTS) += power-traces.o
--
2.47.3
>
> Or better yet, address the root cause as suggested in the thread.
>
> BPF CI is red on bpf branch at the moment:
> https://github.com/kernel-patches/bpf/actions/runs/20243520506/job/58144348281
>
>>
>> [...]
>
prev parent reply other threads:[~2025-12-16 0:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 13:12 [PATCH v1 1/1] bpf: Disable -Wsuggest-attribute=format Andy Shevchenko
2025-12-15 17:36 ` Andrii Nakryiko
2025-12-15 18:13 ` Alexei Starovoitov
2025-12-15 18:23 ` Andrii Nakryiko
2025-12-15 18:40 ` Alexei Starovoitov
2025-12-15 22:18 ` Steven Rostedt
2025-12-16 0:11 ` Ihor Solodrai
2025-12-16 0:53 ` Ihor Solodrai [this message]
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=d80c77cf-c570-4f3b-960f-bbd2d0316fac@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=andrii@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@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