Commit 0b187fd2 authored by Paul Eggert's avatar Paul Eggert

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.
parent ebe2e69c
......@@ -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) ;;
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment