Mercurial > emacs
annotate src/unexalpha.c @ 18142:c9bd973ca168
(Fcopy_keymap): After copying a sub-char-table, do store the copy.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 04 Jun 1997 21:21:53 +0000 |
parents | 8e1553706b3d |
children | c8bf40360ae7 |
rev | line source |
---|---|
8836 | 1 /* Unexec for DEC alpha. schoepf@sc.ZIB-Berlin.DE (Rainer Schoepf). |
2 | |
3 Copyright (C) 1994 Free Software Foundation, Inc. | |
4 | |
5 This file is part of GNU Emacs. | |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
9 the Free Software Foundation; either version 2, or (at your option) | |
10 any later version. | |
11 | |
12 GNU Emacs is distributed in the hope that it will be useful, | |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13512
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13512
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
8836 | 21 |
22 | |
23 #include <config.h> | |
24 #include <sys/types.h> | |
25 #include <sys/file.h> | |
26 #include <sys/stat.h> | |
27 #include <sys/mman.h> | |
28 #include <stdio.h> | |
29 #include <varargs.h> | |
18103
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
30 #ifndef __NetBSD__ |
8836 | 31 #include <filehdr.h> |
32 #include <aouthdr.h> | |
33 #include <scnhdr.h> | |
34 #include <syms.h> | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
35 #ifndef __linux__ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
36 # include <reloc.h> |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
37 # include <elf_abi.h> |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
38 #endif |
18103
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
39 #else /* __NetBSD__ */ |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
40 /* |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
41 * NetBSD/Alpha does not have 'normal' user-land ECOFF support because |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
42 * there's no desire to support ECOFF as the executable format in the |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
43 * long term. |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
44 */ |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
45 #include <sys/exec_ecoff.h> |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
46 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
47 /* Structures, constants, etc., that NetBSD defines strangely. */ |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
48 #define filehdr ecoff_filehdr |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
49 #define aouthdr ecoff_aouthdr |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
50 #define scnhdr ecoff_scnhdr |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
51 #define HDRR struct ecoff_symhdr |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
52 #define pHDRR HDRR * |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
53 #define cbHDRR sizeof(HDRR) |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
54 #define ALPHAMAGIC ECOFF_MAGIC_NETBSD_ALPHA |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
55 #define ZMAGIC ECOFF_ZMAGIC |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
56 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
57 /* Misc. constants that NetBSD doesn't define at all. */ |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
58 #define ALPHAUMAGIC 0617 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
59 #define _MIPS_NSCNS_MAX 35 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
60 #define STYP_TEXT 0x00000020 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
61 #define STYP_DATA 0x00000040 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
62 #define STYP_BSS 0x00000080 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
63 #define STYP_RDATA 0x00000100 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
64 #define STYP_SDATA 0x00000200 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
65 #define STYP_SBSS 0x00000400 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
66 #define STYP_INIT 0x80000000 |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
67 #define _TEXT ".text" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
68 #define _DATA ".data" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
69 #define _BSS ".bss" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
70 #define _INIT ".init" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
71 #define _RDATA ".rdata" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
72 #define _SDATA ".sdata" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
73 #define _SBSS ".sbss" |
8e1553706b3d
[__NetBSD__]: Don't include filehdr.h, aouthdr.h
Richard M. Stallman <rms@gnu.org>
parents:
15893
diff
changeset
|
74 #endif /* __NetBSD__ */ |
8836 | 75 |
76 static void fatal_unexec (); | |
77 static void mark_x (); | |
78 | |
79 #define READ(_fd, _buffer, _size, _error_message, _error_arg) \ | |
80 errno = EEOF; \ | |
81 if (read (_fd, _buffer, _size) != _size) \ | |
82 fatal_unexec (_error_message, _error_arg); | |
83 | |
84 #define WRITE(_fd, _buffer, _size, _error_message, _error_arg) \ | |
85 if (write (_fd, _buffer, _size) != _size) \ | |
86 fatal_unexec (_error_message, _error_arg); | |
87 | |
88 #define SEEK(_fd, _position, _error_message, _error_arg) \ | |
89 errno = EEOF; \ | |
90 if (lseek (_fd, _position, L_SET) != _position) \ | |
91 fatal_unexec (_error_message, _error_arg); | |
92 | |
93 extern int errno; | |
94 extern char *strerror (); | |
95 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
96 void *sbrk (); |
8836 | 97 |
98 #define EEOF -1 | |
99 | |
100 static struct scnhdr *text_section; | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
101 static struct scnhdr *rel_dyn_section; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
102 static struct scnhdr *dynstr_section; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
103 static struct scnhdr *dynsym_section; |
8836 | 104 static struct scnhdr *init_section; |
105 static struct scnhdr *finit_section; | |
106 static struct scnhdr *rdata_section; | |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
107 static struct scnhdr *rconst_section; |
8836 | 108 static struct scnhdr *data_section; |
109 static struct scnhdr *pdata_section; | |
110 static struct scnhdr *xdata_section; | |
111 static struct scnhdr *got_section; | |
112 static struct scnhdr *lit8_section; | |
113 static struct scnhdr *lit4_section; | |
114 static struct scnhdr *sdata_section; | |
115 static struct scnhdr *sbss_section; | |
116 static struct scnhdr *bss_section; | |
117 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
118 static struct scnhdr old_data_scnhdr; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
119 |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
120 static unsigned long Brk; |
8836 | 121 |
122 struct headers { | |
123 struct filehdr fhdr; | |
124 struct aouthdr aout; | |
125 struct scnhdr section[_MIPS_NSCNS_MAX]; | |
126 }; | |
127 | |
128 | |
129 | |
130 /* Define name of label for entry point for the dumped executable. */ | |
131 | |
132 #ifndef DEFAULT_ENTRY_ADDRESS | |
133 #define DEFAULT_ENTRY_ADDRESS __start | |
134 #endif | |
135 | |
136 unexec (new_name, a_name, data_start, bss_start, entry_address) | |
137 char *new_name, *a_name; | |
138 unsigned long data_start, bss_start, entry_address; | |
139 { | |
140 int new, old; | |
141 char * oldptr; | |
142 struct headers ohdr, nhdr; | |
143 struct stat stat; | |
144 long pagesize, brk; | |
145 long newsyms, symrel; | |
146 int nread; | |
147 int i; | |
148 long vaddr, scnptr; | |
149 #define BUFSIZE 8192 | |
150 char buffer[BUFSIZE]; | |
151 | |
152 if ((old = open (a_name, O_RDONLY)) < 0) | |
153 fatal_unexec ("opening %s", a_name); | |
154 | |
155 new = creat (new_name, 0666); | |
156 if (new < 0) fatal_unexec ("creating %s", new_name); | |
157 | |
158 if ((fstat (old, &stat) == -1)) | |
159 fatal_unexec ("fstat %s", a_name); | |
160 | |
161 oldptr = (char *)mmap (0, stat.st_size, PROT_READ, MAP_FILE|MAP_SHARED, old, 0); | |
162 | |
163 if (oldptr == (char *)-1) | |
164 fatal_unexec ("mmap %s", a_name); | |
165 | |
166 close (old); | |
167 | |
168 /* This is a copy of the a.out header of the original executable */ | |
169 | |
170 ohdr = (*(struct headers *)oldptr); | |
171 | |
172 /* This is where we build the new header from the in-memory copy */ | |
173 | |
174 nhdr = *((struct headers *)TEXT_START); | |
175 | |
176 /* First do some consistency checks */ | |
177 | |
178 if (nhdr.fhdr.f_magic != ALPHAMAGIC | |
179 && nhdr.fhdr.f_magic != ALPHAUMAGIC) | |
180 { | |
181 fprintf (stderr, "unexec: input file magic number is %x, not %x or %x.\n", | |
182 nhdr.fhdr.f_magic, ALPHAMAGIC, ALPHAUMAGIC); | |
183 exit (1); | |
184 } | |
185 | |
186 if (nhdr.fhdr.f_opthdr != sizeof (nhdr.aout)) | |
187 { | |
188 fprintf (stderr, "unexec: input a.out header is %d bytes, not %d.\n", | |
189 nhdr.fhdr.f_opthdr, sizeof (nhdr.aout)); | |
190 exit (1); | |
191 } | |
192 if (nhdr.aout.magic != ZMAGIC) | |
193 { | |
194 fprintf (stderr, "unexec: input file a.out magic number is %o, not %o.\n", | |
195 nhdr.aout.magic, ZMAGIC); | |
196 exit (1); | |
197 } | |
198 | |
199 | |
200 /* Now check the existence of certain header section and grab | |
201 their addresses. */ | |
202 | |
203 #define CHECK_SCNHDR(ptr, name, flags) \ | |
204 ptr = NULL; \ | |
205 for (i = 0; i < nhdr.fhdr.f_nscns && !ptr; i++) \ | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
206 if (strncmp (nhdr.section[i].s_name, name, 8) == 0) \ |
8836 | 207 { \ |
208 if (nhdr.section[i].s_flags != flags) \ | |
209 fprintf (stderr, "unexec: %x flags (%x expected) in %s section.\n", \ | |
210 nhdr.section[i].s_flags, flags, name); \ | |
211 ptr = nhdr.section + i; \ | |
212 } \ | |
213 | |
214 CHECK_SCNHDR (text_section, _TEXT, STYP_TEXT); | |
215 CHECK_SCNHDR (init_section, _INIT, STYP_INIT); | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
216 #ifdef _REL_DYN |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
217 CHECK_SCNHDR (rel_dyn_section, _REL_DYN, STYP_REL_DYN); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
218 #endif /* _REL_DYN */ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
219 #ifdef _DYNSYM |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
220 CHECK_SCNHDR (dynsym_section, _DYNSYM, STYP_DYNSYM); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
221 #endif /* _REL_DYN */ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
222 #ifdef _DYNSTR |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
223 CHECK_SCNHDR (dynstr_section, _DYNSTR, STYP_DYNSTR); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
224 #endif /* _REL_DYN */ |
8836 | 225 #ifdef _FINI |
226 CHECK_SCNHDR (finit_section, _FINI, STYP_FINI); | |
227 #endif /* _FINI */ | |
228 CHECK_SCNHDR (rdata_section, _RDATA, STYP_RDATA); | |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
229 #ifdef _RCONST |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
230 CHECK_SCNHDR (rconst_section, _RCONST, STYP_RCONST); |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
231 #endif |
8836 | 232 #ifdef _PDATA |
233 CHECK_SCNHDR (pdata_section, _PDATA, STYP_PDATA); | |
234 #endif _PDATA | |
235 #ifdef _GOT | |
236 CHECK_SCNHDR (got_section, _GOT, STYP_GOT); | |
237 #endif _GOT | |
238 CHECK_SCNHDR (data_section, _DATA, STYP_DATA); | |
239 #ifdef _XDATA | |
240 CHECK_SCNHDR (xdata_section, _XDATA, STYP_XDATA); | |
241 #endif /* _XDATA */ | |
242 #ifdef _LIT8 | |
243 CHECK_SCNHDR (lit8_section, _LIT8, STYP_LIT8); | |
244 CHECK_SCNHDR (lit4_section, _LIT4, STYP_LIT4); | |
245 #endif /* _LIT8 */ | |
246 CHECK_SCNHDR (sdata_section, _SDATA, STYP_SDATA); | |
247 CHECK_SCNHDR (sbss_section, _SBSS, STYP_SBSS); | |
248 CHECK_SCNHDR (bss_section, _BSS, STYP_BSS); | |
249 | |
250 | |
251 pagesize = getpagesize (); | |
252 brk = (((long) (sbrk (0))) + pagesize - 1) & (-pagesize); | |
253 | |
254 /* Remember the current break */ | |
255 | |
256 Brk = brk; | |
257 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
258 bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr)); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
259 |
8836 | 260 nhdr.aout.dsize = brk - DATA_START; |
261 nhdr.aout.bsize = 0; | |
262 if (entry_address == 0) | |
263 { | |
264 extern DEFAULT_ENTRY_ADDRESS (); | |
265 nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS; | |
266 } | |
267 else | |
268 nhdr.aout.entry = entry_address; | |
269 | |
270 nhdr.aout.bss_start = nhdr.aout.data_start + nhdr.aout.dsize; | |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
271 |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
272 if (rdata_section != NULL) |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
273 { |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
274 rdata_section->s_size = data_start - DATA_START; |
8836 | 275 |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
276 /* Adjust start and virtual addresses of rdata_section, too. */ |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
277 rdata_section->s_vaddr = DATA_START; |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
278 rdata_section->s_paddr = DATA_START; |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
279 rdata_section->s_scnptr = text_section->s_scnptr + nhdr.aout.tsize; |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
280 } |
8836 | 281 |
282 data_section->s_vaddr = data_start; | |
283 data_section->s_paddr = data_start; | |
284 data_section->s_size = brk - data_start; | |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
285 |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
286 if (rdata_section != NULL) |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
287 { |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
288 data_section->s_scnptr = rdata_section->s_scnptr + rdata_section->s_size; |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
289 } |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
290 |
8836 | 291 vaddr = data_section->s_vaddr + data_section->s_size; |
292 scnptr = data_section->s_scnptr + data_section->s_size; | |
293 if (lit8_section != NULL) | |
294 { | |
295 lit8_section->s_vaddr = vaddr; | |
296 lit8_section->s_paddr = vaddr; | |
297 lit8_section->s_size = 0; | |
298 lit8_section->s_scnptr = scnptr; | |
299 } | |
300 if (lit4_section != NULL) | |
301 { | |
302 lit4_section->s_vaddr = vaddr; | |
303 lit4_section->s_paddr = vaddr; | |
304 lit4_section->s_size = 0; | |
305 lit4_section->s_scnptr = scnptr; | |
306 } | |
307 if (sdata_section != NULL) | |
308 { | |
309 sdata_section->s_vaddr = vaddr; | |
310 sdata_section->s_paddr = vaddr; | |
311 sdata_section->s_size = 0; | |
312 sdata_section->s_scnptr = scnptr; | |
313 } | |
314 #ifdef _XDATA | |
315 if (xdata_section != NULL) | |
316 { | |
317 xdata_section->s_vaddr = vaddr; | |
318 xdata_section->s_paddr = vaddr; | |
319 xdata_section->s_size = 0; | |
320 xdata_section->s_scnptr = scnptr; | |
321 } | |
322 #endif | |
323 #ifdef _GOT | |
324 if (got_section != NULL) | |
325 { | |
15885
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
326 bcopy (got_section, buffer, sizeof (struct scnhdr)); |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
327 |
8836 | 328 got_section->s_vaddr = vaddr; |
329 got_section->s_paddr = vaddr; | |
330 got_section->s_size = 0; | |
331 got_section->s_scnptr = scnptr; | |
332 } | |
333 #endif /*_GOT */ | |
334 if (sbss_section != NULL) | |
335 { | |
336 sbss_section->s_vaddr = vaddr; | |
337 sbss_section->s_paddr = vaddr; | |
338 sbss_section->s_size = 0; | |
339 sbss_section->s_scnptr = scnptr; | |
340 } | |
341 if (bss_section != NULL) | |
342 { | |
343 bss_section->s_vaddr = vaddr; | |
344 bss_section->s_paddr = vaddr; | |
345 bss_section->s_size = 0; | |
346 bss_section->s_scnptr = scnptr; | |
347 } | |
348 | |
349 WRITE (new, (char *)TEXT_START, nhdr.aout.tsize, | |
350 "writing text section to %s", new_name); | |
351 WRITE (new, (char *)DATA_START, nhdr.aout.dsize, | |
352 "writing data section to %s", new_name); | |
353 | |
15885
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
354 #ifdef _GOT |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
355 #define old_got_section ((struct scnhdr *)buffer) |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
356 |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
357 if (got_section != NULL) |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
358 { |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
359 SEEK (new, old_got_section->s_scnptr, |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
360 "seeking to start of got_section in %s", new_name); |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
361 WRITE (new, oldptr + old_got_section->s_scnptr, old_got_section->s_size, |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
362 "writing new got_section of %s", new_name); |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
363 SEEK (new, nhdr.aout.tsize + nhdr.aout.dsize, |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
364 "seeking to end of data section of %s", new_name); |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
365 } |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
366 |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
367 #undef old_got_section |
67d9f8e91688
(unexec): Copy the .got section.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
368 #endif |
8836 | 369 |
370 /* | |
371 * Construct new symbol table header | |
372 */ | |
373 | |
374 bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR); | |
375 | |
376 #define symhdr ((pHDRR)buffer) | |
377 newsyms = nhdr.aout.tsize + nhdr.aout.dsize; | |
378 symrel = newsyms - nhdr.fhdr.f_symptr; | |
379 nhdr.fhdr.f_symptr = newsyms; | |
380 symhdr->cbLineOffset += symrel; | |
381 symhdr->cbDnOffset += symrel; | |
382 symhdr->cbPdOffset += symrel; | |
383 symhdr->cbSymOffset += symrel; | |
384 symhdr->cbOptOffset += symrel; | |
385 symhdr->cbAuxOffset += symrel; | |
386 symhdr->cbSsOffset += symrel; | |
387 symhdr->cbSsExtOffset += symrel; | |
388 symhdr->cbFdOffset += symrel; | |
389 symhdr->cbRfdOffset += symrel; | |
390 symhdr->cbExtOffset += symrel; | |
391 | |
392 WRITE (new, buffer, cbHDRR, "writing symbol table header of %s", new_name); | |
393 | |
394 /* | |
395 * Copy the symbol table and line numbers | |
396 */ | |
397 WRITE (new, oldptr + ohdr.fhdr.f_symptr + cbHDRR, | |
398 stat.st_size - ohdr.fhdr.f_symptr - cbHDRR, | |
399 "writing symbol table of %s", new_name); | |
400 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
401 #ifndef __linux__ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
402 update_dynamic_symbols (oldptr, new_name, new, nhdr.aout); |
8836 | 403 #endif |
404 | |
405 #undef symhdr | |
406 | |
407 SEEK (new, 0, "seeking to start of header in %s", new_name); | |
408 WRITE (new, &nhdr, sizeof (nhdr), | |
409 "writing header of %s", new_name); | |
410 | |
411 close (old); | |
412 close (new); | |
413 mark_x (new_name); | |
414 } | |
415 | |
416 | |
417 | |
418 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
419 #ifndef __linux__ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
420 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
421 update_dynamic_symbols (old, new_name, new, aout) |
9693
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
422 char *old; /* Pointer to old executable */ |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
423 char *new_name; /* Name of new executable */ |
b6ce6e2ccd15
(Brk): Declare as unsigned long.
Richard M. Stallman <rms@gnu.org>
parents:
8836
diff
changeset
|
424 int new; /* File descriptor for new executable */ |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
425 struct aouthdr aout; /* a.out info from the file header */ |
8836 | 426 { |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
427 typedef struct dynrel_info { |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
428 char * addr; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
429 unsigned type:8; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
430 unsigned index:24; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
431 unsigned info:8; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
432 unsigned pad:8; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
433 } dr_info; |
8836 | 434 |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
435 int nsyms = rel_dyn_section->s_size / sizeof (struct dynrel_info); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
436 int i; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
437 dr_info * rd_base = (dr_info *) (old + rel_dyn_section->s_scnptr); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
438 Elf32_Sym * ds_base = (Elf32_Sym *) (old + dynsym_section->s_scnptr); |
8836 | 439 |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
440 for (i = 0; i < nsyms; i++) { |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
441 register Elf32_Sym x; |
8836 | 442 |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
443 if (rd_base[i].index == 0) |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
444 continue; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
445 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
446 x = ds_base[rd_base[i].index]; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
447 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
448 #if 0 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
449 fprintf (stderr, "Object inspected: %s, addr = %lx, shndx = %x", |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
450 old + dynstr_section->s_scnptr + x.st_name, rd_base[i].addr, x.st_shndx); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
451 #endif |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
452 |
8836 | 453 |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
454 if ((ELF32_ST_BIND (x.st_info) == STB_GLOBAL) |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
455 && (x.st_shndx == 0) |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
456 /* && (x.st_value == NULL) */ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
457 ) { |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
458 /* OK, this is probably a reference to an object in a shared |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
459 library, so copy the old value. This is done in several steps: |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
460 1. reladdr is the address of the location in question relative to |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
461 the start of the data section, |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
462 2. oldref is the addr is the mapped in temacs executable, |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
463 3. newref is the address of the location in question in the |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
464 undumped executable, |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
465 4. len is the size of the object reference in bytes -- |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
466 currently only 4 (long) and 8 (quad) are supported. |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
467 */ |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
468 register unsigned long reladdr = rd_base[i].addr - old_data_scnhdr.s_vaddr; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
469 char * oldref = old + old_data_scnhdr.s_scnptr + reladdr; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
470 unsigned long newref = aout.tsize + reladdr; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
471 int len; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
472 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
473 #if 0 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
474 fprintf (stderr, "...relocated\n"); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
475 #endif |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
476 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
477 if (rd_base[i].type == R_REFLONG) |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
478 len = 4; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
479 else if (rd_base[i].type == R_REFQUAD) |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
480 len = 8; |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
481 else |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
482 fatal_unexec ("unrecognized relocation type in .dyn.rel section (symbol #%d)", i); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
483 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
484 SEEK (new, newref, "seeking to dynamic symbol in %s", new_name); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
485 WRITE (new, oldref, len, "writing old dynrel info in %s", new_name); |
8836 | 486 } |
487 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
488 #if 0 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
489 else |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
490 fprintf (stderr, "...not relocated\n"); |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
491 #endif |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
492 |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
493 } |
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
494 |
8836 | 495 } |
496 | |
15893
56d0b28891da
Conditionalize the changes below on not __linux__.
Richard M. Stallman <rms@gnu.org>
parents:
15885
diff
changeset
|
497 #endif /* !__linux__ */ |
8836 | 498 |
499 | |
500 /* | |
501 * mark_x | |
502 * | |
503 * After successfully building the new a.out, mark it executable | |
504 */ | |
505 | |
506 static void | |
507 mark_x (name) | |
508 char *name; | |
509 { | |
510 struct stat sbuf; | |
511 int um = umask (777); | |
512 umask (um); | |
513 if (stat (name, &sbuf) < 0) | |
514 fatal_unexec ("getting protection on %s", name); | |
515 sbuf.st_mode |= 0111 & ~um; | |
516 if (chmod (name, sbuf.st_mode) < 0) | |
517 fatal_unexec ("setting protection on %s", name); | |
518 } | |
519 | |
520 static void | |
13512
738750464578
(fatal_unexec): Don't use varargs.
Richard M. Stallman <rms@gnu.org>
parents:
12826
diff
changeset
|
521 fatal_unexec (s, arg) |
738750464578
(fatal_unexec): Don't use varargs.
Richard M. Stallman <rms@gnu.org>
parents:
12826
diff
changeset
|
522 char *s; |
738750464578
(fatal_unexec): Don't use varargs.
Richard M. Stallman <rms@gnu.org>
parents:
12826
diff
changeset
|
523 char *arg; |
8836 | 524 { |
525 if (errno == EEOF) | |
526 fputs ("unexec: unexpected end of file, ", stderr); | |
527 else | |
528 fprintf (stderr, "unexec: %s, ", strerror (errno)); | |
13512
738750464578
(fatal_unexec): Don't use varargs.
Richard M. Stallman <rms@gnu.org>
parents:
12826
diff
changeset
|
529 fprintf (stderr, s, arg); |
8836 | 530 fputs (".\n", stderr); |
531 exit (1); | |
532 } |