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

Class representing the LC_LAZY_LOAD_DYLIB_INFO load command. More...

#include <LazyLoadDylibInfo.hpp>

Inheritance diagram for LIEF::MachO::LazyLoadDylibInfo:
Collaboration diagram for LIEF::MachO::LazyLoadDylibInfo:

Classes

class  Fixup
 A single lazy-binding fixup decoded from the chain referenced by chain_start_image_offset and decoded according to pointer_format. More...

Public Types

using fixups_t = std::vector<Fixup>
using it_fixups = ref_iterator<fixups_t&>
 Iterator that outputs Fixup&.
using it_const_fixups = const_ref_iterator<const fixups_t&>
 Iterator that outputs const Fixup&.
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 , ATOM_INFO = 0x00000036u ,
  FUNCTION_VARIANTS = 0x00000037u , FUNCTION_VARIANT_FIXUPS = 0x00000038u , TARGET_TRIPLE = 0x00000039u , LAZY_LOAD_DYLIB_INFO = 0x0000003Au ,
  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

 LazyLoadDylibInfo ()
 LazyLoadDylibInfo (const details::linkedit_data_command &cmd)
LazyLoadDylibInfooperator= (const LazyLoadDylibInfo &copy)=default
 LazyLoadDylibInfo (const LazyLoadDylibInfo &copy)=default
std::unique_ptr< LoadCommandclone () const override
uint32_t data_offset () const
 Offset in the __LINKEDIT segment where the payload starts.
uint32_t data_size () const
 Size of the payload.
void data_offset (uint32_t offset)
void data_size (uint32_t size)
span< const uint8_t > content () const
 Return the data slice in the __LINKEDIT segment referenced by data_offset and data_size.
span< uint8_t > content ()
const std::string & load_path () const
 Load path of the dylib to bind lazily.
LazyLoadDylibInfoload_path (std::string value)
 Change the load path of the dylib to bind lazily.
uint32_t flag_image_offset () const
 Image offset of the global flag that is set once the dylib has been loaded by dyld.
LazyLoadDylibInfoflag_image_offset (uint32_t value)
uint16_t flags () const
 Raw flags associated with this command.
LazyLoadDylibInfoflags (uint16_t value)
bool may_be_missing () const
 Whether the dylib is allowed to be missing at runtime (i.e. "weak linked").
LazyLoadDylibInfomay_be_missing (bool value)
 Set or clear the "may be missing" (weak linked) bit of flags().
uint16_t pointer_format () const
 Chained-fixups pointer format used by the binding chain (e.g. DYLD_CHAINED_PTR_ARM64E_USERLAND).
LazyLoadDylibInfopointer_format (uint16_t value)
uint32_t chain_start_image_offset () const
 Image offset of the fixup chain start used to bind the dylib's symbols.
LazyLoadDylibInfochain_start_image_offset (uint32_t value)
const std::vector< std::string > & symbols () const
 List of the symbol names to bind lazily for this dylib.
LazyLoadDylibInfosymbols (std::vector< std::string > value)
 Replace the list of the symbol names to bind lazily for this dylib.
LazyLoadDylibInfoadd_symbol (std::string value)
 Append a symbol name to the list of symbols to bind lazily.
LazyLoadDylibInfoclear_symbols ()
 Remove all the symbol names to bind lazily.
it_fixups fixups ()
 Iterator over the lazy-binding Fixup entries.
it_const_fixups fixups () const
 ~LazyLoadDylibInfo () override=default
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 greater 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
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)
 Object (Object &&other) noexcept=default
Objectoperator= (Object &&other) noexcept=default
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)

Static Public Attributes

static constexpr auto MAYBE_MISSING_FLAG = 1

Detailed Description

Class representing the LC_LAZY_LOAD_DYLIB_INFO load command.

This command describes how to lazily load a dylib: instead of binding the library and its symbols at launch time, dyld keeps the information required to resolve the dylib on the first use of one of its symbols.

Member Typedef Documentation

◆ fixups_t

◆ it_const_fixups

◆ it_fixups

Constructor & Destructor Documentation

◆ LazyLoadDylibInfo() [1/3]

◆ LazyLoadDylibInfo() [2/3]

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

◆ LazyLoadDylibInfo() [3/3]

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

References LazyLoadDylibInfo().

◆ ~LazyLoadDylibInfo()

LIEF::MachO::LazyLoadDylibInfo::~LazyLoadDylibInfo ( )
overridedefault

Member Function Documentation

◆ add_symbol()

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::add_symbol ( std::string value)
inline

Append a symbol name to the list of symbols to bind lazily.

References LazyLoadDylibInfo(), and LIEF_LIFETIMEBOUND.

◆ chain_start_image_offset() [1/2]

uint32_t LIEF::MachO::LazyLoadDylibInfo::chain_start_image_offset ( ) const
inline

Image offset of the fixup chain start used to bind the dylib's symbols.

◆ chain_start_image_offset() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::chain_start_image_offset ( uint32_t value)
inline

◆ classof()

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

◆ clear_symbols()

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::clear_symbols ( )
inline

Remove all the symbol names to bind lazily.

References LazyLoadDylibInfo(), and LIEF_LIFETIMEBOUND.

◆ clone()

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

Reimplemented from LIEF::MachO::LoadCommand.

References LazyLoadDylibInfo().

◆ content() [1/2]

span< uint8_t > LIEF::MachO::LazyLoadDylibInfo::content ( )
inline

References LIEF_LIFETIMEBOUND.

◆ content() [2/2]

span< const uint8_t > LIEF::MachO::LazyLoadDylibInfo::content ( ) const
inline

Return the data slice in the __LINKEDIT segment referenced by data_offset and data_size.

References LIEF_LIFETIMEBOUND.

◆ data_offset() [1/2]

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

Offset in the __LINKEDIT segment where the payload starts.

◆ data_offset() [2/2]

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

◆ data_size() [1/2]

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

Size of the payload.

◆ data_size() [2/2]

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

◆ fixups() [1/2]

it_fixups LIEF::MachO::LazyLoadDylibInfo::fixups ( )
inline

Iterator over the lazy-binding Fixup entries.

References LIEF_LIFETIMEBOUND.

◆ fixups() [2/2]

it_const_fixups LIEF::MachO::LazyLoadDylibInfo::fixups ( ) const
inline

References LIEF_LIFETIMEBOUND.

◆ flag_image_offset() [1/2]

uint32_t LIEF::MachO::LazyLoadDylibInfo::flag_image_offset ( ) const
inline

Image offset of the global flag that is set once the dylib has been loaded by dyld.

◆ flag_image_offset() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::flag_image_offset ( uint32_t value)
inline

◆ flags() [1/2]

uint16_t LIEF::MachO::LazyLoadDylibInfo::flags ( ) const
inline

Raw flags associated with this command.

◆ flags() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::flags ( uint16_t value)
inline

◆ load_path() [1/2]

const std::string & LIEF::MachO::LazyLoadDylibInfo::load_path ( ) const
inline

Load path of the dylib to bind lazily.

References LIEF_LIFETIMEBOUND.

◆ load_path() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::load_path ( std::string value)
inline

Change the load path of the dylib to bind lazily.

References LazyLoadDylibInfo(), and LIEF_LIFETIMEBOUND.

◆ may_be_missing() [1/2]

bool LIEF::MachO::LazyLoadDylibInfo::may_be_missing ( ) const
inline

Whether the dylib is allowed to be missing at runtime (i.e. "weak linked").

References MAYBE_MISSING_FLAG.

◆ may_be_missing() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::may_be_missing ( bool value)
inline

Set or clear the "may be missing" (weak linked) bit of flags().

References LazyLoadDylibInfo(), LIEF_LIFETIMEBOUND, and MAYBE_MISSING_FLAG.

◆ operator=()

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

References LazyLoadDylibInfo().

◆ pointer_format() [1/2]

uint16_t LIEF::MachO::LazyLoadDylibInfo::pointer_format ( ) const
inline

Chained-fixups pointer format used by the binding chain (e.g. DYLD_CHAINED_PTR_ARM64E_USERLAND).

◆ pointer_format() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::pointer_format ( uint16_t value)
inline

◆ print()

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

Reimplemented from LIEF::MachO::LoadCommand.

◆ symbols() [1/2]

const std::vector< std::string > & LIEF::MachO::LazyLoadDylibInfo::symbols ( ) const
inline

List of the symbol names to bind lazily for this dylib.

References LIEF_LIFETIMEBOUND.

◆ symbols() [2/2]

LazyLoadDylibInfo & LIEF::MachO::LazyLoadDylibInfo::symbols ( std::vector< std::string > value)
inline

Replace the list of the symbol names to bind lazily for this dylib.

References LazyLoadDylibInfo(), and LIEF_LIFETIMEBOUND.

Member Data Documentation

◆ MAYBE_MISSING_FLAG

auto LIEF::MachO::LazyLoadDylibInfo::MAYBE_MISSING_FLAG = 1
staticconstexpr

Referenced by may_be_missing(), and may_be_missing().


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