emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0b187fd 2/2: Make CANNOT_DUMP work better on GNU/Li


From: Paul Eggert
Subject: [Emacs-diffs] master 0b187fd 2/2: Make CANNOT_DUMP work better on GNU/Linux
Date: Mon, 21 Nov 2016 00:59:29 +0000 (UTC)

branch: master
commit 0b187fd2bfb797e113626df1b3740edbda8b698a
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 configure.ac     |    2 ++
 src/alloc.c      |   22 ++++++++++++++--------
 src/emacs.c      |   10 +++++++---
 src/image.c      |    3 +++
 src/lastfile.c   |    4 ++++
 test/Makefile.in |    7 +++++--
 6 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index c9759e1..2d116de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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) ;;
diff --git a/src/alloc.c b/src/alloc.c
index 90c6f94..175dcab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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
diff --git a/src/emacs.c b/src/emacs.c
index efd4fa3..ac9b649 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -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
diff --git a/src/image.c b/src/image.c
index d82fedb..5614f39 100644
--- a/src/image.c
+++ b/src/image.c
@@ -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)
diff --git a/src/lastfile.c b/src/lastfile.c
index 9d70b00..27602bd 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/>.  */
 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
diff --git a/test/Makefile.in b/test/Makefile.in
index 33e625f..f2f2763 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -190,6 +190,7 @@ check-doit: ${LOGFILES}
 
 mostlyclean:
        address@hidden 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> address@hidden
+       # Hack to elide any CANNOT_DUMP=yes chatter.
+       sed '/\.log: /!d' address@hidden >$@
+       rm -f address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]