1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:37:45 +00:00

LibELF: Cache consecutive lookups for the same symbol

This reduces the startup time of LibWeb by 10%, and eliminates 156'000
of the total 481'000 global symbol lookups during a self-test run.
This commit is contained in:
Daniel Bertalan 2023-08-17 08:00:08 +02:00 committed by Andreas Kling
parent 9a07ac0b6a
commit 1adf06c9f0
3 changed files with 31 additions and 6 deletions

View file

@ -143,7 +143,11 @@ private:
ResolveLater = 2,
CallIfuncResolver = 3,
};
RelocationResult do_direct_relocation(DynamicObject::Relocation const&, ShouldInitializeWeak, ShouldCallIfuncResolver);
struct CachedLookupResult {
DynamicObject::Symbol symbol;
Optional<DynamicObject::SymbolLookupResult> result;
};
RelocationResult do_direct_relocation(DynamicObject::Relocation const&, Optional<CachedLookupResult>&, ShouldInitializeWeak, ShouldCallIfuncResolver);
// Will be called from _fixup_plt_entry, as part of the PLT trampoline
static RelocationResult do_plt_relocation(DynamicObject::Relocation const&, ShouldCallIfuncResolver);
void do_relr_relocations();