Getting Started with LEON Ada: Ada 95 Compilation System for Spacecraft Microprocessors | ||
---|---|---|
Prev | Chapter 1. Basic Techniques | Next |
You have written five lines of Ada, yet the size command says your program is over 17K bytes. What happened?
Answer: Your program has been linked with code from the LEON libraries. In addition to the application code, the executable program contains the following:
Program startup code (art0)
Program elaboration code (adainit)
Any Ada library packages mentioned in application code with lists (libada)
Any System packages referenced by the compiler
Object code from the library libgcc.a, as required
Object code from other libraries given on the linker command line.
The following command will give you a list of the object files that have been linked into your program.
$ leon-coff-gnatmake hello.adb -largs -t leon-coff-gcc -c hello.adb leon-coff-gnatbind -x hello.ali leon-coff-gnatlink -t hello.ali /opt/leon-ada-1.8/leon-coff/bin/ld: mode erc_ram art0.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/art0.o) b~hello.o ./hello.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libada.a)a-except.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libada.a)a-textio.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libada.a)a-ioexce.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libada.a)x-malloc.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libada.a)s-stcosc.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libgcc.a)__mulsidi3.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)memcpy.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)open.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)close.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)unlink.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)lseek.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)read.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)write.o (/opt/leon-ada-1.8/lib/gcc-lib/leon-coff/2.8.1/libc.a)sbrk.o
In the example, the TEXT_IO file a-textio.o, accounts for most of the size.