From: Greg Kroah-Hartman Date: Sat, 23 Jul 2022 14:02:09 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.10.133~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=20f8a992e414af295df0162d3b0325f03e696be6;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: riscv-add-as-options-for-modules-with-assembly-compontents.patch --- diff --git a/queue-4.19/riscv-add-as-options-for-modules-with-assembly-compontents.patch b/queue-4.19/riscv-add-as-options-for-modules-with-assembly-compontents.patch new file mode 100644 index 00000000000..e6e049311f9 --- /dev/null +++ b/queue-4.19/riscv-add-as-options-for-modules-with-assembly-compontents.patch @@ -0,0 +1,48 @@ +From c1f6eff304e4dfa4558b6a8c6b2d26a91db6c998 Mon Sep 17 00:00:00 2001 +From: Ben Dooks +Date: Sun, 29 May 2022 16:22:00 +0100 +Subject: riscv: add as-options for modules with assembly compontents + +From: Ben Dooks + +commit c1f6eff304e4dfa4558b6a8c6b2d26a91db6c998 upstream. + +When trying to load modules built for RISC-V which include assembly files +the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'" +due to R_RISCV_ALIGN relocations being generated by the assembler. + +The R_RISCV_ALIGN relocations can be removed at the expense of code space +by adding -mno-relax to gcc and as. In commit 7a8e7da42250138 +("RISC-V: Fixes to module loading") -mno-relax is added to the build +variable KBUILD_CFLAGS_MODULE. See [1] for more info. + +The issue is that when kbuild builds a .S file, it invokes gcc with +the -mno-relax flag, but this is not being passed through to the +assembler. Adding -Wa,-mno-relax to KBUILD_AFLAGS_MODULE ensures that +the assembler is invoked correctly. This may have now been fixed in +gcc[2] and this addition should not stop newer gcc and as from working. + +[1] https://github.com/riscv/riscv-elf-psabi-doc/issues/183 +[2] https://github.com/gcc-mirror/gcc/commit/3b0a7d624e64eeb81e4d5e8c62c46d86ef521857 + +Signed-off-by: Ben Dooks +Reviewed-by: Bin Meng +Link: https://lore.kernel.org/r/20220529152200.609809-1-ben.dooks@codethink.co.uk +Fixes: ab1ef68e5401 ("RISC-V: Add sections of PLT and GOT for kernel module") +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/Makefile | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -66,6 +66,7 @@ ifeq ($(CONFIG_MODULE_SECTIONS),y) + endif + + KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) ++KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) + + # GCC versions that support the "-mstrict-align" option default to allowing + # unaligned accesses. While unaligned accesses are explicitly allowed in the