Include address information about static variables in a map file

10-Mar-2025

By default static symbols are not included in the linker-generated map file.


Possible Solution

Note that the screenshots below are from the TriCore VX-toolset.

To have the linker include information about static symbols, such as static variables, in the map file, the following steps are required:


1. In the command line, use the assembler option --emit-locals=+symbols. Then the assembler generates information about static symbols.

Alternatively, if you are using our Eclipse IDE, follow these steps:

a. Open the Project Properties dialog and select C/C++ Build | Settings.

b. On the Tool Settings tab, select Assembler | Symbols.

c. Enable Emit local non-EQU symbols.


2. In the command line, use the linker option --map-file-format=+statics. Then the linker will add information about static symbols to the map file.

This information is included in the section Module Local Symbols in the user guide.

Alternatively, if you are using our Eclipse IDE, follow these steps:

a. Open the Project Properties dialog and select C/C++ Build | Settings.

b. On the Tool Settings tab, select Linker| Map File.

c. Enable Include module local symbols information.


 

In addition to the above steps, if possible, do not use the --debug-info  (-g) option for the C compiler. This will prevent static label information used for debugging from being included in the map file. For example, If you are using TriCore Eclipse IDE, you can disable the generation of debug information by following the steps in the TriCore user guide.


More resources

Was this answer helpful?