emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r101757: Remove unused arguments for


From: Dan Nicolaescu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101757: Remove unused arguments for unexec.
Date: Sun, 03 Oct 2010 06:59:56 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101757
committer: Dan Nicolaescu <address@hidden>
branch nick: trunk
timestamp: Sun 2010-10-03 06:59:56 -0700
message:
  Remove unused arguments for unexec.
  The third one is never used, and the last two are always passed as zero.
  * src/emacs.c (unexec): Add declaration.
  (Fdump_emacs): Only pass the first two arguments to unexec.
  Simplify #ifdef.
  * src/unexw32.c (unexec):
  * src/unexsol.c (unexec):
  * src/unexhp9k800.c (unexec):
  * src/unexcw.c (unexec): Remove the last 3 arguments, unused.
  * src/unexelf.c (unexec): Remove the last 3 arguments, unused.
  (find_section): Use const.
  * src/unexmacosx.c (unexec): Remove the last 3 arguments, unused.
  (unexec_error): Declare it NO_RETURN.
  * src/unexcoff.c (make_hdr): Assume bss_start is always zero, remove
  it as an argument, remove data_start and entry_address arguments, unused.
  (unexec): Remove bss_start, data_start and
  entry_address arguments.
  * src/unexaix.c (make_hdr): Assume bss_start is always zero, remove
  it as an argument, remove data_start and entry_address arguments, unused.
  (unexec): Remove bss_start, data_start and
  entry_address arguments.
modified:
  src/ChangeLog
  src/emacs.c
  src/unexaix.c
  src/unexcoff.c
  src/unexcw.c
  src/unexelf.c
  src/unexhp9k800.c
  src/unexmacosx.c
  src/unexsol.c
  src/unexw32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-10-03 12:36:19 +0000
+++ b/src/ChangeLog     2010-10-03 13:59:56 +0000
@@ -1,3 +1,27 @@
+2010-10-03  Dan Nicolaescu  <address@hidden>
+
+       Remove unused arguments for unexec.
+       The third one is never used, and the last two are always passed as zero.
+       * emacs.c (unexec): Add declaration.
+       (Fdump_emacs): Only pass the first two arguments to unexec.
+       Simplify #ifdef.
+       * unexw32.c (unexec):
+       * unexsol.c (unexec):
+       * unexhp9k800.c (unexec):
+       * unexcw.c (unexec): Remove the last 3 arguments, unused.
+       * unexelf.c (unexec): Remove the last 3 arguments, unused.
+       (find_section): Use const.
+       * unexmacosx.c (unexec): Remove the last 3 arguments, unused.
+       (unexec_error): Declare it NO_RETURN.
+       * unexcoff.c (make_hdr): Assume bss_start is always zero, remove
+       it as an argument, remove data_start and entry_address arguments, 
unused.
+       (unexec): Remove bss_start, data_start and
+       entry_address arguments.
+       * unexaix.c (make_hdr): Assume bss_start is always zero, remove
+       it as an argument, remove data_start and entry_address arguments, 
unused.
+       (unexec): Remove bss_start, data_start and
+       entry_address arguments.
+
 2010-10-03  Juanma Barranquero  <address@hidden>
 
        * makefile.w32-in (TAGS, TAGS-LISP, TAGS-gmake): Add $(FONTOBJ).

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2010-10-02 08:24:14 +0000
+++ b/src/emacs.c       2010-10-03 13:59:56 +0000
@@ -2118,6 +2118,10 @@
 
 #ifndef CANNOT_DUMP
 
+/* FIXME: maybe this should go into header file, config.h seems the
+   only one appropriate. */
+extern int unexec (const char *, const char *);
+
 DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
        doc: /* Dump current state of Emacs into executable file FILENAME.
 Take symbols from SYMFILE (presumably the file you executed to run Emacs).
@@ -2185,13 +2189,13 @@
      Meanwhile, my_edata is not valid on Windows.  */
   memory_warnings (my_edata, malloc_warning);
 #endif /* not WINDOWSNT */
-#endif
-#if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined 
SYNC_INPUT
+#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
   /* Pthread may call malloc before main, and then we will get an endless
      loop, because pthread_self (see alloc.c) calls malloc the first time
      it is called on some systems.  */
   reset_malloc_hooks ();
 #endif
+#endif /* not SYSTEM_MALLOC */
 #ifdef DOUG_LEA_MALLOC
   malloc_state_ptr = malloc_get_state ();
 #endif
@@ -2199,8 +2203,7 @@
 #ifdef USE_MMAP_FOR_BUFFERS
   mmap_set_vars (0);
 #endif
-  unexec (SDATA (filename),
-         !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0);
+  unexec (SDATA (filename), !NILP (symfile) ? SDATA (symfile) : 0);
 #ifdef USE_MMAP_FOR_BUFFERS
   mmap_set_vars (1);
 #endif

=== modified file 'src/unexaix.c'
--- a/src/unexaix.c     2010-07-08 03:03:52 +0000
+++ b/src/unexaix.c     2010-10-03 13:59:56 +0000
@@ -31,24 +31,13 @@
  * Mike Sperber <address@hidden>
  *
  * Synopsis:
- *     unexec (new_name, a_name, data_start, bss_start, entry_address)
- *     char *new_name, *a_name;
- *     unsigned data_start, bss_start, entry_address;
+ *     unexec (const char *new_name, const *old_name);
  *
  * 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.
  *
- * data_start and entry_address are ignored.
- *
- * 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
- * is given assumes that the entire data segment is to be stored, including
- * the previous data and bss as well as any additional storage allocated with
- * sbrk(2).
- *
  */
 
 #ifndef emacs
@@ -143,10 +132,7 @@
  *
  * driving logic.
  */
-int unexec (char *new_name, char *a_name,
-           unsigned data_start,
-           unsigned bss_start,
-           unsigned entry_address)
+int unexec (const char *new_name, const char *a_name)
 {
   int new = -1, a_out = -1;
 
@@ -159,8 +145,6 @@
       PERROR (new_name);
     }
   if (make_hdr (new, a_out,
-               data_start, bss_start,
-               entry_address,
                a_name, new_name) < 0
       || copy_text_and_data (new) < 0
       || copy_sym (new, a_out, a_name, new_name) < 0
@@ -186,12 +170,11 @@
  */
 static int
 make_hdr (int new, int a_out,
-         unsigned data_start, unsigned bss_start,
-         unsigned entry_address,
          char *a_name, char *new_name)
 {
   int scns;
-  unsigned int bss_end;
+  unsigned int bss_start;
+  unsigned int data_start;
 
   struct scnhdr section[MAX_SECTIONS];
   struct scnhdr * f_thdr;              /* Text section header */
@@ -211,22 +194,8 @@
 
   data_start = data_start & ~pagemask; /* (Down) to page boundary. */
 
-  bss_end = ADDR_CORRECT (sbrk (0)) + pagemask;
-  bss_end &= ~ pagemask;
-  /* Adjust data/bss boundary. */
-  if (bss_start != 0)
-    {
-      bss_start = (ADDR_CORRECT (bss_start) + pagemask);
-      /* (Up) to page bdry. */
-      bss_start &= ~ pagemask;
-      if (bss_start > bss_end)
-       {
-         ERROR1 ("unexec: Specified bss_start (%u) is past end of program",
-                 bss_start);
-       }
-    }
-  else
-    bss_start = bss_end;
+  bss_start = ADDR_CORRECT (sbrk (0)) + pagemask;
+  bss_start &= ~ pagemask;
 
   if (data_start > bss_start)  /* Can't have negative data size. */
     {
@@ -311,7 +280,7 @@
   f_hdr.f_flags |= (F_RELFLG | F_EXEC);
 
   f_ohdr.dsize = bss_start - f_ohdr.data_start;
-  f_ohdr.bsize = bss_end - bss_start;
+  f_ohdr.bsize = 0;
 
   f_dhdr->s_size = f_ohdr.dsize;
   f_bhdr->s_size = f_ohdr.bsize;

=== modified file 'src/unexcoff.c'
--- a/src/unexcoff.c    2010-08-22 15:37:01 +0000
+++ b/src/unexcoff.c    2010-10-03 13:59:56 +0000
@@ -34,37 +34,13 @@
  * Modified heavily since then.
  *
  * Synopsis:
- *     unexec (new_name, a_name, data_start, bss_start, entry_address)
- *     char *new_name, *a_name;
- *     unsigned data_start, bss_start, entry_address;
+ *     unexec (const char *new_name, const char *old_name);
  *
  * 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.
  *
- * 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.
- *
- * Data_start gives the boundary between the text segment and the data
- * segment of the program.  The text segment can contain shared, read-only
- * program code and literal data, while the data segment is always unshared
- * and unprotected.  Data_start gives the lowest unprotected address.
- * 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.
- *
- * 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
- * is given assumes that the entire data segment is to be stored, including
- * the previous data and bss as well as any additional storage allocated with
- * break (2).
- *
- * 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, address@hidden
  *
@@ -186,15 +162,16 @@
  * Modify the text and data sizes.
  */
 static int
-make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
-         unsigned entry_address, const char *a_name, const char *new_name)
+make_hdr (int new, int a_out,
+         const char *a_name, const char *new_name)
 {
   auto struct scnhdr f_thdr;           /* Text section header */
   auto struct scnhdr f_dhdr;           /* Data section header */
   auto struct scnhdr f_bhdr;           /* Bss section header */
   auto struct scnhdr scntemp;          /* Temporary section header */
   register int scns;
-  unsigned int bss_end;
+  unsigned int bss_start;
+  unsigned int data_start;
 
   pagemask = getpagesize () - 1;
 
@@ -203,23 +180,8 @@
   data_start = ADDR_CORRECT (data_start);
   data_start = data_start & ~pagemask; /* (Down) to page boundary. */
 
-  bss_end = ADDR_CORRECT (sbrk (0)) + pagemask;
-  bss_end &= ~ pagemask;
-
-  /* Adjust data/bss boundary. */
-  if (bss_start != 0)
-    {
-      bss_start = (ADDR_CORRECT (bss_start) + pagemask);
-      /* (Up) to page bdry. */
-      bss_start &= ~ pagemask;
-      if (bss_start > bss_end)
-       {
-         ERROR1 ("unexec: Specified bss_start (%u) is past end of program",
-                 bss_start);
-       }
-    }
-  else
-    bss_start = bss_end;
+  bss_start = ADDR_CORRECT (sbrk (0)) + pagemask;
+  bss_start &= ~ pagemask;
 
   if (data_start > bss_start)  /* Can't have negative data size. */
     {
@@ -300,7 +262,7 @@
 
   f_hdr.f_flags |= (F_RELFLG | F_EXEC);
   f_ohdr.dsize = bss_start - f_ohdr.data_start;
-  f_ohdr.bsize = bss_end - bss_start;
+  f_ohdr.bsize = 0;
   f_thdr.s_size = f_ohdr.tsize;
   f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr);
   f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr));
@@ -571,8 +533,7 @@
  * driving logic.
  */
 int
-unexec (const char *new_name, const char *a_name,
-       unsigned data_start, unsigned bss_start, unsigned entry_address)
+unexec (const char *new_name, const char *a_name)
 {
   int new = -1, a_out = -1;
 
@@ -585,7 +546,7 @@
       PERROR (new_name);
     }
 
-  if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, 
new_name) < 0
+  if (make_hdr (new, a_out, a_name, new_name) < 0
       || copy_text_and_data (new, a_out) < 0
       || copy_sym (new, a_out, a_name, new_name) < 0
       || adjust_lnnoptrs (new, a_out, new_name) < 0

=== modified file 'src/unexcw.c'
--- a/src/unexcw.c      2010-01-13 08:35:10 +0000
+++ b/src/unexcw.c      2010-10-03 13:59:56 +0000
@@ -248,8 +248,7 @@
 }
 
 int
-unexec (char *outfile, char *infile, unsigned start_data, unsigned d1,
-       unsigned d2)
+unexec (const char *outfile, const char *infile)
 {
   char infile_buffer[FILENAME_MAX];
   char outfile_buffer[FILENAME_MAX];

=== modified file 'src/unexelf.c'
--- a/src/unexelf.c     2010-08-09 09:35:21 +0000
+++ b/src/unexelf.c     2010-10-03 13:59:56 +0000
@@ -33,34 +33,13 @@
  * Modified heavily since then.
  *
  * Synopsis:
- *     unexec (new_name, old_name, data_start, bss_start, entry_address)
- *     char *new_name, *old_name;
- *     unsigned data_start, bss_start, entry_address;
+ *     unexec (const char *new_name, const char *old_name);
  *
  * Takes a snapshot of the program and makes an a.out format file in the
  * file named by the string argument new_name.
  * 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.
- *
- * Data_start gives the boundary between the text segment and the data
- * segment of the program.  The text segment can contain shared, read-only
- * program code and literal data, while the data segment is always unshared
- * and unprotected.  Data_start gives the lowest unprotected address.
- * The value you specify may be rounded down to a suitable boundary
- * as required by the machine you are using.
- *
- * 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
- * is given assumes that the entire data segment is to be stored, including
- * the previous data and bss as well as any additional storage allocated with
- * break (2).
- *
- * The new file is set up to start at entry_address.
- *
  */
 
 /* Even more heavily modified by address@hidden of Dell Computer Co.
@@ -610,7 +589,7 @@
    if NOERROR is 0; we return -1 if NOERROR is nonzero.  */
 
 static int
-find_section (const char *name, char *section_names, char *file_name,
+find_section (const char *name, const char *section_names, const char 
*file_name,
              ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror)
 {
   int idx;
@@ -646,8 +625,7 @@
  *
  */
 void
-unexec (char *new_name, char *old_name, unsigned int data_start,
-       unsigned int bss_start, unsigned int entry_address)
+unexec (const char *new_name, const char *old_name)
 {
   int new_file, old_file, new_file_size;
 

=== modified file 'src/unexhp9k800.c'
--- a/src/unexhp9k800.c 2008-06-26 04:24:54 +0000
+++ b/src/unexhp9k800.c 2010-10-03 13:59:56 +0000
@@ -79,12 +79,9 @@
 
 
 /* Create a new a.out file, same as old but with current data space */
-
-unexec (new_name, old_name, new_end_of_text, dummy1, dummy2)
-     char new_name[];          /* name of the new a.out file to be created */
-     char old_name[];          /* name of the old a.out file */
-     char *new_end_of_text;    /* ptr to new edata/etext; NOT USED YET */
-     int dummy1, dummy2;       /* not used by emacs */
+int
+unexec (const char *new_name,      /* name of the new a.out file to be created 
*/
+       const char *old_name)       /* name of the old a.out file */
 {
   int old, new;
   int old_size, new_size;

=== modified file 'src/unexmacosx.c'
--- a/src/unexmacosx.c  2010-08-11 08:36:27 +0000
+++ b/src/unexmacosx.c  2010-10-03 13:59:56 +0000
@@ -190,6 +190,8 @@
 
 static struct segment_command *data_segment_scp;
 
+static void unexec_error (const char *format, ...) NO_RETURN;
+
 /* Read N bytes from infd into memory starting at address DEST.
    Return true if successful, false otherwise.  */
 static int
@@ -1217,9 +1219,8 @@
    from it.  The file names of the output and input files are outfile
    and infile, respectively.  The three other parameters are
    ignored.  */
-void
-unexec (char *outfile, char *infile, void *start_data, void *start_bss,
-        void *entry_address)
+int
+unexec (const char *outfile, const char *infile)
 {
   if (in_dumped_exec)
     unexec_error ("Unexec from a dumped executable is not supported.");
@@ -1249,6 +1250,7 @@
   dump_it ();
 
   close (outfd);
+  return 0;
 }
 
 

=== modified file 'src/unexsol.c'
--- a/src/unexsol.c     2010-10-01 13:56:33 +0000
+++ b/src/unexsol.c     2010-10-03 13:59:56 +0000
@@ -10,8 +10,7 @@
 #include "coding.h"
 
 int
-unexec (char *new_name, char *old_name, unsigned int data_start,
-        unsigned int bss_start, unsigned int entry_address)
+unexec (const char *new_name, const char *old_name)
 {
   Lisp_Object data;
   Lisp_Object errstring;

=== modified file 'src/unexw32.c'
--- a/src/unexw32.c     2010-01-13 08:35:10 +0000
+++ b/src/unexw32.c     2010-10-03 13:59:56 +0000
@@ -724,9 +724,8 @@
 
 
 /* Dump out .data and .bss sections into a new executable.  */
-void
-unexec (char *new_name, char *old_name, void *start_data, void *start_bss,
-       void *entry_address)
+int
+unexec (const char *new_name, const char *old_name)
 {
   file_data in_file, out_file;
   char out_filename[MAX_PATH], in_filename[MAX_PATH];
@@ -821,6 +820,8 @@
 
   close_file_data (&in_file);
   close_file_data (&out_file);
+
+  return 0;
 }
 
 /* eof */


reply via email to

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