Force .rodata section to be read only.

This commit is contained in:
James Benton 2019-10-02 20:44:39 +01:00
parent 8155a56707
commit 088a2ca0ed

View File

@ -104,6 +104,18 @@ public class Cafe_ElfExtension extends ElfExtension {
return address;
}
@Override
public Boolean isSectionWritable(ElfSectionHeader section) {
// For some reason .rpl files have .rodata marked with W flag,
// forcing it to read only will help improve decompiler output.
String name = section.getNameAsString();
if (name != null && name.contentEquals(".rodata")) {
return false;
}
return (section.getFlags() & ElfSectionHeaderConstants.SHF_WRITE) != 0;
}
@Override
public void processElf(ElfLoadHelper elfLoadHelper, TaskMonitor monitor)
throws CancelledException {