Product: binutils
Version: 2.16,2.17
Component: ld
OS: SUSE Linux Enterprise Server 10 (x86_64) - Kernel 2.6.16.21-0.8-smp (64-
bit)
when I link some object files ,which some of them are compiled by gcc4.1.0
from c code, and others are assemble code compiled by as, while ld them to a
shared library. a error will occur like this:
as -o a.o a.s
gcc -fPIC -o b.o -c b.c
ld -shared a.o b.o -o libtest.so
ld: a.o: relocation R_X86_64_PC32 against `int_this_is_a_test_k8_64_body' can
not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
make: *** [libtest.so] Error 1
and if works with ld from binutils 2.15, it's fine.
here is my code:
b.c
int hereitis()
{
int_this_is_a_test_k8_64_body();
return 1;
}
===
=== a.s ===
.file "test-k8_64.s"
.text
.align 16
.globl int_this_is_a_test_k8_64_body
.type int_this_is_a_test_k8_64_body,@function
int_this_is_a_test_k8_64_body:
ret
.this_is_a_test_k8_64_body_end:
.size int_this_is_a_test_k8_64_body,.this_is_a_test_k8_64_body_end-
int_this_is_a_test_k8_64_body
.ident "test-k8_64.pl"
.text
.align 16
.globl int_this_is_a_test2_k8_64
.type int_this_is_a_test2_k8_64,@function
int_this_is_a_test2_k8_64:
call int_this_is_a_test_k8_64_body
ret
.this_is_a_test2_k8_64_end:
.size int_this_is_a_test2_k8_64,.this_is_a_test2_k8_64_end-
int_this_is_a_test2_k8_64
.ident "test-k8_64.pl"
==
=== makefile ===
all:libtest.so
libtest.so:a.o b.o
ld -shared a.o b.o -o libtest.so
a.o:a.s
as -o a.o a.s
b.o:b.c
gcc -fPIC -o b.o -c b.c
clean:
rm libtest.so b.o a.o
==
--
Summary: relocation R_X86_64_PC32 against 'funcx'; recompile
with -fPIC
Product: binutils
Version: 2.16
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: evilight at gmail dot com
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=4398
--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils