1//===- X86RelocationFunction.h --------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#ifndef TARGET_X86_X86RELOCATIONFUNCTIONS_H_
10#define TARGET_X86_X86RELOCATIONFUNCTIONS_H_
11
12#define DECL_X86_32_APPLY_RELOC_FUNC(Name)             \
13  static X86Relocator::Result Name(Relocation& pEntry, \
14                                   X86_32Relocator& pParent);
15
16#define DECL_X86_32_APPLY_RELOC_FUNCS      \
17  DECL_X86_32_APPLY_RELOC_FUNC(none)       \
18  DECL_X86_32_APPLY_RELOC_FUNC(abs)        \
19  DECL_X86_32_APPLY_RELOC_FUNC(rel)        \
20  DECL_X86_32_APPLY_RELOC_FUNC(plt32)      \
21  DECL_X86_32_APPLY_RELOC_FUNC(got32)      \
22  DECL_X86_32_APPLY_RELOC_FUNC(gotoff32)   \
23  DECL_X86_32_APPLY_RELOC_FUNC(gotpc32)    \
24  DECL_X86_32_APPLY_RELOC_FUNC(tls_gd)     \
25  DECL_X86_32_APPLY_RELOC_FUNC(tls_ie)     \
26  DECL_X86_32_APPLY_RELOC_FUNC(tls_gotie)  \
27  DECL_X86_32_APPLY_RELOC_FUNC(tls_le)     \
28  DECL_X86_32_APPLY_RELOC_FUNC(tls_ldm)    \
29  DECL_X86_32_APPLY_RELOC_FUNC(tls_ldo_32) \
30  DECL_X86_32_APPLY_RELOC_FUNC(unsupported)
31
32#define DECL_X86_32_APPLY_RELOC_FUNC_PTRS           \
33  { &none,          0, "R_386_NONE",          0  }, \
34  { &abs,           1, "R_386_32",            32 }, \
35  { &rel,           2, "R_386_PC32",          32 }, \
36  { &got32,         3, "R_386_GOT32",         32 }, \
37  { &plt32,         4, "R_386_PLT32",         32 }, \
38  { &none,          5, "R_386_COPY",          0  }, \
39  { &none,          6, "R_386_GLOB_DAT",      0  }, \
40  { &none,          7, "R_386_JMP_SLOT",      0  }, \
41  { &none,          8, "R_386_RELATIVE",      0  }, \
42  { &gotoff32,      9, "R_386_GOTOFF",        32 }, \
43  { &gotpc32,      10, "R_386_GOTPC",         32 }, \
44  { &unsupported,  11, "R_386_32PLT",         0  }, \
45  { &unsupported,  12, "",                    0  }, \
46  { &unsupported,  13, "",                    0  }, \
47  { &unsupported,  14, "R_386_TLS_TPOFF",     0  }, \
48  { &tls_ie,       15, "R_386_TLS_IE",        32 }, \
49  { &tls_gotie,    16, "R_386_TLS_GOTIE",     32 }, \
50  { &tls_le,       17, "R_386_TLS_LE",        32 }, \
51  { &tls_gd,       18, "R_386_TLS_GD",        32 }, \
52  { &tls_ldm,      19, "R_386_TLS_LDM",       32 }, \
53  { &abs,          20, "R_386_16",            16 }, \
54  { &rel,          21, "R_386_PC16",          16 }, \
55  { &abs,          22, "R_386_8",             8  }, \
56  { &rel,          23, "R_386_PC8",           8  }, \
57  { &unsupported,  24, "R_386_TLS_GD_32",     0  }, \
58  { &unsupported,  25, "R_386_TLS_GD_PUSH",   0  }, \
59  { &unsupported,  26, "R_386_TLS_GD_CALL",   0  }, \
60  { &unsupported,  27, "R_386_TLS_GD_POP",    0  }, \
61  { &unsupported,  28, "R_386_TLS_LDM_32",    0  }, \
62  { &unsupported,  29, "R_386_TLS_LDM_PUSH",  0  }, \
63  { &unsupported,  30, "R_386_TLS_LDM_CALL",  0  }, \
64  { &unsupported,  31, "R_386_TLS_LDM_POP",   0  }, \
65  { &tls_ldo_32,   32, "R_386_TLS_LDO_32",    32 }, \
66  { &unsupported,  33, "R_386_TLS_IE_32",     0  }, \
67  { &unsupported,  34, "R_386_TLS_LE_32",     0  }, \
68  { &unsupported,  35, "R_386_TLS_DTPMOD32",  0  }, \
69  { &unsupported,  36, "R_386_TLS_DTPOFF32",  0  }, \
70  { &unsupported,  37, "R_386_TLS_TPOFF32",   0  }, \
71  { &unsupported,  38, "",                    0  }, \
72  { &unsupported,  39, "R_386_TLS_GOTDESC",   0  }, \
73  { &unsupported,  40, "R_386_TLS_DESC_CALL", 0  }, \
74  { &unsupported,  41, "R_386_TLS_DESC",      0  }, \
75  { &unsupported,  42, "R_386_IRELATIVE",     0  }, \
76  { &unsupported,  43, "R_386_NUM",           0  }, \
77  { &none,         44, "R_386_TLS_OPT",       32 }
78
79#define DECL_X86_64_APPLY_RELOC_FUNC(Name)             \
80  static X86Relocator::Result Name(Relocation& pEntry, \
81                                   X86_64Relocator& pParent);
82
83#define DECL_X86_64_APPLY_RELOC_FUNCS    \
84  DECL_X86_64_APPLY_RELOC_FUNC(none)     \
85  DECL_X86_64_APPLY_RELOC_FUNC(abs)      \
86  DECL_X86_64_APPLY_RELOC_FUNC(signed32) \
87  DECL_X86_64_APPLY_RELOC_FUNC(gotpcrel) \
88  DECL_X86_64_APPLY_RELOC_FUNC(plt32)    \
89  DECL_X86_64_APPLY_RELOC_FUNC(rel)      \
90  DECL_X86_64_APPLY_RELOC_FUNC(unsupported)
91
92#define DECL_X86_64_APPLY_RELOC_FUNC_PTRS               \
93  { &none,         0, "R_X86_64_NONE",            0  }, \
94  { &abs,          1, "R_X86_64_64",              64 }, \
95  { &rel,          2, "R_X86_64_PC32",            32 }, \
96  { &unsupported,  3, "R_X86_64_GOT32",           32 }, \
97  { &plt32,        4, "R_X86_64_PLT32",           32 }, \
98  { &none,         5, "R_X86_64_COPY",            0  }, \
99  { &none,         6, "R_X86_64_GLOB_DAT",        0  }, \
100  { &none,         7, "R_X86_64_JMP_SLOT",        0  }, \
101  { &none,         8, "R_X86_64_RELATIVE",        0  }, \
102  { &gotpcrel,     9, "R_X86_64_GOTPCREL",        32 }, \
103  { &abs,         10, "R_X86_64_32",              32 }, \
104  { &signed32,    11, "R_X86_64_32S",             32 }, \
105  { &abs,         12, "R_X86_64_16",              16 }, \
106  { &rel,         13, "R_X86_64_PC16",            16 }, \
107  { &abs,         14, "R_X86_64_8",               8  }, \
108  { &rel,         15, "R_X86_64_PC8",             8  }, \
109  { &none,        16, "R_X86_64_DTPMOD64",        0  }, \
110  { &unsupported, 17, "R_X86_64_DTPOFF64",        0  }, \
111  { &none,        18, "R_X86_64_TPOFF64",         0  }, \
112  { &unsupported, 19, "R_X86_64_TLSGD",           0  }, \
113  { &unsupported, 20, "R_X86_64_TLSLD",           0  }, \
114  { &unsupported, 21, "R_X86_64_DTPOFF32",        0  }, \
115  { &unsupported, 22, "R_X86_64_GOTTPOFF",        0  }, \
116  { &unsupported, 23, "R_X86_64_TPOFF32",         0  }, \
117  { &unsupported, 24, "R_X86_64_PC64",            64 }, \
118  { &unsupported, 25, "R_X86_64_GOTOFF64",        64 }, \
119  { &unsupported, 26, "R_X86_64_GOTPC32",         32 }, \
120  { &unsupported, 27, "R_X86_64_GOT64",           64 }, \
121  { &unsupported, 28, "R_X86_64_GOTPCREL64",      64 }, \
122  { &unsupported, 29, "R_X86_64_GOTPC64",         64 }, \
123  { &unsupported, 30, "R_X86_64_GOTPLT64",        64 }, \
124  { &unsupported, 31, "R_X86_64_PLTOFF64",        64 }, \
125  { &unsupported, 32, "R_X86_64_SIZE32",          32 }, \
126  { &unsupported, 33, "R_X86_64_SIZE64",          64 }, \
127  { &unsupported, 34, "R_X86_64_GOTPC32_TLSDESC", 0  }, \
128  { &unsupported, 35, "R_X86_64_TLSDESC_CALL",    0  }, \
129  { &none,        36, "R_X86_64_TLSDESC",         0  }, \
130  { &none,        37, "R_X86_64_IRELATIVE",       0  }, \
131  { &none,        38, "R_X86_64_RELATIVE64",      0  }
132
133#endif  // TARGET_X86_X86RELOCATIONFUNCTIONS_H_
134