summaryrefslogtreecommitdiff
path: root/Libraries/LibELF
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-11 12:22:19 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-11 12:23:43 +0200
commit8d73355c383b8e0be0d68a9d3e2724972d7077bb (patch)
treeeaab38363b90b8f1714d95affcc67152c33351a0 /Libraries/LibELF
parentc3b6df60b72762af58dd9966dbe25c22b5cd33e9 (diff)
downloadserenity-8d73355c383b8e0be0d68a9d3e2724972d7077bb.zip
LibELF: Set ELF::Loader::m_symbol_count in constructor
Setting it in load() excludes users of ELF::Loader that don't actually call load() but only use the Loader for symbolication purposes. Perhaps the factoring here is not ideal.
Diffstat (limited to 'Libraries/LibELF')
-rw-r--r--Libraries/LibELF/Loader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibELF/Loader.cpp b/Libraries/LibELF/Loader.cpp
index e98594510c..e6b9b3af7a 100644
--- a/Libraries/LibELF/Loader.cpp
+++ b/Libraries/LibELF/Loader.cpp
@@ -43,6 +43,8 @@ namespace ELF {
Loader::Loader(const u8* buffer, size_t size, bool verbose_logging)
: m_image(buffer, size, verbose_logging)
{
+ if (m_image.is_valid())
+ m_symbol_count = m_image.symbol_count();
}
Loader::~Loader()
@@ -57,8 +59,6 @@ bool Loader::load()
if (!m_image.is_valid())
return false;
- m_symbol_count = m_image.symbol_count();
-
if (!layout())
return false;