-map


< Compile Options / Optimize Options >

[Format]

-map[= <file name>]

 

-

[Default]

The default for this option is map when the optimize=max option has been specified.

[Description]

-

This option optimizes accesses to global variables.

-

When the map option is specified, a base address is set by using an external symbol-allocation information file created by the optimizing linkage editor, and a code that uses addresses relative to the base address for accesses to global or static variables is generated.

-

When accesses to external variables are to be optimized by the map option, how the map option is used differs according to the specification of the output option.

-

[output=abs, output=mot, or output=hex is specified]

Specify only map. The compiler automatically performs compilation and linkage twice, and a code in which the base address is set based on external symbol allocation information is generated. Note that when output=abs, output=mot, or output=hex is specified simultaneously with optimize=max, map will be specified implicitly.

-

[output=obj is specified]
Compile the source file once without specifying these options, create an external symbol-allocation information file by specifying map=<file name> at linkage by the optimizing linkage editor, and then compile the source file again by specifying map=<file name> in ccrx.

[Example]

-

<C source file>

long A,B,C;
void func()
{
    A = 1;
    B = 2;
    C = 3;
}

-

<Output code>

_func:
  MOV.L     #_A,R4     ; Sets the address of A as the base address.
  MOV.L     #1,[R4]
  MOV.L     #2,4[R4]   ; Accesses B using the address of A as the base.
  MOV.L     #3,8[R4]   ; Accesses C using the address of A as the base.

[Remarks]

-

When the order of the definitions of global variables or static variables has been changed, a new external symbol-allocation information file must be created. If any option other than the map option in the previous compilation differs from the one in the current compilation, or if any contents of a function are changed, correct operation is not guaranteed. In such a case, a new external symbol-allocation information file must be created.

-

This option is only valid for the compilation of C/C++ source programs. It does not apply to programs that have been compiled with the output=src specification or to programs written in assembly language.

-

When the map option and smap option are specified simultaneously, the map option is valid.

-

When continuous data sections are allocated after a program section, optimization of external variable accesses may be disabled or may not be performed sufficiently. For performing optimization to a maximum extent in a case in which multiple sections are allocated continuously, allocate the program section at the end. An example is shown below.

 

-

In the above example, section P is allocated from address 0x100, sections C1 and C2 are allocated immediately after section P, and section C3 is allocated from address 0x400. Since sections C1 and C2 are allocated continuously after section P, section P should be allocated behind section C2. Section C3 is not involved because it is not allocated continuously.