summaryrefslogtreecommitdiff
path: root/arch/riscv/Makefile
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@sifive.com>2018-04-03 06:43:14 +0300
committerPalmer Dabbelt <palmer@sifive.com>2018-04-03 06:43:14 +0300
commit7a8e7da42250138adf202ba2596ef7f68651060a (patch)
tree4b736dff3d2bd1b04fe7d6b1683350e6cc5f2df7 /arch/riscv/Makefile
parent2c9046b71bb6ce2386e8847fce92b18aca9127c4 (diff)
parente21d54219c7a698b10d5f1e6a1023ebde284cd7b (diff)
downloadlinux-7a8e7da42250138adf202ba2596ef7f68651060a.tar.xz
RISC-V: Fixes to module loading
This cleans up the module support that was commited earlier to work with what's actually emitted from our GCC port as it lands upstream. Most of the work here is adding new relocations to the kernel. There's some limitations on module loading imposed by the kernel: * The kernel doesn't support linker relaxation, which is necessary to support R_RISCV_ALIGN. In order to get reliable module building you're going to need to a GCC that supports the new '-mno-relax', which IIRC isn't going to be out until 8.1.0. It's somewhat unlikely that R_RISCV_ALIGN will appear in a module even without '-mno-relax' support, so issues shouldn't be common. * There is no large code model for RISC-V, which means modules must be loaded within a 32-bit signed offset of the kernel. We don't currently have any mechanism for ensuring this memory remains free or moving pages around, so issues here might be common. I fixed a singcle merge conflict in arch/riscv/kernel/Makefile.
Diffstat (limited to 'arch/riscv/Makefile')
-rw-r--r--arch/riscv/Makefile5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 899226e0da7d..76e958a5414a 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -59,6 +59,11 @@ endif
ifeq ($(CONFIG_CMODEL_MEDANY),y)
KBUILD_CFLAGS += -mcmodel=medany
endif
+ifeq ($(CONFIG_MODULE_SECTIONS),y)
+ KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/riscv/kernel/module.lds
+endif
+
+KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax)
# GCC versions that support the "-mstrict-align" option default to allowing
# unaligned accesses. While unaligned accesses are explicitly allowed in the