elf: Load only PT_LOAD program headers

The only kind of program header that should be read into memory before
executing is PT_LOAD. This speeds up ELF loading by skipping PT_NULL
sections.
pull/27/head
Wladimir J. van der Laan 2019-05-04 18:06:59 +02:00
parent 8705777490
commit 52602eb48c
1 changed files with 1 additions and 1 deletions

View File

@ -973,7 +973,7 @@ class KFlash:
print(INFO_MSG, ("Program Header: Size: %d, Virtual Address: 0x%x, Type: %s" % (segment['p_filesz'], segment['p_vaddr'], t)), BASH_TIPS['DEFAULT'])
if not (segment['p_vaddr'] & 0x80000000):
continue
if segment['p_filesz']==0 or segment['p_vaddr']==0:
if segment['p_type']!='PT_LOAD' or segment['p_filesz']==0 or segment['p_vaddr']==0:
print("Skipped")
continue
self.flash_dataframe(segment.data(), segment['p_vaddr'])