Changeset ad94dc3 in rtems
- Timestamp:
- 07/19/22 16:26:40 (10 months ago)
- Branches:
- master
- Children:
- f6432156
- Parents:
- 6a65803
- git-author:
- Ryan Long <ryan.long@…> (07/19/22 16:26:40)
- git-committer:
- Joel Sherrill <joel@…> (07/29/22 13:32:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/include/sys/exec_elf.h
r6a65803 rad94dc3 1 /* $NetBSD: exec_elf.h,v 1.1 02 2010/03/01 11:27:29 skrllExp $ */1 /* $NetBSD: exec_elf.h,v 1.168 2020/10/19 19:33:02 christos Exp $ */ 2 2 3 3 /*- … … 45 45 #else 46 46 #include <inttypes.h> 47 #include <stddef.h> 47 48 #endif /* _KERNEL || _STANDALONE */ 48 49 … … 61 62 #endif 62 63 63 typedef uint8_t Elf_Byte; 64 65 typedef uint32_t Elf32_Addr; 66 #define ELF32_FSZ_ADDR 4 67 typedef uint32_t Elf32_Off; 68 typedef int32_t Elf32_SOff; 69 #define ELF32_FSZ_OFF 4 70 typedef int32_t Elf32_Sword; 71 #define ELF32_FSZ_SWORD 4 72 typedef uint32_t Elf32_Word; 73 #define ELF32_FSZ_WORD 4 74 typedef uint16_t Elf32_Half; 75 #define ELF32_FSZ_HALF 2 76 typedef uint64_t Elf32_Lword; 77 #define ELF32_FSZ_LWORD 8 78 79 typedef uint64_t Elf64_Addr; 80 #define ELF64_FSZ_ADDR 8 81 typedef uint64_t Elf64_Off; 82 typedef int64_t Elf64_SOff; 83 #define ELF64_FSZ_OFF 8 84 typedef int32_t Elf64_Shalf; 85 #define ELF64_FSZ_SHALF 4 86 87 #ifndef ELF64_FSZ_SWORD 88 typedef int32_t Elf64_Sword; 89 #define ELF64_FSZ_SWORD 4 90 #endif /* ELF64_FSZ_SWORD */ 91 #ifndef ELF64_FSZ_WORD 92 typedef uint32_t Elf64_Word; 93 #define ELF64_FSZ_WORD 4 94 #endif /* ELF64_FSZ_WORD */ 95 96 typedef int64_t Elf64_Sxword; 97 #define ELF64_FSZ_SXWORD 8 98 typedef uint64_t Elf64_Xword; 99 #define ELF64_FSZ_XWORD 8 100 typedef uint64_t Elf64_Lword; 101 #define ELF64_FSZ_LWORD 8 102 typedef uint32_t Elf64_Half; 103 #define ELF64_FSZ_HALF 4 104 typedef uint16_t Elf64_Quarter; 105 #define ELF64_FSZ_QUARTER 2 64 typedef uint8_t Elf_Byte; 65 66 typedef uint32_t Elf32_Addr; 67 #define ELF32_FSZ_ADDR 4 68 typedef uint32_t Elf32_Off; 69 typedef int32_t Elf32_SOff; 70 #define ELF32_FSZ_OFF 4 71 typedef int32_t Elf32_Sword; 72 #define ELF32_FSZ_SWORD 4 73 typedef uint32_t Elf32_Word; 74 #define ELF32_FSZ_WORD 4 75 typedef uint16_t Elf32_Half; 76 #define ELF32_FSZ_HALF 2 77 typedef uint64_t Elf32_Lword; 78 #define ELF32_FSZ_LWORD 8 79 80 typedef uint64_t Elf64_Addr; 81 #define ELF64_FSZ_ADDR 8 82 typedef uint64_t Elf64_Off; 83 typedef int64_t Elf64_SOff; 84 #define ELF64_FSZ_OFF 8 85 86 typedef int32_t Elf64_Sword; 87 #define ELF64_FSZ_SWORD 4 88 typedef uint32_t Elf64_Word; 89 #define ELF64_FSZ_WORD 4 90 91 typedef int64_t Elf64_Sxword; 92 #define ELF64_FSZ_SXWORD 8 93 typedef uint64_t Elf64_Xword; 94 #define ELF64_FSZ_XWORD 8 95 typedef uint64_t Elf64_Lword; 96 #define ELF64_FSZ_LWORD 8 97 typedef uint16_t Elf64_Half; 98 #define ELF64_FSZ_HALF 2 106 99 107 100 /* … … 119 112 Elf32_Off e_shoff; /* Section hdr offset */ 120 113 Elf32_Word e_flags; /* Processor flags */ 121 Elf32_Half 122 Elf32_Half 123 Elf32_Half 124 Elf32_Half 125 Elf32_Half 126 Elf32_Half 114 Elf32_Half e_ehsize; /* sizeof ehdr */ 115 Elf32_Half e_phentsize; /* Program header entry size */ 116 Elf32_Half e_phnum; /* Number of program headers */ 117 Elf32_Half e_shentsize; /* Section header entry size */ 118 Elf32_Half e_shnum; /* Number of section headers */ 119 Elf32_Half e_shstrndx; /* String table index */ 127 120 } Elf32_Ehdr; 128 121 129 122 typedef struct { 130 123 unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ 131 Elf64_ Quartere_type; /* file type */132 Elf64_ Quartere_machine; /* machine type */133 Elf64_ Halfe_version; /* version number */124 Elf64_Half e_type; /* file type */ 125 Elf64_Half e_machine; /* machine type */ 126 Elf64_Word e_version; /* version number */ 134 127 Elf64_Addr e_entry; /* entry point */ 135 128 Elf64_Off e_phoff; /* Program hdr offset */ 136 129 Elf64_Off e_shoff; /* Section hdr offset */ 137 Elf64_ Halfe_flags; /* Processor flags */138 Elf64_ Quartere_ehsize; /* sizeof ehdr */139 Elf64_ Quartere_phentsize; /* Program header entry size */140 Elf64_ Quartere_phnum; /* Number of program headers */141 Elf64_ Quartere_shentsize; /* Section header entry size */142 Elf64_ Quartere_shnum; /* Number of section headers */143 Elf64_ Quartere_shstrndx; /* String table index */130 Elf64_Word e_flags; /* Processor flags */ 131 Elf64_Half e_ehsize; /* sizeof ehdr */ 132 Elf64_Half e_phentsize; /* Program header entry size */ 133 Elf64_Half e_phnum; /* Number of program headers */ 134 Elf64_Half e_shentsize; /* Section header entry size */ 135 Elf64_Half e_shnum; /* Number of section headers */ 136 Elf64_Half e_shstrndx; /* String table index */ 144 137 } Elf64_Ehdr; 145 138 … … 185 178 #define ELFOSABI_HPUX 1 /* HP-UX operating system */ 186 179 #define ELFOSABI_NETBSD 2 /* NetBSD */ 187 #define ELFOSABI_ LINUX3 /* GNU/Linux */188 #define ELFOSABI_HURD 4 /* GNU/Hurd */189 #define ELFOSABI_86OPEN 5 /* 86Open */180 #define ELFOSABI_GNU 3 /* GNU/Linux */ 181 #define ELFOSABI_HURD 4 /* GNU/Hurd - historical */ 182 #define ELFOSABI_86OPEN 5 /* 86Open - historical */ 190 183 #define ELFOSABI_SOLARIS 6 /* Solaris */ 191 #define ELFOSABI_ MONTEREY 7 /* Monterey*/184 #define ELFOSABI_AIX 7 /* AIX */ 192 185 #define ELFOSABI_IRIX 8 /* IRIX */ 193 186 #define ELFOSABI_FREEBSD 9 /* FreeBSD */ … … 198 191 #define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ 199 192 #define ELFOSABI_AROS 15 /* Amiga Research OS */ 193 #define ELFOSABI_FENIXOS 16 /* The FenixOS highly scalable multi-core OS */ 194 #define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */ 195 #define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS */ 200 196 /* Unofficial OSABIs follow */ 201 197 #define ELFOSABI_ARM 97 /* ARM */ … … 203 199 204 200 #define ELFOSABI_NONE ELFOSABI_SYSV 205 #define ELFOSABI_AIX ELFOSABI_MONTEREY 201 202 /* Historical aliases. */ 203 #define ELFOSABI_LINUX ELFOSABI_GNU 204 #define ELFOSABI_MONTEREY ELFOSABI_AIX 206 205 207 206 /* e_type */ … … 225 224 #define EM_68K 4 /* Motorola 68000 */ 226 225 #define EM_88K 5 /* Motorola 88000 */ 227 #define EM_486 6 /* Intel 80486 */ 226 #define EM_486 6 /* Intel 80486 [old] */ 227 #define EM_IAMCU 6 /* Intel MCU. */ 228 228 #define EM_860 7 /* Intel 80860 */ 229 229 #define EM_MIPS 8 /* MIPS I Architecture */ … … 239 239 #define EM_PPC 20 /* PowerPC */ 240 240 #define EM_PPC64 21 /* 64-bit PowerPC */ 241 /* 22-35 - Reserved */ 242 #define EM_S390 22 /* System/390 XXX reserved */ 241 #define EM_S390 22 /* IBM System/390 Processor */ 242 #define EM_SPU 23 /* IBM SPU/SPC */ 243 /* 24-35 - Reserved */ 243 244 #define EM_V800 36 /* NEC V800 */ 244 245 #define EM_FR20 37 /* Fujitsu FR20 */ … … 246 247 #define EM_RCE 39 /* Motorola RCE */ 247 248 #define EM_ARM 40 /* Advanced RISC Machines ARM */ 248 #define EM_ ALPHA 41 /* DIGITAL Alpha*/249 #define EM_OLD_ALPHA 41 /* DIGITAL Alpha (obsolete) */ 249 250 #define EM_SH 42 /* Hitachi Super-H */ 250 251 #define EM_SPARCV9 43 /* SPARC Version 9 */ … … 297 298 #define EM_MN10200 90 /* Matsushita MN10200 */ 298 299 #define EM_PJ 91 /* picoJava */ 299 #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ 300 #define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */ 301 #define EM_OPENRISC EM_OR1K 300 302 #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ 301 303 #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ … … 319 321 #define EM_DXP 112 /* Icera Semiconductor Inc. Deep Execution Processor */ 320 322 #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ 321 #define EM_CRX 114 /* National Semiconductor CRX*/323 #define EM_CRX 114 /* National Semiconductor CompactRISC CRX microprocessor */ 322 324 #define EM_XGATE 115 /* Motorola XGATE embedded processor */ 323 325 #define EM_C166 116 /* Infineon C16x/XC16x processor */ … … 326 328 #define EM_CE 119 /* Freescale Communication Engine RISC core */ 327 329 #define EM_M32C 120 /* Renesas M32C series microprocessors */ 328 329 #define EM_LATTICEMICO32 138 /* RICS processor for Lattice FPGA architecture */ 330 331 #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ 332 333 #define EM_MOXIE 0xFEED 330 /* 121-130 - Reserved */ 331 #define EM_TSK3000 131 /* Altium TSK3000 core */ 332 #define EM_RS08 132 /* Freescale RS08 embedded processor */ 333 #define EM_SHARC 133 /* Analog Devices SHARC family of 32-bit DSP processors */ 334 #define EM_ECOG2 134 /* Cyan Technology eCOG2 microprocessor */ 335 #define EM_SCORE7 135 /* Sunplus S+core7 RISC processor */ 336 #define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP Processor */ 337 #define EM_VIDEOCORE3 137 /* Broadcom VideoCore III processor */ 338 #define EM_LATTICEMICO32 138 /* RISC processor for Lattice FPGA architecture */ 339 #define EM_SE_C17 139 /* Seiko Epson C17 family */ 340 #define EM_TI_C6000 140 /* The Texas Instruments TMS320C6000 DSP family */ 341 #define EM_TI_C2000 141 /* The Texas Instruments TMS320C2000 DSP family */ 342 #define EM_TI_C5500 142 /* The Texas Instruments TMS320C55x DSP family */ 343 #define EM_TI_ARP32 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */ 344 #define EM_TI_PRU 144 /* Texas Instruments Programmable Realtime Unit */ 345 /* 145-159 - Reserved */ 346 #define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */ 347 #define EM_CYPRESS_M8C 161 /* Cypress M8C microprocessor */ 348 #define EM_R32C 162 /* Renesas R32C series microprocessors */ 349 #define EM_TRIMEDIA 163 /* NXP Semiconductors TriMedia architecture family */ 350 #define EM_QDSP6 164 /* QUALCOMM DSP6 Processor */ 351 #define EM_8051 165 /* Intel 8051 and variants */ 352 #define EM_STXP7X 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */ 353 #define EM_NDS32 167 /* Andes Technology compact code size embedded RISC processor family */ 354 #define EM_ECOG1 168 /* Cyan Technology eCOG1X family */ 355 #define EM_ECOG1X 168 /* Cyan Technology eCOG1X family */ 356 #define EM_MAXQ30 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */ 357 #define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP Processor */ 358 #define EM_MANIK 171 /* M2000 Reconfigurable RISC Microprocessor */ 359 #define EM_CRAYNV2 172 /* Cray Inc. NV2 vector architecture */ 360 #define EM_RX 173 /* Renesas RX family */ 361 #define EM_METAG 174 /* Imagination Technologies META processor architecture */ 362 #define EM_MCST_ELBRUS 175 /* MCST Elbrus general purpose hardware architecture */ 363 #define EM_ECOG16 176 /* Cyan Technology eCOG16 family */ 364 #define EM_CR16 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */ 365 #define EM_ETPU 178 /* Freescale Extended Time Processing Unit */ 366 #define EM_SLE9X 179 /* Infineon Technologies SLE9X core */ 367 #define EM_L10M 180 /* Intel L10M */ 368 #define EM_K10M 181 /* Intel K10M */ 369 /* 182 - Reserved */ 370 #define EM_AARCH64 183 /* AArch64 64-bit ARM microprocessor */ 371 /* 184 - Reserved */ 372 //#define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family*/ 373 #define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */ 374 #define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */ 375 #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ 376 #define EM_CUDA 190 /* NVIDIA CUDA architecture */ 377 #define EM_TILEGX 191 /* Tilera TILE-GX multicore architecture family */ 378 #define EM_CLOUDSHIELD 192 /* CloudShield architecture family */ 379 #define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st generation processor family */ 380 #define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd generation processor family */ 381 #define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */ 382 #define EM_OPEN8 196 /* Open8 8-bit RISC soft processor core */ 383 #define EM_RL78 197 /* Renesas RL78 family */ 384 #define EM_VIDEOCORE5 198 /* Broadcom VideoCore V processor */ 385 #define EM_78KOR 199 /* Renesas 78KOR family */ 386 #define EM_56800EX 200 /* Freescale 56800EX Digital Signal Controller (DSC) */ 387 #define EM_BA1 201 /* Beyond BA1 CPU architecture */ 388 #define EM_BA2 202 /* Beyond BA2 CPU architecture */ 389 #define EM_XCORE 203 /* XMOS xCORE processor family */ 390 #define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) family */ 391 #define EM_INTEL205 205 /* Reserved by Intel */ 392 #define EM_INTEL206 206 /* Reserved by Intel */ 393 #define EM_INTEL207 207 /* Reserved by Intel */ 394 #define EM_INTEL208 208 /* Reserved by Intel */ 395 #define EM_INTEL209 209 /* Reserved by Intel */ 396 #define EM_KM32 210 /* KM211 KM32 32-bit processor */ 397 #define EM_KMX32 211 /* KM211 KMX32 32-bit processor */ 398 #define EM_KMX16 212 /* KM211 KMX16 16-bit processor */ 399 #define EM_KMX8 213 /* KM211 KMX8 8-bit processor */ 400 #define EM_KVARC 214 /* KM211 KVARC processor */ 401 #define EM_CDP 215 /* Paneve CDP architecture family */ 402 #define EM_COGE 216 /* Cognitive Smart Memory Processor */ 403 #define EM_COOL 217 /* Bluechip Systems CoolEngine */ 404 #define EM_NORC 218 /* Nanoradio Optimized RISC */ 405 #define EM_CSR_KALIMBA 219 /* CSR Kalimba architecture family */ 406 #define EM_Z80 220 /* Zilog Z80 */ 407 #define EM_VISIUM 221 /* Controls and Data Services VISIUMcore processor */ 408 #define EM_FT32 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */ 409 #define EM_MOXIE 223 /* Moxie processor family */ 410 #define EM_AMDGPU 224 /* AMD GPU architecture */ 411 /* 225-242 - Reserved */ 412 #define EM_RISCV 243 /* RISC-V */ 334 413 335 414 /* Unofficial machine types follow */ … … 353 432 354 433 typedef struct { 355 Elf64_ Halfp_type; /* entry type */356 Elf64_ Halfp_flags; /* flags */434 Elf64_Word p_type; /* entry type */ 435 Elf64_Word p_flags; /* flags */ 357 436 Elf64_Off p_offset; /* offset */ 358 437 Elf64_Addr p_vaddr; /* virtual address */ … … 371 450 #define PT_SHLIB 5 /* Reserved, unspecified semantics */ 372 451 #define PT_PHDR 6 /* Entry for header table itself */ 373 #define PT_NUM 7 374 375 #define PT_LOOS 0x60000000 /* OS-specific range */ 376 #define PT_HIOS 0x6fffffff 377 #define PT_LOPROC 0x70000000 /* Processor-specific range */ 378 #define PT_HIPROC 0x7fffffff 452 #define PT_TLS 7 /* TLS initialisation image */ 453 #define PT_NUM 8 454 455 #define PT_LOOS 0x60000000 /* OS-specific range */ 456 457 /* GNU-specific */ 458 #define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */ 459 #define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */ 460 #define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */ 461 462 #define PT_HIOS 0x6fffffff 463 #define PT_LOPROC 0x70000000 /* Processor-specific range */ 464 #define PT_HIPROC 0x7fffffff 379 465 380 466 #define PT_MIPS_REGINFO 0x70000000 467 #define PT_MIPS_ABIFLAGS 0x70000003 381 468 382 469 /* p_flags */ … … 408 495 409 496 typedef struct { 410 Elf64_ Halfsh_name; /* section name (.shstrtab index) */411 Elf64_ Halfsh_type; /* section type */497 Elf64_Word sh_name; /* section name (.shstrtab index) */ 498 Elf64_Word sh_type; /* section type */ 412 499 Elf64_Xword sh_flags; /* section flags */ 413 500 Elf64_Addr sh_addr; /* virtual address */ 414 501 Elf64_Off sh_offset; /* file offset */ 415 502 Elf64_Xword sh_size; /* section size */ 416 Elf64_ Halfsh_link; /* link to another */417 Elf64_ Halfsh_info; /* misc info */503 Elf64_Word sh_link; /* link to another */ 504 Elf64_Word sh_info; /* misc info */ 418 505 Elf64_Xword sh_addralign; /* memory alignment */ 419 506 Elf64_Xword sh_entsize; /* table entry size */ … … 421 508 422 509 /* sh_type */ 423 #define SHT_NULL 0 /* Section header table entry unused */ 424 #define SHT_PROGBITS 1 /* Program information */ 425 #define SHT_SYMTAB 2 /* Symbol table */ 426 #define SHT_STRTAB 3 /* String table */ 427 #define SHT_RELA 4 /* Relocation information w/ addend */ 428 #define SHT_HASH 5 /* Symbol hash table */ 429 #define SHT_DYNAMIC 6 /* Dynamic linking information */ 430 #define SHT_NOTE 7 /* Auxiliary information */ 431 #define SHT_NOBITS 8 /* No space allocated in file image */ 432 #define SHT_REL 9 /* Relocation information w/o addend */ 433 #define SHT_SHLIB 10 /* Reserved, unspecified semantics */ 434 #define SHT_DYNSYM 11 /* Symbol table for dynamic linker */ 435 #define SHT_INIT_ARRAY 14 /* Initialization function pointers */ 436 #define SHT_FINI_ARRAY 15 /* Termination function pointers */ 437 #define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */ 438 #define SHT_GROUP 17 /* Section group */ 439 #define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */ 440 #define SHT_NUM 19 441 442 #define SHT_LOOS 0x60000000 /* Operating system specific range */ 443 #define SHT_SUNW_move 0x6ffffffa 444 #define SHT_SUNW_syminfo 0x6ffffffc 445 #define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ 446 #define SHT_GNU_verdef SHT_SUNW_verdef 447 #define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ 448 #define SHT_GNU_verneed SHT_SUNW_verneed 449 #define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ 450 #define SHT_GNU_versym SHT_SUNW_versym 451 #define SHT_HIOS 0x6fffffff 452 #define SHT_LOPROC 0x70000000 /* Processor-specific range */ 453 #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ 454 #define SHT_HIPROC 0x7fffffff 455 #define SHT_LOUSER 0x80000000 /* Application-specific range */ 456 #define SHT_HIUSER 0xffffffff 510 #define SHT_NULL 0 /* Section header table entry unused */ 511 #define SHT_PROGBITS 1 /* Program information */ 512 #define SHT_SYMTAB 2 /* Symbol table */ 513 #define SHT_STRTAB 3 /* String table */ 514 #define SHT_RELA 4 /* Relocation information w/ addend */ 515 #define SHT_HASH 5 /* Symbol hash table */ 516 #define SHT_DYNAMIC 6 /* Dynamic linking information */ 517 #define SHT_NOTE 7 /* Auxiliary information */ 518 #define SHT_NOBITS 8 /* No space allocated in file image */ 519 #define SHT_REL 9 /* Relocation information w/o addend */ 520 #define SHT_SHLIB 10 /* Reserved, unspecified semantics */ 521 #define SHT_DYNSYM 11 /* Symbol table for dynamic linker */ 522 #define SHT_INIT_ARRAY 14 /* Initialization function pointers */ 523 #define SHT_FINI_ARRAY 15 /* Termination function pointers */ 524 #define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */ 525 #define SHT_GROUP 17 /* Section group */ 526 #define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */ 527 #define SHT_NUM 19 528 529 #define SHT_LOOS 0x60000000 /* Operating system specific range */ 530 #define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* GNU incremental build data */ 531 #define SHT_LOSUNW 0x6ffffff4 532 #define SHT_SUNW_dof 0x6ffffff4 533 #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* GNU object attributes */ 534 #define SHT_SUNW_cap 0x6ffffff5 535 #define SHT_SUNW_SIGNATURE 0x6ffffff6 536 #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ 537 #define SHT_GNU_LIBLIST 0x6ffffff7 /* GNU list of prelink dependencies */ 538 #define SHT_SUNW_move 0x6ffffffa 539 #define SHT_SUNW_COMDAT 0x6ffffffb 540 #define SHT_SUNW_syminfo 0x6ffffffc 541 #define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ 542 #define SHT_GNU_verdef SHT_SUNW_verdef 543 #define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ 544 #define SHT_GNU_verneed SHT_SUNW_verneed 545 #define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ 546 #define SHT_GNU_versym SHT_SUNW_versym 547 #define SHT_HISUNW 0x6fffffff 548 #define SHT_HIOS 0x6fffffff 549 #define SHT_LOPROC 0x70000000 /* Processor-specific range */ 550 #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ 551 #define SHT_ARM_EXIDX 0x70000001 /* exception index table */ 552 #define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking 553 * pre-emption map */ 554 #define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility 555 * attributes */ 556 #define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */ 557 #define SHT_ARM_OVERLAYSECTION 0x70000005 558 #define SHT_MIPS_REGINFO 0x70000006 559 #define SHT_MIPS_OPTIONS 0x7000000d 560 #define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */ 561 #define SHT_MIPS_XHASH 0x7000002b /* MIPS version of GNU_HASH */ 562 #define SHT_HIPROC 0x7fffffff 563 #define SHT_LOUSER 0x80000000 /* Application-specific range */ 564 #define SHT_HIUSER 0xffffffff 457 565 458 566 /* sh_flags */ 459 #define SHF_WRITE 0x1 /* Section contains writable data */ 460 #define SHF_ALLOC 0x2 /* Section occupies memory */ 461 #define SHF_EXECINSTR 0x4 /* Section contains executable insns */ 462 #define SHF_MERGE 0x10 /* Section contains data that can be merged */ 463 #define SHF_STRINGS 0x20 /* Section contains null-terminated strings */ 464 #define SHF_INFO_LINK 0x40 /* Section header's sh_info holds table index */ 465 #define SHF_LINK_ORDER 0x80 /* Section has special ordering requirements */ 466 467 #define SHF_MASKOS 0x0f000000 /* Operating system specific values */ 468 #define SHF_MASKPROC 0xf0000000 /* Processor-specific values */ 469 567 #define SHF_WRITE 0x00000001 /* Contains writable data */ 568 #define SHF_ALLOC 0x00000002 /* Occupies memory */ 569 #define SHF_EXECINSTR 0x00000004 /* Contains executable insns */ 570 #define SHF_MERGE 0x00000010 /* Might be merged */ 571 #define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */ 572 #define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */ 573 #define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */ 574 #define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */ 575 #define SHF_GROUP 0x00000200 /* Is member of a group */ 576 #define SHF_TLS 0x00000400 /* Holds thread-local data */ 577 #define SHF_MASKOS 0x0ff00000 /* Operating system specific values */ 578 #define SHF_MASKPROC 0xf0000000 /* Processor-specific values */ 579 #define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */ 580 #define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc 581 (Solaris).*/ 470 582 /* 471 583 * Symbol Table … … 481 593 482 594 typedef struct { 483 Elf64_ Halfst_name; /* Symbol name (.strtab index) */595 Elf64_Word st_name; /* Symbol name (.strtab index) */ 484 596 Elf_Byte st_info; /* type / binding attrs */ 485 597 Elf_Byte st_other; /* unused */ 486 Elf64_ Quarterst_shndx; /* section index of symbol */598 Elf64_Half st_shndx; /* section index of symbol */ 487 599 Elf64_Addr st_value; /* value of symbol */ 488 600 Elf64_Xword st_size; /* size of symbol */ … … 516 628 517 629 #define STT_LOOS 10 /* Operating system specific range */ 630 #define STT_GNU_IFUNC 10 /* GNU extension: indirect function */ 518 631 #define STT_HIOS 12 519 632 #define STT_LOPROC 13 /* Processor-specific range */ … … 611 724 Elf64_Xword m_info; /* size + index */ 612 725 Elf64_Xword m_poffset; /* symbol offset */ 613 Elf64_ Halfm_repeat; /* repeat count */614 Elf64_ Halfm_stride; /* stride info */726 Elf64_Word m_repeat; /* repeat count */ 727 Elf64_Word m_stride; /* stride info */ 615 728 } Elf64_Move; 616 729 … … 687 800 #define DT_INIT_ARRAYSZ 27 /* Address of termination function array */ 688 801 #define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/ 689 #define DT_NUM 29 802 #define DT_RUNPATH 29 /* overrides DT_RPATH */ 803 #define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */ 804 #define DT_ENCODING 31 /* ??? */ 805 #define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */ 806 #define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */ 807 #define DT_NUM 34 690 808 691 809 #define DT_LOOS 0x60000000 /* Operating system specific range */ 810 #define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table */ 692 811 #define DT_VERSYM 0x6ffffff0 /* Symbol versions */ 693 812 #define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */ … … 698 817 #define DT_HIOS 0x6fffffff 699 818 #define DT_LOPROC 0x70000000 /* Processor-specific range */ 819 #define DT_MIPS_XHASH 0x70000036 /* MIPS version of GNU_HASH */ 700 820 #define DT_HIPROC 0x7fffffff 701 821 702 /* Flag values for DT_FLAGS_1 (incomplete) */ 703 #define DF_1_INITFIRST 0x00000020 /* Object's init/fini take priority */ 822 /* Flag values for DT_FLAGS */ 823 #define DF_ORIGIN 0x00000001 /* uses $ORIGIN */ 824 #define DF_SYMBOLIC 0x00000002 /* */ 825 #define DF_TEXTREL 0x00000004 /* */ 826 #define DF_BIND_NOW 0x00000008 /* */ 827 #define DF_STATIC_TLS 0x00000010 /* */ 828 829 /* Flag values for DT_FLAGS_1 */ 830 #define DF_1_NOW 0x00000001 /* Same as DF_BIND_NOW */ 831 #define DF_1_GLOBAL 0x00000002 /* Unused */ 832 #define DF_1_GROUP 0x00000004 /* Is member of group */ 833 #define DF_1_NODELETE 0x00000008 /* Cannot be deleted from process */ 834 #define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filters */ 835 #define DF_1_INITFIRST 0x00000020 /* init/fini takes priority */ 836 #define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ 837 #define DF_1_ORIGIN 0x00000080 /* Require $ORIGIN processing */ 838 #define DF_1_DIRECT 0x00000100 /* Enable direct bindings */ 839 #define DF_1_INTERPOSE 0x00000400 /* Is an interposer */ 840 #define DF_1_NODEFLIB 0x00000800 /* Ignore default library search path */ 841 #define DF_1_NODUMP 0x00001000 /* Cannot be dumped with dldump(3C) */ 842 #define DF_1_CONFALT 0x00002000 /* Configuration alternative */ 843 #define DF_1_ENDFILTEE 0x00004000 /* Filtee ends filter's search */ 844 #define DF_1_DISPRELDNE 0x00008000 /* Did displacement relocation */ 845 #define DF_1_DISPRELPND 0x00010000 /* Pending displacement relocation */ 846 #define DF_1_NODIRECT 0x00020000 /* Has non-direct bindings */ 847 #define DF_1_IGNMULDEF 0x00040000 /* Used internally */ 848 #define DF_1_NOKSYMS 0x00080000 /* Used internally */ 849 #define DF_1_NOHDR 0x00100000 /* Used internally */ 850 #define DF_1_EDITED 0x00200000 /* Has been modified since build */ 851 #define DF_1_NORELOC 0x00400000 /* Used internally */ 852 #define DF_1_SYMINTPOSE 0x00800000 /* Has individual symbol interposers */ 853 #define DF_1_GLOBAUDIT 0x01000000 /* Require global auditing */ 854 #define DF_1_SINGLETON 0x02000000 /* Has singleton symbols */ 855 #define DF_1_STUB 0x04000000 /* Stub */ 856 #define DF_1_PIE 0x08000000 /* Position Independent Executable */ 704 857 705 858 /* … … 712 865 713 866 typedef struct { 714 Elf64_ Half a_type;/* 32-bit id */715 Elf64_Xword a_v; 867 Elf64_Word a_type; /* 32-bit id */ 868 Elf64_Xword a_v; /* 64-bit id */ 716 869 } Aux64Info; 717 870 … … 730 883 #define AT_ICACHEBSIZE 11 /* Instruction cache block size */ 731 884 #define AT_UCACHEBSIZE 12 /* Unified cache block size */ 885 #define AT_STACKBASE 13 /* Base address of the main thread */ 732 886 733 887 /* Vendor specific */ … … 757 911 758 912 /* 913 * The header for GNU-style hash sections. 914 */ 915 typedef struct { 916 uint32_t gh_nbuckets; /* Number of hash buckets. */ 917 uint32_t gh_symndx; /* First visible symbol in .dynsym. */ 918 uint32_t gh_maskwords; /* #maskwords used in bloom filter. */ 919 uint32_t gh_shift2; /* Bloom filter shift count. */ 920 } Elf_GNU_Hash_Header; 921 922 /* 759 923 * Note Headers 760 924 */ … … 766 930 767 931 typedef struct { 768 Elf64_ Halfn_namesz;769 Elf64_ Halfn_descsz;770 Elf64_ Halfn_type;932 Elf64_Word n_namesz; 933 Elf64_Word n_descsz; 934 Elf64_Word n_type; 771 935 } Elf64_Nhdr; 772 936 773 #define ELF_NOTE_TYPE_ABI_TAG 1 774 937 #define ELF_NOTE_GNU_NAMESZ 4 938 #define ELF_NOTE_GNU_NAME "GNU\0" 939 940 /* 941 * GNU-specific note type: ABI tag 942 * name: GNU\0 943 * namesz: 4 944 * desc: 945 * word[0]: OS tag 946 * word[1]: major version 947 * word[2]: minor version 948 * word[3]: teeny version 949 * descsz: 16 950 */ 775 951 /* GNU-specific note name and description sizes */ 776 #define ELF_NOTE_ABI_NAMESZ 4 777 #define ELF_NOTE_ABI_DESCSZ 16 778 /* GNU-specific note name */ 779 #define ELF_NOTE_ABI_NAME "GNU\0" 780 952 #define ELF_NOTE_TYPE_ABI_TAG 1 953 #define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME 954 #define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ 955 #define ELF_NOTE_ABI_DESCSZ 16 781 956 /* GNU-specific OS/version value stuff */ 782 #define ELF_NOTE_ABI_OS_LINUX 0 783 #define ELF_NOTE_ABI_OS_HURD 1 784 #define ELF_NOTE_ABI_OS_SOLARIS 2 785 786 /* NetBSD-specific note type: Emulation name. desc is emul name string. */ 787 #define ELF_NOTE_TYPE_NETBSD_TAG 1 957 #define ELF_NOTE_ABI_OS_LINUX 0 958 #define ELF_NOTE_ABI_OS_HURD 1 959 #define ELF_NOTE_ABI_OS_SOLARIS 2 960 #define ELF_NOTE_ABI_OS_KFREEBSD 3 961 #define ELF_NOTE_ABI_OS_KNETBSD 4 962 963 /* Old gcc style, under the ABI tag */ 964 #define ELF_NOTE_OGCC_NAMESZ 8 965 #define ELF_NOTE_OGCC_NAME "01.01\0\0\0\0" 966 #define ELF_NOTE_OGCC_DESCSZ 0 967 968 /* 969 * GNU-specific note type: Hardware capabilities 970 * name: GNU\0 971 * namesz: 4 972 * desc: 973 * word[0]: Number of entries 974 * word[1]: Bitmask of enabled entries 975 * Followed by a byte id, and a NUL terminated string per entry 976 * descsz: variable 977 */ 978 #define ELF_NOTE_TYPE_GNU_HWCAP 2 979 980 /* 981 * GNU-specific note type: Build ID generated by ld 982 * name: GNU\0 983 * desc: 984 * word[0..4] SHA1 [default] 985 * or 986 * word[0..3] md5 or uuid 987 * descsz: 16 or 20 988 */ 989 #define ELF_NOTE_TYPE_GNU_BUILD_ID 3 990 991 /* SuSE-specific note type: ABI 992 * name: SuSE\0 993 * namesz: 5 994 * desc: 995 * half[0] = MMmm 996 * 997 * M = product major version 998 * m = product minor version 999 * descsz: 2 1000 */ 1001 #define ELF_NOTE_TYPE_SUSE_TAG 1 1002 /* SuSE-specific note name and description sizes */ 1003 #define ELF_NOTE_SUSE_NAMESZ 5 1004 #define ELF_NOTE_SUSE_DESCSZ 2 1005 /* SuSE-specific note name */ 1006 #define ELF_NOTE_SUSE_NAME "SuSE\0" 1007 1008 /* SuSE-specific note type: version 1009 * name: SuSE\0\0\0\0 1010 * namesz: 8 1011 * desc: 1012 * word[0] = VVTTMMmm 1013 * 1014 * V = version of following data 1015 * T = product type: [box, sles, nld, whatever] 1016 * M = product major version 1017 * m = product minor version 1018 * descsz: 8 1019 */ 1020 #define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */ 1021 /* SuSE-specific note name and description sizes */ 1022 #define ELF_NOTE_SUSE_VERSION_NAMESZ 8 1023 #define ELF_NOTE_SUSE_VERSION_DESCSZ 8 1024 /* SuSE-specific note name */ 1025 #define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0" 1026 1027 /* Go-specific note type: buildid 1028 * name: Go\0\0 1029 * namesz: 4 1030 * desc: 1031 * words[10] 1032 * descsz: 40 1033 */ 1034 #define ELF_NOTE_TYPE_GO_BUILDID_TAG 4 1035 #define ELF_NOTE_GO_BUILDID_NAMESZ 4 1036 #define ELF_NOTE_GO_BUILDID_DESCSZ 40 1037 #define ELF_NOTE_GO_BUILDID_NAME "Go\0\0" 1038 1039 /* NetBSD-specific note type: NetBSD ABI version. 1040 * name: NetBSD\0\0 1041 * namesz: 8 1042 * desc: 1043 * word[0]: MMmmrrpp00 1044 * 1045 * M = major version 1046 * m = minor version 1047 * r = release ["",A-Z,Z[A-Z] but numeric] 1048 * p = patchlevel 1049 * descsz: 4 1050 */ 1051 #define ELF_NOTE_TYPE_NETBSD_TAG 1 788 1052 /* NetBSD-specific note name and description sizes */ 789 1053 #define ELF_NOTE_NETBSD_NAMESZ 7 790 1054 #define ELF_NOTE_NETBSD_DESCSZ 4 791 1055 /* NetBSD-specific note name */ 792 #define ELF_NOTE_NETBSD_NAME "NetBSD\0\0" 793 794 /* NetBSD-specific note type: Checksum. There should be 1 NOTE per PT_LOAD 795 section. desc is a tuple of <phnum>(16),<chk-type>(16),<chk-value>. */ 796 #define ELF_NOTE_TYPE_CHECKSUM_TAG 2 797 #define ELF_NOTE_CHECKSUM_CRC32 1 798 #define ELF_NOTE_CHECKSUM_MD5 2 799 #define ELF_NOTE_CHECKSUM_SHA1 3 800 #define ELF_NOTE_CHECKSUM_SHA256 4 801 802 /* NetBSD-specific note type: PaX. There should be 1 NOTE per executable. 803 section. desc is a 32 bit bitmask */ 1056 #define ELF_NOTE_NETBSD_NAME "NetBSD\0\0" 1057 1058 /* NetBSD-specific note type: Emulation (obsolete; last used early 2000) 1059 * name: NetBSD\0\0 1060 * namesz: 8 1061 * desc: 1062 * "netbsd\0" 1063 * 1064 * descsz: 8 1065 */ 1066 #define ELF_NOTE_TYPE_NETBSD_EMUL_TAG 2 1067 #define ELF_NOTE_NETBSD_EMUL_NAMESZ 7 1068 #define ELF_NOTE_NETBSD_EMUL_DESCSZ 7 1069 /* NetBSD-specific note name */ 1070 #define ELF_NOTE_NETBSD_EMUL_NAME "NetBSD\0\0" 1071 1072 /* 1073 * NetBSD-specific note type: PaX. 1074 * There should be 1 NOTE per executable. 1075 * name: PaX\0 1076 * namesz: 4 1077 * desc: 1078 * word[0]: capability bitmask 1079 * descsz: 4 1080 */ 804 1081 #define ELF_NOTE_TYPE_PAX_TAG 3 805 1082 #define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */ … … 826 1103 * ELF_NOTE_NETBSD_CORE_PROCINFO 827 1104 * Note is a "netbsd_elfcore_procinfo" structure. 1105 * ELF_NOTE_NETBSD_CORE_AUXV 1106 * Note is an array of AuxInfo structures. 828 1107 * 829 1108 * We also use ptrace(2) request numbers (the ones that exist in … … 839 1118 840 1119 #define ELF_NOTE_NETBSD_CORE_PROCINFO 1 1120 #define ELF_NOTE_NETBSD_CORE_AUXV 2 841 1121 842 1122 #define NETBSD_ELFCORE_PROCINFO_VERSION 1 … … 850 1130 uint32_t cpi_sigpend[4]; /* pending signals */ 851 1131 uint32_t cpi_sigmask[4]; /* blocked signals */ 852 uint32_t cpi_sigignore[4];/* blocked signals */853 uint32_t cpi_sigcatch[4];/* blockedsignals */1132 uint32_t cpi_sigignore[4];/* ignored signals */ 1133 uint32_t cpi_sigcatch[4];/* caught signals */ 854 1134 int32_t cpi_pid; /* process ID */ 855 1135 int32_t cpi_ppid; /* parent process ID */ … … 868 1148 }; 869 1149 1150 /* 1151 * NetBSD-specific note type: MACHINE_ARCH. 1152 * There should be 1 NOTE per executable. 1153 * name: NetBSD\0 1154 * namesz: 7 1155 * desc: string 1156 * descsz: variable 1157 */ 1158 #define ELF_NOTE_TYPE_MARCH_TAG 5 1159 /* NetBSD-specific note name and description sizes */ 1160 #define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_NETBSD_NAMESZ 1161 /* NetBSD-specific note name */ 1162 #define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME 1163 1164 /* 1165 * NetBSD-specific note type: MCMODEL 1166 * There should be 1 NOTE per executable. 1167 * name: NetBSD\0 1168 * namesz: 7 1169 * code model: string 1170 */ 1171 1172 #define ELF_NOTE_TYPE_MCMODEL_TAG 6 1173 /* NetBSD-specific note name and description sizes */ 1174 #define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ 1175 /* NetBSD-specific note name */ 1176 #define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME 1177 1178 1179 #if !defined(ELFSIZE) 1180 # if defined(_RUMPKERNEL) || !defined(_KERNEL) 1181 # define ELFSIZE ARCH_ELFSIZE 1182 # else 1183 # define ELFSIZE KERN_ELFSIZE 1184 # endif 1185 #endif 1186 1187 #if defined(ELFSIZE) 1188 #define CONCAT(x,y) __CONCAT(x,y) 1189 #define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) 1190 #define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) 1191 #define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) 1192 #define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) 1193 #define ElfW(x) CONCAT(Elf,CONCAT(ELFSIZE,CONCAT(_,x))) 1194 #endif 1195 870 1196 #if defined(ELFSIZE) && (ELFSIZE == 32) 871 #define Elf_Ehdr Elf32_Ehdr 872 #define Elf_Phdr Elf32_Phdr 873 #define Elf_Shdr Elf32_Shdr 874 #define Elf_Sym Elf32_Sym 875 #define Elf_Rel Elf32_Rel 876 #define Elf_Rela Elf32_Rela 877 #define Elf_Dyn Elf32_Dyn 878 #define Elf_Word Elf32_Word 879 #define Elf_Sword Elf32_Sword 880 #define Elf_Addr Elf32_Addr 881 #define Elf_Off Elf32_Off 882 #define Elf_SOff Elf32_SOff 883 #define Elf_Nhdr Elf32_Nhdr 884 885 #define ELF_R_SYM ELF32_R_SYM 886 #define ELF_R_TYPE ELF32_R_TYPE 887 #define ELFCLASS ELFCLASS32 888 889 #define AuxInfo Aux32Info 1197 #define Elf_Ehdr Elf32_Ehdr 1198 #define Elf_Phdr Elf32_Phdr 1199 #define Elf_Shdr Elf32_Shdr 1200 #define Elf_Sym Elf32_Sym 1201 #define Elf_Rel Elf32_Rel 1202 #define Elf_Rela Elf32_Rela 1203 #define Elf_Dyn Elf32_Dyn 1204 #define Elf_Word Elf32_Word 1205 #define Elf_Sword Elf32_Sword 1206 #define Elf_Half Elf32_Half 1207 #define Elf_Addr Elf32_Addr 1208 #define Elf_Off Elf32_Off 1209 #define Elf_SOff Elf32_SOff 1210 #define Elf_Nhdr Elf32_Nhdr 1211 #define Elf_Verdef Elf32_Verdef 1212 #define Elf_Verdaux Elf32_Verdaux 1213 #define Elf_Verneed Elf32_Verneed 1214 #define Elf_Vernaux Elf32_Vernaux 1215 #define Elf_Versym Elf32_Versym 1216 1217 #define ELF_R_SYM ELF32_R_SYM 1218 #define ELF_R_TYPE ELF32_R_TYPE 1219 #define ELFCLASS ELFCLASS32 1220 1221 #define AuxInfo Aux32Info 890 1222 #elif defined(ELFSIZE) && (ELFSIZE == 64) 891 #define Elf_Ehdr Elf64_Ehdr 892 #define Elf_Phdr Elf64_Phdr 893 #define Elf_Shdr Elf64_Shdr 894 #define Elf_Sym Elf64_Sym 895 #define Elf_Rel Elf64_Rel 896 #define Elf_Rela Elf64_Rela 897 #define Elf_Dyn Elf64_Dyn 898 #define Elf_Word Elf64_Word 899 #define Elf_Sword Elf64_Sword 900 #define Elf_Addr Elf64_Addr 901 #define Elf_Off Elf64_Off 902 #define Elf_SOff Elf64_SOff 903 #define Elf_Nhdr Elf64_Nhdr 904 905 #define ELF_R_SYM ELF64_R_SYM 906 #define ELF_R_TYPE ELF64_R_TYPE 907 #define ELFCLASS ELFCLASS64 908 909 #define AuxInfo Aux64Info 1223 #define Elf_Ehdr Elf64_Ehdr 1224 #define Elf_Phdr Elf64_Phdr 1225 #define Elf_Shdr Elf64_Shdr 1226 #define Elf_Sym Elf64_Sym 1227 #define Elf_Rel Elf64_Rel 1228 #define Elf_Rela Elf64_Rela 1229 #define Elf_Dyn Elf64_Dyn 1230 #define Elf_Word Elf64_Word 1231 #define Elf_Sword Elf64_Sword 1232 #define Elf_Half Elf64_Half 1233 #define Elf_Addr Elf64_Addr 1234 #define Elf_Off Elf64_Off 1235 #define Elf_SOff Elf64_SOff 1236 #define Elf_Nhdr Elf64_Nhdr 1237 #define Elf_Verdef Elf64_Verdef 1238 #define Elf_Verdaux Elf64_Verdaux 1239 #define Elf_Verneed Elf64_Verneed 1240 #define Elf_Vernaux Elf64_Vernaux 1241 #define Elf_Versym Elf64_Versym 1242 1243 #define ELF_R_SYM ELF64_R_SYM 1244 #define ELF_R_TYPE ELF64_R_TYPE 1245 #define ELFCLASS ELFCLASS64 1246 1247 #define AuxInfo Aux64Info 1248 #endif 1249 1250 #ifndef Elf_Symindx 1251 #define Elf_Symindx uint32_t 910 1252 #endif 911 1253 … … 926 1268 927 1269 typedef struct { 928 Elf64_ Halfsi_boundto; /* direct bindings - symbol bound to */929 Elf64_ Halfsi_flags; /* per symbol flags */1270 Elf64_Word si_boundto; /* direct bindings - symbol bound to */ 1271 Elf64_Word si_flags; /* per symbol flags */ 930 1272 } Elf64_Syminfo; 931 1273 … … 957 1299 */ 958 1300 #define VER_DEF_NONE 0 959 #define VER_DEF_CURRENT 1 1301 #define VER_DEF_CURRENT 1 1302 1303 /* 1304 * These constants are used for Elf32_Verdef struct's vd_ndx. 1305 */ 1306 #define VER_DEF_IDX(x) VER_NDX(x) 960 1307 961 1308 /* … … 968 1315 * These are used in an Elf32_Versym field. 969 1316 */ 970 #define VER_NDX_LOCAL 0 971 #define VER_NDX_GLOBAL 1 1317 #define VER_NDX_LOCAL 0 1318 #define VER_NDX_GLOBAL 1 1319 #define VER_NDX_GIVEN 2 972 1320 973 1321 /* … … 978 1326 979 1327 /* 980 * GNU Extension hidding symb 981 */ 982 #define VERSYM_HIDDEN 0x8000 983 #define VERSYM_VERSION 0x7fff 1328 * These constants are used for Elf32_Vernaux struct's vna_other. 1329 */ 1330 #define VER_NEED_HIDDEN VER_NDX_HIDDEN 1331 #define VER_NEED_IDX(x) VER_NDX(x) 1332 1333 /* index */ 1334 #define VER_NDX_HIDDEN 0x8000 1335 #define VER_NDX(x) ((x) & ~VER_NDX_HIDDEN) 1336 1337 /* 1338 * GNU Extension hidding symbol 1339 */ 1340 #define VERSYM_HIDDEN 0x8000 1341 #define VERSYM_VERSION 0x7fff 984 1342 985 1343 #define ELF_VER_CHR '@' … … 1031 1389 #ifdef _KERNEL 1032 1390 1033 #define ELF_AUX_ENTRIES 14 /* Max size of aux array passed to loader */ 1391 /* 1392 * Arbitrary limits to avoid DoS for excessive memory allocation. 1393 */ 1394 #define ELF_MAXPHNUM 128 1395 #define ELF_MAXSHNUM 32768 1396 #define ELF_MAXNOTESIZE 1024 1397 1398 #define ELF_AUX_ENTRIES 15 /* Max size of aux array passed to loader */ 1034 1399 #define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */ 1035 1400 #define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */ … … 1061 1426 #if defined(ELFSIZE) 1062 1427 struct elf_args { 1063 Elf_Addr arg_entry;/* program entry point */1064 Elf_Addr arg_interp;/* Interpreter load address */1065 Elf_Addr arg_phaddr;/* program header address */1066 Elf_Addr arg_phentsize;/* Size of program header */1067 Elf_Addr arg_phnum;/* Number of program headers */1428 Elf_Addr arg_entry; /* program entry point */ 1429 Elf_Addr arg_interp; /* Interpreter load address */ 1430 Elf_Addr arg_phaddr; /* program header address */ 1431 Elf_Addr arg_phentsize; /* Size of program header */ 1432 Elf_Addr arg_phnum; /* Number of program headers */ 1068 1433 }; 1069 1434 #endif … … 1073 1438 #endif 1074 1439 1440 struct ps_strings; 1441 struct coredump_iostate; 1442 struct note_state; 1443 struct exec_package; 1444 1075 1445 #ifdef EXEC_ELF32 1076 1446 int exec_elf32_makecmds(struct lwp *, struct exec_package *); 1447 int elf32_populate_auxv(struct lwp *, struct exec_package *, char **); 1077 1448 int elf32_copyargs(struct lwp *, struct exec_package *, 1078 1449 struct ps_strings *, char **, void *); 1079 1450 1080 int coredump_elf32(struct lwp *, void *); 1081 int coredump_writenote_elf32(struct proc *, void *, Elf32_Nhdr *, 1082 const char *, void *); 1083 1084 int elf32_check_header(Elf32_Ehdr *, int); 1451 int elf32_check_header(Elf32_Ehdr *); 1085 1452 #endif 1453 1454 int real_coredump_elf32(struct lwp *, struct coredump_iostate *); 1455 int coredump_elf32(struct lwp *, struct coredump_iostate *); 1456 void coredump_savenote_elf32(struct note_state *, unsigned int, 1457 const char *, void *, size_t); 1458 1086 1459 1087 1460 #ifdef EXEC_ELF64 1088 1461 int exec_elf64_makecmds(struct lwp *, struct exec_package *); 1462 int elf64_populate_auxv(struct lwp *, struct exec_package *, char **); 1089 1463 int elf64_copyargs(struct lwp *, struct exec_package *, 1090 1464 struct ps_strings *, char **, void *); 1091 1465 1092 int coredump_elf64(struct lwp *, void *); 1093 int coredump_writenote_elf64(struct proc *, void *, Elf64_Nhdr *, 1094 const char *, void *); 1095 1096 int elf64_check_header(Elf64_Ehdr *, int); 1466 int elf64_check_header(Elf64_Ehdr *); 1097 1467 #endif 1098 1468 1469 int real_coredump_elf64(struct lwp *, struct coredump_iostate *); 1470 int coredump_elf64(struct lwp *, struct coredump_iostate *); 1471 void coredump_savenote_elf64(struct note_state *, unsigned int, 1472 const char *, void *, size_t); 1473 1474 1099 1475 #endif /* _KERNEL */ 1100 1476
Note: See TracChangeset
for help on using the changeset viewer.