bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/15636] New: [2.24 regression] missing NEEDED libc when building


From: doko at debian dot org
Subject: [Bug ld/15636] New: [2.24 regression] missing NEEDED libc when building with g++ -Wl,--as-needed
Date: Mon, 17 Jun 2013 11:26:24 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=15636

            Bug ID: 15636
           Summary: [2.24 regression] missing NEEDED libc when building
                    with g++ -Wl,--as-needed
           Product: binutils
           Version: 2.24 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: doko at debian dot org

[forwarded from http://bugs.debian.org/712081]

Compiling a trivial int a() {return 17;} file with
g++ -v -Wl,--as-needed t.c --shared -o libt${n}.so

With binutils 2.23.52.20130612-1:
$ readelf -d /tmp/libt3.so | grep NEEDED
$ objdump -T libt3.so | grep _cxa_fin
0000000000000000  w   D  *UND*  0000000000000000 __cxa_finalize

While with binutils 2.22-8 and 2.23.2:
$ readelf -d libt2.so  | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
$ objdump -T libt2.so | grep _cxa_fin
0000000000000000  w   DF *UND*  0000000000000000  GLIBC_2.2.5 __cxa_finalize

i.e. the dependency on libc.so.6 is missing and what is worse:
the libc6 symbol is not properly versioned, which might mean that that
library might cause programs segfault with future libc versions.

g++ says it does:
COLLECT_GCC_OPTIONS='-v' '-shared' '-o' 'libt3.so' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.7/collect2 --sysroot=/ --build-id
--eh-frame-hdr -m elf_x86_64 --hash-style=gnu -shared -o libt3.so
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbeginS.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.7
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../..
--as-needed /tmp/cc8CjUQJ.o -lstdc++ -lm -lgcc_s -lc -lgcc_s
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o

with the need for symbol __cxa_finalize coming from crtbeginS.o:

$ objdump -t /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbeginS.o | grep _cxa_fi
0000000000000000  w      *UND*  0000000000000000 __cxa_finalize

gcc unlike g++ is not affected because it puts a --no-as-needed before -lc

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]