summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/integer-gmp/cbits/alloc.c12
-rw-r--r--libraries/integer-gmp/gmp/ghc.mk2
-rw-r--r--libraries/integer-gmp/gmp/tarball/patch25
3 files changed, 32 insertions, 7 deletions
diff --git a/libraries/integer-gmp/cbits/alloc.c b/libraries/integer-gmp/cbits/alloc.c
index 27713865eb..d1d922979e 100644
--- a/libraries/integer-gmp/cbits/alloc.c
+++ b/libraries/integer-gmp/cbits/alloc.c
@@ -10,9 +10,9 @@
#include "gmp.h"
-static void * stgAllocForGMP (size_t size_in_bytes);
-static void * stgReallocForGMP (void *ptr, size_t old_size, size_t new_size);
-static void stgDeallocForGMP (void *ptr STG_UNUSED, size_t size STG_UNUSED);
+void * stgAllocForGMP (size_t size_in_bytes);
+void * stgReallocForGMP (void *ptr, size_t old_size, size_t new_size);
+void stgDeallocForGMP (void *ptr STG_UNUSED, size_t size STG_UNUSED);
static void initAllocForGMP( void ) __attribute__((constructor));
@@ -62,7 +62,7 @@ static void initAllocForGMP( void )
only allocate() style allocation.
-------------------------------------------------------------------------- */
-static void *
+void *
stgAllocForGMP (size_t size_in_bytes)
{
StgArrWords* arr;
@@ -80,7 +80,7 @@ stgAllocForGMP (size_t size_in_bytes)
return arr->payload;
}
-static void *
+void *
stgReallocForGMP (void *ptr, size_t old_size, size_t new_size)
{
size_t min_size;
@@ -98,7 +98,7 @@ stgReallocForGMP (void *ptr, size_t old_size, size_t new_size)
return(new_stuff_ptr);
}
-static void
+void
stgDeallocForGMP (void *ptr STG_UNUSED, size_t size STG_UNUSED)
{
/* easy for us: the garbage collector does the dealloc'n */
diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk
index a798e46d70..9bd52c2e5e 100644
--- a/libraries/integer-gmp/gmp/ghc.mk
+++ b/libraries/integer-gmp/gmp/ghc.mk
@@ -93,7 +93,7 @@ PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
# 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.tar.bz2,%,$(GMP_TARBALL))
+GMP_DIR := $(patsubst libraries/integer-gmp/gmp/tarball/%-nodoc-patched.tar.bz2,%,$(GMP_TARBALL))
libraries/integer-gmp/gmp/libgmp.a libraries/integer-gmp/gmp/gmp.h:
$(RM) -rf $(GMP_DIR) libraries/integer-gmp/gmp/gmpbuild libraries/integer-gmp/gmp/objs
diff --git a/libraries/integer-gmp/gmp/tarball/patch b/libraries/integer-gmp/gmp/tarball/patch
new file mode 100644
index 0000000000..4850bc4dda
--- /dev/null
+++ b/libraries/integer-gmp/gmp/tarball/patch
@@ -0,0 +1,25 @@
+diff -ur before/memory.c after/memory.c
+--- before/memory.c 2007-08-30 19:31:40.000000000 +0100
++++ after/memory.c 2009-06-21 19:12:39.000000000 +0100
+@@ -24,10 +24,21 @@
+ #include "gmp-impl.h"
+
+
++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) _PROTO ((size_t)) = stgAllocForGMP;
++void * (*__gmp_reallocate_func) _PROTO ((void *, size_t, size_t))
++ = stgReallocForGMP;
++void (*__gmp_free_func) _PROTO ((void *, size_t)) = stgDeallocForGMP;
++
++/*
+ void * (*__gmp_allocate_func) _PROTO ((size_t)) = __gmp_default_allocate;
+ void * (*__gmp_reallocate_func) _PROTO ((void *, size_t, size_t))
+ = __gmp_default_reallocate;
+ void (*__gmp_free_func) _PROTO ((void *, size_t)) = __gmp_default_free;
++*/
+
+
+ /* Default allocation functions. In case of failure to allocate/reallocate