Lines Matching refs:ext
35 __weak void arch_elf_relocate_local(struct llext_loader *ldr, struct llext *ext, in arch_elf_relocate_local() argument
41 __weak void arch_elf_relocate_global(struct llext_loader *ldr, struct llext *ext, in arch_elf_relocate_global() argument
78 static int llext_dependency_add(struct llext *ext, struct llext *dependency) in llext_dependency_add() argument
82 for (i = 0; i < ARRAY_SIZE(ext->dependency); i++) { in llext_dependency_add()
83 if (ext->dependency[i] == dependency) { in llext_dependency_add()
87 if (!ext->dependency[i]) { in llext_dependency_add()
88 ext->dependency[i] = dependency; in llext_dependency_add()
98 void llext_dependency_remove_all(struct llext *ext) in llext_dependency_remove_all() argument
102 for (i = 0; i < ARRAY_SIZE(ext->dependency) && ext->dependency[i]; i++) { in llext_dependency_remove_all()
107 ext->dependency[i]->use_count--; in llext_dependency_remove_all()
108 __ASSERT(ext->dependency[i]->use_count, "LLEXT dependency use-count underrun!"); in llext_dependency_remove_all()
114 struct llext *ext; member
119 static int llext_find_extension_sym_iterate(struct llext *ext, void *arg) in llext_find_extension_sym_iterate() argument
122 const void *addr = llext_find_sym(&ext->exp_tab, se->sym); in llext_find_extension_sym_iterate()
126 se->ext = ext; in llext_find_extension_sym_iterate()
133 static const void *llext_find_extension_sym(const char *sym_name, struct llext **ext) in llext_find_extension_sym() argument
138 if (ext) { in llext_find_extension_sym()
139 *ext = se.ext; in llext_find_extension_sym()
145 static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr_t *shdr, in llext_link_plt() argument
153 uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; in llext_link_plt()
156 (void *)llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name), in llext_link_plt()
206 const char *name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym.st_name); in llext_link_plt()
219 uint8_t *rel_addr = (uint8_t *)ext->mem[LLEXT_MEM_TEXT] - in llext_link_plt()
241 link_addr = llext_find_sym(&ext->sym_tab, name); in llext_link_plt()
250 llext_dependency_add(ext, dep); in llext_link_plt()
260 arch_elf_relocate_global(ldr, ext, &rela, &sym, rel_addr, link_addr); in llext_link_plt()
263 arch_elf_relocate_local(ldr, ext, &rela, &sym, rel_addr, ldr_parm); in llext_link_plt()
272 int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_load_param *ldr_parm) in llext_link() argument
281 for (i = 0; i < ext->sect_cnt; ++i) { in llext_link()
282 elf_shdr_t *shdr = ext->sect_hdrs + i; in llext_link()
309 if (shdr->sh_info >= ext->sect_cnt || in llext_link()
321 name = llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name); in llext_link()
341 tgt = ext->sect_hdrs + shdr->sh_info; in llext_link()
344 llext_link_plt(ldr, ext, shdr, ldr_parm, tgt); in llext_link()
358 sect_base = (uintptr_t)llext_loaded_sect_ptr(ldr, ext, shdr->sh_info); in llext_link()
384 name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym.st_name); in llext_link()
411 llext_dependency_add(ext, dep); in llext_link()
447 link_addr = (uintptr_t)llext_loaded_sect_ptr(ldr, ext, in llext_link()
464 (uintptr_t)ext->mem[LLEXT_MEM_TEXT]); in llext_link()
474 if (ext->mem[i]) { in llext_link()
475 sys_cache_data_flush_range(ext->mem[i], ext->mem_size[i]); in llext_link()
476 sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]); in llext_link()
482 for (i = 0; i < ext->sect_cnt; ++i) { in llext_link()
483 elf_shdr_t *shdr = ext->sect_hdrs + i; in llext_link()