summaryrefslogtreecommitdiff
path: root/src/unexcw.c
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2011-08-16 09:27:12 -0400
committerKen Brown <kbrown@cornell.edu>2011-08-16 09:27:12 -0400
commita4579d332d432ea629a1ad2168ce8023d172d563 (patch)
tree518252a17be98424e3744bc35dcc96fedf41c84a /src/unexcw.c
parent9adfcd0bf50066cc678ba65fb1b236d1c4ca0334 (diff)
downloademacs-a4579d332d432ea629a1ad2168ce8023d172d563.tar.gz
Fix memory allocation problems in Cygwin build (Bug#9273).
* src/gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): New variables. (malloc_initialize_1) [CYGWIN]: Prepare for reinitializing the dumped emacs. (_free_internal_nolock) [CYGWIN]: Ignore requests to free storage in the static heap. [CYGWIN] (special_realloc): New function. (_realloc_internal_nolock) [CYGWIN]: Use the new function on requests to realloc storage in the static heap. * src/unexcw.c ( __malloc_initialized): Declare external variable. (fixup_executable): Force the dumped emacs to reinitialize malloc.
Diffstat (limited to 'src/unexcw.c')
-rw-r--r--src/unexcw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/unexcw.c b/src/unexcw.c
index f643c196de0..62df82ec3bc 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -33,6 +33,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
extern int bss_sbrk_did_unexec;
+extern int __malloc_initialized;
+
/* emacs symbols that indicate where bss and data end for emacs internals */
extern char my_endbss[];
extern char my_edata[];
@@ -210,9 +212,12 @@ fixup_executable (int fd)
lseek (fd, (long) (exe_header->section_header[i].s_scnptr),
SEEK_SET);
assert (ret != -1);
+ /* force the dumped emacs to reinitialize malloc */
+ __malloc_initialized = 0;
ret =
write (fd, (char *) start_address,
my_endbss - (char *) start_address);
+ __malloc_initialized = 1;
assert (ret == (my_endbss - (char *) start_address));
if (debug_unexcw)
printf (" .bss, mem start 0x%08x mem length %d\n",