Sashiko discussions
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1
       [not found] ` <20260408060017.9F21DC19424@smtp.kernel.org>
@ 2026-04-10  4:28   ` Namhyung Kim
  0 siblings, 0 replies; only message in thread
From: Namhyung Kim @ 2026-04-10  4:28 UTC (permalink / raw)
  To: sashiko; +Cc: linux-perf-users

Hi Sashiko! ;-)

On Wed, Apr 08, 2026 at 06:00:17AM +0000, sashiko-bot@kernel.org wrote:
> Sashiko AI review found 1 potential issue(s):
> - [Medium] Suppressing the missing-declarations warning instead of enabling Microsoft extensions causes Clang to silently drop anonymous fields from structures in `vmlinux.h`.
> --
> 
> commit 93aff8b1d8d6d53f0451d4c78852fef0b06314df
> Author: Namhyung Kim <namhyung@kernel.org>
> 
> perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1
> 
> This commit suppresses the missing-declarations warning by adding
> -Wno-missing-declarations when compiling BPF skeletons in perf.
> 
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -1249,7 +1249,7 @@ $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h
> >  	$(QUIET_CLANG)$(CLANG) -g -O2 -fno-stack-protector --target=bpf \
> >  	  $(CLANG_OPTIONS) $(EXTRA_BPF_FLAGS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
> >  	  -include $(OUTPUT)PERF-VERSION-FILE -include util/bpf_skel/perf_version.h \
> > -	  -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@
> > +	  -Wno-missing-declarations -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@
> 
> Does suppressing this warning instead of enabling Microsoft extensions cause
> Clang to silently drop anonymous fields from structures in vmlinux.h?
> 
> bpftool generates anonymous structs in vmlinux.h using a Microsoft extension.
> Without -fms-extensions, standard C treats these as empty forward declarations.
> Clang ignores them, effectively removing them from the struct layout and
> altering the structure's size and offsets.
> 
> By passing -Wno-missing-declarations instead of enabling the extension, could
> this hide the layout corruption? Any perf BPF programs relying on the size of
> such structs or performing non-CO-RE offset calculations might compute
> incorrect values, leading to verifier rejections or incorrect tracing
> statistics.
> 
> Would it be better to pass -fms-extensions and -Wno-microsoft-anon-tag to
> properly support this in Clang, mirroring the fix applied to BPF selftests in
> commit 835a50753579a?

Oh, it's good to know that there is a fix for that.  For some reason, I
cannot reproduce it anynmore.  But it'd be fine to have this fix anyway.

Thanhks,
Namhyung

> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260408055259.374744-1-namhyung@kernel.org?part=2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-10  4:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260408055259.374744-2-namhyung@kernel.org>
     [not found] ` <20260408060017.9F21DC19424@smtp.kernel.org>
2026-04-10  4:28   ` [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1 Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox