summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorlaidene <[email protected]>2025-12-15 14:04:50 +0800
committerR b b666 <[email protected]>2025-12-18 13:57:07 +0800
commitd09135f76b1de9c170c6ccd69cd7aa5bc86957b1 (patch)
tree376cda60697056b94cf1a717e82fc06d6224eb3b /components/libc
parentdf990e91d3572a6681ec763ca67ef49f5feace45 (diff)
[components][libc][posix][libdl] Optimization: Redundant calculations in a for loop
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/posix/libdl/dlelf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/libc/posix/libdl/dlelf.c b/components/libc/posix/libdl/dlelf.c
index 4fc89e5aaa..24d82d73b4 100644
--- a/components/libc/posix/libdl/dlelf.c
+++ b/components/libc/posix/libdl/dlelf.c
@@ -209,12 +209,12 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt
}
/* construct module symbol table */
+ rt_uint8_t *shstrab;
+ shstrab = (rt_uint8_t *)module_ptr +
+ shdr[elf_module->e_shstrndx].sh_offset;
for (index = 0; index < elf_module->e_shnum; index ++)
{
/* find .dynsym section */
- rt_uint8_t *shstrab;
- shstrab = (rt_uint8_t *)module_ptr +
- shdr[elf_module->e_shstrndx].sh_offset;
if (rt_strcmp((const char *)(shstrab + shdr[index].sh_name), ELF_DYNSYM) == 0)
break;
}