llext: fix symbol address calculation for ET_DYN
Symbopl tables of ELF objects of type ET_REL contain offsets instead of addresses as for ET_DYN. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
21cea07b8c
commit
e0ea44cbfa
1 changed files with 4 additions and 2 deletions
|
@ -433,8 +433,10 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext)
|
|||
__ASSERT(j <= sym_tab->sym_cnt, "Miscalculated symbol number %u\n", j);
|
||||
|
||||
sym_tab->syms[j].name = name;
|
||||
sym_tab->syms[j].addr = (void *)((uintptr_t)ext->mem[mem]
|
||||
+ sym.st_value);
|
||||
sym_tab->syms[j].addr = (void *)((uintptr_t)ext->mem[mem] +
|
||||
sym.st_value -
|
||||
(ldr->hdr.e_type == ET_REL ? 0 :
|
||||
ldr->sects[sect_idx].sh_addr));
|
||||
LOG_DBG("function symbol %d name %s addr %p",
|
||||
j, name, sym_tab->syms[j].addr);
|
||||
j++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue