emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/unexec.c,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/src/unexec.c,v
Date: Wed, 16 Jul 2008 08:06:19 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/07/16 08:06:18

Index: unexec.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/unexec.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- unexec.c    10 Jul 2008 06:49:46 -0000      1.50
+++ unexec.c    16 Jul 2008 08:06:17 -0000      1.51
@@ -229,41 +229,11 @@
 
 #else /* not COFF */
 
-#ifdef HPUX
-extern void *sbrk ();
-#else
-#if 0
-/* Some systems with __STDC__ compilers still declare this `char *' in some
-   header file, and our declaration conflicts.  The return value is always
-   cast, so it should be harmless to leave it undefined.  Hopefully
-   machines with different size pointers and ints declare sbrk in a header
-   file.  */
-#ifdef __STDC__
-extern void *sbrk ();
-#else
 extern char *sbrk ();
-#endif /* __STDC__ */
-#endif
-#endif /* HPUX */
 
 #define SYMS_START ((long) N_SYMOFF (ohdr))
 
-#ifdef HPUX
-#ifdef HP9000S200_ID
-#define MY_ID HP9000S200_ID
-#else
-#include <model.h>
-#define MY_ID MYSYS
-#endif /* no HP9000S200_ID */
-static MAGIC OLDMAGIC = {MY_ID, SHARE_MAGIC};
-static MAGIC NEWMAGIC = {MY_ID, DEMAND_MAGIC};
-#define N_TXTOFF(x) TEXT_OFFSET(x)
-#define N_SYMOFF(x) LESYM_OFFSET(x)
-static struct exec hdr, ohdr;
-
-#else /* not HPUX */
-
-#if defined (USG) && !defined (IRIS) && !defined (GNU_LINUX)
+#if defined (USG)
 static struct bhdr hdr, ohdr;
 #define a_magic fmagic
 #define a_text tsize
@@ -277,11 +247,10 @@
     (((x).fmagic)!=OMAGIC && ((x).fmagic)!=NMAGIC &&\
      ((x).fmagic)!=FMAGIC && ((x).fmagic)!=IMAGIC)
 #define NEWMAGIC FMAGIC
-#else /* IRIS or not USG */
+#else /* not USG */
 static struct exec hdr, ohdr;
 #define NEWMAGIC ZMAGIC
-#endif /* IRIS or not USG */
-#endif /* not HPUX */
+#endif /* not USG */
 
 static int unexec_text_start;
 static int unexec_data_start;
@@ -358,11 +327,7 @@
   auto struct scnhdr scntemp;          /* Temporary section header */
   register int scns;
 #endif /* COFF */
-#ifdef USG_SHARED_LIBRARIES
-  extern unsigned int bss_end;
-#else
   unsigned int bss_end;
-#endif
 
   pagemask = getpagesize () - 1;
 
@@ -479,17 +444,6 @@
   /* Now we alter the contents of all the f_*hdr variables
      to correspond to what we want to dump.  */
 
-#ifdef USG_SHARED_LIBRARIES
-
-  /* The amount of data we're adding to the file is distance from the
-   * end of the original .data space to the current end of the .data
-   * space.
-   */
-
-  bias = bss_start - (f_ohdr.data_start + f_dhdr.s_size);
-
-#endif
-
   f_hdr.f_flags |= (F_RELFLG | F_EXEC);
 #ifndef NO_REMAP
   f_ohdr.text_start = (long) start_of_text ();
@@ -532,9 +486,7 @@
   f_bhdr.s_vaddr = f_ohdr.data_start + f_ohdr.dsize;
   f_bhdr.s_size = f_ohdr.bsize;
   f_bhdr.s_scnptr = 0L;
-#ifndef USG_SHARED_LIBRARIES
   bias = f_dhdr.s_scnptr + f_dhdr.s_size - block_copy_start;
-#endif
 
   if (f_hdr.f_symptr > 0L)
     {
@@ -560,8 +512,6 @@
       PERROR (new_name);
     }
 
-#ifndef USG_SHARED_LIBRARIES
-
   if (write (new, &f_thdr, sizeof (f_thdr)) != sizeof (f_thdr))
     {
       PERROR (new_name);
@@ -577,55 +527,6 @@
       PERROR (new_name);
     }
 
-#else /* USG_SHARED_LIBRARIES */
-
-  /* The purpose of this code is to write out the new file's section
-   * header table.
-   *
-   * Scan through the original file's sections.  If the encountered
-   * section is one we know (.text, .data or .bss), write out the
-   * correct header.  If it is a section we do not know (such as
-   * .lib), adjust the address of where the section data is in the
-   * file, and write out the header.
-   *
-   * If any section precedes .text or .data in the file, this code
-   * will not adjust the file pointer for that section correctly.
-   */
-
-  /* This used to use sizeof (f_ohdr) instead of .f_opthdr.
-     .f_opthdr is said to be right when there is no optional header.  */
-  lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
-
-  for (scns = f_hdr.f_nscns; scns > 0; scns--)
-    {
-      if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
-       PERROR (a_name);
-
-      if (!strcmp (scntemp.s_name, f_thdr.s_name))     /* .text */
-       {
-         if (write (new, &f_thdr, sizeof (f_thdr)) != sizeof (f_thdr))
-           PERROR (new_name);
-       }
-      else if (!strcmp (scntemp.s_name, f_dhdr.s_name))        /* .data */
-       {
-         if (write (new, &f_dhdr, sizeof (f_dhdr)) != sizeof (f_dhdr))
-           PERROR (new_name);
-       }
-      else if (!strcmp (scntemp.s_name, f_bhdr.s_name))        /* .bss */
-       {
-         if (write (new, &f_bhdr, sizeof (f_bhdr)) != sizeof (f_bhdr))
-           PERROR (new_name);
-       }
-      else
-       {
-         if (scntemp.s_scnptr)
-           scntemp.s_scnptr += bias;
-         if (write (new, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
-           PERROR (new_name);
-       }
-    }
-#endif /* USG_SHARED_LIBRARIES */
-
   return (0);
 
 #else /* if not COFF */
@@ -684,11 +585,6 @@
       PERROR (new_name);
     }
 
-#if 0 /* This #ifndef caused a bug on GNU/Linux when using QMAGIC.  */
-  /* This adjustment was done above only #ifndef NO_REMAP,
-     so only undo it now #ifndef NO_REMAP.  */
-  /* #ifndef NO_REMAP  */
-#endif
 #ifdef A_TEXT_OFFSET
   hdr.a_text -= A_TEXT_OFFSET (ohdr);
 #endif
@@ -767,63 +663,6 @@
 
 #ifdef COFF
 
-#ifdef USG_SHARED_LIBRARIES
-
-  int scns;
-  struct scnhdr scntemp;               /* Temporary section header */
-
-  /* The purpose of this code is to write out the new file's section
-   * contents.
-   *
-   * Step through the section table.  If we know the section (.text,
-   * .data) do the appropriate thing.  Otherwise, if the section has
-   * no allocated space in the file (.bss), do nothing.  Otherwise,
-   * the section has space allocated in the file, and is not a section
-   * we know.  So just copy it.
-   */
-
-  lseek (a_out, sizeof (struct filehdr) + sizeof (struct aouthdr), 0);
-
-  for (scns = f_hdr.f_nscns; scns > 0; scns--)
-    {
-      if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
-       PERROR ("temacs");
-
-      if (!strcmp (scntemp.s_name, ".text"))
-       {
-         lseek (new, (long) text_scnptr, 0);
-         ptr = (char *) f_ohdr.text_start;
-         end = ptr + f_ohdr.tsize;
-         write_segment (new, ptr, end);
-       }
-      else if (!strcmp (scntemp.s_name, ".data"))
-       {
-         lseek (new, (long) data_scnptr, 0);
-         ptr = (char *) f_ohdr.data_start;
-         end = ptr + f_ohdr.dsize;
-         write_segment (new, ptr, end);
-       }
-      else if (!scntemp.s_scnptr)
-       ; /* do nothing - no data for this section */
-      else
-       {
-         char page[BUFSIZ];
-         int size, n;
-         long old_a_out_ptr = lseek (a_out, 0, 1);
-
-         lseek (a_out, scntemp.s_scnptr, 0);
-         for (size = scntemp.s_size; size > 0; size -= sizeof (page))
-           {
-             n = size > sizeof (page) ? sizeof (page) : size;
-             if (read (a_out, page, n) != n || write (new, page, n) != n)
-               PERROR ("emacs");
-           }
-         lseek (a_out, old_a_out_ptr, 0);
-       }
-    }
-
-#else /* COFF, but not USG_SHARED_LIBRARIES */
-
 #ifdef MSDOS
 #if __DJGPP__ >= 2
   /* Dump the original table of exception handlers, not the one
@@ -857,8 +696,6 @@
 #endif
 #endif
 
-#endif /* USG_SHARED_LIBRARIES */
-
 #else /* if not COFF */
 
 /* Some machines count the header as part of the text segment.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]