* mips.h: New file. MIPS ABI specific information.
[external/binutils.git] / include / elf / mips.h
1 /* MIPS ELF support for BFD.
2    Copyright (C) 1993 Free Software Foundation, Inc.
3
4    By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
5    information in the System V Application Binary Interface, MIPS
6    Processor Supplement.
7
8 This file is part of BFD, the Binary File Descriptor library.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
23
24 /* This file holds definitions specific to the MIPS ELF ABI.  Note
25    that most of this is not actually implemented by BFD.  */
26
27 /* Processor specific flags for the ELF header e_flags field.  */
28
29 /* At least one .noreorder directive appears in the source.  */
30 #define EF_MIPS_NOREORDER       0x00000001
31
32 /* File contains position independent code.  */
33 #define EF_MIPS_PIC             0x00000002
34
35 /* Code in file uses the standard calling sequence for calling
36    position independent code.  */
37 #define EF_MIPS_CPIC            0x00000004
38
39 /* Four bit MIPS architecture field.  */
40 #define EF_MIPS_ARCH            0xf0000000
41 \f
42 /* Processor specific section indices.  These sections do not actually
43    exist.  Symbols with a st_shndx field corresponding to one of these
44    values have a special meaning.  */
45
46 /* Defined and allocated common symbol.  Value is virtual address.  If
47    relocated, alignment must be preserved.  */
48 #define SHN_MIPS_ACOMMON        0xff00
49
50 /* Small common symbol.  */
51 #define SHN_MIPS_SCOMMON        0xff03
52
53 /* Small undefined symbol.  */
54 #define SHN_MIPS_SUNDEFINED     0xff04
55 \f
56 /* Processor specific section types.  */
57
58 /* Section contains the set of dynamic shared objects used when
59    statically linking.  */
60 #define SHT_MIPS_LIBLIST        0x70000000
61
62 /* Section contains list of symbols whose definitions conflict with
63    symbols defined in shared objects.  */
64 #define SHT_MIPS_CONFLICT       0x70000002
65
66 /* Section contains the global pointer table.  */
67 #define SHT_MIPS_GPTAB          0x70000003
68
69 /* Section contains microcode information.  The exact format is
70    unspecified.  */
71 #define SHT_MIPS_UCODE          0x70000004
72
73 /* Section contains some sort of debugging information.  The exact
74    format is unspecified.  It's probably ECOFF symbols.  */
75 #define SHT_MIPS_DEBUG          0x70000005
76
77 /* Section contains register usage information.  */
78 #define SHT_MIPS_REGINFO        0x70000006
79
80 /* A section of type SHT_MIPS_LIBLIST contains an array of the
81    following structure.  The sh_link field is the section index of the
82    string table.  The sh_info field is the number of entries in the
83    section.  */
84 typedef struct
85 {
86   /* String table index for name of shared object.  */
87   Elf32_Word l_name;
88   /* Time stamp.  */
89   Elf32_Word l_time_stamp;
90   /* Checksum of symbol names and common sizes.  */
91   Elf32_Word l_checksum;
92   /* String table index for version.  */
93   Elf32_Word l_version;
94   /* Flags.  */
95   Elf32_Word l_flags;
96 } Elf32_Lib;
97
98 /* The l_flags field of an Elf32_Lib structure may contain the
99    following flags.  */
100
101 /* Require an exact match at runtime.  */
102 #define LL_EXACT_MATCH          0x00000001
103
104 /* Ignore version incompatibilities at runtime.  */
105 #define LL_IGNORE_INT_VER       0x00000002
106
107 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
108    .dynsym section.  Each element has the following type.  */
109 typedef Elf32_Addr Elf32_Conflict;
110
111 /* A section of type SHT_MIPS_GPTAB contains information about how
112    much GP space would be required for different -G arguments.  This
113    information is only used so that the linker can provide informative
114    suggestions as to the best -G value to use.  The sh_info field is
115    the index of the section for which this information applies.  The
116    contents of the section are an array of the following union.  The
117    first element uses the gt_header field.  The remaining elements use
118    the gt_entry field.  */
119 typedef union
120 {
121   struct
122     {
123       /* -G value actually used for this object file.  */
124       Elf32_Word gt_current_g_value;
125       /* Unused.  */
126       Elf32_Word gt_unused;
127     } gt_header;
128   struct
129     {
130       /* If this -G argument has been used...  */
131       Elf32_Word gt_g_value;
132       /* ...this many GP section bytes would be required.  */
133       Elf32_Word gt_bytes;
134     } gt_entry;
135 } Elf32_gptab;
136
137 /* A section of type SHT_MIPS_REGINFO contains the following
138    structure.  */
139 typedef struct
140 {
141   /* Mask of general purpose registers used.  */
142   Elf32_Word ri_gprmask;
143   /* Mask of co-processor registers used.  */
144   Elf32_Word ri_cprmask[4];
145   /* GP register value for this object file.  */
146   Elf32_SWord ri_gp_value;
147 } Elf_RegInfo;
148 \f
149 /* Processor specific section flags.  */
150
151 /* This section must be in the global data area.  */
152 define SHF_MIPS_GPREL           0x10000000