File indexing completed on 2024-05-19 05:44:09

0001 /*
0002     Copyright (C) 2015 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 ELFGNUSYMBOLVERSIONREQUIREMENT_H
0019 #define ELFGNUSYMBOLVERSIONREQUIREMENT_H
0020 
0021 #include <QVector>
0022 #include <elf.h>
0023 
0024 class ElfGNUSymbolVersionRequirementsSection;
0025 class ElfGNUSymbolVersionRequirementAuxiliaryEntry;
0026 
0027 /** Entry in the .gnu.version_r section. */
0028 class ElfGNUSymbolVersionRequirement
0029 {
0030 public:
0031     ElfGNUSymbolVersionRequirement(const ElfGNUSymbolVersionRequirement&) = delete;
0032     explicit ElfGNUSymbolVersionRequirement(ElfGNUSymbolVersionRequirementsSection *section, uint32_t offset);
0033     ~ElfGNUSymbolVersionRequirement();
0034 
0035     ElfGNUSymbolVersionRequirement& operator=(const ElfGNUSymbolVersionRequirement&) = delete;
0036 
0037     ElfGNUSymbolVersionRequirementsSection* section() const;
0038 
0039     uint16_t auxiliarySize() const;
0040     const char* fileName() const;
0041     uint32_t auxiliaryOffset() const;
0042     uint32_t nextOffset() const;
0043 
0044     /** Size of this entry including its aux entries. Next one follows right afterwards. */
0045     uint32_t size() const;
0046 
0047     ElfGNUSymbolVersionRequirementAuxiliaryEntry* auxiliaryEntry(uint32_t index) const;
0048 
0049     const unsigned char* rawData() const;
0050 
0051 private:
0052     ElfGNUSymbolVersionRequirementsSection *m_section;
0053     const Elf64_Verneed* const m_verNeed;
0054     QVector<ElfGNUSymbolVersionRequirementAuxiliaryEntry*> m_auxEntries;
0055 };
0056 
0057 #endif // ELFGNUSYMBOLVERSIONREQUIREMENT_H