improved linker resolver

This commit is contained in:
georgemoralis 2024-04-09 13:39:35 +03:00
parent 3a7834b821
commit 7b16e9af23
1 changed files with 39 additions and 33 deletions

View File

@ -559,8 +559,7 @@ void Linker::Resolve(const std::string& name, Loader::SymbolType sym_type, Modul
Loader::SymbolRecord* return_info) { Loader::SymbolRecord* return_info) {
// std::scoped_lock lock{m_mutex}; // std::scoped_lock lock{m_mutex};
const auto ids = Common::SplitString(name, '#'); const auto ids = Common::SplitString(name, '#');
ASSERT_MSG(ids.size() == 3, "Symbols must be 3 parts name, library, module"); if (ids.size() == 3) {
const auto* library = FindLibrary(*m, ids.at(1)); const auto* library = FindLibrary(*m, ids.at(1));
const auto* module = FindModule(*m, ids.at(2)); const auto* module = FindModule(*m, ids.at(2));
ASSERT_MSG(library && module, "Unable to find library and module"); ASSERT_MSG(library && module, "Unable to find library and module");
@ -598,6 +597,13 @@ void Linker::Resolve(const std::string& name, Loader::SymbolType sym_type, Modul
LOG_ERROR(Core_Linker, "Linker: Stub resolved {} as {} (lib: {}, mod: {})", sr.name, LOG_ERROR(Core_Linker, "Linker: Stub resolved {} as {} (lib: {}, mod: {})", sr.name,
return_info->name, library->name, module->name); return_info->name, library->name, module->name);
} }
}
else
{
return_info->virtual_address = 0;
return_info->name = name;
LOG_ERROR(Core_Linker, "Not Resolved {}", name);
}
} }
u64 Linker::GetProcParam() { u64 Linker::GetProcParam() {