[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] my take on threading options
From: |
Scott James Remnant |
Subject: |
[PATCH] my take on threading options |
Date: |
Sun, 09 Nov 2003 22:51:29 +0000 |
Here's my take on the various attempts over the years to support
-pthread and the other similar options, although vaguely based in spirit
on other patches written by others -- this implementation is completely
mine.
The various options are accepted in link mode and added to $deplibs,
then later kept in $deplibs for linking libraries and for programs added
to compile_deplibs and finalize_deplibs.
This means that for BOTH programs and shared libraries, -pthread and
friends will be honoured on the command line, rather than being
rejected. The previous patch submitted to this list stopped it working
for programs! :(
It also means that if -pthread and friends are found in dependency_libs,
rather than producing the very strange "cannot find the library `'"
error message it'll honour it.
On the other hand, it deliberately doesn't place a -pthread found on the
command line into dependency_libs when writing the .la file, that way it
won't break anything else.
Scott
--
Have you ever, ever felt like this?
Had strange things happen? Are you going round the twist?
diff -ruNp libtool-CVS~/ChangeLog libtool-CVS/ChangeLog
--- libtool-CVS~/ChangeLog 2003-10-30 14:40:11.000000000 +0000
+++ libtool-CVS/ChangeLog 2003-11-09 19:27:39.000000000 +0000
@@ -0,0 +1,7 @@
+2003-11-09 Scott James Remnant <address@hidden>
+
+ * ltmain.in: Add -pthread and similar to $deplibs ($compile_deplibs
+ and $finalize_deplibs for programs) when found on the command line
+ or in a .la file's dependency_libs (but don't place them there) so
+ they are honoured when linking both programs and libraries.
+
diff -ruNp libtool-CVS~/ltmain.in libtool-CVS/ltmain.in
--- libtool-CVS~/ltmain.in 2003-10-20 14:36:10.000000000 +0100
+++ libtool-CVS/ltmain.in 2003-11-09 19:28:06.000000000 +0000
@@ -1325,6 +1325,11 @@ EOF
continue
;;
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
# gcc -m* arguments should be passed to the linker via $compiler_flags
# in order to pass architecture information to the linker
# (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
@@ -1845,6 +1850,15 @@ EOF
lib=
found=no
case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
$echo "$modename: warning: \`-l' is ignored for archives/objects"
1>&2
diff -ruNp libtool-CVS~/NEWS libtool-CVS/NEWS
--- libtool-CVS~/NEWS 2003-10-21 16:03:54.000000000 +0100
+++ libtool-CVS/NEWS 2003-11-09 19:30:31.000000000 +0000
@@ -8,6 +8,7 @@ New in 1.5b: 2003-??-??; CVS version 1.5
calls itself for relinking etc.
* -no-suppress in compile mode shows compiler output for both PIC and non-PIC
object compilation.
+* `-pthread' and similar options are honoured when linking shared libraries.
* Shared objects (.lo) are no longer created when `-static' is passed in
compile mode.
* New compile mode option `-shared' prevents creation of static objects (.o).
signature.asc
Description: This is a digitally signed message part
- [PATCH] my take on threading options,
Scott James Remnant <=