mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 03:04:16 +01:00
Fix calculateSectionOffsets for import sections.
Fuck.
This commit is contained in:
parent
b03e4afc49
commit
63119deb63
@ -616,7 +616,7 @@ calculateSectionOffsets(ElfFile &file)
|
||||
}
|
||||
|
||||
// Next the "readMin / readMax" sections, which are:
|
||||
// - !(flags & SHF_EXECINSTR) || type == SHT_RPL_EXPORTS || type == SHT_RPL_IMPORTS
|
||||
// - !(flags & SHF_EXECINSTR) || type == SHT_RPL_EXPORTS
|
||||
// - !(flags & SHF_WRITE)
|
||||
// - flags & SHF_ALLOC
|
||||
for (auto §ion : file.sections) {
|
||||
@ -629,8 +629,7 @@ calculateSectionOffsets(ElfFile &file)
|
||||
}
|
||||
|
||||
if ((!(section->header.flags & elf::SHF_EXECINSTR) ||
|
||||
section->header.type == elf::SHT_RPL_EXPORTS ||
|
||||
section->header.type == elf::SHT_RPL_IMPORTS) &&
|
||||
section->header.type == elf::SHT_RPL_EXPORTS) &&
|
||||
!(section->header.flags & elf::SHF_WRITE) &&
|
||||
(section->header.flags & elf::SHF_ALLOC)) {
|
||||
section->header.offset = offset;
|
||||
@ -639,6 +638,16 @@ calculateSectionOffsets(ElfFile &file)
|
||||
}
|
||||
}
|
||||
|
||||
// Import sections are part of the read sections, but have execinstr flag set
|
||||
// so let's insert them here to avoid complicating the above logic.
|
||||
for (auto §ion : file.sections) {
|
||||
if (section->header.type == elf::SHT_RPL_IMPORTS) {
|
||||
section->header.offset = offset;
|
||||
section->header.size = static_cast<uint32_t>(section->data.size());
|
||||
offset += section->header.size;
|
||||
}
|
||||
}
|
||||
|
||||
// Next the "textMin / textMax" sections, which are:
|
||||
// - flags & SHF_EXECINSTR
|
||||
// - type != SHT_RPL_EXPORTS
|
||||
|
Loading…
Reference in New Issue
Block a user