Lines Matching defs:elf

156 _elf_upd_lib(Elf * elf)
158 NOTE(ASSUMING_PROTECTED(*elf))
163 Ehdr * eh = elf->ed_ehdr;
202 if ((s = elf->ed_hdscn) == 0) {
230 if ((sz = (Lword)_elf_entsz(elf, sh->sh_type, ver)) != 0)
318 sh = (Shdr *)elf->ed_hdscn->s_shdr;
341 _elf_upd_usr(Elf * elf)
343 NOTE(ASSUMING_PROTECTED(*elf))
347 Ehdr * eh = elf->ed_ehdr;
387 if ((s = elf->ed_hdscn) == 0) {
435 sh = (Shdr *)elf->ed_hdscn->s_shdr;
456 wrt(Elf * elf, Xword outsz, unsigned fill, int update_cmd)
458 NOTE(ASSUMING_PROTECTED(*elf))
464 Ehdr *eh = elf->ed_ehdr;
501 if ((elf->ed_myflags & EDF_READ) &&
502 (_elf_vm(elf, (size_t)0, elf->ed_fsz) != OK_YES))
505 flag = elf->ed_myflags & EDF_WRALLOC;
506 if ((image = _elf_outmap(elf->ed_fd, outsz, &flag)) == 0)
510 elf->ed_myflags |= EDF_IMALLOC;
515 * this code sets the dirty bit on the elf descriptor
542 elf->ed_ehflags &= ~ELF_F_DIRTY;
557 src.d_buf = (Elf_Void *)elf->ed_phdr;
559 src.d_size = elf->ed_phdrsz;
566 elf->ed_uflags |= ELF_F_DIRTY;
569 elf->ed_phflags &= ~ELF_F_DIRTY;
579 for (s = elf->ed_hdscn; s != 0; s = s->s_next) {
642 elf->ed_uflags |= ELF_F_DIRTY;
656 elf->ed_uflags |= ELF_F_DIRTY;
678 for (s = elf->ed_hdscn; s != 0; s = s->s_next) {
685 elf->ed_uflags |= ELF_F_DIRTY;
694 * by ld(1) to build up a full image of an elf file and then
700 elf->ed_uflags &= ~ELF_F_DIRTY;
701 elf->ed_wrimage = image;
702 elf->ed_wrimagesz = outsz;
706 if (_elf_outsync(elf->ed_fd, image, outsz,
707 ((elf->ed_myflags & EDF_IMALLOC) ? 0 : 1)) != 0) {
708 elf->ed_uflags &= ~ELF_F_DIRTY;
709 elf->ed_myflags &= ~EDF_IMALLOC;
713 elf->ed_uflags |= ELF_F_DIRTY;
724 * elf_update(elf, ELF_C_WRIMAGE)
725 * This will cause full image representing the elf file
726 * described by the elf pointer to be built in memory. If the
727 * elf pointer has a valid file descriptor associated with it
729 * storage. If the elf descriptor does not have a valid
743 _elfxx_update(Elf * elf, Elf_Cmd cmd)
747 Ehdr *eh = elf->ed_ehdr;
749 if (elf == 0)
752 ELFWLOCK(elf)
756 ELFUNLOCK(elf)
760 if ((elf->ed_myflags & EDF_WRITE) == 0) {
762 ELFUNLOCK(elf)
767 if ((elf->ed_myflags & EDF_WRITE) == 0) {
769 ELFUNLOCK(elf)
772 if (elf->ed_wrimage) {
773 if (elf->ed_myflags & EDF_WRALLOC) {
774 free(elf->ed_wrimage);
781 sz = elf->ed_wrimagesz;
782 elf->ed_wrimage = 0;
783 elf->ed_wrimagesz = 0;
784 ELFUNLOCK(elf);
787 sz = _elf_outsync(elf->ed_fd, elf->ed_wrimage,
788 elf->ed_wrimagesz,
789 (elf->ed_myflags & EDF_IMALLOC ? 0 : 1));
790 elf->ed_myflags &= ~EDF_IMALLOC;
791 elf->ed_wrimage = 0;
792 elf->ed_wrimagesz = 0;
793 ELFUNLOCK(elf);
803 ELFUNLOCK(elf)
809 ELFUNLOCK(elf)
822 ELFUNLOCK(elf)
830 if (elf->ed_uflags & ELF_F_LAYOUT) {
831 sz = _elf_upd_usr(elf);
834 sz = _elf_upd_lib(elf);
837 sz = wrt(elf, (Xword)sz, u, cmd);
840 ELFUNLOCK(elf)
844 ELFUNLOCK(elf)
858 _elfxx_swap_wrimage(Elf *elf)
871 ELFWLOCK(elf);
872 eh = elf->ed_ehdr;
882 ELFUNLOCK(elf);
897 src.d_buf = dst.d_buf = (Elf_Void *)elf->ed_phdr;
899 src.d_size = dst.d_size = elf->ed_phdrsz;
903 ELFUNLOCK(elf);
912 for (s = elf->ed_hdscn; s != 0; s = s->s_next) {
927 ELFUNLOCK(elf);
935 ELFUNLOCK(elf);
947 for (s = elf->ed_hdscn; s != 0; s = s->s_next) {
951 ELFUNLOCK(elf);
956 ELFUNLOCK(elf);
966 elf_update(Elf *elf, Elf_Cmd cmd)
968 if (elf == 0)
971 if (elf->ed_class == ELFCLASS32)
972 return (_elf32_update(elf, cmd));
973 else if (elf->ed_class == ELFCLASS64) {
974 return (_elf64_update(elf, cmd));
982 _elf_swap_wrimage(Elf *elf)
984 if (elf == 0)
987 if (elf->ed_class == ELFCLASS32)
988 return (_elf32_swap_wrimage(elf));
990 if (elf->ed_class == ELFCLASS64)
991 return (_elf64_swap_wrimage(elf));