From: Jim Pick Date: Tue, 5 Aug 2003 16:05:01 +0000 (+0000) Subject: Much as we have tried not to make it the callers' responsibility X-Git-Tag: help~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=522aef6a38cf39bfa39690ccc063f5fa098685a6;p=thirdparty%2Flibtool.git 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. --- diff --git a/ChangeLog b/ChangeLog index 5a70aaf6c..97d406959 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,25 @@ +2003-08-05 Jim Pick , + Ito Kazumitsu , + Gary V. Vaughan + + 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. + 2003-08-01 Peter O'Gorman * libtool.m4 (darwin): Use "-undefined dynamic_lookup" if the - user set MACOSX_DEPLOYMENT_TARGET to 10.3 or greater. + user set MACOSX_DEPLOYMENT_TARGET to 10.3 or greater. * libltdl/ltdl.c (dyld): Save the error from the first lookup to report in lt_dlerror(). Otherwise the error is always "Symbol _foo not in /usr/lib/libSystem.dylib". @@ -84,7 +102,7 @@ * ltmain.in: search libraries in the order of preference, rather than picking .la's even if they're in a less preferred directory. - + 2003-06-03 Robert Millan * ltdl.m4: Add support for GNU/FreeBSD. @@ -109,7 +127,7 @@ 2003-06-03 Peter O'Gorman * libtool.m4 (darwin): Remove checks for Apple-specific gcc. - * libltdl/ltdl.c (HAVE_MACH_O_DYLD_H): #define + * libltdl/ltdl.c (HAVE_MACH_O_DYLD_H): #define __private_extern__ for fsf gcc. * ltmain.in (darwin): Only add new paths to newlib_search_path. @@ -179,7 +197,7 @@ * README: Changed typo in version description. * config.guess, config.sub, texinfo.tex: Synchronized from ftp.gnu.org. - + 2003-04-10 Alexandre Oliva @@ -774,10 +792,11 @@ *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? + 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 + infinite loop? 2002-10-25 Robert Boehne diff --git a/NEWS b/NEWS index 988fda896..532250f9a 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,11 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.5b: 2003-??-??; CVS version 1.5a, Libtool team: * Bug fixes. - + +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. + 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. diff --git a/doc/libtool.texi b/doc/libtool.texi index d5ceba0c5..ee7308714 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1371,7 +1371,7 @@ any of their required library directories are added to the library path. @cindex mode, install In @dfn{install} mode, libtool interprets most of the elements of -@var{mode-args} as an installation command beginning with +@var{mode-args} 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-args} are treated specially: @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 -@code{inst-prefix} 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}, +@code{inst-prefix} 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 -@code{libtool --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 +@code{libtool --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 message for retrieval with @end deftypefun @deftypevar {lt_ptr (*) (size_t @var{size})} lt_dlmalloc +@deftypevarx {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 diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index d45de1550..7fbb4a495 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -237,7 +237,7 @@ LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)) #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;