------- Additional Comments From hjl at lucon dot org  2005-02-25 23:02 -------
Created an attachment (id=8287)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8287&action=view)
A testcase

On ia32

[EMAIL PROTECTED] hidden]$ make
gcc -O -g   -c -o main.o main.c
gcc -O -g -fPIC   -c -o foo1.o foo1.c
gcc -O -g -fPIC   -c -o bar.o bar.c
gcc -O -g -fPIC   -c -o foo2.o foo2.c
ar rcs libfoo.a foo2.o
gcc -o libbar.so -shared bar.o libfoo.a
gcc -o main main.o foo1.o libbar.so -Wl,-rpath,.
./main
make: *** [all] Error 1

On x86_64 with the older linker:
gcc -B/usr/bin/ -O -g   -c -o main.o main.c
gcc -B/usr/bin/ -O -g -fPIC   -c -o foo1.o foo1.c
gcc -B/usr/bin/ -O -g -fPIC   -c -o bar.o bar.c
gcc -B/usr/bin/ -O -g -fPIC   -c -o foo2.o foo2.c
ar rcs libfoo.a foo2.o
gcc -B/usr/bin/ -o libbar.so -shared bar.o libfoo.a
gcc -B/usr/bin/ -o main main.o foo1.o libbar.so -Wl,-rpath,.
./main
./main: Symbol `foo' causes overflow in R_X86_64_PC32 relocation
./main: Symbol `bar' causes overflow in R_X86_64_PC32 relocation
make: *** [all] Segmentation fault

On x86_64 with the newer linker:

gcc -O -g   -c -o main.o main.c
gcc -O -g -fPIC   -c -o foo1.o foo1.c
gcc -O -g -fPIC   -c -o bar.o bar.c
gcc -O -g -fPIC   -c -o foo2.o foo2.c
ar rcs libfoo.a foo2.o
gcc -o libbar.so -shared bar.o libfoo.a
/usr/local/bin/ld: bar.o: relocation R_X86_64_PC32 against `foo' can not be
used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [libbar.so] Error 1


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20218

Reply via email to