187 |
#define start_of_text() ( (char *) 0 ) |
#define start_of_text() ( (char *) 0 ) |
188 |
extern char etext; |
extern char etext; |
189 |
|
|
190 |
static int make_hdr (), copy_text_and_data (), copy_sym (); |
static int make_hdr (int new, int a_out, unsigned int data_start, unsigned int bss_start, unsigned int entry_address, char *a_name, char *new_name), copy_text_and_data (int new, int a_out), copy_sym (int new, int a_out, char *a_name, char *new_name); |
191 |
static int mark_x (); |
static int mark_x (char *name); |
192 |
|
|
193 |
#ifdef COFF |
#ifdef COFF |
194 |
#ifndef USG |
#ifndef USG |
239 |
|
|
240 |
#else /* not HPUX */ |
#else /* not HPUX */ |
241 |
|
|
242 |
extern char *sbrk (); |
extern char *sbrk (int n); |
243 |
|
|
244 |
#if defined (USG) && !defined (IBMRTAIX) && !defined (IRIS) && !defined(linux) |
#if defined (USG) && !defined (IBMRTAIX) && !defined (IRIS) && !defined(linux) |
245 |
static struct bhdr hdr, ohdr; |
static struct bhdr hdr, ohdr; |
294 |
#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 |
#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 |
295 |
|
|
296 |
static |
static |
297 |
report_error_1 (fd, msg, a1, a2) |
report_error_1 (int fd, char *msg, int a1, int a2) |
|
int fd; |
|
|
char *msg; |
|
|
int a1, a2; |
|
298 |
{ |
{ |
299 |
close (fd); |
close (fd); |
300 |
#ifdef emacs |
#ifdef emacs |
310 |
* |
* |
311 |
* driving logic. |
* driving logic. |
312 |
*/ |
*/ |
313 |
unexec (new_name, a_name, data_start, bss_start, entry_address) |
unexec (char *new_name, char *a_name, unsigned int data_start, unsigned int bss_start, unsigned int entry_address) |
|
char *new_name, *a_name; |
|
|
unsigned data_start, bss_start, entry_address; |
|
314 |
{ |
{ |
315 |
int new, a_out = -1; |
int new, a_out = -1; |
316 |
|
|
349 |
* Modify the text and data sizes. |
* Modify the text and data sizes. |
350 |
*/ |
*/ |
351 |
static int |
static int |
352 |
make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) |
make_hdr (int new, int a_out, unsigned int data_start, unsigned int bss_start, unsigned int entry_address, char *a_name, char *new_name) |
|
int new, a_out; |
|
|
unsigned data_start, bss_start, entry_address; |
|
|
char *a_name; |
|
|
char *new_name; |
|
353 |
{ |
{ |
354 |
int tem; |
int tem; |
355 |
#ifdef COFF |
#ifdef COFF |
677 |
* Copy the text and data segments from memory to the new a.out |
* Copy the text and data segments from memory to the new a.out |
678 |
*/ |
*/ |
679 |
static int |
static int |
680 |
copy_text_and_data (new, a_out) |
copy_text_and_data (int new, int a_out) |
|
int new, a_out; |
|
681 |
{ |
{ |
682 |
register char *end; |
register char *end; |
683 |
register char *ptr; |
register char *ptr; |
794 |
return 0; |
return 0; |
795 |
} |
} |
796 |
|
|
797 |
write_segment (new, ptr, end) |
write_segment (int new, register char *ptr, register char *end) |
|
int new; |
|
|
register char *ptr, *end; |
|
798 |
{ |
{ |
799 |
register int i, nwrite, ret; |
register int i, nwrite, ret; |
800 |
char buf[80]; |
char buf[80]; |
834 |
* Copy the relocation information and symbol table from the a.out to the new |
* Copy the relocation information and symbol table from the a.out to the new |
835 |
*/ |
*/ |
836 |
static int |
static int |
837 |
copy_sym (new, a_out, a_name, new_name) |
copy_sym (int new, int a_out, char *a_name, char *new_name) |
|
int new, a_out; |
|
|
char *a_name, *new_name; |
|
838 |
{ |
{ |
839 |
char page[1024]; |
char page[1024]; |
840 |
int n; |
int n; |
874 |
* After succesfully building the new a.out, mark it executable |
* After succesfully building the new a.out, mark it executable |
875 |
*/ |
*/ |
876 |
static int |
static int |
877 |
mark_x (name) |
mark_x (char *name) |
|
char *name; |
|
878 |
{ |
{ |
879 |
struct stat sbuf; |
struct stat sbuf; |
880 |
int um; |
int um; |