Commit 3b69e02a authored by Paul Eggert's avatar Paul Eggert

Rename CANNOT_DUMP to HAVE_UNEXEC

* configure.ac (CANNOT_DUMP): Remove.  All uses removed,
or changed to the negative of with_unexec.
(HAVE_UNEXEC): New macro.  All uses of CANNOT_DUMP changed
to the negative of this macro.
parent 84802b66
Pipeline #667 passed with stage
in 49 minutes and 49 seconds
......@@ -382,15 +382,8 @@ if test "$with_pdumper" = "yes"; then
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
......@@ -1314,7 +1307,7 @@ AC_SUBST([FIND_DELETE])
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],
......@@ -1434,7 +1427,7 @@ else
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
......@@ -1465,13 +1458,16 @@ AC_CACHE_CHECK([whether addresses are sanitized],
[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)
......@@ -1499,8 +1495,10 @@ case "$opsys" in
# 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
......@@ -1551,7 +1549,7 @@ esac
C_SWITCH_MACHINE=
test "$CANNOT_DUMP" = yes ||
test $with_unexec = yes &&
case $canonical in
alpha*)
AC_CHECK_DECL([__ELF__])
......@@ -2310,7 +2308,7 @@ doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
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) ;;
......@@ -5440,7 +5438,7 @@ esac
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
......@@ -5552,10 +5550,9 @@ emacs_config_features=
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} ;;
......
......@@ -936,7 +936,7 @@ its own versions, and because the dumping process might be
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
......
......@@ -526,8 +526,7 @@ lost after dumping")))
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"))
......
......@@ -168,7 +168,7 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook EXTERNALLY_VISIBLE
#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. */
......@@ -502,11 +502,11 @@ static struct mem_node *mem_find (void *);
#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
;
......@@ -1192,9 +1192,9 @@ verify (POWER_OF_2 (BLOCK_ALIGN));
/* 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 \
......@@ -5390,7 +5390,7 @@ pure_alloc (size_t size, int type)
}
#ifndef CANNOT_DUMP
#ifdef HAVE_UNEXEC
/* Print a warning if PURESIZE is too small. */
......
......@@ -92,13 +92,11 @@ typedef bool bool_bf;
# 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.
......
......@@ -149,7 +149,7 @@ bool running_asynch_code;
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
......@@ -868,7 +868,7 @@ main (int argc, char **argv)
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;
......@@ -878,7 +878,7 @@ main (int argc, char **argv)
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;
......@@ -904,7 +904,7 @@ main (int argc, char **argv)
#endif
}
#ifndef CANNOT_DUMP
#ifdef HAVE_UNEXEC
if (!will_dump_with_unexec_p ())
gflags.will_not_unexec_ = true;
#endif
......@@ -953,7 +953,7 @@ main (int argc, char **argv)
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 ();
......@@ -967,7 +967,7 @@ main (int argc, char **argv)
#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
......@@ -1445,7 +1445,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* 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. */
......@@ -2378,7 +2378,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
#ifndef CANNOT_DUMP
#ifdef HAVE_UNEXEC
#include "unexec.h"
......@@ -2405,10 +2405,10 @@ You must run Emacs in batch mode in order to dump it. */)
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)
{
......@@ -2421,7 +2421,7 @@ You must run Emacs in batch mode in order to dump it. */)
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
......@@ -2445,7 +2445,7 @@ You must run Emacs in batch mode in order to dump it. */)
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)];
......@@ -2454,18 +2454,16 @@ You must run Emacs in batch mode in order to dump it. */)
/* 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;
......@@ -2480,19 +2478,19 @@ You must run Emacs in batch mode in order to dump it. */)
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
#if HAVE_SETLOCALE
......@@ -2781,7 +2779,7 @@ syms_of_emacs (void)
DEFSYM (Qkill_emacs, "kill-emacs");
DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
#ifndef CANNOT_DUMP
#ifdef HAVE_UNEXEC
defsubr (&Sdump_emacs);
#endif
......
......@@ -10003,7 +10003,7 @@ lookup_image_type (Lisp_Object type)
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. */
......
......@@ -43,7 +43,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
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). */
......
......@@ -633,11 +633,11 @@ extern bool initialized;
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;
......@@ -645,7 +645,7 @@ extern struct gflags {
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. */
......@@ -658,7 +658,7 @@ extern struct gflags {
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;
......@@ -668,7 +668,7 @@ will_dump_p (void)
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;
......@@ -698,20 +698,20 @@ dumped_with_pdumper_p (void)
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
}
......@@ -721,10 +721,10 @@ dumped_with_unexec_p (void)
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
}
......@@ -3032,7 +3032,7 @@ CHECK_INTEGER (Lisp_Object x)
/* 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
......@@ -4135,7 +4135,7 @@ Lisp_Object backtrace_top_function (void);
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);
......
......@@ -1350,7 +1350,8 @@ term_get_fkeys_1 (void)
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));
......
......@@ -294,7 +294,7 @@ tzlookup (Lisp_Object zone, bool settz)
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";
......@@ -311,7 +311,7 @@ init_timefns (void)
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.
......
......@@ -56,7 +56,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#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>
......@@ -538,4 +538,4 @@ unexec (const char *new_name, const char *a_name)
emacs_close (a_out);
}
#endif /* not CANNOT_DUMP */
#endif /* HAVE_UNEXEC */
......@@ -115,9 +115,9 @@ typedef struct _RTL_HEAP_PARAMETERS {
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
......@@ -597,7 +597,7 @@ free_after_dump_9x (void *ptr)
}
}
#if !defined (CANNOT_DUMP) && defined (ENABLE_CHECKING)
#if defined HAVE_UNEXEC && defined ENABLE_CHECKING
void
report_temacs_memory_usage (void)
{
......
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