Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84043?usp=email )
Change subject: util/cbfstool: Deal with how lld organizes loadable segments ......................................................................
util/cbfstool: Deal with how lld organizes loadable segments
LLD deals with loadable segments in a different manner than BFD. The MemSiz of the .text loadable section is padded till the virtaddr of the .car.data section. Since .text is not loaded in ENV_CAR this does not matter.
Change-Id: I1a0541c8ea3dfbebfba83d505d84b6db12000723 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M util/cbfstool/cbfs-mkstage.c 1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/43/84043/1
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c index 8129f0b..e2f01d4 100644 --- a/util/cbfstool/cbfs-mkstage.c +++ b/util/cbfstool/cbfs-mkstage.c @@ -314,8 +314,14 @@ if (!prev) continue;
- if (prev->p_paddr + prev->p_memsz != cur->p_paddr || - prev->p_filesz != prev->p_memsz) { + const bool bfd_is_consecutive = prev->p_paddr + prev->p_memsz == cur->p_paddr && prev->p_filesz == prev->p_memsz; + /* + * lld pads the memsz of the .text vaddr till the vaddr of car.data. Since we don't load + * XIP stages at runtime, we don't care. + */ + const bool lld_is_consecutive = prev->p_vaddr + prev->p_memsz == cur->p_vaddr; + + if (!bfd_is_consecutive && !lld_is_consecutive) { ERROR("Loadable segments physical addresses should " "be consecutive\n"); free(phdrs);