Re: Is gcc and libgcc_s.a thread-safe ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-01-19 at 17:08 -0800, Ian Lance Taylor wrote:
> biju64 <alex.jacob@xxxxxxxxxx> writes:
> 
> > What about the libgcc_s.a library that we have to link in if using gcc ? Do
> > I need to worry about this ?
> > On google I see something called libgcc_s_pthread.a - What does this do ? Do
> > I need this ? 
> 
> gcc's supporting libraries are all thread-safe.
> 
> I don't know what libgcc_s_pthread.a is--it's not part of a regular
> gcc distribution.

Err - it is not part of a _recent_ (>= gcc-4) on *AIX* any more, but up
to gcc-3.4, these libgcc_s* were provided by gcc on AIX:

$ cd /prefix/of/gcc-3.x
$ find . -name 'libgcc_s*
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/libgcc_s.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/libgcc_s_pthread.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/libgcc_s_ppc64.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/libgcc_s_pthread_ppc64.a

and theses were the libstdc++* ones:
$ find . -name '*.la' -prune -o -name 'libstdc++*' -print
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/pthread/ppc64/libstdc++.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/pthread/libstdc++.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/ppc64/libstdc++.a
./lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.5/libstdc++.a

Note: These are the _shared_ libraries on AIX.

I've always tried hard to _not_ have pthread- and non-pthread-variants
of both libgcc_s (distinguished by filename) and libstdc++
(distinguished by path) as runtime dependencies of my shared libraries
and executables.

In the end, I patched the gcc source (specs) to always behave as if
'-pthread' was passed on the commandline, but it also should work to
have a wrapper-script that always passes '-pthread'.

Even if I did not necessarily use pthreads in my application, I could
not be sure that each required library was built without -pthread. So I
built each library where I have sourcecode for using that patched gcc.
Having pthreads enabled always does not really hurt, even when not used.

Since gcc-4.1 (haven't tried gcc-4.0), the pthread-specific libs are
gone, but I still patch gcc-source to enable pthreads always. I'm not
sure if it is really necessary any more, but it still works.

HTH,
/haubi/


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux