Compiling a small C++ test program with GCC and linking with libsupc++ is
causing the link to fail.


try.C

===================

#include <stdio.h>
int main(){
printf("Hello");
 return 0;
}

==================

arm_v5t_le-gcc try.C -lsupc++


/mnt/disk2/opt/HEAD/arm_v5t_le/opt/montavista/foundation/devkit/arm/v5t_le/target/usr/lib/libsupc++.a(eh_alloc.o):
In function `__cxa_free_exception':
eh_alloc.cc:(.text.__cxa_free_exception+0xc8): undefined reference to
`std::__throw_runtime_error(char const*)'
eh_alloc.cc:(.text.__cxa_free_exception+0xd4): undefined reference to
`std::__throw_runtime_error(char const*)'
/mnt/disk2/opt/HEAD/arm_v5t_le/opt/montavista/foundation/devkit/arm/v5t_le/target/usr/lib/libsupc++.a(eh_alloc.o):
In function `__cxa_allocate_exception':
eh_alloc.cc:(.text.__cxa_allocate_exception+0xe4): undefined reference to
`std::__throw_runtime_error(char const*)'
eh_alloc.cc:(.text.__cxa_allocate_exception+0x10c): undefined reference to
`std::__throw_runtime_error(char const*)'
eh_alloc.cc:(.text.__cxa_allocate_exception+0x174): undefined reference to
`std::__throw_runtime_error(char const*)'
collect2: ld returned 1 exit status



This testcase works ok with GCC 4.1 series. and fails with GCC 4.2

I have verified the behavior on arm and x86 cross compiler.


The issue seems to be because libsupc++/guard.cc is including 

#include <ext/concurrence.h>

and in this include it has references to above mentioned symbol which is in
libstdc++ actually. I verified that by adding -lstdc++ to above gcc invoke
statement


This scenario happens when compiling icewm package.


-- 
           Summary: Linking with libsupc++.a creates link time undefined
                    references
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raj dot khem at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: armv5tl-montavista-linux-gnueabi


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

Reply via email to