Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/lld/COFF/DLL.h
Line
Count
Source
1
//===- DLL.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_COFF_DLL_H
11
#define LLD_COFF_DLL_H
12
13
#include "Chunks.h"
14
#include "Symbols.h"
15
16
namespace lld {
17
namespace coff {
18
19
// Windows-specific.
20
// IdataContents creates all chunks for the DLL import table.
21
// You are supposed to call add() to add symbols and then
22
// call getChunks() to get a list of chunks.
23
class IdataContents {
24
public:
25
56
  void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
26
288
  bool empty() { return Imports.empty(); }
27
  std::vector<Chunk *> getChunks();
28
29
26
  uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
30
  uint64_t getDirSize();
31
26
  uint64_t getIATRVA() { return Addresses[0]->getRVA(); }
32
  uint64_t getIATSize();
33
34
private:
35
  void create();
36
37
  std::vector<DefinedImportData *> Imports;
38
  std::vector<Chunk *> Dirs;
39
  std::vector<Chunk *> Lookups;
40
  std::vector<Chunk *> Addresses;
41
  std::vector<Chunk *> Hints;
42
  std::vector<Chunk *> DLLNames;
43
};
44
45
// Windows-specific.
46
// DelayLoadContents creates all chunks for the delay-load DLL import table.
47
class DelayLoadContents {
48
public:
49
6
  void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
50
288
  bool empty() { return Imports.empty(); }
51
  void create(Defined *Helper);
52
  std::vector<Chunk *> getChunks();
53
  std::vector<Chunk *> getDataChunks();
54
3
  ArrayRef<Chunk *> getCodeChunks() { return Thunks; }
55
56
3
  uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
57
  uint64_t getDirSize();
58
59
private:
60
  Chunk *newThunkChunk(DefinedImportData *S, Chunk *Dir);
61
62
  Defined *Helper;
63
  std::vector<DefinedImportData *> Imports;
64
  std::vector<Chunk *> Dirs;
65
  std::vector<Chunk *> ModuleHandles;
66
  std::vector<Chunk *> Addresses;
67
  std::vector<Chunk *> Names;
68
  std::vector<Chunk *> HintNames;
69
  std::vector<Chunk *> Thunks;
70
  std::vector<Chunk *> DLLNames;
71
};
72
73
// Windows-specific.
74
// EdataContents creates all chunks for the DLL export table.
75
class EdataContents {
76
public:
77
  EdataContents();
78
  std::vector<Chunk *> Chunks;
79
};
80
81
} // namespace coff
82
} // namespace lld
83
84
#endif