[Top][All Lists]

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

Re: Bug#391427: Link order

From: Ralf Wildenhues
Subject: Re: Bug#391427: Link order
Date: Sat, 21 Oct 2006 13:30:31 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

[ adding libtool-patches; this is addressing ]

Hello, and sorry for the delay.

* Kurt Roeckx wrote on Sat, Oct 07, 2006 at 08:34:29PM CEST:
> I agree that libraries picked up from the .la file would better be added
> at the end of the list of libraries.  But I'm not sure if that's going
> to break something or not.  I guess I need to think more about this.

Maybe this testsuite addition helps you with your thoughts.

OK to apply?  Note that this kind of test is IMHO clearly controversial;
there is definitely a choice to make whether Libtool wants to commit to
supporting such a case or not.  (I haven't tested whether it works on
all kinds of systems.)

But also there is clearly no escape from the need of adding several such
cases, to define more clearly the semantics that Libtool wants to

Elsewhere in the bug thread, Kurt wrote:
> I think this is the relavant change:
> -  lt_module   module   = dlopen (filename, LT_GLOBAL | LT_LAZY_OR_NOW);
> +  lt_module   module   = dlopen (filename, LT_LAZY_OR_NOW);
> Which is a backport from the head/2.0 branch.

Yes there is a problem with this change, there have been some reports.
Before we release 2.0, we intend to add functionality to choose the
desired behavior (with non- global being the default).


2006-10-21  Ralf Wildenhues  <address@hidden>

        * tests/ New test.
        * Adjust.

RCS file: /cvsroot/libtool/libtool/,v
retrieving revision 1.200
diff -u -r1.200
--- 17 Sep 2006 20:02:15 -0000      1.200
+++ 10 Oct 2006 11:13:35 -0000
@@ -403,6 +403,7 @@
                  tests/ \
                  tests/ \
                  tests/ \
+                 tests/ \
                  tests/ \
                  tests/ \
                  tests/ \
--- /dev/null   2006-05-22 13:44:12.000000000 +0200
+++ tests/        2006-10-10 08:56:35.000000000 +0200
@@ -0,0 +1,69 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+# link-order2.test: make sure that depdepls are added right after
+# the libs that pull them in: necessary at least for static linking
+# and on systems where libraries do not link against other libraries,
+# in order to do this: override a commonly used symbol in a commonly
+# used library.
+AT_SETUP([Link order of deplibs.])
+LDFLAGS="$LDFLAGS -no-undefined"
+mkdir inst inst/bin inst/lib
+cat >a.c <<\EOF
+/* pretend we have a better sine function */
+double sin (double x) { return 0.0; }
+cat >b.c <<\EOF
+extern double sin (double);
+double b (double x) { return sin (x); }
+cat >main.c <<\EOF
+#include <math.h>
+extern double b (double);
+int main (void)
+  return fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (4.) - 2.) < 0.01;
+$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
+$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
+$CC $CPPFLAGS $CFLAGS -c main.c
+for static in '' -static; do
+  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o a.lo -rpath 
+  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o b.lo 
-rpath $libdir
+  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT -lm
+  LT_AT_EXEC_CHECK([./main])
+  $LIBTOOL --mode=install cp $libdir/
+  $LIBTOOL --mode=install cp $libdir/
+  $LIBTOOL --mode=install cp main $bindir/main
+  $LIBTOOL --mode=clean rm -f
+  LT_AT_EXEC_CHECK([$bindir/main])
+# Now the converse: if both the program and the library need libm, then
+# it needs to be sorted last.  (TODO)

reply via email to

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