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()
52 *dst = (elf->class == ELFCLASS32 in __elf_getphdrnum_rdlock()
53 ? elf->state.elf32.ehdr->e_phnum in __elf_getphdrnum_rdlock()
54 : elf->state.elf64.ehdr->e_phnum); in __elf_getphdrnum_rdlock()
58 const Elf_ScnList *const scns = (elf->class == ELFCLASS32 in __elf_getphdrnum_rdlock()
59 ? &elf->state.elf32.scns in __elf_getphdrnum_rdlock()
60 : &elf->state.elf64.scns); in __elf_getphdrnum_rdlock()
65 if (elf->class == ELFCLASS32) in __elf_getphdrnum_rdlock()
69 Elf_Scn *scn = &elf->state.elf32.scns.data[0]; in __elf_getphdrnum_rdlock()
79 Elf_Scn *scn = &elf->state.elf64.scns.data[0]; in __elf_getphdrnum_rdlock()
92 __elf_getphdrnum_chk_rdlock (Elf *elf, size_t *dst) in __elf_getphdrnum_chk_rdlock() argument
94 int result = __elf_getphdrnum_rdlock (elf, dst); in __elf_getphdrnum_chk_rdlock()
98 if (elf->state.elf.phdr == NULL) in __elf_getphdrnum_chk_rdlock()
100 Elf64_Off off = (elf->class == ELFCLASS32 in __elf_getphdrnum_chk_rdlock()
101 ? elf->state.elf32.ehdr->e_phoff in __elf_getphdrnum_chk_rdlock()
102 : elf->state.elf64.ehdr->e_phoff); in __elf_getphdrnum_chk_rdlock()
109 if (unlikely (off >= elf->maximum_size)) in __elf_getphdrnum_chk_rdlock()
116 size_t phdr_size = (elf->class == ELFCLASS32 in __elf_getphdrnum_chk_rdlock()
125 if (unlikely (elf->maximum_size - off < *dst * phdr_size)) in __elf_getphdrnum_chk_rdlock()
126 *dst = (elf->maximum_size - off) / phdr_size; in __elf_getphdrnum_chk_rdlock()
133 elf_getphdrnum (Elf *elf, size_t *dst) in elf_getphdrnum() argument
137 if (elf == NULL) in elf_getphdrnum()
140 if (unlikely (elf->kind != ELF_K_ELF)) in elf_getphdrnum()
146 rwlock_rdlock (elf->lock); in elf_getphdrnum()
147 result = __elf_getphdrnum_chk_rdlock (elf, dst); in elf_getphdrnum()
148 rwlock_unlock (elf->lock); in elf_getphdrnum()