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
*** Bug 236524 has been marked as a duplicate of this bug. ***
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)
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