]> granicus.if.org Git - llvm/commitdiff
Eliminate useless duplicate libraries
authorChris Lattner <sabre@nondot.org>
Sat, 19 Apr 2003 23:07:33 +0000 (23:07 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 19 Apr 2003 23:07:33 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5823 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gccld/gccld.cpp

index f21dff79c61b195ee46c1bb67f39dc8aedd8bf0a..90cebb4df08837dbfcc45941bd9cf56f15e5f4d6 100644 (file)
@@ -120,7 +120,8 @@ static inline bool LoadLibraryFromDirectory(const std::string &LibName,
                                             bool &isArchive) {
   if (FileExists(Directory + "lib" + LibName + ".a")) {
     std::string ErrorMessage;
-    if (Verbose) std::cerr << "Loading '" << Directory << LibName << ".a'\n";
+    if (Verbose) std::cerr << "  Loading '" << Directory << "lib"
+                           << LibName << ".a'\n";
     if (!ReadArchiveFile(Directory + "lib" + LibName + ".a", Objects,
                          &ErrorMessage)) {   // Read the archive file
       isArchive = true;
@@ -128,7 +129,7 @@ static inline bool LoadLibraryFromDirectory(const std::string &LibName,
     }
 
     if (Verbose) {
-      std::cerr << "Error loading archive '" + Directory + "lib"+LibName+".a'";
+      std::cerr << "  Error loading archive '" + Directory +"lib"+LibName+".a'";
       if (!ErrorMessage.empty()) std::cerr << ": " << ErrorMessage;
       std::cerr << "\n";
     }
@@ -305,6 +306,10 @@ int main(int argc, char **argv) {
                             ": error linking in '" + InputFilenames[i] + "'");
   }
 
+  // Remove any consecutive duplicates of the same library...
+  Libraries.erase(std::unique(Libraries.begin(), Libraries.end()),
+                  Libraries.end());
+
   // Link in all of the libraries next...
   for (unsigned i = 0; i != Libraries.size(); ++i) {
     if (Verbose) std::cerr << "Linking in library: -l" << Libraries[i] << "\n";