diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-11-20 19:08:42 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-11-20 19:08:42 +0000 |
commit | 3e25f2e1bea42ee2c804f3b7b96d37806460825d (patch) | |
tree | 2254fb98029c52775b6d12ec324d701552061935 /tools/gccld/gccld.cpp | |
parent | 84fbc653ce78919196acea9bed9bb7288d461ee7 (diff) |
When writing out the runner script, add -load=<lib> lines to pull in all the
shared objects automagically, so it doesn't have to be done by hand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld/gccld.cpp')
-rw-r--r-- | tools/gccld/gccld.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index 59306ba263..f520ad0ff9 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -281,7 +281,24 @@ int main(int argc, char **argv, char **envp) { if (!Out2.good()) return PrintAndReturn(argv[0], "error opening '" + OutputFilename + "' for writing!"); - Out2 << "#!/bin/sh\nlli $0.bc $*\n"; + Out2 << "#!/bin/sh\nlli \\\n"; + // gcc accepts -l<lib> and implicitly searches /lib and /usr/lib. + LibPaths.push_back("/lib"); + LibPaths.push_back("/usr/lib"); + // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a + // shared object at all! See RH 8: plain text. + std::vector<std::string>::iterator libc = + std::find(Libraries.begin(), Libraries.end(), "c"); + if (libc != Libraries.end()) Libraries.erase(libc); + // List all the shared object (native) libraries this executable will need + // on the command line, so that we don't have to do this manually! + for (std::vector<std::string>::iterator i = Libraries.begin(), + e = Libraries.end(); i != e; ++i) { + std::string FullLibraryPath = FindLib(*i, LibPaths, true); + if (!FullLibraryPath.empty()) + Out2 << " -load=" << FullLibraryPath << " \\\n"; + } + Out2 << " $0.bc $*\n"; Out2.close(); } |