Imagine we have:
ProgramHeaders: - Type: PT_LOAD Flags: [ PF_W, PF_R ] Sections: - Section: .bar VAddr: 0x2000 Sections: - Name: .foo Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] Address: 0x1000 - Name: .bar Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] Address: 0x2000
Both .foo and .bar share the same starting file offset,
but VA(.foo) < VA(PT_LOAD), we should not include it into segment.
This patch fixes the issue.
has a VA
include it in it