• Home
  • Raw
  • Download

Lines Matching refs:mod

80 cache_sections (Dwfl_Module *mod)  in cache_sections()  argument
82 if (likely (mod->reloc_info != NULL)) in cache_sections()
83 return mod->reloc_info->count; in cache_sections()
89 if (unlikely (elf_getshdrstrndx (mod->main.elf, &shstrndx) < 0)) in cache_sections()
99 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) in cache_sections()
107 && mod->e_type == ET_REL) in cache_sections()
110 if (__libdwfl_relocate_value (mod, mod->main.elf, &shstrndx, in cache_sections()
121 const char *name = elf_strptr (mod->main.elf, shstrndx, in cache_sections()
138 newref->start = dwfl_adjusted_address (mod, shdr->sh_addr); in cache_sections()
145 if (mod->e_type == ET_REL in cache_sections()
148 && mod->dwfl->callbacks->section_address != NULL) in cache_sections()
153 Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); in cache_sections()
168 mod->reloc_info = malloc (offsetof (struct dwfl_relocation, refs[nrefs])); in cache_sections()
169 if (unlikely (mod->reloc_info == NULL)) in cache_sections()
182 mod->reloc_info->count = nrefs; in cache_sections()
185 mod->reloc_info->refs[i].name = sortrefs[i]->name; in cache_sections()
186 mod->reloc_info->refs[i].scn = sortrefs[i]->scn; in cache_sections()
187 mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs; in cache_sections()
188 mod->reloc_info->refs[i].start = sortrefs[i]->start; in cache_sections()
189 mod->reloc_info->refs[i].end = sortrefs[i]->end; in cache_sections()
202 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) in cache_sections()
212 Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); in cache_sections()
215 if (mod->reloc_info->refs[i].scn == tscn) in cache_sections()
217 mod->reloc_info->refs[i].relocs = scn; in cache_sections()
237 dwfl_module_relocations (Dwfl_Module *mod) in dwfl_module_relocations() argument
239 if (mod == NULL) in dwfl_module_relocations()
242 switch (mod->e_type) in dwfl_module_relocations()
245 return cache_sections (mod); in dwfl_module_relocations()
251 assert (mod->main.vaddr == mod->low_addr); in dwfl_module_relocations()
259 dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx, in dwfl_module_relocation_info() argument
262 if (mod == NULL) in dwfl_module_relocation_info()
265 switch (mod->e_type) in dwfl_module_relocation_info()
281 if (cache_sections (mod) < 0) in dwfl_module_relocation_info()
284 struct dwfl_relocation *sections = mod->reloc_info; in dwfl_module_relocation_info()
297 check_module (Dwfl_Module *mod) in check_module() argument
299 if (mod == NULL) in check_module()
302 if (INTUSE(dwfl_module_getsymtab) (mod) < 0) in check_module()
312 if (mod->dw == NULL) in check_module()
315 if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL) in check_module()
331 find_section (Dwfl_Module *mod, Dwarf_Addr *addr) in find_section() argument
333 if (cache_sections (mod) < 0) in find_section()
336 struct dwfl_relocation *sections = mod->reloc_info; in find_section()
368 __libdwfl_find_section_ndx (Dwfl_Module *mod, Dwarf_Addr *addr) in __libdwfl_find_section_ndx() argument
370 int idx = find_section (mod, addr); in __libdwfl_find_section_ndx()
374 return elf_ndxscn (mod->reloc_info->refs[idx].scn); in __libdwfl_find_section_ndx()
378 dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr) in dwfl_module_relocate_address() argument
380 if (unlikely (check_module (mod))) in dwfl_module_relocate_address()
383 switch (mod->e_type) in dwfl_module_relocate_address()
386 return find_section (mod, addr); in dwfl_module_relocate_address()
390 *addr -= mod->low_addr; in dwfl_module_relocate_address()
404 dwfl_module_address_section (Dwfl_Module *mod, Dwarf_Addr *address, in INTDEF()
407 if (check_module (mod)) in INTDEF()
410 int idx = find_section (mod, address); in INTDEF()
414 if (mod->reloc_info->refs[idx].relocs != NULL) in INTDEF()
416 assert (mod->e_type == ET_REL); in INTDEF()
418 Elf_Scn *tscn = mod->reloc_info->refs[idx].scn; in INTDEF()
419 Elf_Scn *relocscn = mod->reloc_info->refs[idx].relocs; in INTDEF()
420 Dwfl_Error result = __libdwfl_relocate_section (mod, mod->main.elf, in INTDEF()
423 mod->reloc_info->refs[idx].relocs = NULL; in INTDEF()
431 *bias = dwfl_adjusted_address (mod, 0); in INTDEF()
432 return mod->reloc_info->refs[idx].scn; in INTDEF()