useful and so is no longer enabled by default in developer builds,
to reduce differences between developer and production builds.
-** Emacs by default uses a "portable dumper" instead of unexec,
-improving compatibility with modern systems and supporting ASLR.
-Emacs now needs an "emacs.pdmp" file, generated during the built, in
-its data directory at runtime.
++++
+** Emacs now uses a "portable dumper" instead of unexec.
+This improves compatibility with memory allocation on modern systems,
+and in particular better supports the Address Space Layout
+Randomization (ASLR) feature, a security technique used by most modern
+operating systems.
+
+Portable dumping can be disabled at configure time via the configure
+option '--with-pdumper=no' (but we don't recommend that, unless the
+portable dumping doesn't work on your system for some reason---please
+report such systems to the Emacs developers as bugs).
+
+When built with the portable dumping support (which is the default),
+Emacs looks for the 'emacs.pdmp' file, generated during the build, in
+its data directory at startup, and loads the dumped state from there.
+The new command-line argument '--dump-file=FILE' allows to specify a
+non-default '.pdmp' file to load the state from; see the node "Initial
+Options" in the Emacs manual for more information.
** Ibuffer
"\
--module-assertions assert behavior of dynamic modules\n\
",
+#endif
+#ifdef HAVE_PDUMPER
+ "\
+--dump-file FILE read dumped state from FILE\n\
+",
#endif
"\
--no-build-details do not add build details such as time stamps\n\
}
}
-static bool
-string_starts_with_p (const char* string, const char* prefix)
-{
- return strncmp (string, prefix, strlen (prefix)) == 0;
-}
-
-/* Return the value of GNU-style long argument ARGUMENT if given on
- command line. ARGUMENT must begin with "-". If ARGUMENT is not
- given, return NULL. */
-static char *
-find_argument (const char *argument, int argc, char **argv)
-{
- char *found = NULL;
- int i;
-
- eassert (argument[0] == '-');
-
- for (i = 1; i < argc; ++i)
- if (string_starts_with_p (argv[i], argument) &&
- ((argv[i] + strlen (argument))[0] == '=' ||
- (argv[i] + strlen (argument))[0] == '\0'))
- {
- int j = i;
- found = argv[j++] + strlen (argument);
- if (*found == '=')
- ++found;
- else if (i < argc)
- found = argv[j++];
- else
- fatal ("no argument given for %s", argument);
- break;
- }
- else if (strcmp (argv[i], "--") == 0)
- break;
- return found;
-}
-
/* Close standard output and standard error, reporting any write
errors as best we can. This is intended for use with atexit. */
static void
}
}
-#define PDUMP_FILE_ARG "--dump-file"
-
static enum pdumper_load_result
load_pdump (int argc, char **argv)
{
/* Look for an explicitly-specified dump file. */
const char *path_exec = PATH_EXEC;
- char *dump_file = find_argument (PDUMP_FILE_ARG, argc, argv);
+ char *dump_file = NULL;
+ int skip_args = 0;
+ while (skip_args < argc - 1)
+ {
+ if (argmatch (argv, argc, "-dump-file", "--dump-file", 6,
+ &dump_file, &skip_args)
+ || argmatch (argv, argc, "--", NULL, 2, NULL, &skip_args))
+ break;
+ skip_args++;
+ }
result = PDUMPER_NOT_LOADED;
if (dump_file)
void *stack_bottom_variable;
bool do_initial_setlocale;
- int skip_args = 0;
bool no_loadup = false;
char *junk = 0;
char *dname_arg = 0;
stack_bottom = (char *) &stack_bottom_variable;
const char *dump_mode = NULL;
- const char *temacs = find_argument ("--temacs", argc, argv);
+ int skip_args = 0;
+ char *temacs = NULL;
+ while (skip_args < argc - 1)
+ {
+ if (argmatch (argv, argc, "-temacs", "--temacs", 8, &temacs, &skip_args)
+ || argmatch (argv, argc, "--", NULL, 2, NULL, &skip_args))
+ break;
+ skip_args++;
+ }
#ifdef HAVE_PDUMPER
bool attempt_load_pdump = false;
#endif
{
fatal ("--temacs not supported for unexeced emacs");
}
- else if (initialized)
- {
-#ifdef HAVE_PDUMPER
- if (find_argument (PDUMP_FILE_ARG, argc, argv))
- fatal ("%s not supported in unexeced emacs", PDUMP_FILE_ARG);
-#endif
- }
else
{
eassert (!initialized);
eassert (!temacs);
-#ifdef PDUMP_FILE_ARG
+#ifdef HAVE_PDUMPER
attempt_load_pdump = true;
#endif
}
argc = 0;
while (argv[argc]) argc++;
+ skip_args = 0;
if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
{
const char *version, *copyright;
{ "-color", "--color", 5, 0},
{ "-no-splash", "--no-splash", 3, 0 },
{ "-no-desktop", "--no-desktop", 3, 0 },
+ /* The following two must be just above the file-name args, to get
+ them out of our way, but without mixing them with file names. */
+ { "-temacs", "--temacs", 1, 1 },
+#ifdef HAVE_PDUMPER
+ { "-dump-file", "--dump-file", 1, 1 },
+#endif
#ifdef HAVE_NS
{ "-NSAutoLaunch", 0, 5, 1 },
{ "-NXAutoLaunch", 0, 5, 1 },