bpf: Compile resolve_btfids tool at kernel compilation start
[upstream commit 33a57ce0a54d498275f432db04850001175dfdfa] The resolve_btfids tool will be used during the vmlinux linking, so it's necessary it's ready for it. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200711215329.41165-3-jolsa@kernel.org
This commit is contained in:
parent
56d43cd3f1
commit
951d13afa2
22
Makefile
22
Makefile
|
|
@ -1020,9 +1020,10 @@ export mod_sign_cmd
|
|||
|
||||
HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
|
||||
|
||||
has_libelf = $(call try-run,\
|
||||
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
||||
|
||||
ifdef CONFIG_STACK_VALIDATION
|
||||
has_libelf := $(call try-run,\
|
||||
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
||||
ifeq ($(has_libelf),1)
|
||||
objtool_target := tools/objtool FORCE
|
||||
else
|
||||
|
|
@ -1031,6 +1032,14 @@ ifdef CONFIG_STACK_VALIDATION
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DEBUG_INFO_BTF
|
||||
ifeq ($(has_libelf),1)
|
||||
resolve_btfids_target := tools/bpf/resolve_btfids FORCE
|
||||
else
|
||||
ERROR_RESOLVE_BTFIDS := 1
|
||||
endif
|
||||
endif
|
||||
|
||||
PHONY += prepare0
|
||||
|
||||
export MODORDER := $(extmod-prefix)modules.order
|
||||
|
|
@ -1135,7 +1144,7 @@ prepare0: archprepare
|
|||
$(Q)$(MAKE) $(build)=.
|
||||
|
||||
# All the preparing..
|
||||
prepare: prepare0 prepare-objtool
|
||||
prepare: prepare0 prepare-objtool prepare-resolve_btfids
|
||||
|
||||
# Support for using generic headers in asm-generic
|
||||
asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
|
||||
|
|
@ -1148,7 +1157,7 @@ uapi-asm-generic:
|
|||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
|
||||
generic=include/uapi/asm-generic
|
||||
|
||||
PHONY += prepare-objtool
|
||||
PHONY += prepare-objtool prepare-resolve_btfids
|
||||
prepare-objtool: $(objtool_target)
|
||||
ifeq ($(SKIP_STACK_VALIDATION),1)
|
||||
ifdef CONFIG_UNWINDER_ORC
|
||||
|
|
@ -1159,6 +1168,11 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
prepare-resolve_btfids: $(resolve_btfids_target)
|
||||
ifeq ($(ERROR_RESOLVE_BTFIDS),1)
|
||||
@echo "error: Cannot resolve BTF IDs for CONFIG_DEBUG_INFO_BTF, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
||||
@false
|
||||
endif
|
||||
# Generate some files
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ cpupower: FORCE
|
|||
cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE
|
||||
$(call descend,$@)
|
||||
|
||||
bpf/%: FORCE
|
||||
$(call descend,$@)
|
||||
|
||||
liblockdep: FORCE
|
||||
$(call descend,lib/lockdep)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue