libtool
[Top][All Lists]
Advanced

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

Re: Preloading without .la


From: Pierre Ossman
Subject: Re: Preloading without .la
Date: Fri, 27 Jan 2006 17:30:22 +0100
User-agent: Mozilla Thunderbird 1.0.7-2.1.fc4.nr (X11/20051011)

I've put together a suggestion (against 1.5 branch, but the difference shouldn't be that big compared to HEAD) for this.

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.

Example:

On a non-$need_lib_prefix system:

foomodule.a => foomodule => foomodule.la

On a $need_lib_prefix system:

libfoomodule.a => libfoomodule => foomodule => foomodule.la

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

 - lt_dlopen("module.la")
 - lt_dlopenext("module")
 - lt_dlopenext("module.la")


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.


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.


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

--
Pierre Ossman                Telephone: +46-13-21 46 00
Cendio AB                    Web: http://www.cendio.com
Index: libtool.m4
===================================================================
RCS file: /sources/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.148
diff -u -r1.314.2.148 libtool.m4
--- libtool.m4  21 Jan 2006 16:46:08 -0000      1.314.2.148
+++ libtool.m4  27 Jan 2006 16:16:49 -0000
@@ -1195,6 +1195,7 @@
 [AC_MSG_CHECKING([dynamic linker characteristics])
 library_names_spec=
 libname_spec='lib$name'
+libname_rev_cmds='echo $name | $Xsed "s/^lib//"'
 soname_spec=
 shrext_cmds=".so"
 postinstall_cmds=
@@ -1669,6 +1670,7 @@
 
 os2*)
   libname_spec='$name'
+  libname_rev_cmds='$name'
   shrext_cmds=".dll"
   need_lib_prefix=no
   library_names_spec='$libname${shared_ext} $libname.a'
@@ -4133,7 +4135,7 @@
   # variables and quote the copies for generation of the libtool script.
   for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC 
LTCFLAGS NM \
     SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    libname_spec libname_rev_cmds library_names_spec soname_spec 
extract_expsyms_cmds \
     old_striplib striplib file_magic_cmd finish_cmds finish_eval \
     deplibs_check_method reload_flag reload_cmds need_locks \
     lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
Index: ltmain.in
===================================================================
RCS file: /sources/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.118
diff -u -r1.334.2.118 ltmain.in
--- ltmain.in   21 Jan 2006 16:46:08 -0000      1.334.2.118
+++ ltmain.in   27 Jan 2006 16:16:49 -0000
@@ -4577,7 +4577,12 @@
 
          for arg in $dlprefiles; do
            $show "extracting global C symbols from \`$arg'"
-           name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+           name=`$echo "$arg" | ${SED} -e 's%^.*/%%' | ${SED} -e 
's%\.'${libext}'$%%'`
+           if test "$need_lib_prefix" != no; then
+             eval shared_ext=\"$shrext_cmds\"
+             eval name=\"$libname_rev_cmds\"
+           fi
+           name="${name}.la"
            $run eval '$echo ": $name " >> "$nlist"'
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
          done

reply via email to

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