[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210712174849.2202287-1-ben.dooks@codethink.co.uk>
Date: Mon, 12 Jul 2021 18:48:49 +0100
From: Ben Dooks <ben.dooks@...ethink.co.uk>
To: linux-kernel@...ts.codethink.co.uk, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Ben Dooks <ben.dooks@...ethink.co.uk>
Subject: [PATCH] riscv: add correct as-options for assembly in modules
When trying to load modules built for riscv which include assembly
the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'"
due to R_RISCV_ALIGN relocations being generated by the assembler.
In commit 7a8e7da42250138 ("RISC-V: Fixes to module loading")
the fix for gcc adds -mno-relax to the command line when building
C files. However this was never applied to assembly flags, and gcc
does no pass -mno-relax to gas when presented with a .S file.
The fix (other than making gcc always pass -mno-relax to gas) is
to add -Wa,-mno-relax to gcc to make sure the as is invoked with
the right options.
Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>
---
arch/riscv/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 1f5c03082976..fca40511a8c6 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -60,6 +60,7 @@ ifeq ($(CONFIG_PERF_EVENTS),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
--
2.30.2
Powered by blists - more mailing lists