Skip to content

Commit

Permalink
modlib:move Exception section logic to modlib
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 committed Oct 4, 2024
1 parent 2d2b6c8 commit 0f17625
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libs/libc/modlib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,14 @@ config MODLIB_LOADTO_LMA
relocate .data section to the final address(VMA) and zero .bss section
by self.

config MODLIB_EXIDX_SECTNAME
string "ELF Section Name for Exception Index"
default ".ARM.exidx"
depends on CXX_EXCEPTION && ARCH_ARM
---help---
Set the name string for the exception index section on the ELF modules to
be loaded by the ELF binary loader.

This is needed to support exception handling on loadable ELF modules.

endmenu # Module library configuration
14 changes: 14 additions & 0 deletions libs/libc/modlib/modlib_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,20 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
goto errout_with_buffers;
}

#ifdef CONFIG_MODLIB_EXIDX_SECTNAME
ret = modlib_findsection(loadinfo, CONFIG_MODLIB_EXIDX_SECTNAME);
if (ret < 0)
{
binfo("modlib_findsection: Exception Index section not found: %d\n",
ret);
}
else
{
up_init_exidx(loadinfo->shdr[ret].sh_addr,
loadinfo->shdr[ret].sh_size);
}
#endif

return OK;

/* Error exits */
Expand Down

0 comments on commit 0f17625

Please sign in to comment.