| /netbsd/src/sys/arch/atari/stand/tostools/libtos/ |
| D | aout.c | 83 struct exec ehdr; in aout_load() local 89 if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) in aout_load() 93 if ((ehdr.a_magic & 0xffff) != NMAGIC) in aout_load() 96 if ((N_GETMAGIC(ehdr) != NMAGIC) && (N_GETMAGIC(ehdr) != OMAGIC)) in aout_load() 103 textsz = (ehdr.a_text + AOUT_LDPGSZ - 1) & ~(AOUT_LDPGSZ - 1); in aout_load() 105 od->ksize = textsz + ehdr.a_data + ehdr.a_bss; in aout_load() 106 od->kentry = ehdr.a_entry; in aout_load() 108 if (loadsyms && ehdr.a_syms) { in aout_load() 110 if (lseek(fd, ehdr.a_text+ehdr.a_data+ehdr.a_syms+sizeof(ehdr), in aout_load() 117 if (lseek(fd, sizeof(ehdr), 0) <= 0) in aout_load() [all …]
|
| D | elf.c | 72 Elf32_Ehdr ehdr; in elf_load() local 79 if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) in elf_load() 82 memcpy(&ident, ehdr.e_ident, sizeof ident); in elf_load() 89 i = ehdr.e_phnum * sizeof(Elf32_Phdr); in elf_load() 98 for (i = 0; i < ehdr.e_phnum; i++) { in elf_load() 114 i = ehdr.e_shnum + 1; in elf_load() 116 if (lseek(fd, (off_t)ehdr.e_shoff, SEEK_SET) != ehdr.e_shoff) in elf_load() 131 kernsize += symsize + sizeof(ehdr) + ehdr.e_shnum*sizeof(Elf32_Shdr); in elf_load() 139 od->kentry = ehdr.e_entry; in elf_load() 148 for (i = 0; i < ehdr.e_phnum; i++) { in elf_load() [all …]
|
| /netbsd/src/external/gpl3/gdb/dist/gdb/testsuite/gdb.base/ |
| D | sym-file-loader.c | 72 Elf_External_Ehdr *ehdr; member 76 static Elf_External_Shdr *find_shdr (Elf_External_Ehdr *ehdr, 218 Elf_External_Ehdr *ehdr; in load_shlib() local 268 ehdr = (Elf_External_Ehdr *) addr; in load_shlib() 269 if (ehdr->e_ident[EI_MAG0] != ELFMAG0 in load_shlib() 270 || ehdr->e_ident[EI_MAG1] != ELFMAG1 in load_shlib() 271 || ehdr->e_ident[EI_MAG2] != ELFMAG2 in load_shlib() 272 || ehdr->e_ident[EI_MAG3] != ELFMAG3) in load_shlib() 274 printf ("Not an ELF file: %x\n", ehdr->e_ident[EI_MAG0]); in load_shlib() 278 if (ehdr->e_ident[EI_CLASS] == ELFCLASS32) in load_shlib() [all …]
|
| /netbsd/src/sys/lib/libsa/ |
| D | loadfile_elf32.c | 89 internalize_ehdr(Elf_Byte bo, Elf_Ehdr *ehdr) in internalize_ehdr() argument 93 I16(ehdr->e_type); in internalize_ehdr() 94 I16(ehdr->e_machine); in internalize_ehdr() 95 I32(ehdr->e_version); in internalize_ehdr() 96 I32(ehdr->e_entry); in internalize_ehdr() 97 I32(ehdr->e_phoff); in internalize_ehdr() 98 I32(ehdr->e_shoff); in internalize_ehdr() 99 I32(ehdr->e_flags); in internalize_ehdr() 100 I16(ehdr->e_ehsize); in internalize_ehdr() 101 I16(ehdr->e_phentsize); in internalize_ehdr() [all …]
|
| /netbsd/src/sys/kern/ |
| D | core_elf32.c | 114 Elf_Ehdr ehdr; in ELFNAMEEND() local 159 memset(&ehdr.e_ident[EI_PAD], 0, sizeof(ehdr.e_ident) - EI_PAD); in ELFNAMEEND() 160 memcpy(ehdr.e_ident, ELFMAG, SELFMAG); in ELFNAMEEND() 162 ehdr.e_ident[EI_CLASS] = ELFCLASS32; in ELFNAMEEND() 164 ehdr.e_ident[EI_CLASS] = ELFCLASS64; in ELFNAMEEND() 166 ehdr.e_ident[EI_DATA] = ELFDEFNNAME(MACHDEP_ENDIANNESS); in ELFNAMEEND() 167 ehdr.e_ident[EI_VERSION] = EV_CURRENT; in ELFNAMEEND() 172 ehdr.e_ident[EI_OSABI] = ELFOSABI_SYSV; in ELFNAMEEND() 173 ehdr.e_ident[EI_ABIVERSION] = 0; in ELFNAMEEND() 175 ehdr.e_type = ET_CORE; in ELFNAMEEND() [all …]
|
| /netbsd/src/libexec/ld.elf_so/ |
| D | map_object.c | 68 Elf_Ehdr *ehdr; in _rtld_map_object() local 127 ehdr = mmap(NULL, _rtld_pagesz, PROT_READ, MAP_FILE | MAP_SHARED, fd, in _rtld_map_object() 129 obj->ehdr = ehdr; in _rtld_map_object() 130 if (ehdr == MAP_FAILED) { in _rtld_map_object() 135 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0) { in _rtld_map_object() 139 if (ehdr->e_ident[EI_CLASS] != ELFCLASS) { in _rtld_map_object() 141 ehdr->e_ident[EI_CLASS], ELFCLASS); in _rtld_map_object() 145 if (ehdr->e_ident[EI_VERSION] != EV_CURRENT || in _rtld_map_object() 146 ehdr->e_version != EV_CURRENT || in _rtld_map_object() 147 ehdr->e_ident[EI_DATA] != ELFDEFNNAME(MACHDEP_ENDIANNESS)) { in _rtld_map_object() [all …]
|
| /netbsd/src/external/gpl3/binutils/dist/gold/ |
| D | target.cc | 72 const elfcpp::Ehdr<size, big_endian>& ehdr) in do_make_elf_object_implementation() argument 74 int et = ehdr.get_e_type(); in do_make_elf_object_implementation() 81 new Sized_relobj_file<size, big_endian>(name, input_file, offset, ehdr); in do_make_elf_object_implementation() 88 new Sized_dynobj<size, big_endian>(name, input_file, offset, ehdr); in do_make_elf_object_implementation() 107 off_t offset, const elfcpp::Ehdr<32, false>& ehdr) in do_make_elf_object() argument 110 offset, ehdr); in do_make_elf_object() 117 off_t offset, const elfcpp::Ehdr<32, true>& ehdr) in do_make_elf_object() argument 120 offset, ehdr); in do_make_elf_object() 127 off_t offset, const elfcpp::Ehdr<64, false>& ehdr) in do_make_elf_object() argument 130 offset, ehdr); in do_make_elf_object() [all …]
|
| /netbsd/src/sys/arch/i386/stand/lib/ |
| D | exec_multiboot1.c | 46 ksyms_addr_set(void *ehdr, void *shdr, void *symbase) in ksyms_addr_set() argument 54 class = ((Elf_Ehdr *)ehdr)->e_ident[EI_CLASS]; in ksyms_addr_set() 58 ehdr32 = (Elf32_Ehdr *)ehdr; in ksyms_addr_set() 62 ehdr64 = (Elf64_Ehdr *)ehdr; in ksyms_addr_set() 163 Elf32_Ehdr ehdr; in exec_multiboot1() local 168 pvbcopy((void *)mbp->mbp_marks[MARK_SYM], &ehdr, sizeof(ehdr)); in exec_multiboot1() 170 if (memcmp(&ehdr.e_ident, ELFMAG, SELFMAG) != 0) in exec_multiboot1() 173 shaddr = mbp->mbp_marks[MARK_SYM] + ehdr.e_shoff; in exec_multiboot1() 175 shlen = ehdr.e_shnum * ehdr.e_shentsize; in exec_multiboot1() 179 ksyms_addr_set(&ehdr, shbuf, in exec_multiboot1() [all …]
|
| /netbsd/src/sys/arch/x68k/stand/common/ |
| D | exec_sub.c | 161 xarg->ehdr = *hdr; in xk_elf() 162 xarg->ehdr.e_shstrndx = 0; /* .shstrtab will be the 1st section */ in xk_elf() 163 SECTION_NOPAD(sec, "ELF header", &xarg->ehdr, sizeof(Elf32_Ehdr)); in xk_elf() 181 xarg->ehdr.e_shnum = 0; /* no symbol */ in xk_elf() 191 xarg->ehdr.e_shnum = 3; in xk_elf() 192 xarg->ehdr.e_shoff = sizeof(Elf32_Ehdr); in xk_elf() 207 xarg->ehdr.e_shnum++; in xk_elf() 252 Elf32_Ehdr *ehdr; in xk_load() local 264 ehdr = buf; in xk_load() 292 if (*(u_int32_t *)&ehdr->e_ident[EI_MAG0] != in xk_load() [all …]
|
| /netbsd/src/usr.sbin/mopd/common/ |
| D | file.c | 430 Elf32_Ehdr ehdr; in CheckElfFile() 434 if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) in CheckElfFile() 437 if (ehdr.e_ident[0] != ELFMAG0 || in CheckElfFile() 438 ehdr.e_ident[1] != ELFMAG1 || in CheckElfFile() 439 ehdr.e_ident[2] != ELFMAG2 || in CheckElfFile() 440 ehdr.e_ident[3] != ELFMAG3) in CheckElfFile() 444 if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) in CheckElfFile() 457 Elf32_Ehdr ehdr; in GetElfFileInfo() 465 if (read(dl->ldfd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) in GetElfFileInfo() 468 if (ehdr.e_ident[0] != ELFMAG0 || in GetElfFileInfo() [all …]
|
| /netbsd/src/sys/arch/mipsco/stand/common/ |
| D | bootxx.c | 120 Elf32_Ehdr ehdr; in loadfile() local 137 i = read(fd, (char *)&ehdr, sizeof(ehdr)); in loadfile() 138 if ((i != sizeof(ehdr)) || in loadfile() 139 (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) || in loadfile() 140 (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) { in loadfile() 145 for (i = 0; i < ehdr.e_phnum; i++) { in loadfile() 146 if (lseek(fd, (off_t) ehdr.e_phoff + i * sizeof(phdr), 0) < 0) in loadfile() 157 return ((entrypt)ehdr.e_entry); in loadfile()
|
| /netbsd/src/sys/arch/emips/stand/common/ |
| D | bootxx.c | 116 Elf32_Ehdr ehdr; in loadfile() local 147 i = read(fd, (char *)&ehdr, sizeof(ehdr)); in loadfile() 148 if ((i != sizeof(ehdr)) || in loadfile() 149 (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) || in loadfile() 150 (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) { in loadfile() 155 for (i = 0; i < ehdr.e_phnum; i++) { in loadfile() 156 if (lseek(fd, (off_t) ehdr.e_phoff + i * sizeof(phdr), 0) < 0) in loadfile() 167 return ((entrypt*)ehdr.e_entry); in loadfile()
|
| /netbsd/src/usr.sbin/lockstat/ |
| D | elf32.c | 103 Elf_Ehdr ehdr; in NAME() local 111 if (pread(fd, &ehdr, sizeof(ehdr), 0) != sizeof(ehdr)) in NAME() 114 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 || in NAME() 115 ehdr.e_ident[EI_CLASS] != ELFCLASS) in NAME() 118 switch (ehdr.e_machine) { in NAME() 128 off = ehdr.e_shoff; in NAME() 129 for (i = 0; i < ehdr.e_shnum; i++, off += sizeof(symhdr)) { in NAME() 136 if (i == ehdr.e_shnum || symhdr.sh_offset == 0) in NAME() 145 off = ehdr.e_shoff + symhdr.sh_link * sizeof(symhdr); in NAME()
|
| /netbsd/src/sys/arch/pmax/stand/common/ |
| D | bootxx.c | 138 Elf32_Ehdr ehdr; in loadfile() local 169 i = read(fd, (char *)&ehdr, sizeof(ehdr)); in loadfile() 170 if ((i != sizeof(ehdr)) || in loadfile() 171 (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) || in loadfile() 172 (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) { in loadfile() 177 for (i = 0; i < ehdr.e_phnum; i++) { in loadfile() 178 if (lseek(fd, (off_t) ehdr.e_phoff + i * sizeof(phdr), 0) < 0) in loadfile() 189 return ((entrypt)ehdr.e_entry); in loadfile()
|
| /netbsd/src/sys/arch/sun3/sun3x/ |
| D | locore2.c | 98 Elf_Ehdr *ehdr; in _save_symtab() local 106 ehdr = (void *)end; in _save_symtab() 107 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 || in _save_symtab() 108 ehdr->e_ident[EI_CLASS] != ELFCLASS32) { in _save_symtab() 119 shp = (Elf_Shdr *)(end + ehdr->e_shoff); in _save_symtab() 120 for (i = 0; i < ehdr->e_shnum; i++) { in _save_symtab() 130 ssym = (char *)ehdr; in _save_symtab()
|
| /netbsd/src/external/cddl/osnet/dist/lib/libdtrace/common/ |
| D | dt_link.c | 516 Elf32_Ehdr ehdr; in dump_elf32() member 538 elf_file.ehdr.e_ident[EI_MAG0] = ELFMAG0; in dump_elf32() 539 elf_file.ehdr.e_ident[EI_MAG1] = ELFMAG1; in dump_elf32() 540 elf_file.ehdr.e_ident[EI_MAG2] = ELFMAG2; in dump_elf32() 541 elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3; in dump_elf32() 542 elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT; in dump_elf32() 543 elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS32; in dump_elf32() 545 elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB; in dump_elf32() 547 elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB; in dump_elf32() 550 elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; in dump_elf32() [all …]
|
| /netbsd/src/sys/arch/pmax/stand/smallnet/setnetimage/ |
| D | setnetimage.c | 85 Elf32_Ehdr ehdr; in main() local 130 i = read(ifd, (char *)&ehdr, sizeof(ehdr)); in main() 131 if ((i != sizeof(ehdr)) || in main() 132 (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) || in main() 133 (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) { in main() 139 for (i = 0; i < ehdr.e_phnum; i++) { in main() 140 if (lseek(ifd, (off_t) ehdr.e_phoff + i * sizeof(phdr), 0) < 0) in main() 166 printf("entry point: 0x%08x\n", ehdr.e_entry); in main() 207 NLVAR(X_KERNEL_ENTRY) = ehdr.e_entry; in main()
|
| /netbsd/src/sys/arch/sun2/sun2/ |
| D | locore2.c | 114 Elf_Ehdr *ehdr; in _save_symtab() local 122 ehdr = (void *)end; in _save_symtab() 123 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 || in _save_symtab() 124 ehdr->e_ident[EI_CLASS] != ELFCLASS32) { in _save_symtab() 135 shp = (Elf_Shdr *)(end + ehdr->e_shoff); in _save_symtab() 136 for (i = 0; i < ehdr->e_shnum; i++) { in _save_symtab() 147 ssym = (char *)ehdr; in _save_symtab()
|
| /netbsd/src/external/gpl3/binutils/usr.sbin/dbsym/ |
| D | dbsym.c | 312 #define e32_hdr ehdr.e32hdr 313 #define e64_hdr ehdr.e64hdr 361 elf_ehdr ehdr; in load_symtab() local 372 if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) in load_symtab() 378 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in load_symtab() 379 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in load_symtab() 380 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in load_symtab() 381 ehdr.e_ident[EI_MAG3] != ELFMAG3) in load_symtab() 388 if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) in load_symtab() 481 memcpy(*symtab, &ehdr, sizeof(ehdr)); in load_symtab()
|
| /netbsd/src/sys/arch/sun3/sun3/ |
| D | locore2.c | 118 Elf_Ehdr *ehdr; in _save_symtab() local 126 ehdr = (void *)end; in _save_symtab() 127 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 || in _save_symtab() 128 ehdr->e_ident[EI_CLASS] != ELFCLASS32) { in _save_symtab() 139 shp = (Elf_Shdr *)(end + ehdr->e_shoff); in _save_symtab() 140 for (i = 0; i < ehdr->e_shnum; i++) { in _save_symtab() 164 ssym = (char *)ehdr; in _save_symtab()
|
| /netbsd/src/sys/arch/epoc32/stand/e32boot/exe/ |
| D | netbsd.cpp | 94 Elf32_Ehdr ehdr; in ParseHeader() local 98 Mem::Copy(&ehdr, Buffer, sizeof(ehdr)); in ParseHeader() 99 PhdrSize = sizeof(Elf32_Phdr) * ehdr.e_phnum; in ParseHeader() 101 Mem::Copy(phdr, Buffer + ehdr.e_phoff, PhdrSize); in ParseHeader() 103 for (i = 0; i < ehdr.e_phnum; i++) { in ParseHeader() 118 EntryPoint = ehdr.e_entry; in ParseHeader()
|
| /netbsd/src/external/cddl/osnet/dist/tools/ctf/cvt/ |
| D | util.c | 71 GElf_Ehdr ehdr; in findelfsecidx() local 74 if (gelf_getehdr(elf, &ehdr) == NULL) in findelfsecidx() 86 if ((name = elf_strptr(elf, ehdr.e_shstrndx, in findelfsecidx() 103 GElf_Ehdr ehdr; in elf_ptrsz() local 105 if (gelf_getehdr(elf, &ehdr) == NULL) { in elf_ptrsz() 110 if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) in elf_ptrsz() 112 else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) in elf_ptrsz() 115 terminate("unknown ELF class %d\n", ehdr.e_ident[EI_CLASS]); in elf_ptrsz()
|
| /netbsd/src/usr.bin/crunch/crunchide/ |
| D | exec_elf32.c | 178 Elf_Ehdr ehdr; in ELFNAMEEND() local 191 if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) in ELFNAMEEND() 194 shdrsize = ehdr.e_shnum * ehdr.e_shentsize; in ELFNAMEEND() 197 if (xreadatoff(fd, shdrp, ehdr.e_shoff, shdrsize, fn) != shdrsize) in ELFNAMEEND() 204 for (i = 0; i < ehdr.e_shnum; i++) { in ELFNAMEEND() 217 if (!weird && strtabsnum != (ehdr.e_shnum - 1)) { in ELFNAMEEND() 309 if (xwriteatoff(fd, shdrp, ehdr.e_shoff, shdrsize, fn) != shdrsize) in ELFNAMEEND()
|
| /netbsd/src/usr.sbin/installboot/arch/ |
| D | pmax.c | 315 Elf32_Ehdr ehdr; in load_bootstrap() local 319 if ((pread(params->s1fd, &ehdr, sizeof(ehdr), 0)) != sizeof(ehdr)) { in load_bootstrap() 323 if ((memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) || in load_bootstrap() 324 (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) { in load_bootstrap() 332 for (i = 0; i < le16toh(ehdr.e_phnum); i++) { in load_bootstrap() 334 (off_t) le32toh(ehdr.e_phoff) + i * sizeof(phdr)) in load_bootstrap() 355 *execaddr = le32toh(ehdr.e_entry); in load_bootstrap()
|
| /netbsd/src/sys/arch/i386/i386/ |
| D | multiboot.c | 697 Elf32_Ehdr ehdr; in multiboot1_ksyms_addsyms_elf() local 701 memcpy(ehdr.e_ident, ELFMAG, SELFMAG); in multiboot1_ksyms_addsyms_elf() 702 ehdr.e_ident[EI_CLASS] = ELFCLASS32; in multiboot1_ksyms_addsyms_elf() 703 ehdr.e_ident[EI_DATA] = ELFDATA2LSB; in multiboot1_ksyms_addsyms_elf() 704 ehdr.e_ident[EI_VERSION] = EV_CURRENT; in multiboot1_ksyms_addsyms_elf() 705 ehdr.e_type = ET_EXEC; in multiboot1_ksyms_addsyms_elf() 706 ehdr.e_machine = EM_386; in multiboot1_ksyms_addsyms_elf() 707 ehdr.e_version = 1; in multiboot1_ksyms_addsyms_elf() 708 ehdr.e_ehsize = sizeof(ehdr); in multiboot1_ksyms_addsyms_elf() 710 ksyms_addsyms_explicit((void *)&ehdr, in multiboot1_ksyms_addsyms_elf()
|