Home | History | Annotate | Download | only in src

Lines Matching refs:Elf

51 #include <elf-knowledge.h>
88 N_("Relax a few rules to handle slightly broken ELF files"), 0 },
111 /* Handle one ELF file. */
112 static int handle_elf (int fd, Elf *elf, const char *prefix,
116 static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
142 /* If true relax some ELF rules for input files. */
333 /* Now get the ELF descriptor. */
334 Elf *elf = elf_begin (fd, output_fname == NULL ? ELF_C_RDWR : ELF_C_READ,
337 switch (elf_kind (elf))
340 result = handle_elf (fd, elf, NULL, fname, st.st_mode & ACCESSPERMS,
354 result = handle_ar (fd, elf, NULL, fname, preserve_dates ? tv : NULL);
363 if (unlikely (elf_end (elf) != 0))
376 handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
383 Elf *debugelf = NULL;
444 ebl = ebl_openbackend (elf);
475 GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
480 if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0))
484 /* We now create a new ELF descriptor for the same file. We
487 Elf *newelf;
491 newelf = elf_clone (elf, ELF_C_EMPTY);
493 if (unlikely (gelf_newehdr (newelf, gelf_getclass (elf)) == 0)
507 GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &phdr_mem);
515 /* Also create an ELF descriptor for the debug file */
517 if (unlikely (gelf_newehdr (debugelf, gelf_getclass (elf)) == 0)
531 GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &phdr_mem);
540 if (unlikely (elf_getshnum (elf, &shnum) < 0))
549 table. Maybe some weird tool created an ELF file without one.
564 while ((scn = elf_nextscn (elf, scn)) != NULL)
577 shdr_info[cnt].name = elf_strptr (elf, shstrndx,
757 size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1,
793 - for the cases the ELF specification says. That are
911 /* Finish the ELF header. Fill in the fields not handled by
927 error (0, 0, gettext ("%s: error while creating ELF header: %s"),
983 /* We set the offset to zero here. Before we write the ELF file the
1038 /* We set the offset to zero here. Before we write the ELF file the
1129 size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1,
1415 size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1,
1442 const char *name = elf_strptr (elf, strshndx,
1469 size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1,
1496 const char *name = elf_strptr (elf, strshndx,
1539 size_t elsize = gelf_fsize (elf, verd->d_type, 1,
1551 / gelf_fsize (elf, symd->d_type, 1,
1627 /* Finally finish the ELF header. Fill in the fields not handled by
1641 const size_t offsize = gelf_fsize (elf, ELF_T_OFF, 1, EV_CURRENT);
1645 newehdr->e_shentsize = gelf_fsize (elf, ELF_T_SHDR, 1, EV_CURRENT);
1652 /* The index does not fit in the ELF header field. */
1653 shdr_info[0].scn = elf_getscn (elf, 0);
1666 error (0, 0, gettext ("%s: error while creating ELF header: %s"),
1672 if (elf_cntl (elf, ELF_C_FDDONE) != 0)
1679 /* The ELF library better follows our layout when this is not a
1766 handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
1784 Elf *subelf;
1787 while ((subelf = elf_begin (fd, cmd, elf)) != NULL)