Static linking is broken on ia64: $ gcc -static -v hello.c Using built-in specs. Target: ia64-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking --with-gxx-include-dir=/usr/include/c++/4.2.0 --enable-ssp --disable-libssp --enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib --disable-ltdl-install --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --with-system-libunwind --host=ia64-suse-linux Thread model: posix gcc version 4.2.0 20060601 (experimental) (SUSE Linux) /usr/lib/gcc/ia64-suse-linux/4.2.0/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -auxbase hello -version -o /tmp/ccAc4LPK.s #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/ia64-suse-linux/4.2.0/include /usr/lib/gcc/ia64-suse-linux/4.2.0/../../../../ia64-suse-linux/include /usr/include End of search list. GNU C version 4.2.0 20060601 (experimental) (SUSE Linux) (ia64-suse-linux) compiled by GNU C version 4.2.0 20060601 (experimental) (SUSE Linux). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: a5d82c8d6aeb8d953dd6034fd4040dff /usr/lib/gcc/ia64-suse-linux/4.2.0/../../../../ia64-suse-linux/bin/as -x -o /tmp/cc8qYnOm.o /tmp/ccAc4LPK.s /usr/lib/gcc/ia64-suse-linux/4.2.0/collect2 -static /usr/lib/gcc/ia64-suse-linux/4.2.0/../../../crt1.o /usr/lib/gcc/ia64-suse-linux/4.2.0/../../../crti.o /usr/lib/gcc/ia64-suse-linux/4.2.0/crtbegin.o -L/usr/lib/gcc/ia64-suse-linux/4.2.0 -L/usr/lib/gcc/ia64-suse-linux/4.2.0 -L/usr/lib/gcc/ia64-suse-linux/4.2.0/../../../../ia64-suse-linux/lib -L/usr/lib/gcc/ia64-suse-linux/4.2.0/../../.. /tmp/cc8qYnOm.o --start-group -lgcc -lgcc_eh -lunwind -lc --end-group /usr/lib/gcc/ia64-suse-linux/4.2.0/crtend.o /usr/lib/gcc/ia64-suse-linux/4.2.0/../../../crtn.o /usr/lib/gcc/ia64-suse-linux/4.2.0/libgcc_eh.a(unwind-c.o): In function `__gcc_personality_v0': (.text+0x822): undefined reference to `_Unwind_GetIPInfo' collect2: ld returned 1 exit status
I believe this is because you are configuring with --with-system-libunwind and your system unwind does not have _Unwind_GetIPInfo. This routine was added to the GCC libunwind back in February by Jakub Jelinek to fix PR other/26208.
And I did mention this when that other PR's patch was posted. --with-system-libunwind is the "issue".
I should have mentioned that for HP-UX, where the system unwind also does not have _Unwind_GetIPInfo, I added it to libgcc. See http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01285.html
In bug 26792, I suggest that libstdc++ should use autoconf to detect whether this function exists and not use it if it doesn't. That would also fix this bug.
I think using configure to detect whether or not _Unwind_GetIPInfo exists may be difficult. The libstdc++ configure script seems to go out of its way to not link programs or to use and/or look at libgcc in anyway. Anyone have an idea on how to implement this? I am thinking the checking/flag setting on whether or not _Unwind_GetIPInfo exists might have to be done in the gcc directory.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01023.html>.
Subject: Bug number PR target/27880 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01023.html
I believe a patch to libstdc++ to check for __Unwind_GetIPInfo was committed. Verify this still fails?
Why do you think this bug has anything to do with libstdc++?
libstdc++ is only part of the problem, libjava still has the same issue.
*** Bug 29342 has been marked as a duplicate of this bug. ***
The uses of __Unwind_GetIPInfo in libstdc++ and libjava have been fixed. It looks like the report in PR 29342 is due to the use of __Unwind_GetIPInfo in gcc/unwind-c.c. I will create a patch for this use.
Subject: Bug 27880 Author: sje Date: Mon Oct 9 15:55:38 2006 New Revision: 117576 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117576 Log: PR target/27880 * unwind-c.c (PERSONALITY_FUNCTION): Ifdef use of _Unwind_GetIPInfo. * configure.ac (HAVE_GETIPINFO): Check for _Unwind_GetIPInfo. * configure: Regenerate. * config.in: Regenerate. Modified: trunk/gcc/ChangeLog trunk/gcc/config.in trunk/gcc/configure trunk/gcc/configure.ac trunk/gcc/unwind-c.c
With the patch I just checked in, I believe that this defect is now fixed. The uses of GetIPInfo in libstdc++ and libjava were fixed earlier, this latest patch fixes the use in unwind-c.c and that should be it.
This still does not work. When configuring the stage2 compiler the symbol will be found in libgcc_s (from unwind-compat.o).
Also why does configure set HAVE_GETIPINFO unconditionally when the system libunwind is used?
Will not be fixed in 4.2.0; retargeting at 4.2.1.
Change target milestone to 4.2.3, as 4.2.2 has been released.
This patch seems good to me. What's the delay here?
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
Critical P2 bug and the patch gets unreviewed for so long?! Is this bug still relevant for ia64-*-linux?
Subject: Re: [4.2/4.3/4.4 regression] undefined reference to `_Unwind_GetIPInfo' ubizjak at gmail dot com wrote: > ------- Comment #22 from ubizjak at gmail dot com 2008-02-20 18:39 ------- > Critical P2 bug and the patch gets unreviewed for so long?! > Is this bug still relevant for ia64-*-linux? I didn't realize this PR was still open. I perhaps lost track of it because some misleading info added to it implied that it was already fixed. I'll take a look now. Jim
the proposed patch in question seems to break the opposite scenario on ia64: --without-system-libunwind
4.2.4 is being released, changing milestones to 4.2.5.
This bug also affects OpenSolaris. # gcc -v Using built-in specs. Target: i386-pc-solaris2.11 Configured with: ../gcc-4.2.4/configure --prefix=/usr/gnu --libdir=/usr/gnu/lib --libexecdir=/usr/gnu/lib --mandir=/usr/gnu/share/man --infodir=/usr/share/info --with-as=/usr/gnu/bin/as --with-gnu-as --with-ld=/usr/gnu/bin/ld --with-gnu-ld --enable-languages=c,c++,fortran,objc --enable-shared --disable-static --enable-decimal-float -disable-nls Thread model: posix gcc version 4.2.4 --------- g++ -I/usr/include -I/usr/local/include -Wall -D_REENTRANT -pthreads -I/usr/local/include/openssl -DHAVE_SSL -I/opt/mysql/mysql/include -m64 -mtune=k8 -DMY_ATOMIC_MODE_RWLOCKS -m64 -O2 -mtune=k8 -static-libgcc -o ascent-logonserver AccountCache.o AuthSocket.o LogonCommServer.o LogonConsole.o LogonOpcodes.o LogonStdAfx.o AutoPatcher.o Main.o -L/export/home/burlex/summit/src/ascent-shared -L/export/home/burlex/summit/dep/src/zlib -L/usr/lib/amd64 -L/usr/local/lib/amd64 -L/usr/gnu/lib/amd64 -L/usr/sfw/lib/amd64 -L/usr/gnu/lib -L/opt/mysql/mysql/lib -lmysqlclient -lposix4 -lresolv -lgen -lsocket -lnsl -lm -lshared -lzlib -lz -lssl -lcrypto /usr/gnu/lib/amd64/libstdc++.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0' collect2: ld returned 1 exit status
*** Bug 37403 has been marked as a duplicate of this bug. ***
so this bites again with trunk and ada. Jim, Steve, any news on this?
See http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00647.html for a discussion and proposed patch.
Subject: Bug 27880 Author: sje Date: Wed Nov 12 21:35:46 2008 New Revision: 141804 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141804 Log: PR target/27880 * config/unwind_ipinfo.m4 (GCC_CHECK_UNWIND_GETIPINFO): Change from link test to target based test. * libstdc++/v3/configure.ac: Move call to GCC_CHECK_UNWIND_GETIPINFO. * libstdc++/v3/configure: Regenerate. * libjava/configure: Regenerate. Modified: trunk/config/ChangeLog trunk/config/unwind_ipinfo.m4 trunk/libjava/ChangeLog trunk/libjava/configure trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/configure trunk/libstdc++-v3/configure.ac
Subject: Bug 27880 Author: sje Date: Wed Nov 12 21:37:34 2008 New Revision: 141805 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141805 Log: PR target/27880 * configure.ac (GCC_CHECK_UNWIND_GETIPINFO): Use this macro to set HAVE_GETIPINFO. * aclocal.m4: Include ../config/unwind_ipinfo.m4. * configure: Regenerate. * config.in: Regenerate. Modified: trunk/gcc/ChangeLog trunk/gcc/aclocal.m4 trunk/gcc/config.in trunk/gcc/configure trunk/gcc/configure.ac
ping 4.3.3?
With "gcc version 4.4.0 20090102" on i386-pc-solaris2.11 I'm getting: # gcc -v -o test_gmp_1 test_gmp_1.cc -lgmp -lstdc++ /usr/local/lib/gcc/i386-pc-solaris2.11/4.4.0/../../../libstdc++.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0' collect2: ld returned 1 exit status
(In reply to comment #33) > With "gcc version 4.4.0 20090102" on i386-pc-solaris2.11 I'm getting: > > # gcc -v -o test_gmp_1 test_gmp_1.cc -lgmp -lstdc++ > /usr/local/lib/gcc/i386-pc-solaris2.11/4.4.0/../../../libstdc++.so: undefined > reference to `_Unwind_GetIPInfo@GCC_4.2.0' > collect2: ld returned 1 exit status sounds like correct version of libgcc is not being so that is not a bug with GCC but with your installation of GCC.
(In reply to comment #33) > With "gcc version 4.4.0 20090102" on i386-pc-solaris2.11 I'm getting: > > # gcc -v -o test_gmp_1 test_gmp_1.cc -lgmp -lstdc++ > /usr/local/lib/gcc/i386-pc-solaris2.11/4.4.0/../../../libstdc++.so: undefined > reference to `_Unwind_GetIPInfo@GCC_4.2.0' > collect2: ld returned 1 exit status Another thread suggested that "gcc" should not be used for ".cc" files as gcc did not invoke the same mechanisms as g++ does. I tried g++ (instead of gcc) and it worked correctly on my ".cc" file. Rob
Closing 4.2 branch.
GCC 4.3.4 is being released, adjusting target milestone.
GCC 4.3.5 is being released, adjusting target milestone.
Fixed in GCC 4.4.0.