I ran into this problem. Here are the conditions that seem to reliably create the problem:
- g ++ without the standard C / C ++ library:
-nostdlib (typical small built-in script). - Defining a statically assigned standard library object; for my case -
std::vector . It used to be std::array statically distributed without any problems. Apparently, not all std:: statically allocated objects will cause a problem. - Please note that I do not use a shared library of any type.
- uses the cross-compiler GCC / ARM .
If this is your use case, just add a command line parameter to your compilation / link command line: -fno-use-cxa-atexit
Here is a very good reference to __ using dso_handle as a descriptor for a dynamic shared object .
There is a typo on the page, but I have no idea who to contact to confirm:
After calling the destructors of the object constructor, GCC automatically calls the function ...
I think this should read "When all destructors called GCC calls a function" ...
One way to confirm this is to implement the __cxa_atexit function as mentioned, and then perform one step of the program and see where it is called. I will try it the other day, but not now.
source share