LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Class that represents the Mach-O header. More...
#include <Header.hpp>
Public Types | |
enum class | FILE_TYPE : uint32_t { UNKNOWN = 0 , OBJECT = 0x1u , EXECUTE = 0x2u , FVMLIB = 0x3u , CORE = 0x4u , PRELOAD = 0x5u , DYLIB = 0x6u , DYLINKER = 0x7u , BUNDLE = 0x8u , DYLIB_STUB = 0x9u , DSYM = 0xAu , KEXT_BUNDLE = 0xBu } |
enum class | FLAGS : uint32_t { NOUNDEFS = 0x00000001u , INCRLINK = 0x00000002u , DYLDLINK = 0x00000004u , BINDATLOAD = 0x00000008u , PREBOUND = 0x00000010u , SPLIT_SEGS = 0x00000020u , LAZY_INIT = 0x00000040u , TWOLEVEL = 0x00000080u , FORCE_FLAT = 0x00000100u , NOMULTIDEFS = 0x00000200u , NOFIXPREBINDING = 0x00000400u , PREBINDABLE = 0x00000800u , ALLMODSBOUND = 0x00001000u , SUBSECTIONS_VIA_SYMBOLS = 0x00002000u , CANONICAL = 0x00004000u , WEAK_DEFINES = 0x00008000u , BINDS_TO_WEAK = 0x00010000u , ALLOW_STACK_EXECUTION = 0x00020000u , ROOT_SAFE = 0x00040000u , SETUID_SAFE = 0x00080000u , NO_REEXPORTED_DYLIBS = 0x00100000u , PIE = 0x00200000u , DEAD_STRIPPABLE_DYLIB = 0x00400000u , HAS_TLV_DESCRIPTORS = 0x00800000u , NO_HEAP_EXECUTION = 0x01000000u , APP_EXTENSION_SAFE = 0x02000000u } |
enum class | CPU_TYPE : int32_t { ANY = -1 , X86 = 7 , X86_64 = 7 | ABI64 , MIPS = 8 , MC98000 = 10 , ARM = 12 , ARM64 = 12 | ABI64 , SPARC = 14 , POWERPC = 18 , POWERPC64 = 18 | ABI64 } |
Public Types inherited from LIEF::Object | |
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 | |
Header ()=default | |
Header & | operator= (const Header ©)=default |
Header (const Header ©)=default | |
~Header () override=default | |
MACHO_TYPES | magic () const |
The Mach-O magic bytes. These bytes determine whether it is a 32 bits Mach-O, a 64 bits Mach-O files etc. | |
CPU_TYPE | cpu_type () const |
The CPU architecture targeted by this binary. | |
uint32_t | cpu_subtype () const |
Return the CPU subtype supported by the Mach-O binary. For ARM architectures, this value could represent the minimum version for which the Mach-O binary has been compiled for. | |
FILE_TYPE | file_type () const |
Return the type of the Mach-O file (executable, object, shared library, ...) | |
std::vector< FLAGS > | flags_list () const |
Return the FLAGS as a list. | |
bool | has (FLAGS flag) const |
Check if the given HEADER_FLAGS is present in the header's flags. | |
uint32_t | nb_cmds () const |
Number of LoadCommand present in the Mach-O binary. | |
uint32_t | sizeof_cmds () const |
The size of all the LoadCommand. | |
uint32_t | flags () const |
Header flags (cf. HEADER_FLAGS) | |
uint32_t | reserved () const |
According to the official documentation, a reserved value. | |
void | add (FLAGS flag) |
void | magic (MACHO_TYPES magic) |
void | cpu_type (CPU_TYPE type) |
void | cpu_subtype (uint32_t cpusubtype) |
void | file_type (FILE_TYPE filetype) |
void | nb_cmds (uint32_t ncmds) |
void | sizeof_cmds (uint32_t sizeofcmds) |
void | flags (uint32_t flags) |
void | remove (FLAGS flag) |
void | reserved (uint32_t reserved) |
Header & | operator+= (FLAGS c) |
Header & | operator-= (FLAGS c) |
void | accept (Visitor &visitor) const override |
Public Member Functions inherited from LIEF::Object | |
Object () | |
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 |
virtual | ~Object () |
Static Public Attributes | |
static constexpr int | ABI64 = 0x01000000 |
static constexpr uint32_t | CPU_SUBTYPE_MASK = 0xff000000 |
static constexpr uint32_t | CPU_SUBTYPE_LIB64 = 0x80000000 |
static constexpr auto | CPU_SUBTYPE_ARM64_ARM64E = 2 |
Class that represents the Mach-O header.
|
strong |
|
strong |
|
strong |
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Implements LIEF::Object.
void LIEF::MachO::Header::add | ( | FLAGS | flag | ) |
|
inline |
Return the CPU subtype supported by the Mach-O binary. For ARM architectures, this value could represent the minimum version for which the Mach-O binary has been compiled for.
|
inline |
|
inline |
The CPU architecture targeted by this binary.
|
inline |
|
inline |
Return the type of the Mach-O file (executable, object, shared library, ...)
|
inline |
|
inline |
Header flags (cf. HEADER_FLAGS)
|
inline |
bool LIEF::MachO::Header::has | ( | FLAGS | flag | ) | const |
Check if the given HEADER_FLAGS is present in the header's flags.
|
inline |
The Mach-O magic bytes. These bytes determine whether it is a 32 bits Mach-O, a 64 bits Mach-O files etc.
|
inline |
|
inline |
Number of LoadCommand present in the Mach-O binary.
|
inline |
void LIEF::MachO::Header::remove | ( | FLAGS | flag | ) |
|
inline |
According to the official documentation, a reserved value.
|
inline |
|
inline |
The size of all the LoadCommand.
|
inline |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |