diff options
| author | Paul Eggert | 2016-11-20 16:57:17 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-11-20 16:59:24 -0800 |
| commit | 0b187fd2bfb797e113626df1b3740edbda8b698a (patch) | |
| tree | bb0d96996a2058c644d829350cafe61263f3c51a /src | |
| parent | ebe2e69c8fb14dfa169e0497cd868ade79d4c9d8 (diff) | |
| download | emacs-0b187fd2bfb797e113626df1b3740edbda8b698a.tar.gz emacs-0b187fd2bfb797e113626df1b3740edbda8b698a.zip | |
Make CANNOT_DUMP work better on GNU/Linux
Clean up some of the bitrot affecting the CANNOT_DUMP code. This
lets the build succeed again, and fixes the testing framework so
that most test cases now pass. About twenty test cases still
fail, though, and we still have Bug#24974.
* configure.ac (CANNOT_DUMP): Now empty if CANNOT_DUMP.
(SYSTEM_MALLOC): Now true if CANNOT_DUMP. There should no longer
be any point to messing with a private memory allocator unless
Emacs is dumping.
* src/alloc.c (alloc_unexec_pre, alloc_unexec_post, check_pure_size):
* src/image.c (reset_image_types):
* src/lastfile.c (my_endbss, _my_endbss, my_endbss_static):
Do not define if CANNOT_DUMP.
* src/emacs.c (might_dump) [CANNOT_DUMP]: Now always false and local.
(daemon_pipe) [!WINDOWSNT]: Now static.
* test/Makefile.in (mostlyclean): Remove *.tmp files.
(make-test-deps.mk): Elide CANNOT_DUMP chatter.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 22 | ||||
| -rw-r--r-- | src/emacs.c | 10 | ||||
| -rw-r--r-- | src/image.c | 3 | ||||
| -rw-r--r-- | src/lastfile.c | 4 |
4 files changed, 28 insertions, 11 deletions
diff --git a/src/alloc.c b/src/alloc.c index 90c6f9441fa..175dcab2487 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -173,31 +173,34 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook EXTERNALLY_VISIBLE | |||
| 173 | 173 | ||
| 174 | #endif | 174 | #endif |
| 175 | 175 | ||
| 176 | #if defined DOUG_LEA_MALLOC || !defined CANNOT_DUMP | ||
| 177 | |||
| 176 | /* Allocator-related actions to do just before and after unexec. */ | 178 | /* Allocator-related actions to do just before and after unexec. */ |
| 177 | 179 | ||
| 178 | void | 180 | void |
| 179 | alloc_unexec_pre (void) | 181 | alloc_unexec_pre (void) |
| 180 | { | 182 | { |
| 181 | #ifdef DOUG_LEA_MALLOC | 183 | # ifdef DOUG_LEA_MALLOC |
| 182 | malloc_state_ptr = malloc_get_state (); | 184 | malloc_state_ptr = malloc_get_state (); |
| 183 | if (!malloc_state_ptr) | 185 | if (!malloc_state_ptr) |
| 184 | fatal ("malloc_get_state: %s", strerror (errno)); | 186 | fatal ("malloc_get_state: %s", strerror (errno)); |
| 185 | #endif | 187 | # endif |
| 186 | #ifdef HYBRID_MALLOC | 188 | # ifdef HYBRID_MALLOC |
| 187 | bss_sbrk_did_unexec = true; | 189 | bss_sbrk_did_unexec = true; |
| 188 | #endif | 190 | # endif |
| 189 | } | 191 | } |
| 190 | 192 | ||
| 191 | void | 193 | void |
| 192 | alloc_unexec_post (void) | 194 | alloc_unexec_post (void) |
| 193 | { | 195 | { |
| 194 | #ifdef DOUG_LEA_MALLOC | 196 | # ifdef DOUG_LEA_MALLOC |
| 195 | free (malloc_state_ptr); | 197 | free (malloc_state_ptr); |
| 196 | #endif | 198 | # endif |
| 197 | #ifdef HYBRID_MALLOC | 199 | # ifdef HYBRID_MALLOC |
| 198 | bss_sbrk_did_unexec = false; | 200 | bss_sbrk_did_unexec = false; |
| 199 | #endif | 201 | # endif |
| 200 | } | 202 | } |
| 203 | #endif | ||
| 201 | 204 | ||
| 202 | /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer | 205 | /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer |
| 203 | to a struct Lisp_String. */ | 206 | to a struct Lisp_String. */ |
| @@ -5216,6 +5219,8 @@ pure_alloc (size_t size, int type) | |||
| 5216 | } | 5219 | } |
| 5217 | 5220 | ||
| 5218 | 5221 | ||
| 5222 | #ifndef CANNOT_DUMP | ||
| 5223 | |||
| 5219 | /* Print a warning if PURESIZE is too small. */ | 5224 | /* Print a warning if PURESIZE is too small. */ |
| 5220 | 5225 | ||
| 5221 | void | 5226 | void |
| @@ -5226,6 +5231,7 @@ check_pure_size (void) | |||
| 5226 | " bytes needed)"), | 5231 | " bytes needed)"), |
| 5227 | pure_bytes_used + pure_bytes_used_before_overflow); | 5232 | pure_bytes_used + pure_bytes_used_before_overflow); |
| 5228 | } | 5233 | } |
| 5234 | #endif | ||
| 5229 | 5235 | ||
| 5230 | 5236 | ||
| 5231 | /* Find the byte sequence {DATA[0], ..., DATA[NBYTES-1], '\0'} from | 5237 | /* Find the byte sequence {DATA[0], ..., DATA[NBYTES-1], '\0'} from |
diff --git a/src/emacs.c b/src/emacs.c index efd4fa329df..ac9b6495337 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -130,11 +130,15 @@ Lisp_Object Vlibrary_cache; | |||
| 130 | on subsequent starts. */ | 130 | on subsequent starts. */ |
| 131 | bool initialized; | 131 | bool initialized; |
| 132 | 132 | ||
| 133 | #ifdef CANNOT_DUMP | ||
| 134 | enum { might_dump = false }; | ||
| 135 | #else | ||
| 133 | /* Set to true if this instance of Emacs might dump. */ | 136 | /* Set to true if this instance of Emacs might dump. */ |
| 134 | #ifndef DOUG_LEA_MALLOC | 137 | # ifndef DOUG_LEA_MALLOC |
| 135 | static | 138 | static |
| 136 | #endif | 139 | # endif |
| 137 | bool might_dump; | 140 | bool might_dump; |
| 141 | #endif | ||
| 138 | 142 | ||
| 139 | #ifdef DARWIN_OS | 143 | #ifdef DARWIN_OS |
| 140 | extern void unexec_init_emacs_zone (void); | 144 | extern void unexec_init_emacs_zone (void); |
| @@ -196,7 +200,7 @@ int daemon_type; | |||
| 196 | #ifndef WINDOWSNT | 200 | #ifndef WINDOWSNT |
| 197 | /* Pipe used to send exit notification to the background daemon parent at | 201 | /* Pipe used to send exit notification to the background daemon parent at |
| 198 | startup. On Windows, we use a kernel event instead. */ | 202 | startup. On Windows, we use a kernel event instead. */ |
| 199 | int daemon_pipe[2]; | 203 | static int daemon_pipe[2]; |
| 200 | #else | 204 | #else |
| 201 | HANDLE w32_daemon_event; | 205 | HANDLE w32_daemon_event; |
| 202 | #endif | 206 | #endif |
diff --git a/src/image.c b/src/image.c index d82fedb8dea..5614f39e15b 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -9776,6 +9776,8 @@ lookup_image_type (Lisp_Object type) | |||
| 9776 | return NULL; | 9776 | return NULL; |
| 9777 | } | 9777 | } |
| 9778 | 9778 | ||
| 9779 | #if !defined CANNOT_DUMP && defined HAVE_WINDOW_SYSTEM | ||
| 9780 | |||
| 9779 | /* Reset image_types before dumping. | 9781 | /* Reset image_types before dumping. |
| 9780 | Called from Fdump_emacs. */ | 9782 | Called from Fdump_emacs. */ |
| 9781 | 9783 | ||
| @@ -9789,6 +9791,7 @@ reset_image_types (void) | |||
| 9789 | image_types = next; | 9791 | image_types = next; |
| 9790 | } | 9792 | } |
| 9791 | } | 9793 | } |
| 9794 | #endif | ||
| 9792 | 9795 | ||
| 9793 | void | 9796 | void |
| 9794 | syms_of_image (void) | 9797 | syms_of_image (void) |
diff --git a/src/lastfile.c b/src/lastfile.c index 9d70b001d11..27602bd6a44 100644 --- a/src/lastfile.c +++ b/src/lastfile.c | |||
| @@ -43,6 +43,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 43 | char my_edata[] = "End of Emacs initialized data"; | 43 | char my_edata[] = "End of Emacs initialized data"; |
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | #ifndef CANNOT_DUMP | ||
| 47 | |||
| 46 | /* Help unexec locate the end of the .bss area used by Emacs (which | 48 | /* Help unexec locate the end of the .bss area used by Emacs (which |
| 47 | isn't always a separate section in NT executables). */ | 49 | isn't always a separate section in NT executables). */ |
| 48 | char my_endbss[1]; | 50 | char my_endbss[1]; |
| @@ -52,3 +54,5 @@ char my_endbss[1]; | |||
| 52 | of the bss area used by Emacs. */ | 54 | of the bss area used by Emacs. */ |
| 53 | static char _my_endbss[1]; | 55 | static char _my_endbss[1]; |
| 54 | char * my_endbss_static = _my_endbss; | 56 | char * my_endbss_static = _my_endbss; |
| 57 | |||
| 58 | #endif | ||