/Linux-v4.19/arch/powerpc/kernel/ |
D | kexec_elf_64.c | 49 const struct elfhdr *ehdr; member 54 static inline bool elf_is_elf_file(const struct elfhdr *ehdr) in elf_is_elf_file() argument 56 return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0; in elf_is_elf_file() 59 static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value) in elf64_to_cpu() argument 61 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in elf64_to_cpu() 63 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) in elf64_to_cpu() 69 static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value) in elf16_to_cpu() argument 71 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in elf16_to_cpu() 73 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) in elf16_to_cpu() 79 static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value) in elf32_to_cpu() argument [all …]
|
/Linux-v4.19/arch/s390/kernel/ |
D | kexec_elf.c | 20 const Elf_Ehdr *ehdr; in kexec_file_add_elf_kernel() local 24 ehdr = (Elf_Ehdr *)kernel; in kexec_file_add_elf_kernel() 27 phdr = (void *)ehdr + ehdr->e_phoff; in kexec_file_add_elf_kernel() 28 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { in kexec_file_add_elf_kernel() 68 const Elf_Ehdr *ehdr; in s390_elf_load() local 74 ehdr = (Elf_Ehdr *)kernel; in s390_elf_load() 76 if (ehdr->e_type != ET_EXEC || in s390_elf_load() 77 ehdr->e_ident[EI_CLASS] != ELFCLASS64 || in s390_elf_load() 78 !elf_check_arch(ehdr)) in s390_elf_load() 81 if (!ehdr->e_phnum || ehdr->e_phentsize != sizeof(Elf_Phdr)) in s390_elf_load() [all …]
|
D | crash_dump.c | 510 static void *ehdr_init(Elf64_Ehdr *ehdr, int mem_chunk_cnt) in ehdr_init() argument 512 memset(ehdr, 0, sizeof(*ehdr)); in ehdr_init() 513 memcpy(ehdr->e_ident, ELFMAG, SELFMAG); in ehdr_init() 514 ehdr->e_ident[EI_CLASS] = ELFCLASS64; in ehdr_init() 515 ehdr->e_ident[EI_DATA] = ELFDATA2MSB; in ehdr_init() 516 ehdr->e_ident[EI_VERSION] = EV_CURRENT; in ehdr_init() 517 memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); in ehdr_init() 518 ehdr->e_type = ET_CORE; in ehdr_init() 519 ehdr->e_machine = EM_S390; in ehdr_init() 520 ehdr->e_version = EV_CURRENT; in ehdr_init() [all …]
|
/Linux-v4.19/arch/mips/boot/tools/ |
D | relocs.c | 14 static Elf_Ehdr ehdr; variable 96 sec_strtab = secs[ehdr.e_shstrndx].strtab; in sec_name() 97 if (shndx < ehdr.e_shnum) in sec_name() 112 for (i = 0; i < ehdr.e_shnum; i++) in sec_lookup() 163 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in elf16_to_cpu() 171 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in elf32_to_cpu() 179 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in cpu_to_elf32() 191 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in elf64_to_cpu() 207 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr() 210 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) in read_ehdr() [all …]
|
/Linux-v4.19/drivers/remoteproc/ |
D | remoteproc_elf_loader.c | 46 struct elf32_hdr *ehdr; local 59 ehdr = (struct elf32_hdr *)fw->data; 62 class = ehdr->e_ident[EI_CLASS]; 70 if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { 72 if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) { 78 if (fw->size < ehdr->e_shoff + sizeof(struct elf32_shdr)) { 83 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) { 88 if (ehdr->e_phnum == 0) { 93 if (ehdr->e_phoff > fw->size) { 115 struct elf32_hdr *ehdr = (struct elf32_hdr *)fw->data; local [all …]
|
/Linux-v4.19/tools/perf/util/ |
D | symbol-minimal.c | 111 Elf32_Ehdr ehdr; in filename__read_build_id() local 114 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() 118 ehdr.e_phoff = bswap_32(ehdr.e_phoff); in filename__read_build_id() 119 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); in filename__read_build_id() 120 ehdr.e_phnum = bswap_16(ehdr.e_phnum); in filename__read_build_id() 123 buf_size = ehdr.e_phentsize * ehdr.e_phnum; in filename__read_build_id() 128 fseek(fp, ehdr.e_phoff, SEEK_SET); in filename__read_build_id() 132 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() 162 Elf64_Ehdr ehdr; in filename__read_build_id() local 165 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() [all …]
|
D | symbol-elf.c | 49 GElf_Ehdr *ehdr; in elf_getphdrnum() local 51 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum() 52 if (!ehdr) in elf_getphdrnum() 55 *dst = ehdr->e_phnum; in elf_getphdrnum() 256 GElf_Ehdr ehdr; in dso__synthesize_plt_symbols() local 265 ehdr = ss->ehdr; in dso__synthesize_plt_symbols() 274 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, in dso__synthesize_plt_symbols() 277 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, in dso__synthesize_plt_symbols() 288 if (elf_section_by_name(elf, &ehdr, &shdr_plt, ".plt", NULL) == NULL) in dso__synthesize_plt_symbols() 316 switch (ehdr.e_machine) { in dso__synthesize_plt_symbols() [all …]
|
D | genelf.c | 254 Elf_Ehdr *ehdr; in jit_write_elf() local 275 ehdr = elf_newehdr(e); in jit_write_elf() 276 if (!ehdr) { in jit_write_elf() 281 ehdr->e_ident[EI_DATA] = GEN_ELF_ENDIAN; in jit_write_elf() 282 ehdr->e_ident[EI_CLASS] = GEN_ELF_CLASS; in jit_write_elf() 283 ehdr->e_machine = GEN_ELF_ARCH; in jit_write_elf() 284 ehdr->e_type = ET_DYN; in jit_write_elf() 285 ehdr->e_entry = GEN_ELF_TEXT_OFFSET; in jit_write_elf() 286 ehdr->e_version = EV_CURRENT; in jit_write_elf() 287 ehdr->e_shstrndx= unwinding ? 4 : 2; /* shdr index for section name */ in jit_write_elf()
|
/Linux-v4.19/arch/x86/tools/ |
D | relocs.c | 14 static Elf_Ehdr ehdr; variable 243 sec_strtab = secs[ehdr.e_shstrndx].strtab; in sec_name() 245 if (shndx < ehdr.e_shnum) { in sec_name() 273 for (i = 0; i < ehdr.e_shnum; i++) { in sym_lookup() 337 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr() 341 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { in read_ehdr() 344 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) { in read_ehdr() 347 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { in read_ehdr() 350 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { in read_ehdr() 354 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr() [all …]
|
/Linux-v4.19/scripts/ |
D | recordmcount.h | 178 static void append_func(Elf_Ehdr *const ehdr, in append_func() argument 192 unsigned const old_shnum = w2(ehdr->e_shnum); in append_func() 193 uint_t const old_shoff = _w(ehdr->e_shoff); in append_func() 207 uwrite(fd_map, old_shstr_sh_offset + (void *)ehdr, old_shstr_sh_size); in append_func() 213 uwrite(fd_map, old_shoff + (void *)ehdr, in append_func() 248 ehdr->e_shoff = _w(new_e_shoff); in append_func() 249 ehdr->e_shnum = w2(2 + w2(ehdr->e_shnum)); /* {.rel,}__mcount_loc */ in append_func() 251 uwrite(fd_map, ehdr, sizeof(*ehdr)); in append_func() 277 Elf_Ehdr const *const ehdr, in get_sym_str_and_relp() argument 282 Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff) in get_sym_str_and_relp() [all …]
|
D | sortextable.h | 93 do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) in do_func() argument 117 shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); in do_func() 119 num_sections = r2(&ehdr->e_shnum); in do_func() 123 secindex_strings = r2(&ehdr->e_shstrndx); in do_func() 128 secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); in do_func() 138 relocs = (void *)ehdr + _r(&shdr[i].sh_offset); in do_func() 147 (const char *)ehdr + _r(&shdr[i].sh_offset)); in do_func() 157 symtab = (const Elf_Sym *)((const char *)ehdr + in do_func() 163 strtab = (const char *)ehdr + _r(&strtab_sec->sh_offset); in do_func() 165 extab_image = (void *)ehdr + _r(&extab_sec->sh_offset); in do_func() [all …]
|
D | sortextable.c | 271 Elf32_Ehdr *ehdr = mmap_file(fname); in do_file() local 273 ehdr_curr = ehdr; in do_file() 274 switch (ehdr->e_ident[EI_DATA]) { in do_file() 277 ehdr->e_ident[EI_DATA], fname); in do_file() 297 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 in do_file() 298 || (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN) in do_file() 299 || ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file() 305 switch (r2(&ehdr->e_machine)) { in do_file() 308 r2(&ehdr->e_machine), fname); in do_file() 332 switch (ehdr->e_ident[EI_CLASS]) { in do_file() [all …]
|
D | recordmcount.c | 453 Elf32_Ehdr *const ehdr = mmap_file(fname); in do_file() local 459 switch (ehdr->e_ident[EI_DATA]) { in do_file() 463 ehdr->e_ident[EI_DATA], fname); in do_file() 493 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 in do_file() 494 || w2(ehdr->e_type) != ET_REL in do_file() 495 || ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file() 501 switch (w2(ehdr->e_machine)) { in do_file() 504 w2(ehdr->e_machine), fname); in do_file() 542 switch (ehdr->e_ident[EI_CLASS]) { in do_file() 545 ehdr->e_ident[EI_CLASS], fname); in do_file() [all …]
|
/Linux-v4.19/kernel/ |
D | kexec_file.c | 732 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf() 736 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_kbuf() 796 sechdrs = vzalloc(array_size(sizeof(Elf_Shdr), pi->ehdr->e_shnum)); in kexec_purgatory_setup_sechdrs() 799 memcpy(sechdrs, (void *)pi->ehdr + pi->ehdr->e_shoff, in kexec_purgatory_setup_sechdrs() 800 pi->ehdr->e_shnum * sizeof(Elf_Shdr)); in kexec_purgatory_setup_sechdrs() 805 kbuf->image->start = pi->ehdr->e_entry; in kexec_purgatory_setup_sechdrs() 807 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_sechdrs() 824 pi->ehdr->e_entry >= sechdrs[i].sh_addr && in kexec_purgatory_setup_sechdrs() 825 pi->ehdr->e_entry < (sechdrs[i].sh_addr in kexec_purgatory_setup_sechdrs() 831 src = (void *)pi->ehdr + sechdrs[i].sh_offset; in kexec_purgatory_setup_sechdrs() [all …]
|
/Linux-v4.19/arch/mips/vdso/ |
D | genvdso.h | 13 const ELF(Ehdr) *ehdr = vdso; in FUNC() 19 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 20 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 21 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 23 shdr = shdrs + (sh_entsize * swap_uint16(ehdr->e_shstrndx)); in FUNC() 64 const ELF(Ehdr) *ehdr = vdso; in FUNC() 73 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 74 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 75 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 91 flags = swap_uint32(ehdr->e_flags); in FUNC()
|
D | genvdso.c | 117 const Elf32_Ehdr *ehdr; in map_vdso() local 141 ehdr = addr; in map_vdso() 143 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) { in map_vdso() 149 elf_class = ehdr->e_ident[EI_CLASS]; in map_vdso() 160 switch (ehdr->e_ident[EI_DATA]) { in map_vdso() 163 need_swap = ehdr->e_ident[EI_DATA] != HOST_ORDER; in map_vdso() 171 if (swap_uint16(ehdr->e_machine) != EM_MIPS) { in map_vdso() 176 } else if (swap_uint16(ehdr->e_type) != ET_DYN) { in map_vdso()
|
/Linux-v4.19/arch/x86/boot/compressed/ |
D | misc.c | 272 Elf64_Ehdr ehdr; in parse_elf() local 275 Elf32_Ehdr ehdr; in parse_elf() 281 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf() 282 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf() 283 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf() 284 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf() 285 ehdr.e_ident[EI_MAG3] != ELFMAG3) { in parse_elf() 292 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 296 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 298 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
|
/Linux-v4.19/drivers/s390/crypto/ |
D | zcrypt_error.h | 82 struct error_hdr *ehdr = reply->message; in convert_error() local 86 switch (ehdr->reply_code) { in convert_error() 99 card, queue, ehdr->reply_code); in convert_error() 114 card, queue, ehdr->reply_code); in convert_error() 126 card, queue, ehdr->reply_code); in convert_error() 134 card, queue, ehdr->reply_code); in convert_error()
|
/Linux-v4.19/tools/testing/selftests/powerpc/ptrace/ |
D | core-pkey.c | 195 static int check_core_file(struct shared_info *info, Elf64_Ehdr *ehdr, in check_core_file() argument 202 void *p = ehdr, *note; in check_core_file() 205 ret = memcmp(ehdr->e_ident, ELFMAG, SELFMAG); in check_core_file() 208 FAIL_IF(ehdr->e_type != ET_CORE); in check_core_file() 209 FAIL_IF(ehdr->e_machine != EM_PPC64); in check_core_file() 210 FAIL_IF(ehdr->e_phoff == 0 || ehdr->e_phnum == 0); in check_core_file() 216 phdr_size = sizeof(*phdr) * ehdr->e_phnum; in check_core_file() 219 FAIL_IF(ehdr->e_phoff + phdr_size < ehdr->e_phoff); in check_core_file() 220 FAIL_IF(ehdr->e_phoff + phdr_size > core_size); in check_core_file() 223 for (phdr = p + ehdr->e_phoff; in check_core_file() [all …]
|
/Linux-v4.19/drivers/soc/qcom/ |
D | mdt_loader.c | 52 const struct elf32_hdr *ehdr; in qcom_mdt_get_size() local 57 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_get_size() 58 phdrs = (struct elf32_phdr *)(ehdr + 1); in qcom_mdt_get_size() 60 for (i = 0; i < ehdr->e_phnum; i++) { in qcom_mdt_get_size() 84 const struct elf32_hdr *ehdr; in __qcom_mdt_load() local 100 ehdr = (struct elf32_hdr *)fw->data; in __qcom_mdt_load() 101 phdrs = (struct elf32_phdr *)(ehdr + 1); in __qcom_mdt_load() 119 for (i = 0; i < ehdr->e_phnum; i++) { in __qcom_mdt_load() 158 for (i = 0; i < ehdr->e_phnum; i++) { in __qcom_mdt_load()
|
/Linux-v4.19/arch/powerpc/oprofile/cell/ |
D | vma_map.c | 116 Elf32_Ehdr ehdr; in create_vma_map() local 132 if (copy_from_user(&ehdr, spu_elf_start, sizeof (ehdr))) in create_vma_map() 135 if (memcmp(ehdr.e_ident, expected, EI_PAD) != 0) { in create_vma_map() 141 if (ehdr.e_machine != EM_SPU) { in create_vma_map() 147 if (ehdr.e_type != ET_EXEC) { in create_vma_map() 153 phdr_start = spu_elf_start + ehdr.e_phoff; in create_vma_map() 154 shdr_start = spu_elf_start + ehdr.e_shoff; in create_vma_map() 157 for (i = 0; i < ehdr.e_phnum; i++) { in create_vma_map() 174 for (i = 0; i < ehdr.e_shnum; i++) { in create_vma_map()
|
/Linux-v4.19/tools/perf/arch/arm64/util/ |
D | sym-handling.c | 16 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) in elf__needs_adjust_symbols() argument 18 return ehdr.e_type == ET_EXEC || in elf__needs_adjust_symbols() 19 ehdr.e_type == ET_REL || in elf__needs_adjust_symbols() 20 ehdr.e_type == ET_DYN; in elf__needs_adjust_symbols()
|
/Linux-v4.19/arch/arm/kernel/ |
D | vdso.c | 120 static void * __init find_section(Elf32_Ehdr *ehdr, const char *name, in find_section() argument 128 sechdrs = (void *)ehdr + ehdr->e_shoff; in find_section() 129 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; in find_section() 132 for (i = 1; i < ehdr->e_shnum; i++) { in find_section() 136 return (void *)ehdr + sechdrs[i].sh_offset; in find_section() 176 static void __init patch_vdso(void *ehdr) in patch_vdso() argument 181 .hdr = ehdr, in patch_vdso()
|
/Linux-v4.19/arch/mips/kernel/ |
D | elf.c | 83 } *ehdr = _ehdr; in arch_elf_pt_proc() local 92 elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; in arch_elf_pt_proc() 93 flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; in arch_elf_pt_proc() 142 } *ehdr = _ehdr; in arch_check_elf() local 152 elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; in arch_check_elf() 153 flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; in arch_check_elf()
|
/Linux-v4.19/fs/proc/ |
D | vmcore.c | 1164 Elf64_Ehdr ehdr; in parse_crash_elf64_headers() local 1170 rc = elfcorehdr_read((char *)&ehdr, sizeof(Elf64_Ehdr), &addr); in parse_crash_elf64_headers() 1175 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 || in parse_crash_elf64_headers() 1176 (ehdr.e_type != ET_CORE) || in parse_crash_elf64_headers() 1177 !vmcore_elf64_check_arch(&ehdr) || in parse_crash_elf64_headers() 1178 ehdr.e_ident[EI_CLASS] != ELFCLASS64 || in parse_crash_elf64_headers() 1179 ehdr.e_ident[EI_VERSION] != EV_CURRENT || in parse_crash_elf64_headers() 1180 ehdr.e_version != EV_CURRENT || in parse_crash_elf64_headers() 1181 ehdr.e_ehsize != sizeof(Elf64_Ehdr) || in parse_crash_elf64_headers() 1182 ehdr.e_phentsize != sizeof(Elf64_Phdr) || in parse_crash_elf64_headers() [all …]
|