[rpcsx-os/linker] Ignore needed that not exists

This commit is contained in:
DH 2023-06-29 23:01:47 +03:00
parent e6f6c37675
commit aee2ee62f6
3 changed files with 22 additions and 3 deletions

@ -1 +1 @@
Subproject commit ce17db5749169f42a242591c2d7a9fe105fbf760
Subproject commit 287b6e4470c6f6ac5501a3eab17e81e943c4d245

View file

@ -718,6 +718,12 @@ int main(int argc, const char *argv[]) {
initProcess->onSysExit = onSysExit;
auto executableModule =
rx::linker::loadModuleFile(argv[argIndex], initProcess);
if (executableModule == nullptr) {
std::fprintf(stderr, "Failed to open '%s'\n", argv[argIndex]);
std::abort();
}
initProcess->processParam = executableModule->processParam;
initProcess->processParamSize = executableModule->processParamSize;

View file

@ -474,7 +474,20 @@ SysResult processNeeded(Thread *thread) {
if (neededModule == nullptr) {
std::fprintf(stderr, "Needed '%s' not found\n", needed.c_str());
return ErrorCode::NOENT;
continue;
}
if (neededModule->soName != needed) {
if (neededModule->soName[0] != '\0') {
std::fprintf(stderr, "Module name mismatch, expected '%s', loaded '%s' (%s)\n", needed.c_str(), neededModule->soName, neededModule->moduleName);
std::abort();
}
std::strncpy(neededModule->soName, needed.c_str(), sizeof(neededModule->soName));
if (neededModule->soName[sizeof(neededModule->soName) - 1] != '\0') {
std::fprintf(stderr, "Too big needed name\n");
std::abort();
}
}
hasLoadedNeeded = true;
@ -495,7 +508,7 @@ SysResult processNeeded(Thread *thread) {
}
std::fprintf(stderr, "Not found needed module '%s' for object '%s'\n", mod.name.c_str(), module->soName);
std::abort();
module->importedModules.push_back({});
}
});