From b9feae3b62eed6cbb79b14bb49ba6d95c5c13b54 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 15 Nov 2013 08:19:29 -0800 Subject: [PATCH] Don't require 32-bit relocs to be aligned. Also, report these situations more, who knows what games they could break. --- Core/ELF/ElfReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/ELF/ElfReader.cpp b/Core/ELF/ElfReader.cpp index 1ec733f76..6b17128c4 100644 --- a/Core/ELF/ElfReader.cpp +++ b/Core/ELF/ElfReader.cpp @@ -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"); }