xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_reloc_ppc64.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 
25 #ifndef DWARF_RELOC_PPC64_H
26 #define DWARF_RELOC_PPC64_H
27 
28 /* Definitions for PPC64 */
29 #define DWARF_RELOC_PPC64
30 
31 /* Include the definitions only in the case of Windows */
32 #ifdef _WIN32
33 
34 #include "dwarf_reloc_ppc.h"
35 
36 /* PowerPC64 relocations defined by the ABIs */
37 #define R_PPC64_NONE                R_PPC_NONE
38 #define R_PPC64_ADDR32              R_PPC_ADDR32 /* 32bit absolute address.  */
39 #define R_PPC64_ADDR24              R_PPC_ADDR24 /* 26bit address, word aligned.  */
40 #define R_PPC64_ADDR16              R_PPC_ADDR16 /* 16bit absolute address. */
41 #define R_PPC64_ADDR16_LO           R_PPC_ADDR16_LO /* lower 16bits of abs. address.  */
42 #define R_PPC64_ADDR16_HI           R_PPC_ADDR16_HI /* high 16bits of abs. address. */
43 #define R_PPC64_ADDR16_HA           R_PPC_ADDR16_HA /* adjusted high 16bits.  */
44 #define R_PPC64_ADDR14              R_PPC_ADDR14  /* 16bit address, word aligned.  */
45 #define R_PPC64_ADDR14_BRTAKEN      R_PPC_ADDR14_BRTAKEN
46 #define R_PPC64_ADDR14_BRNTAKEN     R_PPC_ADDR14_BRNTAKEN
47 #define R_PPC64_REL24               R_PPC_REL24 /* PC relative 26 bit, word aligned.  */
48 #define R_PPC64_REL14               R_PPC_REL14 /* PC relative 16 bit. */
49 #define R_PPC64_REL14_BRTAKEN       R_PPC_REL14_BRTAKEN
50 #define R_PPC64_REL14_BRNTAKEN      R_PPC_REL14_BRNTAKEN
51 #define R_PPC64_GOT16               R_PPC_GOT16
52 #define R_PPC64_GOT16_LO            R_PPC_GOT16_LO
53 #define R_PPC64_GOT16_HI            R_PPC_GOT16_HI
54 #define R_PPC64_GOT16_HA            R_PPC_GOT16_HA
55 
56 #define R_PPC64_COPY                R_PPC_COPY
57 #define R_PPC64_GLOB_DAT            R_PPC_GLOB_DAT
58 #define R_PPC64_JMP_SLOT            R_PPC_JMP_SLOT
59 #define R_PPC64_RELATIVE            R_PPC_RELATIVE
60 
61 #define R_PPC64_UADDR32             R_PPC_UADDR32
62 #define R_PPC64_UADDR16             R_PPC_UADDR16
63 #define R_PPC64_REL32               R_PPC_REL32
64 #define R_PPC64_PLT32               R_PPC_PLT32
65 #define R_PPC64_PLTREL32            R_PPC_PLTREL32
66 #define R_PPC64_PLT16_LO            R_PPC_PLT16_LO
67 #define R_PPC64_PLT16_HI            R_PPC_PLT16_HI
68 #define R_PPC64_PLT16_HA            R_PPC_PLT16_HA
69 
70 #define R_PPC64_SECTOFF             R_PPC_SECTOFF
71 #define R_PPC64_SECTOFF_LO          R_PPC_SECTOFF_LO
72 #define R_PPC64_SECTOFF_HI          R_PPC_SECTOFF_HI
73 #define R_PPC64_SECTOFF_HA          R_PPC_SECTOFF_HA
74 #define R_PPC64_ADDR30              37 /* word30 (S + A - P) >> 2.  */
75 #define R_PPC64_ADDR64              38 /* doubleword64 S + A.  */
76 #define R_PPC64_ADDR16_HIGHER       39 /* half16 #higher(S + A).  */
77 #define R_PPC64_ADDR16_HIGHERA      40 /* half16 #highera(S + A).  */
78 #define R_PPC64_ADDR16_HIGHEST      41 /* half16 #highest(S + A).  */
79 #define R_PPC64_ADDR16_HIGHESTA     42 /* half16 #highesta(S + A). */
80 #define R_PPC64_UADDR64             43 /* doubleword64 S + A.  */
81 #define R_PPC64_REL64               44 /* doubleword64 S + A - P.  */
82 #define R_PPC64_PLT64               45 /* doubleword64 L + A.  */
83 #define R_PPC64_PLTREL64            46 /* doubleword64 L + A - P.  */
84 #define R_PPC64_TOC16               47 /* half16* S + A - .TOC.  */
85 #define R_PPC64_TOC16_LO            48 /* half16 #lo(S + A - .TOC.).  */
86 #define R_PPC64_TOC16_HI            49 /* half16 #hi(S + A - .TOC.).  */
87 #define R_PPC64_TOC16_HA            50 /* half16 #ha(S + A - .TOC.).  */
88 #define R_PPC64_TOC                 51 /* doubleword64 .TOC. */
89 #define R_PPC64_PLTGOT16            52 /* half16* M + A.  */
90 #define R_PPC64_PLTGOT16_LO         53 /* half16 #lo(M + A).  */
91 #define R_PPC64_PLTGOT16_HI         54 /* half16 #hi(M + A).  */
92 #define R_PPC64_PLTGOT16_HA         55 /* half16 #ha(M + A).  */
93 
94 #define R_PPC64_ADDR16_DS           56 /* half16ds* (S + A) >> 2.  */
95 #define R_PPC64_ADDR16_LO_DS        57 /* half16ds  #lo(S + A) >> 2.  */
96 #define R_PPC64_GOT16_DS            58 /* half16ds* (G + A) >> 2.  */
97 #define R_PPC64_GOT16_LO_DS         59 /* half16ds  #lo(G + A) >> 2.  */
98 #define R_PPC64_PLT16_LO_DS         60 /* half16ds  #lo(L + A) >> 2.  */
99 #define R_PPC64_SECTOFF_DS          61 /* half16ds* (R + A) >> 2.  */
100 #define R_PPC64_SECTOFF_LO_DS       62 /* half16ds  #lo(R + A) >> 2.  */
101 #define R_PPC64_TOC16_DS            63 /* half16ds* (S + A - .TOC.) >> 2.  */
102 #define R_PPC64_TOC16_LO_DS         64 /* half16ds  #lo(S + A - .TOC.) >> 2.  */
103 #define R_PPC64_PLTGOT16_DS         65 /* half16ds* (M + A) >> 2.  */
104 #define R_PPC64_PLTGOT16_LO_DS      66 /* half16ds  #lo(M + A) >> 2.  */
105 
106 /* PowerPC64 relocations defined for the TLS access ABI.  */
107 #define R_PPC64_TLS                 67 /* none      (sym+add)@tls */
108 #define R_PPC64_DTPMOD64            68 /* doubleword64 (sym+add)@dtpmod */
109 #define R_PPC64_TPREL16             69 /* half16*   (sym+add)@tprel */
110 #define R_PPC64_TPREL16_LO          70 /* half16    (sym+add)@tprel@l */
111 #define R_PPC64_TPREL16_HI          71 /* half16    (sym+add)@tprel@h */
112 #define R_PPC64_TPREL16_HA          72 /* half16    (sym+add)@tprel@ha */
113 #define R_PPC64_TPREL64             73 /* doubleword64 (sym+add)@tprel */
114 #define R_PPC64_DTPREL16            74 /* half16*   (sym+add)@dtprel */
115 #define R_PPC64_DTPREL16_LO         75 /* half16    (sym+add)@dtprel@l */
116 #define R_PPC64_DTPREL16_HI         76 /* half16    (sym+add)@dtprel@h */
117 #define R_PPC64_DTPREL16_HA         77 /* half16    (sym+add)@dtprel@ha */
118 #define R_PPC64_DTPREL64            78 /* doubleword64 (sym+add)@dtprel */
119 #define R_PPC64_GOT_TLSGD16         79 /* half16*   (sym+add)@got@tlsgd */
120 #define R_PPC64_GOT_TLSGD16_LO      80 /* half16    (sym+add)@got@tlsgd@l */
121 #define R_PPC64_GOT_TLSGD16_HI      81 /* half16    (sym+add)@got@tlsgd@h */
122 #define R_PPC64_GOT_TLSGD16_HA      82 /* half16    (sym+add)@got@tlsgd@ha */
123 #define R_PPC64_GOT_TLSLD16         83 /* half16*   (sym+add)@got@tlsld */
124 #define R_PPC64_GOT_TLSLD16_LO      84 /* half16    (sym+add)@got@tlsld@l */
125 #define R_PPC64_GOT_TLSLD16_HI      85 /* half16    (sym+add)@got@tlsld@h */
126 #define R_PPC64_GOT_TLSLD16_HA      86 /* half16    (sym+add)@got@tlsld@ha */
127 #define R_PPC64_GOT_TPREL16_DS      87 /* half16ds* (sym+add)@got@tprel */
128 #define R_PPC64_GOT_TPREL16_LO_DS   88 /* half16ds (sym+add)@got@tprel@l */
129 #define R_PPC64_GOT_TPREL16_HI      89 /* half16    (sym+add)@got@tprel@h */
130 #define R_PPC64_GOT_TPREL16_HA      90 /* half16    (sym+add)@got@tprel@ha */
131 #define R_PPC64_GOT_DTPREL16_DS     91 /* half16ds* (sym+add)@got@dtprel */
132 #define R_PPC64_GOT_DTPREL16_LO_DS  92 /* half16ds (sym+add)@got@dtprel@l */
133 #define R_PPC64_GOT_DTPREL16_HI     93 /* half16    (sym+add)@got@dtprel@h */
134 #define R_PPC64_GOT_DTPREL16_HA     94 /* half16    (sym+add)@got@dtprel@ha */
135 #define R_PPC64_TPREL16_DS          95 /* half16ds* (sym+add)@tprel */
136 #define R_PPC64_TPREL16_LO_DS       96 /* half16ds  (sym+add)@tprel@l */
137 #define R_PPC64_TPREL16_HIGHER      97 /* half16    (sym+add)@tprel@higher */
138 #define R_PPC64_TPREL16_HIGHERA     98 /* half16    (sym+add)@tprel@highera */
139 #define R_PPC64_TPREL16_HIGHEST     99 /* half16    (sym+add)@tprel@highest */
140 #define R_PPC64_TPREL16_HIGHESTA   100 /* half16  (sym+add)@tprel@highesta */
141 #define R_PPC64_DTPREL16_DS        101 /* half16ds* (sym+add)@dtprel */
142 #define R_PPC64_DTPREL16_LO_DS     102 /* half16ds (sym+add)@dtprel@l */
143 #define R_PPC64_DTPREL16_HIGHER    103 /* half16   (sym+add)@dtprel@higher */
144 #define R_PPC64_DTPREL16_HIGHERA   104 /* half16  (sym+add)@dtprel@highera */
145 #define R_PPC64_DTPREL16_HIGHEST   105 /* half16  (sym+add)@dtprel@highest */
146 #define R_PPC64_DTPREL16_HIGHESTA  106 /* half16 (sym+add)@dtprel@highesta */
147 
148 /*  Additional relocation types */
149 #define R_PPC64_TOC32              107
150 #define R_PPC64_DTPMOD32           108
151 #define R_PPC64_TPREL32            109
152 #define R_PPC64_DTPREL32           110
153 
154 /*  Keep this the last entry.  */
155 #define R_PPC64_NUM                111
156 #endif /* _WIN32 */
157 
158 /* PowerPC64 relocations defined by the ABIs */
159 static const char *reloc_type_names_PPC64[] = {
160     "R_PPC64_NONE",                 /*  00 */
161     "R_PPC64_ADDR32",               /*  01 */
162     "R_PPC64_ADDR24",               /*  02 */
163     "R_PPC64_ADDR16",               /*  03 */
164     "R_PPC64_ADDR16_LO",            /*  04 */
165     "R_PPC64_ADDR16_HI",            /*  05 */
166     "R_PPC64_ADDR16_HA",            /*  06 */
167     "R_PPC64_ADDR14",               /*  07 */
168     "R_PPC64_ADDR14_BRTAKEN",       /*  08 */
169     "R_PPC64_ADDR14_BRNTAKEN",      /*  09 */
170     "R_PPC64_REL24",                /*  10 */
171     "R_PPC64_REL14",                /*  11 */
172     "R_PPC64_REL14_BRTAKEN",        /*  12 */
173     "R_PPC64_REL14_BRNTAKEN",       /*  13 */
174     "R_PPC64_GOT16",                /*  14 */
175     "R_PPC64_GOT16_LO",             /*  15 */
176     "R_PPC64_GOT16_HI",             /*  16 */
177     "R_PPC64_GOT16_HA",             /*  17 */
178     "R_PPC64_PLTREL24",             /*  18 */
179     "R_PPC64_COPY",                 /*  19 */
180     "R_PPC64_GLOB_DAT",             /*  20 */
181     "R_PPC64_JMP_SLOT",             /*  21 */
182     "R_PPC64_RELATIVE",             /*  22 */
183     "R_PPC64_LOCAL24PC",            /*  23 */
184     "R_PPC64_UADDR32",              /*  24 */
185     "R_PPC64_UADDR16",              /*  25 */
186     "R_PPC64_REL32",                /*  26 */
187     "R_PPC64_PLT32",                /*  27 */
188     "R_PPC64_PLTREL32",             /*  28 */
189     "R_PPC64_PLT16_LO",             /*  29 */
190     "R_PPC64_PLT16_HI",             /*  30 */
191     "R_PPC64_PLT16_HA",             /*  31 */
192     "R_PPC64_SDAREL16",             /*  32 */
193     "R_PPC64_SECTOFF",              /*  33 */
194     "R_PPC64_SECTOFF_LO",           /*  34 */
195     "R_PPC64_SECTOFF_HI",           /*  35 */
196     "R_PPC64_SECTOFF_HA",           /*  36 */
197     "R_PPC64_REL30",                /*  37 */
198     "R_PPC64_ADDR64",               /*  38 */
199     "R_PPC64_ADDR16_HIGHER",        /*  39 */
200     "R_PPC64_ADDR16_HIGHERA",       /*  40 */
201     "R_PPC64_ADDR16_HIGHEST",       /*  41 */
202     "R_PPC64_ADDR16_HIGHESTA",      /*  42 */
203     "R_PPC64_UADDR64",              /*  43 */
204     "R_PPC64_REL64",                /*  44 */
205     "R_PPC64_PLT64",                /*  45 */
206     "R_PPC64_PLTREL64",             /*  46 */
207     "R_PPC64_TOC16",                /*  47 */
208     "R_PPC64_TOC16_LO",             /*  48 */
209     "R_PPC64_TOC16_HI",             /*  49 */
210     "R_PPC64_TOC16_HA",             /*  50 */
211     "R_PPC64_TOC",                  /*  51 */
212     "R_PPC64_PLTGOT16",             /*  52 */
213     "R_PPC64_PLTGOT16_LO",          /*  53 */
214     "R_PPC64_PLTGOT16_HI",          /*  54 */
215     "R_PPC64_PLTGOT16_HA",          /*  55 */
216     "R_PPC64_ADDR16_DS",            /*  56 */
217     "R_PPC64_ADDR16_LO_DS",         /*  57 */
218     "R_PPC64_GOT16_DS",             /*  58 */
219     "R_PPC64_GOT16_LO_DS",          /*  59 */
220     "R_PPC64_PLT16_LO_DS",          /*  60 */
221     "R_PPC64_SECTOFF_DS",           /*  61 */
222     "R_PPC64_SECTOFF_LO_DS",        /*  62 */
223     "R_PPC64_TOC16_DS",             /*  63 */
224     "R_PPC64_TOC16_LO_DS",          /*  64 */
225     "R_PPC64_PLTGOT16_DS",          /*  65 */
226     "R_PPC64_PLTGOT16_LO_DS",       /*  66 */
227     "R_PPC64_TLS",                  /*  67 */
228     "R_PPC64_DTPMOD32",             /*  68 */
229     "R_PPC64_TPREL16",              /*  69 */
230     "R_PPC64_TPREL16_LO",           /*  70 */
231     "R_PPC64_TPREL16_HI",           /*  71 */
232     "R_PPC64_TPREL16_HA",           /*  72 */
233     "R_PPC64_TPREL32",              /*  73 */
234     "R_PPC64_DTPREL16",             /*  74 */
235     "R_PPC64_DTPREL16_LO",          /*  75 */
236     "R_PPC64_DTPREL16_HI",          /*  76 */
237     "R_PPC64_DTPREL16_HA",          /*  77 */
238     "R_PPC64_DTPREL64",             /*  78 */
239     "R_PPC64_GOT_TLSGD16",          /*  79 */
240     "R_PPC64_GOT_TLSGD16_LO",       /*  80 */
241     "R_PPC64_GOT_TLSGD16_HI",       /*  81 */
242     "R_PPC64_GOT_TLSGD16_HA",       /*  82 */
243     "R_PPC64_GOT_TLSLD16",          /*  83 */
244     "R_PPC64_GOT_TLSLD16_LO",       /*  84 */
245     "R_PPC64_GOT_TLSLD16_HI",       /*  85 */
246     "R_PPC64_GOT_TLSLD16_HA",       /*  86 */
247     "R_PPC64_GOT_TPREL16_DS",       /*  87 */
248     "R_PPC64_GOT_TPREL16_LO",       /*  88 */
249     "R_PPC64_GOT_TPREL16_HI",       /*  89 */
250     "R_PPC64_GOT_TPREL16_HA",       /*  90 */
251     "R_PPC64_GOT_DTPREL16",         /*  91 */
252     "R_PPC64_GOT_DTPREL16_LO",      /*  92 */
253     "R_PPC64_GOT_DTPREL16_HI",      /*  93 */
254     "R_PPC64_GOT_DTPREL16_HA",      /*  94 */
255     "R_PPC64_TPREL16_DS",           /*  95 */
256     "R_PPC64_TPREL16_LO_DS",        /*  96 */
257     "R_PPC64_TPREL16_HIGHER",       /*  97 */
258     "R_PPC64_TPREL16_HIGHERA",      /*  98 */
259     "R_PPC64_TPREL16_HIGHEST",      /*  99 */
260     "R_PPC64_TPREL16_HIGHESTA",     /* 100 */
261     "R_PPC64_DTPREL16_DS",          /* 101 */
262     "R_PPC64_DTPREL16_LO_DS",       /* 102 */
263     "R_PPC64_DTPREL16_HIGHER",      /* 103 */
264     "R_PPC64_DTPREL16_HIGHERA",     /* 104 */
265     "R_PPC64_DTPREL16_HIGHEST",     /* 105 */
266     "R_PPC64_DTPREL16_HIGHESTA",    /* 106 */
267     "R_PPC64_TOC32",                /* 107 */
268     "R_PPC64_DTPMOD32",             /* 108 */
269     "R_PPC64_TPREL32",              /* 109 */
270     "R_PPC64_DTPREL32",             /* 110 */
271 };
272 #endif /* DWARF_RELOC_PPC64_H */
273