Mercurial > emacs
comparison src/unexec.c @ 87730:91da483b3fa5
* movemail.c:
* make-docfile.c: Remove reference to symbols defined by systems
not supported anymore: MAC_OS8, XENIX and STRIDE.
* (src/m/mips.h):
* (src/m/intel386.h):
* callproc.c:
* config.in:
* ecrt0.c:
* emacs.c:
* fileio.c:
* frame.c:
* getpagesize.h:
* keyboard.c:
* lread.c:
* process.c:
* puresize.h:
* sysdep.c:
* systty.h:
* syswait.h:
* unexec.c:
* xdisp.c:
* alloc.c: Remove code containing references to symbols defined by
unsupported systems.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 13 Jan 2008 00:43:55 +0000 |
parents | fc2bcd2a8aad |
children | c70e45a7acfd 0a928dba3639 |
comparison
equal
deleted
inserted
replaced
87729:47fbf21cf3d3 | 87730:91da483b3fa5 |
---|---|
973 lseek (new, (long) A_TEXT_SEEK (hdr), 0); | 973 lseek (new, (long) A_TEXT_SEEK (hdr), 0); |
974 #else | 974 #else |
975 lseek (new, (long) N_TXTOFF (hdr), 0); | 975 lseek (new, (long) N_TXTOFF (hdr), 0); |
976 #endif /* no A_TEXT_SEEK */ | 976 #endif /* no A_TEXT_SEEK */ |
977 | 977 |
978 #ifdef RISCiX | |
979 | |
980 /* Acorn's RISC-iX has a wacky way of initialising the position of the heap. | |
981 * There is a little table in crt0.o that is filled at link time with | |
982 * the min and current brk positions, among other things. When start | |
983 * runs, it copies the table to where these parameters live during | |
984 * execution. This data is in text space, so it cannot be modified here | |
985 * before saving the executable, so the data is written manually. In | |
986 * addition, the table does not have a label, and the nearest accessible | |
987 * label (mcount) is not prefixed with a '_', thus making it inaccessible | |
988 * from within C programs. To overcome this, emacs's executable is passed | |
989 * through the command 'nm %s | fgrep mcount' into a pipe, and the | |
990 * resultant output is then used to find the address of 'mcount'. As far as | |
991 * is possible to determine, in RISC-iX releases prior to 1.2, the negative | |
992 * offset of the table from mcount is 0x2c, whereas from 1.2 onwards it is | |
993 * 0x30. bss_end has been rounded up to page boundary. This solution is | |
994 * based on suggestions made by Kevin Welton and Steve Hunt of Acorn, and | |
995 * avoids the need for a custom version of crt0.o for emacs which has its | |
996 * table in data space. | |
997 */ | |
998 | |
999 { | |
1000 char command[1024]; | |
1001 char errbuf[1024]; | |
1002 char address_text[32]; | |
1003 int proforma[4]; | |
1004 FILE *pfile; | |
1005 char *temp_ptr; | |
1006 char c; | |
1007 int mcount_address, mcount_offset, count; | |
1008 extern char *_execname; | |
1009 | |
1010 | |
1011 /* The use of _execname is incompatible with RISCiX 1.1 */ | |
1012 sprintf (command, "nm %s | fgrep mcount", _execname); | |
1013 | |
1014 if ( (pfile = popen(command, "r")) == NULL) | |
1015 { | |
1016 sprintf (errbuf, "Could not open pipe"); | |
1017 PERROR (errbuf); | |
1018 } | |
1019 | |
1020 count=0; | |
1021 while ( ((c=getc(pfile)) != EOF) && (c != ' ') && (count < 31)) | |
1022 address_text[count++]=c; | |
1023 address_text[count]=0; | |
1024 | |
1025 if ((count == 0) || pclose(pfile) != NULL) | |
1026 { | |
1027 sprintf (errbuf, "Failed to execute the command '%s'\n", command); | |
1028 PERROR (errbuf); | |
1029 } | |
1030 | |
1031 sscanf(address_text, "%x", &mcount_address); | |
1032 ptr = (char *) unexec_text_start; | |
1033 mcount_offset = (char *)mcount_address - ptr; | |
1034 | |
1035 #ifdef RISCiX_1_1 | |
1036 #define EDATA_OFFSET 0x2c | |
1037 #else | |
1038 #define EDATA_OFFSET 0x30 | |
1039 #endif | |
1040 | |
1041 end = ptr + mcount_offset - EDATA_OFFSET; | |
1042 | |
1043 write_segment (new, ptr, end); | |
1044 | |
1045 proforma[0] = bss_end; /* becomes _edata */ | |
1046 proforma[1] = bss_end; /* becomes _end */ | |
1047 proforma[2] = bss_end; /* becomes _minbrk */ | |
1048 proforma[3] = bss_end; /* becomes _curbrk */ | |
1049 | |
1050 write (new, proforma, 16); | |
1051 | |
1052 temp_ptr = ptr; | |
1053 ptr = end + 16; | |
1054 end = temp_ptr + hdr.a_text; | |
1055 | |
1056 write_segment (new, ptr, end); | |
1057 } | |
1058 | |
1059 #else /* !RISCiX */ | |
1060 ptr = (char *) unexec_text_start; | 978 ptr = (char *) unexec_text_start; |
1061 end = ptr + hdr.a_text; | 979 end = ptr + hdr.a_text; |
1062 write_segment (new, ptr, end); | 980 write_segment (new, ptr, end); |
1063 #endif /* RISCiX */ | |
1064 | 981 |
1065 ptr = (char *) unexec_data_start; | 982 ptr = (char *) unexec_data_start; |
1066 end = ptr + hdr.a_data; | 983 end = ptr + hdr.a_data; |
1067 /* This lseek is certainly incorrect when A_TEXT_OFFSET | 984 /* This lseek is certainly incorrect when A_TEXT_OFFSET |
1068 and I believe it is a no-op otherwise. | 985 and I believe it is a no-op otherwise. |
1173 int readdesc; | 1090 int readdesc; |
1174 char *new_name; | 1091 char *new_name; |
1175 { | 1092 { |
1176 register int nsyms; | 1093 register int nsyms; |
1177 register int new; | 1094 register int new; |
1178 #if defined (amdahl_uts) || defined (pfa) | |
1179 SYMENT symentry; | |
1180 AUXENT auxentry; | |
1181 #else | |
1182 struct syment symentry; | 1095 struct syment symentry; |
1183 union auxent auxentry; | 1096 union auxent auxentry; |
1184 #endif | |
1185 | 1097 |
1186 if (!lnnoptr || !f_hdr.f_symptr) | 1098 if (!lnnoptr || !f_hdr.f_symptr) |
1187 return 0; | 1099 return 0; |
1188 | 1100 |
1189 #ifdef MSDOS | 1101 #ifdef MSDOS |