Skip to content

Commit cc6fa77

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
selftests/bpf: Support out-of-tree vmlinux builds for VMLINUX_BTF
Add detection of out-of-tree built vmlinux image for the purpose of VMLINUX_BTF detection. According to Documentation/kbuild/kbuild.rst, O takes precedence over KBUILD_OUTPUT. Also ensure ~/path/to/build/dir also works by relying on wildcard's resolution first, but then applying $(abspath) at the end to also handle O=../../whatever cases. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200304184336.165766-1-andriin@fb.com
1 parent af73d78 commit cc6fa77

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎tools/testing/selftests/bpf/Makefile‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,13 @@ $(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
129129
$(call msg,CC,,$@)
130130
$(CC) -c $(CFLAGS) -o $@ $<
131131

132-
VMLINUX_BTF_PATHS := $(abspath ../../../../vmlinux) \
133-
/sys/kernel/btf/vmlinux \
134-
/boot/vmlinux-$(shell uname -r)
135-
VMLINUX_BTF:= $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))
132+
VMLINUX_BTF_PATHS := $(if $(O),$(O)/vmlinux) \
133+
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
134+
../../../../vmlinux \
135+
/sys/kernel/btf/vmlinux \
136+
/boot/vmlinux-$(shell uname -r)
137+
VMLINUX_BTF:= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
138+
136139
$(OUTPUT)/runqslower: $(BPFOBJ)
137140
$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
138141
OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF) \

0 commit comments

Comments
 (0)