[rpcsx-os] linker: do not ignore symbols

This commit is contained in:
DH 2023-07-18 18:54:05 +03:00
parent db39768d12
commit 9818f5dc62
2 changed files with 9 additions and 10 deletions

View File

@ -714,13 +714,10 @@ Ref<orbis::Module> rx::linker::loadModule(std::span<std::byte> image,
symbol.libraryIndex = -1;
symbol.moduleIndex = -1;
} else {
std::printf("ignored: (%s) - %lx\n",
sceStrtab ? sceStrtab +
static_cast<std::uint32_t>(sym.st_name)
: "<no strtab>",
sym.st_value);
continue;
symbol.id =
encodeFid(sceStrtab + static_cast<std::uint32_t>(sym.st_name));
symbol.libraryIndex = -1;
symbol.moduleIndex = -1;
}
}

View File

@ -42,7 +42,7 @@ orbis::SysResult mmap(orbis::Thread *thread, orbis::caddr_t addr,
if (handle->mmap != nullptr) {
result = handle->mmap(handle.get(), addr, len, prot, flags, pos);
} else {
std::printf("unimplemented mmap\n");
std::printf("unimplemented mmap for fd %d\n", static_cast<int>(fd));
result = rx::vm::map(addr, len, prot, flags);
}
}
@ -70,7 +70,9 @@ orbis::SysResult msync(orbis::Thread *thread, orbis::ptr<void> addr,
orbis::SysResult mprotect(orbis::Thread *thread, orbis::ptr<const void> addr,
orbis::size_t len, orbis::sint prot) {
rx::vm::protect((void *)addr, len, prot);
if (!rx::vm::protect((void *)addr, len, prot)) {
return ErrorCode::INVAL;
}
return {};
}
@ -398,7 +400,7 @@ orbis::SysResult dynlib_get_obj_member(orbis::Thread *thread,
ptr<char> findSymbolById(orbis::Module *module, std::uint64_t id) {
for (auto sym : module->symbols) {
if (sym.id == id && sym.bind != orbis::SymbolBind::Local) {
return (ptr<char>)module->base + sym.address;
return sym.address != 0 ? (ptr<char>)module->base + sym.address : 0;
}
}