File indexing completed on 2024-05-12 05:43:29

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 ELFGNUSYMBOLVERSIONDEFINITIONSSECTION_H
0019 #define ELFGNUSYMBOLVERSIONDEFINITIONSSECTION_H
0020 
0021 #include "elfsection.h"
0022 
0023 #include <QVector>
0024 
0025 class ElfGNUSymbolVersionDefinition;
0026 
0027 /** .gnu.version_d section. */
0028 class ElfGNUSymbolVersionDefinitionsSection : public ElfSection
0029 {
0030 public:
0031     explicit ElfGNUSymbolVersionDefinitionsSection(ElfFile *file, ElfSectionHeader *shdr);
0032     ~ElfGNUSymbolVersionDefinitionsSection();
0033 
0034     uint32_t entryCount() const;
0035     /** This returns the definition at position @p index in the file.
0036      *  Ie. @p index is a 0-based array index, unlike in the method below.
0037      */
0038     ElfGNUSymbolVersionDefinition* definition(uint32_t index) const;
0039     /** This returns the definition with version index @p index.
0040      *  Ie. @p index is the number referenced in the various version entries.
0041      */
0042     ElfGNUSymbolVersionDefinition* definitionForVersionIndex(uint16_t index) const;
0043 
0044 protected:
0045     // parsing needs to be delayed until file()->dynamicSection() works
0046     friend class ElfFile;
0047     void parse();
0048 
0049 private:
0050      QVector<ElfGNUSymbolVersionDefinition*> m_versionDefinitions;
0051 };
0052 
0053 #endif // ELFGNUSYMBOLVERSIONDEFINITIONSSECTION_H