summaryrefslogtreecommitdiff
path: root/src/unexaix.c
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2010-10-03 06:59:56 -0700
committerDan Nicolaescu <dann@ics.uci.edu>2010-10-03 06:59:56 -0700
commit408ad5526aa0422e681b7817b4a2a5afbadd2a35 (patch)
tree4061cfa5d9e2ae7dd675cc54a6be545a46600e87 /src/unexaix.c
parent2dc73f4cbbae9ea81e0803386f1d353768c6fc93 (diff)
downloademacs-408ad5526aa0422e681b7817b4a2a5afbadd2a35.tar.gz
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.
Diffstat (limited to 'src/unexaix.c')
-rw-r--r--src/unexaix.c45
1 files changed, 7 insertions, 38 deletions
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! */
* Mike Sperber <sperber@informatik.uni-tuebingen.de>
*
* 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 @@ static void write_segment (int, char *, char *);
*
* 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 @@ int unexec (char *new_name, char *a_name,
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 @@ int unexec (char *new_name, char *a_name,
*/
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 @@ make_hdr (int new, int a_out,
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 @@ make_hdr (int new, int a_out,
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;