File indexing completed on 2024-05-12 05:43:30
0001 /* 0002 Copyright (C) 2013-2014 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef ELFSECTIONHEADER_IMPL_H 0019 #define ELFSECTIONHEADER_IMPL_H 0020 0021 #include "elfsectionheader.h" 0022 #include "elffile.h" 0023 0024 template <typename T> 0025 class ElfSectionHeaderImpl : public ElfSectionHeader 0026 { 0027 public: 0028 inline ElfSectionHeaderImpl(ElfFile *file, uint16_t sectionIndex) : 0029 ElfSectionHeader(file, sectionIndex), 0030 m_hdr(reinterpret_cast<const T*>(file->rawData() + headerOffset())) 0031 { 0032 } 0033 0034 inline uint32_t nameIndex() const override { return m_hdr->sh_name; } 0035 inline uint32_t type() const override { return m_hdr->sh_type; } 0036 inline uint64_t flags() const override { return m_hdr->sh_flags; } 0037 inline uint64_t virtualAddress() const override { return m_hdr->sh_addr; } 0038 inline uint64_t sectionOffset() const override { return m_hdr->sh_offset; } 0039 inline uint64_t size() const override { return m_hdr->sh_size; } 0040 inline uint32_t link() const override { return m_hdr->sh_link; } 0041 inline uint32_t info() const override { return m_hdr->sh_info; } 0042 inline uint64_t alignment() const override { return m_hdr->sh_addralign; } 0043 inline uint64_t entrySize() const override { return m_hdr->sh_entsize; } 0044 0045 private: 0046 const T* m_hdr = 0; 0047 }; 0048 0049 #endif // ELFSECTIONHEADER_IMPL_H