xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_reloc_arm.h (revision 0ae0ab6f6ac7a567d495b1daad2f6e229d097a21)
1 /*
2   Copyright (C) 2007-2012 David Anderson. All Rights Reserved.
3   Portions Copyright (C) 2012 SN Systems Ltd. All rights reserved.
4 
5   This program is free software; you can redistribute it and/or modify it
6   under the terms of version 2.1 of the GNU Lesser General Public License
7   as published by the Free Software Foundation.
8 
9   This program is distributed in the hope that it would be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13   Further, this software is distributed without any warranty that it is
14   free of the rightful claim of any third person regarding infringement
15   or the like.  Any license provided herein, whether implied or
16   otherwise, applies only to this software file.  Patent licenses, if
17   any, provided herein do not apply to combinations of this program with
18   other software, or any other product whatsoever.
19 
20   You should have received a copy of the GNU Lesser General Public License along
21   with this program; if not, write the Free Software Foundation, Inc., 51
22   Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
23 */
24 
25 #ifndef DWARF_RELOC_ARM_H
26 #define DWARF_RELOC_ARM_H
27 
28 /* Definitions for ARM */
29 #define DWARF_RELOC_ARM
30 
31 #ifndef EM_AARCH64
32 #define EM_AARCH64 183  /* Arm 64 */
33 #endif
34 
35 
36 /* Include the definitions only in the case of Windows */
37 #ifdef _WIN32
38 /* Relocation types for ARM */
39 #define R_ARM_NONE                    0
40 #define R_ARM_PC24                    1
41 #define R_ARM_ABS32                   2
42 #define R_ARM_REL32                   3
43 #define R_ARM_LDR_PC_G0               4
44 #define R_ARM_ABS16                   5
45 #define R_ARM_ABS12                   6
46 #define R_ARM_THM_ABS5                7
47 #define R_ARM_ABS8                    8
48 #define R_ARM_SBREL32                 9
49 #define R_ARM_THM_CALL               10
50 #define R_ARM_THM_PC8                11
51 #define R_ARM_BREL_ADJ               12
52 #define R_ARM_TLS_DESC               13
53 #define R_ARM_THM_SWI8               14
54 #define R_ARM_XPC25                  15
55 #define R_ARM_THM_XPC22              16
56 #define R_ARM_TLS_DTPMOD32           17
57 #define R_ARM_TLS_DTPOFF32           18
58 #define R_ARM_TLS_TPOFF32            19
59 #define R_ARM_COPY                   20
60 #define R_ARM_GLOB_DAT               21
61 #define R_ARM_JUMP_SLOT              22
62 #define R_ARM_RELATIVE               23
63 #define R_ARM_GOTOFF32               24
64 #define R_ARM_BASE_PREL              25
65 #define R_ARM_GOT_BREL               26
66 #define R_ARM_PLT32                  27
67 #define R_ARM_CALL                   28
68 #define R_ARM_JUMP24                 29
69 #define R_ARM_THM_JUMP24             30
70 #define R_ARM_BASE_ABS               31
71 #define R_ARM_ALU_PCREL_7_0          32
72 #define R_ARM_ALU_PCREL_15_8         33
73 #define R_ARM_ALU_PCREL_23_15        34
74 #define R_ARM_LDR_SBREL_11_0_NC      35
75 #define R_ARM_ALU_SBREL_19_12_NC     36
76 #define R_ARM_ALU_SBREL_27_20_CK     37
77 #define R_ARM_TARGET1                38
78 #define R_ARM_SBREL31                39
79 #define R_ARM_V4BX                   40
80 #define R_ARM_TARGET2                41
81 #define R_ARM_PREL31                 42
82 #define R_ARM_MOVW_ABS_NC            43
83 #define R_ARM_MOVT_ABS               44
84 #define R_ARM_MOVW_PREL_NC           45
85 #define R_ARM_MOVT_PREL              46
86 #define R_ARM_THM_MOVW_ABS_NC        47
87 #define R_ARM_THM_MOVT_ABS           48
88 #define R_ARM_THM_MOVW_PREL_NC       49
89 #define R_ARM_THM_MOVT_PREL          50
90 #define R_ARM_THM_JUMP19             51
91 #define R_ARM_THM_JUMP6              52
92 #define R_ARM_THM_ALU_PREL_11_0      53
93 #define R_ARM_THM_PC12               54
94 #define R_ARM_ABS32_NOI              55
95 #define R_ARM_REL32_NOI              56
96 #define R_ARM_ALU_PC_G0_NC           57
97 #define R_ARM_ALU_PC_G0              58
98 #define R_ARM_ALU_PC_G1_NC           59
99 #define R_ARM_ALU_PC_G1              60
100 #define R_ARM_ALU_PC_G2              61
101 #define R_ARM_LDR_PC_G1              62
102 #define R_ARM_LDR_PC_G2              63
103 #define R_ARM_LDRS_PC_G0             64
104 #define R_ARM_LDRS_PC_G1             65
105 #define R_ARM_LDRS_PC_G2             66
106 #define R_ARM_LDC_PC_G0              67
107 #define R_ARM_LDC_PC_G1              68
108 #define R_ARM_LDC_PC_G2              69
109 #define R_ARM_ALU_SB_G0_NC           70
110 #define R_ARM_ALU_SB_G0              71
111 #define R_ARM_ALU_SB_G1_NC           72
112 #define R_ARM_ALU_SB_G1              73
113 #define R_ARM_ALU_SB_G2              74
114 #define R_ARM_LDR_SB_G0              75
115 #define R_ARM_LDR_SB_G1              76
116 #define R_ARM_LDR_SB_G2              77
117 #define R_ARM_LDRS_SB_G0             78
118 #define R_ARM_LDRS_SB_G1             79
119 #define R_ARM_LDRS_SB_G2             80
120 #define R_ARM_LDC_SB_G0              81
121 #define R_ARM_LDC_SB_G1              82
122 #define R_ARM_LDC_SB_G2              83
123 #define R_ARM_MOVW_BREL_NC           84
124 #define R_ARM_MOVT_BREL              85
125 #define R_ARM_MOVW_BREL              86
126 #define R_ARM_THM_MOVW_BREL_NC       87
127 #define R_ARM_THM_MOVT_BREL          88
128 #define R_ARM_THM_MOVW_BREL          89
129 #define R_ARM_TLS_GOTDESC            90
130 #define R_ARM_TLS_CALL               91
131 #define R_ARM_TLS_DESCSEQ            92
132 #define R_ARM_THM_TLS_CALL           93
133 #define R_ARM_PLT32_ABS              94
134 #define R_ARM_GOT_ABS                95
135 #define R_ARM_GOT_PREL               96
136 #define R_ARM_GOT_BREL12             97
137 #define R_ARM_GOTOFF12               98
138 #define R_ARM_GOTRELAX               99
139 #define R_ARM_GNU_VTENTRY           100
140 #define R_ARM_GNU_VTINHERIT         101
141 #define R_ARM_THM_JUMP11            102
142 #define R_ARM_THM_JUMP8             103
143 #define R_ARM_TLS_GD32              104
144 #define R_ARM_TLS_LDM32             105
145 #define R_ARM_TLS_LDO32             106
146 #define R_ARM_TLS_IE32              107
147 #define R_ARM_TLS_LE32              108
148 #define R_ARM_TLS_LDO12             109
149 #define R_ARM_TLS_LE12              110
150 #define R_ARM_TLS_IE12GP            111
151 #define R_ARM_ME_TOO                128
152 #define R_ARM_THM_TLS_DESCSEQ16     129
153 #define R_ARM_THM_TLS_DESCSEQ32     130
154 #define R_ARM_RXPC25                249
155 #define R_ARM_RSBREL32              250
156 #define R_ARM_THM_RPC22             251
157 #define R_ARM_RREL32                252
158 #define R_ARM_RABS32                253
159 #define R_ARM_RPC24                 254
160 #define R_ARM_RBASE                 255
161 
162 /*  Keep this the last entry.  */
163 #define R_ARM_NUM                   256
164 #endif /* _WIN32 */
165 
166 /* ARM relocations defined by the ABIs */
167 static const char *reloc_type_names_ARM[] = {
168     "R_ARM_NONE",                 /*  00 */
169     "R_ARM_PC24",                 /*  01 */
170     "R_ARM_ABS32",                /*  02 */
171     "R_ARM_REL32",                /*  03 */
172     "R_ARM_LDR_PC_G0",            /*  04 */
173     "R_ARM_ABS16",                /*  05 */
174     "R_ARM_ABS12",                /*  06 */
175     "R_ARM_THM_ABS5",             /*  07 */
176     "R_ARM_ABS8",                 /*  08 */
177     "R_ARM_SBREL32",              /*  09 */
178     "R_ARM_THM_CALL",             /*  10 */
179     "R_ARM_THM_PC8",              /*  11 */
180     "R_ARM_BREL_ADJ",             /*  12 */
181     "R_ARM_TLS_DESC",             /*  13 */
182     "R_ARM_THM_SWI8",             /*  14 */
183     "R_ARM_XPC25",                /*  15 */
184     "R_ARM_THM_XPC22",            /*  16 */
185     "R_ARM_TLS_DTPMOD32",         /*  17 */
186     "R_ARM_TLS_DTPOFF32",         /*  18 */
187     "R_ARM_TLS_TPOFF32",          /*  19 */
188     "R_ARM_COPY",                 /*  20 */
189     "R_ARM_GLOB_DAT",             /*  21 */
190     "R_ARM_JUMP_SLOT",            /*  22 */
191     "R_ARM_RELATIVE",             /*  23 */
192     "R_ARM_GOTOFF32",             /*  24 */
193     "R_ARM_BASE_PREL",            /*  25 */
194     "R_ARM_GOT_BREL",             /*  26 */
195     "R_ARM_PLT32",                /*  27 */
196     "R_ARM_CALL",                 /*  28 */
197     "R_ARM_JUMP24",               /*  29 */
198     "R_ARM_THM_JUMP24",           /*  30 */
199     "R_ARM_BASE_ABS",             /*  31 */
200     "R_ARM_ALU_PCREL_7_0",        /*  32 */
201     "R_ARM_ALU_PCREL_15_8",       /*  33 */
202     "R_ARM_ALU_PCREL_23_15",      /*  34 */
203     "R_ARM_LDR_SBREL_11_0_NC",    /*  35 */
204     "R_ARM_ALU_SBREL_19_12_NC",   /*  36 */
205     "R_ARM_ALU_SBREL_27_20_CK",   /*  37 */
206     "R_ARM_TARGET1",              /*  38 */
207     "R_ARM_SBREL31",              /*  39 */
208     "R_ARM_V4BX",                 /*  40 */
209     "R_ARM_TARGET2",              /*  41 */
210     "R_ARM_PREL31",               /*  42 */
211     "R_ARM_MOVW_ABS_NC",          /*  43 */
212     "R_ARM_MOVT_ABS",             /*  44 */
213     "R_ARM_MOVW_PREL_NC",         /*  45 */
214     "R_ARM_MOVT_PREL",            /*  46 */
215     "R_ARM_THM_MOVW_ABS_NC",      /*  47 */
216     "R_ARM_THM_MOVT_ABS",         /*  48 */
217     "R_ARM_THM_MOVW_PREL_NC",     /*  49 */
218     "R_ARM_THM_MOVT_PREL",        /*  50 */
219     "R_ARM_THM_JUMP19",           /*  51 */
220     "R_ARM_THM_JUMP6",            /*  52 */
221     "R_ARM_THM_ALU_PREL_11_0",    /*  53 */
222     "R_ARM_THM_PC12",             /*  54 */
223     "R_ARM_ABS32_NOI",            /*  55 */
224     "R_ARM_REL32_NOI",            /*  56 */
225     "R_ARM_ALU_PC_G0_NC",         /*  57 */
226     "R_ARM_ALU_PC_G0",            /*  58 */
227     "R_ARM_ALU_PC_G1_NC",         /*  59 */
228     "R_ARM_ALU_PC_G1",            /*  60 */
229     "R_ARM_ALU_PC_G2",            /*  61 */
230     "R_ARM_LDR_PC_G1",            /*  62 */
231     "R_ARM_LDR_PC_G2",            /*  63 */
232     "R_ARM_LDRS_PC_G0",           /*  64 */
233     "R_ARM_LDRS_PC_G1",           /*  65 */
234     "R_ARM_LDRS_PC_G2",           /*  66 */
235     "R_ARM_LDC_PC_G0",            /*  67 */
236     "R_ARM_LDC_PC_G1",            /*  68 */
237     "R_ARM_LDC_PC_G2",            /*  69 */
238     "R_ARM_ALU_SB_G0_NC",         /*  70 */
239     "R_ARM_ALU_SB_G0",            /*  71 */
240     "R_ARM_ALU_SB_G1_NC",         /*  72 */
241     "R_ARM_ALU_SB_G1",            /*  73 */
242     "R_ARM_ALU_SB_G2",            /*  74 */
243     "R_ARM_LDR_SB_G0",            /*  75 */
244     "R_ARM_LDR_SB_G1",            /*  76 */
245     "R_ARM_LDR_SB_G2",            /*  77 */
246     "R_ARM_LDRS_SB_G0",           /*  78 */
247     "R_ARM_LDRS_SB_G1",           /*  79 */
248     "R_ARM_LDRS_SB_G2",           /*  80 */
249     "R_ARM_LDC_SB_G0",            /*  81 */
250     "R_ARM_LDC_SB_G1",            /*  82 */
251     "R_ARM_LDC_SB_G2",            /*  83 */
252     "R_ARM_MOVW_BREL_NC",         /*  84 */
253     "R_ARM_MOVT_BREL",            /*  85 */
254     "R_ARM_MOVW_BREL",            /*  86 */
255     "R_ARM_THM_MOVW_BREL_NC",     /*  87 */
256     "R_ARM_THM_MOVT_BREL",        /*  88 */
257     "R_ARM_THM_MOVW_BREL",        /*  89 */
258     "R_ARM_TLS_GOTDESC",          /*  90 */
259     "R_ARM_TLS_CALL",             /*  91 */
260     "R_ARM_TLS_DESCSEQ",          /*  92 */
261     "R_ARM_THM_TLS_CALL",         /*  93 */
262     "R_ARM_PLT32_ABS",            /*  94 */
263     "R_ARM_GOT_ABS",              /*  95 */
264     "R_ARM_GOT_PREL",             /*  96 */
265     "R_ARM_GOT_BREL12",           /*  97 */
266     "R_ARM_GOTOFF12",             /*  98 */
267     "R_ARM_GOTRELAX",             /*  99 */
268     "R_ARM_GNU_VTENTRY",          /* 100 */
269     "R_ARM_GNU_VTINHERIT",        /* 101 */
270     "R_ARM_THM_JUMP11",           /* 102 */
271     "R_ARM_THM_JUMP8",            /* 103 */
272     "R_ARM_TLS_GD32",             /* 104 */
273     "R_ARM_TLS_LDM32",            /* 105 */
274     "R_ARM_TLS_LDO32",            /* 106 */
275     "R_ARM_TLS_IE32",             /* 107 */
276     "R_ARM_TLS_LE32",             /* 108 */
277     "R_ARM_TLS_LDO12",            /* 109 */
278     "R_ARM_TLS_LE12",             /* 110 */
279     "R_ARM_TLS_IE12GP",           /* 111 */
280     "R_ARM_TLS_MOVT_TPOFF32",     /* 112 */   /* "R_ARM_PRIVATE_0" */
281     "R_ARM_TLS_MOVW_TPOFF32",     /* 113 */   /* "R_ARM_PRIVATE_1" */
282     "R_ARM_THM_TLS_MOVT_TPOFF32", /* 114 */   /* "R_ARM_PRIVATE_2" */
283     "R_ARM_THM_TLS_MOVT_TPOFF32", /* 115 */   /* "R_ARM_PRIVATE_3" */
284     "R_ARM_PRIVATE_4",            /* 116 */
285     "R_ARM_PRIVATE_5",            /* 117 */
286     "R_ARM_PRIVATE_6",            /* 118 */
287     "R_ARM_PRIVATE_7",            /* 119 */
288     "R_ARM_PRIVATE_8",            /* 120 */
289     "R_ARM_PRIVATE_9",            /* 121 */
290     "R_ARM_PRIVATE_10",           /* 122 */
291     "R_ARM_PRIVATE_11",           /* 123 */
292     "R_ARM_PRIVATE_12",           /* 124 */
293     "R_ARM_PRIVATE_13",           /* 125 */
294     "R_ARM_PRIVATE_14",           /* 126 */
295     "R_ARM_PRIVATE_15",           /* 127 */
296     "R_ARM_ME_TOO",               /* 128 */
297     "R_ARM_THM_TLS_DESCSEQ16",    /* 129 */
298     "R_ARM_THM_TLS_DESCSEQ32",    /* 130 */
299 };
300 
301 #ifndef R_AARCH64_ABS64
302 #define R_AARCH64_ABS64 0x101
303 #endif
304 #ifndef R_AARCH64_ABS32
305 #define R_AARCH64_ABS32 0x102
306 #endif
307 
308 #endif /* DWARF_RELOC_ARM_H */
309