LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
SymbolVersion.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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_H
17#define LIEF_ELF_SYMBOL_VERSION_H
18#include <ostream>
19#include <cstdint>
20
21#include "LIEF/Object.hpp"
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace ELF {
26class Parser;
29class LIEF_API SymbolVersion : public Object {
33 friend class Parser;
34
35 public:
36 SymbolVersion(uint16_t value) :
37 value_(value)
38 {}
39 SymbolVersion() = default;
40 static SymbolVersion local() {
43 return SymbolVersion(0);
44 }
45 static SymbolVersion global() {
48 return SymbolVersion(1);
49 }
50
51 ~SymbolVersion() override = default;
52
53 SymbolVersion& operator=(const SymbolVersion&) = default;
54 SymbolVersion(const SymbolVersion&) = default;
55 uint16_t value() const {
63 return value_;
64 }
65 bool has_auxiliary_version() const {
68 return symbol_version_auxiliary() != nullptr;
69 }
70 SymbolVersionAux* symbol_version_auxiliary() {
74 return symbol_aux_;
75 }
76
77 const SymbolVersionAux* symbol_version_auxiliary() const {
78 return symbol_aux_;
79 }
80 void symbol_version_auxiliary(SymbolVersionAuxRequirement& svauxr);
88
89 void value(uint16_t v) {
90 value_ = v;
91 }
92
93 void accept(Visitor& visitor) const override;
94
95 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SymbolVersion& symv);
96
97 private:
98 uint16_t value_ = 0;
99 SymbolVersionAux* symbol_aux_ = nullptr;
100};
101}
102}
103#endif
Object.hpp
LIEF::ELF::Parser
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
LIEF::ELF::SymbolVersionAuxRequirement
Definition SymbolVersionAuxRequirement.hpp:35
LIEF::ELF::SymbolVersionAux
Class which represents an Auxiliary Symbol version.
Definition SymbolVersionAux.hpp:30
LIEF::ELF::SymbolVersion
Class which represents an entry defined in the DT_VERSYM dynamic entry.
Definition SymbolVersion.hpp:32
LIEF::ELF::SymbolVersion::symbol_version_auxiliary
const SymbolVersionAux * symbol_version_auxiliary() const
Definition SymbolVersion.hpp:77
LIEF::ELF::SymbolVersion::has_auxiliary_version
bool has_auxiliary_version() const
Whether the current SymbolVersion has an auxiliary one.
Definition SymbolVersion.hpp:67
LIEF::ELF::SymbolVersion::operator=
SymbolVersion & operator=(const SymbolVersion &)=default
LIEF::ELF::SymbolVersion::local
static SymbolVersion local()
Generate a local SymbolVersion.
Definition SymbolVersion.hpp:42
LIEF::ELF::SymbolVersion::SymbolVersion
SymbolVersion()=default
LIEF::ELF::SymbolVersion::~SymbolVersion
~SymbolVersion() override=default
LIEF::ELF::SymbolVersion::operator<<
friend std::ostream & operator<<(std::ostream &os, const SymbolVersion &symv)
LIEF::ELF::SymbolVersion::accept
void accept(Visitor &visitor) const override
LIEF::ELF::SymbolVersion::SymbolVersion
SymbolVersion(const SymbolVersion &)=default
LIEF::ELF::SymbolVersion::symbol_version_auxiliary
void symbol_version_auxiliary(SymbolVersionAuxRequirement &svauxr)
Set the version's auxiliary requirement The given SymbolVersionAuxRequirement must be an existing ref...
LIEF::ELF::SymbolVersion::global
static SymbolVersion global()
Generate a global SymbolVersion.
Definition SymbolVersion.hpp:47
LIEF::ELF::SymbolVersion::SymbolVersion
SymbolVersion(uint16_t value)
Definition SymbolVersion.hpp:36
LIEF::ELF::SymbolVersion::value
void value(uint16_t v)
Definition SymbolVersion.hpp:89
LIEF::ELF::SymbolVersion::symbol_version_auxiliary
SymbolVersionAux * symbol_version_auxiliary()
SymbolVersionAux associated with the current Version if any, or a nullptr.
Definition SymbolVersion.hpp:73
LIEF::ELF::SymbolVersion::value
uint16_t value() const
Value associated with the symbol.
Definition SymbolVersion.hpp:62
LIEF::ELF
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41