Accepting request 418413 from home:Andreas_Schwab:Factory

- emacs-24.4-glibc.patch: don't force system malloc, it doesn't work with
  glibc 2.24
- gmalloc.patch: fix portability bugs in gmalloc

OBS-URL: https://build.opensuse.org/request/show/418413
OBS-URL: https://build.opensuse.org/package/show/editors/emacs?expand=0&rev=195
This commit is contained in:
Dr. Werner Fink 2016-08-12 15:02:46 +00:00 committed by Git OBS Bridge
parent 34e6242353
commit afd41024fc
4 changed files with 136 additions and 26 deletions

View File

@ -4,17 +4,23 @@
lib-src/Makefile.in | 6 ++++-- lib-src/Makefile.in | 6 ++++--
3 files changed, 8 insertions(+), 2 deletions(-) 3 files changed, 8 insertions(+), 2 deletions(-)
--- configure.ac Index: configure
+++ configure.ac 2014-10-21 13:50:36.287837811 +0000 ===================================================================
@@ -1988,6 +1988,7 @@ system_malloc=$emacs_cv_sanitize_address --- configure.orig
+++ configure
@@ -10951,6 +10951,7 @@ fi
use_mmap_for_buffers=no
case "$opsys" in case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework. cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
darwin|sol2-10) system_malloc=yes ;; + gnu-linux) use_mmap_for_buffers=yes ;;
+ gnu-linux) system_malloc=yes ;;
esac esac
GMALLOC_OBJ=
@@ -2045,6 +2046,7 @@ fi Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -2048,6 +2048,7 @@ fi
use_mmap_for_buffers=no use_mmap_for_buffers=no
case "$opsys" in case "$opsys" in
cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;; cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
@ -22,21 +28,3 @@
esac esac
AC_FUNC_MMAP AC_FUNC_MMAP
--- configure
+++ configure 2014-10-21 13:51:36.143837910 +0000
@@ -10862,6 +10862,7 @@ system_malloc=$emacs_cv_sanitize_address
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin|sol2-10) system_malloc=yes ;;
+ gnu-linux) system_malloc=yes ;;
esac
GMALLOC_OBJ=
@@ -10949,6 +10950,7 @@ fi
use_mmap_for_buffers=no
case "$opsys" in
cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
+ gnu-linux) use_mmap_for_buffers=yes ;;
esac

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Aug 10 15:10:01 UTC 2016 - schwab@suse.de
- emacs-24.4-glibc.patch: don't force system malloc, it doesn't work with
glibc 2.24
- gmalloc.patch: fix portability bugs in gmalloc
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Mar 10 12:07:49 UTC 2016 - werner@suse.de Thu Mar 10 12:07:49 UTC 2016 - werner@suse.de

View File

@ -126,6 +126,7 @@ Patch36: emacs-24-0016-ELF-unexec-Drive-from-PT_LOAD-header-rather-than-s
Patch37: emacs-24-0017-ELF-unexec-Don-t-insert-a-new-section.patch Patch37: emacs-24-0017-ELF-unexec-Don-t-insert-a-new-section.patch
Patch38: emacs-24-0018-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch Patch38: emacs-24-0018-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch
Patch39: emacs-24-0019-ELF-unexec-align-section-header.patch Patch39: emacs-24-0019-ELF-unexec-align-section-header.patch
Patch40: gmalloc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{expand: %%global include_info %(test -s /usr/share/info/info.info* && echo 0 || echo 1)} %{expand: %%global include_info %(test -s /usr/share/info/info.info* && echo 0 || echo 1)}
@ -252,6 +253,7 @@ and most assembler-like syntaxes.
%patch37 -p1 %patch37 -p1
%patch38 -p1 %patch38 -p1
%patch39 -p1 %patch39 -p1
%patch40 -p1
%if %{without autoconf} %if %{without autoconf}
# We don't want to run autoconf # We don't want to run autoconf

113
gmalloc.patch Normal file
View File

@ -0,0 +1,113 @@
Index: emacs-24.5/src/emacs.c
===================================================================
--- emacs-24.5.orig/src/emacs.c
+++ emacs-24.5/src/emacs.c
@@ -723,6 +723,26 @@ main (int argc, char **argv)
stack_base = &dummy;
#endif
+#if defined HAVE_PERSONALITY_LINUX32 && defined __PPC64__
+ /* This code partly duplicates the HAVE_PERSONALITY_LINUX32 code
+ below. This duplication is planned to be fixed in a later
+ Emacs release. */
+# define ADD_NO_RANDOMIZE 0x0040000
+ int pers = personality (0xffffffff);
+ if (! (pers & ADD_NO_RANDOMIZE)
+ && 0 <= personality (pers | ADD_NO_RANDOMIZE))
+ {
+ /* Address randomization was enabled, but is now disabled.
+ Re-execute Emacs to get a clean slate. */
+ execvp (argv[0], argv);
+
+ /* If the exec fails, warn the user and then try without a
+ clean slate. */
+ perror (argv[0]);
+ }
+# undef ADD_NO_RANDOMIZE
+#endif
+
#ifdef G_SLICE_ALWAYS_MALLOC
/* This is used by the Cygwin build. It's not needed starting with
cygwin-1.7.24, but it doesn't do any harm. */
@@ -833,7 +853,7 @@ main (int argc, char **argv)
dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
|| strcmp (argv[argc - 1], "bootstrap") == 0);
-#ifdef HAVE_PERSONALITY_LINUX32
+#if defined HAVE_PERSONALITY_LINUX32 && !defined __PPC64__
if (dumping && ! getenv ("EMACS_HEAP_EXEC"))
{
/* Set this so we only do this once. */
@@ -850,7 +870,7 @@ main (int argc, char **argv)
/* If the exec fails, try to dump anyway. */
emacs_perror (argv[0]);
}
-#endif /* HAVE_PERSONALITY_LINUX32 */
+#endif
#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
/* Extend the stack space available.
Index: emacs-24.5/src/gmalloc.c
===================================================================
--- emacs-24.5.orig/src/gmalloc.c
+++ emacs-24.5/src/gmalloc.c
@@ -42,6 +42,16 @@ License along with this library. If not
extern void emacs_abort (void);
#endif
+#undef malloc
+#undef realloc
+#undef calloc
+#undef free
+#define malloc gmalloc
+#define realloc grealloc
+#define calloc gcalloc
+#define aligned_alloc galigned_alloc
+#define free gfree
+
#ifdef __cplusplus
extern "C"
{
@@ -1747,6 +1757,42 @@ valloc (size_t size)
return aligned_alloc (pagesize, size);
}
+#undef malloc
+#undef realloc
+#undef calloc
+#undef aligned_alloc
+#undef free
+
+void *
+malloc (size_t size)
+{
+ return gmalloc (size);
+}
+
+void *
+calloc (size_t nmemb, size_t size)
+{
+ return gcalloc (nmemb, size);
+}
+
+void
+free (void *ptr)
+{
+ gfree (ptr);
+}
+
+void *
+aligned_alloc (size_t alignment, size_t size)
+{
+ return galigned_alloc (alignment, size);
+}
+
+void *
+realloc (void *ptr, size_t size)
+{
+ return grealloc (ptr, size);
+}
+
#ifdef GC_MCHECK
/* Standard debugging hooks for `malloc'.