ARM: module: implement support for PC-relative group relocations
authorArd Biesheuvel <ardb@kernel.org>
Wed, 24 Nov 2021 17:56:22 +0000 (18:56 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 6 Dec 2021 11:49:16 +0000 (12:49 +0100)
commit1fa8c4b19543ae8c8894ec92a18696c9f9b03fc8
treecc6a2f523338f66bf6b59be8b91e3433e0f9baa4
parent831a469bc1674b7898984ce96f2902534445c0cf
ARM: module: implement support for PC-relative group relocations

Add support for the R_ARM_ALU_PC_Gn_NC and R_ARM_LDR_PC_G2 group
relocations [0] so we can use them in modules. These will be used to
load the current task pointer from a global variable without having to
rely on a literal pool entry to carry the address of this variable,
which may have a significant negative impact on cache utilization for
variables that are used often and in many different places, as each
occurrence will result in a literal pool entry and therefore a line in
the D-cache.

[0] 'ELF for the ARM architecture'
    https://github.com/ARM-software/abi-aa/releases

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
arch/arm/include/asm/elf.h
arch/arm/kernel/module.c