This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Meaning of -fcommon and -fno-common
- From: Ian Lance Taylor <iant at google dot com>
- To: Amittai Aviram <amittai dot aviram at yale dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 29 May 2012 15:39:56 -0700
- Subject: Re: Meaning of -fcommon and -fno-common
- References: <AA7AB804-FEE9-467D-82D0-927669B781CD@yale.edu>
Amittai Aviram <amittai.aviram@yale.edu> writes:
> The GCC manual explains the -fcommon and -fno-common flag with
> reference to traditional Unix practice: "In C code, controls the
> placement of uninitialized global variables. Unix C compilers have
> traditionally permitted multiple definitions of such variables in
> different compilation units by placing the variables in a common
> block." What exactly is a "common block" in this context? Where is
> it in the file and--assuming it's an ELF executable to be run on a
> Linux system--what segment (virtual address range) would the OS use
> for it, as opposed to the data section? Thanks!
Common symbols exist in object files, not executables. The linker will
group the common symbols and put them in the data segment.
Ian