Attention is currently required from: Angel Pons, Nico Huber.
Arthur Heymans has posted comments on this change by Arthur Heymans. ( https://review.coreboot.org/c/coreboot/+/84043?usp=email )
Change subject: util/cbfstool: Deal with how lld organizes loadable segments ......................................................................
Patch Set 11:
(1 comment)
File util/cbfstool/cbfs-mkstage.c:
https://review.coreboot.org/c/coreboot/+/84043/comment/e4b3f9f0_95432226?usp... : PS7, Line 301: prev = cur
Maybe I'm confusing myself too much. What do we actually try to assert? That things for `_data .. _edata` are consecutive, I guess?
Looking at a BFD linked romstage, I would check `vaddr` there as well:
$ readelf --segments build/cbfs/fallback/romstage.elf Elf file type is EXEC (Executable file) Entry point 0x2000031 There are 2 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000080 0x02000000 0x02000000 0x0c1d0 0x0c1d0 R E 0x20 LOAD 0x00c250 0xff7cb0a8 0x0200c1d0 0x00018 0x00018 RW 0x4 Section to Segment mapping: Segment Sections... 00 .text 01 .data
Just not compare the executable segment.
So what we want is extract out loadable sections and make it into a XIP binary. We want them to be consecutive. We only use PT_LOAD segments anyway, but it's indeed reasonable to not update the loop variable on non PT_LOAD.