LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
SymbolVersionDefinition.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_ELF_SYMBOL_VERSION_DEFINITION_H
16#define LIEF_ELF_SYMBOL_VERSION_DEFINITION_H
17#include <cstdint>
18#include <memory>
19#include <ostream>
20
21#include "LIEF/Object.hpp"
22#include "LIEF/iterators.hpp"
23#include "LIEF/visibility.h"
24
25
26namespace LIEF::ELF {
27
29class Parser;
30
31namespace details {
32struct Elf64_Verdef;
33struct Elf32_Verdef;
34}
35
38 friend class Parser;
39
40 public:
41 using version_aux_t = std::vector<std::unique_ptr<SymbolVersionAux>>;
45
47 SymbolVersionDefinition(const details::Elf64_Verdef& header);
48 SymbolVersionDefinition(const details::Elf32_Verdef& header);
50
54
59 uint16_t version() const {
60 return version_;
61 }
62
64 uint16_t flags() const {
65 return flags_;
66 }
67
71 uint16_t ndx() const {
72 return ndx_;
73 }
74
76 uint32_t hash() const {
77 return hash_;
78 }
79
82 return symbol_version_aux_;
83 }
84
86 return symbol_version_aux_;
87 }
88
89 void version(uint16_t version) {
90 version_ = version;
91 }
92
93 void flags(uint16_t flags) {
94 flags_ = flags;
95 }
96
97 void hash(uint32_t hash) {
98 hash_ = hash;
99 }
100
101 void accept(Visitor& visitor) const override;
102
103 LIEF_API friend std::ostream& operator<<(std::ostream& os,
104 const SymbolVersionDefinition& sym);
105
106 private:
107 uint16_t version_ = 1;
108 uint16_t flags_ = 0;
109 uint16_t ndx_ = 0;
110 uint32_t hash_ = 0;
111 version_aux_t symbol_version_aux_;
112};
113}
114
115#endif
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:46
Class which represents an Auxiliary Symbol version.
Definition SymbolVersionAux.hpp:31
void hash(uint32_t hash)
Definition SymbolVersionDefinition.hpp:97
SymbolVersionDefinition(const SymbolVersionDefinition &other)
it_version_aux symbols_aux()
SymbolVersionAux entries.
Definition SymbolVersionDefinition.hpp:81
SymbolVersionDefinition(const details::Elf64_Verdef &header)
void accept(Visitor &visitor) const override
uint32_t hash() const
Hash value of the symbol's name (using ELF hash function).
Definition SymbolVersionDefinition.hpp:76
uint16_t ndx() const
Version index.
Definition SymbolVersionDefinition.hpp:71
ref_iterator< version_aux_t &, SymbolVersionAux * > it_version_aux
Definition SymbolVersionDefinition.hpp:42
const_ref_iterator< const version_aux_t &, const SymbolVersionAux * > it_const_version_aux
Definition SymbolVersionDefinition.hpp:43
friend std::ostream & operator<<(std::ostream &os, const SymbolVersionDefinition &sym)
std::vector< std::unique_ptr< SymbolVersionAux > > version_aux_t
Definition SymbolVersionDefinition.hpp:41
void flags(uint16_t flags)
Definition SymbolVersionDefinition.hpp:93
uint16_t version() const
Version revision.
Definition SymbolVersionDefinition.hpp:59
SymbolVersionDefinition(const details::Elf32_Verdef &header)
friend class Parser
Definition SymbolVersionDefinition.hpp:38
it_const_version_aux symbols_aux() const
Definition SymbolVersionDefinition.hpp:85
SymbolVersionDefinition & operator=(SymbolVersionDefinition other)
void swap(SymbolVersionDefinition &other)
void version(uint16_t version)
Definition SymbolVersionDefinition.hpp:89
uint16_t flags() const
Version information.
Definition SymbolVersionDefinition.hpp:64
Definition Visitor.hpp:211
Iterator which returns reference on container's values.
Definition iterators.hpp:120
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition ELF/Binary.hpp:43
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:27
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which returns a const ref on container's values.
Definition iterators.hpp:385
#define LIEF_API
Definition visibility.h:44