ARM: MMUless Core: Fix insmod error - module relocation out of range
PATCH 1/1 ARM: MMUless Core: Fix insmod error - module relocation out of range
From: Neha MAKHIJA <[email protected]>
ARM supports 32Mb jump. Hence branch instruction has a limited range.
For MMU systems, the module area is located just before the kernel memory because this allows function calls to be linked directly without any indirect branches.
In case of MMU-less system, Module area is given whole of the DDR address space. Since, module_alloc() calls vmalloc(), the module area goes outside the allowed jump range. Due to this insmod will not be able to load the modules giving out of range relocation errors.
Solution - Add the mlong-calls flags while compiling the modules. This tells the compiler to perform function calls by first loading the address of the function and then performing a subroutine function call on this register.
--- arch/arm/Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/Makefile +4 -0
@@ -112,6 +112,10 @@ CFLAGS_MODULE +=-fno-optimize-sibling-calls endif endif +ifeq ($(CONFIG_MMU),) +CFLAGS_MODULE +=-mlong-calls +endif + # Need -Uarm for gcc < 3.x KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
Signature · 1 line
1.7.5.4
PATCH 1/1 ARM: MMUless Core: Fix insmod error - module relocation out of range
Quoted 8 lines · Pratyush Anand
From: Neha MAKHIJA <[email protected]>
ARM supports 32Mb jump. Hence branch instruction has a limited range.
For MMU systems, the module area is located just before the kernel memory because this allows function calls to be linked directly without any indirect branches.
Quoted 8 lines
In case of MMU-less system, Module area is given whole of the DDR address space. Since,
module_alloc()callsvmalloc(), the module area goes outside the allowed jump range. Due to this insmod will not be able to load the modules giving out of range relocation errors.Solution - Add the mlong-calls flags while compiling the modules. This tells the compiler to perform function calls by first loading the address of the function and then performing a subroutine function call on this register.
Do we need the module loader to handle additional relocations or they are all already handled?
Signature · 1 line
Catalin
PATCH 1/1 ARM: MMUless Core: Fix insmod error - module relocation out of range
Quoted 14 lines · Catalin Marinas
Quoted 13 lines · Pratyush Anand
From: Neha MAKHIJA <[email protected]>
ARM supports 32Mb jump. Hence branch instruction has a limited range.
For MMU systems, the module area is located just before the kernel memory because this allows function calls to be linked directly without any indirect branches.
In case of MMU-less system, Module area is given whole of the DDR address space. Since,
module_alloc()callsvmalloc(), the module area goes outside the allowed jump range. Due to this insmod will not be able to load the modules giving out of range relocation errors.
Quoted 6 lines
Quoted 3 lines
Solution - Add the mlong-calls flags while compiling the modules. This tells the compiler to perform function calls by first loading the address of the function and then performing a subroutine function call on this register.
Do we need the module loader to handle additional relocations or they are all already handled?
I have explained this extensively when the 2.6 module loader came into being. It's not about additional relocations, it's about the addressible range of the 'b' instruction.
Please search the archives for the explanation.
PATCH 1/1 ARM: MMUless Core: Fix insmod error - module relocation out of range
Quoted 19 lines · Russell King - ARM Linux
Quoted 18 lines · Catalin Marinas
Quoted 16 lines · Pratyush Anand
From: Neha MAKHIJA <[email protected]>
ARM supports 32Mb jump. Hence branch instruction has a limited range.
For MMU systems, the module area is located just before the kernel memory because this allows function calls to be linked directly without any indirect branches.
In case of MMU-less system, Module area is given whole of the DDR address space. Since,
module_alloc()callsvmalloc(), the module area goes outside the allowed jump range. Due to this insmod will not be able to load the modules giving out of range relocation errors.Solution - Add the mlong-calls flags while compiling the modules. This tells the compiler to perform function calls by first loading the address of the function and then performing a subroutine function call on this register.
Quoted 6 lines
Quoted 2 lines
Do we need the module loader to handle additional relocations or they are all already handled?
I have explained this extensively when the 2.6 module loader came into being. It's not about additional relocations, it's about the addressible range of the 'b' instruction.
But doesn't -mlong-calls generate the function calls by first loading the address in a register?
Signature · 1 line
Catalin