MipsRelocationFunctions.h revision cfcb22478ca64c308df58f9abe6fa2dedb213c16
1//===- MipsRelocationFunction.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_MIPS_MIPSRELOCATIONFUNCTIONS_H_
10#define TARGET_MIPS_MIPSRELOCATIONFUNCTIONS_H_
11
12#define DECL_MIPS_APPLY_RELOC_FUNC(Name)                        \
13  static MipsRelocator::Result Name(MipsRelocationInfo& pReloc, \
14                                    MipsRelocator& pParent);
15
16#define DECL_MIPS_APPLY_RELOC_FUNCS   \
17  DECL_MIPS_APPLY_RELOC_FUNC(none)    \
18  DECL_MIPS_APPLY_RELOC_FUNC(abs32)   \
19  DECL_MIPS_APPLY_RELOC_FUNC(rel26)   \
20  DECL_MIPS_APPLY_RELOC_FUNC(hi16)    \
21  DECL_MIPS_APPLY_RELOC_FUNC(lo16)    \
22  DECL_MIPS_APPLY_RELOC_FUNC(gprel16) \
23  DECL_MIPS_APPLY_RELOC_FUNC(got16)   \
24  DECL_MIPS_APPLY_RELOC_FUNC(pc16)    \
25  DECL_MIPS_APPLY_RELOC_FUNC(call16)  \
26  DECL_MIPS_APPLY_RELOC_FUNC(gprel32) \
27  DECL_MIPS_APPLY_RELOC_FUNC(abs64)   \
28  DECL_MIPS_APPLY_RELOC_FUNC(gotdisp) \
29  DECL_MIPS_APPLY_RELOC_FUNC(gotoff)  \
30  DECL_MIPS_APPLY_RELOC_FUNC(gothi16) \
31  DECL_MIPS_APPLY_RELOC_FUNC(gotlo16) \
32  DECL_MIPS_APPLY_RELOC_FUNC(sub)     \
33  DECL_MIPS_APPLY_RELOC_FUNC(jalr)    \
34  DECL_MIPS_APPLY_RELOC_FUNC(pc32)    \
35  DECL_MIPS_APPLY_RELOC_FUNC(pc18_s3) \
36  DECL_MIPS_APPLY_RELOC_FUNC(pc21_s2) \
37  DECL_MIPS_APPLY_RELOC_FUNC(pc19_s2) \
38  DECL_MIPS_APPLY_RELOC_FUNC(pc26_s2) \
39  DECL_MIPS_APPLY_RELOC_FUNC(pchi16) \
40  DECL_MIPS_APPLY_RELOC_FUNC(pclo16) \
41  DECL_MIPS_APPLY_RELOC_FUNC(tlshi16) \
42  DECL_MIPS_APPLY_RELOC_FUNC(tlslo16) \
43  DECL_MIPS_APPLY_RELOC_FUNC(tlsgot)  \
44  DECL_MIPS_APPLY_RELOC_FUNC(unsupported)
45
46#define DECL_MIPS_APPLY_RELOC_FUNC_PTRS \
47  { &none,          0, "R_MIPS_NONE",                  0}, \
48  { &unsupported,   1, "R_MIPS_16",                   16}, \
49  { &abs32,         2, "R_MIPS_32",                   32}, \
50  { &unsupported,   3, "R_MIPS_REL32",                32}, \
51  { &rel26,         4, "R_MIPS_26",                   26}, \
52  { &hi16,          5, "R_MIPS_HI16",                 16}, \
53  { &lo16,          6, "R_MIPS_LO16",                 16}, \
54  { &gprel16,       7, "R_MIPS_GPREL16",              16}, \
55  { &unsupported,   8, "R_MIPS_LITERAL",              16}, \
56  { &got16,         9, "R_MIPS_GOT16",                16}, \
57  { &pc16,         10, "R_MIPS_PC16",                 16}, \
58  { &call16,       11, "R_MIPS_CALL16",               16}, \
59  { &gprel32,      12, "R_MIPS_GPREL32",              32}, \
60  { &none,         13, "R_MIPS_UNUSED1",               0}, \
61  { &none,         14, "R_MIPS_UNUSED2",               0}, \
62  { &none,         15, "R_MIPS_UNUSED3",               0}, \
63  { &unsupported,  16, "R_MIPS_SHIFT5",               32}, \
64  { &unsupported,  17, "R_MIPS_SHIFT6",               32}, \
65  { &abs64,        18, "R_MIPS_64",                   64}, \
66  { &gotdisp,      19, "R_MIPS_GOT_DISP",             16}, \
67  { &gotdisp,      20, "R_MIPS_GOT_PAGE",             16}, \
68  { &gotoff,       21, "R_MIPS_GOT_OFST",             16}, \
69  { &gothi16,      22, "R_MIPS_GOT_HI16",             16}, \
70  { &gotlo16,      23, "R_MIPS_GOT_LO16",             16}, \
71  { &sub,          24, "R_MIPS_SUB",                  64}, \
72  { &unsupported,  25, "R_MIPS_INSERT_A",              0}, \
73  { &unsupported,  26, "R_MIPS_INSERT_B",              0}, \
74  { &unsupported,  27, "R_MIPS_DELETE",                0}, \
75  { &unsupported,  28, "R_MIPS_HIGHER",               16}, \
76  { &unsupported,  29, "R_MIPS_HIGHEST",              16}, \
77  { &gothi16,      30, "R_MIPS_CALL_HI16",            16}, \
78  { &gotlo16,      31, "R_MIPS_CALL_LO16",            16}, \
79  { &unsupported,  32, "R_MIPS_SCN_DISP",             32}, \
80  { &unsupported,  33, "R_MIPS_REL16",                 0}, \
81  { &unsupported,  34, "R_MIPS_ADD_IMMEDIATE",         0}, \
82  { &unsupported,  35, "R_MIPS_PJUMP",                 0}, \
83  { &unsupported,  36, "R_MIPS_RELGOT",                0}, \
84  { &jalr,         37, "R_MIPS_JALR",                 32}, \
85  { &unsupported,  38, "R_MIPS_TLS_DTPMOD32",         32}, \
86  { &unsupported,  39, "R_MIPS_TLS_DTPREL32",         32}, \
87  { &unsupported,  40, "R_MIPS_TLS_DTPMOD64",          0}, \
88  { &unsupported,  41, "R_MIPS_TLS_DTPREL64",          0}, \
89  { &tlsgot,       42, "R_MIPS_TLS_GD",               16}, \
90  { &tlsgot,       43, "R_MIPS_TLS_LDM",              16}, \
91  { &tlshi16,      44, "R_MIPS_TLS_DTPREL_HI16",      16}, \
92  { &tlslo16,      45, "R_MIPS_TLS_DTPREL_LO16",      16}, \
93  { &tlsgot,       46, "R_MIPS_TLS_GOTTPREL",         16}, \
94  { &unsupported,  47, "R_MIPS_TLS_TPREL32",          32}, \
95  { &unsupported,  48, "R_MIPS_TLS_TPREL64",           0}, \
96  { &tlshi16,      49, "R_MIPS_TLS_TPREL_HI16",       16}, \
97  { &tlslo16,      50, "R_MIPS_TLS_TPREL_LO16",       16}, \
98  { &unsupported,  51, "R_MIPS_GLOB_DAT",              0}, \
99  { &unsupported,  52, "",                             0}, \
100  { &unsupported,  53, "",                             0}, \
101  { &unsupported,  54, "",                             0}, \
102  { &unsupported,  55, "",                             0}, \
103  { &unsupported,  56, "",                             0}, \
104  { &unsupported,  57, "",                             0}, \
105  { &unsupported,  58, "",                             0}, \
106  { &unsupported,  59, "",                             0}, \
107  { &pc21_s2,      60, "R_MIPS_PC21_S2",              21}, \
108  { &pc26_s2,      61, "R_MIPS_PC26_S2",              26}, \
109  { &pc18_s3,      62, "R_MIPS_PC18_S3",              18}, \
110  { &pc19_s2,      63, "R_MIPS_PC19_S2",              19}, \
111  { &pchi16,       64, "R_MIPS_PCHI16",               16}, \
112  { &pclo16,       65, "R_MIPS_PCLO16",               16}, \
113  { &unsupported,  66, "",                             0}, \
114  { &unsupported,  67, "",                             0}, \
115  { &unsupported,  68, "",                             0}, \
116  { &unsupported,  69, "",                             0}, \
117  { &unsupported,  70, "",                             0}, \
118  { &unsupported,  71, "",                             0}, \
119  { &unsupported,  72, "",                             0}, \
120  { &unsupported,  73, "",                             0}, \
121  { &unsupported,  74, "",                             0}, \
122  { &unsupported,  75, "",                             0}, \
123  { &unsupported,  76, "",                             0}, \
124  { &unsupported,  77, "",                             0}, \
125  { &unsupported,  78, "",                             0}, \
126  { &unsupported,  79, "",                             0}, \
127  { &unsupported,  80, "",                             0}, \
128  { &unsupported,  81, "",                             0}, \
129  { &unsupported,  82, "",                             0}, \
130  { &unsupported,  83, "",                             0}, \
131  { &unsupported,  84, "",                             0}, \
132  { &unsupported,  85, "",                             0}, \
133  { &unsupported,  86, "",                             0}, \
134  { &unsupported,  87, "",                             0}, \
135  { &unsupported,  88, "",                             0}, \
136  { &unsupported,  89, "",                             0}, \
137  { &unsupported,  90, "",                             0}, \
138  { &unsupported,  91, "",                             0}, \
139  { &unsupported,  92, "",                             0}, \
140  { &unsupported,  93, "",                             0}, \
141  { &unsupported,  94, "",                             0}, \
142  { &unsupported,  95, "",                             0}, \
143  { &unsupported,  96, "",                             0}, \
144  { &unsupported,  97, "",                             0}, \
145  { &unsupported,  98, "",                             0}, \
146  { &unsupported,  99, "",                             0}, \
147  { &unsupported, 100, "R_MIPS16_26",                  0}, \
148  { &unsupported, 101, "R_MIPS16_GPREL",               0}, \
149  { &unsupported, 102, "R_MIPS16_GOT16",               0}, \
150  { &unsupported, 103, "R_MIPS16_CALL16",              0}, \
151  { &unsupported, 104, "R_MIPS16_HI16",                0}, \
152  { &unsupported, 105, "R_MIPS16_LO16",                0}, \
153  { &unsupported, 106, "R_MIPS16_TLS_GD",              0}, \
154  { &unsupported, 107, "R_MIPS16_TLS_LDM",             0}, \
155  { &unsupported, 108, "R_MIPS16_TLS_DTPREL_HI16",     0}, \
156  { &unsupported, 109, "R_MIPS16_TLS_DTPREL_LO16",     0}, \
157  { &unsupported, 110, "R_MIPS16_TLS_GOTTPREL",        0}, \
158  { &unsupported, 111, "R_MIPS16_TLS_TPREL_HI16",      0}, \
159  { &unsupported, 112, "R_MIPS16_TLS_TPREL_LO16",      0}, \
160  { &unsupported, 113, "",                             0}, \
161  { &unsupported, 114, "",                             0}, \
162  { &unsupported, 115, "",                             0}, \
163  { &unsupported, 116, "",                             0}, \
164  { &unsupported, 117, "",                             0}, \
165  { &unsupported, 118, "",                             0}, \
166  { &unsupported, 119, "",                             0}, \
167  { &unsupported, 120, "",                             0}, \
168  { &unsupported, 121, "",                             0}, \
169  { &unsupported, 122, "",                             0}, \
170  { &unsupported, 123, "",                             0}, \
171  { &unsupported, 124, "",                             0}, \
172  { &unsupported, 125, "",                             0}, \
173  { &unsupported, 126, "R_MIPS_COPY",                  0}, \
174  { &unsupported, 127, "R_MIPS_JUMP_SLOT",             0}, \
175  { &unsupported, 128, "",                             0}, \
176  { &unsupported, 129, "",                             0}, \
177  { &unsupported, 130, "",                             0}, \
178  { &unsupported, 131, "",                             0}, \
179  { &unsupported, 132, "",                             0}, \
180  { &unsupported, 133, "R_MICROMIPS_26_S1",            0}, \
181  { &unsupported, 134, "R_MICROMIPS_HI16",             0}, \
182  { &unsupported, 135, "R_MICROMIPS_LO16",             0}, \
183  { &unsupported, 136, "R_MICROMIPS_GPREL16",          0}, \
184  { &unsupported, 137, "R_MICROMIPS_LITERAL",          0}, \
185  { &unsupported, 138, "R_MICROMIPS_GOT16",            0}, \
186  { &unsupported, 139, "R_MICROMIPS_PC7_S1",           0}, \
187  { &unsupported, 140, "R_MICROMIPS_PC10_S1",          0}, \
188  { &unsupported, 141, "R_MICROMIPS_PC16_S1",          0}, \
189  { &unsupported, 142, "R_MICROMIPS_CALL16",           0}, \
190  { &unsupported, 143, "R_MICROMIPS_GOT_DISP",         0}, \
191  { &unsupported, 144, "R_MICROMIPS_GOT_PAGE",         0}, \
192  { &unsupported, 145, "R_MICROMIPS_GOT_OFST",         0}, \
193  { &unsupported, 146, "R_MICROMIPS_GOT_HI16",         0}, \
194  { &unsupported, 147, "R_MICROMIPS_GOT_LO16",         0}, \
195  { &unsupported, 148, "R_MICROMIPS_SUB",              0}, \
196  { &unsupported, 149, "R_MICROMIPS_HIGHER",           0}, \
197  { &unsupported, 150, "R_MICROMIPS_HIGHEST",          0}, \
198  { &unsupported, 151, "R_MICROMIPS_CALL_HI16",        0}, \
199  { &unsupported, 152, "R_MICROMIPS_CALL_LO16",        0}, \
200  { &unsupported, 153, "R_MICROMIPS_SCN_DISP",         0}, \
201  { &unsupported, 154, "R_MICROMIPS_JALR",             0}, \
202  { &unsupported, 155, "R_MICROMIPS_HI0_LO16",         0}, \
203  { &unsupported, 156, "",                             0}, \
204  { &unsupported, 157, "",                             0}, \
205  { &unsupported, 158, "",                             0}, \
206  { &unsupported, 159, "",                             0}, \
207  { &unsupported, 160, "",                             0}, \
208  { &unsupported, 161, "",                             0}, \
209  { &unsupported, 162, "R_MICROMIPS_TLS_GD",           0}, \
210  { &unsupported, 163, "R_MICROMIPS_TLS_LDM",          0}, \
211  { &unsupported, 164, "R_MICROMIPS_TLS_DTPREL_HI16",  0}, \
212  { &unsupported, 165, "R_MICROMIPS_TLS_DTPREL_LO16",  0}, \
213  { &unsupported, 166, "R_MICROMIPS_TLS_GOTTPREL",     0}, \
214  { &unsupported, 167, "",                             0}, \
215  { &unsupported, 168, "",                             0}, \
216  { &unsupported, 169, "R_MICROMIPS_TLS_TPREL_HI16",   0}, \
217  { &unsupported, 170, "R_MICROMIPS_TLS_TPREL_LO16",   0}, \
218  { &unsupported, 171, "",                             0}, \
219  { &unsupported, 172, "R_MICROMIPS_GPREL7_S2",        0}, \
220  { &unsupported, 173, "R_MICROMIPS_PC23_S2",          0}, \
221  { &unsupported, 174, "",                             0}, \
222  { &unsupported, 175, "",                             0}, \
223  { &unsupported, 176, "",                             0}, \
224  { &unsupported, 177, "",                             0}, \
225  { &unsupported, 178, "",                             0}, \
226  { &unsupported, 179, "",                             0}, \
227  { &unsupported, 180, "",                             0}, \
228  { &unsupported, 181, "",                             0}, \
229  { &unsupported, 182, "",                             0}, \
230  { &unsupported, 183, "",                             0}, \
231  { &unsupported, 184, "",                             0}, \
232  { &unsupported, 185, "",                             0}, \
233  { &unsupported, 186, "",                             0}, \
234  { &unsupported, 187, "",                             0}, \
235  { &unsupported, 188, "",                             0}, \
236  { &unsupported, 189, "",                             0}, \
237  { &unsupported, 190, "",                             0}, \
238  { &unsupported, 191, "",                             0}, \
239  { &unsupported, 192, "",                             0}, \
240  { &unsupported, 193, "",                             0}, \
241  { &unsupported, 194, "",                             0}, \
242  { &unsupported, 195, "",                             0}, \
243  { &unsupported, 196, "",                             0}, \
244  { &unsupported, 197, "",                             0}, \
245  { &unsupported, 198, "",                             0}, \
246  { &unsupported, 199, "",                             0}, \
247  { &unsupported, 200, "",                             0}, \
248  { &unsupported, 201, "",                             0}, \
249  { &unsupported, 202, "",                             0}, \
250  { &unsupported, 203, "",                             0}, \
251  { &unsupported, 204, "",                             0}, \
252  { &unsupported, 205, "",                             0}, \
253  { &unsupported, 206, "",                             0}, \
254  { &unsupported, 207, "",                             0}, \
255  { &unsupported, 208, "",                             0}, \
256  { &unsupported, 209, "",                             0}, \
257  { &unsupported, 210, "",                             0}, \
258  { &unsupported, 211, "",                             0}, \
259  { &unsupported, 212, "",                             0}, \
260  { &unsupported, 213, "",                             0}, \
261  { &unsupported, 214, "",                             0}, \
262  { &unsupported, 215, "",                             0}, \
263  { &unsupported, 216, "",                             0}, \
264  { &unsupported, 217, "",                             0}, \
265  { &unsupported, 218, "",                             0}, \
266  { &unsupported, 219, "",                             0}, \
267  { &unsupported, 220, "",                             0}, \
268  { &unsupported, 221, "",                             0}, \
269  { &unsupported, 222, "",                             0}, \
270  { &unsupported, 223, "",                             0}, \
271  { &unsupported, 224, "",                             0}, \
272  { &unsupported, 225, "",                             0}, \
273  { &unsupported, 226, "",                             0}, \
274  { &unsupported, 227, "",                             0}, \
275  { &unsupported, 228, "",                             0}, \
276  { &unsupported, 229, "",                             0}, \
277  { &unsupported, 230, "",                             0}, \
278  { &unsupported, 231, "",                             0}, \
279  { &unsupported, 232, "",                             0}, \
280  { &unsupported, 233, "",                             0}, \
281  { &unsupported, 234, "",                             0}, \
282  { &unsupported, 235, "",                             0}, \
283  { &unsupported, 236, "",                             0}, \
284  { &unsupported, 237, "",                             0}, \
285  { &unsupported, 238, "",                             0}, \
286  { &unsupported, 239, "",                             0}, \
287  { &unsupported, 240, "",                             0}, \
288  { &unsupported, 241, "",                             0}, \
289  { &unsupported, 242, "",                             0}, \
290  { &unsupported, 243, "",                             0}, \
291  { &unsupported, 244, "",                             0}, \
292  { &unsupported, 245, "",                             0}, \
293  { &unsupported, 246, "",                             0}, \
294  { &unsupported, 247, "",                             0}, \
295  { &pc32,        248, "R_MIPS_PC32",                 32}, \
296  { &unsupported, 249, "",                             0}, \
297  { &unsupported, 250, "R_MIPS_GNU_REL16_S2",          0}, \
298  { &unsupported, 251, "",                             0}, \
299  { &unsupported, 252, "",                             0}, \
300  { &unsupported, 253, "R_MIPS_GNU_VTINHERIT",         0}, \
301  { &unsupported, 254, "R_MIPS_GNU_VTENTRY",           0}
302
303#endif  // TARGET_MIPS_MIPSRELOCATIONFUNCTIONS_H_
304