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 <[email protected]> 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/[email protected]/ Signed-off-by: Ihor Solodrai <[email protected]> --- 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 > >> >> [...] >
