| |||
| Home > Directives Reference > Data definition directives > COMMON | |||
The COMMON directive allocates a block of memory,
of the defined size, at the specified symbol. You specify how the
memory is aligned. If alignment is omitted, the default alignment
is 4. If size is omitted, the default size is 0.
You can access this memory as you would any other memory, but no space is allocated in object files.
COMMONsymbol{,size{,alignment}} {[attr]}
where:
symbolis the symbol name. The symbol name is case-sensitive.
sizeis the number of bytes to reserve.
alignmentis the alignment.
attrcan be any one of:
DYNAMICsets the ELF symbol visibility to STV_DEFAULT.
PROTECTEDsets the ELF symbol visibility to STV_PROTECTED.
HIDDENsets the ELF symbol visibility to STV_HIDDEN.
INTERNALsets the ELF symbol visibility to STV_INTERNAL.
The linker allocates the required space as zero initialized
memory during the link stage. You cannot define, IMPORT or EXTERN a
symbol that has already been created by the COMMON directive. In
the same way, if a symbol has already been defined or used with
the IMPORT or EXTERN directive, you cannot
use the same symbol for the COMMON directive.