summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Fitzgerald <garious@gmail.com>2015-01-26 20:46:47 +0000
committerGreg Fitzgerald <garious@gmail.com>2015-01-26 20:46:47 +0000
commit0dc86722f55adfd0e311066ca627626de999ca2d (patch)
tree3cd6311b30c69fb0ab74ea0502f75e97e65a1056
parent3c8465acb219fa83239e004d4fcac9bec1a26239 (diff)
downloadbcm5719-llvm-0dc86722f55adfd0e311066ca627626de999ca2d.tar.gz
bcm5719-llvm-0dc86722f55adfd0e311066ca627626de999ca2d.zip
Fix shared library build
* Removed cyclic dependency between lldPECOFF and lldDriver * Added missing dependencies in unit tests Differential Revision: http://reviews.llvm.org/D7185 llvm-svn: 227134
-rw-r--r--lld/include/lld/Driver/Driver.h8
-rw-r--r--lld/include/lld/ReaderWriter/PECOFFLinkingContext.h16
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp1
-rw-r--r--lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp7
-rw-r--r--lld/tools/lld/CMakeLists.txt1
-rw-r--r--lld/unittests/DriverTests/CMakeLists.txt3
6 files changed, 32 insertions, 4 deletions
diff --git a/lld/include/lld/Driver/Driver.h b/lld/include/lld/Driver/Driver.h
index 627eb179af7..b42ea3ad333 100644
--- a/lld/include/lld/Driver/Driver.h
+++ b/lld/include/lld/Driver/Driver.h
@@ -120,6 +120,14 @@ public:
bool isDirective = false,
std::set<StringRef> *undefinedSymbols = nullptr);
+ // Same as parse(), but restricted to the context of directives.
+ static bool parseDirectives(int argc, const char *argv[],
+ PECOFFLinkingContext &info,
+ raw_ostream &diagnostics = llvm::errs(),
+ std::set<StringRef> *undefinedSymbols = nullptr) {
+ return parse(argc, argv, info, diagnostics, true, undefinedSymbols);
+ }
+
private:
WinLinkDriver() LLVM_DELETED_FUNCTION;
};
diff --git a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
index f3bb9117550..e2c5ea186e2 100644
--- a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
@@ -47,7 +47,8 @@ public:
_manifestUAC(true), _manifestLevel("'asInvoker'"),
_manifestUiAccess("'false'"), _isDll(false), _highEntropyVA(true),
_requireSEH(false), _noSEH(false), _implib(""), _debug(false),
- _pdbFilePath(""), _dosStub(llvm::makeArrayRef(DEFAULT_DOS_STUB)) {
+ _pdbFilePath(""), _dosStub(llvm::makeArrayRef(DEFAULT_DOS_STUB)),
+ _parseDirectives(nullptr) {
setDeadStripping(true);
}
@@ -82,6 +83,9 @@ public:
bool isPrivate;
};
+ typedef bool (*ParseDirectives)(int, const char **, PECOFFLinkingContext &,
+ raw_ostream &, std::set<StringRef> *);
+
/// \brief Casting support
static inline bool classof(const LinkingContext *info) { return true; }
@@ -326,6 +330,14 @@ public:
std::recursive_mutex &getMutex() { return _mutex; }
+ void setParseDirectives(ParseDirectives parseDirectives) {
+ _parseDirectives = parseDirectives;
+ }
+
+ ParseDirectives getParseDirectives() {
+ return _parseDirectives;
+ }
+
protected:
/// Method to create a internal file for the entry symbol
std::unique_ptr<File> createEntrySymbolFile() const override;
@@ -440,6 +452,8 @@ private:
std::set<std::string> _definedSyms;
std::set<Node *> _seen;
+
+ ParseDirectives _parseDirectives;
};
} // end namespace lld
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 826bfe2f447..80524d32fe7 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -855,6 +855,7 @@ bool WinLinkDriver::linkPECOFF(int argc, const char **argv, raw_ostream &diag) {
return true;
PECOFFLinkingContext ctx;
+ ctx.setParseDirectives(parseDirectives);
ctx.registry().addSupportCOFFObjects(ctx);
ctx.registry().addSupportCOFFImportLibraries(ctx);
ctx.registry().addSupportArchives(ctx.logInputFiles());
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
index 92dc5285a6b..f79a243e7e6 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@ -910,9 +910,10 @@ FileCOFF::parseDirectiveSection(StringRef directives,
const char **argv = &tokens[0];
std::string errorMessage;
llvm::raw_string_ostream stream(errorMessage);
- bool parseFailed = !WinLinkDriver::parse(argc, argv, _ctx, stream,
- /*isDirective*/ true,
- undefinedSymbols);
+ PECOFFLinkingContext::ParseDirectives parseDirectives =
+ _ctx.getParseDirectives();
+ bool parseFailed = !parseDirectives(argc, argv, _ctx, stream,
+ undefinedSymbols);
stream.flush();
// Print error message if error.
if (parseFailed) {
diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index c0c154a53aa..47f26b5300c 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -4,6 +4,7 @@ add_llvm_executable(lld
target_link_libraries(lld
lldDriver
+ LLVMSupport
)
install(TARGETS lld
diff --git a/lld/unittests/DriverTests/CMakeLists.txt b/lld/unittests/DriverTests/CMakeLists.txt
index 11edf349cc7..59d56d45958 100644
--- a/lld/unittests/DriverTests/CMakeLists.txt
+++ b/lld/unittests/DriverTests/CMakeLists.txt
@@ -8,4 +8,7 @@ add_lld_unittest(DriverTests
target_link_libraries(DriverTests
lldDriver
+ lldCore
+ lldPECOFF
+ lldMachO
)
OpenPOWER on IntegriCloud