Lines Matching full:elf
1 /* Create new ELF program header table.
46 elfw2(LIBELFBITS,newphdr) (Elf *elf, size_t count) in ElfW2()
50 if (elf == NULL) in ElfW2()
53 if (unlikely (elf->kind != ELF_K_ELF)) in ElfW2()
65 rwlock_wrlock (elf->lock); in ElfW2()
67 if (elf->class == 0) in ElfW2()
68 elf->class = ELFW(ELFCLASS,LIBELFBITS); in ElfW2()
69 else if (unlikely (elf->class != ELFW(ELFCLASS,LIBELFBITS))) in ElfW2()
76 if (unlikely (elf->state.ELFW(elf,LIBELFBITS).ehdr == NULL)) in ElfW2()
87 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL) in ElfW2()
89 if (elf->state.ELFW(elf,LIBELFBITS).phdr_flags & ELF_F_MALLOCED) in ElfW2()
90 free (elf->state.ELFW(elf,LIBELFBITS).phdr); in ElfW2()
93 elf->state.ELFW(elf,LIBELFBITS).phdr = NULL; in ElfW2()
95 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = 0; in ElfW2()
97 if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt > 0) in ElfW2()
98 elf->state.ELFW(elf,LIBELFBITS).scns.data[0] in ElfW2()
101 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize = in ElfW2()
104 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_DIRTY; in ElfW2()
105 elf->flags |= ELF_F_DIRTY; in ElfW2()
111 else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count in ElfW2()
113 || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) in ElfW2()
122 Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0]; in ElfW2()
135 realloc (elf->state.ELFW(elf,LIBELFBITS).phdr, in ElfW2()
142 elf->state.ELFW(elf,LIBELFBITS).phdr = result; in ElfW2()
146 if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt == 0) in ElfW2()
148 assert (elf->state.ELFW(elf,LIBELFBITS).scns.max > 0); in ElfW2()
149 elf->state.ELFW(elf,LIBELFBITS).scns.cnt = 1; in ElfW2()
153 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = PN_XNUM; in ElfW2()
157 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = count; in ElfW2()
161 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize = in ElfW2()
165 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= in ElfW2()
169 elf->flags |= ELF_F_DIRTY; in ElfW2()
175 assert (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize in ElfW2()
179 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_DIRTY; in ElfW2()
181 result = elf->state.ELFW(elf,LIBELFBITS).phdr; in ElfW2()
186 rwlock_unlock (elf->lock); in ElfW2()