mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-02 14:50:05 +01:00
[rpcsx-os] linker: hack for lazy bind
This commit is contained in:
parent
8d9869eb7d
commit
437d8e78b8
|
|
@ -87,6 +87,10 @@ static orbis::SysResult doRelocation(orbis::Process *process,
|
|||
|
||||
auto &defModule = module->importedModules.at(symbol.moduleIndex);
|
||||
if (!defModule) {
|
||||
std::printf(
|
||||
"'%s' ('%s') uses undefined symbol '%llx' in unloaded module\n",
|
||||
module->moduleName, module->soName, (unsigned long long)symbol.id);
|
||||
|
||||
return std::pair(module, symbol.address);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,12 +59,6 @@ static orbis::ErrorCode dmem_ioctl(orbis::File *file, std::uint64_t request,
|
|||
|
||||
return device->queryMaxFreeChunkSize(&args->searchStart, args->searchEnd,
|
||||
args->alignment, &args->size);
|
||||
|
||||
ORBIS_LOG_WARNING("dmem getAvailableSize", device->index, argp, dmemSize);
|
||||
// args->searchStart = device->nextOffset;
|
||||
// args->size = dmemSize - device->nextOffset;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
case 0xc0288011:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <bit>
|
||||
#include <crypto/sha1.h>
|
||||
#include <elf.h>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <orbis/thread/Process.hpp>
|
||||
#include <sys/mman.h>
|
||||
|
|
@ -959,6 +960,8 @@ Ref<orbis::Module> rx::linker::loadModuleFile(std::string_view path,
|
|||
if (image[0] != std::byte{'\x7f'} || image[1] != std::byte{'E'} ||
|
||||
image[2] != std::byte{'L'} || image[3] != std::byte{'F'}) {
|
||||
image = unself(image.data(), image.size());
|
||||
|
||||
std::ofstream("a.out", std::ios::binary).write((const char *)image.data(), image.size());
|
||||
}
|
||||
|
||||
return loadModule(image, thread->tproc);
|
||||
|
|
@ -1051,5 +1054,16 @@ Ref<orbis::Module> rx::linker::loadModuleByName(std::string_view name,
|
|||
}
|
||||
}
|
||||
|
||||
// HACK: implement lazy bind support
|
||||
for (auto path : { "/app0/Media/Modules/" }) {
|
||||
auto filePath = std::string(path);
|
||||
filePath += name;
|
||||
filePath += ".prx";
|
||||
|
||||
if (auto result = rx::linker::loadModuleFile(filePath.c_str(), thread)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue