Browse Source

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>
pull/81485/head
Guennadi Liakhovetski 8 months ago committed by Anas Nashif
parent
commit
ec02b815a7
  1. 11
      subsys/llext/llext_load.c

11
subsys/llext/llext_load.c

@ -587,6 +587,12 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext,
elf_shdr_t *shdr = ldr->sect_hdrs + shndx; elf_shdr_t *shdr = ldr->sect_hdrs + shndx;
uintptr_t section_addr = shdr->sh_addr; uintptr_t section_addr = shdr->sh_addr;
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; const void *base;
base = llext_loaded_sect_ptr(ldr, ext, shndx); base = llext_loaded_sect_ptr(ldr, ext, shndx);
@ -604,11 +610,6 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext,
} }
} }
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 {
sym_tab->syms[j].addr = (uint8_t *)base + sym.st_value - sym_tab->syms[j].addr = (uint8_t *)base + sym.st_value -
(ldr->hdr.e_type == ET_REL ? 0 : section_addr); (ldr->hdr.e_type == ET_REL ? 0 : section_addr);
} }

Loading…
Cancel
Save