LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
ELF
NoteDetails
properties
X86Feature.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_NOTE_DETAILS_PROPERTIES_X86FEATURES_H
17
#define LIEF_ELF_NOTE_DETAILS_PROPERTIES_X86FEATURES_H
18
#include <vector>
19
#include <utility>
20
21
#include "
LIEF/ELF/NoteDetails/NoteGnuProperty.hpp
"
22
#include "
LIEF/visibility.h
"
23
24
namespace
LIEF
{
25
namespace
ELF
{
26
32
class
LIEF_API
X86Features :
public
NoteGnuProperty::Property
{
33
public
:
35
enum class
FLAG
{
36
NONE
= 0,
37
USED,
38
NEEDED,
39
};
40
42
enum class
FEATURE
{
43
UNKNOWN = 0,
44
45
IBT,
46
SHSTK,
47
LAM_U48,
48
LAM_U57,
49
X86,
50
X87,
51
MMX,
52
XMM,
53
YMM,
54
ZMM,
55
FXSR,
56
XSAVE,
57
XSAVEOPT,
58
XSAVEC,
59
TMM,
60
MASK,
61
};
62
68
using
features_t
= std::vector<std::pair<FLAG, FEATURE>>;
69
70
static
bool
classof
(
const
NoteGnuProperty::Property
* prop) {
71
return
prop->
type
() ==
NoteGnuProperty::Property::TYPE::X86_FEATURE
;
72
}
73
74
static
std::unique_ptr<X86Features>
create
(uint32_t
type
,
BinaryStream
& stream);
75
77
const
features_t
&
features
()
const
{
78
return
features_;
79
}
80
81
void
dump
(std::ostream& os)
const override
;
82
83
~X86Features
()
override
=
default
;
84
85
protected
:
86
inline
static
std::unique_ptr<X86Features> create_feat1(
FLAG
flag,
87
BinaryStream
& stream);
88
inline
static
std::unique_ptr<X86Features> create_feat2(
FLAG
flag,
89
BinaryStream
& stream);
90
X86Features(
features_t
values) :
91
NoteGnuProperty
::
Property
(
NoteGnuProperty
::
Property
::
TYPE
::X86_FEATURE),
92
features_(std::move(values)) {}
93
94
features_t features_;
95
};
96
97
LIEF_API
const
char
*
to_string
(
X86Features::FLAG
flag);
98
LIEF_API
const
char
*
to_string
(
X86Features::FEATURE
feat);
99
100
}
101
}
102
103
#endif
NoteGnuProperty.hpp
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:33
LIEF::ELF::NoteGnuProperty::Property
This class wraps the different properties that can be used in a NT_GNU_PROPERTY_TYPE_0 note.
Definition
NoteGnuProperty.hpp:34
LIEF::ELF::NoteGnuProperty::Property::TYPE
TYPE
LIEF's mirror types of the original GNU_PROPERTY_ values.
Definition
NoteGnuProperty.hpp:39
LIEF::ELF::NoteGnuProperty::Property::TYPE::X86_FEATURE
@ X86_FEATURE
Definition
NoteGnuProperty.hpp:61
LIEF::ELF::NoteGnuProperty::Property::Property
Property()=delete
LIEF::ELF::NoteGnuProperty::Property::type
TYPE type() const
Return the LIEF's mirror type of the note.
Definition
NoteGnuProperty.hpp:67
LIEF::ELF::NoteGnuProperty
Class that wraps the NT_GNU_PROPERTY_TYPE_0 note.
Definition
NoteGnuProperty.hpp:30
LIEF::ELF::X86Features::create
static std::unique_ptr< X86Features > create(uint32_t type, BinaryStream &stream)
LIEF::ELF::X86Features::classof
static bool classof(const NoteGnuProperty::Property *prop)
Definition
X86Feature.hpp:70
LIEF::ELF::X86Features::FLAG
FLAG
Flag according to the _AND, _USED or _NEEDED suffixes.
Definition
X86Feature.hpp:35
LIEF::ELF::X86Features::features
const features_t & features() const
List of the features.
Definition
X86Feature.hpp:77
LIEF::ELF::X86Features::dump
void dump(std::ostream &os) const override
LIEF::ELF::X86Features::FEATURE
FEATURE
Features provided by these different properties.
Definition
X86Feature.hpp:42
LIEF::ELF::X86Features::features_t
std::vector< std::pair< FLAG, FEATURE > > features_t
List of the features as a pair of FLAG, FEATURE.
Definition
X86Feature.hpp:68
LIEF::ELF::X86Features::~X86Features
~X86Features() override=default
LIEF::ELF
Namespace related to the LIEF's ELF module.
Definition
Abstract/Header.hpp:28
LIEF::ELF::to_string
const char * to_string(DynamicEntry::TAG e)
LIEF::ELF::ARCH::NONE
@ NONE
Definition
ELF/enums.hpp:31
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.17.0