Lines Matching refs:mod

70 cache_sections (Dwfl_Module *mod)  in cache_sections()  argument
72 if (likely (mod->reloc_info != NULL)) in cache_sections()
73 return mod->reloc_info->count; in cache_sections()
79 if (unlikely (elf_getshdrstrndx (mod->main.elf, &shstrndx) < 0)) in cache_sections()
89 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) in cache_sections()
97 && mod->e_type == ET_REL) in cache_sections()
100 if (__libdwfl_relocate_value (mod, mod->main.elf, &shstrndx, in cache_sections()
111 const char *name = elf_strptr (mod->main.elf, shstrndx, in cache_sections()
128 newref->start = dwfl_adjusted_address (mod, shdr->sh_addr); in cache_sections()
135 if (mod->e_type == ET_REL in cache_sections()
138 && mod->dwfl->callbacks->section_address != NULL) in cache_sections()
143 Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); in cache_sections()
158 mod->reloc_info = malloc (offsetof (struct dwfl_relocation, refs[nrefs])); in cache_sections()
159 if (unlikely (mod->reloc_info == NULL)) in cache_sections()
172 mod->reloc_info->count = nrefs; in cache_sections()
175 mod->reloc_info->refs[i].name = sortrefs[i]->name; in cache_sections()
176 mod->reloc_info->refs[i].scn = sortrefs[i]->scn; in cache_sections()
177 mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs; in cache_sections()
178 mod->reloc_info->refs[i].start = sortrefs[i]->start; in cache_sections()
179 mod->reloc_info->refs[i].end = sortrefs[i]->end; in cache_sections()
192 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) in cache_sections()
202 Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); in cache_sections()
205 if (mod->reloc_info->refs[i].scn == tscn) in cache_sections()
207 mod->reloc_info->refs[i].relocs = scn; in cache_sections()
227 dwfl_module_relocations (Dwfl_Module *mod) in dwfl_module_relocations() argument
229 if (mod == NULL) in dwfl_module_relocations()
232 switch (mod->e_type) in dwfl_module_relocations()
235 return cache_sections (mod); in dwfl_module_relocations()
241 assert (mod->main.vaddr == mod->low_addr); in dwfl_module_relocations()
249 dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx, in dwfl_module_relocation_info() argument
252 if (mod == NULL) in dwfl_module_relocation_info()
255 switch (mod->e_type) in dwfl_module_relocation_info()
271 if (cache_sections (mod) < 0) in dwfl_module_relocation_info()
274 struct dwfl_relocation *sections = mod->reloc_info; in dwfl_module_relocation_info()
287 check_module (Dwfl_Module *mod) in check_module() argument
289 if (mod == NULL) in check_module()
292 if (INTUSE(dwfl_module_getsymtab) (mod) < 0) in check_module()
302 if (mod->dw == NULL) in check_module()
305 if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL) in check_module()
321 find_section (Dwfl_Module *mod, Dwarf_Addr *addr) in find_section() argument
323 if (cache_sections (mod) < 0) in find_section()
326 struct dwfl_relocation *sections = mod->reloc_info; in find_section()
358 __libdwfl_find_section_ndx (Dwfl_Module *mod, Dwarf_Addr *addr) in __libdwfl_find_section_ndx() argument
360 int idx = find_section (mod, addr); in __libdwfl_find_section_ndx()
364 return elf_ndxscn (mod->reloc_info->refs[idx].scn); in __libdwfl_find_section_ndx()
368 dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr) in dwfl_module_relocate_address() argument
370 if (unlikely (check_module (mod))) in dwfl_module_relocate_address()
373 switch (mod->e_type) in dwfl_module_relocate_address()
376 return find_section (mod, addr); in dwfl_module_relocate_address()
380 *addr -= mod->low_addr; in dwfl_module_relocate_address()
394 dwfl_module_address_section (Dwfl_Module *mod, Dwarf_Addr *address, in INTDEF()
397 if (check_module (mod)) in INTDEF()
400 int idx = find_section (mod, address); in INTDEF()
404 if (mod->reloc_info->refs[idx].relocs != NULL) in INTDEF()
406 assert (mod->e_type == ET_REL); in INTDEF()
408 Elf_Scn *tscn = mod->reloc_info->refs[idx].scn; in INTDEF()
409 Elf_Scn *relocscn = mod->reloc_info->refs[idx].relocs; in INTDEF()
410 Dwfl_Error result = __libdwfl_relocate_section (mod, mod->main.elf, in INTDEF()
413 mod->reloc_info->refs[idx].relocs = NULL; in INTDEF()
421 *bias = dwfl_adjusted_address (mod, 0); in INTDEF()
422 return mod->reloc_info->refs[idx].scn; in INTDEF()