Don't require 32-bit relocs to be aligned.

Also, report these situations more, who knows what games they could break.
This commit is contained in:
Unknown W. Brackets 2013-11-15 08:19:29 -08:00
parent f165a15eff
commit b9feae3b62

View File

@ -69,18 +69,18 @@ bool ElfReader::LoadRelocations(Elf32_Rel *rels, int numRelocs)
//0 = code
//1 = data
if (readwrite >= ARRAY_SIZE(segmentVAddr)) {
if (readwrite >= (int)ARRAY_SIZE(segmentVAddr)) {
if (numErrors < 10) {
ERROR_LOG(LOADER, "Bad segment number %i", readwrite);
ERROR_LOG_REPORT(LOADER, "Bad segment number %i", readwrite);
}
numErrors++;
continue;
}
addr += segmentVAddr[readwrite];
if ((addr & 3) || !Memory::IsValidAddress(addr)) {
if (((addr & 3) && type != R_MIPS_32) || !Memory::IsValidAddress(addr)) {
if (numErrors < 10) {
WARN_LOG(LOADER, "Suspicious address %08x, skipping reloc", addr);
WARN_LOG_REPORT(LOADER, "Suspicious address %08x, skipping reloc, type = %d", addr, type);
} else if (numErrors == 10) {
WARN_LOG(LOADER, "Too many bad relocations, skipping logging");
}