Bug#442858: libc6-prof: programs linked agains libc_p.a crash with a SEGV
Package: libc6-prof
Version: 2.6.1-4
Severity: grave
Justification: renders package unusable
Hi,
I don't seem to able build any program linked against the
profiled version of the glibc.
I can reproduce the problem with any version of gcc (3.3, 3.4,
4.0, 4.1, 4.2), with 2.6.1-1 and 2.6.1-4. Manually linking
against libc6-prof_2.3.6.ds1-13etch4_i386.deb using the crt's in
libc6-dev_2.3.6.ds1-13etch4_i386.deb (on the same unstable
debian host) is OK.
Consider this simple C program:
#include <stdio.h>
int main()
{
printf("a\n");
return 0;
}
Compiled with:
~$ gcc -o b -pg -g b.c -lc_p
~$ ./b
zsh: floating point exception (core dumped) ./b
But, the thing is that both the profiled and non-profiled are
linked in:
~$ ldd b
linux-gate.so.1 => (0xffffe000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7f87000)
libc.so.6 => /lib/libc.so.6 (0xb7e3f000)
/lib/ld-linux.so.2 (0xb7fac000)
Then trying to build it statically:
~$ gcc -o b -static -nodefaultlibs -pg -g b.c -lc_p -lgcc_eh
/usr/lib/gcc/i486-linux-gnu/4.2.1/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE':
(.text+0x1a87): undefined reference to `dl_iterate_phdr'
collect2: ld returned 1 exit status
I do get the same with -lc, and it seems it's because of some
circular dependencies for which I need:
gcc -o b -static -nodefaultlibs -pg -g b.c -Wl,-start-group -lc_p -lgcc_eh -Wl,-end-group
Same can be achieved by calling ld directly and replacing -lc
with -lc_p.
But now:
~$ ./b
zsh: segmentation fault (core dumped) ./b
(gdb) bt
#0 0x08072d5b in __mcount_internal ()
#1 0x00000000 in ?? ()
(gdb) disassemble
Dump of assembler code for function __mcount_internal:
0x08072d40 <__mcount_internal+0>: push %ebp
0x08072d41 <__mcount_internal+1>: mov %eax,%ecx
0x08072d43 <__mcount_internal+3>: mov %esp,%ebp
0x08072d45 <__mcount_internal+5>: xor %eax,%eax
0x08072d47 <__mcount_internal+7>: sub $0x10,%esp
0x08072d4a <__mcount_internal+10>: mov %edx,0xfffffff0(%ebp)
0x08072d4d <__mcount_internal+13>: mov $0x1,%edx
0x08072d52 <__mcount_internal+18>: mov %ebx,0xfffffff4(%ebp)
0x08072d55 <__mcount_internal+21>: mov %esi,0xfffffff8(%ebp)
0x08072d58 <__mcount_internal+24>: mov %edi,0xfffffffc(%ebp)
0x08072d5b <__mcount_internal+27>: cmpl $0x0,%gs:0xc
0x08072d63 <__mcount_internal+35>: je 0x8072d66 <__mcount_internal+38>
0x08072d65 <__mcount_internal+37>: lock cmpxchg %edx,0x80c4e40
0x08072d6d <__mcount_internal+45>: test %eax,%eax
0x08072d6f <__mcount_internal+47>: jne 0x8072d8b <__mcount_internal+75>
0x08072d71 <__mcount_internal+49>: mov %ecx,%eax
0x08072d73 <__mcount_internal+51>: sub 0x80c4e60,%eax
0x08072d79 <__mcount_internal+57>: cmp 0x80c4e68,%eax
[...]
Again, the same works fine with etch's libc (2.3.6).
Here are the details for the related packages:
||/ Name Version
+++-=======================================-===========
ii binutils 2.18-1
ii gcc 4:4.2.1-6
ii gcc-3.3 1:3.3.6-15
ii gcc-3.4 3.4.6-6
ii gcc-4.0 4.0.3-7
ii gcc-4.1 4.1.2-16
ii gcc-4.2 4.2.1-5
ii libc6-dev 2.6.1-4
ii libc6-prof 2.6.1-4
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.23-rc6
Locale: LANG=en_GB.ISO-8859-15, LC_CTYPE=en_GB.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash
Versions of packages libc6-prof depends on:
ii libc6 2.6.1-4 GNU C Library: Shared libraries
libc6-prof recommends no packages.
-- no debconf information
Reply to: