[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GCC 3.2.2 (OAR build) question
- Date: Tue, 28 Feb 2006 23:01:16 +1100
- From: chrisj at rtems.org (Chris Johns)
- Subject: GCC 3.2.2 (OAR build) question
leonp at plris.com wrote:
> Hello, all.
> Please, forgive me for 99% off-topic question, but as I use not "native"
> 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.