Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / elf / elf.h
blob85c992cf166bd68714bc69194ea1000a43d74cb4
1 /* This file defines standard ELF types, structures, and macros.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by Ian Lance Taylor (ian@cygnus.com).
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If
19 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
20 Cambridge, MA 02139, USA. */
22 #ifndef _ELF_H
23 #define _ELF_H 1
26 /* Standard ELF types.
28 Using __attribute__ mode ensures that gcc will choose the right for
29 these types. */
31 typedef unsigned int Elf32_Addr __attribute__ ((mode (SI)));
32 typedef unsigned int Elf32_Half __attribute__ ((mode (HI)));
33 typedef unsigned int Elf32_Off __attribute__ ((mode (SI)));
34 typedef int Elf32_Sword __attribute__ ((mode (SI)));
35 typedef unsigned int Elf32_Word __attribute__ ((mode (SI)));
37 /* The ELF file header. This appears at the start of every ELF file. */
39 #define EI_NIDENT (16)
41 typedef struct
43 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
44 Elf32_Half e_type; /* Object file type */
45 Elf32_Half e_machine; /* Architecture */
46 Elf32_Word e_version; /* Object file version */
47 Elf32_Addr e_entry; /* Entry point virtual address */
48 Elf32_Off e_phoff; /* Program header table file offset */
49 Elf32_Off e_shoff; /* Section header table file offset */
50 Elf32_Word e_flags; /* Processor-specific flags */
51 Elf32_Half e_ehsize; /* ELF header size in bytes */
52 Elf32_Half e_phentsize; /* Program header table entry size */
53 Elf32_Half e_phnum; /* Program header table entry count */
54 Elf32_Half e_shentsize; /* Section header table entry size */
55 Elf32_Half e_shnum; /* Section header table entry count */
56 Elf32_Half e_shstrndx; /* Section header string table index */
57 } Elf32_Ehdr;
59 /* Fields in the e_ident array. The EI_* macros are indices into the
60 array. The macros under each EI_* macro are the values the byte
61 may have. */
63 #define EI_MAG0 0 /* File identification byte 0 index */
64 #define ELFMAG0 0x7f /* Magic number byte 0 */
66 #define EI_MAG1 1 /* File identification byte 1 index */
67 #define ELFMAG1 'E' /* Magic number byte 1 */
69 #define EI_MAG2 2 /* File identification byte 2 index */
70 #define ELFMAG2 'L' /* Magic number byte 2 */
72 #define EI_MAG3 3 /* File identification byte 3 index */
73 #define ELFMAG3 'F' /* Magic number byte 3 */
75 /* Conglomeration of the identification bytes, for easy testing as a word. */
76 #define ELFMAG "\177ELF"
77 #define SELFMAG 4
79 #define EI_CLASS 4 /* File class byte index */
80 #define ELFCLASSNONE 0 /* Invalid class */
81 #define ELFCLASS32 1 /* 32-bit objects */
82 #define ELFCLASS64 2 /* 64-bit objects */
84 #define EI_DATA 5 /* Data encoding byte index */
85 #define ELFDATANONE 0 /* Invalid data encoding */
86 #define ELFDATA2LSB 1 /* 2's complement, little endian */
87 #define ELFDATA2MSB 2 /* 2's complement, big endian */
89 #define EI_VERSION 6 /* File version byte index */
90 /* Value must be EV_CURRENT */
92 #define EI_PAD 7 /* Byte index of padding bytes */
94 /* Legal values for e_type (object file type). */
96 #define ET_NONE 0 /* No file type */
97 #define ET_REL 1 /* Relocatable file */
98 #define ET_EXEC 2 /* Executable file */
99 #define ET_DYN 3 /* Shared object file */
100 #define ET_CORE 4 /* Core file */
101 #define ET_NUM 5 /* Number of defined types. */
102 #define ET_LOPROC 0xff00 /* Processor-specific */
103 #define ET_HIPROC 0xffff /* Processor-specific */
105 /* Legal values for e_machine (architecture). */
107 #define EM_NONE 0 /* No machine */
108 #define EM_M32 1 /* AT&T WE 32100 */
109 #define EM_SPARC 2 /* SUN SPARC */
110 #define EM_386 3 /* Intel 80386 */
111 #define EM_68K 4 /* Motorola m68k family */
112 #define EM_88K 5 /* Motorola m88k family */
113 #define EM_486 6 /* Intel 80486 */
114 #define EM_860 7 /* Intel 80860 */
115 #define EM_MIPS 8 /* MIPS R3000 big-endian */
116 #define EM_S370 9 /* Amdahl */
117 #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
119 #define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */
121 #define EM_PARISC 15 /* HPPA */
123 /* If it is necessary to assign new unofficial EM_* values, please
124 pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
125 chances of collision with official or non-GNU unofficial values. */
127 /* Legal values for e_version (version). */
129 #define EV_NONE 0 /* Invalid ELF version */
130 #define EV_CURRENT 1 /* Current version */
132 /* Section header. */
134 typedef struct
136 Elf32_Word sh_name; /* Section name (string tbl index) */
137 Elf32_Word sh_type; /* Section type */
138 Elf32_Word sh_flags; /* Section flags */
139 Elf32_Addr sh_addr; /* Section virtual addr at execution */
140 Elf32_Off sh_offset; /* Section file offset */
141 Elf32_Word sh_size; /* Section size in bytes */
142 Elf32_Word sh_link; /* Link to another section */
143 Elf32_Word sh_info; /* Additional section information */
144 Elf32_Word sh_addralign; /* Section alignment */
145 Elf32_Word sh_entsize; /* Entry size if section holds table */
146 } Elf32_Shdr;
148 /* Special section indices. */
150 #define SHN_UNDEF 0 /* Undefined section */
151 #define SHN_LORESERVE 0xff00 /* Start of reserved indices */
152 #define SHN_LOPROC 0xff00 /* Start of processor-specific */
153 #define SHN_HIPROC 0xff1f /* End of processor-specific */
154 #define SHN_ABS 0xfff1 /* Associated symbol is absolute */
155 #define SHN_COMMON 0xfff2 /* Associated symbol is common */
156 #define SHN_HIRESERVE 0xffff /* End of reserved indices */
158 /* Legal values for sh_type (section type). */
160 #define SHT_NULL 0 /* Section header table entry unused */
161 #define SHT_PROGBITS 1 /* Program data */
162 #define SHT_SYMTAB 2 /* Symbol table */
163 #define SHT_STRTAB 3 /* String table */
164 #define SHT_RELA 4 /* Relocation entries with addends */
165 #define SHT_HASH 5 /* Symbol hash table */
166 #define SHT_DYNAMIC 6 /* Dynamic linking information */
167 #define SHT_NOTE 7 /* Notes */
168 #define SHT_NOBITS 8 /* Program space with no data (bss) */
169 #define SHT_REL 9 /* Relocation entries, no addends */
170 #define SHT_SHLIB 10 /* Reserved */
171 #define SHT_DYNSYM 11 /* Dynamic linker symbol table */
172 #define SHT_NUM 12 /* Number of defined types. */
173 #define SHT_LOPROC 0x70000000 /* Start of processor-specific */
174 #define SHT_HIPROC 0x7fffffff /* End of processor-specific */
175 #define SHT_LOUSER 0x80000000 /* Start of application-specific */
176 #define SHT_HIUSER 0x8fffffff /* End of application-specific */
178 /* Legal values for sh_flags (section flags). */
180 #define SHF_WRITE (1 << 0) /* Writable */
181 #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
182 #define SHF_EXECINSTR (1 << 2) /* Executable */
183 #define SHF_MASKPROC 0xf0000000 /* Processor-specific */
185 /* Symbol table entry. */
187 typedef struct
189 Elf32_Word st_name; /* Symbol name (string tbl index) */
190 Elf32_Addr st_value; /* Symbol value */
191 Elf32_Word st_size; /* Symbol size */
192 unsigned char st_info; /* Symbol type and binding */
193 unsigned char st_other; /* No defined meaning, 0 */
194 Elf32_Half st_shndx; /* Section index */
195 } Elf32_Sym;
197 /* Special section index. */
199 #define SHN_UNDEF 0 /* No section, undefined symbol. */
201 /* How to extract and insert information held in the st_info field. */
203 #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
204 #define ELF32_ST_TYPE(val) ((val) & 0xf)
205 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
207 /* Legal values for ST_BIND subfield of st_info (symbol binding). */
209 #define STB_LOCAL 0 /* Local symbol */
210 #define STB_GLOBAL 1 /* Global symbol */
211 #define STB_WEAK 2 /* Weak symbol */
212 #define STB_NUM 3 /* Number of defined types. */
213 #define STB_LOPROC 13 /* Start of processor-specific */
214 #define STB_HIPROC 15 /* End of processor-specific */
216 /* Legal values for ST_TYPE subfield of st_info (symbol type). */
218 #define STT_NOTYPE 0 /* Symbol type is unspecified */
219 #define STT_OBJECT 1 /* Symbol is a data object */
220 #define STT_FUNC 2 /* Symbol is a code object */
221 #define STT_SECTION 3 /* Symbol associated with a section */
222 #define STT_FILE 4 /* Symbol's name is file name */
223 #define STT_NUM 5 /* Number of defined types. */
224 #define STT_LOPROC 13 /* Start of processor-specific */
225 #define STT_HIPROC 15 /* End of processor-specific */
228 /* Symbol table indices are found in the hash buckets and chain table
229 of a symbol hash table section. This special index value indicates
230 the end of a chain, meaning no further symbols are found in that bucket. */
232 #define STN_UNDEF 0 /* End of a chain. */
235 /* Relocation table entry without addend (in section of type SHT_REL). */
237 typedef struct
239 Elf32_Addr r_offset; /* Address */
240 Elf32_Word r_info; /* Relocation type and symbol index */
241 } Elf32_Rel;
243 /* Relocation table entry with addend (in section of type SHT_RELA). */
245 typedef struct
247 Elf32_Addr r_offset; /* Address */
248 Elf32_Word r_info; /* Relocation type and symbol index */
249 Elf32_Sword r_addend; /* Addend */
250 } Elf32_Rela;
252 /* How to extract and insert information held in the r_info field. */
254 #define ELF32_R_SYM(val) ((val) >> 8)
255 #define ELF32_R_TYPE(val) ((val) & 0xff)
256 #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
258 /* Program segment header. */
260 typedef struct {
261 Elf32_Word p_type; /* Segment type */
262 Elf32_Off p_offset; /* Segment file offset */
263 Elf32_Addr p_vaddr; /* Segment virtual address */
264 Elf32_Addr p_paddr; /* Segment physical address */
265 Elf32_Word p_filesz; /* Segment size in file */
266 Elf32_Word p_memsz; /* Segment size in memory */
267 Elf32_Word p_flags; /* Segment flags */
268 Elf32_Word p_align; /* Segment alignment */
269 } Elf32_Phdr;
271 /* Legal values for p_type (segment type). */
273 #define PT_NULL 0 /* Program header table entry unused */
274 #define PT_LOAD 1 /* Loadable program segment */
275 #define PT_DYNAMIC 2 /* Dynamic linking information */
276 #define PT_INTERP 3 /* Program interpreter */
277 #define PT_NOTE 4 /* Auxiliary information */
278 #define PT_SHLIB 5 /* Reserved */
279 #define PT_PHDR 6 /* Entry for header table itself */
280 #define PT_NUM 7 /* Number of defined types. */
281 #define PT_LOPROC 0x70000000 /* Start of processor-specific */
282 #define PT_HIPROC 0x7fffffff /* End of processor-specific */
284 /* Legal values for p_flags (segment flags). */
286 #define PF_X (1 << 0) /* Segment is executable */
287 #define PF_W (1 << 1) /* Segment is writable */
288 #define PF_R (1 << 2) /* Segment is readable */
289 #define PF_MASKPROC 0xf0000000 /* Processor-specific */
291 /* Dynamic section entry. */
293 typedef struct
295 Elf32_Sword d_tag; /* Dynamic entry type */
296 union
298 Elf32_Word d_val; /* Integer value */
299 Elf32_Addr d_ptr; /* Address value */
300 } d_un;
301 } Elf32_Dyn;
303 /* Legal values for d_tag (dynamic entry type). */
305 #define DT_NULL 0 /* Marks end of dynamic section */
306 #define DT_NEEDED 1 /* Name of needed library */
307 #define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
308 #define DT_PLTGOT 3 /* Processor defined value */
309 #define DT_HASH 4 /* Address of symbol hash table */
310 #define DT_STRTAB 5 /* Address of string table */
311 #define DT_SYMTAB 6 /* Address of symbol table */
312 #define DT_RELA 7 /* Address of Rela relocs */
313 #define DT_RELASZ 8 /* Total size of Rela relocs */
314 #define DT_RELAENT 9 /* Size of one Rela reloc */
315 #define DT_STRSZ 10 /* Size of string table */
316 #define DT_SYMENT 11 /* Size of one symbol table entry */
317 #define DT_INIT 12 /* Address of init function */
318 #define DT_FINI 13 /* Address of termination function */
319 #define DT_SONAME 14 /* Name of shared object */
320 #define DT_RPATH 15 /* Library search path */
321 #define DT_SYMBOLIC 16 /* Start symbol search here */
322 #define DT_REL 17 /* Address of Rel relocs */
323 #define DT_RELSZ 18 /* Total size of Rel relocs */
324 #define DT_RELENT 19 /* Size of one Rel reloc */
325 #define DT_PLTREL 20 /* Type of reloc in PLT */
326 #define DT_DEBUG 21 /* For debugging; unspecified */
327 #define DT_TEXTREL 22 /* Reloc might modify .text */
328 #define DT_JMPREL 23 /* Address of PLT relocs */
329 #define DT_NUM 24 /* Number used. */
330 #define DT_LOPROC 0x70000000 /* Start of processor-specific */
331 #define DT_HIPROC 0x7fffffff /* End of processor-specific */
333 /* Standard 64 bit ELF types. */
335 typedef unsigned int Elf64_Addr __attribute__ ((mode (DI)));
336 typedef unsigned int Elf64_Half __attribute__ ((mode (HI)));
337 typedef unsigned int Elf64_Off __attribute__ ((mode (DI)));
338 typedef int Elf64_Sword __attribute__ ((mode (SI)));
339 typedef int Elf64_Sxword __attribute__ ((mode (DI)));
340 typedef unsigned int Elf64_Word __attribute__ ((mode (SI)));
341 typedef unsigned int Elf64_Xword __attribute__ ((mode (DI)));
342 typedef unsigned int Elf64_Byte __attribute__ ((mode (QI)));
343 typedef unsigned int Elf64_Section __attribute__ ((mode (HI)));
345 /* 64 bit ELF file header. */
347 typedef struct
349 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
350 Elf64_Half e_type; /* Object file type */
351 Elf64_Half e_machine; /* Architecture */
352 Elf64_Word e_version; /* Object file version */
353 Elf64_Addr e_entry; /* Entry point virtual address */
354 Elf64_Off e_phoff; /* Program header table file offset */
355 Elf64_Off e_shoff; /* Section header table file offset */
356 Elf64_Word e_flags; /* Processor-specific flags */
357 Elf64_Half e_ehsize; /* ELF header size in bytes */
358 Elf64_Half e_phentsize; /* Program header table entry size */
359 Elf64_Half e_phnum; /* Program header table entry count */
360 Elf64_Half e_shentsize; /* Section header table entry size */
361 Elf64_Half e_shnum; /* Section header table entry count */
362 Elf64_Half e_shstrndx; /* Section header string table index */
363 } Elf64_Ehdr;
365 /* 64 bit section header. */
367 typedef struct
369 Elf64_Word sh_name; /* Section name (string tbl index) */
370 Elf64_Word sh_type; /* Section type */
371 Elf64_Xword sh_flags; /* Section flags */
372 Elf64_Addr sh_addr; /* Section virtual addr at execution */
373 Elf64_Off sh_offset; /* Section file offset */
374 Elf64_Xword sh_size; /* Section size in bytes */
375 Elf64_Word sh_link; /* Link to another section */
376 Elf64_Word sh_info; /* Additional section information */
377 Elf64_Xword sh_addralign; /* Section alignment */
378 Elf64_Xword sh_entsize; /* Entry size if section holds table */
379 } Elf64_Shdr;
381 /* 64 bit symbol table entry. */
383 typedef struct
385 Elf64_Word st_name; /* Symbol name (string tbl index) */
386 Elf64_Byte st_info; /* Symbol type and binding */
387 Elf64_Byte st_other; /* No defined meaning, 0 */
388 Elf64_Section st_shndx; /* Section index */
389 Elf64_Addr st_value; /* Symbol value */
390 Elf64_Xword st_size; /* Symbol size */
391 } Elf64_Sym;
393 /* The 64 bit st_info field is the same as the 32 bit one. */
395 #define ELF64_ST_BIND(val) (((unsigned char) (val)) >> 4)
396 #define ELF64_ST_TYPE(val) ((val) & 0xf)
397 #define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
399 /* I have seen two different definitions of the Elf64_Rel and
400 Elf64_Rela structures, so we'll leave them out until Novell (or
401 whoever) gets their act together. */
403 /* Auxiliary vector. */
405 /* This vector is normally only used by the program interpreter. The
406 usual definition in an ABI supplement uses the name auxv_t. The
407 vector is not usually defined in a standard <elf.h> file, but it
408 can't hurt. We rename it to avoid conflicts. The sizes of these
409 types are an arrangement between the exec server and the program
410 interpreter, so we don't fully specify them here. */
412 typedef struct
414 int a_type; /* Entry type */
415 union
417 long a_val; /* Integer value */
418 void *a_ptr; /* Pointer value */
419 void (*a_fcn) (); /* Function pointer value */
420 } a_un;
421 } Elf32_auxv_t;
423 /* Legal values for a_type (entry type). */
425 #define AT_NULL 0 /* End of vector */
426 #define AT_IGNORE 1 /* Entry should be ignored */
427 #define AT_EXECFD 2 /* File descriptor of program */
428 #define AT_PHDR 3 /* Program headers for program */
429 #define AT_PHENT 4 /* Size of program header entry */
430 #define AT_PHNUM 5 /* Number of program headers */
431 #define AT_PAGESZ 6 /* System page size */
432 #define AT_BASE 7 /* Base address of interpreter */
433 #define AT_FLAGS 8 /* Flags */
434 #define AT_ENTRY 9 /* Entry point of program */
435 #define AT_NOTELF 10 /* Program is not ELF */
436 #define AT_UID 11 /* Real uid */
437 #define AT_EUID 12 /* Effective uid */
438 #define AT_GID 13 /* Real gid */
439 #define AT_EGID 14 /* Effective gid */
441 /* Intel 80386 specific definitions. */
443 /* i386 relocs. */
445 #define R_386_NONE 0 /* No reloc */
446 #define R_386_32 1 /* Direct 32 bit */
447 #define R_386_PC32 2 /* PC relative 32 bit */
448 #define R_386_GOT32 3 /* 32 bit GOT entry */
449 #define R_386_PLT32 4 /* 32 bit PLT address */
450 #define R_386_COPY 5 /* Copy symbol at runtime */
451 #define R_386_GLOB_DAT 6 /* Create GOT entry */
452 #define R_386_JMP_SLOT 7 /* Create PLT entry */
453 #define R_386_RELATIVE 8 /* Adjust by program base */
454 #define R_386_GOTOFF 9 /* 32 bit offset to GOT */
455 #define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
457 /* SUN SPARC specific definitions. */
459 /* SPARC relocs. */
461 #define R_SPARC_NONE 0 /* No reloc */
462 #define R_SPARC_8 1 /* Direct 8 bit */
463 #define R_SPARC_16 2 /* Direct 16 bit */
464 #define R_SPARC_32 3 /* Direct 32 bit */
465 #define R_SPARC_DISP8 4 /* PC relative 8 bit */
466 #define R_SPARC_DISP16 5 /* PC relative 16 bit */
467 #define R_SPARC_DISP32 6 /* PC relative 32 bit */
468 #define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
469 #define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
470 #define R_SPARC_HI22 9 /* High 22 bit */
471 #define R_SPARC_22 10 /* Direct 22 bit */
472 #define R_SPARC_13 11 /* Direct 13 bit */
473 #define R_SPARC_LO10 12 /* Truncated 10 bit */
474 #define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
475 #define R_SPARC_GOT13 14 /* 13 bit GOT entry */
476 #define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
477 #define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
478 #define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
479 #define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
480 #define R_SPARC_COPY 19 /* Copy symbol at runtime */
481 #define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
482 #define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
483 #define R_SPARC_RELATIVE 22 /* Adjust by program base */
484 #define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
486 /* MIPS R3000 specific definitions. */
488 /* Legal values for e_flags field of Elf32_Ehdr. */
490 #define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
491 #define EF_MIPS_PIC 2 /* Contains PIC code */
492 #define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
493 #define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
495 /* Special section indices. */
497 #define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
498 #define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
499 #define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
501 /* Legal values for sh_type field of Elf32_Shdr. */
503 #define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
504 #define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
505 #define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
506 #define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
507 #define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
508 #define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
510 /* Legal values for sh_flags field of Elf32_Shdr. */
512 #define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
514 /* Entries found in sections of type SHT_MIPS_GPTAB. */
516 typedef union
518 struct
520 Elf32_Word gt_current_g_value; /* -G value used for compilation */
521 Elf32_Word gt_unused; /* Not used */
522 } gt_header; /* First entry in section */
523 struct
525 Elf32_Word gt_g_value; /* If this value were used for -G */
526 Elf32_Word gt_bytes; /* This many bytes would be used */
527 } gt_entry; /* Subsequent entries in section */
528 } Elf32_gptab;
530 /* Entry found in sections of type SHT_MIPS_REGINFO. */
532 typedef struct
534 Elf32_Word ri_gprmask; /* General registers used */
535 Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
536 Elf32_Sword ri_gp_value; /* $gp register value */
537 } Elf32_RegInfo;
539 /* MIPS relocs. */
541 #define R_MIPS_NONE 0 /* No reloc */
542 #define R_MIPS_16 1 /* Direct 16 bit */
543 #define R_MIPS_32 2 /* Direct 32 bit */
544 #define R_MIPS_REL32 3 /* PC relative 32 bit */
545 #define R_MIPS_26 4 /* Direct 26 bit shifted */
546 #define R_MIPS_HI16 5 /* High 16 bit */
547 #define R_MIPS_LO16 6 /* Low 16 bit */
548 #define R_MIPS_GPREL16 7 /* GP relative 16 bit */
549 #define R_MIPS_LITERAL 8 /* 16 bit literal entry */
550 #define R_MIPS_GOT16 9 /* 16 bit GOT entry */
551 #define R_MIPS_PC16 10 /* PC relative 16 bit */
552 #define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
553 #define R_MIPS_GPREL32 12 /* GP relative 32 bit */
555 /* Legal values for p_type field of Elf32_Phdr. */
557 #define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
559 /* Legal values for d_tag field of Elf32_Dyn. */
561 #define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
562 #define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
563 #define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
564 #define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
565 #define DT_MIPS_FLAGS 0x70000005 /* Flags */
566 #define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
567 #define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
568 #define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
569 #define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
570 #define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
571 #define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
572 #define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
573 #define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
574 #define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
575 #define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
577 /* Legal values for DT_MIPS_FLAG Elf32_Dyn entry. */
579 #define RHF_NONE 0 /* No flags */
580 #define RHF_QUICKSTART (1 << 0) /* Use quickstart */
581 #define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
582 #define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
584 /* Entries found in sections of type SHT_MIPS_LIBLIST. */
586 typedef struct
588 Elf32_Word l_name; /* Name (string table index) */
589 Elf32_Word l_time_stamp; /* Timestamp */
590 Elf32_Word l_checksum; /* Checksum */
591 Elf32_Word l_version; /* Interface version */
592 Elf32_Word l_flags; /* Flags */
593 } Elf32_Lib;
595 /* Legal values for l_flags. */
597 #define LL_EXACT_MATCH (1 << 0) /* Require exact match */
598 #define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
600 /* Entries found in sections of type SHT_MIPS_CONFLICT. */
602 typedef Elf32_Addr Elf32_Conflict;
605 #endif /* elf.h */