diff options
| author | Nick Kledzik <kledzik@apple.com> | 2014-10-16 19:31:28 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2014-10-16 19:31:28 +0000 |
| commit | 51720673915e21fbe2756e9ec7a2b38f9b53396c (patch) | |
| tree | 5dda9424a2ca85e2f39c4d62ebb0386f3cbd5e1c /lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | |
| parent | b38b96ab4c491b914835d005532e8f8e4842c77a (diff) | |
| download | bcm5719-llvm-51720673915e21fbe2756e9ec7a2b38f9b53396c.tar.gz bcm5719-llvm-51720673915e21fbe2756e9ec7a2b38f9b53396c.zip | |
[mach-o] Add support for upward linking
To deal with cycles in shared library dependencies, the darwin linker supports
marking specific link dependencies as "upward". An upward link is when a
lower level library links against a higher level library.
llvm-svn: 219949
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp index 3b9c6fb9973..f23bfc86a6e 100644 --- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -598,7 +598,7 @@ Writer &MachOLinkingContext::writer() const { } MachODylibFile* MachOLinkingContext::loadIndirectDylib(StringRef path) { - std::unique_ptr<MachOFileNode> node(new MachOFileNode(path, false, *this)); + std::unique_ptr<MachOFileNode> node(new MachOFileNode(path, *this)); std::error_code ec = node->parse(*this, llvm::errs()); if (ec) return nullptr; @@ -668,15 +668,26 @@ bool MachOLinkingContext::createImplicitFiles( } -void MachOLinkingContext::registerDylib(MachODylibFile *dylib) const { +void MachOLinkingContext::registerDylib(MachODylibFile *dylib, + bool upward) const { _allDylibs.insert(dylib); _pathToDylibMap[dylib->installName()] = dylib; // If path is different than install name, register path too. if (!dylib->path().equals(dylib->installName())) _pathToDylibMap[dylib->path()] = dylib; + if (upward) + _upwardDylibs.insert(dylib); } +bool MachOLinkingContext::isUpwardDylib(StringRef installName) const { + for (MachODylibFile *dylib : _upwardDylibs) { + if (dylib->installName().equals(installName)) + return true; + } + return false; +} + ArchHandler &MachOLinkingContext::archHandler() const { if (!_archHandler) _archHandler = ArchHandler::create(_arch); |

