Home | History | Annotate | Download | only in libelf

Lines Matching refs:Elf

1 /* Free resources associated with Elf descriptor.
43 elf_end (Elf *elf)
45 Elf *parent;
47 if (elf == NULL)
52 rwlock_wrlock (elf->lock);
54 if (elf->ref_count != 0 && --elf->ref_count != 0)
57 int result = elf->ref_count;
58 rwlock_unlock (elf->lock);
62 if (elf->kind == ELF_K_AR)
66 symbol table since this is only available via the archive ELF
68 the archive headers for the ELF files in the archive point
70 if (elf->state.ar.ar_sym != (Elf_Arsym *) -1l)
71 free (elf->state.ar.ar_sym);
72 elf->state.ar.ar_sym = NULL;
74 if (elf->state.ar.children != NULL)
79 parent = elf->parent;
87 rwlock_unlock (elf->lock);
89 rwlock_wrlock (elf->lock);
91 if (parent->state.ar.children == elf)
92 parent->state.ar.children = elf->next;
95 struct Elf *child = parent->state.ar.children;
97 while (child->next != elf)
100 child->next = elf->next;
107 switch (elf->kind)
110 if (elf->state.ar.long_names != NULL)
111 free (elf->state.ar.long_names);
117 = (elf->class == ELFCLASS32
118 || (offsetof (struct Elf, state.elf32.rawchunks)
119 == offsetof (struct Elf, state.elf64.rawchunks))
120 ? elf->state.elf32.rawchunks
121 : elf->state.elf64.rawchunks);
131 Elf_ScnList *list = (elf->class == ELFCLASS32
132 || (offsetof (struct Elf, state.elf32.scns)
133 == offsetof (struct Elf, state.elf64.scns))
134 ? &elf->state.elf32.scns
135 : &elf->state.elf64.scns);
168 if (elf->map_address == NULL
189 if (oldp != (elf->class == ELFCLASS32
190 || (offsetof (struct Elf, state.elf32.scns)
191 == offsetof (struct Elf, state.elf64.scns))
192 ? &elf->state.elf32.scns
193 : &elf->state.elf64.scns))
200 if (elf->state.elf.shdr_malloced != 0)
201 free (elf->class == ELFCLASS32
202 || (offsetof (struct Elf, state.elf32.shdr)
203 == offsetof (struct Elf, state.elf64.shdr))
204 ? (void *) elf->state.elf32.shdr
205 : (void *) elf->state.elf64.shdr);
208 if ((elf->state.elf.phdr_flags & ELF_F_MALLOCED) != 0)
209 free (elf->class == ELFCLASS32
210 || (offsetof (struct Elf, state.elf32.phdr)
211 == offsetof (struct Elf, state.elf64.phdr))
212 ? (void *) elf->state.elf32.phdr
213 : (void *) elf->state.elf64.phdr);
220 if (elf->map_address != NULL && parent == NULL)
223 if ((elf->flags & ELF_F_MALLOCED) != 0)
224 free (elf->map_address);
225 else if ((elf->flags & ELF_F_MMAPPED) != 0)
226 munmap (elf->map_address, elf->maximum_size);
229 rwlock_unlock (elf->lock);
230 rwlock_fini (elf->lock);
233 free (elf);