]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4 (AC_LIBTOOL_PROG_CC_C_O): use printf, not
authorCharles Wilson <cwilson@ece.gatech.edu>
Thu, 31 Oct 2002 00:52:39 +0000 (00:52 +0000)
committerBob Friesenhahn <bfriesen@simple.dallas.tx.us>
Thu, 31 Oct 2002 00:52:39 +0000 (00:52 +0000)
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

* 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?

ChangeLog
f77demo/Makefile.am
libltdl/ltdl.c
libtool.m4
ltmain.in

index 6a03f42f1882a12e505861368eb488ec188fe4b9..b19dc2c30b0c9747e02fcdcd73533ec747b9f061 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2002-10-30  Charles Wilson  <cwilson@ece.gatech.edu>
+
+       * 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-30  Rob Browning  <rlb@defaultvalue.org>
+
+       * 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?
+
 2002-10-25  Robert Boehne  <rboehne@gnu.org>
 
        * ltmain.in (-XCClinker): New flag passes a linking option
index 9f391e23512f59f155e44e1f2484bd08eab4777b..702a3526851a6b60f3b95814aa9c61f0e7024d24 100644 (file)
@@ -9,7 +9,10 @@ EXTRA_DIST = acinclude.m4
 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 dd3ec203ad991eb386dec0da9398c0fc943c56d5..ad6851e2d0cf42b95fa88eb14e6bae15bfb7aed5 100644 (file)
@@ -211,7 +211,8 @@ static char   *lt_estrdup   LT_PARAMS((const char *str));
 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 @@ static struct dirent *readdir(entry)
    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 @@ realloc (ptr, size)
       return mem;
     }
 }
+#endif
 
 
 #if ! HAVE_ARGZ_APPEND
@@ -2107,8 +2116,9 @@ tryall_dlopen_module (handle, prefix, dirname, dlname)
   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 @@ try_dlopen (phandle, filename)
 
          /* 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))
index 1ee500864b7c4a4d35f5e335c7688d08438bef21..5c2d52b69a70b19a7fcfdd1c37824b2cba25e943 100644 (file)
@@ -874,7 +874,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
                   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 @@ bsdi4*)
   ;;
 
 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 130014207c32a1c60e9ad6465246985fce4d2b01..f293d4eedea24b291a6dce7b2b55c15c58737dde 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -114,6 +114,40 @@ execute_dlfiles=
 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