5.2.2 Link Directives

These directives are used for relocatable assembly that enables a program to be written in multiple separate files.

 

.SECTION

This directive declares or restarts a section.

[Format]

SECTION<section name>

.SECTION<section name>,<section attribute>

.SECTION<section name>,<section attribute>,ALIGN=[2|4|8]

.SECTION<section name>,ALIGN=[2|4|8]

<section attribute>: [CODE|ROMDATA|DATA]

[Description]

This directive declares or restarts a section.

(1) Declaration

This directive defines the beginning of a section with a section name and a section attribute specified.

(2) Restart

This directive specifies restart of a section that has already been declared in the source program. Specify an existing section name to restart it. The section attribute and alignment value declared before are used without change.

The alignment value in the section can be changed through the ALIGN specification.

The .ALIGN directive can be used in relative-addressing sections defined by the .SECTION directive including the ALIGN specification or in absolute-addressing sections.

When ALIGN is not specified, the boundary alignment value in the section is 1.

[Examples]

.SECTION program,CODE

NOP

.SECTION ram,DATA

.BLKB 10

.SECTION tbl1,ROMDATA

.BYTE "abcd"

.SECTION tbl2,ROMDATA,ALIGN=8

.LWORD 11111111H,22222222H

.END

[Remarks]

Be sure to specify a section name.

To use assembler directives that allocate memory areas or store data in memory areas, be sure to define a section through this directive.

To write mnemonics, be sure to define a section through this directive.

A section attribute and ALIGN should be specified after a section name.

A section attribute and ALIGN should be specified with them separated by a comma.

A section attribute and ALIGN can be specified in any order.

Select CODE, ROMDATA, or DATA for the section attribute.

The section attribute can be omitted. In this case, the assembler assumes CODE as the section attribute.

When -endian=big is specified, only a multiple of 4 can be specified for the start address of an absolute-addressing CODE section.

If an absolute-addressing CODE section is declared when -endian=big is specified, a warning message will be output. In this case, the assembler appends NOP (0x03) at the end of the section to adjust the section size to a multiple of 4.

Defining a symbol name which is the same as that of an existing section is not possible. If a section and symbol with the same name are defined, the section name will be effective, but the symbol name will lead to an A2118 error.

The section name $iop is reserved and cannot be defined. If this is attempted, an A2049 error will be reported.

 

.GLB

This directive declares that the specified labels and symbols are global.

[Format]

GLB<name>

.GLB<name>[,<name> ?]

[Description]

This directive declares that the specified labels and symbols are global.

When any label or symbol specified through this directive is not defined within the current file, the assembler processes it assuming that it is defined in an external file.

When a label or symbol specified through this directive is defined within the current file, the assembler processes it so that it can be externally referenced.

[Examples]

.GLB name1,name2,name3

.GLB name4

.SECTION program

MOV.L #name1,R1

[Remarks]

Be sure to insert a space character or a tab between this directive and the operand.

Specify a label name to be a global label as the operand.

Specify a symbol name to be a global symbol as the operand.

To specify multiple symbol names as operands, separate them by commas (,).

 

.RVECTOR

This directive registers the specified label or name as a variable vector.

[Format]

.RVECTOR<number>,<name>

[Description]

This directive registers the specified label or name as a variable vector.

A constant from 0 to 255 can be entered in <number> of this directive as the vector number.

A label or symbol defined within the current file can be specified as <name> of this directive.

The registered variable vectors are gathered into a single C$VECT section by the optimizing linkage editor.

[Examples]

.RVECTOR 50,_rvfunc

_rvfunc:

MOV.L #0,R1

RTE

[Remark]

Be sure to insert a space character or a tab between this directive and the operand.