diff options
| author | Nick Kledzik <kledzik@apple.com> | 2014-10-21 21:14:11 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2014-10-21 21:14:11 +0000 |
| commit | a721db24c08bd64dc3495ce1b20bf8dc182e9656 (patch) | |
| tree | f6c85edc39573e521a16e66b36c5754bc0d76133 /lld/lib/Driver/DarwinLdDriver.cpp | |
| parent | 8c4fb7cae09a954b9341f57aff24a32eefe44ba3 (diff) | |
| download | bcm5719-llvm-a721db24c08bd64dc3495ce1b20bf8dc182e9656.tar.gz bcm5719-llvm-a721db24c08bd64dc3495ce1b20bf8dc182e9656.zip | |
Subclass InputGraph to get darwin linker library semantics
The darwin linker operates differently than the gnu linker with respect to
libraries. The darwin linker first links in all object files from the command
line, then to resolve any remaining undefines, it repeatedly iterates over
libraries on the command line until either all undefines are resolved or no
undefines were resolved in the last pass.
When Shankar made the InputGraph model, the plan for darwin was for the darwin
driver to place all libraries in a group at the end of the InputGraph. Thus
making the darwin model a subset of the gnu model. But it turns out that does
not work because the driver cannot tell if a file is an object or library until
it has been loaded, which happens later.
This solution is to subclass InputGraph for darwin and just iterate the graph
the way darwin linker needs.
llvm-svn: 220330
Diffstat (limited to 'lld/lib/Driver/DarwinLdDriver.cpp')
| -rw-r--r-- | lld/lib/Driver/DarwinLdDriver.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp index e7ffcd8f30f..500e292ec50 100644 --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -83,7 +83,7 @@ static std::string canonicalizePath(StringRef path) { } } -static void addFile(StringRef path, std::unique_ptr<InputGraph> &inputGraph, +static void addFile(StringRef path, std::unique_ptr<DarwinInputGraph> &inputGraph, MachOLinkingContext &ctx, bool loadWholeArchive, bool upwardDylib) { auto node = llvm::make_unique<MachOFileNode>(path, ctx); @@ -132,7 +132,7 @@ static std::error_code parseExportsList(StringRef exportFilePath, // per line. The <dir> prefix is prepended to each partial path. // static std::error_code parseFileList(StringRef fileListPath, - std::unique_ptr<InputGraph> &inputGraph, + std::unique_ptr<DarwinInputGraph> &inputGraph, MachOLinkingContext &ctx, bool forceLoad, raw_ostream &diagnostics) { // If there is a comma, split off <dir>. @@ -468,7 +468,7 @@ bool DarwinLdDriver::parse(int argc, const char *argv[], } } - std::unique_ptr<InputGraph> inputGraph(new InputGraph()); + std::unique_ptr<DarwinInputGraph> inputGraph(new DarwinInputGraph()); // Now construct the set of library search directories, following ld64's // baroque set of accumulated hacks. Mostly, the algorithm constructs |

