Diagnostic Files

Two valuable files that can be produced by the compiler are the assembly list file, generated by the assembler and the map file, generated by the linker. These are generated by options, shown in Table 3-3.

Table 1. Diagnostic Files
Extension File Type How Created
file.lst Assembly list file -Wa,-a=file.lst driver option
file.map Map file -Wl,-Map=file.map driver option

The assembly list file contains the mapping between the original source code and the generated assembly code. It is useful for information such as how C source was encoded, or how assembly source may have been optimized. It is essential when confirming if compiler-produced code that accesses objects is atomic and shows the region in which all objects and code are placed.

The assembler option to create a listing file is -a and can be passed to the assembler from the driver using the driver option -Wa,-a=file.lst, for example.

There is one list file produced for the entire program, including library code.

The map file shows information relating to where objects were positioned in memory. It is useful for confirming if user-defined linker options were correctly processed and for determining the exact placement of objects and functions.

The linker option to create a map file in the linker application is -Map file, and this option can be passed to the linker from the driver using the driver option -Wl,-Map=file.map, for example.

One map file is produced when you build a project, assuming that the linker was executed and ran to completion.