/freebsd/contrib/elftoolchain/libelf/ |
H A D | libelf_ehdr.c | 108 void *ehdr; in _libelf_ehdr() local 136 ehdr = (void *) e->e_u.e_elf.e_ehdr.e_ehdr32; in _libelf_ehdr() 138 ehdr = (void *) e->e_u.e_elf.e_ehdr.e_ehdr64; in _libelf_ehdr() 140 if (ehdr != NULL) /* already have a translated ehdr */ in _libelf_ehdr() 141 return (ehdr); in _libelf_ehdr() 154 if ((ehdr = calloc((size_t) 1, msz)) == NULL) { in _libelf_ehdr() 160 e->e_u.e_elf.e_ehdr.e_ehdr32 = ehdr; in _libelf_ehdr() 161 EHDR_INIT(ehdr,32); in _libelf_ehdr() 163 e->e_u.e_elf.e_ehdr.e_ehdr64 = ehdr; in _libelf_ehdr() 164 EHDR_INIT(ehdr,64); in _libelf_ehdr() [all …]
|
H A D | elf_scn.c | 58 _libelf_load_section_headers(Elf *e, void *ehdr) in _libelf_load_section_headers() argument 70 assert(ehdr != NULL); in _libelf_load_section_headers() 91 eh32 = (Elf32_Ehdr *) ehdr; in _libelf_load_section_headers() 95 eh64 = (Elf64_Ehdr *) ehdr; in _libelf_load_section_headers() 148 void *ehdr; in elf_getscn() local 157 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) in elf_getscn() 162 _libelf_load_section_headers(e, ehdr) == 0) in elf_getscn() 193 void *ehdr; in elf_newscn() local 206 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) in elf_newscn() 221 _libelf_load_section_headers(e, ehdr) == 0) in elf_newscn()
|
H A D | libelf_phdr.c | 44 void *ehdr, *phdr; in _libelf_getphdr() local 63 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) in _libelf_getphdr() 69 eh32 = (Elf32_Ehdr *) ehdr; in _libelf_getphdr() 72 eh64 = (Elf64_Ehdr *) ehdr; in _libelf_getphdr() 115 void *ehdr, *newphdr, *oldphdr; in _libelf_newphdr() local 123 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) { in _libelf_newphdr()
|
H A D | elf_update.c | 517 void *ehdr, *phdr; in _libelf_resync_elf() local 530 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) in _libelf_resync_elf() 533 eh32 = ehdr; in _libelf_resync_elf() 534 eh64 = ehdr; in _libelf_resync_elf() 605 ehdr)) in _libelf_resync_elf() 651 _libelf_load_section_headers(e, ehdr) == 0) in _libelf_resync_elf() 694 _libelf_setphnum(e, ehdr, ec, phnum); in _libelf_resync_elf() 695 _libelf_setshnum(e, ehdr, ec, shnum); in _libelf_resync_elf() 851 void *ehdr; in _libelf_write_ehdr() local 860 ehdr = _libelf_ehdr(e, ec, 0); in _libelf_write_ehdr() [all …]
|
H A D | elf_flag.c | 84 void *ehdr; in elf_flagehdr() local 97 ehdr = e->e_u.e_elf.e_ehdr.e_ehdr32; in elf_flagehdr() 99 ehdr = e->e_u.e_elf.e_ehdr.e_ehdr64; in elf_flagehdr() 101 if (ehdr == NULL) { in elf_flagehdr()
|
H A D | gelf_ehdr.c | 122 void *ehdr; in gelf_update_ehdr() local 137 if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) in gelf_update_ehdr() 143 eh64 = (Elf64_Ehdr *) ehdr; in gelf_update_ehdr() 148 eh32 = (Elf32_Ehdr *) ehdr; in gelf_update_ehdr()
|
/freebsd/sys/kern/ |
H A D | kern_dump.c | 289 Elf_Ehdr ehdr; in dumpsys_generic() local 300 bzero(&ehdr, sizeof(ehdr)); in dumpsys_generic() 301 ehdr.e_ident[EI_MAG0] = ELFMAG0; in dumpsys_generic() 302 ehdr.e_ident[EI_MAG1] = ELFMAG1; in dumpsys_generic() 303 ehdr.e_ident[EI_MAG2] = ELFMAG2; in dumpsys_generic() 304 ehdr.e_ident[EI_MAG3] = ELFMAG3; in dumpsys_generic() 305 ehdr.e_ident[EI_CLASS] = ELF_CLASS; in dumpsys_generic() 307 ehdr.e_ident[EI_DATA] = ELFDATA2LSB; in dumpsys_generic() 309 ehdr.e_ident[EI_DATA] = ELFDATA2MSB; in dumpsys_generic() 311 ehdr.e_ident[EI_VERSION] = EV_CURRENT; in dumpsys_generic() [all …]
|
/freebsd/stand/common/ |
H A D | load_elf.c | 53 Elf_Ehdr *ehdr; member 127 static int elf_header_convert(Elf_Ehdr *ehdr) in elf_header_convert() argument 153 CONVERT_SWITCH(ehdr, ehdr, HEADER_FIELDS); in elf_header_convert() 160 static int elf_program_header_convert(const Elf_Ehdr *ehdr, Elf_Phdr *phdr) in elf_program_header_convert() argument 172 CONVERT_SWITCH(ehdr, phdr, PROGRAM_HEADER_FIELDS); in elf_program_header_convert() 179 static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) in elf_section_header_convert() argument 193 CONVERT_SWITCH(ehdr, shdr, SECTION_HEADER_FIELDS); in elf_section_header_convert() 202 static int elf_header_convert(Elf_Ehdr *ehdr) in elf_header_convert() argument 207 static int elf_program_header_convert(const Elf_Ehdr *ehdr, Elf_Phdr *phdr) in elf_program_header_convert() argument 212 static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) in elf_section_header_convert() argument [all …]
|
/freebsd/lib/libc/gen/ |
H A D | nlist.c | 98 __elf_is_okay__(Elf_Ehdr *ehdr) in __elf_is_okay__() argument 107 if (IS_ELF(*ehdr) && in __elf_is_okay__() 108 ehdr->e_ident[EI_CLASS] == ELF_TARG_CLASS && in __elf_is_okay__() 109 ehdr->e_ident[EI_DATA] == ELF_TARG_DATA && in __elf_is_okay__() 110 ehdr->e_ident[EI_VERSION] == ELF_TARG_VER) { in __elf_is_okay__() 113 if (ehdr->e_machine == ELF_TARG_MACH && in __elf_is_okay__() 114 ehdr->e_version == ELF_TARG_VER) in __elf_is_okay__() 131 Elf_Ehdr ehdr; in __elf_fdnlist() local 140 _read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) || in __elf_fdnlist() 141 !__elf_is_okay__(&ehdr) || in __elf_fdnlist() [all …]
|
/freebsd/sys/compat/linux/ |
H A D | linux_vdso.c | 105 Elf_Ehdr *ehdr; in __elfN() local 110 ehdr = (Elf_Ehdr *)base; in __elfN() 112 MPASS(IS_ELF(*ehdr)); in __elfN() 113 MPASS(ehdr->e_ident[EI_CLASS] == ELF_TARG_CLASS); in __elfN() 114 MPASS(ehdr->e_ident[EI_DATA] == ELF_TARG_DATA); in __elfN() 115 MPASS(ehdr->e_ident[EI_VERSION] == EV_CURRENT); in __elfN() 116 MPASS(ehdr->e_shentsize == sizeof(Elf_Shdr)); in __elfN() 117 MPASS(ehdr->e_shoff != 0); in __elfN() 118 MPASS(ehdr->e_type == ET_DYN); in __elfN() 120 shdr = (const Elf_Shdr *)(base + ehdr->e_shoff); in __elfN() [all …]
|
/freebsd/usr.bin/gcore/ |
H A D | elfcore.c | 469 Elf_Ehdr *ehdr, binhdr; in elf_puthdr() local 481 ehdr = (Elf_Ehdr *)hdr; in elf_puthdr() 483 ehdr->e_ident[EI_MAG0] = ELFMAG0; in elf_puthdr() 484 ehdr->e_ident[EI_MAG1] = ELFMAG1; in elf_puthdr() 485 ehdr->e_ident[EI_MAG2] = ELFMAG2; in elf_puthdr() 486 ehdr->e_ident[EI_MAG3] = ELFMAG3; in elf_puthdr() 487 ehdr->e_ident[EI_CLASS] = ELF_CLASS; in elf_puthdr() 488 ehdr->e_ident[EI_DATA] = ELF_DATA; in elf_puthdr() 489 ehdr->e_ident[EI_VERSION] = EV_CURRENT; in elf_puthdr() 490 ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; in elf_puthdr() [all …]
|
/freebsd/cddl/contrib/opensolaris/lib/libdtrace/common/ |
H A D | dt_link.c | 467 Elf32_Ehdr ehdr; in dump_elf32() member 488 elf_file.ehdr.e_ident[EI_MAG0] = ELFMAG0; in dump_elf32() 489 elf_file.ehdr.e_ident[EI_MAG1] = ELFMAG1; in dump_elf32() 490 elf_file.ehdr.e_ident[EI_MAG2] = ELFMAG2; in dump_elf32() 491 elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3; in dump_elf32() 492 elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT; in dump_elf32() 493 elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS32; in dump_elf32() 495 elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB; in dump_elf32() 497 elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB; in dump_elf32() 499 elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; in dump_elf32() [all …]
|
/freebsd/cddl/contrib/opensolaris/tools/ctf/cvt/ |
H A D | util.c | 68 GElf_Ehdr ehdr; in findelfsecidx() local 71 if (gelf_getehdr(elf, &ehdr) == NULL) in findelfsecidx() 83 if ((name = elf_strptr(elf, ehdr.e_shstrndx, in findelfsecidx() 100 GElf_Ehdr ehdr; in elf_ptrsz() local 102 if (gelf_getehdr(elf, &ehdr) == NULL) { in elf_ptrsz() 107 if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) in elf_ptrsz() 109 else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) in elf_ptrsz() 112 terminate("unknown ELF class %d\n", ehdr.e_ident[EI_CLASS]); in elf_ptrsz()
|
/freebsd/usr.bin/ldd/ |
H A D | ldd.c | 266 has_freebsd_abi_tag(const char *fname, Elf *elf, GElf_Ehdr *ehdr, off_t offset, in has_freebsd_abi_tag() argument 295 if (gelf_xlatetom(elf, &dst, &src, ehdr->e_ident[EI_DATA]) == NULL) { in has_freebsd_abi_tag() 334 is_pie(const char *fname, Elf *elf, GElf_Ehdr *ehdr, off_t offset, size_t len) in is_pie() argument 369 if (gelf_xlatetom(elf, &dst, &src, ehdr->e_ident[EI_DATA]) == NULL) { in is_pie() 393 GElf_Ehdr ehdr; in is_executable() local 418 if (gelf_getehdr(elf, &ehdr) == NULL) { in is_executable() 431 freebsd = ehdr.e_ident[EI_OSABI] == ELFOSABI_FREEBSD; in is_executable() 432 for (i = 0; i < ehdr.e_phnum; i++) { in is_executable() 440 if (ehdr.e_ident[EI_OSABI] == ELFOSABI_NONE && !freebsd) in is_executable() 441 freebsd = has_freebsd_abi_tag(fname, elf, &ehdr, in is_executable() [all …]
|
/freebsd/sys/x86/xen/ |
H A D | pv.c | 219 Elf_Ehdr *ehdr; in xen_pvh_parse_symtab() local 223 ehdr = (Elf_Ehdr *)(&end + 1); in xen_pvh_parse_symtab() 224 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) || in xen_pvh_parse_symtab() 225 ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || in xen_pvh_parse_symtab() 226 ehdr->e_version > 1) { in xen_pvh_parse_symtab() 232 shdr = (Elf_Shdr *)((uint8_t *)ehdr + ehdr->e_shoff); in xen_pvh_parse_symtab() 234 for (i = 1; i < ehdr->e_shnum; i++) { in xen_pvh_parse_symtab() 239 ksymtab = (uintptr_t)((uint8_t *)ehdr + shdr[i].sh_offset); in xen_pvh_parse_symtab() 244 kstrtab = (uintptr_t)((uint8_t *)ehdr + shdr[j].sh_offset); in xen_pvh_parse_symtab()
|
/freebsd/stand/i386/libi386/ |
H A D | elf64_freebsd.c | 73 Elf_Ehdr *ehdr; in elf64_exec() local 80 ehdr = (Elf_Ehdr *)&(md->md_data); in elf64_exec() 108 entry_lo = ehdr->e_entry & 0xffffffff; in elf64_exec() 109 entry_hi = (ehdr->e_entry >> 32) & 0xffffffff; in elf64_exec() 111 printf("Start @ %#llx ...\n", ehdr->e_entry); in elf64_exec()
|
H A D | elf32_freebsd.c | 54 Elf_Ehdr *ehdr; in elf32_exec() local 60 ehdr = (Elf_Ehdr *)&(md->md_data); in elf32_exec() 65 entry = ehdr->e_entry & 0xffffff; in elf32_exec()
|
/freebsd/usr.sbin/crunch/crunchide/ |
H A D | exec_elf32.c | 224 Elf_Ehdr ehdr; in ELFNAMEEND() local 242 if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) in ELFNAMEEND() 245 data = ehdr.e_ident[EI_DATA]; in ELFNAMEEND() 246 shnum = xe16toh(ehdr.e_shnum); in ELFNAMEEND() 248 shdrsize = shnum * xe16toh(ehdr.e_shentsize); in ELFNAMEEND() 251 if (xreadatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) != in ELFNAMEEND() 268 if (i == xe16toh(ehdr.e_shstrndx)) in ELFNAMEEND() 303 shdrshdr.sh_offset = ehdr.e_shoff; in ELFNAMEEND() 464 ehdr.e_shoff != shdrshdr.sh_offset) { in ELFNAMEEND() 465 ehdr.e_shoff = shdrshdr.sh_offset; in ELFNAMEEND() [all …]
|
/freebsd/sys/powerpc/ofw/ |
H A D | ofw_initrd.c | 61 Elf_Ehdr ehdr; in ofw_initrd_probe_and_attach() local 96 memcpy(&ehdr, taste, sizeof(ehdr)); in ofw_initrd_probe_and_attach() 98 if (IS_ELF(ehdr)) { in ofw_initrd_probe_and_attach()
|
/freebsd/contrib/elftoolchain/brandelf/ |
H A D | brandelf.c | 93 GElf_Ehdr ehdr; in main() local 185 if (gelf_getehdr(elf, &ehdr) == NULL) { in main() 194 argv[0], iselftype(ehdr.e_ident[EI_OSABI]), in main() 195 ehdr.e_ident[EI_OSABI]); in main() 216 ehdr.e_ident[EI_OSABI] = (unsigned char) type; in main() 217 if (gelf_update_ehdr(elf, &ehdr) == 0) { in main()
|
/freebsd/contrib/elftoolchain/elfdump/ |
H A D | elfdump.c | 119 GElf_Ehdr ehdr; /* ELF header. */ member 1060 if (gelf_getehdr(ed->elf, &ed->ehdr) == NULL) { in elf_print_elf() 1287 ed->ehdr.e_ident[0], ed->ehdr.e_ident[1], in elf_print_ehdr() 1288 ed->ehdr.e_ident[2], ed->ehdr.e_ident[3]); in elf_print_ehdr() 1290 elf_class_str(ed->ehdr.e_ident[EI_CLASS])); in elf_print_ehdr() 1292 elf_data_str(ed->ehdr.e_ident[EI_DATA])); in elf_print_ehdr() 1293 PRT(" e_machine: %-18s", e_machines(ed->ehdr.e_machine)); in elf_print_ehdr() 1295 elf_version_str(ed->ehdr.e_version)); in elf_print_ehdr() 1296 PRT(" e_type: %s\n", elf_type_str(ed->ehdr.e_type)); in elf_print_ehdr() 1297 PRT(" e_flags: %18d\n", ed->ehdr.e_flags); in elf_print_ehdr() [all …]
|
/freebsd/stand/userboot/userboot/ |
H A D | elf64_freebsd.c | 75 Elf_Ehdr *ehdr; in elf64_exec() local 87 ehdr = (Elf_Ehdr *)&(md->md_data); in elf64_exec() 125 printf("Start @ %#"PRIx64" ...\n", ehdr->e_entry); in elf64_exec() 148 CALLBACK(exec, ehdr->e_entry); in elf64_exec()
|
H A D | elf32_freebsd.c | 57 Elf_Ehdr *ehdr; in elf32_exec() local 65 ehdr = (Elf_Ehdr *)&(md->md_data); in elf32_exec() 70 entry = ehdr->e_entry & 0xffffff; in elf32_exec()
|
/freebsd/stand/efi/loader/arch/arm64/ |
H A D | exec.c | 62 Elf_Ehdr *ehdr; in elf64_exec() local 69 ehdr = (Elf_Ehdr *)&(md->md_data); in elf64_exec() 70 entry = efi_translate(ehdr->e_entry); in elf64_exec()
|
/freebsd/usr.bin/elfctl/ |
H A D | elfctl.c | 91 GElf_Ehdr ehdr; in main() local 162 if (gelf_getehdr(elf, &ehdr) == NULL) { in main() 168 if (ehdr.e_ident[EI_DATA] == HOST_ENDIAN) { in main() 170 } else if (ehdr.e_ident[EI_DATA] == SWAP_ENDIAN) { in main() 179 if (!print_file_features(elf, ehdr.e_phnum, fd, in main() 184 } else if (!edit_file_features(elf, ehdr.e_phnum, fd, in main()
|