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

Class that represents the LC_DYLD_CHAINED_FIXUPS command. More...

#include <DyldChainedFixups.hpp>

Inheritance diagram for LIEF::MachO::DyldChainedFixups:
Collaboration diagram for LIEF::MachO::DyldChainedFixups:

Classes

struct  chained_starts_in_segment
 Structure that mirrors the raw dyld_chained_starts_in_segment which aims at providing information about the chained rebase/bind fixups. More...
 

Public Types

using chained_starts_in_segments_t = std::vector<chained_starts_in_segment>
 Internal container for storing chained_starts_in_segment.
 
using it_chained_starts_in_segments_t = ref_iterator<chained_starts_in_segments_t&>
 Iterator that outputs chained_starts_in_segment&.
 
using it_const_chained_starts_in_segments_t = const_ref_iterator<const chained_starts_in_segments_t&>
 Iterator that outputs const chained_starts_in_segment&.
 
using binding_info_t = std::vector<std::unique_ptr<ChainedBindingInfo>>
 Internal container for storing DyldBindingInfo.
 
using it_binding_info = ref_iterator<binding_info_t&, ChainedBindingInfo*>
 Iterator which outputs DyldBindingInfo&.
 
using it_const_binding_info = const_ref_iterator<const binding_info_t&, ChainedBindingInfo*>
 Iterator which outputs const DyldBindingInfo&.
 
- 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>>>
 

Public Member Functions

 DyldChainedFixups ()
 
 DyldChainedFixups (const details::linkedit_data_command &cmd)
 
std::unique_ptr< LoadCommandclone () const override
 
 ~DyldChainedFixups () override
 
uint32_t data_offset () const
 Offset of the LC_DYLD_CHAINED_FIXUPS chained payload. This offset should point in the __LINKEDIT segment.
 
uint32_t data_size () const
 Size of the LC_DYLD_CHAINED_FIXUPS payload.
 
void data_offset (uint32_t offset)
 
void data_size (uint32_t size)
 
it_binding_info bindings ()
 Iterator over the bindings (ChainedBindingInfo) associated with this command.
 
it_const_binding_info bindings () const
 Iterator over the bindings (ChainedBindingInfo) associated with this command.
 
it_chained_starts_in_segments_t chained_starts_in_segments ()
 Iterator over the chained fixup metadata.
 
it_const_chained_starts_in_segments_t chained_starts_in_segments () const
 
uint32_t fixups_version () const
 Chained fixups version. The loader (dyld v852.2) checks that this value is set to 0.
 
void fixups_version (uint32_t version)
 
uint32_t starts_offset () const
 offset of dyld_chained_starts_in_image in chain_data
 
void starts_offset (uint32_t offset)
 
uint32_t imports_offset () const
 Offset of imports table in chain data.
 
void imports_offset (uint32_t offset)
 
uint32_t symbols_offset () const
 Offset of symbol strings in chain data.
 
void symbols_offset (uint32_t offset)
 
uint32_t imports_count () const
 Number of imported symbol names.
 
void imports_count (uint32_t cnt)
 
uint32_t symbols_format () const
 The compression algorithm (if any) used to store the symbols 0 means uncompressed while 1 means zlib compressed.
 
void symbols_format (uint32_t fmt)
 
DYLD_CHAINED_FORMAT imports_format () const
 The format of the imports (ChainedBindingInfo)
 
void imports_format (DYLD_CHAINED_FORMAT fmt)
 
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)
 
void accept (Visitor &visitor) const override
 
- 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)
 

Detailed Description

Class that represents the LC_DYLD_CHAINED_FIXUPS command.

This command aims at providing rebase and binding information like the DyldInfo's bytecode. Compared to the DyldInfo bytecode, these chained fixups are taking less space.

Member Typedef Documentation

◆ binding_info_t

Internal container for storing DyldBindingInfo.

◆ chained_starts_in_segments_t

◆ it_binding_info

◆ it_chained_starts_in_segments_t

◆ it_const_binding_info

◆ it_const_chained_starts_in_segments_t

Constructor & Destructor Documentation

◆ DyldChainedFixups() [1/2]

LIEF::MachO::DyldChainedFixups::DyldChainedFixups ( )

◆ DyldChainedFixups() [2/2]

LIEF::MachO::DyldChainedFixups::DyldChainedFixups ( const details::linkedit_data_command & cmd)

◆ ~DyldChainedFixups()

LIEF::MachO::DyldChainedFixups::~DyldChainedFixups ( )
override

Member Function Documentation

◆ accept()

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

Implements LIEF::Object.

◆ bindings() [1/2]

it_binding_info LIEF::MachO::DyldChainedFixups::bindings ( )
inline

Iterator over the bindings (ChainedBindingInfo) associated with this command.

◆ bindings() [2/2]

it_const_binding_info LIEF::MachO::DyldChainedFixups::bindings ( ) const
inline

Iterator over the bindings (ChainedBindingInfo) associated with this command.

◆ chained_starts_in_segments() [1/2]

it_chained_starts_in_segments_t LIEF::MachO::DyldChainedFixups::chained_starts_in_segments ( )
inline

Iterator over the chained fixup metadata.

◆ chained_starts_in_segments() [2/2]

it_const_chained_starts_in_segments_t LIEF::MachO::DyldChainedFixups::chained_starts_in_segments ( ) const
inline

◆ classof()

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

◆ clone()

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

Reimplemented from LIEF::MachO::LoadCommand.

◆ data_offset() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::data_offset ( ) const
inline

Offset of the LC_DYLD_CHAINED_FIXUPS chained payload. This offset should point in the __LINKEDIT segment.

◆ data_offset() [2/2]

void LIEF::MachO::DyldChainedFixups::data_offset ( uint32_t offset)
inline

◆ data_size() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::data_size ( ) const
inline

Size of the LC_DYLD_CHAINED_FIXUPS payload.

◆ data_size() [2/2]

void LIEF::MachO::DyldChainedFixups::data_size ( uint32_t size)
inline

◆ fixups_version() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::fixups_version ( ) const
inline

Chained fixups version. The loader (dyld v852.2) checks that this value is set to 0.

◆ fixups_version() [2/2]

void LIEF::MachO::DyldChainedFixups::fixups_version ( uint32_t version)
inline

◆ imports_count() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::imports_count ( ) const
inline

Number of imported symbol names.

◆ imports_count() [2/2]

void LIEF::MachO::DyldChainedFixups::imports_count ( uint32_t cnt)
inline

◆ imports_format() [1/2]

DYLD_CHAINED_FORMAT LIEF::MachO::DyldChainedFixups::imports_format ( ) const
inline

The format of the imports (ChainedBindingInfo)

◆ imports_format() [2/2]

void LIEF::MachO::DyldChainedFixups::imports_format ( DYLD_CHAINED_FORMAT fmt)
inline

◆ imports_offset() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::imports_offset ( ) const
inline

Offset of imports table in chain data.

◆ imports_offset() [2/2]

void LIEF::MachO::DyldChainedFixups::imports_offset ( uint32_t offset)
inline

◆ print()

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

Reimplemented from LIEF::MachO::LoadCommand.

◆ starts_offset() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::starts_offset ( ) const
inline

offset of dyld_chained_starts_in_image in chain_data

◆ starts_offset() [2/2]

void LIEF::MachO::DyldChainedFixups::starts_offset ( uint32_t offset)
inline

◆ symbols_format() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::symbols_format ( ) const
inline

The compression algorithm (if any) used to store the symbols 0 means uncompressed while 1 means zlib compressed.

As far of the version v852.2 of dyld loader, it only supports uncompressed format

◆ symbols_format() [2/2]

void LIEF::MachO::DyldChainedFixups::symbols_format ( uint32_t fmt)
inline

◆ symbols_offset() [1/2]

uint32_t LIEF::MachO::DyldChainedFixups::symbols_offset ( ) const
inline

Offset of symbol strings in chain data.

◆ symbols_offset() [2/2]

void LIEF::MachO::DyldChainedFixups::symbols_offset ( uint32_t offset)
inline

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