7 liBrary
7.1.2 Precautions to Be Taken When adding a library
There is a dependency relationship between the libraries.
When writing to a *.mak or *.lds file, specify the libraries in the sequence below.
1. Additional libraries
2. libc.a
3. libgcc.a ( libgccM.a / libgccMD.a )
4. libc.a
(Duplication with 2 does not cause an error. Both files can be referenced normally.)
The object file (or library) can reference only the files present after it, in the order in which they are passed to the
linker. If the added library is specified last, none of the external libraries can be used in the added library. Because
the basic functions such as float and double arithmetic and the ANSI library cannot be used, always make sure
the added library is located before the emulation and ANSI libraries.
Example:
1. NG
ld.exe -T withmylib.lds -o withmylib.elf boot.o libc.a libgcc.a libc.a mylib.a
If mylib.a is using the emulation and ANSI libraries, an error should always occur during linking.
2. OK
ld.exe -T withmylib.lds -o withmylib.elf boot.o mylib.a libc.a libgcc.a libc.a
No errors should occur during linking, allowing mylib.a to use the emulation and ANSI libraries normally.
If the added libraries have a dependent relationship, make sure the basic library is located last.
Example:
lib1.a calls only the emulation and ANSI libraries
lib2.a calls lib1.a in addition to the emulation and ANSI libraries
lib3.a calls lib1.a and lib2.a in addition to the emulation and ANSI libraries
ld.exe -T withmylib.lds -o withmylib.elf boot.o lib3.a lib2.a lib1.a libc.a libgcc.a
libc.a
Refer to Section 5.7.5, "Setting Linker Options", for how to add libraries using the IDE.
7-2
EPSOn
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
S5U1C17001C ManUal
Need help?
Do you have a question about the S5U1C17001C and is the answer not in the manual?