Problem Solution
PowerPC Embedded Application Binary Interface, Version 1.0 System V Application Binary Interface, PowerPC Processor Supplement (Sept. 1995)
Reproduced failure on mv1604 board 64MB of RAM while loading an object module with external function references.
The error message above is known to appear while loading modules with external function references on PowerPC targets having more than 32MB of RAM.
The limitation is due to how direct function calls are implemented for the EABI (Embedded Application Binary Interface). The EABI is a standard we follow for the PowerPC architecture and it may be downloaded from the IBM web page. The EABI is based upon the SVR4 ABI, which suggests that all direct function calls be made with the 'bl' instruction. Because the addressing range of the 'bl' instruction is /- 32MB, all direct function calls referencing functions defined more than 32MB away will fail with the above relocation error.
Calling functions indirectly (i.e. through a function pointer) removes the 32MB limitation as 32-bit absolute addressing is used in place of 26-bit PC relative addressing, thus giving you access to all routines in the 4GB address space. Asking people to rewrite their code to make all external function calls through pointers is not very practical and may not be necessary in all cases.
The following can be used to work around this problem.
1) Use the -mlongcall flag when compiling your code or use the "#pragma longcall" directive to suggest certain function calls be made through a function pointer.
If using versions of Tornado 1.0.x there is a patch to use this workaround. The patch is SPR 22767. Later versions of Tornado do not require any patch.
"#pragma longcall" gives a suggestion to the compiler to call a set of functions through a function pointer (using 32-bit absolute addresses). This should be used primarily for external functions, as local functions are less likely to reside far from your module.
2) If your code does not require constant loading and unloading of object modules at runtime, you can also set LOCAL_MEM_SIZE to 32MB and set aside the rest of memory as USER_RESERVED_MEM (i.e. user reserved memory) and use memAddToPool to add the rest after your object modules have been loaded. No further object modules should be loaded after the memAddToPool has been performed.
Note: Setting aside user reserved memory is outlined in detail in Wind Tech Note 41 (WTN41).