Module: MachO::LoadCommands
- Defined in:
- lib/macho/load_commands.rb
Overview
Classes and constants for parsing load commands in Mach-O binaries.
Defined Under Namespace
Classes: BuildVersionCommand, DyldInfoCommand, DylibCommand, DylibUseCommand, DylinkerCommand, DysymtabCommand, EncryptionInfoCommand, EncryptionInfoCommand64, EntryPointCommand, FilesetEntryCommand, FvmfileCommand, FvmlibCommand, IdentCommand, LinkeditDataCommand, LinkerOptionCommand, LoadCommand, NoteCommand, PrebindCksumCommand, PreboundDylibCommand, RoutinesCommand, RoutinesCommand64, RpathCommand, SegmentCommand, SegmentCommand64, SourceVersionCommand, SubClientCommand, SubFrameworkCommand, SubLibraryCommand, SubUmbrellaCommand, SymsegCommand, SymtabCommand, ThreadCommand, TwolevelHintsCommand, UUIDCommand, VersionMinCommand
Constant Summary collapse
- LC_REQ_DYLD =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
load commands added after OS X 10.1 need to be bitwise ORed with LC_REQ_DYLD to be recognized by the dynamic linker (dyld)
0x80000000
- LOAD_COMMANDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of load commands to symbol representations
{ 0x1 => :LC_SEGMENT, 0x2 => :LC_SYMTAB, 0x3 => :LC_SYMSEG, 0x4 => :LC_THREAD, 0x5 => :LC_UNIXTHREAD, 0x6 => :LC_LOADFVMLIB, 0x7 => :LC_IDFVMLIB, 0x8 => :LC_IDENT, 0x9 => :LC_FVMFILE, 0xa => :LC_PREPAGE, 0xb => :LC_DYSYMTAB, 0xc => :LC_LOAD_DYLIB, 0xd => :LC_ID_DYLIB, 0xe => :LC_LOAD_DYLINKER, 0xf => :LC_ID_DYLINKER, 0x10 => :LC_PREBOUND_DYLIB, 0x11 => :LC_ROUTINES, 0x12 => :LC_SUB_FRAMEWORK, 0x13 => :LC_SUB_UMBRELLA, 0x14 => :LC_SUB_CLIENT, 0x15 => :LC_SUB_LIBRARY, 0x16 => :LC_TWOLEVEL_HINTS, 0x17 => :LC_PREBIND_CKSUM, (LC_REQ_DYLD | 0x18) => :LC_LOAD_WEAK_DYLIB, 0x19 => :LC_SEGMENT_64, 0x1a => :LC_ROUTINES_64, 0x1b => :LC_UUID, (LC_REQ_DYLD | 0x1c) => :LC_RPATH, 0x1d => :LC_CODE_SIGNATURE, 0x1e => :LC_SEGMENT_SPLIT_INFO, (LC_REQ_DYLD | 0x1f) => :LC_REEXPORT_DYLIB, 0x20 => :LC_LAZY_LOAD_DYLIB, 0x21 => :LC_ENCRYPTION_INFO, 0x22 => :LC_DYLD_INFO, (LC_REQ_DYLD | 0x22) => :LC_DYLD_INFO_ONLY, (LC_REQ_DYLD | 0x23) => :LC_LOAD_UPWARD_DYLIB, 0x24 => :LC_VERSION_MIN_MACOSX, 0x25 => :LC_VERSION_MIN_IPHONEOS, 0x26 => :LC_FUNCTION_STARTS, 0x27 => :LC_DYLD_ENVIRONMENT, (LC_REQ_DYLD | 0x28) => :LC_MAIN, 0x29 => :LC_DATA_IN_CODE, 0x2a => :LC_SOURCE_VERSION, 0x2b => :LC_DYLIB_CODE_SIGN_DRS, 0x2c => :LC_ENCRYPTION_INFO_64, 0x2d => :LC_LINKER_OPTION, 0x2e => :LC_LINKER_OPTIMIZATION_HINT, 0x2f => :LC_VERSION_MIN_TVOS, 0x30 => :LC_VERSION_MIN_WATCHOS, 0x31 => :LC_NOTE, 0x32 => :LC_BUILD_VERSION, (LC_REQ_DYLD | 0x33) => :LC_DYLD_EXPORTS_TRIE, (LC_REQ_DYLD | 0x34) => :LC_DYLD_CHAINED_FIXUPS, (LC_REQ_DYLD | 0x35) => :LC_FILESET_ENTRY, 0x36 => :LC_ATOM_INFO, }.freeze
- LOAD_COMMAND_CONSTANTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of symbol representations to load command constants
LOAD_COMMANDS.invert.freeze
- DYLIB_LOAD_COMMANDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
load commands responsible for loading dylibs
%i[ LC_LOAD_DYLIB LC_LOAD_WEAK_DYLIB LC_REEXPORT_DYLIB LC_LAZY_LOAD_DYLIB LC_LOAD_UPWARD_DYLIB ].freeze
- CREATABLE_LOAD_COMMANDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
load commands that can be created manually via LoadCommand.create
DYLIB_LOAD_COMMANDS + %i[ LC_ID_DYLIB LC_RPATH LC_LOAD_DYLINKER ].freeze
- LC_STRUCTURES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of load command symbols to string representations of classes
{ :LC_SEGMENT => "SegmentCommand", :LC_SYMTAB => "SymtabCommand", # "obsolete" :LC_SYMSEG => "SymsegCommand", # seems obsolete, but not documented as such :LC_THREAD => "ThreadCommand", :LC_UNIXTHREAD => "ThreadCommand", # "obsolete" :LC_LOADFVMLIB => "FvmlibCommand", # "obsolete" :LC_IDFVMLIB => "FvmlibCommand", # "obsolete" :LC_IDENT => "IdentCommand", # "reserved for internal use only" :LC_FVMFILE => "FvmfileCommand", # "reserved for internal use only", no public struct :LC_PREPAGE => "LoadCommand", :LC_DYSYMTAB => "DysymtabCommand", :LC_LOAD_DYLIB => "DylibUseCommand", :LC_ID_DYLIB => "DylibCommand", :LC_LOAD_DYLINKER => "DylinkerCommand", :LC_ID_DYLINKER => "DylinkerCommand", :LC_PREBOUND_DYLIB => "PreboundDylibCommand", :LC_ROUTINES => "RoutinesCommand", :LC_SUB_FRAMEWORK => "SubFrameworkCommand", :LC_SUB_UMBRELLA => "SubUmbrellaCommand", :LC_SUB_CLIENT => "SubClientCommand", :LC_SUB_LIBRARY => "SubLibraryCommand", :LC_TWOLEVEL_HINTS => "TwolevelHintsCommand", :LC_PREBIND_CKSUM => "PrebindCksumCommand", :LC_LOAD_WEAK_DYLIB => "DylibUseCommand", :LC_SEGMENT_64 => "SegmentCommand64", :LC_ROUTINES_64 => "RoutinesCommand64", :LC_UUID => "UUIDCommand", :LC_RPATH => "RpathCommand", :LC_CODE_SIGNATURE => "LinkeditDataCommand", :LC_SEGMENT_SPLIT_INFO => "LinkeditDataCommand", :LC_REEXPORT_DYLIB => "DylibCommand", :LC_LAZY_LOAD_DYLIB => "DylibCommand", :LC_ENCRYPTION_INFO => "EncryptionInfoCommand", :LC_DYLD_INFO => "DyldInfoCommand", :LC_DYLD_INFO_ONLY => "DyldInfoCommand", :LC_LOAD_UPWARD_DYLIB => "DylibCommand", :LC_VERSION_MIN_MACOSX => "VersionMinCommand", :LC_VERSION_MIN_IPHONEOS => "VersionMinCommand", :LC_FUNCTION_STARTS => "LinkeditDataCommand", :LC_DYLD_ENVIRONMENT => "DylinkerCommand", :LC_MAIN => "EntryPointCommand", :LC_DATA_IN_CODE => "LinkeditDataCommand", :LC_SOURCE_VERSION => "SourceVersionCommand", :LC_DYLIB_CODE_SIGN_DRS => "LinkeditDataCommand", :LC_ENCRYPTION_INFO_64 => "EncryptionInfoCommand64", :LC_LINKER_OPTION => "LinkerOptionCommand", :LC_LINKER_OPTIMIZATION_HINT => "LinkeditDataCommand", :LC_VERSION_MIN_TVOS => "VersionMinCommand", :LC_VERSION_MIN_WATCHOS => "VersionMinCommand", :LC_NOTE => "NoteCommand", :LC_BUILD_VERSION => "BuildVersionCommand", :LC_DYLD_EXPORTS_TRIE => "LinkeditDataCommand", :LC_DYLD_CHAINED_FIXUPS => "LinkeditDataCommand", :LC_FILESET_ENTRY => "FilesetEntryCommand", :LC_ATOM_INFO => "LinkeditDataCommand", }.freeze
- SEGMENT_NAMES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of segment name symbols to names
{ :SEG_PAGEZERO => "__PAGEZERO", :SEG_TEXT => "__TEXT", :SEG_TEXT_EXEC => "__TEXT_EXEC", :SEG_DATA => "__DATA", :SEG_DATA_CONST => "__DATA_CONST", :SEG_OBJC => "__OBJC", :SEG_OBJC_CONST => "__OBJC_CONST", :SEG_ICON => "__ICON", :SEG_LINKEDIT => "__LINKEDIT", :SEG_LINKINFO => "__LINKINFO", :SEG_UNIXSTACK => "__UNIXSTACK", :SEG_IMPORT => "__IMPORT", :SEG_KLD => "__KLD", :SEG_KLDDATA => "__KLDDATA", :SEG_HIB => "__HIB", :SEG_VECTORS => "__VECTORS", :SEG_LAST => "__LAST", :SEG_LASTDATA_CONST => "__LASTDATA_CONST", :SEG_PRELINK_TEXT => "__PRELINK_TEXT", :SEG_PRELINK_INFO => "__PRELINK_INFO", :SEG_CTF => "__CTF", :SEG_AUTH => "__AUTH", :SEG_AUTH_CONST => "__AUTH_CONST", }.freeze
- SEGMENT_FLAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of segment flag symbols to values
{ :SG_HIGHVM => 0x1, :SG_FVMLIB => 0x2, :SG_NORELOC => 0x4, :SG_PROTECTED_VERSION_1 => 0x8, :SG_READ_ONLY => 0x10, }.freeze
- DYLIB_USE_FLAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
association of dylib use flag symbols to values
{ :DYLIB_USE_WEAK_LINK => 0x1, :DYLIB_USE_REEXPORT => 0x2, :DYLIB_USE_UPWARD => 0x4, :DYLIB_USE_DELAYED_INIT => 0x8, }.freeze
- DYLIB_USE_MARKER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
the marker used to denote a newer style dylib use command. the value is the timestamp 24 January 1984 18:12:16
0x1a741800