From 92287c4e8eab68fe4c214bed9a44cbcec2672d96 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 13 Dec 2024 12:35:56 +0100 Subject: [PATCH] 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 --- arch/xtensa/core/elf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/xtensa/core/elf.c b/arch/xtensa/core/elf.c index 84d80127411..3a7a4947ffb 100644 --- a/arch/xtensa/core/elf.c +++ b/arch/xtensa/core/elf.c @@ -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 &&