Lines Matching refs:scn

139 convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,  in convert_data()  argument
146 if (((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0) in convert_data()
148 scn->data_base = scn->rawdata_base; in convert_data()
151 scn->data_base = (char *) malloc (size); in convert_data()
152 if (scn->data_base == NULL) in convert_data()
159 memcpy (scn->data_base, scn->rawdata_base, size); in convert_data()
166 scn->data_base = (char *) malloc (size); in convert_data()
167 if (scn->data_base == NULL) in convert_data()
177 ((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0) in convert_data()
178 rawdata_source = scn->rawdata_base; in convert_data()
189 memcpy (rawdata_source, scn->rawdata_base, size); in convert_data()
199 fp (scn->data_base, rawdata_source, size, 0); in convert_data()
201 if (rawdata_source != scn->rawdata_base) in convert_data()
205 scn->data_list.data.d.d_buf = scn->data_base; in convert_data()
206 scn->data_list.data.d.d_size = size; in convert_data()
207 scn->data_list.data.d.d_type = type; in convert_data()
208 scn->data_list.data.d.d_off = scn->rawdata.d.d_off; in convert_data()
209 scn->data_list.data.d.d_align = scn->rawdata.d.d_align; in convert_data()
210 scn->data_list.data.d.d_version = scn->rawdata.d.d_version; in convert_data()
212 scn->data_list.data.s = scn; in convert_data()
219 __libelf_set_rawdata_wrlock (Elf_Scn *scn) in __libelf_set_rawdata_wrlock() argument
226 Elf *elf = scn->elf; in __libelf_set_rawdata_wrlock()
231 = scn->shdr.e32 ?: __elf32_getshdr_wrlock (scn); in __libelf_set_rawdata_wrlock()
246 = scn->shdr.e64 ?: __elf64_getshdr_wrlock (scn); in __libelf_set_rawdata_wrlock()
310 scn->rawdata_base = scn->rawdata.d.d_buf in __libelf_set_rawdata_wrlock()
317 scn->rawdata_base = scn->rawdata.d.d_buf in __libelf_set_rawdata_wrlock()
319 if (scn->rawdata.d.d_buf == NULL) in __libelf_set_rawdata_wrlock()
325 ssize_t n = pread_retry (elf->fildes, scn->rawdata.d.d_buf, size, in __libelf_set_rawdata_wrlock()
330 free (scn->rawdata.d.d_buf); in __libelf_set_rawdata_wrlock()
331 scn->rawdata_base = scn->rawdata.d.d_buf = NULL; in __libelf_set_rawdata_wrlock()
345 scn->rawdata.d.d_size = size; in __libelf_set_rawdata_wrlock()
350 scn->rawdata.d.d_type = ELF_T_CHDR; in __libelf_set_rawdata_wrlock()
352 scn->rawdata.d.d_type = __libelf_data_type (elf, type); in __libelf_set_rawdata_wrlock()
353 scn->rawdata.d.d_off = 0; in __libelf_set_rawdata_wrlock()
368 scn->rawdata.d.d_align = align; in __libelf_set_rawdata_wrlock()
372 scn->rawdata.d.d_version = in __libelf_set_rawdata_wrlock()
375 scn->rawdata.d.d_version = in __libelf_set_rawdata_wrlock()
378 scn->rawdata.s = scn; in __libelf_set_rawdata_wrlock()
380 scn->data_read = 1; in __libelf_set_rawdata_wrlock()
383 scn->flags |= ELF_F_FILEDATA; in __libelf_set_rawdata_wrlock()
390 __libelf_set_rawdata (Elf_Scn *scn) in __libelf_set_rawdata() argument
394 if (scn == NULL) in __libelf_set_rawdata()
397 rwlock_wrlock (scn->elf->lock); in __libelf_set_rawdata()
398 result = __libelf_set_rawdata_wrlock (scn); in __libelf_set_rawdata()
399 rwlock_unlock (scn->elf->lock); in __libelf_set_rawdata()
406 __libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked) in __libelf_set_data_list_rdlock() argument
408 if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0) in __libelf_set_data_list_rdlock()
410 Elf *elf = scn->elf; in __libelf_set_data_list_rdlock()
418 if (scn->data_list_rear != NULL) in __libelf_set_data_list_rdlock()
423 convert_data (scn, __libelf_version, elf->class, in __libelf_set_data_list_rdlock()
429 scn->rawdata.d.d_size, scn->rawdata.d.d_type); in __libelf_set_data_list_rdlock()
435 scn->data_list.data.d = scn->rawdata.d; in __libelf_set_data_list_rdlock()
436 scn->data_list.data.s = scn; in __libelf_set_data_list_rdlock()
439 scn->data_list_rear = &scn->data_list; in __libelf_set_data_list_rdlock()
444 __elf_getdata_rdlock (Elf_Scn *scn, Elf_Data *data) in __elf_getdata_rdlock() argument
450 if (scn == NULL) in __elf_getdata_rdlock()
453 if (unlikely (scn->elf->kind != ELF_K_ELF)) in __elf_getdata_rdlock()
460 elf = scn->elf; in __elf_getdata_rdlock()
474 if (scn->data_list_rear == NULL in __elf_getdata_rdlock()
477 || unlikely (((Elf_Data_Scn *) data)->s != scn)) in __elf_getdata_rdlock()
484 runp = &scn->data_list; in __elf_getdata_rdlock()
508 if (scn->data_read == 0) in __elf_getdata_rdlock()
521 if (scn->data_read == 0 && __libelf_set_rawdata_wrlock (scn) != 0) in __elf_getdata_rdlock()
529 if (scn->data_list_rear == NULL) in __elf_getdata_rdlock()
530 __libelf_set_data_list_rdlock (scn, locked); in __elf_getdata_rdlock()
533 result = &scn->data_list.data.d; in __elf_getdata_rdlock()
540 elf_getdata (Elf_Scn *scn, Elf_Data *data) in elf_getdata() argument
544 if (scn == NULL) in elf_getdata()
547 rwlock_rdlock (scn->elf->lock); in elf_getdata()
548 result = __elf_getdata_rdlock (scn, data); in elf_getdata()
549 rwlock_unlock (scn->elf->lock); in elf_getdata()