From 1df12628a00682869cdda056277ca96ab6e064ed Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Thu, 20 Nov 2003 19:08:42 +0000 Subject: When writing out the runner script, add -load= lines to pull in all the shared objects automagically, so it doesn't have to be done by hand. llvm-svn: 10114 --- llvm/tools/gccld/gccld.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'llvm/tools/gccld/gccld.cpp') diff --git a/llvm/tools/gccld/gccld.cpp b/llvm/tools/gccld/gccld.cpp index 59306ba2638..f520ad0ff98 100644 --- a/llvm/tools/gccld/gccld.cpp +++ b/llvm/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 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::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::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(); } -- cgit v1.2.3