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



##########
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:
       i dunno. i guess it has both of pros and cons.
   
   iirc, the original code was doing a single allocation and i changed it for 
CONFIG_ARCH_USE_MODULE_TEXT case.
   




-- 
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:
us...@infra.apache.org


Reply via email to