dump-emacs 是个好东西,不过最近老是dump失败
gdb了一下 发现挂在unexec那
google之至http://bugs.gentoo.org/show_bug.cgi?id=221281#c6

The breakage is caused by the “randomize brk()” patch.
See the LKML, http://lkml.org/lkml/2007/10/23/435:

This is known to break older versions of some emacs variants, whose
dumper code assumed that the last variable declared in the program is
equal to the start of the dynamically allocated memory region.

The corresponding kernel parameter is accessible via
/proc/sys/kernel/randomize_va_space, the breakage occurs if its value is 2.

结论为执行下sysctl -w kernel.randomize_va_space=0再dump即可

shell里这么写

#!/bin/bash
MYEMACS=/home/x/bin/emacs-dump
EMACS=/home/x/bin/emacs
cat > /tmp/dump-emacs.el <<EOF
(load "/home/x/.emacs")
(dump-emacs "$MYEMACS" "$EMACS")
EOF

OLD_VASPACE=`sysctl kernel.randomize_va_space|tr -d " "`
sudo sysctl -w kernel.randomize_va_space=0
$EMACS --batch --load /tmp/dump-emacs.el
sudo sysctl -w "$OLD_VASPACE"

即可