Make sure command line options are parsed before we try to add the LibPath
[oota-llvm.git] / tools / llvm-ld / llvm-ld.cpp
index f6c9c747421ebd940325583a14c26103449c7606..46fd291476309908f1b46305512e452d2357e9b3 100644 (file)
@@ -406,14 +406,14 @@ int main(int argc, char **argv, char **envp) {
     progname = sys::Path(argv[0]).getBasename();
     Linker TheLinker(progname, OutputFilename, Verbose);
 
-    // Set up the library paths for the Linker
-    TheLinker.addPaths(LibPaths);
-    TheLinker.addSystemPaths();
-
     // Parse the command line options
     cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
     sys::PrintStackTraceOnErrorSignal();
 
+    // Set up the library paths for the Linker
+    TheLinker.addPaths(LibPaths);
+    TheLinker.addSystemPaths();
+
     // Remove any consecutive duplicates of the same library...
     Libraries.erase(std::unique(Libraries.begin(), Libraries.end()),
                     Libraries.end());