[PATCH] samples/bpf: add -fms-extensions for CLANG-bpf builds

0 views
Skip to first unread message

ChenMiao

unread,
Feb 7, 2026, 6:33:13 PM (8 hours ago) Feb 7
to chao...@openatom.club, dz...@openatom.club, luo...@openatom.club, plu...@openatom.club, hust-os-ker...@googlegroups.com
From: Chen Miao <chen...@openatom.club>

While fixing make versioncheck output for a redundant
<linux/version.h> include in spintest.bpf.c, this exposed a separate
build issue in samples/bpf.

The CLANG-bpf pipeline compiling *_kern.c was missing -fms-extensions.
Recent namespace tree changes use anonymous members in struct ns_common
(e.g. "struct ns_tree;" inside a union). Without -fms-extensions, clang
treats that as an empty declaration and fails with:

error: no member named 'ns_id' in 'struct ns_common'
error: no member named '__ns_ref_active' in 'struct ns_common'

Add -fms-extensions to BPF_EXTRA_CFLAGS so the first
make M=samples/bpf run succeeds reliably.

Signed-off-by: Chen Miao <chen...@openatom.club>
---
samples/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 95a4fa1f1e447..27afbeb618c4b 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -208,6 +208,7 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \
/bin/rm -f ./llvm_btf_verify.o)

BPF_EXTRA_CFLAGS += -fno-stack-protector
+BPF_EXTRA_CFLAGS += -fms-extensions
ifneq ($(BTF_LLVM_PROBE),)
BPF_EXTRA_CFLAGS += -g
else
--
2.43.0

Reply all
Reply to author
Forward
0 new messages