X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/afe874b1634377ecb27057ee76deb04915bb34d7..b2fa67a80bc53211e4d1ea81f23e9f953ee1dd6c:/src/ld/HeaderAndLoadCommands.hpp diff --git a/src/ld/HeaderAndLoadCommands.hpp b/src/ld/HeaderAndLoadCommands.hpp index 395fc99..903a2bf 100644 --- a/src/ld/HeaderAndLoadCommands.hpp +++ b/src/ld/HeaderAndLoadCommands.hpp @@ -519,33 +519,15 @@ uint32_t HeaderAndLoadCommandsAtom::flags() const return bits; } -template <> uint32_t HeaderAndLoadCommandsAtom::magic() const { return MH_MAGIC; } -template <> uint32_t HeaderAndLoadCommandsAtom::magic() const { return MH_MAGIC_64; } template <> uint32_t HeaderAndLoadCommandsAtom::magic() const { return MH_MAGIC; } template <> uint32_t HeaderAndLoadCommandsAtom::magic() const { return MH_MAGIC_64; } template <> uint32_t HeaderAndLoadCommandsAtom::magic() const { return MH_MAGIC; } -template <> uint32_t HeaderAndLoadCommandsAtom::cpuType() const { return CPU_TYPE_POWERPC; } -template <> uint32_t HeaderAndLoadCommandsAtom::cpuType() const { return CPU_TYPE_POWERPC64; } template <> uint32_t HeaderAndLoadCommandsAtom::cpuType() const { return CPU_TYPE_I386; } template <> uint32_t HeaderAndLoadCommandsAtom::cpuType() const { return CPU_TYPE_X86_64; } template <> uint32_t HeaderAndLoadCommandsAtom::cpuType() const { return CPU_TYPE_ARM; } -template <> -uint32_t HeaderAndLoadCommandsAtom::cpuSubType() const -{ - return _state.cpuSubType; -} - -template <> -uint32_t HeaderAndLoadCommandsAtom::cpuSubType() const -{ - if ( (_options.outputKind() == Options::kDynamicExecutable) && (_options.macosxVersionMin() >= ld::mac10_5) ) - return (CPU_SUBTYPE_POWERPC_ALL | 0x80000000); - else - return CPU_SUBTYPE_POWERPC_ALL; -} template <> uint32_t HeaderAndLoadCommandsAtom::cpuSubType() const @@ -973,7 +955,7 @@ uint8_t* HeaderAndLoadCommandsAtom::copyDylibIDLoadCommand(uint8_t* p) const cmd->set_cmdsize(sz); cmd->set_name_offset(); cmd->set_timestamp(1); // needs to be some constant value that is different than DylibLoadCommandsAtom uses - cmd->set_current_version(_options.currentVersion()); + cmd->set_current_version(_options.currentVersion32()); cmd->set_compatibility_version(_options.compatibilityVersion()); strcpy((char*)&p[sizeof(macho_dylib_command

)], _options.installPath()); return p + sz; @@ -1024,62 +1006,18 @@ uint8_t* HeaderAndLoadCommandsAtom::copyVersionLoadCommand(uint8_t* p) const cmd->set_cmd(LC_VERSION_MIN_MACOSX); cmd->set_cmdsize(sizeof(macho_version_min_command

)); cmd->set_version((uint32_t)macVersion); - cmd->set_reserved(0); + cmd->set_sdk(0); } else { cmd->set_cmd(LC_VERSION_MIN_IPHONEOS); cmd->set_cmdsize(sizeof(macho_version_min_command

)); cmd->set_version((uint32_t)iOSVersion); - cmd->set_reserved(0); + cmd->set_sdk(0); } return p + sizeof(macho_version_min_command

); } -template <> -uint32_t HeaderAndLoadCommandsAtom::threadLoadCommandSize() const -{ - return this->alignedSize(16 + 40*4); // base size + PPC_THREAD_STATE_COUNT * 4 -} - - -template <> -uint8_t* HeaderAndLoadCommandsAtom::copyThreadsLoadCommand(uint8_t* p) const -{ - assert(_state.entryPoint != NULL); - pint_t start = _state.entryPoint->finalAddress(); - macho_thread_command* cmd = (macho_thread_command*)p; - cmd->set_cmd(LC_UNIXTHREAD); - cmd->set_cmdsize(threadLoadCommandSize()); - cmd->set_flavor(1); // PPC_THREAD_STATE - cmd->set_count(40); // PPC_THREAD_STATE_COUNT; - cmd->set_thread_register(0, start); - if ( _options.hasCustomStack() ) - cmd->set_thread_register(3, _options.customStackAddr()); // r1 - return p + threadLoadCommandSize(); -} - -template <> -uint32_t HeaderAndLoadCommandsAtom::threadLoadCommandSize() const -{ - return this->alignedSize(16 + 76*4); // base size + PPC_THREAD_STATE64_COUNT * 4 -} - -template <> -uint8_t* HeaderAndLoadCommandsAtom::copyThreadsLoadCommand(uint8_t* p) const -{ - assert(_state.entryPoint != NULL); - pint_t start = _state.entryPoint->finalAddress(); - macho_thread_command* cmd = (macho_thread_command*)p; - cmd->set_cmd(LC_UNIXTHREAD); - cmd->set_cmdsize(threadLoadCommandSize()); - cmd->set_flavor(5); // PPC_THREAD_STATE64 - cmd->set_count(76); // PPC_THREAD_STATE64_COUNT; - cmd->set_thread_register(0, start); - if ( _options.hasCustomStack() ) - cmd->set_thread_register(3, _options.customStackAddr()); // r1 - return p + threadLoadCommandSize(); -} template <> uint32_t HeaderAndLoadCommandsAtom::threadLoadCommandSize() const