Commit 5b861eea authored by Heinrich Schuchardt's avatar Heinrich Schuchardt 💬 Committed by Kever Yang
Browse files

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's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
Reviewed-by: Kever Yang's avatarKever Yang <kever.yang@rock-chips.com>
parent 454b792a
......@@ -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():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment