From: Haiyue Wang Date: Wed, 17 Dec 2025 08:02:31 +0000 (+0800) Subject: meson: fix BPF build warnings due to MS extensions X-Git-Tag: v259~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=568fe0294ddf273a6036fec6a4e9a962c036b5b4;p=thirdparty%2Fsystemd.git meson: fix BPF build warnings due to MS extensions Fix BPF program build warnings on Linux-6.19.0-rc1, more detail is [1]: A). clang-bpf [781/2458] Generating src/network/bpf/sysctl-monitor/sysctl-monitor.bpf.unstripped.o with a custom command In file included from ../src/network/bpf/sysctl-monitor/sysctl-monitor.bpf.c:3: ./vmlinux.h:60263:3: warning: declaration does not declare anything [-Wmissing-declarations] 60263 | struct ns_tree; | ^~~~~~~~~~~~~~ ./vmlinux.h:80251:2: warning: declaration does not declare anything [-Wmissing-declarations] 80251 | struct __fs_path; | ^~~~~~~~~~~~~~~~ ./vmlinux.h:96184:2: warning: declaration does not declare anything [-Wmissing-declarations] 96184 | struct freelist_tid; | ^~~~~~~~~~~~~~~~~~~ ./vmlinux.h:114441:2: warning: declaration does not declare anything [-Wmissing-declarations] 114441 | struct renamedata; | ^~~~~~~~~~~~~~~~~ ./vmlinux.h:118480:2: warning: declaration does not declare anything [-Wmissing-declarations] 118480 | union pipe_index; | ^~~~~~~~~~~~~~~~ ./vmlinux.h:130452:4: warning: declaration does not declare anything [-Wmissing-declarations] 130452 | struct freelist_counters; | ^~~~~~~~~~~~~~~~~~~~~~~~ 6 warnings generated. B). gcc-bpf meson setup -Dbpf-compiler=gcc build [1040/2458] Generating src/network/bpf/sysctl-monitor/sysctl-monitor.bpf.unstripped.o with a custom command In file included from ../src/network/bpf/sysctl-monitor/sysctl-monitor.bpf.c:3: ./vmlinux.h:60263:31: warning: declaration does not declare anything 60263 | struct ns_tree; | ^ ./vmlinux.h:80251:25: warning: declaration does not declare anything 80251 | struct __fs_path; | ^ ./vmlinux.h:96184:28: warning: declaration does not declare anything 96184 | struct freelist_tid; | ^ ./vmlinux.h:114441:26: warning: declaration does not declare anything 114441 | struct renamedata; | ^ ./vmlinux.h:118480:25: warning: declaration does not declare anything 118480 | union pipe_index; | ^ ./vmlinux.h:130452:49: warning: declaration does not declare anything 130452 | struct freelist_counters; | ^ [1] https://git.kernel.org/torvalds/c/639f58a0f480 "bpftool: Fix build warnings due to MS extensions" Signed-off-by: Haiyue Wang --- diff --git a/meson.build b/meson.build index 547543b9c55..4746146a986 100644 --- a/meson.build +++ b/meson.build @@ -1746,6 +1746,8 @@ if conf.get('BPF_FRAMEWORK') == 1 bpf_clang_flags = [ '-std=gnu17', '-Wno-compare-distinct-pointer-types', + '-Wno-microsoft-anon-tag', + '-fms-extensions', '-fno-stack-protector', '-O2', '-target', @@ -1756,6 +1758,7 @@ if conf.get('BPF_FRAMEWORK') == 1 bpf_gcc_flags = [ '-std=gnu17', + '-fms-extensions', '-fno-stack-protector', '-fno-ssa-phiopt', '-O2',