C++ problems

John Tilp tilp at ISI.EDU
Thu Mar 1 17:50:37 UTC 2007

Leon Pollak wrote:
> On Wednesday 28 February 2007, John Tilp wrote:
>> Leon,
>> Confirm that gcc is being invoked with -specs bsp_specs and the -qrtems
>> option and that your bsp's startfile spec in "bsp_specs" file includes
>> crtbegin.o
>> For more ideas see:
>> http://www.rtems.org/wiki/index.php/Using_C_Plus_Plus
>> http://www.rtems.com/ml/rtems-users/2005/february/msg00029.html
> Thank you very much, John. 
> I see now the problem and I hope I understand in general what should be done.
> But I am a bit doubting, because:
> 1. I scanned all the powerpc bsps and was not able to find one that follows 
> the recommendations you pointed out, except ../shared/start/start.S. I also 
> understand that this ../shared/start/start.S is for example purpose only. So, 
> where I can find some working example of this story to check that my 
> understanding is correct?

It's safe to assume that all the test and sample code can be built and 
run successfully. I would look at any of the ppc bsps that have had 
recent updates.

Review your files libbsp/powerpc/*your_bsp*/bsp_specs and 
libbsp/powerpc/*your_bsp*/startup/linkcmds and compare them to the ones 
in the working bsps

> 2. The cdtest seems never worked as it has global constructors and has no 
> traces of the directions you mentioned. How can it be?

You say here "it has global constructors" but in your first post you 
said "CTORS are not called at all (I mean global constructors)."

When you disassemble your cdtest.exe do you find _init() in the .init 
section? Does it have a bl to __do_global_ctors_aux? If not then 
something went wrong in the linking process. Note the last line of the 
Wiki page: "Your gcc configuration, linkcmds and bsp_specs must harmonize"

> So, if you can give me a link of a code example treating theissue, this will 
> be really great.
> Best Regards

More information about the users mailing list