summaryrefslogtreecommitdiff
path: root/src/unexcw.c
diff options
context:
space:
mode:
authorDaniel Colascione <dancol@dancol.org>2012-12-11 19:26:52 -0800
committerDaniel Colascione <dancol@dancol.org>2012-12-11 19:26:52 -0800
commitcc98b6842663b6fe30e0b7c7a628604959d5dc69 (patch)
tree8fae8652e7ab59422f3b8c782e654f8679c6bc38 /src/unexcw.c
parent69e1c203e96afb6e95fdda422d00c07b0bcbf76c (diff)
downloademacs-cc98b6842663b6fe30e0b7c7a628604959d5dc69.tar.gz
2012-12-12 Daniel Colascione <dancol@dancol.org>
* unexcw.c (fixup_executable): use posix_fallocate to ensure that the dumped Emacs is not a sparse file, greatly improving Cygwin "make bootstrap" performance.
Diffstat (limited to 'src/unexcw.c')
-rw-r--r--src/unexcw.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/unexcw.c b/src/unexcw.c
index 8c5d574530d..7d1a72e0009 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -183,6 +183,19 @@ fixup_executable (int fd)
exe_header->file_optional_header.FileAlignment *
exe_header->file_optional_header.FileAlignment;
+ /* Make sure the generated bootstrap binary isn't
+ * sparse. NT doesn't use a file cache for sparse
+ * executables, so if we bootstrap Emacs using a sparse
+ * bootstrap-emacs.exe, bootstrap takes about twenty
+ * times longer than it would otherwise. */
+
+ ret = posix_fallocate (fd,
+ ( exe_header->section_header[i].s_scnptr +
+ exe_header->section_header[i].s_size ),
+ 1);
+
+ assert (ret != -1);
+
ret =
lseek (fd,
(long) (exe_header->section_header[i].s_scnptr +