libtool-patches
[Top][All Lists]
Advanced

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

Patch to libtool HEAD: a couple of Win32 improvements


From: Tor Lillqvist
Subject: Patch to libtool HEAD: a couple of Win32 improvements
Date: Thu, 10 Oct 2002 06:31:05 +0300

I have submitted these before to some list, but didn't receive any
comments, so I'll try again, hopefully to the correct place this time.

1) AS

I don't think libtool needs to bother with AS at all. It checks AS in
order to pass it to dlltool using dlltool's --as switch. Dlltool
apparently uses the --as switch's value directly as the name of the
executable to run, so it must be the assembler basename only. This
means that some configure.in's that specify AS="gcc -c" cause
libtool/dlltool to break.

I don't see why one would ever need to tell dlltool to use a specific
assembler. Dlltool uses an assembler to compile assembly source files
that it generates itself. Surely the assembler that is specified at
dlltool's build time is the right one for it to use, and not some
potentially different one that the application's configure.in wants to
use for *its* assembly source files. They might even be in another
assembly language variant than what dlltool produces.

I.e., drop the AS stuff, don't pass any --as switch to dlltool.

2) --enable-auto-image-base

I think it's (marginally) useful to pass -Wl,--enable-auto-image-base
to gcc when building DLLs.

3) Check for EXPORTS on any line in .def files, not just the first.

4) Don't ever relink on Win32. 

Why would it be necessary? Isn't libtool's relinking related to those
executable formats that have paths to shared objects. Win32 EXEs and
DLLs don't have any path information in them. Or am I confused?

Cheers,
--tml

Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.265
diff -u -2 -r1.265 libtool.m4
--- libtool.m4  4 Oct 2002 15:34:50 -0000       1.265
+++ libtool.m4  10 Oct 2002 02:53:48 -0000
@@ -170,5 +170,4 @@
 test -z "$AR" && AR=ar
 test -z "$AR_FLAGS" && AR_FLAGS=cru
-test -z "$AS" && AS=as
 test -z "$CC" && CC=cc
 test -z "$LTCC" && LTCC=$CC
@@ -494,5 +493,4 @@
 [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
 
@@ -512,5 +510,5 @@
     CFLAGS="$CFLAGS -shared"
     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
-      [AC_TRY_LINK([],[],[lt_cv_cc_dll_switch=-shared],
+      [AC_TRY_LINK([],[],[lt_cv_cc_dll_switch='-shared 
-Wl,--enable-auto-image-base'],
        [
          CFLAGS="$SAVE_CFLAGS -mdll"
@@ -3616,7 +3614,4 @@
 OBJDUMP="$OBJDUMP"
 
-# Used on cygwin: assembler.
-AS="$AS"
-
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
@@ -4650,5 +4645,5 @@
        $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
 
-      _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --as=$AS 
--dllname $soname --def $output_objdir/$soname-def --output-lib 
$output_objdir/$newlib'
+      _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --dllname 
$soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
 
       # FIXME: what about values for MSVC?
@@ -4682,8 +4677,8 @@
        sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < 
$output_objdir/$soname-def > $export_symbols'
 
-      # If the export-symbols file already is a .def file (1st line
-      # is EXPORTS), use it as is.
+      # If the export-symbols file already is a .def file (contains a line
+      # starting with EXPORTS), use it as is.
       # If DATA tags from a recent dlltool are present, honour them!
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`sed 1q 
$export_symbols`" = xEXPORTS; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if grep -i ^EXPORTS 
$export_symbols >/dev/null; then
          cp $export_symbols $output_objdir/$soname-def;
        else
@@ -4702,7 +4697,7 @@
        '"$ltdll_cmds"'
        $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' 
-Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs 
$compiler_flags~
-       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+       $DLLTOOL --dllname $soname --exclude-symbols '$dll_exclude_symbols' 
--def $output_objdir/$soname-def --base-file $output_objdir/$soname-base 
--output-exp $output_objdir/$soname-exp~
        $CC -Wl,--base-file,$output_objdir/$soname-base 
$output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o 
$output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
-       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp 
--output-lib $output_objdir/$libname.dll.a~
+       $DLLTOOL --dllname $soname --exclude-symbols '$dll_exclude_symbols' 
--def $output_objdir/$soname-def --base-file $output_objdir/$soname-base 
--output-exp $output_objdir/$soname-exp --output-lib 
$output_objdir/$libname.dll.a~
        $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' 
-Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs 
$compiler_flags'
       ;;


Index: ltmain.in
===================================================================
RCS file: /cvs/libtool/ltmain.in,v
retrieving revision 1.301
diff -u -2 -r1.301 ltmain.in
--- ltmain.in   25 Sep 2002 04:26:20 -0000      1.301
+++ ltmain.in   10 Oct 2002 02:53:52 -0000
@@ -2079,8 +2079,15 @@
        if test -n "$library_names" &&
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
-         if test "$installed" = no; then
-           notinst_deplibs="$notinst_deplibs $lib"
-           need_relink=yes
-         fi
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+           # I don't see the point of relinking Win32 DLLs?
+           ;;
+         *)
+           if test "$installed" = no; then
+             notinst_deplibs="$notinst_deplibs $lib"
+             need_relink=yes
+           fi
+           ;;
+         esac
          # This is a shared library
          if test "$linkmode" = lib &&






reply via email to

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