diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-09-15 03:43:29 +0200 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2020-09-16 16:41:30 +0800 |
commit | 5b861eea7927da63f016b75265e454a19ab19d0b (patch) | |
tree | b79988b57b5e8f9997d379fec36c6db0d48c60a0 /arch/arm/mach-rockchip | |
parent | 454b792afeeca1294a780590199e9250b5c9aa64 (diff) | |
download | u-boot-5b861eea7927da63f016b75265e454a19ab19d0b.tar.gz u-boot-5b861eea7927da63f016b75265e454a19ab19d0b.tar.xz u-boot-5b861eea7927da63f016b75265e454a19ab19d0b.zip |
rockchip: make_fit_atf: ignore empty PT_LOAD segment
The linker sometimes creates PT_LOAD segments with length (p_filesz) zero
as described in https://man7.org/linux/man-pages/man5/elf.5.html. This
leads to build failures. We should ignore empty segments.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'arch/arm/mach-rockchip')
-rwxr-xr-x | arch/arm/mach-rockchip/make_fit_atf.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index d15c32b303..f3224d2555 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -189,8 +189,9 @@ def unpack_elf(filename): p_type, p_flags, p_offset = struct.unpack_from('<LLQ', elf, offset) if p_type == 1: # PT_LOAD p_paddr, p_filesz = struct.unpack_from('<2Q', elf, offset + 0x18) - p_data = elf[p_offset:p_offset + p_filesz] - segments.append((index, e_entry, p_paddr, p_data)) + if p_filesz > 0: + p_data = elf[p_offset:p_offset + p_filesz] + segments.append((index, e_entry, p_paddr, p_data)) return segments def main(): |