LLEXT: (cosmetic) reduce the scope of a variable
Move a variable calculation inside the block, where it is actually used. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
835cbad6cc
commit
ec02b815a7
1 changed files with 17 additions and 16 deletions
|
|
@ -587,28 +587,29 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext,
|
|||
|
||||
elf_shdr_t *shdr = ldr->sect_hdrs + shndx;
|
||||
uintptr_t section_addr = shdr->sh_addr;
|
||||
const void *base;
|
||||
|
||||
base = llext_loaded_sect_ptr(ldr, ext, shndx);
|
||||
if (!base) {
|
||||
/* If the section is not mapped, try to peek.
|
||||
* Be noisy about it, since this is addressing
|
||||
* data that was missed by llext_map_sections.
|
||||
*/
|
||||
base = llext_peek(ldr, shdr->sh_offset);
|
||||
if (base) {
|
||||
LOG_DBG("section %d peeked at %p", shndx, base);
|
||||
} else {
|
||||
LOG_ERR("No data for section %d", shndx);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
if (ldr_parm->pre_located &&
|
||||
(!ldr_parm->section_detached || !ldr_parm->section_detached(shdr))) {
|
||||
sym_tab->syms[j].addr = (uint8_t *)sym.st_value +
|
||||
(ldr->hdr.e_type == ET_REL ? section_addr : 0);
|
||||
} else {
|
||||
const void *base;
|
||||
|
||||
base = llext_loaded_sect_ptr(ldr, ext, shndx);
|
||||
if (!base) {
|
||||
/* If the section is not mapped, try to peek.
|
||||
* Be noisy about it, since this is addressing
|
||||
* data that was missed by llext_map_sections.
|
||||
*/
|
||||
base = llext_peek(ldr, shdr->sh_offset);
|
||||
if (base) {
|
||||
LOG_DBG("section %d peeked at %p", shndx, base);
|
||||
} else {
|
||||
LOG_ERR("No data for section %d", shndx);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
sym_tab->syms[j].addr = (uint8_t *)base + sym.st_value -
|
||||
(ldr->hdr.e_type == ET_REL ? 0 : section_addr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue