libtool-patches
[Top][All Lists]
Advanced

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

libltdl skips dlopen loader if there are others


From: Ralf Wildenhues
Subject: libltdl skips dlopen loader if there are others
Date: Tue, 4 Mar 2008 23:31:43 +0100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

Hello,

this fixes one of the most long-standing regressions of 2.2 over
branch-1-5.  It causes issues on every system that has not only the
dlopen loader, but also another one.  I bet this is the cause for
some long-standing issues on w32.

On HP-UX, the lt_dladvise test fails with
| ../../libtool-2.1c/tests/lt_dladvise.at:316: $LIBTOOL --mode=execute $modules 
./main; lt_status=$?;
|            if test $lt_status -eq 0; then :;
|            elif test "X$host" != "X$build" && \
|                 { test -x "./main" || test -x "./main"$EXEEXT; }
|            then (exit 77); else (exit $lt_status); fi
| Not enabling shell tracing (command contains an embedded newline)
| 4c4
| < depend: 5
| ---
| > depend: 4
| 38. lt_dladvise.at:28: 38. lt_dlopenadvise library loading 
(lt_dladvise.at:28): FAILED (lt_dladvise.at:316)

In this test, there are two modules, one to be loaded RTLD_LOCAL and
one RTLD_GLOBAL.  Using the wrong of two symbols 'i' causes the above
failure.

What happens here?  HP-UX 11.23 has both dlopen and shl_load interfaces.
Only the dlopen interface knows how to load with RTLD_LOCAL.  We
actually use prepend priority for dlopen, and append priority for
shl_load.  Compiling with -DLT_DEBUG_LOADERS shows the dlopen loader is
never even used, although dlopen.a has successfully been preopened.

Further, when I munge the config.cache file fooling libtool into
thinking that shl_load does not work, the tests suddenly passes,
which proves that the dlopen loader works here.

So, after lots of searching (I first noted this bugs sometime last year)
I found that our linked list implementation is b0rked.  I feel like Gary
and I both should run around with a rather big brown bag for a while ...
:-/

Gary, could you take care of pushing this change to upstream slist users
if any?

Cheers, and thanks,
Ralf

        Fix libltdl to not skip dlopen on systems with several loaders,
        such as HP-UX, Cygwin.
        * libltdl/slist.c (slist_concat): When appending to the tail
        of a list, do not drop items off the beginning of the list.
        * NEWS: Update.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.221
diff -u -r1.221 NEWS
--- NEWS        4 Mar 2008 21:25:48 -0000       1.221
+++ NEWS        4 Mar 2008 22:30:36 -0000
@@ -6,6 +6,8 @@
 
   - Fix 2.2 regression in libltdl that causes memory corruption upon
     repeated `lt_dlinit(); lt_dlexit()'.
+  - Fix 2.2 regression in libltdl that skipped the dlopen loader if
+    the system also supports other loaders (e.g., Cygwin, HP-UX).
   - Fix 2.2 regression in that `libtool --mode=execute CMD ARGS' does not
     transform ARGS that do not look like shell or C wrappers of libtool
     programs.
Index: libltdl/slist.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/slist.c,v
retrieving revision 1.10
diff -u -r1.10 slist.c
--- libltdl/slist.c     7 Sep 2007 02:44:57 -0000       1.10
+++ libltdl/slist.c     4 Mar 2008 22:30:36 -0000
@@ -1,6 +1,6 @@
 /* slist.c -- generalised singly linked lists
 
-   Copyright (C) 2000, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2004, 2007, 2008 Free Software Foundation, Inc.
    Written by Gary V. Vaughan, 2000
 
    NOTE: The canonical source of this file is maintained with the
@@ -140,15 +140,18 @@
 SList *
 slist_concat (SList *head, SList *tail)
 {
+  SList *last;
+
   if (!head)
     {
       return tail;
     }
 
-  while (head->next)
-    head = head->next;
+  last = head;
+  while (last->next)
+    last = last->next;
 
-  head->next = tail;
+  last->next = tail;
 
   return head;
 }




reply via email to

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