From afd41024fc6f47d57ae5ec29c4b6518cbdf38a85614e5686248eb34992be57a7 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 12 Aug 2016 15:02:46 +0000 Subject: [PATCH] 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 --- emacs-24.4-glibc.patch | 40 +++++---------- emacs.changes | 7 +++ emacs.spec | 2 + gmalloc.patch | 113 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 26 deletions(-) create mode 100644 gmalloc.patch diff --git a/emacs-24.4-glibc.patch b/emacs-24.4-glibc.patch index dec2cf3..5901e88 100644 --- a/emacs-24.4-glibc.patch +++ b/emacs-24.4-glibc.patch @@ -4,17 +4,23 @@ lib-src/Makefile.in | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) ---- configure.ac -+++ configure.ac 2014-10-21 13:50:36.287837811 +0000 -@@ -1988,6 +1988,7 @@ system_malloc=$emacs_cv_sanitize_address +Index: configure +=================================================================== +--- configure.orig ++++ configure +@@ -10951,6 +10951,7 @@ fi + use_mmap_for_buffers=no 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 ;; + cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;; ++ gnu-linux) use_mmap_for_buffers=yes ;; 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 case "$opsys" in cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;; @@ -22,21 +28,3 @@ esac 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 - - diff --git a/emacs.changes b/emacs.changes index 64c34d8..1cca75d 100644 --- a/emacs.changes +++ b/emacs.changes @@ -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 diff --git a/emacs.spec b/emacs.spec index 8811c8c..bf4eb50 100644 --- a/emacs.spec +++ b/emacs.spec @@ -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 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 +Patch40: gmalloc.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %{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 %patch38 -p1 %patch39 -p1 +%patch40 -p1 %if %{without autoconf} # We don't want to run autoconf diff --git a/gmalloc.patch b/gmalloc.patch new file mode 100644 index 0000000..1335ba8 --- /dev/null +++ b/gmalloc.patch @@ -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'.