Home
last modified time | relevance | path

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

1234

/linux/arch/s390/tools/
H A Drelocs.c41 static Elf_Ehdr ehdr; variable
82 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in elf16_to_cpu()
90 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in elf32_to_cpu()
120 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr()
122 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) in read_ehdr()
124 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) in read_ehdr()
126 if (ehdr.e_ident[EI_DATA] != ELF_ENDIAN) in read_ehdr()
128 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) 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()
[all …]
/linux/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()
35 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { in kexec_file_add_kernel_elf()
73 const Elf_Ehdr *ehdr; in s390_elf_load() local
79 ehdr = (Elf_Ehdr *)kernel; in s390_elf_load()
81 if (ehdr->e_type != ET_EXEC || in s390_elf_load()
82 ehdr->e_ident[EI_CLASS] != ELFCLASS64 || in s390_elf_load()
83 !elf_check_arch(ehdr)) in s390_elf_load()
[all …]
/linux/arch/mips/boot/tools/
H A Drelocs.c14 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/drivers/soc/qcom/
H A Dmdt_loader.c23 const struct elf32_hdr *ehdr; in mdt_header_valid() local
27 if (fw->size < sizeof(*ehdr)) in mdt_header_valid()
30 ehdr = (struct elf32_hdr *)fw->data; in mdt_header_valid()
32 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) in mdt_header_valid()
35 if (ehdr->e_phentsize != sizeof(struct elf32_phdr)) in mdt_header_valid()
38 phend = size_add(size_mul(sizeof(struct elf32_phdr), ehdr->e_phnum), ehdr->e_phoff); in mdt_header_valid()
42 if (ehdr->e_shentsize || ehdr->e_shnum) { in mdt_header_valid()
43 if (ehdr->e_shentsize != sizeof(struct elf32_shdr)) in mdt_header_valid()
46 shend = size_add(size_mul(sizeof(struct elf32_shdr), ehdr->e_shnum), ehdr->e_shoff); in mdt_header_valid()
113 const struct elf32_hdr *ehdr; in qcom_mdt_get_size() local
[all …]
/linux/scripts/
H A Drecordmcount.h211 static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) in get_shnum() argument
213 if (shdr0 && !ehdr->e_shnum) in get_shnum()
216 return w2(ehdr->e_shnum); in get_shnum()
219 static void set_shnum(Elf_Ehdr *ehdr, Elf_Shdr *shdr0, unsigned int new_shnum) in set_shnum() argument
222 ehdr->e_shnum = 0; in set_shnum()
225 ehdr->e_shnum = w2(new_shnum); in set_shnum()
228 static int get_shstrndx(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) in get_shstrndx() argument
230 if (ehdr->e_shstrndx != SHN_XINDEX) in get_shstrndx()
231 return w2(ehdr->e_shstrndx); in get_shstrndx()
236 static void find_symtab(Elf_Ehdr *const ehdr, Elf_Shdr const *shdr0, in find_symtab() argument
[all …]
H A Dtracepoint-update.c34 Elf_Ehdr *ehdr; member
72 #define for_each_shdr_str(len, ehdr, sec) \ argument
73 for (const char *str = (void *)(ehdr) + shdr_offset(sec), \
81 Elf_Ehdr *ehdr = etrace->ehdr; in make_trace_array() local
93 for_each_shdr_str(len, ehdr, check_data_sec) { in make_trace_array()
117 Elf_Ehdr *ehdr = etrace->ehdr; in check_tracepoints() local
128 for_each_shdr_str(len, ehdr, tracepoint_data_sec) { in check_tracepoints()
154 Elf_Ehdr *ehdr = addr; in process_tracepoints() local
164 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in process_tracepoints()
165 shentsize = ehdr_shentsize(ehdr); in process_tracepoints()
[all …]
H A Delf-parse.c57 Elf_Ehdr *ehdr = addr; in elf_parse() local
60 switch (ehdr->e32.e_ident[EI_DATA]) { in elf_parse()
77 ehdr->e32.e_ident[EI_DATA], fname); in elf_parse()
81 if (memcmp(ELFMAG, ehdr->e32.e_ident, SELFMAG) != 0 || in elf_parse()
82 ehdr->e32.e_ident[EI_VERSION] != EV_CURRENT) { in elf_parse()
87 type = elf_parser.r2(&ehdr->e32.e_type); in elf_parse()
93 switch (ehdr->e32.e_ident[EI_CLASS]) { in elf_parse()
115 if (elf_parser.r2(&ehdr->e32.e_ehsize) != sizeof(Elf32_Ehdr) || in elf_parse()
116 elf_parser.r2(&ehdr->e32.e_shentsize) != sizeof(Elf32_Shdr)) { in elf_parse()
145 if (elf_parser.r2(&ehdr->e64.e_ehsize) != sizeof(Elf64_Ehdr) || in elf_parse()
[all …]
H A Dsorttable.c353 Elf_Ehdr *ehdr; member
360 static int fill_relocs(void *ptr, uint64_t size, Elf_Ehdr *ehdr, uint64_t start_loc) in fill_relocs() argument
369 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in fill_relocs()
370 shentsize = ehdr_shentsize(ehdr); in fill_relocs()
372 shnum = ehdr_shnum(ehdr); in fill_relocs()
383 rel = (void *)ehdr + shdr_offset(shdr); in fill_relocs()
417 static void replace_relocs(void *ptr, uint64_t size, Elf_Ehdr *ehdr, uint64_t start_loc) in replace_relocs() argument
424 shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); in replace_relocs()
425 shentsize = ehdr_shentsize(ehdr); in replace_relocs()
427 shnum = ehdr_shnum(ehdr); in replace_relocs()
[all …]
H A Delf-parse.h32 uint64_t (*ehdr_shoff)(Elf_Ehdr *ehdr);
33 uint16_t (*ehdr_shstrndx)(Elf_Ehdr *ehdr);
34 uint16_t (*ehdr_shentsize)(Elf_Ehdr *ehdr);
35 uint16_t (*ehdr_shnum)(Elf_Ehdr *ehdr);
60 static inline uint64_t ehdr64_shoff(Elf_Ehdr *ehdr) in ehdr64_shoff() argument
62 return elf_parser.r8(&ehdr->e64.e_shoff); in ehdr64_shoff()
65 static inline uint64_t ehdr32_shoff(Elf_Ehdr *ehdr) in ehdr32_shoff() argument
67 return elf_parser.r(&ehdr->e32.e_shoff); in ehdr32_shoff()
70 static inline uint64_t ehdr_shoff(Elf_Ehdr *ehdr) in ehdr_shoff() argument
72 return elf_parser.ehdr_shoff(ehdr); in ehdr_shoff()
[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()
557 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 || in do_file()
558 w2(ehdr->e_type) != ET_REL || in do_file()
559 ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file()
565 switch (w2(ehdr->e_machine)) { in do_file()
568 w2(ehdr->e_machine), fname); in do_file()
[all …]
/linux/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()
281 elf_hdr_set_e_type(class, ehdr, ET_CORE); in rproc_coredump()
282 elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); in rproc_coredump()
283 elf_hdr_set_e_version(class, ehdr, EV_CURRENT); in rproc_coredump()
284 elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); in rproc_coredump()
285 elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); in rproc_coredump()
286 elf_hdr_set_e_ehsize(class, ehdr, elf_size_of_hdr(class)); in rproc_coredump()
[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);
172 phdr = elf_data + elf_hdr_get_e_phoff(class, ehdr);
[all …]
/linux/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/arch/x86/tools/
H A Drelocs.c14 static Elf_Ehdr ehdr; variable
348 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr()
350 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) in read_ehdr()
352 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) in read_ehdr()
354 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) in read_ehdr()
356 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) 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()
[all …]
/linux/tools/perf/util/
H A Dsymbol-elf.c57 GElf_Ehdr *ehdr; in elf_getphdrnum() local
59 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum()
60 if (!ehdr) in elf_getphdrnum()
63 *dst = ehdr->e_phnum; in elf_getphdrnum()
216 GElf_Ehdr ehdr; in filename__has_section() local
228 if (gelf_getehdr(elf, &ehdr) == NULL) in filename__has_section()
231 found = !!elf_section_by_name(elf, &ehdr, &shdr, sec, NULL); in filename__has_section()
329 static bool addend_may_be_ifunc(GElf_Ehdr *ehdr, struct rel_info *ri) in addend_may_be_ifunc() argument
331 return ehdr->e_machine == EM_X86_64 && ri->is_rela && in addend_may_be_ifunc()
335 static bool get_ifunc_name(Elf *elf, struct dso *dso, GElf_Ehdr *ehdr, in get_ifunc_name() argument
[all …]
/linux/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/lib/
H A Dbuildid.c200 const Elf32_Ehdr *ehdr; in parse_build_id()
204 ehdr = freader_fetch(r, 0, sizeof(Elf32_Ehdr)); in parse_build_id()
205 if (!ehdr) in parse_build_id()
209 phnum = READ_ONCE(ehdr->e_phnum); in parse_build_id()
210 phoff = READ_ONCE(ehdr->e_phoff); in parse_build_id()
236 const Elf64_Ehdr *ehdr; in get_build_id_32()
241 ehdr = freader_fetch(r, 0, sizeof(Elf64_Ehdr)); in get_build_id_32()
242 if (!ehdr) in get_build_id_32()
246 phnum = READ_ONCE(ehdr->e_phnum); in get_build_id_32()
247 phoff = READ_ONCE(ehdr in get_build_id_32()
216 const Elf32_Ehdr *ehdr; get_build_id_32() local
252 const Elf64_Ehdr *ehdr; get_build_id_64() local
293 const Elf32_Ehdr *ehdr; __build_id_parse() local
[all...]
/linux/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/kernel/
H A Dcrash_core.c170 Elf64_Ehdr *ehdr; in crash_prepare_elf64_headers() local
198 ehdr = (Elf64_Ehdr *)buf; in crash_prepare_elf64_headers()
199 phdr = (Elf64_Phdr *)(ehdr + 1); in crash_prepare_elf64_headers()
200 memcpy(ehdr->e_ident, ELFMAG, SELFMAG); in crash_prepare_elf64_headers()
201 ehdr->e_ident[EI_CLASS] = ELFCLASS64; in crash_prepare_elf64_headers()
202 ehdr->e_ident[EI_DATA] = ELFDATA2LSB; in crash_prepare_elf64_headers()
203 ehdr->e_ident[EI_VERSION] = EV_CURRENT; in crash_prepare_elf64_headers()
204 ehdr->e_ident[EI_OSABI] = ELF_OSABI; in crash_prepare_elf64_headers()
205 memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); in crash_prepare_elf64_headers()
206 ehdr->e_type = ET_CORE; in crash_prepare_elf64_headers()
[all …]
H A Dkexec_file.c904 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf()
908 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_kbuf()
969 sechdrs_size = array_size(sizeof(Elf_Shdr), pi->ehdr->e_shnum); in kexec_purgatory_setup_sechdrs()
973 memcpy(sechdrs, (void *)pi->ehdr + pi->ehdr->e_shoff, sechdrs_size); in kexec_purgatory_setup_sechdrs()
978 kbuf->image->start = pi->ehdr->e_entry; in kexec_purgatory_setup_sechdrs()
980 for (i = 0; i < pi->ehdr->e_shnum; i++) { in kexec_purgatory_setup_sechdrs()
1008 pi->ehdr->e_entry >= sechdrs[i].sh_addr && in kexec_purgatory_setup_sechdrs()
1009 pi->ehdr->e_entry < (sechdrs[i].sh_addr in kexec_purgatory_setup_sechdrs()
1011 !WARN_ON(kbuf->image->start != pi->ehdr->e_entry)) { in kexec_purgatory_setup_sechdrs()
1016 src = (void *)pi->ehdr + sechdrs[i].sh_offset; in kexec_purgatory_setup_sechdrs()
[all …]
/linux/arch/arm64/kvm/hyp/nvhe/
H A Dgen-hyprel.c137 Elf64_Ehdr *ehdr; member
205 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var)
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()
[all …]
/linux/arch/riscv/kernel/
H A Dkexec_elf.c24 static int riscv_kexec_elf_load(struct kimage *image, struct elfhdr *ehdr, in riscv_kexec_elf_load() argument
36 for (i = 0; i < ehdr->e_phnum; i++) { in riscv_kexec_elf_load()
64 struct elfhdr *ehdr, struct kexec_elf_info *elf_info, in elf_find_pbase() argument
74 for (i = 0; i < ehdr->e_phnum; i++) { in elf_find_pbase()
104 image->start = ehdr->e_entry - lowest_vaddr + kbuf.mem; in elf_find_pbase()
117 struct elfhdr ehdr; in elf_kexec_load() local
120 ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); in elf_kexec_load()
124 ret = elf_find_pbase(image, kernel_len, &ehdr, &elf_info, in elf_kexec_load()
130 ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, in elf_kexec_load()
/linux/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/arch/arm/kernel/
H A Dvdso.c89 static void * __init find_section(Elf32_Ehdr *ehdr, const char *name, in find_section() argument
97 sechdrs = (void *)ehdr + ehdr->e_shoff; in find_section()
98 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; in find_section()
101 for (i = 1; i < ehdr->e_shnum; i++) { in find_section()
105 return (void *)ehdr + sechdrs[i].sh_offset; in find_section()
145 static void __init patch_vdso(void *ehdr) in patch_vdso() argument
150 .hdr = ehdr, in patch_vdso()
/linux/arch/x86/boot/compressed/
H A Dmisc.c284 Elf64_Ehdr ehdr; in parse_elf() local
287 Elf32_Ehdr ehdr; in parse_elf()
293 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf()
294 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf()
295 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf()
296 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf()
297 ehdr.e_ident[EI_MAG3] != ELFMAG3) in parse_elf()
302 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf()
306 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf()
308 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
[all …]

1234