[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
latest cygwin patches
From: |
Charles Wilson |
Subject: |
latest cygwin patches |
Date: |
Mon, 28 Oct 2002 21:36:00 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 |
Against CVS-20021028.
This includes the small patch I posted earlier here:
http://mail.gnu.org/pipermail/libtool-patches/2002-October/002129.html
as well as parts of the patch posted by Marius Vollmer from the Guile
team here:
http://mail.gnu.org/pipermail/libtool/2002-October/007115.html
I've eliminated the parts of the Guile patch that were already in HEAD,
as well as those portions that are not exercised on the cygwin platform.
The rest, I've updated to apply cleanly to current CVS.
In a followup, I will post the "rest" of Marius' patch (e.g. the portion
that is NOT already in CVS and NOT included in the patch here) for
others to review.
A note about the changes in this latest cygwin patch. Shared libs on
cygwin, pw, mingw, consist of two parts: the DLL itself which contains
the shared code, and an import library used at link time.
$file_magic_cmd needs to identify both types as "shared libraries" so
that relink commands work properly. Unfortunately, you use objdump to
identify DLLs, but you need nm to identify archives (and test whether a
given archive contains import pointers for a DLL)
Since $file_magic_cmd is called with different arguments
($file_magic_test_file in one place, \"\$potlib\" in another), we need
some construct that can take an argument, and then run a sequence of
shell commands on it. The only choices I see are a shell function, or
use a HERE document to generate an ancillary script.
Seems like a shell function is the obvious choice -- but I notice that
libtool doesn't seem to use them. Is there a policy against shell
functions? (I hope not...)
--Chuck
2002-10-28 Charles Wilson <address@hidden>
* libtool.m4 (AC_LIBTOOL_PROG_CC_C_O): use printf,
not echo.
(AC_DEPLIBS_CHECK_METHOD): use new shell function
win32_libid on w32 platforms
* ltmain.in: add new section for shell functions.
Add win32_libid() shell function.
* f77demo/Makefile.am: add -no-undefined flag
2002-10-04 Rob Browning <address@hidden>
* ltdl.c (realloc): Remove custom realloc. (#define
rpl_realloc realloc) and comment out later code for
custom realloc. You can't define your own malloc
unless you know enough about the malloc in use to
be able to tell how big the src ptr is. The disabled
code incorrectly used the *destination* ptr to decide
how much to copy. This sometimes results in out-of-bound
accesses which cause segfaults. This is a quick hack for
now; we may want something cleaner later.
(tryall_dlopen_module): check to be sure (dirname_len > 0)
before testing first character against '/'.
(try_dlopen): check for feof(file) in read loop -- otherwise
infloop?
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.272
diff -u -u -r1.272 libtool.m4
--- libtool.m4 25 Oct 2002 00:16:08 -0000 1.272
+++ libtool.m4 29 Oct 2002 02:30:21 -0000
@@ -874,7 +874,7 @@
FFLAGS="$FFLAGS -o out/conftest2.$ac_objext"],
[$1],[GCJ],[save_GCJFLAGS="$CFLAGS"
CFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"])
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
# that will create temporary files in the current directory regardless of
@@ -1947,8 +1947,9 @@
;;
cygwin* | mingw* | pw32*)
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture:
i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
+ # win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='win32_libid'
;;
darwin* | rhapsody*)
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.307
diff -u -u -r1.307 ltmain.in
--- ltmain.in 28 Oct 2002 15:38:37 -0000 1.307
+++ ltmain.in 29 Oct 2002 02:30:42 -0000
@@ -114,6 +114,40 @@
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+win32_libid () {
+ win32_libid_type="unknown"
+ if eval $OBJDUMP -f $1 2>/dev/null | \
+ grep -E 'file format pei+-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_libid_type="x86 DLL"
+ else
+ if eval $OBJDUMP -f $1 2>/dev/null | \
+ grep -E 'file format pei*-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_libid_type="x86"
+ if eval file $1 2>/dev/null | \
+ grep -E 'ar archive' >/dev/null; then
+ win32_libid_type="$win32_libid_type archive"
+ if eval $NM -f posix -A $1 | awk '{print $3}' | grep "I" >/dev/null ;
then
+ win32_libid_type="$win32_libid_type import"
+ else
+ win32_libid_type="$win32_libid_type static"
+ fi
+ fi
+ fi
+ fi
+ echo $win32_libid_type
+}
+
+# End of Shell function definitions
+#####################################
+
+
# Parse our command line options once, thoroughly.
while test "$#" -gt 0
do
Index: f77demo/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/f77demo/Makefile.am,v
retrieving revision 1.1
diff -u -u -r1.1 Makefile.am
--- f77demo/Makefile.am 31 Jul 2002 20:15:27 -0000 1.1
+++ f77demo/Makefile.am 29 Oct 2002 02:30:42 -0000
@@ -9,7 +9,10 @@
noinst_LTLIBRARIES = libfoo.la libmix.la
libfoo_la_SOURCES = foof.f
+libfoo_la_LDFLAGS = -no-undefined
+
libmix_la_SOURCES = foof.f fooc.c
+libmix_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.171
diff -u -u -r1.171 ltdl.c
--- libltdl/ltdl.c 24 Oct 2002 21:28:34 -0000 1.171
+++ libltdl/ltdl.c 29 Oct 2002 02:30:53 -0000
@@ -211,7 +211,8 @@
static lt_ptr lt_emalloc LT_PARAMS((size_t size));
static lt_ptr lt_erealloc LT_PARAMS((lt_ptr addr, size_t size));
-static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, size_t size));
+/* static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, size_t size)); */
+#define rpl_realloc realloc
/* These are the pointers that can be changed by the caller: */
LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size))
@@ -502,8 +503,15 @@
Instead implement our own version (with known boundary conditions)
using lt_dlmalloc and lt_dlfree. */
-#undef realloc
-#define realloc rpl_realloc
+/* #undef realloc
+ #define realloc rpl_realloc
+*/
+#if 0
+ /* You can't (re)define realloc unless you also (re)define malloc.
+ Right now, this code uses the size of the *destination* to decide
+ how much to copy. That's not right, but you can't know the size
+ of the source unless you know enough about, or wrote malloc. So
+ this code is disabled... */
static lt_ptr
realloc (ptr, size)
@@ -541,6 +549,7 @@
return mem;
}
}
+#endif
#if ! HAVE_ARGZ_APPEND
@@ -2107,8 +2116,9 @@
assert (strchr (dirname, LT_DIRSEP_CHAR) == 0);
#endif
- if (dirname[dirname_len -1] == '/')
- --dirname_len;
+ if (dirname_len > 0)
+ if (dirname[dirname_len -1] == '/')
+ --dirname_len;
filename_len = dirname_len + 1 + LT_STRLEN (dlname);
/* Allocate memory, and combine DIRNAME and MODULENAME into it.
@@ -2852,7 +2862,7 @@
/* Handle the case where we occasionally need to read a line
that is longer than the initial buffer size. */
- while (line[LT_STRLEN(line) -1] != '\n')
+ while ((line[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
{
line = LT_DLREALLOC (char, line, line_len *2);
if (!fgets (&line[line_len -1], (int) line_len +1, file))
- latest cygwin patches,
Charles Wilson <=