9.6 Precautions
• When the linker is executed, an error message as shown below may appear.
ld: test.elf: Not enough room for program header, try linking with -N
This error occurs in the alignment check for the data segment. The linker's alignment check can be disabled with
the -N option, so normally specify the -N option when invoking the linker. (The make file generated by the IDE
contains the linker command line with the -N option.)
• The object file names are case-sensitive. It is necessary to specify the exact same file name in the ld command
line and the linker script file. If the upper/lower case is different, ld considers them as two different files.
Example:
Command line
ld -T sample.lds -o sample.elf prg1.o prg2.o
Linker script file (sample.lds)
:
.text 0xc00000:
{
PRG1.o (.text) ← PRG1.o must be changed to prg1.o.
prg2.o (.text)
}
:
• Linking files of different sizes with the same function name displays the following message.
Warning: size of symbol 'AAA' changed from BBB to CCC in DDD.o
Duplicate function name
AAA:
BBB, CCC: Size of function
File name to be linked
DDD:
If file sizes match, this message is not displayed. When linking files, be careful to avoid specifying the same
function name. Take particular care to avoid assigning a function name already included in the library file (*.a).
• If "*" and individual object file specification coexist in a linker script file as in the example below, the files
may not link correctly. If object files do not need to be specified individually, use only "*". With this exception,
specify object files individually.
Example:
.text 0x00600000 :
{
*(.text) ;
}
.text2 :
{
main.o(.text) ;
}
• Linking two or more library files (*.a) that contain the same function does not cause an error (no double linkage
performed).
Note that an error occurs when two or more object files (*.o) that contain the same function are linked.
• If the located address, which is specified by a variable or the result of a calculation with a variable, is higher than
the 24-bit limit (0xffffff) or lower than 0x0, the address bits that exceed 24 bits are masked with 0 and no error
occurs.
Example: xadd.a %r0,symbol-5
If the symbol is located at address 0, the specified absolute address is 0 - 5 = 0xfffffb (-5). Therefore, this
code will be assembled as "xadd.a %r0,0xfffffb".
S5U1C17001C ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
EPSOn
9 linkEr
9
Linker
9-7
Need help?
Do you have a question about the S5U1C17001C and is the answer not in the manual?