comparison src/unexalpha.c @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents 972bbb6d6ca2
children 6240c7796c7a
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
90 90
91 #ifndef DEFAULT_ENTRY_ADDRESS 91 #ifndef DEFAULT_ENTRY_ADDRESS
92 #define DEFAULT_ENTRY_ADDRESS __start 92 #define DEFAULT_ENTRY_ADDRESS __start
93 #endif 93 #endif
94 94
95 int 95 unexec (new_name, a_name, data_start, bss_start, entry_address)
96 unexec (char *new_name, char *a_name, 96 char *new_name, *a_name;
97 unsigned long data_start, 97 unsigned long data_start, bss_start, entry_address;
98 unsigned long bss_start,
99 unsigned long entry_address)
100 { 98 {
101 int new, old; 99 int new, old;
102 char * oldptr; 100 char * oldptr;
103 struct headers ohdr, nhdr; 101 struct headers ohdr, nhdr;
104 struct stat stat; 102 struct stat stat;
105 long pagesize, brk; 103 long pagesize, brk;
106 long newsyms, symrel; 104 long newsyms, symrel;
105 int nread;
107 int i; 106 int i;
108 long vaddr, scnptr; 107 long vaddr, scnptr;
109 #define BUFSIZE 8192 108 #define BUFSIZE 8192
110 char buffer[BUFSIZE]; 109 char buffer[BUFSIZE];
111 110
208 207
209 nhdr.aout.dsize = brk - DATA_START; 208 nhdr.aout.dsize = brk - DATA_START;
210 nhdr.aout.bsize = 0; 209 nhdr.aout.bsize = 0;
211 if (entry_address == 0) 210 if (entry_address == 0)
212 { 211 {
213 extern int DEFAULT_ENTRY_ADDRESS (void); 212 extern DEFAULT_ENTRY_ADDRESS ();
214 nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS; 213 nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS;
215 } 214 }
216 else 215 else
217 nhdr.aout.entry = entry_address; 216 nhdr.aout.entry = entry_address;
218 217
364 _edata 363 _edata
365 _end 364 _end
366 365
367 */ 366 */
368 367
369 int 368
370 update_dynamic_symbols ( 369 update_dynamic_symbols (old, new_name, new, newsyms, nsyms, symoff, stroff)
371 char *old, /* Pointer to old executable */ 370 char *old; /* Pointer to old executable */
372 char *new_name, /* Name of new executable */ 371 char *new_name; /* Name of new executable */
373 int new, /* File descriptor for new executable */ 372 int new; /* File descriptor for new executable */
374 long newsyms, /* Offset of Symbol table in new executable */ 373 long newsyms; /* Offset of Symbol table in new executable */
375 int nsyms, /* Number of symbol table entries */ 374 int nsyms; /* Number of symbol table entries */
376 long symoff, /* Offset of External Symbols in old file */ 375 long symoff; /* Offset of External Symbols in old file */
377 long stroff) /* Offset of string table in old file */ 376 long stroff; /* Offset of string table in old file */
378 { 377 {
379 long i; 378 long i;
380 int found = 0; 379 int found = 0;
381 EXTR n_end, n_edata; 380 EXTR n_end, n_edata;
382 381