libtool-patches
[Top][All Lists]
Advanced

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

Re: Preloading without .la


From: Ralf Wildenhues
Subject: Re: Preloading without .la
Date: Tue, 28 Feb 2006 18:26:23 +0100
User-agent: Mutt/1.5.11

[ Let's move this to libtool-patches
  Note also the list server may not come back up for a few days. ]

Hi Pierre,

Sorry for the delay.

* Pierre Ossman wrote on Fri, Jan 27, 2006 at 05:30:22PM CET:
> I've put together a suggestion (against 1.5 branch, but the difference 
> shouldn't be that big compared to HEAD) for this.

Many thanks for your effort!  I'm not convinced yet that this is the way
to go, on the contrary, I have real doubts, but at least this is a start.

> What it does is strip ${libext} from the name and, if we're on a 
> $need_lib_prefix system, applies a command that should reverse the 
> effect of $libname_spec. It then appends the '.la' extension.
*snip*

OK.  But the '.la' extension should be necessary for preloading only.

> The effect is that preloading and "normal" loading will work for any 
> application that uses the platform independent ways of loading:

Yep.

> Any programs that uses lt_dlopen("module.a") will break with this patch. 
> But I would consider such a call unsupported since they've been mucking 
> about in libtool internals to figure out that name.

My tests show that also lt_dlopen("module.la") may fail on some systems.

> The is another breakage caused by the fact that libtool special cases 
> the 'lib' prefix. dlpreopening a module called libfoo on a 
> $need_lib_prefix system with a prefix of 'lib' will not work. The reason 
> is that the above magic cannot tell the difference between 'libfoo' and 
> 'foo' (which will be transformed to 'libfoo') on such a system.

I'm still afraid this will cause user breakage.  You can neither expect
the user to use the prefix nor to omit it.  It's much too useful to be
able to dlopen "regular libraries", this feature is used often.

> Please review and comment. If it looks good I'll make a patch for HEAD 
> and try to do some test cases.

The naming is a bit inconsistent: we use `*_cmds' for `~'-separated
lists of commands -- yes, shrext_cmds is a bad counter example, and
should be fixed, too.  It should either be libname_rev, since it's
not a command at all, or ltmain should be able to cope with (multiple)
commands in there.  (This is documented in libtool.texi, too.)

Have you tested it?  I tested something like the patch below (after the
forward port of your patch).  There are several ugly details to be aware
of: Inside the backquotes in libname_rev, you may not use double quotes.
This is because the config.status escaping would then lead to
  "`..\"..\"..`"
which is not portable.  Also, to use $Xsed, you should add an X,
and an `-e'.  ;-)

The patch below is missing at least documentation of `libname_rev' in
libtool.texi, and some decent tests, beside the cheap one.

For me this breaks mdemo-exec.test after mdemo-static.test on GNU/Linux
(without any further modifications).  You can simulate need_lib_prefix
by help of the attached patch (which I won't apply ATM because I don't
know whether it's safe).  The patch creates a test which itself creates
a new build tree for Libtool, changes need_lib_prefix, configures mdemo,
(mdemo-conf, not mdemo-static), changes need_lib_prefix there, then
builds.  Adjust as needed.

Cheers,
Ralf

Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.35
diff -u -r1.35 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  5 Feb 2006 11:06:31 -0000       1.35
+++ libltdl/config/ltmain.m4sh  12 Feb 2006 15:05:11 -0000
@@ -874,7 +874,13 @@
        for dlprefile in $dlprefiles; do
          func_echo "extracting global C symbols from \`$dlprefile'"
          func_basename "$dlprefile"
-         name="$func_basename_result"
+         func_stripname '' ".$libext" "$func_basename_result"
+         name="$func_stripname_result"
+         if test "$need_lib_prefix" != no; then
+           eval shared_ext=\"$shrext_cmds\"
+           eval name=\"$libname_rev\"
+         fi
+         name=${name}.la
          $opt_dry_run || {
            eval '$ECHO ": $name " >> "$nlist"'
            eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.60
diff -u -r1.60 libtool.m4
--- libltdl/m4/libtool.m4       9 Feb 2006 16:04:01 -0000       1.60
+++ libltdl/m4/libtool.m4       12 Feb 2006 15:05:14 -0000
@@ -1898,6 +1898,7 @@
        [withGCC=$GCC])
 library_names_spec=
 libname_spec='lib$name'
+libname_rev='`$ECHO X$name | \$Xsed -e s/^lib//`'
 soname_spec=
 shrext_cmds=".so"
 postinstall_cmds=
@@ -2381,6 +2382,7 @@
 
 os2*)
   libname_spec='$name'
+  libname_rev='$name'
   shrext_cmds=".dll"
   need_lib_prefix=no
   library_names_spec='$libname${shared_ext} $libname.a'
@@ -2524,6 +2526,7 @@
 _LT_DECL([], [shlibpath_overrides_runpath], [0],
     [Is shlibpath searched before the hard-coded library search path?])
 _LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [libname_rev], [1], [Reverse of libname_spec])
 _LT_DECL([], [library_names_spec], [1],
     [[List of archive names.  First name is the real one, the rest are links.
     The last name is the one that the linker finds with -lNAME]])

Attachment: need-lib-prefix.diff
Description: Text document


reply via email to

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