Lines Matching refs:ldr
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
51 static size_t llext_file_offset(struct llext_loader *ldr, size_t offset) in llext_file_offset() argument
56 if (ldr->sects[i].sh_addr <= offset && in llext_file_offset()
57 ldr->sects[i].sh_addr + ldr->sects[i].sh_size > offset) { in llext_file_offset()
58 return offset - ldr->sects[i].sh_addr + ldr->sects[i].sh_offset; in llext_file_offset()
145 static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr_t *shdr, in llext_link_plt() argument
156 (void *)llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name), in llext_link_plt()
159 const elf_shdr_t *sym_shdr = ldr->sects + LLEXT_MEM_SYMTAB; in llext_link_plt()
165 int ret = llext_seek(ldr, shdr->sh_offset + i * shdr->sh_entsize); in llext_link_plt()
168 ret = llext_read(ldr, &rela, sizeof(rela)); in llext_link_plt()
186 ret = llext_seek(ldr, sym_shdr->sh_offset + j * sizeof(elf_sym_t)); in llext_link_plt()
188 ret = llext_read(ldr, &sym, sizeof(sym)); in llext_link_plt()
206 const char *name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym.st_name); in llext_link_plt()
220 ldr->sects[LLEXT_MEM_TEXT].sh_offset; in llext_link_plt()
227 rel_addr += llext_file_offset(ldr, rela.r_offset); 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()
268 (size_t)rela.r_offset, (size_t)ldr->sects[LLEXT_MEM_TEXT].sh_offset, stb); 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
321 name = llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name); in llext_link()
344 llext_link_plt(ldr, ext, shdr, ldr_parm, tgt); in llext_link()
351 enum llext_mem mem_idx = ldr->sect_map[shdr->sh_info].mem_idx; in llext_link()
358 sect_base = (uintptr_t)llext_loaded_sect_ptr(ldr, ext, shdr->sh_info); in llext_link()
362 ret = llext_seek(ldr, shdr->sh_offset + j * shdr->sh_entsize); in llext_link()
367 ret = llext_read(ldr, &rel, shdr->sh_entsize); in llext_link()
373 ret = llext_seek(ldr, ldr->sects[LLEXT_MEM_SYMTAB].sh_offset in llext_link()
379 ret = llext_read(ldr, &sym, sizeof(elf_sym_t)); in llext_link()
384 name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym.st_name); in llext_link()
426 } else if ((sym.st_shndx < ldr->hdr.e_shnum) && in llext_link()
447 link_addr = (uintptr_t)llext_loaded_sect_ptr(ldr, ext, in llext_link()
486 void *base = llext_peek(ldr, shdr->sh_offset); in llext_link()