Home
last modified time | relevance | path

Searched refs:ehdr (Results 1 – 25 of 108) sorted by relevance

12345

/linux-6.15/kernel/
H A Dkexec_elf.c78 if (ehdr->e_phoff > 0 && ehdr->e_phnum > 0) { in elf_is_ehdr_sane()
88 if (ehdr->e_phoff + phdr_size < ehdr->e_phoff) { in elf_is_ehdr_sane()
97 if (ehdr->e_shoff > 0 && ehdr->e_shnum > 0) { in elf_is_ehdr_sane()
107 if (ehdr->e_shoff + shdr_size < ehdr->e_shoff) { in elf_is_ehdr_sane()
128 memset(ehdr, 0, sizeof(*ehdr)); in elf_read_ehdr()
129 memcpy(ehdr->e_ident, buf, sizeof(ehdr->e_ident)); in elf_read_ehdr()
162 ehdr->e_entry = elf64_to_cpu(ehdr, buf_ehdr->e_entry); in elf_read_ehdr()
208 const struct elfhdr *ehdr = elf_info->ehdr; in elf_read_phdr() local
255 const struct elfhdr *ehdr = elf_info->ehdr; in elf_read_phdrs() local
307 elf_info->ehdr = ehdr; in elf_read_from_buffer()
[all …]
H A Dcrash_core.c164 Elf64_Ehdr *ehdr; in crash_prepare_elf64_headers() local
192 ehdr = (Elf64_Ehdr *)buf; in crash_prepare_elf64_headers()
193 phdr = (Elf64_Phdr *)(ehdr + 1); in crash_prepare_elf64_headers()
200 ehdr->e_type = ET_CORE; in crash_prepare_elf64_headers()
201 ehdr->e_machine = ELF_ARCH; in crash_prepare_elf64_headers()
202 ehdr->e_version = EV_CURRENT; in crash_prepare_elf64_headers()
203 ehdr->e_phoff = sizeof(Elf64_Ehdr); in crash_prepare_elf64_headers()
213 (ehdr->e_phnum)++; in crash_prepare_elf64_headers()
221 (ehdr->e_phnum)++; in crash_prepare_elf64_headers()
231 ehdr->e_phnum++; in crash_prepare_elf64_headers()
[all …]
H A Dkexec_file.c855 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf()
859 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_kbuf()
924 memcpy(sechdrs, (void *)pi->ehdr + pi->ehdr->e_shoff, sechdrs_size); in kexec_purgatory_setup_sechdrs()
929 kbuf->image->start = pi->ehdr->e_entry; in kexec_purgatory_setup_sechdrs()
931 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_sechdrs()
985 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_apply_relocations()
1093 const Elf_Ehdr *ehdr; in kexec_purgatory_find_symbol() local
1098 if (!pi->ehdr) in kexec_purgatory_find_symbol()
1101 ehdr = pi->ehdr; in kexec_purgatory_find_symbol()
1102 sechdrs = (void *)ehdr + ehdr->e_shoff; in kexec_purgatory_find_symbol()
[all …]
/linux-6.15/arch/s390/kernel/
H A Dkexec_elf.c20 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()
73 const Elf_Ehdr *ehdr; in s390_elf_load() local
86 if (!ehdr->e_phnum || ehdr->e_phentsize != sizeof(Elf_Phdr)) in s390_elf_load()
89 size = ehdr->e_ehsize + ehdr->e_phoff; in s390_elf_load()
90 size += ehdr->e_phentsize * ehdr->e_phnum; in s390_elf_load()
94 phdr = (void *)ehdr + ehdr->e_phoff; in s390_elf_load()
114 const Elf_Ehdr *ehdr; in s390_elf_probe() local
[all …]
/linux-6.15/arch/s390/tools/
H A Drelocs.c120 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr()
132 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr()
133 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr()
134 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr()
135 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr()
136 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr()
137 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr()
138 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr()
139 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr()
141 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr()
[all …]
/linux-6.15/arch/mips/boot/tools/
H A Drelocs.c207 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr()
224 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr()
225 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr()
227 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr()
228 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr()
229 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr()
230 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr()
231 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr()
233 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr()
235 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum); in read_ehdr()
[all …]
/linux-6.15/tools/perf/util/
H A Dsymbol-minimal.c119 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()
171 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id()
175 ehdr.e_phoff = bswap_64(ehdr.e_phoff); in filename__read_build_id()
176 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); in filename__read_build_id()
177 ehdr.e_phnum = bswap_16(ehdr.e_phnum); in filename__read_build_id()
180 buf_size = ehdr.e_phentsize * ehdr.e_phnum; in filename__read_build_id()
[all …]
H A Dsymbol-elf.c72 GElf_Ehdr *ehdr; in elf_getphdrnum() local
75 if (!ehdr) in elf_getphdrnum()
231 GElf_Ehdr ehdr; in filename__has_section() local
685 GElf_Ehdr ehdr; in dso__synthesize_plt_symbols() local
693 ehdr = ss->ehdr; in dso__synthesize_plt_symbols()
1201 return ehdr.e_type == ET_EXEC || ehdr.e_type == ET_REL || in elf__needs_adjust_symbols()
1385 ss->ehdr = ehdr; in symsrc__init()
1629 ehdr = syms_ss->ehdr; in dso__load_sym_internal()
2086 ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr); in kcore__open()
2087 if (!ehdr) in kcore__open()
[all …]
/linux-6.15/scripts/
H A Drecordmcount.h216 return w2(ehdr->e_shnum); in get_shnum()
222 ehdr->e_shnum = 0; in set_shnum()
345 if (uwrite(ehdr, sizeof(*ehdr)) < 0) in append_func()
379 + (void *)ehdr); in get_sym_str_and_relp()
384 + (void *)ehdr); in get_sym_str_and_relp()
387 + (void *)ehdr); in get_sym_str_and_relp()
456 + (void *)ehdr); in nop_mcount()
526 + (void *)ehdr); in find_secsym_ndx()
610 + (void *)ehdr); in do_func()
614 + (void *)ehdr); in do_func()
[all …]
H A Dsorttable.c130 return e.ehdr_shoff(ehdr); in ehdr_shoff()
686 Elf_Ehdr *ehdr; member
702 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in fill_relocs()
705 shnum = ehdr_shnum(ehdr); in fill_relocs()
757 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in replace_relocs()
760 shnum = ehdr_shnum(ehdr); in replace_relocs()
822 Elf_Ehdr *ehdr = emloc->ehdr; in sort_mcount_loc() local
960 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in do_sort()
1055 mstruct.ehdr = ehdr; in do_sort()
1223 Elf_Ehdr *ehdr = addr; in do_file() local
[all …]
H A Drecordmcount.c514 Elf32_Ehdr *ehdr; in do_file() local
517 ehdr = mmap_file(fname); in do_file()
518 if (!ehdr) in do_file()
524 switch (ehdr->e_ident[EI_DATA]) { in do_file()
528 ehdr->e_ident[EI_DATA], fname); in do_file()
558 w2(ehdr->e_type) != ET_REL || in do_file()
565 switch (w2(ehdr->e_machine)) { in do_file()
568 w2(ehdr->e_machine), fname); in do_file()
610 switch (ehdr->e_ident[EI_CLASS]) { in do_file()
613 ehdr->e_ident[EI_CLASS], fname); in do_file()
[all …]
/linux-6.15/drivers/remoteproc/
H A Dremoteproc_coredump.c239 void *ehdr; in rproc_coredump() local
275 ehdr = data; in rproc_coredump()
277 memset(ehdr, 0, elf_size_of_hdr(class)); in rproc_coredump()
279 elf_hdr_init_ident(ehdr, class); in rproc_coredump()
288 elf_hdr_set_e_phnum(class, ehdr, phnum); in rproc_coredump()
349 void *ehdr; in rproc_coredump_using_sections() local
395 ehdr = data; in rproc_coredump_using_sections()
396 memset(ehdr, 0, elf_size_of_hdr(class)); in rproc_coredump_using_sections()
398 elf_hdr_init_ident(ehdr, class); in rproc_coredump_using_sections()
407 elf_hdr_set_e_shnum(class, ehdr, shnum); in rproc_coredump_using_sections()
[all …]
H A Dremoteproc_elf_loader.c46 struct elf32_hdr *ehdr; local
62 ehdr = (struct elf32_hdr *)fw->data;
64 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
69 class = ehdr->e_ident[EI_CLASS];
82 if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
84 if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) {
163 const void *ehdr, *phdr; local
170 ehdr = elf_data;
171 phnum = elf_hdr_get_e_phnum(class, ehdr);
257 const void *ehdr = elf_data; local
[all …]
/linux-6.15/drivers/s390/crypto/
H A Dzcrypt_error.h81 struct error_hdr *ehdr = reply->msg; in convert_error() local
85 switch (ehdr->reply_code) { in convert_error()
101 if (ehdr->reply_code == REP82_ERROR_FILTERED_BY_HYPERVISOR && in convert_error()
102 ehdr->type == TYPE86_RSP_CODE) { in convert_error()
111 ehdr->reply_code, apfs); in convert_error()
115 ehdr->reply_code); in convert_error()
126 if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL && in convert_error()
127 ehdr->type == TYPE86_RSP_CODE) { in convert_error()
136 __func__, card, queue, ehdr->reply_code, apfs); in convert_error()
140 ehdr->reply_code); in convert_error()
[all …]
/linux-6.15/drivers/soc/qcom/
H A Dmdt_loader.c80 const struct elf32_hdr *ehdr; in qcom_mdt_get_size() local
85 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_get_size()
88 for (i = 0; i < ehdr->e_phnum; i++) { in qcom_mdt_get_size()
128 const struct elf32_hdr *ehdr; in qcom_mdt_read_metadata() local
137 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_read_metadata()
140 if (ehdr->e_phnum < 2) in qcom_mdt_read_metadata()
146 for (i = 1; i < ehdr->e_phnum; i++) { in qcom_mdt_read_metadata()
208 const struct elf32_hdr *ehdr; in qcom_mdt_pas_init() local
217 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_pas_init()
268 const struct elf32_hdr *ehdr; in qcom_mdt_bins_are_split() local
[all …]
/linux-6.15/arch/x86/tools/
H A Drelocs.c348 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr()
360 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr()
361 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr()
362 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr()
363 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr()
364 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr()
365 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr()
366 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr()
367 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr()
369 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr()
[all …]
/linux-6.15/arch/arm64/kernel/pi/
H A Drelacheck.c24 static Elf64_Ehdr *ehdr; variable
66 ehdr = mmap(0, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in main()
67 if (ehdr == MAP_FAILED) { in main()
72 swap = ehdr->e_ident[EI_DATA] != HOST_ORDER; in main()
73 shdr = (void *)ehdr + swab_elfxword(ehdr->e_shoff); in main()
74 strtab = (void *)ehdr + in main()
75 swab_elfxword(shdr[swab_elfhword(ehdr->e_shstrndx)].sh_offset); in main()
77 for (int i = 0; i < swab_elfhword(ehdr->e_shnum); i++) { in main()
105 rela = (void *)ehdr + swab_elfxword(shdr[i].sh_offset); in main()
/linux-6.15/arch/mips/vdso/
H A Dgenvdso.h9 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()
/linux-6.15/lib/
H A Dbuildid.c216 const Elf32_Ehdr *ehdr; in get_build_id_32() local
221 if (!ehdr) in get_build_id_32()
225 phnum = READ_ONCE(ehdr->e_phnum); in get_build_id_32()
226 phoff = READ_ONCE(ehdr->e_phoff); in get_build_id_32()
252 const Elf64_Ehdr *ehdr; in get_build_id_64() local
258 if (!ehdr) in get_build_id_64()
262 phnum = READ_ONCE(ehdr->e_phnum); in get_build_id_64()
263 phoff = READ_ONCE(ehdr->e_phoff); in get_build_id_64()
293 const Elf32_Ehdr *ehdr; in __build_id_parse() local
306 if (!ehdr) { in __build_id_parse()
[all …]
/linux-6.15/arch/arm64/kvm/hyp/nvhe/
H A Dgen-hyprel.c137 Elf64_Ehdr *ehdr; member
279 assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu"); in init_elf()
280 elf.ehdr = elf_ptr(Elf64_Ehdr, 0); in init_elf()
283 assert_eq(elf.ehdr->e_ident[EI_MAG0], ELFMAG0, "0x%x"); in init_elf()
284 assert_eq(elf.ehdr->e_ident[EI_MAG1], ELFMAG1, "0x%x"); in init_elf()
285 assert_eq(elf.ehdr->e_ident[EI_MAG2], ELFMAG2, "0x%x"); in init_elf()
286 assert_eq(elf.ehdr->e_ident[EI_MAG3], ELFMAG3, "0x%x"); in init_elf()
289 assert_eq(elf.ehdr->e_ident[EI_CLASS], ELFCLASS64, "%u"); in init_elf()
290 assert_eq(elf.ehdr->e_ident[EI_DATA], ELFENDIAN, "%u"); in init_elf()
291 assert_eq(elf16toh(elf.ehdr->e_type), ET_REL, "%u"); in init_elf()
[all …]
/linux-6.15/arch/parisc/boot/compressed/
H A Dmisc.c236 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-6.15/arch/arm/kernel/
H A Dvdso.c91 static void * __init find_section(Elf32_Ehdr *ehdr, const char *name, in find_section() argument
99 sechdrs = (void *)ehdr + ehdr->e_shoff; in find_section()
100 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; in find_section()
103 for (i = 1; i < ehdr->e_shnum; i++) { in find_section()
107 return (void *)ehdr + sechdrs[i].sh_offset; in find_section()
147 static void __init patch_vdso(void *ehdr) in patch_vdso() argument
152 .hdr = ehdr, in patch_vdso()
/linux-6.15/tools/testing/selftests/powerpc/ptrace/
H A Dcore-pkey.c173 void *p = ehdr, *note; in check_core_file()
176 ret = memcmp(ehdr->e_ident, ELFMAG, SELFMAG); in check_core_file()
179 FAIL_IF(ehdr->e_type != ET_CORE); in check_core_file()
180 FAIL_IF(ehdr->e_machine != EM_PPC64); in check_core_file()
181 FAIL_IF(ehdr->e_phoff == 0 || ehdr->e_phnum == 0); in check_core_file()
187 phdr_size = sizeof(*phdr) * ehdr->e_phnum; in check_core_file()
190 FAIL_IF(ehdr->e_phoff + phdr_size < ehdr->e_phoff); in check_core_file()
191 FAIL_IF(ehdr->e_phoff + phdr_size > core_size); in check_core_file()
194 for (phdr = p + ehdr->e_phoff; in check_core_file()
195 (void *) phdr < p + ehdr->e_phoff + phdr_size; in check_core_file()
[all …]
/linux-6.15/arch/x86/boot/compressed/
H A Dmisc.c285 Elf64_Ehdr ehdr; in parse_elf() local
288 Elf32_Ehdr ehdr; in parse_elf()
294 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf()
295 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf()
296 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf()
297 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf()
298 ehdr.e_ident[EI_MAG3] != ELFMAG3) in parse_elf()
303 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf()
307 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf()
309 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
[all …]
/linux-6.15/arch/riscv/kernel/
H A Delf_kexec.c49 for (i = 0; i < ehdr->e_phnum; i++) { in riscv_kexec_elf_load()
77 struct elfhdr *ehdr, struct kexec_elf_info *elf_info, in elf_find_pbase() argument
87 for (i = 0; i < ehdr->e_phnum; i++) { in elf_find_pbase()
116 image->start = ehdr->e_entry - lowest_vaddr + kbuf.mem; in elf_find_pbase()
207 struct elfhdr ehdr; in elf_kexec_load() local
223 ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, in elf_kexec_load()
383 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in arch_kexec_apply_relocations_add()
385 shstrtab = (char *)pi->ehdr + sechdrs[pi->ehdr->e_shstrndx].sh_offset; in arch_kexec_apply_relocations_add()
387 relas = (void *)pi->ehdr + relsec->sh_offset; in arch_kexec_apply_relocations_add()
396 sym = (void *)pi->ehdr + symtab->sh_offset; in arch_kexec_apply_relocations_add()
[all …]

12345