This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Common symbol size change bug
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Wed, 9 Apr 2003 18:40:36 -0700
- Subject: Re: Common symbol size change bug
- References: <20030409164208.A13021@lucon.org>
On Wed, Apr 09, 2003 at 04:42:08PM -0700, H. J. Lu wrote:
> When a normal definition overrides a common symbol, ld complains:
>
> # make
> gcc -O -g -c main.c
> gcc -O -g -c foo.c
> gcc -o foo1 -B./ main.o foo.o
> /usr/local/bin/ld: Warning: size of symbol `foo' changed from 8 to 16 in foo.o
> gcc -o foo2 -B./ foo.o main.o
> for f in foo1 foo2; do echo "Running: $f"; ./$f; \
> if [ $? != 0 ]; then echo Failed; fi; done
> Running: foo1
> 0: 0
> 1: 1
> 2: 2
> 3: 3
> Running: foo2
> 0: 0
> 1: 1
> 2: 2
> 3: 3
>
> But ld won't complain if a common symbol follows a normal definition.
> I don't think ld should complain. Here is a testcase. Am I missing
> something?
>
Never mind. Sun linker does the same.
H.J.