Next: , Previous: Building SCM, Up: Installing SCM

2.4 Saving Executable Images

In SCM, the ability to save running program images is called dump (see Dump). In order to make dump available to SCM, build with feature ‘dump’. dumped executables are compatible with dynamic linking.

Most of the code for dump is taken from emacs-19.34/src/unex*.c. No modifications to the emacs source code were required to use unexelf.c. Dump has not been ported to all platforms. If unexec.c or unexelf.c don't work for you, try using the appropriate unex*.c file from emacs.

The ‘dscm4’ and ‘dscm5’ targets in the SCM Makefile save images from udscm4 and udscm5 executables respectively.

Address space layout randomization interferes with dump. Here are the fixes for various operating-systems:

Remove the ‘#’ from the line ‘#SETARCH = setarch i386’ in the Makefile.
Fedora-Core-3 [For FC3] combreloc has become the default for recent GNU ld, which breaks the unexec/undump on all versions of both Emacs and XEmacs...

Override by adding the following to udscm5.opt: ‘--linker-options="-z nocombreloc"

Linux Kernels later than 2.6.11
mentions the exec-shield feature. Kernels later than 2.6.11 must do (as root):
          echo 0 > /proc/sys/kernel/randomize_va_space

before dumping. Makefile has this randomize_va_space stuffing scripted for targets ‘dscm4’ and ‘dscm5’. You must either set randomize_va_space to 0 or run as root to dump.

OS-X 10.6
The dynamic linker uses the following environment variables. They affect any program that uses the dynamic linker.


Causes dyld to not randomize the load addresses of images in a process where the main executable was built position independent. This can be helpful when trying to reproduce and debug a problem in a PIE.