AC_DEFINE(HAVE_PDUMPER, 1, [Define to build with portable dumper support])
fi
-if test "$with_unexec" = "yes"; then
- CANNOT_DUMP=no
-else
- CANNOT_DUMP=yes
-fi
-
DUMPING=$with_dumping
AC_SUBST(DUMPING)
-AC_SUBST(CANNOT_DUMP)
dnl FIXME currently it is not the last.
dnl This should be the last --with option, because --with-x is
PAXCTL_dumped=
PAXCTL_notdumped=
-if test "$CANNOT_DUMP" = "no" && test $opsys = gnu-linux; then
+if test $with_unexec = yes && test $opsys = gnu-linux; then
if test "${SETFATTR+set}" != set; then
AC_CACHE_CHECK([for setfattr],
[emacs_cv_prog_setfattr],
fi
AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
- [if test "$CANNOT_DUMP" = "yes"; then
+ [if test $with_unexec = no; then
emacs_cv_znocombreloc='not needed'
else
save_LDFLAGS=$LDFLAGS
[emacs_cv_sanitize_address=yes],
[emacs_cv_sanitize_address=no])])
-if test "$CANNOT_DUMP" = "yes"; then
- AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs should not support unexec.])
-elif test "$emacs_cv_sanitize_address" = yes; then
- AC_MSG_WARN([[Addresses are sanitized; suggest CANNOT_DUMP=yes]])
+if test $with_unexec = yes; then
+ AC_DEFINE([HAVE_UNEXEC], 1, [Define if Emacs supports unexec.])
+ if test "$emacs_cv_sanitize_address" = yes; then
+ AC_MSG_WARN([[Addresses are sanitized; suggest --without-unexec]])
+ fi
fi
-UNEXEC_OBJ=unexelf.o
+
+UNEXEC_OBJ=
+test $with_unexec = yes &&
case "$opsys" in
# MSDOS uses unexcoff.o
aix4-2)
# not been tested, so for now this change is for Solaris 10 or newer.
UNEXEC_OBJ=unexsol.o
;;
+ *)
+ UNEXEC_OBJ=unexelf.o
+ ;;
esac
-test "$CANNOT_DUMP" = "yes" && UNEXEC_OBJ=
LD_SWITCH_SYSTEM=
test "$with_unexec" = no || case "$opsys" in
C_SWITCH_MACHINE=
-test "$CANNOT_DUMP" = yes ||
+test $with_unexec = yes &&
case $canonical in
alpha*)
AC_CHECK_DECL([__ELF__])
hybrid_malloc=
system_malloc=yes
-test "$CANNOT_DUMP" = yes ||
+test $with_unexec = yes &&
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin | mingw32 | nacl | sol2-10) ;;
AC_CACHE_CHECK(
[for $CC option to disable position independent executables],
[emacs_cv_prog_cc_no_pie],
- [if test "$CANNOT_DUMP" = yes; then
+ [if test $with_unexec = no; then
emacs_cv_prog_cc_no_pie='not needed'
else
emacs_save_c_werror_flag=$ac_c_werror_flag
for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \
GCONF GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT OLDXMENU X11 XDBE XIM \
- NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON CANNOT_DUMP LCMS2 GMP; do
+ NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON LCMS2 GMP; do
case $opt in
- CANNOT_DUMP) eval val=\${$opt} ;;
GLIB) val=${emacs_cv_links_glib} ;;
NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
incompatible with the way these packages use to track allocated
memory. Here are some of the changes you might find necessary:
- - Edit configure, to set system_malloc and CANNOT_DUMP to "yes".
+ - Make sure unexec is disabled, e.g., './configure --without-unexec'.
- Configure with a different --prefix= option. If you use GCC,
version 2.7.2 is preferred, as some malloc debugging packages
t))))
(kill-emacs)))
-;; For machines with CANNOT_DUMP defined in config.h,
-;; this file must be loaded each time Emacs is run.
+;; This file must be loaded each time Emacs is run from scratch, e.g., temacs.
;; So run the startup code now. First, remove `-l loadup' from args.
(if (and (member (nth 1 command-line-args) '("-l" "--load"))
#endif
-#if defined DOUG_LEA_MALLOC || !defined CANNOT_DUMP
+#if defined DOUG_LEA_MALLOC || defined HAVE_UNEXEC
/* Allocator-related actions to do just before and after unexec. */
#endif
/* Addresses of staticpro'd variables. Initialize it to a nonzero
- value if we might dump; otherwise some compilers put it into
+ value if we might unexec; otherwise some compilers put it into
BSS. */
Lisp_Object *staticvec[NSTATICS]
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
= {&Vpurify_flag}
#endif
;
/* Use aligned_alloc if it or a simple substitute is available.
Aligned allocation is incompatible with unexmacosx.c, so don't use
- it on Darwin unless CANNOT_DUMP. */
+ it on Darwin if HAVE_UNEXEC. */
-#if !defined DARWIN_OS || defined CANNOT_DUMP
+#if ! (defined DARWIN_OS && defined HAVE_UNEXEC)
# if (defined HAVE_ALIGNED_ALLOC \
|| (defined HYBRID_MALLOC \
? defined HAVE_POSIX_MEMALIGN \
}
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
/* Print a warning if PURESIZE is too small. */
# define ADDRESS_SANITIZER false
#endif
-#ifdef DARWIN_OS
-#if defined emacs && !defined CANNOT_DUMP
-#define malloc unexec_malloc
-#define realloc unexec_realloc
-#define free unexec_free
+#if defined DARWIN_OS && defined emacs && defined HAVE_UNEXEC
+# define malloc unexec_malloc
+# define realloc unexec_realloc
+# define free unexec_free
#endif
-#endif /* DARWIN_OS */
/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
gmalloc before dumping and the system malloc after dumping.
bool display_arg;
#endif
-#if defined GNU_LINUX && !defined CANNOT_DUMP
+#if defined GNU_LINUX && defined HAVE_UNEXEC
/* The gap between BSS end and heap start as far as we can tell. */
static uprintmax_t heap_bss_diff;
#endif
can set heap flags properly if we're going to unexec. */
if (!initialized && temacs)
{
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
if (strcmp (temacs, "dump") == 0 ||
strcmp (temacs, "bootstrap") == 0)
gflags.will_dump_with_unexec_ = true;
strcmp (temacs, "pbootstrap") == 0)
gflags.will_dump_with_pdumper_ = true;
#endif
-#if defined (HAVE_PDUMPER) || !defined (CANNOT_DUMP)
+#if defined HAVE_PDUMPER || defined HAVE_UNEXEC
if (strcmp (temacs, "bootstrap") == 0 ||
strcmp (temacs, "pbootstrap") == 0)
gflags.will_bootstrap_ = true;
#endif
}
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
if (!will_dump_with_unexec_p ())
gflags.will_not_unexec_ = true;
#endif
argc = maybe_disable_address_randomization (
will_dump_with_unexec_p (), argc, argv);
-#if defined (GNU_LINUX) && !defined (CANNOT_DUMP)
+#if defined GNU_LINUX && defined HAVE_UNEXEC
if (!initialized)
{
char *heap_start = my_heap_start ();
#endif
/* If using unexmacosx.c (set by s/darwin.h), we must do this. */
-#if defined DARWIN_OS && !defined CANNOT_DUMP
+#if defined DARWIN_OS && defined HAVE_UNEXEC
if (!initialized)
unexec_init_emacs_zone ();
#endif
/* Call syms_of_keyboard before init_window_once because
keyboard sets up symbols that include some face names that
the X support will want to use. This can happen when
- CANNOT_DUMP is defined. */
+ Emacs starts up from scratch (e.g., temacs). */
syms_of_keyboard ();
/* Called before syms_of_fileio, because it sets up Qerror_condition. */
\f
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
#include "unexec.h"
if (definitely_will_not_unexec_p ())
error ("This Emacs instance was not started in temacs mode");
-#if defined GNU_LINUX && !defined CANNOT_DUMP
+# if defined GNU_LINUX && defined HAVE_UNEXEC
/* Warn if the gap between BSS end and heap start is larger than this. */
-# define MAX_HEAP_BSS_DIFF (1024*1024)
+# define MAX_HEAP_BSS_DIFF (1024 * 1024)
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
{
fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
fprintf (stderr, "**************************************************\n");
}
-#endif /* GNU_LINUX */
+# endif
/* Bind `command-line-processed' to nil before dumping,
so that the dumped Emacs will process its command line
tem = Vpurify_flag;
Vpurify_flag = Qnil;
-#ifdef HYBRID_MALLOC
+# ifdef HYBRID_MALLOC
{
static char const fmt[] = "%d of %d static heap bytes used";
char buf[sizeof fmt + 2 * (INT_STRLEN_BOUND (int) - 2)];
/* Don't log messages, because at this point buffers cannot be created. */
message1_nolog (buf);
}
-#endif
+# endif
fflush_unlocked (stdout);
/* Tell malloc where start of impure now is. */
/* Also arrange for warnings when nearly out of space. */
-#if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC
-#ifndef WINDOWSNT
+# if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined WINDOWSNT
/* On Windows, this was done before dumping, and that once suffices.
Meanwhile, my_edata is not valid on Windows. */
memory_warnings (my_edata, malloc_warning);
-#endif /* not WINDOWSNT */
-#endif /* not SYSTEM_MALLOC and not HYBRID_MALLOC */
+# endif
struct gflags old_gflags = gflags;
gflags.will_dump_ = false;
gflags = old_gflags;
-#ifdef WINDOWSNT
+# ifdef WINDOWSNT
Vlibrary_cache = Qnil;
-#endif
-#ifdef HAVE_WINDOW_SYSTEM
+# endif
+# ifdef HAVE_WINDOW_SYSTEM
reset_image_types ();
-#endif
+# endif
Vpurify_flag = tem;
return unbind_to (count, Qnil);
}
-#endif /* not CANNOT_DUMP */
+#endif
\f
#if HAVE_SETLOCALE
DEFSYM (Qkill_emacs, "kill-emacs");
DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
defsubr (&Sdump_emacs);
#endif
return NULL;
}
-#if !defined CANNOT_DUMP && defined HAVE_WINDOW_SYSTEM
+#if defined HAVE_UNEXEC && defined HAVE_WINDOW_SYSTEM
/* Reset image_types before dumping.
Called from Fdump_emacs. */
char my_edata[] = "End of Emacs initialized data";
#endif
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
/* Help unexec locate the end of the .bss area used by Emacs (which
isn't always a separate section in NT executables). */
extern struct gflags {
/* True means this Emacs instance was born to dump. */
-#if defined (HAVE_PDUMPER) || !defined (CANNOT_DUMP)
+#if defined HAVE_PDUMPER || defined HAVE_UNEXEC
bool will_dump_ : 1;
bool will_bootstrap_ : 1;
#endif
-#if defined (HAVE_PDUMPER)
+#ifdef HAVE_PDUMPER
/* Set in an Emacs process that will likely dump with pdumper; all
Emacs processes may dump with pdumper, however. */
bool will_dump_with_pdumper_ : 1;
dump. */
bool dumped_with_pdumper_ : 1;
#endif
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
bool will_dump_with_unexec_ : 1;
/* Set in an Emacs process that has been restored from an unexec
dump. */
INLINE bool
will_dump_p (void)
{
-#if HAVE_PDUMPER || !defined (CANNOT_DUMP)
+#if HAVE_PDUMPER || defined HAVE_UNEXEC
return gflags.will_dump_;
#else
return false;
INLINE bool
will_bootstrap_p (void)
{
-#if HAVE_PDUMPER || !defined (CANNOT_DUMP)
+#if HAVE_PDUMPER || defined HAVE_UNEXEC
return gflags.will_bootstrap_;
#else
return false;
INLINE bool
will_dump_with_unexec_p (void)
{
-#ifdef CANNOT_DUMP
- return false;
-#else
+#ifdef HAVE_UNEXEC
return gflags.will_dump_with_unexec_;
+#else
+ return false;
#endif
}
INLINE bool
dumped_with_unexec_p (void)
{
-#ifdef CANNOT_DUMP
- return false;
-#else
+#ifdef HAVE_UNEXEC
return gflags.dumped_with_unexec_;
+#else
+ return false;
#endif
}
INLINE bool
definitely_will_not_unexec_p (void)
{
-#ifdef CANNOT_DUMP
- return true;
-#else
+#ifdef HAVE_UNEXEC
return gflags.will_not_unexec_;
+#else
+ return true;
#endif
}
/* If we're not dumping using the legacy dumper and we might be using
the portable dumper, try to bunch all the subr structures together
for more efficient dump loading. */
-#ifdef CANNOT_DUMP
+#ifndef HAVE_UNEXEC
# ifdef DARWIN_OS
# define SUBR_SECTION_ATTRIBUTE ATTRIBUTE_SECTION ("__DATA,subrs")
# else
extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol);
/* Defined in unexmacosx.c. */
-#if defined DARWIN_OS && !defined CANNOT_DUMP
+#if defined DARWIN_OS && defined HAVE_UNEXEC
extern void unexec_init_emacs_zone (void);
extern void *unexec_malloc (size_t);
extern void *unexec_realloc (void *, size_t);
char **address = term_get_fkeys_address;
KBOARD *kboard = term_get_fkeys_kboard;
- /* This can happen if CANNOT_DUMP or with strange options. */
+ /* This can happen if Emacs is starting up from scratch, or with
+ strange options. */
if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
void
init_timefns (void)
{
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
/* A valid but unlikely setting for the TZ environment variable.
It is OK (though a bit slower) if the user chooses this value. */
static char dump_tz_string[] = "TZ=UtC0";
char *tz = getenv ("TZ");
-#if !defined CANNOT_DUMP
+#ifdef HAVE_UNEXEC
/* If the execution TZ happens to be the same as the dump TZ,
change it to some other value and then change it back,
to force the underlying implementation to reload the TZ info.
#define PERROR(file) report_error (file, new)
-#ifndef CANNOT_DUMP /* all rest of file! */
+#ifdef HAVE_UNEXEC /* all rest of file! */
#ifdef HAVE_COFF_H
#include <coff.h>
emacs_close (a_out);
}
-#endif /* not CANNOT_DUMP */
+#endif /* HAVE_UNEXEC */
than half of the size stated below. It would be nice to find a way
to build only the first bootstrap-emacs.exe with the large size,
and reset that to a lower value afterwards. */
-#ifdef CANNOT_DUMP
-/* We don't use dumped_data[] when CANNOT_DUMP, so define to a small
- size that won't matter. */
+#ifndef HAVE_UNEXEC
+/* We don't use dumped_data[], so define to a small size that won't
+ matter. */
# define DUMPED_HEAP_SIZE 10
#else
# if defined _WIN64 || defined WIDE_EMACS_INT
}
}
-#if !defined (CANNOT_DUMP) && defined (ENABLE_CHECKING)
+#if defined HAVE_UNEXEC && defined ENABLE_CHECKING
void
report_temacs_memory_usage (void)
{