Implement dependent library linking. It is no longer required that -lstdc++
authorReid Spencer <rspencer@reidspencer.com>
Thu, 25 Nov 2004 09:32:08 +0000 (09:32 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 25 Nov 2004 09:32:08 +0000 (09:32 +0000)
-lstdsup++ no -lc be passed on the command line to llvm linkers if the
progam being linked was compiled with the C/C++ Front End or Stacker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18243 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkArchives.cpp

index 0d770f56f13e209e185e41fb47f9e45b8a902d5d..1f96bf97c89ab045c28e0560c6deb2d3b572fa79 100644 (file)
@@ -371,12 +371,19 @@ bool llvm::LinkFiles(const char *progname, Module *HeadModule,
 ///  TRUE  - Error.
 ///
 void llvm::LinkLibraries(const char *progname, Module *HeadModule,
 ///  TRUE  - Error.
 ///
 void llvm::LinkLibraries(const char *progname, Module *HeadModule,
-                         const std::vector<std::string> &Libraries,
+                         const std::vector<std::string> &Libs,
                          const std::vector<std::string> &LibPaths,
                          bool Verbose, bool Native) {
   // String in which to receive error messages.
   std::string ErrorMessage;
 
                          const std::vector<std::string> &LibPaths,
                          bool Verbose, bool Native) {
   // String in which to receive error messages.
   std::string ErrorMessage;
 
+  // Build a set of library names that we should try, including the 
+  // HeadModule's dependent libraries. We use a set here to eliminate 
+  // duplicates between the module's libraries and the argument Libs.
+  Module::LibraryListType Libraries(HeadModule->getLibraries());
+  Libraries.insert(Libs.begin(),Libs.end());
+
+  // For each library
   for (unsigned i = 0; i < Libraries.size(); ++i) {
     // Determine where this library lives.
     std::string Pathname = FindLib(Libraries[i], LibPaths);
   for (unsigned i = 0; i < Libraries.size(); ++i) {
     // Determine where this library lives.
     std::string Pathname = FindLib(Libraries[i], LibPaths);