You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/12 04:29:14 UTC

(nuttx) 01/20: modlib:Modify modlib loading DYN elf file conditions

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit ae4538646bac15779669d3bb8bd1d312002cc4d6
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Wed Jun 26 16:55:42 2024 +0800

    modlib:Modify modlib loading DYN elf file conditions
    
    Signed-off-by: anjiahao <an...@xiaomi.com>
---
 libs/libc/modlib/modlib_load.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/libc/modlib/modlib_load.c b/libs/libc/modlib/modlib_load.c
index 0d36f97ccf..c34f258471 100644
--- a/libs/libc/modlib/modlib_load.c
+++ b/libs/libc/modlib/modlib_load.c
@@ -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++)
         {