Lines Matching full:elf
1 /* Get ELF program header table.
49 __elfw2(LIBELFBITS,getphdr_wrlock) (Elf *elf) in ElfW2()
56 result = elf->state.ELFW(elf,LIBELFBITS).phdr; in ElfW2()
60 if (elf->class == 0) in ElfW2()
61 elf->class = ELFW(ELFCLASS,LIBELFBITS); in ElfW2()
62 else if (elf->class != ELFW(ELFCLASS,LIBELFBITS)) in ElfW2()
72 ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; in ElfW2()
76 if (__elf_getphdrnum_rdlock (elf, &phnum) != 0) in ElfW2()
88 || ehdr->e_phoff > elf->maximum_size in ElfW2()
89 || elf->maximum_size - ehdr->e_phoff < size) in ElfW2()
95 if (elf->map_address != NULL) in ElfW2()
97 /* First see whether the information in the ELF header is in ElfW2()
99 if (unlikely (ehdr->e_phoff >= elf->maximum_size) in ElfW2()
100 || unlikely (elf->maximum_size - ehdr->e_phoff < size)) in ElfW2()
108 void *file_phdr = ((char *) elf->map_address in ElfW2()
109 + elf->start_offset + ehdr->e_phoff); in ElfW2()
115 elf->state.ELFW(elf,LIBELFBITS).phdr = file_phdr; in ElfW2()
122 of entries from the ELF header. */ in ElfW2()
123 phdr = elf->state.ELFW(elf,LIBELFBITS).phdr = in ElfW2()
125 if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) in ElfW2()
130 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= in ElfW2()
177 else if (likely (elf->fildes != -1)) in ElfW2()
180 of entries from the ELF header. */ in ElfW2()
181 elf->state.ELFW(elf,LIBELFBITS).phdr = in ElfW2()
183 if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) in ElfW2()
188 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_MALLOCED; in ElfW2()
191 ssize_t n = pread_retry (elf->fildes, in ElfW2()
192 elf->state.ELFW(elf,LIBELFBITS).phdr, size, in ElfW2()
193 elf->start_offset + ehdr->e_phoff); in ElfW2()
198 free (elf->state.ELFW(elf,LIBELFBITS).phdr); in ElfW2()
199 elf->state.ELFW(elf,LIBELFBITS).phdr = NULL; in ElfW2()
208 = elf->state.ELFW(elf,LIBELFBITS).phdr; in ElfW2()
231 result = elf->state.ELFW(elf,LIBELFBITS).phdr; in ElfW2()
239 elfw2(LIBELFBITS,getphdr) (Elf *elf) in ElfW2()
243 if (elf == NULL) in ElfW2()
246 if (unlikely (elf->kind != ELF_K_ELF)) in ElfW2()
255 result = elf->state.ELFW(elf,LIBELFBITS).phdr; in ElfW2()
259 rwlock_wrlock (elf->lock); in ElfW2()
260 result = __elfw2(LIBELFBITS,getphdr_wrlock) (elf); in ElfW2()
261 rwlock_unlock (elf->lock); in ElfW2()