comparison src/unexcw.c @ 1198:c1e69bcf8d07

[xemacs-hg @ 2003-01-10 14:12:40 by youngs] 2003-01-08 Andy Piper <andy@xemacs.org> * unexcw.c (copy_executable_and_dump_data_section): Set the stack reserve size during unexec().
author youngs
date Fri, 10 Jan 2003 14:12:41 +0000
parents 184461bc8de4
children 29c45c1b64f3
comparison
equal deleted inserted replaced
1197:4ba5a507627c 1198:c1e69bcf8d07
45 #include <../../include/a.out.h> 45 #include <../../include/a.out.h>
46 #else 46 #else
47 #include <a.out.h> 47 #include <a.out.h>
48 #endif 48 #endif
49 49
50 #define STACK_SIZE 0x800000
50 #define ALLOC_UNIT 0xFFFF 51 #define ALLOC_UNIT 0xFFFF
51 #define ALLOC_MASK ~((unsigned long) (ALLOC_UNIT)) 52 #define ALLOC_MASK ~((unsigned long) (ALLOC_UNIT))
52 #define ALIGN_ALLOC(addr) \ 53 #define ALIGN_ALLOC(addr) \
53 ((((unsigned long) addr) + ALLOC_UNIT) & ALLOC_MASK) 54 ((((unsigned long) addr) + ALLOC_UNIT) & ALLOC_MASK)
54 /* Note that all sections must be aligned on a 0x1000 boundary so 55 /* Note that all sections must be aligned on a 0x1000 boundary so
300 f_ohdr.dsize + f_ohdr.bsize); 301 f_ohdr.dsize + f_ohdr.bsize);
301 if (new_data_size < (long) (f_ohdr.dsize + f_ohdr.bsize)) 302 if (new_data_size < (long) (f_ohdr.dsize + f_ohdr.bsize))
302 printf ("warning: new data size is < approx\n"); 303 printf ("warning: new data size is < approx\n");
303 f_ohdr.dsize=new_data_size; 304 f_ohdr.dsize=new_data_size;
304 f_ohdr.bsize=BSS_PAD_SIZE; 305 f_ohdr.bsize=BSS_PAD_SIZE;
306 /* Prevent stack overflow with regexp usage. */
307 f_ohdr.SizeOfStackReserve = STACK_SIZE;
308
305 if (write (a_new, &f_ohdr, sizeof (f_ohdr)) != sizeof (f_ohdr)) 309 if (write (a_new, &f_ohdr, sizeof (f_ohdr)) != sizeof (f_ohdr))
306 PERROR ("failed to write optional header"); 310 PERROR ("failed to write optional header");
307 /* write text as is */ 311 /* write text as is */
308 printf ("writing text header (unchanged)\n"); 312 printf ("writing text header (unchanged)\n");
309 313