#include <mach-o/dyld.h>
#include <vector>
-#include <ext/hash_map>
+#include <unordered_map>
#include "Options.h"
#include "ld.hpp"
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;
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); }
CStringToSlot _cstringTable;
NameToMap _nonStdCStringSectionToMap;
ReferencesToSlot _nonLazyPointerTable;
+ ReferencesToSlot _threadPointerTable;
ReferencesToSlot _cfStringTable;
ReferencesToSlot _objc2ClassRefTable;
ReferencesToSlot _pointerToCStringTable;