Skip to content
Snippets Groups Projects
Commit 32729d35 authored by rwbarton's avatar rwbarton Committed by Ben Gamari
Browse files

Turn libraries/integer-gmp/gmp/tarball into a submodule

The submodule repository contains the latest version of the GMP source
distribution (6.1.2) with the doc/ subdirectory removed, as described
in gmp/ghc.mk. Rather than applying the old patch from gmp/tarball/patch
I moved its contents into gmp/gmpsrc.patch, canceling a patch related to
memory management there. Experimentally, the PIC-related patch for OS X
is still necessary.

The upgrade to GMP 6.1.2 fixes #7655.

Test Plan:
Built on OS X with in-tree gmp and tested that the command
`ghc -e 'length (show (2^(5*10^6) :: Integer))'` no longer segfaults.

Reviewers: mpickering, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: mpickering, thomie

Differential Revision: https://phabricator.haskell.org/D3044

GHC Trac Issues: #7655
parent e9a239ce
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,7 @@
[submodule "nofib"]
path = nofib
url = ../nofib.git
ignore = untracked
ignore = untracked
[submodule "utils/hsc2hs"]
path = utils/hsc2hs
url = ../hsc2hs.git
......@@ -115,6 +115,9 @@
path = libffi-tarballs
url = ../libffi-tarballs.git
ignore = none
[submodule "gmp-tarballs"]
path = libraries/integer-gmp/gmp/gmp-tarballs
url = ../gmp-tarballs.git
[submodule ".arc-linters/arcanist-external-json-linter"]
path = .arc-linters/arcanist-external-json-linter
url = ../arcanist-external-json-linter.git
......@@ -15,8 +15,14 @@
# That's because the doc/ directory contents are under the GFDL,
# which causes problems for Debian.
GMP_TARBALL := $(wildcard libraries/integer-gmp/gmp/tarball/gmp*.tar.bz2)
GMP_DIR := $(patsubst libraries/integer-gmp/gmp/tarball/%-nodoc-patched.tar.bz2,%,$(GMP_TARBALL))
ifneq "$(BINDIST)" "YES"
GMP_TARBALL := $(wildcard libraries/integer-gmp/gmp/gmp-tarballs/gmp*.tar.bz2)
GMP_DIR := $(patsubst libraries/integer-gmp/gmp/gmp-tarballs/%-nodoc.tar.bz2,%,$(GMP_TARBALL))
ifeq "$(GMP_TARBALL)" ""
$(error "GMP tarball is missing; you may need to run 'git submodule update --init'.")
endif
endif
ifneq "$(NO_CLEAN_GMP)" "YES"
$(eval $(call clean-target,gmp,,\
......@@ -119,7 +125,6 @@ libraries/integer-gmp/gmp/libgmp.a libraries/integer-gmp/gmp/gmp.h:
cat $(GMP_TARBALL) | $(BZIP2_CMD) -d | { cd libraries/integer-gmp/gmp && $(TAR_CMD) -xf - ; }
mv libraries/integer-gmp/gmp/$(GMP_DIR) libraries/integer-gmp/gmp/gmpbuild
cd libraries/integer-gmp/gmp && $(PATCH_CMD) -p0 < gmpsrc.patch
cat libraries/integer-gmp/gmp/tarball/gmp-5.0.4.patch | { cd libraries/integer-gmp/gmp/gmpbuild && $(PATCH_CMD) -p1 ; }
chmod +x libraries/integer-gmp/gmp/ln
# Note: We must pass `TARGETPLATFORM` to the `--host` argument of GMP's
......
Subproject commit ff5a56f169a8c6564f469008b21ad8ec0bc9d49d
--- gmp-5.0.3/configure 2012-02-03 16:52:49.000000000 +0100
+++ gmpbuild/configure 2014-11-07 23:46:33.629758238 +0100
@@ -3937,8 +3937,8 @@
diff -Naur gmp-6.1.2/configure gmpbuild/configure
--- gmp-6.1.2/configure 2016-12-16 10:45:32.000000000 -0500
+++ gmpbuild/configure 2017-01-29 15:18:01.037775639 -0500
@@ -4087,8 +4087,8 @@
#
cclist="gcc cc"
......@@ -11,27 +12,78 @@
cc_cflags="-O"
cc_64_cflags="-O"
--- gmp-5.0.3/memory.c 2012-02-03 16:52:49.000000000 +0100
+++ gmpbuild/memory.c 2014-11-07 23:54:20.734523242 +0100
@@ -24,21 +24,10 @@
#include "gmp-impl.h"
-/* Patched for GHC: */
-void * stgAllocForGMP (size_t size_in_bytes);
-void * stgReallocForGMP (void *ptr, size_t old_size, size_t new_size);
-void stgDeallocForGMP (void *ptr, size_t size);
-
-void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)) = stgAllocForGMP;
-void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t))
- = stgReallocForGMP;
-void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)) = stgDeallocForGMP;
-/*
void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)) = __gmp_default_allocate;
void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t))
= __gmp_default_reallocate;
void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)) = __gmp_default_free;
-*/
/* Default allocation functions. In case of failure to allocate/reallocate
@@ -27273,6 +27273,9 @@
case $host in
*-*-darwin*)
+echo "define(<PIC_ALWAYS>,<yes>)" >> $gmp_tmpconfigm4
+
+
echo "include_mpn(\`x86_64/darwin.m4')" >> $gmp_tmpconfigm4i
;;
*-*-mingw* | *-*-cygwin)
@@ -28181,7 +28181,7 @@
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
-ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in"
+ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -29325,7 +29325,6 @@
"tests/rand/Makefile") CONFIG_FILES="$CONFIG_FILES tests/rand/Makefile" ;;
"tests/misc/Makefile") CONFIG_FILES="$CONFIG_FILES tests/misc/Makefile" ;;
"tests/cxx/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cxx/Makefile" ;;
- "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;;
"demos/Makefile") CONFIG_FILES="$CONFIG_FILES demos/Makefile" ;;
"demos/calc/Makefile") CONFIG_FILES="$CONFIG_FILES demos/calc/Makefile" ;;
diff -Naur gmp-6.1.2/Makefile.am gmpbuild/Makefile.am
--- gmp-6.1.2/Makefile.am 2016-12-16 10:45:27.000000000 -0500
+++ gmpbuild/Makefile.am 2017-01-29 15:14:20.764370926 -0500
@@ -110,7 +110,7 @@
LIBGMPXX_LT_AGE = 5
-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
+SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
COPYING.LESSERv3 COPYINGv2 COPYINGv3
diff -Naur gmp-6.1.2/Makefile.in gmpbuild/Makefile.in
--- gmp-6.1.2/Makefile.in 2016-12-16 10:45:34.000000000 -0500
+++ gmpbuild/Makefile.in 2017-01-29 15:14:32.596446554 -0500
@@ -566,7 +566,7 @@
LIBGMPXX_LT_CURRENT = 9
LIBGMPXX_LT_REVISION = 2
LIBGMPXX_LT_AGE = 5
-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
+SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
# The "test -f" support for srcdir!=builddir is similar to the automake .c.o
# etc rules, but with each foo.c explicitly, since $< is not portable
diff -Naur gmp-6.1.2/configure.ac gmpbuild/configure.ac
--- gmp-6.1.2/configure.ac 2016-12-16 10:45:27.000000000 -0500
+++ gmpbuild/configure.ac 2017-01-29 22:47:28.469558006 -0500
@@ -3698,7 +3698,8 @@
AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86_64)
case $host in
*-*-darwin*)
+ GMP_DEFINE_RAW(["define(<PIC_ALWAYS>,<yes>)"])
GMP_INCLUDE_MPN(x86_64/darwin.m4) ;;
*-*-mingw* | *-*-cygwin)
GMP_INCLUDE_MPN(x86_64/dos64.m4) ;;
*-openbsd*)
diff -Naur gmp-6.1.2/mpn/asm-defs.m4 gmpbuild/mpn/asm-defs.m4
--- gmp-6.1.2/mpn/asm-defs.m4 2016-12-16 10:45:27.000000000 -0500
+++ gmpbuild/mpn/asm-defs.m4 2017-01-29 22:46:26.025176258 -0500
@@ -1051,7 +1051,7 @@
dnl systems which are always PIC. PIC_ALWAYS established in config.m4
dnl identifies these for us.
-ifelse(`PIC_ALWAYS',`yes',`define(`PIC')')
+ifelse(PIC_ALWAYS,yes,`define(`PIC')')
dnl Various possible defines passed from the Makefile that are to be tested
Download linked from http://gmplib.org/
Untar.
Remove doc/ directory.
Apply patch.
Re-tar.
File deleted
This diff is collapsed.
diff -ur gmp-5.0.2.orig/Makefile.am gmp-5.0.2/Makefile.am
--- gmp-5.0.2.orig/Makefile.am 2011-05-08 10:49:29.000000000 +0100
+++ gmp-5.0.2/Makefile.am 2011-07-27 17:58:20.000000000 +0100
@@ -93,7 +93,7 @@
LIBMP_LT_AGE = 1
-SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc
+SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune
EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf
diff -ur gmp-5.0.2.orig/Makefile.in gmp-5.0.2/Makefile.in
--- gmp-5.0.2.orig/Makefile.in 2011-05-08 10:49:35.000000000 +0100
+++ gmp-5.0.2/Makefile.in 2011-07-27 17:58:13.000000000 +0100
@@ -435,7 +435,7 @@
LIBMP_LT_CURRENT = 4
LIBMP_LT_REVISION = 22
LIBMP_LT_AGE = 1
-SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc
+SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune
# The ansi2knr setups for the build programs are the same as the normal
# automake ansi2knr rules, but using $(CC_FOR_BUILD) instead of $(CC).
diff -ur gmp-5.0.2.orig/configure gmp-5.0.2/configure
--- gmp-5.0.2.orig/configure 2011-05-08 10:49:33.000000000 +0100
+++ gmp-5.0.2/configure 2011-07-27 18:00:11.000000000 +0100
@@ -28478,7 +28478,7 @@
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
-ac_config_files="$ac_config_files Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in mp.h:mp-h.in"
+ac_config_files="$ac_config_files Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in mp.h:mp-h.in"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -29665,7 +29665,6 @@
"tests/rand/Makefile") CONFIG_FILES="$CONFIG_FILES tests/rand/Makefile" ;;
"tests/misc/Makefile") CONFIG_FILES="$CONFIG_FILES tests/misc/Makefile" ;;
"tests/cxx/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cxx/Makefile" ;;
- "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;;
"demos/Makefile") CONFIG_FILES="$CONFIG_FILES demos/Makefile" ;;
"demos/calc/Makefile") CONFIG_FILES="$CONFIG_FILES demos/calc/Makefile" ;;
Only in gmp-5.0.2.orig: doc
diff -ur gmp-5.0.2.orig/memory.c gmp-5.0.2/memory.c
--- gmp-5.0.2.orig/memory.c 2011-05-08 10:49:29.000000000 +0100
+++ gmp-5.0.2/memory.c 2011-07-27 15:18:21.000000000 +0100
@@ -24,10 +24,21 @@
#include "gmp-impl.h"
+/* Patched for GHC: */
+void * stgAllocForGMP (size_t size_in_bytes);
+void * stgReallocForGMP (void *ptr, size_t old_size, size_t new_size);
+void stgDeallocForGMP (void *ptr, size_t size);
+
+void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)) = stgAllocForGMP;
+void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t))
+ = stgReallocForGMP;
+void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)) = stgDeallocForGMP;
+/*
void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)) = __gmp_default_allocate;
void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t))
= __gmp_default_reallocate;
void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)) = __gmp_default_free;
+*/
/* Default allocation functions. In case of failure to allocate/reallocate
--- gmp-5.0.2.orig/configure.in 2011-08-04 16:35:01.000000000 +1000
+++ gmp-5.0.2/configure.in 2011-08-04 16:39:03.000000000 +1000
@@ -3178,6 +3178,7 @@
AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86_64)
case $host in
*-*-darwin*)
+ GMP_DEFINE_RAW(["define(<PIC_ALWAYS>,<yes>)"])
GMP_INCLUDE_MPN(x86_64/darwin.m4) ;;
esac
;;
--- gmp-5.0.2.orig/configure 2011-08-04 17:38:22.000000000 +1000
+++ gmp-5.0.2/configure 2011-08-04 17:39:04.000000000 +1000
@@ -27567,6 +27567,9 @@
case $host in
*-*-darwin*)
+echo "define(<PIC_ALWAYS>,<yes>)" >> $gmp_tmpconfigm4
+
+
echo "include_mpn(\`x86_64/darwin.m4')" >> $gmp_tmpconfigm4i
;;
esac
--- gmp-5.0.2.orig/mpn/asm-defs.m4 2011-08-04 23:11:19.000000000 +1000
+++ gmp-5.0.2/mpn/asm-defs.m4 2011-08-04 23:11:59.000000000 +1000
@@ -1041,7 +1041,7 @@
dnl systems which are always PIC. PIC_ALWAYS established in config.m4
dnl identifies these for us.
-ifelse(`PIC_ALWAYS',`yes',`define(`PIC')')
+ifelse(PIC_ALWAYS,yes,`define(`PIC')')
dnl Various possible defines passed from the Makefile that are to be tested
......@@ -86,7 +86,7 @@ endif
# Uncomment the following line to enable building DPH
#BUILD_DPH=YES
# Uncomment the following to force `integer-gmp` to use the in-tree GMP 5.0.4
# Uncomment the following to force `integer-gmp` to use the in-tree GMP 6.1.2
# (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`)
#libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment