summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib32/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/lib32/module.c')
-rw-r--r--arch/arm/lib32/module.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/lib32/module.c b/arch/arm/lib32/module.c
index be7965d59c..3ded9896b7 100644
--- a/arch/arm/lib32/module.c
+++ b/arch/arm/lib32/module.c
@@ -64,6 +64,20 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
offset -= 0x04000000;
offset += sym->st_value - loc;
+
+ /*
+ * Route through a PLT entry if 'offset' exceeds the
+ * supported range. Note that 'offset + loc + 8'
+ * contains the absolute jump target, i.e.,
+ * @sym + addend, corrected for the +8 PC bias.
+ */
+ if (IS_ENABLED(CONFIG_ARM_MODULE_PLTS) &&
+ (offset <= (s32)0xfe000000 ||
+ offset >= (s32)0x02000000))
+ offset = get_module_plt(module, loc,
+ offset + loc + 8)
+ - loc - 8;
+
if (offset & 3 ||
offset <= (s32)0xfe000000 ||
offset >= (s32)0x02000000) {