summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-19 11:37:20 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-19 12:00:40 +0200
commit97d7450571caaec13c18a57da38f5b8c2eb24c09 (patch)
treed341829c6856a56953560e59e9cc926652912a85
parent55914841b7712c7721eee497986a086fd109259f (diff)
downloadserenity-97d7450571caaec13c18a57da38f5b8c2eb24c09.zip
LibELF: Remove VERIFY() calls and let control flow return to the caller
This way we get better error messages for unresolved symbols because the caller logs the file and symbol names.
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp
index cfc6e124b8..376d497e0c 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.cpp
+++ b/Userland/Libraries/LibELF/DynamicLoader.cpp
@@ -444,7 +444,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
if (symbol.bind() == STB_WEAK)
return RelocationResult::ResolveLater;
dbgln("ERROR: symbol not found: {}.", symbol.name());
- VERIFY_NOT_REACHED();
+ return RelocationResult::Failed;
}
auto symbol_address = res.value().address;
*patch_ptr += symbol_address.get();
@@ -453,7 +453,8 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
case R_386_PC32: {
auto symbol = relocation.symbol();
auto result = lookup_symbol(symbol);
- VERIFY(result.has_value());
+ if (!result.has_value())
+ return RelocationResult::Failed;
auto relative_offset = result.value().address - m_dynamic_object->base_address().offset(relocation.offset());
*patch_ptr += relative_offset.get();
break;