The static linking with -fPIC is broken now

H . J . Lu hjl@lucon.org
Wed Jun 20 10:03:00 GMT 2001


On Wed, Jun 20, 2001 at 09:47:56AM -0700, H . J . Lu wrote:
> I am enclosing a simple testcase here.
> 
> # make
> cc -O2 -g   -c -o main.o main.c
> cc -fPIC -O2 -g -c foo.c
> foo.c:7: warning: static declaration for `foo2' follows non-static
> cc -fPIC -O2 -g -c bar.c
> ar rcs libfoo.a foo.o bar.o
> cc -static -o main main.o libfoo.a
> for f in main; do echo "Running: $f"; ./$f; \
>   if [ $? != 0 ]; then echo Failed; fi; done
> Running: main
> Failed
> # ./main
> zsh: 9648 segmentation fault  ./main
> 
> 
> H.J.

There are more than one bug. After fixing this one, I am working on
another bug.


H.J.



More information about the Binutils mailing list