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.
This commit is contained in:
Gunnar Beutner 2021-04-19 11:37:20 +02:00 committed by Andreas Kling
parent 55914841b7
commit 97d7450571
Notes: sideshowbarker 2024-07-18 19:24:36 +09:00

View file

@ -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;