From 8694449c7a90edbd94e8da5038631bce433f81bc Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 21 Sep 2026 14:19:25 +0800 Subject: [PATCH] kselftests-bpf: isolate target userspace compiler flags Passing target flags through EXTRA_CFLAGS leaks them into kernel module builds on Linux 6.6 and 6.12, causing ARM hard-float ABI mismatches in generated module objects. Linux 6.18 also forwards these flags to host tools, where the host compiler rejects them. Reuse SAN_CFLAGS, normally used for sanitizer options, to pass target flags to both userspace selftests and their target libbpf builds on Linux 6.6, 6.12 and 6.18. Host tools and kernel modules do not consume this variable. USERCFLAGS would only cover the selftests, leaving their libbpf builds without the target flags. This covers the targets built by this package; CROSS_BPFTOOL does not consume SAN_CFLAGS. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/25345 Signed-off-by: Robert Marko --- package/devel/kselftests-bpf/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/devel/kselftests-bpf/Makefile b/package/devel/kselftests-bpf/Makefile index 380e9fa270b..4e1d69b420b 100644 --- a/package/devel/kselftests-bpf/Makefile +++ b/package/devel/kselftests-bpf/Makefile @@ -42,10 +42,12 @@ MOD_TARGETS:= \ MAKE_PATH:=tools/testing/selftests/bpf +# Use SAN_CFLAGS to cover target libbpf as well as userspace selftests, +# without passing target flags to host tools or kernel modules. MAKE_VARS:= \ ARCH="$(LINUX_KARCH)" \ CROSS_COMPILE="$(TARGET_CROSS)" \ - EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + SAN_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ LDLIBS="$(TARGET_LDFLAGS)" \ TOOLCHAIN_INCLUDE="$(TOOLCHAIN_INC_DIRS)" \ KBUILD_OUTPUT="$(LINUX_DIR)"