arm: module: Allow modules outside of bl range
Unlike the Linux kernel, barebox does not have a dedicated heap for
storing modules. Therefore, if the system memory configuration places
the general heap further away than can be reached by a 'bl' instruction
(24 bits of address, or 16 MiB), then the module relocations will fail
due to being out of range.

Allocate PLTs when loading modules so that jumps and calls whose
targets are too far away for their relative offsets to be encoded
in the instructions themselves can be bounced via veneers in the
module's PLT. The modules will use slightly more memory, but after
rounding up to page size, the actual memory footprint is usually
the same.

Adoption of Linux commits:

66e94ba3c8ea ARM: kernel: avoid brute force search on PLT generation
1031a7e674d1 ARM: kernel: sort relocation sections before allocating PLTs
05123fef0982 ARM: kernel: allocate PLT entries only for external symbols
35fa91eed817 ARM: kernel: merge core and init PLTs
7d485f647c1f ARM: 8220/1: allow modules outside of bl range

Signed-off-by: David Dgien <dgienda125@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 4b7b828 commit c55d8cbfc9447f32cb0d880e23c42d4ad185fae5
@David Dgien David Dgien authored on 29 Jun 2020
Sascha Hauer committed on 1 Jul 2020
Showing 8 changed files
View
arch/arm/Kconfig
View
arch/arm/Makefile
View
arch/arm/cpu/Kconfig
View
arch/arm/include/asm/module.h
View
arch/arm/lib32/Makefile
View
arch/arm/lib32/module-plts.c 0 → 100644
View
arch/arm/lib32/module.c
View
arch/arm/lib32/module.lds 0 → 100644