Lines Matching refs:mod

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