]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/Resolver.h
ld64-302.3.tar.gz
[apple/ld64.git] / src / ld / Resolver.h
index 65e20065740032287ba2f7b15cc3cae317f6ba9d..06b7a8b0f145702c88e304a1bc473b8fe7ff83c3 100644 (file)
@@ -42,6 +42,7 @@
 #include <mach-o/dyld.h>
 
 #include <vector>
+#include <unordered_set>
 
 #include "Options.h"
 #include "ld.hpp"
@@ -57,11 +58,13 @@ namespace tool {
 class Resolver : public ld::File::AtomHandler
 {
 public:
-                                                       Resolver(const Options& opts, const InputFiles& inputs, ld::Internal& state) 
+                                                       Resolver(const Options& opts, InputFiles& inputs, ld::Internal& state) 
                                                                : _options(opts), _inputFiles(inputs), _internal(state), 
                                                                  _symbolTable(opts, state.indirectBindingTable),
-                                                                 _haveLLVMObjs(false), _addToFinalSection(false),
-                                                                 _completedInitialObjectFiles(false) {}
+                                                                 _haveLLVMObjs(false),
+                                                                 _completedInitialObjectFiles(false),
+                                                                 _ltoCodeGenFinished(false),
+                                                                 _haveAliases(false) {}
                                                                
 
                virtual void            doAtom(const ld::Atom&);
@@ -69,7 +72,7 @@ public:
                
                void                            resolve();
 
-       
+
 private:
        struct WhyLiveBackChain
        {
@@ -80,7 +83,7 @@ private:
        void                                    initializeState();
        void                                    buildAtomList();
        void                                    addInitialUndefines();
-       void                                    deadStripOptimize();
+       void                                    deadStripOptimize(bool force=false);
        void                                    resolveUndefines();
        void                                    checkUndefines(bool force=false);
        void                                    checkDylibSymbolCollisions();
@@ -88,20 +91,22 @@ private:
        void                                    fillInInternalState();
        void                                    fillInHelpersInInternalState();
        void                                    removeCoalescedAwayAtoms();
+       void                                    syncAliases();
+       void                                    fillInEntryPoint();
        void                                    linkTimeOptimize();
        void                                    convertReferencesToIndirect(const ld::Atom& atom);
        const ld::Atom*                 entryPoint(bool searchArchives);
        void                                    markLive(const ld::Atom& atom, WhyLiveBackChain* previous);
        bool                                    isDtraceProbe(ld::Fixup::Kind kind);
        void                                    liveUndefines(std::vector<const char*>&);
+       void                                    remainingUndefines(std::vector<const char*>&);
        bool                                    printReferencedBy(const char* name, SymbolTable::IndirectBindingSlot slot);
-                       
+       void                                    tweakWeakness();
+       void                                    buildArchivesList();
+       void                                    doLinkerOption(const std::vector<const char*>& linkerOption, const char* fileName);
+       void                                    dumpAtoms();
 
-       class CStringEquals {
-       public:
-               bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
-       };
-       typedef __gnu_cxx::hash_set<const char*, __gnu_cxx::hash<const char*>, CStringEquals>  StringSet;
+       typedef std::unordered_set<const char*, CStringHash, CStringEquals>  StringSet;
 
        class NotLive {
        public:
@@ -118,15 +123,18 @@ private:
        };
 
        const Options&                                  _options;
-       const InputFiles&                               _inputFiles;
+       InputFiles&                                             _inputFiles;
        ld::Internal&                                   _internal;
        std::vector<const ld::Atom*>    _atoms;
        std::set<const ld::Atom*>               _deadStripRoots;
+       std::vector<const ld::Atom*>    _dontDeadStripIfReferencesLive;
        std::vector<const ld::Atom*>    _atomsWithUnresolvedReferences;
+       std::vector<const class AliasAtom*>     _aliasesFromCmdLine;
        SymbolTable                                             _symbolTable;
        bool                                                    _haveLLVMObjs;
-       bool                                                    _addToFinalSection;
        bool                                                    _completedInitialObjectFiles;
+       bool                                                    _ltoCodeGenFinished;
+       bool                                                    _haveAliases;
 };