428
|
1 /* unexec for GNU Emacs on Cygwin32.
|
|
2 Copyright (C) 1994, 1998 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to the Free
|
|
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
19 02111-1307, USA.
|
|
20
|
|
21 */
|
|
22
|
|
23 /* This is a complete rewrite, some code snarfed from unexnt.c and
|
|
24 unexec.c, Andy Piper (andy@xemacs.org) 13-1-98 */
|
|
25
|
448
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
|
28
|
442
|
29 #define DONT_ENCAPSULATE /* filenames are external in unex*.c */
|
428
|
30 #include "sysfile.h"
|
442
|
31
|
546
|
32 #define PERROR(arg) \
|
|
33 do { \
|
|
34 perror (arg); \
|
|
35 exit (-1); \
|
|
36 } while (0)
|
428
|
37
|
546
|
38 #if !defined (HAVE_A_OUT_H) && !defined (WIN32_NATIVE)
|
428
|
39 unexec (char *, char *, void *, void *, void *)
|
|
40 {
|
|
41 PERROR("cannot unexec() a.out.h not installed");
|
|
42 }
|
|
43 #else
|
|
44
|
546
|
45 #ifdef MINGW
|
|
46 #include <../../include/a.out.h>
|
|
47 #else
|
428
|
48 #include <a.out.h>
|
546
|
49 #endif
|
428
|
50
|
|
51 #define ALLOC_UNIT 0xFFFF
|
|
52 #define ALLOC_MASK ~((unsigned long)(ALLOC_UNIT))
|
|
53 #define ALIGN_ALLOC(addr) \
|
|
54 ((((unsigned long)addr) + ALLOC_UNIT) & ALLOC_MASK)
|
444
|
55 /* Note that all sections must be aligned on a 0x1000 boundary so
|
|
56 this is the minimum size that our dummy bss can be. */
|
448
|
57 #ifndef NO_DEBUG
|
444
|
58 #define BSS_PAD_SIZE 0x1000
|
446
|
59 #else
|
|
60 #define BSS_PAD_SIZE 0
|
|
61 #endif
|
428
|
62
|
|
63 /* To prevent zero-initialized variables from being placed into the bss
|
|
64 section, use non-zero values to represent an uninitialized state. */
|
|
65 #define UNINIT_PTR ((void *) 0xF0A0F0A0)
|
|
66 #define UNINIT_LONG (0xF0A0F0A0L)
|
|
67
|
|
68 static void get_section_info (int a_out, char* a_name);
|
|
69 static void copy_executable_and_dump_data_section (int a_out, int a_new);
|
|
70 static void dup_file_area(int a_out, int a_new, long size);
|
|
71 #if 0
|
|
72 static void write_int_to_bss(int a_out, int a_new, void* va, void* newval);
|
|
73 #endif
|
|
74
|
|
75 /* Cached info about the .data section in the executable. */
|
|
76 void* data_start_va = UNINIT_PTR;
|
|
77 unsigned long data_size = UNINIT_LONG;
|
|
78
|
|
79 /* Cached info about the .bss section in the executable. */
|
|
80 void* bss_start = UNINIT_PTR;
|
|
81 unsigned long bss_size = UNINIT_LONG;
|
|
82 int sections_reversed = 0;
|
|
83 FILHDR f_hdr;
|
|
84 PEAOUTHDR f_ohdr;
|
|
85 SCNHDR f_data, f_bss, f_text, f_nextdata;
|
|
86
|
558
|
87 #define CHECK_AOUT_POS(a) \
|
|
88 if (lseek(a_out, 0, SEEK_CUR) != a) \
|
|
89 { \
|
|
90 printf("we are at %lx, should be at %lx\n", \
|
|
91 lseek(a_out, 0, SEEK_CUR), a); \
|
|
92 exit(-1); \
|
428
|
93 }
|
|
94
|
|
95 /* Dump out .data and .bss sections into a new executable. */
|
448
|
96 int
|
|
97 unexec (char *out_name, char *in_name, uintptr_t start_data,
|
|
98 uintptr_t d1, uintptr_t d2)
|
428
|
99 {
|
|
100 /* ugly nt hack - should be in lisp */
|
|
101 int a_new, a_out = -1;
|
558
|
102 char new_name[PATH_MAX], a_name[PATH_MAX];
|
428
|
103 char *ptr;
|
|
104
|
|
105 /* Make sure that the input and output filenames have the
|
|
106 ".exe" extension...patch them up if they don't. */
|
|
107 strcpy (a_name, in_name);
|
|
108 ptr = a_name + strlen (a_name) - 4;
|
|
109 if (strcmp (ptr, ".exe"))
|
|
110 strcat (a_name, ".exe");
|
|
111
|
|
112 strcpy (new_name, out_name);
|
|
113 ptr = new_name + strlen (new_name) - 4;
|
|
114 if (strcmp (ptr, ".exe"))
|
|
115 strcat (new_name, ".exe");
|
|
116
|
|
117 /* We need to round off our heap to NT's allocation unit (64KB). */
|
|
118 /* round_heap (get_allocation_unit ()); */
|
|
119
|
|
120 if (a_name && (a_out = open (a_name, O_RDONLY | OPEN_BINARY)) < 0)
|
558
|
121 PERROR (a_name);
|
428
|
122
|
|
123 if ((a_new = open (new_name, O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
|
446
|
124 0755)) < 0)
|
558
|
125 PERROR (new_name);
|
428
|
126
|
|
127 /* Get the interesting section info, like start and size of .bss... */
|
|
128 get_section_info (a_out, a_name);
|
|
129
|
|
130 copy_executable_and_dump_data_section (a_out, a_new);
|
|
131
|
|
132 close(a_out);
|
|
133 close(a_new);
|
448
|
134 return 0;
|
428
|
135 }
|
|
136
|
|
137 /* Flip through the executable and cache the info necessary for dumping. */
|
558
|
138 static void
|
|
139 get_section_info (int a_out, char* a_name)
|
428
|
140 {
|
448
|
141 extern char my_ebss[];
|
428
|
142 /* From lastfile.c */
|
|
143 extern char my_edata[];
|
|
144
|
|
145 if (read (a_out, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr))
|
558
|
146 PERROR (a_name);
|
428
|
147
|
|
148 if (f_hdr.e_magic != DOSMAGIC)
|
558
|
149 PERROR("unknown exe header");
|
428
|
150
|
|
151 /* Check the NT header signature ... */
|
|
152 if (f_hdr.nt_signature != NT_SIGNATURE)
|
558
|
153 PERROR("invalid nt header");
|
428
|
154
|
|
155 /* Flip through the sections for .data and .bss ... */
|
|
156 if (f_hdr.f_opthdr > 0)
|
|
157 {
|
|
158 if (read (a_out, &f_ohdr, AOUTSZ) != AOUTSZ)
|
558
|
159 PERROR (a_name);
|
428
|
160 }
|
|
161 /* Loop through .data & .bss section headers, copying them in.
|
|
162 With newer lds these are reversed so we have to cope with both */
|
|
163 lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
|
|
164
|
|
165 if (read (a_out, &f_text, sizeof (f_text)) != sizeof (f_text)
|
558
|
166 || strcmp (f_text.s_name, ".text"))
|
|
167 PERROR ("no .text section");
|
428
|
168
|
|
169 /* The .bss section. */
|
|
170 if (read (a_out, &f_bss, sizeof (f_bss)) != sizeof (f_bss)
|
558
|
171 || (strcmp (f_bss.s_name, ".bss") && strcmp (f_bss.s_name, ".data")))
|
|
172 PERROR ("no .bss / .data section");
|
428
|
173
|
|
174 /* check for reversed .bss and .data */
|
|
175 if (!strcmp(f_bss.s_name, ".data"))
|
|
176 {
|
|
177 printf(".data and .bss reversed\n");
|
|
178 sections_reversed = 1;
|
|
179 memcpy(&f_data, &f_bss, sizeof(f_bss));
|
|
180 }
|
|
181
|
|
182 /* The .data section. */
|
|
183 if (!sections_reversed)
|
|
184 {
|
|
185 if (read (a_out, &f_data, sizeof (f_data)) != sizeof (f_data)
|
558
|
186 || strcmp (f_data.s_name, ".data"))
|
|
187 PERROR ("no .data section");
|
428
|
188 }
|
|
189 else
|
|
190 {
|
|
191 if (read (a_out, &f_bss, sizeof (f_bss)) != sizeof (f_bss)
|
558
|
192 || strcmp (f_bss.s_name, ".bss"))
|
|
193 PERROR ("no .bss section");
|
428
|
194 }
|
|
195
|
|
196 bss_start = (void *) ((char*)f_ohdr.ImageBase + f_bss.s_vaddr);
|
|
197 bss_size = (unsigned long)((char*)&my_ebss-(char*)bss_start);
|
|
198
|
|
199 /* must keep bss data that we want to be blank as blank */
|
|
200 printf("found bss - keeping %lx of %lx bytes\n", bss_size, f_ohdr.bsize);
|
|
201
|
|
202 /* The .data section. */
|
|
203 data_start_va = (void *) ((char*)f_ohdr.ImageBase + f_data.s_vaddr);
|
|
204
|
|
205 /* We want to only write Emacs data back to the executable,
|
|
206 not any of the library data (if library data is included,
|
|
207 then a dumped Emacs won't run on system versions other
|
|
208 than the one Emacs was dumped on). */
|
|
209 data_size = (unsigned long)my_edata - (unsigned long)data_start_va;
|
|
210 printf("found data - keeping %lx of %lx bytes\n", data_size, f_ohdr.dsize);
|
|
211
|
|
212 /* The following data section - often .idata */
|
|
213 if (read (a_out, &f_nextdata, sizeof (f_nextdata)) != sizeof (f_nextdata)
|
|
214 &&
|
|
215 strcmp (&f_nextdata.s_name[2], "data"))
|
558
|
216 PERROR ("no other data section");
|
428
|
217 }
|
|
218
|
|
219 /* The dump routines. */
|
|
220
|
|
221 static void
|
|
222 copy_executable_and_dump_data_section (int a_out, int a_new)
|
|
223 {
|
|
224 long size=0;
|
|
225 unsigned long new_data_size, new_bss_size,
|
558
|
226 bss_padding, file_sz_change, data_padding=0,
|
|
227 f_data_s_vaddr = f_data.s_vaddr,
|
|
228 f_data_s_scnptr = f_data.s_scnptr,
|
|
229 f_bss_s_vaddr = f_bss.s_vaddr,
|
|
230 f_nextdata_s_scnptr = f_nextdata.s_scnptr;
|
428
|
231
|
|
232 int i;
|
|
233 void* empty_space;
|
|
234 extern int static_heap_dumped;
|
|
235 SCNHDR section;
|
444
|
236 /* calculate new sizes:
|
558
|
237
|
444
|
238 f_ohdr.dsize is the total initialized data size on disk which is
|
|
239 f_data.s_size + f_idata.s_size.
|
558
|
240
|
444
|
241 f_ohdr.data_start is the base addres of all data and so should
|
|
242 not be changed.
|
|
243
|
|
244 *.s_vaddr is the virtual address of the start of the section
|
|
245 *normalized from f_ohdr.ImageBase.
|
558
|
246
|
444
|
247 *.s_paddr appears to be the number of bytes in the section
|
|
248 *actually used (whereas *.s_size is aligned).
|
558
|
249
|
428
|
250 bsize is now 0 since subsumed into .data
|
|
251 dsize is dsize + (f_data.s_vaddr - f_bss.s_vaddr)
|
|
252 f_data.s_vaddr is f_bss.s_vaddr
|
|
253 f_data.s_size is new dsize maybe.
|
|
254 what about s_paddr & s_scnptr? */
|
|
255
|
|
256 /* this is the amount the file increases in size */
|
|
257 if (!sections_reversed)
|
|
258 {
|
|
259 new_bss_size = f_data.s_vaddr - f_bss.s_vaddr;
|
|
260 data_padding = 0;
|
|
261 }
|
|
262 else
|
|
263 {
|
|
264 new_bss_size = f_nextdata.s_vaddr - f_bss.s_vaddr;
|
|
265 data_padding = (f_bss.s_vaddr - f_data.s_vaddr) - f_data.s_size;
|
|
266 }
|
|
267
|
448
|
268 if ((new_bss_size - bss_size) < BSS_PAD_SIZE)
|
558
|
269 PERROR (".bss free space too small");
|
448
|
270
|
444
|
271 file_sz_change=(new_bss_size + data_padding) - BSS_PAD_SIZE;
|
428
|
272 new_data_size=f_ohdr.dsize + file_sz_change;
|
|
273
|
|
274 if (!sections_reversed)
|
558
|
275 f_data.s_vaddr = f_bss.s_vaddr;
|
428
|
276 f_data.s_paddr += file_sz_change;
|
|
277 #if 0
|
|
278 if (f_data.s_size + f_nextdata.s_size != f_ohdr.dsize)
|
558
|
279 printf("section size doesn't tally with dsize %lx != %lx\n",
|
|
280 f_data.s_size + f_nextdata.s_size, f_ohdr.dsize);
|
428
|
281 #endif
|
|
282 f_data.s_size += file_sz_change;
|
|
283 lseek (a_new, 0, SEEK_SET);
|
|
284 /* write file header */
|
|
285 f_hdr.f_symptr += file_sz_change;
|
448
|
286 #ifdef NO_DEBUG
|
446
|
287 f_hdr.f_nscns--;
|
|
288 #endif
|
444
|
289
|
428
|
290 printf("writing file header\n");
|
|
291 if (write(a_new, &f_hdr, sizeof(f_hdr)) != sizeof(f_hdr))
|
558
|
292 PERROR("failed to write file header");
|
428
|
293 /* write optional header fixing dsize & bsize*/
|
|
294 printf("writing optional header\n");
|
|
295 printf("new data size is %lx, >= %lx\n", new_data_size,
|
|
296 f_ohdr.dsize + f_ohdr.bsize);
|
|
297 if (new_data_size < f_ohdr.dsize + f_ohdr.bsize )
|
558
|
298 printf("warning: new data size is < approx\n");
|
428
|
299 f_ohdr.dsize=new_data_size;
|
444
|
300 f_ohdr.bsize=BSS_PAD_SIZE;
|
428
|
301 if (write(a_new, &f_ohdr, sizeof(f_ohdr)) != sizeof(f_ohdr))
|
558
|
302 PERROR("failed to write optional header");
|
428
|
303 /* write text as is */
|
|
304 printf("writing text header (unchanged)\n");
|
|
305
|
|
306 if (write(a_new, &f_text, sizeof(f_text)) != sizeof(f_text))
|
558
|
307 PERROR("failed to write text header");
|
448
|
308 #ifndef NO_DEBUG
|
444
|
309 /* Write small bss section. */
|
|
310 if (!sections_reversed)
|
|
311 {
|
|
312 f_bss.s_size = BSS_PAD_SIZE;
|
|
313 f_bss.s_paddr = BSS_PAD_SIZE;
|
|
314 f_bss.s_vaddr = f_data.s_vaddr - BSS_PAD_SIZE;
|
|
315 if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
|
558
|
316 PERROR("failed to write bss header");
|
444
|
317 }
|
446
|
318 #endif
|
428
|
319 /* write new data header */
|
|
320 printf("writing .data header\n");
|
|
321
|
|
322 if (write(a_new, &f_data, sizeof(f_data)) != sizeof(f_data))
|
558
|
323 PERROR("failed to write data header");
|
448
|
324 #ifndef NO_DEBUG
|
444
|
325 /* Write small bss section. */
|
|
326 if (sections_reversed)
|
|
327 {
|
|
328 f_bss.s_size = BSS_PAD_SIZE;
|
|
329 f_bss.s_paddr = BSS_PAD_SIZE;
|
|
330 f_bss.s_vaddr = f_nextdata.s_vaddr - BSS_PAD_SIZE;
|
|
331 if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
|
558
|
332 PERROR("failed to write bss header");
|
444
|
333 }
|
446
|
334 #endif
|
428
|
335 printf("writing following data header\n");
|
|
336 f_nextdata.s_scnptr += file_sz_change;
|
|
337 if (f_nextdata.s_lnnoptr != 0) f_nextdata.s_lnnoptr += file_sz_change;
|
|
338 if (f_nextdata.s_relptr != 0) f_nextdata.s_relptr += file_sz_change;
|
|
339 if (write(a_new, &f_nextdata, sizeof(f_nextdata)) != sizeof(f_nextdata))
|
558
|
340 PERROR("failed to write nextdata header");
|
428
|
341
|
|
342 /* copy other section headers adjusting the file offset */
|
|
343 for (i=0; i<(f_hdr.f_nscns-3); i++)
|
|
344 {
|
|
345 if (read (a_out, §ion, sizeof (section)) != sizeof (section))
|
558
|
346 PERROR ("no .data section");
|
428
|
347
|
|
348 section.s_scnptr += file_sz_change;
|
|
349 if (section.s_lnnoptr != 0) section.s_lnnoptr += file_sz_change;
|
|
350 if (section.s_relptr != 0) section.s_relptr += file_sz_change;
|
|
351
|
|
352 if (write(a_new, §ion, sizeof(section)) != sizeof(section))
|
558
|
353 PERROR("failed to write data header");
|
428
|
354 }
|
448
|
355 #ifdef NO_DEBUG
|
446
|
356 /* dump bss to maintain offsets */
|
|
357 memset(&f_bss, 0, sizeof(f_bss));
|
|
358 if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
|
558
|
359 PERROR("failed to write bss header");
|
446
|
360 #endif
|
428
|
361 size=lseek(a_new, 0, SEEK_CUR);
|
|
362 CHECK_AOUT_POS(size);
|
|
363
|
|
364 /* copy eveything else until start of data */
|
|
365 size = f_data_s_scnptr - lseek (a_out, 0, SEEK_CUR);
|
|
366
|
|
367 printf ("copying executable up to data section ... %lx bytes\n",
|
|
368 size);
|
|
369 dup_file_area(a_out, a_new, size);
|
|
370
|
|
371 CHECK_AOUT_POS(f_data_s_scnptr);
|
|
372
|
|
373 if (!sections_reversed)
|
|
374 {
|
444
|
375 /* dump bss + padding between sections, sans small bss pad */
|
428
|
376 printf ("dumping .bss into executable... %lx bytes\n", bss_size);
|
|
377 if (write(a_new, bss_start, bss_size) != (int)bss_size)
|
|
378 {
|
|
379 PERROR("failed to write bss section");
|
|
380 }
|
|
381
|
|
382 /* pad, needs to be zero */
|
444
|
383 bss_padding = (new_bss_size - bss_size) - BSS_PAD_SIZE;
|
|
384 if (bss_padding < 0)
|
558
|
385 PERROR("padded .bss too small");
|
428
|
386 printf ("padding .bss ... %lx bytes\n", bss_padding);
|
|
387 empty_space = malloc(bss_padding);
|
|
388 memset(empty_space, 0, bss_padding);
|
|
389 if (write(a_new, empty_space, bss_padding) != (int)bss_padding)
|
558
|
390 PERROR("failed to write bss section");
|
428
|
391 free(empty_space);
|
|
392 }
|
|
393
|
|
394 /* tell dumped version not to free pure heap */
|
|
395 static_heap_dumped = 1;
|
|
396 /* Get a pointer to the raw data in our address space. */
|
|
397 printf ("dumping .data section... %lx bytes\n", data_size);
|
|
398 if (write(a_new, data_start_va, data_size) != (int)data_size)
|
558
|
399 PERROR("failed to write data section");
|
428
|
400 /* were going to use free again ... */
|
|
401 static_heap_dumped = 0;
|
|
402
|
|
403 size = lseek(a_out, f_data_s_scnptr + data_size, SEEK_SET);
|
|
404
|
|
405 if (!sections_reversed)
|
|
406 {
|
|
407 size = f_nextdata_s_scnptr - size;
|
|
408 dup_file_area(a_out, a_new, size);
|
|
409 }
|
|
410 else
|
|
411 {
|
444
|
412 /* need to pad to bss with data in file */
|
428
|
413 printf ("padding .data ... %lx bytes\n", data_padding);
|
|
414 size = (f_bss_s_vaddr - f_data_s_vaddr) - data_size;
|
|
415 dup_file_area(a_out, a_new, size);
|
|
416
|
|
417 /* dump bss + padding between sections */
|
|
418 printf ("dumping .bss into executable... %lx bytes\n", bss_size);
|
|
419 if (write(a_new, bss_start, bss_size) != (int)bss_size)
|
558
|
420 PERROR("failed to write bss section");
|
428
|
421
|
|
422 /* pad, needs to be zero */
|
444
|
423 bss_padding = (new_bss_size - bss_size) - BSS_PAD_SIZE;
|
|
424 if (bss_padding < 0)
|
558
|
425 PERROR("padded .bss too small");
|
428
|
426 printf ("padding .bss ... %lx bytes\n", bss_padding);
|
|
427 empty_space = malloc(bss_padding);
|
|
428 memset(empty_space, 0, bss_padding);
|
|
429 if (write(a_new, empty_space, bss_padding) != (int)bss_padding)
|
558
|
430 PERROR("failed to write bss section");
|
428
|
431 free(empty_space);
|
|
432 if (lseek(a_new, 0, SEEK_CUR) != f_nextdata.s_scnptr)
|
|
433 {
|
|
434 printf("at %lx should be at %lx\n",
|
|
435 lseek(a_new, 0, SEEK_CUR),
|
|
436 f_nextdata.s_scnptr);
|
|
437 PERROR("file positioning error\n");
|
|
438 }
|
|
439 lseek(a_out, f_nextdata_s_scnptr, SEEK_SET);
|
|
440 }
|
|
441
|
|
442 CHECK_AOUT_POS(f_nextdata_s_scnptr);
|
|
443
|
|
444 /* now dump - nextdata don't need to do this cygwin ds is in .data! */
|
|
445 printf ("dumping following data section... %lx bytes\n", f_nextdata.s_size);
|
|
446
|
|
447 dup_file_area(a_out,a_new,f_nextdata.s_size);
|
|
448
|
|
449 /* write rest of file */
|
|
450 printf ("writing rest of file\n");
|
|
451 size = lseek(a_out, 0, SEEK_END);
|
|
452 size = size - (f_nextdata_s_scnptr + f_nextdata.s_size); /* length remaining in a_out */
|
|
453 lseek(a_out, f_nextdata_s_scnptr + f_nextdata.s_size, SEEK_SET);
|
|
454
|
|
455 dup_file_area(a_out, a_new, size);
|
|
456 }
|
|
457
|
|
458 /*
|
|
459 * copy from aout to anew
|
|
460 */
|
|
461 static void dup_file_area(int a_out, int a_new, long size)
|
|
462 {
|
|
463 char page[BUFSIZ];
|
|
464 long n;
|
|
465 for (; size > 0; size -= sizeof (page))
|
|
466 {
|
|
467 n = size > sizeof (page) ? sizeof (page) : size;
|
|
468 if (read (a_out, page, n) != n || write (a_new, page, n) != n)
|
558
|
469 PERROR ("dump_out()");
|
428
|
470 }
|
|
471 }
|
|
472
|
|
473 #if 0
|
|
474 static void write_int_to_bss(int a_out, int a_new, void* va, void* newval)
|
|
475 {
|
|
476 int cpos;
|
|
477
|
|
478 cpos = lseek(a_new, 0, SEEK_CUR);
|
|
479 if (va < bss_start || va > bss_start + f_data.s_size)
|
558
|
480 PERROR("address not in data space\n");
|
428
|
481 lseek(a_new, f_data.s_scnptr + ((unsigned long)va -
|
|
482 (unsigned long)bss_start), SEEK_SET);
|
|
483 if (write(a_new, newval, sizeof(int)) != (int)sizeof(int))
|
558
|
484 PERROR("failed to write int value");
|
428
|
485 lseek(a_new, cpos, SEEK_SET);
|
|
486 }
|
|
487 #endif
|
|
488
|
|
489 #endif /* HAVE_A_OUT_H */
|