This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/15486] [3.3/3.4/3.5] -fdata-sections moves common vars to .bss
- From: "rearnsha at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jun 2004 10:26:44 -0000
- Subject: [Bug middle-end/15486] [3.3/3.4/3.5] -fdata-sections moves common vars to .bss
- References: <20040517064727.15486.jifl-bugzilla@jifvik.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rearnsha at gcc dot gnu dot org 2004-06-22 10:26 -------
I'm not convinced this is even a bug.
Looking at the assembly code generated for the test case
int x;
we see:
.file "foo.c"
.global x
.section .bss.x,"aw",%nobits
.align 2
.type x, %object
.size x, 4
x:
.space 4
So indeed the compiler has done as asked and given X a section of its own
(.bss.x). I'm not aware that it is possible to do this using the common model -
at least, not in ELF.
Section 6.2.2 of the C99 rationale describes 4 linkage models: Common, Relaxed
Ref/Def, Strict Ref/Def and Initialization. GCC normally implements the Relaxed
Ref/Def model, since this is tradionally what Unix uses; but I don't think it
would be unreasonable to assert that -fdata-sections requires the Strict Ref/Def
model.
My inclination would be to document that -fdata-sections implies -fno-common.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15486