moving from gcc 2.95 to 4.4.2

I have software generated using the IBM Rhapsody code tool (v7.4).

The target was QNX 6.3.2 for the i386 architecture. This builds using qcc 2.95

We are now moving to QNX 6.5 (still i386). Rebuilding using the version of qcc supplied (4.4.2?). Everything builds OK, but there are problems when I run the software.

The processor card communicates over VME by memory mapping the interface. The card is running QNX 6.5. When I run the code build for 6.3.2 (i.e. qcc 2.95) this communication appears to work. When I run the code built for 6.5 (qcc 4.4.2) this communciation appears unreliable. Its not an all or nothing affair, there seems to be no pattern to what works on the interface or not.

I’ve been using objdump and readelf to compare the executable, and I’ve found the manuals for the different versions of gcc to try and find out what has changed. I’m new to examining executables at this level of detail and would appreciate any help to try and determine what the newer compiler is doing differently that could cause this.

Thanks

Steve

The compiler is quite different and the generated code is probably different. I personnaly don’t use 4.4.2 because of issue with usage of xmm registers on miss aligned data. I stick with 4.3.3 ( 6.4.1 ) for now.

Maybe the difference is how variable/structures are aligned or packed. Print the size of what ever structure you map to the VME memory and compare the difference.

Steve,

When you say it doesn’t work what exactly do you mean.

Are you getting crashes/system hangs or simply strange results?

In addition to what Mario said, I’d make sure you have the highest level of warnings turned on in both 2.95 and 4.4.2 and then eliminate any warning in the code.

I know that when we moved a large project from 2.95 to 3.3.5 in QNX 6.3.2 that some working code stopped working (even with no compiler warnings at the highest levels) and sometimes crashed. Eventually with the help of the debugger and some time I tracked down what were all legitimate errors (uninitialized variables, walking off the end of arrays) that somehow under 2.9.5 weren’t crashing/causing problems. I chalked it up to how 2.9.5 aligned memory/initialized variables/managed the stack compared to how 3.3.5 does it, fixed them and the problems went away.

Tim

Thanks for the responses.

The processor reads and writes data to another card on the VME bus, controlling it via a number of registers. The interface is memory mapped and access is done directly with a pointer, which is offset to access the correct register on the other card. There are no structures involved.

By not working I mean that the program runs, but it seems to not read and write to the other card properly all the time. This is evidenced by what appears to missing elements of the initialisation of the other card at program startup and during operation we might go into mode X which sets the other card up in a particular way, going into mode X may set up 3 things on the other card, for example, but we see maybe only 2 of then are happening, we also appear to have reads failing, e.g. when we read from the other card over the VME but we get 0 back from the pointer to the mapped memory.

I’ve just rebuilt the executable with GCC 3.3.5 which also comes with QNX6.3.2 and this evidenced the same problem as using the later compiler .

I’m guessing I will have to try the same and switch on all the warnings, see what pops up and start from there.

I believe you are using a VME driver( probably GE Fanuc one ). Probably it has been compiled with some older compiler version.
You should check with the vendor about the problem.

Do you link in libraries other than QNX-supplied ones? They have to be compiled with the new compiler, too.

The VME driver is up to date, provided by the processor card supplier. I’m using the same VME driver in both cases.

There are rhapsody framework libraries but I have version rebuilt with the appropriate compilers, part from that it’s just the QNX ones.