rockchip: make_fit_atf: ignore empty PT_LOAD segment
Subsystems (3)
PATCH 1/1 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.
--- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/make_fit_atf.py +3 -2
@@ -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():
--
2.28.0
PATCH 1/1 rockchip: make_fit_atf: ignore empty PT_LOAD segment
Quoted 5 lines · Heinrich Schuchardt
The linker sometimes creates
PT_LOADsegments 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 <[email protected]>
This also fixes the build issue I had.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200915/dc729d3b/attachment.sig>
PATCH 1/1 rockchip: make_fit_atf: ignore empty PT_LOAD segment
In reply to Heinrich SchuchardtQuoted 5 lines · Heinrich Schuchardt
The linker sometimes creates
PT_LOADsegments 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 <[email protected]>
Thanks,
- Kever
Quoted 25 lines
--- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm/mach-rockchip/make_fit_atf.py +3
-3@@ -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(): --2.28.0
PATCH 1/1 rockchip: make_fit_atf: ignore empty PT_LOAD segment
Quoted 11 lines · Kever Yang
Quoted 5 lines · Heinrich Schuchardt
The linker sometimes creates
PT_LOADsegments 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 <[email protected]>Reviewed-by Kever Yang <[email protected]>
Hello Tom,
now that the patch has been reviewed I hope you can use it to get the efi-2020-10-rc5 pull request merged.
Best regards
Heinrich
Quoted 35 lines
Thanks,
- Kever
Quoted 28 lines
---
?arch/arm/mach-rockchip/make_fit_atf.py| 5 +++-- ? 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm/mach-rockchip/make_fit_atf.py +0
-0@@ -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))+??????????? ifp_filesz> 0:
+???????????????p_data= elf[p_offset:p_offset +p_filesz] +???????????????segments.append((index, e_entry, p_paddr, p_data))????? return segments? def
main():
--
2.28.0