Everything

.public


Declares to the optimizing linker that the symbol described in the operand field is a symbol to be referenced from another module.

[Syntax]

Symbol field

Mnemonic field

Operand field

Comment field

[label:]
.public
symbol-name[, absolute-expression ]
[; comment]

[Function]

-

The .public directive declares to the optimizing linker that the symbol described in the operand field is a symbol to be referenced from another module.

[Use]

-

When defining a symbol to be referenced from another module, use the .public or .weak directive to declare that symbol as an external definitionNote.

Note

See ".weak" for details on the difference between the .public directive and .weak directive.

[Description]

-

The symbol specified by the first operand is declared as an external symbolNote.

Note that if the second operand is specified, this specifies the size of the data indicated by the symbol. However, specifications of size are ignored (although including them has been allowed to retain compatibility with CX).

Note

This is a symbol with a GLOBAL binding class.

 

-

The function of this directive for declaring an external symbol does not differ from the function of the .extern directive. Use this directive to declare a symbol with a definition in the specified file as an external symbol. Use the .extern directive to declare symbols without definitions in the specified file as external symbols.

-

The .public directive may be described anywhere in a source program.

-

The ".public" directive can only define one symbol per line.

-

When the symbol(s) to be described in the operand field isn't defined within the same module, an warning is output. When the symbol(s) isn't defined in any file, it will cause an error during linking.

-

The following symbols cannot be used as the operand of the .public directive:

(a)

Symbol defined with the .set directive

(b)

Section name

(c)

Macro name

[Example]

-

Module 1

        .public A1              ; (a)
        .extern B1
 
A1:
        .db2    0x10
 
        .cseg   text
        jr      B1

-

Module 2

        .public B1              ; (b)
        .extern A1
        .cseg   text
B1: 
        mov     A1, r12

(a)

This .public directive declares that symbol "A1" is to be referenced from other modules.

(b)

This .public directive declares that symbol "B1" is to be referenced from another module.