From 8e3fac3a304132c67c8faa280ac6194b17c7fa6b Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 14 Apr 2005 11:59:46 +0000 Subject: [PATCH] * config/ltmain.m4sh (link mode): Add to tmp_libs paths for libtool dep libs in reverse order as well. * tests/Makefile.am, tests/link-order.test: New test. --- ChangeLog | 7 +++ config/ltmain.m4sh | 2 +- tests/Makefile.am | 3 +- tests/link-order.test | 105 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100755 tests/link-order.test diff --git a/ChangeLog b/ChangeLog index 058243c2c..5e95b6178 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-14 Alexandre Oliva , + Ralf Wildenhues + + * config/ltmain.m4sh (link mode): Add to tmp_libs paths for libtool dep + libs in reverse order as well. + * tests/Makefile.am, tests/link-order.test: New test. + 2005-04-12 Ralf Wildenhues * config/general.m4sh, libtool.m4 (_LT_SETUP), tests/defs.m4sh: diff --git a/config/ltmain.m4sh b/config/ltmain.m4sh index 06ce90a26..85d1a20eb 100644 --- a/config/ltmain.m4sh +++ b/config/ltmain.m4sh @@ -4022,7 +4022,7 @@ func_mode_link () esac case " $deplibs " in *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no diff --git a/tests/Makefile.am b/tests/Makefile.am index 5bdda9a15..1b7e68e73 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -64,7 +64,8 @@ COMMON_TESTS = \ depdemo-inst.test depdemo-relink.test depdemo-unst.test \ mdemo-shared.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ - cdemo-undef.test cdemo-make.test cdemo-exec.test + cdemo-undef.test cdemo-make.test cdemo-exec.test \ + link-order.test if HAVE_CXX if HAVE_F77 diff --git a/tests/link-order.test b/tests/link-order.test new file mode 100755 index 000000000..7bc681a03 --- /dev/null +++ b/tests/link-order.test @@ -0,0 +1,105 @@ +#! /bin/sh +# link-order.test - make sure that library linking order matches + +# Copyright (C) 2005 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# 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 of the License, 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, a copy can be downloaded from +# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + +. ./defs || exit 1 + +retcode=0 + +rm -rf linkorder.dir +mkdir linkorder.dir +top_dir=`pwd`/linkorder.dir +prefix_old=$top_dir/old +prefix_new=$top_dir/new +srcdir=linkorder.dir/src +mkdir $srcdir $prefix_old $prefix_new $prefix_old/lib $prefix_new/lib + +cat >$srcdir/c.c <$srcdir/a_$i.c <$srcdir/b_$i.c <$srcdir/stdout 2>$srcdir/stderr || retcode=1 + cat $srcdir/stdout + cat $srcdir/stderr >&2 +done + +# Do not error if we do not relink (e.g. static-only systems) +if $EGREP relinking $srcdir/stderr; then + if $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' $srcdir/stdout; then :; else + echo "$0: wrong link order" 1>&2 + retcode=1 + fi +fi + +for i in old new; do + cat >$srcdir/main_$i.c <&2 + if test "X$host" != "X$build"; then + echo "This may be ok since you seem to be cross-compiling." 1>&2 + retcode=77 + else + retcode=1 + fi + fi +done + +rm -rf $top_dir +exit $retcode -- 2.47.2