From ed23fa71e9983861587dcc8d333ac64ba9834c32 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 28 Aug 2013 16:17:22 -0700 Subject: [PATCH] rmodule: Support for ARMv7 relocations This is needed for early vboot selection Signed-off-by: Stefan Reinauer BRANCH=none TEST=needs further changes BUG=none Change-Id: Ibfd36c59e96513b65f5ff5239b4ecc02e807039b Reviewed-on: https://chromium-review.googlesource.com/167401 Reviewed-by: Aaron Durbin Tested-by: Stefan Reinauer Commit-Queue: Stefan Reinauer --- src/lib/rmodule.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c index b56ec322be..783aa0a50e 100644 --- a/src/lib/rmodule.c +++ b/src/lib/rmodule.c @@ -60,6 +60,40 @@ static inline void *remodule_next_reloc(const void *reloc) return (void *)rel; } +#elif CONFIG_ARCH_ARMV7 +/* + * On ARMv7, the only relocations currently allowed are R_ARM_RELATIVE which + * have '0' for the symbol info in the relocation metadata (in r_info). + * The reason is that the module is fully linked and just has the relocations' + * locations. + */ +typedef struct { + u32 r_offset; + u32 r_info; +} Elf32_Rel; + +#define R_ARM_RELATIVE 23 + +#define RELOCTION_ENTRY_SIZE sizeof(Elf32_Rel) +static inline int rmodule_reloc_offset(const void *reloc) +{ + const Elf32_Rel *rel = reloc; + return rel->r_offset; +} + +static inline int rmodule_reloc_valid(const void *reloc) +{ + const Elf32_Rel *rel = reloc; + return (rel->r_info == R_ARM_RELATIVE); +} + +static inline void *remodule_next_reloc(const void *reloc) +{ + const Elf32_Rel *rel = reloc; + rel++; + return (void *)rel; +} + #else #error Arch needs to add relocation information support for RMODULE #endif