X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/ebf6f43431fe84b7b17822014a6d1f0169516e93..dd9e569f384b2c941bcc73d89d1468756788ee5b:/src/ld/parsers/archive_file.cpp diff --git a/src/ld/parsers/archive_file.cpp b/src/ld/parsers/archive_file.cpp index 78d8912..9004530 100644 --- a/src/ld/parsers/archive_file.cpp +++ b/src/ld/parsers/archive_file.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "MachOFileAbstraction.hpp" #include "Architectures.hpp" @@ -109,15 +109,10 @@ private: }; - struct MemberState { ld::relocatable::File* file; const Entry *entry; bool logged; bool loaded; uint16_t index;}; + struct MemberState { ld::relocatable::File* file; const Entry *entry; bool logged; bool loaded; uint32_t index;}; bool loadMember(MemberState& state, ld::File::AtomHandler& handler, const char *format, ...) const; - class CStringEquals - { - public: - bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); } - }; - typedef __gnu_cxx::hash_map, CStringEquals> NameToEntryMap; + typedef std::unordered_map NameToEntryMap; typedef typename A::P P; typedef typename A::P::E E; @@ -228,6 +223,7 @@ const class File::Entry* File::Entry::next() const template <> cpu_type_t File::architecture() { return CPU_TYPE_I386; } template <> cpu_type_t File::architecture() { return CPU_TYPE_X86_64; } template <> cpu_type_t File::architecture() { return CPU_TYPE_ARM; } +template <> cpu_type_t File::architecture() { return CPU_TYPE_ARM64; } template @@ -328,13 +324,13 @@ bool File::memberHasObjCCategories(const Entry* member) const template typename File::MemberState& File::makeObjectFileForMember(const Entry* member) const { - uint16_t memberIndex = 0; + uint32_t memberIndex = 0; // in case member was instantiated earlier but not needed yet typename MemberToStateMap::iterator pos = _instantiatedEntries.find(member); if ( pos == _instantiatedEntries.end() ) { // Have to find the index of this member const Entry* start; - uint16_t index; + uint32_t index; if (_instantiatedEntries.size() == 0) { start = (Entry*)&_archiveFileContent[8]; index = 1; @@ -384,8 +380,8 @@ typename File::MemberState& File::makeObjectFileForMember(const Entry* mem } // see if member is llvm bitcode file result = lto::parse(member->content(), member->contentSize(), - mPath, member->modificationTime(), - _objOpts.architecture, _objOpts.subType, _logAllFiles); + mPath, member->modificationTime(), ordinal, + _objOpts.architecture, _objOpts.subType, _logAllFiles, _objOpts.verboseOptimizationHints); if ( result != NULL ) { MemberState state = {result, member, false, false, memberIndex}; _instantiatedEntries[member] = state; @@ -603,6 +599,12 @@ ld::archive::File* parse(const uint8_t* fileContent, uint64_t fileLength, if ( archive::Parser::validFile(fileContent, fileLength, opts.objOpts) ) return archive::Parser::parse(fileContent, fileLength, path, modTime, ordinal, opts); break; +#endif +#if SUPPORT_ARCH_arm64 + case CPU_TYPE_ARM64: + if ( archive::Parser::validFile(fileContent, fileLength, opts.objOpts) ) + return archive::Parser::parse(fileContent, fileLength, path, modTime, ordinal, opts); + break; #endif } return NULL;