On 5/29/2014 12:56 AM, Katsumi Yamaoka wrote:
I verified simply reverting r117168 builds Emacs successfully on
Cygwin.
The removal of mmap_set_vars is what caused the problem. The following patch fixes restores mmap_set_vars and fixes the problem. Eli and Fabrice, is the w32 build still OK with this patch?
=== modified file 'src/buffer.c'
--- src/buffer.c 2014-05-27 17:31:17 +0000
+++ src/buffer.c 2014-05-29 12:23:53 +0000
@@ -4855,6 +4855,38 @@
}
+/* Set or reset variables holding references to mapped regions.
+ If not RESTORE_P, set all variables to null. If RESTORE_P, set all
+ variables to the start of the user-areas of mapped regions.
+
+ This function is called from Fdump_emacs to ensure that the dumped
+ Emacs doesn't contain references to memory that won't be mapped
+ when Emacs starts. */
+
+void
+mmap_set_vars (bool restore_p)
+{
+ struct mmap_region *r;
+
+ if (restore_p)
+ {
+ mmap_regions = mmap_regions_1;
+ mmap_fd = mmap_fd_1;
+ for (r = mmap_regions; r; r = r->next)
+ *r->var = MMAP_USER_AREA (r);
+ }
+ else
+ {
+ for (r = mmap_regions; r; r = r->next)
+ *r->var = NULL;
+ mmap_regions_1 = mmap_regions;
+ mmap_regions = NULL;
+ mmap_fd_1 = mmap_fd;
+ mmap_fd = -1;
+ }
+}
+
+
/* Allocate a block of storage large enough to hold NBYTES bytes of
data. A pointer to the data is returned in *VAR. VAR is thus the
address of some variable which will use the data area.
=== modified file 'src/emacs.c'
--- src/emacs.c 2014-05-27 17:31:17 +0000
+++ src/emacs.c 2014-05-29 12:28:19 +0000
@@ -2155,8 +2155,13 @@
malloc_state_ptr = malloc_get_state ();
#endif
+#if defined USE_MMAP_FOR_BUFFERS && !defined WINDOWSNT
+ mmap_set_vars (0);
+#endif
unexec (SSDATA (filename), !NILP (symfile) ? SSDATA (symfile) : 0);
-
+#if defined USE_MMAP_FOR_BUFFERS && !defined WINDOWSNT
+ mmap_set_vars (1);
+#endif
#ifdef DOUG_LEA_MALLOC
free (malloc_state_ptr);
#endif
Ken