Tag Archives: mlongcall

VxWorks & Qt – Relocation value does not fit in 24 bits

Problem

When loading Qt with VxWorks with a PowerPC CPU the following error messages can appear:

Relocation value does not fit in 24 bits (offset: 0x19c948, type: 10)
Relocation value does not fit in 24 bits (offset: 0x19ca20, type: 10)
Relocation value does not fit in 24 bits (offset: 0x19d91c, type: 10)
Cannot load library /tffs0/libQtCore.so

This happens when Qt, VxWorks or an application is not compiled with the -mlongcall flag and when the libraries/files that are loaded into memory comes to far away from the VxWorks kernel. This only affects computers with more than 32 MB of RAM. The PowerPC relative branch instruction is limited to jumps between +/- 32MB (24 bits = +/- 4M instructions, 4 bytes per instruction = +/- 32MB) of the current instruction. If an instruction cannot be resolved within a 24 bit range, it will print out the error above.

Solution

Compile the software with the -mlongcall flag. The compiler flags are located in the mkspecs\unsupported\vxworks-ppc-g++\qmake.conf file. No Qt version so far has the -mlongcall flag, so it must be added manually. It’s important that VxWorks (including the stdlib), Qt and your application is compiled with -mlongcall.

If VxWorks’ stdlib is not compiled with -mlongcall and the source code is not available, disable it with the -nostdlib flag. This means that you cannot use the stdlib API. Instead replace the stdlib functions with the corresponding functions in Qt.

More information about this will soon be posted (e.g. a working qmake.conf file for VxWorks).