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 2022/05/23 06:49:09 UTC

[GitHub] [incubator-nuttx] pussuw commented on a diff in pull request #6313: arch: risc-v: Fix crt0.c if CONFIG_HAVE_CXX is not set

pussuw commented on code in PR #6313:
URL: https://github.com/apache/incubator-nuttx/pull/6313#discussion_r879077657


##########
arch/risc-v/src/common/crt0.c:
##########
@@ -169,13 +169,15 @@ void _start(int argc, char *argv[])
 
   ARCH_DATA_RESERVE->ar_sigtramp = (addrenv_sigtramp_t)sig_trampoline;
 
+#ifdef CONFIG_HAVE_CXX
   /* Call C++ constructors */
 
   exec_ctors();
 
   /* Setup so that C++ destructors called on task exit */
 
   atexit(exec_dtors);

Review Comment:
   The problem is call to this. The fix IMO is not to mask this functionality but to fix atexit(), which is done here:
   https://github.com/apache/incubator-nuttx/pull/6197
   
   The reason for the crash, is that atexit runs the dtors in supervisor mode, and the MMU does not allow this.



-- 
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: commits-unsubscribe@nuttx.apache.org

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