Merge branch 'vendor/GCC44'
[dragonfly.git] / contrib / binutils-2.21 / include / elf / cr16c.h
CommitLineData
5e4e6ec1
SW
1/* CR16C ELF support for BFD.
2 Copyright 2004, 2008, 2010 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
19
20#ifndef _ELF_CR16C_H
21#define _ELF_CR16C_H
22
23#include "bfd.h"
24#include "elf/reloc-macros.h"
25
26/* Creating indices for reloc_map_index array. */
27START_RELOC_NUMBERS (elf_cr16c_reloc_type)
28 RELOC_NUMBER (RINDEX_16C_NUM08, 0)
29 RELOC_NUMBER (RINDEX_16C_NUM08_C, 1)
30 RELOC_NUMBER (RINDEX_16C_NUM16, 2)
31 RELOC_NUMBER (RINDEX_16C_NUM16_C, 3)
32 RELOC_NUMBER (RINDEX_16C_NUM32, 4)
33 RELOC_NUMBER (RINDEX_16C_NUM32_C, 5)
34 RELOC_NUMBER (RINDEX_16C_DISP04, 6)
35 RELOC_NUMBER (RINDEX_16C_DISP04_C, 7)
36 RELOC_NUMBER (RINDEX_16C_DISP08, 8)
37 RELOC_NUMBER (RINDEX_16C_DISP08_C, 9)
38 RELOC_NUMBER (RINDEX_16C_DISP16, 10)
39 RELOC_NUMBER (RINDEX_16C_DISP16_C, 11)
40 RELOC_NUMBER (RINDEX_16C_DISP24, 12)
41 RELOC_NUMBER (RINDEX_16C_DISP24_C, 13)
42 RELOC_NUMBER (RINDEX_16C_DISP24a, 14)
43 RELOC_NUMBER (RINDEX_16C_DISP24a_C, 15)
44 RELOC_NUMBER (RINDEX_16C_REG04, 16)
45 RELOC_NUMBER (RINDEX_16C_REG04_C, 17)
46 RELOC_NUMBER (RINDEX_16C_REG04a, 18)
47 RELOC_NUMBER (RINDEX_16C_REG04a_C, 19)
48 RELOC_NUMBER (RINDEX_16C_REG14, 20)
49 RELOC_NUMBER (RINDEX_16C_REG14_C, 21)
50 RELOC_NUMBER (RINDEX_16C_REG16, 22)
51 RELOC_NUMBER (RINDEX_16C_REG16_C, 23)
52 RELOC_NUMBER (RINDEX_16C_REG20, 24)
53 RELOC_NUMBER (RINDEX_16C_REG20_C, 25)
54 RELOC_NUMBER (RINDEX_16C_ABS20, 26)
55 RELOC_NUMBER (RINDEX_16C_ABS20_C, 27)
56 RELOC_NUMBER (RINDEX_16C_ABS24, 28)
57 RELOC_NUMBER (RINDEX_16C_ABS24_C, 29)
58 RELOC_NUMBER (RINDEX_16C_IMM04, 30)
59 RELOC_NUMBER (RINDEX_16C_IMM04_C, 31)
60 RELOC_NUMBER (RINDEX_16C_IMM16, 32)
61 RELOC_NUMBER (RINDEX_16C_IMM16_C, 33)
62 RELOC_NUMBER (RINDEX_16C_IMM20, 34)
63 RELOC_NUMBER (RINDEX_16C_IMM20_C, 35)
64 RELOC_NUMBER (RINDEX_16C_IMM24, 36)
65 RELOC_NUMBER (RINDEX_16C_IMM24_C, 37)
66 RELOC_NUMBER (RINDEX_16C_IMM32, 38)
67 RELOC_NUMBER (RINDEX_16C_IMM32_C, 39)
68END_RELOC_NUMBERS (RINDEX_16C_MAX)
69
70/* CR16C Relocation Types ('cr_reloc_type' entry in the reloc_map structure).
71 The relocation constant name is determined as follows :
72
73 R_16C_<format><size>[_C]
74
75 Where :
76
77 <format> is one of the following:
78 NUM - R_NUMBER mnemonic,
79 DISP - R_16C_DISPL mnemonic,
80 REG - R_16C_REGREL mnemonic,
81 ABS - R_16C_ABS mnemonic,
82 IMM - R_16C_IMMED mnemonic,
83 <size> stands for R_S_16C_<size>
84 _C means 'code label' and is only added when R_ADDRTYPE subfield
85 is of type R_CODE_ADDR. */
86
87/* The table below shows what the hex digits in the definition of the
88 relocation type constants correspond to.
89 ------------------------------------------------------------------
90 R_SIZESP R_FORMAT R_RELTO R_ADDRTYPE
91 ------------------------------------------------------------------ */
92/* R_S_16C_08 R_NUMBER R_ABS R_ADDRESS */
93#define R_16C_NUM08 0X0001
94
95/* R_S_16C_08 R_NUMBER R_ABS R_CODE_ADDR */
96#define R_16C_NUM08_C 0X0006
97
98/* R_S_16C_16 R_NUMBER R_ABS R_ADDRESS */
99#define R_16C_NUM16 0X1001
100
101/* R_S_16C_16 R_NUMBER R_ABS R_CODE_ADDR */
102#define R_16C_NUM16_C 0X1006
103
104/* R_S_16C_32 R_NUMBER R_ABS R_ADDRESS */
105#define R_16C_NUM32 0X2001
106
107/* R_S_16C_32 R_NUMBER R_ABS R_CODE_ADDR */
108#define R_16C_NUM32_C 0X2006
109
110/* R_S_16C_04 R_16C_DISPL R_PCREL R_ADDRESS */
111#define R_16C_DISP04 0X5411
112
113/* R_S_16C_04 R_16C_DISPL R_PCREL R_CODE_ADDR */
114#define R_16C_DISP04_C 0X5416
115
116/* R_S_16C_08 R_16C_DISPL R_PCREL R_ADDRESS */
117#define R_16C_DISP08 0X0411
118
119/* R_S_16C_08 R_16C_DISPL R_PCREL R_CODE_ADDR */
120#define R_16C_DISP08_C 0X0416
121
122/* R_S_16C_16 R_16C_DISPL R_PCREL R_ADDRESS */
123#define R_16C_DISP16 0X1411
124
125/* R_S_16C_16 R_16C_DISPL R_PCREL R_CODE_ADDR */
126#define R_16C_DISP16_C 0X1416
127
128/* R_S_16C_24 R_16C_DISPL R_PCREL R_ADDRESS */
129#define R_16C_DISP24 0X7411
130
131/* R_S_16C_24 R_16C_DISPL R_PCREL R_CODE_ADDR */
132#define R_16C_DISP24_C 0X7416
133
134/* R_S_16C_24a R_16C_DISPL R_PCREL R_ADDRESS */
135#define R_16C_DISP24a 0X6411
136
137/* R_S_16C_24a R_16C_DISPL R_PCREL R_CODE_ADDR */
138#define R_16C_DISP24a_C 0X6416
139
140/* R_S_16C_04 R_16C_REGREL R_ABS R_ADDRESS */
141#define R_16C_REG04 0X5201
142
143/* R_S_16C_04 R_16C_REGREL R_ABS R_CODE_ADDR */
144#define R_16C_REG04_C 0X5206
145
146/* R_S_16C_04_a R_16C_REGREL R_ABS R_ADDRESS */
147#define R_16C_REG04a 0X4201
148
149/* R_S_16C_04_a R_16C_REGREL R_ABS R_CODE_ADDR */
150#define R_16C_REG04a_C 0X4206
151
152/* R_S_16C_14 R_16C_REGREL R_ABS R_ADDRESS */
153#define R_16C_REG14 0X3201
154
155/* R_S_16C_14 R_16C_REGREL R_ABS R_CODE_ADDR */
156#define R_16C_REG14_C 0X3206
157
158/* R_S_16C_16 R_16C_REGREL R_ABS R_ADDRESS */
159#define R_16C_REG16 0X1201
160
161/* R_S_16C_16 R_16C_REGREL R_ABS R_CODE_ADDR */
162#define R_16C_REG16_C 0X1206
163
164/* R_S_16C_20 R_16C_REGREL R_ABS R_ADDRESS */
165#define R_16C_REG20 0X8201
166
167/* R_S_16C_20 R_16C_REGREL R_ABS R_CODE_ADDR */
168#define R_16C_REG20_C 0X8206
169
170/* R_S_16C_20 R_16C_ABS R_ABS R_ADDRESS */
171#define R_16C_ABS20 0X8101
172
173/* R_S_16C_20 R_16C_ABS R_ABS R_CODE_ADDR */
174#define R_16C_ABS20_C 0X8106
175
176/* R_S_16C_24 R_16C_ABS R_ABS R_ADDRESS */
177#define R_16C_ABS24 0X7101
178
179/* R_S_16C_24 R_16C_ABS R_ABS R_CODE_ADDR */
180#define R_16C_ABS24_C 0X7106
181
182/* R_S_16C_04 R_16C_IMMED R_ABS R_ADDRESS */
183#define R_16C_IMM04 0X5301
184
185/* R_S_16C_04 R_16C_IMMED R_ABS R_CODE_ADDR */
186#define R_16C_IMM04_C 0X5306
187
188/* R_S_16C_16 R_16C_IMMED R_ABS R_ADDRESS */
189#define R_16C_IMM16 0X1301
190
191/* R_S_16C_16 R_16C_IMMED R_ABS R_CODE_ADDR */
192#define R_16C_IMM16_C 0X1306
193
194/* R_S_16C_20 R_16C_IMMED R_ABS R_ADDRESS */
195#define R_16C_IMM20 0X8301
196
197/* R_S_16C_20 R_16C_IMMED R_ABS R_CODE_ADDR */
198#define R_16C_IMM20_C 0X8306
199
200/* R_S_16C_24 R_16C_IMMED R_ABS R_ADDRESS */
201#define R_16C_IMM24 0X7301
202
203/* R_S_16C_24 R_16C_IMMED R_ABS R_CODE_ADDR */
204#define R_16C_IMM24_C 0X7306
205
206/* R_S_16C_32 R_16C_IMMED R_ABS R_ADDRESS */
207#define R_16C_IMM32 0X2301
208
209/* R_S_16C_32 R_16C_IMMED R_ABS R_CODE_ADDR */
210#define R_16C_IMM32_C 0X2306
211
212
213/* Relocation item type. */
214#define R_ADDRTYPE 0x000f
215#define R_ADDRESS 0x0001 /* Take address of symbol. */
216#define R_CODE_ADDR 0x0006 /* Take address of symbol divided by 2. */
217
218/* Relocation action. */
219#define R_RELTO 0x00f0
220#define R_ABS 0x0000 /* Keep symbol's address as such. */
221#define R_PCREL 0x0010 /* Subtract the pc address of hole. */
222
223/* Relocation item data format. */
224#define R_FORMAT 0x0f00
225#define R_NUMBER 0x0000 /* Retain as two's complement value. */
226#define R_16C_DISPL 0x0400 /* CR16C displacement type. */
227#define R_16C_ABS 0x0100 /* CR16C absolute type. */
228#define R_16C_REGREL 0x0200 /* CR16C register-relative type. */
229#define R_16C_IMMED 0x0300 /* CR16C immediate type. */
230
231/* Relocation item size. */
232#define R_SIZESP 0xf000
233#define R_S_16C_04 0x5000
234#define R_S_16C_04_a 0x4000
235#define R_S_16C_08 0x0000
236#define R_S_16C_14 0x3000
237#define R_S_16C_16 0x1000
238#define R_S_16C_20 0x8000
239#define R_S_16C_24_a 0x6000
240#define R_S_16C_24 0x7000
241#define R_S_16C_32 0x2000
242
243
244/* Processor specific section indices. These sections do not actually
245 exist. Symbols with a st_shndx field corresponding to one of these
246 values have a special meaning. */
247
248/* Far common symbol. */
249#define SHN_CR16C_FCOMMON SHN_LORESERVE
250#define SHN_CR16C_NCOMMON (SHN_LORESERVE + 1)
251
252typedef struct reloc_map
253{
254 unsigned short cr_reloc_type; /* CR relocation type. */
255 bfd_reloc_code_real_type bfd_reloc_enum; /* BFD relocation enum. */
256} RELOC_MAP;
257
258#endif /* _ELF_CR16C_H */