Mercurial > emacs
comparison src/unexmips.c @ 12420:0c728a1b2bed
[MACH]: Include a.out.h.
[MACH] (STYP_INIT, _RDATA, STYP_RDATA, _SDATA, STYP_SDATA): Defined.
[MACH] (_SBSS, STYP_SBSS, HDRR, pHDRR): New definitions.
(unexec): Add MACH conditionals.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Jun 1995 01:44:57 +0000 |
parents | 1edd14fa94ae |
children | ee40177f6c68 |
comparison
equal
deleted
inserted
replaced
12419:818d7bcf63b0 | 12420:0c728a1b2bed |
---|---|
29 #include <sys/types.h> | 29 #include <sys/types.h> |
30 #include <sys/file.h> | 30 #include <sys/file.h> |
31 #include <sys/stat.h> | 31 #include <sys/stat.h> |
32 #include <stdio.h> | 32 #include <stdio.h> |
33 #include <varargs.h> | 33 #include <varargs.h> |
34 | |
35 #ifdef MACH | |
36 | |
37 #include <a.out.h> | |
38 | |
39 /* I don't know why this isn't defined. */ | |
40 #ifndef STYP_INIT | |
41 #define STYP_INIT 0x80000000 | |
42 #endif | |
43 | |
44 /* I don't know why this isn't defined. */ | |
45 #ifndef _RDATA | |
46 #define _RDATA ".rdata" | |
47 #define STYP_RDATA 0x00000100 | |
48 #endif | |
49 | |
50 /* Small ("near") data section. */ | |
51 #ifndef _SDATA | |
52 #define _SDATA ".sdata" | |
53 #define STYP_SDATA 0x00000200 | |
54 #endif | |
55 | |
56 /* Small ("near") bss section. */ | |
57 #ifndef _SBSS | |
58 #define _SBSS ".sbss" | |
59 #define STYP_SBSS 0x00000400 | |
60 #endif | |
61 | |
62 /* We don't seem to have a sym.h or syms.h anywhere, so we'll do it the | |
63 hard way. This stinks. */ | |
64 typedef struct { | |
65 short magic; | |
66 short vstamp; | |
67 long ilineMax; | |
68 struct { long foo, offset; } offsets[11]; | |
69 } HDRR, *pHDRR; | |
70 | |
71 #else /* not MACH */ | |
72 | |
34 #include <filehdr.h> | 73 #include <filehdr.h> |
35 #include <aouthdr.h> | 74 #include <aouthdr.h> |
36 #include <scnhdr.h> | 75 #include <scnhdr.h> |
37 #include <sym.h> | 76 #include <sym.h> |
77 | |
78 #endif /* not MACH */ | |
38 | 79 |
39 #if defined (IRIS_4D) || defined (sony) | 80 #if defined (IRIS_4D) || defined (sony) |
40 #include "getpagesize.h" | 81 #include "getpagesize.h" |
41 #include <fcntl.h> | 82 #include <fcntl.h> |
42 #endif | 83 #endif |
242 | 283 |
243 SEEK (old, hdr.fhdr.f_symptr, "seeking to start of symbols in %s", a_name); | 284 SEEK (old, hdr.fhdr.f_symptr, "seeking to start of symbols in %s", a_name); |
244 errno = EEOF; | 285 errno = EEOF; |
245 nread = read (old, buffer, BUFSIZE); | 286 nread = read (old, buffer, BUFSIZE); |
246 if (nread < sizeof (HDRR)) fatal_unexec ("reading symbols from %s", a_name); | 287 if (nread < sizeof (HDRR)) fatal_unexec ("reading symbols from %s", a_name); |
247 #define symhdr ((pHDRR)buffer) | |
248 newsyms = hdr.aout.tsize + hdr.aout.dsize; | 288 newsyms = hdr.aout.tsize + hdr.aout.dsize; |
249 symrel = newsyms - hdr.fhdr.f_symptr; | 289 symrel = newsyms - hdr.fhdr.f_symptr; |
250 hdr.fhdr.f_symptr = newsyms; | 290 hdr.fhdr.f_symptr = newsyms; |
291 #define symhdr ((pHDRR)buffer) | |
292 #ifdef MACH | |
293 for (i = 0; i < 11; i++) | |
294 symhdr->offsets[i].offset += symrel; | |
295 #else | |
251 symhdr->cbLineOffset += symrel; | 296 symhdr->cbLineOffset += symrel; |
252 symhdr->cbDnOffset += symrel; | 297 symhdr->cbDnOffset += symrel; |
253 symhdr->cbPdOffset += symrel; | 298 symhdr->cbPdOffset += symrel; |
254 symhdr->cbSymOffset += symrel; | 299 symhdr->cbSymOffset += symrel; |
255 symhdr->cbOptOffset += symrel; | 300 symhdr->cbOptOffset += symrel; |
257 symhdr->cbSsOffset += symrel; | 302 symhdr->cbSsOffset += symrel; |
258 symhdr->cbSsExtOffset += symrel; | 303 symhdr->cbSsExtOffset += symrel; |
259 symhdr->cbFdOffset += symrel; | 304 symhdr->cbFdOffset += symrel; |
260 symhdr->cbRfdOffset += symrel; | 305 symhdr->cbRfdOffset += symrel; |
261 symhdr->cbExtOffset += symrel; | 306 symhdr->cbExtOffset += symrel; |
307 #endif | |
262 #undef symhdr | 308 #undef symhdr |
263 do | 309 do |
264 { | 310 { |
265 if (write (new, buffer, nread) != nread) | 311 if (write (new, buffer, nread) != nread) |
266 fatal_unexec ("writing symbols to %s", new_name); | 312 fatal_unexec ("writing symbols to %s", new_name); |