comparison src/unexelf.c @ 247:e70b3a057e12 r20-5b22

Import from CVS: tag r20-5b22
author cvs
date Mon, 13 Aug 2007 10:18:21 +0200
parents 538048ae2ab8
children 677f6a0ee643
comparison
equal deleted inserted replaced
246:cf2a77a48c1c 247:e70b3a057e12
797 continue; 797 continue;
798 798
799 /* Write out the sections. .data and .data1 (and data2, called 799 /* Write out the sections. .data and .data1 (and data2, called
800 ".data" in the strings table) get copied from the current process 800 ".data" in the strings table) get copied from the current process
801 instead of the old file. */ 801 instead of the old file. */
802 #ifdef __powerpc__
803 /* The PowerPC has additional 'data' segments which need to be saved */
804 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") ||
805 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1") ||
806 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata") ||
807 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata1"))
808 #else
802 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") 809 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
803 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 810 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
804 ".data1")) 811 ".data1"))
812 #endif
805 src = (caddr_t) OLD_SECTION_H (n).sh_addr; 813 src = (caddr_t) OLD_SECTION_H (n).sh_addr;
806 else 814 else
807 src = old_base + OLD_SECTION_H (n).sh_offset; 815 src = old_base + OLD_SECTION_H (n).sh_offset;
808 816
809 memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src, 817 memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
862 case SHT_RELA: 870 case SHT_RELA:
863 /* This code handles two different size structs, but there should 871 /* This code handles two different size structs, but there should
864 be no harm in that provided that r_offset is always the first 872 be no harm in that provided that r_offset is always the first
865 member. */ 873 member. */
866 nn = section.sh_info; 874 nn = section.sh_info;
875 #ifdef __powerpc__
876 /* The PowerPC has additional 'data' segments which need to be saved */
877 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") ||
878 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1") ||
879 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata") ||
880 !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata1"))
881 #else
867 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") 882 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
868 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 883 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
869 ".data1")) 884 ".data1"))
885 #endif
870 { 886 {
871 Elf32_Addr offset = NEW_SECTION_H (nn).sh_addr - 887 Elf32_Addr offset = NEW_SECTION_H (nn).sh_addr -
872 NEW_SECTION_H (nn).sh_offset; 888 NEW_SECTION_H (nn).sh_offset;
873 caddr_t reloc = old_base + section.sh_offset, end; 889 caddr_t reloc = old_base + section.sh_offset, end;
874 for (end = reloc + section.sh_size; reloc < end; 890 for (end = reloc + section.sh_size; reloc < end;