diff options
| author | Richard M. Stallman | 1995-06-29 01:44:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-06-29 01:44:57 +0000 |
| commit | 19ab8db9073ae8f060e9344a86b7a886f505588a (patch) | |
| tree | 7b25b9835c0ca5c267ff485f2e8ea662c509b7e6 /src | |
| parent | a46849a84344ea9811b3ff3bff72d68f83c1f417 (diff) | |
| download | emacs-19ab8db9073ae8f060e9344a86b7a886f505588a.tar.gz emacs-19ab8db9073ae8f060e9344a86b7a886f505588a.zip | |
[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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexmips.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/unexmips.c b/src/unexmips.c index 598791098ea..25563cf9555 100644 --- a/src/unexmips.c +++ b/src/unexmips.c | |||
| @@ -31,11 +31,52 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 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> |
| 38 | 77 | ||
| 78 | #endif /* not MACH */ | ||
| 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> |
| @@ -244,10 +285,14 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) | |||
| 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; |
| @@ -259,6 +304,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) | |||
| 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 | { |