From: Namhyung Kim <namhyung@kernel.org>
To: sashiko@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1
Date: Thu, 9 Apr 2026 21:28:24 -0700 [thread overview]
Message-ID: <adh8aFYVspZmrLpZ@google.com> (raw)
In-Reply-To: <20260408060017.9F21DC19424@smtp.kernel.org>
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
next prev parent reply other threads:[~2026-04-10 4:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 5:52 [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Namhyung Kim
2026-04-08 5:52 ` [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1 Namhyung Kim
2026-04-08 6:00 ` sashiko-bot
2026-04-10 4:28 ` Namhyung Kim [this message]
2026-04-08 6:11 ` [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Ian Rogers
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=adh8aFYVspZmrLpZ@google.com \
--to=namhyung@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko@lists.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