]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4: Third time lucky, with Tor's patch.
authorOlly Betts <olly@muscat.co.uk>
Thu, 28 Oct 1999 20:18:15 +0000 (20:18 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 28 Oct 1999 20:18:15 +0000 (20:18 +0000)
ChangeLog
libtool.m4
mail/cygwin32

index 9c50725af51662fa24e82d2d03c6930e5db1a07e..080e28eba7420df00c74e0b0c2752fb4a20a2413 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+1999-10-28  Olly Betts  <olly@muscat.co.uk>
+
+       * libtool.m4:  Third time lucky, with Tor's patch.
+
 1999-10-19  Tor Lillqvist  <tml@iki.fi>
 
        * libtool.m4:  these was a missing `*' in the -mno-cygwin
index 7068e85a21722339989caebf525cbcdd94245473..498948c7cbf96c22839b47134082674f8e2d9a5e 100644 (file)
@@ -152,7 +152,6 @@ ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
       DllMain (0, 0, 0);],
       [lt_cv_need_dllmain=yes],[lt_cv_need_dllmain=no])])
 
-  case $host in
   case "$host/$CC" in
   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
     # old mingw systems require "-dll" to link a DLL, while more recent ones
index de2a0ae36fdde731ba89b0685ac5b07ea87e48b8..45b2f1ee722b9c00fa6fa1579b663baeae508e88 100644 (file)
@@ -93,3 +93,110 @@ symbol in the shared library, and Windows DLLs do not.
 
 Ian
 
+When libtool links DLLs, it strips some command line switches. It's probably
+the case that this is ok for most situations. However, this potentially breaks
+Mingw32 support in the Cygwin environment.
+
+In order to get Mingw32 support in Cygwin, the compiler must be invoked with
+the -mno-cygwin switch. If libtool strips this switch out during the link
+process, the resulting binary will get linked with the wrong import libraries.
+
+The following is a small example. I've edited the output a bit for
+readability. When I send this email, long lines will get broken up, so it
+still might be a bit difficult to read.
+
+-------------------------
+
+$ libtool --version
+ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
+
+
+$ cat xx.c
+
+extern __declspec(dllexport) int func(void);
+
+int func()
+{
+}
+
+
+$ libtool --mode=compile gcc -mno-cygwin -c xx.c
+mkdir .libs
+gcc -mno-cygwin -c  -DPIC xx.c -o .libs/xx.lo
+mv -f .libs/xx.lo xx.o
+ln -s xx.o xx.lo
+
+$ libtool --mode=link gcc -mno-cygwin -o libxx.la xx.lo \
+       -version-info 0:0:0 -no-undefined -rpath /usr/local/lib
+
+rm -fr .libs/libxx.la .libs/libxx.* .libs/libxx.*
+
+generating symbol list for `libxx.la'
+
+test -f .libs/libxx-0-0-0.dll-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here
+\*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d <
+/usr/local/bin/libtool > .libs/libxx-0-0-0.dll-ltdll.c
+
+ test -f .libs/libxx-0-0-0.dll-ltdll.o || (cd .libs && gcc -c
+libxx-0-0-0.dll-ltdll.c)
+
+ dlltool --export-all --exclude-symbols
+DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def
+.libs/libxx-0-0-0.dll-def .libs/libxx-0-0-0.dll-ltdll.o  xx.o
+
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < .libs/libxx-0-0-0.dll-def >
+.libs/libxx.exp
+
+echo EXPORTS > .libs/libxx-0-0-0.dll-def
+
+ _lt_hint=1; for symbol in `cat .libs/libxx.exp`; do echo " $symbol @
+$_lt_hint; " >> .libs/libxx-0-0-0.dll-def; _lt_hint=`expr 1 + $_lt_hint`; done
+
+ test -f .libs/libxx-0-0-0.dll-ltdll.c || sed -e "/^# \/\* ltdll\.c starts
+here\*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d <
+/usr/local/bin/libtool > .libs/libxx-0-0-0.dll-ltdll.c
+
+ test -f .libs/libxx-0-0-0.dll-ltdll.o || (cd .libs && gcc -c
+libxx-0-0-0.dll-ltdll.c)
+
+
+gcc -Wl,--base-file,.libs/libxx-0-0-0.dll-base -Wl,--dll -nostartfiles -Wl,-e,
+__cygwin_dll_entry@12 -o .libs/libxx-0-0-0.dll .libs/libxx-0-0-0.dll-ltdll.o
+xx.o
+
+ dlltool --as=as --dllname libxx-0-0-0.dll --exclude-symbols
+DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def
+.libs/libxx-0-0-0.dll-def --base-file .libs/libxx-0-0-0.dll-base --output-exp
+.libs/libxx-0-0-0.dll-exp
+
+ gcc -Wl,--base-file,.libs/libxx-0-0-0.dll-base
+.libs/libxx-0-0-0.dll-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12
+ -o .libs/libxx-0-0-0.dll .libs/libxx-0-0-0.dll-ltdll.o  xx.o
+
+ dlltool --as=as --dllname libxx-0-0-0.dll --exclude-symbols
+DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def
+.libs/libxx-0-0-0.dll-def --base-file .libs/libxx-0-0-0.dll-base --output-exp
+.libs/libxx-0-0-0.dll-exp
+
+ gcc
+.libs/libxx-0-0-0.dll-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12
+ -o .libs/libxx-0-0-0.dll .libs/libxx-0-0-0.dll-ltdll.o  xx.o
+
+(cd .libs && rm -f libxx.a && ln -s libxx-0-0-0.dll libxx.a)
+
+dlltool --as=as --dllname libxx-0-0-0.dll --def
+.libs/libxx-0-0-0.dll-def --output-lib .libs/libxx.a
+
+creating libxx.la
+
+(cd .libs && rm -f libxx.la && ln -s ../libxx.la libxx.la)
+
+---------------
+
+Notice how the 'gcc' lines do not contain the -mno-cygwin switch. This switch
+should not get stripped.
+
+Jon Leichter
+jon@symas.com
+
+