Does a zero-sized object in BSS go away?
Thiemo Seufer
ica2_ts@csv.ica.uni-stuttgart.de
Fri Jun 27 09:10:00 GMT 2003
Geoff Keating wrote:
> > Date: Thu, 19 Jun 2003 14:19:39 -0400 (EDT)
> > Cc: binutils@sources.redhat.com
> > From: Kazu Hirata <kazu@cs.umass.edu>
>
> > Hi Geoff,
> >
> > > The linker should assign an address to it. However, some object file
> > > formats can't represent zero-sized common objects, in which case the
> > > assembler should probably report an error if someone tries to create one.
> >
> > Thanks. That means some valid C using a zerosized object program
> > may not be represented in those formats. Sigh...
>
> ISO C programs can't create zero-size objects, but you can do it in
> GCC.
>
> I think there's no way to tell if an object, which the program thinks
> is zero-size, actually has non-zero size. So you could just make the
> common symbols have size 1 if the user asks for size 0...
This may break pointer comparisions. (Not that I knew of a good reason
to do this).
Thiemo
More information about the Binutils
mailing list