Getting Started with ERC32 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 ERC32 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.
$ erc-coff-gnatmake hello.adb -largs -t erc-coff-gcc -c hello.adb erc-coff-gnatbind -x hello.ali erc-coff-gnatlink -t hello.ali /opt/erc32-ada-1.7/erc-coff/bin/ld: mode erc_ram art0.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/art0.o) b~hello.o ./hello.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libada.a)a-except.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libada.a)a-textio.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libada.a)a-ioexce.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libada.a)x-malloc.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libada.a)s-stcosc.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libgcc.a)__mulsidi3.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)memcpy.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)open.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)close.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)unlink.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)lseek.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)read.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)write.o (/opt/erc32-ada-1.7/lib/gcc-lib/erc-coff/2.8.1/libc.a)sbrk.o
In the example, the TEXT_IO file a-textio.o, accounts for most of the size.