• Home
  • Raw
  • Download

Lines Matching full:elf

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