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.

llvm-svn: 18243
This commit is contained in:
Reid Spencer 2004-11-25 09:32:08 +00:00
parent 2c4f9a484c
commit 8bb258d1ea
1 changed files with 8 additions and 1 deletions

View File

@ -371,12 +371,19 @@ bool llvm::LinkFiles(const char *progname, Module *HeadModule,
/// TRUE - Error. /// TRUE - Error.
/// ///
void llvm::LinkLibraries(const char *progname, Module *HeadModule, 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, const std::vector<std::string> &LibPaths,
bool Verbose, bool Native) { bool Verbose, bool Native) {
// String in which to receive error messages. // String in which to receive error messages.
std::string ErrorMessage; 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) { for (unsigned i = 0; i < Libraries.size(); ++i) {
// Determine where this library lives. // Determine where this library lives.
std::string Pathname = FindLib(Libraries[i], LibPaths); std::string Pathname = FindLib(Libraries[i], LibPaths);