From: Greg Kroah-Hartman Date: Sat, 27 Apr 2019 13:53:27 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v4.9.172~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36509f81198142fbf349d028b7919c73c78f6217;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: kbuild-simplify-ld-option-implementation.patch --- diff --git a/queue-4.14/series b/queue-4.14/series new file mode 100644 index 00000000000..ec92ee65e6a --- /dev/null +++ b/queue-4.14/series @@ -0,0 +1 @@ +kbuild-simplify-ld-option-implementation.patch diff --git a/queue-4.4/kbuild-simplify-ld-option-implementation.patch b/queue-4.4/kbuild-simplify-ld-option-implementation.patch new file mode 100644 index 00000000000..78662135cb7 --- /dev/null +++ b/queue-4.4/kbuild-simplify-ld-option-implementation.patch @@ -0,0 +1,92 @@ +From 42f440aaf2cc0d0a0061b4e0bb716f93a5f030b8 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Fri, 23 Feb 2018 13:56:53 +0900 +Subject: kbuild: simplify ld-option implementation + +From: Masahiro Yamada + +commit 0294e6f4a0006856e1f36b8cd8fa088d9e499e98 upstream. + +Currently, linker options are tested by the coordination of $(CC) and +$(LD) because $(LD) needs some object to link. + +As commit 86a9df597cdd ("kbuild: fix linker feature test macros when +cross compiling with Clang") addressed, we need to make sure $(CC) +and $(LD) agree the underlying architecture of the passed object. + +This could be a bit complex when we combine tools from different groups. +For example, we can use clang for $(CC), but we still need to rely on +GCC toolchain for $(LD). + +So, I was searching for a way of standalone testing of linker options. +A trick I found is to use '-v'; this not only prints the version string, +but also tests if the given option is recognized. + +If a given option is supported, + + $ aarch64-linux-gnu-ld -v --fix-cortex-a53-843419 + GNU ld (Linaro_Binutils-2017.11) 2.28.2.20170706 + $ echo $? + 0 + +If unsupported, + + $ aarch64-linux-gnu-ld -v --fix-cortex-a53-843419 + GNU ld (crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04) 2.23.1 + aarch64-linux-gnu-ld: unrecognized option '--fix-cortex-a53-843419' + aarch64-linux-gnu-ld: use the --help option for usage information + $ echo $? + 1 + +Gold works likewise. + + $ aarch64-linux-gnu-ld.gold -v --fix-cortex-a53-843419 + GNU gold (Linaro_Binutils-2017.11 2.28.2.20170706) 1.14 + masahiro@pug:~/ref/linux$ echo $? + 0 + $ aarch64-linux-gnu-ld.gold -v --fix-cortex-a53-999999 + GNU gold (Linaro_Binutils-2017.11 2.28.2.20170706) 1.14 + aarch64-linux-gnu-ld.gold: --fix-cortex-a53-999999: unknown option + aarch64-linux-gnu-ld.gold: use the --help option for usage information + $ echo $? + 1 + +LLD too. + + $ ld.lld -v --gc-sections + LLD 7.0.0 (http://llvm.org/git/lld.git 4a0e4190e74cea19f8a8dc625ccaebdf8b5d1585) (compatible with GNU linkers) + $ echo $? + 0 + $ ld.lld -v --fix-cortex-a53-843419 + LLD 7.0.0 (http://llvm.org/git/lld.git 4a0e4190e74cea19f8a8dc625ccaebdf8b5d1585) (compatible with GNU linkers) + $ echo $? + 0 + $ ld.lld -v --fix-cortex-a53-999999 + ld.lld: error: unknown argument: --fix-cortex-a53-999999 + LLD 7.0.0 (http://llvm.org/git/lld.git 4a0e4190e74cea19f8a8dc625ccaebdf8b5d1585) (compatible with GNU linkers) + $ echo $? + 1 + +Signed-off-by: Masahiro Yamada +Tested-by: Nick Desaulniers +[nc: try-run-cached was added later, just use try-run, which is the + current mainline state] +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + scripts/Kbuild.include | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -156,9 +156,7 @@ cc-ldoption = $(call try-run,\ + + # ld-option + # Usage: LDFLAGS += $(call ld-option, -X) +-ld-option = $(call try-run,\ +- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \ +- $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) ++ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2)) + + # ar-option + # Usage: KBUILD_ARFLAGS := $(call ar-option,D) diff --git a/queue-4.4/series b/queue-4.4/series new file mode 100644 index 00000000000..ec92ee65e6a --- /dev/null +++ b/queue-4.4/series @@ -0,0 +1 @@ +kbuild-simplify-ld-option-implementation.patch diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..ec92ee65e6a --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1 @@ +kbuild-simplify-ld-option-implementation.patch