LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
LIEF::MachO::Routine Class Reference

Class that represents the LC_ROUTINE/LC_ROUTINE64 commands. Accodring to the Mach-O loader.h documentation: More...

#include <Routine.hpp>

Inheritance diagram for LIEF::MachO::Routine:
Collaboration diagram for LIEF::MachO::Routine:

Public Member Functions

 Routine ()=default
 
template<class T >
 Routine (const T &cmd)
 
Routineoperator= (const Routine &copy)=default
 
 Routine (const Routine &copy)=default
 
std::unique_ptr< LoadCommandclone () const override
 
uint64_t init_address () const
 address of initialization routine
 
void init_address (uint64_t addr)
 
uint64_t init_module () const
 Index into the module table that the init routine is defined in.
 
void init_module (uint64_t mod)
 
uint64_t reserved1 () const
 
void reserved1 (uint64_t value)
 
uint64_t reserved2 () const
 
void reserved2 (uint64_t value)
 
uint64_t reserved3 () const
 
void reserved3 (uint64_t value)
 
uint64_t reserved4 () const
 
void reserved4 (uint64_t value)
 
uint64_t reserved5 () const
 
void reserved5 (uint64_t value)
 
uint64_t reserved6 () const
 
void reserved6 (uint64_t value)
 
 ~Routine () override=default
 
void accept (Visitor &visitor) const override
 
std::ostream & print (std::ostream &os) const override
 
- Public Member Functions inherited from LIEF::MachO::LoadCommand
 LoadCommand ()=default
 
 LoadCommand (const details::load_command &command)
 
 LoadCommand (LoadCommand::TYPE type, uint32_t size)
 
LoadCommandoperator= (const LoadCommand &copy)=default
 
 LoadCommand (const LoadCommand &copy)=default
 
void swap (LoadCommand &other) noexcept
 
 ~LoadCommand () override=default
 
LoadCommand::TYPE command () const
 Command type.
 
uint32_t size () const
 Size of the command (should be greather than sizeof(load_command))
 
span< const uint8_t > data () const
 Raw command.
 
uint64_t command_offset () const
 Offset of the command within the Load Command Table
 
void data (raw_t data)
 
void command (LoadCommand::TYPE command)
 
void size (uint32_t size)
 
void command_offset (uint64_t offset)
 
template<class T >
const T * cast () const
 
template<class T >
T * cast ()
 
- Public Member Functions inherited from LIEF::Object
 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
 
virtual ~Object ()
 

Static Public Member Functions

static bool classof (const LoadCommand *cmd)
 
- Static Public Member Functions inherited from LIEF::MachO::LoadCommand
static bool is_linkedit_data (const LoadCommand &cmd)
 

Additional Inherited Members

- Public Types inherited from LIEF::MachO::LoadCommand
enum class  TYPE : uint64_t {
  UNKNOWN = 0 , SEGMENT = 0x00000001u , SYMTAB = 0x00000002u , SYMSEG = 0x00000003u ,
  THREAD = 0x00000004u , UNIXTHREAD = 0x00000005u , LOADFVMLIB = 0x00000006u , IDFVMLIB = 0x00000007u ,
  IDENT = 0x00000008u , FVMFILE = 0x00000009u , PREPAGE = 0x0000000Au , DYSYMTAB = 0x0000000Bu ,
  LOAD_DYLIB = 0x0000000Cu , ID_DYLIB = 0x0000000Du , LOAD_DYLINKER = 0x0000000Eu , ID_DYLINKER = 0x0000000Fu ,
  PREBOUND_DYLIB = 0x00000010u , ROUTINES = 0x00000011u , SUB_FRAMEWORK = 0x00000012u , SUB_UMBRELLA = 0x00000013u ,
  SUB_CLIENT = 0x00000014u , SUB_LIBRARY = 0x00000015u , TWOLEVEL_HINTS = 0x00000016u , PREBIND_CKSUM = 0x00000017u ,
  LOAD_WEAK_DYLIB = 0x80000018u , SEGMENT_64 = 0x00000019u , ROUTINES_64 = 0x0000001Au , UUID = 0x0000001Bu ,
  RPATH = 0x8000001Cu , CODE_SIGNATURE = 0x0000001Du , SEGMENT_SPLIT_INFO = 0x0000001Eu , REEXPORT_DYLIB = 0x8000001Fu ,
  LAZY_LOAD_DYLIB = 0x00000020u , ENCRYPTION_INFO = 0x00000021u , DYLD_INFO = 0x00000022u , DYLD_INFO_ONLY = 0x80000022u ,
  LOAD_UPWARD_DYLIB = 0x80000023u , VERSION_MIN_MACOSX = 0x00000024u , VERSION_MIN_IPHONEOS = 0x00000025u , FUNCTION_STARTS = 0x00000026u ,
  DYLD_ENVIRONMENT = 0x00000027u , MAIN = 0x80000028u , DATA_IN_CODE = 0x00000029u , SOURCE_VERSION = 0x0000002Au ,
  DYLIB_CODE_SIGN_DRS = 0x0000002Bu , ENCRYPTION_INFO_64 = 0x0000002Cu , LINKER_OPTION = 0x0000002Du , LINKER_OPTIMIZATION_HINT = 0x0000002Eu ,
  VERSION_MIN_TVOS = 0x0000002Fu , VERSION_MIN_WATCHOS = 0x00000030u , NOTE = 0x00000031u , BUILD_VERSION = 0x00000032u ,
  DYLD_EXPORTS_TRIE = 0x80000033u , DYLD_CHAINED_FIXUPS = 0x80000034u , FILESET_ENTRY = 0x80000035u , LIEF_UNKNOWN = 0xffee0001u
}
 
using raw_t = std::vector<uint8_t>
 
- 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>>>
 

Detailed Description

Class that represents the LC_ROUTINE/LC_ROUTINE64 commands. Accodring to the Mach-O loader.h documentation:

‍The routines command contains the address of the dynamic shared library initialization routine and an index into the module table for the module that defines the routine. Before any modules are used from the library the dynamic linker fully binds the module that defines the initialization routine and then calls it. This gets called before any module initialization routines (used for C++ static constructors) in the library.

Constructor & Destructor Documentation

◆ Routine() [1/3]

LIEF::MachO::Routine::Routine ( )
default

◆ Routine() [2/3]

template<class T >
LIEF::MachO::Routine::Routine ( const T & cmd)

◆ Routine() [3/3]

LIEF::MachO::Routine::Routine ( const Routine & copy)
default

◆ ~Routine()

LIEF::MachO::Routine::~Routine ( )
overridedefault

Member Function Documentation

◆ accept()

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

Reimplemented from LIEF::MachO::LoadCommand.

◆ classof()

static bool LIEF::MachO::Routine::classof ( const LoadCommand * cmd)
inlinestatic

◆ clone()

std::unique_ptr< LoadCommand > LIEF::MachO::Routine::clone ( ) const
inlineoverridevirtual

Reimplemented from LIEF::MachO::LoadCommand.

◆ init_address() [1/2]

uint64_t LIEF::MachO::Routine::init_address ( ) const
inline

address of initialization routine

◆ init_address() [2/2]

void LIEF::MachO::Routine::init_address ( uint64_t addr)
inline

◆ init_module() [1/2]

uint64_t LIEF::MachO::Routine::init_module ( ) const
inline

Index into the module table that the init routine is defined in.

◆ init_module() [2/2]

void LIEF::MachO::Routine::init_module ( uint64_t mod)
inline

◆ operator=()

Routine & LIEF::MachO::Routine::operator= ( const Routine & copy)
default

◆ print()

std::ostream & LIEF::MachO::Routine::print ( std::ostream & os) const
overridevirtual

Reimplemented from LIEF::MachO::LoadCommand.

◆ reserved1() [1/2]

uint64_t LIEF::MachO::Routine::reserved1 ( ) const
inline

◆ reserved1() [2/2]

void LIEF::MachO::Routine::reserved1 ( uint64_t value)
inline

◆ reserved2() [1/2]

uint64_t LIEF::MachO::Routine::reserved2 ( ) const
inline

◆ reserved2() [2/2]

void LIEF::MachO::Routine::reserved2 ( uint64_t value)
inline

◆ reserved3() [1/2]

uint64_t LIEF::MachO::Routine::reserved3 ( ) const
inline

◆ reserved3() [2/2]

void LIEF::MachO::Routine::reserved3 ( uint64_t value)
inline

◆ reserved4() [1/2]

uint64_t LIEF::MachO::Routine::reserved4 ( ) const
inline

◆ reserved4() [2/2]

void LIEF::MachO::Routine::reserved4 ( uint64_t value)
inline

◆ reserved5() [1/2]

uint64_t LIEF::MachO::Routine::reserved5 ( ) const
inline

◆ reserved5() [2/2]

void LIEF::MachO::Routine::reserved5 ( uint64_t value)
inline

◆ reserved6() [1/2]

uint64_t LIEF::MachO::Routine::reserved6 ( ) const
inline

◆ reserved6() [2/2]

void LIEF::MachO::Routine::reserved6 ( uint64_t value)
inline

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