diff options
author | Ulrich Müller <ulm@gentoo.org> | 2017-02-18 08:12:10 +0100 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2017-02-18 08:12:10 +0100 |
commit | d7cd02e1aa9ef37a0aee0d4f2507b8f21b522c7b (patch) | |
tree | c40bbbdc45c0ea5bcea7ad4921a8322240b6283d | |
parent | Remove 24.4 patchset. (diff) | |
download | emacs-patches-d7cd02e1aa9ef37a0aee0d4f2507b8f21b522c7b.tar.gz emacs-patches-d7cd02e1aa9ef37a0aee0d4f2507b8f21b522c7b.tar.bz2 emacs-patches-d7cd02e1aa9ef37a0aee0d4f2507b8f21b522c7b.zip |
Fix temacs segmentation fault due to endless calloc loop.emacs-24.5-patches-3
-rw-r--r-- | emacs/24.5/07_all_gmalloc.patch | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/emacs/24.5/07_all_gmalloc.patch b/emacs/24.5/07_all_gmalloc.patch new file mode 100644 index 0000000..7698ee3 --- /dev/null +++ b/emacs/24.5/07_all_gmalloc.patch @@ -0,0 +1,81 @@ +Fix temacs segmentation fault due to endless calloc loop. +https://bugs.gentoo.org/609680 + +Backported from Emacs 25: + +commit 4b1436b702d56eedd27a0777fc7232cdfb7ac4f6 +Author: Wolfgang Jenkner <wjenkner@inode.at> +Date: Sat Dec 26 12:12:02 2015 -0800 + + Always define gmalloc etc. in src/gmalloc.c + + This is a work-around to prevent the compiler from using semantic + knowledge about malloc for optimization purposes. E.g., gcc 5.2 + with -O2 replaces most of calloc's definition by a call to calloc; + see Bug#22085. + * src/gmalloc.c [!HYBRID_MALLOC] (malloc, realloc, calloc) + (aligned_alloc, free): Do not undef. Instead, define these as + functions (perhaps renamed to gmalloc etc.) in terms of gmalloc etc. + +--- emacs-24.5-orig/src/gmalloc.c ++++ emacs-24.5/src/gmalloc.c +@@ -42,6 +42,16 @@ + 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 @@ + 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'. |