mirror of
https://github.com/wiiu-env/wut.git
synced 2025-03-01 18:15:35 +01:00
elf2rpl: Fix .rodata section flags to have WRITE.
Yes, READ ONLY data requires a WRITE flag.
This commit is contained in:
parent
0a4a7c66b3
commit
a1072fc729
@ -597,12 +597,37 @@ fixSectionAlign(ElfFile &file)
|
||||
section->header.addralign = 64u;
|
||||
} else if (section->header.type == elf::SHT_RPL_IMPORTS) {
|
||||
section->header.addralign = 4u;
|
||||
} else if (section->header.type == elf::SHT_RPL_EXPORTS) {
|
||||
section->header.addralign = 4u;
|
||||
} else if (section->header.type == elf::SHT_STRTAB) {
|
||||
section->header.addralign = 1u;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* .rodate requires W flag.
|
||||
*/
|
||||
static bool
|
||||
fixRoDataFlags(ElfFile &file)
|
||||
{
|
||||
for (auto §ion : file.sections) {
|
||||
if (section->header.type == elf::SHT_PROGBITS &&
|
||||
!(section->header.flags & elf::SHF_EXECINSTR)) {
|
||||
section->header.flags |= elf::SHF_WRITE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Relocate a section to a new address.
|
||||
*/
|
||||
static bool
|
||||
relocateSection(ElfFile &file,
|
||||
ElfFile::Section §ion,
|
||||
@ -719,6 +744,10 @@ fixLoaderVirtualAddresses(ElfFile &file)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* zlib deflate any suitable section.
|
||||
*/
|
||||
static bool
|
||||
deflateSections(ElfFile &file)
|
||||
{
|
||||
@ -962,6 +991,11 @@ int main(int argc, const char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!fixRoDataFlags(elf)) {
|
||||
fmt::print("ERROR: fixRoDataFlags failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!deflateSections(elf)) {
|
||||
fmt::print("ERROR: deflateSections failed");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user