Home | History | Annotate | Download | only in libelf

Lines Matching refs:elf

1 /* Return number of program headers in the ELF file.
42 __elf_getphdrnum_rdlock (Elf *elf, size_t *dst)
44 if (unlikely (elf->state.elf64.ehdr == NULL))
46 /* Maybe no ELF header was created yet. */
51 *dst = (elf->class == ELFCLASS32
52 ? elf->state.elf32.ehdr->e_phnum
53 : elf->state.elf64.ehdr->e_phnum);
57 const Elf_ScnList *const scns = (elf->class == ELFCLASS32
58 ? &elf->state.elf32.scns
59 : &elf->state.elf64.scns);
64 if (elf->class == ELFCLASS32)
67 && elf->state.elf32.scns.data[0].shdr.e32 != NULL))
73 && elf->state.elf64.scns.data[0].shdr.e64 != NULL))
83 __elf_getphdrnum_chk_rdlock (Elf *elf, size_t *dst)
85 int result = __elf_getphdrnum_rdlock (elf, dst);
88 Elf64_Off off = (elf->class == ELFCLASS32
89 ? elf->state.elf32.ehdr->e_phoff
90 : elf->state.elf64.ehdr->e_phoff);
97 if (unlikely (off >= elf->maximum_size))
104 size_t phdr_size = (elf->class == ELFCLASS32
113 if (unlikely (elf->maximum_size - off < *dst * phdr_size))
114 *dst = (elf->maximum_size - off) / phdr_size;
120 elf_getphdrnum (Elf *elf, size_t *dst)
124 if (elf == NULL)
127 if (unlikely (elf->kind != ELF_K_ELF))
133 rwlock_rdlock (elf->lock);
134 result = __elf_getphdrnum_chk_rdlock (elf, dst);
135 rwlock_unlock (elf->lock);