public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/565] New: Linking with -lc_p and -lpthreads causes seg fault in all applications
@ 2004-11-21  8:08 bji-glibc@ischo.com
  2004-11-22 11:01 ` [Bug libc/565] " jakub@redhat.com
  0 siblings, 1 reply; 2+ messages in thread
From: bji-glibc@ischo.com @ 2004-11-21  8:08 UTC (permalink / raw)
  To: glibc-bugs

The glibc profiling library and the pthreads library cannot be linked into the
same application.  Consider this simple program:

int main()
{
    return 0;
}

Compiled like so:

gcc -g -pg -o proftest proftest.cpp -lc_p -lpthread

This program will immediately segmentation fault when run.  I realize that the
pthreads library is not strictly needed for this program but it is needed for
the programs I am working on and this makes a simple test case.

Here is the stack trace which results from the crash:

bji$ ./proftest 
Segmentation fault (core dumped)
bji$ gdb ./proftest
GNU gdb Red Hat Linux (6.1post-1.20040607.41rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) r
[Thread debugging using libthread_db enabled]
[New Thread -1208019264 (LWP 2400)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208019264 (LWP 2400)]
0x0807999c in _dl_get_tls_static_info ()
(gdb) where
#0  0x0807999c in _dl_get_tls_static_info ()
#1  0x0052661c in __pthread_initialize_minimal_internal ()
   from /lib/tls/libpthread.so.0
#2  0x005262f8 in call_initialize_minimal () from /lib/tls/libpthread.so.0
#3  0x00525e98 in _init () from /lib/tls/libpthread.so.0
#4  0x00a752e4 in _dl_init_internal () from /lib/ld-linux.so.2
#5  0x00a697f5 in _dl_start_user () from /lib/ld-linux.so.2
(gdb) quit

Compiling without -lc_p or without -lpthread will work just fine.  But they
cannot be combined.

-- 
           Summary: Linking with -lc_p and -lpthreads causes seg fault in
                    all applications
           Product: glibc
           Version: 2.3.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: bji-glibc at ischo dot com
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: Fedora Core 3 (GNU/Linux)


http://sources.redhat.com/bugzilla/show_bug.cgi?id=565

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/565] Linking with -lc_p and -lpthreads causes seg fault in all applications
  2004-11-21  8:08 [Bug libc/565] New: Linking with -lc_p and -lpthreads causes seg fault in all applications bji-glibc@ischo.com
@ 2004-11-22 11:01 ` jakub@redhat.com
  0 siblings, 0 replies; 2+ messages in thread
From: jakub@redhat.com @ 2004-11-22 11:01 UTC (permalink / raw)
  To: glibc-bugs

------- Additional Comments From jakub at redhat dot com  2004-11-22 11:01 -------
-lc_p is only .a library, not DSO as well.
Therefore if you use it, you must be statically linking and -lpthread in that
case must come before -lc_p.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sources.redhat.com/bugzilla/show_bug.cgi?id=565

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-22 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-21  8:08 [Bug libc/565] New: Linking with -lc_p and -lpthreads causes seg fault in all applications bji-glibc@ischo.com
2004-11-22 11:01 ` [Bug libc/565] " jakub@redhat.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).