From cc647ed910ca638b3411efbe5785e09f39acf08a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Jun 2013 09:29:38 -0700 Subject: [PATCH] Add logging of more relocation errors. --- Core/ELF/ElfReader.cpp | 59 +++++++++++++++++++----------------- Core/ELF/ElfReader.h | 16 ++++++++++ Core/HLE/sceKernelModule.cpp | 16 ---------- 3 files changed, 47 insertions(+), 44 deletions(-) diff --git a/Core/ELF/ElfReader.cpp b/Core/ELF/ElfReader.cpp index b713f5144d..589dde661f 100644 --- a/Core/ELF/ElfReader.cpp +++ b/Core/ELF/ElfReader.cpp @@ -15,7 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "../MemMap.h" +#include "Core/MemMap.h" +#include "Core/Reporting.h" #include "../MIPS/MIPSTables.h" #include "ElfReader.h" #include "../Debugger/SymbolMap.h" @@ -46,7 +47,7 @@ void addrToHiLo(u32 addr, u16 &hi, s16 &lo) u32 test = (hi<<16) + lo; if (test != addr) { - + WARN_LOG_REPORT(LOADER, "HI16/LO16 relocation failure?"); } } @@ -77,28 +78,23 @@ void ElfReader::LoadRelocations(Elf32_Rel *rels, int numRelocs) } u32 relocateTo = segmentVAddr[relative]; -#define R_MIPS32 2 -#define R_MIPS26 4 -#define R_MIPS16_HI 5 -#define R_MIPS16_LO 6 - switch (type) { - case R_MIPS32: + case R_MIPS_32: if (log) DEBUG_LOG(LOADER,"Full address reloc %08x", addr); //full address, no problemo op += relocateTo; break; - case R_MIPS26: //j, jal + case R_MIPS_26: //j, jal //add on to put in correct address space if (log) DEBUG_LOG(LOADER,"j/jal reloc %08x", addr); op = (op & 0xFC000000) | (((op&0x03FFFFFF)+(relocateTo>>2))&0x03FFFFFFF); break; - case R_MIPS16_HI: //lui part of lui-addiu pairs + case R_MIPS_HI16: //lui part of lui-addiu pairs { if (log) DEBUG_LOG(LOADER,"HI reloc %08x", addr); @@ -108,7 +104,7 @@ void ElfReader::LoadRelocations(Elf32_Rel *rels, int numRelocs) bool found = false; for (int t = r + 1; tsh_type == SHT_REL) @@ -475,15 +478,15 @@ bool ElfReader::LoadInto(u32 loadAddress) { if (!(sections[sectionToModify].sh_flags & SHF_ALLOC)) { - ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s, ignoring",GetSectionName(sectionToModify)); + ERROR_LOG_REPORT(LOADER, "Trying to relocate non-loaded section %s, ignoring", GetSectionName(sectionToModify)); continue; } } else { - WARN_LOG(LOADER, "sectionToModify = %i - ignoring relocation sector %i", sectionToModify, i); + WARN_LOG_REPORT(LOADER, "sectionToModify = %i - ignoring relocation sector %i", sectionToModify, i); } - ERROR_LOG(LOADER,"Traditional relocations unsupported."); + ERROR_LOG_REPORT(LOADER, "Traditional relocations unsupported."); } } } diff --git a/Core/ELF/ElfReader.h b/Core/ELF/ElfReader.h index 5a2006cee9..b7c243278d 100644 --- a/Core/ELF/ElfReader.h +++ b/Core/ELF/ElfReader.h @@ -21,6 +21,22 @@ #include "ElfTypes.h" +enum { + R_MIPS_NONE, + R_MIPS_16, + R_MIPS_32, + R_MIPS_REL32, + R_MIPS_26, + R_MIPS_HI16, + R_MIPS_LO16, + R_MIPS_GPREL16, + R_MIPS_LITERAL, + R_MIPS_GOT16, + R_MIPS_PC16, + R_MIPS_CALL16, + R_MIPS_GPREL32 +}; + enum KnownElfTypes { KNOWNELF_PSP = 0, diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 84a98e48ce..3d7036bd63 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -49,22 +49,6 @@ enum { PSP_THREAD_ATTR_USER = 0x80000000 }; -enum { - R_MIPS_NONE, - R_MIPS_16, - R_MIPS_32, - R_MIPS_REL32, - R_MIPS_26, - R_MIPS_HI16, - R_MIPS_LO16, - R_MIPS_GPREL16, - R_MIPS_LITERAL, - R_MIPS_GOT16, - R_MIPS_PC16, - R_MIPS_CALL16, - R_MIPS_GPREL32 -}; - enum { // Function exports. NID_MODULE_START = 0xD632ACDB,