| ... | ... | @@ -7,6 +7,246 @@ const mem = std.mem; |
| 7 | 7 | const debug = std.debug; |
| 8 | 8 | const InStream = std.stream.InStream; |
| 9 | 9 | |
| 10 | pub const AT_NULL = 0; |
| 11 | pub const AT_IGNORE = 1; |
| 12 | pub const AT_EXECFD = 2; |
| 13 | pub const AT_PHDR = 3; |
| 14 | pub const AT_PHENT = 4; |
| 15 | pub const AT_PHNUM = 5; |
| 16 | pub const AT_PAGESZ = 6; |
| 17 | pub const AT_BASE = 7; |
| 18 | pub const AT_FLAGS = 8; |
| 19 | pub const AT_ENTRY = 9; |
| 20 | pub const AT_NOTELF = 10; |
| 21 | pub const AT_UID = 11; |
| 22 | pub const AT_EUID = 12; |
| 23 | pub const AT_GID = 13; |
| 24 | pub const AT_EGID = 14; |
| 25 | pub const AT_CLKTCK = 17; |
| 26 | pub const AT_PLATFORM = 15; |
| 27 | pub const AT_HWCAP = 16; |
| 28 | pub const AT_FPUCW = 18; |
| 29 | pub const AT_DCACHEBSIZE = 19; |
| 30 | pub const AT_ICACHEBSIZE = 20; |
| 31 | pub const AT_UCACHEBSIZE = 21; |
| 32 | pub const AT_IGNOREPPC = 22; |
| 33 | pub const AT_SECURE = 23; |
| 34 | pub const AT_BASE_PLATFORM = 24; |
| 35 | pub const AT_RANDOM = 25; |
| 36 | pub const AT_HWCAP2 = 26; |
| 37 | pub const AT_EXECFN = 31; |
| 38 | pub const AT_SYSINFO = 32; |
| 39 | pub const AT_SYSINFO_EHDR = 33; |
| 40 | pub const AT_L1I_CACHESHAPE = 34; |
| 41 | pub const AT_L1D_CACHESHAPE = 35; |
| 42 | pub const AT_L2_CACHESHAPE = 36; |
| 43 | pub const AT_L3_CACHESHAPE = 37; |
| 44 | pub const AT_L1I_CACHESIZE = 40; |
| 45 | pub const AT_L1I_CACHEGEOMETRY = 41; |
| 46 | pub const AT_L1D_CACHESIZE = 42; |
| 47 | pub const AT_L1D_CACHEGEOMETRY = 43; |
| 48 | pub const AT_L2_CACHESIZE = 44; |
| 49 | pub const AT_L2_CACHEGEOMETRY = 45; |
| 50 | pub const AT_L3_CACHESIZE = 46; |
| 51 | pub const AT_L3_CACHEGEOMETRY = 47; |
| 52 | |
| 53 | pub const DT_NULL = 0; |
| 54 | pub const DT_NEEDED = 1; |
| 55 | pub const DT_PLTRELSZ = 2; |
| 56 | pub const DT_PLTGOT = 3; |
| 57 | pub const DT_HASH = 4; |
| 58 | pub const DT_STRTAB = 5; |
| 59 | pub const DT_SYMTAB = 6; |
| 60 | pub const DT_RELA = 7; |
| 61 | pub const DT_RELASZ = 8; |
| 62 | pub const DT_RELAENT = 9; |
| 63 | pub const DT_STRSZ = 10; |
| 64 | pub const DT_SYMENT = 11; |
| 65 | pub const DT_INIT = 12; |
| 66 | pub const DT_FINI = 13; |
| 67 | pub const DT_SONAME = 14; |
| 68 | pub const DT_RPATH = 15; |
| 69 | pub const DT_SYMBOLIC = 16; |
| 70 | pub const DT_REL = 17; |
| 71 | pub const DT_RELSZ = 18; |
| 72 | pub const DT_RELENT = 19; |
| 73 | pub const DT_PLTREL = 20; |
| 74 | pub const DT_DEBUG = 21; |
| 75 | pub const DT_TEXTREL = 22; |
| 76 | pub const DT_JMPREL = 23; |
| 77 | pub const DT_BIND_NOW = 24; |
| 78 | pub const DT_INIT_ARRAY = 25; |
| 79 | pub const DT_FINI_ARRAY = 26; |
| 80 | pub const DT_INIT_ARRAYSZ = 27; |
| 81 | pub const DT_FINI_ARRAYSZ = 28; |
| 82 | pub const DT_RUNPATH = 29; |
| 83 | pub const DT_FLAGS = 30; |
| 84 | pub const DT_ENCODING = 32; |
| 85 | pub const DT_PREINIT_ARRAY = 32; |
| 86 | pub const DT_PREINIT_ARRAYSZ = 33; |
| 87 | pub const DT_SYMTAB_SHNDX = 34; |
| 88 | pub const DT_NUM = 35; |
| 89 | pub const DT_LOOS = 0x6000000d; |
| 90 | pub const DT_HIOS = 0x6ffff000; |
| 91 | pub const DT_LOPROC = 0x70000000; |
| 92 | pub const DT_HIPROC = 0x7fffffff; |
| 93 | pub const DT_PROCNUM = DT_MIPS_NUM; |
| 94 | |
| 95 | pub const DT_VALRNGLO = 0x6ffffd00; |
| 96 | pub const DT_GNU_PRELINKED = 0x6ffffdf5; |
| 97 | pub const DT_GNU_CONFLICTSZ = 0x6ffffdf6; |
| 98 | pub const DT_GNU_LIBLISTSZ = 0x6ffffdf7; |
| 99 | pub const DT_CHECKSUM = 0x6ffffdf8; |
| 100 | pub const DT_PLTPADSZ = 0x6ffffdf9; |
| 101 | pub const DT_MOVEENT = 0x6ffffdfa; |
| 102 | pub const DT_MOVESZ = 0x6ffffdfb; |
| 103 | pub const DT_FEATURE_1 = 0x6ffffdfc; |
| 104 | pub const DT_POSFLAG_1 = 0x6ffffdfd; |
| 105 | |
| 106 | pub const DT_SYMINSZ = 0x6ffffdfe; |
| 107 | pub const DT_SYMINENT = 0x6ffffdff; |
| 108 | pub const DT_VALRNGHI = 0x6ffffdff; |
| 109 | pub const DT_VALNUM = 12; |
| 110 | |
| 111 | pub const DT_ADDRRNGLO = 0x6ffffe00; |
| 112 | pub const DT_GNU_HASH = 0x6ffffef5; |
| 113 | pub const DT_TLSDESC_PLT = 0x6ffffef6; |
| 114 | pub const DT_TLSDESC_GOT = 0x6ffffef7; |
| 115 | pub const DT_GNU_CONFLICT = 0x6ffffef8; |
| 116 | pub const DT_GNU_LIBLIST = 0x6ffffef9; |
| 117 | pub const DT_CONFIG = 0x6ffffefa; |
| 118 | pub const DT_DEPAUDIT = 0x6ffffefb; |
| 119 | pub const DT_AUDIT = 0x6ffffefc; |
| 120 | pub const DT_PLTPAD = 0x6ffffefd; |
| 121 | pub const DT_MOVETAB = 0x6ffffefe; |
| 122 | pub const DT_SYMINFO = 0x6ffffeff; |
| 123 | pub const DT_ADDRRNGHI = 0x6ffffeff; |
| 124 | pub const DT_ADDRNUM = 11; |
| 125 | |
| 126 | |
| 127 | pub const DT_VERSYM = 0x6ffffff0; |
| 128 | |
| 129 | pub const DT_RELACOUNT = 0x6ffffff9; |
| 130 | pub const DT_RELCOUNT = 0x6ffffffa; |
| 131 | |
| 132 | |
| 133 | pub const DT_FLAGS_1 = 0x6ffffffb; |
| 134 | pub const DT_VERDEF = 0x6ffffffc; |
| 135 | |
| 136 | pub const DT_VERDEFNUM = 0x6ffffffd; |
| 137 | pub const DT_VERNEED = 0x6ffffffe; |
| 138 | |
| 139 | pub const DT_VERNEEDNUM = 0x6fffffff; |
| 140 | pub const DT_VERSIONTAGNUM = 16; |
| 141 | |
| 142 | |
| 143 | |
| 144 | pub const DT_AUXILIARY = 0x7ffffffd; |
| 145 | pub const DT_FILTER = 0x7fffffff; |
| 146 | pub const DT_EXTRANUM = 3; |
| 147 | |
| 148 | |
| 149 | pub const DT_SPARC_REGISTER = 0x70000001; |
| 150 | pub const DT_SPARC_NUM = 2; |
| 151 | |
| 152 | pub const DT_MIPS_RLD_VERSION = 0x70000001; |
| 153 | pub const DT_MIPS_TIME_STAMP = 0x70000002; |
| 154 | pub const DT_MIPS_ICHECKSUM = 0x70000003; |
| 155 | pub const DT_MIPS_IVERSION = 0x70000004; |
| 156 | pub const DT_MIPS_FLAGS = 0x70000005; |
| 157 | pub const DT_MIPS_BASE_ADDRESS = 0x70000006; |
| 158 | pub const DT_MIPS_MSYM = 0x70000007; |
| 159 | pub const DT_MIPS_CONFLICT = 0x70000008; |
| 160 | pub const DT_MIPS_LIBLIST = 0x70000009; |
| 161 | pub const DT_MIPS_LOCAL_GOTNO = 0x7000000a; |
| 162 | pub const DT_MIPS_CONFLICTNO = 0x7000000b; |
| 163 | pub const DT_MIPS_LIBLISTNO = 0x70000010; |
| 164 | pub const DT_MIPS_SYMTABNO = 0x70000011; |
| 165 | pub const DT_MIPS_UNREFEXTNO = 0x70000012; |
| 166 | pub const DT_MIPS_GOTSYM = 0x70000013; |
| 167 | pub const DT_MIPS_HIPAGENO = 0x70000014; |
| 168 | pub const DT_MIPS_RLD_MAP = 0x70000016; |
| 169 | pub const DT_MIPS_DELTA_CLASS = 0x70000017; |
| 170 | pub const DT_MIPS_DELTA_CLASS_NO = 0x70000018; |
| 171 | |
| 172 | pub const DT_MIPS_DELTA_INSTANCE = 0x70000019; |
| 173 | pub const DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a; |
| 174 | |
| 175 | pub const DT_MIPS_DELTA_RELOC = 0x7000001b; |
| 176 | pub const DT_MIPS_DELTA_RELOC_NO = 0x7000001c; |
| 177 | |
| 178 | pub const DT_MIPS_DELTA_SYM = 0x7000001d; |
| 179 | |
| 180 | pub const DT_MIPS_DELTA_SYM_NO = 0x7000001e; |
| 181 | |
| 182 | pub const DT_MIPS_DELTA_CLASSSYM = 0x70000020; |
| 183 | |
| 184 | pub const DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021; |
| 185 | |
| 186 | pub const DT_MIPS_CXX_FLAGS = 0x70000022; |
| 187 | pub const DT_MIPS_PIXIE_INIT = 0x70000023; |
| 188 | pub const DT_MIPS_SYMBOL_LIB = 0x70000024; |
| 189 | pub const DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025; |
| 190 | pub const DT_MIPS_LOCAL_GOTIDX = 0x70000026; |
| 191 | pub const DT_MIPS_HIDDEN_GOTIDX = 0x70000027; |
| 192 | pub const DT_MIPS_PROTECTED_GOTIDX = 0x70000028; |
| 193 | pub const DT_MIPS_OPTIONS = 0x70000029; |
| 194 | pub const DT_MIPS_INTERFACE = 0x7000002a; |
| 195 | pub const DT_MIPS_DYNSTR_ALIGN = 0x7000002b; |
| 196 | pub const DT_MIPS_INTERFACE_SIZE = 0x7000002c; |
| 197 | pub const DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d; |
| 198 | |
| 199 | pub const DT_MIPS_PERF_SUFFIX = 0x7000002e; |
| 200 | |
| 201 | pub const DT_MIPS_COMPACT_SIZE = 0x7000002f; |
| 202 | pub const DT_MIPS_GP_VALUE = 0x70000030; |
| 203 | pub const DT_MIPS_AUX_DYNAMIC = 0x70000031; |
| 204 | |
| 205 | pub const DT_MIPS_PLTGOT = 0x70000032; |
| 206 | |
| 207 | pub const DT_MIPS_RWPLT = 0x70000034; |
| 208 | pub const DT_MIPS_RLD_MAP_REL = 0x70000035; |
| 209 | pub const DT_MIPS_NUM = 0x36; |
| 210 | |
| 211 | pub const DT_ALPHA_PLTRO = (DT_LOPROC + 0); |
| 212 | pub const DT_ALPHA_NUM = 1; |
| 213 | |
| 214 | pub const DT_PPC_GOT = (DT_LOPROC + 0); |
| 215 | pub const DT_PPC_OPT = (DT_LOPROC + 1); |
| 216 | pub const DT_PPC_NUM = 2; |
| 217 | |
| 218 | pub const DT_PPC64_GLINK = (DT_LOPROC + 0); |
| 219 | pub const DT_PPC64_OPD = (DT_LOPROC + 1); |
| 220 | pub const DT_PPC64_OPDSZ = (DT_LOPROC + 2); |
| 221 | pub const DT_PPC64_OPT = (DT_LOPROC + 3); |
| 222 | pub const DT_PPC64_NUM = 4; |
| 223 | |
| 224 | pub const DT_IA_64_PLT_RESERVE = (DT_LOPROC + 0); |
| 225 | pub const DT_IA_64_NUM = 1; |
| 226 | |
| 227 | pub const DT_NIOS2_GP = 0x70000002; |
| 228 | |
| 229 | pub const PT_NULL = 0; |
| 230 | pub const PT_LOAD = 1; |
| 231 | pub const PT_DYNAMIC = 2; |
| 232 | pub const PT_INTERP = 3; |
| 233 | pub const PT_NOTE = 4; |
| 234 | pub const PT_SHLIB = 5; |
| 235 | pub const PT_PHDR = 6; |
| 236 | pub const PT_TLS = 7; |
| 237 | pub const PT_NUM = 8; |
| 238 | pub const PT_LOOS = 0x60000000; |
| 239 | pub const PT_GNU_EH_FRAME = 0x6474e550; |
| 240 | pub const PT_GNU_STACK = 0x6474e551; |
| 241 | pub const PT_GNU_RELRO = 0x6474e552; |
| 242 | pub const PT_LOSUNW = 0x6ffffffa; |
| 243 | pub const PT_SUNWBSS = 0x6ffffffa; |
| 244 | pub const PT_SUNWSTACK = 0x6ffffffb; |
| 245 | pub const PT_HISUNW = 0x6fffffff; |
| 246 | pub const PT_HIOS = 0x6fffffff; |
| 247 | pub const PT_LOPROC = 0x70000000; |
| 248 | pub const PT_HIPROC = 0x7fffffff; |
| 249 | |
| 10 | 250 | pub const SHT_NULL = 0; |
| 11 | 251 | pub const SHT_PROGBITS = 1; |
| 12 | 252 | pub const SHT_SYMTAB = 2; |
| ... | ... | @@ -31,6 +271,45 @@ pub const SHT_HIPROC = 0x7fffffff; |
| 31 | 271 | pub const SHT_LOUSER = 0x80000000; |
| 32 | 272 | pub const SHT_HIUSER = 0xffffffff; |
| 33 | 273 | |
| 274 | pub const STB_LOCAL = 0; |
| 275 | pub const STB_GLOBAL = 1; |
| 276 | pub const STB_WEAK = 2; |
| 277 | pub const STB_NUM = 3; |
| 278 | pub const STB_LOOS = 10; |
| 279 | pub const STB_GNU_UNIQUE = 10; |
| 280 | pub const STB_HIOS = 12; |
| 281 | pub const STB_LOPROC = 13; |
| 282 | pub const STB_HIPROC = 15; |
| 283 | |
| 284 | pub const STB_MIPS_SPLIT_COMMON = 13; |
| 285 | |
| 286 | pub const STT_NOTYPE = 0; |
| 287 | pub const STT_OBJECT = 1; |
| 288 | pub const STT_FUNC = 2; |
| 289 | pub const STT_SECTION = 3; |
| 290 | pub const STT_FILE = 4; |
| 291 | pub const STT_COMMON = 5; |
| 292 | pub const STT_TLS = 6; |
| 293 | pub const STT_NUM = 7; |
| 294 | pub const STT_LOOS = 10; |
| 295 | pub const STT_GNU_IFUNC = 10; |
| 296 | pub const STT_HIOS = 12; |
| 297 | pub const STT_LOPROC = 13; |
| 298 | pub const STT_HIPROC = 15; |
| 299 | |
| 300 | pub const STT_SPARC_REGISTER = 13; |
| 301 | |
| 302 | pub const STT_PARISC_MILLICODE = 13; |
| 303 | |
| 304 | pub const STT_HP_OPAQUE = (STT_LOOS + 0x1); |
| 305 | pub const STT_HP_STUB = (STT_LOOS + 0x2); |
| 306 | |
| 307 | pub const STT_ARM_TFUNC = STT_LOPROC; |
| 308 | pub const STT_ARM_16BIT = STT_HIPROC; |
| 309 | |
| 310 | pub const VER_FLG_BASE = 0x1; |
| 311 | pub const VER_FLG_WEAK = 0x2; |
| 312 | |
| 34 | 313 | pub const FileType = enum { |
| 35 | 314 | Relocatable, |
| 36 | 315 | Executable, |
| ... | ... | @@ -266,3 +545,335 @@ pub const Elf = struct { |
| 266 | 545 | try elf.in_file.seekTo(elf_section.offset); |
| 267 | 546 | } |
| 268 | 547 | }; |
| 548 | |
| 549 | pub const EI_NIDENT = 16; |
| 550 | pub const Elf32_Half = u16; |
| 551 | pub const Elf64_Half = u16; |
| 552 | pub const Elf32_Word = u32; |
| 553 | pub const Elf32_Sword = i32; |
| 554 | pub const Elf64_Word = u32; |
| 555 | pub const Elf64_Sword = i32; |
| 556 | pub const Elf32_Xword = u64; |
| 557 | pub const Elf32_Sxword = i64; |
| 558 | pub const Elf64_Xword = u64; |
| 559 | pub const Elf64_Sxword = i64; |
| 560 | pub const Elf32_Addr = u32; |
| 561 | pub const Elf64_Addr = u64; |
| 562 | pub const Elf32_Off = u32; |
| 563 | pub const Elf64_Off = u64; |
| 564 | pub const Elf32_Section = u16; |
| 565 | pub const Elf64_Section = u16; |
| 566 | pub const Elf32_Versym = Elf32_Half; |
| 567 | pub const Elf64_Versym = Elf64_Half; |
| 568 | pub const Elf32_Ehdr = extern struct { |
| 569 | e_ident: [EI_NIDENT]u8, |
| 570 | e_type: Elf32_Half, |
| 571 | e_machine: Elf32_Half, |
| 572 | e_version: Elf32_Word, |
| 573 | e_entry: Elf32_Addr, |
| 574 | e_phoff: Elf32_Off, |
| 575 | e_shoff: Elf32_Off, |
| 576 | e_flags: Elf32_Word, |
| 577 | e_ehsize: Elf32_Half, |
| 578 | e_phentsize: Elf32_Half, |
| 579 | e_phnum: Elf32_Half, |
| 580 | e_shentsize: Elf32_Half, |
| 581 | e_shnum: Elf32_Half, |
| 582 | e_shstrndx: Elf32_Half, |
| 583 | }; |
| 584 | pub const Elf64_Ehdr = extern struct { |
| 585 | e_ident: [EI_NIDENT]u8, |
| 586 | e_type: Elf64_Half, |
| 587 | e_machine: Elf64_Half, |
| 588 | e_version: Elf64_Word, |
| 589 | e_entry: Elf64_Addr, |
| 590 | e_phoff: Elf64_Off, |
| 591 | e_shoff: Elf64_Off, |
| 592 | e_flags: Elf64_Word, |
| 593 | e_ehsize: Elf64_Half, |
| 594 | e_phentsize: Elf64_Half, |
| 595 | e_phnum: Elf64_Half, |
| 596 | e_shentsize: Elf64_Half, |
| 597 | e_shnum: Elf64_Half, |
| 598 | e_shstrndx: Elf64_Half, |
| 599 | }; |
| 600 | pub const Elf32_Shdr = extern struct { |
| 601 | sh_name: Elf32_Word, |
| 602 | sh_type: Elf32_Word, |
| 603 | sh_flags: Elf32_Word, |
| 604 | sh_addr: Elf32_Addr, |
| 605 | sh_offset: Elf32_Off, |
| 606 | sh_size: Elf32_Word, |
| 607 | sh_link: Elf32_Word, |
| 608 | sh_info: Elf32_Word, |
| 609 | sh_addralign: Elf32_Word, |
| 610 | sh_entsize: Elf32_Word, |
| 611 | }; |
| 612 | pub const Elf64_Shdr = extern struct { |
| 613 | sh_name: Elf64_Word, |
| 614 | sh_type: Elf64_Word, |
| 615 | sh_flags: Elf64_Xword, |
| 616 | sh_addr: Elf64_Addr, |
| 617 | sh_offset: Elf64_Off, |
| 618 | sh_size: Elf64_Xword, |
| 619 | sh_link: Elf64_Word, |
| 620 | sh_info: Elf64_Word, |
| 621 | sh_addralign: Elf64_Xword, |
| 622 | sh_entsize: Elf64_Xword, |
| 623 | }; |
| 624 | pub const Elf32_Chdr = extern struct { |
| 625 | ch_type: Elf32_Word, |
| 626 | ch_size: Elf32_Word, |
| 627 | ch_addralign: Elf32_Word, |
| 628 | }; |
| 629 | pub const Elf64_Chdr = extern struct { |
| 630 | ch_type: Elf64_Word, |
| 631 | ch_reserved: Elf64_Word, |
| 632 | ch_size: Elf64_Xword, |
| 633 | ch_addralign: Elf64_Xword, |
| 634 | }; |
| 635 | pub const Elf32_Sym = extern struct { |
| 636 | st_name: Elf32_Word, |
| 637 | st_value: Elf32_Addr, |
| 638 | st_size: Elf32_Word, |
| 639 | st_info: u8, |
| 640 | st_other: u8, |
| 641 | st_shndx: Elf32_Section, |
| 642 | }; |
| 643 | pub const Elf64_Sym = extern struct { |
| 644 | st_name: Elf64_Word, |
| 645 | st_info: u8, |
| 646 | st_other: u8, |
| 647 | st_shndx: Elf64_Section, |
| 648 | st_value: Elf64_Addr, |
| 649 | st_size: Elf64_Xword, |
| 650 | }; |
| 651 | pub const Elf32_Syminfo = extern struct { |
| 652 | si_boundto: Elf32_Half, |
| 653 | si_flags: Elf32_Half, |
| 654 | }; |
| 655 | pub const Elf64_Syminfo = extern struct { |
| 656 | si_boundto: Elf64_Half, |
| 657 | si_flags: Elf64_Half, |
| 658 | }; |
| 659 | pub const Elf32_Rel = extern struct { |
| 660 | r_offset: Elf32_Addr, |
| 661 | r_info: Elf32_Word, |
| 662 | }; |
| 663 | pub const Elf64_Rel = extern struct { |
| 664 | r_offset: Elf64_Addr, |
| 665 | r_info: Elf64_Xword, |
| 666 | }; |
| 667 | pub const Elf32_Rela = extern struct { |
| 668 | r_offset: Elf32_Addr, |
| 669 | r_info: Elf32_Word, |
| 670 | r_addend: Elf32_Sword, |
| 671 | }; |
| 672 | pub const Elf64_Rela = extern struct { |
| 673 | r_offset: Elf64_Addr, |
| 674 | r_info: Elf64_Xword, |
| 675 | r_addend: Elf64_Sxword, |
| 676 | }; |
| 677 | pub const Elf32_Phdr = extern struct { |
| 678 | p_type: Elf32_Word, |
| 679 | p_offset: Elf32_Off, |
| 680 | p_vaddr: Elf32_Addr, |
| 681 | p_paddr: Elf32_Addr, |
| 682 | p_filesz: Elf32_Word, |
| 683 | p_memsz: Elf32_Word, |
| 684 | p_flags: Elf32_Word, |
| 685 | p_align: Elf32_Word, |
| 686 | }; |
| 687 | pub const Elf64_Phdr = extern struct { |
| 688 | p_type: Elf64_Word, |
| 689 | p_flags: Elf64_Word, |
| 690 | p_offset: Elf64_Off, |
| 691 | p_vaddr: Elf64_Addr, |
| 692 | p_paddr: Elf64_Addr, |
| 693 | p_filesz: Elf64_Xword, |
| 694 | p_memsz: Elf64_Xword, |
| 695 | p_align: Elf64_Xword, |
| 696 | }; |
| 697 | pub const Elf32_Dyn = extern struct { |
| 698 | d_tag: Elf32_Sword, |
| 699 | d_un: extern union { |
| 700 | d_val: Elf32_Word, |
| 701 | d_ptr: Elf32_Addr, |
| 702 | }, |
| 703 | }; |
| 704 | pub const Elf64_Dyn = extern struct { |
| 705 | d_tag: Elf64_Sxword, |
| 706 | d_un: extern union { |
| 707 | d_val: Elf64_Xword, |
| 708 | d_ptr: Elf64_Addr, |
| 709 | }, |
| 710 | }; |
| 711 | pub const Elf32_Verdef = extern struct { |
| 712 | vd_version: Elf32_Half, |
| 713 | vd_flags: Elf32_Half, |
| 714 | vd_ndx: Elf32_Half, |
| 715 | vd_cnt: Elf32_Half, |
| 716 | vd_hash: Elf32_Word, |
| 717 | vd_aux: Elf32_Word, |
| 718 | vd_next: Elf32_Word, |
| 719 | }; |
| 720 | pub const Elf64_Verdef = extern struct { |
| 721 | vd_version: Elf64_Half, |
| 722 | vd_flags: Elf64_Half, |
| 723 | vd_ndx: Elf64_Half, |
| 724 | vd_cnt: Elf64_Half, |
| 725 | vd_hash: Elf64_Word, |
| 726 | vd_aux: Elf64_Word, |
| 727 | vd_next: Elf64_Word, |
| 728 | }; |
| 729 | pub const Elf32_Verdaux = extern struct { |
| 730 | vda_name: Elf32_Word, |
| 731 | vda_next: Elf32_Word, |
| 732 | }; |
| 733 | pub const Elf64_Verdaux = extern struct { |
| 734 | vda_name: Elf64_Word, |
| 735 | vda_next: Elf64_Word, |
| 736 | }; |
| 737 | pub const Elf32_Verneed = extern struct { |
| 738 | vn_version: Elf32_Half, |
| 739 | vn_cnt: Elf32_Half, |
| 740 | vn_file: Elf32_Word, |
| 741 | vn_aux: Elf32_Word, |
| 742 | vn_next: Elf32_Word, |
| 743 | }; |
| 744 | pub const Elf64_Verneed = extern struct { |
| 745 | vn_version: Elf64_Half, |
| 746 | vn_cnt: Elf64_Half, |
| 747 | vn_file: Elf64_Word, |
| 748 | vn_aux: Elf64_Word, |
| 749 | vn_next: Elf64_Word, |
| 750 | }; |
| 751 | pub const Elf32_Vernaux = extern struct { |
| 752 | vna_hash: Elf32_Word, |
| 753 | vna_flags: Elf32_Half, |
| 754 | vna_other: Elf32_Half, |
| 755 | vna_name: Elf32_Word, |
| 756 | vna_next: Elf32_Word, |
| 757 | }; |
| 758 | pub const Elf64_Vernaux = extern struct { |
| 759 | vna_hash: Elf64_Word, |
| 760 | vna_flags: Elf64_Half, |
| 761 | vna_other: Elf64_Half, |
| 762 | vna_name: Elf64_Word, |
| 763 | vna_next: Elf64_Word, |
| 764 | }; |
| 765 | pub const Elf32_auxv_t = extern struct { |
| 766 | a_type: u32, |
| 767 | a_un: extern union { |
| 768 | a_val: u32, |
| 769 | }, |
| 770 | }; |
| 771 | pub const Elf64_auxv_t = extern struct { |
| 772 | a_type: u64, |
| 773 | a_un: extern union { |
| 774 | a_val: u64, |
| 775 | }, |
| 776 | }; |
| 777 | pub const Elf32_Nhdr = extern struct { |
| 778 | n_namesz: Elf32_Word, |
| 779 | n_descsz: Elf32_Word, |
| 780 | n_type: Elf32_Word, |
| 781 | }; |
| 782 | pub const Elf64_Nhdr = extern struct { |
| 783 | n_namesz: Elf64_Word, |
| 784 | n_descsz: Elf64_Word, |
| 785 | n_type: Elf64_Word, |
| 786 | }; |
| 787 | pub const Elf32_Move = extern struct { |
| 788 | m_value: Elf32_Xword, |
| 789 | m_info: Elf32_Word, |
| 790 | m_poffset: Elf32_Word, |
| 791 | m_repeat: Elf32_Half, |
| 792 | m_stride: Elf32_Half, |
| 793 | }; |
| 794 | pub const Elf64_Move = extern struct { |
| 795 | m_value: Elf64_Xword, |
| 796 | m_info: Elf64_Xword, |
| 797 | m_poffset: Elf64_Xword, |
| 798 | m_repeat: Elf64_Half, |
| 799 | m_stride: Elf64_Half, |
| 800 | }; |
| 801 | pub const Elf32_gptab = extern union { |
| 802 | gt_header: extern struct { |
| 803 | gt_current_g_value: Elf32_Word, |
| 804 | gt_unused: Elf32_Word, |
| 805 | }, |
| 806 | gt_entry: extern struct { |
| 807 | gt_g_value: Elf32_Word, |
| 808 | gt_bytes: Elf32_Word, |
| 809 | }, |
| 810 | }; |
| 811 | pub const Elf32_RegInfo = extern struct { |
| 812 | ri_gprmask: Elf32_Word, |
| 813 | ri_cprmask: [4]Elf32_Word, |
| 814 | ri_gp_value: Elf32_Sword, |
| 815 | }; |
| 816 | pub const Elf_Options = extern struct { |
| 817 | kind: u8, |
| 818 | size: u8, |
| 819 | @"section": Elf32_Section, |
| 820 | info: Elf32_Word, |
| 821 | }; |
| 822 | pub const Elf_Options_Hw = extern struct { |
| 823 | hwp_flags1: Elf32_Word, |
| 824 | hwp_flags2: Elf32_Word, |
| 825 | }; |
| 826 | pub const Elf32_Lib = extern struct { |
| 827 | l_name: Elf32_Word, |
| 828 | l_time_stamp: Elf32_Word, |
| 829 | l_checksum: Elf32_Word, |
| 830 | l_version: Elf32_Word, |
| 831 | l_flags: Elf32_Word, |
| 832 | }; |
| 833 | pub const Elf64_Lib = extern struct { |
| 834 | l_name: Elf64_Word, |
| 835 | l_time_stamp: Elf64_Word, |
| 836 | l_checksum: Elf64_Word, |
| 837 | l_version: Elf64_Word, |
| 838 | l_flags: Elf64_Word, |
| 839 | }; |
| 840 | pub const Elf32_Conflict = Elf32_Addr; |
| 841 | pub const Elf_MIPS_ABIFlags_v0 = extern struct { |
| 842 | version: Elf32_Half, |
| 843 | isa_level: u8, |
| 844 | isa_rev: u8, |
| 845 | gpr_size: u8, |
| 846 | cpr1_size: u8, |
| 847 | cpr2_size: u8, |
| 848 | fp_abi: u8, |
| 849 | isa_ext: Elf32_Word, |
| 850 | ases: Elf32_Word, |
| 851 | flags1: Elf32_Word, |
| 852 | flags2: Elf32_Word, |
| 853 | }; |
| 854 | |
| 855 | pub const Ehdr = switch(@sizeOf(usize)) { |
| 856 | 4 => Elf32_Ehdr, |
| 857 | 8 => Elf64_Ehdr, |
| 858 | else => @compileError("expected pointer size of 32 or 64"), |
| 859 | }; |
| 860 | pub const Phdr = switch(@sizeOf(usize)) { |
| 861 | 4 => Elf32_Phdr, |
| 862 | 8 => Elf64_Phdr, |
| 863 | else => @compileError("expected pointer size of 32 or 64"), |
| 864 | }; |
| 865 | pub const Sym = switch(@sizeOf(usize)) { |
| 866 | 4 => Elf32_Sym, |
| 867 | 8 => Elf64_Sym, |
| 868 | else => @compileError("expected pointer size of 32 or 64"), |
| 869 | }; |
| 870 | pub const Verdef = switch(@sizeOf(usize)) { |
| 871 | 4 => Elf32_Verdef, |
| 872 | 8 => Elf64_Verdef, |
| 873 | else => @compileError("expected pointer size of 32 or 64"), |
| 874 | }; |
| 875 | pub const Verdaux = switch(@sizeOf(usize)) { |
| 876 | 4 => Elf32_Verdaux, |
| 877 | 8 => Elf64_Verdaux, |
| 878 | else => @compileError("expected pointer size of 32 or 64"), |
| 879 | }; |