]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/SymbolTable.h
ld64-278.4.tar.gz
[apple/ld64.git] / src / ld / SymbolTable.h
index 451d0641fc32420bba3f4007c023afa63a7cca77..2708f1fce6a75d73cfb45618ea9d78da04f888f8 100644 (file)
@@ -42,7 +42,7 @@
 #include <mach-o/dyld.h>
 
 #include <vector>
-#include <ext/hash_map>
+#include <unordered_map>
 
 #include "Options.h"
 #include "ld.hpp"
@@ -57,42 +57,38 @@ public:
        typedef uint32_t IndirectBindingSlot;
 
 private:
-       class CStringEquals {
-       public:
-               bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
-       };
-       typedef __gnu_cxx::hash_map<const char*, IndirectBindingSlot, __gnu_cxx::hash<const char*>, CStringEquals> NameToSlot;
+       typedef std::unordered_map<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
 
        class ContentFuncs {
        public:
                size_t  operator()(const ld::Atom*) const;
                bool    operator()(const ld::Atom* left, const ld::Atom* right) const;
        };
-       typedef __gnu_cxx::hash_map<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
+       typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
 
        class ReferencesHashFuncs {
        public:
                size_t  operator()(const ld::Atom*) const;
                bool    operator()(const ld::Atom* left, const ld::Atom* right) const;
        };
-       typedef __gnu_cxx::hash_map<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
+       typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
 
        class CStringHashFuncs {
        public:
                size_t  operator()(const ld::Atom*) const;
                bool    operator()(const ld::Atom* left, const ld::Atom* right) const;
        };
-       typedef __gnu_cxx::hash_map<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
+       typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
 
        class UTF16StringHashFuncs {
        public:
                size_t  operator()(const ld::Atom*) const;
                bool    operator()(const ld::Atom* left, const ld::Atom* right) const;
        };
-       typedef __gnu_cxx::hash_map<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
+       typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
 
        typedef std::map<IndirectBindingSlot, const char*> SlotToName;
-       typedef __gnu_cxx::hash_map<const char*, CStringToSlot*, __gnu_cxx::hash<const char*>, CStringEquals> NameToMap;
+       typedef std::unordered_map<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
     
     typedef std::vector<const ld::Atom *> DuplicatedSymbolAtomList;
     typedef std::map<const char *, DuplicatedSymbolAtomList * > DuplicateSymbols;
@@ -124,6 +120,8 @@ public:
        unsigned int            updateCount()                                           { return _indirectBindingTable.size(); }
        void                            undefines(std::vector<const char*>& undefines);
        void                            tentativeDefs(std::vector<const char*>& undefines);
+       void                            mustPreserveForBitcode(std::unordered_set<const char*>& syms);
+       void                            removeDeadAtoms();
        bool                            hasName(const char* name);
        bool                            hasExternalTentativeDefinitions()       { return _hasExternalTentativeDefinitions; }
        byNameIterator          begin()                                                         { return byNameIterator(_byNameTable.begin(),_indirectBindingTable); }
@@ -158,6 +156,7 @@ private:
        CStringToSlot                                   _cstringTable;
        NameToMap                                               _nonStdCStringSectionToMap;
        ReferencesToSlot                                _nonLazyPointerTable;
+       ReferencesToSlot                                _threadPointerTable;
        ReferencesToSlot                                _cfStringTable;
        ReferencesToSlot                                _objc2ClassRefTable;
        ReferencesToSlot                                _pointerToCStringTable;