RISC-V: Fixes to module loading
authorPalmer Dabbelt <palmer@sifive.com>
Tue, 3 Apr 2018 03:43:14 +0000 (20:43 -0700)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 3 Apr 2018 03:43:14 +0000 (20:43 -0700)
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.

1  2 
arch/riscv/Kconfig
arch/riscv/Makefile
arch/riscv/kernel/Makefile

Simple merge
Simple merge
@@@ -34,8 -34,8 +34,9 @@@ CFLAGS_setup.o := -mcmodel=medan
  obj-$(CONFIG_SMP)             += smpboot.o
  obj-$(CONFIG_SMP)             += smp.o
  obj-$(CONFIG_MODULES)         += module.o
 -obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
 -obj-$(CONFIG_FUNCTION_GRAPH_TRACER)   += ftrace.o
+ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
 +
 +obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
 +obj-$(CONFIG_DYNAMIC_FTRACE)  += mcount-dyn.o
  
  clean: