Make previous code cleaner

This commit is contained in:
Arthur Blot committed 2013-01-02 19:42:15 +01:00
1 parent c2851467e5
commit e4ce0592c1
4 files changed
+62 -50

No files matched your search

+9 -7
View File
@@ -271,7 +271,6 @@ bool ElfReader::LoadInto(u32 loadAddress)
}
DEBUG_LOG(LOADER,"Relocations:");
bool oldRelocs = false;
// Second pass: Do necessary relocations
for (int i=0; i<GetNumSections(); i++)
@@ -300,20 +299,23 @@ bool ElfReader::LoadInto(u32 loadAddress)
else if (s->sh_type == SHT_REL)
{
DEBUG_LOG(LOADER, "Traditional relocation section found.");
if (bRelocate)
if (!bRelocate)
{
DEBUG_LOG(LOADER, "Binary is prerelocated. Skipping relocations.");
}
else
{
oldRelocs = true;
//We have a relocation table!
int sectionToModify = s->sh_info;
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
{
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s, ignoring",GetSectionName(sectionToModify));
continue;
}
ERROR_LOG(LOADER,"Traditional relocations unsupported.");
}
}
}
if (oldRelocs)
{
INFO_LOG(LOADER, "Game uses old relocations (often for debugging, should be harmless)");
}
// Segment relocations (a few games use them)
if (GetNumSections() == 0)