Mercurial > hg > xemacs-beta
comparison src/unexelf.c @ 408:501cfd01ee6d r21-2-34
Import from CVS: tag r21-2-34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:18:11 +0200 |
parents | 74fd4e045ea6 |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
407:ed6218a7d4d3 | 408:501cfd01ee6d |
---|---|
492 | 492 |
493 # define SHN_UNDEF Elf_eshn_undefined | 493 # define SHN_UNDEF Elf_eshn_undefined |
494 # define SHN_ABS Elf_eshn_absolute | 494 # define SHN_ABS Elf_eshn_absolute |
495 # define SHN_COMMON Elf_eshn_common | 495 # define SHN_COMMON Elf_eshn_common |
496 | 496 |
497 /* | |
498 * The magic of picking the right size types is handled by the ELFSIZE | |
499 * definition above. | |
500 */ | |
501 # ifdef __STDC__ | |
502 # define ElfW(type) Elf_##type | |
503 # else | |
504 # define ElfW(type) Elf_/**/type | |
505 # endif | |
506 | |
507 # ifdef __alpha__ | 497 # ifdef __alpha__ |
508 # include <sys/exec_ecoff.h> | 498 # include <sys/exec_ecoff.h> |
509 # define HDRR struct ecoff_symhdr | 499 # define HDRR struct ecoff_symhdr |
510 # define pHDRR HDRR * | 500 # define pHDRR HDRR * |
511 # endif | 501 # endif |
683 if (old_sbss_index == old_file_h->e_shnum) | 673 if (old_sbss_index == old_file_h->e_shnum) |
684 { | 674 { |
685 old_sbss_index = -1; | 675 old_sbss_index = -1; |
686 old_bss_addr = OLD_SECTION_H(old_bss_index).sh_addr; | 676 old_bss_addr = OLD_SECTION_H(old_bss_index).sh_addr; |
687 old_bss_size = OLD_SECTION_H(old_bss_index).sh_size; | 677 old_bss_size = OLD_SECTION_H(old_bss_index).sh_size; |
688 new_data2_offset = OLD_SECTION_H(old_bss_index).sh_offset; | |
689 new_data2_index = old_bss_index; | 678 new_data2_index = old_bss_index; |
690 } | 679 } |
691 else | 680 else |
692 { | 681 { |
693 old_bss_addr = OLD_SECTION_H(old_sbss_index).sh_addr; | 682 old_bss_addr = OLD_SECTION_H(old_sbss_index).sh_addr; |
694 old_bss_size = OLD_SECTION_H(old_bss_index).sh_size | 683 old_bss_size = OLD_SECTION_H(old_bss_index).sh_size |
695 + OLD_SECTION_H(old_sbss_index).sh_size; | 684 + OLD_SECTION_H(old_sbss_index).sh_size; |
696 new_data2_offset = OLD_SECTION_H(old_sbss_index).sh_offset; | |
697 new_data2_index = old_sbss_index; | 685 new_data2_index = old_sbss_index; |
698 } | 686 } |
699 | 687 |
700 for (old_mdebug_index = 1; old_mdebug_index < (int) old_file_h->e_shnum; | 688 for (old_mdebug_index = 1; old_mdebug_index < (int) old_file_h->e_shnum; |
701 old_mdebug_index++) | 689 old_mdebug_index++) |
709 break; | 697 break; |
710 } | 698 } |
711 if (old_mdebug_index == old_file_h->e_shnum) | 699 if (old_mdebug_index == old_file_h->e_shnum) |
712 old_mdebug_index = 0; | 700 old_mdebug_index = 0; |
713 | 701 |
702 for (old_data_index = 1; old_data_index < (int) old_file_h->e_shnum; | |
703 old_data_index++) | |
704 { | |
705 #ifdef DEBUG | |
706 fprintf (stderr, "Looking for .data - found %s\n", | |
707 old_section_names + OLD_SECTION_H (old_data_index).sh_name); | |
708 #endif | |
709 if (!strcmp (old_section_names + OLD_SECTION_H (old_data_index).sh_name, | |
710 ".data")) | |
711 break; | |
712 } | |
713 if (old_data_index == old_file_h->e_shnum) | |
714 old_data_index = 0; | |
715 | |
714 #if defined (emacs) || !defined (DEBUG) | 716 #if defined (emacs) || !defined (DEBUG) |
715 new_bss_addr = (ElfW(Addr)) sbrk (0); | 717 new_bss_addr = (ElfW(Addr)) sbrk (0); |
716 #else | 718 #else |
717 new_bss_addr = old_bss_addr + old_bss_size + 0x1234; | 719 new_bss_addr = old_bss_addr + old_bss_size + 0x1234; |
718 #endif | 720 #endif |
719 new_data2_addr = old_bss_addr; | 721 new_data2_addr = old_bss_addr; |
720 new_data2_size = new_bss_addr - old_bss_addr; | 722 new_data2_size = new_bss_addr - old_bss_addr; |
723 new_data2_offset = OLD_SECTION_H (old_data_index).sh_offset + | |
724 (new_data2_addr - OLD_SECTION_H (old_data_index).sh_addr); | |
721 | 725 |
722 #ifdef DEBUG | 726 #ifdef DEBUG |
723 fprintf (stderr, "old_bss_index %d\n", old_bss_index); | 727 fprintf (stderr, "old_bss_index %d\n", old_bss_index); |
724 fprintf (stderr, "old_bss_addr %x\n", old_bss_addr); | 728 fprintf (stderr, "old_bss_addr %x\n", old_bss_addr); |
725 fprintf (stderr, "old_bss_size %x\n", old_bss_size); | 729 fprintf (stderr, "old_bss_size %x\n", old_bss_size); |