summaryrefslogtreecommitdiffstats
path: root/debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch')
-rw-r--r--debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch b/debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch
new file mode 100644
index 000000000..037999c8d
--- /dev/null
+++ b/debian/patches/debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch
@@ -0,0 +1,83 @@
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Mon, 07 Sep 2020 03:38:04 +0100
+Subject: 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".
+---
+ Makefile | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -1083,18 +1083,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
+@@ -1106,16 +1094,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
+@@ -1239,6 +1217,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)