modlib/dlfcn:unify same code

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2024-04-29 19:59:34 +08:00
committed by Xiang Xiao
parent fc1aefbeb3
commit 29e4e71167
18 changed files with 860 additions and 1052 deletions

View File

@@ -162,29 +162,30 @@ int unload_module(FAR struct binary_s *binp)
}
#ifdef CONFIG_ARCH_USE_SEPARATED_SECTION
for (i = 0; binp->sectalloc[i] != NULL && i < binp->nsect; i++)
{
# ifdef CONFIG_ARCH_USE_TEXT_HEAP
if (up_textheap_heapmember(binp->sectalloc[i]))
for (i = 0; binp->sectalloc[i] != NULL && i < binp->nsect; i++)
{
up_textheap_free(binp->sectalloc[i]);
continue;
}
# ifdef CONFIG_ARCH_USE_TEXT_HEAP
if (up_textheap_heapmember(binp->sectalloc[i]))
{
up_textheap_free(binp->sectalloc[i]);
}
else
# endif
# ifdef CONFIG_ARCH_USE_DATA_HEAP
if (up_dataheap_heapmember(binp->sectalloc[i]))
{
up_dataheap_free(binp->sectalloc[i]);
continue;
}
if (up_dataheap_heapmember(binp->sectalloc[i]))
{
up_dataheap_free(binp->sectalloc[i]);
}
else
# endif
{
kumm_free(binp->sectalloc[i]);
}
}
kumm_free(binp->sectalloc[i]);
}
binp->alloc[0] = NULL;
binp->alloc[1] = NULL;
binp->alloc[0] = NULL;
binp->alloc[1] = NULL;
#endif
/* Free allocated address spaces */

View File

@@ -270,15 +270,6 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
{
FAR Elf_Shdr *shdr = &loadinfo->shdr[i];
/* SHF_ALLOC indicates that the section requires memory during
* execution.
*/
if ((shdr->sh_flags & SHF_ALLOC) == 0)
{
continue;
}
#ifdef CONFIG_ARCH_USE_SEPARATED_SECTION
if (loadinfo->ehdr.e_type == ET_REL)
{