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