• Home
  • Raw
  • Download

Lines Matching full:elf

129 __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)  in __elfw2()
133 /* We need the ELF header several times. */ in __elfw2()
134 ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; in __elfw2()
136 /* Write out the ELF header. */ in __elfw2()
137 if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY) in __elfw2()
146 /* Today there is only one version of the ELF header. */ in __elfw2()
156 (*fctp) ((char *) elf->map_address + elf->start_offset, ehdr, in __elfw2()
159 else if (elf->map_address + elf->start_offset != ehdr) in __elfw2()
160 memcpy (elf->map_address + elf->start_offset, ehdr, in __elfw2()
163 elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY; in __elfw2()
165 /* We start writing sections after the ELF header only if there is in __elfw2()
167 previous_scn_changed = elf->state.ELFW(elf,LIBELFBITS).phdr == NULL; in __elfw2()
171 if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) in __elfw2()
175 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL in __elfw2()
176 && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags) in __elfw2()
184 /* Maybe the user wants a gap between the ELF header and the program in __elfw2()
187 memset (elf->map_address + elf->start_offset + ehdr->e_ehsize, in __elfw2()
192 /* Today there is only one version of the ELF header. */ in __elfw2()
202 (*fctp) (elf->map_address + elf->start_offset + ehdr->e_phoff, in __elfw2()
203 elf->state.ELFW(elf,LIBELFBITS).phdr, in __elfw2()
207 memcpy (elf->map_address + elf->start_offset + ehdr->e_phoff, in __elfw2()
208 elf->state.ELFW(elf,LIBELFBITS).phdr, in __elfw2()
211 elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY; in __elfw2()
220 char *last_position = ((char *) elf->map_address + elf->start_offset in __elfw2()
231 Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; in __elfw2()
238 char *const shdr_start = ((char *) elf->map_address + elf->start_offset in __elfw2()
259 if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced in __elfw2()
263 assert ((char *) elf->map_address + elf->start_offset in __elfw2()
266 < ((char *) elf->map_address + elf->start_offset in __elfw2()
267 + elf->maximum_size)); in __elfw2()
286 if (((char *) elf->map_address + elf->start_offset in __elfw2()
289 < ((char *) elf->map_address + elf->start_offset in __elfw2()
290 + elf->maximum_size)) in __elfw2()
291 && (((char *) elf->map_address + elf->start_offset in __elfw2()
324 char *scn_start = ((char *) elf->map_address in __elfw2()
325 + elf->start_offset + shdr->sh_offset); in __elfw2()
340 || ((scn->flags | dl->flags | elf->flags) in __elfw2()
348 if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) in __elfw2()
393 /* If the previous section (or the ELF/program in __elfw2()
411 if ((elf->flags & ELF_F_DIRTY) in __elfw2()
412 && last_position < ((char *) elf->map_address + elf->start_offset in __elfw2()
415 (char *) elf->map_address + elf->start_offset + ehdr->e_shoff in __elfw2()
423 if ((scn->shdr_flags | elf->flags) & ELF_F_DIRTY) in __elfw2()
437 if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced in __elfw2()
452 elf->flags &= ~ELF_F_DIRTY; in __elfw2()
455 char *msync_start = ((char *) elf->map_address in __elfw2()
456 + (elf->start_offset & ~(sysconf (_SC_PAGESIZE) - 1))); in __elfw2()
457 char *msync_end = ((char *) elf->map_address in __elfw2()
458 + elf->start_offset + ehdr->e_shoff in __elfw2()
511 __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) in __elfw2()
517 /* We need the ELF header several times. */ in __elfw2()
518 ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; in __elfw2()
520 /* Write out the ELF header. */ in __elfw2()
521 if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY) in __elfw2()
533 /* Today there is only one version of the ELF header. */ in __elfw2()
542 /* Write the converted ELF header in a temporary buffer. */ in __elfw2()
549 /* Write out the ELF header. */ in __elfw2()
550 if (unlikely (pwrite_retry (elf->fildes, out_ehdr, in __elfw2()
558 elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY; in __elfw2()
560 /* We start writing sections after the ELF header only if there is in __elfw2()
562 previous_scn_changed = elf->state.ELFW(elf,LIBELFBITS).phdr == NULL; in __elfw2()
571 if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) in __elfw2()
575 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL in __elfw2()
576 && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags) in __elfw2()
580 ElfW2(LIBELFBITS,Phdr) *out_phdr = elf->state.ELFW(elf,LIBELFBITS).phdr; in __elfw2()
582 /* Maybe the user wants a gap between the ELF header and the program in __elfw2()
585 && unlikely (fill (elf->fildes, ehdr->e_ehsize, in __elfw2()
592 /* Today there is only one version of the ELF header. */ in __elfw2()
610 /* Write the converted ELF header in a temporary buffer. */ in __elfw2()
611 (*fctp) (tmp_phdr, elf->state.ELFW(elf,LIBELFBITS).phdr, in __elfw2()
618 /* Write out the ELF header. */ in __elfw2()
620 if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr, in __elfw2()
631 elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY; in __elfw2()
641 if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) in __elfw2()
653 off_t shdr_offset = elf->start_offset + ehdr->e_shoff; in __elfw2()
663 if (change_bo || elf->state.ELFW(elf,LIBELFBITS).shdr == NULL in __elfw2()
664 || (elf->flags & ELF_F_DIRTY)) in __elfw2()
676 shdr_data = elf->state.ELFW(elf,LIBELFBITS).shdr; in __elfw2()
677 int shdr_flags = elf->flags; in __elfw2()
680 Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; in __elfw2()
705 off_t scn_start = elf->start_offset + shdr->sh_offset; in __elfw2()
715 || ((scn->flags | dl->flags | elf->flags) in __elfw2()
718 if (unlikely (fill (elf->fildes, last_offset, in __elfw2()
730 if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) in __elfw2()
767 ssize_t n = pwrite_retry (elf->fildes, buf, in __elfw2()
794 /* If the previous section (or the ELF/program in __elfw2()
798 if (unlikely (fill (elf->fildes, last_offset, in __elfw2()
814 else if (elf->state.ELFW(elf,LIBELFBITS).shdr == NULL in __elfw2()
815 || (elf->flags & ELF_F_DIRTY)) in __elfw2()
825 if ((elf->flags & ELF_F_DIRTY) && last_offset < shdr_offset in __elfw2()
826 && unlikely (fill (elf->fildes, last_offset, in __elfw2()
833 && unlikely ((size_t) pwrite_retry (elf->fildes, shdr_data, in __elfw2()
847 elf->flags &= ~ELF_F_DIRTY; in __elfw2()