diff options
author | Chris Lattner <sabre@nondot.org> | 2002-03-11 17:49:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-03-11 17:49:53 +0000 |
commit | 41c34658129091ae9982d8919176fb6ff3e5a6ac (patch) | |
tree | 01689bb563bc91716c60c640255eace2ea85ffce /tools/gccld | |
parent | 4ee8dd7f2b14efacf7d9242c85881dc381413e4a (diff) | |
download | external_llvm-41c34658129091ae9982d8919176fb6ff3e5a6ac.zip external_llvm-41c34658129091ae9982d8919176fb6ff3e5a6ac.tar.gz external_llvm-41c34658129091ae9982d8919176fb6ff3e5a6ac.tar.bz2 |
* Implement linking to libraries
* Pass arguments to program through shell script
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld')
-rw-r--r-- | tools/gccld/gccld.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index cde23f9..c2aa837 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -22,6 +22,7 @@ #include "Support/CommandLine.h" #include <fstream> #include <memory> +#include <algorithm> #include <sys/types.h> // For FileExists #include <sys/stat.h> @@ -86,8 +87,18 @@ int main(int argc, char **argv) { unsigned BaseArg = 0; std::string ErrorMessage; - if (!Libraries.empty()) - cerr << "LLVM Linker Warning: Linking to libraries is unimplemented!\n"; + if (!Libraries.empty()) { + // Sort libraries list... + sort(Libraries.begin(), Libraries.end()); + + // Remove duplicate libraries entries... + Libraries.erase(unique(Libraries.begin(), Libraries.end()), + Libraries.end()); + + // Add all of the libraries to the end of the link line... + for (unsigned i = 0; i < Libraries.size(); ++i) + InputFilenames.push_back("lib" + Libraries[i] + ".bc"); + } std::auto_ptr<Module> Composite(LoadFile(InputFilenames[BaseArg])); if (Composite.get() == 0) return 1; @@ -121,7 +132,7 @@ int main(int argc, char **argv) { cerr << "Error openeing '" << OutputFilename << "' for writing!\n"; return 1; } - Out2 << "#!/bin/sh\nlli -q $0.bc\n"; + Out2 << "#!/bin/sh\nlli -q $0.bc $*\n"; Out2.close(); // Make the script executable... |