00001 #ifndef _QEMU_ELF_H
00002 #define _QEMU_ELF_H
00003
00004 #include <inttypes.h>
00005
00006
00007 typedef uint32_t Elf32_Addr;
00008 typedef uint16_t Elf32_Half;
00009 typedef uint32_t Elf32_Off;
00010 typedef int32_t Elf32_Sword;
00011 typedef uint32_t Elf32_Word;
00012
00013
00014 typedef uint64_t Elf64_Addr;
00015 typedef uint16_t Elf64_Half;
00016 typedef int16_t Elf64_SHalf;
00017 typedef uint64_t Elf64_Off;
00018 typedef int32_t Elf64_Sword;
00019 typedef uint32_t Elf64_Word;
00020 typedef uint64_t Elf64_Xword;
00021 typedef int64_t Elf64_Sxword;
00022
00023
00024 #define PT_NULL 0
00025 #define PT_LOAD 1
00026 #define PT_DYNAMIC 2
00027 #define PT_INTERP 3
00028 #define PT_NOTE 4
00029 #define PT_SHLIB 5
00030 #define PT_PHDR 6
00031 #define PT_LOPROC 0x70000000
00032 #define PT_HIPROC 0x7fffffff
00033 #define PT_MIPS_REGINFO 0x70000000
00034 #define PT_MIPS_OPTIONS 0x70000001
00035
00036
00037
00038 #define EF_MIPS_ARCH_1 0x00000000
00039 #define EF_MIPS_ARCH_2 0x10000000
00040 #define EF_MIPS_ARCH_3 0x20000000
00041 #define EF_MIPS_ARCH_4 0x30000000
00042 #define EF_MIPS_ARCH_5 0x40000000
00043 #define EF_MIPS_ARCH_32 0x50000000
00044 #define EF_MIPS_ARCH_64 0x60000000
00045
00046
00047 #define EF_MIPS_ABI_O32 0x00001000
00048 #define EF_MIPS_ABI_O64 0x00002000
00049
00050 #define EF_MIPS_NOREORDER 0x00000001
00051 #define EF_MIPS_PIC 0x00000002
00052 #define EF_MIPS_CPIC 0x00000004
00053 #define EF_MIPS_ABI2 0x00000020
00054 #define EF_MIPS_OPTIONS_FIRST 0x00000080
00055 #define EF_MIPS_32BITMODE 0x00000100
00056 #define EF_MIPS_ABI 0x0000f000
00057 #define EF_MIPS_ARCH 0xf0000000
00058
00059
00060 #define ET_NONE 0
00061 #define ET_REL 1
00062 #define ET_EXEC 2
00063 #define ET_DYN 3
00064 #define ET_CORE 4
00065 #define ET_LOPROC 0xff00
00066 #define ET_HIPROC 0xffff
00067
00068
00069 #define EM_NONE 0
00070 #define EM_M32 1
00071 #define EM_SPARC 2
00072 #define EM_386 3
00073 #define EM_68K 4
00074 #define EM_88K 5
00075 #define EM_486 6
00076 #define EM_860 7
00077
00078 #define EM_MIPS 8
00079
00080 #define EM_MIPS_RS4_BE 10
00081
00082 #define EM_PARISC 15
00083
00084 #define EM_SPARC32PLUS 18
00085
00086 #define EM_PPC 20
00087 #define EM_PPC64 21
00088
00089 #define EM_ARM 40
00090
00091 #define EM_SH 42
00092
00093 #define EM_SPARCV9 43
00094
00095 #define EM_IA_64 50
00096
00097 #define EM_X86_64 62
00098
00099 #define EM_S390 22
00100
00101 #define EM_CRIS 76
00102
00103 #define EM_V850 87
00104
00105 #define EM_H8_300H 47
00106 #define EM_H8S 48
00107
00108
00109
00110
00111
00112 #define EM_ALPHA 0x9026
00113
00114
00115 #define EM_CYGNUS_V850 0x9080
00116
00117
00118
00119
00120 #define EM_S390_OLD 0xA390
00121
00122
00123 #define DT_NULL 0
00124 #define DT_NEEDED 1
00125 #define DT_PLTRELSZ 2
00126 #define DT_PLTGOT 3
00127 #define DT_HASH 4
00128 #define DT_STRTAB 5
00129 #define DT_SYMTAB 6
00130 #define DT_RELA 7
00131 #define DT_RELASZ 8
00132 #define DT_RELAENT 9
00133 #define DT_STRSZ 10
00134 #define DT_SYMENT 11
00135 #define DT_INIT 12
00136 #define DT_FINI 13
00137 #define DT_SONAME 14
00138 #define DT_RPATH 15
00139 #define DT_SYMBOLIC 16
00140 #define DT_REL 17
00141 #define DT_RELSZ 18
00142 #define DT_RELENT 19
00143 #define DT_PLTREL 20
00144 #define DT_DEBUG 21
00145 #define DT_TEXTREL 22
00146 #define DT_JMPREL 23
00147 #define DT_LOPROC 0x70000000
00148 #define DT_HIPROC 0x7fffffff
00149 #define DT_MIPS_RLD_VERSION 0x70000001
00150 #define DT_MIPS_TIME_STAMP 0x70000002
00151 #define DT_MIPS_ICHECKSUM 0x70000003
00152 #define DT_MIPS_IVERSION 0x70000004
00153 #define DT_MIPS_FLAGS 0x70000005
00154 #define RHF_NONE 0
00155 #define RHF_HARDWAY 1
00156 #define RHF_NOTPOT 2
00157 #define DT_MIPS_BASE_ADDRESS 0x70000006
00158 #define DT_MIPS_CONFLICT 0x70000008
00159 #define DT_MIPS_LIBLIST 0x70000009
00160 #define DT_MIPS_LOCAL_GOTNO 0x7000000a
00161 #define DT_MIPS_CONFLICTNO 0x7000000b
00162 #define DT_MIPS_LIBLISTNO 0x70000010
00163 #define DT_MIPS_SYMTABNO 0x70000011
00164 #define DT_MIPS_UNREFEXTNO 0x70000012
00165 #define DT_MIPS_GOTSYM 0x70000013
00166 #define DT_MIPS_HIPAGENO 0x70000014
00167 #define DT_MIPS_RLD_MAP 0x70000016
00168
00169
00170 #define STB_LOCAL 0
00171 #define STB_GLOBAL 1
00172 #define STB_WEAK 2
00173
00174 #define STT_NOTYPE 0
00175 #define STT_OBJECT 1
00176 #define STT_FUNC 2
00177 #define STT_SECTION 3
00178 #define STT_FILE 4
00179
00180 #define ELF_ST_BIND(x) ((x) >> 4)
00181 #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
00182 #define ELF32_ST_BIND(x) ELF_ST_BIND(x)
00183 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
00184 #define ELF64_ST_BIND(x) ELF_ST_BIND(x)
00185 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
00186
00187
00188
00189 #define AT_NULL 0
00190 #define AT_IGNORE 1
00191 #define AT_EXECFD 2
00192 #define AT_PHDR 3
00193 #define AT_PHENT 4
00194 #define AT_PHNUM 5
00195 #define AT_PAGESZ 6
00196 #define AT_BASE 7
00197 #define AT_FLAGS 8
00198 #define AT_ENTRY 9
00199 #define AT_NOTELF 10
00200 #define AT_UID 11
00201 #define AT_EUID 12
00202 #define AT_GID 13
00203 #define AT_EGID 14
00204 #define AT_PLATFORM 15
00205 #define AT_HWCAP 16
00206 #define AT_CLKTCK 17
00207
00208 typedef struct dynamic{
00209 Elf32_Sword d_tag;
00210 union{
00211 Elf32_Sword d_val;
00212 Elf32_Addr d_ptr;
00213 } d_un;
00214 } Elf32_Dyn;
00215
00216 typedef struct {
00217 Elf64_Sxword d_tag;
00218 union {
00219 Elf64_Xword d_val;
00220 Elf64_Addr d_ptr;
00221 } d_un;
00222 } Elf64_Dyn;
00223
00224
00225 #define ELF32_R_SYM(x) ((x) >> 8)
00226 #define ELF32_R_TYPE(x) ((x) & 0xff)
00227
00228 #define ELF64_R_SYM(i) ((i) >> 32)
00229 #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
00230 #define ELF64_R_TYPE_DATA(i) (((ELF64_R_TYPE(i) >> 8) ^ 0x00800000) - 0x00800000)
00231
00232 #define R_386_NONE 0
00233 #define R_386_32 1
00234 #define R_386_PC32 2
00235 #define R_386_GOT32 3
00236 #define R_386_PLT32 4
00237 #define R_386_COPY 5
00238 #define R_386_GLOB_DAT 6
00239 #define R_386_JMP_SLOT 7
00240 #define R_386_RELATIVE 8
00241 #define R_386_GOTOFF 9
00242 #define R_386_GOTPC 10
00243 #define R_386_NUM 11
00244
00245 #define R_MIPS_NONE 0
00246 #define R_MIPS_16 1
00247 #define R_MIPS_32 2
00248 #define R_MIPS_REL32 3
00249 #define R_MIPS_26 4
00250 #define R_MIPS_HI16 5
00251 #define R_MIPS_LO16 6
00252 #define R_MIPS_GPREL16 7
00253 #define R_MIPS_LITERAL 8
00254 #define R_MIPS_GOT16 9
00255 #define R_MIPS_PC16 10
00256 #define R_MIPS_CALL16 11
00257 #define R_MIPS_GPREL32 12
00258
00259
00260 #define R_MIPS_UNUSED1 13
00261 #define R_MIPS_UNUSED2 14
00262 #define R_MIPS_UNUSED3 15
00263 #define R_MIPS_SHIFT5 16
00264 #define R_MIPS_SHIFT6 17
00265 #define R_MIPS_64 18
00266 #define R_MIPS_GOT_DISP 19
00267 #define R_MIPS_GOT_PAGE 20
00268 #define R_MIPS_GOT_OFST 21
00269
00270
00271
00272
00273 #define R_MIPS_GOTHI16 22
00274 #define R_MIPS_GOTLO16 23
00275 #define R_MIPS_SUB 24
00276 #define R_MIPS_INSERT_A 25
00277 #define R_MIPS_INSERT_B 26
00278 #define R_MIPS_DELETE 27
00279 #define R_MIPS_HIGHER 28
00280 #define R_MIPS_HIGHEST 29
00281
00282
00283
00284
00285 #define R_MIPS_CALLHI16 30
00286 #define R_MIPS_CALLLO16 31
00287
00288
00289
00290 #define R_MIPS_LOVENDOR 100
00291 #define R_MIPS_HIVENDOR 127
00292
00293
00294
00295
00296
00297 #define R_SPARC_NONE 0
00298 #define R_SPARC_8 1
00299 #define R_SPARC_16 2
00300 #define R_SPARC_32 3
00301 #define R_SPARC_DISP8 4
00302 #define R_SPARC_DISP16 5
00303 #define R_SPARC_DISP32 6
00304 #define R_SPARC_WDISP30 7
00305 #define R_SPARC_WDISP22 8
00306 #define R_SPARC_HI22 9
00307 #define R_SPARC_22 10
00308 #define R_SPARC_13 11
00309 #define R_SPARC_LO10 12
00310 #define R_SPARC_GOT10 13
00311 #define R_SPARC_GOT13 14
00312 #define R_SPARC_GOT22 15
00313 #define R_SPARC_PC10 16
00314 #define R_SPARC_PC22 17
00315 #define R_SPARC_WPLT30 18
00316 #define R_SPARC_COPY 19
00317 #define R_SPARC_GLOB_DAT 20
00318 #define R_SPARC_JMP_SLOT 21
00319 #define R_SPARC_RELATIVE 22
00320 #define R_SPARC_UA32 23
00321 #define R_SPARC_PLT32 24
00322 #define R_SPARC_HIPLT22 25
00323 #define R_SPARC_LOPLT10 26
00324 #define R_SPARC_PCPLT32 27
00325 #define R_SPARC_PCPLT22 28
00326 #define R_SPARC_PCPLT10 29
00327 #define R_SPARC_10 30
00328 #define R_SPARC_11 31
00329 #define R_SPARC_64 32
00330 #define R_SPARC_OLO10 33
00331 #define R_SPARC_HH22 34
00332 #define R_SPARC_HM10 35
00333 #define R_SPARC_LM22 36
00334 #define R_SPARC_WDISP16 40
00335 #define R_SPARC_WDISP19 41
00336 #define R_SPARC_7 43
00337 #define R_SPARC_5 44
00338 #define R_SPARC_6 45
00339
00340
00341
00342 #define HWCAP_SPARC_FLUSH 1
00343 #define HWCAP_SPARC_STBAR 2
00344 #define HWCAP_SPARC_SWAP 4
00345 #define HWCAP_SPARC_MULDIV 8
00346 #define HWCAP_SPARC_V9 16
00347 #define HWCAP_SPARC_ULTRA3 32
00348
00349
00350
00351
00352 #define R_68K_NONE 0
00353 #define R_68K_32 1
00354 #define R_68K_16 2
00355 #define R_68K_8 3
00356 #define R_68K_PC32 4
00357 #define R_68K_PC16 5
00358 #define R_68K_PC8 6
00359 #define R_68K_GOT32 7
00360 #define R_68K_GOT16 8
00361 #define R_68K_GOT8 9
00362 #define R_68K_GOT32O 10
00363 #define R_68K_GOT16O 11
00364 #define R_68K_GOT8O 12
00365 #define R_68K_PLT32 13
00366 #define R_68K_PLT16 14
00367 #define R_68K_PLT8 15
00368 #define R_68K_PLT32O 16
00369 #define R_68K_PLT16O 17
00370 #define R_68K_PLT8O 18
00371 #define R_68K_COPY 19
00372 #define R_68K_GLOB_DAT 20
00373 #define R_68K_JMP_SLOT 21
00374 #define R_68K_RELATIVE 22
00375
00376
00377
00378
00379 #define R_ALPHA_NONE 0
00380 #define R_ALPHA_REFLONG 1
00381 #define R_ALPHA_REFQUAD 2
00382 #define R_ALPHA_GPREL32 3
00383 #define R_ALPHA_LITERAL 4
00384 #define R_ALPHA_LITUSE 5
00385 #define R_ALPHA_GPDISP 6
00386 #define R_ALPHA_BRADDR 7
00387 #define R_ALPHA_HINT 8
00388 #define R_ALPHA_SREL16 9
00389 #define R_ALPHA_SREL32 10
00390 #define R_ALPHA_SREL64 11
00391 #define R_ALPHA_GPRELHIGH 17
00392 #define R_ALPHA_GPRELLOW 18
00393 #define R_ALPHA_GPREL16 19
00394 #define R_ALPHA_COPY 24
00395 #define R_ALPHA_GLOB_DAT 25
00396 #define R_ALPHA_JMP_SLOT 26
00397 #define R_ALPHA_RELATIVE 27
00398 #define R_ALPHA_BRSGP 28
00399 #define R_ALPHA_TLSGD 29
00400 #define R_ALPHA_TLS_LDM 30
00401 #define R_ALPHA_DTPMOD64 31
00402 #define R_ALPHA_GOTDTPREL 32
00403 #define R_ALPHA_DTPREL64 33
00404 #define R_ALPHA_DTPRELHI 34
00405 #define R_ALPHA_DTPRELLO 35
00406 #define R_ALPHA_DTPREL16 36
00407 #define R_ALPHA_GOTTPREL 37
00408 #define R_ALPHA_TPREL64 38
00409 #define R_ALPHA_TPRELHI 39
00410 #define R_ALPHA_TPRELLO 40
00411 #define R_ALPHA_TPREL16 41
00412
00413 #define SHF_ALPHA_GPREL 0x10000000
00414
00415
00416
00417 #define R_PPC_NONE 0
00418 #define R_PPC_ADDR32 1
00419 #define R_PPC_ADDR24 2
00420 #define R_PPC_ADDR16 3
00421 #define R_PPC_ADDR16_LO 4
00422 #define R_PPC_ADDR16_HI 5
00423 #define R_PPC_ADDR16_HA 6
00424 #define R_PPC_ADDR14 7
00425 #define R_PPC_ADDR14_BRTAKEN 8
00426 #define R_PPC_ADDR14_BRNTAKEN 9
00427 #define R_PPC_REL24 10
00428 #define R_PPC_REL14 11
00429 #define R_PPC_REL14_BRTAKEN 12
00430 #define R_PPC_REL14_BRNTAKEN 13
00431 #define R_PPC_GOT16 14
00432 #define R_PPC_GOT16_LO 15
00433 #define R_PPC_GOT16_HI 16
00434 #define R_PPC_GOT16_HA 17
00435 #define R_PPC_PLTREL24 18
00436 #define R_PPC_COPY 19
00437 #define R_PPC_GLOB_DAT 20
00438 #define R_PPC_JMP_SLOT 21
00439 #define R_PPC_RELATIVE 22
00440 #define R_PPC_LOCAL24PC 23
00441 #define R_PPC_UADDR32 24
00442 #define R_PPC_UADDR16 25
00443 #define R_PPC_REL32 26
00444 #define R_PPC_PLT32 27
00445 #define R_PPC_PLTREL32 28
00446 #define R_PPC_PLT16_LO 29
00447 #define R_PPC_PLT16_HI 30
00448 #define R_PPC_PLT16_HA 31
00449 #define R_PPC_SDAREL16 32
00450 #define R_PPC_SECTOFF 33
00451 #define R_PPC_SECTOFF_LO 34
00452 #define R_PPC_SECTOFF_HI 35
00453 #define R_PPC_SECTOFF_HA 36
00454
00455 #define R_PPC_NUM 37
00456
00457
00458
00459
00460 #define EF_ARM_RELEXEC 0x01
00461 #define EF_ARM_HASENTRY 0x02
00462 #define EF_ARM_INTERWORK 0x04
00463 #define EF_ARM_APCS_26 0x08
00464 #define EF_ARM_APCS_FLOAT 0x10
00465 #define EF_ARM_PIC 0x20
00466 #define EF_ALIGN8 0x40
00467 #define EF_NEW_ABI 0x80
00468 #define EF_OLD_ABI 0x100
00469
00470
00471 #define STT_ARM_TFUNC 0xd
00472
00473
00474 #define SHF_ARM_ENTRYSECT 0x10000000
00475 #define SHF_ARM_COMDEF 0x80000000
00476
00477
00478
00479 #define PF_ARM_SB 0x10000000
00480
00481
00482
00483 #define R_ARM_NONE 0
00484 #define R_ARM_PC24 1
00485 #define R_ARM_ABS32 2
00486 #define R_ARM_REL32 3
00487 #define R_ARM_PC13 4
00488 #define R_ARM_ABS16 5
00489 #define R_ARM_ABS12 6
00490 #define R_ARM_THM_ABS5 7
00491 #define R_ARM_ABS8 8
00492 #define R_ARM_SBREL32 9
00493 #define R_ARM_THM_PC22 10
00494 #define R_ARM_THM_PC8 11
00495 #define R_ARM_AMP_VCALL9 12
00496 #define R_ARM_SWI24 13
00497 #define R_ARM_THM_SWI8 14
00498 #define R_ARM_XPC25 15
00499 #define R_ARM_THM_XPC22 16
00500 #define R_ARM_COPY 20
00501 #define R_ARM_GLOB_DAT 21
00502 #define R_ARM_JUMP_SLOT 22
00503 #define R_ARM_RELATIVE 23
00504 #define R_ARM_GOTOFF 24
00505 #define R_ARM_GOTPC 25
00506 #define R_ARM_GOT32 26
00507 #define R_ARM_PLT32 27
00508 #define R_ARM_CALL 28
00509 #define R_ARM_JUMP24 29
00510 #define R_ARM_GNU_VTENTRY 100
00511 #define R_ARM_GNU_VTINHERIT 101
00512 #define R_ARM_THM_PC11 102
00513 #define R_ARM_THM_PC9 103
00514 #define R_ARM_RXPC25 249
00515 #define R_ARM_RSBREL32 250
00516 #define R_ARM_THM_RPC22 251
00517 #define R_ARM_RREL32 252
00518 #define R_ARM_RABS22 253
00519 #define R_ARM_RPC24 254
00520 #define R_ARM_RBASE 255
00521
00522 #define R_ARM_NUM 256
00523
00524
00525 #define R_390_NONE 0
00526 #define R_390_8 1
00527 #define R_390_12 2
00528 #define R_390_16 3
00529 #define R_390_32 4
00530 #define R_390_PC32 5
00531 #define R_390_GOT12 6
00532 #define R_390_GOT32 7
00533 #define R_390_PLT32 8
00534 #define R_390_COPY 9
00535 #define R_390_GLOB_DAT 10
00536 #define R_390_JMP_SLOT 11
00537 #define R_390_RELATIVE 12
00538 #define R_390_GOTOFF32 13
00539 #define R_390_GOTPC 14
00540 #define R_390_GOT16 15
00541 #define R_390_PC16 16
00542 #define R_390_PC16DBL 17
00543 #define R_390_PLT16DBL 18
00544 #define R_390_PC32DBL 19
00545 #define R_390_PLT32DBL 20
00546 #define R_390_GOTPCDBL 21
00547 #define R_390_64 22
00548 #define R_390_PC64 23
00549 #define R_390_GOT64 24
00550 #define R_390_PLT64 25
00551 #define R_390_GOTENT 26
00552 #define R_390_GOTOFF16 27
00553 #define R_390_GOTOFF64 28
00554 #define R_390_GOTPLT12 29
00555 #define R_390_GOTPLT16 30
00556 #define R_390_GOTPLT32 31
00557 #define R_390_GOTPLT64 32
00558 #define R_390_GOTPLTENT 33
00559 #define R_390_PLTOFF16 34
00560 #define R_390_PLTOFF32 35
00561 #define R_390_PLTOFF64 36
00562 #define R_390_TLS_LOAD 37
00563 #define R_390_TLS_GDCALL 38
00564
00565 #define R_390_TLS_LDCALL 39
00566
00567 #define R_390_TLS_GD32 40
00568
00569 #define R_390_TLS_GD64 41
00570
00571 #define R_390_TLS_GOTIE12 42
00572
00573 #define R_390_TLS_GOTIE32 43
00574
00575 #define R_390_TLS_GOTIE64 44
00576
00577 #define R_390_TLS_LDM32 45
00578
00579 #define R_390_TLS_LDM64 46
00580
00581 #define R_390_TLS_IE32 47
00582
00583 #define R_390_TLS_IE64 48
00584
00585 #define R_390_TLS_IEENT 49
00586
00587 #define R_390_TLS_LE32 50
00588
00589 #define R_390_TLS_LE64 51
00590
00591 #define R_390_TLS_LDO32 52
00592
00593 #define R_390_TLS_LDO64 53
00594
00595 #define R_390_TLS_DTPMOD 54
00596 #define R_390_TLS_DTPOFF 55
00597 #define R_390_TLS_TPOFF 56
00598
00599
00600 #define R_390_NUM 57
00601
00602
00603 #define R_X86_64_NONE 0
00604 #define R_X86_64_64 1
00605 #define R_X86_64_PC32 2
00606 #define R_X86_64_GOT32 3
00607 #define R_X86_64_PLT32 4
00608 #define R_X86_64_COPY 5
00609 #define R_X86_64_GLOB_DAT 6
00610 #define R_X86_64_JUMP_SLOT 7
00611 #define R_X86_64_RELATIVE 8
00612 #define R_X86_64_GOTPCREL 9
00613
00614 #define R_X86_64_32 10
00615 #define R_X86_64_32S 11
00616 #define R_X86_64_16 12
00617 #define R_X86_64_PC16 13
00618 #define R_X86_64_8 14
00619 #define R_X86_64_PC8 15
00620
00621 #define R_X86_64_NUM 16
00622
00623
00624
00625 #define EF_ALPHA_32BIT 1
00626
00627
00628
00629
00630
00631 #define EF_PARISC_TRAPNIL 0x00010000
00632 #define EF_PARISC_EXT 0x00020000
00633 #define EF_PARISC_LSB 0x00040000
00634 #define EF_PARISC_WIDE 0x00080000
00635 #define EF_PARISC_NO_KABP 0x00100000
00636
00637 #define EF_PARISC_LAZYSWAP 0x00400000
00638 #define EF_PARISC_ARCH 0x0000ffff
00639
00640
00641
00642 #define EFA_PARISC_1_0 0x020b
00643 #define EFA_PARISC_1_1 0x0210
00644 #define EFA_PARISC_2_0 0x0214
00645
00646
00647
00648 #define SHN_PARISC_ANSI_COMMON 0xff00
00649
00650 #define SHN_PARISC_HUGE_COMMON 0xff01
00651
00652
00653
00654 #define SHT_PARISC_EXT 0x70000000
00655 #define SHT_PARISC_UNWIND 0x70000001
00656 #define SHT_PARISC_DOC 0x70000002
00657
00658
00659
00660 #define SHF_PARISC_SHORT 0x20000000
00661 #define SHF_PARISC_HUGE 0x40000000
00662 #define SHF_PARISC_SBP 0x80000000
00663
00664
00665
00666 #define STT_PARISC_MILLICODE 13
00667
00668 #define STT_HP_OPAQUE (STT_LOOS + 0x1)
00669 #define STT_HP_STUB (STT_LOOS + 0x2)
00670
00671
00672
00673 #define R_PARISC_NONE 0
00674 #define R_PARISC_DIR32 1
00675 #define R_PARISC_DIR21L 2
00676 #define R_PARISC_DIR17R 3
00677 #define R_PARISC_DIR17F 4
00678 #define R_PARISC_DIR14R 6
00679 #define R_PARISC_PCREL32 9
00680 #define R_PARISC_PCREL21L 10
00681 #define R_PARISC_PCREL17R 11
00682 #define R_PARISC_PCREL17F 12
00683 #define R_PARISC_PCREL14R 14
00684 #define R_PARISC_DPREL21L 18
00685 #define R_PARISC_DPREL14R 22
00686 #define R_PARISC_GPREL21L 26
00687 #define R_PARISC_GPREL14R 30
00688 #define R_PARISC_LTOFF21L 34
00689 #define R_PARISC_LTOFF14R 38
00690 #define R_PARISC_SECREL32 41
00691 #define R_PARISC_SEGBASE 48
00692 #define R_PARISC_SEGREL32 49
00693 #define R_PARISC_PLTOFF21L 50
00694 #define R_PARISC_PLTOFF14R 54
00695 #define R_PARISC_LTOFF_FPTR32 57
00696 #define R_PARISC_LTOFF_FPTR21L 58
00697 #define R_PARISC_LTOFF_FPTR14R 62
00698 #define R_PARISC_FPTR64 64
00699 #define R_PARISC_PLABEL32 65
00700 #define R_PARISC_PCREL64 72
00701 #define R_PARISC_PCREL22F 74
00702 #define R_PARISC_PCREL14WR 75
00703 #define R_PARISC_PCREL14DR 76
00704 #define R_PARISC_PCREL16F 77
00705 #define R_PARISC_PCREL16WF 78
00706 #define R_PARISC_PCREL16DF 79
00707 #define R_PARISC_DIR64 80
00708 #define R_PARISC_DIR14WR 83
00709 #define R_PARISC_DIR14DR 84
00710 #define R_PARISC_DIR16F 85
00711 #define R_PARISC_DIR16WF 86
00712 #define R_PARISC_DIR16DF 87
00713 #define R_PARISC_GPREL64 88
00714 #define R_PARISC_GPREL14WR 91
00715 #define R_PARISC_GPREL14DR 92
00716 #define R_PARISC_GPREL16F 93
00717 #define R_PARISC_GPREL16WF 94
00718 #define R_PARISC_GPREL16DF 95
00719 #define R_PARISC_LTOFF64 96
00720 #define R_PARISC_LTOFF14WR 99
00721 #define R_PARISC_LTOFF14DR 100
00722 #define R_PARISC_LTOFF16F 101
00723 #define R_PARISC_LTOFF16WF 102
00724 #define R_PARISC_LTOFF16DF 103
00725 #define R_PARISC_SECREL64 104
00726 #define R_PARISC_SEGREL64 112
00727 #define R_PARISC_PLTOFF14WR 115
00728 #define R_PARISC_PLTOFF14DR 116
00729 #define R_PARISC_PLTOFF16F 117
00730 #define R_PARISC_PLTOFF16WF 118
00731 #define R_PARISC_PLTOFF16DF 119
00732 #define R_PARISC_LTOFF_FPTR64 120
00733 #define R_PARISC_LTOFF_FPTR14WR 123
00734 #define R_PARISC_LTOFF_FPTR14DR 124
00735 #define R_PARISC_LTOFF_FPTR16F 125
00736 #define R_PARISC_LTOFF_FPTR16WF 126
00737 #define R_PARISC_LTOFF_FPTR16DF 127
00738 #define R_PARISC_LORESERVE 128
00739 #define R_PARISC_COPY 128
00740 #define R_PARISC_IPLT 129
00741 #define R_PARISC_EPLT 130
00742 #define R_PARISC_TPREL32 153
00743 #define R_PARISC_TPREL21L 154
00744 #define R_PARISC_TPREL14R 158
00745 #define R_PARISC_LTOFF_TP21L 162
00746 #define R_PARISC_LTOFF_TP14R 166
00747 #define R_PARISC_LTOFF_TP14F 167
00748 #define R_PARISC_TPREL64 216
00749 #define R_PARISC_TPREL14WR 219
00750 #define R_PARISC_TPREL14DR 220
00751 #define R_PARISC_TPREL16F 221
00752 #define R_PARISC_TPREL16WF 222
00753 #define R_PARISC_TPREL16DF 223
00754 #define R_PARISC_LTOFF_TP64 224
00755 #define R_PARISC_LTOFF_TP14WR 227
00756 #define R_PARISC_LTOFF_TP14DR 228
00757 #define R_PARISC_LTOFF_TP16F 229
00758 #define R_PARISC_LTOFF_TP16WF 230
00759 #define R_PARISC_LTOFF_TP16DF 231
00760 #define R_PARISC_HIRESERVE 255
00761
00762
00763
00764 #define PT_HP_TLS (PT_LOOS + 0x0)
00765 #define PT_HP_CORE_NONE (PT_LOOS + 0x1)
00766 #define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
00767 #define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
00768 #define PT_HP_CORE_COMM (PT_LOOS + 0x4)
00769 #define PT_HP_CORE_PROC (PT_LOOS + 0x5)
00770 #define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
00771 #define PT_HP_CORE_STACK (PT_LOOS + 0x7)
00772 #define PT_HP_CORE_SHM (PT_LOOS + 0x8)
00773 #define PT_HP_CORE_MMF (PT_LOOS + 0x9)
00774 #define PT_HP_PARALLEL (PT_LOOS + 0x10)
00775 #define PT_HP_FASTBIND (PT_LOOS + 0x11)
00776 #define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
00777 #define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
00778 #define PT_HP_STACK (PT_LOOS + 0x14)
00779
00780 #define PT_PARISC_ARCHEXT 0x70000000
00781 #define PT_PARISC_UNWIND 0x70000001
00782
00783
00784
00785 #define PF_PARISC_SBP 0x08000000
00786
00787 #define PF_HP_PAGE_SIZE 0x00100000
00788 #define PF_HP_FAR_SHARED 0x00200000
00789 #define PF_HP_NEAR_SHARED 0x00400000
00790 #define PF_HP_CODE 0x01000000
00791 #define PF_HP_MODIFY 0x02000000
00792 #define PF_HP_LAZYSWAP 0x04000000
00793 #define PF_HP_SBP 0x08000000
00794
00795
00796
00797
00798 #define EF_IA_64_MASKOS 0x0000000f
00799 #define EF_IA_64_ABI64 0x00000010
00800 #define EF_IA_64_ARCH 0xff000000
00801
00802
00803 #define PT_IA_64_ARCHEXT (PT_LOPROC + 0)
00804 #define PT_IA_64_UNWIND (PT_LOPROC + 1)
00805
00806
00807 #define PF_IA_64_NORECOV 0x80000000
00808
00809
00810 #define SHT_IA_64_EXT (SHT_LOPROC + 0)
00811 #define SHT_IA_64_UNWIND (SHT_LOPROC + 1)
00812
00813
00814 #define SHF_IA_64_SHORT 0x10000000
00815 #define SHF_IA_64_NORECOV 0x20000000
00816
00817
00818 #define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
00819 #define DT_IA_64_NUM 1
00820
00821
00822 #define R_IA64_NONE 0x00
00823 #define R_IA64_IMM14 0x21
00824 #define R_IA64_IMM22 0x22
00825 #define R_IA64_IMM64 0x23
00826 #define R_IA64_DIR32MSB 0x24
00827 #define R_IA64_DIR32LSB 0x25
00828 #define R_IA64_DIR64MSB 0x26
00829 #define R_IA64_DIR64LSB 0x27
00830 #define R_IA64_GPREL22 0x2a
00831 #define R_IA64_GPREL64I 0x2b
00832 #define R_IA64_GPREL32MSB 0x2c
00833 #define R_IA64_GPREL32LSB 0x2d
00834 #define R_IA64_GPREL64MSB 0x2e
00835 #define R_IA64_GPREL64LSB 0x2f
00836 #define R_IA64_LTOFF22 0x32
00837 #define R_IA64_LTOFF64I 0x33
00838 #define R_IA64_PLTOFF22 0x3a
00839 #define R_IA64_PLTOFF64I 0x3b
00840 #define R_IA64_PLTOFF64MSB 0x3e
00841 #define R_IA64_PLTOFF64LSB 0x3f
00842 #define R_IA64_FPTR64I 0x43
00843 #define R_IA64_FPTR32MSB 0x44
00844 #define R_IA64_FPTR32LSB 0x45
00845 #define R_IA64_FPTR64MSB 0x46
00846 #define R_IA64_FPTR64LSB 0x47
00847 #define R_IA64_PCREL60B 0x48
00848 #define R_IA64_PCREL21B 0x49
00849 #define R_IA64_PCREL21M 0x4a
00850 #define R_IA64_PCREL21F 0x4b
00851 #define R_IA64_PCREL32MSB 0x4c
00852 #define R_IA64_PCREL32LSB 0x4d
00853 #define R_IA64_PCREL64MSB 0x4e
00854 #define R_IA64_PCREL64LSB 0x4f
00855 #define R_IA64_LTOFF_FPTR22 0x52
00856 #define R_IA64_LTOFF_FPTR64I 0x53
00857 #define R_IA64_LTOFF_FPTR32MSB 0x54
00858 #define R_IA64_LTOFF_FPTR32LSB 0x55
00859 #define R_IA64_LTOFF_FPTR64MSB 0x56
00860 #define R_IA64_LTOFF_FPTR64LSB 0x57
00861 #define R_IA64_SEGREL32MSB 0x5c
00862 #define R_IA64_SEGREL32LSB 0x5d
00863 #define R_IA64_SEGREL64MSB 0x5e
00864 #define R_IA64_SEGREL64LSB 0x5f
00865 #define R_IA64_SECREL32MSB 0x64
00866 #define R_IA64_SECREL32LSB 0x65
00867 #define R_IA64_SECREL64MSB 0x66
00868 #define R_IA64_SECREL64LSB 0x67
00869 #define R_IA64_REL32MSB 0x6c
00870 #define R_IA64_REL32LSB 0x6d
00871 #define R_IA64_REL64MSB 0x6e
00872 #define R_IA64_REL64LSB 0x6f
00873 #define R_IA64_LTV32MSB 0x74
00874 #define R_IA64_LTV32LSB 0x75
00875 #define R_IA64_LTV64MSB 0x76
00876 #define R_IA64_LTV64LSB 0x77
00877 #define R_IA64_PCREL21BI 0x79
00878 #define R_IA64_PCREL22 0x7a
00879 #define R_IA64_PCREL64I 0x7b
00880 #define R_IA64_IPLTMSB 0x80
00881 #define R_IA64_IPLTLSB 0x81
00882 #define R_IA64_COPY 0x84
00883 #define R_IA64_SUB 0x85
00884 #define R_IA64_LTOFF22X 0x86
00885 #define R_IA64_LDXMOV 0x87
00886 #define R_IA64_TPREL14 0x91
00887 #define R_IA64_TPREL22 0x92
00888 #define R_IA64_TPREL64I 0x93
00889 #define R_IA64_TPREL64MSB 0x96
00890 #define R_IA64_TPREL64LSB 0x97
00891 #define R_IA64_LTOFF_TPREL22 0x9a
00892 #define R_IA64_DTPMOD64MSB 0xa6
00893 #define R_IA64_DTPMOD64LSB 0xa7
00894 #define R_IA64_LTOFF_DTPMOD22 0xaa
00895 #define R_IA64_DTPREL14 0xb1
00896 #define R_IA64_DTPREL22 0xb2
00897 #define R_IA64_DTPREL64I 0xb3
00898 #define R_IA64_DTPREL32MSB 0xb4
00899 #define R_IA64_DTPREL32LSB 0xb5
00900 #define R_IA64_DTPREL64MSB 0xb6
00901 #define R_IA64_DTPREL64LSB 0xb7
00902 #define R_IA64_LTOFF_DTPREL22 0xba
00903
00904 typedef struct elf32_rel {
00905 Elf32_Addr r_offset;
00906 Elf32_Word r_info;
00907 } Elf32_Rel;
00908
00909 typedef struct elf64_rel {
00910 Elf64_Addr r_offset;
00911 Elf64_Xword r_info;
00912 } Elf64_Rel;
00913
00914 typedef struct elf32_rela{
00915 Elf32_Addr r_offset;
00916 Elf32_Word r_info;
00917 Elf32_Sword r_addend;
00918 } Elf32_Rela;
00919
00920 typedef struct elf64_rela {
00921 Elf64_Addr r_offset;
00922 Elf64_Xword r_info;
00923 Elf64_Sxword r_addend;
00924 } Elf64_Rela;
00925
00926 typedef struct elf32_sym{
00927 Elf32_Word st_name;
00928 Elf32_Addr st_value;
00929 Elf32_Word st_size;
00930 unsigned char st_info;
00931 unsigned char st_other;
00932 Elf32_Half st_shndx;
00933 } Elf32_Sym;
00934
00935 typedef struct elf64_sym {
00936 Elf64_Word st_name;
00937 unsigned char st_info;
00938 unsigned char st_other;
00939 Elf64_Half st_shndx;
00940 Elf64_Addr st_value;
00941 Elf64_Xword st_size;
00942 } Elf64_Sym;
00943
00944
00945 #define EI_NIDENT 16
00946
00947 typedef struct elf32_hdr{
00948 unsigned char e_ident[EI_NIDENT];
00949 Elf32_Half e_type;
00950 Elf32_Half e_machine;
00951 Elf32_Word e_version;
00952 Elf32_Addr e_entry;
00953 Elf32_Off e_phoff;
00954 Elf32_Off e_shoff;
00955 Elf32_Word e_flags;
00956 Elf32_Half e_ehsize;
00957 Elf32_Half e_phentsize;
00958 Elf32_Half e_phnum;
00959 Elf32_Half e_shentsize;
00960 Elf32_Half e_shnum;
00961 Elf32_Half e_shstrndx;
00962 } Elf32_Ehdr;
00963
00964 typedef struct elf64_hdr {
00965 unsigned char e_ident[16];
00966 Elf64_Half e_type;
00967 Elf64_Half e_machine;
00968 Elf64_Word e_version;
00969 Elf64_Addr e_entry;
00970 Elf64_Off e_phoff;
00971 Elf64_Off e_shoff;
00972 Elf64_Word e_flags;
00973 Elf64_Half e_ehsize;
00974 Elf64_Half e_phentsize;
00975 Elf64_Half e_phnum;
00976 Elf64_Half e_shentsize;
00977 Elf64_Half e_shnum;
00978 Elf64_Half e_shstrndx;
00979 } Elf64_Ehdr;
00980
00981
00982
00983 #define PF_R 0x4
00984 #define PF_W 0x2
00985 #define PF_X 0x1
00986
00987 typedef struct elf32_phdr{
00988 Elf32_Word p_type;
00989 Elf32_Off p_offset;
00990 Elf32_Addr p_vaddr;
00991 Elf32_Addr p_paddr;
00992 Elf32_Word p_filesz;
00993 Elf32_Word p_memsz;
00994 Elf32_Word p_flags;
00995 Elf32_Word p_align;
00996 } Elf32_Phdr;
00997
00998 typedef struct elf64_phdr {
00999 Elf64_Word p_type;
01000 Elf64_Word p_flags;
01001 Elf64_Off p_offset;
01002 Elf64_Addr p_vaddr;
01003 Elf64_Addr p_paddr;
01004 Elf64_Xword p_filesz;
01005 Elf64_Xword p_memsz;
01006 Elf64_Xword p_align;
01007 } Elf64_Phdr;
01008
01009
01010 #define SHT_NULL 0
01011 #define SHT_PROGBITS 1
01012 #define SHT_SYMTAB 2
01013 #define SHT_STRTAB 3
01014 #define SHT_RELA 4
01015 #define SHT_HASH 5
01016 #define SHT_DYNAMIC 6
01017 #define SHT_NOTE 7
01018 #define SHT_NOBITS 8
01019 #define SHT_REL 9
01020 #define SHT_SHLIB 10
01021 #define SHT_DYNSYM 11
01022 #define SHT_NUM 12
01023 #define SHT_LOPROC 0x70000000
01024 #define SHT_HIPROC 0x7fffffff
01025 #define SHT_LOUSER 0x80000000
01026 #define SHT_HIUSER 0xffffffff
01027 #define SHT_MIPS_LIST 0x70000000
01028 #define SHT_MIPS_CONFLICT 0x70000002
01029 #define SHT_MIPS_GPTAB 0x70000003
01030 #define SHT_MIPS_UCODE 0x70000004
01031
01032
01033 #define SHF_WRITE 0x1
01034 #define SHF_ALLOC 0x2
01035 #define SHF_EXECINSTR 0x4
01036 #define SHF_MASKPROC 0xf0000000
01037 #define SHF_MIPS_GPREL 0x10000000
01038
01039
01040 #define SHN_UNDEF 0
01041 #define SHN_LORESERVE 0xff00
01042 #define SHN_LOPROC 0xff00
01043 #define SHN_HIPROC 0xff1f
01044 #define SHN_ABS 0xfff1
01045 #define SHN_COMMON 0xfff2
01046 #define SHN_HIRESERVE 0xffff
01047 #define SHN_MIPS_ACCOMON 0xff00
01048
01049 typedef struct elf32_shdr {
01050 Elf32_Word sh_name;
01051 Elf32_Word sh_type;
01052 Elf32_Word sh_flags;
01053 Elf32_Addr sh_addr;
01054 Elf32_Off sh_offset;
01055 Elf32_Word sh_size;
01056 Elf32_Word sh_link;
01057 Elf32_Word sh_info;
01058 Elf32_Word sh_addralign;
01059 Elf32_Word sh_entsize;
01060 } Elf32_Shdr;
01061
01062 typedef struct elf64_shdr {
01063 Elf64_Word sh_name;
01064 Elf64_Word sh_type;
01065 Elf64_Xword sh_flags;
01066 Elf64_Addr sh_addr;
01067 Elf64_Off sh_offset;
01068 Elf64_Xword sh_size;
01069 Elf64_Word sh_link;
01070 Elf64_Word sh_info;
01071 Elf64_Xword sh_addralign;
01072 Elf64_Xword sh_entsize;
01073 } Elf64_Shdr;
01074
01075 #define EI_MAG0 0
01076 #define EI_MAG1 1
01077 #define EI_MAG2 2
01078 #define EI_MAG3 3
01079 #define EI_CLASS 4
01080 #define EI_DATA 5
01081 #define EI_VERSION 6
01082 #define EI_PAD 7
01083
01084 #define ELFMAG0 0x7f
01085 #define ELFMAG1 'E'
01086 #define ELFMAG2 'L'
01087 #define ELFMAG3 'F'
01088 #define ELFMAG "\177ELF"
01089 #define SELFMAG 4
01090
01091 #define ELFCLASSNONE 0
01092 #define ELFCLASS32 1
01093 #define ELFCLASS64 2
01094 #define ELFCLASSNUM 3
01095
01096 #define ELFDATANONE 0
01097 #define ELFDATA2LSB 1
01098 #define ELFDATA2MSB 2
01099
01100 #define EV_NONE 0
01101 #define EV_CURRENT 1
01102 #define EV_NUM 2
01103
01104
01105 #define NT_PRSTATUS 1
01106 #define NT_PRFPREG 2
01107 #define NT_PRPSINFO 3
01108 #define NT_TASKSTRUCT 4
01109 #define NT_PRXFPREG 0x46e62b7f
01110
01111
01112
01113 typedef struct elf32_note {
01114 Elf32_Word n_namesz;
01115 Elf32_Word n_descsz;
01116 Elf32_Word n_type;
01117 } Elf32_Nhdr;
01118
01119
01120 typedef struct elf64_note {
01121 Elf64_Word n_namesz;
01122 Elf64_Word n_descsz;
01123 Elf64_Word n_type;
01124 } Elf64_Nhdr;
01125
01126 #ifdef ELF_CLASS
01127 #if ELF_CLASS == ELFCLASS32
01128
01129 #define elfhdr elf32_hdr
01130 #define elf_phdr elf32_phdr
01131 #define elf_note elf32_note
01132 #define elf_shdr elf32_shdr
01133 #define elf_sym elf32_sym
01134 #define elf_addr_t Elf32_Off
01135
01136 #ifdef ELF_USES_RELOCA
01137 # define ELF_RELOC Elf32_Rela
01138 #else
01139 # define ELF_RELOC Elf32_Rel
01140 #endif
01141
01142 #else
01143
01144 #define elfhdr elf64_hdr
01145 #define elf_phdr elf64_phdr
01146 #define elf_note elf64_note
01147 #define elf_shdr elf64_shdr
01148 #define elf_sym elf64_sym
01149 #define elf_addr_t Elf64_Off
01150
01151 #ifdef ELF_USES_RELOCA
01152 # define ELF_RELOC Elf64_Rela
01153 #else
01154 # define ELF_RELOC Elf64_Rel
01155 #endif
01156
01157 #endif
01158
01159 #ifndef ElfW
01160 # if ELF_CLASS == ELFCLASS32
01161 # define ElfW(x) Elf32_ ## x
01162 # define ELFW(x) ELF32_ ## x
01163 # else
01164 # define ElfW(x) Elf64_ ## x
01165 # define ELFW(x) ELF64_ ## x
01166 # endif
01167 #endif
01168
01169 #endif
01170
01171
01172 #endif