This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

BFD internal error when using ld --wrap when building Xenomai with uClibc


Hello,

We have run into this problem when building the Xenomai 2.3-rc2
testsuite for ARM target using Gcc 4.0.0/binutils-2.16.1/uClibc-0.9.27

We were able to create a simpler testcase and tried it on some
x86-based systems.


- When using binutils-2.17.50.0.3-6 (Fedora Core 6) the linker
outputs:
/usr/bin/ld: /usr/bin/ld: BFD 2.17.50.0.3-6 20060715 internal error, aborting at ../../bfd/bfd.c line 506 in _bfd_default_error_handler


/usr/bin/ld: Please report this bug.

collect2: ld returned 1 exit status

- On old RedHat 9 (binutils-2.13.90.0.18-9) the linking went ok with
warning:
/usr/bin/ld: Warning: size of symbol `__wrap_pthread_getschedparam1' changed from 5 to 38 in ./libmy.so


- On Fedore Core-5 (binutils-2.16.91.0.6-5), the test even
segfaults:
gcc -c wrap.c lib.c func.c pthread.c -g -fpic
gcc -shared -o libpthread1.so pthread.o -g
gcc -shared -o libmy.so lib.o wrap.o ./libpthread1.so -g
gcc -c -o main.o main.c -g
gcc -o main -Wl,--wrap -Wl,pthread_getschedparam1 main.o ./libmy.so ./libpthread1.so
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: make: *** [all] Error 1



Interstingly enough, the error is gone if the libmy.so DSO is linked without the reference to libpthread1.so, i.e.:

gcc -shared -o libmy.so lib.o wrap.o -g

The testcase tarball and proposed fix to bfd/elflink.c are attached.

Regards,
Sergei

Attachment: ld-kill.tgz
Description: application/compressed-tar

--- bfd/elflink.c.orig	2006-12-25 15:33:10.000000000 +0100
+++ bfd/elflink.c	2006-12-25 15:35:24.000000000 +0100
@@ -3800,7 +3800,10 @@
 	    {
 	    default:
 	      break;
-
+	    case bfd_link_hash_undefined:
+	    case bfd_link_hash_undefweak:
+	      old_bfd = h->root.u.undef.abfd;
+	      break;
 	    case bfd_link_hash_defined:
 	    case bfd_link_hash_defweak:
 	      old_bfd = h->root.u.def.section->owner;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]