libtool-patches
[Top][All Lists]
Advanced

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

[PATCH] Don't pass dependency_libs on program link line on Linux


From: Scott James Remnant
Subject: [PATCH] Don't pass dependency_libs on program link line on Linux
Date: Mon, 29 Mar 2004 00:32:10 +0100

The dynamic link loader on some platforms, such as Linux, is able to
correctly process the following style of dependency tree:

        prog
      /      \
     /        \
libone        libtwo
            /        \
           /          \
       libthree     libfour

Therefore when linking ‘prog’, we only need to pass "-lone -ltwo" on the
link line.  Libtool's current behaviour causes problems when libone and
libfour are different version of the same library with an alternative
method (such as versioned symbols) of resolving symbols.

Okay to apply?

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      2004-03-24 14:23:18.000000000 +0000
+++ libtool-CVS/ChangeLog       2004-03-28 22:12:29.000000000 +0100
@@ -0,0 +1,11 @@
+2004-03-28  Scott James Remnant  <address@hidden>
+
+       * ltmain.in: The dynamic link loader on some platforms is able to
+       correctly traverse dependency trees, therefore when $link_all_deplibs
+       is set to 'no' don't add the contents of dependency_libs to the
+       link line to link a program.
+       * m4/libtool.m4 (AC_LIBTOOL_PROG_LD_SHLIBS) [linux*]: Linux is one
+       of those platforms, set link_all_deplibs to 'no' for both C++ and
+       other compilers.
+       * NEWS: Updated.
+
diff -ruNp libtool-CVS~/ltmain.in libtool-CVS/ltmain.in
--- libtool-CVS~/ltmain.in      2004-03-24 02:59:18.000000000 +0000
+++ libtool-CVS/ltmain.in       2004-03-28 21:45:45.000000000 +0100
@@ -1904,7 +1904,10 @@ EOF
        case $pass in
        dlopen) libs="$dlfiles" ;;
        dlpreopen) libs="$dlprefiles" ;;
-       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       link)
+         libs="$deplibs %DEPLIBS%"
+         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+         ;;
        esac
       fi
       if test "$pass" = dlopen; then
diff -ruNp libtool-CVS~/m4/libtool.m4 libtool-CVS/m4/libtool.m4
--- libtool-CVS~/m4/libtool.m4  2004-03-24 14:08:28.000000000 +0000
+++ libtool-CVS/m4/libtool.m4   2004-03-28 22:08:26.000000000 +0100
@@ -3381,6 +3381,9 @@ m4_if([$1], [CXX], [
   cygwin* | mingw*)
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* 
__nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' 
| sort | uniq > $export_symbols'
   ;;
+  linux*)
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+  ;;
   *)
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
@@ -3566,6 +3569,7 @@ _LT_EOF
       else
         _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1)
       fi
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=no
     else
       _LT_AC_TAGVAR(ld_shlibs, $1)=no
     fi
diff -ruNp libtool-CVS~/NEWS libtool-CVS/NEWS
--- libtool-CVS~/NEWS   2004-03-24 14:13:19.000000000 +0000
+++ libtool-CVS/NEWS    2004-03-28 22:13:41.000000000 +0100
@@ -31,6 +31,9 @@ New in 1.5b: 2004-??-??; CVS version 1.5
 * If you configure libtool with --disable-shared (or if libtool does not
   support shared libraries on your platform) trying to build a library using
   `-shared' is a fatal error.
+* libtool no longer adds the contents of dependency_libs to the link line
+  to link a program on Linux as its dynamic link loader is able to
+  correctly traverse dependency trees.
 * libtoolize installs libtool.m4 (and ltdl.m4 if used) to AC_CONFIG_MACRO_DIR.
 * Mode inferrence removed, shorthand for choosing modes added.
 * Specifying -allow-undefined is now an error.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]