Getting Started with M68K Ada: Ada 95 Compilation System for the Motorola M68000 Family | ||
---|---|---|
Prev | Chapter 1. Basic Techniques | Next |
You have written ten lines of Ada, yet the size command says your program is over 5K bytes. What happened?
Answer: Your program has been linked with code from the M68K 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 with-ed 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 link map that lists the object files that have been linked into your program, and the address of every global data item and subprogram.
Here is part of the link map generated by the last command. We have reduced the width of the map to fit on a page by replacing the path name of the library directory with $p.
Example 1-12. A Linker Map
$ more hello.map Archive member included because of file (symbol) $p/libgnat.a(a-except.o) b~hello.o (ada__exceptions___elabs) $p/libgnat.a(x-textio.o) b~hello.o (xgc__text_io___elabs) $p/libgnat.a(x-malloc.o) $p/libgnat.a(a-except.o) (__gnat_malloc) $p/libgnat.a(a-ioexce.o) $p/libgnat.a(x-textio.o) (ada__io_exceptions__use_error) $p/libc.a(schandler.o) $p/art0.o (default_system_call_handler) $p/libc.a(bcopy.o) $p/libgnat.a(a-except.o) (bcopy) $p/libc.a(read.o) $p/libgnat.a(x-textio.o) (read) $p/libc.a(write.o) $p/libgnat.a(x-textio.o) (write) $p/libc.a(sbrk.o) $p/libgnat.a(x-malloc.o) (sbrk) $p/libc.a(sys_handler.o) $p/libc.a(schandler.o) (sys_handler) $p/libc.a(errno.o) $p/libc.a(read.o) (errno) Allocating common symbols Common symbol size file __exception_id 0x4 $p/art0.o __stack_ptr 0x4 $p/art0.o errno 0x4 $p/libc.a(errno.o) __exception_pc 0x4 $p/art0.o xgc__text_io__current_out 0x4 $p/libgnat.a(x-textio.o) ...