X-Git-Url: https://git.saurik.com/apple/dyld.git/blobdiff_plain/39a8cd101b922f08058746122efff58c14b57605..484799563310e57a6cac8693ce18f6db71c1b80d:/launch-cache/MachOFileAbstraction.hpp diff --git a/launch-cache/MachOFileAbstraction.hpp b/launch-cache/MachOFileAbstraction.hpp index cba7f8a..6314caa 100644 --- a/launch-cache/MachOFileAbstraction.hpp +++ b/launch-cache/MachOFileAbstraction.hpp @@ -43,6 +43,49 @@ struct uuid_command { #define S_16BYTE_LITERALS 0xE #endif +#ifndef CPU_SUBTYPE_ARM_V5TEJ + #define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7) +#endif +#ifndef CPU_SUBTYPE_ARM_XSCALE + #define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8) +#endif +#ifndef CPU_SUBTYPE_ARM_V7 + #define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) +#endif +#ifndef CPU_SUBTYPE_ARM_V7F + #define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) +#endif +#ifndef CPU_SUBTYPE_ARM_V7K + #define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12) +#endif +#ifndef CPU_SUBTYPE_ARM_V7S + #define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) +#endif + +#ifndef LC_LOAD_UPWARD_DYLIB + #define LC_LOAD_UPWARD_DYLIB (0x23|LC_REQ_DYLD) /* load of dylib whose initializers run later */ +#endif + +#ifndef EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER + #define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10 +#endif +#ifndef EXPORT_SYMBOL_FLAGS_REEXPORT + #define EXPORT_SYMBOL_FLAGS_REEXPORT 0x08 +#endif + +#ifndef LC_FUNCTION_STARTS + #define LC_FUNCTION_STARTS 0x26 +#endif + +#ifndef LC_DATA_IN_CODE + #define LC_DATA_IN_CODE 0x29 +#endif + +#ifndef LC_DYLIB_CODE_SIGN_DRS + #define LC_DYLIB_CODE_SIGN_DRS 0x2B +#endif + + #include "FileAbstraction.hpp" #include "Architectures.hpp" @@ -738,29 +781,28 @@ public: const macho_segment_command
* getSegment(const char *segname) const { - const macho_load_command
* const cmds = (macho_load_command
*)((uint8_t*)this + sizeof(macho_header
)); - const uint32_t cmd_count = this->ncmds(); + const macho_load_command
* cmds = (macho_load_command
*)((uint8_t*)this + sizeof(macho_header
)); + uint32_t cmd_count = this->ncmds(); const macho_load_command
* cmd = cmds; for (uint32_t i = 0; i < cmd_count; ++i) { if ( cmd->cmd() == macho_segment_command
::CMD ) { - const macho_segment_command
* segcmd = - (macho_segment_command
*)cmd; + const macho_segment_command
* segcmd = (macho_segment_command
*)cmd; if (0 == strncmp(segname, segcmd->segname(), 16)) { return segcmd; } } - cmd = (const macho_load_command
*)(((uint8_t*)cmd)+cmd->cmdsize()); + cmd = (macho_load_command
*)(((uint8_t*)cmd)+cmd->cmdsize()); } return NULL; } const macho_section
* getSection(const char *segname, const char *sectname) const { - const macho_segment_command
* const segcmd = getSegment(segname); + const macho_segment_command
* segcmd = getSegment(segname); if (!segcmd) return NULL; const macho_section
* sectcmd = (macho_section
*)(segcmd+1); - const uint32_t section_count = segcmd->nsects(); + uint32_t section_count = segcmd->nsects(); for (uint32_t j = 0; j < section_count; ++j) { if (0 == ::strncmp(sectcmd[j].sectname(), sectname, 16)) { return sectcmd+j; @@ -770,6 +812,20 @@ public: return NULL; } + const macho_load_command
* getLoadCommand(int query) const + { + const macho_load_command
* cmds = (macho_load_command
*)((uint8_t*)this + sizeof(macho_header
)); + uint32_t cmd_count = this->ncmds(); + const macho_load_command
* cmd = cmds; + for (uint32_t i = 0; i < cmd_count; ++i) { + if ( cmd->cmd() == query ) { + return cmd; + } + cmd = (macho_load_command
*)(((uint8_t*)cmd)+cmd->cmdsize()); + } + return NULL; + } + typedef typename P::E E; private: macho_header_content
header;