]> git.eshelyaron.com Git - emacs.git/commitdiff
Make CANNOT_DUMP work better on GNU/Linux
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Nov 2016 00:57:17 +0000 (16:57 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Nov 2016 00:59:24 +0000 (16:59 -0800)
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.

configure.ac
src/alloc.c
src/emacs.c
src/image.c
src/lastfile.c
test/Makefile.in

index c9759e18a02922e1e585668ed1a7375870c78a82..2d116de3b6b17f875ab59d6c62ee77572bd372e5 100644 (file)
@@ -1366,6 +1366,7 @@ case "$opsys" in
    UNEXEC_OBJ=unexsol.o
    ;;
 esac
+test "$CANNOT_DUMP" = "yes" && UNEXEC_OBJ=
 
 LD_SWITCH_SYSTEM=
 case "$opsys" in
@@ -2154,6 +2155,7 @@ doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 hybrid_malloc=
 system_malloc=yes
 
+test "$CANNOT_DUMP" = yes ||
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
   darwin | mingw32 | nacl | sol2-10) ;;
index 90c6f9441faf96183744bdf67087c104e13a3fce..175dcab2487be175aa8f16379979aaa882ef7b2b 100644 (file)
@@ -173,31 +173,34 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook EXTERNALLY_VISIBLE
 
 #endif
 
+#if defined DOUG_LEA_MALLOC || !defined CANNOT_DUMP
+
 /* Allocator-related actions to do just before and after unexec.  */
 
 void
 alloc_unexec_pre (void)
 {
-#ifdef DOUG_LEA_MALLOC
+# ifdef DOUG_LEA_MALLOC
   malloc_state_ptr = malloc_get_state ();
   if (!malloc_state_ptr)
     fatal ("malloc_get_state: %s", strerror (errno));
-#endif
-#ifdef HYBRID_MALLOC
+# endif
+# ifdef HYBRID_MALLOC
   bss_sbrk_did_unexec = true;
-#endif
+# endif
 }
 
 void
 alloc_unexec_post (void)
 {
-#ifdef DOUG_LEA_MALLOC
+# ifdef DOUG_LEA_MALLOC
   free (malloc_state_ptr);
-#endif
-#ifdef HYBRID_MALLOC
+# endif
+# ifdef HYBRID_MALLOC
   bss_sbrk_did_unexec = false;
-#endif
+# endif
 }
+#endif
 
 /* Mark, unmark, query mark bit of a Lisp string.  S must be a pointer
    to a struct Lisp_String.  */
@@ -5216,6 +5219,8 @@ pure_alloc (size_t size, int type)
 }
 
 
+#ifndef CANNOT_DUMP
+
 /* Print a warning if PURESIZE is too small.  */
 
 void
@@ -5226,6 +5231,7 @@ check_pure_size (void)
              " bytes needed)"),
             pure_bytes_used + pure_bytes_used_before_overflow);
 }
+#endif
 
 
 /* Find the byte sequence {DATA[0], ..., DATA[NBYTES-1], '\0'} from
index efd4fa329df97cdb03cbe8b0f3952470dbbdec35..ac9b6495337a923a4636ad69ec845bb807bc083d 100644 (file)
@@ -130,11 +130,15 @@ Lisp_Object Vlibrary_cache;
    on subsequent starts.  */
 bool initialized;
 
+#ifdef CANNOT_DUMP
+enum { might_dump = false };
+#else
 /* Set to true if this instance of Emacs might dump.  */
-#ifndef DOUG_LEA_MALLOC
+# ifndef DOUG_LEA_MALLOC
 static
-#endif
+# endif
 bool might_dump;
+#endif
 
 #ifdef DARWIN_OS
 extern void unexec_init_emacs_zone (void);
@@ -196,7 +200,7 @@ int daemon_type;
 #ifndef WINDOWSNT
 /* Pipe used to send exit notification to the background daemon parent at
    startup.  On Windows, we use a kernel event instead.  */
-int daemon_pipe[2];
+static int daemon_pipe[2];
 #else
 HANDLE w32_daemon_event;
 #endif
index d82fedb8deaca62a8765059002d00a21c9d6af48..5614f39e15bb369a3764b87d1a65817dddd360bb 100644 (file)
@@ -9776,6 +9776,8 @@ lookup_image_type (Lisp_Object type)
   return NULL;
 }
 
+#if !defined CANNOT_DUMP && defined HAVE_WINDOW_SYSTEM
+
 /* Reset image_types before dumping.
    Called from Fdump_emacs.  */
 
@@ -9789,6 +9791,7 @@ reset_image_types (void)
       image_types = next;
     }
 }
+#endif
 
 void
 syms_of_image (void)
index 9d70b001d11d02e6cdfd7b4af95e1f34883d1124..27602bd6a444b07f670422009b7eeda020cb591c 100644 (file)
@@ -43,6 +43,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 char my_edata[] = "End of Emacs initialized data";
 #endif
 
+#ifndef CANNOT_DUMP
+
 /* Help unexec locate the end of the .bss area used by Emacs (which
    isn't always a separate section in NT executables).  */
 char my_endbss[1];
@@ -52,3 +54,5 @@ char my_endbss[1];
    of the bss area used by Emacs.  */
 static char _my_endbss[1];
 char * my_endbss_static = _my_endbss;
+
+#endif
index 33e625fc996c81611abc516e1f312da1311244eb..f2f27634c240f25b6b8e8e3ca0a4231454e602a3 100644 (file)
@@ -190,6 +190,7 @@ check-doit: ${LOGFILES}
 
 mostlyclean:
        -@for f in ${LOGFILES}; do test ! -f $$f || mv $$f $$f~; done
+       rm -f *.tmp
 
 clean:
        -rm -f ${LOGFILES} ${LOGSAVEFILES}
@@ -206,5 +207,7 @@ maintainer-clean: distclean bootstrap-clean
 make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
        $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
        --eval "(make-test-deps \"$(srcdir)\")" \
-       2> $@
-# Makefile ends here.
+       2> $@.tmp
+       # Hack to elide any CANNOT_DUMP=yes chatter.
+       sed '/\.log: /!d' $@.tmp >$@
+       rm -f $@.tmp