LLEXT: no repeated linking with inline relocations
When linking and relocations are performed on the ELF object itself with no copying, also global binding linking can break references. Disable linking globally for such cases. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
827909b7b9
commit
cbb6199e67
2 changed files with 8 additions and 9 deletions
|
|
@ -259,10 +259,7 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr
|
|||
arch_elf_relocate_global(ldr, ext, &rela, &sym, got_offset, link_addr);
|
||||
break;
|
||||
case STB_LOCAL:
|
||||
if (ldr_parm->relocate_local) {
|
||||
arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset,
|
||||
ldr_parm);
|
||||
}
|
||||
arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset, ldr_parm);
|
||||
}
|
||||
|
||||
LOG_DBG("symbol %s offset %#zx r-offset %#zx .text offset %#zx stb %u",
|
||||
|
|
|
|||
|
|
@ -712,11 +712,13 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext,
|
|||
goto out;
|
||||
}
|
||||
|
||||
LOG_DBG("Linking ELF...");
|
||||
ret = llext_link(ldr, ext, ldr_parm);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("Failed to link, ret %d", ret);
|
||||
goto out;
|
||||
if (ldr_parm->relocate_local) {
|
||||
LOG_DBG("Linking ELF...");
|
||||
ret = llext_link(ldr, ext, ldr_parm);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("Failed to link, ret %d", ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = llext_export_symbols(ldr, ext);
|
||||
|
|
|
|||
Loading…
Reference in a new issue