comparison src/unexmips.c @ 1486:1a12c5f1c04d

[sony, IRIS_4D]: Include getpagesize.h and fcntl.h. (unexec): #if 0 the error check of hdr.fhdr.f_nscns. Clear text_section->s_scnptr.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 Oct 1992 19:42:55 +0000
parents 42922d56e5a6
children 507f64624555
comparison
equal deleted inserted replaced
1485:a6da00e1c5ad 1486:1a12c5f1c04d
34 #include <filehdr.h> 34 #include <filehdr.h>
35 #include <aouthdr.h> 35 #include <aouthdr.h>
36 #include <scnhdr.h> 36 #include <scnhdr.h>
37 #include <sym.h> 37 #include <sym.h>
38 38
39 #ifdef IRIS_4D 39 #if defined (IRIS_4D) || defined (sony)
40 #include "getpagesize.h" 40 #include "getpagesize.h"
41 #include <fcntl.h>
41 #endif 42 #endif
42 43
43 static void fatal_unexec (); 44 static void fatal_unexec ();
44 static void mark_x (); 45 static void mark_x ();
45 46
110 if (hdr.fhdr.f_magic != MIPSELMAGIC 111 if (hdr.fhdr.f_magic != MIPSELMAGIC
111 && hdr.fhdr.f_magic != MIPSEBMAGIC 112 && hdr.fhdr.f_magic != MIPSEBMAGIC
112 && hdr.fhdr.f_magic != (MIPSELMAGIC | 1) 113 && hdr.fhdr.f_magic != (MIPSELMAGIC | 1)
113 && hdr.fhdr.f_magic != (MIPSEBMAGIC | 1)) 114 && hdr.fhdr.f_magic != (MIPSEBMAGIC | 1))
114 { 115 {
115 fprintf(stderr, 116 fprintf (stderr,
116 "unexec: input file magic number is %x, not %x, %x, %x or %x.\n", 117 "unexec: input file magic number is %x, not %x, %x, %x or %x.\n",
117 hdr.fhdr.f_magic, 118 hdr.fhdr.f_magic,
118 MIPSELMAGIC, MIPSEBMAGIC, 119 MIPSELMAGIC, MIPSEBMAGIC,
119 MIPSELMAGIC | 1, MIPSEBMAGIC | 1); 120 MIPSELMAGIC | 1, MIPSEBMAGIC | 1);
120 exit(1); 121 exit(1);
121 } 122 }
122 #else /* not MIPS2 */ 123 #else /* not MIPS2 */
123 if (hdr.fhdr.f_magic != MIPSELMAGIC 124 if (hdr.fhdr.f_magic != MIPSELMAGIC
124 && hdr.fhdr.f_magic != MIPSEBMAGIC) 125 && hdr.fhdr.f_magic != MIPSEBMAGIC)
161 CHECK_SCNHDR (lit4_section, _LIT4, STYP_LIT4); 162 CHECK_SCNHDR (lit4_section, _LIT4, STYP_LIT4);
162 #endif /* _LIT8 */ 163 #endif /* _LIT8 */
163 CHECK_SCNHDR (sdata_section, _SDATA, STYP_SDATA); 164 CHECK_SCNHDR (sdata_section, _SDATA, STYP_SDATA);
164 CHECK_SCNHDR (sbss_section, _SBSS, STYP_SBSS); 165 CHECK_SCNHDR (sbss_section, _SBSS, STYP_SBSS);
165 CHECK_SCNHDR (bss_section, _BSS, STYP_BSS); 166 CHECK_SCNHDR (bss_section, _BSS, STYP_BSS);
167 #if 0 /* Apparently this error check goes off on irix 3.3,
168 but it doesn't indicate a real problem. */
166 if (i != hdr.fhdr.f_nscns) 169 if (i != hdr.fhdr.f_nscns)
167 fprintf (stderr, "unexec: %d sections found instead of %d.\n", 170 fprintf (stderr, "unexec: %d sections found instead of %d.\n",
168 i, hdr.fhdr.f_nscns); 171 i, hdr.fhdr.f_nscns);
172 #endif
173
174 text_section->s_scnptr = 0;
169 175
170 pagesize = getpagesize (); 176 pagesize = getpagesize ();
171 brk = (sbrk (0) + pagesize - 1) & (-pagesize); 177 brk = (sbrk (0) + pagesize - 1) & (-pagesize);
172 hdr.aout.dsize = brk - DATA_START; 178 hdr.aout.dsize = brk - DATA_START;
173 hdr.aout.bsize = 0; 179 hdr.aout.bsize = 0;