LIEF: Library to Instrument Executable Formats Version
Loading...
Searching...
No Matches
SymbolVersionDefinition.hpp
1/* Copyright 2017 - 2023 R. Thomas
2 * Copyright 2017 - 2023 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 <ostream>
19#include <memory>
20
21#include "LIEF/Object.hpp"
22#include "LIEF/visibility.h"
23#include "LIEF/iterators.hpp"
24
25#include "LIEF/ELF/enums.hpp"
26
27namespace LIEF {
28namespace ELF {
29
30class SymbolVersionAux;
31class Parser;
32
33namespace details {
34struct Elf64_Verdef;
35struct Elf32_Verdef;
36}
37
39class LIEF_API SymbolVersionDefinition : public Object {
40 friend class Parser;
41 public:
42 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);
49 ~SymbolVersionDefinition() override;
50
53 void swap(SymbolVersionDefinition& other);
54
59 uint16_t version() const;
60
62 uint16_t flags() const;
63
67 uint16_t ndx() const;
68
70 uint32_t hash() const;
71
74 it_const_version_aux symbols_aux() const;
75
76 void version(uint16_t version);
77 void flags(uint16_t flags);
78 void hash(uint32_t hash);
79
80 void accept(Visitor& visitor) const override;
81
82
83 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SymbolVersionDefinition& sym);
84
85 private:
86 uint16_t version_ = 1;
87 uint16_t flags_ = 0;
88 uint16_t ndx_ = 0;
89 uint32_t hash_ = 0;
90 version_aux_t symbol_version_aux_;
91};
92}
93}
94#endif
95
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:44
Class which represents an entry defined in DT_VERDEF or .gnu.version_d
Definition SymbolVersionDefinition.hpp:39
it_version_aux symbols_aux()
SymbolVersionAux entries.
uint32_t hash() const
Hash value of the symbol's name (using ELF hash function)
uint16_t ndx() const
Version index.
uint16_t version() const
Version revision.
uint16_t flags() const
Version information.
Definition Object.hpp:25
Definition Visitor.hpp:219
Iterator which returns reference on container's values.
Definition iterators.hpp:48
LIEF namespace.
Definition Abstract/Binary.hpp:32