diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index dfb8660483..21acbe77f5 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -454,13 +454,15 @@ VirtualAddress DynamicObject::patch_plt_entry(u32 relocation_offset) auto symbol = relocation.symbol(); u8* relocation_address = relocation.address().as_ptr(); + VirtualAddress symbol_location; auto result = DynamicLoader::lookup_symbol(symbol); - if (!result.has_value()) { + if (result.has_value()) { + symbol_location = result.value().address; + } else if (symbol.bind() != STB_WEAK) { dbgln("did not find symbol while doing relocations for library {}: {}", m_filename, symbol.name()); VERIFY_NOT_REACHED(); } - auto symbol_location = result.value().address; dbgln_if(DYNAMIC_LOAD_DEBUG, "DynamicLoader: Jump slot relocation: putting {} ({}) into PLT at {}", symbol.name(), symbol_location, (void*)relocation_address); *(FlatPtr*)relocation_address = symbol_location.get();