The static linking with -fPIC is broken now

H . J . Lu hjl@lucon.org
Wed Jun 20 09:48:00 GMT 2001


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.tar.gz
Type: application/x-gzip
Size: 561 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20010620/5987a6db/attachment.bin>


More information about the Binutils mailing list