From 5902d88264353436c33580d9a9ae82247dbb52ab Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Sat, 25 Jun 2022 16:30:52 +0530 Subject: commonlib: Handle DIR64 relocation type in FSP relocation code It seems fixup or adjustment addition for relocation type EFI_IMAGE_REL_BASED_DIR64 is missing in the fsp rebasing code. The patch address the miss. Without extending the fixup for the relocation type, build system throws warnings during the rebasing of FSP-M and FSP-S blobs which are built with 64bit. Portion of build output containing warning with debug enabled cbfs lib: ................................................... E: file offset: 9218 E: file type = 4 E: file attribs = 0 E: section offset: 9230 E: section type: 12 E: TE image at offset 9234 E: TE Image 0xffed80d4 -> 0xff256234 adjust value: ff37e000 E: Relocs for RVA offset 12000 E: Num relocs in block: 18 E: reloc type a offset f40 E: Unknown reloc type: a Portion of build output after fix: .................................. E: file offset: 9218 E: file type = 4 E: file attribs = 0 E: section offset: 9230 E: section type: 12 E: TE image at offset 9234 E: TE Image 0xffed80d4 -> 0xff256234 adjust value: ff37e000 E: Relocs for RVA offset 12000^M E: Num relocs in block: 18 E: reloc type a offset f40 E: Adjusting 0x7f2e7f377024 ffee9192 -> ff267192 E: reloc type a offset f48 TEST: Integrate FSP blobs built with 64 bit and do boot test. Signed-off-by: Sridhar Siricilla Change-Id: I894007ec50378357c00d635ec86d044710892aab Reviewed-on: https://review.coreboot.org/c/coreboot/+/65383 Reviewed-by: Tim Wawrzynczak Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/commonlib/fsp_relocate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commonlib/fsp_relocate.c b/src/commonlib/fsp_relocate.c index 421dae9012..4d89a70e23 100644 --- a/src/commonlib/fsp_relocate.c +++ b/src/commonlib/fsp_relocate.c @@ -170,7 +170,8 @@ static int te_relocate(uintptr_t new_addr, void *te) printk(FSP_DBG_LVL, "reloc type %x offset %zx\n", type, offset); - if (type == EFI_IMAGE_REL_BASED_HIGHLOW) { + if (type == EFI_IMAGE_REL_BASED_HIGHLOW || + type == EFI_IMAGE_REL_BASED_DIR64) { uint32_t *reloc_addr; uint32_t val; -- cgit v1.2.3