]> Git Repo - binutils.git/blame - include/elf/mips.h
(PT_MIPS_OPTIONS): New symbol.
[binutils.git] / include / elf / mips.h
CommitLineData
55d5703f 1/* MIPS ELF support for BFD.
55412e05 2 Copyright (C) 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
55d5703f
ILT
3
4 By Ian Lance Taylor, Cygnus Support, <[email protected]>, from
5 information in the System V Application Binary Interface, MIPS
6 Processor Supplement.
7
8This file is part of BFD, the Binary File Descriptor library.
9
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
80483b24 22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
55d5703f
ILT
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
80483b24
ILT
27#ifndef _ELF_MIPS_H
28#define _ELF_MIPS_H
29
55d5703f
ILT
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
4086bde1
DE
42/* Code in file uses new ABI (-n32 on Irix 6). */
43#define EF_MIPS_ABI2 0x00000020
44
55d5703f
ILT
45/* Four bit MIPS architecture field. */
46#define EF_MIPS_ARCH 0xf0000000
4c040a64
PS
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
68745520
ILT
56
57/* -mips4 code. */
58#define E_MIPS_ARCH_4 0x30000000
d15f4fd0
DE
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 */
55d5703f
ILT
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
80483b24
ILT
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
55d5703f
ILT
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
80483b24
ILT
117/* I'm not sure what this is, but it's used on Irix 5. */
118#define SHT_MIPS_MSYM 0x70000001
119
55d5703f
ILT
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
4086bde1
DE
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. */
4c040a64
PS
145#define SHT_MIPS_OPTIONS 0x7000000d
146
4086bde1 147/* DWARF debugging section. */
80483b24
ILT
148#define SHT_MIPS_DWARF 0x7000001e
149
4086bde1
DE
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. */
80483b24
ILT
154#define SHT_MIPS_EVENTS 0x70000021
155
d15f4fd0
DE
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
55d5703f
ILT
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. */
171typedef struct
172{
173 /* String table index for name of shared object. */
4c040a64 174 unsigned long l_name;
55d5703f 175 /* Time stamp. */
4c040a64 176 unsigned long l_time_stamp;
55d5703f 177 /* Checksum of symbol names and common sizes. */
4c040a64 178 unsigned long l_checksum;
55d5703f 179 /* String table index for version. */
4c040a64 180 unsigned long l_version;
55d5703f 181 /* Flags. */
4c040a64 182 unsigned long l_flags;
55d5703f
ILT
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. */
4c040a64 196typedef unsigned long Elf32_Conflict;
55d5703f
ILT
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. */
206typedef union
207{
208 struct
209 {
210 /* -G value actually used for this object file. */
4c040a64 211 unsigned long gt_current_g_value;
55d5703f 212 /* Unused. */
4c040a64 213 unsigned long gt_unused;
55d5703f
ILT
214 } gt_header;
215 struct
216 {
217 /* If this -G argument has been used... */
4c040a64 218 unsigned long gt_g_value;
55d5703f 219 /* ...this many GP section bytes would be required. */
4c040a64 220 unsigned long gt_bytes;
55d5703f
ILT
221 } gt_entry;
222} Elf32_gptab;
223
80483b24
ILT
224/* The external version of Elf32_gptab. */
225
226typedef 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
55d5703f
ILT
240/* A section of type SHT_MIPS_REGINFO contains the following
241 structure. */
242typedef struct
243{
244 /* Mask of general purpose registers used. */
4c040a64 245 unsigned long ri_gprmask;
55d5703f 246 /* Mask of co-processor registers used. */
4c040a64 247 unsigned long ri_cprmask[4];
55d5703f 248 /* GP register value for this object file. */
4c040a64
PS
249 long ri_gp_value;
250} Elf32_RegInfo;
251
252/* The external version of the Elf_RegInfo structure. */
253typedef 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. */
261extern void bfd_mips_elf32_swap_reginfo_in
262 PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
263extern void bfd_mips_elf32_swap_reginfo_out
264 PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
55d5703f
ILT
265\f
266/* Processor specific section flags. */
267
268/* This section must be in the global data area. */
4c040a64 269#define SHF_MIPS_GPREL 0x10000000
4086bde1
DE
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
4c040a64
PS
288\f
289/* Processor specific program header types. */
290
291/* Register usage information. Identifies one .reginfo section. */
292#define PT_MIPS_REGINFO 0x70000000
80483b24
ILT
293
294/* Runtime procedure table. */
295#define PT_MIPS_RTPROC 0x70000001
55412e05
UD
296
297/* Options (for what ???). */
298#define PT_MIPS_OPTIONS 0x70000002
4c040a64
PS
299\f
300/* Processor specific dynamic array tags. */
301
302/* 32 bit version number for runtime linker interface. */
303#define DT_MIPS_RLD_VERSION 0x70000001
304
305/* Time stamp. */
306#define DT_MIPS_TIME_STAMP 0x70000002
307
308/* Checksum of external strings and common sizes. */
309#define DT_MIPS_ICHECKSUM 0x70000003
310
311/* Index of version string in string table. */
312#define DT_MIPS_IVERSION 0x70000004
313
314/* 32 bits of flags. */
315#define DT_MIPS_FLAGS 0x70000005
316
317/* Base address of the segment. */
318#define DT_MIPS_BASE_ADDRESS 0x70000006
319
320/* Address of .conflict section. */
321#define DT_MIPS_CONFLICT 0x70000008
322
323/* Address of .liblist section. */
324#define DT_MIPS_LIBLIST 0x70000009
325
326/* Number of local global offset table entries. */
327#define DT_MIPS_LOCAL_GOTNO 0x7000000a
328
329/* Number of entries in the .conflict section. */
330#define DT_MIPS_CONFLICTNO 0x7000000b
331
332/* Number of entries in the .liblist section. */
333#define DT_MIPS_LIBLISTNO 0x70000010
334
335/* Number of entries in the .dynsym section. */
336#define DT_MIPS_SYMTABNO 0x70000011
337
338/* Index of first external dynamic symbol not referenced locally. */
339#define DT_MIPS_UNREFEXTNO 0x70000012
340
341/* Index of first dynamic symbol in global offset table. */
342#define DT_MIPS_GOTSYM 0x70000013
343
344/* Number of page table entries in global offset table. */
345#define DT_MIPS_HIPAGENO 0x70000014
346
347/* Address of run time loader map, used for debugging. */
348#define DT_MIPS_RLD_MAP 0x70000016
80483b24
ILT
349\f
350/* Flags which may appear in a DT_MIPS_FLAGS entry. */
351
352/* No flags. */
353#define RHF_NONE 0x00000000
354
355/* Uses shortcut pointers. */
356#define RHF_QUICKSTART 0x00000001
357
358/* Hash size is not a power of two. */
359#define RHF_NOTPOT 0x00000002
360
361/* Ignore LD_LIBRARY_PATH. */
362#define RHS_NO_LIBRARY_REPLACEMENT \
363 0x00000004
364\f
365/* Special values for the st_other field in the symbol table. These
366 are used in an Irix 5 dynamic symbol table. */
367
368#define STO_DEFAULT 0x00
369#define STO_INTERNAL 0x01
370#define STO_HIDDEN 0x02
371#define STO_PROTECTED 0x03
4086bde1
DE
372
373/* start-sanitize-sky */
374/* These values are used for the dvp. */
375#define STO_DVP_DMA 0xe8
d15f4fd0
DE
376#define STO_DVP_VIF 0xe9
377#define STO_DVP_GIF 0xea
4086bde1 378#define STO_DVP_VU 0xeb
d15f4fd0
DE
379/* Reserve a couple in case we need them. */
380#define STO_DVP_RES1 0xec
381#define STO_DVP_RES2 0xed
382#define STO_DVP_P(sto) ((sto) >= STO_DVP_DMA && (sto) <= STO_DVP_RES2)
4086bde1
DE
383
384/* end-sanitize-sky */
385/* This value is used for a mips16 .text symbol. */
386#define STO_MIPS16 0xf0
80483b24 387\f
4086bde1 388/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
80483b24
ILT
389 relocation entry specifies up to three actual relocations, all at
390 the same address. The first relocation which required a symbol
391 uses the symbol in the r_sym field. The second relocation which
392 requires a symbol uses the symbol in the r_ssym field. If all
393 three relocations require a symbol, the third one uses a zero
394 value. */
395
396/* An entry in a 64 bit SHT_REL section. */
397
398typedef struct
399{
400 /* Address of relocation. */
401 unsigned char r_offset[8];
402 /* Symbol index. */
403 unsigned char r_sym[4];
404 /* Special symbol. */
405 unsigned char r_ssym[1];
406 /* Third relocation. */
407 unsigned char r_type3[1];
408 /* Second relocation. */
409 unsigned char r_type2[1];
410 /* First relocation. */
411 unsigned char r_type[1];
412} Elf64_Mips_External_Rel;
413
414typedef struct
415{
416 /* Address of relocation. */
417 bfd_vma r_offset;
418 /* Symbol index. */
419 unsigned long r_sym;
420 /* Special symbol. */
421 unsigned char r_ssym;
422 /* Third relocation. */
423 unsigned char r_type3;
424 /* Second relocation. */
425 unsigned char r_type2;
426 /* First relocation. */
427 unsigned char r_type;
428} Elf64_Mips_Internal_Rel;
429
430/* An entry in a 64 bit SHT_RELA section. */
431
432typedef struct
433{
434 /* Address of relocation. */
435 unsigned char r_offset[8];
436 /* Symbol index. */
437 unsigned char r_sym[4];
438 /* Special symbol. */
439 unsigned char r_ssym[1];
440 /* Third relocation. */
441 unsigned char r_type3[1];
442 /* Second relocation. */
443 unsigned char r_type2[1];
444 /* First relocation. */
445 unsigned char r_type[1];
446 /* Addend. */
447 unsigned char r_addend[8];
448} Elf64_Mips_External_Rela;
449
450typedef struct
451{
452 /* Address of relocation. */
453 bfd_vma r_offset;
454 /* Symbol index. */
455 unsigned long r_sym;
456 /* Special symbol. */
457 unsigned char r_ssym;
458 /* Third relocation. */
459 unsigned char r_type3;
460 /* Second relocation. */
461 unsigned char r_type2;
462 /* First relocation. */
463 unsigned char r_type;
464 /* Addend. */
465 bfd_signed_vma r_addend;
466} Elf64_Mips_Internal_Rela;
467
468/* Values found in the r_ssym field of a relocation entry. */
469
470/* No relocation. */
471#define RSS_UNDEF 0
472
473/* Value of GP. */
474#define RSS_GP 1
475
476/* Value of GP in object being relocated. */
477#define RSS_GP0 2
478
479/* Address of location being relocated. */
480#define RSS_LOC 3
4086bde1
DE
481\f
482/* A SHT_MIPS_OPTIONS section contains a series of options, each of
483 which starts with this header. */
484
485typedef struct
486{
487 /* Type of option. */
488 unsigned char kind[1];
489 /* Size of option descriptor, including header. */
490 unsigned char size[1];
491 /* Section index of affected section, or 0 for global option. */
492 unsigned char section[2];
493 /* Information specific to this kind of option. */
494 unsigned char info[4];
495} Elf_External_Options;
496
497typedef struct
498{
499 /* Type of option. */
500 unsigned char kind;
501 /* Size of option descriptor, including header. */
502 unsigned char size;
503 /* Section index of affected section, or 0 for global option. */
504 unsigned short section;
505 /* Information specific to this kind of option. */
506 unsigned long info;
507} Elf_Internal_Options;
508
509/* MIPS ELF option header swapping routines. */
510extern void bfd_mips_elf_swap_options_in
511 PARAMS ((bfd *, const Elf_External_Options *, Elf_Internal_Options *));
512extern void bfd_mips_elf_swap_options_out
513 PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *));
514
515/* Values which may appear in the kind field of an Elf_Options
516 structure. */
517
518/* Undefined. */
519#define ODK_NULL 0
520
521/* Register usage and GP value. */
522#define ODK_REGINFO 1
523
524/* Exception processing information. */
525#define ODK_EXCEPTIONS 2
526
527/* Section padding information. */
528#define ODK_PAD 3
529
530/* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_Reginfo
531 structure. In the 64 bit ABI, it is the following structure. The
532 info field of the options header is not used. */
533
534typedef struct
535{
536 /* Mask of general purpose registers used. */
537 unsigned char ri_gprmask[4];
538 /* Padding. */
539 unsigned char ri_pad[4];
540 /* Mask of co-processor registers used. */
541 unsigned char ri_cprmask[4][4];
542 /* GP register value for this object file. */
543 unsigned char ri_gp_value[8];
544} Elf64_External_RegInfo;
545
546typedef struct
547{
548 /* Mask of general purpose registers used. */
549 unsigned long ri_gprmask;
550 /* Padding. */
551 unsigned long ri_pad;
552 /* Mask of co-processor registers used. */
553 unsigned long ri_cprmask[4];
554 /* GP register value for this object file. */
555 bfd_vma ri_gp_value;
556} Elf64_Internal_RegInfo;
557
558/* MIPS ELF reginfo swapping routines. */
559extern void bfd_mips_elf64_swap_reginfo_in
560 PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *));
561extern void bfd_mips_elf64_swap_reginfo_out
562 PARAMS ((bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *));
d15f4fd0
DE
563\f
564/* start-sanitize-sky */
565/* The vu overlay table is an array of this. */
566
567typedef struct
568{
55412e05
UD
569 /* `name' is offset into overlay string table section. */
570 char name[4];
571 char lma[4];
572 char vma[4];
573} Elf32_Dvp_External_Overlay;
d15f4fd0
DE
574
575typedef struct
576{
577 bfd_vma name;
578 bfd_vma lma;
579 bfd_vma vma;
55412e05 580} Elf32_Dvp_Internal_Overlay;
d15f4fd0
DE
581
582/* overlay swapping routines. */
55412e05
UD
583extern void bfd_dvp_elf32_swap_overlay_in
584 PARAMS ((bfd *, const Elf32_Dvp_External_Overlay *,
585 Elf32_Dvp_Internal_Overlay *));
586extern void bfd_dvp_elf32_swap_overlay_out
587 PARAMS ((bfd *, const Elf32_Dvp_Internal_Overlay *,
588 Elf32_Dvp_External_Overlay *));
d15f4fd0
DE
589
590/* end-sanitize-sky */
80483b24
ILT
591
592#endif /* _ELF_MIPS_H */
This page took 0.403312 seconds and 4 git commands to generate.