Lines 78-83
Link Here
|
78 |
#endif |
78 |
#endif |
79 |
#endif |
79 |
#endif |
80 |
|
80 |
|
|
|
81 |
#ifdef HAVE_PERSONALITY_LINUX32 |
82 |
#include <sys/personality.h> |
83 |
#endif |
84 |
|
81 |
#ifndef O_RDWR |
85 |
#ifndef O_RDWR |
82 |
#define O_RDWR 2 |
86 |
#define O_RDWR 2 |
83 |
#endif |
87 |
#endif |
Lines 110-115
Link Here
|
110 |
int xargc; |
114 |
int xargc; |
111 |
#endif /* HAVE_X_WINDOWS */ |
115 |
#endif /* HAVE_X_WINDOWS */ |
112 |
|
116 |
|
|
|
117 |
/* The address where the heap starts (from the first sbrk (0) call). */ |
118 |
static void *my_heap_start; |
119 |
|
120 |
/* The gap between BSS end and heap start as far as we can tell. */ |
121 |
static unsigned long heap_bss_diff; |
122 |
|
123 |
/* If the gap between BSS end and heap start is larger than this we try to |
124 |
work around it, and if that fails, output a warning in dump-emacs. */ |
125 |
#define MAX_HEAP_BSS_DIFF (1024*1024) |
126 |
|
113 |
#ifdef USG_SHARED_LIBRARIES |
127 |
#ifdef USG_SHARED_LIBRARIES |
114 |
/* If nonzero, this is the place to put the end of the writable segment |
128 |
/* If nonzero, this is the place to put the end of the writable segment |
115 |
at startup. */ |
129 |
at startup. */ |
Lines 241-247
Link Here
|
241 |
int skip_args = 0; |
255 |
int skip_args = 0; |
242 |
extern int errno; |
256 |
extern int errno; |
243 |
extern void malloc_warning (); |
257 |
extern void malloc_warning (); |
|
|
258 |
extern char *sbrk (); |
244 |
|
259 |
|
|
|
260 |
if (!initialized) |
261 |
{ |
262 |
extern char my_endbss[]; |
263 |
extern char *my_endbss_static; |
264 |
|
265 |
if (my_heap_start == 0) |
266 |
my_heap_start = sbrk (0); |
267 |
|
268 |
heap_bss_diff = (char *)my_heap_start |
269 |
- (my_endbss > my_endbss_static ? my_endbss : my_endbss_static); |
270 |
} |
271 |
|
272 |
#ifdef HAVE_PERSONALITY_LINUX32 |
273 |
/* See if there is a gap between the end of BSS and the heap. |
274 |
In that case, set personality and exec ourself again. */ |
275 |
if (!initialized |
276 |
&& strcmp (argv[argc-1], "dump") == 0 |
277 |
&& heap_bss_diff > MAX_HEAP_BSS_DIFF) |
278 |
{ |
279 |
if (! getenv ("EMACS_HEAP_EXEC")) |
280 |
{ |
281 |
/* Set this so we only do this once. */ |
282 |
putenv("EMACS_HEAP_EXEC=true"); |
283 |
|
284 |
/* A flag to turn off address randomization which is introduced |
285 |
in linux kernel shipped with fedora core 4 */ |
286 |
#define ADD_NO_RANDOMIZE 0x0040000 |
287 |
personality (PER_LINUX32 | ADD_NO_RANDOMIZE); |
288 |
#undef ADD_NO_RANDOMIZE |
289 |
|
290 |
execvp (argv[0], argv); |
291 |
|
292 |
/* If the exec fails, try to dump anyway. */ |
293 |
perror ("execvp"); |
294 |
} |
295 |
} |
296 |
#endif /* HAVE_PERSONALITY_LINUX32 */ |
297 |
|
245 |
/* Map in shared memory, if we are using that. */ |
298 |
/* Map in shared memory, if we are using that. */ |
246 |
#ifdef HAVE_SHM |
299 |
#ifdef HAVE_SHM |
247 |
if (argc > 1 && !strcmp (argv[1], "-nl")) |
300 |
if (argc > 1 && !strcmp (argv[1], "-nl")) |