xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_reloc_ppc.h (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
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   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 /* The address of the Free Software Foundation is
25    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
26    Boston, MA 02110-1301, USA.
27 */
28 
29 #ifndef DWARF_RELOC_PPC_H
30 #define DWARF_RELOC_PPC_H
31 
32 /* Definitions for PPC */
33 #define DWARF_RELOC_PPC
34 
35 /* Include the definitions only in the case of Windows */
36 #ifdef _WIN32
37 /* PowerPC relocations defined by the ABIs */
38 #define R_PPC_NONE                   0
39 #define R_PPC_ADDR32                 1 /* 32bit absolute address */
40 #define R_PPC_ADDR24                 2 /* 26bit address, 2 bits ignored.  */
41 #define R_PPC_ADDR16                 3 /* 16bit absolute address */
42 #define R_PPC_ADDR16_LO              4 /* lower 16bit of absolute address */
43 #define R_PPC_ADDR16_HI              5 /* high 16bit of absolute address */
44 #define R_PPC_ADDR16_HA              6 /* adjusted high 16bit */
45 #define R_PPC_ADDR14                 7 /* 16bit address, 2 bits ignored */
46 #define R_PPC_ADDR14_BRTAKEN         8
47 #define R_PPC_ADDR14_BRNTAKEN        9
48 #define R_PPC_REL24                 10 /* PC relative 26 bit */
49 #define R_PPC_REL14                 11 /* PC relative 16 bit */
50 #define R_PPC_REL14_BRTAKEN         12
51 #define R_PPC_REL14_BRNTAKEN        13
52 #define R_PPC_GOT16                 14
53 #define R_PPC_GOT16_LO              15
54 #define R_PPC_GOT16_HI              16
55 #define R_PPC_GOT16_HA              17
56 #define R_PPC_PLTREL24              18
57 #define R_PPC_COPY                  19
58 #define R_PPC_GLOB_DAT              20
59 #define R_PPC_JMP_SLOT              21
60 #define R_PPC_RELATIVE              22
61 #define R_PPC_LOCAL24PC             23
62 #define R_PPC_UADDR32               24
63 #define R_PPC_UADDR16               25
64 #define R_PPC_REL32                 26
65 #define R_PPC_PLT32                 27
66 #define R_PPC_PLTREL32              28
67 #define R_PPC_PLT16_LO              29
68 #define R_PPC_PLT16_HI              30
69 #define R_PPC_PLT16_HA              31
70 #define R_PPC_SDAREL16              32
71 #define R_PPC_SECTOFF               33
72 #define R_PPC_SECTOFF_LO            34
73 #define R_PPC_SECTOFF_HI            35
74 #define R_PPC_SECTOFF_HA            36
75 
76 /* Unused types */
77 #define R_PPC_37                    37
78 #define R_PPC_38                    38
79 #define R_PPC_39                    39
80 #define R_PPC_40                    40
81 #define R_PPC_41                    41
82 #define R_PPC_42                    42
83 #define R_PPC_43                    43
84 #define R_PPC_44                    44
85 #define R_PPC_45                    45
86 #define R_PPC_46                    46
87 #define R_PPC_47                    47
88 #define R_PPC_48                    48
89 #define R_PPC_49                    49
90 #define R_PPC_50                    50
91 #define R_PPC_51                    51
92 #define R_PPC_52                    52
93 #define R_PPC_53                    53
94 #define R_PPC_54                    54
95 #define R_PPC_55                    55
96 
97 /* Unused types */
98 #define R_PPC_56                    56
99 #define R_PPC_57                    57
100 #define R_PPC_58                    58
101 #define R_PPC_59                    59
102 #define R_PPC_60                    60
103 #define R_PPC_61                    61
104 #define R_PPC_62                    62
105 #define R_PPC_63                    63
106 #define R_PPC_64                    64
107 #define R_PPC_65                    65
108 #define R_PPC_66                    66
109 
110 /* PowerPC relocations defined for the TLS access ABI.  */
111 #define R_PPC_TLS                   67 /* none      (sym+add)@tls */
112 #define R_PPC_DTPMOD32              68 /* word32    (sym+add)@dtpmod */
113 #define R_PPC_TPREL16               69 /* half16*   (sym+add)@tprel */
114 #define R_PPC_TPREL16_LO            70 /* half16    (sym+add)@tprel@l */
115 #define R_PPC_TPREL16_HI            71 /* half16    (sym+add)@tprel@h */
116 #define R_PPC_TPREL16_HA            72 /* half16    (sym+add)@tprel@ha */
117 #define R_PPC_TPREL32               73 /* word32    (sym+add)@tprel */
118 #define R_PPC_DTPREL16              74 /* half16*   (sym+add)@dtprel */
119 #define R_PPC_DTPREL16_LO           75 /* half16    (sym+add)@dtprel@l */
120 #define R_PPC_DTPREL16_HI           76 /* half16    (sym+add)@dtprel@h */
121 #define R_PPC_DTPREL16_HA           77 /* half16    (sym+add)@dtprel@ha */
122 #define R_PPC_DTPREL32              78 /* word32    (sym+add)@dtprel */
123 #define R_PPC_GOT_TLSGD16           79 /* half16*   (sym+add)@got@tlsgd */
124 #define R_PPC_GOT_TLSGD16_LO        80 /* half16    (sym+add)@got@tlsgd@l */
125 #define R_PPC_GOT_TLSGD16_HI        81 /* half16    (sym+add)@got@tlsgd@h */
126 #define R_PPC_GOT_TLSGD16_HA        82 /* half16    (sym+add)@got@tlsgd@ha */
127 #define R_PPC_GOT_TLSLD16           83 /* half16*   (sym+add)@got@tlsld */
128 #define R_PPC_GOT_TLSLD16_LO        84 /* half16    (sym+add)@got@tlsld@l */
129 #define R_PPC_GOT_TLSLD16_HI        85 /* half16    (sym+add)@got@tlsld@h */
130 #define R_PPC_GOT_TLSLD16_HA        86 /* half16    (sym+add)@got@tlsld@ha */
131 #define R_PPC_GOT_TPREL16           87 /* half16*   (sym+add)@got@tprel */
132 #define R_PPC_GOT_TPREL16_LO        88 /* half16    (sym+add)@got@tprel@l */
133 #define R_PPC_GOT_TPREL16_HI        89 /* half16    (sym+add)@got@tprel@h */
134 #define R_PPC_GOT_TPREL16_HA        90 /* half16    (sym+add)@got@tprel@ha */
135 #define R_PPC_GOT_DTPREL16          91 /* half16*   (sym+add)@got@dtprel */
136 #define R_PPC_GOT_DTPREL16_LO       92 /* half16*   (sym+add)@got@dtprel@l */
137 #define R_PPC_GOT_DTPREL16_HI       93 /* half16*   (sym+add)@got@dtprel@h */
138 #define R_PPC_GOT_DTPREL16_HA       94 /* half16*   (sym+add)@got@dtprel@ha */
139 
140 /* Keep this the last entry.  */
141 #define R_PPC_NUM                   95
142 #endif /* _WIN32 */
143 
144 /* PowerPC relocations defined by the ABIs */
145 static const char *reloc_type_names_PPC[] = {
146     "R_PPC_NONE",                 /*  00 */
147     "R_PPC_ADDR32",               /*  01 */
148     "R_PPC_ADDR24",               /*  02 */
149     "R_PPC_ADDR16",               /*  03 */
150     "R_PPC_ADDR16_LO",            /*  04 */
151     "R_PPC_ADDR16_HI",            /*  05 */
152     "R_PPC_ADDR16_HA",            /*  06 */
153     "R_PPC_ADDR14",               /*  07 */
154     "R_PPC_ADDR14_BRTAKEN",       /*  08 */
155     "R_PPC_ADDR14_BRNTAKEN",      /*  09 */
156     "R_PPC_REL24",                /*  10 */
157     "R_PPC_REL14",                /*  11 */
158     "R_PPC_REL14_BRTAKEN",        /*  12 */
159     "R_PPC_REL14_BRNTAKEN",       /*  13 */
160     "R_PPC_GOT16",                /*  14 */
161     "R_PPC_GOT16_LO",             /*  15 */
162     "R_PPC_GOT16_HI",             /*  16 */
163     "R_PPC_GOT16_HA",             /*  17 */
164     "R_PPC_PLTREL24",             /*  18 */
165     "R_PPC_COPY",                 /*  19 */
166     "R_PPC_GLOB_DAT",             /*  20 */
167     "R_PPC_JMP_SLOT",             /*  21 */
168     "R_PPC_RELATIVE",             /*  22 */
169     "R_PPC_LOCAL24PC",            /*  23 */
170     "R_PPC_UADDR32",              /*  24 */
171     "R_PPC_UADDR16",              /*  25 */
172     "R_PPC_REL32",                /*  26 */
173     "R_PPC_PLT32",                /*  27 */
174     "R_PPC_PLTREL32",             /*  28 */
175     "R_PPC_PLT16_LO",             /*  29 */
176     "R_PPC_PLT16_HI",             /*  30 */
177     "R_PPC_PLT16_HA",             /*  31 */
178     "R_PPC_SDAREL16",             /*  32 */
179     "R_PPC_SECTOFF",              /*  33 */
180     "R_PPC_SECTOFF_LO",           /*  34 */
181     "R_PPC_SECTOFF_HI",           /*  35 */
182     "R_PPC_SECTOFF_HA",           /*  36 */
183     "R_PPC_37",                   /*  37 */
184     "R_PPC_38",                   /*  38 */
185     "R_PPC_39",                   /*  39 */
186     "R_PPC_40",                   /*  40 */
187     "R_PPC_41",                   /*  41 */
188     "R_PPC_42",                   /*  42 */
189     "R_PPC_43",                   /*  43 */
190     "R_PPC_44",                   /*  44 */
191     "R_PPC_45",                   /*  45 */
192     "R_PPC_46",                   /*  46 */
193     "R_PPC_47",                   /*  47 */
194     "R_PPC_48",                   /*  48 */
195     "R_PPC_49",                   /*  49 */
196     "R_PPC_50",                   /*  50 */
197     "R_PPC_51",                   /*  51 */
198     "R_PPC_52",                   /*  52 */
199     "R_PPC_53",                   /*  53 */
200     "R_PPC_54",                   /*  54 */
201     "R_PPC_55",                   /*  55 */
202     "R_PPC_56",                   /*  56 */
203     "R_PPC_57",                   /*  57 */
204     "R_PPC_58",                   /*  58 */
205     "R_PPC_59",                   /*  59 */
206     "R_PPC_60",                   /*  60 */
207     "R_PPC_61",                   /*  61 */
208     "R_PPC_62",                   /*  62 */
209     "R_PPC_63",                   /*  63 */
210     "R_PPC_64",                   /*  64 */
211     "R_PPC_65",                   /*  65 */
212     "R_PPC_66",                   /*  66 */
213     "R_PPC_TLS",                  /*  67 */
214     "R_PPC_DTPMOD32",             /*  68 */
215     "R_PPC_TPREL16",              /*  69 */
216     "R_PPC_TPREL16_LO",           /*  70 */
217     "R_PPC_TPREL16_HI",           /*  71 */
218     "R_PPC_TPREL16_HA",           /*  72 */
219     "R_PPC_TPREL32",              /*  73 */
220     "R_PPC_DTPREL16",             /*  74 */
221     "R_PPC_DTPREL16_LO",          /*  75 */
222     "R_PPC_DTPREL16_HI",          /*  76 */
223     "R_PPC_DTPREL16_HA",          /*  77 */
224     "R_PPC_DTPREL64",             /*  78 */
225     "R_PPC_GOT_TLSGD16",          /*  79 */
226     "R_PPC_GOT_TLSGD16_LO",       /*  80 */
227     "R_PPC_GOT_TLSGD16_HI",       /*  81 */
228     "R_PPC_GOT_TLSGD16_HA",       /*  82 */
229     "R_PPC_GOT_TLSLD16",          /*  83 */
230     "R_PPC_GOT_TLSLD16_LO",       /*  84 */
231     "R_PPC_GOT_TLSLD16_HI",       /*  85 */
232     "R_PPC_GOT_TLSLD16_HA",       /*  86 */
233     "R_PPC_GOT_TPREL16_DS",       /*  87 */
234     "R_PPC_GOT_TPREL16_LO",       /*  88 */
235     "R_PPC_GOT_TPREL16_HI",       /*  89 */
236     "R_PPC_GOT_TPREL16_HA",       /*  90 */
237     "R_PPC_GOT_DTPREL16",         /*  91 */
238     "R_PPC_GOT_DTPREL16_LO",      /*  92 */
239     "R_PPC_GOT_DTPREL16_HI",      /*  93 */
240     "R_PPC_GOT_DTPREL16_HA",      /*  94 */
241 };
242 #endif /* DWARF_RELOC_PPC_H */
243