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: PATCH: Fix alignment of common symbol


On Thu, Apr 10, 2003 at 11:26:14AM -0700, H. J. Lu wrote:
> When there is a alignment differnce between common/normal symbols or
> common symbols, ld doesn't check alignment. Here is a testcase:
> 
> gcc -O -g -c main.c
> gcc -O -g -c foo.c
> gcc -o foo1 -B./ main.o foo.o
> /usr/bin/ld: Warning: size of symbol `foo' changed from 2 to 21 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
> 0x8049421: 1
> 0x8049536: 2
> Running: foo2
> 0x8049421: 1
> 0x8049550: 16
> 
> I also include a patch.
> 

I took a look at Sun's linker doc. It says alignment change will
generate a warning, not a fatal error. Here is the new patch.


H.J.

Attachment: bfd-common.patch
Description: Text document


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