* internal.h: Remove Elf32_*, Elf64_* typedefs. These names
[external/binutils.git] / include / elf / mips.h
1 /* MIPS ELF support for BFD.
2    Copyright (C) 1993, 1994 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
42 /* -mips1 code.  */
43 #define E_MIPS_ARCH_1           0x00000000
44
45 /* -mips2 code.  */
46 #define E_MIPS_ARCH_2           0x10000000
47
48 /* -mips3 code.  */
49 #define E_MIPS_ARCH_3           0x20000000
50 \f
51 /* Processor specific section indices.  These sections do not actually
52    exist.  Symbols with a st_shndx field corresponding to one of these
53    values have a special meaning.  */
54
55 /* Defined and allocated common symbol.  Value is virtual address.  If
56    relocated, alignment must be preserved.  */
57 #define SHN_MIPS_ACOMMON        0xff00
58
59 /* Small common symbol.  */
60 #define SHN_MIPS_SCOMMON        0xff03
61
62 /* Small undefined symbol.  */
63 #define SHN_MIPS_SUNDEFINED     0xff04
64 \f
65 /* Processor specific section types.  */
66
67 /* Section contains the set of dynamic shared objects used when
68    statically linking.  */
69 #define SHT_MIPS_LIBLIST        0x70000000
70
71 /* Section contains list of symbols whose definitions conflict with
72    symbols defined in shared objects.  */
73 #define SHT_MIPS_CONFLICT       0x70000002
74
75 /* Section contains the global pointer table.  */
76 #define SHT_MIPS_GPTAB          0x70000003
77
78 /* Section contains microcode information.  The exact format is
79    unspecified.  */
80 #define SHT_MIPS_UCODE          0x70000004
81
82 /* Section contains some sort of debugging information.  The exact
83    format is unspecified.  It's probably ECOFF symbols.  */
84 #define SHT_MIPS_DEBUG          0x70000005
85
86 /* Section contains register usage information.  */
87 #define SHT_MIPS_REGINFO        0x70000006
88
89 /* Section contains miscellaneous options (used on Irix).  */
90 #define SHT_MIPS_OPTIONS        0x7000000d
91
92 /* A section of type SHT_MIPS_LIBLIST contains an array of the
93    following structure.  The sh_link field is the section index of the
94    string table.  The sh_info field is the number of entries in the
95    section.  */
96 typedef struct
97 {
98   /* String table index for name of shared object.  */
99   unsigned long l_name;
100   /* Time stamp.  */
101   unsigned long l_time_stamp;
102   /* Checksum of symbol names and common sizes.  */
103   unsigned long l_checksum;
104   /* String table index for version.  */
105   unsigned long l_version;
106   /* Flags.  */
107   unsigned long l_flags;
108 } Elf32_Lib;
109
110 /* The l_flags field of an Elf32_Lib structure may contain the
111    following flags.  */
112
113 /* Require an exact match at runtime.  */
114 #define LL_EXACT_MATCH          0x00000001
115
116 /* Ignore version incompatibilities at runtime.  */
117 #define LL_IGNORE_INT_VER       0x00000002
118
119 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
120    .dynsym section.  Each element has the following type.  */
121 typedef unsigned long Elf32_Conflict;
122
123 /* A section of type SHT_MIPS_GPTAB contains information about how
124    much GP space would be required for different -G arguments.  This
125    information is only used so that the linker can provide informative
126    suggestions as to the best -G value to use.  The sh_info field is
127    the index of the section for which this information applies.  The
128    contents of the section are an array of the following union.  The
129    first element uses the gt_header field.  The remaining elements use
130    the gt_entry field.  */
131 typedef union
132 {
133   struct
134     {
135       /* -G value actually used for this object file.  */
136       unsigned long gt_current_g_value;
137       /* Unused.  */
138       unsigned long gt_unused;
139     } gt_header;
140   struct
141     {
142       /* If this -G argument has been used...  */
143       unsigned long gt_g_value;
144       /* ...this many GP section bytes would be required.  */
145       unsigned long gt_bytes;
146     } gt_entry;
147 } Elf32_gptab;
148
149 /* A section of type SHT_MIPS_REGINFO contains the following
150    structure.  */
151 typedef struct
152 {
153   /* Mask of general purpose registers used.  */
154   unsigned long ri_gprmask;
155   /* Mask of co-processor registers used.  */
156   unsigned long ri_cprmask[4];
157   /* GP register value for this object file.  */
158   long ri_gp_value;
159 } Elf32_RegInfo;
160
161 /* The external version of the Elf_RegInfo structure.  */
162 typedef struct
163 {
164   unsigned char ri_gprmask[4];
165   unsigned char ri_cprmask[4][4];
166   unsigned char ri_gp_value[4];
167 } Elf32_External_RegInfo;
168
169 /* MIPS ELF .reginfo swapping routines.  */
170 extern void bfd_mips_elf32_swap_reginfo_in
171   PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
172 extern void bfd_mips_elf32_swap_reginfo_out
173   PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
174 \f
175 /* Processor specific section flags.  */
176
177 /* This section must be in the global data area.  */
178 #define SHF_MIPS_GPREL          0x10000000
179 \f
180 /* Processor specific program header types.  */
181
182 /* Register usage information.  Identifies one .reginfo section.  */
183 #define PT_MIPS_REGINFO         0x70000000
184 \f
185 /* Processor specific dynamic array tags.  */
186
187 /* 32 bit version number for runtime linker interface.  */
188 #define DT_MIPS_RLD_VERSION     0x70000001
189
190 /* Time stamp.  */
191 #define DT_MIPS_TIME_STAMP      0x70000002
192
193 /* Checksum of external strings and common sizes.  */
194 #define DT_MIPS_ICHECKSUM       0x70000003
195
196 /* Index of version string in string table.  */
197 #define DT_MIPS_IVERSION        0x70000004
198
199 /* 32 bits of flags.  */
200 #define DT_MIPS_FLAGS           0x70000005
201
202 /* Base address of the segment.  */
203 #define DT_MIPS_BASE_ADDRESS    0x70000006
204
205 /* Address of .conflict section.  */
206 #define DT_MIPS_CONFLICT        0x70000008
207
208 /* Address of .liblist section.  */
209 #define DT_MIPS_LIBLIST         0x70000009
210
211 /* Number of local global offset table entries.  */
212 #define DT_MIPS_LOCAL_GOTNO     0x7000000a
213
214 /* Number of entries in the .conflict section.  */
215 #define DT_MIPS_CONFLICTNO      0x7000000b
216
217 /* Number of entries in the .liblist section.  */
218 #define DT_MIPS_LIBLISTNO       0x70000010
219
220 /* Number of entries in the .dynsym section.  */
221 #define DT_MIPS_SYMTABNO        0x70000011
222
223 /* Index of first external dynamic symbol not referenced locally.  */
224 #define DT_MIPS_UNREFEXTNO      0x70000012
225
226 /* Index of first dynamic symbol in global offset table.  */
227 #define DT_MIPS_GOTSYM          0x70000013
228
229 /* Number of page table entries in global offset table.  */
230 #define DT_MIPS_HIPAGENO        0x70000014
231
232 /* Address of run time loader map, used for debugging.  */
233 #define DT_MIPS_RLD_MAP         0x70000016