Forum Discussion
Altera_Forum
Honored Contributor
21 years agoC++ global constructors not being called
We are using version 1.0.0 build 393 of the Nios II IDE and bringing up an application under uClinux. The problem du jour is that it appears the constructors for globally defined C++ objects are not...
Altera_Forum
Honored Contributor
21 years agoThanks, Scott, for the reminder about the linker script. It indeed rolled the .ctors and .dtors sections into .text but didn't provide a label by which to access them, so I've added that and put in a function to run through and call the constructor function pointers in sequence. We've done that on past projects where we provided the entire runtime support. I haven't found anywhere in the documentation that says we need to do that here, but there it is. So now I just need to figure out how to get rid of the 4 bytes of extraneous garbage libpthread.a has in a .ctors section (in pthread.o; pthread is a C library, isn't it??) which my function dutifully calls, sending it to Never Never Land.