This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How can I get the BSS emitted at the start of the file instead of the end of the file?
- From: Richard Henderson <rth at redhat dot com>
- To: Mike Laman <mlaman at cox dot net>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Sun, 8 Sep 2002 10:58:14 -0700
- Subject: Re: How can I get the BSS emitted at the start of the file instead of the end of the file?
- References: <000701c25704$2384b2e0$5aa80844@fed1.sdca.home.com>
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~