Package: gcc-4.6
Version: 4.6.0-10
Severity: normal


Since gcc started using --no-add-needed by default, there are issues
with weak references, see attached testcase:

- libthread represents a thread library, which here only provide the
  "cancel" symbol.
- libA is a library which uses the "cancel" symbol, and links against
  the thread library.
- foo.c is a file which detects whether the thread library is brought
  into the program by showing the value of a weak reference to cancel.
- main.c uses both libA and foo.

The result is this:

cc thread.c -o -shared -fPIC
cc libA.c -o -shared -fPIC -L. -lthread -Wl,-rpath=/tmp/tmp
cc -Wall -g   -c -o foo.o foo.c
cc  foo.o main.c -o main -L. -lA
/usr/bin/ld.bfd.real: ./ undefined reference to symbol 'cancel'
/usr/bin/ld.bfd.real: note: 'cancel' is defined in DSO /tmp/tmp/ so 
try adding it to the linker command line
/tmp/tmp/ could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [main] Erreur 1

For some reason the linker doesn't manage to resolve the "cancel"
symbol, although it's supposed to be brought in by

In case you wonder where that testcast comes from, it's actually gcc
itself, the __gthread_active_p() function, which gets inlined into


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.39 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.6 depends on:
ii  binutils     The GNU assembler, linker and bina
ii  cpp-4.6               4.6.0-10           The GNU C preprocessor
ii  gcc-4.6-base          4.6.0-10           The GNU Compiler Collection (base 
ii  libc6                 2.13-4             Embedded GNU C Library: Shared lib
ii  libcloog-ppl0         0.15.9-3           the Chunky Loop Generator (runtime
ii  libgcc1               1:4.6.0-10         GCC support library
ii  libgmp10              2:5.0.1+dfsg-7     Multiprecision arithmetic library
ii  libgmpxx4ldbl         2:5.0.1+dfsg-7     Multiprecision arithmetic library 
ii  libgomp1              4.6.0-10           GCC OpenMP (GOMP) support library
ii  libmpc2               0.9-3              multiple precision complex floatin
ii  libmpfr4              3.0.1-3            multiple precision floating-point 
ii  libppl-c4             0.11.2-3           Parma Polyhedra Library (C interfa
ii  libppl9               0.11.2-3           Parma Polyhedra Library (runtime l
ii  libquadmath0          4.6.0-10           GCC Quad-Precision Math Library
ii  zlib1g                1:   compression library - runtime

Versions of packages gcc-4.6 recommends:
ii  libc6-dev                     2.13-4     Embedded GNU C Library: Developmen

Versions of packages gcc-4.6 suggests:
pn  binutils-gold             <none>         (no description available)
ii  gcc-4.6-doc               4.6-20110123-1 Documentation for the GNU compiler
pn  gcc-4.6-locales           <none>         (no description available)
pn  gcc-4.6-multilib          <none>         (no description available)
ii  libgcc1-dbg               1:4.6.0-10     GCC support library (debug symbols
pn  libgomp1-dbg              <none>         (no description available)
pn  libmudflap0-4.6-dev       <none>         (no description available)
pn  libmudflap0-dbg           <none>         (no description available)
pn  libquadmath0-dbg          <none>         (no description available)

-- no debconf information

Attachment: test.tgz
Description: application/tar-gz

Reply via email to