From c2483bfc4a61c81b81f49981c8a8c8d6339993d5 Mon Sep 17 00:00:00 2001 From: dholland Date: Sat, 31 Dec 2016 06:11:21 +0000 Subject: Merge my recent fixes to emacs20 and emacs21: - set ELFSIZE correctly (I still have no idea how this ever worked) - insert workaround for gcc5's calloc bug For some reason I thought emacs22 wasn't affected by these issues, or I would have done this earlier. This does not make the package build on -current, but it gets a lot farther now - it segvs building the quail elisp. I have a feeling we've seen this problem before also, but if so it was some years back and I can't remember what it was about. --- editors/emacs22/distinfo | 4 +++- editors/emacs22/patches/patch-src_gmalloc.c | 22 ++++++++++++++++++++++ editors/emacs22/patches/patch-src_unexelf.c | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 editors/emacs22/patches/patch-src_gmalloc.c create mode 100644 editors/emacs22/patches/patch-src_unexelf.c (limited to 'editors') diff --git a/editors/emacs22/distinfo b/editors/emacs22/distinfo index 0bb60cc24dc..850f7f8fe4d 100644 --- a/editors/emacs22/distinfo +++ b/editors/emacs22/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.16 2015/11/03 03:32:15 agc Exp $ +$NetBSD: distinfo,v 1.17 2016/12/31 06:11:21 dholland Exp $ SHA1 (emacs-22.3.tar.gz) = 5e9b3e0205099a83be7198fd43ba1c9442a3feb0 RMD160 (emacs-22.3.tar.gz) = a7eed5099d0cab25f34152f1b18b5c1b4e2e0746 @@ -27,4 +27,6 @@ SHA1 (patch-ax) = 4a9a795fd08eedcd83c1c92ede566fd63f365bec SHA1 (patch-ba) = 066f6e0f1f69e1e477820589d9b9de4a4a168148 SHA1 (patch-src_Makefile.in) = 656a199e1f2b2fcc7954935c1f9db1861c12bde0 SHA1 (patch-src_alloc_c) = 72055017f43d1526a90fdb3a02b6c317f488399d +SHA1 (patch-src_gmalloc.c) = 3d10e1ae9f9d98495a8da47e6051a51ac18aed10 +SHA1 (patch-src_unexelf.c) = 7cff2fa2427821447a375f2f99578466d028322c SHA1 (patch-xx) = fe52a07d10e8347a721e20611b527c0d626cde3e diff --git a/editors/emacs22/patches/patch-src_gmalloc.c b/editors/emacs22/patches/patch-src_gmalloc.c new file mode 100644 index 00000000000..a20f9131aa8 --- /dev/null +++ b/editors/emacs22/patches/patch-src_gmalloc.c @@ -0,0 +1,22 @@ +$NetBSD: patch-src_gmalloc.c,v 1.1 2016/12/31 06:11:21 dholland Exp $ + +Work around bug in gcc 5.x that makes calloc into a call to itself, +resulting in an infinite loop. + +--- src/gmalloc.c.orig 2001-11-04 17:35:43.000000000 +0000 ++++ src/gmalloc.c +@@ -1520,7 +1520,13 @@ calloc (nmemb, size) + register __malloc_size_t nmemb; + register __malloc_size_t size; + { +- register __ptr_t result = malloc (nmemb * size); ++ register __ptr_t result; ++ ++ result = malloc (nmemb * size); ++#ifdef __GNUC__ ++/* Work around a gcc bug that converts calloc into a call to itself. */ ++ __asm volatile("" : "+r" (result)); ++#endif + + if (result != NULL) + (void) memset (result, 0, nmemb * size); diff --git a/editors/emacs22/patches/patch-src_unexelf.c b/editors/emacs22/patches/patch-src_unexelf.c new file mode 100644 index 00000000000..7ba7e8175e7 --- /dev/null +++ b/editors/emacs22/patches/patch-src_unexelf.c @@ -0,0 +1,22 @@ +$NetBSD: patch-src_unexelf.c,v 1.1 2016/12/31 06:11:21 dholland Exp $ + +- Set ELFSIZE correctly (from exec_elf.h) + +--- src/unexelf.c~ 2008-01-08 04:29:48.000000000 +0000 ++++ src/unexelf.c +@@ -489,12 +489,14 @@ typedef struct { + /* + * NetBSD does not have normal-looking user-land ELF support. + */ ++# include + # if defined __alpha__ || defined __sparc_v9__ ++# ifndef ELFSIZE + # define ELFSIZE 64 + # else + # define ELFSIZE 32 + # endif +-# include ++# endif + + # ifndef PT_LOAD + # define PT_LOAD Elf_pt_load -- cgit v1.2.3