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