LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
LIEF::MachO::Header Class Reference

Class that represents the Mach-O header. More...

#include <Header.hpp>

Inheritance diagram for LIEF::MachO::Header:
Inheritance graph
[legend]
Collaboration diagram for LIEF::MachO::Header:
Collaboration graph
[legend]

Public Types

enum class  FILE_TYPE {
  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 : int {
  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

Headeroperator= (const Header &copy)=default
 
 Header (const Header &copy)=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)
 
OBJECT_TYPES abstract_object_type () const
 LIEF abstract object type.
 
std::pair< ARCHITECTURES, std::set< MODES > > abstract_architecture () const
 
ENDIANNESS abstract_endianness () const
 LIEF abstract endiannes.
 
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)
 
Headeroperator+= (FLAGS c)
 
Headeroperator-= (FLAGS c)
 
void accept (Visitor &visitor) const override
 
- Public Member Functions inherited from LIEF::Object
 Object (const Object &other)
 
Objectoperator= (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 Attributes

static constexpr int ABI64 = 0x01000000
 

Detailed Description

Class that represents the Mach-O header.

Member Function Documentation

◆ accept()

void LIEF::MachO::Header::accept ( Visitor & visitor) const
overridevirtual

Implements LIEF::Object.

◆ flags()

uint32_t LIEF::MachO::Header::flags ( ) const
inline

Header flags (cf. HEADER_FLAGS)

See also
flags_list

The documentation for this class was generated from the following file: