LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
ELF
DynamicSharedObject.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_DYNAMIC_SHARED_OBJECT_H
17
#define LIEF_ELF_DYNAMIC_SHARED_OBJECT_H
18
19
#include <string_view>
20
#include <memory>
21
#include <string>
22
23
#include "
LIEF/ELF/DynamicEntry.hpp
"
24
#include "
LIEF/compiler_attributes.hpp
"
25
#include "
LIEF/visibility.h
"
26
27
28
namespace
LIEF::ELF
{
29
34
class
LIEF_API
DynamicSharedObject
:
public
DynamicEntry
{
35
36
public
:
37
using
DynamicEntry::DynamicEntry
;
38
DynamicSharedObject
() :
39
DynamicEntry
(
DynamicEntry
::
TAG
::SONAME, 0) {}
40
41
DynamicSharedObject
(std::string
name
) :
42
DynamicEntry
(
DynamicEntry
::
TAG
::SONAME, 0),
43
name_(std::move(
name
)) {}
44
45
DynamicSharedObject
&
operator=
(
const
DynamicSharedObject
&) =
default
;
46
DynamicSharedObject
(
const
DynamicSharedObject
&) =
default
;
47
48
std::unique_ptr<DynamicEntry>
clone
()
const override
{
49
return
std::make_unique<DynamicSharedObject>(*
this
);
50
}
51
53
std::string_view
name
() const
LIEF_LIFETIMEBOUND
{
54
return
name_;
55
}
56
57
void
name
(std::string
name
) {
58
name_ = std::move(
name
);
59
}
60
61
void
accept
(
Visitor
& visitor)
const override
;
62
63
std::ostream&
print
(std::ostream& os)
const override
;
64
65
static
bool
classof
(
const
DynamicEntry
* entry) {
66
return
entry->
tag
() ==
DynamicEntry::TAG::SONAME
;
67
}
68
69
~DynamicSharedObject
()
override
=
default
;
70
71
private
:
72
std::string name_;
73
};
74
}
75
76
#endif
DynamicEntry.hpp
LIEF::ELF::DynamicEntry::TAG
TAG
Definition
DynamicEntry.hpp:49
LIEF::ELF::DynamicEntry::TAG::SONAME
@ SONAME
Definition
DynamicEntry.hpp:65
LIEF::ELF::DynamicEntry::tag
TAG tag() const
Tag of the current entry. The most common tags are: DT_NEEDED, DT_INIT, ...
Definition
DynamicEntry.hpp:252
LIEF::ELF::DynamicEntry::DynamicEntry
DynamicEntry()=default
LIEF::ELF::DynamicSharedObject::~DynamicSharedObject
~DynamicSharedObject() override=default
LIEF::ELF::DynamicSharedObject::name
void name(std::string name)
Definition
DynamicSharedObject.hpp:57
LIEF::ELF::DynamicSharedObject::DynamicSharedObject
DynamicSharedObject(std::string name)
Definition
DynamicSharedObject.hpp:41
LIEF::ELF::DynamicSharedObject::accept
void accept(Visitor &visitor) const override
LIEF::ELF::DynamicSharedObject::name
std::string_view name() const
The actual name (e.g. libMyLib.so).
Definition
DynamicSharedObject.hpp:53
LIEF::ELF::DynamicSharedObject::clone
std::unique_ptr< DynamicEntry > clone() const override
Definition
DynamicSharedObject.hpp:48
LIEF::ELF::DynamicSharedObject::print
std::ostream & print(std::ostream &os) const override
LIEF::ELF::DynamicSharedObject::DynamicSharedObject
DynamicSharedObject(const DynamicSharedObject &)=default
LIEF::ELF::DynamicSharedObject::DynamicSharedObject
DynamicSharedObject()
Definition
DynamicSharedObject.hpp:38
LIEF::ELF::DynamicSharedObject::classof
static bool classof(const DynamicEntry *entry)
Definition
DynamicSharedObject.hpp:65
LIEF::ELF::DynamicSharedObject::operator=
DynamicSharedObject & operator=(const DynamicSharedObject &)=default
LIEF::ELF::DynamicSharedObject::DynamicEntry
DynamicEntry()=default
LIEF::Visitor
Definition
Visitor.hpp:212
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
LIEF::ELF
Namespace related to the LIEF's ELF module.
Definition
Abstract/Header.hpp:28
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.18.0