[RFC PATCH bpf-next v5 2/8] selftests/bpf: drop stale and no-op lines

Mykola Lysenko <[email protected]> Tue, 4 Aug 2026 10:01:50 -0700
Newsgroups org.kernel.vger.bpf
Message-ID <[email protected]>
Four target-specific lines name objects nothing builds. Three went
dead when commit afef88e65554 ("selftests/bpf: Store BPF object files
with .bpf.o extension") renamed the BPF objects; the
flow_dissector_load.o dependency names an intermediate the generic
one-step compile+link rule does not produce.

The '-fno-inline' pair (test_l4lb_noinline, test_xdp_noinline)
applied the flag until the rename; both programs have compiled
without it since, and nothing was lost: every function in them
carries a noinline annotation (the single __always_inline helper in
each is a deliberate exception the flag never overrode), and
compiling with -fno-inline restored yields byte-identical objects.

The two header dependencies with remaining value are redeclared in
working form. flow_dissector_load.h moves to the binary itself, which
is linked straight from its .c by the generic '$(OUTPUT)/%:%.c' rule
- editing the header now rebuilds it. cgroup_getset_retval_hooks.h -
added by commit e7215f574079 ("selftests/bpf: Make sure
bpf_{g,s}et_retval is exposed everywhere") days before the rename
orphaned it - is redeclared against the .bpf.o of every flavor: the
header lives in the top directory, outside the progs/*.h blanket
prerequisite, so editing it never rebuilt the BPF object. (Its
userspace consumer is tracked exactly by the compiler-generated
dependency files.)

'CURDIR := $(abspath .)' redefines make's builtin to the value it
already has; drop it too.

Signed-off-by: Mykola Lysenko <[email protected]>
---
 tools/testing/selftests/bpf/Makefile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 65c702613..69093fba3 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -6,7 +6,6 @@ include ../../../scripts/Makefile.include
 CXX ?= $(CROSS_COMPILE)g++
 OBJCOPY ?= $(CROSS_COMPILE)objcopy
 
-CURDIR := $(abspath .)
 TOOLSDIR := $(abspath ../../..)
 LIBDIR := $(TOOLSDIR)/lib
 BPFDIR := $(LIBDIR)/bpf
@@ -480,11 +479,14 @@ BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN)	\
 
 CLANG_CFLAGS = $(CLANG_SYS_INCLUDES)
 
-$(OUTPUT)/test_l4lb_noinline.o: BPF_CFLAGS += -fno-inline
-$(OUTPUT)/test_xdp_noinline.o: BPF_CFLAGS += -fno-inline
+$(OUTPUT)/flow_dissector_load: flow_dissector_load.h
 
-$(OUTPUT)/flow_dissector_load.o: flow_dissector_load.h
-$(OUTPUT)/cgroup_getset_retval_hooks.o: cgroup_getset_retval_hooks.h
+# progs/cgroup_getset_retval_hooks.c includes this top-directory header,
+# which the progs/*.h prerequisite of the BPF object rules does not
+# cover.
+$(addprefix $(OUTPUT)/,cgroup_getset_retval_hooks.bpf.o \
+	$(addsuffix /cgroup_getset_retval_hooks.bpf.o,$(TEST_INST_SUBDIRS))): \
+	cgroup_getset_retval_hooks.h
 
 # Build BPF object using Clang
 # $1 - input .c file
-- 
2.43.0