Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: bpf: fix bpf compilation with -fms-extensions

Similar to commit 835a50753579 ("selftests/bpf: Add -fms-extensions to
bpf build flags") and commit 639f58a0f480 ("bpftool: Fix build warnings
due to MS extensions")

The kernel is now built with -fms-extensions, therefore
generated vmlinux.h contains types like:
struct slab {
..
struct freelist_counters;
};

Use -fms-extensions and -Wno-microsoft-anon-tag flags
to build bpf programs that #include "vmlinux.h"

Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

+4 -2
+4 -2
drivers/hid/bpf/progs/Makefile
··· 56 56 57 57 %.bpf.o: %.bpf.c vmlinux.h $(BPFOBJ) | $(OUTPUT) 58 58 $(call msg,BPF,$@) 59 - $(Q)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(INCLUDES) \ 60 - -c $(filter %.c,$^) -o $@ && \ 59 + $(Q)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(INCLUDES) \ 60 + -Wno-microsoft-anon-tag \ 61 + -fms-extensions \ 62 + -c $(filter %.c,$^) -o $@ && \ 61 63 $(LLVM_STRIP) -g $@ 62 64 63 65 vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)