From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1e73ab0e39f3c740 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1993-10-07 11:26:34 PST Path: gmd.de!xlink.net!howland.reston.ans.net!sol.ctr.columbia.edu!news.kei.com!bloom-beacon.mit.edu!paperboy.osf.org!jeffc From: jeffc@soba.osf.org (Jeff Carter) Newsgroups: comp.unix.osf.osf1 Subject: Re: Help with problem with *libc_r.a* Date: 7 Oct 1993 17:08:43 GMT Organization: Open Software Foundation Distribution: world Message-ID: <291ier$g9v@paperboy.osf.org> References: <28hfdj$1a3@ahhnold.cs.utexas.edu> NNTP-Posting-Host: soba.osf.org In article <28hfdj$1a3@ahhnold.cs.utexas.edu>, marty@cs.utexas.edu (Marty J. Sirkin) writes: > I have a problem and am hoping that someone out there has an answer. > > I have an application which compiles, links and, runs with the standard > libraries (including libc.a). The application can be either single or > multi-threaded. When I run it with 2 threads (with libc.a) it quite > reasonably fails at random locations. > > I then tried to link the program with the libc_r.a that comes with our > OSF/1 distribution. I ran into quite a few unresolved externals (including > memcpy and memset). Using "ar" to look at the libraries, I noticed that > a number of functions (including the two above) are present in libc.a, but > are missing in libc_r.a > > I suspect that either: 1) I have a bad copy of libc_r.a 2) There is another > library out there with the thread-reentrant versions of the missing functions > (although I doubt this - why would they break up libc.a?) or 3) There's a > trick to this that I am missing. libc_r.a is an "overlay" for libc.a: it contains only those functions that have to change to be made thread safe. (The system call stub/errno problem is handled rather "specially", so you don't actually end up with duplicate syscall stubs). The way that libpthreads.a and libc_r.a work to implement the reentrant functions depends on replacing functions in libc that are called from other functions within libc. (This is referred to as "hookable globals"). In order for this to work, ROSE shared libraries cannot be used (libc.so), so the program must be linked without shared libraries (-lnoshrlib or -lpic-none depending on the compiler version).