You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/04/14 09:55:19 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #3546: modlib: Implement sh_addralign handling

xiaoxiang781216 commented on a change in pull request #3546:
URL: https://github.com/apache/incubator-nuttx/pull/3546#discussion_r613105669



##########
File path: libs/libc/modlib/modlib_load.c
##########
@@ -271,16 +293,29 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
         }
     }
 #else
-  loadinfo->textalloc = (uintptr_t)lib_malloc(loadinfo->textsize +

Review comment:
       Why go through the different patch with or without CONFIG_ARCH_USE_MODULE_TEXT?

##########
File path: libs/libc/modlib/modlib_load.c
##########
@@ -271,16 +293,29 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
         }
     }
 #else
-  loadinfo->textalloc = (uintptr_t)lib_malloc(loadinfo->textsize +
-                                              loadinfo->datasize);
+  align = loadinfo->textalign;
+  if (align < loadinfo->dataalign)
+    {
+      align = loadinfo->dataalign;
+    }
+
+  text_size = loadinfo->textsize;
+  if (loadinfo->datasize > 0)
+    {
+      text_size = _ALIGN_UP(text_size, loadinfo->dataalign);
+    }
+
+  loadinfo->textalloc = (uintptr_t)lib_memalign(align,

Review comment:
       Is it good to combine text and data in one allocation? Since it require more large consecutive memory.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org