]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 20:54:02 +0000 (21:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 20:54:02 +0000 (21:54 +0100)
added patches:
kbuild-fix-linker-feature-test-macros-when-cross-compiling-with-clang.patch

queue-4.14/kbuild-fix-linker-feature-test-macros-when-cross-compiling-with-clang.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/kbuild-fix-linker-feature-test-macros-when-cross-compiling-with-clang.patch b/queue-4.14/kbuild-fix-linker-feature-test-macros-when-cross-compiling-with-clang.patch
new file mode 100644 (file)
index 0000000..7b649aa
--- /dev/null
@@ -0,0 +1,71 @@
+From 86a9df597cdd564d2d29c65897bcad42519e3678 Mon Sep 17 00:00:00 2001
+From: Nick Desaulniers <ndesaulniers@google.com>
+Date: Mon, 6 Nov 2017 10:47:54 -0800
+Subject: kbuild: fix linker feature test macros when cross compiling with Clang
+
+From: Nick Desaulniers <ndesaulniers@google.com>
+
+commit 86a9df597cdd564d2d29c65897bcad42519e3678 upstream.
+
+I was not seeing my linker flags getting added when using ld-option when
+cross compiling with Clang. Upon investigation, this seems to be due to
+a difference in how GCC vs Clang handle cross compilation.
+
+GCC is configured at build time to support one backend, that is implicit
+when compiling.  Clang is explicit via the use of `-target <triple>` and
+ships with all supported backends by default.
+
+GNU Make feature test macros that compile then link will always fail
+when cross compiling with Clang unless Clang's triple is passed along to
+the compiler. For example:
+
+$ clang -x c /dev/null -c -o temp.o
+$ aarch64-linux-android/bin/ld -E temp.o
+aarch64-linux-android/bin/ld:
+unknown architecture of input file `temp.o' is incompatible with
+aarch64 output
+aarch64-linux-android/bin/ld:
+warning: cannot find entry symbol _start; defaulting to
+0000000000400078
+$ echo $?
+1
+
+$ clang -target aarch64-linux-android- -x c /dev/null -c -o temp.o
+$ aarch64-linux-android/bin/ld -E temp.o
+aarch64-linux-android/bin/ld:
+warning: cannot find entry symbol _start; defaulting to 00000000004002e4
+$ echo $?
+0
+
+This causes conditional checks that invoke $(CC) without the target
+triple, then $(LD) on the result, to always fail.
+
+Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Greg Hackmann <ghackmann@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ scripts/Kbuild.include |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/scripts/Kbuild.include
++++ b/scripts/Kbuild.include
+@@ -160,12 +160,13 @@ cc-if-fullversion = $(shell [ $(cc-fullv
+ # cc-ldoption
+ # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
+ cc-ldoption = $(call try-run,\
+-      $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
++      $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
+ # ld-option
+ # Usage: LDFLAGS += $(call ld-option, -X)
+ ld-option = $(call try-run,\
+-      $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
++      $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \
++      $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+ # ar-option
+ # Usage: KBUILD_ARFLAGS := $(call ar-option,D)
index 47d215b5d320485b7ad6c11c3be60f7b52067fa9..0685d509399b91516e25caece4d3b540c5d5e238 100644 (file)
@@ -73,3 +73,4 @@ rdma-core-do-not-use-invalid-destination-in-determining-port-reuse.patch
 clk-migrate-the-count-of-orphaned-clocks-at-init.patch
 rdma-ucma-fix-access-to-non-initialized-cm_id-object.patch
 rdma-ucma-don-t-allow-join-attempts-for-unsupported-af-family.patch
+kbuild-fix-linker-feature-test-macros-when-cross-compiling-with-clang.patch