summaryrefslogtreecommitdiff
path: root/util/cbfstool/rmodule.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-03-20 11:08:02 -0500
committerMarc Jones <marc.jones@se-eng.com>2014-10-28 18:15:18 +0100
commit785e47bbf3125d86632c16584a974d1c180a989a (patch)
treec24546265930d7f36f653e50d82295fea5d14791 /util/cbfstool/rmodule.c
parent25ae602d2edb9426f94fe5fee26665d498f7fd9e (diff)
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. Original-Change-Id: I0c22d4abca970e82ccd60b33fed700b96e3e52fb Original-Signed-off-by: Aaron Durbin <adurbin@chromuim.org> Original-Reviewed-on: https://chromium-review.googlesource.com/190922 Original-Reviewed-by: Gabe Black <gabeblack@chromium.org> (cherry picked from commit a642102ba7ace5c1829abe7732199eda6646950a) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: Ib3b3c90ebb672d8d6a537df896b97dc82c6186cc Reviewed-on: http://review.coreboot.org/7204 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'util/cbfstool/rmodule.c')
-rw-r--r--util/cbfstool/rmodule.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/cbfstool/rmodule.c b/util/cbfstool/rmodule.c
index 168d71a8f7..966c364c47 100644
--- a/util/cbfstool/rmodule.c
+++ b/util/cbfstool/rmodule.c
@@ -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,
+ },
};
/*