Mercurial > hg > xemacs-beta
comparison src/unexelfsgi.c @ 394:7d59cb494b73 r21-2-12
Import from CVS: tag r21-2-12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:11:37 +0200 |
parents | cc15677e0335 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
393:2e030b8965b1 | 394:7d59cb494b73 |
---|---|
539 (n)++; } while (0) | 539 (n)++; } while (0) |
540 typedef unsigned char byte; | 540 typedef unsigned char byte; |
541 | 541 |
542 /* Round X up to a multiple of Y. */ | 542 /* Round X up to a multiple of Y. */ |
543 | 543 |
544 int | 544 static int |
545 round_up (x, y) | 545 round_up (int x, int y) |
546 int x, y; | |
547 { | 546 { |
548 int rem = x % y; | 547 int rem = x % y; |
549 if (rem == 0) | 548 if (rem == 0) |
550 return x; | 549 return x; |
551 return x - rem + y; | 550 return x - rem + y; |
557 | 556 |
558 If we don't find the section NAME, that is a fatal error | 557 If we don't find the section NAME, that is a fatal error |
559 if NOERROR is 0; we return -1 if NOERROR is nonzero. */ | 558 if NOERROR is 0; we return -1 if NOERROR is nonzero. */ |
560 | 559 |
561 static int | 560 static int |
562 find_section (name, section_names, file_name, old_file_h, old_section_h, noerror) | 561 find_section (char *name, |
563 char *name; | 562 char *section_names, |
564 char *section_names; | 563 char *file_name, |
565 char *file_name; | 564 l_Elf_Ehdr *old_file_h, |
566 l_Elf_Ehdr *old_file_h; | 565 l_Elf_Shdr *old_section_h, |
567 l_Elf_Shdr *old_section_h; | 566 int noerror) |
568 int noerror; | |
569 { | 567 { |
570 int idx; | 568 int idx; |
571 | 569 |
572 for (idx = 1; idx < old_file_h->e_shnum; idx++) | 570 for (idx = 1; idx < old_file_h->e_shnum; idx++) |
573 { | 571 { |
598 * In ELF, this works by replacing the old .bss section with a new | 596 * In ELF, this works by replacing the old .bss section with a new |
599 * .data section, and inserting an empty .bss immediately afterwards. | 597 * .data section, and inserting an empty .bss immediately afterwards. |
600 * | 598 * |
601 */ | 599 */ |
602 int | 600 int |
603 unexec (new_name, old_name, data_start, bss_start, entry_address) | 601 unexec (char *new_name, |
604 char *new_name, *old_name; | 602 char *old_name, |
605 uintptr_t data_start, bss_start, entry_address; | 603 uintptr_t data_start, |
604 uintptr_t bss_start, | |
605 uintptr_t entry_address) | |
606 { | 606 { |
607 extern uintptr_t bss_end; | 607 extern uintptr_t bss_end; |
608 int new_file, old_file, new_file_size; | 608 int new_file, old_file, new_file_size; |
609 | 609 |
610 /* Pointers to the base of the image of the two files. */ | 610 /* Pointers to the base of the image of the two files. */ |