LIEF: Library to Instrument Executable Formats Version
|
Class which represents the ELF segments. More...
#include <Segment.hpp>
Public Types | |
using | sections_t = std::vector< Section * > |
using | it_sections = ref_iterator< sections_t & > |
using | it_const_sections = const_ref_iterator< const sections_t & > |
![]() | |
template<class T > | |
using | output_t = add_pointer_t< decay_t< T > > |
template<class T > | |
using | output_const_t = add_pointer_t< add_const_t< decay_t< T > > > |
Public Member Functions | |
Segment (const details::Elf64_Phdr &header) | |
Segment (const details::Elf32_Phdr &header) | |
Segment & | operator= (Segment other) |
Segment (const Segment &other) | |
Segment & | operator= (Segment &&) |
Segment (Segment &&) | |
void | swap (Segment &other) |
SEGMENT_TYPES | type () const |
The segment's type (LOAD, DYNAMIC, ...) | |
ELF_SEGMENT_FLAGS | flags () const |
The flag permissions associated with this segment. | |
uint64_t | file_offset () const |
The file offset of the data associated with this segment. | |
uint64_t | virtual_address () const |
The virtual address of the segment. | |
uint64_t | physical_address () const |
The physical address of the segment. This value is not really relevant on systems like Linux or Android. On the other hand, Qualcomm trustlets might use this value. | |
uint64_t | physical_size () const |
The file size of the data associated with this segment. | |
uint64_t | virtual_size () const |
The in-memory size of this segment. Usually, if the .bss segment is wrapped by this segment then, virtual_size is larger than physical_size. | |
uint64_t | alignment () const |
The offset alignment of the segment. | |
span< const uint8_t > | content () const |
The raw data associated with this segment. | |
bool | has (ELF_SEGMENT_FLAGS flag) const |
Check if the current segment has the given flag. | |
bool | has (const Section §ion) const |
Check if the current segment wraps the given ELF::Section. | |
bool | has (const std::string §ion_name) const |
Check if the current segment wraps the given section's name. | |
void | add (ELF_SEGMENT_FLAGS flag) |
Append the given ELF_SEGMENT_FLAGS. | |
void | remove (ELF_SEGMENT_FLAGS flag) |
Remove the given ELF_SEGMENT_FLAGS. | |
void | type (SEGMENT_TYPES type) |
void | flags (ELF_SEGMENT_FLAGS flags) |
void | clear_flags () |
void | file_offset (uint64_t file_offset) |
void | virtual_address (uint64_t virtual_address) |
void | physical_address (uint64_t physical_address) |
void | physical_size (uint64_t physical_size) |
void | virtual_size (uint64_t virtual_size) |
void | alignment (uint64_t alignment) |
void | content (std::vector< uint8_t > content) |
template<typename T > | |
T | get_content_value (size_t offset) const |
template<typename T > | |
void | set_content_value (size_t offset, T value) |
size_t | get_content_size () const |
it_sections | sections () |
Iterator over the sections wrapped by this segment. | |
it_const_sections | sections () const |
void | accept (Visitor &visitor) const override |
Segment & | operator+= (ELF_SEGMENT_FLAGS flag) |
Segment & | operator-= (ELF_SEGMENT_FLAGS flag) |
![]() | |
Object (const Object &other) | |
Object & | operator= (const Object &other) |
template<class T > | |
output_t< T > | as () |
template<class T > | |
output_const_t< T > | as () const |
virtual bool | operator== (const Object &other) const |
virtual bool | operator!= (const Object &other) const |
Static Public Member Functions | |
static result< Segment > | from_raw (const uint8_t *ptr, size_t size) |
static result< Segment > | from_raw (const std::vector< uint8_t > &raw) |
Class which represents the ELF segments.
|
overridevirtual |
Implements LIEF::Object.
uint64_t LIEF::ELF::Segment::physical_address | ( | ) | const |
The physical address of the segment. This value is not really relevant on systems like Linux or Android. On the other hand, Qualcomm trustlets might use this value.
Usually this value matches virtual_address