Mercurial > emacs
comparison src/unexec.c @ 91691:0a928dba3639
* Makefile.in (REGEXP_IN_LIBC): Remove reference to obsolete
variable.
* s/gnu-linux.h: Remove commented out code.
* unexec.c: Remove references to obsolete variable
COFF_ENCAPSULATE.
* Makefile.in: Update what RMS says about using autoconf.
(C_COMPILER):
(COFF_ENCAPSULATE):
(MAKE_PARALLEL): Remove obsolete variable.
(C_SWITCH_MACHINE_1, C_SWITCH_SYSTEM_1, C_SWITCH_SITE_1):
(C_SWITCH_X_SITE_1, C_SWITCH_X_MACHINE_1)
(C_SWITCH_X_SYSTEM_1): Move invariant code outside conditional.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 09 Feb 2008 07:42:06 +0000 |
parents | 91da483b3fa5 |
children | b7a5a89054dc |
comparison
equal
deleted
inserted
replaced
91690:6dc0177676fe | 91691:0a928dba3639 |
---|---|
74 /* There are several compilation parameters affecting unexec: | 74 /* There are several compilation parameters affecting unexec: |
75 | 75 |
76 * COFF | 76 * COFF |
77 | 77 |
78 Define this if your system uses COFF for executables. | 78 Define this if your system uses COFF for executables. |
79 | |
80 * COFF_ENCAPSULATE | |
81 | |
82 Define this if you are using the GNU coff encapsulated a.out format. | |
83 This is closer to a.out than COFF. You should *not* define COFF if | |
84 you define COFF_ENCAPSULATE | |
85 | |
86 Otherwise we assume you use Berkeley format. | |
87 | 79 |
88 * NO_REMAP | 80 * NO_REMAP |
89 | 81 |
90 Define this if you do not want to try to save Emacs's pure data areas | 82 Define this if you do not want to try to save Emacs's pure data areas |
91 as part of the text segment. | 83 as part of the text segment. |
197 unsigned long text_start;/* base of text used for this file */ | 189 unsigned long text_start;/* base of text used for this file */ |
198 unsigned long data_start;/* base of data used for this file */ | 190 unsigned long data_start;/* base of data used for this file */ |
199 }; | 191 }; |
200 #endif /* not MSDOS */ | 192 #endif /* not MSDOS */ |
201 #else /* not COFF */ | 193 #else /* not COFF */ |
202 #ifdef COFF_ENCAPSULATE | |
203 int need_coff_header = 1; | |
204 #include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */ | |
205 #else /* not COFF_ENCAPSULATE */ | |
206 #include <a.out.h> | 194 #include <a.out.h> |
207 #endif /* not COFF_ENCAPSULATE */ | |
208 #endif /* not COFF */ | 195 #endif /* not COFF */ |
209 | 196 |
210 /* Define getpagesize if the system does not. | 197 /* Define getpagesize if the system does not. |
211 Note that this may depend on symbols defined in a.out.h. */ | 198 Note that this may depend on symbols defined in a.out.h. */ |
212 #include "getpagesize.h" | 199 #include "getpagesize.h" |
287 #define N_SYMOFF(x) LESYM_OFFSET(x) | 274 #define N_SYMOFF(x) LESYM_OFFSET(x) |
288 static EXEC_HDR_TYPE hdr, ohdr; | 275 static EXEC_HDR_TYPE hdr, ohdr; |
289 | 276 |
290 #else /* not HPUX */ | 277 #else /* not HPUX */ |
291 | 278 |
292 #if defined (USG) && !defined (IBMAIX) && !defined (IRIS) && !defined (COFF_ENCAPSULATE) && !defined (GNU_LINUX) | 279 #if defined (USG) && !defined (IBMAIX) && !defined (IRIS) && !defined (GNU_LINUX) |
293 static struct bhdr hdr, ohdr; | 280 static struct bhdr hdr, ohdr; |
294 #define a_magic fmagic | 281 #define a_magic fmagic |
295 #define a_text tsize | 282 #define a_text tsize |
296 #define a_data dsize | 283 #define a_data dsize |
297 #define a_bss bsize | 284 #define a_bss bsize |
309 #endif /* IRIS or IBMAIX not USG */ | 296 #endif /* IRIS or IBMAIX not USG */ |
310 #endif /* not HPUX */ | 297 #endif /* not HPUX */ |
311 | 298 |
312 static int unexec_text_start; | 299 static int unexec_text_start; |
313 static int unexec_data_start; | 300 static int unexec_data_start; |
314 | |
315 #ifdef COFF_ENCAPSULATE | |
316 /* coffheader is defined in the GNU a.out.encap.h file. */ | |
317 struct coffheader coffheader; | |
318 #endif | |
319 | 301 |
320 #endif /* not COFF */ | 302 #endif /* not COFF */ |
321 | 303 |
322 static int pagemask; | 304 static int pagemask; |
323 | 305 |
684 #else /* if not COFF */ | 666 #else /* if not COFF */ |
685 | 667 |
686 /* Get symbol table info from header of a.out file if given one. */ | 668 /* Get symbol table info from header of a.out file if given one. */ |
687 if (a_out >= 0) | 669 if (a_out >= 0) |
688 { | 670 { |
689 #ifdef COFF_ENCAPSULATE | |
690 if (read (a_out, &coffheader, sizeof coffheader) != sizeof coffheader) | |
691 { | |
692 PERROR(a_name); | |
693 } | |
694 if (coffheader.f_magic != COFF_MAGIC) | |
695 { | |
696 ERROR1("%s doesn't have legal coff magic number\n", a_name); | |
697 } | |
698 #endif | |
699 if (read (a_out, &ohdr, sizeof hdr) != sizeof hdr) | 671 if (read (a_out, &ohdr, sizeof hdr) != sizeof hdr) |
700 { | 672 { |
701 PERROR (a_name); | 673 PERROR (a_name); |
702 } | 674 } |
703 | 675 |
707 } | 679 } |
708 hdr = ohdr; | 680 hdr = ohdr; |
709 } | 681 } |
710 else | 682 else |
711 { | 683 { |
712 #ifdef COFF_ENCAPSULATE | |
713 /* We probably could without too much trouble. The code is in gld | |
714 * but I don't have that much time or incentive. | |
715 */ | |
716 ERROR0 ("can't build a COFF file from scratch yet"); | |
717 #else | |
718 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 684 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
719 bzero ((void *)&hdr, sizeof hdr); | 685 bzero ((void *)&hdr, sizeof hdr); |
720 #else | 686 #else |
721 bzero (&hdr, sizeof hdr); | 687 bzero (&hdr, sizeof hdr); |
722 #endif | |
723 #endif | 688 #endif |
724 } | 689 } |
725 | 690 |
726 unexec_text_start = (long) start_of_text (); | 691 unexec_text_start = (long) start_of_text (); |
727 unexec_data_start = data_start; | 692 unexec_data_start = data_start; |
746 #ifdef A_TEXT_OFFSET | 711 #ifdef A_TEXT_OFFSET |
747 hdr.a_text += A_TEXT_OFFSET (ohdr); | 712 hdr.a_text += A_TEXT_OFFSET (ohdr); |
748 #endif | 713 #endif |
749 | 714 |
750 #endif /* not NO_REMAP */ | 715 #endif /* not NO_REMAP */ |
751 | |
752 #ifdef COFF_ENCAPSULATE | |
753 /* We are encapsulating BSD format within COFF format. */ | |
754 { | |
755 struct coffscn *tp, *dp, *bp; | |
756 tp = &coffheader.scns[0]; | |
757 dp = &coffheader.scns[1]; | |
758 bp = &coffheader.scns[2]; | |
759 tp->s_size = hdr.a_text + sizeof(struct exec); | |
760 dp->s_paddr = data_start; | |
761 dp->s_vaddr = data_start; | |
762 dp->s_size = hdr.a_data; | |
763 bp->s_paddr = dp->s_vaddr + dp->s_size; | |
764 bp->s_vaddr = bp->s_paddr; | |
765 bp->s_size = hdr.a_bss; | |
766 coffheader.tsize = tp->s_size; | |
767 coffheader.dsize = dp->s_size; | |
768 coffheader.bsize = bp->s_size; | |
769 coffheader.text_start = tp->s_vaddr; | |
770 coffheader.data_start = dp->s_vaddr; | |
771 } | |
772 if (write (new, &coffheader, sizeof coffheader) != sizeof coffheader) | |
773 { | |
774 PERROR(new_name); | |
775 } | |
776 #endif /* COFF_ENCAPSULATE */ | |
777 | 716 |
778 if (write (new, &hdr, sizeof hdr) != sizeof hdr) | 717 if (write (new, &hdr, sizeof hdr) != sizeof hdr) |
779 { | 718 { |
780 PERROR (new_name); | 719 PERROR (new_name); |
781 } | 720 } |