From: Greg Kroah-Hartman Date: Tue, 24 Mar 2020 10:44:22 +0000 (+0100) Subject: 5.5-stable patches X-Git-Tag: v4.19.113~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbfa38dffa08322127e6af4c232c780b6d65b964;p=thirdparty%2Fkernel%2Fstable-queue.git 5.5-stable patches added patches: kconfig-introduce-m32-flag-and-m64-flag.patch --- diff --git a/queue-5.5/kconfig-introduce-m32-flag-and-m64-flag.patch b/queue-5.5/kconfig-introduce-m32-flag-and-m64-flag.patch new file mode 100644 index 00000000000..bfda0486ff4 --- /dev/null +++ b/queue-5.5/kconfig-introduce-m32-flag-and-m64-flag.patch @@ -0,0 +1,80 @@ +From 8cc4fd73501d9f1370c3eebb70cfe8cc9e24062b Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Tue, 10 Mar 2020 19:12:49 +0900 +Subject: kconfig: introduce m32-flag and m64-flag + +From: Masahiro Yamada + +commit 8cc4fd73501d9f1370c3eebb70cfe8cc9e24062b upstream. + +When a compiler supports multiple architectures, some compiler features +can be dependent on the target architecture. + +This is typical for Clang, which supports multiple LLVM backends. +Even for GCC, we need to take care of biarch compiler cases. + +It is not a problem when we evaluate cc-option in Makefiles because +cc-option is tested against the flag in question + $(KBUILD_CFLAGS). + +The cc-option in Kconfig, on the other hand, does not accumulate +tested flags. Due to this simplification, it could potentially test +cc-option against a different target. + +At first, Kconfig always evaluated cc-option against the host +architecture. + +Since commit e8de12fb7cde ("kbuild: Check for unknown options with +cc-option usage in Kconfig and clang"), in case of cross-compiling +with Clang, the target triple is correctly passed to Kconfig. + +The case with biarch GCC (and native build with Clang) is still not +handled properly. We need to pass some flags to specify the target +machine bit. + +Due to the design, all the macros in Kconfig are expanded in the +parse stage, where we do not know the target bit size yet. + +For example, arch/x86/Kconfig allows a user to toggle CONFIG_64BIT. +If a compiler flag -foo depends on the machine bit, it must be tested +twice, one with -m32 and the other with -m64. + +However, -m32/-m64 are not always recognized. So, this commits adds +m64-flag and m32-flag macros. They expand to -m32, -m64, respectively +if supported. Or, they expand to an empty string if unsupported. + +The typical usage is like this: + + config FOO + bool + default $(cc-option,$(m64-flag) -foo) if 64BIT + default $(cc-option,$(m32-flag) -foo) + +This is clumsy, but there is no elegant way to handle this in the +current static macro expansion. + +There was discussion for static functions vs dynamic functions. +The consensus was to go as far as possible with the static functions. +(https://lkml.org/lkml/2018/3/2/22) + +Signed-off-by: Masahiro Yamada +Tested-by: George Spelvin +Reviewed-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/Kconfig.include | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/scripts/Kconfig.include ++++ b/scripts/Kconfig.include +@@ -40,3 +40,10 @@ $(error-if,$(success, $(LD) -v | grep -q + + # gcc version including patch level + gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) ++ ++# machine bit flags ++# $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise. ++# $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise. ++cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1)) ++m32-flag := $(cc-option-bit,-m32) ++m64-flag := $(cc-option-bit,-m64) diff --git a/queue-5.5/series b/queue-5.5/series index add91fd9aaa..1cd822fadc5 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -115,4 +115,5 @@ drm-i915-execlists-track-active-elements-during-dequeue.patch drm-i915-handle-all-mcr-ranges.patch staging-greybus-loopback_test-fix-potential-path-truncation.patch staging-greybus-loopback_test-fix-potential-path-truncations.patch +kconfig-introduce-m32-flag-and-m64-flag.patch int128-fix-__uint128_t-compiler-test-in-kconfig.patch