This is the mail archive of the gcc@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]

Re: How can I get the BSS emitted at the start of the file instead of the end of the file?


On Sat, Sep 07, 2002 at 11:50:15PM -0700, Mike Laman wrote:
> Despite all my efforts, I can't seem to get GCC to output the common
> (uninitialized) data space allocation at the beginning of the file as
> it does for the initialized data instead of at the end of the file.

This is a feature.

6.9.2  External object definitions

2    A declaration of an identifier for an object that has file scope
     without an initializer, and without a storage-class specifier or
     with the storage-class specifier static, constitutes a /tentative
     definition/. If a translation unit contains one or more tentative
     definitions for an identifier, and the translation unit contains
     no external definition for that identifier, then the behavior is
     exactly as if the translation unit contains a file scope declaration
     of that identifier, with the composite type as of the end of the
     translation unit, with an initializer equal to 0.

Notice that we have to wait until the end of the translation unit
to find out if there are no external definitions.


r~


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