linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: module: add support for R_ARM_REL32 relocations
@ 2017-01-19 22:11 Ard Biesheuvel
  2017-01-19 23:56 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2017-01-19 22:11 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm/include/asm/elf.h | 1 +
 arch/arm/kernel/module.c   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index d2315ffd8f12..d450a59ca121 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -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
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 4f14b5ce6535..29629fe02ce5 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm: module: add support for R_ARM_REL32 relocations
  2017-01-19 22:11 [PATCH] arm: module: add support for R_ARM_REL32 relocations Ard Biesheuvel
@ 2017-01-19 23:56 ` Russell King - ARM Linux
  2017-01-20 10:28   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2017-01-19 23:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 19, 2017 at 10:11:32PM +0000, Ard Biesheuvel wrote:
> 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.)

-- 
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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm: module: add support for R_ARM_REL32 relocations
  2017-01-19 23:56 ` Russell King - ARM Linux
@ 2017-01-20 10:28   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2017-01-20 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 19 January 2017 at 23:56, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Thu, Jan 19, 2017 at 10:11:32PM +0000, Ard Biesheuvel wrote:
>> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-20 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-19 22:11 [PATCH] arm: module: add support for R_ARM_REL32 relocations Ard Biesheuvel
2017-01-19 23:56 ` Russell King - ARM Linux
2017-01-20 10:28   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).