These are diff between FSF Emacs 20.6.90 and current XEmacs
21.2.
--- /src/xemacs/src/m/iris4d.h	Mon Feb 21 10:00:40 2000
+++ /home/penny/sources/emacs-20.6.90/src/m/iris4d.h	Mon May 15 22:06:31 2000
@@ -14,11 +14,25 @@
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with XEmacs; see the file COPYING.  If not, write to
+along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* Synched up with: FSF 19.31. */
+
+/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word
+   is the most significant byte.  */
+
+#define WORDS_BIG_ENDIAN
+
+/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
+ * group of arguments and treat it as an array of the arguments.  */
+
+#define NO_ARG_ARRAY
+
+/* Define WORD_MACHINE if addresses and such have
+ * to be corrected before they can be used as byte counts.  */
+
+#undef WORD_MACHINE
 
 /* Now define a symbol for the cpu type, if your compiler
    does not define it automatically:
@@ -33,6 +47,19 @@
 #define IRIS_4D
 #endif
 
+/* Use type int rather than a union, to represent Lisp_Object */
+/* This is desirable for most machines.  */
+
+#define NO_UNION_TYPE
+
+/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
+   the bit field into an int.  In other words, if bit fields
+   are always unsigned.
+
+   If you use NO_UNION_TYPE, this flag does not matter.  */
+
+#define EXPLICIT_SIGN_EXTEND
+
 /* jg(a)genmagic.genmagic.com (John Giannandrea) says this is unnecessary.  */
 #if 0
 /* Data type of load average, as read out of kmem.  */
@@ -86,16 +113,33 @@
 
 #ifdef USG5_4
 #undef UNEXEC
-#define UNEXEC "unexelf.o"
+#define UNEXEC unexelf.o
 #else
-#define UNEXEC "unexmips.o"
+#define UNEXEC unexmips.o
 #endif
 
 #define TEXT_START 0x400000
+
+/*
+ * DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
+ * were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
+ * the value field of a LISP_OBJECT).
+ */
+
 #define DATA_START 0x10000000
+#define DATA_SEG_BITS	0x10000000
 
 #undef LIBS_MACHINE
 /* -lsun in case using Yellow Pages for passwords.  */
+#if defined(__GNUC__) && defined(_ABIN32)
+#define LIBS_MACHINE
+#else
+#ifndef IRIX6_5
+#define LIBS_MACHINE -lmld
+#else
+#define LIBS_MACHINE
+#endif
+#endif
 #define LIBS_DEBUG
 
 /* Define this if you have a fairly recent system,
@@ -105,13 +149,13 @@
 #ifndef USG5_4
 #ifdef HAVE_CRTN
 /* Must define START-FILES so that the linker can find /usr/lib/crt0.o.  */
-#define START_FILES "pre-crt0.o /usr/lib/crt1.o"
-#define LIB_STANDARD "-lc /usr/lib/crtn.o"
+#define START_FILES pre-crt0.o /usr/lib/crt1.o
+#define LIB_STANDARD -lc /usr/lib/crtn.o
 #else
-#define START_FILES "pre-crt0.o /usr/lib/crt0.o"
+#define START_FILES pre-crt0.o /usr/lib/crt0.o
 /* The entry-point label (start of text segment) is `start', not `__start'.  */
 #define DEFAULT_ENTRY_ADDRESS start
-#define LIB_STANDARD "-lc"
+#define LIB_STANDARD -lc
 #endif
 #endif
 
@@ -129,3 +173,30 @@
 
 #undef STACK_DIRECTION
 #define STACK_DIRECTION -1
+
+/* The standard definitions of these macros would work ok,
+   but these are faster because the constants are short.  */
+
+#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >>
BITS_PER_INT-VALBITS)
+
+#define XSET(var, type, ptr) \
+   ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) <<
BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS))
+
+#define XMARKBIT(a) ((a) < 0)
+#define XSETMARKBIT(a,b) ((a) = ((a) & ~MARKBIT) | ((b) ? MARKBIT : 0))
+#define XUNMARK(a) ((a) = (((unsigned)(a) << BITS_PER_INT-GCTYPEBITS-VALBITS)
>> BITS_PER_INT-GCTYPEBITS-VALBITS))
+
+#ifndef __GNUC__
+/* Turn off some "helpful" error checks for type mismatches
+   that we can't fix without breaking other machines.  */
+#ifdef IRIX_FORCE_32_BITS
+#ifdef THIS_IS_MAKEFILE
+#ifndef IRIX6_5
+#define C_SWITCH_MACHINE -32
+#else
+#define C_SWITCH_MACHINE -n32
+#endif
+#endif
+#endif
+
+#endif /* not __GNUC__ */
--- /src/xemacs/src/m/iris5d.h	Mon Feb 21 10:00:40 2000
+++ /home/penny/sources/emacs-20.6.90/src/m/iris5d.h	Mon May 15 22:06:35 2000
@@ -1,4 +1,4 @@
-/* machine description file for Iris-4D machines.  Use with s-iris3-6.h
+/* machine description file for Iris-5D machines.  Use with s-iris3-6.h
    Copyright (C) 1987 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -14,16 +14,30 @@
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with XEmacs; see the file COPYING.  If not, write to
+along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* Synched up with: FSF 19.31. */
 
 /* The following line tells the configuration script what sort of 
    operating system this machine is likely to run.
    USUAL-OPSYS="irix3-3"  */
 
+/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word
+   is the most significant byte.  */
+
+#define WORDS_BIG_ENDIAN
+
+/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
+ * group of arguments and treat it as an array of the arguments.  */
+
+#define NO_ARG_ARRAY
+
+/* Define WORD_MACHINE if addresses and such have
+ * to be corrected before they can be used as byte counts.  */
+
+#undef WORD_MACHINE
+
 /* Now define a symbol for the cpu type, if your compiler
    does not define it automatically:
    Ones defined so far include vax, m68000, ns16000, pyramid,
@@ -37,6 +51,19 @@
 #define IRIS_4D
 #endif
 
+/* Use type int rather than a union, to represent Lisp_Object */
+/* This is desirable for most machines.  */
+
+#define NO_UNION_TYPE
+
+/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
+   the bit field into an int.  In other words, if bit fields
+   are always unsigned.
+
+   If you use NO_UNION_TYPE, this flag does not matter.  */
+
+#define EXPLICIT_SIGN_EXTEND
+
 /* Data type of load average, as read out of kmem.  */
 
 #define LOAD_AVE_TYPE long	/* This doesn't quite work on the 4D */
@@ -88,14 +115,27 @@
 #ifdef UNEXEC
 #undef UNEXEC
 #endif
-#define UNEXEC "unexelf.o"
+#define UNEXEC unexelf.o
 
 #define TEXT_START 0x400000
 
+/*
+ * DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
+ * were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
+ * the value field of a LISP_OBJECT).
+ */
+
 #define DATA_START 0x10000000
+#define DATA_SEG_BITS	0x10000000
 
 #undef LIBS_MACHINE
 /* -lsun in case using Yellow Pages for passwords.  */
+#if defined(__GNUC__) && defined(_ABIN32)
+#define LIBS_MACHINE -lsun
+#else
+#define LIBS_MACHINE -lsun -lmld
+#endif
+
 #define LIBS_DEBUG
 
 /* Define this if you have a fairly recent system,
@@ -104,13 +144,13 @@
 
 #ifdef HAVE_CRTN
 /* Must define START-FILES so that the linker can find /usr/lib/crt0.o.  */
-#define START_FILES "pre-crt0.o /usr/lib/crt1.o"
-#define LIB_STANDARD "-lbsd -lc /usr/lib/crtn.o"
+#define START_FILES pre-crt0.o /usr/lib/crt1.o
+#define LIB_STANDARD -lbsd -lc /usr/lib/crtn.o
 #else
-#define START_FILES "pre-crt0.o /usr/lib/crt0.o"
+#define START_FILES pre-crt0.o /usr/lib/crt0.o
 /* The entry-point label (start of text segment) is `start', not `__start'.  */
 #define DEFAULT_ENTRY_ADDRESS start
-#define LIB_STANDARD "-lbsd -lc"
+#define LIB_STANDARD -lbsd -lc
 #endif
 
 /* Use terminfo instead of termcap.  */
@@ -131,8 +171,20 @@
 
 #define STACK_DIRECTION -1
 
+/* The standard definitions of these macros would work ok,
+   but these are faster because the constants are short.  */
+
+#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >>
BITS_PER_INT-VALBITS)
+
+#define XSET(var, type, ptr) \
+   ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) <<
BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS))
+
+#define XMARKBIT(a) ((a) < 0)
+#define XSETMARKBIT(a,b) ((a) = ((a) & ~MARKBIT) | ((b) ? MARKBIT : 0))
+#define XUNMARK(a) ((a) = (((unsigned)(a) << BITS_PER_INT-GCTYPEBITS-VALBITS)
>> BITS_PER_INT-GCTYPEBITS-VALBITS))
+
 #ifndef __GNUC__
 /* Turn off some "helpful" error checks for type mismatches
    that we can't fix without breaking other machines.  */
-#define C_SWITCH_MACHINE "-cckr"
+#define C_SWITCH_MACHINE -cckr
 #endif
--- /src/xemacs/src/unexelf.c	Thu May 25 14:28:08 2000
+++ /home/penny/sources/emacs-20.6.90/src/unexelf.c	Mon May 15 17:14:02 2000
@@ -1,24 +1,27 @@
-/* Copyright (C) 1985, 1986, 1987, 1988, 1990, 1992, 1993
+/* Copyright (C) 1985, 1986, 1987, 1988, 1990, 1992, 1999, 2000
    Free Software Foundation, Inc.
 
-This file is part of XEmacs.
+This file is part of GNU Emacs.
 
-XEmacs is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-XEmacs is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with XEmacs; see the file COPYING.  If not, write to
+along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+Boston, MA 02111-1307, USA.
+
+In other words, you are welcome to use, share and improve this program.
+You are forbidden to forbid anyone else to use, share and improve
+what you give them.   Help stamp out software-hoarding!  */
 
-/* Synched up with: FSF 20.4. */
 
 /*
  * unexec.c - Convert a running program into an a.out file.
@@ -30,14 +33,14 @@
  * Modified heavily since then.
  *
  * Synopsis:
- *	unexec (new_name, a_name, data_start, bss_start, entry_address)
- *	char *new_name, *a_name;
+ *	unexec (new_name, old_name, data_start, bss_start, entry_address)
+ *	char *new_name, *old_name;
  *	unsigned data_start, bss_start, entry_address;
  *
  * Takes a snapshot of the program and makes an a.out format file in the
  * file named by the string argument new_name.
- * If a_name is non-NULL, the symbol table will be taken from the given file.
- * On some machines, an existing a_name file is required.
+ * If old_name is non-NULL, the symbol table will be taken from the given file.
+ * On some machines, an existing old_name file is required.
  *
  * The boundaries within the a.out file may be adjusted with the data_start
  * and bss_start arguments.  Either or both may be given as 0 for defaults.
@@ -49,11 +52,6 @@
  * The value you specify may be rounded down to a suitable boundary
  * as required by the machine you are using.
  *
- * Specifying zero for data_start means the boundary between text and data
- * should not be the same as when the program was loaded.
- * If NO_REMAP is defined, the argument data_start is ignored and the
- * segment boundaries are never changed.
- *
  * Bss_start indicates how much of the data segment is to be saved in the
  * a.out file and restored when the program is executed.  It gives the lowest
  * unsaved address, and is rounded up to a page boundary.  The default when 0
@@ -63,9 +61,6 @@
  *
  * The new file is set up to start at entry_address.
  *
- * If you make improvements I'd like to get them too.
- * harpo!utah-cs!thomas, thomas@Utah-20
- *
  */
 
 /* Even more heavily modified by james(a)bigtex.cactus.org of Dell Computer Co.
@@ -413,7 +408,7 @@
 #define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
 #else
 #include <config.h>
-extern void fatal (const char *, ...);
+extern void fatal (char *, ...);
 #endif
 
 #include <sys/types.h>
@@ -432,8 +427,8 @@
 #include <sys/elf_mips.h>
 #include <sym.h>
 #endif /* __sony_news && _SYSTYPE_SYSV */
-#ifdef __sgi
-#include <sym.h> /* for HDRR declaration */
+#if __sgi
+#include <syms.h> /* for HDRR declaration */
 #endif /* __sgi */
 
 #if defined (__alpha__) && !defined (__NetBSD__) && !defined
(__OpenBSD__)
@@ -482,17 +477,19 @@
 # endif
 # include <sys/exec_elf.h>
 
-# define PT_LOAD	Elf_pt_load
-# define SHT_SYMTAB	Elf_sht_symtab
-# define SHT_DYNSYM	Elf_sht_dynsym
-# define SHT_NULL	Elf_sht_null
-# define SHT_NOBITS	Elf_sht_nobits
-# define SHT_REL	Elf_sht_rel
-# define SHT_RELA	Elf_sht_rela
-
-# define SHN_UNDEF	Elf_eshn_undefined
-# define SHN_ABS	Elf_eshn_absolute
-# define SHN_COMMON	Elf_eshn_common
+# ifndef PT_LOAD
+#  define PT_LOAD	Elf_pt_load
+#  define SHT_SYMTAB	Elf_sht_symtab
+#  define SHT_DYNSYM	Elf_sht_dynsym
+#  define SHT_NULL	Elf_sht_null
+#  define SHT_NOBITS	Elf_sht_nobits
+#  define SHT_REL	Elf_sht_rel
+#  define SHT_RELA	Elf_sht_rela
+
+#  define SHN_UNDEF	Elf_eshn_undefined
+#  define SHN_ABS	Elf_eshn_absolute
+#  define SHN_COMMON	Elf_eshn_common
+# endif
 
 # ifdef __alpha__
 #  include <sys/exec_ecoff.h>
@@ -511,10 +508,18 @@
 
 #ifndef ElfW
 # ifdef __STDC__
-#  define ElfW(type)	Elf32_##type
+#  define ElfBitsW(bits, type) Elf##bits##_##type
+# else
+#  define ElfBitsW(bits, type) Elf/**/bits/**/_/**/type
+# endif
+# ifdef _LP64
+#  define ELFSIZE 64
 # else
-#  define ElfW(type)	Elf32_/**/type
+#  define ELFSIZE 32
 # endif
+  /* This macro expands `bits' before invoking ElfBitsW.  */
+# define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
+# define ElfW(type) ElfExpandBitsW (ELFSIZE, type)
 #endif
 
 #ifndef ELF_BSS_SECTION_NAME
@@ -566,7 +571,8 @@
 /* Round X up to a multiple of Y.  */
 
 static ElfW(Addr)
-round_up (ElfW(Addr) x, ElfW(Addr) y)
+round_up (x, y)
+     ElfW(Addr) x, y;
 {
   int rem = x % y;
   if (rem == 0)
@@ -574,6 +580,45 @@
   return x - rem + y;
 }
 
+/* Return the index of the section named NAME.
+   SECTION_NAMES, FILE_NAME and FILE_H give information
+   about the file we are looking in.
+
+   If we don't find the section NAME, that is a fatal error
+   if NOERROR is 0; we return -1 if NOERROR is nonzero.  */
+
+static int
+find_section (name, section_names, file_name, old_file_h, old_section_h, noerror)
+     char *name;
+     char *section_names;
+     char *file_name;
+     ElfW(Ehdr) *old_file_h;
+     ElfW(Shdr) *old_section_h;
+     int noerror;
+{
+  int idx;
+
+  for (idx = 1; idx < old_file_h->e_shnum; idx++)
+    {
+#ifdef DEBUG
+      fprintf (stderr, "Looking for %s - found %s\n", name,
+	       section_names + OLD_SECTION_H (idx).sh_name);
+#endif
+      if (!strcmp (section_names + OLD_SECTION_H (idx).sh_name,
+		   name))
+	break;
+    }
+  if (idx == old_file_h->e_shnum)
+    {
+      if (noerror)
+	return -1;
+      else
+	fatal ("Can't find %s in %s.\n", name, file_name, 0);
+    }
+
+  return idx;
+}
+
 /* ****************************************************************
  * unexec
  *
@@ -583,11 +628,10 @@
  * .data section, and inserting an empty .bss immediately afterwards.
  *
  */
-void unexec (char *new_name, char *old_name, unsigned int data_start,
-	    unsigned int bss_start, unsigned int entry_address);
 void
-unexec (char *new_name, char *old_name, unsigned int data_start,
-	unsigned int bss_start, unsigned int entry_address)
+unexec (new_name, old_name, data_start, bss_start, entry_address)
+     char *new_name, *old_name;
+     unsigned data_start, bss_start, entry_address;
 {
   int new_file, old_file, new_file_size;
 
@@ -609,8 +653,10 @@
   ElfW(Off)  new_data2_offset;
   ElfW(Addr) new_data2_addr;
 
-  int n, nn, old_bss_index, old_data_index, new_data2_index;
-  int old_sbss_index, old_mdebug_index;
+  int n, nn;
+  int old_bss_index, old_sbss_index;
+  int old_data_index, new_data2_index;
+  int old_mdebug_index;
   struct stat stat_buf;
 
   /* Open the old file & map it into the address space. */
@@ -623,7 +669,8 @@
   if (fstat (old_file, &stat_buf) == -1)
     fatal ("Can't fstat (%s): errno %d\n", old_name, errno);
 
-  old_base = (caddr_t) mmap (0, stat_buf.st_size, PROT_READ, MAP_SHARED, old_file, 0);
+  old_base = mmap ((caddr_t) 0, stat_buf.st_size, PROT_READ, MAP_SHARED,
+		   old_file, 0);
 
   if (old_base == (caddr_t) -1)
     fatal ("Can't mmap (%s): errno %d\n", old_name, errno);
@@ -641,77 +688,43 @@
   old_section_names = (char *) old_base
     + OLD_SECTION_H (old_file_h->e_shstrndx).sh_offset;
 
+  /* Find the mdebug section, if any.  */
+
+  old_mdebug_index = find_section (".mdebug", old_section_names,
+				   old_name, old_file_h, old_section_h, 1);
+
   /* Find the old .bss section.  Figure out parameters of the new
    * data2 and bss sections.
    */
 
-  for (old_bss_index = 1; old_bss_index < (int) old_file_h->e_shnum;
-       old_bss_index++)
-    {
-#ifdef DEBUG
-      fprintf (stderr, "Looking for .bss - found %s\n",
-	       old_section_names + OLD_SECTION_H (old_bss_index).sh_name);
-#endif
-      if (!strcmp (old_section_names + OLD_SECTION_H (old_bss_index).sh_name,
-		   ELF_BSS_SECTION_NAME))
-	break;
-    }
-  if (old_bss_index == old_file_h->e_shnum)
-    fatal ("Can't find .bss in %s.\n", old_name, 0);
+  old_bss_index = find_section (".bss", old_section_names,
+				old_name, old_file_h, old_section_h, 0);
 
-  for (old_sbss_index = 1; old_sbss_index < (int) old_file_h->e_shnum;
-       old_sbss_index++)
-    {
-#ifdef DEBUG
-      fprintf (stderr, "Looking for .sbss - found %s\n",
-	       old_section_names + OLD_SECTION_H (old_sbss_index).sh_name);
-#endif
-      if (!strcmp (old_section_names + OLD_SECTION_H (old_sbss_index).sh_name,
-		   ".sbss"))
-	break;
-    }
-  if (old_sbss_index == old_file_h->e_shnum)
-    {
+  old_sbss_index = find_section (".sbss", old_section_names,
+				 old_name, old_file_h, old_section_h, 1);
+  if (old_sbss_index != -1)
+    if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS)
       old_sbss_index = -1;
-      old_bss_addr = OLD_SECTION_H(old_bss_index).sh_addr;
-      old_bss_size = OLD_SECTION_H(old_bss_index).sh_size;
+
+  if (old_sbss_index == -1)
+    {
+      old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
+      old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
       new_data2_index = old_bss_index;
     }
   else
     {
-      old_bss_addr = OLD_SECTION_H(old_sbss_index).sh_addr;
-      old_bss_size = OLD_SECTION_H(old_bss_index).sh_size
-	+ OLD_SECTION_H(old_sbss_index).sh_size;
+      old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr;
+      old_bss_size = OLD_SECTION_H (old_bss_index).sh_size
+	+ OLD_SECTION_H (old_sbss_index).sh_size;
       new_data2_index = old_sbss_index;
     }
 
-  for (old_mdebug_index = 1; old_mdebug_index < (int) old_file_h->e_shnum;
-       old_mdebug_index++)
-    {
-#ifdef DEBUG
-      fprintf (stderr, "Looking for .mdebug - found %s\n",
-	       old_section_names + OLD_SECTION_H (old_mdebug_index).sh_name);
-#endif
-      if (!strcmp (old_section_names + OLD_SECTION_H (old_mdebug_index).sh_name,
-		   ".mdebug"))
-	break;
-    }
-    if (old_mdebug_index == old_file_h->e_shnum)
-	old_mdebug_index = 0;
+  /* Find the old .data section.  Figure out parameters of
+     the new data2 and bss sections.  */
 
-  for (old_data_index = 1; old_data_index < (int) old_file_h->e_shnum;
-       old_data_index++)
-    {
-#ifdef DEBUG
-      fprintf (stderr, "Looking for .data - found %s\n",
-	       old_section_names + OLD_SECTION_H (old_data_index).sh_name);
-#endif
-      if (!strcmp (old_section_names + OLD_SECTION_H (old_data_index).sh_name,
-		   ".data"))
-	break;
-    }
-    if (old_data_index == old_file_h->e_shnum)
-	old_data_index = 0;
+  old_data_index = find_section (".data", old_section_names,
+				 old_name, old_file_h, old_section_h, 0);
 
 #if defined (emacs) || !defined (DEBUG)
   new_bss_addr = (ElfW(Addr)) sbrk (0);
@@ -750,13 +763,13 @@
   if (ftruncate (new_file, new_file_size))
     fatal ("Can't ftruncate (%s): errno %d\n", new_name, errno);
 
-  new_base = (caddr_t) mmap (0, new_file_size, PROT_READ | PROT_WRITE,
 #ifdef UNEXEC_USE_MAP_PRIVATE
-			     MAP_PRIVATE,
+  new_base = mmap ((caddr_t) 0, new_file_size, PROT_READ | PROT_WRITE,
+		   MAP_PRIVATE, new_file, 0);
 #else
-			     MAP_SHARED,
+  new_base = mmap ((caddr_t) 0, new_file_size, PROT_READ | PROT_WRITE,
+		   MAP_SHARED, new_file, 0);
 #endif
-			     new_file, 0);
 
   if (new_base == (caddr_t) -1)
     fatal ("Can't mmap (%s): errno %d\n", new_name, errno);
@@ -806,13 +819,13 @@
       if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
 	alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
 
-#ifdef __mips
+#ifdef __sgi
 	  /* According to r02kar(a)x4u2.desy.de (Karsten Kuenne)
 	     and oliva(a)gnu.org (Alexandre Oliva), on IRIX 5.2, we
 	     always get "Program segment above .bss" when dumping
 	     when the executable doesn't have an sbss section.  */
       if (old_sbss_index != -1)
-#endif /* __mips */
+#endif /* __sgi */
       if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz
 (old_sbss_index == -1 
 	     ? old_bss_addr
@@ -948,6 +961,15 @@
       if (NEW_SECTION_H (nn).sh_type != SHT_SYMTAB
 	  && NEW_SECTION_H (nn).sh_type != SHT_DYNSYM)
 	PATCH_INDEX (NEW_SECTION_H (nn).sh_info);
+      
+      if (old_sbss_index != -1)
+	if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".sbss"))
+	  {
+	    NEW_SECTION_H (nn).sh_offset = 
+	      round_up (NEW_SECTION_H (nn).sh_offset,
+			NEW_SECTION_H (nn).sh_addralign);
+	    NEW_SECTION_H (nn).sh_type = SHT_PROGBITS;
+	  }
 
       /* Now, start to copy the content of sections.  */
       if (NEW_SECTION_H (nn).sh_type == SHT_NULL
@@ -960,21 +982,16 @@
       if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
 		      ".sdata")
-          /* Taking these sections from the current process, breaks
-             Linux in a subtle way. Binaries only run on the
-             architecture (e.g. i586 vs i686) of the dumping machine */
-#ifdef __sgi
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
 		      ".lit4")
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
 		      ".lit8")
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
-		      ".got")
-#endif
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
 		      ".sdata1")
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
-		      ".data1"))
+		      ".data1")
+	  || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name,
+		      ".sbss"))
 	src = (caddr_t) OLD_SECTION_H (n).sh_addr;
       else
 	src = old_base + OLD_SECTION_H (n).sh_offset;
@@ -1004,7 +1021,8 @@
 #endif /* __alpha__ */
 
 #if defined (__sony_news) && defined (_SYSTYPE_SYSV)
-      if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG && old_mdebug_index) 
+      if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG
+	  && old_mdebug_index != -1) 
         {
 	  int diff = NEW_SECTION_H(nn).sh_offset 
 	 	- OLD_SECTION_H(old_mdebug_index).sh_offset;
@@ -1027,7 +1045,7 @@
 	}
 #endif /* __sony_news && _SYSTYPE_SYSV */
 
-#ifdef __sgi
+#if __sgi
       /* Adjust  the HDRR offsets in .mdebug and copy the 
 	 line data if it's in its usual 'hole' in the object.
 	 Makes the new file debuggable with dbx.
@@ -1142,14 +1160,10 @@
 	if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
 	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
 			".sdata")
-#ifdef __sgi
 	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
 			".lit4")
 	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
 			".lit8")
-	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
-			".got")
-#endif
 	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
 			".sdata1")
 	    || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
-- 
Yoshiki Hayashi