I get the following error from ld on ia64 when building GHDL. It works fine on all other architectures supported by Debian. > gnatlink > /build/buildd/ghdl-0.25+gcc4.1.1/gcc-4.1.1/build/gcc/vhdl/ortho_gcc-main.ali >-o ghdl1 ortho-lang.o gcc-version.o ../gcc/toplev.o ../gcc/libbackend.a >../libcpp/libcpp.a ../libiberty/libiberty.a ../libcpp/libcpp.a >../libiberty/libiberty.a > /usr/bin/ld: BFD 2.17 Debian GNU/Linux assertion fail ../../bfd/elflink.c:6261 > /usr/bin/ld: BFD 2.17 Debian GNU/Linux internal error, aborting at >../../bfd/elflink.c line 6349 in elf_link_check_versioned_symbol > > /usr/bin/ld: Please report this bug. > > collect2: ld returned 1 exit status > gnatlink: cannot call /usr/bin/gcc-4.1 It still fails with current binutils from CVS HEAD. I get: > tbm@coconut0:~/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/build/gcc$ > /home/tbm/src/src/ld/ld-new -dynamic-linker /lib/ld-linux-ia64.so.2 -o ghdl1 > -L./ vhdl/ortho_gcc.o -lgnat-4.1 -lgcc > /home/tbm/src/src/ld/ld-new: warning: cannot find entry symbol _start; > defaulting to 40000000000010e0 > vhdl/ortho_gcc.o: In function `lang_parse_file': > ortho_gcc.adb:(.text+0x7c2): undefined reference to `ortho_front__parse' > vhdl/ortho_gcc.o: In function `lang_handle_option': > ortho_gcc.adb:(.text+0x9b2): undefined reference to `ortho_front__decode_option' > /home/tbm/src/src/ld/ld-new: BFD 2.17.50 20061012 assertion fail elflink.c:6690 > /home/tbm/src/src/ld/ld-new: BFD 2.17.50 20061012 internal error, aborting at > elflink.c line 6778 in elf_link_check_versioned_symbol
Created attachment 1368 [details] object file
Created attachment 1369 [details] assembler
It works for me: [hjl@gnu-11 3351]$ ./ld -dynamic-linker /lib/ld-linux-ia64.so.2 -o ortho_gcc ortho_gcc.o -L/usr/gcc-4.1-redhat/lib/gcc/ia64-redhat-linux/4.1.2 -L/usr/gcc-4.1-redhat/lib/gcc/ia64-redhat-linux/4.1.2/adalib -lgnat-4.1 -lgcc -v GNU ld version 2.17.50 20061017 ./ld: warning: cannot find entry symbol _start; defaulting to 4000000000000640 ortho_gcc.o: In function `lang_handle_option': /home/tbm/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/gcc/vhdl/ortho_gcc.adb:85: undefined reference to `ortho_front__decode_option' ortho_gcc.o: In function `lang_parse_file': /home/tbm/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/gcc/vhdl/ortho_gcc.adb:103: undefined reference to `ortho_front__parse' [hjl@gnu-11 3351]$ Something may be wrong with your environment. Can you provide me with your /lib/ld-linux-ia64.so.2 libgcc.a libgnat-4.1.so
I can still reproduce this. The files are from a standard Debian install and libgcc.a has been built during the GHDL build process. I'll attach them in a .tar.bz2. tbm@coconut0:~/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/build/gcc$ /home/tbm/src/src/ld/ld-new -dynamic-linker /lib/ld-2.3.6.so -o ghdl1 vhdl/ortho_gcc.o /usr/lib/libgnat-4.1.so.1 libgcc.a /home/tbm/src/src/ld/ld-new: warning: cannot find entry symbol _start; defaulting to 4000000000001160 vhdl/ortho_gcc.o: In function `lang_handle_option': /home/tbm/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/gcc/vhdl/ortho_gcc.adb:85: undefined reference to `ortho_front__decode_option' vhdl/ortho_gcc.o: In function `lang_parse_file': /home/tbm/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/gcc/vhdl/ortho_gcc.adb:103: undefined reference to `ortho_front__parse' /home/tbm/src/src/ld/ld-new: BFD 2.17.50 20061012 assertion fail elflink.c:6690 /home/tbm/src/src/ld/ld-new: BFD 2.17.50 20061012 internal error, aborting at elflink.c line 6778 in elf_link_check_versioned_symbol /home/tbm/src/src/ld/ld-new: Please report this bug. tbm@coconut0:~/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/build/gcc$ ls -l /lib/ld-2.3.6.so /usr/lib/libgnat-4.1.so.1 libgcc.a -rwxr-xr-x 1 root root 203496 Oct 13 14:01 /lib/ld-2.3.6.so -rw-r--r-- 1 root root 4272960 Oct 9 13:21 /usr/lib/libgnat-4.1.so.1 -rw-r--r-- 1 tbm tbm 565664 Oct 12 00:49 libgcc.a tbm@coconut0:~/src/ghdl-0.25+gcc4.1.1/gcc-4.1.1/build/gcc$
The tar file is just too big to be attached. You can grab it from http://cyrius.com/tmp/ld-bug.tar.bz2
How did you configure your gcc?
Do you have any local gcc patches?
It's Debin's standard 4.1 compiler. There are some patches but I don't think anything related to IA64. I can try with an unchanged FSF GCC if you really want. The libgcc I sent comes from GHDL itself, which is some kind of simulator/compiler based on GCC. tbm@coconut0:~$ gcc -v Using built-in specs. Target: ia64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --disable-libssp --with-system-libunwind --enable-checking=release ia64-linux-gnu Thread model: posix gcc version 4.1.2 20061007 (prerelease) (Debian 4.1.1-16)
There are several problem with your libgcc.a: 1. Your libgcc.a has unwind-sjlj.o unwind-c.o unwind-compat.o which mine doesn't. 2. I have [hjl@gnu-11 stage1]$ ar -t libgcc_eh.a unwind-sjlj.o unwind-c.o [hjl@gnu-11 stage1]$ 3. I don't have unwind-compat.o at all. I have unwind-compat_s.o which is used to build libgcc_s.so.
I don't see why these differences would necessary be a "problem". Can you please elaborate?
You changed EH functions in libgcc in such a way which isn't intended for. Linker should issue an error instead of abort in this case.
Here is a simple testcase: [hjl@gnu-13 version-31]$ cat x.c extern void bar (void); int _start (void) { bar (); return 0; } int __start (void) { return _start (); } [hjl@gnu-13 version-31]$ cat bar.c extern void foo (void); void bar (void) { foo (); } [hjl@gnu-13 version-31]$ cat foo.c void foo (void) { } asm (".symver foo,foo@FOO"); [hjl@gnu-13 version-31]$ make gcc -O -c -o x.o x.c gcc -O -fPIC -c -o bar.o bar.c ./ld -shared -o libbar.so bar.o gcc -O -c -o foo.o foo.c ./ld -o x x.o libbar.so foo.o ./ld: BFD 2.17.50 20061017 assertion fail /export/gnu/src/binutils-import/binutils/bfd/elflink.c:6755 ./ld: ./ld: BFD 2.17.50 20061017 internal error, aborting at /export/gnu/src/binutils-import/binutils/bfd/bfd.c line 506 in _bfd_default_error_handler ./ld: Please report this bug. make: *** [x] Error 1 [hjl@gnu-13 version-31]$
Your libgcc from GHDL is wrong. It should be built in the same way as the one in gcc. Here is a linker patch to avoid crash: http://sourceware.org/ml/binutils/2006-10/msg00161.html
(In reply to comment #13) > Your libgcc from GHDL is wrong. It should be built in the same way as the one in > gcc. > > Here is a linker patch to avoid crash: > > http://sourceware.org/ml/binutils/2006-10/msg00161.html What's the status of this patch?
(In reply to comment #14) > (In reply to comment #13) > > Your libgcc from GHDL is wrong. It should be built in the same way as the one in > > gcc. > > > > Here is a linker patch to avoid crash: > > > > http://sourceware.org/ml/binutils/2006-10/msg00161.html > > What's the status of this patch? It is fixed in the Linux binutils 2.17.50.0.6 or newer. >
(In reply to comment #15) > > What's the status of this patch? > > It is fixed in the Linux binutils 2.17.50.0.6 or newer. I was wondering about FSF binutils.
CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2012-07-03 14:44:35 Modified files: bfd : ChangeLog elflink.c ld/testsuite : ChangeLog Added files: ld/testsuite/ld-elf: indirect.exp indirect1a.c indirect1b.c indirect1c.c indirect2.c indirect3.out indirect3a.c indirect3b.c indirect3c.c indirect4.out indirect4a.c indirect4b.c indirect4c.c Log message: Properly handle indirect symbols 2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR ld/3351 * elflink.c (_bfd_elf_update_dynamic_flags): New. (_bfd_elf_merge_symbol): Update both real and indirect symbol dynamic flags. (_bfd_elf_add_default_symbol): Make the real symbol dynamic if the indirect symbol is defined in a shared library. (elf_link_add_object_symbols): Likewise. If the indirect symbol has been forced local, don't make the real symbol dynamic. (elf_link_check_versioned_symbol): Check indirect symbol. (elf_link_output_extsym): Use real symbol definition when reporting indirect symbol error. Check version info for dynamic versioned symbol. 2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR ld/3351 * ld-elf/indirect.exp: New file. * ld-elf/indirect1a.c: Likewise. * ld-elf/indirect1b.c: Likewise. * ld-elf/indirect1c.c: Likewise. * ld-elf/indirect2.c: Likewise. * ld-elf/indirect3.out: Likewise. * ld-elf/indirect3a.c: Likewise. * ld-elf/indirect3b.c: Likewise. * ld-elf/indirect3c.c: Likewise. * ld-elf/indirect4.out: Likewise. * ld-elf/indirect4a.c: Likewise. * ld-elf/indirect4b.c: Likewise. * ld-elf/indirect4c.c: Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5743&r2=1.5744 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.448&r2=1.449 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1574&r2=1.1575 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect.exp.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect1a.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect1b.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect1c.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect2.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect3.out.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect3a.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect3b.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect3c.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect4.out.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect4a.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect4b.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/indirect4c.c.diff?cvsroot=src&r1=NONE&r2=1.1
Fixed in 2.23.