util/cbfstool: Support AMD64 rmodules
Add support for 64bit rmodule, as required for relocatable ramstage on x86_64. Change-Id: I7fbb3b4c0f76ce82c090b5f16f67a728b6bf94a5 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/c/29874 Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
committed by
Patrick Georgi
parent
f7fdc3a5ab
commit
565bebe0b3
@ -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;
|
||||
@ -100,6 +127,11 @@ static const struct arch_ops reloc_ops[] = {
|
||||
.valid_type = valid_reloc_386,
|
||||
.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,
|
||||
|
Reference in New Issue
Block a user