]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Jan 2022 14:29:30 +0000 (15:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Jan 2022 14:29:30 +0000 (15:29 +0100)
added patches:
kbuild-add-kbuild_hostldflags-to-has_libelf-test.patch

queue-4.19/kbuild-add-kbuild_hostldflags-to-has_libelf-test.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/kbuild-add-kbuild_hostldflags-to-has_libelf-test.patch b/queue-4.19/kbuild-add-kbuild_hostldflags-to-has_libelf-test.patch
new file mode 100644 (file)
index 0000000..e24237c
--- /dev/null
@@ -0,0 +1,54 @@
+From f634ca650f724347892068489c7920631a3aac6a Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Thu, 22 Apr 2021 13:19:14 -0700
+Subject: kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit f634ca650f724347892068489c7920631a3aac6a upstream.
+
+Normally, invocations of $(HOSTCC) include $(KBUILD_HOSTLDFLAGS), which
+in turn includes $(HOSTLDFLAGS), which allows users to pass in their own
+flags when linking. However, the 'has_libelf' test does not, meaning
+that if a user requests a specific linker via HOSTLDFLAGS=-fuse-ld=...,
+it is not respected and the build might error.
+
+For example, if a user building with clang wants to use all of the LLVM
+tools without any GNU tools, they might remove all of the GNU tools from
+their system or PATH then build with
+
+$ make HOSTLDFLAGS=-fuse-ld=lld LLVM=1 LLVM_IAS=1
+
+which says use all of the LLVM tools, the integrated assembler, and
+ld.lld for linking host executables. Without this change, the build will
+error because $(HOSTCC) uses its default linker, rather than the one
+requested via -fuse-ld=..., which is GNU ld in clang's case in a default
+configuration.
+
+error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please
+install libelf-dev, libelf-devel or elfutils-libelf-devel
+make[1]: *** [Makefile:1260: prepare-objtool] Error 1
+
+Add $(KBUILD_HOSTLDFLAGS) to the 'has_libelf' test so that the linker
+choice is respected.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/479
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Paul Barker <paul.barker@sancloud.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -972,7 +972,7 @@ HOST_LIBELF_LIBS = $(shell pkg-config li
+ ifdef CONFIG_STACK_VALIDATION
+   has_libelf := $(call try-run,\
+-              echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
++              echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
+   ifeq ($(has_libelf),1)
+     objtool_target := tools/objtool FORCE
+   else
index a9ab6f7cc7e5561efeca5cb36cca93387174eaed..85e980325b4b82d80633861d41ad4387a0ab38af 100644 (file)
@@ -10,3 +10,4 @@ random-fix-data-race-on-crng_node_pool.patch
 random-fix-data-race-on-crng-init-time.patch
 staging-wlan-ng-avoid-bitwise-vs-logical-or-warning-in-hfa384x_usb_throttlefn.patch
 drm-i915-avoid-bitwise-vs-logical-or-warning-in-snb_wm_latency_quirk.patch
+kbuild-add-kbuild_hostldflags-to-has_libelf-test.patch