1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibELF: Use Optional<SymbolLookupResult> as a return type

Instead of storing a "found" state inside the result object.
This commit is contained in:
Andreas Kling 2021-01-25 13:09:08 +01:00
parent a5de46684b
commit 41d8734288
6 changed files with 42 additions and 47 deletions

View file

@ -276,18 +276,17 @@ public:
void for_each_initialization_array_function(F f) const;
struct SymbolLookupResult {
bool found { false };
FlatPtr value { 0 };
FlatPtr address { 0 };
unsigned bind { STB_LOCAL };
const ELF::DynamicObject* dynamic_object { nullptr }; // The object in which the symbol is defined
};
SymbolLookupResult lookup_symbol(const char* name) const;
Optional<SymbolLookupResult> lookup_symbol(const char* name) const;
// Will be called from _fixup_plt_entry, as part of the PLT trampoline
Elf32_Addr patch_plt_entry(u32 relocation_offset);
SymbolLookupResult lookup_symbol(const ELF::DynamicObject::Symbol& symbol) const;
Optional<SymbolLookupResult> lookup_symbol(const ELF::DynamicObject::Symbol&) const;
bool elf_is_dynamic() const { return m_is_elf_dynamic; }