aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-01-08 09:19:22 +0000
committerRichard M. Stallman1994-01-08 09:19:22 +0000
commit3680bdc6ffed16f2dd713552f8e9d40abf544f8b (patch)
treeaa35fb5025b648f686788bd0b0a03483cbdfcdcb /src
parent8e99c732db1100b3f2c83a5341efd202af4b7075 (diff)
downloademacs-3680bdc6ffed16f2dd713552f8e9d40abf544f8b.tar.gz
emacs-3680bdc6ffed16f2dd713552f8e9d40abf544f8b.zip
[MSDOS]: Don't #include <a.out.h>, but use other headers.
(make_hdr) [MSDOS]: Cast a pointer for bzero. (write_segment) [EFAULT]: Check for before using. (adjust_lnnoptrs) [MSDOS]: Use provided descriptor. (adjust_lnnoptrs): Return 0 if ok.
Diffstat (limited to 'src')
-rw-r--r--src/unexec.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/unexec.c b/src/unexec.c
index e9be7aeac22..7524c080de0 100644
--- a/src/unexec.c
+++ b/src/unexec.c
@@ -176,7 +176,31 @@ pointer looks like an int) but not on all machines.
176int need_coff_header = 1; 176int need_coff_header = 1;
177#include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */ 177#include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */
178#else 178#else
179#ifdef MSDOS
180#include <../go32/gotypes.h>
181#include <../go32/ed/coff.h>
182#define filehdr external_filehdr
183#define scnhdr external_scnhdr
184#define syment external_syment
185#define auxent external_auxent
186#define n_numaux e_numaux
187#define n_type e_type
188struct aouthdr
189{
190 word16 magic; /* type of file */
191 word16 vstamp; /* version stamp */
192 word32 tsize; /* text size in bytes, padded to FW bdry*/
193 word32 dsize; /* initialized data " " */
194 word32 bsize; /* uninitialized data " " */
195 word32 entry; /* entry pt. */
196 word32 text_start; /* base of text used for this file */
197 word32 data_start; /* base of data used for this file */
198};
199
200
201#else /* not MSDOS */
179#include <a.out.h> 202#include <a.out.h>
203#endif /* not MSDOS */
180#endif 204#endif
181 205
182/* Define getpagesize () if the system does not. 206/* Define getpagesize () if the system does not.
@@ -686,8 +710,12 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
686 */ 710 */
687 ERROR0 ("can't build a COFF file from scratch yet"); 711 ERROR0 ("can't build a COFF file from scratch yet");
688#else 712#else
713#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
714 bzero ((void *)&hdr, sizeof hdr);
715#else
689 bzero (&hdr, sizeof hdr); 716 bzero (&hdr, sizeof hdr);
690#endif 717#endif
718#endif
691 } 719 }
692 720
693 unexec_text_start = (long) start_of_text (); 721 unexec_text_start = (long) start_of_text ();
@@ -898,7 +926,11 @@ write_segment (new, ptr, end)
898 a gap between the old text segment and the old data segment. 926 a gap between the old text segment and the old data segment.
899 This gap has probably been remapped into part of the text segment. 927 This gap has probably been remapped into part of the text segment.
900 So write zeros for it. */ 928 So write zeros for it. */
901 if (ret == -1 && errno == EFAULT) 929 if (ret == -1
930#ifdef EFAULT
931 && errno == EFAULT
932#endif
933 )
902 write (new, zeros, nwrite); 934 write (new, zeros, nwrite);
903 else if (nwrite != ret) 935 else if (nwrite != ret)
904 { 936 {
@@ -1021,7 +1053,11 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
1021 if (!lnnoptr || !f_hdr.f_symptr) 1053 if (!lnnoptr || !f_hdr.f_symptr)
1022 return 0; 1054 return 0;
1023 1055
1056#ifdef MSDOS
1057 if ((new = writedesc) < 0)
1058#else
1024 if ((new = open (new_name, 2)) < 0) 1059 if ((new = open (new_name, 2)) < 0)
1060#endif
1025 { 1061 {
1026 PERROR (new_name); 1062 PERROR (new_name);
1027 return -1; 1063 return -1;
@@ -1043,7 +1079,10 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
1043 } 1079 }
1044 } 1080 }
1045 } 1081 }
1082#ifndef MSDOS
1046 close (new); 1083 close (new);
1084#endif
1085 return 0;
1047} 1086}
1048 1087
1049#endif /* COFF_BSD_SYMBOLS */ 1088#endif /* COFF_BSD_SYMBOLS */