00001 /* 00002 * elf.h - SimpleScalar ELF definitions 00003 * 00004 * This file is a part of the SimpleScalar tool suite written by 00005 * Todd M. Austin as a part of the Multiscalar Research Project. 00006 * 00007 * The tool suite is currently maintained by Doug Burger and Todd M. Austin. 00008 * 00009 * Copyright (C) 1994, 1995, 1996, 1997 by Todd M. Austin 00010 * 00011 * This source file is distributed "as is" in the hope that it will be 00012 * useful. The tool set comes with no warranty, and no author or 00013 * distributor accepts any responsibility for the consequences of its 00014 * use. 00015 * 00016 * Everyone is granted permission to copy, modify and redistribute 00017 * this tool set under the following conditions: 00018 * 00019 * This source code is distributed for non-commercial use only. 00020 * Please contact the maintainer for restrictions applying to 00021 * commercial use. 00022 * 00023 * Permission is granted to anyone to make or distribute copies 00024 * of this source code, either as received or modified, in any 00025 * medium, provided that all copyright notices, permission and 00026 * nonwarranty notices are preserved, and that the distributor 00027 * grants the recipient permission for further redistribution as 00028 * permitted by this document. 00029 * 00030 * Permission is granted to distribute this file in compiled 00031 * or executable form under the same conditions that apply for 00032 * source code, provided that either: 00033 * 00034 * A. it is accompanied by the corresponding machine-readable 00035 * source code, 00036 * B. it is accompanied by a written offer, with no time limit, 00037 * to give anyone a machine-readable copy of the corresponding 00038 * source code in return for reimbursement of the cost of 00039 * distribution. This written offer must permit verbatim 00040 * duplication by anyone, or 00041 * C. it is distributed by someone who received only the 00042 * executable form, and is accompanied by a copy of the 00043 * written offer of source code that they received concurrently. 00044 * 00045 * In other words, you are welcome to use, share and improve this 00046 * source file. You are forbidden to forbid anyone else to use, share 00047 * and improve what you give them. 00048 * 00049 * INTERNET: dburger@cs.wisc.edu 00050 * US Mail: 1210 W. Dayton Street, Madison, WI 53706 00051 * 00052 * $Id: elf.h,v 1.1.1.1 2003/09/18 00:57:55 panalyzer Exp $ 00053 * 00054 * $Log: elf.h,v $ 00055 * Revision 1.1.1.1 2003/09/18 00:57:55 panalyzer 00056 * 00057 * 00058 * Revision 1.1.1.1 2003/09/18 00:18:45 panalyzer 00059 * 00060 * 00061 * Revision 1.1.1.1 2003/09/16 18:48:14 gdm 00062 * 00063 * 00064 * Revision 1.1.1.1 2000/11/29 14:53:54 cu-cs 00065 * Grand unification of arm sources. 00066 * 00067 * 00068 * Revision 1.1.2.1 2000/07/21 18:34:59 taustin 00069 * More progress on the SimpleScalar/ARM target. 00070 * 00071 * Revision 1.1.1.1 2000/05/26 15:22:27 taustin 00072 * SimpleScalar Tool Set 00073 * 00074 * 00075 * Revision 1.2 1999/12/31 18:57:49 taustin 00076 * quad_t naming conflicts removed 00077 * 00078 * Revision 1.1 1998/08/27 16:54:03 taustin 00079 * Initial revision 00080 * 00081 * Revision 1.1 1998/05/06 01:09:18 calder 00082 * Initial revision 00083 * 00084 * Revision 1.1 1997/04/16 22:13:35 taustin 00085 * Initial revision 00086 * 00087 * 00088 */ 00089 00090 /* SimpleScalar ELF definitions */ 00091 00092 #ifndef ELF_H 00093 #define ELF_H 00094 00095 #include "arm.h" 00096 00097 00098 /* Fields in the e_ident array. The EI_* macros are indices into the 00099 array. The macros under each EI_* macro are the values the byte 00100 may have. */ 00101 00102 #define EI_MAG0 0 /* File identification byte 0 index */ 00103 #define ELFMAG0 0x7f /* Magic number byte 0 */ 00104 00105 #define EI_MAG1 1 /* File identification byte 1 index */ 00106 #define ELFMAG1 'E' /* Magic number byte 1 */ 00107 00108 #define EI_MAG2 2 /* File identification byte 2 index */ 00109 #define ELFMAG2 'L' /* Magic number byte 2 */ 00110 00111 #define EI_MAG3 3 /* File identification byte 3 index */ 00112 #define ELFMAG3 'F' /* Magic number byte 3 */ 00113 00114 00115 /* Legal values for e_type (object file type). */ 00116 00117 #define ET_NONE 0 /* No file type */ 00118 #define ET_REL 1 /* Relocatable file */ 00119 #define ET_EXEC 2 /* Executable file */ 00120 #define ET_DYN 3 /* Shared object file */ 00121 #define ET_CORE 4 /* Core file */ 00122 #define ET_NUM 5 /* Number of defined types. */ 00123 #define ET_LOPROC 0xff00 /* Processor-specific */ 00124 #define ET_HIPROC 0xffff /* Processor-specific */ 00125 00126 00127 /* Legal values for e_machine (architecture). */ 00128 00129 #define EM_NONE 0 /* No machine */ 00130 #define EM_M32 1 /* AT&T WE 32100 */ 00131 #define EM_SPARC 2 /* SUN SPARC */ 00132 #define EM_386 3 /* Intel 80386 */ 00133 #define EM_68K 4 /* Motorola m68k family */ 00134 #define EM_88K 5 /* Motorola m88k family */ 00135 #define EM_486 6 /* Intel 80486 */ 00136 #define EM_860 7 /* Intel 80860 */ 00137 #define EM_MIPS 8 /* MIPS R3000 big-endian */ 00138 #define EM_S370 9 /* Amdahl */ 00139 #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ 00140 #define EM_PARISC 15 /* HPPA */ 00141 #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 00142 #define EM_PPC 20 /* PowerPC */ 00143 #define EM_ARM 40 /* ARM */ 00144 #define EM_SPARCV9 43 /* SPARC v9 64-bit */ 00145 00146 00147 /* Special section indices. */ 00148 00149 #define SHN_UNDEF 0 /* Undefined section */ 00150 #define SHN_LORESERVE 0xff00 /* Start of reserved indices */ 00151 #define SHN_LOPROC 0xff00 /* Start of processor-specific */ 00152 #define SHN_HIPROC 0xff1f /* End of processor-specific */ 00153 #define SHN_ABS 0xfff1 /* Associated symbol is absolute */ 00154 #define SHN_COMMON 0xfff2 /* Associated symbol is common */ 00155 #define SHN_HIRESERVE 0xffff /* End of reserved indices */ 00156 00157 00158 /* Legal values for sh_type (section type). */ 00159 00160 #define SHT_NULL 0 /* Section header table entry unused */ 00161 #define SHT_PROGBITS 1 /* Program data */ 00162 #define SHT_SYMTAB 2 /* Symbol table */ 00163 #define SHT_STRTAB 3 /* String table */ 00164 #define SHT_RELA 4 /* Relocation entries with addends */ 00165 #define SHT_HASH 5 /* Symbol hash table */ 00166 #define SHT_DYNAMIC 6 /* Dynamic linking information */ 00167 #define SHT_NOTE 7 /* Notes */ 00168 #define SHT_NOBITS 8 /* Program space with no data (bss) */ 00169 #define SHT_REL 9 /* Relocation entries, no addends */ 00170 #define SHT_SHLIB 10 /* Reserved */ 00171 #define SHT_DYNSYM 11 /* Dynamic linker symbol table */ 00172 #define SHT_NUM 12 /* Number of defined types. */ 00173 #define SHT_LOSUNW 0x6ffffffd /* Sun-specific low bound. */ 00174 #define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ 00175 #define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ 00176 #define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ 00177 #define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ 00178 #define SHT_LOPROC 0x70000000 /* Start of processor-specific */ 00179 #define SHT_HIPROC 0x7fffffff /* End of processor-specific */ 00180 #define SHT_LOUSER 0x80000000 /* Start of application-specific */ 00181 #define SHT_HIUSER 0x8fffffff /* End of application-specific */ 00182 00183 00184 /* Legal values for sh_flags (section flags). */ 00185 00186 #define SHF_WRITE (1 << 0) /* Writable */ 00187 #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ 00188 #define SHF_EXECINSTR (1 << 2) /* Executable */ 00189 #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ 00190 00191 #define EI_NIDENT (16) 00192 00193 00194 struct elf_filehdr 00195 { 00196 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ 00197 half_t e_type; /* Object file type */ 00198 half_t e_machine; /* Architecture */ 00199 word_t e_version; /* Object file version */ 00200 md_addr_t e_entry; /* Entry point virtual address */ 00201 word_t e_phoff; /* Program header table file offset */ 00202 word_t e_shoff; /* Section header table file offset */ 00203 word_t e_flags; /* Processor-specific flags */ 00204 half_t e_ehsize; /* ELF header size in bytes */ 00205 half_t e_phentsize; /* Program header table entry size */ 00206 half_t e_phnum; /* Program header table entry count */ 00207 half_t e_shentsize; /* Section header table entry size */ 00208 half_t e_shnum; /* Section header table entry count */ 00209 half_t e_shstrndx; /* Section header string table index */ 00210 }; 00211 00212 struct elf_scnhdr 00213 { 00214 word_t sh_name; /* Section name (string tbl index) */ 00215 word_t sh_type; /* Section type */ 00216 word_t sh_flags; /* Section flags */ 00217 md_addr_t sh_addr; /* Section virtual addr at execution */ 00218 word_t sh_offset; /* Section file offset */ 00219 word_t sh_size; /* Section size in bytes */ 00220 word_t sh_link; /* Link to another section */ 00221 word_t sh_info; /* Additional section information */ 00222 word_t sh_addralign; /* Section alignment */ 00223 word_t sh_entsize; /* Entry size if section holds table */ 00224 }; 00225 00226 #endif /* ELF_H */