1 |
1624 |
jcastillo |
/* MIPS ELF support for BFD.
|
2 |
|
|
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
|
5 |
|
|
information in the System V Application Binary Interface, MIPS
|
6 |
|
|
Processor Supplement.
|
7 |
|
|
|
8 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
9 |
|
|
|
10 |
|
|
This program is free software; you can redistribute it and/or modify
|
11 |
|
|
it under the terms of the GNU General Public License as published by
|
12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
(at your option) any later version.
|
14 |
|
|
|
15 |
|
|
This program is distributed in the hope that it will be useful,
|
16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
GNU General Public License for more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License
|
21 |
|
|
along with this program; if not, write to the Free Software
|
22 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
23 |
|
|
|
24 |
|
|
/* This file holds definitions specific to the MIPS ELF ABI. Note
|
25 |
|
|
that most of this is not actually implemented by BFD. */
|
26 |
|
|
|
27 |
|
|
/* Processor specific flags for the ELF header e_flags field. */
|
28 |
|
|
|
29 |
|
|
/* At least one .noreorder directive appears in the source. */
|
30 |
|
|
#define EF_MIPS_NOREORDER 0x00000001
|
31 |
|
|
|
32 |
|
|
/* File contains position independent code. */
|
33 |
|
|
#define EF_MIPS_PIC 0x00000002
|
34 |
|
|
|
35 |
|
|
/* Code in file uses the standard calling sequence for calling
|
36 |
|
|
position independent code. */
|
37 |
|
|
#define EF_MIPS_CPIC 0x00000004
|
38 |
|
|
|
39 |
|
|
/* Four bit MIPS architecture field. */
|
40 |
|
|
#define EF_MIPS_ARCH 0xf0000000
|
41 |
|
|
|
42 |
|
|
/* -mips1 code. */
|
43 |
|
|
#define E_MIPS_ARCH_1 0x00000000
|
44 |
|
|
|
45 |
|
|
/* -mips2 code. */
|
46 |
|
|
#define E_MIPS_ARCH_2 0x10000000
|
47 |
|
|
|
48 |
|
|
/* -mips3 code. */
|
49 |
|
|
#define E_MIPS_ARCH_3 0x20000000
|
50 |
|
|
|
51 |
|
|
/* Processor specific section indices. These sections do not actually
|
52 |
|
|
exist. Symbols with a st_shndx field corresponding to one of these
|
53 |
|
|
values have a special meaning. */
|
54 |
|
|
|
55 |
|
|
/* Defined and allocated common symbol. Value is virtual address. If
|
56 |
|
|
relocated, alignment must be preserved. */
|
57 |
|
|
#define SHN_MIPS_ACOMMON 0xff00
|
58 |
|
|
|
59 |
|
|
/* Defined and allocated text symbol. Value is virtual address.
|
60 |
|
|
Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
|
61 |
|
|
#define SHN_MIPS_TEXT 0xff01
|
62 |
|
|
|
63 |
|
|
/* Defined and allocated data symbol. Value is virtual address.
|
64 |
|
|
Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
|
65 |
|
|
#define SHN_MIPS_DATA 0xff02
|
66 |
|
|
|
67 |
|
|
/* Small common symbol. */
|
68 |
|
|
#define SHN_MIPS_SCOMMON 0xff03
|
69 |
|
|
|
70 |
|
|
/* Small undefined symbol. */
|
71 |
|
|
#define SHN_MIPS_SUNDEFINED 0xff04
|
72 |
|
|
|
73 |
|
|
/* Processor specific section types. */
|
74 |
|
|
|
75 |
|
|
/* Section contains the set of dynamic shared objects used when
|
76 |
|
|
statically linking. */
|
77 |
|
|
#define SHT_MIPS_LIBLIST 0x70000000
|
78 |
|
|
|
79 |
|
|
/* I'm not sure what this is, but it's used on Irix 5. */
|
80 |
|
|
#define SHT_MIPS_MSYM 0x70000001
|
81 |
|
|
|
82 |
|
|
/* Section contains list of symbols whose definitions conflict with
|
83 |
|
|
symbols defined in shared objects. */
|
84 |
|
|
#define SHT_MIPS_CONFLICT 0x70000002
|
85 |
|
|
|
86 |
|
|
/* Section contains the global pointer table. */
|
87 |
|
|
#define SHT_MIPS_GPTAB 0x70000003
|
88 |
|
|
|
89 |
|
|
/* Section contains microcode information. The exact format is
|
90 |
|
|
unspecified. */
|
91 |
|
|
#define SHT_MIPS_UCODE 0x70000004
|
92 |
|
|
|
93 |
|
|
/* Section contains some sort of debugging information. The exact
|
94 |
|
|
format is unspecified. It's probably ECOFF symbols. */
|
95 |
|
|
#define SHT_MIPS_DEBUG 0x70000005
|
96 |
|
|
|
97 |
|
|
/* Section contains register usage information. */
|
98 |
|
|
#define SHT_MIPS_REGINFO 0x70000006
|
99 |
|
|
|
100 |
|
|
/* Section contains miscellaneous options (used on Irix). */
|
101 |
|
|
#define SHT_MIPS_OPTIONS 0x7000000d
|
102 |
|
|
|
103 |
|
|
/* DWARF debugging section (used on Irix 6). */
|
104 |
|
|
#define SHT_MIPS_DWARF 0x7000001e
|
105 |
|
|
|
106 |
|
|
/* Events section. This appears on Irix 6. I don't know what it
|
107 |
|
|
means. */
|
108 |
|
|
#define SHT_MIPS_EVENTS 0x70000021
|
109 |
|
|
|
110 |
|
|
/* A section of type SHT_MIPS_LIBLIST contains an array of the
|
111 |
|
|
following structure. The sh_link field is the section index of the
|
112 |
|
|
string table. The sh_info field is the number of entries in the
|
113 |
|
|
section. */
|
114 |
|
|
typedef struct
|
115 |
|
|
{
|
116 |
|
|
/* String table index for name of shared object. */
|
117 |
|
|
unsigned long l_name;
|
118 |
|
|
/* Time stamp. */
|
119 |
|
|
unsigned long l_time_stamp;
|
120 |
|
|
/* Checksum of symbol names and common sizes. */
|
121 |
|
|
unsigned long l_checksum;
|
122 |
|
|
/* String table index for version. */
|
123 |
|
|
unsigned long l_version;
|
124 |
|
|
/* Flags. */
|
125 |
|
|
unsigned long l_flags;
|
126 |
|
|
} Elf32_Lib;
|
127 |
|
|
|
128 |
|
|
/* The l_flags field of an Elf32_Lib structure may contain the
|
129 |
|
|
following flags. */
|
130 |
|
|
|
131 |
|
|
/* Require an exact match at runtime. */
|
132 |
|
|
#define LL_EXACT_MATCH 0x00000001
|
133 |
|
|
|
134 |
|
|
/* Ignore version incompatibilities at runtime. */
|
135 |
|
|
#define LL_IGNORE_INT_VER 0x00000002
|
136 |
|
|
|
137 |
|
|
/* A section of type SHT_MIPS_CONFLICT is an array of indices into the
|
138 |
|
|
.dynsym section. Each element has the following type. */
|
139 |
|
|
typedef unsigned long Elf32_Conflict;
|
140 |
|
|
|
141 |
|
|
/* A section of type SHT_MIPS_GPTAB contains information about how
|
142 |
|
|
much GP space would be required for different -G arguments. This
|
143 |
|
|
information is only used so that the linker can provide informative
|
144 |
|
|
suggestions as to the best -G value to use. The sh_info field is
|
145 |
|
|
the index of the section for which this information applies. The
|
146 |
|
|
contents of the section are an array of the following union. The
|
147 |
|
|
first element uses the gt_header field. The remaining elements use
|
148 |
|
|
the gt_entry field. */
|
149 |
|
|
typedef union
|
150 |
|
|
{
|
151 |
|
|
struct
|
152 |
|
|
{
|
153 |
|
|
/* -G value actually used for this object file. */
|
154 |
|
|
unsigned long gt_current_g_value;
|
155 |
|
|
/* Unused. */
|
156 |
|
|
unsigned long gt_unused;
|
157 |
|
|
} gt_header;
|
158 |
|
|
struct
|
159 |
|
|
{
|
160 |
|
|
/* If this -G argument has been used... */
|
161 |
|
|
unsigned long gt_g_value;
|
162 |
|
|
/* ...this many GP section bytes would be required. */
|
163 |
|
|
unsigned long gt_bytes;
|
164 |
|
|
} gt_entry;
|
165 |
|
|
} Elf32_gptab;
|
166 |
|
|
|
167 |
|
|
/* The external version of Elf32_gptab. */
|
168 |
|
|
|
169 |
|
|
typedef union
|
170 |
|
|
{
|
171 |
|
|
struct
|
172 |
|
|
{
|
173 |
|
|
unsigned char gt_current_g_value[4];
|
174 |
|
|
unsigned char gt_unused[4];
|
175 |
|
|
} gt_header;
|
176 |
|
|
struct
|
177 |
|
|
{
|
178 |
|
|
unsigned char gt_g_value[4];
|
179 |
|
|
unsigned char gt_bytes[4];
|
180 |
|
|
} gt_entry;
|
181 |
|
|
} Elf32_External_gptab;
|
182 |
|
|
|
183 |
|
|
/* A section of type SHT_MIPS_REGINFO contains the following
|
184 |
|
|
structure. */
|
185 |
|
|
typedef struct
|
186 |
|
|
{
|
187 |
|
|
/* Mask of general purpose registers used. */
|
188 |
|
|
unsigned long ri_gprmask;
|
189 |
|
|
/* Mask of co-processor registers used. */
|
190 |
|
|
unsigned long ri_cprmask[4];
|
191 |
|
|
/* GP register value for this object file. */
|
192 |
|
|
long ri_gp_value;
|
193 |
|
|
} Elf32_RegInfo;
|
194 |
|
|
|
195 |
|
|
/* The external version of the Elf_RegInfo structure. */
|
196 |
|
|
typedef struct
|
197 |
|
|
{
|
198 |
|
|
unsigned char ri_gprmask[4];
|
199 |
|
|
unsigned char ri_cprmask[4][4];
|
200 |
|
|
unsigned char ri_gp_value[4];
|
201 |
|
|
} Elf32_External_RegInfo;
|
202 |
|
|
|
203 |
|
|
/* MIPS ELF .reginfo swapping routines. */
|
204 |
|
|
extern void bfd_mips_elf32_swap_reginfo_in
|
205 |
|
|
PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
|
206 |
|
|
extern void bfd_mips_elf32_swap_reginfo_out
|
207 |
|
|
PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
|
208 |
|
|
|
209 |
|
|
/* Processor specific section flags. */
|
210 |
|
|
|
211 |
|
|
/* This section must be in the global data area. */
|
212 |
|
|
#define SHF_MIPS_GPREL 0x10000000
|
213 |
|
|
|
214 |
|
|
/* Processor specific program header types. */
|
215 |
|
|
|
216 |
|
|
/* Register usage information. Identifies one .reginfo section. */
|
217 |
|
|
#define PT_MIPS_REGINFO 0x70000000
|
218 |
|
|
|
219 |
|
|
/* Processor specific dynamic array tags. */
|
220 |
|
|
|
221 |
|
|
/* 32 bit version number for runtime linker interface. */
|
222 |
|
|
#define DT_MIPS_RLD_VERSION 0x70000001
|
223 |
|
|
|
224 |
|
|
/* Time stamp. */
|
225 |
|
|
#define DT_MIPS_TIME_STAMP 0x70000002
|
226 |
|
|
|
227 |
|
|
/* Checksum of external strings and common sizes. */
|
228 |
|
|
#define DT_MIPS_ICHECKSUM 0x70000003
|
229 |
|
|
|
230 |
|
|
/* Index of version string in string table. */
|
231 |
|
|
#define DT_MIPS_IVERSION 0x70000004
|
232 |
|
|
|
233 |
|
|
/* 32 bits of flags. */
|
234 |
|
|
#define DT_MIPS_FLAGS 0x70000005
|
235 |
|
|
|
236 |
|
|
/* Base address of the segment. */
|
237 |
|
|
#define DT_MIPS_BASE_ADDRESS 0x70000006
|
238 |
|
|
|
239 |
|
|
/* Address of .conflict section. */
|
240 |
|
|
#define DT_MIPS_CONFLICT 0x70000008
|
241 |
|
|
|
242 |
|
|
/* Address of .liblist section. */
|
243 |
|
|
#define DT_MIPS_LIBLIST 0x70000009
|
244 |
|
|
|
245 |
|
|
/* Number of local global offset table entries. */
|
246 |
|
|
#define DT_MIPS_LOCAL_GOTNO 0x7000000a
|
247 |
|
|
|
248 |
|
|
/* Number of entries in the .conflict section. */
|
249 |
|
|
#define DT_MIPS_CONFLICTNO 0x7000000b
|
250 |
|
|
|
251 |
|
|
/* Number of entries in the .liblist section. */
|
252 |
|
|
#define DT_MIPS_LIBLISTNO 0x70000010
|
253 |
|
|
|
254 |
|
|
/* Number of entries in the .dynsym section. */
|
255 |
|
|
#define DT_MIPS_SYMTABNO 0x70000011
|
256 |
|
|
|
257 |
|
|
/* Index of first external dynamic symbol not referenced locally. */
|
258 |
|
|
#define DT_MIPS_UNREFEXTNO 0x70000012
|
259 |
|
|
|
260 |
|
|
/* Index of first dynamic symbol in global offset table. */
|
261 |
|
|
#define DT_MIPS_GOTSYM 0x70000013
|
262 |
|
|
|
263 |
|
|
/* Number of page table entries in global offset table. */
|
264 |
|
|
#define DT_MIPS_HIPAGENO 0x70000014
|
265 |
|
|
|
266 |
|
|
/* Address of run time loader map, used for debugging. */
|
267 |
|
|
#define DT_MIPS_RLD_MAP 0x70000016
|