[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch ping: 5 days without reply (was: Re: three line patch for ltdl
From: |
gary |
Subject: |
Re: Patch ping: 5 days without reply (was: Re: three line patch for ltdl.c memory reallocation problem) |
Date: |
Tue, 05 Aug 2003 17:15:41 +0100 |
User-agent: |
Demon-WebMail/2.0 |
address@hidden wrote:
> Dalibor Topic wrote:
> > Hi all,
> >
> > in kaffe we have found a problem with libtool's realloc macro. Citing
> > the original bug report from Ito Kazumitsu in
> > http://www.kaffe.org/pipermail/kaffe/2003-June/042426.html :
I have applied this modified version of the patch to HEAD and branch-1-5.
Cheers,
Gary.
Index: ChangeLog
from Jim Pick <address@hidden>,
Ito Kazumitsu <address@hidden>,
Gary V. Vaughan <address@hidden>
Much as we have tried not to make it the callers' responsibility
to maintain an lt_dlrealloc function pointer, it is too difficult
to implement realloc as malloc/memcpy/free without knowing the
size of the original block. rpl_realloc has been deprecated since
2002-10-30, but kaffe has real failures with that so it's time to
bite the bullet. Caller gets to maintain lt_dlrealloc:
* NEWS (1.5.1): Updated.
* libltdl/ltdl.c (LT_DLREALLOC): Use lt_dlrealloc so the user can
update the function pointer to match lt_dlmalloc.
(lt_emalloc): Use lt_dlrealloc rather than hardcoding realloc.
* doc/libtool.texi (Libltdl interface): Describe lt_dlrealloc now
that it too has become part of the exported interface to libltdl.
Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.110
diff -u -p -u -r1.110 NEWS
--- NEWS 11 Jun 2003 14:23:41 -0000 1.110
+++ NEWS 5 Aug 2003 15:51:35 -0000
@@ -2,7 +2,11 @@ NEWS - list of user-visible changes betw
New in 1.5b: 2003-??-??; CVS version 1.5a, Libtool team:
* Bug fixes.
-
+^L
+New in 1.5.1: 2003-??-??; CVS version 1.5.0a, Libtool team:
+* lt_dlrealloc is an official part of the libltdl API.
+* Bug fixes.
+^L
New in 1.5: 2003-04-14; CVS version 1.4e, Libtool team:
* First stable release of multi-language architecture.
* libtool and libltdl support for Mac OS/X.
Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.135
diff -u -p -u -r1.135 libtool.texi
--- doc/libtool.texi 22 Apr 2003 04:57:10 -0000 1.135
+++ doc/libtool.texi 5 Aug 2003 15:51:35 -0000
@@ -1371,7 +1371,7 @@ any of their required library directorie
@cindex mode, install
In @dfn{install} mode, libtool interprets most of the elements of
address@hidden as an installation command beginning with
address@hidden as an installation command beginning with
@code{cp}, or a BSD-compatible @code{install} program.
The following components of @var{mode-args} are treated specially:
@@ -1379,11 +1379,11 @@ The following components of @var{mode-ar
@table @samp
@item -inst-prefix @var{inst-prefix-dir}
When installing into a temporary staging area, rather than the
-final @var{prefix}, this argument is used to reflect the
+final @var{prefix}, this argument is used to reflect the
temporary path, in much the same way @code{automake} uses
@var{DESTDIR}. For instance, if @var{prefix} is @code{/usr/local},
but @var{inst-prefix-dir} is @code{/tmp}, then the object will be
-installed under @code{/tmp/usr/local/}. If the installed object
+installed under @code{/tmp/usr/local/}. If the installed object
is a libtool library, then the internal fields of that library
will reflect only @var{prefix}, not @var{inst-prefix-dir}:
@@ -1399,16 +1399,16 @@ not
libdir='/tmp/usr/local/lib'
@end example
address@hidden is also used to insure that if the installed
-object must be relinked upon installation, that it is relinked
-against the libraries in @var{inst-prefix-dir}/@var{prefix},
address@hidden is also used to insure that if the installed
+object must be relinked upon installation, that it is relinked
+against the libraries in @var{inst-prefix-dir}/@var{prefix},
not @var{prefix}.
In truth, this option is not really intended for use when calling
libtool directly; it is automatically used when @code{libtool --mode=install}
-calls @code{libtool --mode=relink}. Libtool does this by
-analyzing the destination path given in the original
address@hidden --mode=install} command and comparing it to the
+calls @code{libtool --mode=relink}. Libtool does this by
+analyzing the destination path given in the original
address@hidden --mode=install} command and comparing it to the
expected installation path established during @code{libtool --mode=link}.
Thus, end-users need change nothing, and @code{automake}-style
@@ -2968,11 +2968,18 @@ function, return -1 and set an error mes
@end deftypefun
@deftypevar {lt_ptr (*) (size_t @var{size})} lt_dlmalloc
address@hidden {lt_ptr (*) (lt_ptr @var{ptr}, size_t @var{size})} lt_dlrealloc
@deftypevarx {void (*) (lt_ptr @var{ptr})} lt_dlfree
-These variables are set to @code{malloc} and @code{free}, by default,
-but you can set them to any other functions that provides equivalent
-functionality. However, you must not modify their values after calling
-any libltdl function other than @code{lt_dlpreopen_default} or the macro
+These variables are set to @code{malloc}, @code{realloc} and @code{free} by
+default, but you can set them to any other functions that provide equivalent
+functionality. If you change any of these function pointers, you will almost
+certainly need to change all three to point into the same malloc library.
+Strange things will happen if you allocate memory from one library, and then
+pass it to an implementation of @code{free} that doesn't know what book
+keeping the allocator used.
+
+You must not modify any of their values after calling any libltdl function
+other than @code{lt_dlpreopen_default} or the macro
@code{LTDL_SET_PRELOADED_SYMBOLS}.
@end deftypevar
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.178
diff -u -p -u -r1.178 ltdl.c
--- libltdl/ltdl.c 1 Aug 2003 19:08:14 -0000 1.178
+++ libltdl/ltdl.c 5 Aug 2003 15:51:36 -0000
@@ -237,7 +237,7 @@ LT_GLOBAL_DATA void (*lt_dlfree) LT_PA
#else
#define LT_DLMALLOC(tp, n) ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
-#define LT_DLREALLOC(tp, p, n) ((tp *) rpl_realloc ((p), (n) * sizeof(tp)))
+#define LT_DLREALLOC(tp, p, n) ((tp *) lt_dlrealloc ((p), (n) * sizeof(tp)))
#define LT_DLFREE(p) \
LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END
@@ -1016,7 +1016,7 @@ lt_erealloc (addr, size)
lt_ptr addr;
size_t size;
{
- lt_ptr mem = realloc (addr, size);
+ lt_ptr mem = lt_dlrealloc (addr, size);
if (size && !mem)
LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
return mem;