Home | History | Annotate | Download | only in src

Lines Matching refs:Elf

1 /* Print information from ELF file in human-readable form.
96 static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
99 /* Handle ELF file. */
100 static int handle_elf (Elf *elf, const char *prefix, const char *fname,
261 /* Now get the ELF descriptor. */
262 Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
263 if (elf != NULL)
265 if (elf_kind (elf) == ELF_K_ELF)
267 int result = handle_elf (elf, more_than_one ? "" : NULL,
270 if (elf_end (elf) != 0)
278 else if (elf_kind (elf) == ELF_K_AR)
280 int result = handle_ar (fd, elf, NULL, fname, NULL);
282 if (elf_end (elf) != 0)
292 if (elf_end (elf) != 0)
303 handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
311 Elf *subelf;
327 while ((subelf = elf_begin (fd, cmd, elf)) != NULL)
365 int elfclass = gelf_getclass (ebl->elf);
399 elf_strptr (ebl->elf, symstrndx, sym->st_name));
404 destshdr = gelf_getshdr (elf_getscn (ebl->elf,
426 elf_strptr (ebl->elf, shstrndx, destshdr->sh_name));
438 int elfclass = gelf_getclass (ebl->elf);
472 elf_strptr (ebl->elf, symstrndx, sym->st_name));
477 destshdr = gelf_getshdr (elf_getscn (ebl->elf,
499 elf_strptr (ebl->elf, shstrndx, destshdr->sh_name));
511 section_match (Elf *elf, uint32_t scnndx, GElf_Shdr *shdr, size_t shstrndx)
523 elf_strptr (elf, shstrndx, shdr->sh_name)) == 0)
543 int elfclass = gelf_getclass (ebl->elf);
546 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
556 if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx))
560 GElf_Shdr *destshdr = gelf_getshdr (elf_getscn (ebl->elf,
566 elf_strptr (ebl->elf, shstrndx, destshdr->sh_name),
575 Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link);
583 while ((xndxscn = elf_nextscn (ebl->elf, xndxscn)) != NULL)
617 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
627 if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx))
631 elf_strptr (ebl->elf, shstrndx, shdr->sh_name));
728 DisasmCtx_t *ctx = disasm_begin (ebl, ebl->elf, NULL /* XXX TODO */);
733 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
744 if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx))
752 elf_strptr (ebl->elf, shstrndx, shdr->sh_name));
771 handle_elf (Elf *elf, const char *prefix, const char *fname,
776 Ebl *ebl = ebl_openbackend (elf);
778 printf ("%s: elf%d-%s\n\n",
779 fname, gelf_getclass (elf) == ELFCLASS32 ? 32 : 64,
796 if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
808 /* Close the ELF backend library descriptor. */