Lines Matching full:elf
46 elf_getshdrstrndx (Elf *elf, size_t *dst) in elf_getshdrstrndx() argument
50 if (elf == NULL) in elf_getshdrstrndx()
53 if (unlikely (elf->kind != ELF_K_ELF)) in elf_getshdrstrndx()
59 rwlock_rdlock (elf->lock); in elf_getshdrstrndx()
61 /* We rely here on the fact that the `elf' element is a common prefix in elf_getshdrstrndx()
63 assert (offsetof (struct Elf, state.elf.ehdr) in elf_getshdrstrndx()
64 == offsetof (struct Elf, state.elf32.ehdr)); in elf_getshdrstrndx()
65 assert (sizeof (elf->state.elf.ehdr) in elf_getshdrstrndx()
66 == sizeof (elf->state.elf32.ehdr)); in elf_getshdrstrndx()
67 assert (offsetof (struct Elf, state.elf.ehdr) in elf_getshdrstrndx()
68 == offsetof (struct Elf, state.elf64.ehdr)); in elf_getshdrstrndx()
69 assert (sizeof (elf->state.elf.ehdr) in elf_getshdrstrndx()
70 == sizeof (elf->state.elf64.ehdr)); in elf_getshdrstrndx()
72 if (unlikely (elf->state.elf.ehdr == NULL)) in elf_getshdrstrndx()
81 num = (elf->class == ELFCLASS32 in elf_getshdrstrndx()
82 ? elf->state.elf32.ehdr->e_shstrndx in elf_getshdrstrndx()
83 : elf->state.elf64.ehdr->e_shstrndx); in elf_getshdrstrndx()
85 /* Determine whether the index is too big to fit in the ELF in elf_getshdrstrndx()
90 if (elf->class == ELFCLASS32) in elf_getshdrstrndx()
93 if (unlikely (elf->state.elf32.scns.cnt == 0)) in elf_getshdrstrndx()
101 if (elf->state.elf32.scns.data[0].shdr.e32 != NULL) in elf_getshdrstrndx()
103 num = elf->state.elf32.scns.data[0].shdr.e32->sh_link; in elf_getshdrstrndx()
107 offset = elf->state.elf32.ehdr->e_shoff; in elf_getshdrstrndx()
109 if (elf->map_address != NULL in elf_getshdrstrndx()
110 && elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA in elf_getshdrstrndx()
112 || (((size_t) ((char *) elf->map_address in elf_getshdrstrndx()
113 + elf->start_offset + offset)) in elf_getshdrstrndx()
116 /* First see whether the information in the ELF header is in elf_getshdrstrndx()
118 if (unlikely (elf->maximum_size - offset in elf_getshdrstrndx()
128 num = ((Elf32_Shdr *) (elf->map_address + elf->start_offset in elf_getshdrstrndx()
137 if (unlikely (pread_retry (elf->fildes, &shdr_mem, in elf_getshdrstrndx()
141 /* We must be able to read this ELF section header. */ in elf_getshdrstrndx()
147 if (elf->state.elf32.ehdr->e_ident[EI_DATA] != MY_ELFDATA) in elf_getshdrstrndx()
154 if (unlikely (elf->state.elf64.scns.cnt == 0)) in elf_getshdrstrndx()
162 if (elf->state.elf64.scns.data[0].shdr.e64 != NULL) in elf_getshdrstrndx()
164 num = elf->state.elf64.scns.data[0].shdr.e64->sh_link; in elf_getshdrstrndx()
168 size_t offset = elf->state.elf64.ehdr->e_shoff; in elf_getshdrstrndx()
170 if (elf->map_address != NULL in elf_getshdrstrndx()
171 && elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA in elf_getshdrstrndx()
173 || (((size_t) ((char *) elf->map_address in elf_getshdrstrndx()
174 + elf->start_offset + offset)) in elf_getshdrstrndx()
177 /* First see whether the information in the ELF header is in elf_getshdrstrndx()
179 if (unlikely (elf->maximum_size - offset in elf_getshdrstrndx()
189 num = ((Elf64_Shdr *) (elf->map_address + elf->start_offset in elf_getshdrstrndx()
198 if (unlikely (pread_retry (elf->fildes, &shdr_mem, in elf_getshdrstrndx()
202 /* We must be able to read this ELF section header. */ in elf_getshdrstrndx()
208 if (elf->state.elf64.ehdr->e_ident[EI_DATA] != MY_ELFDATA) in elf_getshdrstrndx()
221 rwlock_unlock (elf->lock); in elf_getshdrstrndx()