comparison src/unexelf.c @ 357:4711e16a8e49 r21-1-8

Import from CVS: tag r21-1-8
author cvs
date Mon, 13 Aug 2007 10:57:04 +0200
parents 3b3709405255
children 8e84bee8ddd0
comparison
equal deleted inserted replaced
356:e85f639a32f3 357:4711e16a8e49
430 #include <sys/mman.h> 430 #include <sys/mman.h>
431 #if defined (__sony_news) && defined (_SYSTYPE_SYSV) 431 #if defined (__sony_news) && defined (_SYSTYPE_SYSV)
432 #include <sys/elf_mips.h> 432 #include <sys/elf_mips.h>
433 #include <sym.h> 433 #include <sym.h>
434 #endif /* __sony_news && _SYSTYPE_SYSV */ 434 #endif /* __sony_news && _SYSTYPE_SYSV */
435 #if __sgi 435 #ifdef __sgi
436 #include <sym.h> /* for HDRR declaration */ 436 #include <sym.h> /* for HDRR declaration */
437 #endif /* __sgi */ 437 #endif /* __sgi */
438 438
439 #if defined (__alpha__) && !defined (__NetBSD__) && !defined (__OpenBSD__) 439 #if defined (__alpha__) && !defined (__NetBSD__) && !defined (__OpenBSD__)
440 /* Declare COFF debugging symbol table. This used to be in 440 /* Declare COFF debugging symbol table. This used to be in
954 ".data" in the strings table) get copied from the current process 954 ".data" in the strings table) get copied from the current process
955 instead of the old file. */ 955 instead of the old file. */
956 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") 956 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
957 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 957 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
958 ".sdata") 958 ".sdata")
959 /* Taking these sections from the current process, breaks
960 Linux in a subtle way. Binaries only run on the
961 architecture (e.g. i586 vs i686) of the dumping machine */
962 #ifdef __sgi
959 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 963 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
960 ".lit4") 964 ".lit4")
961 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 965 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
962 ".lit8") 966 ".lit8")
963 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 967 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
964 ".got") 968 ".got")
969 #endif
965 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 970 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
966 ".sdata1") 971 ".sdata1")
967 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), 972 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
968 ".data1")) 973 ".data1"))
969 src = (caddr_t) OLD_SECTION_H (n).sh_addr; 974 src = (caddr_t) OLD_SECTION_H (n).sh_addr;
1016 phdr->cbExtOffset += diff; 1021 phdr->cbExtOffset += diff;
1017 } 1022 }
1018 } 1023 }
1019 #endif /* __sony_news && _SYSTYPE_SYSV */ 1024 #endif /* __sony_news && _SYSTYPE_SYSV */
1020 1025
1021 #if __sgi 1026 #ifdef __sgi
1022 /* Adjust the HDRR offsets in .mdebug and copy the 1027 /* Adjust the HDRR offsets in .mdebug and copy the
1023 line data if it's in its usual 'hole' in the object. 1028 line data if it's in its usual 'hole' in the object.
1024 Makes the new file debuggable with dbx. 1029 Makes the new file debuggable with dbx.
1025 patches up two problems: the absolute file offsets 1030 patches up two problems: the absolute file offsets
1026 in the HDRR record of .mdebug (see /usr/include/syms.h), and 1031 in the HDRR record of .mdebug (see /usr/include/syms.h), and
1131 member. */ 1136 member. */
1132 nn = section.sh_info; 1137 nn = section.sh_info;
1133 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") 1138 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
1134 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1139 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1135 ".sdata") 1140 ".sdata")
1141 #ifdef __sgi
1136 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1142 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1137 ".lit4") 1143 ".lit4")
1138 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1144 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1139 ".lit8") 1145 ".lit8")
1140 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1146 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1141 ".got") 1147 ".got")
1148 #endif
1142 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1149 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1143 ".sdata1") 1150 ".sdata1")
1144 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), 1151 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
1145 ".data1")) 1152 ".data1"))
1146 { 1153 {