* mips.h (SHT_DVP_OVERLAY_TABLE,SHT_DVP_OVERLAY): New section types.
[deliverable/binutils-gdb.git] / include / elf / mips.h
1 /* MIPS ELF support for BFD.
2 Copyright (C) 1993, 1994, 1995, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 #ifndef _ELF_MIPS_H
28 #define _ELF_MIPS_H
29
30 /* Processor specific flags for the ELF header e_flags field. */
31
32 /* At least one .noreorder directive appears in the source. */
33 #define EF_MIPS_NOREORDER 0x00000001
34
35 /* File contains position independent code. */
36 #define EF_MIPS_PIC 0x00000002
37
38 /* Code in file uses the standard calling sequence for calling
39 position independent code. */
40 #define EF_MIPS_CPIC 0x00000004
41
42 /* Code in file uses new ABI (-n32 on Irix 6). */
43 #define EF_MIPS_ABI2 0x00000020
44
45 /* Four bit MIPS architecture field. */
46 #define EF_MIPS_ARCH 0xf0000000
47
48 /* -mips1 code. */
49 #define E_MIPS_ARCH_1 0x00000000
50
51 /* -mips2 code. */
52 #define E_MIPS_ARCH_2 0x10000000
53
54 /* -mips3 code. */
55 #define E_MIPS_ARCH_3 0x20000000
56
57 /* -mips4 code. */
58 #define E_MIPS_ARCH_4 0x30000000
59
60 /* Machine variant if we know it. This field was invented at Cygnus,
61 but it is hoped that other vendors will adopt it. If some standard
62 is developed, this code should be changed to follow it. */
63
64 #define EF_MIPS_MACH 0x00FF0000
65
66 /* Cygnus is choosing values between 80 and 9F;
67 00 - 7F should be left for a future standard;
68 the rest are open. */
69
70 #define E_MIPS_MACH_3900 0x00810000
71
72 #define E_MIPS_MACH_4010 0x00820000
73 #define E_MIPS_MACH_4100 0x00830000
74 /* start-sanitize-vr4320 */
75 #define E_MIPS_MACH_4320 0x00840000
76 /* end-sanitize-vr4320 */
77 #define E_MIPS_MACH_4650 0x00850000
78 /* start-sanitize-tx49 */
79 #define E_MIPS_MACH_4900 0x00860000
80 /* end-sanitize-tx49 */
81
82 /* start-sanitize-vr5400 */
83 #define E_MIPS_MACH_5400 0x00910000
84 /* end-sanitize-vr5400 */
85 /* start-sanitize-r5900 */
86 #define E_MIPS_MACH_5900 0x00920000
87 /* end-sanitize-r5900 */
88 \f
89 /* Processor specific section indices. These sections do not actually
90 exist. Symbols with a st_shndx field corresponding to one of these
91 values have a special meaning. */
92
93 /* Defined and allocated common symbol. Value is virtual address. If
94 relocated, alignment must be preserved. */
95 #define SHN_MIPS_ACOMMON 0xff00
96
97 /* Defined and allocated text symbol. Value is virtual address.
98 Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
99 #define SHN_MIPS_TEXT 0xff01
100
101 /* Defined and allocated data symbol. Value is virtual address.
102 Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
103 #define SHN_MIPS_DATA 0xff02
104
105 /* Small common symbol. */
106 #define SHN_MIPS_SCOMMON 0xff03
107
108 /* Small undefined symbol. */
109 #define SHN_MIPS_SUNDEFINED 0xff04
110 \f
111 /* Processor specific section types. */
112
113 /* Section contains the set of dynamic shared objects used when
114 statically linking. */
115 #define SHT_MIPS_LIBLIST 0x70000000
116
117 /* I'm not sure what this is, but it's used on Irix 5. */
118 #define SHT_MIPS_MSYM 0x70000001
119
120 /* Section contains list of symbols whose definitions conflict with
121 symbols defined in shared objects. */
122 #define SHT_MIPS_CONFLICT 0x70000002
123
124 /* Section contains the global pointer table. */
125 #define SHT_MIPS_GPTAB 0x70000003
126
127 /* Section contains microcode information. The exact format is
128 unspecified. */
129 #define SHT_MIPS_UCODE 0x70000004
130
131 /* Section contains some sort of debugging information. The exact
132 format is unspecified. It's probably ECOFF symbols. */
133 #define SHT_MIPS_DEBUG 0x70000005
134
135 /* Section contains register usage information. */
136 #define SHT_MIPS_REGINFO 0x70000006
137
138 /* Section contains interface information. */
139 #define SHT_MIPS_IFACE 0x7000000b
140
141 /* Section contains description of contents of another section. */
142 #define SHT_MIPS_CONTENT 0x7000000c
143
144 /* Section contains miscellaneous options. */
145 #define SHT_MIPS_OPTIONS 0x7000000d
146
147 /* DWARF debugging section. */
148 #define SHT_MIPS_DWARF 0x7000001e
149
150 /* I'm not sure what this is, but it appears on Irix 6. */
151 #define SHT_MIPS_SYMBOL_LIB 0x70000020
152
153 /* Events section. */
154 #define SHT_MIPS_EVENTS 0x70000021
155
156 /* start-sanitize-sky */
157 /* The VU overlay table. */
158 #define SHT_DVP_OVERLAY_TABLE 0x7ffff420
159 #define SHNAME_DVP_OVERLAY_TABLE ".DVP.ovlytab"
160 #define SHNAME_DVP_OVERLAY_STRTAB ".DVP.ovlystrtab"
161 /* A VU overlay. */
162 #define SHT_DVP_OVERLAY 0x7ffff421
163 /* Prefix of VU overlay sections. */
164 #define SHNAME_DVP_OVERLAY_PREFIX ".DVP.overlay."
165 /* end-sanitize-sky */
166
167 /* A section of type SHT_MIPS_LIBLIST contains an array of the
168 following structure. The sh_link field is the section index of the
169 string table. The sh_info field is the number of entries in the
170 section. */
171 typedef struct
172 {
173 /* String table index for name of shared object. */
174 unsigned long l_name;
175 /* Time stamp. */
176 unsigned long l_time_stamp;
177 /* Checksum of symbol names and common sizes. */
178 unsigned long l_checksum;
179 /* String table index for version. */
180 unsigned long l_version;
181 /* Flags. */
182 unsigned long l_flags;
183 } Elf32_Lib;
184
185 /* The l_flags field of an Elf32_Lib structure may contain the
186 following flags. */
187
188 /* Require an exact match at runtime. */
189 #define LL_EXACT_MATCH 0x00000001
190
191 /* Ignore version incompatibilities at runtime. */
192 #define LL_IGNORE_INT_VER 0x00000002
193
194 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
195 .dynsym section. Each element has the following type. */
196 typedef unsigned long Elf32_Conflict;
197
198 /* A section of type SHT_MIPS_GPTAB contains information about how
199 much GP space would be required for different -G arguments. This
200 information is only used so that the linker can provide informative
201 suggestions as to the best -G value to use. The sh_info field is
202 the index of the section for which this information applies. The
203 contents of the section are an array of the following union. The
204 first element uses the gt_header field. The remaining elements use
205 the gt_entry field. */
206 typedef union
207 {
208 struct
209 {
210 /* -G value actually used for this object file. */
211 unsigned long gt_current_g_value;
212 /* Unused. */
213 unsigned long gt_unused;
214 } gt_header;
215 struct
216 {
217 /* If this -G argument has been used... */
218 unsigned long gt_g_value;
219 /* ...this many GP section bytes would be required. */
220 unsigned long gt_bytes;
221 } gt_entry;
222 } Elf32_gptab;
223
224 /* The external version of Elf32_gptab. */
225
226 typedef union
227 {
228 struct
229 {
230 unsigned char gt_current_g_value[4];
231 unsigned char gt_unused[4];
232 } gt_header;
233 struct
234 {
235 unsigned char gt_g_value[4];
236 unsigned char gt_bytes[4];
237 } gt_entry;
238 } Elf32_External_gptab;
239
240 /* A section of type SHT_MIPS_REGINFO contains the following
241 structure. */
242 typedef struct
243 {
244 /* Mask of general purpose registers used. */
245 unsigned long ri_gprmask;
246 /* Mask of co-processor registers used. */
247 unsigned long ri_cprmask[4];
248 /* GP register value for this object file. */
249 long ri_gp_value;
250 } Elf32_RegInfo;
251
252 /* The external version of the Elf_RegInfo structure. */
253 typedef struct
254 {
255 unsigned char ri_gprmask[4];
256 unsigned char ri_cprmask[4][4];
257 unsigned char ri_gp_value[4];
258 } Elf32_External_RegInfo;
259
260 /* MIPS ELF .reginfo swapping routines. */
261 extern void bfd_mips_elf32_swap_reginfo_in
262 PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
263 extern void bfd_mips_elf32_swap_reginfo_out
264 PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
265 \f
266 /* Processor specific section flags. */
267
268 /* This section must be in the global data area. */
269 #define SHF_MIPS_GPREL 0x10000000
270
271 /* This section should be merged. */
272 #define SHF_MIPS_MERGE 0x20000000
273
274 /* This section contains 32 bit addresses. */
275 #define SHF_MIPS_ADDR32 0x40000000
276
277 /* This section contains 64 bit addresses. */
278 #define SHF_MIPS_ADDR64 0x80000000
279
280 /* This section may not be stripped. */
281 #define SHF_MIPS_NOSTRIP 0x08000000
282
283 /* This section is local to threads. */
284 #define SHF_MIPS_LOCAL 0x04000000
285
286 /* Linker should generate implicit weak names for this section. */
287 #define SHF_MIPS_NAMES 0x02000000
288 \f
289 /* Processor specific program header types. */
290
291 /* Register usage information. Identifies one .reginfo section. */
292 #define PT_MIPS_REGINFO 0x70000000
293
294 /* Runtime procedure table. */
295 #define PT_MIPS_RTPROC 0x70000001
296 \f
297 /* Processor specific dynamic array tags. */
298
299 /* 32 bit version number for runtime linker interface. */
300 #define DT_MIPS_RLD_VERSION 0x70000001
301
302 /* Time stamp. */
303 #define DT_MIPS_TIME_STAMP 0x70000002
304
305 /* Checksum of external strings and common sizes. */
306 #define DT_MIPS_ICHECKSUM 0x70000003
307
308 /* Index of version string in string table. */
309 #define DT_MIPS_IVERSION 0x70000004
310
311 /* 32 bits of flags. */
312 #define DT_MIPS_FLAGS 0x70000005
313
314 /* Base address of the segment. */
315 #define DT_MIPS_BASE_ADDRESS 0x70000006
316
317 /* Address of .conflict section. */
318 #define DT_MIPS_CONFLICT 0x70000008
319
320 /* Address of .liblist section. */
321 #define DT_MIPS_LIBLIST 0x70000009
322
323 /* Number of local global offset table entries. */
324 #define DT_MIPS_LOCAL_GOTNO 0x7000000a
325
326 /* Number of entries in the .conflict section. */
327 #define DT_MIPS_CONFLICTNO 0x7000000b
328
329 /* Number of entries in the .liblist section. */
330 #define DT_MIPS_LIBLISTNO 0x70000010
331
332 /* Number of entries in the .dynsym section. */
333 #define DT_MIPS_SYMTABNO 0x70000011
334
335 /* Index of first external dynamic symbol not referenced locally. */
336 #define DT_MIPS_UNREFEXTNO 0x70000012
337
338 /* Index of first dynamic symbol in global offset table. */
339 #define DT_MIPS_GOTSYM 0x70000013
340
341 /* Number of page table entries in global offset table. */
342 #define DT_MIPS_HIPAGENO 0x70000014
343
344 /* Address of run time loader map, used for debugging. */
345 #define DT_MIPS_RLD_MAP 0x70000016
346 \f
347 /* Flags which may appear in a DT_MIPS_FLAGS entry. */
348
349 /* No flags. */
350 #define RHF_NONE 0x00000000
351
352 /* Uses shortcut pointers. */
353 #define RHF_QUICKSTART 0x00000001
354
355 /* Hash size is not a power of two. */
356 #define RHF_NOTPOT 0x00000002
357
358 /* Ignore LD_LIBRARY_PATH. */
359 #define RHS_NO_LIBRARY_REPLACEMENT \
360 0x00000004
361 \f
362 /* Special values for the st_other field in the symbol table. These
363 are used in an Irix 5 dynamic symbol table. */
364
365 #define STO_DEFAULT 0x00
366 #define STO_INTERNAL 0x01
367 #define STO_HIDDEN 0x02
368 #define STO_PROTECTED 0x03
369
370 /* start-sanitize-sky */
371 /* These values are used for the dvp. */
372 #define STO_DVP_DMA 0xe8
373 #define STO_DVP_VIF 0xe9
374 #define STO_DVP_GIF 0xea
375 #define STO_DVP_VU 0xeb
376 /* Reserve a couple in case we need them. */
377 #define STO_DVP_RES1 0xec
378 #define STO_DVP_RES2 0xed
379 #define STO_DVP_P(sto) ((sto) >= STO_DVP_DMA && (sto) <= STO_DVP_RES2)
380
381 /* end-sanitize-sky */
382 /* This value is used for a mips16 .text symbol. */
383 #define STO_MIPS16 0xf0
384 \f
385 /* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
386 relocation entry specifies up to three actual relocations, all at
387 the same address. The first relocation which required a symbol
388 uses the symbol in the r_sym field. The second relocation which
389 requires a symbol uses the symbol in the r_ssym field. If all
390 three relocations require a symbol, the third one uses a zero
391 value. */
392
393 /* An entry in a 64 bit SHT_REL section. */
394
395 typedef struct
396 {
397 /* Address of relocation. */
398 unsigned char r_offset[8];
399 /* Symbol index. */
400 unsigned char r_sym[4];
401 /* Special symbol. */
402 unsigned char r_ssym[1];
403 /* Third relocation. */
404 unsigned char r_type3[1];
405 /* Second relocation. */
406 unsigned char r_type2[1];
407 /* First relocation. */
408 unsigned char r_type[1];
409 } Elf64_Mips_External_Rel;
410
411 typedef struct
412 {
413 /* Address of relocation. */
414 bfd_vma r_offset;
415 /* Symbol index. */
416 unsigned long r_sym;
417 /* Special symbol. */
418 unsigned char r_ssym;
419 /* Third relocation. */
420 unsigned char r_type3;
421 /* Second relocation. */
422 unsigned char r_type2;
423 /* First relocation. */
424 unsigned char r_type;
425 } Elf64_Mips_Internal_Rel;
426
427 /* An entry in a 64 bit SHT_RELA section. */
428
429 typedef struct
430 {
431 /* Address of relocation. */
432 unsigned char r_offset[8];
433 /* Symbol index. */
434 unsigned char r_sym[4];
435 /* Special symbol. */
436 unsigned char r_ssym[1];
437 /* Third relocation. */
438 unsigned char r_type3[1];
439 /* Second relocation. */
440 unsigned char r_type2[1];
441 /* First relocation. */
442 unsigned char r_type[1];
443 /* Addend. */
444 unsigned char r_addend[8];
445 } Elf64_Mips_External_Rela;
446
447 typedef struct
448 {
449 /* Address of relocation. */
450 bfd_vma r_offset;
451 /* Symbol index. */
452 unsigned long r_sym;
453 /* Special symbol. */
454 unsigned char r_ssym;
455 /* Third relocation. */
456 unsigned char r_type3;
457 /* Second relocation. */
458 unsigned char r_type2;
459 /* First relocation. */
460 unsigned char r_type;
461 /* Addend. */
462 bfd_signed_vma r_addend;
463 } Elf64_Mips_Internal_Rela;
464
465 /* Values found in the r_ssym field of a relocation entry. */
466
467 /* No relocation. */
468 #define RSS_UNDEF 0
469
470 /* Value of GP. */
471 #define RSS_GP 1
472
473 /* Value of GP in object being relocated. */
474 #define RSS_GP0 2
475
476 /* Address of location being relocated. */
477 #define RSS_LOC 3
478 \f
479 /* A SHT_MIPS_OPTIONS section contains a series of options, each of
480 which starts with this header. */
481
482 typedef struct
483 {
484 /* Type of option. */
485 unsigned char kind[1];
486 /* Size of option descriptor, including header. */
487 unsigned char size[1];
488 /* Section index of affected section, or 0 for global option. */
489 unsigned char section[2];
490 /* Information specific to this kind of option. */
491 unsigned char info[4];
492 } Elf_External_Options;
493
494 typedef struct
495 {
496 /* Type of option. */
497 unsigned char kind;
498 /* Size of option descriptor, including header. */
499 unsigned char size;
500 /* Section index of affected section, or 0 for global option. */
501 unsigned short section;
502 /* Information specific to this kind of option. */
503 unsigned long info;
504 } Elf_Internal_Options;
505
506 /* MIPS ELF option header swapping routines. */
507 extern void bfd_mips_elf_swap_options_in
508 PARAMS ((bfd *, const Elf_External_Options *, Elf_Internal_Options *));
509 extern void bfd_mips_elf_swap_options_out
510 PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *));
511
512 /* Values which may appear in the kind field of an Elf_Options
513 structure. */
514
515 /* Undefined. */
516 #define ODK_NULL 0
517
518 /* Register usage and GP value. */
519 #define ODK_REGINFO 1
520
521 /* Exception processing information. */
522 #define ODK_EXCEPTIONS 2
523
524 /* Section padding information. */
525 #define ODK_PAD 3
526
527 /* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_Reginfo
528 structure. In the 64 bit ABI, it is the following structure. The
529 info field of the options header is not used. */
530
531 typedef struct
532 {
533 /* Mask of general purpose registers used. */
534 unsigned char ri_gprmask[4];
535 /* Padding. */
536 unsigned char ri_pad[4];
537 /* Mask of co-processor registers used. */
538 unsigned char ri_cprmask[4][4];
539 /* GP register value for this object file. */
540 unsigned char ri_gp_value[8];
541 } Elf64_External_RegInfo;
542
543 typedef struct
544 {
545 /* Mask of general purpose registers used. */
546 unsigned long ri_gprmask;
547 /* Padding. */
548 unsigned long ri_pad;
549 /* Mask of co-processor registers used. */
550 unsigned long ri_cprmask[4];
551 /* GP register value for this object file. */
552 bfd_vma ri_gp_value;
553 } Elf64_Internal_RegInfo;
554
555 /* MIPS ELF reginfo swapping routines. */
556 extern void bfd_mips_elf64_swap_reginfo_in
557 PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *));
558 extern void bfd_mips_elf64_swap_reginfo_out
559 PARAMS ((bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *));
560 \f
561 /* start-sanitize-sky */
562 /* The vu overlay table is an array of this. */
563
564 typedef struct
565 {
566 /* Offset into overlay string table section. */
567 char name[8];
568 char lma[8];
569 char vma[8];
570 } Elf64_Dvp_External_Overlay;
571
572 typedef struct
573 {
574 bfd_vma name;
575 bfd_vma lma;
576 bfd_vma vma;
577 } Elf64_Dvp_Internal_Overlay;
578
579 /* overlay swapping routines. */
580 extern void bfd_dvp_elf64_swap_overlay_in
581 PARAMS ((bfd *, const Elf64_Dvp_External_Overlay *,
582 Elf64_Dvp_Internal_Overlay *));
583 extern void bfd_dvp_elf64_swap_overlay_out
584 PARAMS ((bfd *, const Elf64_Dvp_Internal_Overlay *,
585 Elf64_Dvp_External_Overlay *));
586
587 /* end-sanitize-sky */
588
589 #endif /* _ELF_MIPS_H */
This page took 0.042958 seconds and 5 git commands to generate.