[En-Nut-Discussion] CM3: C++ startup and linker infrastructure

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Dec 12 11:33:44 CET 2016


as Krzysztof pointed out, for CM3 code and linker commands where missing for
C++ contructors. cppdemo was changed to show this behaviour. However this
results in normal C programs to use 64 bytes more flash. For most devices
this is not important, but a solution that would link __libc_init_array()
only when needed would be welcome.

One possibility would be, that we compile nutinit.c in the user Makefile with
the appropriate compiler and the relevant code guarded with "#if
defined(__cplusplus)". At the moment, we link with nutinit.o.

B.t.w. what was the reason to link against nutinit.o and not put nutinit
into the arch-library?

Another possibility is a configuartor option that drops __libc_init_array()
on request. But this makes the compiled libraries only usefull for C.

Other ideas?

@Krzysztof: I dropped __dso_handle for the moment. In my understanding,
__dso_handle seems to related to destructors after main, something that is
not needed in an embedded program. cppdemo compiles and runs fine w/o
__dso_handle. If __dso_handle is still needed in some situations, cppdemo
should be extended to show that requirement.


Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------

More information about the En-Nut-Discussion mailing list