Lines Matching refs:elf
50 read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p) in read_number_entries() argument
59 if (elf->map_address != NULL) in read_number_entries()
62 memcpy (&u, elf->map_address + *offp, sizeof u); in read_number_entries()
63 else if ((size_t) pread_retry (elf->fildes, &u, w, *offp) != w) in read_number_entries()
77 elf_getarsym (Elf *elf, size_t *ptr) in elf_getarsym() argument
79 if (elf->kind != ELF_K_AR) in elf_getarsym()
89 *ptr = elf->state.ar.ar_sym_num; in elf_getarsym()
91 if (elf->state.ar.ar_sym == (Elf_Arsym *) -1l) in elf_getarsym()
98 Elf_Arsym *result = elf->state.ar.ar_sym; in elf_getarsym()
102 rwlock_wrlock (elf->lock); in elf_getarsym()
105 elf->state.ar.ar_sym = (Elf_Arsym *) -1l; in elf_getarsym()
111 if (elf->map_address == NULL) in elf_getarsym()
114 assert (elf->fildes != -1); in elf_getarsym()
115 if (pread_retry (elf->fildes, &elf->state.ar.ar_hdr, in elf_getarsym()
116 sizeof (struct ar_hdr), elf->start_offset + SARMAG) in elf_getarsym()
125 index_hdr = &elf->state.ar.ar_hdr; in elf_getarsym()
129 if (SARMAG + sizeof (struct ar_hdr) > elf->maximum_size) in elf_getarsym()
136 index_hdr = (struct ar_hdr *) (elf->map_address in elf_getarsym()
137 + elf->start_offset + SARMAG); in elf_getarsym()
171 size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr); in elf_getarsym()
172 if (read_number_entries (&n, elf, &off, index64_p) < 0) in elf_getarsym()
186 if (index_size > elf->maximum_size in elf_getarsym()
187 || elf->maximum_size - index_size < SARMAG + sizeof (struct ar_hdr) in elf_getarsym()
201 elf->state.ar.ar_sym = (Elf_Arsym *) malloc (ar_sym_len); in elf_getarsym()
202 if (elf->state.ar.ar_sym != NULL) in elf_getarsym()
208 if (elf->map_address == NULL) in elf_getarsym()
219 Elf_Arsym *newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym, in elf_getarsym()
223 free (elf->state.ar.ar_sym); in elf_getarsym()
224 elf->state.ar.ar_sym = NULL; in elf_getarsym()
228 elf->state.ar.ar_sym = newp; in elf_getarsym()
230 char *new_str = (char *) (elf->state.ar.ar_sym + n + 1); in elf_getarsym()
233 if ((size_t) pread_retry (elf->fildes, file_data, sz, off) != sz in elf_getarsym()
234 || ((size_t) pread_retry (elf->fildes, new_str, in elf_getarsym()
239 free (elf->state.ar.ar_sym); in elf_getarsym()
240 elf->state.ar.ar_sym = NULL; in elf_getarsym()
249 file_data = (void *) (elf->map_address + off); in elf_getarsym()
259 file_data = memcpy (temp_data, elf->map_address + off, sz); in elf_getarsym()
261 str_data = (char *) (elf->map_address + off + sz); in elf_getarsym()
265 Elf_Arsym *arsym = elf->state.ar.ar_sym; in elf_getarsym()
284 if (elf->map_address == NULL) in elf_getarsym()
286 free (elf->state.ar.ar_sym); in elf_getarsym()
287 elf->state.ar.ar_sym = NULL; in elf_getarsym()
309 elf->state.ar.ar_sym_num = n + 1; in elf_getarsym()
312 result = elf->state.ar.ar_sym; in elf_getarsym()
316 rwlock_unlock (elf->lock); in elf_getarsym()
320 *ptr = elf->state.ar.ar_sym_num; in elf_getarsym()