blob: cfae2b9cbeb201bce5f5b007c0581fb652d5dd1f [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//===----------------------------------------------------------------------===//
9//
John Criswell71478b72003-09-19 20:24:23 +000010//
Chris Lattnera58d2be2003-09-30 03:24:28 +000011// This file contains routines to handle linking together LLVM bytecode files,
12// and to handle annoying things like static libraries.
John Criswell71478b72003-09-19 20:24:23 +000013//
14//===----------------------------------------------------------------------===//
15
Misha Brukman17dc4ce2003-09-29 22:16:43 +000016#include "gccld.h"
John Criswell71478b72003-09-19 20:24:23 +000017#include "llvm/Module.h"
18#include "llvm/PassManager.h"
19#include "llvm/Bytecode/Reader.h"
20#include "llvm/Bytecode/WriteBytecodePass.h"
21#include "llvm/Target/TargetData.h"
22#include "llvm/Transforms/IPO.h"
23#include "llvm/Transforms/Scalar.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000024#include "llvm/Transforms/Utils/Linker.h"
John Criswell71478b72003-09-19 20:24:23 +000025#include "Support/CommandLine.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000026#include "Support/FileUtilities.h"
John Criswell71478b72003-09-19 20:24:23 +000027#include "Support/Signals.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000028#include "Support/SystemUtils.h"
Misha Brukman17dc4ce2003-09-29 22:16:43 +000029#include <algorithm>
John Criswell71478b72003-09-19 20:24:23 +000030#include <fstream>
31#include <memory>
32#include <set>
John Criswell71478b72003-09-19 20:24:23 +000033
Misha Brukman5208ba12003-09-30 18:09:32 +000034/// FileExists - determines if the specified filename exists and is readable.
35///
36/// Inputs:
37/// FN - The name of the file.
38///
39/// Outputs:
40/// None.
41///
42/// Return Value:
43/// TRUE - The file exists and is readable.
44/// FALSE - The file does not exist or is unreadable.
45///
Misha Brukman17dc4ce2003-09-29 22:16:43 +000046static inline bool FileExists(const std::string &FN) {
John Criswell71478b72003-09-19 20:24:23 +000047 return access(FN.c_str(), R_OK | F_OK) != -1;
48}
49
Misha Brukman5208ba12003-09-30 18:09:32 +000050/// IsArchive - determines if the specified file is an ar archive
51/// by checking the magic string at the beginning of the file.
52///
53/// Inputs:
54/// filename - A C++ string containing the name of the file.
55///
56/// Outputs:
57/// None.
58///
59/// Return value:
60/// TRUE - The file is an archive.
61/// FALSE - The file is not an archive.
62///
Misha Brukman61087cc2003-09-30 17:51:20 +000063static inline bool IsArchive(const std::string &filename) {
John Criswell71478b72003-09-19 20:24:23 +000064 std::string ArchiveMagic("!<arch>\012");
65 char buf[1 + ArchiveMagic.size()];
John Criswell71478b72003-09-19 20:24:23 +000066 std::ifstream f(filename.c_str());
67 f.read(buf, ArchiveMagic.size());
68 buf[ArchiveMagic.size()] = '\0';
69 return ArchiveMagic == buf;
70}
71
Misha Brukman5208ba12003-09-30 18:09:32 +000072/// FindLib - locates a particular library. It will prepend and append
73/// various directories, prefixes, and suffixes until it can find the library.
74///
75/// Inputs:
76/// Filename - Name of the file to find.
77/// Paths - List of directories to search.
78///
79/// Outputs:
80/// None.
81///
82/// Return value:
83/// The name of the file is returned.
84/// If the file is not found, an empty string is returned.
85///
John Criswell71478b72003-09-19 20:24:23 +000086static std::string
Misha Brukman61087cc2003-09-30 17:51:20 +000087FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
John Criswell71478b72003-09-19 20:24:23 +000088 // Determine if the pathname can be found as it stands.
Misha Brukmane6763132003-09-29 22:26:24 +000089 if (FileExists(Filename))
John Criswell71478b72003-09-19 20:24:23 +000090 return Filename;
John Criswell71478b72003-09-19 20:24:23 +000091
John Criswell71478b72003-09-19 20:24:23 +000092 // If that doesn't work, convert the name into a library name.
John Criswell71478b72003-09-19 20:24:23 +000093 std::string LibName = "lib" + Filename;
94
John Criswell71478b72003-09-19 20:24:23 +000095 // Iterate over the directories in Paths to see if we can find the library
96 // there.
Misha Brukman17dc4ce2003-09-29 22:16:43 +000097 for (unsigned Index = 0; Index != Paths.size(); ++Index) {
John Criswell71478b72003-09-19 20:24:23 +000098 std::string Directory = Paths[Index] + "/";
99
Misha Brukmane6763132003-09-29 22:26:24 +0000100 if (FileExists(Directory + LibName + ".bc"))
John Criswell71478b72003-09-19 20:24:23 +0000101 return Directory + LibName + ".bc";
John Criswell71478b72003-09-19 20:24:23 +0000102
Misha Brukmane6763132003-09-29 22:26:24 +0000103 if (FileExists(Directory + LibName + ".so"))
John Criswell71478b72003-09-19 20:24:23 +0000104 return Directory + LibName + ".so";
John Criswell71478b72003-09-19 20:24:23 +0000105
Misha Brukmane6763132003-09-29 22:26:24 +0000106 if (FileExists(Directory + LibName + ".a"))
John Criswell71478b72003-09-19 20:24:23 +0000107 return Directory + LibName + ".a";
John Criswell71478b72003-09-19 20:24:23 +0000108 }
109
John Criswell71478b72003-09-19 20:24:23 +0000110 // One last hope: Check LLVM_LIB_SEARCH_PATH.
John Criswell71478b72003-09-19 20:24:23 +0000111 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
112 if (SearchPath == NULL)
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000113 return std::string();
John Criswell71478b72003-09-19 20:24:23 +0000114
115 LibName = std::string(SearchPath) + "/" + LibName;
Misha Brukmane6763132003-09-29 22:26:24 +0000116 if (FileExists(LibName))
John Criswell71478b72003-09-19 20:24:23 +0000117 return LibName;
John Criswell71478b72003-09-19 20:24:23 +0000118
119 return std::string();
120}
121
Misha Brukman5208ba12003-09-30 18:09:32 +0000122/// GetAllDefinedSymbols - finds all of the defined symbols in the specified
123/// module.
124///
125/// Inputs:
126/// M - The module in which to find defined symbols.
127///
128/// Outputs:
129/// DefinedSymbols - A set of C++ strings that will contain the name of all
130/// defined symbols.
131///
132/// Return value:
133/// None.
134///
Misha Brukman61087cc2003-09-30 17:51:20 +0000135void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000136 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
137 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
138 DefinedSymbols.insert(I->getName());
139 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
140 if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
141 DefinedSymbols.insert(I->getName());
142}
143
Misha Brukman5208ba12003-09-30 18:09:32 +0000144/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
145/// exist in an LLVM module. This is a bit tricky because there may be two
146/// symbols with the same name but different LLVM types that will be resolved to
147/// each other but aren't currently (thus we need to treat it as resolved).
148///
149/// Inputs:
150/// M - The module in which to find undefined symbols.
151///
152/// Outputs:
153/// UndefinedSymbols - A set of C++ strings containing the name of all
154/// undefined symbols.
155///
156/// Return value:
157/// None.
158///
John Criswell71478b72003-09-19 20:24:23 +0000159void
Misha Brukman61087cc2003-09-30 17:51:20 +0000160GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
John Criswell71478b72003-09-19 20:24:23 +0000161 std::set<std::string> DefinedSymbols;
162 UndefinedSymbols.clear(); // Start out empty
163
164 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
165 if (I->hasName()) {
166 if (I->isExternal())
167 UndefinedSymbols.insert(I->getName());
168 else if (!I->hasInternalLinkage())
169 DefinedSymbols.insert(I->getName());
170 }
171 for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
172 if (I->hasName()) {
173 if (I->isExternal())
174 UndefinedSymbols.insert(I->getName());
175 else if (!I->hasInternalLinkage())
176 DefinedSymbols.insert(I->getName());
177 }
178
179 // Prune out any defined symbols from the undefined symbols set...
180 for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
181 I != UndefinedSymbols.end(); )
182 if (DefinedSymbols.count(*I))
183 UndefinedSymbols.erase(I++); // This symbol really is defined!
184 else
185 ++I; // Keep this symbol in the undefined symbols list
186}
187
188
Misha Brukman5208ba12003-09-30 18:09:32 +0000189/// LoadObject - reads the specified bytecode object file.
190///
191/// Inputs:
192/// FN - The name of the file to load.
193///
194/// Outputs:
195/// OutErrorMessage - The error message to give back to the caller.
196///
197/// Return Value:
198/// A pointer to a module represening the bytecode file is returned.
199/// If an error occurs, the pointer is 0.
200///
John Criswell71478b72003-09-19 20:24:23 +0000201std::auto_ptr<Module>
Misha Brukmane6763132003-09-29 22:26:24 +0000202LoadObject(const std::string & FN, std::string &OutErrorMessage) {
John Criswell71478b72003-09-19 20:24:23 +0000203 std::string ErrorMessage;
204 Module *Result = ParseBytecodeFile(FN, &ErrorMessage);
205 if (Result) return std::auto_ptr<Module>(Result);
John Criswell71478b72003-09-19 20:24:23 +0000206 OutErrorMessage = "Bytecode file '" + FN + "' corrupt!";
207 if (ErrorMessage.size()) OutErrorMessage += ": " + ErrorMessage;
208 return std::auto_ptr<Module>();
209}
210
Misha Brukman5208ba12003-09-30 18:09:32 +0000211/// LinkInArchive - opens an archive library and link in all objects which
212/// provide symbols that are currently undefined.
213///
214/// Inputs:
215/// M - The module in which to link the archives.
216/// Filename - The pathname of the archive.
217/// Verbose - Flags whether verbose messages should be printed.
218///
219/// Outputs:
220/// ErrorMessage - A C++ string detailing what error occurred, if any.
221///
222/// Return Value:
223/// TRUE - An error occurred.
224/// FALSE - No errors.
225///
Misha Brukmane6763132003-09-29 22:26:24 +0000226static bool LinkInArchive(Module *M,
227 const std::string &Filename,
228 std::string &ErrorMessage,
229 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000230{
John Criswell71478b72003-09-19 20:24:23 +0000231 // Find all of the symbols currently undefined in the bytecode program.
232 // If all the symbols are defined, the program is complete, and there is
233 // no reason to link in any archive files.
John Criswell71478b72003-09-19 20:24:23 +0000234 std::set<std::string> UndefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000235 GetAllUndefinedSymbols(M, UndefinedSymbols);
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000236 if (UndefinedSymbols.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000237 if (Verbose) std::cerr << " No symbols undefined, don't link library!\n";
238 return false; // No need to link anything in!
239 }
240
John Criswell71478b72003-09-19 20:24:23 +0000241 // Load in the archive objects.
John Criswell71478b72003-09-19 20:24:23 +0000242 if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
243 std::vector<Module*> Objects;
Misha Brukmane6763132003-09-29 22:26:24 +0000244 if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
John Criswell71478b72003-09-19 20:24:23 +0000245 return true;
John Criswell71478b72003-09-19 20:24:23 +0000246
John Criswell71478b72003-09-19 20:24:23 +0000247 // Figure out which symbols are defined by all of the modules in the archive.
John Criswell71478b72003-09-19 20:24:23 +0000248 std::vector<std::set<std::string> > DefinedSymbols;
Misha Brukmane6763132003-09-29 22:26:24 +0000249 DefinedSymbols.resize(Objects.size());
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000250 for (unsigned i = 0; i != Objects.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000251 GetAllDefinedSymbols(Objects[i], DefinedSymbols[i]);
252 }
253
254 // While we are linking in object files, loop.
255 bool Linked = true;
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000256 while (Linked) {
John Criswell71478b72003-09-19 20:24:23 +0000257 Linked = false;
258
259 for (unsigned i = 0; i != Objects.size(); ++i) {
260 // Consider whether we need to link in this module... we only need to
261 // link it in if it defines some symbol which is so far undefined.
262 //
263 const std::set<std::string> &DefSymbols = DefinedSymbols[i];
264
265 bool ObjectRequired = false;
266 for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
267 E = UndefinedSymbols.end(); I != E; ++I)
268 if (DefSymbols.count(*I)) {
269 if (Verbose)
270 std::cerr << " Found object providing symbol '" << *I << "'...\n";
271 ObjectRequired = true;
272 break;
273 }
274
275 // We DO need to link this object into the program...
276 if (ObjectRequired) {
277 if (LinkModules(M, Objects[i], &ErrorMessage))
278 return true; // Couldn't link in the right object file...
279
280 // Since we have linked in this object, delete it from the list of
281 // objects to consider in this archive file.
282 std::swap(Objects[i], Objects.back());
283 std::swap(DefinedSymbols[i], DefinedSymbols.back());
284 Objects.pop_back();
285 DefinedSymbols.pop_back();
286 --i; // Do not skip an entry
287
288 // The undefined symbols set should have shrunk.
289 GetAllUndefinedSymbols(M, UndefinedSymbols);
290 Linked = true; // We have linked something in!
291 }
292 }
293 }
294
295 return false;
296}
297
Misha Brukman5208ba12003-09-30 18:09:32 +0000298/// LinkInFile - opens an archive library and link in all objects which
299/// provide symbols that are currently undefined.
300///
301/// Inputs:
302/// HeadModule - The module in which to link the archives.
303/// Filename - The pathname of the archive.
304/// Verbose - Flags whether verbose messages should be printed.
305///
306/// Outputs:
307/// ErrorMessage - A C++ string detailing what error occurred, if any.
308///
309/// Return Value:
310/// TRUE - An error occurred.
311/// FALSE - No errors.
312///
Misha Brukmane6763132003-09-29 22:26:24 +0000313static bool LinkInFile(Module *HeadModule,
314 const std::string &Filename,
315 std::string &ErrorMessage,
316 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000317{
318 std::auto_ptr<Module> M(LoadObject(Filename, ErrorMessage));
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000319 if (M.get() == 0) return true;
John Criswell71478b72003-09-19 20:24:23 +0000320 if (Verbose) std::cerr << "Linking in '" << Filename << "'\n";
Misha Brukmane6763132003-09-29 22:26:24 +0000321 return LinkModules(HeadModule, M.get(), &ErrorMessage);
John Criswell71478b72003-09-19 20:24:23 +0000322}
323
Misha Brukman5208ba12003-09-30 18:09:32 +0000324/// LinkFiles - takes a module and a list of files and links them all together.
325/// It locates the file either in the current directory, as its absolute
326/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
327///
328/// Inputs:
329/// progname - The name of the program (infamous argv[0]).
330/// HeadModule - The module under which all files will be linked.
331/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
332/// to be linked. The names can refer to a mixture of pure LLVM
333/// bytecode files and archive (ar) formatted files.
334/// Verbose - Flags whether verbose output should be printed while linking.
335///
336/// Outputs:
337/// HeadModule - The module will have the specified LLVM bytecode files linked
338/// in.
339///
340/// Return value:
341/// FALSE - No errors.
342/// TRUE - Some error occurred.
343///
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000344bool LinkFiles(const char *progname,
345 Module *HeadModule,
346 const std::vector<std::string> &Files,
347 bool Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000348{
349 // String in which to receive error messages.
350 std::string ErrorMessage;
351
352 // Full pathname of the file
353 std::string Pathname;
354
355 // Get the library search path from the environment
356 char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
357
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000358 for (unsigned i = 1; i < Files.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000359 // Determine where this file lives.
Misha Brukmane6763132003-09-29 22:26:24 +0000360 if (FileExists(Files[i])) {
John Criswell71478b72003-09-19 20:24:23 +0000361 Pathname = Files[i];
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000362 } else {
363 if (SearchPath == NULL) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000364 std::cerr << progname << ": Cannot find linker input file '"
365 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000366 return true;
367 }
368
369 Pathname = std::string(SearchPath)+"/"+Files[i];
Misha Brukmane6763132003-09-29 22:26:24 +0000370 if (!FileExists(Pathname)) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000371 std::cerr << progname << ": Cannot find linker input file '"
372 << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000373 return true;
374 }
375 }
376
John Criswell71478b72003-09-19 20:24:23 +0000377 // A user may specify an ar archive without -l, perhaps because it
378 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000379 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000380 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000381 std::cerr << "Linking archive '" << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000382
Misha Brukmane6763132003-09-29 22:26:24 +0000383 if (LinkInArchive(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000384 PrintAndReturn(progname, ErrorMessage,
Misha Brukmane6763132003-09-29 22:26:24 +0000385 ": Error linking in '" + Files[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000386 return true;
387 }
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000388 } else {
John Criswell71478b72003-09-19 20:24:23 +0000389 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000390 std::cerr << "Linking file '" << Files[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000391
Misha Brukmane6763132003-09-29 22:26:24 +0000392 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000393 PrintAndReturn(progname, ErrorMessage,
Brian Gaeke608e75c2003-10-08 19:09:30 +0000394 ": Error linking in '" + Files[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000395 return true;
396 }
397 }
398 }
399
400 return false;
401}
402
Misha Brukman5208ba12003-09-30 18:09:32 +0000403/// LinkLibraries - takes the specified library files and links them into the
404/// main bytecode object file.
405///
406/// Inputs:
407/// progname - The name of the program (infamous argv[0]).
408/// HeadModule - The module into which all necessary libraries will be linked.
409/// Libraries - The list of libraries to link into the module.
410/// LibPaths - The list of library paths in which to find libraries.
411/// Verbose - Flags whether verbose messages should be printed.
412/// Native - Flags whether native code is being generated.
413///
414/// Outputs:
415/// HeadModule - The module will have all necessary libraries linked in.
416///
417/// Return value:
418/// FALSE - No error.
419/// TRUE - Error.
420///
Misha Brukmane6763132003-09-29 22:26:24 +0000421bool LinkLibraries(const char *progname,
422 Module *HeadModule,
423 const std::vector<std::string> &Libraries,
424 const std::vector<std::string> &LibPaths,
425 bool Verbose,
426 bool Native)
John Criswell71478b72003-09-19 20:24:23 +0000427{
428 // String in which to receive error messages.
429 std::string ErrorMessage;
430
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000431 for (unsigned i = 1; i < Libraries.size(); ++i) {
John Criswell71478b72003-09-19 20:24:23 +0000432 // Determine where this library lives.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000433 std::string Pathname = FindLib(Libraries[i], LibPaths);
434 if (Pathname.empty()) {
John Criswell71478b72003-09-19 20:24:23 +0000435 // If the pathname does not exist, then continue to the next one if
436 // we're doing a native link and give an error if we're doing a bytecode
437 // link.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000438 if (!Native) {
Brian Gaeke608e75c2003-10-08 19:09:30 +0000439 PrintAndReturn(progname, "Cannot find " + Libraries[i] + "\n");
John Criswell71478b72003-09-19 20:24:23 +0000440 return true;
441 }
442 }
443
John Criswell71478b72003-09-19 20:24:23 +0000444 // A user may specify an ar archive without -l, perhaps because it
445 // is not installed as a library. Detect that and link the library.
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000446 if (IsArchive(Pathname)) {
John Criswell71478b72003-09-19 20:24:23 +0000447 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000448 std::cerr << "Linking archive '" << Libraries[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000449
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000450 if (LinkInArchive(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000451 PrintAndReturn(progname, ErrorMessage,
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000452 ": Error linking in '" + Libraries[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000453 return true;
454 }
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000455 } else {
John Criswell71478b72003-09-19 20:24:23 +0000456 if (Verbose)
John Criswell71478b72003-09-19 20:24:23 +0000457 std::cerr << "Linking file '" << Libraries[i] << "'\n";
John Criswell71478b72003-09-19 20:24:23 +0000458
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000459 if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) {
John Criswell71478b72003-09-19 20:24:23 +0000460 PrintAndReturn(progname, ErrorMessage,
Misha Brukman17dc4ce2003-09-29 22:16:43 +0000461 ": error linking in '" + Libraries[i] + "'");
John Criswell71478b72003-09-19 20:24:23 +0000462 return true;
463 }
464 }
465 }
466
467 return false;
468}