Getting Started with M68K Coral 66: Compilation System for the Motorola M68000 Family | ||
---|---|---|
Prev | Chapter 1. Basic Techniques | Next |
Question: You have written ten lines of Coral 66, yet the size command says your program is over 5K bytes. What happened?
Answer: Your program has been linked with code from the object code libraries. In addition to the application code, the executable program contains the following:
Program startup code (art0)
All the compilation units mentioned on the command line
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.
Example 1-10. A Linker Map File
$ m68k-coff-gcc hello.cor -Wl,-Map=hello.map $ more hello.map Archive member included because of file (symbol) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(schandler.o) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o (default_system_call_handler) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(write.o) /tmp/ccM8XXl81.o (write) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(sys_handler.o) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(schandler.o) (sys_handler) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(errno.o) /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(write.o) (errno) Allocating common symbols Common symbol size file __stack_ptr 0x4 /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o __rtc_cnt 0x4 /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o errno 0x4 /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a(errno.o) _stack_limit 0x4 /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o __handler_table 0x100 /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o Memory Configuration Name Origin Length Attributes *default* 0x00000000 0xffffffff Linker script and memory map LOAD /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/art0.o LOAD /tmp/ccM8XXl81.o LOAD /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libgcc.a LOAD /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libc.a LOAD /opt/m68k-c66-1.7/lib/gcc-lib/m68k-coff/2.8.1/libgcc.a ...