1.4. What's in My Program?

You have written five lines of Ada, yet the size command says your program is over 10K bytes. What happened?

Answer: Although we aim to minimize the size of the executable image of your program, there are object code modules that are needed to support the code you've written. Your program has been linked with code from the M1750 Ada libraries. In addition to the application code, the executable program contains the following:

The following command will give you a list of the object files that have been linked into your program.

$ m1750-coff-gnatmake hello.adb -largs -t
m1750-coff-gcc -c hello.adb
m1750-coff-gnatbind -x hello.ali
m1750-coff-gnatlink -t hello.ali
/opt/m1750-ada-1.7/m1750-coff/bin/ld: mode coff_m1750
/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/art0.o
b~hello.o
./hello.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-except.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-textio.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-ioexce.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)x-malloc.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)s-stcosc.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)open.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)close.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)unlink.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)lseek.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)read.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)write.o
(/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)sbrk.o

In this example, the Text_IO file a-text_io.o is 8K bytes in size and accounts for most of the program's 10K bytes.