blob: d9c029aec9d8d9f5547997361506528c91f660cc [file] [log] [blame]
Chris Lattnera58d2be2003-09-30 03:24:28 +00001//===- Linker.cpp - Link together 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
Misha Brukman17dc4ce2003-09-29 22:16:43 +000015#include "gccld.h"
John Criswell71478b72003-09-19 20:24:23 +000016#include "llvm/Module.h"
17#include "llvm/PassManager.h"
18#include "llvm/Bytecode/Reader.h"
19#include "llvm/Bytecode/WriteBytecodePass.h"
20#include "llvm/Target/TargetData.h"
21#include "llvm/Transforms/IPO.h"
22#include "llvm/Transforms/Scalar.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000023#include "llvm/Transforms/Utils/Linker.h"
John Criswell71478b72003-09-19 20:24:23 +000024#include "Support/CommandLine.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000025#include "Support/FileUtilities.h"
John Criswell71478b72003-09-19 20:24:23 +000026#include "Support/Signals.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000027#include "Support/SystemUtils.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000028#include <algorithm>
John Criswell71478b72003-09-19 20:24:23 +000029#include <fstream>
30#include <memory>
31#include <set>
John Criswell71478b72003-09-19 20:24:23 +000032
Misha Brukman5208ba12003-09-30 18:09:32 +000033/// FileExists - determines if the specified filename exists and is readable.
34///
35/// Inputs:
36/// FN - The name of the file.
37///
38/// Outputs:
39/// None.
40///
41/// Return Value:
42/// TRUE - The file exists and is readable.
43/// FALSE - The file does not exist or is unreadable.
44///
Misha Brukman17dc4ce2003-09-29 22:16:43 +000045static inline bool FileExists(const std::string &FN) {
John Criswell71478b72003-09-19 20:24:23 +000046 return access(FN.c_str(), R_OK | F_OK) != -1;
47}
48
Misha Brukman5208ba12003-09-30 18:09:32 +000049/// IsArchive - determines if the specified file is an ar archive
50/// by checking the magic string at the beginning of the file.
51///
52/// Inputs:
53/// filename - A C++ string containing the name of the file.
54///
55/// Outputs:
56/// None.
57///
58/// Return value:
59/// TRUE - The file is an archive.
60/// FALSE - The file is not an archive.
61///
Misha Brukman61087cc2003-09-30 17:51:20 +000062static inline bool IsArchive(const std::string &filename) {
John Criswell71478b72003-09-19 20:24:23 +000063 std::string ArchiveMagic("!<arch>\012");
64 char buf[1 + ArchiveMagic.size()];
John Criswell71478b72003-09-19 20:24:23 +000065 std::ifstream f(filename.c_str());
66 f.read(buf, ArchiveMagic.size());
67 buf[ArchiveMagic.size()] = '\0';
68 return ArchiveMagic == buf;
69}
70
Misha Brukman5208ba12003-09-30 18:09:32 +000071/// FindLib - locates a particular library. It will prepend and append
72/// various directories, prefixes, and suffixes until it can find the library.
73///
74/// Inputs:
75/// Filename - Name of the file to find.
76/// Paths - List of directories to search.
77///
78/// Outputs:
79/// None.
80///
81/// Return value:
82/// The name of the file is returned.
83/// If the file is not found, an empty string is returned.
84///
John Criswell71478b72003-09-19 20:24:23 +000085static std::string
Misha Brukman61087cc2003-09-30 17:51:20 +000086FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
John Criswell71478b72003-09-19 20:24:23 +000087 // Determine if the pathname can be found as it stands.
Misha Brukmane6763132003-09-29 22:26:24 +000088 if (FileExists(Filename))
John Criswell71478b72003-09-19 20:24:23 +000089 return Filename;
John Criswell71478b72003-09-19 20:24:23 +000090
John Criswell71478b72003-09-19 20:24:23 +000091 // If that doesn't work, convert the name into a library name.
John Criswell71478b72003-09-19 20:24:23 +000092 std::string LibName = "lib" + Filename;
93
John Criswell71478b72003-09-19 20:24:23 +000094 // Iterate over the directories in Paths to see if we can find the library
95 // there.
Misha Brukman17dc4ce2003-09-29 22:16:43 +000096 for (unsigned Index = 0; Index != Paths.size(); ++Index) {
John Criswell71478b72003-09-19 20:24:23 +000097 std::string Directory = Paths[Index] + "/";
98
Misha Brukmane6763132003-09-29 22:26:24 +000099 if (FileExists(Directory + LibName + ".bc"))
John Criswell71478b72003-09-19 20:24:23 +0000100 return Directory + LibName + ".bc";
John Criswell71478b72003-09-19 20:24:23 +0000101
Misha Brukmane6763132003-09-29 22:26:24 +0000102 if (FileExists(Directory + LibName + ".so"))
John Criswell71478b72003-09-19 20:24:23 +0000103 return Directory + LibName + ".so";
John Criswell71478b72003-09-19 20:24:23 +0000104
Misha Brukmane6763132003-09-29 22:26:24 +0000105 if (FileExists(Directory + LibName + ".a"))
John Criswell71478b72003-09-19 20:24:23 +0000106 return Directory + LibName + ".a";
John Criswell71478b72003-09-19 20:24:23 +0000107 }
108
John Criswell71478b72003-09-19 20:24:23 +0000109 // One last hope: Check LLVM_LIB_SEARCH_PATH.
John Criswell71478b72003-09-19 20:24:23 +0000110 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
111 if (SearchPath == NULL)
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000112 return std::string();
John Criswell71478b72003-09-19 20:24:23 +0000113
114 LibName = std::string(SearchPath) + "/" + LibName;
Misha Brukmane6763132003-09-29 22:26:24 +0000115 if (FileExists(LibName))
John Criswell71478b72003-09-19 20:24:23 +0000116 return LibName;
John Criswell71478b72003-09-19 20:24:23 +0000117
118 return std::string();
119}
120
Misha Brukman5208ba12003-09-30 18:09:32 +0000121/// GetAllDefinedSymbols - finds all of the defined symbols in the specified
122/// module.
123///
124/// Inputs:
125/// M - The module in which to find defined symbols.
126///
127/// Outputs:
128/// DefinedSymbols - A set of C++ strings that will contain the name of all
129/// defined symbols.
130///
131/// Return value:
132/// None.
133///
Misha Brukman61087cc2003-09-30 17:51:20 +0000134void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000135 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
136 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
137 DefinedSymbols.insert(I->getName());
138 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
139 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
140 DefinedSymbols.insert(I->getName());
141}
142
Misha Brukman5208ba12003-09-30 18:09:32 +0000143/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
144/// exist in an LLVM module. This is a bit tricky because there may be two
145/// symbols with the same name but different LLVM types that will be resolved to
146/// each other but aren't currently (thus we need to treat it as resolved).
147///
148/// Inputs:
149/// M - The module in which to find undefined symbols.
150///
151/// Outputs:
152/// UndefinedSymbols - A set of C++ strings containing the name of all
153/// undefined symbols.
154///
155/// Return value:
156/// None.
157///
John Criswell71478b72003-09-19 20:24:23 +0000158void
Misha Brukman61087cc2003-09-30 17:51:20 +0000159GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000160 std::set<std::string> DefinedSymbols;
161 UndefinedSymbols.clear(); // Start out empty
162
163 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
164 if (I->hasName()) {
165 if (I->isExternal())
166 UndefinedSymbols.insert(I->getName());
167 else if (!I->hasInternalLinkage())
168 DefinedSymbols.insert(I->getName());
169 }
170 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
171 if (I->hasName()) {
172 if (I->isExternal())
173 UndefinedSymbols.insert(I->getName());
174 else if (!I->hasInternalLinkage())
175 DefinedSymbols.insert(I->getName());
176 }
177
178 // Prune out any defined symbols from the undefined symbols set...
179 for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
180 I != UndefinedSymbols.end(); )
181 if (DefinedSymbols.count(*I))
182 UndefinedSymbols.erase(I++); // This symbol really is defined!
183 else
184 ++I; // Keep this symbol in the undefined symbols list
185}
186
187
Misha Brukman5208ba12003-09-30 18:09:32 +0000188/// LoadObject - reads the specified bytecode object file.
189///
190/// Inputs:
191/// FN - The name of the file to load.
192///
193/// Outputs:
194/// OutErrorMessage - The error message to give back to the caller.
195///
196/// Return Value:
197/// A pointer to a module represening the bytecode file is returned.
198/// If an error occurs, the pointer is 0.
199///
John Criswell71478b72003-09-19 20:24:23 +0000200std::auto_ptr<Module>
Misha Brukmane6763132003-09-29 22:26:24 +0000201LoadObject(const std::string & FN, std::string &OutErrorMessage) {
John Criswell71478b72003-09-19 20:24:23 +0000202 std::string ErrorMessage;
203 Module *Result = ParseBytecodeFile(FN, &ErrorMessage);
204 if (Result) return std::auto_ptr<Module>(Result);
John Criswell71478b72003-09-19 20:24:23 +0000205 OutErrorMessage = "Bytecode file '" + FN + "' corrupt!";
206 if (ErrorMessage.size()) OutErrorMessage += ": " + ErrorMessage;
207 return std::auto_ptr<Module>();
208}
209
Misha Brukman5208ba12003-09-30 18:09:32 +0000210/// LinkInArchive - opens an archive library and link in all objects which
211/// provide symbols that are currently undefined.
212///
213/// Inputs:
214/// M - The module in which to link the archives.
215/// Filename - The pathname of the archive.
216/// Verbose - Flags whether verbose messages should be printed.
217///
218/// Outputs:
219/// ErrorMessage - A C++ string detailing what error occurred, if any.
220///
221/// Return Value:
222/// TRUE - An error occurred.
223/// FALSE - No errors.
224///
Misha Brukmane6763132003-09-29 22:26:24 +0000225static bool LinkInArchive(Module *M,
226 const std::string &Filename,
227 std::string &ErrorMessage,
228 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000229{
John Criswell71478b72003-09-19 20:24:23 +0000230 // Find all of the symbols currently undefined in the bytecode program.
231 // If all the symbols are defined, the program is complete, and there is
232 // no reason to link in any archive files.
John Criswell71478b72003-09-19 20:24:23 +0000233 std::set<std::string> UndefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000234 GetAllUndefinedSymbols(M, UndefinedSymbols);
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000235 if (UndefinedSymbols.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000236 if (Verbose) std::cerr << " No symbols undefined, don't link library!\n";
237 return false; // No need to link anything in!
238 }
239
John Criswell71478b72003-09-19 20:24:23 +0000240 // Load in the archive objects.
John Criswell71478b72003-09-19 20:24:23 +0000241 if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
242 std::vector<Module*> Objects;
Misha Brukmane6763132003-09-29 22:26:24 +0000243 if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
John Criswell71478b72003-09-19 20:24:23 +0000244 return true;
John Criswell71478b72003-09-19 20:24:23 +0000245
John Criswell71478b72003-09-19 20:24:23 +0000246 // Figure out which symbols are defined by all of the modules in the archive.
John Criswell71478b72003-09-19 20:24:23 +0000247 std::vector<std::set<std::string> > DefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000248 DefinedSymbols.resize(Objects.size());
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000249 for (unsigned i = 0; i != Objects.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000250 GetAllDefinedSymbols(Objects[i], DefinedSymbols[i]);
251 }
252
253 // While we are linking in object files, loop.
254 bool Linked = true;
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000255 while (Linked) {
John Criswell71478b72003-09-19 20:24:23 +0000256 Linked = false;
257
258 for (unsigned i = 0; i != Objects.size(); ++i) {
259 // Consider whether we need to link in this module... we only need to
260 // link it in if it defines some symbol which is so far undefined.
261 //
262 const std::set<std::string> &DefSymbols = DefinedSymbols[i];
263
264 bool ObjectRequired = false;
265 for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
266 E = UndefinedSymbols.end(); I != E; ++I)
267 if (DefSymbols.count(*I)) {
268 if (Verbose)
269 std::cerr << " Found object providing symbol '" << *I << "'...\n";
270 ObjectRequired = true;
271 break;
272 }
273
274 // We DO need to link this object into the program...
275 if (ObjectRequired) {
276 if (LinkModules(M, Objects[i], &ErrorMessage))
277 return true; // Couldn't link in the right object file...
278
279 // Since we have linked in this object, delete it from the list of
280 // objects to consider in this archive file.
281 std::swap(Objects[i], Objects.back());
282 std::swap(DefinedSymbols[i], DefinedSymbols.back());
283 Objects.pop_back();
284 DefinedSymbols.pop_back();
285 --i; // Do not skip an entry
286
287 // The undefined symbols set should have shrunk.
288 GetAllUndefinedSymbols(M, UndefinedSymbols);
289 Linked = true; // We have linked something in!
290 }
291 }
292 }
293
294 return false;
295}
296
Misha Brukman5208ba12003-09-30 18:09:32 +0000297/// LinkInFile - opens an archive library and link in all objects which
298/// provide symbols that are currently undefined.
299///
300/// Inputs:
301/// HeadModule - The module in which to link the archives.
302/// Filename - The pathname of the archive.
303/// Verbose - Flags whether verbose messages should be printed.
304///
305/// Outputs:
306/// ErrorMessage - A C++ string detailing what error occurred, if any.
307///
308/// Return Value:
309/// TRUE - An error occurred.
310/// FALSE - No errors.
311///
Misha Brukmane6763132003-09-29 22:26:24 +0000312static bool LinkInFile(Module *HeadModule,
313 const std::string &Filename,
314 std::string &ErrorMessage,
315 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000316{
317 std::auto_ptr<Module> M(LoadObject(Filename, ErrorMessage));
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000318 if (M.get() == 0) return true;
John Criswell71478b72003-09-19 20:24:23 +0000319 if (Verbose) std::cerr << "Linking in '" << Filename << "'\n";
Misha Brukmane6763132003-09-29 22:26:24 +0000320 return LinkModules(HeadModule, M.get(), &ErrorMessage);
John Criswell71478b72003-09-19 20:24:23 +0000321}
322
Misha Brukman5208ba12003-09-30 18:09:32 +0000323/// LinkFiles - takes a module and a list of files and links them all together.
324/// It locates the file either in the current directory, as its absolute
325/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
326///
327/// Inputs:
328/// progname - The name of the program (infamous argv[0]).
329/// HeadModule - The module under which all files will be linked.
330/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
331/// to be linked. The names can refer to a mixture of pure LLVM
332/// bytecode files and archive (ar) formatted files.
333/// Verbose - Flags whether verbose output should be printed while linking.
334///
335/// Outputs:
336/// HeadModule - The module will have the specified LLVM bytecode files linked
337/// in.
338///
339/// Return value:
340/// FALSE - No errors.
341/// TRUE - Some error occurred.
342///
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000343bool LinkFiles(const char *progname,
344 Module *HeadModule,
345 const std::vector<std::string> &Files,
346 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000347{
348 // String in which to receive error messages.
349 std::string ErrorMessage;
350
351 // Full pathname of the file
352 std::string Pathname;
353
354 // Get the library search path from the environment
355 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
356
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000357 for (unsigned i = 1; i < Files.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000358 // Determine where this file lives.
Misha Brukmane6763132003-09-29 22:26:24 +0000359 if (FileExists(Files[i])) {
John Criswell71478b72003-09-19 20:24:23 +0000360 Pathname = Files[i];
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000361 } else {
362 if (SearchPath == NULL) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000363 std::cerr << progname << ": Cannot find linker input file '"
364 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000365 return true;
366 }
367
368 Pathname = std::string(SearchPath)+"/"+Files[i];
Misha Brukmane6763132003-09-29 22:26:24 +0000369 if (!FileExists(Pathname)) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000370 std::cerr << progname << ": Cannot find linker input file '"
371 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000372 return true;
373 }
374 }
375
John Criswell71478b72003-09-19 20:24:23 +0000376 // A user may specify an ar archive without -l, perhaps because it
377 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000378 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000379 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000380 std::cerr << "Linking archive '" << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000381
Misha Brukmane6763132003-09-29 22:26:24 +0000382 if (LinkInArchive(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000383 PrintAndReturn(progname, ErrorMessage,
Misha Brukmane6763132003-09-29 22:26:24 +0000384 ": Error linking in '" + Files[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000385 return true;
386 }
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000387 } else {
John Criswell71478b72003-09-19 20:24:23 +0000388 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000389 std::cerr << "Linking file '" << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000390
Misha Brukmane6763132003-09-29 22:26:24 +0000391 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000392 PrintAndReturn(progname, ErrorMessage,
Brian Gaeke608e75c2003-10-08 19:09:30 +0000393 ": Error linking in '" + Files[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000394 return true;
395 }
396 }
397 }
398
399 return false;
400}
401
Misha Brukman5208ba12003-09-30 18:09:32 +0000402/// LinkLibraries - takes the specified library files and links them into the
403/// main bytecode object file.
404///
405/// Inputs:
406/// progname - The name of the program (infamous argv[0]).
407/// HeadModule - The module into which all necessary libraries will be linked.
408/// Libraries - The list of libraries to link into the module.
409/// LibPaths - The list of library paths in which to find libraries.
410/// Verbose - Flags whether verbose messages should be printed.
411/// Native - Flags whether native code is being generated.
412///
413/// Outputs:
414/// HeadModule - The module will have all necessary libraries linked in.
415///
416/// Return value:
417/// FALSE - No error.
418/// TRUE - Error.
419///
Misha Brukmane6763132003-09-29 22:26:24 +0000420bool LinkLibraries(const char *progname,
421 Module *HeadModule,
422 const std::vector<std::string> &Libraries,
423 const std::vector<std::string> &LibPaths,
424 bool Verbose,
425 bool Native)
John Criswell71478b72003-09-19 20:24:23 +0000426{
427 // String in which to receive error messages.
428 std::string ErrorMessage;
429
Brian Gaekef1fce082003-10-21 21:07:12 +0000430 for (unsigned i = 0; i < Libraries.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000431 // Determine where this library lives.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000432 std::string Pathname = FindLib(Libraries[i], LibPaths);
433 if (Pathname.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000434 // If the pathname does not exist, then continue to the next one if
435 // we're doing a native link and give an error if we're doing a bytecode
436 // link.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000437 if (!Native) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000438 PrintAndReturn(progname, "Cannot find " + Libraries[i] + "\n");
John Criswell71478b72003-09-19 20:24:23 +0000439 return true;
440 }
441 }
442
John Criswell71478b72003-09-19 20:24:23 +0000443 // A user may specify an ar archive without -l, perhaps because it
444 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000445 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000446 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000447 std::cerr << "Linking archive '" << Libraries[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000448
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000449 if (LinkInArchive(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000450 PrintAndReturn(progname, ErrorMessage,
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000451 ": Error linking in '" + Libraries[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000452 return true;
453 }
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000454 } else {
John Criswell71478b72003-09-19 20:24:23 +0000455 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000456 std::cerr << "Linking file '" << Libraries[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000457
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000458 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000459 PrintAndReturn(progname, ErrorMessage,
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000460 ": error linking in '" + Libraries[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000461 return true;
462 }
463 }
464 }
465
466 return false;
467}