Coverage Report

Created: 2018-01-17 17:22

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/ELF/InputFiles.h
Line
Count
Source (jump to first uncovered line)
1
//===- InputFiles.h ---------------------------------------------*- C++ -*-===//
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
#ifndef LLD_ELF_INPUT_FILES_H
11
#define LLD_ELF_INPUT_FILES_H
12
13
#include "Config.h"
14
#include "lld/Common/ErrorHandler.h"
15
16
#include "lld/Common/LLVM.h"
17
#include "lld/Common/Reproduce.h"
18
#include "llvm/ADT/CachedHashString.h"
19
#include "llvm/ADT/DenseSet.h"
20
#include "llvm/ADT/STLExtras.h"
21
#include "llvm/IR/Comdat.h"
22
#include "llvm/Object/Archive.h"
23
#include "llvm/Object/ELF.h"
24
#include "llvm/Object/IRObjectFile.h"
25
#include "llvm/Support/Threading.h"
26
27
#include <map>
28
29
namespace llvm {
30
class DWARFDebugLine;
31
class TarWriter;
32
struct DILineInfo;
33
namespace lto {
34
class InputFile;
35
}
36
} // namespace llvm
37
38
namespace lld {
39
namespace elf {
40
class InputFile;
41
class InputSectionBase;
42
}
43
44
// Returns "<internal>", "foo.a(bar.o)" or "baz.o".
45
std::string toString(const elf::InputFile *F);
46
47
namespace elf {
48
49
using llvm::object::Archive;
50
51
class Lazy;
52
class Symbol;
53
54
// If -reproduce option is given, all input files are written
55
// to this tar archive.
56
extern llvm::TarWriter *Tar;
57
58
// Opens a given file.
59
llvm::Optional<MemoryBufferRef> readFile(StringRef Path);
60
61
// The root class of input files.
62
class InputFile {
63
public:
64
  enum Kind {
65
    ObjKind,
66
    SharedKind,
67
    LazyObjKind,
68
    ArchiveKind,
69
    BitcodeKind,
70
    BinaryKind,
71
  };
72
73
31.3k
  Kind kind() const { return FileKind; }
74
75
3.04k
  bool isElf() const {
76
3.04k
    Kind K = kind();
77
3.04k
    return K == ObjKind || 
K == SharedKind571
;
78
3.04k
  }
79
80
133k
  StringRef getName() const { return MB.getBufferIdentifier(); }
81
  MemoryBufferRef MB;
82
83
  // Returns sections. It is a runtime error to call this function
84
  // on files that don't have the notion of sections.
85
2.69k
  ArrayRef<InputSectionBase *> getSections() const {
86
2.69k
    assert(FileKind == ObjKind || FileKind == BinaryKind);
87
2.69k
    return Sections;
88
2.69k
  }
89
90
  // Returns object file symbols. It is a runtime error to call this
91
  // function on files of other types.
92
2.20k
  ArrayRef<Symbol *> getSymbols() {
93
2.20k
    assert(FileKind == ObjKind || FileKind == BitcodeKind ||
94
2.20k
           FileKind == ArchiveKind);
95
2.20k
    return Symbols;
96
2.20k
  }
97
98
  // Filename of .a which contained this file. If this file was
99
  // not in an archive file, it is the empty string. We use this
100
  // string for creating error messages.
101
  StringRef ArchiveName;
102
103
  // If this is an architecture-specific file, the following members
104
  // have ELF type (i.e. ELF{32,64}{LE,BE}) and target machine type.
105
  ELFKind EKind = ELFNoneKind;
106
  uint16_t EMachine = llvm::ELF::EM_NONE;
107
  uint8_t OSABI = 0;
108
109
  // Cache for toString(). Only toString() should use this member.
110
  mutable std::string ToStringCache;
111
112
  std::string getSrcMsg(const Symbol &Sym, InputSectionBase &Sec,
113
                        uint64_t Offset);
114
115
protected:
116
  InputFile(Kind K, MemoryBufferRef M);
117
  std::vector<InputSectionBase *> Sections;
118
  std::vector<Symbol *> Symbols;
119
120
private:
121
  const Kind FileKind;
122
};
123
124
template <typename ELFT> class ELFFileBase : public InputFile {
125
public:
126
  typedef typename ELFT::Shdr Elf_Shdr;
127
  typedef typename ELFT::Sym Elf_Sym;
128
  typedef typename ELFT::Word Elf_Word;
129
  typedef typename ELFT::SymRange Elf_Sym_Range;
130
131
  ELFFileBase(Kind K, MemoryBufferRef M);
132
438
  static bool classof(const InputFile *F) { return F->isElf(); }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, false> >::classof(lld::elf::InputFile const*)
Line
Count
Source
132
36
  static bool classof(const InputFile *F) { return F->isElf(); }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, false> >::classof(lld::elf::InputFile const*)
Line
Count
Source
132
320
  static bool classof(const InputFile *F) { return F->isElf(); }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, true> >::classof(lld::elf::InputFile const*)
Line
Count
Source
132
3
  static bool classof(const InputFile *F) { return F->isElf(); }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, true> >::classof(lld::elf::InputFile const*)
Line
Count
Source
132
79
  static bool classof(const InputFile *F) { return F->isElf(); }
133
134
439k
  llvm::object::ELFFile<ELFT> getObj() const {
135
439k
    return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
136
439k
  }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getObj() const
Line
Count
Source
134
418k
  llvm::object::ELFFile<ELFT> getObj() const {
135
418k
    return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
136
418k
  }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getObj() const
Line
Count
Source
134
6.34k
  llvm::object::ELFFile<ELFT> getObj() const {
135
6.34k
    return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
136
6.34k
  }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getObj() const
Line
Count
Source
134
3.59k
  llvm::object::ELFFile<ELFT> getObj() const {
135
3.59k
    return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
136
3.59k
  }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getObj() const
Line
Count
Source
134
11.3k
  llvm::object::ELFFile<ELFT> getObj() const {
135
11.3k
    return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
136
11.3k
  }
137
138
78
  StringRef getStringTable() const { return StringTable; }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getStringTable() const
Line
Count
Source
138
6
  StringRef getStringTable() const { return StringTable; }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getStringTable() const
Line
Count
Source
138
5
  StringRef getStringTable() const { return StringTable; }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getStringTable() const
Line
Count
Source
138
67
  StringRef getStringTable() const { return StringTable; }
Unexecuted instantiation: lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getStringTable() const
139
140
  uint32_t getSectionIndex(const Elf_Sym &Sym) const;
141
142
  Elf_Sym_Range getGlobalELFSyms();
143
36
  Elf_Sym_Range getELFSyms() const { return ELFSyms; }
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getELFSyms() const
Line
Count
Source
143
2
  Elf_Sym_Range getELFSyms() const { return ELFSyms; }
Unexecuted instantiation: lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getELFSyms() const
lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getELFSyms() const
Line
Count
Source
143
34
  Elf_Sym_Range getELFSyms() const { return ELFSyms; }
Unexecuted instantiation: lld::elf::ELFFileBase<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getELFSyms() const
144
145
protected:
146
  ArrayRef<Elf_Sym> ELFSyms;
147
  uint32_t FirstNonLocal = 0;
148
  ArrayRef<Elf_Word> SymtabSHNDX;
149
  StringRef StringTable;
150
  void initSymtab(ArrayRef<Elf_Shdr> Sections, const Elf_Shdr *Symtab);
151
};
152
153
// .o file.
154
template <class ELFT> class ObjFile : public ELFFileBase<ELFT> {
155
  typedef ELFFileBase<ELFT> Base;
156
  typedef typename ELFT::Rel Elf_Rel;
157
  typedef typename ELFT::Rela Elf_Rela;
158
  typedef typename ELFT::Sym Elf_Sym;
159
  typedef typename ELFT::Shdr Elf_Shdr;
160
  typedef typename ELFT::Word Elf_Word;
161
162
  StringRef getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
163
                                 const Elf_Shdr &Sec);
164
  ArrayRef<Elf_Word> getShtGroupEntries(const Elf_Shdr &Sec);
165
166
public:
167
0
  static bool classof(const InputFile *F) { return F->kind() == Base::ObjKind; }
Unexecuted instantiation: lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::classof(lld::elf::InputFile const*)
Unexecuted instantiation: lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::classof(lld::elf::InputFile const*)
Unexecuted instantiation: lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::classof(lld::elf::InputFile const*)
Unexecuted instantiation: lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::classof(lld::elf::InputFile const*)
168
169
  ArrayRef<Symbol *> getLocalSymbols();
170
171
  ObjFile(MemoryBufferRef M, StringRef ArchiveName);
172
  void parse(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
173
174
12.9k
  Symbol &getSymbol(uint32_t SymbolIndex) const {
175
12.9k
    if (SymbolIndex >= this->Symbols.size())
176
0
      fatal(toString(this) + ": invalid symbol index");
177
12.9k
    return *this->Symbols[SymbolIndex];
178
12.9k
  }
lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getSymbol(unsigned int) const
Line
Count
Source
174
753
  Symbol &getSymbol(uint32_t SymbolIndex) const {
175
753
    if (SymbolIndex >= this->Symbols.size())
176
0
      fatal(toString(this) + ": invalid symbol index");
177
753
    return *this->Symbols[SymbolIndex];
178
753
  }
lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getSymbol(unsigned int) const
Line
Count
Source
174
256
  Symbol &getSymbol(uint32_t SymbolIndex) const {
175
256
    if (SymbolIndex >= this->Symbols.size())
176
0
      fatal(toString(this) + ": invalid symbol index");
177
256
    return *this->Symbols[SymbolIndex];
178
256
  }
lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getSymbol(unsigned int) const
Line
Count
Source
174
1.87k
  Symbol &getSymbol(uint32_t SymbolIndex) const {
175
1.87k
    if (SymbolIndex >= this->Symbols.size())
176
0
      fatal(toString(this) + ": invalid symbol index");
177
1.87k
    return *this->Symbols[SymbolIndex];
178
1.87k
  }
lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getSymbol(unsigned int) const
Line
Count
Source
174
10.1k
  Symbol &getSymbol(uint32_t SymbolIndex) const {
175
10.1k
    if (SymbolIndex >= this->Symbols.size())
176
0
      fatal(toString(this) + ": invalid symbol index");
177
10.1k
    return *this->Symbols[SymbolIndex];
178
10.1k
  }
179
180
12.9k
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
12.9k
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
12.9k
    return getSymbol(SymIndex);
183
12.9k
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> const&) const
Line
Count
Source
180
2
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
2
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
2
    return getSymbol(SymIndex);
183
2
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> const&) const
Line
Count
Source
180
751
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
751
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
751
    return getSymbol(SymIndex);
183
751
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> const&) const
Line
Count
Source
180
10
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
10
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
10
    return getSymbol(SymIndex);
183
10
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> const&) const
Line
Count
Source
180
247
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
247
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
247
    return getSymbol(SymIndex);
183
247
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> const&) const
Line
Count
Source
180
1.86k
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
1.86k
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
1.86k
    return getSymbol(SymIndex);
183
1.86k
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> const&) const
Line
Count
Source
180
2
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
2
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
2
    return getSymbol(SymIndex);
183
2
  }
lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> const&) const
Line
Count
Source
180
10.1k
  template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const {
181
10.1k
    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
182
10.1k
    return getSymbol(SymIndex);
183
10.1k
  }
Unexecuted instantiation: lld::elf::Symbol& lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getRelocTargetSym<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> >(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> const&) const
184
185
  // Returns source line information for a given offset.
186
  // If no information is available, returns "".
187
  std::string getLineInfo(InputSectionBase *S, uint64_t Offset);
188
  llvm::Optional<llvm::DILineInfo> getDILineInfo(InputSectionBase *, uint64_t);
189
  llvm::Optional<std::pair<std::string, unsigned>> getVariableLoc(StringRef Name);
190
191
  // MIPS GP0 value defined by this file. This value represents the gp value
192
  // used to create the relocatable object and required to support
193
  // R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.
194
  uint32_t MipsGp0 = 0;
195
196
  // Name of source file obtained from STT_FILE symbol value,
197
  // or empty string if there is no such symbol in object file
198
  // symbol table.
199
  StringRef SourceFile;
200
201
private:
202
  void
203
  initializeSections(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
204
  void initializeSymbols();
205
  void initializeDwarf();
206
  InputSectionBase *getRelocTarget(const Elf_Shdr &Sec);
207
  InputSectionBase *createInputSection(const Elf_Shdr &Sec);
208
  StringRef getSectionName(const Elf_Shdr &Sec);
209
210
  bool shouldMerge(const Elf_Shdr &Sec);
211
  Symbol *createSymbol(const Elf_Sym *Sym);
212
213
  // .shstrtab contents.
214
  StringRef SectionStringTable;
215
216
  // Debugging information to retrieve source file and line for error
217
  // reporting. Linker may find reasonable number of errors in a
218
  // single object file, so we cache debugging information in order to
219
  // parse it only once for each object file we link.
220
  std::unique_ptr<llvm::DWARFDebugLine> DwarfLine;
221
  llvm::DenseMap<StringRef, std::pair<unsigned, unsigned>> VariableLoc;
222
  llvm::once_flag InitDwarfLine;
223
};
224
225
// LazyObjFile is analogous to ArchiveFile in the sense that
226
// the file contains lazy symbols. The difference is that
227
// LazyObjFile wraps a single file instead of multiple files.
228
//
229
// This class is used for --start-lib and --end-lib options which
230
// instruct the linker to link object files between them with the
231
// archive file semantics.
232
class LazyObjFile : public InputFile {
233
public:
234
  LazyObjFile(MemoryBufferRef M, StringRef ArchiveName,
235
              uint64_t OffsetInArchive)
236
19
      : InputFile(LazyObjKind, M), OffsetInArchive(OffsetInArchive) {
237
19
    this->ArchiveName = ArchiveName;
238
19
  }
239
240
2.51k
  static bool classof(const InputFile *F) { return F->kind() == LazyObjKind; }
241
242
  template <class ELFT> void parse();
243
  MemoryBufferRef getBuffer();
244
  InputFile *fetch();
245
246
private:
247
  std::vector<StringRef> getSymbolNames();
248
  template <class ELFT> std::vector<StringRef> getElfSymbols();
249
  std::vector<StringRef> getBitcodeSymbols();
250
251
  bool Seen = false;
252
  uint64_t OffsetInArchive;
253
};
254
255
// An ArchiveFile object represents a .a file.
256
class ArchiveFile : public InputFile {
257
public:
258
  explicit ArchiveFile(std::unique_ptr<Archive> &&File);
259
2.59k
  static bool classof(const InputFile *F) { return F->kind() == ArchiveKind; }
260
  template <class ELFT> void parse();
261
262
  // Returns a memory buffer for a given symbol and the offset in the archive
263
  // for the member. An empty memory buffer and an offset of zero
264
  // is returned if we have already returned the same memory buffer.
265
  // (So that we don't instantiate same members more than once.)
266
  std::pair<MemoryBufferRef, uint64_t> getMember(const Archive::Symbol *Sym);
267
268
private:
269
  std::unique_ptr<Archive> File;
270
  llvm::DenseSet<uint64_t> Seen;
271
};
272
273
class BitcodeFile : public InputFile {
274
public:
275
  BitcodeFile(MemoryBufferRef M, StringRef ArchiveName,
276
              uint64_t OffsetInArchive);
277
2.48k
  static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; }
278
  template <class ELFT>
279
  void parse(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
280
  std::unique_ptr<llvm::lto::InputFile> Obj;
281
};
282
283
// .so file.
284
template <class ELFT> class SharedFile : public ELFFileBase<ELFT> {
285
  typedef ELFFileBase<ELFT> Base;
286
  typedef typename ELFT::Dyn Elf_Dyn;
287
  typedef typename ELFT::Shdr Elf_Shdr;
288
  typedef typename ELFT::Sym Elf_Sym;
289
  typedef typename ELFT::SymRange Elf_Sym_Range;
290
  typedef typename ELFT::Verdef Elf_Verdef;
291
  typedef typename ELFT::Versym Elf_Versym;
292
293
  std::vector<StringRef> Undefs;
294
  const Elf_Shdr *VersymSec = nullptr;
295
  const Elf_Shdr *VerdefSec = nullptr;
296
297
public:
298
  std::vector<const Elf_Verdef *> Verdefs;
299
  std::string SoName;
300
301
228
  llvm::ArrayRef<StringRef> getUndefinedSymbols() { return Undefs; }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getUndefinedSymbols()
Line
Count
Source
301
42
  llvm::ArrayRef<StringRef> getUndefinedSymbols() { return Undefs; }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getUndefinedSymbols()
Line
Count
Source
301
15
  llvm::ArrayRef<StringRef> getUndefinedSymbols() { return Undefs; }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getUndefinedSymbols()
Line
Count
Source
301
163
  llvm::ArrayRef<StringRef> getUndefinedSymbols() { return Undefs; }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getUndefinedSymbols()
Line
Count
Source
301
8
  llvm::ArrayRef<StringRef> getUndefinedSymbols() { return Undefs; }
302
303
2.49k
  static bool classof(const InputFile *F) {
304
2.49k
    return F->kind() == Base::SharedKind;
305
2.49k
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::classof(lld::elf::InputFile const*)
Line
Count
Source
303
317
  static bool classof(const InputFile *F) {
304
317
    return F->kind() == Base::SharedKind;
305
317
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >::classof(lld::elf::InputFile const*)
Line
Count
Source
303
157
  static bool classof(const InputFile *F) {
304
157
    return F->kind() == Base::SharedKind;
305
157
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >::classof(lld::elf::InputFile const*)
Line
Count
Source
303
1.94k
  static bool classof(const InputFile *F) {
304
1.94k
    return F->kind() == Base::SharedKind;
305
1.94k
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >::classof(lld::elf::InputFile const*)
Line
Count
Source
303
70
  static bool classof(const InputFile *F) {
304
70
    return F->kind() == Base::SharedKind;
305
70
  }
306
307
  SharedFile(MemoryBufferRef M, StringRef DefaultSoName);
308
309
  void parseSoName();
310
  void parseRest();
311
  std::vector<const Elf_Verdef *> parseVerdefs(const Elf_Versym *&Versym);
312
313
  struct NeededVer {
314
    // The string table offset of the version name in the output file.
315
    size_t StrTab;
316
317
    // The version identifier for this version name.
318
    uint16_t Index;
319
  };
320
321
  // Mapping from Elf_Verdef data structures to information about Elf_Vernaux
322
  // data structures in the output file.
323
  std::map<const Elf_Verdef *, NeededVer> VerdefMap;
324
325
  // Used for --as-needed
326
  bool IsNeeded;
327
};
328
329
class BinaryFile : public InputFile {
330
public:
331
5
  explicit BinaryFile(MemoryBufferRef M) : InputFile(BinaryKind, M) {}
332
2.58k
  static bool classof(const InputFile *F) { return F->kind() == BinaryKind; }
333
  void parse();
334
};
335
336
InputFile *createObjectFile(MemoryBufferRef MB, StringRef ArchiveName = "",
337
                            uint64_t OffsetInArchive = 0);
338
InputFile *createSharedFile(MemoryBufferRef MB, StringRef DefaultSoName);
339
340
extern std::vector<BinaryFile *> BinaryFiles;
341
extern std::vector<BitcodeFile *> BitcodeFiles;
342
extern std::vector<InputFile *> ObjectFiles;
343
extern std::vector<InputFile *> SharedFiles;
344
345
} // namespace elf
346
} // namespace lld
347
348
#endif