From: Ben Hutchings Date: Mon, 7 Sep 2020 02:38:04 +0000 (+0100) Subject: Makefile: Do not check for libelf when building OOT module X-Git-Tag: archive/raspbian/5.10.237-1+rpi1^2~30 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ce66d67f524a7aef62d9a148a0d943e65259e00b;p=linux.git Makefile: Do not check for libelf when building OOT module When building out-of-tree modules, the necessary tools should have already been built. We therefore do not need libelf-dev to be installed. This effectively reverts commit 9f0c18aec620 "objtool: Fix CONFIG_STACK_VALIDATION=y warning for out-of-tree modules", and similarly moves the check introduced by commit 33a57ce0a54d "bpf: Compile resolve_btfids tool at kernel compilation start". Gbp-Pq: Topic debian Gbp-Pq: Name makefile-do-not-check-for-libelf-when-building-oot-module.patch --- diff --git a/Makefile b/Makefile index 29b2d114b13..c10cda63534 100644 --- a/Makefile +++ b/Makefile @@ -1121,18 +1121,6 @@ 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) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) - -ifdef CONFIG_STACK_VALIDATION - ifeq ($(has_libelf),1) - objtool_target := tools/objtool FORCE - else - SKIP_STACK_VALIDATION := 1 - export SKIP_STACK_VALIDATION - endif -endif - PHONY += resolve_btfids_clean resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids @@ -1144,16 +1132,6 @@ ifneq ($(wildcard $(resolve_btfids_O)),) $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean endif -ifdef CONFIG_BPF -ifdef CONFIG_DEBUG_INFO_BTF - ifeq ($(has_libelf),1) - resolve_btfids_target := tools/bpf/resolve_btfids FORCE - else - ERROR_RESOLVE_BTFIDS := 1 - endif -endif # CONFIG_DEBUG_INFO_BTF -endif # CONFIG_BPF - PHONY += prepare0 export MODORDER := $(extmod-prefix)modules.order @@ -1275,6 +1253,28 @@ uapi-asm-generic: $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \ generic=include/uapi/asm-generic +has_libelf = $(call try-run,\ + echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) + +ifdef CONFIG_STACK_VALIDATION + ifeq ($(has_libelf),1) + objtool_target := tools/objtool FORCE + else + SKIP_STACK_VALIDATION := 1 + export SKIP_STACK_VALIDATION + endif +endif + +ifdef CONFIG_BPF +ifdef CONFIG_DEBUG_INFO_BTF + ifeq ($(has_libelf),1) + resolve_btfids_target := tools/bpf/resolve_btfids FORCE + else + ERROR_RESOLVE_BTFIDS := 1 + endif +endif # CONFIG_DEBUG_INFO_BTF +endif # CONFIG_BPF + PHONY += prepare-objtool prepare-resolve_btfids prepare-objtool: $(objtool_target) ifeq ($(SKIP_STACK_VALIDATION),1)