This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: MT-safe exception and thread library
- To: "egcs at cygnus dot com" <egcs at cygnus dot com>
- Subject: Re: MT-safe exception and thread library
- From: "Andrew Zabolotny" <bit at freya dot etu dot ru>
- Date: Sat, 20 Dec 97 18:10:54 +0400
- Reply-To: "Andrew Zabolotny" <bit at freya dot etu dot ru>
On Wed, 17 Dec 1997 13:48:26 +0100, Teemu Torma wrote:
> One more thing: the flag. How about -fthreads instead of -threads?
>And what if there are multiple thread libraries? There are, at
>least in Solaris 2.5.
I'm not sure if this is applicable, but OS/2 resolves this following way
(since `93 or `94):
In target makefile fragment:
# Allow multi-threaded/single-threaded libraries
MULTILIB_OPTIONS = Zmt
MULTILIB_DIRNAMES = mt st
MULTILIB_MATCHES = Zmt=Zmts Zmt=Zmtd
MULTILIB_EXCEPTIONS =
MULTILIB_EXTRA_OPTS =
and with a few changes to
-----------------------------------------------------------
diff -rcwB pgcc-1.0/gcc/genmultilib pgcc-1.0-emx/gcc/genmultilib
*** pgcc-1.0/gcc/genmultilib Mon Aug 11 18:57:08 1997
--- pgcc-1.0-emx/gcc/genmultilib Mon Dec 8 23:08:38 1997
***************
*** 35,40 ****
--- 35,43 ----
# elements in the second list are separated by spaces. If the second
# argument is empty, the option names will be used as the directory
# names.
+ # If number of elements in second argument is bigger than number of
options
+ # in the first argument, the n+1'th element is used as default directory
+ # name (i.e. when no one of options specified in argument 1 was used)
# The optional third argument is a list of options which are
# identical. The elements in the list are separated by spaces. Each
***************
*** 164,169 ****
--- 167,178 ----
done
fi
+ # See if default directory was specified
+ if [ -n "$1" ]; then
+ defaultdir="$1"
+ else
+ defaultdir="."
+ fi
# We need another recursive shell script to correctly handle positive
# matches. If we are invoked as
# genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2"
***************
*** 203,209 ****
done
done
optout=`echo ${optout} | sed -e 's/^ //'`
! echo "\". ${optout};\","
# Work over the list of combinations. We have to translate each one
# to use the directory names rather than the option names, we have to
--- 212,218 ----
done
done
optout=`echo ${optout} | sed -e 's/^ //'`
! echo "\"${defaultdir} ${optout};\","
# Work over the list of combinations. We have to translate each one
# to use the directory names rather than the option names, we have to
-----------------------------the end----------------------------
It also would be nice to define some symbol (OS/2 defines __MT__ -- are
there other standards? If yes, it would be The Right Thing {tm} to define
some unique symbol everywhere (on all platforms), and all other symbols
depending on target platform) when using -mthreads (this is needed, for
example C headers checks it for a thread-aware errno). And it looks stupid
to me to make three (four counting OS/2`s -Zmt/-Zst) different switches
for same thing - producing a threaded program. There should be only one
switch, I think -fthreads looks best. I think this switch should be
unified ASAP, since later changing the switch may affect much more
makefiles.
>pthread library. Similiary, -threads would do the same thing with
>a platform-specific threads library.
-fthreads should define the preprocessor symbol and link agains
thread-aware C libraries, the thread library itself
can be as well linked with something like -lthreads.
Greetings,
_\ndy@teamOS/2