public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1
@ 2026-04-08  5:52 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:11 ` [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Ian Rogers
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2026-04-08  5:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
  Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users

It should say binutils-dev(el) instead of plain binutils package as it's
mostly installed already and can confuse people like me. :)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index e6686641761fd0bf..ad5401eb720e9e78 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -923,7 +923,7 @@ ifdef BUILD_NONDISTRO
   $(call feature_check,libbfd-liberty-z)
 
   ifneq ($(feature-libbfd-threadsafe), 1)
-    $(error binutils 2.42 or later is required for non-distro builds)
+    $(error binutils-dev(el) 2.42 or later is required for non-distro builds)
   endif
 
   # we may be on a system that requires -liberty and (maybe) -lz
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1
  2026-04-08  5:52 [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Namhyung Kim
@ 2026-04-08  5:52 ` Namhyung Kim
  2026-04-08  6:00   ` sashiko-bot
  2026-04-08  6:11 ` [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Ian Rogers
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2026-04-08  5:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
  Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, bpf

On my system, `make GEN_VMLINUX_H=1` fails with a lot of error messages
like below:

  ./util/bpf_skel/vmlinux.h:134488:4: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
   134488 |                         struct freelist_counters;
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~
  make[2]: *** [Makefile.perf:1249: linux/tools/perf/util/bpf_skel/.tmp/lock_contention.bpf.o] Error 1

It seems clang doesn't like forward declarations in the current setting.
Let's suppress the warning by adding the no warning flags.

Cc: bpf@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index cee19c923c0607d2..a41e0dd34d8df660 100644
--- 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 $@
 
 $(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)
 	$(QUIET_GENSKEL)$(BPFTOOL) gen skeleton $< > $@
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] perf build: Add -Wno-missing-declarations for GEN_VMLINUX_H=1
  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
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-04-08  6:00 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-perf-users

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?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1
  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:11 ` Ian Rogers
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2026-04-08  6:11 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, James Clark, Jiri Olsa, Adrian Hunter,
	Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users

On Tue, Apr 7, 2026 at 10:53 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> It should say binutils-dev(el) instead of plain binutils package as it's
> mostly installed already and can confuse people like me. :)
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/Makefile.config | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index e6686641761fd0bf..ad5401eb720e9e78 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -923,7 +923,7 @@ ifdef BUILD_NONDISTRO
>    $(call feature_check,libbfd-liberty-z)
>
>    ifneq ($(feature-libbfd-threadsafe), 1)
> -    $(error binutils 2.42 or later is required for non-distro builds)
> +    $(error binutils-dev(el) 2.42 or later is required for non-distro builds)
>    endif
>
>    # we may be on a system that requires -liberty and (maybe) -lz
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-08  6:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-08  6:11 ` [PATCH 1/2] perf build: Update error message for BUILD_NONDISTRO=1 Ian Rogers

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