getDylibPathName
Asserts LoadCommand is of type dylib_command.
Function parameters
Parameters
Type definitions in this namespace
Types
- uuid_command
- The uuid load command contains a single 128-bit unique random number that
- version_min_command
- The version_min_command contains the min OS version on which this
- source_version_command
- The source_version_command is an optional load command containing
- build_version_command
- The build_version_command contains the min OS version on which this
- entry_point_command
- The entry_point_command is a replacement for thread_command.
- symtab_command
- The symtab_command contains the offsets and sizes of the link-edit 4.3BSD
- dysymtab_command
- This is the second set of the symbolic information which is used to support
- linkedit_data_command
- The linkedit_data_command contains the offsets and sizes of a blob
- dyld_info_command
- The dyld_info_command contains the file offsets and sizes of
- dylinker_command
- A program that uses a dynamic linker contains a dylinker_command to identify
- dylib_command
- A dynamically linked shared library (filetype == MH_DYLIB in the mach header)
- dylib
- Dynamically linked shared libraries are identified by two things.
- rpath_command
- The rpath_command contains a path which at runtime should be added to the current
- segment_command
- The segment load command indicates that a part of this file is to be
- segment_command_64
- The 64-bit segment load command indicates that a part of this file is to be
- section
- A segment is made up of zero or more sections.
- relocation_info
- Format of a relocation entry of a Mach-O file.
- CodeDirectory
- This CodeDirectory is tailored specifically at version 0x20400.
- BlobIndex
- Structure of an embedded-signature SuperBlob
- SuperBlob
- This structure is followed by GenericBlobs in no particular
- data_in_code_entry
- The LC_DATA_IN_CODE load commands uses a linkedit_data_command
After MacOS X 10.1 when a new load command is added that is required to be
Values
- LC_REQ_DYLD
- After MacOS X 10.1 when a new load command is added that is required to be
- MH_MAGIC
- the mach magic number
- MH_CIGAM
- NXSwapInt(MH_MAGIC)
- MH_MAGIC_64
- the 64-bit mach magic number
- MH_CIGAM_64
- NXSwapInt(MH_MAGIC_64)
- MH_OBJECT
- relocatable object file
- MH_EXECUTE
- demand paged executable file
- MH_FVMLIB
- fixed VM shared library file
- MH_CORE
- core file
- MH_PRELOAD
- preloaded executable file
- MH_DYLIB
- dynamically bound shared library
- MH_DYLINKER
- dynamic link editor
- MH_BUNDLE
- dynamically bound bundle file
- MH_DYLIB_STUB
- shared library stub for static linking only, no section contents
- MH_DSYM
- companion file with only debug sections
- MH_KEXT_BUNDLE
- x86_64 kexts
- MH_NOUNDEFS
- the object file has no undefined references
- MH_INCRLINK
- the object file is the output of an incremental link against a base file and can't be link edited again
- MH_DYLDLINK
- the object file is input for the dynamic linker and can't be statically link edited again
- MH_BINDATLOAD
- the object file's undefined references are bound by the dynamic linker when loaded.
- MH_PREBOUND
- the file has its dynamic undefined references prebound.
- MH_SPLIT_SEGS
- the file has its read-only and read-write segments split
- MH_LAZY_INIT
- the shared library init routine is to be run lazily via catching memory faults to its writeable segments (obsolete)
- MH_TWOLEVEL
- the image is using two-level name space bindings
- MH_FORCE_FLAT
- the executable is forcing all images to use flat name space bindings
- MH_NOMULTIDEFS
- this umbrella guarantees no multiple definitions of symbols in its sub-images so the two-level namespace hints can always be used.
- MH_NOFIXPREBINDING
- do not have dyld notify the prebinding agent about this executable
- MH_PREBINDABLE
- the binary is not prebound but can have its prebinding redone.
- MH_ALLMODSBOUND
- indicates that this binary binds to all two-level namespace modules of its dependent libraries.
- MH_SUBSECTIONS_VIA_SYMBOLS
- safe to divide up the sections into sub-sections via symbols for dead code stripping
- MH_CANONICAL
- the binary has been canonicalized via the unprebind operation
- MH_WEAK_DEFINES
- the final linked image contains external weak symbols
- MH_BINDS_TO_WEAK
- the final linked image uses weak symbols
- MH_ALLOW_STACK_EXECUTION
- When this bit is set, all stacks in the task will be given stack execution privilege.
- MH_ROOT_SAFE
- When this bit is set, the binary declares it is safe for use in processes with uid zero
- MH_SETUID_SAFE
- When this bit is set, the binary declares it is safe for use in processes when issetugid() is true
- MH_NO_REEXPORTED_DYLIBS
- When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to see if any are re-exported
- MH_PIE
- When this bit is set, the OS will load the main executable at a random address.
- MH_DEAD_STRIPPABLE_DYLIB
- Only for use on dylibs.
- MH_HAS_TLV_DESCRIPTORS
- Contains a section of type S_THREAD_LOCAL_VARIABLES
- MH_NO_HEAP_EXECUTION
- When this bit is set, the OS will run the main executable with a non-executable heap even on platforms (e.g.
- MH_APP_EXTENSION_SAFE
- The code was linked for use in an application extension.
- MH_NLIST_OUTOFSYNC_WITH_DYLDINFO
- The external symbols listed in the nlist symbol table do not include all the symbols listed in the dyld info.
- MH_SIM_SUPPORT
- Allow LC_MIN_VERSION_MACOS and LC_BUILD_VERSION load commands with the platforms macOS, iOSMac, iOSSimulator, tvOSSimulator and watchOSSimulator.
- MH_DYLIB_IN_CACHE
- Only for use on dylibs.
- FAT_MAGIC
- the fat magic number
- FAT_CIGAM
- NXSwapLong(FAT_MAGIC)
- FAT_MAGIC_64
- the 64-bit fat magic number
- FAT_CIGAM_64
- NXSwapLong(FAT_MAGIC_64)
- SG_HIGHVM
- Segment flags
- SG_FVMLIB
- This segment is the VM that is allocated by a fixed VM library, for overlap checking in
- SG_NORELOC
- This segment has nothing that was relocated in it and nothing relocated to it, that is
- SG_PROTECTED_VERSION_1
- This segment is protected.
- SG_READ_ONLY
- This segment is made read-only after fixups
- SECTION_TYPE
- The flags field of a section structure is separated into two parts a section
- SECTION_ATTRIBUTES
- 24 section attributes
- S_REGULAR
- regular section
- S_ZEROFILL
- zero fill on demand section
- S_CSTRING_LITERALS
- section with only literal C string
- S_4BYTE_LITERALS
- section with only 4 byte literals
- S_8BYTE_LITERALS
- section with only 8 byte literals
- S_LITERAL_POINTERS
- section with only pointers to
- N_STAB
- if any of these bits set, a symbolic debugging entry
- N_PEXT
- private external symbol bit
- N_TYPE
- mask for the type bits
- N_EXT
- external symbol bit, set for external symbols
- N_UNDF
- symbol is undefined
- N_ABS
- symbol is absolute
- N_SECT
- symbol is defined in the section number given in n_sect
- N_PBUD
- symbol is undefined and the image is using a prebound
- N_INDR
- symbol is defined to be the same as another symbol; the n_value
- N_GSYM
- global symbol: name,,NO_SECT,type,0
- N_FNAME
- procedure name (f77 kludge): name,,NO_SECT,0,0
- N_FUN
- procedure: name,,n_sect,linenumber,address
- N_STSYM
- static symbol: name,,n_sect,type,address
- N_LCSYM
- .lcomm symbol: name,,n_sect,type,address
- N_BNSYM
- begin nsect sym: 0,,n_sect,0,address
- N_AST
- AST file path: name,,NO_SECT,0,0
- N_OPT
- emitted with gcc2_compiled and in gcc source
- N_RSYM
- register sym: name,,NO_SECT,type,register
- N_SLINE
- src line: 0,,n_sect,linenumber,address
- N_ENSYM
- end nsect sym: 0,,n_sect,0,address
- N_SSYM
- structure elt: name,,NO_SECT,type,struct_offset
- N_SO
- source file name: name,,n_sect,0,address
- N_OSO
- object file name: name,,0,0,st_mtime
- N_LSYM
- local sym: name,,NO_SECT,type,offset
- N_BINCL
- include file beginning: name,,NO_SECT,0,sum
- N_SOL
- #included file name: name,,n_sect,0,address
- N_PARAMS
- compiler parameters: name,,NO_SECT,0,0
- N_VERSION
- compiler version: name,,NO_SECT,0,0
- N_OLEVEL
- compiler -O level: name,,NO_SECT,0,0
- N_PSYM
- parameter: name,,NO_SECT,type,offset
- N_EINCL
- include file end: name,,NO_SECT,0,0
- N_ENTRY
- alternate entry: name,,n_sect,linenumber,address
- N_LBRAC
- left bracket: 0,,NO_SECT,nesting level,address
- N_EXCL
- deleted include file: name,,NO_SECT,0,sum
- N_RBRAC
- right bracket: 0,,NO_SECT,nesting level,address
- N_BCOMM
- begin common: name,,NO_SECT,0,0
- N_ECOMM
- end common: name,,n_sect,0,0
- N_ECOML
- end common (local name): 0,,n_sect,0,address
- N_LENG
- second stab entry with length information
- S_NON_LAZY_SYMBOL_POINTERS
- section with only non-lazy symbol pointers
- S_LAZY_SYMBOL_POINTERS
- section with only lazy symbol pointers
- S_SYMBOL_STUBS
- section with only symbol stubs, byte size of stub in the reserved2 field
- S_MOD_INIT_FUNC_POINTERS
- section with only function pointers for initialization
- S_MOD_TERM_FUNC_POINTERS
- section with only function pointers for termination
- S_COALESCED
- section contains symbols that are to be coalesced
- S_GB_ZEROFILL
- zero fill on demand section (that can be larger than 4 gigabytes)
- S_INTERPOSING
- section with only pairs of function pointers for interposing
- S_16BYTE_LITERALS
- section with only 16 byte literals
- S_DTRACE_DOF
- section contains DTrace Object Format
- S_LAZY_DYLIB_SYMBOL_POINTERS
- section with only lazy symbol pointers to lazy loaded dylibs
- S_ATTR_DEBUG
- a debug section
- S_ATTR_PURE_INSTRUCTIONS
- section contains only true machine instructions
- S_ATTR_NO_TOC
- section contains coalesced symbols that are not to be in a ranlib
- S_ATTR_STRIP_STATIC_SYMS
- ok to strip static symbols in this section in files with the
- S_ATTR_NO_DEAD_STRIP
- no dead stripping
- S_ATTR_LIVE_SUPPORT
- blocks are live if they reference live blocks
- S_ATTR_SELF_MODIFYING_CODE
- used with x86 code stubs written on by dyld
- S_ATTR_SOME_INSTRUCTIONS
- section contains some machine instructions
- S_ATTR_EXT_RELOC
- section has external relocation entries
- S_ATTR_LOC_RELOC
- section has local relocation entries
- S_THREAD_LOCAL_REGULAR
- template of initial values for TLVs
- S_THREAD_LOCAL_ZEROFILL
- template of initial values for TLVs
- S_THREAD_LOCAL_VARIABLES
- TLV descriptors
- S_THREAD_LOCAL_VARIABLE_POINTERS
- pointers to TLV descriptors
- S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
- functions to call to initialize TLV values
- S_INIT_FUNC_OFFSETS
- 32-bit offsets to initializers
- CPU_TYPE_X86_64
- CPU type targeting 64-bit Intel-based Macs
- CPU_TYPE_ARM64
- CPU type targeting 64-bit ARM-based Macs
- CPU_SUBTYPE_X86_64_ALL
- All Intel-based Macs
- CPU_SUBTYPE_ARM_ALL
- All ARM-based Macs
- REBASE_OPCODE_MASK
- = 0xF0
- REBASE_IMMEDIATE_MASK
- = 0x0F
- REBASE_OPCODE_DONE
- = 0x00
- BIND_OPCODE_MASK
- = 0xf0
- BIND_IMMEDIATE_MASK
- = 0x0f
- BIND_OPCODE_DONE
- = 0x00
- BIND_OPCODE_SET_TYPE_IMM
- = 0x50
- BIND_OPCODE_DO_BIND
- = 0x90
- REFERENCE_FLAG_UNDEFINED_NON_LAZY
- This symbol is a reference to an external non-lazy (data) symbol.
- REFERENCE_FLAG_UNDEFINED_LAZY
- This symbol is a reference to an external lazy symbol—that is, to a function call.
- REFERENCE_FLAG_DEFINED
- This symbol is defined in this module.
- REFERENCE_FLAG_PRIVATE_DEFINED
- This symbol is defined in this module and is visible only to modules within this shared library.
- REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY
- This symbol is defined in another module in this file, is a non-lazy (data) symbol, and is visible
- REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY
- This symbol is defined in another module in this file, is a lazy (function) symbol, and is visible
- REFERENCED_DYNAMICALLY
- Must be set for any defined symbol that is referenced by dynamic-loader APIs (such as dlsym and
- N_NO_DEAD_STRIP
- The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
- N_DESC_DISCARDED
- Used by the dynamic linker at runtime.
- N_WEAK_REF
- Indicates that this symbol is a weak reference.
- N_WEAK_DEF
- Indicates that this symbol is a weak definition.
- N_SYMBOL_RESOLVER
- The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
- INDIRECT_SYMBOL_LOCAL
- = 0x80000000
- INDIRECT_SYMBOL_ABS
- = 0x40000000
- CSMAGIC_REQUIREMENT
- Single Requirement blob
- CSMAGIC_REQUIREMENTS
- Requirements vector (internal requirements)
- CSMAGIC_CODEDIRECTORY
- CodeDirectory blob
- CSMAGIC_EMBEDDED_SIGNATURE
- embedded form of signature data
- CSMAGIC_EMBEDDED_ENTITLEMENTS
- Embedded entitlements
- CSMAGIC_EMBEDDED_DER_ENTITLEMENTS
- Embedded DER encoded entitlements
- CSMAGIC_DETACHED_SIGNATURE
- Multi-arch collection of embedded signatures
- CSMAGIC_BLOBWRAPPER
- CMS Signature, among other things
- CS_SUPPORTSSCATTER
- = 0x20100
- CS_SUPPORTSTEAMID
- = 0x20200
- CS_SUPPORTSCODELIMIT64
- = 0x20300
- CS_SUPPORTSEXECSEG
- = 0x20400
- CSSLOT_CODEDIRECTORY
- Slot index for CodeDirectory
- CSSLOT_ALTERNATE_CODEDIRECTORIES
- first alternate CodeDirectory, if any
- CSSLOT_ALTERNATE_CODEDIRECTORY_MAX
- Max number of alternate CD slots
- CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT
- One past the last
- CSSLOT_SIGNATURESLOT
- CMS Signature
- CSSLOT_IDENTIFICATIONSLOT
- = 0x10001
- CSSLOT_TICKETSLOT
- = 0x10002
- CSTYPE_INDEX_REQUIREMENTS
- Compat with amfi
- CSTYPE_INDEX_ENTITLEMENTS
- Compat with amfi
- CS_SHA1_LEN
- = 20
- CS_SHA256_LEN
- = 32
- CS_CDHASH_LEN
- Always - larger hashes are truncated
- CS_HASH_MAX_SIZE
- Max size of the hash we'll support
- CS_ADHOC
- = 0x2
- CS_LINKER_SIGNED
- = 0x20000
- UNWIND_IS_NOT_FUNCTION_START
- = 0x80000000
- UNWIND_HAS_LSDA
- = 0x40000000
- UNWIND_PERSONALITY_MASK
- = 0x30000000
- UNWIND_X86_64_MODE_MASK
- = 0x0F000000
- UNWIND_X86_64_RBP_FRAME_REGISTERS
- = 0x00007FFF
- UNWIND_X86_64_RBP_FRAME_OFFSET
- = 0x00FF0000
- UNWIND_X86_64_FRAMELESS_STACK_SIZE
- = 0x00FF0000
- UNWIND_X86_64_FRAMELESS_STACK_ADJUST
- = 0x0000E000
- UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT
- = 0x00001C00
- UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION
- = 0x000003FF
- UNWIND_X86_64_DWARF_SECTION_OFFSET
- = 0x00FFFFFF
- UNWIND_ARM64_MODE_MASK
- = 0x0F000000
- UNWIND_ARM64_FRAME_X19_X20_PAIR
- = 0x00000001
- UNWIND_ARM64_FRAME_X21_X22_PAIR
- = 0x00000002
- UNWIND_ARM64_FRAME_X23_X24_PAIR
- = 0x00000004
- UNWIND_ARM64_FRAME_X25_X26_PAIR
- = 0x00000008
- UNWIND_ARM64_FRAME_X27_X28_PAIR
- = 0x00000010
- UNWIND_ARM64_FRAME_D8_D9_PAIR
- = 0x00000100
- UNWIND_ARM64_FRAME_D10_D11_PAIR
- = 0x00000200
- UNWIND_ARM64_FRAME_D12_D13_PAIR
- = 0x00000400
- UNWIND_ARM64_FRAME_D14_D15_PAIR
- = 0x00000800
- UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK
- = 0x00FFF000
- UNWIND_ARM64_DWARF_SECTION_OFFSET
- = 0x00FFFFFF
Source
Implementation
pub fn getDylibPathName(lc: LoadCommand) []const u8 {
const dylib_lc = lc.cast(dylib_command).?;
const data = lc.data[dylib_lc.dylib.name..];
return mem.sliceTo(data, 0);
}