Home | History | Annotate | Download | only in libelf

Lines Matching refs:Elf

1 /* Free resources associated with Elf descriptor.
64 elf_end (elf)
65 Elf *elf;
67 Elf *parent;
69 if (elf == NULL)
74 rwlock_wrlock (elf->lock);
76 if (elf->ref_count != 0 && --elf->ref_count != 0)
79 int result = elf->ref_count;
80 rwlock_unlock (elf->lock);
84 if (elf->kind == ELF_K_AR)
88 symbol table since this is only available via the archive ELF
90 the archive headers for the ELF files in the archive point
92 if (elf->state.ar.ar_sym != (Elf_Arsym *) -1l)
93 free (elf->state.ar.ar_sym);
94 elf->state.ar.ar_sym = NULL;
96 if (elf->state.ar.children != NULL)
101 parent = elf->parent;
109 rwlock_unlock (elf->lock);
111 rwlock_wrlock (elf->lock);
113 if (parent->state.ar.children == elf)
114 parent->state.ar.children = elf->next;
117 struct Elf *child = parent->state.ar.children;
119 while (child->next != elf)
122 child->next = elf->next;
129 switch (elf->kind)
132 if (elf->state.ar.long_names != NULL)
133 free (elf->state.ar.long_names);
139 = (elf->class == ELFCLASS32
140 || (offsetof (struct Elf, state.elf32.rawchunks)
141 == offsetof (struct Elf, state.elf64.rawchunks))
142 ? elf->state.elf32.rawchunks
143 : elf->state.elf64.rawchunks);
153 Elf_ScnList *list = (elf->class == ELFCLASS32
154 || (offsetof (struct Elf, state.elf32.scns)
155 == offsetof (struct Elf, state.elf64.scns))
156 ? &elf->state.elf32.scns
157 : &elf->state.elf64.scns);
184 if (elf->map_address == NULL)
204 if (oldp != (elf->class == ELFCLASS32
205 || (offsetof (struct Elf, state.elf32.scns)
206 == offsetof (struct Elf, state.elf64.scns))
207 ? &elf->state.elf32.scns
208 : &elf->state.elf64.scns))
215 if (elf->state.elf.shdr_malloced != 0)
216 free (elf->class == ELFCLASS32
217 || (offsetof (struct Elf, state.elf32.shdr)
218 == offsetof (struct Elf, state.elf64.shdr))
219 ? (void *) elf->state.elf32.shdr
220 : (void *) elf->state.elf64.shdr);
223 if ((elf->state.elf.phdr_flags & ELF_F_MALLOCED) != 0)
224 free (elf->class == ELFCLASS32
225 || (offsetof (struct Elf, state.elf32.phdr)
226 == offsetof (struct Elf, state.elf64.phdr))
227 ? (void *) elf->state.elf32.phdr
228 : (void *) elf->state.elf64.phdr);
235 if (elf->map_address != NULL && parent == NULL)
238 if ((elf->flags & ELF_F_MALLOCED) != 0)
239 free (elf->map_address);
240 else if ((elf->flags & ELF_F_MMAPPED) != 0)
241 munmap (elf->map_address, elf->maximum_size);
244 rwlock_fini (elf->lock);
247 free (elf);