elf2rpl: Set file offset to 0 for the SHT_NOBITS and SHT_NULL sections.

This commit is contained in:
James Benton 2018-09-30 08:37:33 +01:00
parent 400318c3d1
commit b6c024fc5c

View File

@ -569,6 +569,14 @@ calculateSectionOffsets(ElfFile &file)
auto offset = file.header.shoff;
offset += align_up(static_cast<uint32_t>(file.sections.size() * sizeof(elf::SectionHeader)), 64);
for (auto &section : file.sections) {
if (section->header.type == elf::SHT_NOBITS ||
section->header.type == elf::SHT_NULL) {
section->header.offset = 0u;
section->data.clear();
}
}
for (auto &section : file.sections) {
if (section->header.type == elf::SHT_RPL_CRCS) {
section->header.offset = offset;