summaryrefslogtreecommitdiff
path: root/util/cbfstool/rmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/rmodule.c')
-rw-r--r--util/cbfstool/rmodule.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/util/cbfstool/rmodule.c b/util/cbfstool/rmodule.c
index ff8f1cdef2..f270e3ec8f 100644
--- a/util/cbfstool/rmodule.c
+++ b/util/cbfstool/rmodule.c
@@ -44,6 +44,33 @@ static int should_emit_386(Elf64_Rela *rel)
return (type == R_386_32);
}
+static int valid_reloc_amd64(Elf64_Rela *rel)
+{
+ int type;
+
+ type = ELF64_R_TYPE(rel->r_info);
+
+ /* Only these 5 relocations are expected to be found. */
+ return (type == R_AMD64_64 ||
+ type == R_AMD64_PC64 ||
+ type == R_AMD64_32S ||
+ type == R_AMD64_32 ||
+ type == R_AMD64_PC32);
+}
+
+static int should_emit_amd64(Elf64_Rela *rel)
+{
+ int type;
+
+ type = ELF64_R_TYPE(rel->r_info);
+
+ /* Only emit absolute relocations */
+ return (type == R_AMD64_64 ||
+ type == R_AMD64_PC64 ||
+ type == R_AMD64_32S ||
+ type == R_AMD64_32);
+}
+
static int valid_reloc_arm(Elf64_Rela *rel)
{
int type;
@@ -101,6 +128,11 @@ static const struct arch_ops reloc_ops[] = {
.should_emit = should_emit_386,
},
{
+ .arch = EM_X86_64,
+ .valid_type = valid_reloc_amd64,
+ .should_emit = should_emit_amd64,
+ },
+ {
.arch = EM_ARM,
.valid_type = valid_reloc_arm,
.should_emit = should_emit_arm,