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