This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: The static linking with -fPIC is broken now
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.
bug.tar.gz