libtool-patches
[Top][All Lists]
Advanced

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

FYI: fix order of -L flags added for libtool dep libs


From: Ralf Wildenhues
Subject: FYI: fix order of -L flags added for libtool dep libs
Date: Thu, 14 Apr 2005 13:58:07 +0200
User-agent: Mutt/1.4.1i

* Peter O'Gorman wrote on Wed, Apr 13, 2005 at 02:43:37PM CEST:
> Ralf Wildenhues wrote:
> >The depdepl part is darwin-specific.  Tell me this is a non-issue and I
> >will happily believe you.  :)
> 
> Looks like a non-issue.

Alright.  I believe you.  :)

> I considered back-porting the change I made to HEAD to use darwin ld's 
> -dylib_file flag to point to the indirectly referenced libraries (instead 
> of the stable branch's behavior of just adding them to the link line), but 
> thought that maybe it was too big a change for the stable branch. What do 
> you think?

Naa, don't do that.  Thanks for looking!

FYI, I have applied the pending patch to branch-2-0, and the patch below
to HEAD.  It uses the new testsuite, and sure again feels a little like
working around the limitations of Autotest.  Suggestions for improvement
welcome.  We should also start to think about using the grouping
feature more consistently in the long run.

Regards,
Ralf


Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.145
diff -u -r1.145 Makefile.am
--- Makefile.am 13 Apr 2005 12:24:34 -0000      1.145
+++ Makefile.am 14 Apr 2005 08:41:38 -0000
@@ -305,6 +305,7 @@
                  tests/inherited_flags.at \
                  tests/libtoolize.at \
                  tests/stresstest.at \
+                 tests/link-order.at \
                  tests/template.at
 
 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.60
diff -u -r1.60 ltmain.m4sh
--- config/ltmain.m4sh  7 Apr 2005 17:58:26 -0000       1.60
+++ config/ltmain.m4sh  14 Apr 2005 08:41:38 -0000
@@ -4054,7 +4054,7 @@
              esac
              case " $deplibs " in
              *" $path "*) ;;
-             *) deplibs="$deplibs $path" ;;
+             *) deplibs="$path $deplibs" ;;
              esac
            done
          fi # link_all_deplibs != no
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.10
diff -u -r1.10 testsuite.at
--- tests/testsuite.at  7 Apr 2005 06:37:23 -0000       1.10
+++ tests/testsuite.at  14 Apr 2005 08:41:38 -0000
@@ -72,4 +72,6 @@
 m4_include([template.at])
 # libtoolize tests
 m4_include([libtoolize.at])
+# link order test
+m4_include([link-order.at])
 
--- /dev/null   2005-04-04 11:53:15.417024464 +0200
+++ tests/link-order.at 2005-04-14 10:38:27.656825616 +0200
@@ -0,0 +1,88 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# link-order.test - make sure that library linking order matches
+
+AT_BANNER([Libtool link order test.])
+AT_SETUP([Link order test.])
+: ${LIBTOOL=${abs_top_builddir}/libtool}
+: ${EGREP='grep -E'}
+eval `$LIBTOOL --config | grep ECHO=`
+
+prefix_old=`pwd`/old
+prefix_new=`pwd`/new
+mkdir src $prefix_old $prefix_new $prefix_old/lib $prefix_new/lib
+
+AT_DATA(src/c.c,
+[[int c = 1;
+]])
+
+$LIBTOOL --mode=compile $CC $CFLAGS -c src/c.c -o src/c.lo
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libcee.la src/c.lo -rpath 
$prefix_old/lib
+$LIBTOOL --mode=install cp src/libcee.la $prefix_old/lib/libcee.la
+
+for i in old new; do
+  rm -rf src
+  mkdir src
+
+  AT_DATA(src/a_$i.c,
+[[extern int c;
+extern int b_$i();
+int a_$i() { return c + b_$i(); }
+]])
+
+  AT_DATA(src/b_$i.c,
+[[extern int c;
+int b_$i() { return 1 + c; }
+]])
+
+  prefix=`eval echo \\$prefix_$i`
+  $LIBTOOL --mode=compile $CC $CFLAGS -c src/a_$i.c -o src/a.lo
+  $LIBTOOL --mode=compile $CC $CFLAGS -c src/b_$i.c -o src/b.lo
+  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libb.la src/b.lo \
+      -L$prefix_old/lib -lcee -rpath $prefix/lib
+  $LIBTOOL --mode=link $CC $CFLAGS -o src/liba.la src/a.lo \
+      src/libb.la -L$prefix_old/lib -lcee -rpath $prefix/lib
+  $LIBTOOL --mode=install cp src/libb.la $prefix/lib/libb.la
+  $LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la
+done
+
+# Do not error if we do not relink (e.g. static-only systems)
+AT_CHECK([$LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la >mylog 
2>&1;
+         if $EGREP relinking mylog; then
+           $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' mylog
+         else :;
+         fi], [0], [ignore], [ignore], [echo "wrong link order"])
+
+
+for i in old new; do
+  AT_DATA(src/main_$i.c,
+[[extern int a_$i();
+int main(void) { return a_$i() != 3; }
+]])
+
+  prefix=`eval echo \\$prefix_$i`
+  $LIBTOOL --mode=compile $CC $CFLAGS -c src/main_$i.c -o src/main_$i.lo
+  AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/main_$i 
src/main_$i.lo -L$prefix/lib -la,
+          [0], [ignore], [ignore])
+  
+  AT_CHECK(src/main_$i, [0],,,
+           [AT_CHECK(if test "X$host" != "X$build"; then exit 77; fi)])
+done
+
+AT_CLEANUP




reply via email to

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