blob: 8e0ae7ed32ac33b8a1a11ee4e4feca2fa6504561 [file] [log] [blame]
Reid Spencerc408c452004-11-12 20:34:32 +00001//===- lib/Linker/LinkArchives.cpp - Link LLVM objects and libraries ------===//
John Criswell7c0e0222003-10-20 17:47:21 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
John Criswell71478b72003-09-19 20:24:23 +00009//
Chris Lattnera58d2be2003-09-30 03:24:28 +000010// This file contains routines to handle linking together LLVM bytecode files,
11// and to handle annoying things like static libraries.
John Criswell71478b72003-09-19 20:24:23 +000012//
13//===----------------------------------------------------------------------===//
14
Reid Spencer8bbb17a2004-11-14 22:02:27 +000015#include "llvm/Linker.h"
John Criswell71478b72003-09-19 20:24:23 +000016#include "llvm/Module.h"
Reid Spencer8bbb17a2004-11-14 22:02:27 +000017#include "llvm/ModuleProvider.h"
John Criswell71478b72003-09-19 20:24:23 +000018#include "llvm/PassManager.h"
19#include "llvm/Bytecode/Reader.h"
Reid Spencer8bbb17a2004-11-14 22:02:27 +000020#include "llvm/Bytecode/Archive.h"
John Criswell71478b72003-09-19 20:24:23 +000021#include "llvm/Bytecode/WriteBytecodePass.h"
22#include "llvm/Target/TargetData.h"
23#include "llvm/Transforms/IPO.h"
24#include "llvm/Transforms/Scalar.h"
Misha Brukman008248f2004-06-23 17:33:09 +000025#include "llvm/Support/Linker.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000026#include "llvm/Config/config.h"
27#include "llvm/Support/CommandLine.h"
28#include "llvm/Support/FileUtilities.h"
Chris Lattnerbed85ff2004-05-27 05:41:36 +000029#include "llvm/System/Signals.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000030#include "llvm/Support/SystemUtils.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000031#include <algorithm>
John Criswell71478b72003-09-19 20:24:23 +000032#include <fstream>
33#include <memory>
34#include <set>
Chris Lattner6cc8ca92003-11-28 07:44:09 +000035using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000036
Brian Gaeke0d723ac2003-11-11 21:54:01 +000037/// FindLib - Try to convert Filename into the name of a file that we can open,
38/// if it does not already name a file we can open, by first trying to open
Misha Brukman7a46e4c2004-04-15 15:23:45 +000039/// Filename, then libFilename.[suffix] for each of a set of several common
Brian Gaeke0d723ac2003-11-11 21:54:01 +000040/// library suffixes, in each of the directories in Paths and the directory
41/// named by the value of the environment variable LLVM_LIB_SEARCH_PATH. Returns
42/// an empty string if no matching file can be found.
Misha Brukman5208ba12003-09-30 18:09:32 +000043///
Chris Lattner6cc8ca92003-11-28 07:44:09 +000044std::string llvm::FindLib(const std::string &Filename,
45 const std::vector<std::string> &Paths,
46 bool SharedObjectOnly) {
John Criswell71478b72003-09-19 20:24:23 +000047 // Determine if the pathname can be found as it stands.
Brian Gaekeee8adb12003-11-11 18:27:37 +000048 if (FileOpenable(Filename))
John Criswell71478b72003-09-19 20:24:23 +000049 return Filename;
John Criswell71478b72003-09-19 20:24:23 +000050
John Criswell71478b72003-09-19 20:24:23 +000051 // If that doesn't work, convert the name into a library name.
John Criswell71478b72003-09-19 20:24:23 +000052 std::string LibName = "lib" + Filename;
53
John Criswell71478b72003-09-19 20:24:23 +000054 // Iterate over the directories in Paths to see if we can find the library
55 // there.
Misha Brukman17dc4ce2003-09-29 22:16:43 +000056 for (unsigned Index = 0; Index != Paths.size(); ++Index) {
John Criswell71478b72003-09-19 20:24:23 +000057 std::string Directory = Paths[Index] + "/";
58
Misha Brukman84fbc652003-11-20 19:08:06 +000059 if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc"))
John Criswell71478b72003-09-19 20:24:23 +000060 return Directory + LibName + ".bc";
John Criswell71478b72003-09-19 20:24:23 +000061
John Criswell7f7d16b2004-01-26 20:59:41 +000062 if (FileOpenable(Directory + LibName + SHLIBEXT))
63 return Directory + LibName + SHLIBEXT;
John Criswell71478b72003-09-19 20:24:23 +000064
Misha Brukman84fbc652003-11-20 19:08:06 +000065 if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a"))
John Criswell71478b72003-09-19 20:24:23 +000066 return Directory + LibName + ".a";
John Criswell71478b72003-09-19 20:24:23 +000067 }
68
John Criswell71478b72003-09-19 20:24:23 +000069 // One last hope: Check LLVM_LIB_SEARCH_PATH.
John Criswell71478b72003-09-19 20:24:23 +000070 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
71 if (SearchPath == NULL)
Misha Brukman17dc4ce2003-09-29 22:16:43 +000072 return std::string();
John Criswell71478b72003-09-19 20:24:23 +000073
74 LibName = std::string(SearchPath) + "/" + LibName;
Brian Gaekeee8adb12003-11-11 18:27:37 +000075 if (FileOpenable(LibName))
John Criswell71478b72003-09-19 20:24:23 +000076 return LibName;
John Criswell71478b72003-09-19 20:24:23 +000077
78 return std::string();
79}
80
Brian Gaeke3b3640a2003-11-05 22:12:52 +000081/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
82/// name of each externally-visible symbol defined in M.
Misha Brukman5208ba12003-09-30 18:09:32 +000083///
Chris Lattner6cc8ca92003-11-28 07:44:09 +000084void llvm::GetAllDefinedSymbols(Module *M,
85 std::set<std::string> &DefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +000086 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
87 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
88 DefinedSymbols.insert(I->getName());
89 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
90 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
91 DefinedSymbols.insert(I->getName());
92}
93
Misha Brukman5208ba12003-09-30 18:09:32 +000094/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
95/// exist in an LLVM module. This is a bit tricky because there may be two
96/// symbols with the same name but different LLVM types that will be resolved to
97/// each other but aren't currently (thus we need to treat it as resolved).
98///
99/// Inputs:
100/// M - The module in which to find undefined symbols.
101///
102/// Outputs:
103/// UndefinedSymbols - A set of C++ strings containing the name of all
104/// undefined symbols.
105///
John Criswell71478b72003-09-19 20:24:23 +0000106void
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000107llvm::GetAllUndefinedSymbols(Module *M,
108 std::set<std::string> &UndefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000109 std::set<std::string> DefinedSymbols;
110 UndefinedSymbols.clear(); // Start out empty
111
112 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
113 if (I->hasName()) {
114 if (I->isExternal())
115 UndefinedSymbols.insert(I->getName());
116 else if (!I->hasInternalLinkage())
117 DefinedSymbols.insert(I->getName());
118 }
119 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
120 if (I->hasName()) {
121 if (I->isExternal())
122 UndefinedSymbols.insert(I->getName());
123 else if (!I->hasInternalLinkage())
124 DefinedSymbols.insert(I->getName());
125 }
126
127 // Prune out any defined symbols from the undefined symbols set...
128 for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
129 I != UndefinedSymbols.end(); )
130 if (DefinedSymbols.count(*I))
131 UndefinedSymbols.erase(I++); // This symbol really is defined!
132 else
133 ++I; // Keep this symbol in the undefined symbols list
134}
135
136
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000137/// LoadObject - Read in and parse the bytecode file named by FN and return the
138/// module it contains (wrapped in an auto_ptr), or 0 and set ErrorMessage if an
139/// error occurs.
Misha Brukman5208ba12003-09-30 18:09:32 +0000140///
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000141static std::auto_ptr<Module> LoadObject(const std::string &FN,
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000142 std::string &ErrorMessage) {
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000143 std::string ParserErrorMessage;
144 Module *Result = ParseBytecodeFile(FN, &ParserErrorMessage);
John Criswell71478b72003-09-19 20:24:23 +0000145 if (Result) return std::auto_ptr<Module>(Result);
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000146 ErrorMessage = "Bytecode file '" + FN + "' could not be loaded";
147 if (ParserErrorMessage.size()) ErrorMessage += ": " + ParserErrorMessage;
John Criswell71478b72003-09-19 20:24:23 +0000148 return std::auto_ptr<Module>();
149}
150
Misha Brukman5208ba12003-09-30 18:09:32 +0000151/// LinkInArchive - opens an archive library and link in all objects which
152/// provide symbols that are currently undefined.
153///
154/// Inputs:
155/// M - The module in which to link the archives.
156/// Filename - The pathname of the archive.
157/// Verbose - Flags whether verbose messages should be printed.
158///
159/// Outputs:
160/// ErrorMessage - A C++ string detailing what error occurred, if any.
161///
162/// Return Value:
163/// TRUE - An error occurred.
164/// FALSE - No errors.
165///
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000166bool llvm::LinkInArchive(Module *M,
Misha Brukmane6763132003-09-29 22:26:24 +0000167 const std::string &Filename,
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000168 std::string* ErrorMessage,
Misha Brukmane6763132003-09-29 22:26:24 +0000169 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000170{
John Criswell71478b72003-09-19 20:24:23 +0000171 // Find all of the symbols currently undefined in the bytecode program.
172 // If all the symbols are defined, the program is complete, and there is
173 // no reason to link in any archive files.
John Criswell71478b72003-09-19 20:24:23 +0000174 std::set<std::string> UndefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000175 GetAllUndefinedSymbols(M, UndefinedSymbols);
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000176 if (UndefinedSymbols.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000177 if (Verbose) std::cerr << " No symbols undefined, don't link library!\n";
178 return false; // No need to link anything in!
179 }
180
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000181 // Open the archive file
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000182 if (Verbose) std::cerr << " Loading archive file '" << Filename << "'\n";
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000183 Archive* arch = Archive::OpenAndLoadSymbols(sys::Path(Filename));
John Criswell71478b72003-09-19 20:24:23 +0000184
185 // While we are linking in object files, loop.
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000186 while (true) {
187 std::set<ModuleProvider*> Modules;
188 // Find the modules we need to link
189 arch->findModulesDefiningSymbols(UndefinedSymbols,Modules);
John Criswell71478b72003-09-19 20:24:23 +0000190
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000191 // If we didn't find any more modules to link this time, we are done.
192 if (Modules.empty())
193 break;
John Criswell71478b72003-09-19 20:24:23 +0000194
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000195 // Loop over all the ModuleProviders that we got back from the archive
196 for (std::set<ModuleProvider*>::iterator I=Modules.begin(), E=Modules.end();
197 I != E; ++I) {
198 // Get the module we must link in.
199 Module* aModule = (*I)->releaseModule();
200 std::cout << "Linked: " << aModule->getModuleIdentifier() << "\n";
John Criswell1715ce02003-12-23 17:37:06 +0000201
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000202 // Link it in
203 if (LinkModules(M, aModule, ErrorMessage)) {
204 // don't create a memory leak
205 delete aModule;
206 delete arch;
207 return true; // Couldn't link in the right object file...
John Criswell1715ce02003-12-23 17:37:06 +0000208 }
John Criswell71478b72003-09-19 20:24:23 +0000209
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000210 // Since we have linked in this object, throw it away now.
211 delete aModule;
John Criswell71478b72003-09-19 20:24:23 +0000212 }
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000213
214 // We have linked in a set of modules determined by the archive to satisfy
215 // our missing symbols. Linking in the new modules will have satisfied some
216 // symbols but may introduce additional missing symbols. We need to update
217 // the list of undefined symbols and try again until the archive doesn't
218 // have any modules that satisfy our symbols.
219 GetAllUndefinedSymbols(M, UndefinedSymbols);
John Criswell71478b72003-09-19 20:24:23 +0000220 }
221
222 return false;
223}
224
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000225/// LinkInFile - opens a bytecode file and links in all objects which
Misha Brukman5208ba12003-09-30 18:09:32 +0000226/// provide symbols that are currently undefined.
227///
228/// Inputs:
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000229/// HeadModule - The module in which to link the bytecode file.
230/// Filename - The pathname of the bytecode file.
Misha Brukman5208ba12003-09-30 18:09:32 +0000231/// Verbose - Flags whether verbose messages should be printed.
232///
233/// Outputs:
234/// ErrorMessage - A C++ string detailing what error occurred, if any.
235///
236/// Return Value:
237/// TRUE - An error occurred.
238/// FALSE - No errors.
239///
Misha Brukmane6763132003-09-29 22:26:24 +0000240static bool LinkInFile(Module *HeadModule,
241 const std::string &Filename,
242 std::string &ErrorMessage,
243 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000244{
245 std::auto_ptr<Module> M(LoadObject(Filename, ErrorMessage));
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000246 if (M.get() == 0) return true;
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000247 bool Result = LinkModules(HeadModule, M.get(), &ErrorMessage);
248 if (Verbose) std::cerr << "Linked in bytecode file '" << Filename << "'\n";
249 return Result;
John Criswell71478b72003-09-19 20:24:23 +0000250}
251
Misha Brukman5208ba12003-09-30 18:09:32 +0000252/// LinkFiles - takes a module and a list of files and links them all together.
253/// It locates the file either in the current directory, as its absolute
254/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
255///
256/// Inputs:
257/// progname - The name of the program (infamous argv[0]).
258/// HeadModule - The module under which all files will be linked.
259/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
260/// to be linked. The names can refer to a mixture of pure LLVM
261/// bytecode files and archive (ar) formatted files.
262/// Verbose - Flags whether verbose output should be printed while linking.
263///
264/// Outputs:
265/// HeadModule - The module will have the specified LLVM bytecode files linked
266/// in.
267///
268/// Return value:
269/// FALSE - No errors.
270/// TRUE - Some error occurred.
271///
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000272bool llvm::LinkFiles(const char *progname, Module *HeadModule,
273 const std::vector<std::string> &Files, bool Verbose) {
John Criswell71478b72003-09-19 20:24:23 +0000274 // String in which to receive error messages.
275 std::string ErrorMessage;
276
277 // Full pathname of the file
278 std::string Pathname;
279
280 // Get the library search path from the environment
281 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
282
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000283 for (unsigned i = 0; i < Files.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000284 // Determine where this file lives.
Brian Gaekeee8adb12003-11-11 18:27:37 +0000285 if (FileOpenable(Files[i])) {
John Criswell71478b72003-09-19 20:24:23 +0000286 Pathname = Files[i];
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000287 } else {
288 if (SearchPath == NULL) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000289 std::cerr << progname << ": Cannot find linker input file '"
290 << Files[i] << "'\n";
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000291 std::cerr << progname
292 << ": Warning: Your LLVM_LIB_SEARCH_PATH is unset.\n";
John Criswell71478b72003-09-19 20:24:23 +0000293 return true;
294 }
295
296 Pathname = std::string(SearchPath)+"/"+Files[i];
Brian Gaekeee8adb12003-11-11 18:27:37 +0000297 if (!FileOpenable(Pathname)) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000298 std::cerr << progname << ": Cannot find linker input file '"
299 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000300 return true;
301 }
302 }
303
John Criswell71478b72003-09-19 20:24:23 +0000304 // A user may specify an ar archive without -l, perhaps because it
305 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000306 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000307 if (Verbose)
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000308 std::cerr << "Trying to link archive '" << Pathname << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000309
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000310 if (LinkInArchive(HeadModule, Pathname, &ErrorMessage, Verbose)) {
Chris Lattner0ebee742004-06-02 00:22:24 +0000311 std::cerr << progname << ": Error linking in archive '" << Pathname
312 << "': " << ErrorMessage << "\n";
John Criswell71478b72003-09-19 20:24:23 +0000313 return true;
314 }
Brian Gaekeee8adb12003-11-11 18:27:37 +0000315 } else if (IsBytecode(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000316 if (Verbose)
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000317 std::cerr << "Trying to link bytecode file '" << Pathname << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000318
Misha Brukmane6763132003-09-29 22:26:24 +0000319 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
Chris Lattner0ebee742004-06-02 00:22:24 +0000320 std::cerr << progname << ": Error linking in bytecode file '"
321 << Pathname << "': " << ErrorMessage << "\n";
John Criswell71478b72003-09-19 20:24:23 +0000322 return true;
323 }
Misha Brukmaneda20f92004-11-08 22:03:10 +0000324 } else {
Misha Brukman669b5242004-11-09 04:24:59 +0000325 std::cerr << progname << ": Warning: invalid file `" << Pathname
326 << "' ignored.\n";
John Criswell71478b72003-09-19 20:24:23 +0000327 }
328 }
329
330 return false;
331}
332
Misha Brukman5208ba12003-09-30 18:09:32 +0000333/// LinkLibraries - takes the specified library files and links them into the
334/// main bytecode object file.
335///
336/// Inputs:
337/// progname - The name of the program (infamous argv[0]).
338/// HeadModule - The module into which all necessary libraries will be linked.
339/// Libraries - The list of libraries to link into the module.
340/// LibPaths - The list of library paths in which to find libraries.
341/// Verbose - Flags whether verbose messages should be printed.
342/// Native - Flags whether native code is being generated.
343///
344/// Outputs:
345/// HeadModule - The module will have all necessary libraries linked in.
346///
347/// Return value:
348/// FALSE - No error.
349/// TRUE - Error.
350///
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000351void llvm::LinkLibraries(const char *progname, Module *HeadModule,
352 const std::vector<std::string> &Libraries,
353 const std::vector<std::string> &LibPaths,
354 bool Verbose, bool Native) {
John Criswell71478b72003-09-19 20:24:23 +0000355 // String in which to receive error messages.
356 std::string ErrorMessage;
357
Brian Gaekef1fce082003-10-21 21:07:12 +0000358 for (unsigned i = 0; i < Libraries.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000359 // Determine where this library lives.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000360 std::string Pathname = FindLib(Libraries[i], LibPaths);
361 if (Pathname.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000362 // If the pathname does not exist, then continue to the next one if
363 // we're doing a native link and give an error if we're doing a bytecode
364 // link.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000365 if (!Native) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000366 std::cerr << progname << ": WARNING: Cannot find library -l"
367 << Libraries[i] << "\n";
368 continue;
John Criswell71478b72003-09-19 20:24:23 +0000369 }
370 }
371
John Criswell71478b72003-09-19 20:24:23 +0000372 // A user may specify an ar archive without -l, perhaps because it
373 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000374 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000375 if (Verbose)
Brian Gaeke2282ae12003-11-16 23:07:13 +0000376 std::cerr << "Trying to link archive '" << Pathname << "' (-l"
377 << Libraries[i] << ")\n";
John Criswell71478b72003-09-19 20:24:23 +0000378
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000379 if (LinkInArchive(HeadModule, Pathname, &ErrorMessage, Verbose)) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000380 std::cerr << progname << ": " << ErrorMessage
381 << ": Error linking in archive '" << Pathname << "' (-l"
382 << Libraries[i] << ")\n";
383 exit(1);
John Criswell71478b72003-09-19 20:24:23 +0000384 }
Brian Gaekeee8adb12003-11-11 18:27:37 +0000385 } else if (IsBytecode(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000386 if (Verbose)
Brian Gaeke2282ae12003-11-16 23:07:13 +0000387 std::cerr << "Trying to link bytecode file '" << Pathname
388 << "' (-l" << Libraries[i] << ")\n";
John Criswell71478b72003-09-19 20:24:23 +0000389
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000390 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000391 std::cerr << progname << ": " << ErrorMessage
392 << ": error linking in bytecode file '" << Pathname << "' (-l"
393 << Libraries[i] << ")\n";
394 exit(1);
John Criswell71478b72003-09-19 20:24:23 +0000395 }
396 }
397 }
John Criswell71478b72003-09-19 20:24:23 +0000398}