• Home
  • Raw
  • Download

Lines Matching full:elf

1 /* Free resources associated with Elf descriptor.
53 elf_end (Elf *elf) in elf_end() argument
55 Elf *parent; in elf_end()
57 if (elf == NULL) in elf_end()
62 rwlock_wrlock (elf->lock); in elf_end()
64 if (elf->ref_count != 0 && --elf->ref_count != 0) in elf_end()
67 int result = elf->ref_count; in elf_end()
68 rwlock_unlock (elf->lock); in elf_end()
72 if (elf->kind == ELF_K_AR) in elf_end()
76 symbol table since this is only available via the archive ELF in elf_end()
78 the archive headers for the ELF files in the archive point in elf_end()
80 if (elf->state.ar.ar_sym != (Elf_Arsym *) -1l) in elf_end()
81 free (elf->state.ar.ar_sym); in elf_end()
82 elf->state.ar.ar_sym = NULL; in elf_end()
84 if (elf->state.ar.children != NULL) in elf_end()
86 rwlock_unlock(elf->lock); in elf_end()
92 parent = elf->parent; in elf_end()
100 rwlock_unlock (elf->lock); in elf_end()
102 rwlock_wrlock (elf->lock); in elf_end()
104 if (parent->state.ar.children == elf) in elf_end()
105 parent->state.ar.children = elf->next; in elf_end()
108 struct Elf *child = parent->state.ar.children; in elf_end()
110 while (child->next != elf) in elf_end()
113 child->next = elf->next; in elf_end()
120 switch (elf->kind) in elf_end()
123 if (elf->state.ar.long_names != NULL) in elf_end()
124 free (elf->state.ar.long_names); in elf_end()
130 = (elf->class == ELFCLASS32 in elf_end()
131 || (offsetof (struct Elf, state.elf32.rawchunks) in elf_end()
132 == offsetof (struct Elf, state.elf64.rawchunks)) in elf_end()
133 ? elf->state.elf32.rawchunks in elf_end()
134 : elf->state.elf64.rawchunks); in elf_end()
137 Elf_ScnList *list = (elf->class == ELFCLASS32 in elf_end()
138 || (offsetof (struct Elf, state.elf32.scns) in elf_end()
139 == offsetof (struct Elf, state.elf64.scns)) in elf_end()
140 ? &elf->state.elf32.scns in elf_end()
141 : &elf->state.elf64.scns); in elf_end()
177 if (elf->map_address == NULL in elf_end()
199 if (oldp != (elf->class == ELFCLASS32 in elf_end()
200 || (offsetof (struct Elf, state.elf32.scns) in elf_end()
201 == offsetof (struct Elf, state.elf64.scns)) in elf_end()
202 ? &elf->state.elf32.scns in elf_end()
203 : &elf->state.elf64.scns)) in elf_end()
210 if (elf->state.elf.shdr_malloced != 0) in elf_end()
211 free (elf->class == ELFCLASS32 in elf_end()
212 || (offsetof (struct Elf, state.elf32.shdr) in elf_end()
213 == offsetof (struct Elf, state.elf64.shdr)) in elf_end()
214 ? (void *) elf->state.elf32.shdr in elf_end()
215 : (void *) elf->state.elf64.shdr); in elf_end()
218 if ((elf->state.elf.phdr_flags & ELF_F_MALLOCED) != 0) in elf_end()
219 free (elf->class == ELFCLASS32 in elf_end()
220 || (offsetof (struct Elf, state.elf32.phdr) in elf_end()
221 == offsetof (struct Elf, state.elf64.phdr)) in elf_end()
222 ? (void *) elf->state.elf32.phdr in elf_end()
223 : (void *) elf->state.elf64.phdr); in elf_end()
230 if (elf->map_address != NULL && parent == NULL) in elf_end()
233 if ((elf->flags & ELF_F_MALLOCED) != 0) in elf_end()
234 free (elf->map_address); in elf_end()
235 else if ((elf->flags & ELF_F_MMAPPED) != 0) in elf_end()
236 munmap (elf->map_address, elf->maximum_size); in elf_end()
239 rwlock_unlock (elf->lock); in elf_end()
240 rwlock_fini (elf->lock); in elf_end()
243 free (elf); in elf_end()