A program running on an embedded system is usually designed
never to exit — it runs until the system is powered down.
The C and C++ standards leave it unspecified
as to whether exit
is called at program
termination. If the program never exits, then there is no
reason to include exit
, facilities to run
functions registered with atexit
, or global
destructors. This code would never be run and would therefore
just waste space in the application.
The CS3 startup code, by itself, does not cause
exit
to be present in the application. It
dynamically checks whether exit
is present,
and only calls it if it is. If you require
exit
to be present, either refer to it
within your application, or add -Wl,-u,exit
to
the linking command line.
Similarly, code to register global destructors is only invoked
when atexit
is already in the executable;
CS3, by itself, does not cause atexit
to be
present. If you require atexit
, either
refer to it within your application, or add
-Wl,-u,atexit
to the linking command line.