comparison src/unexalpha.c @ 3025:facf3239ba30

[xemacs-hg @ 2005-10-25 11:16:19 by ben] rename new->new_, convert 'foo to `foo' EmacsFrame.c, ExternalClient.c, ExternalShell.c, chartab.c, cmdloop.c, compiler.h, console.c, database.c, device-msw.c, device-x.c, device.c, doc.c, dragdrop.c, eval.c, event-msw.c, event-stream.c, events.c, extents.c, file-coding.c, fns.c, frame-tty.c, frame.c, gpmevent.c, gutter.c, hash.c, imgproc.c, indent.c, keymap.c, lisp-union.h, macros.c, malloc.c, marker.c, menubar-x.c, menubar.c, mule-charset.c, number.c, process.c, profile.h, ralloc.c, redisplay.c, select-common.h, select.c, syntax.c, sysfile.h, sysproc.h, systime.h, syswindows.h, toolbar.c, tooltalk.c, tparam.c, unexaix.c, unexalpha.c, unexconvex.c, unexec.c, unexhp9k800.c, unexmips.c, unicode.c, window.c: new -> new_. 'foo -> `foo'. lwlib-internal.h: redo assert macros to follow lisp.h and not trigger warnings. lwlib.c, xlwtabs.c: new -> new_.
author ben
date Tue, 25 Oct 2005 11:16:49 +0000
parents 04bc9d2f42c7
children 308d34e9f07d
comparison
equal deleted inserted replaced
3024:b7f26b2f78bd 3025:facf3239ba30
94 unexec (char *new_name, char *a_name, 94 unexec (char *new_name, char *a_name,
95 unsigned long data_start, 95 unsigned long data_start,
96 unsigned long UNUSED (bss_start), 96 unsigned long UNUSED (bss_start),
97 unsigned long entry_address) 97 unsigned long entry_address)
98 { 98 {
99 int new, old; 99 int new_, old;
100 char * oldptr; 100 char * oldptr;
101 struct headers ohdr, nhdr; 101 struct headers ohdr, nhdr;
102 struct stat stat; 102 struct stat stat;
103 long pagesize, brk; 103 long pagesize, brk;
104 long newsyms, symrel; 104 long newsyms, symrel;
108 char buffer[BUFSIZE]; 108 char buffer[BUFSIZE];
109 109
110 if ((old = open (a_name, O_RDONLY)) < 0) 110 if ((old = open (a_name, O_RDONLY)) < 0)
111 fatal_unexec ("opening %s", a_name); 111 fatal_unexec ("opening %s", a_name);
112 112
113 new = creat (new_name, 0666); 113 new_ = creat (new_name, 0666);
114 if (new < 0) fatal_unexec ("creating %s", new_name); 114 if (new_ < 0) fatal_unexec ("creating %s", new_name);
115 115
116 if ((fstat (old, &stat) == -1)) 116 if ((fstat (old, &stat) == -1))
117 fatal_unexec ("fstat %s", a_name); 117 fatal_unexec ("fstat %s", a_name);
118 118
119 oldptr = (char *)mmap (0, stat.st_size, PROT_READ, MAP_FILE|MAP_SHARED, old, 0); 119 oldptr = (char *)mmap (0, stat.st_size, PROT_READ, MAP_FILE|MAP_SHARED, old, 0);
288 bss_section->s_paddr = vaddr; 288 bss_section->s_paddr = vaddr;
289 bss_section->s_size = 0; 289 bss_section->s_size = 0;
290 bss_section->s_scnptr = scnptr; 290 bss_section->s_scnptr = scnptr;
291 } 291 }
292 292
293 WRITE (new, (char *)TEXT_START, nhdr.aout.tsize, 293 WRITE (new_, (char *)TEXT_START, nhdr.aout.tsize,
294 "writing text section to %s", new_name); 294 "writing text section to %s", new_name);
295 WRITE (new, (char *)DATA_START, nhdr.aout.dsize, 295 WRITE (new_, (char *)DATA_START, nhdr.aout.dsize,
296 "writing data section to %s", new_name); 296 "writing data section to %s", new_name);
297 297
298 298
299 /* 299 /*
300 * Construct new symbol table header 300 * Construct new symbol table header
316 symhdr->cbSsExtOffset += symrel; 316 symhdr->cbSsExtOffset += symrel;
317 symhdr->cbFdOffset += symrel; 317 symhdr->cbFdOffset += symrel;
318 symhdr->cbRfdOffset += symrel; 318 symhdr->cbRfdOffset += symrel;
319 symhdr->cbExtOffset += symrel; 319 symhdr->cbExtOffset += symrel;
320 320
321 WRITE (new, buffer, cbHDRR, "writing symbol table header of %s", new_name); 321 WRITE (new_, buffer, cbHDRR, "writing symbol table header of %s", new_name);
322 322
323 /* 323 /*
324 * Copy the symbol table and line numbers 324 * Copy the symbol table and line numbers
325 */ 325 */
326 WRITE (new, oldptr + ohdr.fhdr.f_symptr + cbHDRR, 326 WRITE (new_, oldptr + ohdr.fhdr.f_symptr + cbHDRR,
327 stat.st_size - ohdr.fhdr.f_symptr - cbHDRR, 327 stat.st_size - ohdr.fhdr.f_symptr - cbHDRR,
328 "writing symbol table of %s", new_name); 328 "writing symbol table of %s", new_name);
329 329
330 #if 0 330 #if 0
331 331
332 /* Not needed for now */ 332 /* Not needed for now */
333 333
334 update_dynamic_symbols (oldptr, new_name, new, newsyms, 334 update_dynamic_symbols (oldptr, new_name, new_, newsyms,
335 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->issExtMax, 335 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->issExtMax,
336 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->cbExtOffset, 336 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->cbExtOffset,
337 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->cbSsExtOffset); 337 ((pHDRR) (oldptr + ohdr.fhdr.f_symptr))->cbSsExtOffset);
338 338
339 #endif 339 #endif
340 340
341 #undef symhdr 341 #undef symhdr
342 342
343 SEEK (new, 0, "seeking to start of header in %s", new_name); 343 SEEK (new_, 0, "seeking to start of header in %s", new_name);
344 WRITE (new, &nhdr, sizeof (nhdr), 344 WRITE (new_, &nhdr, sizeof (nhdr),
345 "writing header of %s", new_name); 345 "writing header of %s", new_name);
346 346
347 close (old); 347 close (old);
348 close (new); 348 close (new_);
349 mark_x (new_name); 349 mark_x (new_name);
350 return 0; 350 return 0;
351 } 351 }
352 352
353 353
365 365
366 int 366 int
367 update_dynamic_symbols ( 367 update_dynamic_symbols (
368 char *old, /* Pointer to old executable */ 368 char *old, /* Pointer to old executable */
369 char *new_name, /* Name of new executable */ 369 char *new_name, /* Name of new executable */
370 int new, /* File descriptor for new executable */ 370 int new_, /* File descriptor for new executable */
371 long newsyms, /* Offset of Symbol table in new executable */ 371 long newsyms, /* Offset of Symbol table in new executable */
372 int nsyms, /* Number of symbol table entries */ 372 int nsyms, /* Number of symbol table entries */
373 long symoff, /* Offset of External Symbols in old file */ 373 long symoff, /* Offset of External Symbols in old file */
374 long stroff) /* Offset of string table in old file */ 374 long stroff) /* Offset of string table in old file */
375 { 375 {
392 if (!strcmp(s,"_edata")) 392 if (!strcmp(s,"_edata"))
393 { 393 {
394 found++; 394 found++;
395 memcpy (&n_edata, x, cbEXTR); 395 memcpy (&n_edata, x, cbEXTR);
396 n_edata.asym.value = Brk; 396 n_edata.asym.value = Brk;
397 SEEK (new, newsyms + cbHDRR + i, 397 SEEK (new_, newsyms + cbHDRR + i,
398 "seeking to symbol _edata in %s", new_name); 398 "seeking to symbol _edata in %s", new_name);
399 WRITE (new, &n_edata, cbEXTR, 399 WRITE (new_, &n_edata, cbEXTR,
400 "writing symbol table entry for _edata into %s", new_name); 400 "writing symbol table entry for _edata into %s", new_name);
401 } 401 }
402 else if (!strcmp(s,"_end")) 402 else if (!strcmp(s,"_end"))
403 { 403 {
404 found++; 404 found++;
405 memcpy (&n_end, x, cbEXTR); 405 memcpy (&n_end, x, cbEXTR);
406 n_end.asym.value = Brk; 406 n_end.asym.value = Brk;
407 SEEK (new, newsyms + cbHDRR + i, 407 SEEK (new_, newsyms + cbHDRR + i,
408 "seeking to symbol _end in %s", new_name); 408 "seeking to symbol _end in %s", new_name);
409 WRITE (new, &n_end, cbEXTR, 409 WRITE (new_, &n_end, cbEXTR,
410 "writing symbol table entry for _end into %s", new_name); 410 "writing symbol table entry for _end into %s", new_name);
411 } 411 }
412 } 412 }
413 413
414 } 414 }