Displacement value does not match 24 bits

I tried loading the code file into memory using the loadmodule vxWorks function, and this gave me an error:

Relocation value does not fit in 24 bits 

I tried adding the -mlongcall flag to my compiler, but it does not work.

+4
source share
2 answers

I saw this error before working in the PowerPC architecture. Assuming that you are working in a similar environment, the problem should specifically concern the amount of memory in the system and the range of the relative branch command.

Argonne National Laboratories has a web page detailing their experience with the same problem . The following excerpt explains the problem with relative addressing:

The relative PowerPC branch command is limited to jumps between +/- 32 MB of the current command (24 bits = +/- 4 M instructions, 4 bytes per command = +/- 32 MB). Unfortunately, the vxWorks kernel gets to the bottom of RAM, but it loads all the application code at the top end. If they are separated by more than 32 MB (if you have 64 MB or more on board), then when he tries to download the application, encode those calls that use these relative branch instructions. VxWorks procedures cannot be resolved for 24 bits, and the bootloader prints the message you see.

The proposed fix for this problem, both in Argonne National Labs, is to recompile loaded modules with the -mlongcall flag -mlongcall .

The initial question states that this flag was not a problem for your problem. The gnu flag is set, but there is no additional information for your compiler. Given that I can only suggest checking your compiler documentation and -mlongcall sure the -mlongcall flag -mlongcall valid.

Assuming the flag is supported, this could be caused by a linked library that itself was not compiled with the -mlongcall flag. An article in ComplexIT describes a similar problem, also in PowerPC architecture, using QT. To solve this problem, a rebuild of all libraries, including QT, was required.

+3
source

Make sure your compiler is configured to GNU for your active build if you want to use -mlongcall . Remember that WindRiver also provides the Diab compiler, which is their own compiler. If you want to use the Diab compiler, the equivalent flag for this compiler:

-Xcode-absolute-far

If you use Workbench, you can see which compiler you are using (and possibly change it if you want) by right-clicking on your project in the Project Explorer sub-screen, then select

Properties-> Assembly Properties-> Assembly Support and Specifications.

In this dialog box, you'll see (usually at the bottom) a drop-down menu called Active Build Spec. Choose the desired combination of architecture and compiler.

If you do not find the required combination of compiler architecture, you most likely did not select it when creating the project, or it did not come with your purchased pkg VxWorks.

+3
source

All Articles