/linux-master/kernel/ |
H A D | kexec_elf.c | 24 static inline bool elf_is_elf_file(const struct elfhdr *ehdr) argument 26 return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0; 29 static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value) argument 31 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) 33 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) 39 static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value) argument 41 if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) 43 else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) 49 static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value) argument 51 if (ehdr 63 elf_is_ehdr_sane(const struct elfhdr *ehdr, size_t buf_len) argument 119 elf_read_ehdr(const char *buf, size_t len, struct elfhdr *ehdr) argument 208 const struct elfhdr *ehdr = elf_info->ehdr; local 255 const struct elfhdr *ehdr = elf_info->ehdr; local 296 elf_read_from_buffer(const char *buf, size_t len, struct elfhdr *ehdr, struct kexec_elf_info *elf_info) argument 327 kexec_build_elf_info(const char *buf, size_t len, struct elfhdr *ehdr, struct kexec_elf_info *elf_info) argument 367 struct elfhdr ehdr; local 388 kexec_elf_load(struct kimage *image, struct elfhdr *ehdr, struct kexec_elf_info *elf_info, struct kexec_buf *kbuf, unsigned long *lowest_load_addr) argument [all...] |
H A D | crash_core.c | 162 Elf64_Ehdr *ehdr; local 190 ehdr = (Elf64_Ehdr *)buf; 191 phdr = (Elf64_Phdr *)(ehdr + 1); 192 memcpy(ehdr->e_ident, ELFMAG, SELFMAG); 193 ehdr->e_ident[EI_CLASS] = ELFCLASS64; 194 ehdr->e_ident[EI_DATA] = ELFDATA2LSB; 195 ehdr->e_ident[EI_VERSION] = EV_CURRENT; 196 ehdr->e_ident[EI_OSABI] = ELF_OSABI; 197 memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); 198 ehdr [all...] |
/linux-master/arch/s390/kernel/ |
H A D | kexec_elf.c | 20 const Elf_Ehdr *ehdr; local 27 ehdr = (Elf_Ehdr *)kernel; 32 entry = ehdr->e_entry; 34 phdr = (void *)ehdr + ehdr->e_phoff; 35 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { 73 const Elf_Ehdr *ehdr; local 79 ehdr = (Elf_Ehdr *)kernel; 81 if (ehdr->e_type != ET_EXEC || 82 ehdr 114 const Elf_Ehdr *ehdr; local [all...] |
/linux-master/arch/s390/tools/ |
H A D | relocs.c | 41 static Elf_Ehdr ehdr; variable 82 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 90 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 120 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) 122 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) 124 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) 126 if (ehdr.e_ident[EI_DATA] != ELF_ENDIAN) 128 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) 132 ehdr [all...] |
/linux-master/arch/mips/boot/tools/ |
H A D | relocs.c | 14 static Elf_Ehdr ehdr; variable 96 sec_strtab = secs[ehdr.e_shstrndx].strtab; 97 if (shndx < ehdr.e_shnum) 112 for (i = 0; i < ehdr.e_shnum; i++) 163 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 171 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 179 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 191 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 207 if (fread(&ehdr, sizeof(ehdr), [all...] |
/linux-master/drivers/s390/crypto/ |
H A D | zcrypt_error.h | 81 struct error_hdr *ehdr = reply->msg; local 85 switch (ehdr->reply_code) { 101 if (ehdr->reply_code == REP82_ERROR_FILTERED_BY_HYPERVISOR && 102 ehdr->type == TYPE86_RSP_CODE) { 111 ehdr->reply_code, apfs); 115 ehdr->reply_code); 126 if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL && 127 ehdr->type == TYPE86_RSP_CODE) { 136 __func__, card, queue, ehdr->reply_code, apfs); 140 ehdr [all...] |
/linux-master/tools/perf/util/ |
H A D | symbol-minimal.c | 116 Elf32_Ehdr ehdr; local 119 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) 123 ehdr.e_phoff = bswap_32(ehdr.e_phoff); 124 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); 125 ehdr.e_phnum = bswap_16(ehdr.e_phnum); 128 buf_size = ehdr 168 Elf64_Ehdr ehdr; local 322 Elf64_Ehdr ehdr; local [all...] |
H A D | symbol-elf.c | 71 GElf_Ehdr *ehdr; local 73 ehdr = gelf_getehdr(elf, &gehdr); 74 if (!ehdr) 77 *dst = ehdr->e_phnum; 230 GElf_Ehdr ehdr; local 242 if (gelf_getehdr(elf, &ehdr) == NULL) 245 found = !!elf_section_by_name(elf, &ehdr, &shdr, sec, NULL); 397 static bool addend_may_be_ifunc(GElf_Ehdr *ehdr, struct rel_info *ri) argument 399 return ehdr->e_machine == EM_X86_64 && ri->is_rela && 403 static bool get_ifunc_name(Elf *elf, struct dso *dso, GElf_Ehdr *ehdr, argument 434 get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, u64 *plt_header_size, u64 *plt_entry_size) argument 539 get_rela_dyn_info(Elf *elf, GElf_Ehdr *ehdr, struct rela_dyn_info *di, Elf_Scn *scn) argument 633 dso__synthesize_plt_got_symbols(struct dso *dso, Elf *elf, GElf_Ehdr *ehdr, char *buf, size_t buf_sz) argument 682 GElf_Ehdr ehdr; local 860 GElf_Ehdr ehdr; local 1125 GElf_Ehdr ehdr; local 1218 elf__needs_adjust_symbols(GElf_Ehdr ehdr) argument 1232 GElf_Ehdr ehdr; local 1344 max_text_section(Elf *elf, GElf_Ehdr *ehdr) argument 1558 GElf_Ehdr ehdr; local 1916 GElf_Ehdr ehdr; local 1991 GElf_Ehdr ehdr; member in struct:kcore 1996 GElf_Ehdr *ehdr; local 2062 GElf_Ehdr *ehdr = &to->ehdr; local 2732 GElf_Ehdr ehdr; local 2861 GElf_Ehdr ehdr; local [all...] |
/linux-master/arch/arm64/kernel/pi/ |
H A D | relacheck.c | 24 static Elf64_Ehdr *ehdr; variable 66 ehdr = mmap(0, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 67 if (ehdr == MAP_FAILED) { 72 swap = ehdr->e_ident[EI_DATA] != HOST_ORDER; 73 shdr = (void *)ehdr + swab_elfxword(ehdr->e_shoff); 74 strtab = (void *)ehdr + 75 swab_elfxword(shdr[swab_elfhword(ehdr->e_shstrndx)].sh_offset); 77 for (int i = 0; i < swab_elfhword(ehdr->e_shnum); i++) { 105 rela = (void *)ehdr [all...] |
/linux-master/lib/ |
H A D | buildid.c | 72 Elf32_Ehdr *ehdr = (Elf32_Ehdr *)page_addr; local 77 if (ehdr->e_phnum > 83 for (i = 0; i < ehdr->e_phnum; ++i) { 97 Elf64_Ehdr *ehdr = (Elf64_Ehdr *)page_addr; local 102 if (ehdr->e_phnum > 108 for (i = 0; i < ehdr->e_phnum; ++i) { 129 Elf32_Ehdr *ehdr; local 144 ehdr = (Elf32_Ehdr *)page_addr; 147 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) 151 if (ehdr [all...] |
/linux-master/scripts/ |
H A D | recordmcount.h | 211 static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) argument 213 if (shdr0 && !ehdr->e_shnum) 216 return w2(ehdr->e_shnum); 219 static void set_shnum(Elf_Ehdr *ehdr, Elf_Shdr *shdr0, unsigned int new_shnum) argument 222 ehdr->e_shnum = 0; 225 ehdr->e_shnum = w2(new_shnum); 228 static int get_shstrndx(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) argument 230 if (ehdr->e_shstrndx != SHN_XINDEX) 231 return w2(ehdr->e_shstrndx); 236 static void find_symtab(Elf_Ehdr *const ehdr, Elf_Shd argument 258 append_func(Elf_Ehdr *const ehdr, Elf_Shdr *const shstr, uint_t const *const mloc0, uint_t const *const mlocp, Elf_Rel const *const mrel0, Elf_Rel const *const mrelp, unsigned int const rel_entsize, unsigned int const symsec_sh_link) argument 372 get_sym_str_and_relp(Elf_Shdr const *const relhdr, Elf_Ehdr const *const ehdr, Elf_Sym const **sym0, char const **str0, Elf_Rel const **relp) argument 400 sift_rel_mcount(uint_t *mlocp, unsigned const offbase, Elf_Rel **const mrelpp, Elf_Shdr const *const relhdr, Elf_Ehdr const *const ehdr, unsigned const recsym, uint_t const recval, unsigned const reltype) argument 451 nop_mcount(Elf_Shdr const *const relhdr, Elf_Ehdr const *const ehdr, const char *const txtname) argument 516 find_secsym_ndx(unsigned const txtndx, char const *const txtname, uint_t *const recvalp, unsigned int *sym_index, Elf_Shdr const *const symhdr, Elf32_Word const *symtab, Elf32_Word const *symtab_shndx, Elf_Ehdr const *const ehdr) argument 606 do_func(Elf_Ehdr *const ehdr, char const *const fname, unsigned const reltype) argument [all...] |
H A D | sorttable.c | 271 Elf32_Ehdr *ehdr = addr; local 274 switch (ehdr->e_ident[EI_DATA]) { 293 ehdr->e_ident[EI_DATA], fname); 297 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 || 298 (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN) || 299 ehdr->e_ident[EI_VERSION] != EV_CURRENT) { 304 switch (r2(&ehdr->e_machine)) { 327 r2(&ehdr->e_machine), fname); 331 switch (ehdr [all...] |
H A D | sorttable.h | 205 Elf_Ehdr *ehdr; member in struct:elf_mcount_loc 218 unsigned char *start_loc = (void *)emloc->ehdr + offset; 261 static int do_sort(Elf_Ehdr *ehdr, argument 266 Elf_Shdr *s, *shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); 297 shstrndx = r2(&ehdr->e_shstrndx); 300 secstrings = (const char *)ehdr + _r(&shdr[shstrndx].sh_offset); 302 shnum = r2(&ehdr->e_shnum); 320 relocs = (void *)ehdr + _r(&s->sh_offset); 324 symtab_shndx = (Elf32_Word *)((const char *)ehdr [all...] |
/linux-master/drivers/remoteproc/ |
H A D | remoteproc_coredump.c | 239 void *ehdr; local 275 ehdr = data; 277 memset(ehdr, 0, elf_size_of_hdr(class)); 279 elf_hdr_init_ident(ehdr, class); 281 elf_hdr_set_e_type(class, ehdr, ET_CORE); 282 elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); 283 elf_hdr_set_e_version(class, ehdr, EV_CURRENT); 284 elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); 285 elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); 286 elf_hdr_set_e_ehsize(class, ehdr, elf_size_of_hd 349 void *ehdr; local [all...] |
H A D | remoteproc_elf_loader.c | 46 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); 257 const void *ehdr = elf_data; local [all...] |
H A D | remoteproc_elf_helpers.h | 25 struct elf32_hdr *ehdr = (struct elf32_hdr *)fw->data; local 27 return ehdr->e_ident[EI_CLASS]; 100 static inline unsigned int elf_strtbl_add(const char *name, void *ehdr, u8 class, size_t *index) argument 102 u16 shstrndx = elf_hdr_get_e_shstrndx(class, ehdr); 107 shdr = ehdr + elf_size_of_hdr(class) + shstrndx * elf_size_of_shdr(class); 108 strtab = ehdr + elf_shdr_get_sh_offset(class, shdr);
|
/linux-master/arch/mips/vdso/ |
H A D | genvdso.h | 9 const ELF(Ehdr) *ehdr = vdso; 15 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); 16 sh_count = swap_uint16(ehdr->e_shnum); 17 sh_entsize = swap_uint16(ehdr->e_shentsize); 19 shdr = shdrs + (sh_entsize * swap_uint16(ehdr->e_shstrndx)); 60 const ELF(Ehdr) *ehdr = vdso; 69 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); 70 sh_count = swap_uint16(ehdr->e_shnum); 71 sh_entsize = swap_uint16(ehdr->e_shentsize); 87 flags = swap_uint32(ehdr [all...] |
/linux-master/drivers/soc/qcom/ |
H A D | mdt_loader.c | 82 const struct elf32_hdr *ehdr; local 87 ehdr = (struct elf32_hdr *)fw->data; 88 phdrs = (struct elf32_phdr *)(ehdr + 1); 90 for (i = 0; i < ehdr->e_phnum; i++) { 130 const struct elf32_hdr *ehdr; local 139 ehdr = (struct elf32_hdr *)fw->data; 140 phdrs = (struct elf32_phdr *)(ehdr + 1); 142 if (ehdr->e_phnum < 2) 148 for (i = 1; i < ehdr->e_phnum; i++) { 210 const struct elf32_hdr *ehdr; local 270 const struct elf32_hdr *ehdr; local 302 const struct elf32_hdr *ehdr; local [all...] |
/linux-master/arch/parisc/boot/compressed/ |
H A D | misc.c | 236 Elf64_Ehdr ehdr; local 239 Elf32_Ehdr ehdr; 245 memcpy(&ehdr, output, sizeof(ehdr)); 246 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || 247 ehdr.e_ident[EI_MAG1] != ELFMAG1 || 248 ehdr.e_ident[EI_MAG2] != ELFMAG2 || 249 ehdr.e_ident[EI_MAG3] != ELFMAG3) { 258 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); 262 memcpy(phdrs, output + ehdr [all...] |
/linux-master/arch/x86/tools/ |
H A D | relocs.c | 14 static Elf_Ehdr ehdr; variable 368 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { 372 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { 375 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) { 378 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { 381 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { 385 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); 386 ehdr [all...] |
/linux-master/tools/testing/selftests/powerpc/ptrace/ |
H A D | core-pkey.c | 195 static int check_core_file(struct shared_info *info, Elf64_Ehdr *ehdr, argument 202 void *p = ehdr, *note; 205 ret = memcmp(ehdr->e_ident, ELFMAG, SELFMAG); 208 FAIL_IF(ehdr->e_type != ET_CORE); 209 FAIL_IF(ehdr->e_machine != EM_PPC64); 210 FAIL_IF(ehdr->e_phoff == 0 || ehdr->e_phnum == 0); 216 phdr_size = sizeof(*phdr) * ehdr->e_phnum; 219 FAIL_IF(ehdr->e_phoff + phdr_size < ehdr [all...] |
/linux-master/arch/arm64/kvm/hyp/nvhe/ |
H A D | gen-hyprel.c | 134 Elf64_Ehdr *ehdr; member in struct:__anon5 202 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var) 276 assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu"); 277 elf.ehdr = elf_ptr(Elf64_Ehdr, 0); 280 assert_eq(elf.ehdr->e_ident[EI_MAG0], ELFMAG0, "0x%x"); 281 assert_eq(elf.ehdr->e_ident[EI_MAG1], ELFMAG1, "0x%x"); 282 assert_eq(elf.ehdr->e_ident[EI_MAG2], ELFMAG2, "0x%x"); 283 assert_eq(elf.ehdr->e_ident[EI_MAG3], ELFMAG3, "0x%x"); 286 assert_eq(elf.ehdr->e_ident[EI_CLASS], ELFCLASS64, "%u"); 287 assert_eq(elf.ehdr [all...] |
/linux-master/arch/x86/boot/compressed/ |
H A D | misc.c | 297 Elf64_Ehdr ehdr; local 300 Elf32_Ehdr ehdr; 306 memcpy(&ehdr, output, sizeof(ehdr)); 307 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || 308 ehdr.e_ident[EI_MAG1] != ELFMAG1 || 309 ehdr.e_ident[EI_MAG2] != ELFMAG2 || 310 ehdr.e_ident[EI_MAG3] != ELFMAG3) 315 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); 319 memcpy(phdrs, output + ehdr [all...] |
/linux-master/arch/riscv/kernel/ |
H A D | elf_kexec.c | 36 static int riscv_kexec_elf_load(struct kimage *image, struct elfhdr *ehdr, argument 48 for (i = 0; i < ehdr->e_phnum; i++) { 76 struct elfhdr *ehdr, struct kexec_elf_info *elf_info, 86 for (i = 0; i < ehdr->e_phnum; i++) { 115 image->start = ehdr->e_entry - lowest_vaddr + kbuf.mem; 206 struct elfhdr ehdr; local 211 ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); 215 ret = elf_find_pbase(image, kernel_len, &ehdr, &elf_info, 222 ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, 382 sechdrs = (void *)pi->ehdr 75 elf_find_pbase(struct kimage *image, unsigned long kernel_len, struct elfhdr *ehdr, struct kexec_elf_info *elf_info, unsigned long *old_pbase, unsigned long *new_pbase) argument [all...] |
/linux-master/tools/objtool/include/objtool/ |
H A D | endianness.h | 18 (elf->ehdr.e_ident[EI_DATA] == ELFDATA2LSB);
|