FYI: HEAD old static/shared tests
Darn, I sometimes suck. Give me that brown paper bag, please. Fast. (been in there since 2005-08-12). Applied to HEAD. Duly sorry, Ralf * tests/defs.m4sh (func_configure_nofail): Actually pass options (like --disable-shared) to func_configure. Index: tests/defs.m4sh === RCS file: /cvsroot/libtool/libtool/tests/defs.m4sh,v retrieving revision 1.15 diff -u -r1.15 defs.m4sh --- tests/defs.m4sh 27 Sep 2005 06:48:22 - 1.15 +++ tests/defs.m4sh 12 Nov 2005 09:15:48 - @@ -205,7 +205,7 @@ # Configure the demonstration, fail on error. func_configure () { -func_configure_nofail +func_configure_nofail ${1+$@} if test $conf_status -eq $EXIT_FAILURE; then exit $EXIT_FAILURE fi
FYI: ltoptions nit
| configure.ac:2: warning: Unknown Libtool option `bla' is much nicer than | unknown channel Unknown Libtool option `bla' at /home/ralf/local/share/autoconf/Autom4te/Channels.pm line 541 :) Cheers, Ralf * libltdl/m4/ltoptions.m4 (_LT_SET_OPTION): Use m4_warning instead of m4_warn. Index: libltdl/m4/ltoptions.m4 === RCS file: /cvsroot/libtool/libtool/libltdl/m4/ltoptions.m4,v retrieving revision 1.6 diff -u -r1.6 ltoptions.m4 --- libltdl/m4/ltoptions.m4 1 Nov 2005 14:26:38 - 1.6 +++ libltdl/m4/ltoptions.m4 12 Nov 2005 12:07:22 - @@ -27,7 +27,7 @@ [m4_define(_LT_MANGLE_OPTION([$1]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1]), _LT_MANGLE_DEFUN([$1]), -[m4_warn([Unknown Libtool option `$1'])])[]dnl +[m4_warning([Unknown Libtool option `$1'])])[]dnl ])
Re: cygwin dlopening backends
Hi Charles, Eric, * Charles Wilson wrote on Thu, Nov 10, 2005 at 05:55:28AM CET: What interface id should loadlibrary.c's vm_open() itself use? loadlibrary.c is not itself a module...or is it? Yes, it is. In CVS HEAD, it's a dlpreloaded (static) module. Note that most of the args passed-thru to the linker are given '-Xlinker' precedents, but the --enable-auto-image-base uses '-Wl,' instead. Should this be fixed? The current syntax 'works' (or would, if it weren't for that missing lt_dlhandle_next symbol) but stylistically the inconsistency is ugly. Hmm. We changed the '-Wl,$lib' specifically for MSYS, because we need the shell to do the path conversion to w32 paths here. We could use '-Xlinker --enable-auto-image-base' as well, I guess, for consistency, but then again all linker flags passed by the user will have '-Wl,' prefixed, so that would still be inconsistent. OTOH, changing all to '-Xlinker' uses a tiny bit more command line length, a scarce resource on w32. We could also separate mingw from cygwin setting here.. Shrug. I don't know. What do you like best? (Some patches for the actual bugs coming up in another mail..) Cheers, Ralf
Re: cygwin dlopening backends
Hi Charles, Eric, * Charles Wilson wrote on Thu, Nov 10, 2005 at 05:55:28AM CET: Ralf Wildenhues wrote: There are several separate issues here: 1) lt_dlhandle_iterate breakage of loadlibrary.c 2) needed dlinterface_free (or maybe _unregister?) including documentation 3) cygwin managed mount fix of loadlibrary.c or remove the cygwin-specific code of loadlibrary.c 4) use either - only dlopen, or - first dlopen, then LoadLibrary on cygwin, or - make the choice configurable I think Ralf's issues (1) and (2) need fixing first Please take a look at and test the following patches which should address (1), (2), and (3). I have not done a lot testing myself /yet/, so beware. I'm not so sure whether we should register/free the thing in loadlibrary every time instead of once at the start: those memory checker users always go nuts when they find a small, constant-amount of allocated memory not freed before exit(). (OTOH, we might be lucky in that there aren't any good checkers -- at least that I know of -- for mingw or cygwin ;-) Also, I wasn't sure whether paths on w32 (all incarnations) can be bound by MAX_PATH. The documentation for cygwin_conv_to_full_win32_path suggests that at least for cygwin this is safe. Cheers, Ralf 2005-11-12 Eric Blake [EMAIL PROTECTED], Ralf Wildenhues [EMAIL PROTECTED] * libltdl/ltdl.h, libltdl/ltdl.c (lt_dlinterface_free): New function. * doc/libtool.texi (User defined module data): Document it. * libltdl/ltdl.c (lt_dlhandle_iterate): Fix endless loop. * libltdl/loaders/loadlibrary.c (iface_id): New variable. (loadlibrary__module_interface): New function. (get_vtable): Register it to `lt_dlinterface_register'. (get_vtable): Rewrite to catch up with lt_dlhandle_iterate interface change. Append dot only after w32 path conversion so it works on cygwin managed mounts. Index: doc/libtool.texi === RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v retrieving revision 1.204 diff -u -r1.204 libtool.texi --- doc/libtool.texi7 Nov 2005 14:35:35 - 1.204 +++ doc/libtool.texi12 Nov 2005 12:57:07 - @@ -3848,6 +3848,10 @@ returned by the iteration functions below. @end deftypefun [EMAIL PROTECTED] void lt_dlinterface_free (@w{lt_dlinterface_id @var{iface}}) +Release the data associated with @var{iface}. [EMAIL PROTECTED] deftypefun + @deftypefun int lt_dlhandle_map (@w{lt_dlinterface_id @var{iface}}, @w{int ([EMAIL PROTECTED]) (lt_dlhandle @var{handle}, void * @var{data})}, @w{void * @var{data}}) For each module that matches @var{iface}, call the function @var{func}. When writing the @var{func} callback function, the Index: libltdl/ltdl.h === RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.h,v retrieving revision 1.82 diff -u -r1.82 ltdl.h --- libltdl/ltdl.h 26 Oct 2005 10:26:48 - 1.82 +++ libltdl/ltdl.h 12 Nov 2005 12:51:11 - @@ -111,6 +111,7 @@ LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string, lt_dlhandle_interface *iface); +LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key); LT_SCOPE void *lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data); LT_SCOPE void *lt_dlcaller_get_data (lt_dlinterface_id key, Index: libltdl/ltdl.c === RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v retrieving revision 1.236 diff -u -r1.236 ltdl.c --- libltdl/ltdl.c 26 Oct 2005 10:26:48 - 1.236 +++ libltdl/ltdl.c 12 Nov 2005 12:51:11 - @@ -2033,6 +2033,13 @@ return (lt_dlinterface_id) interface_id; } +void lt_dlinterface_free (lt_dlinterface_id key) +{ + lt__interface_id *interface_id = (lt__interface_id *)key; + FREE (interface_id-id_string); + FREE (interface_id); +} + void * lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data) { @@ -2125,6 +2132,8 @@ if (!handle) handle = (lt__handle *) handles; + else +handle = handle-next; /* advance while the interface check fails */ while (handle iterator-iface Index: libltdl/loaders/loadlibrary.c === RCS file: /cvsroot/libtool/libtool/libltdl/loaders/loadlibrary.c,v retrieving revision 1.9 diff -u -r1.9 loadlibrary.c --- libltdl/loaders/loadlibrary.c 23 Sep 2005 07:58:42 - 1.9 +++ libltdl/loaders/loadlibrary.c 12 Nov 2005 12:51:13 - @@ -50,6 +50,15 @@ static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); +static lt_dlinterface_id iface_id = 0; + +static int +loadlibrary__module_interface
Re: SCO/bugfix patch 7 of 10: Improve SCO platform support
Since this is really for a dying libtool branch, what the heck, repost as above. At least it would match your usage pattern with -absolute-soname, too. Ok attached please find the revised patch. I was unable to avoid the test in the setting of hardcode_libdir_flag_spec but I think you'll agree this looks a great deal cleaner. Kean Index: libtool.m4 === RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v retrieving revision 1.314.2.128 diff -u -3 -p -u -r1.314.2.128 libtool.m4 --- libtool.m4 10 Nov 2005 18:29:38 - 1.314.2.128 +++ libtool.m4 12 Nov 2005 18:11:51 - @@ -1652,13 +1652,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -1684,7 +1677,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3*) +sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -1717,17 +1710,27 @@ sysv4*MP*) fi ;; -sysv5*) - version_type=linux +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes hardcode_into_libs=yes - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + if test $with_gnu_ld = yes; then +sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' +shlibpath_overrides_runpath=no + else +sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' +shlibpath_overrides_runpath=yes +case $host_os in + sco3.2v5*) +sys_lib_search_path_spec=$sys_lib_search_path_spec /lib + ;; +esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) @@ -2353,15 +2356,11 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - solaris*) lt_cv_deplibs_check_method=pass_all ;; -sysv4 | sysv4.2uw2* | sysv4.3*) +sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' @@ -2388,7 +2387,7 @@ sysv4 | sysv4.2uw2* | sysv4.3*) esac ;; -unixware7* | sysv5*) +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac @@ -2634,13 +2633,6 @@ _LT_LINKER_BOILERPLATE # Check for any special shared library compilation flags. # _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test $GCC = no; then - case $host_os in - sco3.2v5*) -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' -;; - esac -fi if test -n $_LT_AC_TAGVAR(lt_prog_cc_shlib, $1); then AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) if echo $old_CC $old_CFLAGS | grep [[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[]] /dev/null; then : @@ -3488,19 +3480,6 @@ case $host_os in # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - sco*) -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -;; sunos4*) case $cc_basename in CC*) @@ -3593,27 +3572,57 @@ case $host_os in ;; esac ;; - sysv5OpenUNIX8* | sysv5UnixWare7.[[01]].[[01]]* | sysv5uw[[78]]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) +_LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no +runpath_var='LD_RUN_PATH' + case $cc_basename in CC*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -
Re: branch-1-5 UnixWare fixes
On Sat, 12 Nov 2005, Ralf Wildenhues wrote: Hi Tim, Quite some time ago: * Tim Rice wrote on Mon, Sep 26, 2005 at 08:41:21PM CEST: On Mon, 26 Sep 2005, Ralf Wildenhues wrote: : * Tim Rice wrote on Sun, Sep 25, 2005 at 10:05:21PM CEST: [snip] : I re-ran the tests using ksh88 and all tests passed. : Must be a ksh bug. : Version M-11/16/88h passes quote test : Version M-12/28/93e-SCO fails quote test : make check TESTS=quote.test VERBOSE=x = trying: \\ quoting = failed: mkdir .libs cc -c -DVAR=\\test\\ foo.c -KPIC -DPIC -o .libs/foo.o cc -c -DVAR=\\test\\ foo.c -o foo.o /dev/null 21 = trying: \ quoting *snip* FAIL: quote.test Does the test pass even with ksh88, after this patch is applied (CVS HEAD)? Tests pass on both ksh and ksh88. Good work. Thank you, Ralf -- Tim RiceMultitalents(707) 887-1469 [EMAIL PROTECTED]
Re: cygwin dlopening backends
Ralf Wildenhues Ralf.Wildenhues at gmx.de writes: Hi Charles, Eric, Hi Ralf, * Charles Wilson wrote on Thu, Nov 10, 2005 at 05:55:28AM CET: Ralf Wildenhues wrote: There are several separate issues here: 1) lt_dlhandle_iterate breakage of loadlibrary.c 2) needed dlinterface_free (or maybe _unregister?) including documentation 3) cygwin managed mount fix of loadlibrary.c or remove the cygwin-specific code of loadlibrary.c 4) use either - only dlopen, or - first dlopen, then LoadLibrary on cygwin, or - make the choice configurable I think Ralf's issues (1) and (2) need fixing first Please take a look at and test the following patches which should address (1), (2), and (3). I have not done a lot testing myself /yet/, so beware. In general, it looks good to me. Minor nits below. I'll try running it through the full testsuite, but it may take me a while. I'm not so sure whether we should register/free the thing in loadlibrary every time instead of once at the start: those memory checker users always go nuts when they find a small, constant-amount of allocated memory not freed before exit(). (OTOH, we might be lucky in that there aren't any good checkers -- at least that I know of -- for mingw or cygwin I'm fine with your approach of creating it just once, because you maintain a handle to it. If you are really worried about a memory leak, use an atexit() function to clean up after yourself. Also, I wasn't sure whether paths on w32 (all incarnations) can be bound by MAX_PATH. The documentation for cygwin_conv_to_full_win32_path suggests that at least for cygwin this is safe. Yes, the cygwin_conv* functions are bounded by MAX_PATH. I would much rather have an interface that does not have an implicit, arbitrary length (preferring either the user passes in the max length of a pre-allocated buffer, or the function itself does the malloc), but that was not done in this case. Currently, MAX_PATH on cygwin is 256 (okay by strict POSIX but not by XSI standards) because of corresponding limits in the ASCII versions of Windows syscalls. There is talk (but just that, because it would be a huge patch, particularly while maintaining backward compatibility) of switching cygwin to use the Unicode version of Windows syscalls on NT machines (with suitable fallbacks for the 9x family which only supports ASCII), at which point MAX_PATH would be increased to a more reasonable 32k on NT. +void lt_dlinterface_free (lt_dlinterface_id key) +{ + lt__interface_id *interface_id = (lt__interface_id *)key; + FREE (interface_id-id_string); + FREE (interface_id); +} This made me realize that there is another problem with lt_dlinterface_register: 2005-10-26 Eric Blake [EMAIL PROTECTED] * libltdl/ltdl.c (lt_dlinterface_register): Fail if lt__strdup did. Index: libltdl/ltdl.c === RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v retrieving revision 1.236 diff -u -p -r1.236 ltdl.c --- libltdl/ltdl.c 26 Oct 2005 10:26:48 - 1.236 +++ libltdl/ltdl.c 13 Nov 2005 04:35:45 - @@ -2027,7 +2027,10 @@ lt_dlinterface_register (const char *id_ if (interface_id) { interface_id-id_string = lt__strdup (id_string); - interface_id-iface = iface; + if (!interface_id-id_string) + FREE (interface_id); + else + interface_id-iface = iface; } return (lt_dlinterface_id) interface_id; +static lt_dlinterface_id iface_id = 0; + +static int +loadlibrary__module_interface (lt_dlhandle handle, const char *id_string) +{ + /* we _need_ to look at every module, so pretend all belong to us */ + return 0; +} Hmm, you are actually registering a no-op function, even though lt_dlhandle_iterate behaves the same (although slightly faster) had you registered a NULL pointer instead as in my original version of the patch. But I guess that is okay, in case we ever change lt_dlinterface_register to require a non-NULL function. at at -99,6 +110,7 at at char *searchname = 0; char *ext; char self_name_buf[MAX_PATH]; + char wpath[MAX_PATH]; If cygwin ever increases MAX_PATH beyond 256, self_name_buf and wpath together would become a huge burden on the stack. if (!filename) { at at -109,24 +121,33 at at } else { - ext = strrchr (filename, '.'); -} + if (LT_STRLEN (filename) = MAX_PATH) Should you cache the length here?... + return 0; - if (ext) -{ - /* FILENAME already has an extension. */ - searchname = lt__strdup (filename); -} - else -{ - /* Append a `.' to stop Windows from adding an - implicit `.dll' extension. */ - searchname = MALLOC (char, 2+ LT_STRLEN (filename)); - if (searchname) - sprintf (searchname, %s., filename);
Re: cygwin dlopening backends
Ralf Wildenhues wrote: Please take a look at and test the following patches which should address (1), (2), and (3). I have not done a lot testing myself /yet/, so beware. Basic libtool-HEAD with this patch on cygwin (compiling in both dlopen and loadlibrary loaders) compiles and passes all expected tests in the suite. Then I got ambitious, and did the following: (1) modified ltdl.m4 so that ONLY loadlibrary loader is built for cygwin. (a) bootstrap/conf/build/ran the entire testsuite. all pass. (b) created a new builddir on a managed mount. repeat as above -- all pass. (2) modified ltdl.m4 so that ONLY dlopen loader is built for cygwin. (a) bootstrap/conf/build/ran the entire testsuite. all pass. (b) created a new builddir on a managed mount. repeat as above -- all pass. So it seems that, from a functional standpoint, Ralf's patch addresses all of points (1), (2), and (3) from his earlier post. That just leaves Eric's comments, and Ralf's point (4). I wonder if it would be a good idea to add --enable/--disable configure flags for every loader...with the default set of loaders determined on a per-platform basis. That's the most flexible (and wouldn't be a cygwin-specific hack), but it seems like it could be really complicated. -- Chuck