Phoenix
Object-oriented orthogonally persistent operating system
|
00001 /* 00002 ext_types.h - external representation of ELF data types. 00003 Copyright (C) 1995 - 1998 Michael Riepe 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 /* @(#) $Id: ext_types.h 153 2010-11-10 06:26:43Z vagran $ */ 00021 00022 #ifndef _EXT_TYPES_H 00023 #define _EXT_TYPES_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif /* __cplusplus */ 00028 00029 /* 00030 * Scalar data types 00031 */ 00032 typedef unsigned char __ext_Elf32_Addr [ELF32_FSZ_ADDR]; 00033 typedef unsigned char __ext_Elf32_Half [ELF32_FSZ_HALF]; 00034 typedef unsigned char __ext_Elf32_Off [ELF32_FSZ_OFF]; 00035 typedef unsigned char __ext_Elf32_Sword [ELF32_FSZ_SWORD]; 00036 typedef unsigned char __ext_Elf32_Word [ELF32_FSZ_WORD]; 00037 00038 #if __LIBELF64 00039 00040 typedef unsigned char __ext_Elf32_Lword [8]; 00041 00042 typedef unsigned char __ext_Elf64_Addr [ELF64_FSZ_ADDR]; 00043 typedef unsigned char __ext_Elf64_Half [ELF64_FSZ_HALF]; 00044 typedef unsigned char __ext_Elf64_Off [ELF64_FSZ_OFF]; 00045 typedef unsigned char __ext_Elf64_Sword [ELF64_FSZ_SWORD]; 00046 typedef unsigned char __ext_Elf64_Word [ELF64_FSZ_WORD]; 00047 typedef unsigned char __ext_Elf64_Sxword[ELF64_FSZ_SXWORD]; 00048 typedef unsigned char __ext_Elf64_Xword [ELF64_FSZ_XWORD]; 00049 00050 typedef unsigned char __ext_Elf64_Lword [8]; 00051 00052 #endif /* __LIBELF64 */ 00053 00054 /* 00055 * ELF header 00056 */ 00057 typedef struct { 00058 unsigned char e_ident[EI_NIDENT]; 00059 __ext_Elf32_Half e_type; 00060 __ext_Elf32_Half e_machine; 00061 __ext_Elf32_Word e_version; 00062 __ext_Elf32_Addr e_entry; 00063 __ext_Elf32_Off e_phoff; 00064 __ext_Elf32_Off e_shoff; 00065 __ext_Elf32_Word e_flags; 00066 __ext_Elf32_Half e_ehsize; 00067 __ext_Elf32_Half e_phentsize; 00068 __ext_Elf32_Half e_phnum; 00069 __ext_Elf32_Half e_shentsize; 00070 __ext_Elf32_Half e_shnum; 00071 __ext_Elf32_Half e_shstrndx; 00072 } __ext_Elf32_Ehdr; 00073 00074 #if __LIBELF64 00075 typedef struct { 00076 unsigned char e_ident[EI_NIDENT]; 00077 __ext_Elf64_Half e_type; 00078 __ext_Elf64_Half e_machine; 00079 __ext_Elf64_Word e_version; 00080 __ext_Elf64_Addr e_entry; 00081 __ext_Elf64_Off e_phoff; 00082 __ext_Elf64_Off e_shoff; 00083 __ext_Elf64_Word e_flags; 00084 __ext_Elf64_Half e_ehsize; 00085 __ext_Elf64_Half e_phentsize; 00086 __ext_Elf64_Half e_phnum; 00087 __ext_Elf64_Half e_shentsize; 00088 __ext_Elf64_Half e_shnum; 00089 __ext_Elf64_Half e_shstrndx; 00090 } __ext_Elf64_Ehdr; 00091 #endif /* __LIBELF64 */ 00092 00093 /* 00094 * Section header 00095 */ 00096 typedef struct { 00097 __ext_Elf32_Word sh_name; 00098 __ext_Elf32_Word sh_type; 00099 __ext_Elf32_Word sh_flags; 00100 __ext_Elf32_Addr sh_addr; 00101 __ext_Elf32_Off sh_offset; 00102 __ext_Elf32_Word sh_size; 00103 __ext_Elf32_Word sh_link; 00104 __ext_Elf32_Word sh_info; 00105 __ext_Elf32_Word sh_addralign; 00106 __ext_Elf32_Word sh_entsize; 00107 } __ext_Elf32_Shdr; 00108 00109 #if __LIBELF64 00110 typedef struct { 00111 __ext_Elf64_Word sh_name; 00112 __ext_Elf64_Word sh_type; 00113 __ext_Elf64_Xword sh_flags; 00114 __ext_Elf64_Addr sh_addr; 00115 __ext_Elf64_Off sh_offset; 00116 __ext_Elf64_Xword sh_size; 00117 __ext_Elf64_Word sh_link; 00118 __ext_Elf64_Word sh_info; 00119 __ext_Elf64_Xword sh_addralign; 00120 __ext_Elf64_Xword sh_entsize; 00121 } __ext_Elf64_Shdr; 00122 #endif /* __LIBELF64 */ 00123 00124 /* 00125 * Symbol table 00126 */ 00127 typedef struct { 00128 __ext_Elf32_Word st_name; 00129 __ext_Elf32_Addr st_value; 00130 __ext_Elf32_Word st_size; 00131 unsigned char st_info; 00132 unsigned char st_other; 00133 __ext_Elf32_Half st_shndx; 00134 } __ext_Elf32_Sym; 00135 00136 #if __LIBELF64 00137 typedef struct { 00138 __ext_Elf64_Word st_name; 00139 unsigned char st_info; 00140 unsigned char st_other; 00141 __ext_Elf64_Half st_shndx; 00142 __ext_Elf64_Addr st_value; 00143 __ext_Elf64_Xword st_size; 00144 } __ext_Elf64_Sym; 00145 #endif /* __LIBELF64 */ 00146 00147 /* 00148 * Relocation 00149 */ 00150 typedef struct { 00151 __ext_Elf32_Addr r_offset; 00152 __ext_Elf32_Word r_info; 00153 } __ext_Elf32_Rel; 00154 00155 typedef struct { 00156 __ext_Elf32_Addr r_offset; 00157 __ext_Elf32_Word r_info; 00158 __ext_Elf32_Sword r_addend; 00159 } __ext_Elf32_Rela; 00160 00161 #if __LIBELF64 00162 typedef struct { 00163 __ext_Elf64_Addr r_offset; 00164 #if __LIBELF64_IRIX 00165 __ext_Elf64_Word r_sym; 00166 unsigned char r_ssym; 00167 unsigned char r_type3; 00168 unsigned char r_type2; 00169 unsigned char r_type; 00170 #else /* __LIBELF64_IRIX */ 00171 __ext_Elf64_Xword r_info; 00172 #endif /* __LIBELF64_IRIX */ 00173 } __ext_Elf64_Rel; 00174 00175 typedef struct { 00176 __ext_Elf64_Addr r_offset; 00177 #if __LIBELF64_IRIX 00178 __ext_Elf64_Word r_sym; 00179 unsigned char r_ssym; 00180 unsigned char r_type3; 00181 unsigned char r_type2; 00182 unsigned char r_type; 00183 #else /* __LIBELF64_IRIX */ 00184 __ext_Elf64_Xword r_info; 00185 #endif /* __LIBELF64_IRIX */ 00186 __ext_Elf64_Sxword r_addend; 00187 } __ext_Elf64_Rela; 00188 #endif /* __LIBELF64 */ 00189 00190 /* 00191 * Program header 00192 */ 00193 typedef struct { 00194 __ext_Elf32_Word p_type; 00195 __ext_Elf32_Off p_offset; 00196 __ext_Elf32_Addr p_vaddr; 00197 __ext_Elf32_Addr p_paddr; 00198 __ext_Elf32_Word p_filesz; 00199 __ext_Elf32_Word p_memsz; 00200 __ext_Elf32_Word p_flags; 00201 __ext_Elf32_Word p_align; 00202 } __ext_Elf32_Phdr; 00203 00204 #if __LIBELF64 00205 typedef struct { 00206 __ext_Elf64_Word p_type; 00207 __ext_Elf64_Word p_flags; 00208 __ext_Elf64_Off p_offset; 00209 __ext_Elf64_Addr p_vaddr; 00210 __ext_Elf64_Addr p_paddr; 00211 __ext_Elf64_Xword p_filesz; 00212 __ext_Elf64_Xword p_memsz; 00213 __ext_Elf64_Xword p_align; 00214 } __ext_Elf64_Phdr; 00215 #endif /* __LIBELF64 */ 00216 00217 /* 00218 * Dynamic structure 00219 */ 00220 typedef struct { 00221 __ext_Elf32_Sword d_tag; 00222 union { 00223 __ext_Elf32_Word d_val; 00224 __ext_Elf32_Addr d_ptr; 00225 } d_un; 00226 } __ext_Elf32_Dyn; 00227 00228 #if __LIBELF64 00229 typedef struct { 00230 __ext_Elf64_Sxword d_tag; 00231 union { 00232 __ext_Elf64_Xword d_val; 00233 __ext_Elf64_Addr d_ptr; 00234 } d_un; 00235 } __ext_Elf64_Dyn; 00236 #endif /* __LIBELF64 */ 00237 00238 /* 00239 * Version definitions 00240 */ 00241 typedef struct { 00242 __ext_Elf32_Half vd_version; 00243 __ext_Elf32_Half vd_flags; 00244 __ext_Elf32_Half vd_ndx; 00245 __ext_Elf32_Half vd_cnt; 00246 __ext_Elf32_Word vd_hash; 00247 __ext_Elf32_Word vd_aux; 00248 __ext_Elf32_Word vd_next; 00249 } __ext_Elf32_Verdef; 00250 00251 typedef struct { 00252 __ext_Elf32_Word vda_name; 00253 __ext_Elf32_Word vda_next; 00254 } __ext_Elf32_Verdaux; 00255 00256 typedef struct { 00257 __ext_Elf32_Half vn_version; 00258 __ext_Elf32_Half vn_cnt; 00259 __ext_Elf32_Word vn_file; 00260 __ext_Elf32_Word vn_aux; 00261 __ext_Elf32_Word vn_next; 00262 } __ext_Elf32_Verneed; 00263 00264 typedef struct { 00265 __ext_Elf32_Word vna_hash; 00266 __ext_Elf32_Half vna_flags; 00267 __ext_Elf32_Half vna_other; 00268 __ext_Elf32_Word vna_name; 00269 __ext_Elf32_Word vna_next; 00270 } __ext_Elf32_Vernaux; 00271 00272 #if __LIBELF64 00273 00274 typedef struct { 00275 __ext_Elf64_Half vd_version; 00276 __ext_Elf64_Half vd_flags; 00277 __ext_Elf64_Half vd_ndx; 00278 __ext_Elf64_Half vd_cnt; 00279 __ext_Elf64_Word vd_hash; 00280 __ext_Elf64_Word vd_aux; 00281 __ext_Elf64_Word vd_next; 00282 } __ext_Elf64_Verdef; 00283 00284 typedef struct { 00285 __ext_Elf64_Word vda_name; 00286 __ext_Elf64_Word vda_next; 00287 } __ext_Elf64_Verdaux; 00288 00289 typedef struct { 00290 __ext_Elf64_Half vn_version; 00291 __ext_Elf64_Half vn_cnt; 00292 __ext_Elf64_Word vn_file; 00293 __ext_Elf64_Word vn_aux; 00294 __ext_Elf64_Word vn_next; 00295 } __ext_Elf64_Verneed; 00296 00297 typedef struct { 00298 __ext_Elf64_Word vna_hash; 00299 __ext_Elf64_Half vna_flags; 00300 __ext_Elf64_Half vna_other; 00301 __ext_Elf64_Word vna_name; 00302 __ext_Elf64_Word vna_next; 00303 } __ext_Elf64_Vernaux; 00304 00305 #endif /* __LIBELF64 */ 00306 00307 /* 00308 * Move section 00309 */ 00310 #if __LIBELF64 00311 00312 typedef struct { 00313 __ext_Elf32_Lword m_value; 00314 __ext_Elf32_Word m_info; 00315 __ext_Elf32_Word m_poffset; 00316 __ext_Elf32_Half m_repeat; 00317 __ext_Elf32_Half m_stride; 00318 } __ext_Elf32_Move; 00319 00320 typedef struct { 00321 __ext_Elf64_Lword m_value; 00322 __ext_Elf64_Xword m_info; 00323 __ext_Elf64_Xword m_poffset; 00324 __ext_Elf64_Half m_repeat; 00325 __ext_Elf64_Half m_stride; 00326 } __ext_Elf64_Move; 00327 00328 #endif /* __LIBELF64 */ 00329 00330 #ifdef __cplusplus 00331 } 00332 #endif /* __cplusplus */ 00333 00334 #endif /* _EXT_TYPES_H */