144348Simp/* MIPS ELF support for BFD.
2208737Sjmallett   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3208737Sjmallett   2003, 2004, 2005
477298Sobrien   Free Software Foundation, Inc.
544348Simp
644348Simp   By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
744348Simp   information in the System V Application Binary Interface, MIPS
844348Simp   Processor Supplement.
944348Simp
1044348SimpThis file is part of BFD, the Binary File Descriptor library.
1144348Simp
1244348SimpThis program is free software; you can redistribute it and/or modify
1344348Simpit under the terms of the GNU General Public License as published by
1444348Simpthe Free Software Foundation; either version 2 of the License, or
1544348Simp(at your option) any later version.
1644348Simp
1744348SimpThis program is distributed in the hope that it will be useful,
1844348Simpbut WITHOUT ANY WARRANTY; without even the implied warranty of
1944348SimpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2044348SimpGNU General Public License for more details.
2144348Simp
2244348SimpYou should have received a copy of the GNU General Public License
2344348Simpalong with this program; if not, write to the Free Software
24208737SjmallettFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2544348Simp
2644348Simp/* This file holds definitions specific to the MIPS ELF ABI.  Note
2744348Simp   that most of this is not actually implemented by BFD.  */
2844348Simp
2944348Simp#ifndef _ELF_MIPS_H
3044348Simp#define _ELF_MIPS_H
3144348Simp
3260484Sobrien#include "elf/reloc-macros.h"
3360484Sobrien
3460484Sobrien/* Relocation types.  */
3560484SobrienSTART_RELOC_NUMBERS (elf_mips_reloc_type)
3660484Sobrien  RELOC_NUMBER (R_MIPS_NONE, 0)
3760484Sobrien  RELOC_NUMBER (R_MIPS_16, 1)
3878828Sobrien  RELOC_NUMBER (R_MIPS_32, 2)		/* In Elf 64: alias R_MIPS_ADD */
3978828Sobrien  RELOC_NUMBER (R_MIPS_REL32, 3)	/* In Elf 64: alias R_MIPS_REL */
4060484Sobrien  RELOC_NUMBER (R_MIPS_26, 4)
4160484Sobrien  RELOC_NUMBER (R_MIPS_HI16, 5)
4260484Sobrien  RELOC_NUMBER (R_MIPS_LO16, 6)
4378828Sobrien  RELOC_NUMBER (R_MIPS_GPREL16, 7)	/* In Elf 64: alias R_MIPS_GPREL */
4460484Sobrien  RELOC_NUMBER (R_MIPS_LITERAL, 8)
4578828Sobrien  RELOC_NUMBER (R_MIPS_GOT16, 9)	/* In Elf 64: alias R_MIPS_GOT */
4660484Sobrien  RELOC_NUMBER (R_MIPS_PC16, 10)
4778828Sobrien  RELOC_NUMBER (R_MIPS_CALL16, 11)	/* In Elf 64: alias R_MIPS_CALL */
4860484Sobrien  RELOC_NUMBER (R_MIPS_GPREL32, 12)
4960484Sobrien  /* The remaining relocs are defined on Irix, although they are not
5060484Sobrien     in the MIPS ELF ABI.  */
5160484Sobrien  RELOC_NUMBER (R_MIPS_UNUSED1, 13)
5260484Sobrien  RELOC_NUMBER (R_MIPS_UNUSED2, 14)
5360484Sobrien  RELOC_NUMBER (R_MIPS_UNUSED3, 15)
5460484Sobrien  RELOC_NUMBER (R_MIPS_SHIFT5, 16)
5560484Sobrien  RELOC_NUMBER (R_MIPS_SHIFT6, 17)
5660484Sobrien  RELOC_NUMBER (R_MIPS_64, 18)
5760484Sobrien  RELOC_NUMBER (R_MIPS_GOT_DISP, 19)
5860484Sobrien  RELOC_NUMBER (R_MIPS_GOT_PAGE, 20)
5960484Sobrien  RELOC_NUMBER (R_MIPS_GOT_OFST, 21)
6060484Sobrien  RELOC_NUMBER (R_MIPS_GOT_HI16, 22)
6160484Sobrien  RELOC_NUMBER (R_MIPS_GOT_LO16, 23)
6260484Sobrien  RELOC_NUMBER (R_MIPS_SUB, 24)
6360484Sobrien  RELOC_NUMBER (R_MIPS_INSERT_A, 25)
6460484Sobrien  RELOC_NUMBER (R_MIPS_INSERT_B, 26)
6560484Sobrien  RELOC_NUMBER (R_MIPS_DELETE, 27)
6660484Sobrien  RELOC_NUMBER (R_MIPS_HIGHER, 28)
6760484Sobrien  RELOC_NUMBER (R_MIPS_HIGHEST, 29)
6860484Sobrien  RELOC_NUMBER (R_MIPS_CALL_HI16, 30)
6960484Sobrien  RELOC_NUMBER (R_MIPS_CALL_LO16, 31)
7060484Sobrien  RELOC_NUMBER (R_MIPS_SCN_DISP, 32)
7160484Sobrien  RELOC_NUMBER (R_MIPS_REL16, 33)
7260484Sobrien  RELOC_NUMBER (R_MIPS_ADD_IMMEDIATE, 34)
7360484Sobrien  RELOC_NUMBER (R_MIPS_PJUMP, 35)
7460484Sobrien  RELOC_NUMBER (R_MIPS_RELGOT, 36)
7560484Sobrien  RELOC_NUMBER (R_MIPS_JALR, 37)
76218822Sdim  /* TLS relocations.  */
77218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPMOD32, 38)
78218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPREL32, 39)
79218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPMOD64, 40)
80218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPREL64, 41)
81218822Sdim  RELOC_NUMBER (R_MIPS_TLS_GD, 42)
82218822Sdim  RELOC_NUMBER (R_MIPS_TLS_LDM, 43)
83218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPREL_HI16, 44)
84218822Sdim  RELOC_NUMBER (R_MIPS_TLS_DTPREL_LO16, 45)
85218822Sdim  RELOC_NUMBER (R_MIPS_TLS_GOTTPREL, 46)
86218822Sdim  RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
87218822Sdim  RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
88218822Sdim  RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
89218822Sdim  RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
90218822Sdim  RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
91218822Sdim  FAKE_RELOC (R_MIPS_max, 52)
9260484Sobrien  /* These relocs are used for the mips16.  */
93218822Sdim  FAKE_RELOC (R_MIPS16_min, 100)
9460484Sobrien  RELOC_NUMBER (R_MIPS16_26, 100)
9560484Sobrien  RELOC_NUMBER (R_MIPS16_GPREL, 101)
96218822Sdim  RELOC_NUMBER (R_MIPS16_GOT16, 102)
97218822Sdim  RELOC_NUMBER (R_MIPS16_CALL16, 103)
98218822Sdim  RELOC_NUMBER (R_MIPS16_HI16, 104)
99218822Sdim  RELOC_NUMBER (R_MIPS16_LO16, 105)
100218822Sdim  FAKE_RELOC (R_MIPS16_max, 106)
101218822Sdim  /* These relocations are specific to VxWorks.  */
102218822Sdim  RELOC_NUMBER (R_MIPS_COPY, 126)
103218822Sdim  RELOC_NUMBER (R_MIPS_JUMP_SLOT, 127)
104218822Sdim  /* This was a GNU extension used by embedded-PIC.  It was co-opted by
105218822Sdim     mips-linux for exception-handling data.  It is no longer used, but
106218822Sdim     should continue to be supported by the linker for backward
107218822Sdim     compatibility.  (GCC stopped using it in May, 2004.)  */
10860484Sobrien  RELOC_NUMBER (R_MIPS_PC32, 248)
109218822Sdim  /* FIXME: this relocation is used internally by gas.  */
11060484Sobrien  RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250)
11160484Sobrien  /* These are GNU extensions to enable C++ vtable garbage collection.  */
11260484Sobrien  RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
11360484Sobrien  RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
11477298SobrienEND_RELOC_NUMBERS (R_MIPS_maxext)
11560484Sobrien
11644348Simp/* Processor specific flags for the ELF header e_flags field.  */
11744348Simp
11844348Simp/* At least one .noreorder directive appears in the source.  */
11944348Simp#define EF_MIPS_NOREORDER	0x00000001
12044348Simp
12144348Simp/* File contains position independent code.  */
12244348Simp#define EF_MIPS_PIC		0x00000002
12344348Simp
12444348Simp/* Code in file uses the standard calling sequence for calling
12544348Simp   position independent code.  */
12644348Simp#define EF_MIPS_CPIC		0x00000004
12744348Simp
128130561Sobrien/* ???  Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a.  */
129130561Sobrien#define EF_MIPS_XGOT		0x00000008
130130561Sobrien
13178828Sobrien/* Code in file uses UCODE (obsolete) */
13278828Sobrien#define EF_MIPS_UCODE		0x00000010
13378828Sobrien
13444348Simp/* Code in file uses new ABI (-n32 on Irix 6).  */
13544348Simp#define EF_MIPS_ABI2		0x00000020
13644348Simp
13778828Sobrien/* Process the .MIPS.options section first by ld */
13878828Sobrien#define EF_MIPS_OPTIONS_FIRST	0x00000080
13978828Sobrien
14078828Sobrien/* Architectural Extensions used by this file */
14178828Sobrien#define EF_MIPS_ARCH_ASE	0x0f000000
14278828Sobrien
14378828Sobrien/* Use MDMX multimedia extensions */
14478828Sobrien#define EF_MIPS_ARCH_ASE_MDMX	0x08000000
14578828Sobrien
14678828Sobrien/* Use MIPS-16 ISA extensions */
14778828Sobrien#define EF_MIPS_ARCH_ASE_M16	0x04000000
14878828Sobrien
14978828Sobrien/* Indicates code compiled for a 64-bit machine in 32-bit mode.
15060484Sobrien   (regs are 32-bits wide.) */
15160484Sobrien#define EF_MIPS_32BITMODE       0x00000100
15260484Sobrien
15344348Simp/* Four bit MIPS architecture field.  */
15444348Simp#define EF_MIPS_ARCH		0xf0000000
15544348Simp
15644348Simp/* -mips1 code.  */
15744348Simp#define E_MIPS_ARCH_1		0x00000000
15844348Simp
15944348Simp/* -mips2 code.  */
16044348Simp#define E_MIPS_ARCH_2		0x10000000
16144348Simp
16244348Simp/* -mips3 code.  */
16344348Simp#define E_MIPS_ARCH_3		0x20000000
16444348Simp
16544348Simp/* -mips4 code.  */
16644348Simp#define E_MIPS_ARCH_4		0x30000000
16760484Sobrien
16877298Sobrien/* -mips5 code.  */
16977298Sobrien#define E_MIPS_ARCH_5           0x40000000
17077298Sobrien
17177298Sobrien/* -mips32 code.  */
17277298Sobrien#define E_MIPS_ARCH_32          0x50000000
17377298Sobrien
17477298Sobrien/* -mips64 code.  */
17577298Sobrien#define E_MIPS_ARCH_64          0x60000000
17677298Sobrien
177130561Sobrien/* -mips32r2 code.  */
178130561Sobrien#define E_MIPS_ARCH_32R2        0x70000000
179130561Sobrien
180130561Sobrien/* -mips64r2 code.  */
181130561Sobrien#define E_MIPS_ARCH_64R2        0x80000000
182130561Sobrien
18360484Sobrien/* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
18460484Sobrien#define EF_MIPS_ABI		0x0000F000
18560484Sobrien
18660484Sobrien/* The original o32 abi. */
18760484Sobrien#define E_MIPS_ABI_O32          0x00001000
18860484Sobrien
18960484Sobrien/* O32 extended to work on 64 bit architectures */
19060484Sobrien#define E_MIPS_ABI_O64          0x00002000
19160484Sobrien
19260484Sobrien/* EABI in 32 bit mode */
19360484Sobrien#define E_MIPS_ABI_EABI32       0x00003000
19460484Sobrien
19560484Sobrien/* EABI in 64 bit mode */
19660484Sobrien#define E_MIPS_ABI_EABI64       0x00004000
19760484Sobrien
19860484Sobrien
19960484Sobrien/* Machine variant if we know it.  This field was invented at Cygnus,
20060484Sobrien   but it is hoped that other vendors will adopt it.  If some standard
20160484Sobrien   is developed, this code should be changed to follow it. */
20260484Sobrien
20360484Sobrien#define EF_MIPS_MACH		0x00FF0000
20460484Sobrien
20560484Sobrien/* Cygnus is choosing values between 80 and 9F;
20660484Sobrien   00 - 7F should be left for a future standard;
20760484Sobrien   the rest are open. */
20860484Sobrien
20960484Sobrien#define E_MIPS_MACH_3900	0x00810000
21060484Sobrien#define E_MIPS_MACH_4010	0x00820000
21160484Sobrien#define E_MIPS_MACH_4100	0x00830000
21260484Sobrien#define E_MIPS_MACH_4650	0x00850000
213130561Sobrien#define E_MIPS_MACH_4120	0x00870000
21460484Sobrien#define E_MIPS_MACH_4111	0x00880000
21577298Sobrien#define E_MIPS_MACH_SB1         0x008a0000
216208737Sjmallett#define E_MIPS_MACH_OCTEON	0x008b0000
217130561Sobrien#define E_MIPS_MACH_5400	0x00910000
218130561Sobrien#define E_MIPS_MACH_5500	0x00980000
219208737Sjmallett#define E_MIPS_MACH_9000	0x00990000
22044348Simp
22144348Simp/* Processor specific section indices.  These sections do not actually
22244348Simp   exist.  Symbols with a st_shndx field corresponding to one of these
22344348Simp   values have a special meaning.  */
22444348Simp
22544348Simp/* Defined and allocated common symbol.  Value is virtual address.  If
22644348Simp   relocated, alignment must be preserved.  */
22744348Simp#define SHN_MIPS_ACOMMON	0xff00
22844348Simp
22944348Simp/* Defined and allocated text symbol.  Value is virtual address.
23044348Simp   Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
23144348Simp#define SHN_MIPS_TEXT		0xff01
23244348Simp
23344348Simp/* Defined and allocated data symbol.  Value is virtual address.
23444348Simp   Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
23544348Simp#define SHN_MIPS_DATA		0xff02
23644348Simp
23744348Simp/* Small common symbol.  */
23844348Simp#define SHN_MIPS_SCOMMON	0xff03
23944348Simp
24044348Simp/* Small undefined symbol.  */
24144348Simp#define SHN_MIPS_SUNDEFINED	0xff04
24244348Simp
24344348Simp/* Processor specific section types.  */
24444348Simp
24544348Simp/* Section contains the set of dynamic shared objects used when
24644348Simp   statically linking.  */
24744348Simp#define SHT_MIPS_LIBLIST	0x70000000
24844348Simp
24944348Simp/* I'm not sure what this is, but it's used on Irix 5.  */
25044348Simp#define SHT_MIPS_MSYM		0x70000001
25144348Simp
25244348Simp/* Section contains list of symbols whose definitions conflict with
25344348Simp   symbols defined in shared objects.  */
25444348Simp#define SHT_MIPS_CONFLICT	0x70000002
25544348Simp
25644348Simp/* Section contains the global pointer table.  */
25744348Simp#define SHT_MIPS_GPTAB		0x70000003
25844348Simp
25944348Simp/* Section contains microcode information.  The exact format is
26044348Simp   unspecified.  */
26144348Simp#define SHT_MIPS_UCODE		0x70000004
26244348Simp
26344348Simp/* Section contains some sort of debugging information.  The exact
26444348Simp   format is unspecified.  It's probably ECOFF symbols.  */
26544348Simp#define SHT_MIPS_DEBUG		0x70000005
26644348Simp
26744348Simp/* Section contains register usage information.  */
26844348Simp#define SHT_MIPS_REGINFO	0x70000006
26944348Simp
27060484Sobrien/* ??? */
27160484Sobrien#define SHT_MIPS_PACKAGE	0x70000007
27260484Sobrien
27360484Sobrien/* ??? */
27460484Sobrien#define SHT_MIPS_PACKSYM	0x70000008
27560484Sobrien
27660484Sobrien/* ??? */
27760484Sobrien#define SHT_MIPS_RELD		0x70000009
27860484Sobrien
27944348Simp/* Section contains interface information.  */
28044348Simp#define SHT_MIPS_IFACE		0x7000000b
28144348Simp
28244348Simp/* Section contains description of contents of another section.  */
28344348Simp#define SHT_MIPS_CONTENT	0x7000000c
28444348Simp
28544348Simp/* Section contains miscellaneous options.  */
28644348Simp#define SHT_MIPS_OPTIONS	0x7000000d
28744348Simp
28860484Sobrien/* ??? */
28960484Sobrien#define SHT_MIPS_SHDR		0x70000010
29060484Sobrien
29160484Sobrien/* ??? */
29260484Sobrien#define SHT_MIPS_FDESC		0x70000011
29360484Sobrien
29460484Sobrien/* ??? */
29560484Sobrien#define SHT_MIPS_EXTSYM		0x70000012
29660484Sobrien
29760484Sobrien/* ??? */
29860484Sobrien#define SHT_MIPS_DENSE		0x70000013
29960484Sobrien
30060484Sobrien/* ??? */
30160484Sobrien#define SHT_MIPS_PDESC		0x70000014
30260484Sobrien
30360484Sobrien/* ??? */
30460484Sobrien#define SHT_MIPS_LOCSYM		0x70000015
30560484Sobrien
30660484Sobrien/* ??? */
30760484Sobrien#define SHT_MIPS_AUXSYM		0x70000016
30860484Sobrien
30960484Sobrien/* ??? */
31060484Sobrien#define SHT_MIPS_OPTSYM		0x70000017
31160484Sobrien
31260484Sobrien/* ??? */
31360484Sobrien#define SHT_MIPS_LOCSTR		0x70000018
31460484Sobrien
31560484Sobrien/* ??? */
31660484Sobrien#define SHT_MIPS_LINE		0x70000019
31760484Sobrien
31860484Sobrien/* ??? */
31960484Sobrien#define SHT_MIPS_RFDESC		0x7000001a
32060484Sobrien
32178828Sobrien/* Delta C++: symbol table */
32260484Sobrien#define SHT_MIPS_DELTASYM	0x7000001b
32360484Sobrien
32478828Sobrien/* Delta C++: instance table */
32560484Sobrien#define SHT_MIPS_DELTAINST	0x7000001c
32660484Sobrien
32778828Sobrien/* Delta C++: class table */
32860484Sobrien#define SHT_MIPS_DELTACLASS	0x7000001d
32960484Sobrien
33044348Simp/* DWARF debugging section.  */
33144348Simp#define SHT_MIPS_DWARF		0x7000001e
33244348Simp
33378828Sobrien/* Delta C++: declarations */
33460484Sobrien#define SHT_MIPS_DELTADECL	0x7000001f
33560484Sobrien
33660484Sobrien/* List of libraries the binary depends on.  Includes a time stamp, version
33760484Sobrien   number.  */
33844348Simp#define SHT_MIPS_SYMBOL_LIB	0x70000020
33944348Simp
34044348Simp/* Events section.  */
34144348Simp#define SHT_MIPS_EVENTS		0x70000021
34244348Simp
34360484Sobrien/* ??? */
34460484Sobrien#define SHT_MIPS_TRANSLATE	0x70000022
34560484Sobrien
34678828Sobrien/* Special pixie sections */
34760484Sobrien#define SHT_MIPS_PIXIE		0x70000023
34860484Sobrien
34978828Sobrien/* Address translation table (for debug info) */
35060484Sobrien#define SHT_MIPS_XLATE		0x70000024
35160484Sobrien
35278828Sobrien/* SGI internal address translation table (for debug info) */
35360484Sobrien#define SHT_MIPS_XLATE_DEBUG	0x70000025
35460484Sobrien
35578828Sobrien/* Intermediate code */
35660484Sobrien#define SHT_MIPS_WHIRL		0x70000026
35760484Sobrien
35878828Sobrien/* C++ exception handling region info */
35960484Sobrien#define SHT_MIPS_EH_REGION	0x70000027
36060484Sobrien
36178828Sobrien/* Obsolete address translation table (for debug info) */
36260484Sobrien#define SHT_MIPS_XLATE_OLD	0x70000028
36360484Sobrien
36478828Sobrien/* Runtime procedure descriptor table exception information (ucode) ??? */
36560484Sobrien#define SHT_MIPS_PDR_EXCEPTION	0x70000029
36660484Sobrien
36760484Sobrien
36844348Simp/* A section of type SHT_MIPS_LIBLIST contains an array of the
36944348Simp   following structure.  The sh_link field is the section index of the
37044348Simp   string table.  The sh_info field is the number of entries in the
37144348Simp   section.  */
37244348Simptypedef struct
37344348Simp{
37444348Simp  /* String table index for name of shared object.  */
37544348Simp  unsigned long l_name;
37644348Simp  /* Time stamp.  */
37744348Simp  unsigned long l_time_stamp;
37844348Simp  /* Checksum of symbol names and common sizes.  */
37944348Simp  unsigned long l_checksum;
38044348Simp  /* String table index for version.  */
38144348Simp  unsigned long l_version;
38244348Simp  /* Flags.  */
38344348Simp  unsigned long l_flags;
38444348Simp} Elf32_Lib;
38544348Simp
38660484Sobrien/* The external version of Elf32_Lib.  */
38760484Sobrientypedef struct
38860484Sobrien{
38960484Sobrien  unsigned char l_name[4];
39060484Sobrien  unsigned char l_time_stamp[4];
39160484Sobrien  unsigned char l_checksum[4];
39260484Sobrien  unsigned char l_version[4];
39360484Sobrien  unsigned char l_flags[4];
39460484Sobrien} Elf32_External_Lib;
39560484Sobrien
39644348Simp/* The l_flags field of an Elf32_Lib structure may contain the
39744348Simp   following flags.  */
39844348Simp
39944348Simp/* Require an exact match at runtime.  */
40044348Simp#define LL_EXACT_MATCH		0x00000001
40144348Simp
40244348Simp/* Ignore version incompatibilities at runtime.  */
40344348Simp#define LL_IGNORE_INT_VER	0x00000002
40444348Simp
40560484Sobrien/* Require matching minor version number.  */
40660484Sobrien#define LL_REQUIRE_MINOR	0x00000004
40760484Sobrien
40860484Sobrien/* ??? */
40960484Sobrien#define LL_EXPORTS		0x00000008
41060484Sobrien
41160484Sobrien/* Delay loading of this library until really needed.  */
41260484Sobrien#define LL_DELAY_LOAD		0x00000010
41360484Sobrien
41460484Sobrien/* ??? Delta C++ stuff ??? */
41560484Sobrien#define LL_DELTA		0x00000020
41660484Sobrien
41760484Sobrien
41844348Simp/* A section of type SHT_MIPS_CONFLICT is an array of indices into the
41944348Simp   .dynsym section.  Each element has the following type.  */
42044348Simptypedef unsigned long Elf32_Conflict;
42160484Sobrientypedef unsigned char Elf32_External_Conflict[4];
42244348Simp
42360484Sobrientypedef unsigned long Elf64_Conflict;
42460484Sobrientypedef unsigned char Elf64_External_Conflict[8];
42560484Sobrien
42644348Simp/* A section of type SHT_MIPS_GPTAB contains information about how
42744348Simp   much GP space would be required for different -G arguments.  This
42844348Simp   information is only used so that the linker can provide informative
42944348Simp   suggestions as to the best -G value to use.  The sh_info field is
43044348Simp   the index of the section for which this information applies.  The
43144348Simp   contents of the section are an array of the following union.  The
43244348Simp   first element uses the gt_header field.  The remaining elements use
43344348Simp   the gt_entry field.  */
43444348Simptypedef union
43544348Simp{
43644348Simp  struct
43744348Simp    {
43844348Simp      /* -G value actually used for this object file.  */
43944348Simp      unsigned long gt_current_g_value;
44044348Simp      /* Unused.  */
44144348Simp      unsigned long gt_unused;
44244348Simp    } gt_header;
44344348Simp  struct
44444348Simp    {
44544348Simp      /* If this -G argument has been used...  */
44644348Simp      unsigned long gt_g_value;
44744348Simp      /* ...this many GP section bytes would be required.  */
44844348Simp      unsigned long gt_bytes;
44944348Simp    } gt_entry;
45044348Simp} Elf32_gptab;
45144348Simp
45244348Simp/* The external version of Elf32_gptab.  */
45344348Simp
45444348Simptypedef union
45544348Simp{
45644348Simp  struct
45744348Simp    {
45844348Simp      unsigned char gt_current_g_value[4];
45944348Simp      unsigned char gt_unused[4];
46044348Simp    } gt_header;
46144348Simp  struct
46244348Simp    {
46344348Simp      unsigned char gt_g_value[4];
46444348Simp      unsigned char gt_bytes[4];
46544348Simp    } gt_entry;
46644348Simp} Elf32_External_gptab;
46744348Simp
46844348Simp/* A section of type SHT_MIPS_REGINFO contains the following
46944348Simp   structure.  */
47044348Simptypedef struct
47144348Simp{
47244348Simp  /* Mask of general purpose registers used.  */
47344348Simp  unsigned long ri_gprmask;
47444348Simp  /* Mask of co-processor registers used.  */
47544348Simp  unsigned long ri_cprmask[4];
47644348Simp  /* GP register value for this object file.  */
47744348Simp  long ri_gp_value;
47844348Simp} Elf32_RegInfo;
47944348Simp
48044348Simp/* The external version of the Elf_RegInfo structure.  */
48144348Simptypedef struct
48244348Simp{
48344348Simp  unsigned char ri_gprmask[4];
48444348Simp  unsigned char ri_cprmask[4][4];
48544348Simp  unsigned char ri_gp_value[4];
48644348Simp} Elf32_External_RegInfo;
48744348Simp
48844348Simp/* MIPS ELF .reginfo swapping routines.  */
48944348Simpextern void bfd_mips_elf32_swap_reginfo_in
490130561Sobrien  (bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *);
49144348Simpextern void bfd_mips_elf32_swap_reginfo_out
492130561Sobrien  (bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *);
49344348Simp
49444348Simp/* Processor specific section flags.  */
49544348Simp
49644348Simp/* This section must be in the global data area.  */
49744348Simp#define SHF_MIPS_GPREL		0x10000000
49844348Simp
49944348Simp/* This section should be merged.  */
50044348Simp#define SHF_MIPS_MERGE		0x20000000
50144348Simp
50278828Sobrien/* This section contains address data of size implied by section
50378828Sobrien   element size.  */
50478828Sobrien#define SHF_MIPS_ADDR		0x40000000
50544348Simp
50678828Sobrien/* This section contains string data.  */
50778828Sobrien#define SHF_MIPS_STRING		0x80000000
50844348Simp
50944348Simp/* This section may not be stripped.  */
51044348Simp#define SHF_MIPS_NOSTRIP	0x08000000
51144348Simp
51244348Simp/* This section is local to threads.  */
51344348Simp#define SHF_MIPS_LOCAL		0x04000000
51444348Simp
51544348Simp/* Linker should generate implicit weak names for this section.  */
51644348Simp#define SHF_MIPS_NAMES		0x02000000
51778828Sobrien
51878828Sobrien/* Section contais text/data which may be replicated in other sections.
51978828Sobrien   Linker should retain only one copy.  */
52078828Sobrien#define SHF_MIPS_NODUPES	0x01000000
52144348Simp
52244348Simp/* Processor specific program header types.  */
52344348Simp
52444348Simp/* Register usage information.  Identifies one .reginfo section.  */
52544348Simp#define PT_MIPS_REGINFO		0x70000000
52644348Simp
52744348Simp/* Runtime procedure table.  */
52844348Simp#define PT_MIPS_RTPROC		0x70000001
52960484Sobrien
53078828Sobrien/* .MIPS.options section.  */
53160484Sobrien#define PT_MIPS_OPTIONS		0x70000002
53244348Simp
53344348Simp/* Processor specific dynamic array tags.  */
53444348Simp
53544348Simp/* 32 bit version number for runtime linker interface.  */
53644348Simp#define DT_MIPS_RLD_VERSION	0x70000001
53744348Simp
53844348Simp/* Time stamp.  */
53944348Simp#define DT_MIPS_TIME_STAMP	0x70000002
54044348Simp
54144348Simp/* Checksum of external strings and common sizes.  */
54244348Simp#define DT_MIPS_ICHECKSUM	0x70000003
54344348Simp
54444348Simp/* Index of version string in string table.  */
54544348Simp#define DT_MIPS_IVERSION	0x70000004
54644348Simp
54744348Simp/* 32 bits of flags.  */
54844348Simp#define DT_MIPS_FLAGS		0x70000005
54944348Simp
55044348Simp/* Base address of the segment.  */
55144348Simp#define DT_MIPS_BASE_ADDRESS	0x70000006
55244348Simp
55360484Sobrien/* ??? */
55460484Sobrien#define DT_MIPS_MSYM		0x70000007
55560484Sobrien
55644348Simp/* Address of .conflict section.  */
55744348Simp#define DT_MIPS_CONFLICT	0x70000008
55844348Simp
55944348Simp/* Address of .liblist section.  */
56044348Simp#define DT_MIPS_LIBLIST		0x70000009
56144348Simp
56244348Simp/* Number of local global offset table entries.  */
56344348Simp#define DT_MIPS_LOCAL_GOTNO	0x7000000a
56444348Simp
56544348Simp/* Number of entries in the .conflict section.  */
56644348Simp#define DT_MIPS_CONFLICTNO	0x7000000b
56744348Simp
56844348Simp/* Number of entries in the .liblist section.  */
56944348Simp#define DT_MIPS_LIBLISTNO	0x70000010
57044348Simp
57144348Simp/* Number of entries in the .dynsym section.  */
57244348Simp#define DT_MIPS_SYMTABNO	0x70000011
57344348Simp
57444348Simp/* Index of first external dynamic symbol not referenced locally.  */
57544348Simp#define DT_MIPS_UNREFEXTNO	0x70000012
57644348Simp
57744348Simp/* Index of first dynamic symbol in global offset table.  */
57844348Simp#define DT_MIPS_GOTSYM		0x70000013
57944348Simp
58044348Simp/* Number of page table entries in global offset table.  */
58144348Simp#define DT_MIPS_HIPAGENO	0x70000014
58244348Simp
58344348Simp/* Address of run time loader map, used for debugging.  */
58444348Simp#define DT_MIPS_RLD_MAP		0x70000016
58560484Sobrien
58660484Sobrien/* Delta C++ class definition.  */
58760484Sobrien#define DT_MIPS_DELTA_CLASS	0x70000017
58860484Sobrien
58960484Sobrien/* Number of entries in DT_MIPS_DELTA_CLASS.  */
59060484Sobrien#define DT_MIPS_DELTA_CLASS_NO	0x70000018
59160484Sobrien
59260484Sobrien/* Delta C++ class instances.  */
59360484Sobrien#define DT_MIPS_DELTA_INSTANCE	0x70000019
59460484Sobrien
59560484Sobrien/* Number of entries in DT_MIPS_DELTA_INSTANCE.  */
59660484Sobrien#define DT_MIPS_DELTA_INSTANCE_NO	0x7000001a
59760484Sobrien
59860484Sobrien/* Delta relocations.  */
59960484Sobrien#define DT_MIPS_DELTA_RELOC	0x7000001b
60060484Sobrien
60160484Sobrien/* Number of entries in DT_MIPS_DELTA_RELOC.  */
60260484Sobrien#define DT_MIPS_DELTA_RELOC_NO	0x7000001c
60360484Sobrien
60460484Sobrien/* Delta symbols that Delta relocations refer to.  */
60560484Sobrien#define DT_MIPS_DELTA_SYM	0x7000001d
60660484Sobrien
60760484Sobrien/* Number of entries in DT_MIPS_DELTA_SYM.  */
60860484Sobrien#define DT_MIPS_DELTA_SYM_NO	0x7000001e
60960484Sobrien
61060484Sobrien/* Delta symbols that hold class declarations.  */
61160484Sobrien#define DT_MIPS_DELTA_CLASSSYM	0x70000020
61260484Sobrien
61360484Sobrien/* Number of entries in DT_MIPS_DELTA_CLASSSYM.  */
61460484Sobrien#define DT_MIPS_DELTA_CLASSSYM_NO	0x70000021
61560484Sobrien
61660484Sobrien/* Flags indicating information about C++ flavor.  */
61760484Sobrien#define DT_MIPS_CXX_FLAGS	0x70000022
61860484Sobrien
61960484Sobrien/* Pixie information (???).  */
62060484Sobrien#define DT_MIPS_PIXIE_INIT	0x70000023
62160484Sobrien
62278828Sobrien/* Address of .MIPS.symlib */
62360484Sobrien#define DT_MIPS_SYMBOL_LIB	0x70000024
62460484Sobrien
62578828Sobrien/* The GOT index of the first PTE for a segment */
62660484Sobrien#define DT_MIPS_LOCALPAGE_GOTIDX	0x70000025
62760484Sobrien
62878828Sobrien/* The GOT index of the first PTE for a local symbol */
62960484Sobrien#define DT_MIPS_LOCAL_GOTIDX	0x70000026
63060484Sobrien
63178828Sobrien/* The GOT index of the first PTE for a hidden symbol */
63260484Sobrien#define DT_MIPS_HIDDEN_GOTIDX	0x70000027
63360484Sobrien
63478828Sobrien/* The GOT index of the first PTE for a protected symbol */
63560484Sobrien#define DT_MIPS_PROTECTED_GOTIDX	0x70000028
63660484Sobrien
63760484Sobrien/* Address of `.MIPS.options'.  */
63860484Sobrien#define DT_MIPS_OPTIONS		0x70000029
63960484Sobrien
64060484Sobrien/* Address of `.interface'.  */
64160484Sobrien#define DT_MIPS_INTERFACE	0x7000002a
64260484Sobrien
64360484Sobrien/* ??? */
64460484Sobrien#define DT_MIPS_DYNSTR_ALIGN	0x7000002b
64560484Sobrien
64660484Sobrien/* Size of the .interface section.  */
64760484Sobrien#define DT_MIPS_INTERFACE_SIZE	0x7000002c
64860484Sobrien
64960484Sobrien/* Size of rld_text_resolve function stored in the GOT.  */
65060484Sobrien#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR	0x7000002d
65160484Sobrien
65260484Sobrien/* Default suffix of DSO to be added by rld on dlopen() calls.  */
65360484Sobrien#define DT_MIPS_PERF_SUFFIX	0x7000002e
65460484Sobrien
65560484Sobrien/* Size of compact relocation section (O32).  */
65660484Sobrien#define DT_MIPS_COMPACT_SIZE	0x7000002f
65760484Sobrien
65860484Sobrien/* GP value for auxiliary GOTs.  */
65960484Sobrien#define DT_MIPS_GP_VALUE	0x70000030
66060484Sobrien
66160484Sobrien/* Address of auxiliary .dynamic.  */
66260484Sobrien#define DT_MIPS_AUX_DYNAMIC	0x70000031
66344348Simp
66444348Simp/* Flags which may appear in a DT_MIPS_FLAGS entry.  */
66544348Simp
66644348Simp/* No flags.  */
66744348Simp#define RHF_NONE		0x00000000
66844348Simp
66944348Simp/* Uses shortcut pointers.  */
67044348Simp#define RHF_QUICKSTART		0x00000001
67144348Simp
67244348Simp/* Hash size is not a power of two.  */
67344348Simp#define RHF_NOTPOT		0x00000002
67444348Simp
67544348Simp/* Ignore LD_LIBRARY_PATH.  */
67678828Sobrien#define RHS_NO_LIBRARY_REPLACEMENT 0x00000004
67760484Sobrien
67878828Sobrien/* DSO address may not be relocated. */
67978828Sobrien#define RHF_NO_MOVE		0x00000008
68078828Sobrien
68178828Sobrien/* SGI specific features. */
68278828Sobrien#define RHF_SGI_ONLY		0x00000010
68378828Sobrien
68478828Sobrien/* Guarantee that .init will finish executing before any non-init
68578828Sobrien   code in DSO is called. */
68660484Sobrien#define RHF_GUARANTEE_INIT	   0x00000020
68778828Sobrien
68878828Sobrien/* Contains Delta C++ code. */
68960484Sobrien#define RHF_DELTA_C_PLUS_PLUS	   0x00000040
69078828Sobrien
69178828Sobrien/* Guarantee that .init will start executing before any non-init
69278828Sobrien   code in DSO is called. */
69360484Sobrien#define RHF_GUARANTEE_START_INIT   0x00000080
69478828Sobrien
69578828Sobrien/* Generated by pixie. */
69660484Sobrien#define RHF_PIXIE		   0x00000100
69778828Sobrien
69878828Sobrien/* Delay-load DSO by default. */
69960484Sobrien#define RHF_DEFAULT_DELAY_LOAD	   0x00000200
70078828Sobrien
70178828Sobrien/* Object may be requickstarted */
70260484Sobrien#define RHF_REQUICKSTART	   0x00000400
70378828Sobrien
70478828Sobrien/* Object has been requickstarted */
70560484Sobrien#define RHF_REQUICKSTARTED	   0x00000800
70678828Sobrien
70778828Sobrien/* Generated by cord. */
70860484Sobrien#define RHF_CORD		   0x00001000
70978828Sobrien
71078828Sobrien/* Object contains no unresolved undef symbols. */
71160484Sobrien#define RHF_NO_UNRES_UNDEF	   0x00002000
71278828Sobrien
71378828Sobrien/* Symbol table is in a safe order. */
71460484Sobrien#define RHF_RLD_ORDER_SAFE	   0x00004000
71544348Simp
71644348Simp/* Special values for the st_other field in the symbol table.  These
71744348Simp   are used in an Irix 5 dynamic symbol table.  */
71844348Simp
71960484Sobrien#define STO_DEFAULT		STV_DEFAULT
72060484Sobrien#define STO_INTERNAL		STV_INTERNAL
72160484Sobrien#define STO_HIDDEN		STV_HIDDEN
72260484Sobrien#define STO_PROTECTED		STV_PROTECTED
72344348Simp
72444348Simp/* This value is used for a mips16 .text symbol.  */
72544348Simp#define STO_MIPS16		0xf0
726218822Sdim
727218822Sdim/* This bit is used on Irix to indicate a symbol whose definition
728218822Sdim   is optional - if, at final link time, it cannot be found, no
729218822Sdim   error message should be produced.  */
730218822Sdim#define STO_OPTIONAL		(1 << 2)
731218822Sdim/* A macro to examine the STO_OPTIONAL bit.  */
732218822Sdim#define ELF_MIPS_IS_OPTIONAL(other)	((other) & STO_OPTIONAL)
73344348Simp
73444348Simp/* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
73544348Simp   relocation entry specifies up to three actual relocations, all at
73644348Simp   the same address.  The first relocation which required a symbol
73744348Simp   uses the symbol in the r_sym field.  The second relocation which
73844348Simp   requires a symbol uses the symbol in the r_ssym field.  If all
73944348Simp   three relocations require a symbol, the third one uses a zero
74044348Simp   value.  */
74144348Simp
74244348Simp/* An entry in a 64 bit SHT_REL section.  */
74344348Simp
74444348Simptypedef struct
74544348Simp{
74644348Simp  /* Address of relocation.  */
74744348Simp  unsigned char r_offset[8];
74844348Simp  /* Symbol index.  */
74944348Simp  unsigned char r_sym[4];
75044348Simp  /* Special symbol.  */
75144348Simp  unsigned char r_ssym[1];
75244348Simp  /* Third relocation.  */
75344348Simp  unsigned char r_type3[1];
75444348Simp  /* Second relocation.  */
75544348Simp  unsigned char r_type2[1];
75644348Simp  /* First relocation.  */
75744348Simp  unsigned char r_type[1];
75844348Simp} Elf64_Mips_External_Rel;
75944348Simp
76044348Simptypedef struct
76144348Simp{
76244348Simp  /* Address of relocation.  */
76344348Simp  bfd_vma r_offset;
76444348Simp  /* Symbol index.  */
76544348Simp  unsigned long r_sym;
76644348Simp  /* Special symbol.  */
76744348Simp  unsigned char r_ssym;
76844348Simp  /* Third relocation.  */
76944348Simp  unsigned char r_type3;
77044348Simp  /* Second relocation.  */
77144348Simp  unsigned char r_type2;
77244348Simp  /* First relocation.  */
77344348Simp  unsigned char r_type;
77444348Simp} Elf64_Mips_Internal_Rel;
77544348Simp
77644348Simp/* An entry in a 64 bit SHT_RELA section.  */
77744348Simp
77844348Simptypedef struct
77944348Simp{
78044348Simp  /* Address of relocation.  */
78144348Simp  unsigned char r_offset[8];
78244348Simp  /* Symbol index.  */
78344348Simp  unsigned char r_sym[4];
78444348Simp  /* Special symbol.  */
78544348Simp  unsigned char r_ssym[1];
78644348Simp  /* Third relocation.  */
78744348Simp  unsigned char r_type3[1];
78844348Simp  /* Second relocation.  */
78944348Simp  unsigned char r_type2[1];
79044348Simp  /* First relocation.  */
79144348Simp  unsigned char r_type[1];
79244348Simp  /* Addend.  */
79344348Simp  unsigned char r_addend[8];
79444348Simp} Elf64_Mips_External_Rela;
79544348Simp
79644348Simptypedef struct
79744348Simp{
79844348Simp  /* Address of relocation.  */
79944348Simp  bfd_vma r_offset;
80044348Simp  /* Symbol index.  */
80144348Simp  unsigned long r_sym;
80244348Simp  /* Special symbol.  */
80344348Simp  unsigned char r_ssym;
80444348Simp  /* Third relocation.  */
80544348Simp  unsigned char r_type3;
80644348Simp  /* Second relocation.  */
80744348Simp  unsigned char r_type2;
80844348Simp  /* First relocation.  */
80944348Simp  unsigned char r_type;
81044348Simp  /* Addend.  */
81144348Simp  bfd_signed_vma r_addend;
81244348Simp} Elf64_Mips_Internal_Rela;
81344348Simp
81478828Sobrien/* MIPS ELF 64 relocation info access macros.  */
81578828Sobrien#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
81678828Sobrien#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
81778828Sobrien#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
81878828Sobrien#define ELF64_MIPS_R_TYPE(i) ((i) & 0xff)
81978828Sobrien
82044348Simp/* Values found in the r_ssym field of a relocation entry.  */
82144348Simp
82244348Simp/* No relocation.  */
82344348Simp#define RSS_UNDEF	0
82444348Simp
82544348Simp/* Value of GP.  */
82644348Simp#define RSS_GP		1
82744348Simp
82844348Simp/* Value of GP in object being relocated.  */
82944348Simp#define RSS_GP0		2
83044348Simp
83144348Simp/* Address of location being relocated.  */
83244348Simp#define RSS_LOC		3
83344348Simp
83444348Simp/* A SHT_MIPS_OPTIONS section contains a series of options, each of
83544348Simp   which starts with this header.  */
83644348Simp
83744348Simptypedef struct
83844348Simp{
83944348Simp  /* Type of option.  */
84044348Simp  unsigned char kind[1];
84144348Simp  /* Size of option descriptor, including header.  */
84244348Simp  unsigned char size[1];
84344348Simp  /* Section index of affected section, or 0 for global option.  */
84444348Simp  unsigned char section[2];
84544348Simp  /* Information specific to this kind of option.  */
84644348Simp  unsigned char info[4];
84744348Simp} Elf_External_Options;
84844348Simp
84944348Simptypedef struct
85044348Simp{
85144348Simp  /* Type of option.  */
85244348Simp  unsigned char kind;
85344348Simp  /* Size of option descriptor, including header.  */
85444348Simp  unsigned char size;
85544348Simp  /* Section index of affected section, or 0 for global option.  */
85644348Simp  unsigned short section;
85744348Simp  /* Information specific to this kind of option.  */
85844348Simp  unsigned long info;
85944348Simp} Elf_Internal_Options;
86044348Simp
86144348Simp/* MIPS ELF option header swapping routines.  */
86244348Simpextern void bfd_mips_elf_swap_options_in
863130561Sobrien  (bfd *, const Elf_External_Options *, Elf_Internal_Options *);
86444348Simpextern void bfd_mips_elf_swap_options_out
865130561Sobrien  (bfd *, const Elf_Internal_Options *, Elf_External_Options *);
86644348Simp
86744348Simp/* Values which may appear in the kind field of an Elf_Options
86844348Simp   structure.  */
86944348Simp
87044348Simp/* Undefined.  */
87144348Simp#define ODK_NULL	0
87244348Simp
87344348Simp/* Register usage and GP value.  */
87444348Simp#define ODK_REGINFO	1
87544348Simp
87644348Simp/* Exception processing information.  */
87744348Simp#define ODK_EXCEPTIONS	2
87844348Simp
87944348Simp/* Section padding information.  */
88044348Simp#define ODK_PAD		3
88144348Simp
88260484Sobrien/* Hardware workarounds performed.  */
88360484Sobrien#define ODK_HWPATCH	4
88460484Sobrien
88560484Sobrien/* Fill value used by the linker.  */
88660484Sobrien#define ODK_FILL	5
88760484Sobrien
88860484Sobrien/* Reserved space for desktop tools.  */
88960484Sobrien#define ODK_TAGS	6
89060484Sobrien
89160484Sobrien/* Hardware workarounds, AND bits when merging.  */
89260484Sobrien#define ODK_HWAND	7
89360484Sobrien
89460484Sobrien/* Hardware workarounds, OR bits when merging.  */
89560484Sobrien#define ODK_HWOR	8
89660484Sobrien
89760484Sobrien/* GP group to use for text/data sections.  */
89860484Sobrien#define ODK_GP_GROUP	9
89960484Sobrien
90060484Sobrien/* ID information.  */
90160484Sobrien#define ODK_IDENT	10
90260484Sobrien
90360484Sobrien/* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_RegInfo
90444348Simp   structure.  In the 64 bit ABI, it is the following structure.  The
90544348Simp   info field of the options header is not used.  */
90644348Simp
90744348Simptypedef struct
90844348Simp{
90944348Simp  /* Mask of general purpose registers used.  */
91044348Simp  unsigned char ri_gprmask[4];
91144348Simp  /* Padding.  */
91244348Simp  unsigned char ri_pad[4];
91344348Simp  /* Mask of co-processor registers used.  */
91444348Simp  unsigned char ri_cprmask[4][4];
91544348Simp  /* GP register value for this object file.  */
91644348Simp  unsigned char ri_gp_value[8];
91744348Simp} Elf64_External_RegInfo;
91844348Simp
91944348Simptypedef struct
92044348Simp{
92144348Simp  /* Mask of general purpose registers used.  */
92244348Simp  unsigned long ri_gprmask;
92344348Simp  /* Padding.  */
92444348Simp  unsigned long ri_pad;
92544348Simp  /* Mask of co-processor registers used.  */
92644348Simp  unsigned long ri_cprmask[4];
92744348Simp  /* GP register value for this object file.  */
92844348Simp  bfd_vma ri_gp_value;
92944348Simp} Elf64_Internal_RegInfo;
93044348Simp
93160484Sobrientypedef struct
93260484Sobrien{
93360484Sobrien  /* The hash value computed from the name of the corresponding
93460484Sobrien     dynamic symbol.  */
93560484Sobrien  unsigned char ms_hash_value[4];
93660484Sobrien  /* Contains both the dynamic relocation index and the symbol flags
93760484Sobrien     field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
93860484Sobrien     to access the individual values.  The dynamic relocation index
93960484Sobrien     identifies the first entry in the .rel.dyn section that
94060484Sobrien     references the dynamic symbol corresponding to this msym entry.
94160484Sobrien     If the index is 0, no dynamic relocations are associated with the
94260484Sobrien     symbol.  The symbol flags field is reserved for future use.  */
94360484Sobrien  unsigned char ms_info[4];
94460484Sobrien} Elf32_External_Msym;
94560484Sobrien
94660484Sobrientypedef struct
94760484Sobrien{
94860484Sobrien  /* The hash value computed from the name of the corresponding
94960484Sobrien     dynamic symbol.  */
95060484Sobrien  unsigned long ms_hash_value;
95160484Sobrien  /* Contains both the dynamic relocation index and the symbol flags
95260484Sobrien     field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
95360484Sobrien     to access the individual values.  The dynamic relocation index
95460484Sobrien     identifies the first entry in the .rel.dyn section that
95560484Sobrien     references the dynamic symbol corresponding to this msym entry.
95660484Sobrien     If the index is 0, no dynamic relocations are associated with the
95760484Sobrien     symbol.  The symbol flags field is reserved for future use.  */
95860484Sobrien  unsigned long ms_info;
95960484Sobrien} Elf32_Internal_Msym;
96060484Sobrien
96160484Sobrien#define ELF32_MS_REL_INDEX(i) ((i) >> 8)
96260484Sobrien#define ELF32_MS_FLAGS(i)     (i) & 0xff)
96360484Sobrien#define ELF32_MS_INFO(r, f)   (((r) << 8) + ((f) & 0xff))
96460484Sobrien
96544348Simp/* MIPS ELF reginfo swapping routines.  */
96644348Simpextern void bfd_mips_elf64_swap_reginfo_in
967130561Sobrien  (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
96844348Simpextern void bfd_mips_elf64_swap_reginfo_out
969130561Sobrien  (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
97044348Simp
97160484Sobrien/* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
97260484Sobrien#define OEX_FPU_MIN	0x1f	/* FPEs which must be enabled.  */
97360484Sobrien#define OEX_FPU_MAX	0x1f00	/* FPEs which may be enabled.  */
97460484Sobrien#define OEX_PAGE0	0x10000	/* Page zero must be mapped.  */
97560484Sobrien#define OEX_SMM		0x20000	/* Force sequential memory mode.  */
97678828Sobrien#define OEX_FPDBUG	0x40000	/* Force precise floating-point
97778828Sobrien				   exceptions (debug mode).  */
97860484Sobrien#define OEX_DISMISS	0x80000	/* Dismiss invalid address faults.  */
97960484Sobrien
98060484Sobrien/* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX.  */
98160484Sobrien#define OEX_FPU_INVAL	0x10	/* Invalid operation exception.  */
98260484Sobrien#define OEX_FPU_DIV0	0x08	/* Division by zero exception.  */
98360484Sobrien#define OEX_FPU_OFLO	0x04	/* Overflow exception.  */
98460484Sobrien#define OEX_FPU_UFLO	0x02	/* Underflow exception.  */
98560484Sobrien#define OEX_FPU_INEX	0x01	/* Inexact exception.  */
98660484Sobrien
98760484Sobrien/* Masks for the info word of an ODK_PAD descriptor.  */
98860484Sobrien#define OPAD_PREFIX	0x01
98960484Sobrien#define OPAD_POSTFIX	0x02
99060484Sobrien#define OPAD_SYMBOL	0x04
99160484Sobrien
99260484Sobrien/* Masks for the info word of an ODK_HWPATCH descriptor.  */
99378828Sobrien#define OHW_R4KEOP	0x00000001	/* R4000 end-of-page patch.  */
99478828Sobrien#define OHW_R8KPFETCH	0x00000002	/* May need R8000 prefetch patch.  */
99578828Sobrien#define OHW_R5KEOP	0x00000004	/* R5000 end-of-page patch.  */
99678828Sobrien#define OHW_R5KCVTL	0x00000008	/* R5000 cvt.[ds].l bug
99778828Sobrien					   (clean == 1).  */
99878828Sobrien#define OHW_R10KLDL	0x00000010	/* Needs R10K misaligned
99978828Sobrien					   load patch. */
100060484Sobrien
100160484Sobrien/* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor.  */
100260484Sobrien#define OGP_GROUP	0x0000ffff	/* GP group number.  */
100360484Sobrien#define OGP_SELF	0xffff0000	/* Self-contained GP groups.  */
100460484Sobrien
100560484Sobrien/* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
100660484Sobrien#define OHWA0_R4KEOP_CHECKED	0x00000001
100760484Sobrien#define OHWA0_R4KEOP_CLEAN	0x00000002
100860484Sobrien
100960484Sobrien
1010218822Sdim/* Object attribute tags.  */
1011218822Sdimenum
1012218822Sdim{
1013218822Sdim  /* 0-3 are generic.  */
1014218822Sdim  Tag_GNU_MIPS_ABI_FP = 4, /* Value 1 for hard-float -mdouble-float, 2
1015218822Sdim			      for hard-float -msingle-float, 3 for
1016218822Sdim			      soft-float; 0 for not tagged or not
1017218822Sdim			      using any ABIs affected by the
1018218822Sdim			      differences.  */
1019218822Sdim};
1020218822Sdim
102144348Simp#endif /* _ELF_MIPS_H */
1022