Re: cope with dlopen(NULL) failing on AIX (was: support AIX 6.1 in config.rpath)

2008-01-12 Thread Ralf Wildenhues
Hi Bob,

* Bob Friesenhahn wrote on Sat, Jan 12, 2008 at 05:30:39PM CET:
> On Sat, 12 Jan 2008, Ralf Wildenhues wrote:
> >
> >I still don't know why it doesn't "just work".  But here is a somewhat
> >less crude hack.  OK to apply?

> This patch looks ok to me.

Applied.  Thank you for your speedy reviews!

Cheers,
Ralf




Re: cope with dlopen(NULL) failing on AIX (was: support AIX 6.1 in config.rpath)

2008-01-12 Thread Bob Friesenhahn

On Sat, 12 Jan 2008, Ralf Wildenhues wrote:


I still don't know why it doesn't "just work".  But here is a somewhat
less crude hack.  OK to apply?  Fixing this could maybe be more nicely
be done in ltdl.c, but I would like to defer that until after 2.2, and
with this I don't see any obvious semantic downsides.


This patch looks ok to me.

Bob



FWIW, this patch requires that LT_INIT is expanded before LTDL_INIT.

Thanks,
Ralf

2008-01-12  Ralf Wildenhues  <[EMAIL PROTECTED]>

* libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define
LTDL_DLOPEN_SELF_WORKS, depending upon lt_cv_dlopen_self.
* libltdl/loaders/dlopen.c (vm_open) [!LTDL_DLOPEN_SELF_WORKS]:
Fail for dlopen(NULL), so that the preopen loader is used.  This
fixes mdemo-exec.test failures on AIX where dlopen(NULL)
succeeds but dlsym resolves no symbol.
* NEWS: Update.
Report by Rainer Tammer.

Index: NEWS
===
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.213
diff -u -r1.213 NEWS
--- NEWS11 Jan 2008 07:08:27 -  1.213
+++ NEWS12 Jan 2008 14:38:45 -
@@ -116,6 +116,7 @@
  - Some configure variables have been renamed to fix caching:
lt_prog_compiler_pic_works to lt_cv_prog_compiler_pic_works
lt_prog_compiler_static_works to lt_cv_prog_compiler_static_works.
+  - Fix 1.9b regression: lt_dlopen(NULL) works on AIX again.
  - Loads of smaller bug fixes.


Index: libltdl/loaders/dlopen.c
===
RCS file: /cvsroot/libtool/libtool/libltdl/loaders/dlopen.c,v
retrieving revision 1.11
diff -u -r1.11 dlopen.c
--- libltdl/loaders/dlopen.c4 Jul 2007 23:05:05 -   1.11
+++ libltdl/loaders/dlopen.c12 Jan 2008 14:38:45 -
@@ -1,7 +1,7 @@
/* loader-dlopen.c --  dynamic linking with dlopen/dlsym

   Copyright (C) 1998, 1999, 2000, 2004, 2006,
- 2007 Free Software Foundation, Inc.
+ 2007, 2008 Free Software Foundation, Inc.
   Written by Thomas Tanner, 1998

   NOTE: The canonical source of this file is maintained with the
@@ -178,7 +178,14 @@
#endif
}

-  module = dlopen (filename, module_flags);
+  /* On AIX, dlopen(NULL) succeeds but dlsym of symbols fails.
+ In this case, fail here to let the preopen loader do the job. */
+#ifndef LTDL_DLOPEN_SELF_WORKS
+  if (!filename)
+module = NULL;
+  else
+#endif
+module = dlopen (filename, module_flags);

  if (!module)
{
Index: libltdl/m4/ltdl.m4
===
RCS file: /cvsroot/libtool/libtool/libltdl/m4/ltdl.m4,v
retrieving revision 1.39
diff -u -r1.39 ltdl.m4
--- libltdl/m4/ltdl.m4  8 Jan 2008 19:39:19 -   1.39
+++ libltdl/m4/ltdl.m4  12 Jan 2008 14:38:46 -
@@ -338,6 +338,12 @@
m4_require([_LT_CHECK_DLPREOPEN])dnl
m4_require([_LT_DECL_SED])dnl

+# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
+if test "$lt_cv_dlopen_self" = yes; then
+  AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
+[Define if dlopen(NULL) is able to resolve symbols from the main program.])
+fi
+
dnl Don't require this, or it will be expanded earlier than the code
dnl that sets the variables it relies on:
_LT_ENABLE_INSTALL


___
Bug-libtool mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-libtool



==
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/





cope with dlopen(NULL) failing on AIX (was: support AIX 6.1 in config.rpath)

2008-01-12 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Thu, Jan 10, 2008 at 10:20:30PM CET:
> > * Rainer Tammer wrote on Tue, Jan 08, 2008 at 05:03:30PM CET:
> > 
> > > did not find the `myfunc' function
> > > error was: Function not implemented (myfunc)
> > > did not find the `myvar' variable
> > > error was: Function not implemented (myvar)
> > > FAIL: tests/mdemo-exec.test
[...]
> branch-1-5 ltdl finds these symbols with the preopen loader.
> HEAD tries with the dlopen one, and then fails.
> 
> I think this is due to the order in which lt_dlopen tries the loaders,
> and for some reason or other we changed that order (deliberately?) in
> HEAD over branch-1-5.
> 
> At least with this crude hack I can get the failure to disappear.
> What I don't know yet is how to fix this right, nor why this patch would
> even be needed: glancing at the documentation, dlopen(NULL) should just
> work.

I still don't know why it doesn't "just work".  But here is a somewhat
less crude hack.  OK to apply?  Fixing this could maybe be more nicely
be done in ltdl.c, but I would like to defer that until after 2.2, and
with this I don't see any obvious semantic downsides.

FWIW, this patch requires that LT_INIT is expanded before LTDL_INIT.

Thanks,
Ralf

2008-01-12  Ralf Wildenhues  <[EMAIL PROTECTED]>

* libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define
LTDL_DLOPEN_SELF_WORKS, depending upon lt_cv_dlopen_self.
* libltdl/loaders/dlopen.c (vm_open) [!LTDL_DLOPEN_SELF_WORKS]:
Fail for dlopen(NULL), so that the preopen loader is used.  This
fixes mdemo-exec.test failures on AIX where dlopen(NULL)
succeeds but dlsym resolves no symbol.
* NEWS: Update.
Report by Rainer Tammer.

Index: NEWS
===
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.213
diff -u -r1.213 NEWS
--- NEWS11 Jan 2008 07:08:27 -  1.213
+++ NEWS12 Jan 2008 14:38:45 -
@@ -116,6 +116,7 @@
   - Some configure variables have been renamed to fix caching:
 lt_prog_compiler_pic_works to lt_cv_prog_compiler_pic_works
 lt_prog_compiler_static_works to lt_cv_prog_compiler_static_works.
+  - Fix 1.9b regression: lt_dlopen(NULL) works on AIX again.
   - Loads of smaller bug fixes.
 
 
Index: libltdl/loaders/dlopen.c
===
RCS file: /cvsroot/libtool/libtool/libltdl/loaders/dlopen.c,v
retrieving revision 1.11
diff -u -r1.11 dlopen.c
--- libltdl/loaders/dlopen.c4 Jul 2007 23:05:05 -   1.11
+++ libltdl/loaders/dlopen.c12 Jan 2008 14:38:45 -
@@ -1,7 +1,7 @@
 /* loader-dlopen.c --  dynamic linking with dlopen/dlsym
 
Copyright (C) 1998, 1999, 2000, 2004, 2006,
- 2007 Free Software Foundation, Inc.
+ 2007, 2008 Free Software Foundation, Inc.
Written by Thomas Tanner, 1998
 
NOTE: The canonical source of this file is maintained with the
@@ -178,7 +178,14 @@
 #endif
 }
 
-  module = dlopen (filename, module_flags);
+  /* On AIX, dlopen(NULL) succeeds but dlsym of symbols fails.
+ In this case, fail here to let the preopen loader do the job. */
+#ifndef LTDL_DLOPEN_SELF_WORKS
+  if (!filename)
+module = NULL;
+  else
+#endif
+module = dlopen (filename, module_flags);
 
   if (!module)
 {
Index: libltdl/m4/ltdl.m4
===
RCS file: /cvsroot/libtool/libtool/libltdl/m4/ltdl.m4,v
retrieving revision 1.39
diff -u -r1.39 ltdl.m4
--- libltdl/m4/ltdl.m4  8 Jan 2008 19:39:19 -   1.39
+++ libltdl/m4/ltdl.m4  12 Jan 2008 14:38:46 -
@@ -338,6 +338,12 @@
 m4_require([_LT_CHECK_DLPREOPEN])dnl
 m4_require([_LT_DECL_SED])dnl
 
+# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
+if test "$lt_cv_dlopen_self" = yes; then
+  AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
+[Define if dlopen(NULL) is able to resolve symbols from the main program.])
+fi
+
 dnl Don't require this, or it will be expanded earlier than the code
 dnl that sets the variables it relies on:
 _LT_ENABLE_INSTALL