mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 07:25:26 +00:00
[rpcsx-os] linker: hack for lazy bind
This commit is contained in:
parent
8d9869eb7d
commit
437d8e78b8
3 changed files with 18 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue