Lines Matching refs:elf
42 __elf_getphdrnum_rdlock (Elf *elf, size_t *dst) in __elf_getphdrnum_rdlock() argument
44 if (unlikely (elf->state.elf64.ehdr == NULL)) in __elf_getphdrnum_rdlock()
51 *dst = (elf->class == ELFCLASS32 in __elf_getphdrnum_rdlock()
52 ? elf->state.elf32.ehdr->e_phnum in __elf_getphdrnum_rdlock()
53 : elf->state.elf64.ehdr->e_phnum); in __elf_getphdrnum_rdlock()
57 const Elf_ScnList *const scns = (elf->class == ELFCLASS32 in __elf_getphdrnum_rdlock()
58 ? &elf->state.elf32.scns in __elf_getphdrnum_rdlock()
59 : &elf->state.elf64.scns); in __elf_getphdrnum_rdlock()
64 if (elf->class == ELFCLASS32) in __elf_getphdrnum_rdlock()
67 && elf->state.elf32.scns.data[0].shdr.e32 != NULL)) in __elf_getphdrnum_rdlock()
73 && elf->state.elf64.scns.data[0].shdr.e64 != NULL)) in __elf_getphdrnum_rdlock()
83 __elf_getphdrnum_chk_rdlock (Elf *elf, size_t *dst) in __elf_getphdrnum_chk_rdlock() argument
85 int result = __elf_getphdrnum_rdlock (elf, dst); in __elf_getphdrnum_chk_rdlock()
89 if (elf->state.elf.phdr == NULL) in __elf_getphdrnum_chk_rdlock()
91 Elf64_Off off = (elf->class == ELFCLASS32 in __elf_getphdrnum_chk_rdlock()
92 ? elf->state.elf32.ehdr->e_phoff in __elf_getphdrnum_chk_rdlock()
93 : elf->state.elf64.ehdr->e_phoff); in __elf_getphdrnum_chk_rdlock()
100 if (unlikely (off >= elf->maximum_size)) in __elf_getphdrnum_chk_rdlock()
107 size_t phdr_size = (elf->class == ELFCLASS32 in __elf_getphdrnum_chk_rdlock()
116 if (unlikely (elf->maximum_size - off < *dst * phdr_size)) in __elf_getphdrnum_chk_rdlock()
117 *dst = (elf->maximum_size - off) / phdr_size; in __elf_getphdrnum_chk_rdlock()
124 elf_getphdrnum (Elf *elf, size_t *dst) in elf_getphdrnum() argument
128 if (elf == NULL) in elf_getphdrnum()
131 if (unlikely (elf->kind != ELF_K_ELF)) in elf_getphdrnum()
137 rwlock_rdlock (elf->lock); in elf_getphdrnum()
138 result = __elf_getphdrnum_chk_rdlock (elf, dst); in elf_getphdrnum()
139 rwlock_unlock (elf->lock); in elf_getphdrnum()