Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 221281 | Differences between
and this patch

Collapse All | Expand All

(-)emacs-18.59-orig/src/ChangeLog (+15 lines)
Lines 1-3 Link Here
1
2008-05-11  Ulrich Mueller  <ulm@gentoo.org>
2
3
	* emacs.c: Handle gap between end of BSS and heap, backported
4
	from Emacs 22. Original changes by Jan Djarv and Masatake YAMATO.
5
	This fixes dumping on Linux 2.6.25.
6
	(my_heap_start, heap_bss_diff, MAX_HEAP_BSS_DIFF): New variables
7
	and constant.
8
	(main): Calculate heap_bss_diff.  If we are dumping and the
9
	heap_bss_diff is greater than MAX_HEAP_BSS_DIFF, set PER_LINUX32
10
	and ADD_NO_RANDOMIZE and exec ourself again.
11
12
	* lastfile.c: (my_endbss, my_endbss_static) New variables.
13
14
	* s-linux.h (HAVE_PERSONALITY_LINUX32): Define.
15
1
2007-01-30  Ulrich Mueller  <ulm@kph.uni-mainz.de>
16
2007-01-30  Ulrich Mueller  <ulm@kph.uni-mainz.de>
2
17
3
	* x11term.c (internal_socket_read): Handle XK_BackSpace key.
18
	* x11term.c (internal_socket_read): Handle XK_BackSpace key.
(-)emacs-18.59-orig/src/emacs.c (+53 lines)
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"))
(-)emacs-18.59-orig/src/lastfile.c (+10 lines)
Lines 41-43 Link Here
41
#endif
41
#endif
42
42
43
char my_edata = 0;
43
char my_edata = 0;
44
45
/* Help unexec locate the end of the .bss area used by Emacs (which
46
   isn't always a separate section in NT executables).  */
47
char my_endbss[1];
48
49
/* The Alpha MSVC linker globally segregates all static and public bss
50
   data, so we must take both into account to determine the true extent
51
   of the bss area used by Emacs.  */
52
static char _my_endbss[1];
53
char * my_endbss_static = _my_endbss;
(-)emacs-18.59-orig/src/s-linux.h (+1 lines)
Lines 161-166 Link Here
161
#define HAVE_SYS_SIGLIST	/* we have a (non-standard) sys_siglist */
161
#define HAVE_SYS_SIGLIST	/* we have a (non-standard) sys_siglist */
162
#define SYS_SIGLIST_DECLARED
162
#define SYS_SIGLIST_DECLARED
163
#define HAVE_GETWD		/* cure conflict with getcwd? */
163
#define HAVE_GETWD		/* cure conflict with getcwd? */
164
#define HAVE_PERSONALITY_LINUX32 /* personality LINUX32 can be set */
164
165
165
#define NO_SIOCTL_H		/* don't have sioctl.h */
166
#define NO_SIOCTL_H		/* don't have sioctl.h */
166
#define SYSV_SYSTEM_DIR		/* use dirent.h */
167
#define SYSV_SYSTEM_DIR		/* use dirent.h */

Return to bug 221281