diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2020-01-08 21:40:11 -0700 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-09 09:29:36 +0100 |
commit | c21f384d17599a082bc64ce0175a0aad24b25720 (patch) | |
tree | 9abb91f131b1fc4d2b9431f7b9d001c7ce8882dc /Libraries | |
parent | 2e349337d3de20d1f2f3725ec394b8e1ae97a53d (diff) | |
download | serenity-c21f384d17599a082bc64ce0175a0aad24b25720.zip |
LibELF: Remove DynamicSection from ELFImage
Since ELFDynamicObject needs the actual virtual address of the .dynamic
section in the loaded image, and not the file offset like we assumed
before, due to MAP_PRIVATE secretly giving us a MAP_SHARED, we can
remove all of the Dynamic* code from ELFImage.
ELFDynamicLoader only needs ELFImage to get the Program headers at this
point. More consolidation opportunities seem likely in the future.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibELF/ELFImage.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibELF/ELFImage.h | 15 |
2 files changed, 0 insertions, 25 deletions
diff --git a/Libraries/LibELF/ELFImage.cpp b/Libraries/LibELF/ELFImage.cpp index 33ac0ff426..ca4004f1ba 100644 --- a/Libraries/LibELF/ELFImage.cpp +++ b/Libraries/LibELF/ELFImage.cpp @@ -117,10 +117,6 @@ bool ELFImage::parse() if (StringView(".strtab") == section_header_table_string(sh.sh_name)) m_string_table_section_index = i; } - if (sh.sh_type == SHT_DYNAMIC) { - ASSERT(!m_dynamic_section_index || m_dynamic_section_index == i); - m_dynamic_section_index = i; - } } // Then create a name-to-index map. @@ -218,9 +214,3 @@ const ELFImage::Section ELFImage::lookup_section(const String& name) const return section((*it).value); return section(0); } - -const ELFImage::DynamicSection ELFImage::dynamic_section() const -{ - ASSERT(is_dynamic()); - return section(m_dynamic_section_index); -} diff --git a/Libraries/LibELF/ELFImage.h b/Libraries/LibELF/ELFImage.h index 816c8e0682..d4529d79ba 100644 --- a/Libraries/LibELF/ELFImage.h +++ b/Libraries/LibELF/ELFImage.h @@ -27,7 +27,6 @@ public: class RelocationSection; class Symbol; class Relocation; - class DynamicSection; class Symbol { public: @@ -111,8 +110,6 @@ public: protected: friend class RelocationSection; - friend class DynamicSection; - friend class DynamicRelocationSection; const ELFImage& m_image; const Elf32_Shdr& m_section_header; unsigned m_section_index; @@ -150,24 +147,13 @@ public: const Elf32_Rel& m_rel; }; - class DynamicSection : public Section { - public: - DynamicSection(const Section& section) - : Section(section.m_image, section.m_section_index) - { - ASSERT(type() == SHT_DYNAMIC); - } - }; - unsigned symbol_count() const; - unsigned dynamic_symbol_count() const; unsigned section_count() const; unsigned program_header_count() const; const Symbol symbol(unsigned) const; const Section section(unsigned) const; const ProgramHeader program_header(unsigned const) const; - const DynamicSection dynamic_section() const; template<typename F> void for_each_section(F) const; @@ -204,7 +190,6 @@ private: bool m_valid { false }; unsigned m_symbol_table_section_index { 0 }; unsigned m_string_table_section_index { 0 }; - unsigned m_dynamic_section_index { 0 }; }; template<typename F> |