blob: 2cccc983ecdc8577d2ed4198a0c8818533c413dc [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"
Reid Spencer551ccae2004-09-01 22:55:40 +000025#include "llvm/Config/config.h"
26#include "llvm/Support/CommandLine.h"
27#include "llvm/Support/FileUtilities.h"
Chris Lattnerbed85ff2004-05-27 05:41:36 +000028#include "llvm/System/Signals.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000029#include "llvm/Support/SystemUtils.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000030#include <algorithm>
John Criswell71478b72003-09-19 20:24:23 +000031#include <fstream>
32#include <memory>
33#include <set>
Chris Lattner6cc8ca92003-11-28 07:44:09 +000034using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000035
Brian Gaeke0d723ac2003-11-11 21:54:01 +000036/// FindLib - Try to convert Filename into the name of a file that we can open,
37/// if it does not already name a file we can open, by first trying to open
Misha Brukman7a46e4c2004-04-15 15:23:45 +000038/// Filename, then libFilename.[suffix] for each of a set of several common
Brian Gaeke0d723ac2003-11-11 21:54:01 +000039/// library suffixes, in each of the directories in Paths and the directory
40/// named by the value of the environment variable LLVM_LIB_SEARCH_PATH. Returns
41/// an empty string if no matching file can be found.
Misha Brukman5208ba12003-09-30 18:09:32 +000042///
Chris Lattner6cc8ca92003-11-28 07:44:09 +000043std::string llvm::FindLib(const std::string &Filename,
44 const std::vector<std::string> &Paths,
45 bool SharedObjectOnly) {
John Criswell71478b72003-09-19 20:24:23 +000046 // Determine if the pathname can be found as it stands.
Brian Gaekeee8adb12003-11-11 18:27:37 +000047 if (FileOpenable(Filename))
John Criswell71478b72003-09-19 20:24:23 +000048 return Filename;
John Criswell71478b72003-09-19 20:24:23 +000049
John Criswell71478b72003-09-19 20:24:23 +000050 // If that doesn't work, convert the name into a library name.
John Criswell71478b72003-09-19 20:24:23 +000051 std::string LibName = "lib" + Filename;
52
John Criswell71478b72003-09-19 20:24:23 +000053 // Iterate over the directories in Paths to see if we can find the library
54 // there.
Misha Brukman17dc4ce2003-09-29 22:16:43 +000055 for (unsigned Index = 0; Index != Paths.size(); ++Index) {
John Criswell71478b72003-09-19 20:24:23 +000056 std::string Directory = Paths[Index] + "/";
57
Misha Brukman84fbc652003-11-20 19:08:06 +000058 if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc"))
John Criswell71478b72003-09-19 20:24:23 +000059 return Directory + LibName + ".bc";
John Criswell71478b72003-09-19 20:24:23 +000060
John Criswell7f7d16b2004-01-26 20:59:41 +000061 if (FileOpenable(Directory + LibName + SHLIBEXT))
62 return Directory + LibName + SHLIBEXT;
John Criswell71478b72003-09-19 20:24:23 +000063
Misha Brukman84fbc652003-11-20 19:08:06 +000064 if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a"))
John Criswell71478b72003-09-19 20:24:23 +000065 return Directory + LibName + ".a";
John Criswell71478b72003-09-19 20:24:23 +000066 }
67
John Criswell71478b72003-09-19 20:24:23 +000068 // One last hope: Check LLVM_LIB_SEARCH_PATH.
John Criswell71478b72003-09-19 20:24:23 +000069 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
70 if (SearchPath == NULL)
Misha Brukman17dc4ce2003-09-29 22:16:43 +000071 return std::string();
John Criswell71478b72003-09-19 20:24:23 +000072
73 LibName = std::string(SearchPath) + "/" + LibName;
Brian Gaekeee8adb12003-11-11 18:27:37 +000074 if (FileOpenable(LibName))
John Criswell71478b72003-09-19 20:24:23 +000075 return LibName;
John Criswell71478b72003-09-19 20:24:23 +000076
77 return std::string();
78}
79
Brian Gaeke3b3640a2003-11-05 22:12:52 +000080/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
81/// name of each externally-visible symbol defined in M.
Misha Brukman5208ba12003-09-30 18:09:32 +000082///
Chris Lattner6cc8ca92003-11-28 07:44:09 +000083void llvm::GetAllDefinedSymbols(Module *M,
84 std::set<std::string> &DefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +000085 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
86 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
87 DefinedSymbols.insert(I->getName());
88 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
89 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
90 DefinedSymbols.insert(I->getName());
91}
92
Misha Brukman5208ba12003-09-30 18:09:32 +000093/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
94/// exist in an LLVM module. This is a bit tricky because there may be two
95/// symbols with the same name but different LLVM types that will be resolved to
96/// each other but aren't currently (thus we need to treat it as resolved).
97///
98/// Inputs:
99/// M - The module in which to find undefined symbols.
100///
101/// Outputs:
102/// UndefinedSymbols - A set of C++ strings containing the name of all
103/// undefined symbols.
104///
John Criswell71478b72003-09-19 20:24:23 +0000105void
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000106llvm::GetAllUndefinedSymbols(Module *M,
107 std::set<std::string> &UndefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000108 std::set<std::string> DefinedSymbols;
109 UndefinedSymbols.clear(); // Start out empty
110
111 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
112 if (I->hasName()) {
113 if (I->isExternal())
114 UndefinedSymbols.insert(I->getName());
115 else if (!I->hasInternalLinkage())
116 DefinedSymbols.insert(I->getName());
117 }
118 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
119 if (I->hasName()) {
120 if (I->isExternal())
121 UndefinedSymbols.insert(I->getName());
122 else if (!I->hasInternalLinkage())
123 DefinedSymbols.insert(I->getName());
124 }
125
126 // Prune out any defined symbols from the undefined symbols set...
127 for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
128 I != UndefinedSymbols.end(); )
129 if (DefinedSymbols.count(*I))
130 UndefinedSymbols.erase(I++); // This symbol really is defined!
131 else
132 ++I; // Keep this symbol in the undefined symbols list
133}
134
135
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000136/// LoadObject - Read in and parse the bytecode file named by FN and return the
137/// module it contains (wrapped in an auto_ptr), or 0 and set ErrorMessage if an
138/// error occurs.
Misha Brukman5208ba12003-09-30 18:09:32 +0000139///
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000140static std::auto_ptr<Module> LoadObject(const std::string &FN,
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000141 std::string &ErrorMessage) {
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000142 std::string ParserErrorMessage;
143 Module *Result = ParseBytecodeFile(FN, &ParserErrorMessage);
John Criswell71478b72003-09-19 20:24:23 +0000144 if (Result) return std::auto_ptr<Module>(Result);
Brian Gaeke0d723ac2003-11-11 21:54:01 +0000145 ErrorMessage = "Bytecode file '" + FN + "' could not be loaded";
146 if (ParserErrorMessage.size()) ErrorMessage += ": " + ParserErrorMessage;
John Criswell71478b72003-09-19 20:24:23 +0000147 return std::auto_ptr<Module>();
148}
149
Misha Brukman5208ba12003-09-30 18:09:32 +0000150/// LinkInArchive - opens an archive library and link in all objects which
151/// provide symbols that are currently undefined.
152///
153/// Inputs:
154/// M - The module in which to link the archives.
155/// Filename - The pathname of the archive.
156/// Verbose - Flags whether verbose messages should be printed.
157///
158/// Outputs:
159/// ErrorMessage - A C++ string detailing what error occurred, if any.
160///
161/// Return Value:
162/// TRUE - An error occurred.
163/// FALSE - No errors.
164///
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000165bool llvm::LinkInArchive(Module *M,
Misha Brukmane6763132003-09-29 22:26:24 +0000166 const std::string &Filename,
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000167 std::string* ErrorMessage,
Misha Brukmane6763132003-09-29 22:26:24 +0000168 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000169{
John Criswell71478b72003-09-19 20:24:23 +0000170 // Find all of the symbols currently undefined in the bytecode program.
171 // If all the symbols are defined, the program is complete, and there is
172 // no reason to link in any archive files.
John Criswell71478b72003-09-19 20:24:23 +0000173 std::set<std::string> UndefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000174 GetAllUndefinedSymbols(M, UndefinedSymbols);
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000175 if (UndefinedSymbols.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000176 if (Verbose) std::cerr << " No symbols undefined, don't link library!\n";
177 return false; // No need to link anything in!
178 }
179
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000180 // Open the archive file
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000181 if (Verbose) std::cerr << " Loading archive file '" << Filename << "'\n";
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000182 Archive* arch = Archive::OpenAndLoadSymbols(sys::Path(Filename));
John Criswell71478b72003-09-19 20:24:23 +0000183
184 // While we are linking in object files, loop.
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000185 while (true) {
186 std::set<ModuleProvider*> Modules;
187 // Find the modules we need to link
188 arch->findModulesDefiningSymbols(UndefinedSymbols,Modules);
John Criswell71478b72003-09-19 20:24:23 +0000189
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000190 // If we didn't find any more modules to link this time, we are done.
191 if (Modules.empty())
192 break;
John Criswell71478b72003-09-19 20:24:23 +0000193
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000194 // Loop over all the ModuleProviders that we got back from the archive
195 for (std::set<ModuleProvider*>::iterator I=Modules.begin(), E=Modules.end();
196 I != E; ++I) {
197 // Get the module we must link in.
Chris Lattnera4d0c6f2004-11-16 06:40:54 +0000198 std::auto_ptr<Module> aModule((*I)->releaseModule());
John Criswell1715ce02003-12-23 17:37:06 +0000199
Chris Lattnera4d0c6f2004-11-16 06:40:54 +0000200 // Link it in.
201 if (LinkModules(M, aModule.get(), ErrorMessage)) {
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000202 // don't create a memory leak
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000203 delete arch;
204 return true; // Couldn't link in the right object file...
John Criswell1715ce02003-12-23 17:37:06 +0000205 }
John Criswell71478b72003-09-19 20:24:23 +0000206 }
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000207
208 // We have linked in a set of modules determined by the archive to satisfy
209 // our missing symbols. Linking in the new modules will have satisfied some
210 // symbols but may introduce additional missing symbols. We need to update
211 // the list of undefined symbols and try again until the archive doesn't
212 // have any modules that satisfy our symbols.
213 GetAllUndefinedSymbols(M, UndefinedSymbols);
John Criswell71478b72003-09-19 20:24:23 +0000214 }
215
216 return false;
217}
218
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000219/// LinkInFile - opens a bytecode file and links in all objects which
Misha Brukman5208ba12003-09-30 18:09:32 +0000220/// provide symbols that are currently undefined.
221///
222/// Inputs:
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000223/// HeadModule - The module in which to link the bytecode file.
224/// Filename - The pathname of the bytecode file.
Misha Brukman5208ba12003-09-30 18:09:32 +0000225/// Verbose - Flags whether verbose messages should be printed.
226///
227/// Outputs:
228/// ErrorMessage - A C++ string detailing what error occurred, if any.
229///
230/// Return Value:
231/// TRUE - An error occurred.
232/// FALSE - No errors.
233///
Misha Brukmane6763132003-09-29 22:26:24 +0000234static bool LinkInFile(Module *HeadModule,
235 const std::string &Filename,
236 std::string &ErrorMessage,
237 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000238{
239 std::auto_ptr<Module> M(LoadObject(Filename, ErrorMessage));
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000240 if (M.get() == 0) return true;
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000241 bool Result = LinkModules(HeadModule, M.get(), &ErrorMessage);
242 if (Verbose) std::cerr << "Linked in bytecode file '" << Filename << "'\n";
243 return Result;
John Criswell71478b72003-09-19 20:24:23 +0000244}
245
Misha Brukman5208ba12003-09-30 18:09:32 +0000246/// LinkFiles - takes a module and a list of files and links them all together.
247/// It locates the file either in the current directory, as its absolute
248/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
249///
250/// Inputs:
251/// progname - The name of the program (infamous argv[0]).
252/// HeadModule - The module under which all files will be linked.
253/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
254/// to be linked. The names can refer to a mixture of pure LLVM
255/// bytecode files and archive (ar) formatted files.
256/// Verbose - Flags whether verbose output should be printed while linking.
257///
258/// Outputs:
259/// HeadModule - The module will have the specified LLVM bytecode files linked
260/// in.
261///
262/// Return value:
263/// FALSE - No errors.
264/// TRUE - Some error occurred.
265///
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000266bool llvm::LinkFiles(const char *progname, Module *HeadModule,
267 const std::vector<std::string> &Files, bool Verbose) {
John Criswell71478b72003-09-19 20:24:23 +0000268 // String in which to receive error messages.
269 std::string ErrorMessage;
270
271 // Full pathname of the file
272 std::string Pathname;
273
274 // Get the library search path from the environment
275 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
276
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000277 for (unsigned i = 0; i < Files.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000278 // Determine where this file lives.
Brian Gaekeee8adb12003-11-11 18:27:37 +0000279 if (FileOpenable(Files[i])) {
John Criswell71478b72003-09-19 20:24:23 +0000280 Pathname = Files[i];
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000281 } else {
282 if (SearchPath == NULL) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000283 std::cerr << progname << ": Cannot find linker input file '"
284 << Files[i] << "'\n";
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000285 std::cerr << progname
286 << ": Warning: Your LLVM_LIB_SEARCH_PATH is unset.\n";
John Criswell71478b72003-09-19 20:24:23 +0000287 return true;
288 }
289
290 Pathname = std::string(SearchPath)+"/"+Files[i];
Brian Gaekeee8adb12003-11-11 18:27:37 +0000291 if (!FileOpenable(Pathname)) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000292 std::cerr << progname << ": Cannot find linker input file '"
293 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000294 return true;
295 }
296 }
297
John Criswell71478b72003-09-19 20:24:23 +0000298 // A user may specify an ar archive without -l, perhaps because it
299 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000300 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000301 if (Verbose)
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000302 std::cerr << "Trying to link archive '" << Pathname << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000303
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000304 if (LinkInArchive(HeadModule, Pathname, &ErrorMessage, Verbose)) {
Chris Lattner0ebee742004-06-02 00:22:24 +0000305 std::cerr << progname << ": Error linking in archive '" << Pathname
306 << "': " << ErrorMessage << "\n";
John Criswell71478b72003-09-19 20:24:23 +0000307 return true;
308 }
Brian Gaekeee8adb12003-11-11 18:27:37 +0000309 } else if (IsBytecode(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000310 if (Verbose)
Brian Gaeke3b3640a2003-11-05 22:12:52 +0000311 std::cerr << "Trying to link bytecode file '" << Pathname << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000312
Misha Brukmane6763132003-09-29 22:26:24 +0000313 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
Chris Lattner0ebee742004-06-02 00:22:24 +0000314 std::cerr << progname << ": Error linking in bytecode file '"
315 << Pathname << "': " << ErrorMessage << "\n";
John Criswell71478b72003-09-19 20:24:23 +0000316 return true;
317 }
Misha Brukmaneda20f92004-11-08 22:03:10 +0000318 } else {
Misha Brukman669b5242004-11-09 04:24:59 +0000319 std::cerr << progname << ": Warning: invalid file `" << Pathname
320 << "' ignored.\n";
John Criswell71478b72003-09-19 20:24:23 +0000321 }
322 }
323
324 return false;
325}
326
Misha Brukman5208ba12003-09-30 18:09:32 +0000327/// LinkLibraries - takes the specified library files and links them into the
328/// main bytecode object file.
329///
330/// Inputs:
331/// progname - The name of the program (infamous argv[0]).
332/// HeadModule - The module into which all necessary libraries will be linked.
333/// Libraries - The list of libraries to link into the module.
334/// LibPaths - The list of library paths in which to find libraries.
335/// Verbose - Flags whether verbose messages should be printed.
336/// Native - Flags whether native code is being generated.
337///
338/// Outputs:
339/// HeadModule - The module will have all necessary libraries linked in.
340///
341/// Return value:
342/// FALSE - No error.
343/// TRUE - Error.
344///
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000345void llvm::LinkLibraries(const char *progname, Module *HeadModule,
346 const std::vector<std::string> &Libraries,
347 const std::vector<std::string> &LibPaths,
348 bool Verbose, bool Native) {
John Criswell71478b72003-09-19 20:24:23 +0000349 // String in which to receive error messages.
350 std::string ErrorMessage;
351
Brian Gaekef1fce082003-10-21 21:07:12 +0000352 for (unsigned i = 0; i < Libraries.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000353 // Determine where this library lives.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000354 std::string Pathname = FindLib(Libraries[i], LibPaths);
355 if (Pathname.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000356 // If the pathname does not exist, then continue to the next one if
357 // we're doing a native link and give an error if we're doing a bytecode
358 // link.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000359 if (!Native) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000360 std::cerr << progname << ": WARNING: Cannot find library -l"
361 << Libraries[i] << "\n";
362 continue;
John Criswell71478b72003-09-19 20:24:23 +0000363 }
364 }
365
John Criswell71478b72003-09-19 20:24:23 +0000366 // A user may specify an ar archive without -l, perhaps because it
367 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000368 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000369 if (Verbose)
Brian Gaeke2282ae12003-11-16 23:07:13 +0000370 std::cerr << "Trying to link archive '" << Pathname << "' (-l"
371 << Libraries[i] << ")\n";
John Criswell71478b72003-09-19 20:24:23 +0000372
Reid Spencer8bbb17a2004-11-14 22:02:27 +0000373 if (LinkInArchive(HeadModule, Pathname, &ErrorMessage, Verbose)) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000374 std::cerr << progname << ": " << ErrorMessage
375 << ": Error linking in archive '" << Pathname << "' (-l"
376 << Libraries[i] << ")\n";
377 exit(1);
John Criswell71478b72003-09-19 20:24:23 +0000378 }
Brian Gaekeee8adb12003-11-11 18:27:37 +0000379 } else if (IsBytecode(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000380 if (Verbose)
Brian Gaeke2282ae12003-11-16 23:07:13 +0000381 std::cerr << "Trying to link bytecode file '" << Pathname
382 << "' (-l" << Libraries[i] << ")\n";
John Criswell71478b72003-09-19 20:24:23 +0000383
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000384 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
Chris Lattner6cc8ca92003-11-28 07:44:09 +0000385 std::cerr << progname << ": " << ErrorMessage
386 << ": error linking in bytecode file '" << Pathname << "' (-l"
387 << Libraries[i] << ")\n";
388 exit(1);
John Criswell71478b72003-09-19 20:24:23 +0000389 }
390 }
391 }
John Criswell71478b72003-09-19 20:24:23 +0000392}