12.12 COMMON

The COMMON directive allocates a block of memory of the defined size, at the specified symbol.


COMMON symbol{,size{,alignment}} {[attr]}
is the symbol name. The symbol name is case-sensitive.
is the number of bytes to reserve.
is the alignment.
can be any one of:
sets the ELF symbol visibility to STV_DEFAULT.
sets the ELF symbol visibility to STV_PROTECTED.
sets the ELF symbol visibility to STV_HIDDEN.
sets the ELF symbol visibility to STV_INTERNAL.


You specify how the memory is aligned. If the alignment is omitted, the default alignment is four. If the size is omitted, the default size is zero.
You can access this memory as you would any other memory, but no space is allocated by the assembler in object files. 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.

Correct example

    LDR       r0, =xyz
    COMMON    xyz,255,4   ; defines 255 bytes of ZI store, word-aligned

Incorrect example

    COMMON    foo,4,4
    COMMON    bar,4,4
foo DCD       0         ; cannot define label with same name as COMMON
    IMPORT    bar       ; cannot import label with same name as COMMON
Non-ConfidentialPDF file icon PDF versionARM DUI0379G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.