Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-08-12 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Sat, Aug 02, 2008 at 12:51:36PM CEST:
 * Gary V. Vaughan wrote on Tue, May 06, 2008 at 07:24:46PM CEST:
  * libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
  provides lt_dladvise_preopen when deciding if installed libltdl
  is 'new enough'.
  * libltdl/libltdl/lt__private.h (lt__advise): Add a new
  is_preload flag.
  * libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
  (try_dlopen): If it is set, and the search of preloaded modules
  didn't return a match, don't bother searching the filesystem.
  * libltdl/ltdl.h (lt_dladvise_preload): Declare it.
  * doc/libtool.texi (Libltdl Interface): Document it.
  * tests/lt_dladvise.at: Test it (and incidentally add some test
  coverage for `libtool -dlpreopen').
  * NEWS: Announce it.
 
 This patch causes a testsuite failure on GNU/Linux.

As a step toward stabilization, I would like to propose to revert the
above patch.  Its acceptance should rely on its test passing on at least
more than one of Darwin, MinGW, GNU/Linux, and AIX.  (Does it currently
pass on any of them?)

OK to revert?  Or, rather: does anybody have problems with the reversal?

Thanks,
Ralf

 # -*- compilation -*-
 45. lt_dladvise.at:28: testing ...
 ../../libtool/tests/lt_dladvise.at:305: case $LIBLTDL in #(
  */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
 esac
 Not enabling shell tracing (command contains an embedded newline)
 stdout:
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c moddepend.c  -fPIC -DPIC -o 
 .libs/moddepend.o
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c moddepend.c -o moddepend.o /dev/null 
 21
 ../../libtool/tests/lt_dladvise.at:330: $LIBTOOL --mode=link $CC -module 
 $CFLAGS $LDFLAGS -o libdepend.la \
 moddepend.lo -rpath /foo -avoid-version
 Not enabling shell tracing (command contains an embedded newline)
 stderr:
 stdout:
 libtool: link: gcc -shared  .libs/moddepend.o  -Wl,-soname 
 -Wl,libdepend.so -o .libs/libdepend.so
 libtool: link: ar cru .libs/libdepend.a  moddepend.o
 libtool: link: ranlib .libs/libdepend.a
 libtool: link: ( cd .libs  rm -f libdepend.la  ln -s 
 ../libdepend.la libdepend.la )
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modresident.c  -fPIC -DPIC -o 
 .libs/modresident.o
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modresident.c -o modresident.o 
 /dev/null 21
 ../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
 $CFLAGS $LDFLAGS -o lib$name.la \
 mod$name.lo -rpath /foo -avoid-version
 Not enabling shell tracing (command contains an embedded newline)
 stderr:
 stdout:
 libtool: link: gcc -shared  .libs/modresident.o  -Wl,-soname 
 -Wl,libresident.so -o .libs/libresident.so
 libtool: link: ar cru .libs/libresident.a  modresident.o
 libtool: link: ranlib .libs/libresident.a
 libtool: link: ( cd .libs  rm -f libresident.la  ln -s 
 ../libresident.la libresident.la )
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modlocal.c  -fPIC -DPIC -o 
 .libs/modlocal.o
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modlocal.c -o modlocal.o /dev/null 21
 ../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
 $CFLAGS $LDFLAGS -o lib$name.la \
 mod$name.lo -rpath /foo -avoid-version
 Not enabling shell tracing (command contains an embedded newline)
 stderr:
 stdout:
 libtool: link: gcc -shared  .libs/modlocal.o  -Wl,-soname -Wl,liblocal.so 
 -o .libs/liblocal.so
 libtool: link: ar cru .libs/liblocal.a  modlocal.o
 libtool: link: ranlib .libs/liblocal.a
 libtool: link: ( cd .libs  rm -f liblocal.la  ln -s ../liblocal.la 
 liblocal.la )
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modglobal.c  -fPIC -DPIC -o 
 .libs/modglobal.o
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modglobal.c -o modglobal.o /dev/null 
 21
 ../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
 $CFLAGS $LDFLAGS -o lib$name.la \
 mod$name.lo -rpath /foo -avoid-version
 Not enabling shell tracing (command contains an embedded newline)
 stderr:
 stdout:
 libtool: link: gcc -shared  .libs/modglobal.o  -Wl,-soname 
 -Wl,libglobal.so -o .libs/libglobal.so
 libtool: link: ar cru .libs/libglobal.a  modglobal.o
 libtool: link: ranlib .libs/libglobal.a
 libtool: link: ( cd .libs  rm -f libglobal.la  ln -s 
 ../libglobal.la libglobal.la )
 libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
 -DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modpreload.c  -fPIC -DPIC -o 
 .libs/modpreload.o
 libtool: 

Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-08-12 Thread Bob Friesenhahn

On Tue, 12 Aug 2008, Ralf Wildenhues wrote:


This patch causes a testsuite failure on GNU/Linux.


As a step toward stabilization, I would like to propose to revert the
above patch.  Its acceptance should rely on its test passing on at least
more than one of Darwin, MinGW, GNU/Linux, and AIX.  (Does it currently
pass on any of them?)

OK to revert?  Or, rather: does anybody have problems with the reversal?


Temporarily or permanently?

It seems that lt_dladvise_preload() is needed to allow ltdl to be more 
secure for applications which need it.  It should be ok to revert the 
patch temporarily so that the forthcoming release can be cut.


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





Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-08-12 Thread Ralf Wildenhues
* Bob Friesenhahn wrote on Tue, Aug 12, 2008 at 09:27:07PM CEST:
 On Tue, 12 Aug 2008, Ralf Wildenhues wrote:

 OK to revert?  Or, rather: does anybody have problems with the reversal?

 Temporarily or permanently?

Ah, chucks.  Incomplete research.  I take the above back, for now,
and brood over it a little more.  Sorry.

Looks like preloading was borked before this patch, only exposed now.

Cheers,
Ralf




Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-08-12 Thread Peter O'Gorman
Ralf Wildenhues wrote:
 * Bob Friesenhahn wrote on Tue, Aug 12, 2008 at 09:27:07PM CEST:
 On Tue, 12 Aug 2008, Ralf Wildenhues wrote:
 OK to revert?  Or, rather: does anybody have problems with the reversal?
 Temporarily or permanently?
 
 Ah, chucks.  Incomplete research.  I take the above back, for now,
 and brood over it a little more.  Sorry.
 
 Looks like preloading was borked before this patch, only exposed now.

Yes, the test exposed it. It adds the .so when it should be adding the
.a. I also looked at this over the weekend, but did not figure out where
it fails.

Peter
-- 
Peter O'Gorman
http://pogma.com




Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-08-02 Thread Ralf Wildenhues
Hi Gary,

* Gary V. Vaughan wrote on Tue, May 06, 2008 at 07:24:46PM CEST:
 * libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
 provides lt_dladvise_preopen when deciding if installed libltdl
 is 'new enough'.
 * libltdl/libltdl/lt__private.h (lt__advise): Add a new
 is_preload flag.
 * libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
 (try_dlopen): If it is set, and the search of preloaded modules
 didn't return a match, don't bother searching the filesystem.
 * libltdl/ltdl.h (lt_dladvise_preload): Declare it.
 * doc/libtool.texi (Libltdl Interface): Document it.
 * tests/lt_dladvise.at: Test it (and incidentally add some test
 coverage for `libtool -dlpreopen').
 * NEWS: Announce it.

This patch causes a testsuite failure on GNU/Linux.
Also note the repeated file in the 'rm' call hints
to two nits: it should be 'rm -f', and there is some
uniquification needed in func_mode_clean.

I haven't had time to review this patch otherwise yet, sorry.

Cheers,
Ralf


# -*- compilation -*-
45. lt_dladvise.at:28: testing ...
../../libtool/tests/lt_dladvise.at:305: case $LIBLTDL in #(
 */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
esac
Not enabling shell tracing (command contains an embedded newline)
stdout:
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c moddepend.c  -fPIC -DPIC -o 
.libs/moddepend.o
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c moddepend.c -o moddepend.o /dev/null 21
../../libtool/tests/lt_dladvise.at:330: $LIBTOOL --mode=link $CC -module 
$CFLAGS $LDFLAGS -o libdepend.la \
moddepend.lo -rpath /foo -avoid-version
Not enabling shell tracing (command contains an embedded newline)
stderr:
stdout:
libtool: link: gcc -shared  .libs/moddepend.o  -Wl,-soname -Wl,libdepend.so 
-o .libs/libdepend.so
libtool: link: ar cru .libs/libdepend.a  moddepend.o
libtool: link: ranlib .libs/libdepend.a
libtool: link: ( cd .libs  rm -f libdepend.la  ln -s ../libdepend.la 
libdepend.la )
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modresident.c  -fPIC -DPIC -o 
.libs/modresident.o
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modresident.c -o modresident.o /dev/null 
21
../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
$CFLAGS $LDFLAGS -o lib$name.la \
mod$name.lo -rpath /foo -avoid-version
Not enabling shell tracing (command contains an embedded newline)
stderr:
stdout:
libtool: link: gcc -shared  .libs/modresident.o  -Wl,-soname 
-Wl,libresident.so -o .libs/libresident.so
libtool: link: ar cru .libs/libresident.a  modresident.o
libtool: link: ranlib .libs/libresident.a
libtool: link: ( cd .libs  rm -f libresident.la  ln -s 
../libresident.la libresident.la )
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modlocal.c  -fPIC -DPIC -o .libs/modlocal.o
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modlocal.c -o modlocal.o /dev/null 21
../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
$CFLAGS $LDFLAGS -o lib$name.la \
mod$name.lo -rpath /foo -avoid-version
Not enabling shell tracing (command contains an embedded newline)
stderr:
stdout:
libtool: link: gcc -shared  .libs/modlocal.o  -Wl,-soname -Wl,liblocal.so 
-o .libs/liblocal.so
libtool: link: ar cru .libs/liblocal.a  modlocal.o
libtool: link: ranlib .libs/liblocal.a
libtool: link: ( cd .libs  rm -f liblocal.la  ln -s ../liblocal.la 
liblocal.la )
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modglobal.c  -fPIC -DPIC -o 
.libs/modglobal.o
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modglobal.c -o modglobal.o /dev/null 21
../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
$CFLAGS $LDFLAGS -o lib$name.la \
mod$name.lo -rpath /foo -avoid-version
Not enabling shell tracing (command contains an embedded newline)
stderr:
stdout:
libtool: link: gcc -shared  .libs/modglobal.o  -Wl,-soname -Wl,libglobal.so 
-o .libs/libglobal.so
libtool: link: ar cru .libs/libglobal.a  modglobal.o
libtool: link: ranlib .libs/libglobal.a
libtool: link: ( cd .libs  rm -f libglobal.la  ln -s ../libglobal.la 
libglobal.la )
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modpreload.c  -fPIC -DPIC -o 
.libs/modpreload.o
libtool: compile:  gcc -I/home/ralf/libtool/build/../libtool/libltdl 
-DHAVE_UNDEFINED_SYMBOLS=1 -g -O2 -c modpreload.c -o modpreload.o /dev/null 
21
../../libtool/tests/lt_dladvise.at:344: $LIBTOOL --mode=link $CC -module 
$CFLAGS $LDFLAGS -o lib$name.la \
  

Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-05-07 Thread Gary V. Vaughan

On 6 May 2008, at 14:07, Ralf Wildenhues wrote:

Hi Gary,


Hallo Ralf,


a quick nit review (I haven't looked thoroughly yet):


Thanks.  I'll fix these nits and repost an updated [PATCH 370 bis]  
shortly.  I'm only commenting on the nits I disagree with here.   
Everything else will be addressed in the repost.



* Gary V. Vaughan wrote on Tue, May 06, 2008 at 07:24:46PM CEST:

--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,10 @@ NEWS - list of user-visible changes between  
releases of GNU Libtool


New in 2.2.??: 2008-06-??: git version 2.2.5a, Libtool team:

-* Bug fixes:
+* New features:

-  - None yet


No need to remove the Bug fixes section, there will certainly be  
entries

later, no?  ;-)


What? Bugs in libtool?  Of course not!!

But seriously, that was a spurious place-holder when I added the git  
version 2.2.5a line, to stop it looking lonely :-)  No need for the  
place-holder now that we have some real information there.



--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4
@@ -264,7 +264,7 @@ if test x$with_included_ltdl != xyes; then
  # decide whether there is a useful installed version we can use.
  AC_CHECK_HEADER([ltdl.h],
  [AC_CHECK_DECL([lt_dlinterface_register],
-  [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
+  [AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
   [with_included_ltdl=no],
   [with_included_ltdl=yes])],
   [with_included_ltdl=yes],


I view this as a separate change.


I disagree at the moment, but I'm glad you brought it up, as I went  
back and forth on it myself for a while...



Not sure whether we should have a
policy to always require the newest available feature or not, in an
installed ltdl.


My reasoning is that if you have libtoolized your package with a  
particular set of ltdl.m4 et al and you read the associated info  
manual on libltdl features, there is every chance that you will have  
used that newest available feature.  Without explicitly checking which  
features are actually used by the parent project, the best we can  
offer is to require that everything up to and including that newest  
feature is available from the installed libltdl before we decide to  
use it in preference to the shipped libltdl.


That being the case, updating ltdl.m4 to do that correctly is very  
much a part of a patch that adds a new libltdl entry point.


Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_






PGP.sig
Description: This is a digitally signed message part


[PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-05-06 Thread Gary V. Vaughan
* libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
provides lt_dladvise_preopen when deciding if installed libltdl
is 'new enough'.
* libltdl/libltdl/lt__private.h (lt__advise): Add a new
is_preload flag.
* libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
(try_dlopen): If it is set, and the search of preloaded modules
didn't return a match, don't bother searching the filesystem.
* libltdl/ltdl.h (lt_dladvise_preload): Declare it.
* doc/libtool.texi (Libltdl Interface): Document it.
* tests/lt_dladvise.at: Test it (and incidentally add some test
coverage for `libtool -dlpreopen').
* NEWS: Announce it.
---

This makes it possible to build a libltdl client with some preloaded
modules, and limit lt_dlopenadvise to open only the preloaded modules.

For example: nearly all of GNU M4 is implemented as modules, with the
core functionality preloaded by default.  All module loading is
handled by lt_dlopenadvise irrespective of whether modules were
preloaded or need to be found in M4PATH.  However, it is also
possible to turn off gnu extensions, such as path searching and
module loading with -G, but we still need to be able to lt_dlopen
the preloaded core modules when module loading proper has been
disabled.  With this patch I can use the lt_dlodvise_preopen hint
when the driver loads the preloaded core modules, even though user
module loading from the filesystem is turned off without the need
to maintain two codepaths (load preloaded core modules even if
they can't be found in the filesystem vs load arbitrary modules
from the filesystem in gnu extended mode).

Okay to push?

 ChangeLog |   17 
 NEWS  |5 ++-
 doc/libtool.texi  |7 +
 libltdl/libltdl/lt__private.h |1 +
 libltdl/ltdl.c|   25 +-
 libltdl/ltdl.h|1 +
 libltdl/m4/ltdl.m4|2 +-
 tests/lt_dladvise.at  |   56 +
 8 files changed, 98 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15ffae1..2a1c843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-05-06  Gary V. Vaughan  [EMAIL PROTECTED]
+
+   Implement lt_dlopening of only preloaded modules.
+   * libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
+   provides lt_dladvise_preopen when deciding if installed libltdl
+   is 'new enough'.
+   * libltdl/libltdl/lt__private.h (lt__advise): Add a new
+   is_preload flag.
+   * libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
+   (try_dlopen): If it is set, and the search of preloaded modules
+   didn't return a match, don't bother searching the filesystem.
+   * libltdl/ltdl.h (lt_dladvise_preload): Declare it.
+   * doc/libtool.texi (Libltdl Interface): Document it.
+   * tests/lt_dladvise.at: Test it (and incidentally add some test
+   coverage for `libtool -dlpreopen').
+   * NEWS: Announce it.
+
 2008-05-05  Gary V. Vaughan  [EMAIL PROTECTED]
 
Fix libtoolize test failure with aclocal  1.10.1
diff --git a/NEWS b/NEWS
index 2b113fb..3354e6c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,10 @@ NEWS - list of user-visible changes between releases of GNU 
Libtool
 
 New in 2.2.??: 2008-06-??: git version 2.2.5a, Libtool team:
 
-* Bug fixes:
+* New features:
 
-  - None yet
+  - New lt_dloadvise_preload() call to set a hint that only preloadeded
+modules can be opened.
 
 New in 2.2.4: 2008-05-04: git version 2.2.3a, Libtool team:
 
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 31ba0c7..e694655 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -3816,6 +3816,13 @@ On failure, @code{lt_dladvise_resident} returns non-zero 
and sets an error
 message that can be retrieved with @code{lt_dlerror}.
 @end deftypefun
 
[EMAIL PROTECTED] int lt_dladvise_preload (lt_dladvise [EMAIL PROTECTED])
+Set the @code{preload} hint on @var{advise}.  Passing an @var{advise}
+parameter to @code{lt_dlopenadvise} with this hint set causes it to
+load only preloaded modules, so that if a suitable preleaded module is
+not found, @code{lt_dlopenadvise} will return @code{NULL}.
[EMAIL PROTECTED] deftypefun
+
 @deftypefun int lt_dlclose (lt_dlhandle @var{handle})
 Decrement the reference count on the module @var{handle}.
 If it drops to zero and no other module depends on this module,
diff --git a/libltdl/libltdl/lt__private.h b/libltdl/libltdl/lt__private.h
index 4ce936d..fd6e662 100644
--- a/libltdl/libltdl/lt__private.h
+++ b/libltdl/libltdl/lt__private.h
@@ -126,6 +126,7 @@ struct lt__advise {
   subsequently loaded modules.  */
   unsigned int is_symlocal:1;  /* module symbols are only available
   locally. */
+  unsigned int is_preload:1;   /* only preloaded modules will be tried.  */
 };
 
 /* --- ERROR HANDLING --- */
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 

Re: [PATCH 370] Implement lt_dlopening of only preloaded modules.

2008-05-06 Thread Ralf Wildenhues
Hi Gary,

a quick nit review (I haven't looked thoroughly yet):

* Gary V. Vaughan wrote on Tue, May 06, 2008 at 07:24:46PM CEST:
 
 This makes it possible to build a libltdl client with some preloaded
 modules, and limit lt_dlopenadvise to open only the preloaded modules.

 --- a/NEWS
 +++ b/NEWS
 @@ -2,9 +2,10 @@ NEWS - list of user-visible changes between releases of GNU 
 Libtool
  
  New in 2.2.??: 2008-06-??: git version 2.2.5a, Libtool team:
  
 -* Bug fixes:
 +* New features:
  
 -  - None yet

No need to remove the Bug fixes section, there will certainly be entries
later, no?  ;-)

 --- a/doc/libtool.texi
 +++ b/doc/libtool.texi
 @@ -3816,6 +3816,13 @@ On failure, @code{lt_dladvise_resident} returns 
 non-zero and sets an error
  message that can be retrieved with @code{lt_dlerror}.
  @end deftypefun
  
 [EMAIL PROTECTED] int lt_dladvise_preload (lt_dladvise [EMAIL PROTECTED])
 +Set the @code{preload} hint on @var{advise}.  Passing an @var{advise}
 +parameter to @code{lt_dlopenadvise} with this hint set causes it to
 +load only preloaded modules, so that if a suitable preleaded module is

s/preleaded/preloaded/

 +not found, @code{lt_dlopenadvise} will return @code{NULL}.
 [EMAIL PROTECTED] deftypefun
 +

 --- a/libltdl/libltdl/lt__private.h
 +++ b/libltdl/libltdl/lt__private.h
 @@ -126,6 +126,7 @@ struct lt__advise {
  subsequently loaded modules.  */
unsigned int   is_symlocal:1;  /* module symbols are only available
  locally. */
 +  unsigned int   is_preload:1;   /* only preloaded modules will be 
 tried.  */

s/is_preload/try_preload_only/  ?


 --- a/libltdl/ltdl.c
 +++ b/libltdl/ltdl.c
 @@ -1257,27 +1257,40 @@ try_dlopen (lt_dlhandle *phandle, const char 
 *filename, const char *ext,
  
if (vtable)
   {
 +   char *archive_name = MALLOC (char, LT_STRLEN (name) + 3);
 *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
  
 -   if (*phandle == NULL)
 +   if ((*phandle == NULL) || (archive_name == NULL))
   {
 ++errors;
 goto cleanup;
   }
 newhandle = *phandle;
  
 -   if (tryall_dlopen (newhandle, attempt, advise, vtable) == 0)
 +   /* Preloaded modules are always named according to their old
 +  archive name.  */
 +   sprintf (archive_name, %s.a, name);
 +
 +   if (tryall_dlopen (newhandle, archive_name, advise, vtable) == 0)
   {
 goto register_handle;

Leaking archive_name here.

   }
  
 /* If we're still here, there was no matching preloaded module,
so put things back as we found them, and continue searching.  */
 +   FREE (archive_name);
 FREE (*phandle);
 newhandle = NULL;
   }
  }
  


 --- a/libltdl/m4/ltdl.m4
 +++ b/libltdl/m4/ltdl.m4
 @@ -264,7 +264,7 @@ if test x$with_included_ltdl != xyes; then
# decide whether there is a useful installed version we can use.
AC_CHECK_HEADER([ltdl.h],
[AC_CHECK_DECL([lt_dlinterface_register],
 -[AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
 +[AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
  [with_included_ltdl=no],
  [with_included_ltdl=yes])],
  [with_included_ltdl=yes],

I view this as a separate change.  Not sure whether we should have a
policy to always require the newest available feature or not, in an
installed ltdl.

 --- a/tests/lt_dladvise.at
 +++ b/tests/lt_dladvise.at

AFAICS the test doesn't ensure that, if the platform supports
non-preloaded module, lt_dladvise_preload causes trying to load them to
fail.

Cheers,
Ralf