xiaoxiang781216 commented on code in PR #19938:
URL: https://github.com/apache/nuttx/pull/19938#discussion_r3843414912
##########
binfmt/elf.c:
##########
@@ -286,6 +290,28 @@ static int elf_loadbinary(FAR struct binary_s *binp,
}
#endif
+#ifdef CONFIG_BINFMT_CONSTRUCTORS
+ /* Run the constructors, as libelf_insert() does for dlopen(). A module
+ * with a PIC base is skipped: this task holds its own base, not the
+ * module's.
+ */
+
+ if (binp->picbase == NULL)
+ {
+ array = (FAR void (**)(void))loadinfo.preiarr;
Review Comment:
elf_loadbinary runs inside the parent process, executing constructors here
will generate the strange behavior. For example, the opened file handles belong
the parent process, the child process can't accept them at all.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]