Add R_MIPS_* and SHT_MIPS_* entries.
[external/binutils.git] / include / elf / mips.h
1 /* MIPS ELF support for BFD.
2    Copyright (C) 1993, 1994, 1995, 1996, 1998 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 /* Relocation types.  */
31 #define R_MIPS_NONE     0
32 #define R_MIPS_16       1
33 #define R_MIPS_32       2
34 #define R_MIPS_REL32    3
35 #define R_MIPS_26       4
36 #define R_MIPS_HI16     5
37 #define R_MIPS_LO16     6
38 #define R_MIPS_GPREL16  7
39 #define R_MIPS_LITERAL  8
40 #define R_MIPS_GOT16    9
41 #define R_MIPS_PC16     10
42 #define R_MIPS_CALL16   11
43 #define R_MIPS_GPREL32  12
44
45 /* Processor specific flags for the ELF header e_flags field.  */
46
47 /* At least one .noreorder directive appears in the source.  */
48 #define EF_MIPS_NOREORDER       0x00000001
49
50 /* File contains position independent code.  */
51 #define EF_MIPS_PIC             0x00000002
52
53 /* Code in file uses the standard calling sequence for calling
54    position independent code.  */
55 #define EF_MIPS_CPIC            0x00000004
56
57 /* Code in file uses new ABI (-n32 on Irix 6).  */
58 #define EF_MIPS_ABI2            0x00000020
59
60 /* Four bit MIPS architecture field.  */
61 #define EF_MIPS_ARCH            0xf0000000
62
63 /* -mips1 code.  */
64 #define E_MIPS_ARCH_1           0x00000000
65
66 /* -mips2 code.  */
67 #define E_MIPS_ARCH_2           0x10000000
68
69 /* -mips3 code.  */
70 #define E_MIPS_ARCH_3           0x20000000
71
72 /* -mips4 code.  */
73 #define E_MIPS_ARCH_4           0x30000000
74
75 /* Machine variant if we know it.  This field was invented at Cygnus,
76    but it is hoped that other vendors will adopt it.  If some standard
77    is developed, this code should be changed to follow it. */
78
79 #define EF_MIPS_MACH            0x00FF0000
80
81 /* Cygnus is choosing values between 80 and 9F;
82    00 - 7F should be left for a future standard;
83    the rest are open. */
84
85 #define E_MIPS_MACH_3900        0x00810000
86
87 #define E_MIPS_MACH_4010        0x00820000
88 #define E_MIPS_MACH_4100        0x00830000
89 /* start-sanitize-vr4320 */
90 #define E_MIPS_MACH_4320        0x00840000
91 /* end-sanitize-vr4320 */
92 #define E_MIPS_MACH_4650        0x00850000
93 /* start-sanitize-tx49 */
94 #define E_MIPS_MACH_4900        0x00860000
95 /* end-sanitize-tx49 */
96
97 /* start-sanitize-vr5400 */
98 #define E_MIPS_MACH_5400        0x00910000
99 /* end-sanitize-vr5400 */
100 /* start-sanitize-r5900 */
101 #define E_MIPS_MACH_5900        0x00920000
102 /* end-sanitize-r5900 */
103 \f
104 /* Processor specific section indices.  These sections do not actually
105    exist.  Symbols with a st_shndx field corresponding to one of these
106    values have a special meaning.  */
107
108 /* Defined and allocated common symbol.  Value is virtual address.  If
109    relocated, alignment must be preserved.  */
110 #define SHN_MIPS_ACOMMON        0xff00
111
112 /* Defined and allocated text symbol.  Value is virtual address.
113    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
114 #define SHN_MIPS_TEXT           0xff01
115
116 /* Defined and allocated data symbol.  Value is virtual address.
117    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
118 #define SHN_MIPS_DATA           0xff02
119
120 /* Small common symbol.  */
121 #define SHN_MIPS_SCOMMON        0xff03
122
123 /* Small undefined symbol.  */
124 #define SHN_MIPS_SUNDEFINED     0xff04
125 \f
126 /* Processor specific section types.  */
127
128 /* Section contains the set of dynamic shared objects used when
129    statically linking.  */
130 #define SHT_MIPS_LIBLIST        0x70000000
131
132 /* I'm not sure what this is, but it's used on Irix 5.  */
133 #define SHT_MIPS_MSYM           0x70000001
134
135 /* Section contains list of symbols whose definitions conflict with
136    symbols defined in shared objects.  */
137 #define SHT_MIPS_CONFLICT       0x70000002
138
139 /* Section contains the global pointer table.  */
140 #define SHT_MIPS_GPTAB          0x70000003
141
142 /* Section contains microcode information.  The exact format is
143    unspecified.  */
144 #define SHT_MIPS_UCODE          0x70000004
145
146 /* Section contains some sort of debugging information.  The exact
147    format is unspecified.  It's probably ECOFF symbols.  */
148 #define SHT_MIPS_DEBUG          0x70000005
149
150 /* Section contains register usage information.  */
151 #define SHT_MIPS_REGINFO        0x70000006
152
153 /* ??? */
154 #define SHT_MIPS_PACKAGE        0x70000007
155
156 /* ??? */
157 #define SHT_MIPS_PACKSYM        0x70000008
158
159 /* ??? */
160 #define SHT_MIPS_RELD           0x70000009
161
162 /* Section contains interface information.  */
163 #define SHT_MIPS_IFACE          0x7000000b
164
165 /* Section contains description of contents of another section.  */
166 #define SHT_MIPS_CONTENT        0x7000000c
167
168 /* Section contains miscellaneous options.  */
169 #define SHT_MIPS_OPTIONS        0x7000000d
170
171 /* ??? */
172 #define SHT_MIPS_SHDR           0x70000010
173
174 /* ??? */
175 #define SHT_MIPS_FDESC          0x70000011
176
177 /* ??? */
178 #define SHT_MIPS_EXTSYM         0x70000012
179
180 /* ??? */
181 #define SHT_MIPS_DENSE          0x70000013
182
183 /* ??? */
184 #define SHT_MIPS_PDESC          0x70000014
185
186 /* ??? */
187 #define SHT_MIPS_LOCSYM         0x70000015
188
189 /* ??? */
190 #define SHT_MIPS_AUXSYM         0x70000016
191
192 /* ??? */
193 #define SHT_MIPS_OPTSYM         0x70000017
194
195 /* ??? */
196 #define SHT_MIPS_LOCSTR         0x70000018
197
198 /* ??? */
199 #define SHT_MIPS_LINE           0x70000019
200
201 /* ??? */
202 #define SHT_MIPS_RFDESC         0x7000001a
203
204 /* ??? */
205 #define SHT_MIPS_DELTASYM       0x7000001b
206
207 /* ??? */
208 #define SHT_MIPS_DELTAINST      0x7000001c
209
210 /* ??? */
211 #define SHT_MIPS_DELTACLASS     0x7000001d
212
213 /* DWARF debugging section.  */
214 #define SHT_MIPS_DWARF          0x7000001e
215
216 /* ??? */
217 #define SHT_MIPS_DELTADECL      0x7000001f
218
219 /* List of libraries the binary depends on.  Includes a time stamp, version
220    number.  */
221 #define SHT_MIPS_SYMBOL_LIB     0x70000020
222
223 /* Events section.  */
224 #define SHT_MIPS_EVENTS         0x70000021
225
226 /* ??? */
227 #define SHT_MIPS_TRANSLATE      0x70000022
228
229 /* ??? */
230 #define SHT_MIPS_PIXIE          0x70000023
231
232 /* ??? */
233 #define SHT_MIPS_XLATE          0x70000024
234
235 /* ??? */
236 #define SHT_MIPS_XLATE_DEBUG    0x70000025
237
238 /* ??? */
239 #define SHT_MIPS_WHIRL          0x70000026
240
241 /* ??? */
242 #define SHT_MIPS_EH_REGION      0x70000027
243
244 /* ??? */
245 #define SHT_MIPS_XLATE_OLD      0x70000028
246
247 /* ??? */
248 #define SHT_MIPS_PDR_EXCEPTION  0x70000029
249
250 /* start-sanitize-sky */
251 /* The VU overlay table.  */
252 #define SHT_DVP_OVERLAY_TABLE           0x7ffff420
253 #define SHNAME_DVP_OVERLAY_TABLE        ".DVP.ovlytab"
254 #define SHNAME_DVP_OVERLAY_STRTAB       ".DVP.ovlystrtab"
255 /* A VU overlay.  */
256 #define SHT_DVP_OVERLAY                 0x7ffff421
257 /* Prefix of VU overlay sections.  */
258 #define SHNAME_DVP_OVERLAY_PREFIX       ".DVP.overlay."
259 /* end-sanitize-sky */
260
261 /* A section of type SHT_MIPS_LIBLIST contains an array of the
262    following structure.  The sh_link field is the section index of the
263    string table.  The sh_info field is the number of entries in the
264    section.  */
265 typedef struct
266 {
267   /* String table index for name of shared object.  */
268   unsigned long l_name;
269   /* Time stamp.  */
270   unsigned long l_time_stamp;
271   /* Checksum of symbol names and common sizes.  */
272   unsigned long l_checksum;
273   /* String table index for version.  */
274   unsigned long l_version;
275   /* Flags.  */
276   unsigned long l_flags;
277 } Elf32_Lib;
278
279 /* The external version of Elf32_Lib.  */
280 typedef struct
281 {
282   unsigned char l_name[4];
283   unsigned char l_time_stamp[4];
284   unsigned char l_checksum[4];
285   unsigned char l_version[4];
286   unsigned char l_flags[4];
287 } Elf32_External_Lib;
288
289 /* The l_flags field of an Elf32_Lib structure may contain the
290    following flags.  */
291
292 /* Require an exact match at runtime.  */
293 #define LL_EXACT_MATCH          0x00000001
294
295 /* Ignore version incompatibilities at runtime.  */
296 #define LL_IGNORE_INT_VER       0x00000002
297
298 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
299    .dynsym section.  Each element has the following type.  */
300 typedef unsigned long Elf32_Conflict;
301
302 /* A section of type SHT_MIPS_GPTAB contains information about how
303    much GP space would be required for different -G arguments.  This
304    information is only used so that the linker can provide informative
305    suggestions as to the best -G value to use.  The sh_info field is
306    the index of the section for which this information applies.  The
307    contents of the section are an array of the following union.  The
308    first element uses the gt_header field.  The remaining elements use
309    the gt_entry field.  */
310 typedef union
311 {
312   struct
313     {
314       /* -G value actually used for this object file.  */
315       unsigned long gt_current_g_value;
316       /* Unused.  */
317       unsigned long gt_unused;
318     } gt_header;
319   struct
320     {
321       /* If this -G argument has been used...  */
322       unsigned long gt_g_value;
323       /* ...this many GP section bytes would be required.  */
324       unsigned long gt_bytes;
325     } gt_entry;
326 } Elf32_gptab;
327
328 /* The external version of Elf32_gptab.  */
329
330 typedef union
331 {
332   struct
333     {
334       unsigned char gt_current_g_value[4];
335       unsigned char gt_unused[4];
336     } gt_header;
337   struct
338     {
339       unsigned char gt_g_value[4];
340       unsigned char gt_bytes[4];
341     } gt_entry;
342 } Elf32_External_gptab;
343
344 /* A section of type SHT_MIPS_REGINFO contains the following
345    structure.  */
346 typedef struct
347 {
348   /* Mask of general purpose registers used.  */
349   unsigned long ri_gprmask;
350   /* Mask of co-processor registers used.  */
351   unsigned long ri_cprmask[4];
352   /* GP register value for this object file.  */
353   long ri_gp_value;
354 } Elf32_RegInfo;
355
356 /* The external version of the Elf_RegInfo structure.  */
357 typedef struct
358 {
359   unsigned char ri_gprmask[4];
360   unsigned char ri_cprmask[4][4];
361   unsigned char ri_gp_value[4];
362 } Elf32_External_RegInfo;
363
364 /* MIPS ELF .reginfo swapping routines.  */
365 extern void bfd_mips_elf32_swap_reginfo_in
366   PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
367 extern void bfd_mips_elf32_swap_reginfo_out
368   PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
369 \f
370 /* Processor specific section flags.  */
371
372 /* This section must be in the global data area.  */
373 #define SHF_MIPS_GPREL          0x10000000
374
375 /* This section should be merged.  */
376 #define SHF_MIPS_MERGE          0x20000000
377
378 /* This section contains 32 bit addresses.  */
379 #define SHF_MIPS_ADDR32         0x40000000
380
381 /* This section contains 64 bit addresses.  */
382 #define SHF_MIPS_ADDR64         0x80000000
383
384 /* This section may not be stripped.  */
385 #define SHF_MIPS_NOSTRIP        0x08000000
386
387 /* This section is local to threads.  */
388 #define SHF_MIPS_LOCAL          0x04000000
389
390 /* Linker should generate implicit weak names for this section.  */
391 #define SHF_MIPS_NAMES          0x02000000
392 \f
393 /* Processor specific program header types.  */
394
395 /* Register usage information.  Identifies one .reginfo section.  */
396 #define PT_MIPS_REGINFO         0x70000000
397
398 /* Runtime procedure table.  */
399 #define PT_MIPS_RTPROC          0x70000001
400
401 /* Options (for what ???).  */
402 #define PT_MIPS_OPTIONS         0x70000002
403 \f
404 /* Processor specific dynamic array tags.  */
405
406 /* 32 bit version number for runtime linker interface.  */
407 #define DT_MIPS_RLD_VERSION     0x70000001
408
409 /* Time stamp.  */
410 #define DT_MIPS_TIME_STAMP      0x70000002
411
412 /* Checksum of external strings and common sizes.  */
413 #define DT_MIPS_ICHECKSUM       0x70000003
414
415 /* Index of version string in string table.  */
416 #define DT_MIPS_IVERSION        0x70000004
417
418 /* 32 bits of flags.  */
419 #define DT_MIPS_FLAGS           0x70000005
420
421 /* Base address of the segment.  */
422 #define DT_MIPS_BASE_ADDRESS    0x70000006
423
424 /* ??? */
425 #define DT_MIPS_MSYM            0x70000007
426
427 /* Address of .conflict section.  */
428 #define DT_MIPS_CONFLICT        0x70000008
429
430 /* Address of .liblist section.  */
431 #define DT_MIPS_LIBLIST         0x70000009
432
433 /* Number of local global offset table entries.  */
434 #define DT_MIPS_LOCAL_GOTNO     0x7000000a
435
436 /* Number of entries in the .conflict section.  */
437 #define DT_MIPS_CONFLICTNO      0x7000000b
438
439 /* Number of entries in the .liblist section.  */
440 #define DT_MIPS_LIBLISTNO       0x70000010
441
442 /* Number of entries in the .dynsym section.  */
443 #define DT_MIPS_SYMTABNO        0x70000011
444
445 /* Index of first external dynamic symbol not referenced locally.  */
446 #define DT_MIPS_UNREFEXTNO      0x70000012
447
448 /* Index of first dynamic symbol in global offset table.  */
449 #define DT_MIPS_GOTSYM          0x70000013
450
451 /* Number of page table entries in global offset table.  */
452 #define DT_MIPS_HIPAGENO        0x70000014
453
454 /* Address of run time loader map, used for debugging.  */
455 #define DT_MIPS_RLD_MAP         0x70000016
456
457 /* Delta C++ class definition.  */
458 #define DT_MIPS_DELTA_CLASS     0x70000017
459
460 /* Number of entries in DT_MIPS_DELTA_CLASS.  */
461 #define DT_MIPS_DELTA_CLASS_NO  0x70000018
462
463 /* Delta C++ class instances.  */
464 #define DT_MIPS_DELTA_INSTANCE  0x70000019
465
466 /* Number of entries in DT_MIPS_DELTA_INSTANCE.  */
467 #define DT_MIPS_DELTA_INSTANCE_NO       0x7000001a
468
469 /* Delta relocations.  */
470 #define DT_MIPS_DELTA_RELOC     0x7000001b
471
472 /* Number of entries in DT_MIPS_DELTA_RELOC.  */
473 #define DT_MIPS_DELTA_RELOC_NO  0x7000001c
474
475 /* Delta symbols that Delta relocations refer to.  */
476 #define DT_MIPS_DELTA_SYM       0x7000001d
477
478 /* Number of entries in DT_MIPS_DELTA_SYM.  */
479 #define DT_MIPS_DELTA_SYM_NO    0x7000001e
480
481 /* Delta symbols that hold class declarations.  */
482 #define DT_MIPS_DELTA_CLASSSYM  0x70000020
483
484 /* Number of entries in DT_MIPS_DELTA_CLASSSYM.  */
485 #define DT_MIPS_DELTA_CLASSSYM_NO       0x70000021
486
487 /* Flags indicating information about C++ flavor.  */
488 #define DT_MIPS_CXX_FLAGS       0x70000022
489
490 /* Pixie information (???).  */
491 #define DT_MIPS_PIXIE_INIT      0x70000023
492
493 /* ??? */
494 #define DT_MIPS_SYMBOL_LIB      0x70000024
495
496 /* ??? */
497 #define DT_MIPS_LOCALPAGE_GOTIDX        0x70000025
498
499 /* ??? */
500 #define DT_MIPS_LOCAL_GOTIDX    0x70000026
501
502 /* ??? */
503 #define DT_MIPS_HIDDEN_GOTIDX   0x70000027
504
505 /* ??? */
506 #define DT_MIPS_PROTECTED_GOTIDX        0x70000028
507
508 /* Address of `.MIPS.options'.  */
509 #define DT_MIPS_OPTIONS         0x70000029
510
511 /* Address of `.interface'.  */
512 #define DT_MIPS_INTERFACE       0x7000002a
513
514 /* ??? */
515 #define DT_MIPS_DYNSTR_ALIGN    0x7000002b
516
517 /* Size of the .interface section.  */
518 #define DT_MIPS_INTERFACE_SIZE  0x7000002c
519
520 /* Size of rld_text_resolve function stored in the GOT.  */
521 #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR   0x7000002d
522
523 /* Default suffix of DSO to be added by rld on dlopen() calls.  */
524 #define DT_MIPS_PERF_SUFFIX     0x7000002e
525
526 /* Size of compact relocation section (O32).  */
527 #define DT_MIPS_COMPACT_SIZE    0x7000002f
528
529 /* GP value for auxiliary GOTs.  */
530 #define DT_MIPS_GP_VALUE        0x70000030
531
532 /* Address of auxiliary .dynamic.  */
533 #define DT_MIPS_AUX_DYNAMIC     0x70000031
534 \f
535 /* Flags which may appear in a DT_MIPS_FLAGS entry.  */
536
537 /* No flags.  */
538 #define RHF_NONE                0x00000000
539
540 /* Uses shortcut pointers.  */
541 #define RHF_QUICKSTART          0x00000001
542
543 /* Hash size is not a power of two.  */
544 #define RHF_NOTPOT              0x00000002
545
546 /* Ignore LD_LIBRARY_PATH.  */
547 #define RHS_NO_LIBRARY_REPLACEMENT \
548                                 0x00000004
549 \f
550 /* Special values for the st_other field in the symbol table.  These
551    are used in an Irix 5 dynamic symbol table.  */
552
553 #define STO_DEFAULT             0x00
554 #define STO_INTERNAL            0x01
555 #define STO_HIDDEN              0x02
556 #define STO_PROTECTED           0x03
557
558 /* start-sanitize-sky */
559 /* These values are used for the dvp.  */
560 #define STO_DVP_DMA             0xe8
561 #define STO_DVP_VIF             0xe9
562 #define STO_DVP_GIF             0xea
563 #define STO_DVP_VU              0xeb
564 /* Reserve a couple in case we need them.  */
565 #define STO_DVP_RES1            0xec
566 #define STO_DVP_RES2            0xed
567 #define STO_DVP_P(sto) ((sto) >= STO_DVP_DMA && (sto) <= STO_DVP_RES2)
568
569 /* end-sanitize-sky */
570 /* This value is used for a mips16 .text symbol.  */
571 #define STO_MIPS16              0xf0
572 \f
573 /* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
574    relocation entry specifies up to three actual relocations, all at
575    the same address.  The first relocation which required a symbol
576    uses the symbol in the r_sym field.  The second relocation which
577    requires a symbol uses the symbol in the r_ssym field.  If all
578    three relocations require a symbol, the third one uses a zero
579    value.  */
580
581 /* An entry in a 64 bit SHT_REL section.  */
582
583 typedef struct
584 {
585   /* Address of relocation.  */
586   unsigned char r_offset[8];
587   /* Symbol index.  */
588   unsigned char r_sym[4];
589   /* Special symbol.  */
590   unsigned char r_ssym[1];
591   /* Third relocation.  */
592   unsigned char r_type3[1];
593   /* Second relocation.  */
594   unsigned char r_type2[1];
595   /* First relocation.  */
596   unsigned char r_type[1];
597 } Elf64_Mips_External_Rel;
598
599 typedef struct
600 {
601   /* Address of relocation.  */
602   bfd_vma r_offset;
603   /* Symbol index.  */
604   unsigned long r_sym;
605   /* Special symbol.  */
606   unsigned char r_ssym;
607   /* Third relocation.  */
608   unsigned char r_type3;
609   /* Second relocation.  */
610   unsigned char r_type2;
611   /* First relocation.  */
612   unsigned char r_type;
613 } Elf64_Mips_Internal_Rel;
614
615 /* An entry in a 64 bit SHT_RELA section.  */
616
617 typedef struct
618 {
619   /* Address of relocation.  */
620   unsigned char r_offset[8];
621   /* Symbol index.  */
622   unsigned char r_sym[4];
623   /* Special symbol.  */
624   unsigned char r_ssym[1];
625   /* Third relocation.  */
626   unsigned char r_type3[1];
627   /* Second relocation.  */
628   unsigned char r_type2[1];
629   /* First relocation.  */
630   unsigned char r_type[1];
631   /* Addend.  */
632   unsigned char r_addend[8];
633 } Elf64_Mips_External_Rela;
634
635 typedef struct
636 {
637   /* Address of relocation.  */
638   bfd_vma r_offset;
639   /* Symbol index.  */
640   unsigned long r_sym;
641   /* Special symbol.  */
642   unsigned char r_ssym;
643   /* Third relocation.  */
644   unsigned char r_type3;
645   /* Second relocation.  */
646   unsigned char r_type2;
647   /* First relocation.  */
648   unsigned char r_type;
649   /* Addend.  */
650   bfd_signed_vma r_addend;
651 } Elf64_Mips_Internal_Rela;
652
653 /* Values found in the r_ssym field of a relocation entry.  */
654
655 /* No relocation.  */
656 #define RSS_UNDEF       0
657
658 /* Value of GP.  */
659 #define RSS_GP          1
660
661 /* Value of GP in object being relocated.  */
662 #define RSS_GP0         2
663
664 /* Address of location being relocated.  */
665 #define RSS_LOC         3
666 \f
667 /* A SHT_MIPS_OPTIONS section contains a series of options, each of
668    which starts with this header.  */
669
670 typedef struct
671 {
672   /* Type of option.  */
673   unsigned char kind[1];
674   /* Size of option descriptor, including header.  */
675   unsigned char size[1];
676   /* Section index of affected section, or 0 for global option.  */
677   unsigned char section[2];
678   /* Information specific to this kind of option.  */
679   unsigned char info[4];
680 } Elf_External_Options;
681
682 typedef struct
683 {
684   /* Type of option.  */
685   unsigned char kind;
686   /* Size of option descriptor, including header.  */
687   unsigned char size;
688   /* Section index of affected section, or 0 for global option.  */
689   unsigned short section;
690   /* Information specific to this kind of option.  */
691   unsigned long info;
692 } Elf_Internal_Options;
693
694 /* MIPS ELF option header swapping routines.  */
695 extern void bfd_mips_elf_swap_options_in
696   PARAMS ((bfd *, const Elf_External_Options *, Elf_Internal_Options *));
697 extern void bfd_mips_elf_swap_options_out
698   PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *));
699
700 /* Values which may appear in the kind field of an Elf_Options
701    structure.  */
702
703 /* Undefined.  */
704 #define ODK_NULL        0
705
706 /* Register usage and GP value.  */
707 #define ODK_REGINFO     1
708
709 /* Exception processing information.  */
710 #define ODK_EXCEPTIONS  2
711
712 /* Section padding information.  */
713 #define ODK_PAD         3
714
715 /* Hardware workarounds performed.  */
716 #define ODK_HWPATCH     4
717
718 /* Fill value used by the linker.  */
719 #define ODK_FILL        5
720
721 /* Reserved space for desktop tools.  */
722 #define ODK_TAGS        6
723
724 /* Hardware workarounds, AND bits when merging.  */
725 #define ODK_HWAND       7
726
727 /* Hardware workarounds, OR bits when merging.  */
728 #define ODK_HWOR        8
729
730 /* GP group to use for text/data sections.  */
731 #define ODK_GP_GROUP    9
732
733 /* ID information.  */
734 #define ODK_IDENT       10
735
736 /* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_RegInfo
737    structure.  In the 64 bit ABI, it is the following structure.  The
738    info field of the options header is not used.  */
739
740 typedef struct
741 {
742   /* Mask of general purpose registers used.  */
743   unsigned char ri_gprmask[4];
744   /* Padding.  */
745   unsigned char ri_pad[4];
746   /* Mask of co-processor registers used.  */
747   unsigned char ri_cprmask[4][4];
748   /* GP register value for this object file.  */
749   unsigned char ri_gp_value[8];
750 } Elf64_External_RegInfo;
751
752 typedef struct
753 {
754   /* Mask of general purpose registers used.  */
755   unsigned long ri_gprmask;
756   /* Padding.  */
757   unsigned long ri_pad;
758   /* Mask of co-processor registers used.  */
759   unsigned long ri_cprmask[4];
760   /* GP register value for this object file.  */
761   bfd_vma ri_gp_value;
762 } Elf64_Internal_RegInfo;
763
764 /* MIPS ELF reginfo swapping routines.  */
765 extern void bfd_mips_elf64_swap_reginfo_in
766   PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *));
767 extern void bfd_mips_elf64_swap_reginfo_out
768   PARAMS ((bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *));
769
770 /* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
771 #define OEX_FPU_MIN     0x1f    /* FPEs which must be enabled.  */
772 #define OEX_FPU_MAX     0x1f00  /* FPEs which may be enabled.  */
773 #define OEX_PAGE0       0x10000 /* Page zero must be mapped.  */
774 #define OEX_SMM         0x20000 /* Force sequential memory mode.  */
775 #define OEX_FPDBUG      0x40000 /* Force floating-point debug mode.  */
776 #define OEX_DISMISS     0x80000 /* Dismiss invalid address faults.  */
777
778 /* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX.  */
779 #define OEX_FPU_INVAL   0x10    /* Invalid operation exception.  */
780 #define OEX_FPU_DIV0    0x08    /* Division by zero exception.  */
781 #define OEX_FPU_OFLO    0x04    /* Overflow exception.  */
782 #define OEX_FPU_UFLO    0x02    /* Underflow exception.  */
783 #define OEX_FPU_INEX    0x01    /* Inexact exception.  */
784
785 /* Masks for the info word of an ODK_PAD descriptor.  */
786 #define OPAD_PREFIX     0x01
787 #define OPAD_POSTFIX    0x02
788 #define OPAD_SYMBOL     0x04
789
790 /* Masks for the info word of an ODK_HWPATCH descriptor.  */
791 #define OHW_R4KEOP      0x01    /* R4000 end-of-page patch.  */
792 #define OHW_R8KPFETCH   0x02    /* May need R8000 prefetch patch.  */
793 #define OHW_R5KEOP      0x04    /* R5000 end-of-page patch.  */
794 #define OHW_R5KCVTL     0x08    /* R5000 cvt.[ds].l bug (clean == 1).  */
795
796 /* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor.  */
797 #define OGP_GROUP       0x0000ffff      /* GP group number.  */
798 #define OGP_SELF        0xffff0000      /* Self-contained GP groups.  */
799
800 /* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
801 #define OHWA0_R4KEOP_CHECKED    0x00000001
802 #define OHWA0_R4KEOP_CLEAN      0x00000002
803 \f
804 /* start-sanitize-sky */
805 /* The vu overlay table is an array of this.  */
806
807 typedef struct
808 {
809   /* `name' is offset into overlay string table section.  */
810   char name[4];
811   char lma[4];
812   char vma[4];
813 } Elf32_Dvp_External_Overlay;
814
815 typedef struct
816 {
817   bfd_vma name;
818   bfd_vma lma;
819   bfd_vma vma;
820 } Elf32_Dvp_Internal_Overlay;
821
822 /* overlay swapping routines.  */
823 extern void bfd_dvp_elf32_swap_overlay_in
824   PARAMS ((bfd *, const Elf32_Dvp_External_Overlay *,
825            Elf32_Dvp_Internal_Overlay *));
826 extern void bfd_dvp_elf32_swap_overlay_out
827   PARAMS ((bfd *, const Elf32_Dvp_Internal_Overlay *,
828            Elf32_Dvp_External_Overlay *));
829
830 /* end-sanitize-sky */
831
832 #endif /* _ELF_MIPS_H */