android_kernel_motorola_sm6375/arch/riscv
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ben Dooks c3dc751184 riscv: add as-options for modules with assembly compontents
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 7a8e7da422
("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] 3b0a7d624e

Signed-off-by: Ben Dooks <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Fixes: ab1ef68e54 ("RISC-V: Add sections of PLT and GOT for kernel module")
Cc: [email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-07-29 17:14:08 +02:00
..
boot dts: phy: fix missing mdio device and probe failure of vsc8541-01 device 2021-01-27 11:47:45 +01:00
configs riscv: defconfig: enable gpio support for HiFive Unleashed 2021-01-27 11:47:45 +01:00
include riscv: Less inefficient gcc tishift helpers (and export their symbols) 2022-06-22 14:11:24 +02:00
kernel riscv module: remove (NOLOAD) 2022-04-15 14:18:31 +02:00
lib riscv: Less inefficient gcc tishift helpers (and export their symbols) 2022-06-22 14:11:24 +02:00
mm
net bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-09-15 09:47:38 +02:00
Kbuild
Kconfig riscv: Fix spelling mistake "SPARSEMEM" to "SPARSMEM" 2021-04-21 12:56:16 +02:00
Kconfig.debug
Kconfig.socs
Makefile riscv: add as-options for modules with assembly compontents 2022-07-29 17:14:08 +02:00