Skip to contentSkip to conversation

arm: module: add support for R_ARM_REL32 relocations

PATCH New Ard Biesheuvel 2 participants 3 messages Jan 19, 2017 – Jan 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: module: add support for R_ARM_REL32 relocations

Add support for R_ARM_REL32 relocations in the module loader, which will be used by the modversions code when (if) it switches to using relative references to refer to CRC values.

---
 arch/arm/include/asm/elf.h | 1 +
 arch/arm/kernel/module.c   | 4 ++++
 2 files changed, 5 insertions(+)
arch/arm/include/asm/elf.h +1 -0
index d2315ffd8f12..d450a59ca121 100644
@@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t;
 #define R_ARM_NONE		0
 #define R_ARM_PC24		1
 #define R_ARM_ABS32		2
+#define R_ARM_REL32		3
 #define R_ARM_CALL		28
 #define R_ARM_JUMP24		29
 #define R_ARM_TARGET1		38
arch/arm/kernel/module.c +4 -0
index 4f14b5ce6535..29629fe02ce5 100644
@@ -159,6 +159,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
 			*(u32 *)loc = offset & 0x7fffffff;
 			break;
 
+		case R_ARM_REL32:
+			*(u32 *)loc += sym->st_value - loc;
+			break;
+
 		case R_ARM_MOVW_ABS_NC:
 		case R_ARM_MOVT_ABS:
 			offset = tmp = __mem_to_opcode_arm(*(u32 *)loc);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 arm: module: add support for R_ARM_REL32 relocations

Quoted 3 lines · Ard Biesheuvel

Add support for R_ARM_REL32 relocations in the module loader, which will be used by the modversions code when (if) it switches to using relative references to refer to CRC values.

Thanks, please keep this patch handy for when (if) that does happen. I won't apply this until it is actually needed - no point adding stuff that never gets used (and therefore doesn't get tested.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#2 lore raw

PATCH 1/1 arm: module: add support for R_ARM_REL32 relocations

Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Ard Biesheuvel

Add support for R_ARM_REL32 relocations in the module loader, which will be used by the modversions code when (if) it switches to using relative references to refer to CRC values.

Thanks, please keep this patch handy for when (if) that does happen. I won't apply this until it is actually needed - no point adding stuff that never gets used (and therefore doesn't get tested.)

Fair enough