Lines Matching refs:elf
35 static bool __resolve_sym(struct ta_elf *elf, unsigned int st_bind, in __resolve_sym() argument
44 if (st_name > elf->dynstr_size) in __resolve_sym()
46 if (strcmp(name, elf->dynstr + st_name)) in __resolve_sym()
64 if (st_value > (elf->max_addr - elf->load_addr)) in __resolve_sym()
68 *val = st_value + elf->load_addr; in __resolve_sym()
82 vaddr_t *val, struct ta_elf *elf, in resolve_sym_helper() argument
89 uint32_t *hashtab = elf->hashtab; in resolve_sym_helper()
96 if (elf->is_32bit) { in resolve_sym_helper()
97 Elf32_Sym *sym = elf->dynsymtab; in resolve_sym_helper()
100 if (n >= nchains || n >= elf->num_dynsyms) in resolve_sym_helper()
109 n = confine_array_index(n, elf->num_dynsyms); in resolve_sym_helper()
110 if (__resolve_sym(elf, in resolve_sym_helper()
119 Elf64_Sym *sym = elf->dynsymtab; in resolve_sym_helper()
122 if (n >= nchains || n >= elf->num_dynsyms) in resolve_sym_helper()
131 n = confine_array_index(n, elf->num_dynsyms); in resolve_sym_helper()
132 if (__resolve_sym(elf, in resolve_sym_helper()
155 struct ta_elf *elf) in ta_elf_resolve_sym() argument
159 if (elf) { in ta_elf_resolve_sym()
161 if (!resolve_sym_helper(hash, name, val, elf, in ta_elf_resolve_sym()
165 if (!resolve_sym_helper(hash, name, val, elf, in ta_elf_resolve_sym()
170 TAILQ_FOREACH(elf, &main_elf_queue, link) { in ta_elf_resolve_sym()
171 if (!resolve_sym_helper(hash, name, val, elf, in ta_elf_resolve_sym()
174 if (!resolve_sym_helper(hash, name, val, elf, in ta_elf_resolve_sym()
183 *found_elf = elf; in ta_elf_resolve_sym()
255 static void e32_relocate(struct ta_elf *elf, unsigned int rel_sidx) in e32_relocate() argument
257 Elf32_Shdr *shdr = elf->shdr; in e32_relocate()
275 if (sym_tab_idx >= elf->e_shnum) in e32_relocate()
277 sym_tab_idx = confine_array_index(sym_tab_idx, elf->e_shnum); in e32_relocate()
285 if (sh_end >= (elf->max_addr - elf->load_addr)) in e32_relocate()
288 sym_tab = (Elf32_Sym *)(elf->load_addr + in e32_relocate()
295 if (str_tab_idx >= elf->e_shnum) in e32_relocate()
299 elf->e_shnum); in e32_relocate()
305 if (sh_end >= (elf->max_addr - elf->load_addr)) in e32_relocate()
309 str_tab = (const char *)(elf->load_addr + in e32_relocate()
319 if (sh_end >= (elf->max_addr - elf->load_addr)) in e32_relocate()
321 rel = (Elf32_Rel *)(elf->load_addr + shdr[rel_sidx].sh_addr); in e32_relocate()
331 if (rel->r_offset >= (elf->max_addr - elf->load_addr)) in e32_relocate()
334 where = (Elf32_Addr *)(elf->load_addr + rel->r_offset); in e32_relocate()
354 *where += elf->load_addr + in e32_relocate()
366 *where += elf->load_addr; in e32_relocate()
380 mod = elf; in e32_relocate()
434 Elf64_Addr *where, struct ta_elf *elf) in e64_process_tls_tprel_rela() argument
447 mod = elf; in e64_process_tls_tprel_rela()
463 struct ta_elf *elf) in e64_process_tlsdesc_rela() argument
480 rela, where + 1, elf); in e64_process_tlsdesc_rela()
483 static void e64_relocate(struct ta_elf *elf, unsigned int rel_sidx) in e64_relocate() argument
485 Elf64_Shdr *shdr = elf->shdr; in e64_relocate()
503 if (sym_tab_idx >= elf->e_shnum) in e64_relocate()
505 sym_tab_idx = confine_array_index(sym_tab_idx, elf->e_shnum); in e64_relocate()
513 if (sh_end >= (elf->max_addr - elf->load_addr)) in e64_relocate()
516 sym_tab = (Elf64_Sym *)(elf->load_addr + in e64_relocate()
523 if (str_tab_idx >= elf->e_shnum) in e64_relocate()
527 elf->e_shnum); in e64_relocate()
533 if (sh_end >= (elf->max_addr - elf->load_addr)) in e64_relocate()
537 str_tab = (const char *)(elf->load_addr + in e64_relocate()
547 if (sh_end >= (elf->max_addr - elf->load_addr)) in e64_relocate()
549 rela = (Elf64_Rela *)(elf->load_addr + shdr[rel_sidx].sh_addr); in e64_relocate()
557 if (rela->r_offset >= (elf->max_addr - elf->load_addr)) in e64_relocate()
561 where = (Elf64_Addr *)(elf->load_addr + rela->r_offset); in e64_relocate()
582 *where = rela->r_addend + elf->load_addr + in e64_relocate()
587 *where = rela->r_addend + elf->load_addr; in e64_relocate()
597 elf); in e64_relocate()
602 elf); in e64_relocate()
611 static void __noreturn e64_relocate(struct ta_elf *elf __unused, in e64_relocate()
618 void ta_elf_relocate(struct ta_elf *elf) in ta_elf_relocate() argument
622 if (elf->is_32bit) { in ta_elf_relocate()
623 Elf32_Shdr *shdr = elf->shdr; in ta_elf_relocate()
625 for (n = 0; n < elf->e_shnum; n++) in ta_elf_relocate()
627 e32_relocate(elf, n); in ta_elf_relocate()
629 Elf64_Shdr *shdr = elf->shdr; in ta_elf_relocate()
631 for (n = 0; n < elf->e_shnum; n++) in ta_elf_relocate()
633 e64_relocate(elf, n); in ta_elf_relocate()