]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/COFF/DLL.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303571, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / COFF / DLL.h
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   void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
26   bool empty() { return Imports.empty(); }
27   std::vector<Chunk *> getChunks();
28
29   uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
30   uint64_t getDirSize();
31   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 *> Addresses;
40   std::vector<Chunk *> Hints;
41   std::vector<Chunk *> DLLNames;
42 };
43
44 // Windows-specific.
45 // DelayLoadContents creates all chunks for the delay-load DLL import table.
46 class DelayLoadContents {
47 public:
48   void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
49   bool empty() { return Imports.empty(); }
50   void create(Defined *Helper);
51   std::vector<Chunk *> getChunks();
52   std::vector<Chunk *> getDataChunks();
53   ArrayRef<Chunk *> getCodeChunks() { return Thunks; }
54
55   uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
56   uint64_t getDirSize();
57
58 private:
59   Chunk *newThunkChunk(DefinedImportData *S, Chunk *Dir);
60
61   Defined *Helper;
62   std::vector<DefinedImportData *> Imports;
63   std::vector<Chunk *> Dirs;
64   std::vector<Chunk *> ModuleHandles;
65   std::vector<Chunk *> Addresses;
66   std::vector<Chunk *> Names;
67   std::vector<Chunk *> HintNames;
68   std::vector<Chunk *> Thunks;
69   std::vector<Chunk *> DLLNames;
70 };
71
72 // Windows-specific.
73 // EdataContents creates all chunks for the DLL export table.
74 class EdataContents {
75 public:
76   EdataContents();
77   std::vector<Chunk *> Chunks;
78 };
79
80 } // namespace coff
81 } // namespace lld
82
83 #endif