fcommon

Tells the compiler to treat common symbols as global definitions.

IDE Equivalent

Windows: None

Linux: Data > Allow gprel Addressing of Common Data Variables

Mac OS: Data > Allow gprel Addressing of Common Data Variables

Architectures

IA-32 architecture, Intel® 64 architecture, IA-64 architecture

Syntax

Linux and Mac OS: -f[no-]common
Windows:    None

Arguments

None

Default

OFF      -fcommon

Description

This option tells the compiler to treat common symbols as global definitions and to allocate memory for each symbol at compile time.

It enables the compiler to treat common variables as if they were defined, allowing the use of GP-relative (gprel) addressing of common data variables.

Normally, a file-scope declaration with no initializer and without the extern or static keyword "int i;" is represented as a common symbol. Such a symbol is treated as an external reference. However, if no other compilation unit has a global definition for the name, the linker allocates memory for it. The -fno-common option allows the compiler to use a more efficient way to access the symbol.

Alternate Options

None