diff options
| author | Dan Nicolaescu | 2010-10-03 06:59:56 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-10-03 06:59:56 -0700 |
| commit | dd5ecd6bb5778143554b5f82cd05bab3234bc5e8 (patch) | |
| tree | 9238f45cacb7ecca7515d1161ef9ef7a6aa7f03a | |
| parent | e1b69165cca0ba5012a54c249589d544247217c3 (diff) | |
| download | emacs-dd5ecd6bb5778143554b5f82cd05bab3234bc5e8.tar.gz emacs-dd5ecd6bb5778143554b5f82cd05bab3234bc5e8.zip | |
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.
| -rw-r--r-- | src/ChangeLog | 24 | ||||
| -rw-r--r-- | src/emacs.c | 11 | ||||
| -rw-r--r-- | src/unexaix.c | 45 | ||||
| -rw-r--r-- | src/unexcoff.c | 59 | ||||
| -rw-r--r-- | src/unexcw.c | 3 | ||||
| -rw-r--r-- | src/unexelf.c | 28 | ||||
| -rw-r--r-- | src/unexhp9k800.c | 9 | ||||
| -rw-r--r-- | src/unexmacosx.c | 8 | ||||
| -rw-r--r-- | src/unexsol.c | 3 | ||||
| -rw-r--r-- | src/unexw32.c | 7 |
10 files changed, 65 insertions, 132 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 70ed07cb24e..2e1864b270e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2010-10-03 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Remove unused arguments for unexec. | ||
| 4 | The third one is never used, and the last two are always passed as zero. | ||
| 5 | * emacs.c (unexec): Add declaration. | ||
| 6 | (Fdump_emacs): Only pass the first two arguments to unexec. | ||
| 7 | Simplify #ifdef. | ||
| 8 | * unexw32.c (unexec): | ||
| 9 | * unexsol.c (unexec): | ||
| 10 | * unexhp9k800.c (unexec): | ||
| 11 | * unexcw.c (unexec): Remove the last 3 arguments, unused. | ||
| 12 | * unexelf.c (unexec): Remove the last 3 arguments, unused. | ||
| 13 | (find_section): Use const. | ||
| 14 | * unexmacosx.c (unexec): Remove the last 3 arguments, unused. | ||
| 15 | (unexec_error): Declare it NO_RETURN. | ||
| 16 | * unexcoff.c (make_hdr): Assume bss_start is always zero, remove | ||
| 17 | it as an argument, remove data_start and entry_address arguments, unused. | ||
| 18 | (unexec): Remove bss_start, data_start and | ||
| 19 | entry_address arguments. | ||
| 20 | * unexaix.c (make_hdr): Assume bss_start is always zero, remove | ||
| 21 | it as an argument, remove data_start and entry_address arguments, unused. | ||
| 22 | (unexec): Remove bss_start, data_start and | ||
| 23 | entry_address arguments. | ||
| 24 | |||
| 1 | 2010-10-03 Juanma Barranquero <lekktu@gmail.com> | 25 | 2010-10-03 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 26 | ||
| 3 | * makefile.w32-in (TAGS, TAGS-LISP, TAGS-gmake): Add $(FONTOBJ). | 27 | * makefile.w32-in (TAGS, TAGS-LISP, TAGS-gmake): Add $(FONTOBJ). |
diff --git a/src/emacs.c b/src/emacs.c index 41f091bd656..95e2f0c0d37 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2118,6 +2118,10 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) | |||
| 2118 | 2118 | ||
| 2119 | #ifndef CANNOT_DUMP | 2119 | #ifndef CANNOT_DUMP |
| 2120 | 2120 | ||
| 2121 | /* FIXME: maybe this should go into header file, config.h seems the | ||
| 2122 | only one appropriate. */ | ||
| 2123 | extern int unexec (const char *, const char *); | ||
| 2124 | |||
| 2121 | DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, | 2125 | DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, |
| 2122 | doc: /* Dump current state of Emacs into executable file FILENAME. | 2126 | doc: /* Dump current state of Emacs into executable file FILENAME. |
| 2123 | Take symbols from SYMFILE (presumably the file you executed to run Emacs). | 2127 | Take symbols from SYMFILE (presumably the file you executed to run Emacs). |
| @@ -2185,13 +2189,13 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2185 | Meanwhile, my_edata is not valid on Windows. */ | 2189 | Meanwhile, my_edata is not valid on Windows. */ |
| 2186 | memory_warnings (my_edata, malloc_warning); | 2190 | memory_warnings (my_edata, malloc_warning); |
| 2187 | #endif /* not WINDOWSNT */ | 2191 | #endif /* not WINDOWSNT */ |
| 2188 | #endif | 2192 | #if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT |
| 2189 | #if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT | ||
| 2190 | /* Pthread may call malloc before main, and then we will get an endless | 2193 | /* Pthread may call malloc before main, and then we will get an endless |
| 2191 | loop, because pthread_self (see alloc.c) calls malloc the first time | 2194 | loop, because pthread_self (see alloc.c) calls malloc the first time |
| 2192 | it is called on some systems. */ | 2195 | it is called on some systems. */ |
| 2193 | reset_malloc_hooks (); | 2196 | reset_malloc_hooks (); |
| 2194 | #endif | 2197 | #endif |
| 2198 | #endif /* not SYSTEM_MALLOC */ | ||
| 2195 | #ifdef DOUG_LEA_MALLOC | 2199 | #ifdef DOUG_LEA_MALLOC |
| 2196 | malloc_state_ptr = malloc_get_state (); | 2200 | malloc_state_ptr = malloc_get_state (); |
| 2197 | #endif | 2201 | #endif |
| @@ -2199,8 +2203,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2199 | #ifdef USE_MMAP_FOR_BUFFERS | 2203 | #ifdef USE_MMAP_FOR_BUFFERS |
| 2200 | mmap_set_vars (0); | 2204 | mmap_set_vars (0); |
| 2201 | #endif | 2205 | #endif |
| 2202 | unexec (SDATA (filename), | 2206 | unexec (SDATA (filename), !NILP (symfile) ? SDATA (symfile) : 0); |
| 2203 | !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0); | ||
| 2204 | #ifdef USE_MMAP_FOR_BUFFERS | 2207 | #ifdef USE_MMAP_FOR_BUFFERS |
| 2205 | mmap_set_vars (1); | 2208 | mmap_set_vars (1); |
| 2206 | #endif | 2209 | #endif |
diff --git a/src/unexaix.c b/src/unexaix.c index 949616d5e31..8365396b498 100644 --- a/src/unexaix.c +++ b/src/unexaix.c | |||
| @@ -31,24 +31,13 @@ what you give them. Help stamp out software-hoarding! */ | |||
| 31 | * Mike Sperber <sperber@informatik.uni-tuebingen.de> | 31 | * Mike Sperber <sperber@informatik.uni-tuebingen.de> |
| 32 | * | 32 | * |
| 33 | * Synopsis: | 33 | * Synopsis: |
| 34 | * unexec (new_name, a_name, data_start, bss_start, entry_address) | 34 | * unexec (const char *new_name, const *old_name); |
| 35 | * char *new_name, *a_name; | ||
| 36 | * unsigned data_start, bss_start, entry_address; | ||
| 37 | * | 35 | * |
| 38 | * Takes a snapshot of the program and makes an a.out format file in the | 36 | * Takes a snapshot of the program and makes an a.out format file in the |
| 39 | * file named by the string argument new_name. | 37 | * file named by the string argument new_name. |
| 40 | * If a_name is non-NULL, the symbol table will be taken from the given file. | 38 | * If a_name is non-NULL, the symbol table will be taken from the given file. |
| 41 | * On some machines, an existing a_name file is required. | 39 | * On some machines, an existing a_name file is required. |
| 42 | * | 40 | * |
| 43 | * data_start and entry_address are ignored. | ||
| 44 | * | ||
| 45 | * bss_start indicates how much of the data segment is to be saved in the | ||
| 46 | * a.out file and restored when the program is executed. It gives the lowest | ||
| 47 | * unsaved address, and is rounded up to a page boundary. The default when 0 | ||
| 48 | * is given assumes that the entire data segment is to be stored, including | ||
| 49 | * the previous data and bss as well as any additional storage allocated with | ||
| 50 | * sbrk(2). | ||
| 51 | * | ||
| 52 | */ | 41 | */ |
| 53 | 42 | ||
| 54 | #ifndef emacs | 43 | #ifndef emacs |
| @@ -143,10 +132,7 @@ static void write_segment (int, char *, char *); | |||
| 143 | * | 132 | * |
| 144 | * driving logic. | 133 | * driving logic. |
| 145 | */ | 134 | */ |
| 146 | int unexec (char *new_name, char *a_name, | 135 | int unexec (const char *new_name, const char *a_name) |
| 147 | unsigned data_start, | ||
| 148 | unsigned bss_start, | ||
| 149 | unsigned entry_address) | ||
| 150 | { | 136 | { |
| 151 | int new = -1, a_out = -1; | 137 | int new = -1, a_out = -1; |
| 152 | 138 | ||
| @@ -159,8 +145,6 @@ int unexec (char *new_name, char *a_name, | |||
| 159 | PERROR (new_name); | 145 | PERROR (new_name); |
| 160 | } | 146 | } |
| 161 | if (make_hdr (new, a_out, | 147 | if (make_hdr (new, a_out, |
| 162 | data_start, bss_start, | ||
| 163 | entry_address, | ||
| 164 | a_name, new_name) < 0 | 148 | a_name, new_name) < 0 |
| 165 | || copy_text_and_data (new) < 0 | 149 | || copy_text_and_data (new) < 0 |
| 166 | || copy_sym (new, a_out, a_name, new_name) < 0 | 150 | || copy_sym (new, a_out, a_name, new_name) < 0 |
| @@ -186,12 +170,11 @@ int unexec (char *new_name, char *a_name, | |||
| 186 | */ | 170 | */ |
| 187 | static int | 171 | static int |
| 188 | make_hdr (int new, int a_out, | 172 | make_hdr (int new, int a_out, |
| 189 | unsigned data_start, unsigned bss_start, | ||
| 190 | unsigned entry_address, | ||
| 191 | char *a_name, char *new_name) | 173 | char *a_name, char *new_name) |
| 192 | { | 174 | { |
| 193 | int scns; | 175 | int scns; |
| 194 | unsigned int bss_end; | 176 | unsigned int bss_start; |
| 177 | unsigned int data_start; | ||
| 195 | 178 | ||
| 196 | struct scnhdr section[MAX_SECTIONS]; | 179 | struct scnhdr section[MAX_SECTIONS]; |
| 197 | struct scnhdr * f_thdr; /* Text section header */ | 180 | struct scnhdr * f_thdr; /* Text section header */ |
| @@ -211,22 +194,8 @@ make_hdr (int new, int a_out, | |||
| 211 | 194 | ||
| 212 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ | 195 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ |
| 213 | 196 | ||
| 214 | bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; | 197 | bss_start = ADDR_CORRECT (sbrk (0)) + pagemask; |
| 215 | bss_end &= ~ pagemask; | 198 | bss_start &= ~ pagemask; |
| 216 | /* Adjust data/bss boundary. */ | ||
| 217 | if (bss_start != 0) | ||
| 218 | { | ||
| 219 | bss_start = (ADDR_CORRECT (bss_start) + pagemask); | ||
| 220 | /* (Up) to page bdry. */ | ||
| 221 | bss_start &= ~ pagemask; | ||
| 222 | if (bss_start > bss_end) | ||
| 223 | { | ||
| 224 | ERROR1 ("unexec: Specified bss_start (%u) is past end of program", | ||
| 225 | bss_start); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | else | ||
| 229 | bss_start = bss_end; | ||
| 230 | 199 | ||
| 231 | if (data_start > bss_start) /* Can't have negative data size. */ | 200 | if (data_start > bss_start) /* Can't have negative data size. */ |
| 232 | { | 201 | { |
| @@ -311,7 +280,7 @@ make_hdr (int new, int a_out, | |||
| 311 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); | 280 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); |
| 312 | 281 | ||
| 313 | f_ohdr.dsize = bss_start - f_ohdr.data_start; | 282 | f_ohdr.dsize = bss_start - f_ohdr.data_start; |
| 314 | f_ohdr.bsize = bss_end - bss_start; | 283 | f_ohdr.bsize = 0; |
| 315 | 284 | ||
| 316 | f_dhdr->s_size = f_ohdr.dsize; | 285 | f_dhdr->s_size = f_ohdr.dsize; |
| 317 | f_bhdr->s_size = f_ohdr.bsize; | 286 | f_bhdr->s_size = f_ohdr.bsize; |
diff --git a/src/unexcoff.c b/src/unexcoff.c index cb4b8d603b5..428382e4a3d 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c | |||
| @@ -34,37 +34,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | * Modified heavily since then. | 34 | * Modified heavily since then. |
| 35 | * | 35 | * |
| 36 | * Synopsis: | 36 | * Synopsis: |
| 37 | * unexec (new_name, a_name, data_start, bss_start, entry_address) | 37 | * unexec (const char *new_name, const char *old_name); |
| 38 | * char *new_name, *a_name; | ||
| 39 | * unsigned data_start, bss_start, entry_address; | ||
| 40 | * | 38 | * |
| 41 | * Takes a snapshot of the program and makes an a.out format file in the | 39 | * Takes a snapshot of the program and makes an a.out format file in the |
| 42 | * file named by the string argument new_name. | 40 | * file named by the string argument new_name. |
| 43 | * If a_name is non-NULL, the symbol table will be taken from the given file. | 41 | * If a_name is non-NULL, the symbol table will be taken from the given file. |
| 44 | * On some machines, an existing a_name file is required. | 42 | * On some machines, an existing a_name file is required. |
| 45 | * | 43 | * |
| 46 | * The boundaries within the a.out file may be adjusted with the data_start | ||
| 47 | * and bss_start arguments. Either or both may be given as 0 for defaults. | ||
| 48 | * | ||
| 49 | * Data_start gives the boundary between the text segment and the data | ||
| 50 | * segment of the program. The text segment can contain shared, read-only | ||
| 51 | * program code and literal data, while the data segment is always unshared | ||
| 52 | * and unprotected. Data_start gives the lowest unprotected address. | ||
| 53 | * The value you specify may be rounded down to a suitable boundary | ||
| 54 | * as required by the machine you are using. | ||
| 55 | * | ||
| 56 | * Specifying zero for data_start means the boundary between text and data | ||
| 57 | * should not be the same as when the program was loaded. | ||
| 58 | * | ||
| 59 | * Bss_start indicates how much of the data segment is to be saved in the | ||
| 60 | * a.out file and restored when the program is executed. It gives the lowest | ||
| 61 | * unsaved address, and is rounded up to a page boundary. The default when 0 | ||
| 62 | * is given assumes that the entire data segment is to be stored, including | ||
| 63 | * the previous data and bss as well as any additional storage allocated with | ||
| 64 | * break (2). | ||
| 65 | * | ||
| 66 | * The new file is set up to start at entry_address. | ||
| 67 | * | ||
| 68 | * If you make improvements I'd like to get them too. | 44 | * If you make improvements I'd like to get them too. |
| 69 | * harpo!utah-cs!thomas, thomas@Utah-20 | 45 | * harpo!utah-cs!thomas, thomas@Utah-20 |
| 70 | * | 46 | * |
| @@ -186,15 +162,16 @@ static void mark_x (const char *); | |||
| 186 | * Modify the text and data sizes. | 162 | * Modify the text and data sizes. |
| 187 | */ | 163 | */ |
| 188 | static int | 164 | static int |
| 189 | make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, | 165 | make_hdr (int new, int a_out, |
| 190 | unsigned entry_address, const char *a_name, const char *new_name) | 166 | const char *a_name, const char *new_name) |
| 191 | { | 167 | { |
| 192 | auto struct scnhdr f_thdr; /* Text section header */ | 168 | auto struct scnhdr f_thdr; /* Text section header */ |
| 193 | auto struct scnhdr f_dhdr; /* Data section header */ | 169 | auto struct scnhdr f_dhdr; /* Data section header */ |
| 194 | auto struct scnhdr f_bhdr; /* Bss section header */ | 170 | auto struct scnhdr f_bhdr; /* Bss section header */ |
| 195 | auto struct scnhdr scntemp; /* Temporary section header */ | 171 | auto struct scnhdr scntemp; /* Temporary section header */ |
| 196 | register int scns; | 172 | register int scns; |
| 197 | unsigned int bss_end; | 173 | unsigned int bss_start; |
| 174 | unsigned int data_start; | ||
| 198 | 175 | ||
| 199 | pagemask = getpagesize () - 1; | 176 | pagemask = getpagesize () - 1; |
| 200 | 177 | ||
| @@ -203,23 +180,8 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, | |||
| 203 | data_start = ADDR_CORRECT (data_start); | 180 | data_start = ADDR_CORRECT (data_start); |
| 204 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ | 181 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ |
| 205 | 182 | ||
| 206 | bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; | 183 | bss_start = ADDR_CORRECT (sbrk (0)) + pagemask; |
| 207 | bss_end &= ~ pagemask; | 184 | bss_start &= ~ pagemask; |
| 208 | |||
| 209 | /* Adjust data/bss boundary. */ | ||
| 210 | if (bss_start != 0) | ||
| 211 | { | ||
| 212 | bss_start = (ADDR_CORRECT (bss_start) + pagemask); | ||
| 213 | /* (Up) to page bdry. */ | ||
| 214 | bss_start &= ~ pagemask; | ||
| 215 | if (bss_start > bss_end) | ||
| 216 | { | ||
| 217 | ERROR1 ("unexec: Specified bss_start (%u) is past end of program", | ||
| 218 | bss_start); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | else | ||
| 222 | bss_start = bss_end; | ||
| 223 | 185 | ||
| 224 | if (data_start > bss_start) /* Can't have negative data size. */ | 186 | if (data_start > bss_start) /* Can't have negative data size. */ |
| 225 | { | 187 | { |
| @@ -300,7 +262,7 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, | |||
| 300 | 262 | ||
| 301 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); | 263 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); |
| 302 | f_ohdr.dsize = bss_start - f_ohdr.data_start; | 264 | f_ohdr.dsize = bss_start - f_ohdr.data_start; |
| 303 | f_ohdr.bsize = bss_end - bss_start; | 265 | f_ohdr.bsize = 0; |
| 304 | f_thdr.s_size = f_ohdr.tsize; | 266 | f_thdr.s_size = f_ohdr.tsize; |
| 305 | f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); | 267 | f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); |
| 306 | f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); | 268 | f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); |
| @@ -571,8 +533,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) | |||
| 571 | * driving logic. | 533 | * driving logic. |
| 572 | */ | 534 | */ |
| 573 | int | 535 | int |
| 574 | unexec (const char *new_name, const char *a_name, | 536 | unexec (const char *new_name, const char *a_name) |
| 575 | unsigned data_start, unsigned bss_start, unsigned entry_address) | ||
| 576 | { | 537 | { |
| 577 | int new = -1, a_out = -1; | 538 | int new = -1, a_out = -1; |
| 578 | 539 | ||
| @@ -585,7 +546,7 @@ unexec (const char *new_name, const char *a_name, | |||
| 585 | PERROR (new_name); | 546 | PERROR (new_name); |
| 586 | } | 547 | } |
| 587 | 548 | ||
| 588 | if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) < 0 | 549 | if (make_hdr (new, a_out, a_name, new_name) < 0 |
| 589 | || copy_text_and_data (new, a_out) < 0 | 550 | || copy_text_and_data (new, a_out) < 0 |
| 590 | || copy_sym (new, a_out, a_name, new_name) < 0 | 551 | || copy_sym (new, a_out, a_name, new_name) < 0 |
| 591 | || adjust_lnnoptrs (new, a_out, new_name) < 0 | 552 | || adjust_lnnoptrs (new, a_out, new_name) < 0 |
diff --git a/src/unexcw.c b/src/unexcw.c index 4930eb46315..c33d9d90215 100644 --- a/src/unexcw.c +++ b/src/unexcw.c | |||
| @@ -248,8 +248,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified) | |||
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | int | 250 | int |
| 251 | unexec (char *outfile, char *infile, unsigned start_data, unsigned d1, | 251 | unexec (const char *outfile, const char *infile) |
| 252 | unsigned d2) | ||
| 253 | { | 252 | { |
| 254 | char infile_buffer[FILENAME_MAX]; | 253 | char infile_buffer[FILENAME_MAX]; |
| 255 | char outfile_buffer[FILENAME_MAX]; | 254 | char outfile_buffer[FILENAME_MAX]; |
diff --git a/src/unexelf.c b/src/unexelf.c index 0de69a4cabc..e4d26b310ff 100644 --- a/src/unexelf.c +++ b/src/unexelf.c | |||
| @@ -33,34 +33,13 @@ what you give them. Help stamp out software-hoarding! */ | |||
| 33 | * Modified heavily since then. | 33 | * Modified heavily since then. |
| 34 | * | 34 | * |
| 35 | * Synopsis: | 35 | * Synopsis: |
| 36 | * unexec (new_name, old_name, data_start, bss_start, entry_address) | 36 | * unexec (const char *new_name, const char *old_name); |
| 37 | * char *new_name, *old_name; | ||
| 38 | * unsigned data_start, bss_start, entry_address; | ||
| 39 | * | 37 | * |
| 40 | * Takes a snapshot of the program and makes an a.out format file in the | 38 | * Takes a snapshot of the program and makes an a.out format file in the |
| 41 | * file named by the string argument new_name. | 39 | * file named by the string argument new_name. |
| 42 | * If old_name is non-NULL, the symbol table will be taken from the given file. | 40 | * If old_name is non-NULL, the symbol table will be taken from the given file. |
| 43 | * On some machines, an existing old_name file is required. | 41 | * On some machines, an existing old_name file is required. |
| 44 | * | 42 | * |
| 45 | * The boundaries within the a.out file may be adjusted with the data_start | ||
| 46 | * and bss_start arguments. Either or both may be given as 0 for defaults. | ||
| 47 | * | ||
| 48 | * Data_start gives the boundary between the text segment and the data | ||
| 49 | * segment of the program. The text segment can contain shared, read-only | ||
| 50 | * program code and literal data, while the data segment is always unshared | ||
| 51 | * and unprotected. Data_start gives the lowest unprotected address. | ||
| 52 | * The value you specify may be rounded down to a suitable boundary | ||
| 53 | * as required by the machine you are using. | ||
| 54 | * | ||
| 55 | * Bss_start indicates how much of the data segment is to be saved in the | ||
| 56 | * a.out file and restored when the program is executed. It gives the lowest | ||
| 57 | * unsaved address, and is rounded up to a page boundary. The default when 0 | ||
| 58 | * is given assumes that the entire data segment is to be stored, including | ||
| 59 | * the previous data and bss as well as any additional storage allocated with | ||
| 60 | * break (2). | ||
| 61 | * | ||
| 62 | * The new file is set up to start at entry_address. | ||
| 63 | * | ||
| 64 | */ | 43 | */ |
| 65 | 44 | ||
| 66 | /* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co. | 45 | /* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co. |
| @@ -610,7 +589,7 @@ round_up (ElfW(Addr) x, ElfW(Addr) y) | |||
| 610 | if NOERROR is 0; we return -1 if NOERROR is nonzero. */ | 589 | if NOERROR is 0; we return -1 if NOERROR is nonzero. */ |
| 611 | 590 | ||
| 612 | static int | 591 | static int |
| 613 | find_section (const char *name, char *section_names, char *file_name, | 592 | find_section (const char *name, const char *section_names, const char *file_name, |
| 614 | ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror) | 593 | ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror) |
| 615 | { | 594 | { |
| 616 | int idx; | 595 | int idx; |
| @@ -646,8 +625,7 @@ find_section (const char *name, char *section_names, char *file_name, | |||
| 646 | * | 625 | * |
| 647 | */ | 626 | */ |
| 648 | void | 627 | void |
| 649 | unexec (char *new_name, char *old_name, unsigned int data_start, | 628 | unexec (const char *new_name, const char *old_name) |
| 650 | unsigned int bss_start, unsigned int entry_address) | ||
| 651 | { | 629 | { |
| 652 | int new_file, old_file, new_file_size; | 630 | int new_file, old_file, new_file_size; |
| 653 | 631 | ||
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index cad2a5025ab..b410092b1cc 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c | |||
| @@ -79,12 +79,9 @@ run_time_remap (ignored) | |||
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | /* Create a new a.out file, same as old but with current data space */ | 81 | /* Create a new a.out file, same as old but with current data space */ |
| 82 | 82 | int | |
| 83 | unexec (new_name, old_name, new_end_of_text, dummy1, dummy2) | 83 | unexec (const char *new_name, /* name of the new a.out file to be created */ |
| 84 | char new_name[]; /* name of the new a.out file to be created */ | 84 | const char *old_name) /* name of the old a.out file */ |
| 85 | char old_name[]; /* name of the old a.out file */ | ||
| 86 | char *new_end_of_text; /* ptr to new edata/etext; NOT USED YET */ | ||
| 87 | int dummy1, dummy2; /* not used by emacs */ | ||
| 88 | { | 85 | { |
| 89 | int old, new; | 86 | int old, new; |
| 90 | int old_size, new_size; | 87 | int old_size, new_size; |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 5c450e062c6..f48c8d7dfa6 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -190,6 +190,8 @@ static off_t data_segment_old_fileoff = 0; | |||
| 190 | 190 | ||
| 191 | static struct segment_command *data_segment_scp; | 191 | static struct segment_command *data_segment_scp; |
| 192 | 192 | ||
| 193 | static void unexec_error (const char *format, ...) NO_RETURN; | ||
| 194 | |||
| 193 | /* Read N bytes from infd into memory starting at address DEST. | 195 | /* Read N bytes from infd into memory starting at address DEST. |
| 194 | Return true if successful, false otherwise. */ | 196 | Return true if successful, false otherwise. */ |
| 195 | static int | 197 | static int |
| @@ -1217,9 +1219,8 @@ dump_it (void) | |||
| 1217 | from it. The file names of the output and input files are outfile | 1219 | from it. The file names of the output and input files are outfile |
| 1218 | and infile, respectively. The three other parameters are | 1220 | and infile, respectively. The three other parameters are |
| 1219 | ignored. */ | 1221 | ignored. */ |
| 1220 | void | 1222 | int |
| 1221 | unexec (char *outfile, char *infile, void *start_data, void *start_bss, | 1223 | unexec (const char *outfile, const char *infile) |
| 1222 | void *entry_address) | ||
| 1223 | { | 1224 | { |
| 1224 | if (in_dumped_exec) | 1225 | if (in_dumped_exec) |
| 1225 | unexec_error ("Unexec from a dumped executable is not supported."); | 1226 | unexec_error ("Unexec from a dumped executable is not supported."); |
| @@ -1249,6 +1250,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss, | |||
| 1249 | dump_it (); | 1250 | dump_it (); |
| 1250 | 1251 | ||
| 1251 | close (outfd); | 1252 | close (outfd); |
| 1253 | return 0; | ||
| 1252 | } | 1254 | } |
| 1253 | 1255 | ||
| 1254 | 1256 | ||
diff --git a/src/unexsol.c b/src/unexsol.c index da4865d8ca8..1d58ed46d4b 100644 --- a/src/unexsol.c +++ b/src/unexsol.c | |||
| @@ -10,8 +10,7 @@ | |||
| 10 | #include "coding.h" | 10 | #include "coding.h" |
| 11 | 11 | ||
| 12 | int | 12 | int |
| 13 | unexec (char *new_name, char *old_name, unsigned int data_start, | 13 | unexec (const char *new_name, const char *old_name) |
| 14 | unsigned int bss_start, unsigned int entry_address) | ||
| 15 | { | 14 | { |
| 16 | Lisp_Object data; | 15 | Lisp_Object data; |
| 17 | Lisp_Object errstring; | 16 | Lisp_Object errstring; |
diff --git a/src/unexw32.c b/src/unexw32.c index d3e4e812480..a4dba647f53 100644 --- a/src/unexw32.c +++ b/src/unexw32.c | |||
| @@ -724,9 +724,8 @@ copy_executable_and_dump_data (file_data *p_infile, | |||
| 724 | 724 | ||
| 725 | 725 | ||
| 726 | /* Dump out .data and .bss sections into a new executable. */ | 726 | /* Dump out .data and .bss sections into a new executable. */ |
| 727 | void | 727 | int |
| 728 | unexec (char *new_name, char *old_name, void *start_data, void *start_bss, | 728 | unexec (const char *new_name, const char *old_name) |
| 729 | void *entry_address) | ||
| 730 | { | 729 | { |
| 731 | file_data in_file, out_file; | 730 | file_data in_file, out_file; |
| 732 | char out_filename[MAX_PATH], in_filename[MAX_PATH]; | 731 | char out_filename[MAX_PATH], in_filename[MAX_PATH]; |
| @@ -821,6 +820,8 @@ unexec (char *new_name, char *old_name, void *start_data, void *start_bss, | |||
| 821 | 820 | ||
| 822 | close_file_data (&in_file); | 821 | close_file_data (&in_file); |
| 823 | close_file_data (&out_file); | 822 | close_file_data (&out_file); |
| 823 | |||
| 824 | return 0; | ||
| 824 | } | 825 | } |
| 825 | 826 | ||
| 826 | /* eof */ | 827 | /* eof */ |