Your message dated Sat, 07 Aug 2010 19:32:29 +0000
with message-id <[email protected]>
and subject line Bug#591405: fixed in binutils 2.20.1-13
has caused the Debian Bug report #591405,
regarding ld: -no-add-needed breaks linking with weak symbols
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
591405: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591405
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: g++-4.4
Version: 4.4.4-7
Severity: normal

 [ First of all, this bug seems to be the same as bugs #577961 and
   #578831, only they cover gcc-4.5, where afaik -Wl,-no-add-needed
   is default ]

I'm trying to build my libraries with -Wl,-no-add-needed and got an
issue wrt weak symbols handling. Here is the testcase (based on
#577961):

---- 8< Makefile ----
CXXLD=$(CXX) -Wl,-no-add-needed
CXXFLAGS=-Wall -fPIC -std=gnu++0x
CPPFLAGS=-I.
all: mymain2 mymain libkapi.so.0
mymain: mymain.o libkapi.so
        $(CXXLD) -o $@ $(CXXFLAGS) mymain.o -L. -lkapi
mymain2: mymain.o
        $(CXXLD) -o $@ $(CXXFLAGS) mymain.o
libkapi.so: libkapi.so.0
        ln -fs [email protected] $@
kapi.cc:
        touch $@
kapi.o: kapi.cc
libkapi.so.0: kapi.o
        $(CXXLD) $(CXXFLAGS) -shared -Wl,-soname -Wl,$@ -o $@ $^ -pthread
clean:
        $(RM) *.o libkapi.so.0 mymain kapi.cc libkapi.so mymain2


---- 8< mymain.cc ----
#include <iostream>
#include <memory>
#include <string>
using namespace std;

int main () {
  string numbers[] ={"one","two","three"};

  // get block of uninitialized memory:
  pair <string*,ptrdiff_t> result = get_temporary_buffer<string>(3);

  if (result.second>0) {
    uninitialized_copy ( numbers, numbers+result.second, result.first );

    for (int i=0; i<result.second; i++)
      cout << result.first[i] << " ";
    cout << endl;

    return_temporary_buffer(result.first);
  }

  return 0;
}


$ make
g++ -Wall -fPIC -std=gnu++0x -I.  -c -o mymain.o mymain.cc
g++ -Wl,-no-add-needed -o mymain2 -Wall -fPIC -std=gnu++0x mymain.o
touch kapi.cc
g++ -Wall -fPIC -std=gnu++0x -I.  -c -o kapi.o kapi.cc
g++ -Wl,-no-add-needed -Wall -fPIC -std=gnu++0x -shared -Wl,-soname 
-Wl,libkapi.so.0 -o libkapi.so.0 kapi.o -pthread
ln -fs libkapi.so.0 libkapi.so
g++ -Wl,-no-add-needed -o mymain -Wall -fPIC -std=gnu++0x mymain.o -L. -lkapi
/usr/bin/ld: :: invalid DSO for symbol `pthread_cancel@@GLIBC_2.0' definition
/lib/libpthread.so.0: could not read symbols: Bad value
collect2: ld returned 1 exit status


If CXXLD is changed back to just $(CXX) it builds ok.

As I can tell this is related to libstdc++ weakly pulling in libpthread.so, but
if then another library (libkapi.so) links explicitely to libpthread, when
linking mymain, linker wrongly decides we need pthread_cancel non-weakly.

See e.g. this thread:

        http://www.mail-archive.com/[email protected]/msg00042.html

Probably a linker issue too, so

$ ld -v
GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303



Thanks,
Kirill

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.33.6-roro-00002-gf825b2a-dirty (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.4 depends on:
ii  gcc-4.4                   4.4.4-7        The GNU C compiler
ii  gcc-4.4-base              4.4.4-7        The GNU Compiler Collection (base 
ii  libc6                     2.11.2-2       Embedded GNU C Library: Shared lib
ii  libgmp3c2                 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.4.2-3        multiple precision floating-point 
ii  libstdc++6-4.4-dev        4.4.4-7        The GNU Standard C++ Library v3 (d

g++-4.4 recommends no packages.

Versions of packages g++-4.4 suggests:
pn  g++-4.4-multilib             <none>      (no description available)
ii  gcc-4.4-doc                  4.4.4.nf1-1 documentation for the GNU compiler
ii  libstdc++6-4.4-dbg           4.4.4-7     The GNU Standard C++ Library v3 (d

-- no debconf information



--- End Message ---
--- Begin Message ---
Source: binutils
Source-Version: 2.20.1-13

We believe that the bug you reported is fixed in the latest version of
binutils, which is due to be installed in the Debian FTP archive:

binutils-dev_2.20.1-13_amd64.deb
  to main/b/binutils/binutils-dev_2.20.1-13_amd64.deb
binutils-doc_2.20.1-13_all.deb
  to main/b/binutils/binutils-doc_2.20.1-13_all.deb
binutils-gold_2.20.1-13_amd64.deb
  to main/b/binutils/binutils-gold_2.20.1-13_amd64.deb
binutils-multiarch_2.20.1-13_amd64.deb
  to main/b/binutils/binutils-multiarch_2.20.1-13_amd64.deb
binutils-source_2.20.1-13_all.deb
  to main/b/binutils/binutils-source_2.20.1-13_all.deb
binutils_2.20.1-13.diff.gz
  to main/b/binutils/binutils_2.20.1-13.diff.gz
binutils_2.20.1-13.dsc
  to main/b/binutils/binutils_2.20.1-13.dsc
binutils_2.20.1-13_amd64.deb
  to main/b/binutils/binutils_2.20.1-13_amd64.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <[email protected]> (supplier of updated binutils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sat, 07 Aug 2010 21:01:40 +0200
Source: binutils
Binary: binutils binutils-dev binutils-multiarch binutils-gold binutils-hppa64 
binutils-spu binutils-doc binutils-source
Architecture: source all amd64
Version: 2.20.1-13
Distribution: unstable
Urgency: low
Maintainer: Matthias Klose <[email protected]>
Changed-By: Matthias Klose <[email protected]>
Description: 
 binutils   - The GNU assembler, linker and binary utilities
 binutils-dev - The GNU binary utilities (BFD development files)
 binutils-doc - Documentation for the GNU assembler, linker and binary utilities
 binutils-gold - The (experimental) GNU gold linker utility
 binutils-hppa64 - The GNU assembler, linker and binary utilities targeted for 
hppa6
 binutils-multiarch - Binary utilities that support multi-arch targets
 binutils-source - The GNU assembler, linker and binary utilities (source)
 binutils-spu - The GNU assembler, linker and binary utilities targeted for 
spu-e
Closes: 591405
Changes: 
 binutils (2.20.1-13) unstable; urgency=low
 .
   * Fix --no-add-needed with weak symbols (Kirill Smelkov). Closes: #591405.
Checksums-Sha1: 
 1c625b338e009c05efda3970b944add9207ea5c8 1283 binutils_2.20.1-13.dsc
 ddd419ebfa8d42b784b38f762bdcb9fd53fe7cc2 93428 binutils_2.20.1-13.diff.gz
 2e28ad45f4ae17862da8d9cc0d60b8423a07196c 548856 binutils-doc_2.20.1-13_all.deb
 d6b7e3b775d4267ae30ff1c7f5199d522a40ec98 16288640 
binutils-source_2.20.1-13_all.deb
 42944f90268019c52fba9f5e01a1bab287e8bf90 3991958 binutils_2.20.1-13_amd64.deb
 980d055efae2af58d5076e1ff8089dd8e7da1d27 3560494 
binutils-dev_2.20.1-13_amd64.deb
 8cbc65704f650a3ad3f3e34d5169f17a3ac1e67c 2053054 
binutils-multiarch_2.20.1-13_amd64.deb
 ae8ed1d5bb2496bd27d387e3a422b0dcabd7fe30 1388 binutils-gold_2.20.1-13_amd64.deb
Checksums-Sha256: 
 bd6405f556f21b93720539df3813a15497e354eb076e400de49d6818926ce9a3 1283 
binutils_2.20.1-13.dsc
 46a00e5694db4c87e6cb6417d9866619d4f2132aea1b38d8cbd56fb0c85182bd 93428 
binutils_2.20.1-13.diff.gz
 9dd864a6bb699f71af0c219456c1745b4a883caf2bc55b75ed9472eac361edc3 548856 
binutils-doc_2.20.1-13_all.deb
 1c89df64f149880af50afcbf6521ae0637aa07e753ddd786b86c882388d19699 16288640 
binutils-source_2.20.1-13_all.deb
 2554940d61ab9bb90429e1018355a0033c9bbf3d759e3d80001f5b8bb25cec26 3991958 
binutils_2.20.1-13_amd64.deb
 d902efbd1ecebe2a508660b7e52e05df9c26a7ac48b5f1200f398e1f24b40053 3560494 
binutils-dev_2.20.1-13_amd64.deb
 70dba5f0f71509ac444580e39de403fff252ca5b6cdc9c07505966a4eceb962e 2053054 
binutils-multiarch_2.20.1-13_amd64.deb
 f5c650345702063110a2d33407b6df2c2c42b626e3038ed9e4e0d81c1548c56f 1388 
binutils-gold_2.20.1-13_amd64.deb
Files: 
 77b9581309318a0f32a36a507b17948c 1283 devel optional binutils_2.20.1-13.dsc
 21898f214a1bca21d0bedfc1254e1997 93428 devel optional 
binutils_2.20.1-13.diff.gz
 a2eafa160709e3d997641ee8e024eac9 548856 doc optional 
binutils-doc_2.20.1-13_all.deb
 5f0a345bbe3d067c5d97e6e0ffa09543 16288640 devel optional 
binutils-source_2.20.1-13_all.deb
 e0ab705d09dabf9eb1c5a67af9020c2f 3991958 devel optional 
binutils_2.20.1-13_amd64.deb
 ad002f899a533212cd4c63680dfaf0f9 3560494 devel extra 
binutils-dev_2.20.1-13_amd64.deb
 db9830e68706bcfedd42b66ecfff00fb 2053054 devel extra 
binutils-multiarch_2.20.1-13_amd64.deb
 fec1c3cdcca8f58c32dd8ae1a907f212 1388 devel extra 
binutils-gold_2.20.1-13_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkxdseMACgkQStlRaw+TLJxpswCgqqbKRuRegLMa3RSmiB8W93LV
f9YAoJ0qgi8iruBsrzI8RMSU3Lekwgdk
=NUDb
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to