This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Does a zero-sized object in BSS go away?
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: binutils at sources dot redhat dot com
- Date: 19 Jun 2003 11:07:18 -0700
- Subject: Re: Does a zero-sized object in BSS go away?
- References: <20030619.114107.129788470.kazu@cs.umass.edu><20030619.120003.127177937.kazu@cs.umass.edu>
Kazu Hirata <kazu@cs.umass.edu> writes:
> Hi,
>
> Consider
>
> .section .text
> .global _main
> _main:
> ;; Store the address of _zerosized and return.
> mov.w #_zerosized,r0
> rts
> .comm _zerosized,0
> .end
>
> When I assemble and link this file, I get a linker error:
>
> undefined reference to `_zerosized'
>
> Is the linker supposed to assign an address to _zerosized? Or simply
> ignore it? I am trying this on h8300-hms.
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.
--
- Geoffrey Keating <geoffk@geoffk.org>