This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Common symbol size change bug


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.


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