Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 201376

Summary: sys-libs/glibc[profile]: programs linked with -lc_p always segfault early
Product: Gentoo Linux Reporter: Jeffrey Graham <grahamspam>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED UPSTREAM    
Severity: major CC: nbowler, tanarrian
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
URL: https://sourceware.org/bugzilla/show_bug.cgi?id=9689
See Also: https://sourceware.org/bugzilla/show_bug.cgi?id=9689
Whiteboard:
Package list:
Runtime testing required: ---

Description Jeffrey Graham 2007-12-05 16:43:26 UTC
Added use flag profile to /etc/make.conf and re-emerged glibc 2.6.1 to get libc_p.a

Built my app and linked it against libc_p.a like this:
gcc test.c -g -pg -O0 -o test -static -lc_p

The program segfaults. The debugger reports this:
Program received signal SIGSEGV, Segmentation fault.
0x08083aeb in __mcount_internal().


This bug has been reported to other distributions...
http://people.debian.org/~terpstra/message/20070917.132524.9ab97a81.en.html



Reproducible: Always
Comment 1 SpanKY gentoo-dev 2008-09-07 06:39:36 UTC
*** Bug 236524 has been marked as a duplicate of this bug. ***
Comment 2 SpanKY gentoo-dev 2008-12-27 10:32:58 UTC
still happens with glibc-2.9 :/

$ gcc test.c -g -pg -O0 -o test -static -lc_p
$ gdb ./test
(gdb) r
Starting program: /home/vapier/test

Program received signal SIGSEGV, Segmentation fault.
0x000000000042fecb in __mcount_internal ()
(gdb) bt
#0  0x000000000042fecb in __mcount_internal ()
#1  0x000000000040dc04 in mcount ()
#2  0x0000000000000000 in ?? ()
(gdb)
Comment 3 SpanKY gentoo-dev 2008-12-27 22:02:32 UTC
Debian bug report (not that it has any info):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506850

the crash seems to be because mcount uses atomic code which relies on the TLS descriptors being setup, but that doesnt happen until __libc_start_main.  but since __libc_start_main itself calls mcount, we crash.

at any rate, moved upstream