Home | History | Annotate | Download | only in libelf

Lines Matching refs:Elf

127 __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
132 /* We need the ELF header several times. */
133 ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr;
135 /* Write out the ELF header. */
136 if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY)
145 /* Today there is only one version of the ELF header. */
155 (*fctp) ((char *) elf->map_address + elf->start_offset, ehdr,
159 memcpy (elf->map_address + elf->start_offset, ehdr,
162 elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY;
166 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL
167 && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags)
175 /* Maybe the user wants a gap between the ELF header and the program
178 memset (elf->map_address + elf->start_offset + ehdr->e_ehsize,
183 /* Today there is only one version of the ELF header. */
193 (*fctp) (elf->map_address + elf->start_offset + ehdr->e_phoff,
194 elf->state.ELFW(elf,LIBELFBITS).phdr,
198 memcpy (elf->map_address + elf->start_offset + ehdr->e_phoff,
199 elf->state.ELFW(elf,LIBELFBITS).phdr,
202 elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY;
207 last_position = ((char *) elf->map_address + elf->start_offset
215 Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
217 char *const shdr_start = ((char *) elf->map_address + elf->start_offset
238 if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced
242 assert ((char *) elf->map_address + elf->start_offset
245 < ((char *) elf->map_address + elf->start_offset
246 + elf->maximum_size));
260 if (((char *) elf->map_address + elf->start_offset
263 < ((char *) elf->map_address + elf->start_offset
264 + elf->maximum_size))
265 && (((char *) elf->map_address + elf->start_offset
289 char *scn_start = ((char *) elf->map_address
290 + elf->start_offset + shdr->sh_offset);
301 if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
374 if ((elf->flags & ELF_F_DIRTY)
375 && last_position < ((char *) elf->map_address + elf->start_offset
378 (char *) elf->map_address + elf->start_offset + ehdr->e_shoff
386 if ((scn->shdr_flags | elf->flags) & ELF_F_DIRTY)
400 if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced
410 elf->flags &= ~ELF_F_DIRTY;
413 char *msync_start = ((char *) elf->map_address
414 + (elf->start_offset & ~(sysconf (_SC_PAGESIZE) - 1)));
415 char *msync_end = ((char *) elf->map_address
416 + elf->start_offset + ehdr->e_shoff
469 __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
474 /* We need the ELF header several times. */
475 ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr;
477 /* Write out the ELF header. */
478 if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY)
490 /* Today there is only one version of the ELF header. */
499 /* Write the converted ELF header in a temporary buffer. */
506 /* Write out the ELF header. */
507 if (unlikely (pwrite_retry (elf->fildes, out_ehdr,
515 elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY;
524 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL
525 && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags)
529 ElfW2(LIBELFBITS,Phdr) *out_phdr = elf->state.ELFW(elf,LIBELFBITS).phdr;
531 /* Maybe the user wants a gap between the ELF header and the program
534 && unlikely (fill (elf->fildes, ehdr->e_ehsize,
541 /* Today there is only one version of the ELF header. */
559 /* Write the converted ELF header in a temporary buffer. */
560 (*fctp) (tmp_phdr, elf->state.ELFW(elf,LIBELFBITS).phdr,
567 /* Write out the ELF header. */
569 if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr,
580 elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY;
586 if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
595 off_t shdr_offset = elf->start_offset + ehdr->e_shoff;
604 if (change_bo || elf->state.ELFW(elf,LIBELFBITS).shdr == NULL)
608 shdr_data = elf->state.ELFW(elf,LIBELFBITS).shdr;
609 int shdr_flags = elf->flags;
612 Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
622 off_t scn_start = elf->start_offset + shdr->sh_offset;
629 if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
636 if (unlikely (fill (elf->fildes, last_offset,
675 ssize_t n = pwrite_retry (elf->fildes, buf,
706 else if (elf->state.ELFW(elf,LIBELFBITS).shdr == NULL)
716 if ((elf->flags & ELF_F_DIRTY) && last_offset < shdr_offset
717 && unlikely (fill (elf->fildes, last_offset,
724 && unlikely ((size_t) pwrite_retry (elf->fildes, shdr_data,
735 elf->flags &= ~ELF_F_DIRTY;