the offset between load address and ELF data offset varies by section,
some loadable sections follow the first non-loadable section,
load address is different than entry point address.
The first case is encountered at least in some PMUFW ELF files. The
second case is encountered at least in some PMUFW ELF files on Vivado
2018.1.
The elf_find_offsets() function is merged into elf_append() as they are
always called in pairs and having elf_append() continue to work without
libelf calls would have required elf_find_offsets() to pass much more
information for elf_append().
I haven't tested this extensively, but with this change I seemed to get bootable images again (PMUFW+FSBL+ATF+u-boot for ZynqMP).
Fix handling of several cases in the ELF code:
the offset between load address and ELF data offset varies by section,
some loadable sections follow the first non-loadable section,
load address is different than entry point address.
The first case is encountered at least in some PMUFW ELF files. The second case is encountered at least in some PMUFW ELF files on Vivado 2018.1.
The elf_find_offsets() function is merged into elf_append() as they are always called in pairs and having elf_append() continue to work without libelf calls would have required elf_find_offsets() to pass much more information for elf_append().
I haven't tested this extensively, but with this change I seemed to get bootable images again (PMUFW+FSBL+ATF+u-boot for ZynqMP).