rmodule: Support for ARMv7 relocations

This is needed for early vboot selection

Signed-off-by: Stefan Reinauer <reinauer@google.com>

BRANCH=none
TEST=needs further changes
BUG=none

Change-Id: Ibfd36c59e96513b65f5ff5239b4ecc02e807039b
Reviewed-on: https://chromium-review.googlesource.com/167401
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Stefan Reinauer <reinauer@google.com>
Commit-Queue: Stefan Reinauer <reinauer@google.com>
This commit is contained in:
Stefan Reinauer 2013-08-28 16:17:22 -07:00 committed by chrome-internal-fetch
commit ed23fa71e9

View file

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