/Linux-v5.10/kernel/ |
D | kexec_elf.c | 24 static inline bool elf_is_elf_file(const struct elfhdr *ehdr) in elf_is_elf_file() argument 26 return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0; in elf_is_elf_file() 29 static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value) in elf64_to_cpu() argument 31 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in elf64_to_cpu() 33 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) in elf64_to_cpu() 39 static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value) in elf32_to_cpu() argument 41 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in elf32_to_cpu() 43 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) in elf32_to_cpu() 49 static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value) in elf16_to_cpu() argument 51 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in elf16_to_cpu() [all …]
|
D | kexec_file.c | 840 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf() 844 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_kbuf() 904 sechdrs = vzalloc(array_size(sizeof(Elf_Shdr), pi->ehdr->e_shnum)); in kexec_purgatory_setup_sechdrs() 907 memcpy(sechdrs, (void *)pi->ehdr + pi->ehdr->e_shoff, in kexec_purgatory_setup_sechdrs() 908 pi->ehdr->e_shnum * sizeof(Elf_Shdr)); in kexec_purgatory_setup_sechdrs() 913 kbuf->image->start = pi->ehdr->e_entry; in kexec_purgatory_setup_sechdrs() 915 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_sechdrs() 932 pi->ehdr->e_entry >= sechdrs[i].sh_addr && in kexec_purgatory_setup_sechdrs() 933 pi->ehdr->e_entry < (sechdrs[i].sh_addr in kexec_purgatory_setup_sechdrs() 939 src = (void *)pi->ehdr + sechdrs[i].sh_offset; in kexec_purgatory_setup_sechdrs() [all …]
|
/Linux-v5.10/arch/s390/kernel/ |
D | kexec_elf.c | 20 const Elf_Ehdr *ehdr; in kexec_file_add_kernel_elf() local 27 ehdr = (Elf_Ehdr *)kernel; in kexec_file_add_kernel_elf() 32 entry = ehdr->e_entry; in kexec_file_add_kernel_elf() 34 phdr = (void *)ehdr + ehdr->e_phoff; in kexec_file_add_kernel_elf() 35 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { in kexec_file_add_kernel_elf() 71 const Elf_Ehdr *ehdr; in s390_elf_load() local 77 ehdr = (Elf_Ehdr *)kernel; in s390_elf_load() 79 if (ehdr->e_type != ET_EXEC || in s390_elf_load() 80 ehdr->e_ident[EI_CLASS] != ELFCLASS64 || in s390_elf_load() 81 !elf_check_arch(ehdr)) in s390_elf_load() [all …]
|
/Linux-v5.10/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-v5.10/tools/perf/util/ |
D | symbol-minimal.c | 116 Elf32_Ehdr ehdr; in filename__read_build_id() local 119 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() 123 ehdr.e_phoff = bswap_32(ehdr.e_phoff); in filename__read_build_id() 124 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); in filename__read_build_id() 125 ehdr.e_phnum = bswap_16(ehdr.e_phnum); in filename__read_build_id() 128 buf_size = ehdr.e_phentsize * ehdr.e_phnum; in filename__read_build_id() 133 fseek(fp, ehdr.e_phoff, SEEK_SET); in filename__read_build_id() 137 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() 167 Elf64_Ehdr ehdr; in filename__read_build_id() local 170 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() [all …]
|
D | symbol-elf.c | 80 GElf_Ehdr *ehdr; in elf_getphdrnum() local 82 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum() 83 if (!ehdr) in elf_getphdrnum() 86 *dst = ehdr->e_phnum; in elf_getphdrnum() 294 GElf_Ehdr ehdr; in dso__synthesize_plt_symbols() local 303 ehdr = ss->ehdr; in dso__synthesize_plt_symbols() 312 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, in dso__synthesize_plt_symbols() 315 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, in dso__synthesize_plt_symbols() 326 if (elf_section_by_name(elf, &ehdr, &shdr_plt, ".plt", NULL) == NULL) in dso__synthesize_plt_symbols() 354 switch (ehdr.e_machine) { in dso__synthesize_plt_symbols() [all …]
|
D | genelf.c | 249 Elf_Ehdr *ehdr; in jit_write_elf() local 270 ehdr = elf_newehdr(e); in jit_write_elf() 271 if (!ehdr) { in jit_write_elf() 276 ehdr->e_ident[EI_DATA] = GEN_ELF_ENDIAN; in jit_write_elf() 277 ehdr->e_ident[EI_CLASS] = GEN_ELF_CLASS; in jit_write_elf() 278 ehdr->e_machine = GEN_ELF_ARCH; in jit_write_elf() 279 ehdr->e_type = ET_DYN; in jit_write_elf() 280 ehdr->e_entry = GEN_ELF_TEXT_OFFSET; in jit_write_elf() 281 ehdr->e_version = EV_CURRENT; in jit_write_elf() 282 ehdr->e_shstrndx= unwinding ? 4 : 2; /* shdr index for section name */ in jit_write_elf()
|
/Linux-v5.10/scripts/ |
D | recordmcount.h | 206 static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) in get_shnum() argument 208 if (shdr0 && !ehdr->e_shnum) in get_shnum() 211 return w2(ehdr->e_shnum); in get_shnum() 214 static void set_shnum(Elf_Ehdr *ehdr, Elf_Shdr *shdr0, unsigned int new_shnum) in set_shnum() argument 217 ehdr->e_shnum = 0; in set_shnum() 220 ehdr->e_shnum = w2(new_shnum); in set_shnum() 223 static int get_shstrndx(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) in get_shstrndx() argument 225 if (ehdr->e_shstrndx != SHN_XINDEX) in get_shstrndx() 226 return w2(ehdr->e_shstrndx); in get_shstrndx() 231 static void find_symtab(Elf_Ehdr *const ehdr, Elf_Shdr const *shdr0, in find_symtab() argument [all …]
|
D | sorttable.c | 300 Elf32_Ehdr *ehdr = addr; in do_file() local 303 switch (ehdr->e_ident[EI_DATA]) { in do_file() 322 ehdr->e_ident[EI_DATA], fname); in do_file() 326 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 || in do_file() 327 (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN) || in do_file() 328 ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file() 333 switch (r2(&ehdr->e_machine)) { in do_file() 356 r2(&ehdr->e_machine), fname); in do_file() 360 switch (ehdr->e_ident[EI_CLASS]) { in do_file() 362 if (r2(&ehdr->e_ehsize) != sizeof(Elf32_Ehdr) || in do_file() [all …]
|
D | sorttable.h | 195 static int do_sort(Elf_Ehdr *ehdr, in do_sort() argument 200 Elf_Shdr *s, *shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); in do_sort() 226 shstrndx = r2(&ehdr->e_shstrndx); in do_sort() 229 secstrings = (const char *)ehdr + _r(&shdr[shstrndx].sh_offset); in do_sort() 231 shnum = r2(&ehdr->e_shnum); in do_sort() 249 relocs = (void *)ehdr + _r(&s->sh_offset); in do_sort() 253 symtab_shndx = (Elf32_Word *)((const char *)ehdr + in do_sort() 260 g_orc_ip_table = (int *)((void *)ehdr + in do_sort() 265 g_orc_table = (struct orc_entry *)((void *)ehdr + in do_sort() 312 extab_image = (void *)ehdr + _r(&extab_sec->sh_offset); in do_sort() [all …]
|
D | recordmcount.c | 480 Elf32_Ehdr *ehdr; in do_file() local 483 ehdr = mmap_file(fname); in do_file() 484 if (!ehdr) in do_file() 490 switch (ehdr->e_ident[EI_DATA]) { in do_file() 494 ehdr->e_ident[EI_DATA], fname); in do_file() 523 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 || in do_file() 524 w2(ehdr->e_type) != ET_REL || in do_file() 525 ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file() 531 switch (w2(ehdr->e_machine)) { in do_file() 534 w2(ehdr->e_machine), fname); in do_file() [all …]
|
/Linux-v5.10/arch/x86/tools/ |
D | relocs.c | 14 static Elf_Ehdr ehdr; variable 340 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr() 344 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { in read_ehdr() 347 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) { in read_ehdr() 350 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { in read_ehdr() 353 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { in read_ehdr() 357 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr() 358 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr() 359 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr() 360 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr() [all …]
|
/Linux-v5.10/drivers/s390/crypto/ |
D | zcrypt_error.h | 81 struct error_hdr *ehdr = reply->msg; in convert_error() local 85 switch (ehdr->reply_code) { in convert_error() 103 card, queue, ehdr->reply_code); in convert_error() 114 if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL && in convert_error() 115 ehdr->type == TYPE86_RSP_CODE) { in convert_error() 124 card, queue, ehdr->reply_code, apfs); in convert_error() 128 card, queue, ehdr->reply_code); in convert_error() 134 card, queue, ehdr->reply_code); in convert_error()
|
/Linux-v5.10/arch/mips/vdso/ |
D | genvdso.h | 9 const ELF(Ehdr) *ehdr = vdso; in FUNC() 15 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 16 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 17 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 19 shdr = shdrs + (sh_entsize * swap_uint16(ehdr->e_shstrndx)); in FUNC() 60 const ELF(Ehdr) *ehdr = vdso; in FUNC() 69 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 70 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 71 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 87 flags = swap_uint32(ehdr->e_flags); in FUNC()
|
D | genvdso.c | 113 const Elf32_Ehdr *ehdr; in map_vdso() local 139 ehdr = addr; in map_vdso() 141 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) { in map_vdso() 148 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() 172 if (swap_uint16(ehdr->e_machine) != EM_MIPS) { in map_vdso() 178 } else if (swap_uint16(ehdr->e_type) != ET_DYN) { in map_vdso()
|
/Linux-v5.10/drivers/remoteproc/ |
D | remoteproc_coredump.c | 234 void *ehdr; in rproc_coredump() local 270 ehdr = data; in rproc_coredump() 272 memset(ehdr, 0, elf_size_of_hdr(class)); in rproc_coredump() 274 elf_hdr_init_ident(ehdr, class); in rproc_coredump() 276 elf_hdr_set_e_type(class, ehdr, ET_CORE); in rproc_coredump() 277 elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); in rproc_coredump() 278 elf_hdr_set_e_version(class, ehdr, EV_CURRENT); in rproc_coredump() 279 elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); in rproc_coredump() 280 elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); in rproc_coredump() 281 elf_hdr_set_e_ehsize(class, ehdr, elf_size_of_hdr(class)); in rproc_coredump() [all …]
|
D | remoteproc_elf_loader.c | 44 struct elf32_hdr *ehdr; local 60 ehdr = (struct elf32_hdr *)fw->data; 62 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) { 67 class = ehdr->e_ident[EI_CLASS]; 80 if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { 82 if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) { 159 const void *ehdr, *phdr; local 166 ehdr = elf_data; 167 phnum = elf_hdr_get_e_phnum(class, ehdr); 168 phdr = elf_data + elf_hdr_get_e_phoff(class, ehdr); [all …]
|
/Linux-v5.10/drivers/soc/qcom/ |
D | mdt_loader.c | 44 const struct elf32_hdr *ehdr; in qcom_mdt_get_size() local 49 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_get_size() 50 phdrs = (struct elf32_phdr *)(ehdr + 1); in qcom_mdt_get_size() 52 for (i = 0; i < ehdr->e_phnum; i++) { in qcom_mdt_get_size() 89 const struct elf32_hdr *ehdr; in qcom_mdt_read_metadata() local 95 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_read_metadata() 96 phdrs = (struct elf32_phdr *)(ehdr + 1); in qcom_mdt_read_metadata() 98 if (ehdr->e_phnum < 2) in qcom_mdt_read_metadata() 136 const struct elf32_hdr *ehdr; in __qcom_mdt_load() local 154 ehdr = (struct elf32_hdr *)fw->data; in __qcom_mdt_load() [all …]
|
/Linux-v5.10/arch/parisc/boot/compressed/ |
D | misc.c | 236 Elf64_Ehdr ehdr; in parse_elf() local 239 Elf32_Ehdr ehdr; in parse_elf() 245 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf() 246 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf() 247 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf() 248 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf() 249 ehdr.e_ident[EI_MAG3] != ELFMAG3) { in parse_elf() 258 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 262 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 264 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
|
/Linux-v5.10/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-v5.10/arch/x86/boot/compressed/ |
D | misc.c | 274 Elf64_Ehdr ehdr; in parse_elf() local 277 Elf32_Ehdr ehdr; in parse_elf() 283 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf() 284 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf() 285 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf() 286 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf() 287 ehdr.e_ident[EI_MAG3] != ELFMAG3) { in parse_elf() 294 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 298 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 300 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
|
/Linux-v5.10/arch/powerpc/oprofile/cell/ |
D | vma_map.c | 112 Elf32_Ehdr ehdr; in create_vma_map() local 128 if (copy_from_user(&ehdr, spu_elf_start, sizeof (ehdr))) in create_vma_map() 131 if (memcmp(ehdr.e_ident, expected, EI_PAD) != 0) { in create_vma_map() 137 if (ehdr.e_machine != EM_SPU) { in create_vma_map() 143 if (ehdr.e_type != ET_EXEC) { in create_vma_map() 149 phdr_start = spu_elf_start + ehdr.e_phoff; in create_vma_map() 150 shdr_start = spu_elf_start + ehdr.e_shoff; in create_vma_map() 153 for (i = 0; i < ehdr.e_phnum; i++) { in create_vma_map() 170 for (i = 0; i < ehdr.e_shnum; i++) { in create_vma_map()
|
/Linux-v5.10/arch/arm/kernel/ |
D | vdso.c | 113 static void * __init find_section(Elf32_Ehdr *ehdr, const char *name, in find_section() argument 121 sechdrs = (void *)ehdr + ehdr->e_shoff; in find_section() 122 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; in find_section() 125 for (i = 1; i < ehdr->e_shnum; i++) { in find_section() 129 return (void *)ehdr + sechdrs[i].sh_offset; in find_section() 169 static void __init patch_vdso(void *ehdr) in patch_vdso() argument 174 .hdr = ehdr, in patch_vdso()
|
/Linux-v5.10/arch/mips/kernel/ |
D | elf.c | 81 } *ehdr = _ehdr; in arch_elf_pt_proc() local 90 elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; in arch_elf_pt_proc() 91 flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; in arch_elf_pt_proc() 140 } *ehdr = _ehdr; in arch_check_elf() local 150 elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; in arch_check_elf() 151 flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; in arch_check_elf()
|
/Linux-v5.10/net/tipc/ |
D | crypto.c | 270 static inline int tipc_ehdr_size(struct tipc_ehdr *ehdr); 731 struct tipc_ehdr *ehdr; in tipc_aead_encrypt() local 791 ehdr = (struct tipc_ehdr *)skb->data; in tipc_aead_encrypt() 794 salt ^= ehdr->addr; /* __be32 */ in tipc_aead_encrypt() 798 memcpy(iv + 4, (u8 *)&ehdr->seqno, 8); in tipc_aead_encrypt() 801 ehsz = tipc_ehdr_size(ehdr); in tipc_aead_encrypt() 885 struct tipc_ehdr *ehdr; in tipc_aead_decrypt() local 922 ehdr = (struct tipc_ehdr *)skb->data; in tipc_aead_decrypt() 925 salt ^= ehdr->addr; /* __be32 */ in tipc_aead_decrypt() 926 else if (ehdr->destined) in tipc_aead_decrypt() [all …]
|