diff --git a/Core/ELF/ElfReader.cpp b/Core/ELF/ElfReader.cpp index 0f2a29f9b..f7c0f7ccc 100644 --- a/Core/ELF/ElfReader.cpp +++ b/Core/ELF/ElfReader.cpp @@ -29,7 +29,7 @@ const char *ElfReader::GetSectionName(int section) return 0; int nameOffset = sections[section].sh_name; - char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx); + const char *ptr = (const char *)GetSectionDataPtr(header->e_shstrndx); if (ptr) return ptr + nameOffset; diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 420261170..fef5918b6 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -838,6 +838,8 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro u32_le *entryPos = (u32_le *)Memory::GetPointer(modinfo->libstub); u32_le *entryEnd = (u32_le *)Memory::GetPointer(modinfo->libstubend); + u32_le firstImportStubAddr = 0; + bool needReport = false; while (entryPos < entryEnd) { PspLibStubEntry *entry = (PspLibStubEntry *)entryPos; @@ -882,6 +884,9 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro func.stubAddr = entry->firstSymAddr + i * 8; module->ImportFunc(func); } + + if (firstImportStubAddr == NULL || firstImportStubAddr > entry->firstSymAddr) + firstImportStubAddr = entry->firstSymAddr; } else if (entry->numFuncs > 0) { WARN_LOG_REPORT(LOADER, "Module entry with %d imports but no valid address", entry->numFuncs); needReport = true; @@ -945,6 +950,15 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro Reporting::ReportMessage("Module linking debug info:\n%s", debugInfo.c_str()); } + if (textSection == -1) { + u32 textStart = reader.GetVaddr(); + u32 textEnd = firstImportStubAddr - 4; +#if !defined(USING_GLES2) + if (!reader.LoadSymbols()) + MIPSAnalyst::ScanForFunctions(textStart, textEnd); +#endif + } + // Look at the exports, too. struct PspLibEntEntry