]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jun 2019 01:15:42 +0000 (09:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jun 2019 01:15:42 +0000 (09:15 +0800)
added patches:
arm64-don-t-unconditionally-add-wno-psabi-to-kbuild_cflags.patch

queue-5.1/arm64-don-t-unconditionally-add-wno-psabi-to-kbuild_cflags.patch [new file with mode: 0644]
queue-5.1/series

diff --git a/queue-5.1/arm64-don-t-unconditionally-add-wno-psabi-to-kbuild_cflags.patch b/queue-5.1/arm64-don-t-unconditionally-add-wno-psabi-to-kbuild_cflags.patch
new file mode 100644 (file)
index 0000000..907ca45
--- /dev/null
@@ -0,0 +1,104 @@
+From fa63da2ab046b885a7f70291aafc4e8ce015429b Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <natechancellor@gmail.com>
+Date: Tue, 11 Jun 2019 10:19:32 -0700
+Subject: arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+commit fa63da2ab046b885a7f70291aafc4e8ce015429b upstream.
+
+This is a GCC only option, which warns about ABI changes within GCC, so
+unconditionally adding it breaks Clang with tons of:
+
+warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
+
+and link time failures:
+
+ld.lld: error: undefined symbol: __efistub___stack_chk_guard
+>>> referenced by arm-stub.c:73
+(/home/nathan/cbl/linux/drivers/firmware/efi/libstub/arm-stub.c:73)
+>>>               arm-stub.stub.o:(__efistub_install_memreserve_table)
+in archive ./drivers/firmware/efi/libstub/lib.a
+
+These failures come from the lack of -fno-stack-protector, which is
+added via cc-option in drivers/firmware/efi/libstub/Makefile. When an
+unknown flag is added to KBUILD_CFLAGS, clang will noisily warn that it
+is ignoring the option like above, unlike gcc, who will just error.
+
+$ echo "int main() { return 0; }" > tmp.c
+
+$ clang -Wno-psabi tmp.c; echo $?
+warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
+1 warning generated.
+0
+
+$ gcc -Wsometimes-uninitialized tmp.c; echo $?
+gcc: error: unrecognized command line option
+‘-Wsometimes-uninitialized’; did you mean ‘-Wmaybe-uninitialized’?
+1
+
+For cc-option to work properly with clang and behave like gcc, -Werror
+is needed, which was done in commit c3f0d0bc5b01 ("kbuild, LLVMLinux:
+Add -Werror to cc-option to support clang").
+
+$ clang -Werror -Wno-psabi tmp.c; echo $?
+error: unknown warning option '-Wno-psabi'
+[-Werror,-Wunknown-warning-option]
+1
+
+As a consequence of this, when an unknown flag is unconditionally added
+to KBUILD_CFLAGS, it will cause cc-option to always fail and those flags
+will never get added:
+
+$ clang -Werror -Wno-psabi -fno-stack-protector tmp.c; echo $?
+error: unknown warning option '-Wno-psabi'
+[-Werror,-Wunknown-warning-option]
+1
+
+This can be seen when compiling the whole kernel as some warnings that
+are normally disabled (see below) show up. The full list of flags
+missing from drivers/firmware/efi/libstub are the following (gathered
+from diffing .arm64-stub.o.cmd):
+
+-fno-delete-null-pointer-checks
+-Wno-address-of-packed-member
+-Wframe-larger-than=2048
+-Wno-unused-const-variable
+-fno-strict-overflow
+-fno-merge-all-constants
+-fno-stack-check
+-Werror=date-time
+-Werror=incompatible-pointer-types
+-ffreestanding
+-fno-stack-protector
+
+Use cc-disable-warning so that it gets disabled for GCC and does nothing
+for Clang.
+
+Fixes: ebcc5928c5d9 ("arm64: Silence gcc warnings about arch ABI drift")
+Link: https://github.com/ClangBuiltLinux/linux/issues/511
+Reported-by: Qian Cai <cai@lca.pw>
+Acked-by: Dave Martin <Dave.Martin@arm.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/Makefile
++++ b/arch/arm64/Makefile
+@@ -51,7 +51,7 @@ endif
+ KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst)
+ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
+-KBUILD_CFLAGS += -Wno-psabi
++KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
+ KBUILD_AFLAGS += $(lseinstr) $(brokengasinst)
+ KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..09a48bd90ef7f4724a859cfd01425fbea0e7fc47 100644 (file)
@@ -0,0 +1 @@
+arm64-don-t-unconditionally-add-wno-psabi-to-kbuild_cflags.patch