xref: /dflybsd-src/contrib/gdb-7/include/elf/mips.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* MIPS ELF support for BFD.
25796c8dcSSimon Schubert    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3*ef5ccd6cSJohn Marino    2003, 2004, 2005, 2008, 2009, 2010, 2013
45796c8dcSSimon Schubert    Free Software Foundation, Inc.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
75796c8dcSSimon Schubert    information in the System V Application Binary Interface, MIPS
85796c8dcSSimon Schubert    Processor Supplement.
95796c8dcSSimon Schubert 
105796c8dcSSimon Schubert    This file is part of BFD, the Binary File Descriptor library.
115796c8dcSSimon Schubert 
125796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
135796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
14cf7f2e2dSJohn Marino    the Free Software Foundation; either version 3 of the License, or
155796c8dcSSimon Schubert    (at your option) any later version.
165796c8dcSSimon Schubert 
175796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
185796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
195796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
205796c8dcSSimon Schubert    GNU General Public License for more details.
215796c8dcSSimon Schubert 
225796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
235796c8dcSSimon Schubert    along with this program; if not, write to the Free Software
24cf7f2e2dSJohn Marino    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
25cf7f2e2dSJohn Marino    MA 02110-1301, USA.  */
265796c8dcSSimon Schubert 
275796c8dcSSimon Schubert /* This file holds definitions specific to the MIPS ELF ABI.  Note
285796c8dcSSimon Schubert    that most of this is not actually implemented by BFD.  */
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert #ifndef _ELF_MIPS_H
315796c8dcSSimon Schubert #define _ELF_MIPS_H
325796c8dcSSimon Schubert 
335796c8dcSSimon Schubert #include "elf/reloc-macros.h"
345796c8dcSSimon Schubert 
355796c8dcSSimon Schubert /* Relocation types.  */
365796c8dcSSimon Schubert START_RELOC_NUMBERS (elf_mips_reloc_type)
375796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_NONE, 0)
385796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_16, 1)
395796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_32, 2)		/* In Elf 64: alias R_MIPS_ADD */
405796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_REL32, 3)	/* In Elf 64: alias R_MIPS_REL */
415796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_26, 4)
425796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_HI16, 5)
435796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_LO16, 6)
445796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GPREL16, 7)	/* In Elf 64: alias R_MIPS_GPREL */
455796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_LITERAL, 8)
465796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT16, 9)	/* In Elf 64: alias R_MIPS_GOT */
475796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_PC16, 10)
485796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_CALL16, 11)	/* In Elf 64: alias R_MIPS_CALL */
495796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GPREL32, 12)
505796c8dcSSimon Schubert   /* The remaining relocs are defined on Irix, although they are not
515796c8dcSSimon Schubert      in the MIPS ELF ABI.  */
525796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_UNUSED1, 13)
535796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_UNUSED2, 14)
545796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_UNUSED3, 15)
555796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_SHIFT5, 16)
565796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_SHIFT6, 17)
575796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_64, 18)
585796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT_DISP, 19)
595796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT_PAGE, 20)
605796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT_OFST, 21)
615796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT_HI16, 22)
625796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GOT_LO16, 23)
635796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_SUB, 24)
645796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_INSERT_A, 25)
655796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_INSERT_B, 26)
665796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_DELETE, 27)
675796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_HIGHER, 28)
685796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_HIGHEST, 29)
695796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_CALL_HI16, 30)
705796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_CALL_LO16, 31)
715796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_SCN_DISP, 32)
725796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_REL16, 33)
735796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_ADD_IMMEDIATE, 34)
745796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_PJUMP, 35)
755796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_RELGOT, 36)
765796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_JALR, 37)
775796c8dcSSimon Schubert   /* TLS relocations.  */
785796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPMOD32, 38)
795796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPREL32, 39)
805796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPMOD64, 40)
815796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPREL64, 41)
825796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_GD, 42)
835796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_LDM, 43)
845796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPREL_HI16, 44)
855796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_DTPREL_LO16, 45)
865796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_GOTTPREL, 46)
875796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
885796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
895796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
905796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
915796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
925796c8dcSSimon Schubert   FAKE_RELOC (R_MIPS_max, 52)
935796c8dcSSimon Schubert   /* These relocs are used for the mips16.  */
945796c8dcSSimon Schubert   FAKE_RELOC (R_MIPS16_min, 100)
955796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_26, 100)
965796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_GPREL, 101)
975796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_GOT16, 102)
985796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_CALL16, 103)
995796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_HI16, 104)
1005796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS16_LO16, 105)
101*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_GD, 106)
102*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_LDM, 107)
103*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_DTPREL_HI16, 108)
104*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_DTPREL_LO16, 109)
105*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_GOTTPREL, 110)
106*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_TPREL_HI16, 111)
107*ef5ccd6cSJohn Marino   RELOC_NUMBER (R_MIPS16_TLS_TPREL_LO16, 112)
108*ef5ccd6cSJohn Marino   FAKE_RELOC (R_MIPS16_max, 113)
1095796c8dcSSimon Schubert   /* These relocations are specific to VxWorks.  */
1105796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_COPY, 126)
1115796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_JUMP_SLOT, 127)
112a45ae5f8SJohn Marino 
113a45ae5f8SJohn Marino   /* These relocations are specific to microMIPS.  */
114a45ae5f8SJohn Marino   FAKE_RELOC (R_MICROMIPS_min, 130)
115a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_26_S1, 133)
116a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_HI16, 134)
117a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_LO16, 135)
118a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GPREL16, 136)	/* In Elf 64:
119a45ae5f8SJohn Marino 						   alias R_MICROMIPS_GPREL */
120a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_LITERAL, 137)
121a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT16, 138)		/* In Elf 64:
122a45ae5f8SJohn Marino 						   alias R_MICROMIPS_GOT */
123a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_PC7_S1, 139)
124a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_PC10_S1, 140)
125a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_PC16_S1, 141)
126a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_CALL16, 142)	/* In Elf 64:
127a45ae5f8SJohn Marino 						   alias R_MICROMIPS_CALL */
128a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT_DISP, 145)
129a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT_PAGE, 146)
130a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT_OFST, 147)
131a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT_HI16, 148)
132a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GOT_LO16, 149)
133a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_SUB, 150)
134a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_HIGHER, 151)
135a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_HIGHEST, 152)
136a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_CALL_HI16, 153)
137a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_CALL_LO16, 154)
138a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_SCN_DISP, 155)
139a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_JALR, 156)
140a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_HI0_LO16, 157)
141a45ae5f8SJohn Marino   /* TLS relocations.  */
142a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_GD, 162)
143a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_LDM, 163)
144a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_DTPREL_HI16, 164)
145a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_DTPREL_LO16, 165)
146a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_GOTTPREL, 166)
147a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_TPREL_HI16, 169)
148a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_TLS_TPREL_LO16, 170)
149a45ae5f8SJohn Marino   /* microMIPS GP- and PC-relative relocations. */
150a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_GPREL7_S2, 172)
151a45ae5f8SJohn Marino   RELOC_NUMBER (R_MICROMIPS_PC23_S2, 173)
152a45ae5f8SJohn Marino   FAKE_RELOC (R_MICROMIPS_max, 174)
153a45ae5f8SJohn Marino 
1545796c8dcSSimon Schubert   /* This was a GNU extension used by embedded-PIC.  It was co-opted by
1555796c8dcSSimon Schubert      mips-linux for exception-handling data.  It is no longer used, but
1565796c8dcSSimon Schubert      should continue to be supported by the linker for backward
1575796c8dcSSimon Schubert      compatibility.  (GCC stopped using it in May, 2004.)  */
1585796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_PC32, 248)
1595796c8dcSSimon Schubert   /* FIXME: this relocation is used internally by gas.  */
1605796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250)
1615796c8dcSSimon Schubert   /* These are GNU extensions to enable C++ vtable garbage collection.  */
1625796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
1635796c8dcSSimon Schubert   RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
1645796c8dcSSimon Schubert END_RELOC_NUMBERS (R_MIPS_maxext)
1655796c8dcSSimon Schubert 
1665796c8dcSSimon Schubert /* Processor specific flags for the ELF header e_flags field.  */
1675796c8dcSSimon Schubert 
1685796c8dcSSimon Schubert /* At least one .noreorder directive appears in the source.  */
1695796c8dcSSimon Schubert #define EF_MIPS_NOREORDER	0x00000001
1705796c8dcSSimon Schubert 
1715796c8dcSSimon Schubert /* File contains position independent code.  */
1725796c8dcSSimon Schubert #define EF_MIPS_PIC		0x00000002
1735796c8dcSSimon Schubert 
1745796c8dcSSimon Schubert /* Code in file uses the standard calling sequence for calling
1755796c8dcSSimon Schubert    position independent code.  */
1765796c8dcSSimon Schubert #define EF_MIPS_CPIC		0x00000004
1775796c8dcSSimon Schubert 
1785796c8dcSSimon Schubert /* ???  Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a.  */
1795796c8dcSSimon Schubert #define EF_MIPS_XGOT		0x00000008
1805796c8dcSSimon Schubert 
1815796c8dcSSimon Schubert /* Code in file uses UCODE (obsolete) */
1825796c8dcSSimon Schubert #define EF_MIPS_UCODE		0x00000010
1835796c8dcSSimon Schubert 
1845796c8dcSSimon Schubert /* Code in file uses new ABI (-n32 on Irix 6).  */
1855796c8dcSSimon Schubert #define EF_MIPS_ABI2		0x00000020
1865796c8dcSSimon Schubert 
1875796c8dcSSimon Schubert /* Process the .MIPS.options section first by ld */
1885796c8dcSSimon Schubert #define EF_MIPS_OPTIONS_FIRST	0x00000080
1895796c8dcSSimon Schubert 
190*ef5ccd6cSJohn Marino /* Indicates code compiled for a 64-bit machine in 32-bit mode
191*ef5ccd6cSJohn Marino    (regs are 32-bits wide).  */
192*ef5ccd6cSJohn Marino #define EF_MIPS_32BITMODE	0x00000100
193*ef5ccd6cSJohn Marino 
1945796c8dcSSimon Schubert /* Architectural Extensions used by this file */
1955796c8dcSSimon Schubert #define EF_MIPS_ARCH_ASE	0x0f000000
1965796c8dcSSimon Schubert 
1975796c8dcSSimon Schubert /* Use MDMX multimedia extensions */
1985796c8dcSSimon Schubert #define EF_MIPS_ARCH_ASE_MDMX	0x08000000
1995796c8dcSSimon Schubert 
2005796c8dcSSimon Schubert /* Use MIPS-16 ISA extensions */
2015796c8dcSSimon Schubert #define EF_MIPS_ARCH_ASE_M16	0x04000000
2025796c8dcSSimon Schubert 
203a45ae5f8SJohn Marino /* Use MICROMIPS ISA extensions.  */
204a45ae5f8SJohn Marino #define EF_MIPS_ARCH_ASE_MICROMIPS	0x02000000
205a45ae5f8SJohn Marino 
2065796c8dcSSimon Schubert /* Four bit MIPS architecture field.  */
2075796c8dcSSimon Schubert #define EF_MIPS_ARCH		0xf0000000
2085796c8dcSSimon Schubert 
2095796c8dcSSimon Schubert /* -mips1 code.  */
2105796c8dcSSimon Schubert #define E_MIPS_ARCH_1		0x00000000
2115796c8dcSSimon Schubert 
2125796c8dcSSimon Schubert /* -mips2 code.  */
2135796c8dcSSimon Schubert #define E_MIPS_ARCH_2		0x10000000
2145796c8dcSSimon Schubert 
2155796c8dcSSimon Schubert /* -mips3 code.  */
2165796c8dcSSimon Schubert #define E_MIPS_ARCH_3		0x20000000
2175796c8dcSSimon Schubert 
2185796c8dcSSimon Schubert /* -mips4 code.  */
2195796c8dcSSimon Schubert #define E_MIPS_ARCH_4		0x30000000
2205796c8dcSSimon Schubert 
2215796c8dcSSimon Schubert /* -mips5 code.  */
2225796c8dcSSimon Schubert #define E_MIPS_ARCH_5           0x40000000
2235796c8dcSSimon Schubert 
2245796c8dcSSimon Schubert /* -mips32 code.  */
2255796c8dcSSimon Schubert #define E_MIPS_ARCH_32          0x50000000
2265796c8dcSSimon Schubert 
2275796c8dcSSimon Schubert /* -mips64 code.  */
2285796c8dcSSimon Schubert #define E_MIPS_ARCH_64          0x60000000
2295796c8dcSSimon Schubert 
2305796c8dcSSimon Schubert /* -mips32r2 code.  */
2315796c8dcSSimon Schubert #define E_MIPS_ARCH_32R2        0x70000000
2325796c8dcSSimon Schubert 
2335796c8dcSSimon Schubert /* -mips64r2 code.  */
2345796c8dcSSimon Schubert #define E_MIPS_ARCH_64R2        0x80000000
2355796c8dcSSimon Schubert 
2365796c8dcSSimon Schubert /* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
2375796c8dcSSimon Schubert #define EF_MIPS_ABI		0x0000F000
2385796c8dcSSimon Schubert 
2395796c8dcSSimon Schubert /* The original o32 abi. */
2405796c8dcSSimon Schubert #define E_MIPS_ABI_O32          0x00001000
2415796c8dcSSimon Schubert 
2425796c8dcSSimon Schubert /* O32 extended to work on 64 bit architectures */
2435796c8dcSSimon Schubert #define E_MIPS_ABI_O64          0x00002000
2445796c8dcSSimon Schubert 
2455796c8dcSSimon Schubert /* EABI in 32 bit mode */
2465796c8dcSSimon Schubert #define E_MIPS_ABI_EABI32       0x00003000
2475796c8dcSSimon Schubert 
2485796c8dcSSimon Schubert /* EABI in 64 bit mode */
2495796c8dcSSimon Schubert #define E_MIPS_ABI_EABI64       0x00004000
2505796c8dcSSimon Schubert 
2515796c8dcSSimon Schubert 
2525796c8dcSSimon Schubert /* Machine variant if we know it.  This field was invented at Cygnus,
2535796c8dcSSimon Schubert    but it is hoped that other vendors will adopt it.  If some standard
2545796c8dcSSimon Schubert    is developed, this code should be changed to follow it. */
2555796c8dcSSimon Schubert 
2565796c8dcSSimon Schubert #define EF_MIPS_MACH		0x00FF0000
2575796c8dcSSimon Schubert 
2585796c8dcSSimon Schubert /* Cygnus is choosing values between 80 and 9F;
2595796c8dcSSimon Schubert    00 - 7F should be left for a future standard;
2605796c8dcSSimon Schubert    the rest are open. */
2615796c8dcSSimon Schubert 
2625796c8dcSSimon Schubert #define E_MIPS_MACH_3900	0x00810000
2635796c8dcSSimon Schubert #define E_MIPS_MACH_4010	0x00820000
2645796c8dcSSimon Schubert #define E_MIPS_MACH_4100	0x00830000
2655796c8dcSSimon Schubert #define E_MIPS_MACH_4650	0x00850000
2665796c8dcSSimon Schubert #define E_MIPS_MACH_4120	0x00870000
2675796c8dcSSimon Schubert #define E_MIPS_MACH_4111	0x00880000
2685796c8dcSSimon Schubert #define E_MIPS_MACH_SB1         0x008a0000
2695796c8dcSSimon Schubert #define E_MIPS_MACH_OCTEON	0x008b0000
2705796c8dcSSimon Schubert #define E_MIPS_MACH_XLR     	0x008c0000
271cf7f2e2dSJohn Marino #define E_MIPS_MACH_OCTEON2	0x008d0000
2725796c8dcSSimon Schubert #define E_MIPS_MACH_5400	0x00910000
273*ef5ccd6cSJohn Marino #define E_MIPS_MACH_5900	0x00920000
2745796c8dcSSimon Schubert #define E_MIPS_MACH_5500	0x00980000
2755796c8dcSSimon Schubert #define E_MIPS_MACH_9000	0x00990000
2765796c8dcSSimon Schubert #define E_MIPS_MACH_LS2E        0x00A00000
2775796c8dcSSimon Schubert #define E_MIPS_MACH_LS2F        0x00A10000
278c50c785cSJohn Marino #define E_MIPS_MACH_LS3A        0x00A20000
2795796c8dcSSimon Schubert 
2805796c8dcSSimon Schubert /* Processor specific section indices.  These sections do not actually
2815796c8dcSSimon Schubert    exist.  Symbols with a st_shndx field corresponding to one of these
2825796c8dcSSimon Schubert    values have a special meaning.  */
2835796c8dcSSimon Schubert 
2845796c8dcSSimon Schubert /* Defined and allocated common symbol.  Value is virtual address.  If
2855796c8dcSSimon Schubert    relocated, alignment must be preserved.  */
2865796c8dcSSimon Schubert #define SHN_MIPS_ACOMMON	SHN_LORESERVE
2875796c8dcSSimon Schubert 
2885796c8dcSSimon Schubert /* Defined and allocated text symbol.  Value is virtual address.
2895796c8dcSSimon Schubert    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
2905796c8dcSSimon Schubert #define SHN_MIPS_TEXT		(SHN_LORESERVE + 1)
2915796c8dcSSimon Schubert 
2925796c8dcSSimon Schubert /* Defined and allocated data symbol.  Value is virtual address.
2935796c8dcSSimon Schubert    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
2945796c8dcSSimon Schubert #define SHN_MIPS_DATA		(SHN_LORESERVE + 2)
2955796c8dcSSimon Schubert 
2965796c8dcSSimon Schubert /* Small common symbol.  */
2975796c8dcSSimon Schubert #define SHN_MIPS_SCOMMON	(SHN_LORESERVE + 3)
2985796c8dcSSimon Schubert 
2995796c8dcSSimon Schubert /* Small undefined symbol.  */
3005796c8dcSSimon Schubert #define SHN_MIPS_SUNDEFINED	(SHN_LORESERVE + 4)
3015796c8dcSSimon Schubert 
3025796c8dcSSimon Schubert /* Processor specific section types.  */
3035796c8dcSSimon Schubert 
3045796c8dcSSimon Schubert /* Section contains the set of dynamic shared objects used when
3055796c8dcSSimon Schubert    statically linking.  */
3065796c8dcSSimon Schubert #define SHT_MIPS_LIBLIST	0x70000000
3075796c8dcSSimon Schubert 
3085796c8dcSSimon Schubert /* I'm not sure what this is, but it's used on Irix 5.  */
3095796c8dcSSimon Schubert #define SHT_MIPS_MSYM		0x70000001
3105796c8dcSSimon Schubert 
3115796c8dcSSimon Schubert /* Section contains list of symbols whose definitions conflict with
3125796c8dcSSimon Schubert    symbols defined in shared objects.  */
3135796c8dcSSimon Schubert #define SHT_MIPS_CONFLICT	0x70000002
3145796c8dcSSimon Schubert 
3155796c8dcSSimon Schubert /* Section contains the global pointer table.  */
3165796c8dcSSimon Schubert #define SHT_MIPS_GPTAB		0x70000003
3175796c8dcSSimon Schubert 
3185796c8dcSSimon Schubert /* Section contains microcode information.  The exact format is
3195796c8dcSSimon Schubert    unspecified.  */
3205796c8dcSSimon Schubert #define SHT_MIPS_UCODE		0x70000004
3215796c8dcSSimon Schubert 
3225796c8dcSSimon Schubert /* Section contains some sort of debugging information.  The exact
3235796c8dcSSimon Schubert    format is unspecified.  It's probably ECOFF symbols.  */
3245796c8dcSSimon Schubert #define SHT_MIPS_DEBUG		0x70000005
3255796c8dcSSimon Schubert 
3265796c8dcSSimon Schubert /* Section contains register usage information.  */
3275796c8dcSSimon Schubert #define SHT_MIPS_REGINFO	0x70000006
3285796c8dcSSimon Schubert 
3295796c8dcSSimon Schubert /* ??? */
3305796c8dcSSimon Schubert #define SHT_MIPS_PACKAGE	0x70000007
3315796c8dcSSimon Schubert 
3325796c8dcSSimon Schubert /* ??? */
3335796c8dcSSimon Schubert #define SHT_MIPS_PACKSYM	0x70000008
3345796c8dcSSimon Schubert 
3355796c8dcSSimon Schubert /* ??? */
3365796c8dcSSimon Schubert #define SHT_MIPS_RELD		0x70000009
3375796c8dcSSimon Schubert 
3385796c8dcSSimon Schubert /* Section contains interface information.  */
3395796c8dcSSimon Schubert #define SHT_MIPS_IFACE		0x7000000b
3405796c8dcSSimon Schubert 
3415796c8dcSSimon Schubert /* Section contains description of contents of another section.  */
3425796c8dcSSimon Schubert #define SHT_MIPS_CONTENT	0x7000000c
3435796c8dcSSimon Schubert 
3445796c8dcSSimon Schubert /* Section contains miscellaneous options.  */
3455796c8dcSSimon Schubert #define SHT_MIPS_OPTIONS	0x7000000d
3465796c8dcSSimon Schubert 
3475796c8dcSSimon Schubert /* ??? */
3485796c8dcSSimon Schubert #define SHT_MIPS_SHDR		0x70000010
3495796c8dcSSimon Schubert 
3505796c8dcSSimon Schubert /* ??? */
3515796c8dcSSimon Schubert #define SHT_MIPS_FDESC		0x70000011
3525796c8dcSSimon Schubert 
3535796c8dcSSimon Schubert /* ??? */
3545796c8dcSSimon Schubert #define SHT_MIPS_EXTSYM		0x70000012
3555796c8dcSSimon Schubert 
3565796c8dcSSimon Schubert /* ??? */
3575796c8dcSSimon Schubert #define SHT_MIPS_DENSE		0x70000013
3585796c8dcSSimon Schubert 
3595796c8dcSSimon Schubert /* ??? */
3605796c8dcSSimon Schubert #define SHT_MIPS_PDESC		0x70000014
3615796c8dcSSimon Schubert 
3625796c8dcSSimon Schubert /* ??? */
3635796c8dcSSimon Schubert #define SHT_MIPS_LOCSYM		0x70000015
3645796c8dcSSimon Schubert 
3655796c8dcSSimon Schubert /* ??? */
3665796c8dcSSimon Schubert #define SHT_MIPS_AUXSYM		0x70000016
3675796c8dcSSimon Schubert 
3685796c8dcSSimon Schubert /* ??? */
3695796c8dcSSimon Schubert #define SHT_MIPS_OPTSYM		0x70000017
3705796c8dcSSimon Schubert 
3715796c8dcSSimon Schubert /* ??? */
3725796c8dcSSimon Schubert #define SHT_MIPS_LOCSTR		0x70000018
3735796c8dcSSimon Schubert 
3745796c8dcSSimon Schubert /* ??? */
3755796c8dcSSimon Schubert #define SHT_MIPS_LINE		0x70000019
3765796c8dcSSimon Schubert 
3775796c8dcSSimon Schubert /* ??? */
3785796c8dcSSimon Schubert #define SHT_MIPS_RFDESC		0x7000001a
3795796c8dcSSimon Schubert 
3805796c8dcSSimon Schubert /* Delta C++: symbol table */
3815796c8dcSSimon Schubert #define SHT_MIPS_DELTASYM	0x7000001b
3825796c8dcSSimon Schubert 
3835796c8dcSSimon Schubert /* Delta C++: instance table */
3845796c8dcSSimon Schubert #define SHT_MIPS_DELTAINST	0x7000001c
3855796c8dcSSimon Schubert 
3865796c8dcSSimon Schubert /* Delta C++: class table */
3875796c8dcSSimon Schubert #define SHT_MIPS_DELTACLASS	0x7000001d
3885796c8dcSSimon Schubert 
3895796c8dcSSimon Schubert /* DWARF debugging section.  */
3905796c8dcSSimon Schubert #define SHT_MIPS_DWARF		0x7000001e
3915796c8dcSSimon Schubert 
3925796c8dcSSimon Schubert /* Delta C++: declarations */
3935796c8dcSSimon Schubert #define SHT_MIPS_DELTADECL	0x7000001f
3945796c8dcSSimon Schubert 
3955796c8dcSSimon Schubert /* List of libraries the binary depends on.  Includes a time stamp, version
3965796c8dcSSimon Schubert    number.  */
3975796c8dcSSimon Schubert #define SHT_MIPS_SYMBOL_LIB	0x70000020
3985796c8dcSSimon Schubert 
3995796c8dcSSimon Schubert /* Events section.  */
4005796c8dcSSimon Schubert #define SHT_MIPS_EVENTS		0x70000021
4015796c8dcSSimon Schubert 
4025796c8dcSSimon Schubert /* ??? */
4035796c8dcSSimon Schubert #define SHT_MIPS_TRANSLATE	0x70000022
4045796c8dcSSimon Schubert 
4055796c8dcSSimon Schubert /* Special pixie sections */
4065796c8dcSSimon Schubert #define SHT_MIPS_PIXIE		0x70000023
4075796c8dcSSimon Schubert 
4085796c8dcSSimon Schubert /* Address translation table (for debug info) */
4095796c8dcSSimon Schubert #define SHT_MIPS_XLATE		0x70000024
4105796c8dcSSimon Schubert 
4115796c8dcSSimon Schubert /* SGI internal address translation table (for debug info) */
4125796c8dcSSimon Schubert #define SHT_MIPS_XLATE_DEBUG	0x70000025
4135796c8dcSSimon Schubert 
4145796c8dcSSimon Schubert /* Intermediate code */
4155796c8dcSSimon Schubert #define SHT_MIPS_WHIRL		0x70000026
4165796c8dcSSimon Schubert 
4175796c8dcSSimon Schubert /* C++ exception handling region info */
4185796c8dcSSimon Schubert #define SHT_MIPS_EH_REGION	0x70000027
4195796c8dcSSimon Schubert 
4205796c8dcSSimon Schubert /* Obsolete address translation table (for debug info) */
4215796c8dcSSimon Schubert #define SHT_MIPS_XLATE_OLD	0x70000028
4225796c8dcSSimon Schubert 
4235796c8dcSSimon Schubert /* Runtime procedure descriptor table exception information (ucode) ??? */
4245796c8dcSSimon Schubert #define SHT_MIPS_PDR_EXCEPTION	0x70000029
4255796c8dcSSimon Schubert 
4265796c8dcSSimon Schubert 
4275796c8dcSSimon Schubert /* A section of type SHT_MIPS_LIBLIST contains an array of the
4285796c8dcSSimon Schubert    following structure.  The sh_link field is the section index of the
4295796c8dcSSimon Schubert    string table.  The sh_info field is the number of entries in the
4305796c8dcSSimon Schubert    section.  */
4315796c8dcSSimon Schubert typedef struct
4325796c8dcSSimon Schubert {
4335796c8dcSSimon Schubert   /* String table index for name of shared object.  */
4345796c8dcSSimon Schubert   unsigned long l_name;
4355796c8dcSSimon Schubert   /* Time stamp.  */
4365796c8dcSSimon Schubert   unsigned long l_time_stamp;
4375796c8dcSSimon Schubert   /* Checksum of symbol names and common sizes.  */
4385796c8dcSSimon Schubert   unsigned long l_checksum;
4395796c8dcSSimon Schubert   /* String table index for version.  */
4405796c8dcSSimon Schubert   unsigned long l_version;
4415796c8dcSSimon Schubert   /* Flags.  */
4425796c8dcSSimon Schubert   unsigned long l_flags;
4435796c8dcSSimon Schubert } Elf32_Lib;
4445796c8dcSSimon Schubert 
4455796c8dcSSimon Schubert /* The external version of Elf32_Lib.  */
4465796c8dcSSimon Schubert typedef struct
4475796c8dcSSimon Schubert {
4485796c8dcSSimon Schubert   unsigned char l_name[4];
4495796c8dcSSimon Schubert   unsigned char l_time_stamp[4];
4505796c8dcSSimon Schubert   unsigned char l_checksum[4];
4515796c8dcSSimon Schubert   unsigned char l_version[4];
4525796c8dcSSimon Schubert   unsigned char l_flags[4];
4535796c8dcSSimon Schubert } Elf32_External_Lib;
4545796c8dcSSimon Schubert 
4555796c8dcSSimon Schubert /* The l_flags field of an Elf32_Lib structure may contain the
4565796c8dcSSimon Schubert    following flags.  */
4575796c8dcSSimon Schubert 
4585796c8dcSSimon Schubert /* Require an exact match at runtime.  */
4595796c8dcSSimon Schubert #define LL_EXACT_MATCH		0x00000001
4605796c8dcSSimon Schubert 
4615796c8dcSSimon Schubert /* Ignore version incompatibilities at runtime.  */
4625796c8dcSSimon Schubert #define LL_IGNORE_INT_VER	0x00000002
4635796c8dcSSimon Schubert 
4645796c8dcSSimon Schubert /* Require matching minor version number.  */
4655796c8dcSSimon Schubert #define LL_REQUIRE_MINOR	0x00000004
4665796c8dcSSimon Schubert 
4675796c8dcSSimon Schubert /* ??? */
4685796c8dcSSimon Schubert #define LL_EXPORTS		0x00000008
4695796c8dcSSimon Schubert 
4705796c8dcSSimon Schubert /* Delay loading of this library until really needed.  */
4715796c8dcSSimon Schubert #define LL_DELAY_LOAD		0x00000010
4725796c8dcSSimon Schubert 
4735796c8dcSSimon Schubert /* ??? Delta C++ stuff ??? */
4745796c8dcSSimon Schubert #define LL_DELTA		0x00000020
4755796c8dcSSimon Schubert 
4765796c8dcSSimon Schubert 
4775796c8dcSSimon Schubert /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
4785796c8dcSSimon Schubert    .dynsym section.  Each element has the following type.  */
4795796c8dcSSimon Schubert typedef unsigned long Elf32_Conflict;
4805796c8dcSSimon Schubert typedef unsigned char Elf32_External_Conflict[4];
4815796c8dcSSimon Schubert 
4825796c8dcSSimon Schubert typedef unsigned long Elf64_Conflict;
4835796c8dcSSimon Schubert typedef unsigned char Elf64_External_Conflict[8];
4845796c8dcSSimon Schubert 
4855796c8dcSSimon Schubert /* A section of type SHT_MIPS_GPTAB contains information about how
4865796c8dcSSimon Schubert    much GP space would be required for different -G arguments.  This
4875796c8dcSSimon Schubert    information is only used so that the linker can provide informative
4885796c8dcSSimon Schubert    suggestions as to the best -G value to use.  The sh_info field is
4895796c8dcSSimon Schubert    the index of the section for which this information applies.  The
4905796c8dcSSimon Schubert    contents of the section are an array of the following union.  The
4915796c8dcSSimon Schubert    first element uses the gt_header field.  The remaining elements use
4925796c8dcSSimon Schubert    the gt_entry field.  */
4935796c8dcSSimon Schubert typedef union
4945796c8dcSSimon Schubert {
4955796c8dcSSimon Schubert   struct
4965796c8dcSSimon Schubert     {
4975796c8dcSSimon Schubert       /* -G value actually used for this object file.  */
4985796c8dcSSimon Schubert       unsigned long gt_current_g_value;
4995796c8dcSSimon Schubert       /* Unused.  */
5005796c8dcSSimon Schubert       unsigned long gt_unused;
5015796c8dcSSimon Schubert     } gt_header;
5025796c8dcSSimon Schubert   struct
5035796c8dcSSimon Schubert     {
5045796c8dcSSimon Schubert       /* If this -G argument has been used...  */
5055796c8dcSSimon Schubert       unsigned long gt_g_value;
5065796c8dcSSimon Schubert       /* ...this many GP section bytes would be required.  */
5075796c8dcSSimon Schubert       unsigned long gt_bytes;
5085796c8dcSSimon Schubert     } gt_entry;
5095796c8dcSSimon Schubert } Elf32_gptab;
5105796c8dcSSimon Schubert 
5115796c8dcSSimon Schubert /* The external version of Elf32_gptab.  */
5125796c8dcSSimon Schubert 
5135796c8dcSSimon Schubert typedef union
5145796c8dcSSimon Schubert {
5155796c8dcSSimon Schubert   struct
5165796c8dcSSimon Schubert     {
5175796c8dcSSimon Schubert       unsigned char gt_current_g_value[4];
5185796c8dcSSimon Schubert       unsigned char gt_unused[4];
5195796c8dcSSimon Schubert     } gt_header;
5205796c8dcSSimon Schubert   struct
5215796c8dcSSimon Schubert     {
5225796c8dcSSimon Schubert       unsigned char gt_g_value[4];
5235796c8dcSSimon Schubert       unsigned char gt_bytes[4];
5245796c8dcSSimon Schubert     } gt_entry;
5255796c8dcSSimon Schubert } Elf32_External_gptab;
5265796c8dcSSimon Schubert 
5275796c8dcSSimon Schubert /* A section of type SHT_MIPS_REGINFO contains the following
5285796c8dcSSimon Schubert    structure.  */
5295796c8dcSSimon Schubert typedef struct
5305796c8dcSSimon Schubert {
5315796c8dcSSimon Schubert   /* Mask of general purpose registers used.  */
5325796c8dcSSimon Schubert   unsigned long ri_gprmask;
5335796c8dcSSimon Schubert   /* Mask of co-processor registers used.  */
5345796c8dcSSimon Schubert   unsigned long ri_cprmask[4];
5355796c8dcSSimon Schubert   /* GP register value for this object file.  */
5365796c8dcSSimon Schubert   long ri_gp_value;
5375796c8dcSSimon Schubert } Elf32_RegInfo;
5385796c8dcSSimon Schubert 
5395796c8dcSSimon Schubert /* The external version of the Elf_RegInfo structure.  */
5405796c8dcSSimon Schubert typedef struct
5415796c8dcSSimon Schubert {
5425796c8dcSSimon Schubert   unsigned char ri_gprmask[4];
5435796c8dcSSimon Schubert   unsigned char ri_cprmask[4][4];
5445796c8dcSSimon Schubert   unsigned char ri_gp_value[4];
5455796c8dcSSimon Schubert } Elf32_External_RegInfo;
5465796c8dcSSimon Schubert 
5475796c8dcSSimon Schubert /* MIPS ELF .reginfo swapping routines.  */
5485796c8dcSSimon Schubert extern void bfd_mips_elf32_swap_reginfo_in
5495796c8dcSSimon Schubert   (bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *);
5505796c8dcSSimon Schubert extern void bfd_mips_elf32_swap_reginfo_out
5515796c8dcSSimon Schubert   (bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *);
5525796c8dcSSimon Schubert 
5535796c8dcSSimon Schubert /* Processor specific section flags.  */
5545796c8dcSSimon Schubert 
5555796c8dcSSimon Schubert /* This section must be in the global data area.  */
5565796c8dcSSimon Schubert #define SHF_MIPS_GPREL		0x10000000
5575796c8dcSSimon Schubert 
5585796c8dcSSimon Schubert /* This section should be merged.  */
5595796c8dcSSimon Schubert #define SHF_MIPS_MERGE		0x20000000
5605796c8dcSSimon Schubert 
5615796c8dcSSimon Schubert /* This section contains address data of size implied by section
5625796c8dcSSimon Schubert    element size.  */
5635796c8dcSSimon Schubert #define SHF_MIPS_ADDR		0x40000000
5645796c8dcSSimon Schubert 
5655796c8dcSSimon Schubert /* This section contains string data.  */
5665796c8dcSSimon Schubert #define SHF_MIPS_STRING		0x80000000
5675796c8dcSSimon Schubert 
5685796c8dcSSimon Schubert /* This section may not be stripped.  */
5695796c8dcSSimon Schubert #define SHF_MIPS_NOSTRIP	0x08000000
5705796c8dcSSimon Schubert 
5715796c8dcSSimon Schubert /* This section is local to threads.  */
5725796c8dcSSimon Schubert #define SHF_MIPS_LOCAL		0x04000000
5735796c8dcSSimon Schubert 
5745796c8dcSSimon Schubert /* Linker should generate implicit weak names for this section.  */
5755796c8dcSSimon Schubert #define SHF_MIPS_NAMES		0x02000000
5765796c8dcSSimon Schubert 
5775796c8dcSSimon Schubert /* Section contais text/data which may be replicated in other sections.
5785796c8dcSSimon Schubert    Linker should retain only one copy.  */
5795796c8dcSSimon Schubert #define SHF_MIPS_NODUPES	0x01000000
5805796c8dcSSimon Schubert 
5815796c8dcSSimon Schubert /* Processor specific program header types.  */
5825796c8dcSSimon Schubert 
5835796c8dcSSimon Schubert /* Register usage information.  Identifies one .reginfo section.  */
5845796c8dcSSimon Schubert #define PT_MIPS_REGINFO		0x70000000
5855796c8dcSSimon Schubert 
5865796c8dcSSimon Schubert /* Runtime procedure table.  */
5875796c8dcSSimon Schubert #define PT_MIPS_RTPROC		0x70000001
5885796c8dcSSimon Schubert 
5895796c8dcSSimon Schubert /* .MIPS.options section.  */
5905796c8dcSSimon Schubert #define PT_MIPS_OPTIONS		0x70000002
5915796c8dcSSimon Schubert 
5925796c8dcSSimon Schubert /* Processor specific dynamic array tags.  */
5935796c8dcSSimon Schubert 
5945796c8dcSSimon Schubert /* 32 bit version number for runtime linker interface.  */
5955796c8dcSSimon Schubert #define DT_MIPS_RLD_VERSION	0x70000001
5965796c8dcSSimon Schubert 
5975796c8dcSSimon Schubert /* Time stamp.  */
5985796c8dcSSimon Schubert #define DT_MIPS_TIME_STAMP	0x70000002
5995796c8dcSSimon Schubert 
6005796c8dcSSimon Schubert /* Checksum of external strings and common sizes.  */
6015796c8dcSSimon Schubert #define DT_MIPS_ICHECKSUM	0x70000003
6025796c8dcSSimon Schubert 
6035796c8dcSSimon Schubert /* Index of version string in string table.  */
6045796c8dcSSimon Schubert #define DT_MIPS_IVERSION	0x70000004
6055796c8dcSSimon Schubert 
6065796c8dcSSimon Schubert /* 32 bits of flags.  */
6075796c8dcSSimon Schubert #define DT_MIPS_FLAGS		0x70000005
6085796c8dcSSimon Schubert 
6095796c8dcSSimon Schubert /* Base address of the segment.  */
6105796c8dcSSimon Schubert #define DT_MIPS_BASE_ADDRESS	0x70000006
6115796c8dcSSimon Schubert 
6125796c8dcSSimon Schubert /* ??? */
6135796c8dcSSimon Schubert #define DT_MIPS_MSYM		0x70000007
6145796c8dcSSimon Schubert 
6155796c8dcSSimon Schubert /* Address of .conflict section.  */
6165796c8dcSSimon Schubert #define DT_MIPS_CONFLICT	0x70000008
6175796c8dcSSimon Schubert 
6185796c8dcSSimon Schubert /* Address of .liblist section.  */
6195796c8dcSSimon Schubert #define DT_MIPS_LIBLIST		0x70000009
6205796c8dcSSimon Schubert 
6215796c8dcSSimon Schubert /* Number of local global offset table entries.  */
6225796c8dcSSimon Schubert #define DT_MIPS_LOCAL_GOTNO	0x7000000a
6235796c8dcSSimon Schubert 
6245796c8dcSSimon Schubert /* Number of entries in the .conflict section.  */
6255796c8dcSSimon Schubert #define DT_MIPS_CONFLICTNO	0x7000000b
6265796c8dcSSimon Schubert 
6275796c8dcSSimon Schubert /* Number of entries in the .liblist section.  */
6285796c8dcSSimon Schubert #define DT_MIPS_LIBLISTNO	0x70000010
6295796c8dcSSimon Schubert 
6305796c8dcSSimon Schubert /* Number of entries in the .dynsym section.  */
6315796c8dcSSimon Schubert #define DT_MIPS_SYMTABNO	0x70000011
6325796c8dcSSimon Schubert 
6335796c8dcSSimon Schubert /* Index of first external dynamic symbol not referenced locally.  */
6345796c8dcSSimon Schubert #define DT_MIPS_UNREFEXTNO	0x70000012
6355796c8dcSSimon Schubert 
6365796c8dcSSimon Schubert /* Index of first dynamic symbol in global offset table.  */
6375796c8dcSSimon Schubert #define DT_MIPS_GOTSYM		0x70000013
6385796c8dcSSimon Schubert 
6395796c8dcSSimon Schubert /* Number of page table entries in global offset table.  */
6405796c8dcSSimon Schubert #define DT_MIPS_HIPAGENO	0x70000014
6415796c8dcSSimon Schubert 
6425796c8dcSSimon Schubert /* Address of run time loader map, used for debugging.  */
6435796c8dcSSimon Schubert #define DT_MIPS_RLD_MAP		0x70000016
6445796c8dcSSimon Schubert 
6455796c8dcSSimon Schubert /* Delta C++ class definition.  */
6465796c8dcSSimon Schubert #define DT_MIPS_DELTA_CLASS	0x70000017
6475796c8dcSSimon Schubert 
6485796c8dcSSimon Schubert /* Number of entries in DT_MIPS_DELTA_CLASS.  */
6495796c8dcSSimon Schubert #define DT_MIPS_DELTA_CLASS_NO	0x70000018
6505796c8dcSSimon Schubert 
6515796c8dcSSimon Schubert /* Delta C++ class instances.  */
6525796c8dcSSimon Schubert #define DT_MIPS_DELTA_INSTANCE	0x70000019
6535796c8dcSSimon Schubert 
6545796c8dcSSimon Schubert /* Number of entries in DT_MIPS_DELTA_INSTANCE.  */
6555796c8dcSSimon Schubert #define DT_MIPS_DELTA_INSTANCE_NO	0x7000001a
6565796c8dcSSimon Schubert 
6575796c8dcSSimon Schubert /* Delta relocations.  */
6585796c8dcSSimon Schubert #define DT_MIPS_DELTA_RELOC	0x7000001b
6595796c8dcSSimon Schubert 
6605796c8dcSSimon Schubert /* Number of entries in DT_MIPS_DELTA_RELOC.  */
6615796c8dcSSimon Schubert #define DT_MIPS_DELTA_RELOC_NO	0x7000001c
6625796c8dcSSimon Schubert 
6635796c8dcSSimon Schubert /* Delta symbols that Delta relocations refer to.  */
6645796c8dcSSimon Schubert #define DT_MIPS_DELTA_SYM	0x7000001d
6655796c8dcSSimon Schubert 
6665796c8dcSSimon Schubert /* Number of entries in DT_MIPS_DELTA_SYM.  */
6675796c8dcSSimon Schubert #define DT_MIPS_DELTA_SYM_NO	0x7000001e
6685796c8dcSSimon Schubert 
6695796c8dcSSimon Schubert /* Delta symbols that hold class declarations.  */
6705796c8dcSSimon Schubert #define DT_MIPS_DELTA_CLASSSYM	0x70000020
6715796c8dcSSimon Schubert 
6725796c8dcSSimon Schubert /* Number of entries in DT_MIPS_DELTA_CLASSSYM.  */
6735796c8dcSSimon Schubert #define DT_MIPS_DELTA_CLASSSYM_NO	0x70000021
6745796c8dcSSimon Schubert 
6755796c8dcSSimon Schubert /* Flags indicating information about C++ flavor.  */
6765796c8dcSSimon Schubert #define DT_MIPS_CXX_FLAGS	0x70000022
6775796c8dcSSimon Schubert 
6785796c8dcSSimon Schubert /* Pixie information (???).  */
6795796c8dcSSimon Schubert #define DT_MIPS_PIXIE_INIT	0x70000023
6805796c8dcSSimon Schubert 
6815796c8dcSSimon Schubert /* Address of .MIPS.symlib */
6825796c8dcSSimon Schubert #define DT_MIPS_SYMBOL_LIB	0x70000024
6835796c8dcSSimon Schubert 
6845796c8dcSSimon Schubert /* The GOT index of the first PTE for a segment */
6855796c8dcSSimon Schubert #define DT_MIPS_LOCALPAGE_GOTIDX	0x70000025
6865796c8dcSSimon Schubert 
6875796c8dcSSimon Schubert /* The GOT index of the first PTE for a local symbol */
6885796c8dcSSimon Schubert #define DT_MIPS_LOCAL_GOTIDX	0x70000026
6895796c8dcSSimon Schubert 
6905796c8dcSSimon Schubert /* The GOT index of the first PTE for a hidden symbol */
6915796c8dcSSimon Schubert #define DT_MIPS_HIDDEN_GOTIDX	0x70000027
6925796c8dcSSimon Schubert 
6935796c8dcSSimon Schubert /* The GOT index of the first PTE for a protected symbol */
6945796c8dcSSimon Schubert #define DT_MIPS_PROTECTED_GOTIDX	0x70000028
6955796c8dcSSimon Schubert 
6965796c8dcSSimon Schubert /* Address of `.MIPS.options'.  */
6975796c8dcSSimon Schubert #define DT_MIPS_OPTIONS		0x70000029
6985796c8dcSSimon Schubert 
6995796c8dcSSimon Schubert /* Address of `.interface'.  */
7005796c8dcSSimon Schubert #define DT_MIPS_INTERFACE	0x7000002a
7015796c8dcSSimon Schubert 
7025796c8dcSSimon Schubert /* ??? */
7035796c8dcSSimon Schubert #define DT_MIPS_DYNSTR_ALIGN	0x7000002b
7045796c8dcSSimon Schubert 
7055796c8dcSSimon Schubert /* Size of the .interface section.  */
7065796c8dcSSimon Schubert #define DT_MIPS_INTERFACE_SIZE	0x7000002c
7075796c8dcSSimon Schubert 
7085796c8dcSSimon Schubert /* Size of rld_text_resolve function stored in the GOT.  */
7095796c8dcSSimon Schubert #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR	0x7000002d
7105796c8dcSSimon Schubert 
7115796c8dcSSimon Schubert /* Default suffix of DSO to be added by rld on dlopen() calls.  */
7125796c8dcSSimon Schubert #define DT_MIPS_PERF_SUFFIX	0x7000002e
7135796c8dcSSimon Schubert 
7145796c8dcSSimon Schubert /* Size of compact relocation section (O32).  */
7155796c8dcSSimon Schubert #define DT_MIPS_COMPACT_SIZE	0x7000002f
7165796c8dcSSimon Schubert 
7175796c8dcSSimon Schubert /* GP value for auxiliary GOTs.  */
7185796c8dcSSimon Schubert #define DT_MIPS_GP_VALUE	0x70000030
7195796c8dcSSimon Schubert 
7205796c8dcSSimon Schubert /* Address of auxiliary .dynamic.  */
7215796c8dcSSimon Schubert #define DT_MIPS_AUX_DYNAMIC	0x70000031
7225796c8dcSSimon Schubert 
7235796c8dcSSimon Schubert /* Address of the base of the PLTGOT.  */
7245796c8dcSSimon Schubert #define DT_MIPS_PLTGOT         0x70000032
7255796c8dcSSimon Schubert 
7265796c8dcSSimon Schubert /* Points to the base of a writable PLT.  */
7275796c8dcSSimon Schubert #define DT_MIPS_RWPLT          0x70000034
7285796c8dcSSimon Schubert 
7295796c8dcSSimon Schubert /* Flags which may appear in a DT_MIPS_FLAGS entry.  */
7305796c8dcSSimon Schubert 
7315796c8dcSSimon Schubert /* No flags.  */
7325796c8dcSSimon Schubert #define RHF_NONE		0x00000000
7335796c8dcSSimon Schubert 
7345796c8dcSSimon Schubert /* Uses shortcut pointers.  */
7355796c8dcSSimon Schubert #define RHF_QUICKSTART		0x00000001
7365796c8dcSSimon Schubert 
7375796c8dcSSimon Schubert /* Hash size is not a power of two.  */
7385796c8dcSSimon Schubert #define RHF_NOTPOT		0x00000002
7395796c8dcSSimon Schubert 
7405796c8dcSSimon Schubert /* Ignore LD_LIBRARY_PATH.  */
7415796c8dcSSimon Schubert #define RHS_NO_LIBRARY_REPLACEMENT 0x00000004
7425796c8dcSSimon Schubert 
7435796c8dcSSimon Schubert /* DSO address may not be relocated. */
7445796c8dcSSimon Schubert #define RHF_NO_MOVE		0x00000008
7455796c8dcSSimon Schubert 
7465796c8dcSSimon Schubert /* SGI specific features. */
7475796c8dcSSimon Schubert #define RHF_SGI_ONLY		0x00000010
7485796c8dcSSimon Schubert 
7495796c8dcSSimon Schubert /* Guarantee that .init will finish executing before any non-init
7505796c8dcSSimon Schubert    code in DSO is called. */
7515796c8dcSSimon Schubert #define RHF_GUARANTEE_INIT	   0x00000020
7525796c8dcSSimon Schubert 
7535796c8dcSSimon Schubert /* Contains Delta C++ code. */
7545796c8dcSSimon Schubert #define RHF_DELTA_C_PLUS_PLUS	   0x00000040
7555796c8dcSSimon Schubert 
7565796c8dcSSimon Schubert /* Guarantee that .init will start executing before any non-init
7575796c8dcSSimon Schubert    code in DSO is called. */
7585796c8dcSSimon Schubert #define RHF_GUARANTEE_START_INIT   0x00000080
7595796c8dcSSimon Schubert 
7605796c8dcSSimon Schubert /* Generated by pixie. */
7615796c8dcSSimon Schubert #define RHF_PIXIE		   0x00000100
7625796c8dcSSimon Schubert 
7635796c8dcSSimon Schubert /* Delay-load DSO by default. */
7645796c8dcSSimon Schubert #define RHF_DEFAULT_DELAY_LOAD	   0x00000200
7655796c8dcSSimon Schubert 
7665796c8dcSSimon Schubert /* Object may be requickstarted */
7675796c8dcSSimon Schubert #define RHF_REQUICKSTART	   0x00000400
7685796c8dcSSimon Schubert 
7695796c8dcSSimon Schubert /* Object has been requickstarted */
7705796c8dcSSimon Schubert #define RHF_REQUICKSTARTED	   0x00000800
7715796c8dcSSimon Schubert 
7725796c8dcSSimon Schubert /* Generated by cord. */
7735796c8dcSSimon Schubert #define RHF_CORD		   0x00001000
7745796c8dcSSimon Schubert 
7755796c8dcSSimon Schubert /* Object contains no unresolved undef symbols. */
7765796c8dcSSimon Schubert #define RHF_NO_UNRES_UNDEF	   0x00002000
7775796c8dcSSimon Schubert 
7785796c8dcSSimon Schubert /* Symbol table is in a safe order. */
7795796c8dcSSimon Schubert #define RHF_RLD_ORDER_SAFE	   0x00004000
7805796c8dcSSimon Schubert 
7815796c8dcSSimon Schubert /* Special values for the st_other field in the symbol table.  These
7825796c8dcSSimon Schubert    are used in an Irix 5 dynamic symbol table.  */
7835796c8dcSSimon Schubert 
7845796c8dcSSimon Schubert #define STO_DEFAULT		STV_DEFAULT
7855796c8dcSSimon Schubert #define STO_INTERNAL		STV_INTERNAL
7865796c8dcSSimon Schubert #define STO_HIDDEN		STV_HIDDEN
7875796c8dcSSimon Schubert #define STO_PROTECTED		STV_PROTECTED
7885796c8dcSSimon Schubert 
789a45ae5f8SJohn Marino /* Two topmost bits denote the MIPS ISA for .text symbols:
790a45ae5f8SJohn Marino    + 00 -- standard MIPS code,
791a45ae5f8SJohn Marino    + 10 -- microMIPS code,
792a45ae5f8SJohn Marino    + 11 -- MIPS16 code; requires the following two bits to be set too.
793a45ae5f8SJohn Marino    Note that one of the MIPS16 bits overlaps with STO_MIPS_PIC.  See below
794a45ae5f8SJohn Marino    for details.  */
795a45ae5f8SJohn Marino #define STO_MIPS_ISA		(3 << 6)
796a45ae5f8SJohn Marino 
797a45ae5f8SJohn Marino /* The mask spanning the rest of MIPS psABI flags.  At most one is expected
798a45ae5f8SJohn Marino    to be set except for STO_MIPS16.  */
799a45ae5f8SJohn Marino #define STO_MIPS_FLAGS		(~(STO_MIPS_ISA | ELF_ST_VISIBILITY (-1)))
800a45ae5f8SJohn Marino 
8015796c8dcSSimon Schubert /* The MIPS psABI was updated in 2008 with support for PLTs and copy
8025796c8dcSSimon Schubert    relocs.  There are therefore two types of nonzero SHN_UNDEF functions:
8035796c8dcSSimon Schubert    PLT entries and traditional MIPS lazy binding stubs.  We mark the former
8045796c8dcSSimon Schubert    with STO_MIPS_PLT to distinguish them from the latter.  */
8055796c8dcSSimon Schubert #define STO_MIPS_PLT		0x8
806a45ae5f8SJohn Marino #define ELF_ST_IS_MIPS_PLT(other) (((other) & STO_MIPS_FLAGS) == STO_MIPS_PLT)
807a45ae5f8SJohn Marino #define ELF_ST_SET_MIPS_PLT(other) (((other) & ~STO_MIPS_FLAGS) | STO_MIPS_PLT)
8085796c8dcSSimon Schubert 
8095796c8dcSSimon Schubert /* This value is used to mark PIC functions in an object that mixes
810a45ae5f8SJohn Marino    PIC and non-PIC.  Note that this bit overlaps with STO_MIPS16,
811a45ae5f8SJohn Marino    although MIPS16 symbols are never considered to be MIPS_PIC.  */
8125796c8dcSSimon Schubert #define STO_MIPS_PIC		0x20
813a45ae5f8SJohn Marino #define ELF_ST_IS_MIPS_PIC(other) (((other) & STO_MIPS_FLAGS) == STO_MIPS_PIC)
814a45ae5f8SJohn Marino #define ELF_ST_SET_MIPS_PIC(other) (((other) & ~STO_MIPS_FLAGS) | STO_MIPS_PIC)
8155796c8dcSSimon Schubert 
8165796c8dcSSimon Schubert /* This value is used for a mips16 .text symbol.  */
8175796c8dcSSimon Schubert #define STO_MIPS16		0xf0
818a45ae5f8SJohn Marino #define ELF_ST_IS_MIPS16(other) (((other) & STO_MIPS16) == STO_MIPS16)
819a45ae5f8SJohn Marino #define ELF_ST_SET_MIPS16(other) ((other) | STO_MIPS16)
820a45ae5f8SJohn Marino 
821a45ae5f8SJohn Marino /* This value is used for a microMIPS .text symbol.  To distinguish from
822a45ae5f8SJohn Marino    STO_MIPS16, we set top two bits to be 10 to denote STO_MICROMIPS.  The
823a45ae5f8SJohn Marino    mask is STO_MIPS_ISA.  */
824a45ae5f8SJohn Marino #define STO_MICROMIPS		(2 << 6)
825a45ae5f8SJohn Marino #define ELF_ST_IS_MICROMIPS(other) (((other) & STO_MIPS_ISA) == STO_MICROMIPS)
826a45ae5f8SJohn Marino #define ELF_ST_SET_MICROMIPS(other) (((other) & ~STO_MIPS_ISA) | STO_MICROMIPS)
827a45ae5f8SJohn Marino 
828a45ae5f8SJohn Marino /* Whether code compression (either of the MIPS16 or the microMIPS ASEs)
829a45ae5f8SJohn Marino    has been indicated for a .text symbol.  */
830a45ae5f8SJohn Marino #define ELF_ST_IS_COMPRESSED(other) \
831a45ae5f8SJohn Marino   (ELF_ST_IS_MIPS16 (other) || ELF_ST_IS_MICROMIPS (other))
8325796c8dcSSimon Schubert 
8335796c8dcSSimon Schubert /* This bit is used on Irix to indicate a symbol whose definition
8345796c8dcSSimon Schubert    is optional - if, at final link time, it cannot be found, no
8355796c8dcSSimon Schubert    error message should be produced.  */
8365796c8dcSSimon Schubert #define STO_OPTIONAL		(1 << 2)
8375796c8dcSSimon Schubert /* A macro to examine the STO_OPTIONAL bit.  */
8385796c8dcSSimon Schubert #define ELF_MIPS_IS_OPTIONAL(other)	((other) & STO_OPTIONAL)
8395796c8dcSSimon Schubert 
8405796c8dcSSimon Schubert /* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
8415796c8dcSSimon Schubert    relocation entry specifies up to three actual relocations, all at
8425796c8dcSSimon Schubert    the same address.  The first relocation which required a symbol
8435796c8dcSSimon Schubert    uses the symbol in the r_sym field.  The second relocation which
8445796c8dcSSimon Schubert    requires a symbol uses the symbol in the r_ssym field.  If all
8455796c8dcSSimon Schubert    three relocations require a symbol, the third one uses a zero
8465796c8dcSSimon Schubert    value.  */
8475796c8dcSSimon Schubert 
8485796c8dcSSimon Schubert /* An entry in a 64 bit SHT_REL section.  */
8495796c8dcSSimon Schubert 
8505796c8dcSSimon Schubert typedef struct
8515796c8dcSSimon Schubert {
8525796c8dcSSimon Schubert   /* Address of relocation.  */
8535796c8dcSSimon Schubert   unsigned char r_offset[8];
8545796c8dcSSimon Schubert   /* Symbol index.  */
8555796c8dcSSimon Schubert   unsigned char r_sym[4];
8565796c8dcSSimon Schubert   /* Special symbol.  */
8575796c8dcSSimon Schubert   unsigned char r_ssym[1];
8585796c8dcSSimon Schubert   /* Third relocation.  */
8595796c8dcSSimon Schubert   unsigned char r_type3[1];
8605796c8dcSSimon Schubert   /* Second relocation.  */
8615796c8dcSSimon Schubert   unsigned char r_type2[1];
8625796c8dcSSimon Schubert   /* First relocation.  */
8635796c8dcSSimon Schubert   unsigned char r_type[1];
8645796c8dcSSimon Schubert } Elf64_Mips_External_Rel;
8655796c8dcSSimon Schubert 
8665796c8dcSSimon Schubert typedef struct
8675796c8dcSSimon Schubert {
8685796c8dcSSimon Schubert   /* Address of relocation.  */
8695796c8dcSSimon Schubert   bfd_vma r_offset;
8705796c8dcSSimon Schubert   /* Symbol index.  */
8715796c8dcSSimon Schubert   unsigned long r_sym;
8725796c8dcSSimon Schubert   /* Special symbol.  */
8735796c8dcSSimon Schubert   unsigned char r_ssym;
8745796c8dcSSimon Schubert   /* Third relocation.  */
8755796c8dcSSimon Schubert   unsigned char r_type3;
8765796c8dcSSimon Schubert   /* Second relocation.  */
8775796c8dcSSimon Schubert   unsigned char r_type2;
8785796c8dcSSimon Schubert   /* First relocation.  */
8795796c8dcSSimon Schubert   unsigned char r_type;
8805796c8dcSSimon Schubert } Elf64_Mips_Internal_Rel;
8815796c8dcSSimon Schubert 
8825796c8dcSSimon Schubert /* An entry in a 64 bit SHT_RELA section.  */
8835796c8dcSSimon Schubert 
8845796c8dcSSimon Schubert typedef struct
8855796c8dcSSimon Schubert {
8865796c8dcSSimon Schubert   /* Address of relocation.  */
8875796c8dcSSimon Schubert   unsigned char r_offset[8];
8885796c8dcSSimon Schubert   /* Symbol index.  */
8895796c8dcSSimon Schubert   unsigned char r_sym[4];
8905796c8dcSSimon Schubert   /* Special symbol.  */
8915796c8dcSSimon Schubert   unsigned char r_ssym[1];
8925796c8dcSSimon Schubert   /* Third relocation.  */
8935796c8dcSSimon Schubert   unsigned char r_type3[1];
8945796c8dcSSimon Schubert   /* Second relocation.  */
8955796c8dcSSimon Schubert   unsigned char r_type2[1];
8965796c8dcSSimon Schubert   /* First relocation.  */
8975796c8dcSSimon Schubert   unsigned char r_type[1];
8985796c8dcSSimon Schubert   /* Addend.  */
8995796c8dcSSimon Schubert   unsigned char r_addend[8];
9005796c8dcSSimon Schubert } Elf64_Mips_External_Rela;
9015796c8dcSSimon Schubert 
9025796c8dcSSimon Schubert typedef struct
9035796c8dcSSimon Schubert {
9045796c8dcSSimon Schubert   /* Address of relocation.  */
9055796c8dcSSimon Schubert   bfd_vma r_offset;
9065796c8dcSSimon Schubert   /* Symbol index.  */
9075796c8dcSSimon Schubert   unsigned long r_sym;
9085796c8dcSSimon Schubert   /* Special symbol.  */
9095796c8dcSSimon Schubert   unsigned char r_ssym;
9105796c8dcSSimon Schubert   /* Third relocation.  */
9115796c8dcSSimon Schubert   unsigned char r_type3;
9125796c8dcSSimon Schubert   /* Second relocation.  */
9135796c8dcSSimon Schubert   unsigned char r_type2;
9145796c8dcSSimon Schubert   /* First relocation.  */
9155796c8dcSSimon Schubert   unsigned char r_type;
9165796c8dcSSimon Schubert   /* Addend.  */
9175796c8dcSSimon Schubert   bfd_signed_vma r_addend;
9185796c8dcSSimon Schubert } Elf64_Mips_Internal_Rela;
9195796c8dcSSimon Schubert 
9205796c8dcSSimon Schubert /* MIPS ELF 64 relocation info access macros.  */
9215796c8dcSSimon Schubert #define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
9225796c8dcSSimon Schubert #define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
9235796c8dcSSimon Schubert #define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
9245796c8dcSSimon Schubert #define ELF64_MIPS_R_TYPE(i) ((i) & 0xff)
9255796c8dcSSimon Schubert 
9265796c8dcSSimon Schubert /* Values found in the r_ssym field of a relocation entry.  */
9275796c8dcSSimon Schubert 
9285796c8dcSSimon Schubert /* No relocation.  */
9295796c8dcSSimon Schubert #define RSS_UNDEF	0
9305796c8dcSSimon Schubert 
9315796c8dcSSimon Schubert /* Value of GP.  */
9325796c8dcSSimon Schubert #define RSS_GP		1
9335796c8dcSSimon Schubert 
9345796c8dcSSimon Schubert /* Value of GP in object being relocated.  */
9355796c8dcSSimon Schubert #define RSS_GP0		2
9365796c8dcSSimon Schubert 
9375796c8dcSSimon Schubert /* Address of location being relocated.  */
9385796c8dcSSimon Schubert #define RSS_LOC		3
9395796c8dcSSimon Schubert 
9405796c8dcSSimon Schubert /* A SHT_MIPS_OPTIONS section contains a series of options, each of
9415796c8dcSSimon Schubert    which starts with this header.  */
9425796c8dcSSimon Schubert 
9435796c8dcSSimon Schubert typedef struct
9445796c8dcSSimon Schubert {
9455796c8dcSSimon Schubert   /* Type of option.  */
9465796c8dcSSimon Schubert   unsigned char kind[1];
9475796c8dcSSimon Schubert   /* Size of option descriptor, including header.  */
9485796c8dcSSimon Schubert   unsigned char size[1];
9495796c8dcSSimon Schubert   /* Section index of affected section, or 0 for global option.  */
9505796c8dcSSimon Schubert   unsigned char section[2];
9515796c8dcSSimon Schubert   /* Information specific to this kind of option.  */
9525796c8dcSSimon Schubert   unsigned char info[4];
9535796c8dcSSimon Schubert } Elf_External_Options;
9545796c8dcSSimon Schubert 
9555796c8dcSSimon Schubert typedef struct
9565796c8dcSSimon Schubert {
9575796c8dcSSimon Schubert   /* Type of option.  */
9585796c8dcSSimon Schubert   unsigned char kind;
9595796c8dcSSimon Schubert   /* Size of option descriptor, including header.  */
9605796c8dcSSimon Schubert   unsigned char size;
9615796c8dcSSimon Schubert   /* Section index of affected section, or 0 for global option.  */
9625796c8dcSSimon Schubert   unsigned short section;
9635796c8dcSSimon Schubert   /* Information specific to this kind of option.  */
9645796c8dcSSimon Schubert   unsigned long info;
9655796c8dcSSimon Schubert } Elf_Internal_Options;
9665796c8dcSSimon Schubert 
9675796c8dcSSimon Schubert /* MIPS ELF option header swapping routines.  */
9685796c8dcSSimon Schubert extern void bfd_mips_elf_swap_options_in
9695796c8dcSSimon Schubert   (bfd *, const Elf_External_Options *, Elf_Internal_Options *);
9705796c8dcSSimon Schubert extern void bfd_mips_elf_swap_options_out
9715796c8dcSSimon Schubert   (bfd *, const Elf_Internal_Options *, Elf_External_Options *);
9725796c8dcSSimon Schubert 
9735796c8dcSSimon Schubert /* Values which may appear in the kind field of an Elf_Options
9745796c8dcSSimon Schubert    structure.  */
9755796c8dcSSimon Schubert 
9765796c8dcSSimon Schubert /* Undefined.  */
9775796c8dcSSimon Schubert #define ODK_NULL	0
9785796c8dcSSimon Schubert 
9795796c8dcSSimon Schubert /* Register usage and GP value.  */
9805796c8dcSSimon Schubert #define ODK_REGINFO	1
9815796c8dcSSimon Schubert 
9825796c8dcSSimon Schubert /* Exception processing information.  */
9835796c8dcSSimon Schubert #define ODK_EXCEPTIONS	2
9845796c8dcSSimon Schubert 
9855796c8dcSSimon Schubert /* Section padding information.  */
9865796c8dcSSimon Schubert #define ODK_PAD		3
9875796c8dcSSimon Schubert 
9885796c8dcSSimon Schubert /* Hardware workarounds performed.  */
9895796c8dcSSimon Schubert #define ODK_HWPATCH	4
9905796c8dcSSimon Schubert 
9915796c8dcSSimon Schubert /* Fill value used by the linker.  */
9925796c8dcSSimon Schubert #define ODK_FILL	5
9935796c8dcSSimon Schubert 
9945796c8dcSSimon Schubert /* Reserved space for desktop tools.  */
9955796c8dcSSimon Schubert #define ODK_TAGS	6
9965796c8dcSSimon Schubert 
9975796c8dcSSimon Schubert /* Hardware workarounds, AND bits when merging.  */
9985796c8dcSSimon Schubert #define ODK_HWAND	7
9995796c8dcSSimon Schubert 
10005796c8dcSSimon Schubert /* Hardware workarounds, OR bits when merging.  */
10015796c8dcSSimon Schubert #define ODK_HWOR	8
10025796c8dcSSimon Schubert 
10035796c8dcSSimon Schubert /* GP group to use for text/data sections.  */
10045796c8dcSSimon Schubert #define ODK_GP_GROUP	9
10055796c8dcSSimon Schubert 
10065796c8dcSSimon Schubert /* ID information.  */
10075796c8dcSSimon Schubert #define ODK_IDENT	10
10085796c8dcSSimon Schubert 
10095796c8dcSSimon Schubert /* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_RegInfo
10105796c8dcSSimon Schubert    structure.  In the 64 bit ABI, it is the following structure.  The
10115796c8dcSSimon Schubert    info field of the options header is not used.  */
10125796c8dcSSimon Schubert 
10135796c8dcSSimon Schubert typedef struct
10145796c8dcSSimon Schubert {
10155796c8dcSSimon Schubert   /* Mask of general purpose registers used.  */
10165796c8dcSSimon Schubert   unsigned char ri_gprmask[4];
10175796c8dcSSimon Schubert   /* Padding.  */
10185796c8dcSSimon Schubert   unsigned char ri_pad[4];
10195796c8dcSSimon Schubert   /* Mask of co-processor registers used.  */
10205796c8dcSSimon Schubert   unsigned char ri_cprmask[4][4];
10215796c8dcSSimon Schubert   /* GP register value for this object file.  */
10225796c8dcSSimon Schubert   unsigned char ri_gp_value[8];
10235796c8dcSSimon Schubert } Elf64_External_RegInfo;
10245796c8dcSSimon Schubert 
10255796c8dcSSimon Schubert typedef struct
10265796c8dcSSimon Schubert {
10275796c8dcSSimon Schubert   /* Mask of general purpose registers used.  */
10285796c8dcSSimon Schubert   unsigned long ri_gprmask;
10295796c8dcSSimon Schubert   /* Padding.  */
10305796c8dcSSimon Schubert   unsigned long ri_pad;
10315796c8dcSSimon Schubert   /* Mask of co-processor registers used.  */
10325796c8dcSSimon Schubert   unsigned long ri_cprmask[4];
10335796c8dcSSimon Schubert   /* GP register value for this object file.  */
10345796c8dcSSimon Schubert   bfd_vma ri_gp_value;
10355796c8dcSSimon Schubert } Elf64_Internal_RegInfo;
10365796c8dcSSimon Schubert 
10375796c8dcSSimon Schubert typedef struct
10385796c8dcSSimon Schubert {
10395796c8dcSSimon Schubert   /* The hash value computed from the name of the corresponding
10405796c8dcSSimon Schubert      dynamic symbol.  */
10415796c8dcSSimon Schubert   unsigned char ms_hash_value[4];
10425796c8dcSSimon Schubert   /* Contains both the dynamic relocation index and the symbol flags
10435796c8dcSSimon Schubert      field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
10445796c8dcSSimon Schubert      to access the individual values.  The dynamic relocation index
10455796c8dcSSimon Schubert      identifies the first entry in the .rel.dyn section that
10465796c8dcSSimon Schubert      references the dynamic symbol corresponding to this msym entry.
10475796c8dcSSimon Schubert      If the index is 0, no dynamic relocations are associated with the
10485796c8dcSSimon Schubert      symbol.  The symbol flags field is reserved for future use.  */
10495796c8dcSSimon Schubert   unsigned char ms_info[4];
10505796c8dcSSimon Schubert } Elf32_External_Msym;
10515796c8dcSSimon Schubert 
10525796c8dcSSimon Schubert typedef struct
10535796c8dcSSimon Schubert {
10545796c8dcSSimon Schubert   /* The hash value computed from the name of the corresponding
10555796c8dcSSimon Schubert      dynamic symbol.  */
10565796c8dcSSimon Schubert   unsigned long ms_hash_value;
10575796c8dcSSimon Schubert   /* Contains both the dynamic relocation index and the symbol flags
10585796c8dcSSimon Schubert      field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
10595796c8dcSSimon Schubert      to access the individual values.  The dynamic relocation index
10605796c8dcSSimon Schubert      identifies the first entry in the .rel.dyn section that
10615796c8dcSSimon Schubert      references the dynamic symbol corresponding to this msym entry.
10625796c8dcSSimon Schubert      If the index is 0, no dynamic relocations are associated with the
10635796c8dcSSimon Schubert      symbol.  The symbol flags field is reserved for future use.  */
10645796c8dcSSimon Schubert   unsigned long ms_info;
10655796c8dcSSimon Schubert } Elf32_Internal_Msym;
10665796c8dcSSimon Schubert 
10675796c8dcSSimon Schubert #define ELF32_MS_REL_INDEX(i) ((i) >> 8)
10685796c8dcSSimon Schubert #define ELF32_MS_FLAGS(i)     (i) & 0xff)
10695796c8dcSSimon Schubert #define ELF32_MS_INFO(r, f)   (((r) << 8) + ((f) & 0xff))
10705796c8dcSSimon Schubert 
10715796c8dcSSimon Schubert /* MIPS ELF reginfo swapping routines.  */
10725796c8dcSSimon Schubert extern void bfd_mips_elf64_swap_reginfo_in
10735796c8dcSSimon Schubert   (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
10745796c8dcSSimon Schubert extern void bfd_mips_elf64_swap_reginfo_out
10755796c8dcSSimon Schubert   (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
10765796c8dcSSimon Schubert 
10775796c8dcSSimon Schubert /* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
10785796c8dcSSimon Schubert #define OEX_FPU_MIN	0x1f	/* FPEs which must be enabled.  */
10795796c8dcSSimon Schubert #define OEX_FPU_MAX	0x1f00	/* FPEs which may be enabled.  */
10805796c8dcSSimon Schubert #define OEX_PAGE0	0x10000	/* Page zero must be mapped.  */
10815796c8dcSSimon Schubert #define OEX_SMM		0x20000	/* Force sequential memory mode.  */
10825796c8dcSSimon Schubert #define OEX_FPDBUG	0x40000	/* Force precise floating-point
10835796c8dcSSimon Schubert 				   exceptions (debug mode).  */
10845796c8dcSSimon Schubert #define OEX_DISMISS	0x80000	/* Dismiss invalid address faults.  */
10855796c8dcSSimon Schubert 
10865796c8dcSSimon Schubert /* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX.  */
10875796c8dcSSimon Schubert #define OEX_FPU_INVAL	0x10	/* Invalid operation exception.  */
10885796c8dcSSimon Schubert #define OEX_FPU_DIV0	0x08	/* Division by zero exception.  */
10895796c8dcSSimon Schubert #define OEX_FPU_OFLO	0x04	/* Overflow exception.  */
10905796c8dcSSimon Schubert #define OEX_FPU_UFLO	0x02	/* Underflow exception.  */
10915796c8dcSSimon Schubert #define OEX_FPU_INEX	0x01	/* Inexact exception.  */
10925796c8dcSSimon Schubert 
10935796c8dcSSimon Schubert /* Masks for the info word of an ODK_PAD descriptor.  */
10945796c8dcSSimon Schubert #define OPAD_PREFIX	0x01
10955796c8dcSSimon Schubert #define OPAD_POSTFIX	0x02
10965796c8dcSSimon Schubert #define OPAD_SYMBOL	0x04
10975796c8dcSSimon Schubert 
10985796c8dcSSimon Schubert /* Masks for the info word of an ODK_HWPATCH descriptor.  */
10995796c8dcSSimon Schubert #define OHW_R4KEOP	0x00000001	/* R4000 end-of-page patch.  */
11005796c8dcSSimon Schubert #define OHW_R8KPFETCH	0x00000002	/* May need R8000 prefetch patch.  */
11015796c8dcSSimon Schubert #define OHW_R5KEOP	0x00000004	/* R5000 end-of-page patch.  */
11025796c8dcSSimon Schubert #define OHW_R5KCVTL	0x00000008	/* R5000 cvt.[ds].l bug
11035796c8dcSSimon Schubert 					   (clean == 1).  */
11045796c8dcSSimon Schubert #define OHW_R10KLDL	0x00000010	/* Needs R10K misaligned
11055796c8dcSSimon Schubert 					   load patch. */
11065796c8dcSSimon Schubert 
11075796c8dcSSimon Schubert /* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor.  */
11085796c8dcSSimon Schubert #define OGP_GROUP	0x0000ffff	/* GP group number.  */
11095796c8dcSSimon Schubert #define OGP_SELF	0xffff0000	/* Self-contained GP groups.  */
11105796c8dcSSimon Schubert 
11115796c8dcSSimon Schubert /* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
11125796c8dcSSimon Schubert #define OHWA0_R4KEOP_CHECKED	0x00000001
11135796c8dcSSimon Schubert #define OHWA0_R4KEOP_CLEAN	0x00000002
11145796c8dcSSimon Schubert 
11155796c8dcSSimon Schubert 
11165796c8dcSSimon Schubert /* Object attribute tags.  */
11175796c8dcSSimon Schubert enum
11185796c8dcSSimon Schubert {
11195796c8dcSSimon Schubert   /* 0-3 are generic.  */
11205796c8dcSSimon Schubert   Tag_GNU_MIPS_ABI_FP = 4, /* Value 1 for hard-float -mdouble-float, 2
11215796c8dcSSimon Schubert 			      for hard-float -msingle-float, 3 for
11225796c8dcSSimon Schubert 			      soft-float, 4 for -mips32r2 -mfp64; 0 for
11235796c8dcSSimon Schubert 			      not tagged or not using any ABIs affected
11245796c8dcSSimon Schubert 			      by the differences.  */
11255796c8dcSSimon Schubert };
11265796c8dcSSimon Schubert 
11275796c8dcSSimon Schubert #endif /* _ELF_MIPS_H */
1128