[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
rpms/emacs/devel emacs-21-personality-linux32-101818.patch, NONE, 1.1 emacs-21.4-setarch_for_loadup-101818.patch, 1.1, NONE
- From: fedora-cvs-commits redhat com
- To: fedora-cvs-commits redhat com
- Subject: rpms/emacs/devel emacs-21-personality-linux32-101818.patch, NONE, 1.1 emacs-21.4-setarch_for_loadup-101818.patch, 1.1, NONE
- Date: Thu, 14 Jul 2005 07:06:10 -0400
Author: petersen
Update of /cvs/dist/rpms/emacs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv1084
Added Files:
emacs-21-personality-linux32-101818.patch
Removed Files:
emacs-21.4-setarch_for_loadup-101818.patch
Log Message:
remember to actually commit the patch update
emacs-21-personality-linux32-101818.patch:
configure.in | 12 ++++++++++
src/emacs.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lastfile.c | 2 -
3 files changed, 80 insertions(+), 2 deletions(-)
--- NEW FILE emacs-21-personality-linux32-101818.patch ---
--- emacs-21.3/src/emacs.c~ 2002-08-30 04:27:07.000000000 +0900
+++ emacs-21.3/src/emacs.c 2005-07-14 15:36:48.000000000 +0900
@@ -61,6 +61,10 @@
#include <sys/resource.h>
#endif
+#ifdef HAVE_PERSONALITY_LINUX32
+#include <sys/personality.h>
+#endif
+
#ifndef O_RDWR
#define O_RDWR 2
#endif
@@ -181,6 +185,17 @@
Tells GC how to save a copy of the stack. */
char *stack_bottom;
+/* The address where the heap starts (from the first sbrk (0) call). */
+static void *my_heap_start;
+
+/* The gap between BSS end and heap start as far as we can tell. */
+static unsigned long heap_bss_diff;
+
+/* If the gap between BSS end and heap start is larger than this we try to
+ work around it, and if that fails, output a warning in dump-emacs. */
+#define MAX_HEAP_BSS_DIFF (1024*1024)
+
+
#ifdef HAVE_WINDOW_SYSTEM
extern Lisp_Object Vwindow_system;
#endif /* HAVE_WINDOW_SYSTEM */
@@ -725,6 +740,17 @@
stack_base = &dummy;
#endif
+ if (!initialized)
+ {
+ extern char my_endbss[];
+ extern char *my_endbss_static;
+
+ if (my_heap_start == 0)
+ my_heap_start = sbrk (0);
+
+ heap_bss_diff = (char *)my_heap_start - max (my_endbss, my_endbss_static);
+ }
+
#ifdef LINUX_SBRK_BUG
__sbrk (1);
#endif
@@ -763,6 +789,34 @@
}
}
+#ifdef HAVE_PERSONALITY_LINUX32
+ /* See if there is a gap between the end of BSS and the heap.
+ In that case, set personality and exec ourself again. */
+ if (!initialized
+ && (strcmp (argv[argc-1], "dump") == 0
+ || strcmp (argv[argc-1], "bootstrap") == 0)
+ && heap_bss_diff > MAX_HEAP_BSS_DIFF)
+ {
+ if (! getenv ("EMACS_HEAP_EXEC"))
+ {
+ /* Set this so we only do this once. */
+ putenv("EMACS_HEAP_EXEC=true");
+
+ /* A flag to turn off address randomization which is introduced
+ in linux kernel shipped with fedora core 4 */
+#define ADD_NO_RANDOMIZE 0x0040000
+ personality (PER_LINUX32 | ADD_NO_RANDOMIZE);
+#undef ADD_NO_RANDOMIZE
+
+ execvp (argv[0], argv);
+
+ /* If the exec fails, try to dump anyway. */
+ perror ("execvp");
+ }
+ }
+#endif /* HAVE_PERSONALITY_LINUX32 */
+
+
/* Map in shared memory, if we are using that. */
#ifdef HAVE_SHM
if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
@@ -1978,6 +2032,20 @@
if (! noninteractive)
error ("Dumping Emacs works only in batch mode");
+#ifdef __linux__
+ if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
+ {
+ fprintf (stderr, "**************************************************\n");
+ fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
+ fprintf (stderr, "heap (%lu byte). This usually means that exec-shield\n",
+ heap_bss_diff);
+ fprintf (stderr, "or something similar is in effect. The dump may\n");
+ fprintf (stderr, "fail because of this. See the section about \n");
+ fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
+ fprintf (stderr, "**************************************************\n");
+ }
+#endif /* __linux__ */
+
/* Bind `command-line-processed' to nil before dumping,
so that the dumped Emacs will process its command line
and set up to work with X windows if appropriate. */
--- emacs-21.3/src/lastfile.c~ 1999-01-18 04:16:08.000000000 +0900
+++ emacs-21.3/src/lastfile.c 2005-07-14 15:56:18.000000000 +0900
@@ -40,7 +40,6 @@
char my_edata[] = "End of Emacs initialized data";
-#ifdef WINDOWSNT
/* Help unexec locate the end of the .bss area used by Emacs (which
isn't always a separate section in NT executables). */
char my_endbss[1];
@@ -50,4 +49,3 @@
of the bss area used by Emacs. */
static char _my_endbss[1];
char * my_endbss_static = _my_endbss;
-#endif
--- emacs-21.3/configure.in~ 2005-04-06 23:47:05.000000000 +0900
+++ emacs-21.3/configure.in 2005-07-14 15:39:47.000000000 +0900
@@ -1350,6 +1350,18 @@
AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
termcap.h stdio_ext.h fcntl.h term.h strings.h)
+
+AC_MSG_CHECKING(if personality LINUX32 can be set)
+AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
+ emacs_cv_personality_linux32=yes,
+ emacs_cv_personality_linux32=no)
+AC_MSG_RESULT($emacs_cv_personality_linux32)
+
+if test $emacs_cv_personality_linux32 = yes; then
+ AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
+ [Define to 1 if personality LINUX32 can be set.])
+fi
+
AC_HEADER_STDC
AC_HEADER_TIME
AC_DECL_SYS_SIGLIST
--- emacs-21.4-setarch_for_loadup-101818.patch DELETED ---
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]