How to Use Linker Error Messages
4-2
4.1
How to Use Linker Error Messages
When you try to call a function which, due to how you linked your application,
is too far away from a call site to be reached with the normal PC-relative branch
instruction, you will see the following linker error message:
>> PC-relative displacement overflow. Located in file.obj,
section .text, SPC offset 000000bc
This message means that in the named object file in that particular section, is
a PC-relative branch instruction trying to reach a call destination that is too far
away. The SPC offset is the section program counter (SPC) offset within that
section where the branch occurs. For C code, the section name will be .text
(unless a CODE_SECTION pragma is in effect).
You might also see this message in connection with an MVK instruction:
>> relocation value truncated at 0xa4 in section .text,
file file.obj
Or, an MVK can be the source of this message:
>> Signed 16-bit relocation out of range, value truncated.
Located in file.obj, section .text, SPC offset 000000a4
4.1.1
How to Find The Problem
These messages are similar. The file is file.obj, the section is .text, and the
SPC offset is 0xa4. If this happens to you when you are linking C code, here
is what you do to find the problem:
-
Recompile the C source file as you did before but include –s –al in the op-
tions list
cl6x <other options> –s –al file.c
This will give you C interlisted in the assembly output and create an assembler
listing file with the extension .lst.
-
Edit the resulting .lst file, in this case file.lst.
-
Each line in the assembly listing has several fields. For a full description
of those fields see section 3.10 of the
TMS320C6000 Assembly Language
Tools User’s Guide. The field you are interested in here is the second one,
the section program counter (SPC) field. Find the line with the same SPC
field as the SPC offset given in the linker error message. It will look like:
245 000000bc 0FFFEC10! B .S1 _atoi ; |56|