[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#530388: g++-4.3: g++ linker driver leaves undefined references to GCC intrinsics on shared objects on armel



Package: g++-4.3
Version: 4.3.3-10
Severity: important

When linking a shared object file from one or several object files
that use GCC's intrinsic atomic functions like
__sync_bool_compare_and_swap, __sync_sub_and_fetch,
__sync_add_and_fetch..., g++ linker driver leaves that symbols as
undefined to the library created, so later attempts to use the library
will fail. It behaves correctly when using gcc for linking,
however. Here I send a simple testcase:

debian-armel:~# cat foo.c
void doit(void **p, void *val, void *val2)
{
  __sync_bool_compare_and_swap(p, val, val2);
}
debian-armel:~# gcc foo.c -c
debian-armel:~# g++ -shared foo.o -o libfoo.so
debian-armel:~# nm -D libfoo.so | grep sync
         U __sync_bool_compare_and_swap_4
debian-armel:~# gcc -shared foo.o -o libfoo.so
debian-armel:~# nm -D libfoo.so | grep sync
debian-armel:~#

*Linking:

debian-armel:~# g++ -shared foo.o -o libfoo.so
debian-armel:~# cat dummymain.c
int main(){return 0;}
debian-armel:~# g++ dummymain.c libfoo.so
/usr/bin/ld: a.out: hidden symbol `__sync_bool_compare_and_swap_4' in /usr/lib/gcc/arm-linux-gnueabi/4.3.3/libgcc.a(linux-atomic.o) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status

Thank you for your help,

Alberto

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: armel (armv5tejl)

Kernel: Linux 2.6.26-1-versatile
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.3 depends on:
ii  gcc-4.3                 4.3.3-10         The GNU C compiler
ii  gcc-4.3-base            4.3.3-10         The GNU Compiler Collection (base 
ii  libc6                   2.9-12           GNU C Library: Shared libraries
ii  libgcc1                 1:4.4.0-5        GCC support library
ii  libgmp3c2               2:4.2.4+dfsg-8.1 Multiprecision arithmetic library
ii  libmpfr1ldbl            2.4.1-1          multiple precision floating-point 
ii  libstdc++6-4.3-dev      4.3.3-10         The GNU Standard C++ Library v3 (d

g++-4.3 recommends no packages.

Versions of packages g++-4.3 suggests:
pn  gcc-4.3-doc                   <none>     (no description available)
pn  libstdc++6-4.3-dbg            <none>     (no description available)

-- no debconf information



Reply to: