This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/15486] [3.3/3.4/3.5] -fdata-sections moves common vars to .bss


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]