GCC 3.2.2 (OAR build) question

Chris Johns chrisj at rtems.org
Tue Feb 28 12:01:16 UTC 2006


leonp at plris.com wrote:
> Hello, all.
> 
> Please, forgive me for 99% off-topic question, but as I use not "native" 
> gcc...:-))
> 
> I have the following very strange gcc problem - in the file a.cpp there is 
> some cCL class declaration and also global object CL is created. The 
> constructor of the class inserts 'this' pointer into a global array pCLs. 
> This array is declared system wide and all usage of the object therefore is 
> done using this pointer and the object is never referenced directly.
> 
> Now, when everything is linked in - the 'a' object module is never used!
> I checked the a.o content - there is an object CL (record of type 000B) and 
> everything looks OK, but the executable has no a.o at all in its map file 
> (and nothing works obviously).
> 
> Just for experiment, I added the following into a.cpp: 'volatile int 
> x;' (global var declaration) and 'extern volatile int x' into main.cpp.
> Magic! Now everything is OK - CL constructor was added into CTORS, all 
> functions appeared in the map file.
> 
> Can someone help me to understand where the first variant is incorrect?
> Many many thanks ahead.

Is the object file in a library ?

If so it will not be linked in. You will need to force the object file 
in the executable.

Regards
Chris



More information about the users mailing list