Subversion Repositories Kolibri OS

Rev

Rev 5191 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5191 Rev 6324
1
/* CRIS ELF support for BFD.
1
/* CRIS ELF support for BFD.
2
   Copyright 2000, 2001, 2004, 2010  Free Software Foundation, Inc.
2
   Copyright (C) 2000-2015 Free Software Foundation, Inc.
3
   Contributed by Axis Communications AB, Lund, Sweden.
3
   Contributed by Axis Communications AB, Lund, Sweden.
4
   Written by Hans-Peter Nilsson.
4
   Written by Hans-Peter Nilsson.
5
 
5
 
6
   This file is part of BFD, the Binary File Descriptor library.
6
   This file is part of BFD, the Binary File Descriptor library.
7
 
7
 
8
   This program is free software; you can redistribute it and/or modify
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 3 of the License, or
10
   the Free Software Foundation; either version 3 of the License, or
11
   (at your option) any later version.
11
   (at your option) any later version.
12
 
12
 
13
   This program is distributed in the hope that it will be useful,
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
16
   GNU General Public License for more details.
17
 
17
 
18
   You should have received a copy of the GNU General Public License
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software Foundation,
19
   along with this program; if not, write to the Free Software Foundation,
20
   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20
   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
21
 
21
 
22
#ifndef _ELF_CRIS_H
22
#ifndef _ELF_CRIS_H
23
#define _ELF_CRIS_H
23
#define _ELF_CRIS_H
24
 
24
 
25
#include "elf/reloc-macros.h"
25
#include "elf/reloc-macros.h"
26
 
26
 
27
/* Relocations.  */
27
/* Relocations.  */
28
START_RELOC_NUMBERS (elf_cris_reloc_type)
28
START_RELOC_NUMBERS (elf_cris_reloc_type)
29
  RELOC_NUMBER (R_CRIS_NONE,		0)
29
  RELOC_NUMBER (R_CRIS_NONE,		0)
30
  RELOC_NUMBER (R_CRIS_8,		1)
30
  RELOC_NUMBER (R_CRIS_8,		1)
31
  RELOC_NUMBER (R_CRIS_16,		2)
31
  RELOC_NUMBER (R_CRIS_16,		2)
32
  RELOC_NUMBER (R_CRIS_32,		3)
32
  RELOC_NUMBER (R_CRIS_32,		3)
33
 
33
 
34
  /* The "PC" position is the location right after the relocation.  */
34
  /* The "PC" position is the location right after the relocation.  */
35
  RELOC_NUMBER (R_CRIS_8_PCREL,		4)
35
  RELOC_NUMBER (R_CRIS_8_PCREL,		4)
36
  RELOC_NUMBER (R_CRIS_16_PCREL,	5)
36
  RELOC_NUMBER (R_CRIS_16_PCREL,	5)
37
  RELOC_NUMBER (R_CRIS_32_PCREL,	6)
37
  RELOC_NUMBER (R_CRIS_32_PCREL,	6)
38
 
38
 
39
  RELOC_NUMBER (R_CRIS_GNU_VTINHERIT,	7)
39
  RELOC_NUMBER (R_CRIS_GNU_VTINHERIT,	7)
40
  RELOC_NUMBER (R_CRIS_GNU_VTENTRY,	8)
40
  RELOC_NUMBER (R_CRIS_GNU_VTENTRY,	8)
41
 
41
 
42
  /* Copy contents at dynlinking.  Generated by the linker.
42
  /* Copy contents at dynlinking.  Generated by the linker.
43
     The BFD equivalent is BFD_RELOC_CRIS_COPY.  */
43
     The BFD equivalent is BFD_RELOC_CRIS_COPY.  */
44
  RELOC_NUMBER (R_CRIS_COPY, 9)
44
  RELOC_NUMBER (R_CRIS_COPY, 9)
45
 
45
 
46
  /* Create GOT entry.  Generated by the linker.
46
  /* Create GOT entry.  Generated by the linker.
47
     The BFD equivalent is BFD_RELOC_CRIS_GLOB_DAT.  */
47
     The BFD equivalent is BFD_RELOC_CRIS_GLOB_DAT.  */
48
  RELOC_NUMBER (R_CRIS_GLOB_DAT, 10)
48
  RELOC_NUMBER (R_CRIS_GLOB_DAT, 10)
49
 
49
 
50
  /* Create PLT entry.  Generated by the linker.
50
  /* Create PLT entry.  Generated by the linker.
51
     The BFD equivalent is BFD_RELOC_CRIS_JUMP_SLOT.  */
51
     The BFD equivalent is BFD_RELOC_CRIS_JUMP_SLOT.  */
52
  RELOC_NUMBER (R_CRIS_JUMP_SLOT, 11)
52
  RELOC_NUMBER (R_CRIS_JUMP_SLOT, 11)
53
 
53
 
54
  /* Adjust by program base.  Generated by the linker.
54
  /* Adjust by program base.  Generated by the linker.
55
     The BFD equivalent is BFD_RELOC_CRIS_RELATIVE.  */
55
     The BFD equivalent is BFD_RELOC_CRIS_RELATIVE.  */
56
  RELOC_NUMBER (R_CRIS_RELATIVE, 12)
56
  RELOC_NUMBER (R_CRIS_RELATIVE, 12)
57
 
57
 
58
  /* A 16-bit offset to entry in GOT and request to create GOT entry for
58
  /* A 16-bit offset to entry in GOT and request to create GOT entry for
59
     that symbol.
59
     that symbol.
60
     The BFD equivalent is BFD_RELOC_CRIS_16_GOT.  */
60
     The BFD equivalent is BFD_RELOC_CRIS_16_GOT.  */
61
  RELOC_NUMBER (R_CRIS_16_GOT, 13)
61
  RELOC_NUMBER (R_CRIS_16_GOT, 13)
62
 
62
 
63
  /* A 32-bit offset to entry in GOT and request to create GOT entry for
63
  /* A 32-bit offset to entry in GOT and request to create GOT entry for
64
     that symbol.
64
     that symbol.
65
     The BFD equivalent is BFD_RELOC_CRIS_32_GOT.  */
65
     The BFD equivalent is BFD_RELOC_CRIS_32_GOT.  */
66
  RELOC_NUMBER (R_CRIS_32_GOT, 14)
66
  RELOC_NUMBER (R_CRIS_32_GOT, 14)
67
 
67
 
68
  /* A 16-bit offset to entry in PLT part of GOT and request to create PLT
68
  /* A 16-bit offset to entry in PLT part of GOT and request to create PLT
69
     entry for that symbol.
69
     entry for that symbol.
70
     The BFD equivalent is BFD_RELOC_CRIS_16_GOTPLT.  */
70
     The BFD equivalent is BFD_RELOC_CRIS_16_GOTPLT.  */
71
  RELOC_NUMBER (R_CRIS_16_GOTPLT, 15)
71
  RELOC_NUMBER (R_CRIS_16_GOTPLT, 15)
72
 
72
 
73
  /* A 32-bit offset to entry in PLT part of GOT and request to create PLT
73
  /* A 32-bit offset to entry in PLT part of GOT and request to create PLT
74
     entry for that symbol.
74
     entry for that symbol.
75
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTPLT.  */
75
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTPLT.  */
76
  RELOC_NUMBER (R_CRIS_32_GOTPLT, 16)
76
  RELOC_NUMBER (R_CRIS_32_GOTPLT, 16)
77
 
77
 
78
  /* A 32-bit offset from GOT to (local) symbol: no GOT entry should be
78
  /* A 32-bit offset from GOT to (local) symbol: no GOT entry should be
79
     necessary.
79
     necessary.
80
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL.  */
80
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL.  */
81
  RELOC_NUMBER (R_CRIS_32_GOTREL, 17)
81
  RELOC_NUMBER (R_CRIS_32_GOTREL, 17)
82
 
82
 
83
  /* A 32-bit offset from GOT to entry for this symbol in PLT and request
83
  /* A 32-bit offset from GOT to entry for this symbol in PLT and request
84
     to create PLT entry for symbol.
84
     to create PLT entry for symbol.
85
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL.  */
85
     The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL.  */
86
  RELOC_NUMBER (R_CRIS_32_PLT_GOTREL, 18)
86
  RELOC_NUMBER (R_CRIS_32_PLT_GOTREL, 18)
87
 
87
 
88
  /* A 32-bit offset from location after this relocation (addend specifies
88
  /* A 32-bit offset from location after this relocation (addend specifies
89
     offset) to entry for this symbol in PLT and request to create PLT
89
     offset) to entry for this symbol in PLT and request to create PLT
90
     entry for symbol.
90
     entry for symbol.
91
     The BFD equivalent is BFD_RELOC_CRIS_32_PLT_PCREL.  */
91
     The BFD equivalent is BFD_RELOC_CRIS_32_PLT_PCREL.  */
92
  RELOC_NUMBER (R_CRIS_32_PLT_PCREL, 19)
92
  RELOC_NUMBER (R_CRIS_32_PLT_PCREL, 19)
93
 
93
 
94
  /* An assembler-generated-only relocation, instructing the linker to
94
  /* An assembler-generated-only relocation, instructing the linker to
95
     reserve two GOT slots, carrying the R_CRIS_DTP relocation for the
95
     reserve two GOT slots, carrying the R_CRIS_DTP relocation for the
96
     symbol (pointing to the first slot, the relocation fills in
96
     symbol (pointing to the first slot, the relocation fills in
97
     both).  The value is a 32-bit-value, relative to the start of the
97
     both).  The value is a 32-bit-value, relative to the start of the
98
     GOT.  Assembly syntax: "sym:GDGOTREL".  */
98
     GOT.  Assembly syntax: "sym:GDGOTREL".  */
99
  RELOC_NUMBER (R_CRIS_32_GOT_GD, 20)
99
  RELOC_NUMBER (R_CRIS_32_GOT_GD, 20)
100
 
100
 
101
  /* Similar to R_CRIS_32_GOT_GD, but the value is a 16-bit unsigned
101
  /* Similar to R_CRIS_32_GOT_GD, but the value is a 16-bit unsigned
102
     number, limiting access to 65536/4 global symbols per module (or
102
     number, limiting access to 65536/4 global symbols per module (or
103
     65536/8 thread variables; loosely speaking G*4+T*8 < 65536, where
103
     65536/8 thread variables; loosely speaking G*4+T*8 < 65536, where
104
     T is the number of thread variables and G is the number of other
104
     T is the number of thread variables and G is the number of other
105
     external global variables and functions).  Assembly syntax:
105
     external global variables and functions).  Assembly syntax:
106
     "sym:GDGOTREL16".  */
106
     "sym:GDGOTREL16".  */
107
  RELOC_NUMBER (R_CRIS_16_GOT_GD, 21)
107
  RELOC_NUMBER (R_CRIS_16_GOT_GD, 21)
108
 
108
 
109
  /* Similar to R_CRIS_32_GOT_GD, but the value is the absolute
109
  /* Similar to R_CRIS_32_GOT_GD, but the value is the absolute
110
     address of the GOT entry.  Disallowed in DSOs created with
110
     address of the GOT entry.  Disallowed in DSOs created with
111
     -shared.  Assembly syntax: "sym:GD".  */
111
     -shared.  Assembly syntax: "sym:GD".  */
112
  RELOC_NUMBER (R_CRIS_32_GD, 22)
112
  RELOC_NUMBER (R_CRIS_32_GD, 22)
113
 
113
 
114
  /* A linker-generated-only relocation, instructing the dynamic
114
  /* A linker-generated-only relocation, instructing the dynamic
115
     linker to fill in the module ID and module-relative-TLS-block
115
     linker to fill in the module ID and module-relative-TLS-block
116
     offset of the symbol in question, used for GOT entries.  Note
116
     offset of the symbol in question, used for GOT entries.  Note
117
     that this relocation instructs to fill in two 32-bit values.  */
117
     that this relocation instructs to fill in two 32-bit values.  */
118
  RELOC_NUMBER (R_CRIS_DTP, 23)
118
  RELOC_NUMBER (R_CRIS_DTP, 23)
119
 
119
 
120
  /* An assembler-generated-only relocation, instructing the linker to
120
  /* An assembler-generated-only relocation, instructing the linker to
121
     reserve the first two GOT slots, and attach the R_CRIS_DTPMOD
121
     reserve the first two GOT slots, and attach the R_CRIS_DTPMOD
122
     relocation(*) for the module to the first slot, the second
122
     relocation(*) for the module to the first slot, the second
123
     containing zero.  The value is 32 bits, the offset from the start
123
     containing zero.  The value is 32 bits, the offset from the start
124
     of the TLS block of the module to the thread-local symbol
124
     of the TLS block of the module to the thread-local symbol
125
     mentioned in the relocation.  This relocation must only be applied
125
     mentioned in the relocation.  This relocation must only be applied
126
     to module-local symbols.  Assembly syntax: "expr:DTPREL".  */
126
     to module-local symbols.  Assembly syntax: "expr:DTPREL".  */
127
  RELOC_NUMBER (R_CRIS_32_DTPREL, 24)
127
  RELOC_NUMBER (R_CRIS_32_DTPREL, 24)
128
 
128
 
129
  /* Similar to R_CRIS_32_DTPREL, but the value is a 16-bit signed
129
  /* Similar to R_CRIS_32_DTPREL, but the value is a 16-bit signed
130
     number, limiting the size of thread-variables of the DSO to 32768
130
     number, limiting the size of thread-variables of the DSO to 32768
131
     bytes.  (Note: matches both model 1 and 2 and allows use of addo.w
131
     bytes.  (Note: matches both model 1 and 2 and allows use of addo.w
132
     as the instruction where this relocation is used.)  Assembly
132
     as the instruction where this relocation is used.)  Assembly
133
     syntax: "expr:DTPREL16".  */
133
     syntax: "expr:DTPREL16".  */
134
  RELOC_NUMBER (R_CRIS_16_DTPREL, 25)
134
  RELOC_NUMBER (R_CRIS_16_DTPREL, 25)
135
 
135
 
136
  /* An assembler-generated-only relocation, instructing the linker to
136
  /* An assembler-generated-only relocation, instructing the linker to
137
     reserve a GOT slot and attach the R_CRIS_32_TPREL relocation for
137
     reserve a GOT slot and attach the R_CRIS_32_TPREL relocation for
138
     the symbol in question.  The value is 32 bits, which is the
138
     the symbol in question.  The value is 32 bits, which is the
139
     GOT-relative offset of the slot.  Assembly syntax:
139
     GOT-relative offset of the slot.  Assembly syntax:
140
     "sym:TPOFFGOT".  */
140
     "sym:TPOFFGOT".  */
141
  RELOC_NUMBER (R_CRIS_32_GOT_TPREL, 26)
141
  RELOC_NUMBER (R_CRIS_32_GOT_TPREL, 26)
142
 
142
 
143
  /* Similar to R_CRIS_32_TPREL, but the value is a 16-bit positive
143
  /* Similar to R_CRIS_32_TPREL, but the value is a 16-bit positive
144
     number, limiting the number of thread- and global variables of
144
     number, limiting the number of thread- and global variables of
145
     the DSO to 32768/4.  Assembly syntax: "sym:TPOFFGOT16".  */
145
     the DSO to 32768/4.  Assembly syntax: "sym:TPOFFGOT16".  */
146
  RELOC_NUMBER (R_CRIS_16_GOT_TPREL, 27)
146
  RELOC_NUMBER (R_CRIS_16_GOT_TPREL, 27)
147
 
147
 
148
  /* An assembler- and linker-generated relocation, instructing to
148
  /* An assembler- and linker-generated relocation, instructing to
149
     resolve the symbol in question yielding the TLS offset of the
149
     resolve the symbol in question yielding the TLS offset of the
150
     thread variable, relative to the global TLS block.  Not allowed
150
     thread variable, relative to the global TLS block.  Not allowed
151
     as input when generating a DSO.  Assembly syntax:
151
     as input when generating a DSO.  Assembly syntax:
152
     "expr:TPOFF".  */
152
     "expr:TPOFF".  */
153
  RELOC_NUMBER (R_CRIS_32_TPREL, 28)
153
  RELOC_NUMBER (R_CRIS_32_TPREL, 28)
154
 
154
 
155
  /* Similar to R_CRIS_32_TPREL, but only applicable to executables
155
  /* Similar to R_CRIS_32_TPREL, but only applicable to executables
156
     compiled with -msmall-tls. Not allowed in a DSO. The value is a
156
     compiled with -msmall-tls. Not allowed in a DSO. The value is a
157
     16-bit signed number, limiting the size of thread-variables of
157
     16-bit signed number, limiting the size of thread-variables of
158
     the executable to 32768 bytes. (Note: being signed makes it match
158
     the executable to 32768 bytes. (Note: being signed makes it match
159
     both model 1 and 2 and allows use of addo.w as the instruction
159
     both model 1 and 2 and allows use of addo.w as the instruction
160
     where this relocation is applied.)  Assembly syntax:
160
     where this relocation is applied.)  Assembly syntax:
161
     "expr:TPOFF16".  */
161
     "expr:TPOFF16".  */
162
  RELOC_NUMBER (R_CRIS_16_TPREL, 29)
162
  RELOC_NUMBER (R_CRIS_16_TPREL, 29)
163
 
163
 
164
  /* A linker-generated-only relocation, instructing the dynamic
164
  /* A linker-generated-only relocation, instructing the dynamic
165
     linker to fill in the current module ID, used for GOT entries
165
     linker to fill in the current module ID, used for GOT entries
166
     (usually the fourth one).  */
166
     (usually the fourth one).  */
167
  RELOC_NUMBER (R_CRIS_DTPMOD, 30)
167
  RELOC_NUMBER (R_CRIS_DTPMOD, 30)
168
 
168
 
169
  /* Similar to R_CRIS_32_GOT_TPREL, but the value is the absolute
169
  /* Similar to R_CRIS_32_GOT_TPREL, but the value is the absolute
170
     address of the GOT entry.  Disallowed in DSOs created with
170
     address of the GOT entry.  Disallowed in DSOs created with
171
     -shared.  Assembly syntax: "sym:IE".  */
171
     -shared.  Assembly syntax: "sym:IE".  */
172
  RELOC_NUMBER (R_CRIS_32_IE, 31)
172
  RELOC_NUMBER (R_CRIS_32_IE, 31)
173
 
173
 
174
  /* No other relocs must be visible outside the assembler.  */
174
  /* No other relocs must be visible outside the assembler.  */
175
 
175
 
176
END_RELOC_NUMBERS (R_CRIS_max)
176
END_RELOC_NUMBERS (R_CRIS_max)
177
 
177
 
178
/* User symbols in this file have a leading underscore.  */
178
/* User symbols in this file have a leading underscore.  */
179
#define EF_CRIS_UNDERSCORE		0x00000001
179
#define EF_CRIS_UNDERSCORE		0x00000001
180
 
180
 
181
/* This is a mask for different incompatible machine variants.  */
181
/* This is a mask for different incompatible machine variants.  */
182
#define EF_CRIS_VARIANT_MASK		0x0000000e
182
#define EF_CRIS_VARIANT_MASK		0x0000000e
183
 
183
 
184
/* Variant 0; may contain v0..10 object.  */
184
/* Variant 0; may contain v0..10 object.  */
185
#define EF_CRIS_VARIANT_ANY_V0_V10	0x00000000
185
#define EF_CRIS_VARIANT_ANY_V0_V10	0x00000000
186
 
186
 
187
/* Variant 1; contains v32 object.  */
187
/* Variant 1; contains v32 object.  */
188
#define EF_CRIS_VARIANT_V32		0x00000002
188
#define EF_CRIS_VARIANT_V32		0x00000002
189
 
189
 
190
/* Variant 2; contains object compatible with v32 and v10.  */
190
/* Variant 2; contains object compatible with v32 and v10.  */
191
#define EF_CRIS_VARIANT_COMMON_V10_V32	0x00000004
191
#define EF_CRIS_VARIANT_COMMON_V10_V32	0x00000004
192
 
192
 
193
#endif /* _ELF_CRIS_H */
193
#endif /* _ELF_CRIS_H */