[llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp

Reid Spencer reid at x10sys.com
Thu Nov 25 01:32:19 PST 2004



Changes in directory llvm/lib/Linker:

LinkArchives.cpp updated: 1.38 -> 1.39
---
Log message:

Implement dependent library linking. It is no longer required that -lstdc++
-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.


---
Diffs of the changes:  (+8 -1)

Index: llvm/lib/Linker/LinkArchives.cpp
diff -u llvm/lib/Linker/LinkArchives.cpp:1.38 llvm/lib/Linker/LinkArchives.cpp:1.39
--- llvm/lib/Linker/LinkArchives.cpp:1.38	Thu Nov 18 21:27:05 2004
+++ llvm/lib/Linker/LinkArchives.cpp	Thu Nov 25 03:32:08 2004
@@ -371,12 +371,19 @@
 ///  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;
 
+  // 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);






More information about the llvm-commits mailing list