1 /* MIPS ELF support for BFD.
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4 By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
5 information in the System V Application Binary Interface, MIPS
8 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 /* This file holds definitions specific to the MIPS ELF ABI. Note
25 that most of this is not actually implemented by BFD. */
30 /* Processor specific flags for the ELF header e_flags field. */
32 /* At least one .noreorder directive appears in the source. */
33 #define EF_MIPS_NOREORDER 0x00000001
35 /* File contains position independent code. */
36 #define EF_MIPS_PIC 0x00000002
38 /* Code in file uses the standard calling sequence for calling
39 position independent code. */
40 #define EF_MIPS_CPIC 0x00000004
42 /* Four bit MIPS architecture field. */
43 #define EF_MIPS_ARCH 0xf0000000
46 #define E_MIPS_ARCH_1 0x00000000
49 #define E_MIPS_ARCH_2 0x10000000
52 #define E_MIPS_ARCH_3 0x20000000
55 #define E_MIPS_ARCH_4 0x30000000
57 /* Processor specific section indices. These sections do not actually
58 exist. Symbols with a st_shndx field corresponding to one of these
59 values have a special meaning. */
61 /* Defined and allocated common symbol. Value is virtual address. If
62 relocated, alignment must be preserved. */
63 #define SHN_MIPS_ACOMMON 0xff00
65 /* Defined and allocated text symbol. Value is virtual address.
66 Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
67 #define SHN_MIPS_TEXT 0xff01
69 /* Defined and allocated data symbol. Value is virtual address.
70 Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */
71 #define SHN_MIPS_DATA 0xff02
73 /* Small common symbol. */
74 #define SHN_MIPS_SCOMMON 0xff03
76 /* Small undefined symbol. */
77 #define SHN_MIPS_SUNDEFINED 0xff04
79 /* Processor specific section types. */
81 /* Section contains the set of dynamic shared objects used when
82 statically linking. */
83 #define SHT_MIPS_LIBLIST 0x70000000
85 /* I'm not sure what this is, but it's used on Irix 5. */
86 #define SHT_MIPS_MSYM 0x70000001
88 /* Section contains list of symbols whose definitions conflict with
89 symbols defined in shared objects. */
90 #define SHT_MIPS_CONFLICT 0x70000002
92 /* Section contains the global pointer table. */
93 #define SHT_MIPS_GPTAB 0x70000003
95 /* Section contains microcode information. The exact format is
97 #define SHT_MIPS_UCODE 0x70000004
99 /* Section contains some sort of debugging information. The exact
100 format is unspecified. It's probably ECOFF symbols. */
101 #define SHT_MIPS_DEBUG 0x70000005
103 /* Section contains register usage information. */
104 #define SHT_MIPS_REGINFO 0x70000006
106 /* Section contains miscellaneous options (used on Irix). */
107 #define SHT_MIPS_OPTIONS 0x7000000d
109 /* DWARF debugging section (used on Irix 6). */
110 #define SHT_MIPS_DWARF 0x7000001e
112 /* Events section. This appears on Irix 6. I don't know what it
114 #define SHT_MIPS_EVENTS 0x70000021
116 /* A section of type SHT_MIPS_LIBLIST contains an array of the
117 following structure. The sh_link field is the section index of the
118 string table. The sh_info field is the number of entries in the
122 /* String table index for name of shared object. */
123 unsigned long l_name
;
125 unsigned long l_time_stamp
;
126 /* Checksum of symbol names and common sizes. */
127 unsigned long l_checksum
;
128 /* String table index for version. */
129 unsigned long l_version
;
131 unsigned long l_flags
;
134 /* The l_flags field of an Elf32_Lib structure may contain the
137 /* Require an exact match at runtime. */
138 #define LL_EXACT_MATCH 0x00000001
140 /* Ignore version incompatibilities at runtime. */
141 #define LL_IGNORE_INT_VER 0x00000002
143 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
144 .dynsym section. Each element has the following type. */
145 typedef unsigned long Elf32_Conflict
;
147 /* A section of type SHT_MIPS_GPTAB contains information about how
148 much GP space would be required for different -G arguments. This
149 information is only used so that the linker can provide informative
150 suggestions as to the best -G value to use. The sh_info field is
151 the index of the section for which this information applies. The
152 contents of the section are an array of the following union. The
153 first element uses the gt_header field. The remaining elements use
154 the gt_entry field. */
159 /* -G value actually used for this object file. */
160 unsigned long gt_current_g_value
;
162 unsigned long gt_unused
;
166 /* If this -G argument has been used... */
167 unsigned long gt_g_value
;
168 /* ...this many GP section bytes would be required. */
169 unsigned long gt_bytes
;
173 /* The external version of Elf32_gptab. */
179 unsigned char gt_current_g_value
[4];
180 unsigned char gt_unused
[4];
184 unsigned char gt_g_value
[4];
185 unsigned char gt_bytes
[4];
187 } Elf32_External_gptab
;
189 /* A section of type SHT_MIPS_REGINFO contains the following
193 /* Mask of general purpose registers used. */
194 unsigned long ri_gprmask
;
195 /* Mask of co-processor registers used. */
196 unsigned long ri_cprmask
[4];
197 /* GP register value for this object file. */
201 /* The external version of the Elf_RegInfo structure. */
204 unsigned char ri_gprmask
[4];
205 unsigned char ri_cprmask
[4][4];
206 unsigned char ri_gp_value
[4];
207 } Elf32_External_RegInfo
;
209 /* MIPS ELF .reginfo swapping routines. */
210 extern void bfd_mips_elf32_swap_reginfo_in
211 PARAMS ((bfd
*, const Elf32_External_RegInfo
*, Elf32_RegInfo
*));
212 extern void bfd_mips_elf32_swap_reginfo_out
213 PARAMS ((bfd
*, const Elf32_RegInfo
*, Elf32_External_RegInfo
*));
215 /* Processor specific section flags. */
217 /* This section must be in the global data area. */
218 #define SHF_MIPS_GPREL 0x10000000
220 /* Processor specific program header types. */
222 /* Register usage information. Identifies one .reginfo section. */
223 #define PT_MIPS_REGINFO 0x70000000
225 /* Runtime procedure table. */
226 #define PT_MIPS_RTPROC 0x70000001
228 /* Processor specific dynamic array tags. */
230 /* 32 bit version number for runtime linker interface. */
231 #define DT_MIPS_RLD_VERSION 0x70000001
234 #define DT_MIPS_TIME_STAMP 0x70000002
236 /* Checksum of external strings and common sizes. */
237 #define DT_MIPS_ICHECKSUM 0x70000003
239 /* Index of version string in string table. */
240 #define DT_MIPS_IVERSION 0x70000004
242 /* 32 bits of flags. */
243 #define DT_MIPS_FLAGS 0x70000005
245 /* Base address of the segment. */
246 #define DT_MIPS_BASE_ADDRESS 0x70000006
248 /* Address of .conflict section. */
249 #define DT_MIPS_CONFLICT 0x70000008
251 /* Address of .liblist section. */
252 #define DT_MIPS_LIBLIST 0x70000009
254 /* Number of local global offset table entries. */
255 #define DT_MIPS_LOCAL_GOTNO 0x7000000a
257 /* Number of entries in the .conflict section. */
258 #define DT_MIPS_CONFLICTNO 0x7000000b
260 /* Number of entries in the .liblist section. */
261 #define DT_MIPS_LIBLISTNO 0x70000010
263 /* Number of entries in the .dynsym section. */
264 #define DT_MIPS_SYMTABNO 0x70000011
266 /* Index of first external dynamic symbol not referenced locally. */
267 #define DT_MIPS_UNREFEXTNO 0x70000012
269 /* Index of first dynamic symbol in global offset table. */
270 #define DT_MIPS_GOTSYM 0x70000013
272 /* Number of page table entries in global offset table. */
273 #define DT_MIPS_HIPAGENO 0x70000014
275 /* Address of run time loader map, used for debugging. */
276 #define DT_MIPS_RLD_MAP 0x70000016
278 /* Flags which may appear in a DT_MIPS_FLAGS entry. */
281 #define RHF_NONE 0x00000000
283 /* Uses shortcut pointers. */
284 #define RHF_QUICKSTART 0x00000001
286 /* Hash size is not a power of two. */
287 #define RHF_NOTPOT 0x00000002
289 /* Ignore LD_LIBRARY_PATH. */
290 #define RHS_NO_LIBRARY_REPLACEMENT \
293 /* Special values for the st_other field in the symbol table. These
294 are used in an Irix 5 dynamic symbol table. */
296 #define STO_DEFAULT 0x00
297 #define STO_INTERNAL 0x01
298 #define STO_HIDDEN 0x02
299 #define STO_PROTECTED 0x03
301 /* The 64-bit MIPS ELF ABI uses an usual reloc format. Each
302 relocation entry specifies up to three actual relocations, all at
303 the same address. The first relocation which required a symbol
304 uses the symbol in the r_sym field. The second relocation which
305 requires a symbol uses the symbol in the r_ssym field. If all
306 three relocations require a symbol, the third one uses a zero
309 /* An entry in a 64 bit SHT_REL section. */
313 /* Address of relocation. */
314 unsigned char r_offset
[8];
316 unsigned char r_sym
[4];
317 /* Special symbol. */
318 unsigned char r_ssym
[1];
319 /* Third relocation. */
320 unsigned char r_type3
[1];
321 /* Second relocation. */
322 unsigned char r_type2
[1];
323 /* First relocation. */
324 unsigned char r_type
[1];
325 } Elf64_Mips_External_Rel
;
329 /* Address of relocation. */
333 /* Special symbol. */
334 unsigned char r_ssym
;
335 /* Third relocation. */
336 unsigned char r_type3
;
337 /* Second relocation. */
338 unsigned char r_type2
;
339 /* First relocation. */
340 unsigned char r_type
;
341 } Elf64_Mips_Internal_Rel
;
343 /* An entry in a 64 bit SHT_RELA section. */
347 /* Address of relocation. */
348 unsigned char r_offset
[8];
350 unsigned char r_sym
[4];
351 /* Special symbol. */
352 unsigned char r_ssym
[1];
353 /* Third relocation. */
354 unsigned char r_type3
[1];
355 /* Second relocation. */
356 unsigned char r_type2
[1];
357 /* First relocation. */
358 unsigned char r_type
[1];
360 unsigned char r_addend
[8];
361 } Elf64_Mips_External_Rela
;
365 /* Address of relocation. */
369 /* Special symbol. */
370 unsigned char r_ssym
;
371 /* Third relocation. */
372 unsigned char r_type3
;
373 /* Second relocation. */
374 unsigned char r_type2
;
375 /* First relocation. */
376 unsigned char r_type
;
378 bfd_signed_vma r_addend
;
379 } Elf64_Mips_Internal_Rela
;
381 /* Values found in the r_ssym field of a relocation entry. */
389 /* Value of GP in object being relocated. */
392 /* Address of location being relocated. */
395 #endif /* _ELF_MIPS_H */