modlib:Modify modlib loading DYN elf file conditions

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-06-26 16:55:42 +08:00 • committed by Xiang Xiao
parent 24b0fa0072
commit ae4538646b

View file

@ -140,7 +140,7 @@ static void modlib_elfsize(FAR struct mod_loadinfo_s *loadinfo)
* (and zero) memory for the each section.
*/
if (loadinfo->ehdr.e_phnum > 0)
if (loadinfo->ehdr.e_type == ET_DYN)
{
for (i = 0; i < loadinfo->ehdr.e_phnum; i++)
{
@ -251,7 +251,7 @@ static inline int modlib_loadfile(FAR struct mod_loadinfo_s *loadinfo)
binfo("Loading sections - text: %p.%zx data: %p.%zx\n",
text, loadinfo->textsize, data, loadinfo->datasize);
if (loadinfo->ehdr.e_phnum > 0)
if (loadinfo->ehdr.e_type == ET_DYN)
{
for (i = 0; i < loadinfo->ehdr.e_phnum; i++)
{