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.
Unified · Split
| @@ -129,10 +129,13 @@ $(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ) · 128 unmodified lines | |||
| 129 | $(call msg,CC,,$@) | 129 | $(call msg,CC,,$@) |
| 130 | $(CC) -c $(CFLAGS) -o $@ $< | 130 | $(CC) -c $(CFLAGS) -o $@ $< |
| 131 | 131 | ||
| 132 | VMLINUX_BTF_PATHS := $(abspath ../../../../vmlinux) \ | 132 | VMLINUX_BTF_PATHS := $(if $(O),$(O)/vmlinux) \ |
| 133 | /sys/kernel/btf/vmlinux \ | 133 | $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \ |
| 134 | /boot/vmlinux-$(shell uname -r) | 134 | ../../../../vmlinux \ |
| 135 | VMLINUX_BTF:= $(firstword $(wildcard $(VMLINUX_BTF_PATHS))) | 135 | /sys/kernel/btf/vmlinux \ |
| 136 | /boot/vmlinux-$(shell uname -r) | ||
| 137 | VMLINUX_BTF:= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))) | ||
| 138 | |||
| 136 | $(OUTPUT)/runqslower: $(BPFOBJ) | 139 | $(OUTPUT)/runqslower: $(BPFOBJ) |
| 137 | $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \ | 140 | $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \ |
| 138 | OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF) \ | 141 | OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF) \ |