llext: xtensa: (cosmetic) simplify a calculation

To obtain a section header reference we don't need to calculate its
location in the ELF image, we already have a pointer to all section
headers, just use them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2024-12-13 12:35:56 +01:00 committed by Benjamin Cabé
parent 024f43b1f0
commit 92287c4e8e

View file

@ -123,8 +123,7 @@ void arch_elf_relocate_local(struct llext_loader *ldr, struct llext *ext, const
uintptr_t sh_addr;
if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) {
elf_shdr_t *shdr = llext_peek(ldr, ldr->hdr.e_shoff +
sym->st_shndx * ldr->hdr.e_shentsize);
elf_shdr_t *shdr = ext->sect_hdrs + sym->st_shndx;
/* shdr->sh_addr is NULL when not built for a specific address */
sh_addr = shdr->sh_addr &&