Coverage Report

Created: 2018-01-17 21:32

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/ELF/Symbols.h
Line
Count
Source (jump to first uncovered line)
1
//===- Symbols.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
// All symbols are handled as SymbolBodies regardless of their types.
11
// This file defines various types of SymbolBodies.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLD_ELF_SYMBOLS_H
16
#define LLD_ELF_SYMBOLS_H
17
18
#include "InputSection.h"
19
#include "Strings.h"
20
21
#include "lld/Common/LLVM.h"
22
#include "llvm/Object/Archive.h"
23
#include "llvm/Object/ELF.h"
24
25
namespace lld {
26
namespace elf {
27
28
class ArchiveFile;
29
class BitcodeFile;
30
class BssSection;
31
class InputFile;
32
class LazyObjFile;
33
template <class ELFT> class ObjFile;
34
class OutputSection;
35
template <class ELFT> class SharedFile;
36
37
// The base class for real symbol classes.
38
class Symbol {
39
public:
40
  enum Kind {
41
    DefinedKind,
42
    SharedKind,
43
    UndefinedKind,
44
    LazyArchiveKind,
45
    LazyObjectKind,
46
  };
47
48
38.7k
  Kind kind() const { return static_cast<Kind>(SymbolKind); }
49
50
  // Symbol binding. This is not overwritten by replaceSymbol to track
51
  // changes during resolution. In particular:
52
  //  - An undefined weak is still weak when it resolves to a shared library.
53
  //  - An undefined weak will not fetch archive members, but we have to
54
  //    remember it is weak.
55
  uint8_t Binding;
56
57
  // Version definition index.
58
  uint16_t VersionId;
59
60
  // Symbol visibility. This is the computed minimum visibility of all
61
  // observed non-DSO symbols.
62
  unsigned Visibility : 2;
63
64
  // True if the symbol was used for linking and thus need to be added to the
65
  // output file's symbol table. This is true for all symbols except for
66
  // unreferenced DSO symbols and bitcode symbols that are unreferenced except
67
  // by other bitcode objects.
68
  unsigned IsUsedInRegularObj : 1;
69
70
  // If this flag is true and the symbol has protected or default visibility, it
71
  // will appear in .dynsym. This flag is set by interposable DSO symbols in
72
  // executables, by most symbols in DSOs and executables built with
73
  // --export-dynamic, and by dynamic lists.
74
  unsigned ExportDynamic : 1;
75
76
  // False if LTO shouldn't inline whatever this symbol points to. If a symbol
77
  // is overwritten after LTO, LTO shouldn't inline the symbol because it
78
  // doesn't know the final contents of the symbol.
79
  unsigned CanInline : 1;
80
81
  // True if this symbol is specified by --trace-symbol option.
82
  unsigned Traced : 1;
83
84
  // This symbol version was found in a version script.
85
  unsigned InVersionScript : 1;
86
87
  // The file from which this symbol was created.
88
  InputFile *File;
89
90
  bool includeInDynsym() const;
91
  uint8_t computeBinding() const;
92
1.46k
  bool isWeak() const { return Binding == llvm::ELF::STB_WEAK; }
93
94
11.4k
  bool isUndefined() const { return SymbolKind == UndefinedKind; }
95
18.1M
  bool isDefined() const { return SymbolKind == DefinedKind; }
96
273
  bool isShared() const { return SymbolKind == SharedKind; }
97
79.5k
  bool isLocal() const { return Binding == llvm::ELF::STB_LOCAL; }
98
99
811
  bool isLazy() const {
100
811
    return SymbolKind == LazyArchiveKind || 
SymbolKind == LazyObjectKind799
;
101
811
  }
102
103
  // True is this is an undefined weak symbol. This only works once
104
  // all input files have been added.
105
1.09k
  bool isUndefWeak() const {
106
1.09k
    // See comment on Lazy the details.
107
1.09k
    return isWeak() && 
(38
isUndefined()38
||
isLazy()13
);
108
1.09k
  }
109
110
29.8k
  StringRef getName() const { return Name; }
111
  void parseSymbolVersion();
112
113
20.1k
  bool isInGot() const { return GotIndex != -1U; }
114
10.6k
  bool isInPlt() const { return PltIndex != -1U; }
115
116
  uint64_t getVA(int64_t Addend = 0) const;
117
118
  uint64_t getGotOffset() const;
119
  uint64_t getGotVA() const;
120
  uint64_t getGotPltOffset() const;
121
  uint64_t getGotPltVA() const;
122
  uint64_t getPltVA() const;
123
  uint64_t getSize() const;
124
  OutputSection *getOutputSection() const;
125
126
  uint32_t DynsymIndex = 0;
127
  uint32_t GotIndex = -1;
128
  uint32_t GotPltIndex = -1;
129
  uint32_t PltIndex = -1;
130
  uint32_t GlobalDynIndex = -1;
131
132
protected:
133
  Symbol(Kind K, InputFile *File, StringRefZ Name, uint8_t Binding,
134
         uint8_t StOther, uint8_t Type)
135
      : Binding(Binding), File(File), SymbolKind(K), NeedsPltAddr(false),
136
        IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
137
        IsInIgot(false), IsPreemptible(false), Used(!Config->GcSections),
138
15.9k
        Type(Type), StOther(StOther), Name(Name) {}
139
140
  const unsigned SymbolKind : 8;
141
142
public:
143
  // True the symbol should point to its PLT entry.
144
  // For SharedSymbol only.
145
  unsigned NeedsPltAddr : 1;
146
  // True if this symbol has an entry in the global part of MIPS GOT.
147
  unsigned IsInGlobalMipsGot : 1;
148
149
  // True if this symbol is referenced by 32-bit GOT relocations.
150
  unsigned Is32BitMipsGot : 1;
151
152
  // True if this symbol is in the Iplt sub-section of the Plt.
153
  unsigned IsInIplt : 1;
154
155
  // True if this symbol is in the Igot sub-section of the .got.plt or .got.
156
  unsigned IsInIgot : 1;
157
158
  unsigned IsPreemptible : 1;
159
160
  // True if an undefined or shared symbol is used from a live section.
161
  unsigned Used : 1;
162
163
  // The following fields have the same meaning as the ELF symbol attributes.
164
  uint8_t Type;    // symbol type
165
  uint8_t StOther; // st_other field value
166
167
  // The Type field may also have this value. It means that we have not yet seen
168
  // a non-Lazy symbol with this name, so we don't know what its type is. The
169
  // Type field is normally set to this value for Lazy symbols unless we saw a
170
  // weak undefined symbol first, in which case we need to remember the original
171
  // symbol's type in order to check for TLS mismatches.
172
  enum { UnknownType = 255 };
173
174
36.3k
  bool isSection() const { return Type == llvm::ELF::STT_SECTION; }
175
78.1k
  bool isTls() const { return Type == llvm::ELF::STT_TLS; }
176
98
  bool isFunc() const { return Type == llvm::ELF::STT_FUNC; }
177
11.5k
  bool isGnuIFunc() const { return Type == llvm::ELF::STT_GNU_IFUNC; }
178
69
  bool isObject() const { return Type == llvm::ELF::STT_OBJECT; }
179
867
  bool isFile() const { return Type == llvm::ELF::STT_FILE; }
180
181
protected:
182
  StringRefZ Name;
183
};
184
185
// Represents a symbol that is defined in the current output file.
186
class Defined : public Symbol {
187
public:
188
  Defined(InputFile *File, StringRefZ Name, uint8_t Binding, uint8_t StOther,
189
          uint8_t Type, uint64_t Value, uint64_t Size, SectionBase *Section)
190
      : Symbol(DefinedKind, File, Name, Binding, StOther, Type), Value(Value),
191
13.7k
        Size(Size), Section(Section) {}
192
193
18.1M
  static bool classof(const Symbol *S) { return S->isDefined(); }
194
195
  uint64_t Value;
196
  uint64_t Size;
197
  SectionBase *Section;
198
};
199
200
class Undefined : public Symbol {
201
public:
202
  Undefined(InputFile *File, StringRefZ Name, uint8_t Binding, uint8_t StOther,
203
            uint8_t Type)
204
1.78k
      : Symbol(UndefinedKind, File, Name, Binding, StOther, Type) {}
205
206
0
  static bool classof(const Symbol *S) { return S->kind() == UndefinedKind; }
207
};
208
209
class SharedSymbol : public Symbol {
210
public:
211
2.39k
  static bool classof(const Symbol *S) { return S->kind() == SharedKind; }
212
213
  SharedSymbol(InputFile &File, StringRef Name, uint8_t Binding,
214
               uint8_t StOther, uint8_t Type, uint64_t Value, uint64_t Size,
215
               uint32_t Alignment, uint32_t VerdefIndex)
216
      : Symbol(SharedKind, &File, Name, Binding, StOther, Type), Value(Value),
217
331
        Size(Size), VerdefIndex(VerdefIndex), Alignment(Alignment) {
218
331
    // GNU ifunc is a mechanism to allow user-supplied functions to
219
331
    // resolve PLT slot values at load-time. This is contrary to the
220
331
    // regular symbol resolution scheme in which symbols are resolved just
221
331
    // by name. Using this hook, you can program how symbols are solved
222
331
    // for you program. For example, you can make "memcpy" to be resolved
223
331
    // to a SSE-enabled version of memcpy only when a machine running the
224
331
    // program supports the SSE instruction set.
225
331
    //
226
331
    // Naturally, such symbols should always be called through their PLT
227
331
    // slots. What GNU ifunc symbols point to are resolver functions, and
228
331
    // calling them directly doesn't make sense (unless you are writing a
229
331
    // loader).
230
331
    //
231
331
    // For DSO symbols, we always call them through PLT slots anyway.
232
331
    // So there's no difference between GNU ifunc and regular function
233
331
    // symbols if they are in DSOs. So we can handle GNU_IFUNC as FUNC.
234
331
    if (this->Type == llvm::ELF::STT_GNU_IFUNC)
235
2
      this->Type = llvm::ELF::STT_FUNC;
236
331
  }
237
238
233
  template <class ELFT> SharedFile<ELFT> &getFile() const {
239
233
    return *cast<SharedFile<ELFT>>(File);
240
233
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >& lld::elf::SharedSymbol::getFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >() const
Line
Count
Source
238
53
  template <class ELFT> SharedFile<ELFT> &getFile() const {
239
53
    return *cast<SharedFile<ELFT>>(File);
240
53
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >& lld::elf::SharedSymbol::getFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >() const
Line
Count
Source
238
12
  template <class ELFT> SharedFile<ELFT> &getFile() const {
239
12
    return *cast<SharedFile<ELFT>>(File);
240
12
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >& lld::elf::SharedSymbol::getFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >() const
Line
Count
Source
238
163
  template <class ELFT> SharedFile<ELFT> &getFile() const {
239
163
    return *cast<SharedFile<ELFT>>(File);
240
163
  }
lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >& lld::elf::SharedSymbol::getFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >() const
Line
Count
Source
238
5
  template <class ELFT> SharedFile<ELFT> &getFile() const {
239
5
    return *cast<SharedFile<ELFT>>(File);
240
5
  }
241
242
  // If not null, there is a copy relocation to this section.
243
  InputSection *CopyRelSec = nullptr;
244
245
  uint64_t Value; // st_value
246
  uint64_t Size;  // st_size
247
248
  // This field is a index to the symbol's version definition.
249
  uint32_t VerdefIndex;
250
251
  uint32_t Alignment;
252
};
253
254
// This represents a symbol that is not yet in the link, but we know where to
255
// find it if needed. If the resolver finds both Undefined and Lazy for the same
256
// name, it will ask the Lazy to load a file.
257
//
258
// A special complication is the handling of weak undefined symbols. They should
259
// not load a file, but we have to remember we have seen both the weak undefined
260
// and the lazy. We represent that with a lazy symbol with a weak binding. This
261
// means that code looking for undefined symbols normally also has to take lazy
262
// symbols into consideration.
263
class Lazy : public Symbol {
264
public:
265
650
  static bool classof(const Symbol *S) { return S->isLazy(); }
266
267
  // Returns an object file for this symbol, or a nullptr if the file
268
  // was already returned.
269
  InputFile *fetch();
270
271
protected:
272
  Lazy(Kind K, InputFile &File, StringRef Name, uint8_t Type)
273
      : Symbol(K, &File, Name, llvm::ELF::STB_GLOBAL, llvm::ELF::STV_DEFAULT,
274
38
               Type) {}
275
};
276
277
// This class represents a symbol defined in an archive file. It is
278
// created from an archive file header, and it knows how to load an
279
// object file from an archive to replace itself with a defined
280
// symbol.
281
class LazyArchive : public Lazy {
282
public:
283
  LazyArchive(InputFile &File, const llvm::object::Archive::Symbol S,
284
              uint8_t Type)
285
33
      : Lazy(LazyArchiveKind, File, S.getName(), Type), Sym(S) {}
286
287
8
  static bool classof(const Symbol *S) { return S->kind() == LazyArchiveKind; }
288
289
  ArchiveFile &getFile();
290
  InputFile *fetch();
291
292
private:
293
  const llvm::object::Archive::Symbol Sym;
294
};
295
296
// LazyObject symbols represents symbols in object files between
297
// --start-lib and --end-lib options.
298
class LazyObject : public Lazy {
299
public:
300
  LazyObject(InputFile &File, StringRef Name, uint8_t Type)
301
5
      : Lazy(LazyObjectKind, File, Name, Type) {}
302
303
0
  static bool classof(const Symbol *S) { return S->kind() == LazyObjectKind; }
304
305
  LazyObjFile &getFile();
306
  InputFile *fetch();
307
};
308
309
// Some linker-generated symbols need to be created as
310
// Defined symbols.
311
struct ElfSym {
312
  // __bss_start
313
  static Defined *Bss;
314
315
  // etext and _etext
316
  static Defined *Etext1;
317
  static Defined *Etext2;
318
319
  // edata and _edata
320
  static Defined *Edata1;
321
  static Defined *Edata2;
322
323
  // end and _end
324
  static Defined *End1;
325
  static Defined *End2;
326
327
  // The _GLOBAL_OFFSET_TABLE_ symbol is defined by target convention to
328
  // be at some offset from the base of the .got section, usually 0 or
329
  // the end of the .got.
330
  static Defined *GlobalOffsetTable;
331
332
  // _gp, _gp_disp and __gnu_local_gp symbols. Only for MIPS.
333
  static Defined *MipsGp;
334
  static Defined *MipsGpDisp;
335
  static Defined *MipsLocalGp;
336
};
337
338
// A buffer class that is large enough to hold any Symbol-derived
339
// object. We allocate memory using this class and instantiate a symbol
340
// using the placement new.
341
union SymbolUnion {
342
  alignas(Defined) char A[sizeof(Defined)];
343
  alignas(Undefined) char C[sizeof(Undefined)];
344
  alignas(SharedSymbol) char D[sizeof(SharedSymbol)];
345
  alignas(LazyArchive) char E[sizeof(LazyArchive)];
346
  alignas(LazyObject) char F[sizeof(LazyObject)];
347
};
348
349
void printTraceSymbol(Symbol *Sym);
350
351
template <typename T, typename... ArgT>
352
13.5k
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
13.5k
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
13.5k
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
13.5k
                "SymbolUnion not aligned enough");
356
13.5k
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
13.5k
         "Not a Symbol");
358
13.5k
359
13.5k
  Symbol Sym = *S;
360
13.5k
361
13.5k
  new (S) T(std::forward<ArgT>(Arg)...);
362
13.5k
363
13.5k
  S->VersionId = Sym.VersionId;
364
13.5k
  S->Visibility = Sym.Visibility;
365
13.5k
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
13.5k
  S->ExportDynamic = Sym.ExportDynamic;
367
13.5k
  S->CanInline = Sym.CanInline;
368
13.5k
  S->Traced = Sym.Traced;
369
13.5k
  S->InVersionScript = Sym.InVersionScript;
370
13.5k
371
13.5k
  // Print out a log message if --trace-symbol was specified.
372
13.5k
  // This is for debugging.
373
13.5k
  if (S->Traced)
374
30
    printTraceSymbol(S);
375
13.5k
}
LTO.cpp:void lld::elf::replaceSymbol<lld::elf::Undefined, std::nullptr_t, llvm::StringRef, llvm::ELF::$_3, llvm::ELF::$_4, unsigned char&>(lld::elf::Symbol*, std::nullptr_t&&, llvm::StringRef&&, llvm::ELF::$_3&&, llvm::ELF::$_4&&, unsigned char&&&)
Line
Count
Source
352
96
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
96
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
96
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
96
                "SymbolUnion not aligned enough");
356
96
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
96
         "Not a Symbol");
358
96
359
96
  Symbol Sym = *S;
360
96
361
96
  new (S) T(std::forward<ArgT>(Arg)...);
362
96
363
96
  S->VersionId = Sym.VersionId;
364
96
  S->Visibility = Sym.Visibility;
365
96
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
96
  S->ExportDynamic = Sym.ExportDynamic;
367
96
  S->CanInline = Sym.CanInline;
368
96
  S->Traced = Sym.Traced;
369
96
  S->InVersionScript = Sym.InVersionScript;
370
96
371
96
  // Print out a log message if --trace-symbol was specified.
372
96
  // This is for debugging.
373
96
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
96
}
LinkerScript.cpp:void lld::elf::replaceSymbol<lld::elf::Defined, std::nullptr_t, llvm::StringRef&, llvm::ELF::$_1, unsigned char&, llvm::ELF::$_2, unsigned long long&, int, lld::elf::SectionBase*&>(lld::elf::Symbol*, std::nullptr_t&&, llvm::StringRef&&&, llvm::ELF::$_1&&, unsigned char&&&, llvm::ELF::$_2&&, unsigned long long&&&, int&&, lld::elf::SectionBase*&&&)
Line
Count
Source
352
87
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
87
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
87
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
87
                "SymbolUnion not aligned enough");
356
87
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
87
         "Not a Symbol");
358
87
359
87
  Symbol Sym = *S;
360
87
361
87
  new (S) T(std::forward<ArgT>(Arg)...);
362
87
363
87
  S->VersionId = Sym.VersionId;
364
87
  S->Visibility = Sym.Visibility;
365
87
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
87
  S->ExportDynamic = Sym.ExportDynamic;
367
87
  S->CanInline = Sym.CanInline;
368
87
  S->Traced = Sym.Traced;
369
87
  S->InVersionScript = Sym.InVersionScript;
370
87
371
87
  // Print out a log message if --trace-symbol was specified.
372
87
  // This is for debugging.
373
87
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
87
}
void lld::elf::replaceSymbol<lld::elf::Defined, lld::elf::InputFile*, llvm::StringRef&, unsigned char&, unsigned char&, unsigned char&, int, unsigned long long&, lld::elf::BssSection*&>(lld::elf::Symbol*, lld::elf::InputFile*&&, llvm::StringRef&&&, unsigned char&&&, unsigned char&&&, unsigned char&&&, int&&, unsigned long long&&&, lld::elf::BssSection*&&&)
Line
Count
Source
352
62
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
62
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
62
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
62
                "SymbolUnion not aligned enough");
356
62
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
62
         "Not a Symbol");
358
62
359
62
  Symbol Sym = *S;
360
62
361
62
  new (S) T(std::forward<ArgT>(Arg)...);
362
62
363
62
  S->VersionId = Sym.VersionId;
364
62
  S->Visibility = Sym.Visibility;
365
62
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
62
  S->ExportDynamic = Sym.ExportDynamic;
367
62
  S->CanInline = Sym.CanInline;
368
62
  S->Traced = Sym.Traced;
369
62
  S->InVersionScript = Sym.InVersionScript;
370
62
371
62
  // Print out a log message if --trace-symbol was specified.
372
62
  // This is for debugging.
373
62
  if (S->Traced)
374
4
    printTraceSymbol(S);
375
62
}
void lld::elf::replaceSymbol<lld::elf::Defined, lld::elf::InputFile*&, llvm::StringRef&, unsigned char&, unsigned char&, unsigned char&, unsigned long long&, unsigned long long&, lld::elf::SectionBase*&>(lld::elf::Symbol*, lld::elf::InputFile*&&&, llvm::StringRef&&&, unsigned char&&&, unsigned char&&&, unsigned char&&&, unsigned long long&&&, unsigned long long&&&, lld::elf::SectionBase*&&&)
Line
Count
Source
352
12.2k
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
12.2k
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
12.2k
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
12.2k
                "SymbolUnion not aligned enough");
356
12.2k
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
12.2k
         "Not a Symbol");
358
12.2k
359
12.2k
  Symbol Sym = *S;
360
12.2k
361
12.2k
  new (S) T(std::forward<ArgT>(Arg)...);
362
12.2k
363
12.2k
  S->VersionId = Sym.VersionId;
364
12.2k
  S->Visibility = Sym.Visibility;
365
12.2k
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
12.2k
  S->ExportDynamic = Sym.ExportDynamic;
367
12.2k
  S->CanInline = Sym.CanInline;
368
12.2k
  S->Traced = Sym.Traced;
369
12.2k
  S->InVersionScript = Sym.InVersionScript;
370
12.2k
371
12.2k
  // Print out a log message if --trace-symbol was specified.
372
12.2k
  // This is for debugging.
373
12.2k
  if (S->Traced)
374
12
    printTraceSymbol(S);
375
12.2k
}
void lld::elf::replaceSymbol<lld::elf::Defined, lld::elf::BitcodeFile*, llvm::StringRef&, unsigned char&, unsigned char&, unsigned char&, int, int, std::nullptr_t>(lld::elf::Symbol*, lld::elf::BitcodeFile*&&, llvm::StringRef&&&, unsigned char&&&, unsigned char&&&, unsigned char&&&, int&&, int&&, std::nullptr_t&&)
Line
Count
Source
352
97
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
97
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
97
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
97
                "SymbolUnion not aligned enough");
356
97
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
97
         "Not a Symbol");
358
97
359
97
  Symbol Sym = *S;
360
97
361
97
  new (S) T(std::forward<ArgT>(Arg)...);
362
97
363
97
  S->VersionId = Sym.VersionId;
364
97
  S->Visibility = Sym.Visibility;
365
97
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
97
  S->ExportDynamic = Sym.ExportDynamic;
367
97
  S->CanInline = Sym.CanInline;
368
97
  S->Traced = Sym.Traced;
369
97
  S->InVersionScript = Sym.InVersionScript;
370
97
371
97
  // Print out a log message if --trace-symbol was specified.
372
97
  // This is for debugging.
373
97
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
97
}
void lld::elf::replaceSymbol<lld::elf::Undefined, lld::elf::InputFile*&, llvm::StringRef&, unsigned char&, unsigned char&, unsigned char&>(lld::elf::Symbol*, lld::elf::InputFile*&&&, llvm::StringRef&&&, unsigned char&&&, unsigned char&&&, unsigned char&&&)
Line
Count
Source
352
522
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
522
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
522
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
522
                "SymbolUnion not aligned enough");
356
522
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
522
         "Not a Symbol");
358
522
359
522
  Symbol Sym = *S;
360
522
361
522
  new (S) T(std::forward<ArgT>(Arg)...);
362
522
363
522
  S->VersionId = Sym.VersionId;
364
522
  S->Visibility = Sym.Visibility;
365
522
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
522
  S->ExportDynamic = Sym.ExportDynamic;
367
522
  S->CanInline = Sym.CanInline;
368
522
  S->Traced = Sym.Traced;
369
522
  S->InVersionScript = Sym.InVersionScript;
370
522
371
522
  // Print out a log message if --trace-symbol was specified.
372
522
  // This is for debugging.
373
522
  if (S->Traced)
374
9
    printTraceSymbol(S);
375
522
}
void lld::elf::replaceSymbol<lld::elf::LazyArchive, lld::elf::ArchiveFile&, llvm::object::Archive::Symbol const&, lld::elf::Symbol::'unnamed'>(lld::elf::Symbol*, lld::elf::ArchiveFile&&&, llvm::object::Archive::Symbol const&&&, lld::elf::Symbol::'unnamed'&&)
Line
Count
Source
352
27
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
27
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
27
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
27
                "SymbolUnion not aligned enough");
356
27
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
27
         "Not a Symbol");
358
27
359
27
  Symbol Sym = *S;
360
27
361
27
  new (S) T(std::forward<ArgT>(Arg)...);
362
27
363
27
  S->VersionId = Sym.VersionId;
364
27
  S->Visibility = Sym.Visibility;
365
27
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
27
  S->ExportDynamic = Sym.ExportDynamic;
367
27
  S->CanInline = Sym.CanInline;
368
27
  S->Traced = Sym.Traced;
369
27
  S->InVersionScript = Sym.InVersionScript;
370
27
371
27
  // Print out a log message if --trace-symbol was specified.
372
27
  // This is for debugging.
373
27
  if (S->Traced)
374
1
    printTraceSymbol(S);
375
27
}
void lld::elf::replaceSymbol<lld::elf::LazyArchive, lld::elf::ArchiveFile&, llvm::object::Archive::Symbol const&, unsigned char&>(lld::elf::Symbol*, lld::elf::ArchiveFile&&&, llvm::object::Archive::Symbol const&&&, unsigned char&&&)
Line
Count
Source
352
6
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
6
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
6
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
6
                "SymbolUnion not aligned enough");
356
6
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
6
         "Not a Symbol");
358
6
359
6
  Symbol Sym = *S;
360
6
361
6
  new (S) T(std::forward<ArgT>(Arg)...);
362
6
363
6
  S->VersionId = Sym.VersionId;
364
6
  S->Visibility = Sym.Visibility;
365
6
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
6
  S->ExportDynamic = Sym.ExportDynamic;
367
6
  S->CanInline = Sym.CanInline;
368
6
  S->Traced = Sym.Traced;
369
6
  S->InVersionScript = Sym.InVersionScript;
370
6
371
6
  // Print out a log message if --trace-symbol was specified.
372
6
  // This is for debugging.
373
6
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
6
}
void lld::elf::replaceSymbol<lld::elf::LazyObject, lld::elf::LazyObjFile&, llvm::StringRef&, lld::elf::Symbol::'unnamed'>(lld::elf::Symbol*, lld::elf::LazyObjFile&&&, llvm::StringRef&&&, lld::elf::Symbol::'unnamed'&&)
Line
Count
Source
352
5
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
5
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
5
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
5
                "SymbolUnion not aligned enough");
356
5
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
5
         "Not a Symbol");
358
5
359
5
  Symbol Sym = *S;
360
5
361
5
  new (S) T(std::forward<ArgT>(Arg)...);
362
5
363
5
  S->VersionId = Sym.VersionId;
364
5
  S->Visibility = Sym.Visibility;
365
5
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
5
  S->ExportDynamic = Sym.ExportDynamic;
367
5
  S->CanInline = Sym.CanInline;
368
5
  S->Traced = Sym.Traced;
369
5
  S->InVersionScript = Sym.InVersionScript;
370
5
371
5
  // Print out a log message if --trace-symbol was specified.
372
5
  // This is for debugging.
373
5
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
5
}
Unexecuted instantiation: void lld::elf::replaceSymbol<lld::elf::LazyObject, lld::elf::LazyObjFile&, llvm::StringRef&, unsigned char&>(lld::elf::Symbol*, lld::elf::LazyObjFile&&&, llvm::StringRef&&&, unsigned char&&&)
void lld::elf::replaceSymbol<lld::elf::SharedSymbol, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >&, llvm::StringRef&, unsigned char, unsigned char const&, unsigned char, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1, 1ul> const&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1, 1ul> const&, unsigned int&, unsigned int&>(lld::elf::Symbol*, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >&&&, llvm::StringRef&&&, unsigned char&&, unsigned char const&&&, unsigned char&&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1, 1ul> const&&&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1, 1ul> const&&&, unsigned int&&&, unsigned int&&&)
Line
Count
Source
352
66
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
66
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
66
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
66
                "SymbolUnion not aligned enough");
356
66
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
66
         "Not a Symbol");
358
66
359
66
  Symbol Sym = *S;
360
66
361
66
  new (S) T(std::forward<ArgT>(Arg)...);
362
66
363
66
  S->VersionId = Sym.VersionId;
364
66
  S->Visibility = Sym.Visibility;
365
66
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
66
  S->ExportDynamic = Sym.ExportDynamic;
367
66
  S->CanInline = Sym.CanInline;
368
66
  S->Traced = Sym.Traced;
369
66
  S->InVersionScript = Sym.InVersionScript;
370
66
371
66
  // Print out a log message if --trace-symbol was specified.
372
66
  // This is for debugging.
373
66
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
66
}
void lld::elf::replaceSymbol<lld::elf::SharedSymbol, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >&, llvm::StringRef&, unsigned char, unsigned char const&, unsigned char, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)0, 1ul> const&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)0, 1ul> const&, unsigned int&, unsigned int&>(lld::elf::Symbol*, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >&&&, llvm::StringRef&&&, unsigned char&&, unsigned char const&&&, unsigned char&&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)0, 1ul> const&&&, llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)0, 1ul> const&&&, unsigned int&&&, unsigned int&&&)
Line
Count
Source
352
29
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
29
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
29
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
29
                "SymbolUnion not aligned enough");
356
29
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
29
         "Not a Symbol");
358
29
359
29
  Symbol Sym = *S;
360
29
361
29
  new (S) T(std::forward<ArgT>(Arg)...);
362
29
363
29
  S->VersionId = Sym.VersionId;
364
29
  S->Visibility = Sym.Visibility;
365
29
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
29
  S->ExportDynamic = Sym.ExportDynamic;
367
29
  S->CanInline = Sym.CanInline;
368
29
  S->Traced = Sym.Traced;
369
29
  S->InVersionScript = Sym.InVersionScript;
370
29
371
29
  // Print out a log message if --trace-symbol was specified.
372
29
  // This is for debugging.
373
29
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
29
}
void lld::elf::replaceSymbol<lld::elf::SharedSymbol, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >&, llvm::StringRef&, unsigned char, unsigned char const&, unsigned char, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)1, 1ul> const&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)1, 1ul> const&, unsigned int&, unsigned int&>(lld::elf::Symbol*, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >&&&, llvm::StringRef&&&, unsigned char&&, unsigned char const&&&, unsigned char&&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)1, 1ul> const&&&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)1, 1ul> const&&&, unsigned int&&&, unsigned int&&&)
Line
Count
Source
352
224
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
224
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
224
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
224
                "SymbolUnion not aligned enough");
356
224
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
224
         "Not a Symbol");
358
224
359
224
  Symbol Sym = *S;
360
224
361
224
  new (S) T(std::forward<ArgT>(Arg)...);
362
224
363
224
  S->VersionId = Sym.VersionId;
364
224
  S->Visibility = Sym.Visibility;
365
224
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
224
  S->ExportDynamic = Sym.ExportDynamic;
367
224
  S->CanInline = Sym.CanInline;
368
224
  S->Traced = Sym.Traced;
369
224
  S->InVersionScript = Sym.InVersionScript;
370
224
371
224
  // Print out a log message if --trace-symbol was specified.
372
224
  // This is for debugging.
373
224
  if (S->Traced)
374
4
    printTraceSymbol(S);
375
224
}
void lld::elf::replaceSymbol<lld::elf::SharedSymbol, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >&, llvm::StringRef&, unsigned char, unsigned char const&, unsigned char, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)0, 1ul> const&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)0, 1ul> const&, unsigned int&, unsigned int&>(lld::elf::Symbol*, lld::elf::SharedFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >&&&, llvm::StringRef&&&, unsigned char&&, unsigned char const&&&, unsigned char&&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)0, 1ul> const&&&, llvm::support::detail::packed_endian_specific_integral<unsigned long long, (llvm::support::endianness)0, 1ul> const&&&, unsigned int&&&, unsigned int&&&)
Line
Count
Source
352
12
void replaceSymbol(Symbol *S, ArgT &&... Arg) {
353
12
  static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
354
12
  static_assert(alignof(T) <= alignof(SymbolUnion),
355
12
                "SymbolUnion not aligned enough");
356
12
  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
357
12
         "Not a Symbol");
358
12
359
12
  Symbol Sym = *S;
360
12
361
12
  new (S) T(std::forward<ArgT>(Arg)...);
362
12
363
12
  S->VersionId = Sym.VersionId;
364
12
  S->Visibility = Sym.Visibility;
365
12
  S->IsUsedInRegularObj = Sym.IsUsedInRegularObj;
366
12
  S->ExportDynamic = Sym.ExportDynamic;
367
12
  S->CanInline = Sym.CanInline;
368
12
  S->Traced = Sym.Traced;
369
12
  S->InVersionScript = Sym.InVersionScript;
370
12
371
12
  // Print out a log message if --trace-symbol was specified.
372
12
  // This is for debugging.
373
12
  if (S->Traced)
374
0
    printTraceSymbol(S);
375
12
}
376
} // namespace elf
377
378
std::string toString(const elf::Symbol &B);
379
} // namespace lld
380
381
#endif