summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/Driver/DarwinLdDriver.cpp7
-rw-r--r--lld/unittests/DriverTests/DarwinLdDriverTest.cpp9
2 files changed, 16 insertions, 0 deletions
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp
index d41bba05ffa..169cafa8542 100644
--- a/lld/lib/Driver/DarwinLdDriver.cpp
+++ b/lld/lib/Driver/DarwinLdDriver.cpp
@@ -245,6 +245,13 @@ bool DarwinLdDriver::parse(int argc, const char *argv[],
}
}
+ // Handle -mllvm
+ for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_mllvm),
+ ie = parsedArgs->filtered_end();
+ it != ie; ++it) {
+ ctx.appendLLVMOption((*it)->getValue());
+ }
+
std::unique_ptr<InputGraph> inputGraph(new InputGraph());
// Handle input files
diff --git a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
index d9b6764e01c..6c8799e089a 100644
--- a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
+++ b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
@@ -222,4 +222,13 @@ TEST_F(DarwinLdParserTest, deadStrippableDylibInvalidType) {
EXPECT_FALSE(parse("ld", "-mark_dead_strippable_dylib", "a.o", nullptr));
}
+TEST_F(DarwinLdParserTest, llvmOptions) {
+ EXPECT_TRUE(parse("ld", "-mllvm", "-debug-only", "-mllvm", "foo", "a.o", nullptr));
+ const std::vector<const char *> &options = _context.llvmOptions();
+ EXPECT_EQ(options.size(), 2UL);
+ EXPECT_EQ(strcmp(options[0],"-debug-only"), 0);
+ EXPECT_EQ(strcmp(options[1],"foo"), 0);
+}
+
+
} // end anonymous namespace
OpenPOWER on IntegriCloud