Subject: emacs and undumping....
To: None <port-pmax@netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 01/30/1999 18:35:34
I think I understand what's going wrong with emacs undumping.
(I cant fix it yet, but I know what's broken).

I've hacked unexelf.c so that, on a netbsd/mips ELF box, we do all the
things that were previously done for the Sony-NEWS box (except ECOFF
relocation).  that produces a dumped emacs binary which works when
unstripped, but fails with ENOEXEC when stripped.

looking at the  section headers, the undumped stripped emacs looks okay.

The problem is that when GNU binutils strips the unexec'ed binary,
it's inserting an additional ELF program-header with PT_LOAD.
And the mips  elf exec package only supports two segments: one text
and one data. (see sys/arch/mips/mips/elf.c:elf_set_segment()).
That's why we lose.

I'll put the modified emacs-20.3/src/{unexelf.c,m/pmax.h} on the
FTP server for anyone who wants to play with it.

Is strip adding the additional phdr "normal" for an ELF preloaded
emacs binary?  (do objdump --private-headers --headers before and
after stripping).