The COMMON directive is
used to declare common variables. A common
variable is much like a global variable declared in the uninitialised data section, so
that
common intvar 4
is similar in function to
global intvar
section .bss
intvar resd 1
The difference is that if more than one module defines the same common variable, then
at link time those variables will be merged, and
references to intvar in all modules will point at the same
piece of memory.
Like GLOBAL and EXTERN,
COMMON supports object-format specific extensions. For
example, the obj format allows common variables to be NEAR
or FAR, and the elf format allows you to specify the
alignment requirements of a common variable:
common commvar 4:near ; works in OBJ
common intarray 100:4 ; works in ELF: 4 byte aligned
Once again, like EXTERN and GLOBAL, the primitive form of COMMON
differs from the user-level form only in that it can take only one argument at a
time.