libtool-patches
[Top][All Lists]
Advanced

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

Re: HEAD link-order.at fails when hardcode_direct=yes


From: Albert Chin
Subject: Re: HEAD link-order.at fails when hardcode_direct=yes
Date: Wed, 17 May 2006 07:44:49 -0500
User-agent: Mutt/1.5.6i

On Tue, Apr 25, 2006 at 02:55:09PM -0500, Albert Chin wrote:
> On systems with hardcode_direct=yes, the following section in
> tests/link-order.at will fail:
>   AT_CHECK([if $EGREP relinking stderr; then
>               $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' stdout
>             else :; fi], [0], [ignore], [], [echo "wrong link order"])
> 
> Why? Because "-L.*\/new\/lib -lb" will be converted to
> .*\/new\/lib/liblb$shrext_cmds.
> 
> Patch attached. Note, the new RE doesn't fully address what you
> intended. The original libtool output:
>   libtool: install: warning: relinking `src/liba.la'
>   stdout:
>   libtool: install: (cd /opt/build/libtool/tests/testsuite.dir/14; /bin/sh 
> /opt/build/libtool/libtool  --mode=relink cc -z +O2 +Olit=all +Onofltacc 
> +Oentrysched +Odataprefetch +Onolimit -no-undefined -o src/liba.la src/a.lo 
> src/libb.la -L/opt/build/libtool/tests/testsuite.dir/14/old/lib -lcee -rpath 
> /opt/build/libtool/tests/testsuite.dir/14/new/lib )
>   libtool: relink: cc -b -Wl,+h -Wl,liba.sl.0 -Wl,+b 
> -Wl,/opt/build/libtool/tests/testsuite.dir/14/new/lib -o 
> src/.libs/liba.sl.0.0  src/.libs/a.o   
> /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl 
> -L/opt/build/libtool/tests/testsuite.dir/14/old/lib 
> /opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl -lc     
> 
> Note the link order above is:
>   /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl
>   -L/opt/build/libtool/tests/testsuite.dir/14/old/lib
>   /opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl
> rather than what you probably want:
>   /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl
>   /opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl
> 
> But the ".*" pattern sucks up the
> "-L/opt/build/libtool/tests/testsuite.dir/14/old/lib".

Updated patch for new hardcode_direct_static variable:
  http://lists.gnu.org/archive/html/libtool-patches/2006-05/msg00018.html

Patch against HEAD.

2006-05-16  Albert Chin-A-Young  <address@hidden>

        * tests/link-order.at: Take hardcode_direct and
        hardcode_direct_static into consideration when testing
        link order.

-- 
albert chin (address@hidden)

-- snip snip
Index: tests/link-order.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order.at,v
retrieving revision 1.9
diff -u -p -r1.9 link-order.at
--- tests/link-order.at 5 Feb 2006 09:56:44 -0000       1.9
+++ tests/link-order.at 17 May 2006 00:58:16 -0000
@@ -20,6 +20,7 @@
 
 AT_SETUP([Link order test.])
 AT_KEYWORDS([libtool])
+eval `$LIBTOOL --config | $EGREP 
'^(hardcode_direct|hardcode_direct_static|shrext_cmds)='`
 LDFLAGS="$LDFLAGS -no-undefined"
 
 prefix_old=`pwd`/old
@@ -68,10 +69,18 @@ case $host_os in
 aix* | interix*) ;;  # These systems have different path syntax
 *)
   # Do not error if we do not relink (e.g. static-only systems)
-  AT_CHECK([if $EGREP relinking stderr; then
-             $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' stdout
-           else :; fi], [0], [ignore], [], [echo "wrong link order"])
-  ;;
+  case $hardcode_direct$hardcode_direct_static in
+  yesno)
+    AT_CHECK([if $EGREP relinking stderr; then
+               $EGREP " .*\/new\/lib/libb$shrext_cmds 
.*\/old\/lib/libcee$shrext_cmds" stdout
+             else :; fi], [0], [ignore], [], [echo "wrong link order"])
+    ;;
+  *)
+    AT_CHECK([if $EGREP relinking stderr; then
+               $EGREP " -L.*\/new\/lib -lb -L.*\/old\/lib -lcee" stdout
+             else :; fi], [0], [ignore], [], [echo "wrong link order"])
+    ;;
+  esac
 esac
 
 for i in old new; do




reply via email to

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