X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Funexalpha.c;h=b8705f91deb915a07b3bf768182914dd48d619eb;hb=57bf633187a745973c8f0e0220e3aad79a83462f;hp=9200f162edd51df2c8c8fb8ec9fcc8b75208ef4b;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/src/unexalpha.c b/src/unexalpha.c index 9200f16..b8705f9 100644 --- a/src/unexalpha.c +++ b/src/unexalpha.c @@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ #include #include #include +#include #include #include #include @@ -54,11 +55,6 @@ static void mark_x (char *); if (lseek (_fd, _position, L_SET) != _position) \ fatal_unexec (_error_message, _error_arg); -extern int errno; -extern char *strerror (); - -void *sbrk(); - #define EEOF -1 static struct scnhdr *text_section; @@ -85,16 +81,19 @@ struct headers { }; - /* Define name of label for entry point for the dumped executable. */ #ifndef DEFAULT_ENTRY_ADDRESS #define DEFAULT_ENTRY_ADDRESS __start #endif +EXTERN_C int DEFAULT_ENTRY_ADDRESS (void); + -unexec (new_name, a_name, data_start, bss_start, entry_address) - char *new_name, *a_name; - unsigned long data_start, bss_start, entry_address; +int +unexec (char *new_name, char *a_name, + unsigned long data_start, + unsigned long bss_start, + unsigned long entry_address) { int new, old; char * oldptr; @@ -102,7 +101,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) struct stat stat; long pagesize, brk; long newsyms, symrel; - int nread; int i; long vaddr, scnptr; #define BUFSIZE 8192 @@ -209,7 +207,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) nhdr.aout.bsize = 0; if (entry_address == 0) { - extern DEFAULT_ENTRY_ADDRESS (); nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS; } else @@ -365,15 +362,15 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) */ - -update_dynamic_symbols (old, new_name, new, newsyms, nsyms, symoff, stroff) - char *old; /* Pointer to old executable */ - char *new_name; /* Name of new executable */ - int new; /* File descriptor for new executable */ - long newsyms; /* Offset of Symbol table in new executable */ - int nsyms; /* Number of symbol table entries */ - long symoff; /* Offset of External Symbols in old file */ - long stroff; /* Offset of string table in old file */ +int +update_dynamic_symbols ( + char *old, /* Pointer to old executable */ + char *new_name, /* Name of new executable */ + int new, /* File descriptor for new executable */ + long newsyms, /* Offset of Symbol table in new executable */ + int nsyms, /* Number of symbol table entries */ + long symoff, /* Offset of External Symbols in old file */ + long stroff) /* Offset of string table in old file */ { long i; int found = 0;