rmodtool: add support for ARM
Add support for creating ARM rmodules. There are 3 expected relocations for an ARM rmodule: - R_ARM_ABS32 - R_ARM_THM_PC22 - R_ARM_THM_JUMP24 R_ARM_ABS32 is the only type that needs to emitted for relocation as the other 2 are relative relocations. BUG=chrome-os-partner:27094 BRANCH=None TEST=Built vbootstub for ARM device. Change-Id: I0c22d4abca970e82ccd60b33fed700b96e3e52fb Signed-off-by: Aaron Durbin <adurbin@chromuim.org> Reviewed-on: https://chromium-review.googlesource.com/190922 Reviewed-by: Gabe Black <gabeblack@chromium.org> Tested-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
5d262f8dd4
commit
a642102ba7
2 changed files with 27 additions and 0 deletions
|
|
@ -2223,6 +2223,7 @@ typedef Elf32_Addr Elf32_Conflict;
|
|||
#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
|
||||
#define R_ARM_GOT32 26 /* 32 bit GOT entry */
|
||||
#define R_ARM_PLT32 27 /* 32 bit PLT address */
|
||||
#define R_ARM_THM_JUMP24 30
|
||||
#define R_ARM_ALU_PCREL_7_0 32
|
||||
#define R_ARM_ALU_PCREL_15_8 33
|
||||
#define R_ARM_ALU_PCREL_23_15 34
|
||||
|
|
|
|||
|
|
@ -82,12 +82,38 @@ static int should_emit_386(struct rmod_context *ctx, Elf64_Rela *rel)
|
|||
return (type == R_386_32);
|
||||
}
|
||||
|
||||
static int valid_reloc_arm(struct rmod_context *ctx, Elf64_Rela *rel)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = ELF64_R_TYPE(rel->r_info);
|
||||
|
||||
/* Only these 3 relocations are expected to be found. */
|
||||
return (type == R_ARM_ABS32 || type == R_ARM_THM_PC22 ||
|
||||
type == R_ARM_THM_JUMP24);
|
||||
}
|
||||
|
||||
static int should_emit_arm(struct rmod_context *ctx, Elf64_Rela *rel)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = ELF64_R_TYPE(rel->r_info);
|
||||
|
||||
/* R_ARM_ABS32 relocations are absolute. Must emit these. */
|
||||
return (type == R_ARM_ABS32);
|
||||
}
|
||||
|
||||
static struct arch_ops reloc_ops[] = {
|
||||
{
|
||||
.arch = EM_386,
|
||||
.valid_type = valid_reloc_386,
|
||||
.should_emit = should_emit_386,
|
||||
},
|
||||
{
|
||||
.arch = EM_ARM,
|
||||
.valid_type = valid_reloc_arm,
|
||||
.should_emit = should_emit_arm,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue