Home | History | Annotate | Download | only in libelf

Lines Matching refs:elf

30 write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
32 int class = elf->class;
39 if (elf->parent == NULL
40 && (elf->maximum_size == ~((size_t) 0) || size > elf->maximum_size)
41 && unlikely (ftruncate (elf->fildes, size) != 0))
48 if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP)
50 elf->map_address = mmap (NULL, size, PROT_READ | PROT_WRITE,
51 MAP_SHARED, elf->fildes, 0);
52 if (unlikely (elf->map_address == MAP_FAILED))
53 elf->map_address = NULL;
56 if (elf->map_address != NULL)
60 ? __elf32_updatemmap (elf, change_bo, shnum)
61 : __elf64_updatemmap (elf, change_bo, shnum)) != 0)
69 ? __elf32_updatefile (elf, change_bo, shnum)
70 : __elf64_updatefile (elf, change_bo, shnum)) != 0)
76 && elf->parent == NULL
77 && elf->maximum_size != ~((size_t) 0)
78 && size < elf->maximum_size
79 && unlikely (ftruncate (elf->fildes, size) != 0))
85 if (size != -1 && elf->parent == NULL)
86 elf->maximum_size = size;
93 elf_update (elf, cmd)
94 Elf *elf;
109 if (elf == NULL)
112 if (elf->kind != ELF_K_ELF)
118 rwlock_rdlock (elf->lock);
120 /* Make sure we have an ELF header. */
121 if (elf->state.elf.ehdr == NULL)
129 shnum = (elf->state.elf.scns_last->cnt == 0
131 : 1 + elf->state.elf.scns_last->data[elf->state.elf.scns_last->cnt - 1].index);
133 /* Update the ELF descriptor. First, place the program header. It
134 will come right after the ELF header. The count the size of all
136 size = (elf->class == ELFCLASS32
137 ? __elf32_updatenull (elf, &change_bo, shnum)
138 : __elf64_updatenull (elf, &change_bo, shnum));
143 if (elf->cmd != ELF_C_RDWR
144 && elf->cmd != ELF_C_RDWR_MMAP
145 && elf->cmd != ELF_C_WRITE
146 && unlikely (elf->cmd != ELF_C_WRITE_MMAP))
151 else if (unlikely (elf->fildes == -1))
159 if (elf->parent != NULL)
165 size = write_file (elf, size, change_bo, shnum);
170 rwlock_unlock (elf->lock);