Lines Matching full:elf

1 /* Create new ELF program header table.
46 elfw2(LIBELFBITS,newphdr) (elf, count)
47 Elf *elf;
52 if (elf == NULL)
55 if (unlikely (elf->kind != ELF_K_ELF))
67 rwlock_wrlock (elf->lock);
69 if (elf->class == 0)
70 elf->class = ELFW(ELFCLASS,LIBELFBITS);
71 else if (unlikely (elf->class != ELFW(ELFCLASS,LIBELFBITS)))
78 if (unlikely (elf->state.ELFW(elf,LIBELFBITS).ehdr == NULL))
89 if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL)
91 if (elf->state.ELFW(elf,LIBELFBITS).phdr_flags & ELF_F_MALLOCED)
92 free (elf->state.ELFW(elf,LIBELFBITS).phdr);
95 elf->state.ELFW(elf,LIBELFBITS).phdr = NULL;
97 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = 0;
99 if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt > 0)
100 elf->state.ELFW(elf,LIBELFBITS).scns.data[0]
103 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize =
106 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_DIRTY;
107 elf->flags |= ELF_F_DIRTY;
113 else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count
115 || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
126 realloc (elf->state.ELFW(elf,LIBELFBITS).phdr,
133 elf->state.ELFW(elf,LIBELFBITS).phdr = result;
137 Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0];
138 if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt == 0)
140 assert (elf->state.ELFW(elf,LIBELFBITS).scns.max > 0);
141 elf->state.ELFW(elf,LIBELFBITS).scns.cnt = 1;
145 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = PN_XNUM;
149 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = count;
153 elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize =
157 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |=
161 elf->flags |= ELF_F_DIRTY;
167 assert (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize
171 elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_DIRTY;
173 result = elf->state.ELFW(elf,LIBELFBITS).phdr;
178 rwlock_unlock (elf->lock);