xiaoxiang781216 commented on code in PR #20048:
URL: https://github.com/apache/nuttx/pull/20048#discussion_r3917772141
##########
CMakeLists.txt:
##########
@@ -516,6 +516,14 @@ if(EXISTS
${NUTTX_DIR}/arch/${CONFIG_ARCH}/src/cmake/elf.cmake)
include(${NUTTX_DIR}/arch/${CONFIG_ARCH}/src/cmake/elf.cmake)
endif()
+# The default registers each static object's destructor with __cxa_atexit(dtor,
+# obj, &__dso_handle), and __dso_handle comes from crtbegin, which a module
does
+# not link. Turning it off also puts the destructors in .fini_array, which is
+# where the loader looks for them when the module is unloaded. The option is
+# for C++ alone, so the generator expression keeps it off the C compiles.
+
+nuttx_elf_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-use-cxa-atexit>)
Review Comment:
should we move to toolchain specific cmake file
--
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]