Coverage Report

Created: 2018-10-20 12:32

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/COFF/SymbolTable.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- SymbolTable.cpp ----------------------------------------------------===//
2
//
3
//                             The LLVM Linker
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "SymbolTable.h"
11
#include "Config.h"
12
#include "Driver.h"
13
#include "LTO.h"
14
#include "PDB.h"
15
#include "Symbols.h"
16
#include "lld/Common/ErrorHandler.h"
17
#include "lld/Common/Memory.h"
18
#include "lld/Common/Timer.h"
19
#include "llvm/IR/LLVMContext.h"
20
#include "llvm/Support/Debug.h"
21
#include "llvm/Support/raw_ostream.h"
22
#include <utility>
23
24
using namespace llvm;
25
26
namespace lld {
27
namespace coff {
28
29
static Timer LTOTimer("LTO", Timer::root());
30
31
SymbolTable *Symtab;
32
33
837
void SymbolTable::addFile(InputFile *File) {
34
837
  log("Reading " + toString(File));
35
837
  File->parse();
36
837
37
837
  MachineTypes MT = File->getMachineType();
38
837
  if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) {
39
506
    Config->Machine = MT;
40
506
  } else 
if (331
MT != IMAGE_FILE_MACHINE_UNKNOWN331
&&
Config->Machine != MT152
) {
41
2
    error(toString(File) + ": machine type " + machineToStr(MT) +
42
2
          " conflicts with " + machineToStr(Config->Machine));
43
2
    return;
44
2
  }
45
835
46
835
  if (auto *F = dyn_cast<ObjFile>(File)) {
47
598
    ObjFile::Instances.push_back(F);
48
598
  } else 
if (auto *237
F237
= dyn_cast<BitcodeFile>(File)) {
49
54
    BitcodeFile::Instances.push_back(F);
50
183
  } else if (auto *F = dyn_cast<ImportFile>(File)) {
51
99
    ImportFile::Instances.push_back(F);
52
99
  }
53
835
54
835
  StringRef S = File->getDirectives();
55
835
  if (S.empty())
56
683
    return;
57
152
58
152
  log("Directives: " + toString(File) + ": " + S);
59
152
  Driver->parseDirectives(S);
60
152
}
61
62
37
static void errorOrWarn(const Twine &S) {
63
37
  if (Config->ForceUnresolved)
64
1
    warn(S);
65
36
  else
66
36
    error(S);
67
37
}
68
69
// Returns the symbol in SC whose value is <= Addr that is closest to Addr.
70
// This is generally the global variable or function whose definition contains
71
// Addr.
72
19
static Symbol *getSymbol(SectionChunk *SC, uint32_t Addr) {
73
19
  DefinedRegular *Candidate = nullptr;
74
19
75
300
  for (Symbol *S : SC->File->getSymbols()) {
76
300
    auto *D = dyn_cast_or_null<DefinedRegular>(S);
77
300
    if (!D || 
D->getChunk() != SC143
||
D->getValue() > Addr46
||
78
300
        
(40
Candidate40
&&
D->getValue() < Candidate->getValue()21
))
79
260
      continue;
80
40
81
40
    Candidate = D;
82
40
  }
83
19
84
19
  return Candidate;
85
19
}
86
87
17
static std::string getSymbolLocations(ObjFile *File, uint32_t SymIndex) {
88
17
  struct Location {
89
17
    Symbol *Sym;
90
17
    std::pair<StringRef, uint32_t> FileLine;
91
17
  };
92
17
  std::vector<Location> Locations;
93
17
94
53
  for (Chunk *C : File->getChunks()) {
95
53
    auto *SC = dyn_cast<SectionChunk>(C);
96
53
    if (!SC)
97
0
      continue;
98
63
    
for (const coff_relocation &R : SC->Relocs)53
{
99
63
      if (R.SymbolTableIndex != SymIndex)
100
44
        continue;
101
19
      std::pair<StringRef, uint32_t> FileLine =
102
19
          getFileLine(SC, R.VirtualAddress);
103
19
      Symbol *Sym = getSymbol(SC, R.VirtualAddress);
104
19
      if (!FileLine.first.empty() || 
Sym14
)
105
19
        Locations.push_back({Sym, FileLine});
106
19
    }
107
53
  }
108
17
109
17
  if (Locations.empty())
110
2
    return "\n>>> referenced by " + toString(File);
111
15
112
15
  std::string Out;
113
15
  llvm::raw_string_ostream OS(Out);
114
19
  for (Location Loc : Locations) {
115
19
    OS << "\n>>> referenced by ";
116
19
    if (!Loc.FileLine.first.empty())
117
5
      OS << Loc.FileLine.first << ":" << Loc.FileLine.second
118
5
         << "\n>>>               ";
119
19
    OS << toString(File);
120
19
    if (Loc.Sym)
121
19
      OS << ":(" << toString(*Loc.Sym) << ')';
122
19
  }
123
15
  return OS.str();
124
15
}
125
126
39
void SymbolTable::loadMinGWAutomaticImports() {
127
701
  for (auto &I : SymMap) {
128
701
    Symbol *Sym = I.second;
129
701
    auto *Undef = dyn_cast<Undefined>(Sym);
130
701
    if (!Undef)
131
691
      continue;
132
10
    if (!Sym->IsUsedInRegularObj)
133
0
      continue;
134
10
135
10
    StringRef Name = Undef->getName();
136
10
137
10
    if (Name.startswith("__imp_"))
138
0
      continue;
139
10
    // If we have an undefined symbol, but we have a Lazy representing a
140
10
    // symbol we could load from file, make sure to load that.
141
10
    Lazy *L = dyn_cast_or_null<Lazy>(find(("__imp_" + Name).str()));
142
10
    if (!L || 
L->PendingArchiveLoad7
)
143
3
      continue;
144
7
145
7
    log("Loading lazy " + L->getName() + " from " + L->File->getName() +
146
7
        " for automatic import");
147
7
    L->PendingArchiveLoad = true;
148
7
    L->File->addMember(&L->Sym);
149
7
  }
150
39
}
151
152
8
bool SymbolTable::handleMinGWAutomaticImport(Symbol *Sym, StringRef Name) {
153
8
  if (Name.startswith("__imp_"))
154
0
    return false;
155
8
  Defined *Imp = dyn_cast_or_null<Defined>(find(("__imp_" + Name).str()));
156
8
  if (!Imp)
157
1
    return false;
158
7
159
7
  // Replace the reference directly to a variable with a reference
160
7
  // to the import address table instead. This obviously isn't right,
161
7
  // but we mark the symbol as IsRuntimePseudoReloc, and a later pass
162
7
  // will add runtime pseudo relocations for every relocation against
163
7
  // this Symbol. The runtime pseudo relocation framework expects the
164
7
  // reference itself to point at the IAT entry.
165
7
  size_t ImpSize = 0;
166
7
  if (isa<DefinedImportData>(Imp)) {
167
6
    log("Automatically importing " + Name + " from " +
168
6
        cast<DefinedImportData>(Imp)->getDLLName());
169
6
    ImpSize = sizeof(DefinedImportData);
170
6
  } else 
if (1
isa<DefinedRegular>(Imp)1
) {
171
1
    log("Automatically importing " + Name + " from " +
172
1
        toString(cast<DefinedRegular>(Imp)->File));
173
1
    ImpSize = sizeof(DefinedRegular);
174
1
  } else {
175
0
    warn("unable to automatically import " + Name + " from " + Imp->getName() +
176
0
         " from " + toString(cast<DefinedRegular>(Imp)->File) +
177
0
         "; unexpected symbol type");
178
0
    return false;
179
0
  }
180
7
  Sym->replaceKeepingName(Imp, ImpSize);
181
7
  Sym->IsRuntimePseudoReloc = true;
182
7
183
7
  // There may exist symbols named .refptr.<name> which only consist
184
7
  // of a single pointer to <name>. If it turns out <name> is
185
7
  // automatically imported, we don't need to keep the .refptr.<name>
186
7
  // pointer at all, but redirect all accesses to it to the IAT entry
187
7
  // for __imp_<name> instead, and drop the whole .refptr.<name> chunk.
188
7
  DefinedRegular *Refptr =
189
7
      dyn_cast_or_null<DefinedRegular>(find((".refptr." + Name).str()));
190
7
  if (Refptr && 
Refptr->getChunk()->getSize() == Config->Wordsize1
) {
191
1
    SectionChunk *SC = dyn_cast_or_null<SectionChunk>(Refptr->getChunk());
192
1
    if (SC && SC->Relocs.size() == 1 && *SC->symbols().begin() == Sym) {
193
1
      log("Replacing .refptr." + Name + " with " + Imp->getName());
194
1
      Refptr->getChunk()->Live = false;
195
1
      Refptr->replaceKeepingName(Imp, ImpSize);
196
1
    }
197
1
  }
198
7
  return true;
199
7
}
200
201
505
void SymbolTable::reportRemainingUndefines() {
202
505
  SmallPtrSet<Symbol *, 8> Undefs;
203
505
  DenseMap<Symbol *, Symbol *> LocalImports;
204
505
205
6.56k
  for (auto &I : SymMap) {
206
6.56k
    Symbol *Sym = I.second;
207
6.56k
    auto *Undef = dyn_cast<Undefined>(Sym);
208
6.56k
    if (!Undef)
209
6.45k
      continue;
210
105
    if (!Sym->IsUsedInRegularObj)
211
21
      continue;
212
84
213
84
    StringRef Name = Undef->getName();
214
84
215
84
    // A weak alias may have been resolved, so check for that.
216
84
    if (Defined *D = Undef->getWeakAlias()) {
217
33
      // We want to replace Sym with D. However, we can't just blindly
218
33
      // copy sizeof(SymbolUnion) bytes from D to Sym because D may be an
219
33
      // internal symbol, and internal symbols are stored as "unparented"
220
33
      // Symbols. For that reason we need to check which type of symbol we
221
33
      // are dealing with and copy the correct number of bytes.
222
33
      if (isa<DefinedRegular>(D))
223
31
        memcpy(Sym, D, sizeof(DefinedRegular));
224
2
      else if (isa<DefinedAbsolute>(D))
225
0
        memcpy(Sym, D, sizeof(DefinedAbsolute));
226
2
      else
227
2
        memcpy(Sym, D, sizeof(SymbolUnion));
228
33
      continue;
229
33
    }
230
51
231
51
    // If we can resolve a symbol by removing __imp_ prefix, do that.
232
51
    // This odd rule is for compatibility with MSVC linker.
233
51
    if (Name.startswith("__imp_")) {
234
8
      Symbol *Imp = find(Name.substr(strlen("__imp_")));
235
8
      if (Imp && 
isa<Defined>(Imp)7
) {
236
7
        auto *D = cast<Defined>(Imp);
237
7
        replaceSymbol<DefinedLocalImport>(Sym, Name, D);
238
7
        LocalImportChunks.push_back(cast<DefinedLocalImport>(Sym)->getChunk());
239
7
        LocalImports[Sym] = D;
240
7
        continue;
241
7
      }
242
44
    }
243
44
244
44
    if (Config->MinGW && 
handleMinGWAutomaticImport(Sym, Name)8
)
245
7
      continue;
246
37
247
37
    // Remaining undefined symbols are not fatal if /force is specified.
248
37
    // They are replaced with dummy defined symbols.
249
37
    if (Config->ForceUnresolved)
250
1
      replaceSymbol<DefinedAbsolute>(Sym, Name, 0);
251
37
    Undefs.insert(Sym);
252
37
  }
253
505
254
505
  if (Undefs.empty() && 
LocalImports.empty()479
)
255
472
    return;
256
33
257
34
  
for (Symbol *B : Config->GCRoot)33
{
258
34
    if (Undefs.count(B))
259
20
      errorOrWarn("<root>: undefined symbol: " + toString(*B));
260
34
    if (Config->WarnLocallyDefinedImported)
261
33
      if (Symbol *Imp = LocalImports.lookup(B))
262
0
        warn("<root>: locally defined symbol imported: " + toString(*Imp) +
263
0
             " (defined in " + toString(Imp->getFile()) + ") [LNK4217]");
264
34
  }
265
33
266
36
  for (ObjFile *File : ObjFile::Instances) {
267
36
    size_t SymIndex = (size_t)-1;
268
225
    for (Symbol *Sym : File->getSymbols()) {
269
225
      ++SymIndex;
270
225
      if (!Sym)
271
77
        continue;
272
148
      if (Undefs.count(Sym))
273
17
        errorOrWarn("undefined symbol: " + toString(*Sym) +
274
17
                    getSymbolLocations(File, SymIndex));
275
148
      if (Config->WarnLocallyDefinedImported)
276
143
        if (Symbol *Imp = LocalImports.lookup(Sym))
277
7
          warn(toString(File) +
278
7
               ": locally defined symbol imported: " + toString(*Imp) +
279
7
               " (defined in " + toString(Imp->getFile()) + ") [LNK4217]");
280
148
    }
281
36
  }
282
33
}
283
284
7.92k
std::pair<Symbol *, bool> SymbolTable::insert(StringRef Name) {
285
7.92k
  bool Inserted = false;
286
7.92k
  Symbol *&Sym = SymMap[CachedHashStringRef(Name)];
287
7.92k
  if (!Sym) {
288
6.61k
    Sym = reinterpret_cast<Symbol *>(make<SymbolUnion>());
289
6.61k
    Sym->IsUsedInRegularObj = false;
290
6.61k
    Sym->PendingArchiveLoad = false;
291
6.61k
    Inserted = true;
292
6.61k
  }
293
7.92k
  return {Sym, Inserted};
294
7.92k
}
295
296
7.47k
std::pair<Symbol *, bool> SymbolTable::insert(StringRef Name, InputFile *File) {
297
7.47k
  std::pair<Symbol *, bool> Result = insert(Name);
298
7.47k
  if (!File || 
!isa<BitcodeFile>(File)1.62k
)
299
7.36k
    Result.first->IsUsedInRegularObj = true;
300
7.47k
  return Result;
301
7.47k
}
302
303
Symbol *SymbolTable::addUndefined(StringRef Name, InputFile *F,
304
1.06k
                                  bool IsWeakAlias) {
305
1.06k
  Symbol *S;
306
1.06k
  bool WasInserted;
307
1.06k
  std::tie(S, WasInserted) = insert(Name, F);
308
1.06k
  if (WasInserted || 
(708
isa<Lazy>(S)708
&&
IsWeakAlias27
)) {
309
355
    replaceSymbol<Undefined>(S, Name);
310
355
    return S;
311
355
  }
312
708
  if (auto *L = dyn_cast<Lazy>(S)) {
313
27
    if (!S->PendingArchiveLoad) {
314
27
      S->PendingArchiveLoad = true;
315
27
      L->File->addMember(&L->Sym);
316
27
    }
317
27
  }
318
708
  return S;
319
708
}
320
321
452
void SymbolTable::addLazy(ArchiveFile *F, const Archive::Symbol Sym) {
322
452
  StringRef Name = Sym.getName();
323
452
  Symbol *S;
324
452
  bool WasInserted;
325
452
  std::tie(S, WasInserted) = insert(Name);
326
452
  if (WasInserted) {
327
332
    replaceSymbol<Lazy>(S, F, Sym);
328
332
    return;
329
332
  }
330
120
  auto *U = dyn_cast<Undefined>(S);
331
120
  if (!U || 
U->WeakAlias105
||
S->PendingArchiveLoad105
)
332
15
    return;
333
105
  S->PendingArchiveLoad = true;
334
105
  F->addMember(&Sym);
335
105
}
336
337
8
void SymbolTable::reportDuplicate(Symbol *Existing, InputFile *NewFile) {
338
8
  std::string Msg = "duplicate symbol: " + toString(*Existing) + " in " +
339
8
                    toString(Existing->getFile()) + " and in " +
340
8
                    toString(NewFile);
341
8
342
8
  if (Config->ForceMultiple)
343
2
    warn(Msg);
344
6
  else
345
6
    error(Msg);
346
8
}
347
348
17
Symbol *SymbolTable::addAbsolute(StringRef N, COFFSymbolRef Sym) {
349
17
  Symbol *S;
350
17
  bool WasInserted;
351
17
  std::tie(S, WasInserted) = insert(N, nullptr);
352
17
  S->IsUsedInRegularObj = true;
353
17
  if (WasInserted || 
isa<Undefined>(S)3
||
isa<Lazy>(S)0
)
354
17
    replaceSymbol<DefinedAbsolute>(S, N, Sym);
355
0
  else if (!isa<DefinedCOFF>(S))
356
0
    reportDuplicate(S, nullptr);
357
17
  return S;
358
17
}
359
360
4.38k
Symbol *SymbolTable::addAbsolute(StringRef N, uint64_t VA) {
361
4.38k
  Symbol *S;
362
4.38k
  bool WasInserted;
363
4.38k
  std::tie(S, WasInserted) = insert(N, nullptr);
364
4.38k
  S->IsUsedInRegularObj = true;
365
4.38k
  if (WasInserted || 
isa<Undefined>(S)68
||
isa<Lazy>(S)0
)
366
4.38k
    replaceSymbol<DefinedAbsolute>(S, N, VA);
367
0
  else if (!isa<DefinedCOFF>(S))
368
0
    reportDuplicate(S, nullptr);
369
4.38k
  return S;
370
4.38k
}
371
372
507
Symbol *SymbolTable::addSynthetic(StringRef N, Chunk *C) {
373
507
  Symbol *S;
374
507
  bool WasInserted;
375
507
  std::tie(S, WasInserted) = insert(N, nullptr);
376
507
  S->IsUsedInRegularObj = true;
377
507
  if (WasInserted || 
isa<Undefined>(S)26
||
isa<Lazy>(S)0
)
378
507
    replaceSymbol<DefinedSynthetic>(S, N, C);
379
0
  else if (!isa<DefinedCOFF>(S))
380
0
    reportDuplicate(S, nullptr);
381
507
  return S;
382
507
}
383
384
Symbol *SymbolTable::addRegular(InputFile *F, StringRef N,
385
                                const coff_symbol_generic *Sym,
386
995
                                SectionChunk *C) {
387
995
  Symbol *S;
388
995
  bool WasInserted;
389
995
  std::tie(S, WasInserted) = insert(N, F);
390
995
  if (WasInserted || 
!isa<DefinedRegular>(S)99
)
391
990
    replaceSymbol<DefinedRegular>(S, F, N, /*IsCOMDAT*/ false,
392
990
                                  /*IsExternal*/ true, Sym, C);
393
5
  else
394
5
    reportDuplicate(S, F);
395
995
  return S;
396
995
}
397
398
std::pair<Symbol *, bool>
399
SymbolTable::addComdat(InputFile *F, StringRef N,
400
305
                       const coff_symbol_generic *Sym) {
401
305
  Symbol *S;
402
305
  bool WasInserted;
403
305
  std::tie(S, WasInserted) = insert(N, F);
404
305
  if (WasInserted || 
!isa<DefinedRegular>(S)103
) {
405
280
    replaceSymbol<DefinedRegular>(S, F, N, /*IsCOMDAT*/ true,
406
280
                                  /*IsExternal*/ true, Sym, nullptr);
407
280
    return {S, true};
408
280
  }
409
25
  if (!cast<DefinedRegular>(S)->isCOMDAT())
410
0
    reportDuplicate(S, F);
411
25
  return {S, false};
412
25
}
413
414
Symbol *SymbolTable::addCommon(InputFile *F, StringRef N, uint64_t Size,
415
12
                               const coff_symbol_generic *Sym, CommonChunk *C) {
416
12
  Symbol *S;
417
12
  bool WasInserted;
418
12
  std::tie(S, WasInserted) = insert(N, F);
419
12
  if (WasInserted || 
!isa<DefinedCOFF>(S)0
)
420
12
    replaceSymbol<DefinedCommon>(S, F, N, Size, Sym, C);
421
0
  else if (auto *DC = dyn_cast<DefinedCommon>(S))
422
0
    if (Size > DC->getSize())
423
0
      replaceSymbol<DefinedCommon>(S, F, N, Size, Sym, C);
424
12
  return S;
425
12
}
426
427
100
Symbol *SymbolTable::addImportData(StringRef N, ImportFile *F) {
428
100
  Symbol *S;
429
100
  bool WasInserted;
430
100
  std::tie(S, WasInserted) = insert(N, nullptr);
431
100
  S->IsUsedInRegularObj = true;
432
100
  if (WasInserted || isa<Undefined>(S) || 
isa<Lazy>(S)93
) {
433
98
    replaceSymbol<DefinedImportData>(S, N, F);
434
98
    return S;
435
98
  }
436
2
437
2
  reportDuplicate(S, F);
438
2
  return nullptr;
439
2
}
440
441
Symbol *SymbolTable::addImportThunk(StringRef Name, DefinedImportData *ID,
442
89
                                    uint16_t Machine) {
443
89
  Symbol *S;
444
89
  bool WasInserted;
445
89
  std::tie(S, WasInserted) = insert(Name, nullptr);
446
89
  S->IsUsedInRegularObj = true;
447
89
  if (WasInserted || isa<Undefined>(S) || 
isa<Lazy>(S)14
) {
448
88
    replaceSymbol<DefinedImportThunk>(S, Name, ID, Machine);
449
88
    return S;
450
88
  }
451
1
452
1
  reportDuplicate(S, ID->File);
453
1
  return nullptr;
454
1
}
455
456
1.24k
std::vector<Chunk *> SymbolTable::getChunks() {
457
1.24k
  std::vector<Chunk *> Res;
458
1.58k
  for (ObjFile *File : ObjFile::Instances) {
459
1.58k
    ArrayRef<Chunk *> V = File->getChunks();
460
1.58k
    Res.insert(Res.end(), V.begin(), V.end());
461
1.58k
  }
462
1.24k
  return Res;
463
1.24k
}
464
465
2.90k
Symbol *SymbolTable::find(StringRef Name) {
466
2.90k
  return SymMap.lookup(CachedHashStringRef(Name));
467
2.90k
}
468
469
1.67k
Symbol *SymbolTable::findUnderscore(StringRef Name) {
470
1.67k
  if (Config->Machine == I386)
471
302
    return find(("_" + Name).str());
472
1.37k
  return find(Name);
473
1.37k
}
474
475
1.06k
StringRef SymbolTable::findByPrefix(StringRef Prefix) {
476
3.53k
  for (auto Pair : SymMap) {
477
3.53k
    StringRef Name = Pair.first.val();
478
3.53k
    if (Name.startswith(Prefix))
479
25
      return Name;
480
3.53k
  }
481
1.06k
  
return ""1.04k
;
482
1.06k
}
483
484
926
StringRef SymbolTable::findMangle(StringRef Name) {
485
926
  if (Symbol *Sym = find(Name))
486
263
    if (!isa<Undefined>(Sym))
487
221
      return Name;
488
705
  if (Config->Machine != I386)
489
571
    return findByPrefix(("?" + Name + "@@Y").str());
490
134
  if (!Name.startswith("_"))
491
0
    return "";
492
134
  // Search for x86 stdcall function.
493
134
  StringRef S = findByPrefix((Name + "@").str());
494
134
  if (!S.empty())
495
13
    return S;
496
121
  // Search for x86 fastcall function.
497
121
  S = findByPrefix(("@" + Name.substr(1) + "@").str());
498
121
  if (!S.empty())
499
1
    return S;
500
120
  // Search for x86 vectorcall function.
501
120
  S = findByPrefix((Name.substr(1) + "@@").str());
502
120
  if (!S.empty())
503
1
    return S;
504
119
  // Search for x86 C++ non-member function.
505
119
  return findByPrefix(("?" + Name.substr(1) + "@@Y").str());
506
119
}
507
508
573
void SymbolTable::mangleMaybe(Symbol *B) {
509
573
  auto *U = dyn_cast<Undefined>(B);
510
573
  if (!U || 
U->WeakAlias47
)
511
531
    return;
512
42
  StringRef Alias = findMangle(U->getName());
513
42
  if (!Alias.empty()) {
514
19
    log(U->getName() + " aliased to " + Alias);
515
19
    U->WeakAlias = addUndefined(Alias);
516
19
  }
517
42
}
518
519
747
Symbol *SymbolTable::addUndefined(StringRef Name) {
520
747
  return addUndefined(Name, nullptr, false);
521
747
}
522
523
39
std::vector<StringRef> SymbolTable::compileBitcodeFiles() {
524
39
  LTO.reset(new BitcodeCompiler);
525
39
  for (BitcodeFile *F : BitcodeFile::Instances)
526
52
    LTO->add(*F);
527
39
  return LTO->compile();
528
39
}
529
530
505
void SymbolTable::addCombinedLTOObjects() {
531
505
  if (BitcodeFile::Instances.empty())
532
466
    return;
533
39
534
39
  ScopedTimer T(LTOTimer);
535
49
  for (StringRef Object : compileBitcodeFiles()) {
536
49
    auto *Obj = make<ObjFile>(MemoryBufferRef(Object, "lto.tmp"));
537
49
    Obj->parse();
538
49
    ObjFile::Instances.push_back(Obj);
539
49
  }
540
39
}
541
542
} // namespace coff
543
} // namespace lld