summaryrefslogtreecommitdiff
path: root/lang/smlnj
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2016-04-14 21:58:22 +0000
committerdholland <dholland@pkgsrc.org>2016-04-14 21:58:22 +0000
commit3183cd3c64a367b82e0b83cdc80a3045f2b8b4d9 (patch)
treec35d740862b3568d8ca3f7fabe037e5d145227f8 /lang/smlnj
parentf25821a437118a92ffff5679e9ce4ee1b5c9c1c7 (diff)
downloadpkgsrc-3183cd3c64a367b82e0b83cdc80a3045f2b8b4d9.tar.gz
Use struct timeval instead of blithely assuming that some private
struct declaration is always bit compatible with it. (Because it isn't.) My patches from PR 40954 circa 2009, which it turns out is still relevant even after the last couple updates. (Just for some reason it had stopped crashing.) This does not make smlnj build for me, but it gets further than it used to.
Diffstat (limited to 'lang/smlnj')
-rw-r--r--lang/smlnj/Makefile3
-rw-r--r--lang/smlnj/distinfo10
-rw-r--r--lang/smlnj/patches/patch-base_runtime_gc_gc-stats.h44
-rw-r--r--lang/smlnj/patches/patch-base_runtime_gc_init-gc.c27
-rw-r--r--lang/smlnj/patches/patch-base_runtime_kernel_unix-timers.c17
-rw-r--r--lang/smlnj/patches/patch-base_runtime_mach-dep_unix-prof.c15
-rw-r--r--lang/smlnj/patches/patch-src_runtime_gc_gc-stats.h44
-rw-r--r--lang/smlnj/patches/patch-src_runtime_gc_init-gc.c27
-rw-r--r--lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c17
-rw-r--r--lang/smlnj/patches/patch-src_runtime_mach-dep_unix-prof.c15
10 files changed, 217 insertions, 2 deletions
diff --git a/lang/smlnj/Makefile b/lang/smlnj/Makefile
index b1499acfab1..3cafe1e9197 100644
--- a/lang/smlnj/Makefile
+++ b/lang/smlnj/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2012/10/02 20:11:53 asau Exp $
+# $NetBSD: Makefile,v 1.25 2016/04/14 21:58:22 dholland Exp $
#
DISTNAME= boot.${BOX}-unix
@@ -31,6 +31,7 @@ HOMEPAGE= http://www.smlnj.org/index.html
COMMENT= Popular functional language from Bell Labs
SML_VERSION= 110.73
+PKGREVISION= 1
WRKSRC= ${WRKDIR}
DIST_SUBDIR= smlnj-${SML_VERSION}
diff --git a/lang/smlnj/distinfo b/lang/smlnj/distinfo
index d157e04abd1..fd7aee57df5 100644
--- a/lang/smlnj/distinfo
+++ b/lang/smlnj/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.16 2015/11/03 22:50:44 agc Exp $
+$NetBSD: distinfo,v 1.17 2016/04/14 21:58:22 dholland Exp $
SHA1 (smlnj-110.73/MLRISC.tgz) = 59a38a4a1c63cecf97764a99577b3f929b5ccbc9
RMD160 (smlnj-110.73/MLRISC.tgz) = dd951776482f37421a17701d67c051741691c6cb
@@ -96,6 +96,14 @@ SHA1 (patch-ao) = 1c66024c5949269291cbf6f815baf6162db47d31
SHA1 (patch-ap) = 8e9e28548b4e58de68a11982a355a010ea96aa29
SHA1 (patch-aq) = 7d0734b76d778d7f584d2e70d325fd72e6554b01
SHA1 (patch-at) = 376b67d25ef428377b1686fcd6232628867d6eae
+SHA1 (patch-base_runtime_gc_gc-stats.h) = 35e54cb66c47c636c5a9f450cff99dced4218dd2
+SHA1 (patch-base_runtime_gc_init-gc.c) = f40e961089beab151290ffc8371a48bc9f846511
+SHA1 (patch-base_runtime_kernel_unix-timers.c) = 42f1d2964d5de37fdc232139f74fb9a95f21da07
+SHA1 (patch-base_runtime_mach-dep_unix-prof.c) = 1f28a05cfb271c569cfb9778e67076bbfb14d646
SHA1 (patch-base_runtime_objs_mk.x86-netbsd) = 1e5ca88c65066a07b818af76abc2f9f1bafdc339
SHA1 (patch-config___arch-n-opsys) = 83b357d78c0762c9b0c295444bfe9e5641aa02e0
+SHA1 (patch-src_runtime_gc_gc-stats.h) = af61db9d1f04e566d4c5c2bc5dcf4c6958f0ea78
+SHA1 (patch-src_runtime_gc_init-gc.c) = 5d1d5a13a51d732590dd4f375824bbc389a0525d
+SHA1 (patch-src_runtime_kernel_unix-timers.c) = 1c1db5bce0ec1e72adafb9380027884cf746c75c
+SHA1 (patch-src_runtime_mach-dep_unix-prof.c) = 90a4b81e2a8532e4e06f29bfe42c55423a0f4154
SHA1 (patch-src_runtime_objs_mk.x86-netbsd) = bd29b208b68771ecd1f3c64d896653084c6eb30e
diff --git a/lang/smlnj/patches/patch-base_runtime_gc_gc-stats.h b/lang/smlnj/patches/patch-base_runtime_gc_gc-stats.h
new file mode 100644
index 00000000000..72d30b54d60
--- /dev/null
+++ b/lang/smlnj/patches/patch-base_runtime_gc_gc-stats.h
@@ -0,0 +1,44 @@
+$NetBSD: patch-base_runtime_gc_gc-stats.h,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use struct timeval instead of blithely assuming that some private
+struct declaration is always bit compatible with it. (Because it
+isn't.) From PR 40954.
+
+--- base/runtime/gc/gc-stats.h.orig 2009-03-03 18:23:38.000000000 -0500
++++ base/runtime/gc/gc-stats.h 2009-03-03 18:25:04.000000000 -0500
+@@ -16,6 +16,7 @@ extern void ReportVM (ml_state_t *msp, i
+
+ #define START_GC_PAUSE(HEAP) { \
+ if (StatsOn) { \
++ struct timeval tv; \
+ heap_t *__heap = (HEAP); \
+ stat_rec_t *__p = &(StatsBuf[NStatsRecs]); \
+ Unsigned32_t __n = (Addr_t)(msp->ml_allocPtr) - \
+@@ -23,7 +24,10 @@ extern void ReportVM (ml_state_t *msp, i
+ CNTR_INCR(&(__heap->numAlloc), __n); \
+ __p->allocCnt = __heap->numAlloc; \
+ __p->numGens = 0; \
+- gettimeofday(&(__p->startTime), NIL(struct timezone *)); \
++ gettimeofday(&tv, NIL(struct timezone *)); \
++ /* XXX breaks in 2038 */ \
++ __p->startTime.seconds = tv.tv_sec; \
++ __p->startTime.uSeconds = tv.tv_usec; \
+ } \
+ }
+
+@@ -34,8 +38,11 @@ extern void ReportVM (ml_state_t *msp, i
+
+ #define STOP_GC_PAUSE() { \
+ if (StatsOn) { \
+- gettimeofday(&(StatsBuf[NStatsRecs].stopTime), \
+- NIL(struct timezone *)); \
++ struct timeval tv; \
++ gettimeofday(&tv, NIL(struct timezone *)); \
++ /* XXX breaks in 2038 */ \
++ StatsBuf[NStatsRecs].stopTime.seconds = tv.tv_sec; \
++ StatsBuf[NStatsRecs].stopTime.uSeconds = tv.tv_usec; \
+ STATS_FINISH(); \
+ } \
+ }
+
+
diff --git a/lang/smlnj/patches/patch-base_runtime_gc_init-gc.c b/lang/smlnj/patches/patch-base_runtime_gc_init-gc.c
new file mode 100644
index 00000000000..3032c25a548
--- /dev/null
+++ b/lang/smlnj/patches/patch-base_runtime_gc_init-gc.c
@@ -0,0 +1,27 @@
+$NetBSD: patch-base_runtime_gc_init-gc.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use struct timeval instead of blithely assuming that some private
+struct declaration is always bit compatible with it. (Because it
+isn't.) From PR 40954.
+
+--- base/runtime/gc/init-gc.c.orig 2009-03-03 18:15:36.000000000 -0500
++++ base/runtime/gc/init-gc.c 2009-03-03 18:17:03.000000000 -0500
+@@ -218,12 +218,16 @@ void InitHeap (ml_state_t *msp, bool_t i
+ #if defined(COLLECT_STATS)
+ if (StatsFD > 0) {
+ stat_hdr_t hdr;
++ struct timeval tv;
+ CNTR_ZERO(&(heap->numAlloc));
+ hdr.mask = STATMASK_ALLOC|STATMASK_NGENS|STATMASK_START|STATMASK_STOP;
+ hdr.isNewRuntime = 1;
+ hdr.allocSzB = params->allocSz;
+ hdr.numGens = params->numGens;
+- gettimeofday (&(hdr.startTime), NIL(struct timezone *));
++ gettimeofday (&tv, NIL(struct timezone *));
++ /* XXX breaks in 2038 */
++ hdr.startTime.seconds = tv.tv_sec;
++ hdr.startTime.uSeconds = tv.tv_usec;
+ write (StatsFD, (char *)&hdr, sizeof(stat_hdr_t));
+ }
+ #endif
+
diff --git a/lang/smlnj/patches/patch-base_runtime_kernel_unix-timers.c b/lang/smlnj/patches/patch-base_runtime_kernel_unix-timers.c
new file mode 100644
index 00000000000..7841421b5b0
--- /dev/null
+++ b/lang/smlnj/patches/patch-base_runtime_kernel_unix-timers.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-base_runtime_kernel_unix-timers.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Don't blithely assume that some internal type has the same layout as a
+system type. It doesn't. Same issue as PR 40954, but a new case that I
+either didn't find at the time or has appeared since.
+
+--- base/runtime/kernel/unix-timers.c~ 2000-06-01 18:34:03.000000000 +0000
++++ base/runtime/kernel/unix-timers.c
+@@ -18,7 +18,7 @@ typedef struct rusage time_struct_t;
+ #define GET_TIME(t) getrusage(RUSAGE_SELF, &(t))
+ #define SYS_TIME(t) ((t).ru_stime)
+ #define USR_TIME(t) ((t).ru_utime)
+-#define SET_TIME(tp, t) { *((struct timeval *)(tp)) = (t); }
++#define SET_TIME(tp, t) { (tp)->seconds = (t).tv_sec; (tp)->uSeconds = (t).tv_usec; }
+
+ #else /* !HAS_GETRUSAGE */
+
diff --git a/lang/smlnj/patches/patch-base_runtime_mach-dep_unix-prof.c b/lang/smlnj/patches/patch-base_runtime_mach-dep_unix-prof.c
new file mode 100644
index 00000000000..0716bf88ce2
--- /dev/null
+++ b/lang/smlnj/patches/patch-base_runtime_mach-dep_unix-prof.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-base_runtime_mach-dep_unix-prof.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use own abstractions correctly.
+
+--- base/runtime/mach-dep/unix-prof.c~ 2005-01-18 17:58:39.000000000 +0000
++++ base/runtime/mach-dep/unix-prof.c
+@@ -34,7 +34,7 @@ void EnableProfSignals ()
+ */
+ void DisableProfSignals ()
+ {
+- SIG_SetHandler (SIGVTALRM, SIG_DFL);
++ SIG_SetDefault (SIGVTALRM);
+
+ } /* end of DisableProfSignals */
+
diff --git a/lang/smlnj/patches/patch-src_runtime_gc_gc-stats.h b/lang/smlnj/patches/patch-src_runtime_gc_gc-stats.h
new file mode 100644
index 00000000000..43c5f56e389
--- /dev/null
+++ b/lang/smlnj/patches/patch-src_runtime_gc_gc-stats.h
@@ -0,0 +1,44 @@
+$NetBSD: patch-src_runtime_gc_gc-stats.h,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use struct timeval instead of blithely assuming that some private
+struct declaration is always bit compatible with it. (Because it
+isn't.) From PR 40954.
+
+--- src/runtime/gc/gc-stats.h.orig 2009-03-03 18:23:38.000000000 -0500
++++ src/runtime/gc/gc-stats.h 2009-03-03 18:25:04.000000000 -0500
+@@ -16,6 +16,7 @@ extern void ReportVM (ml_state_t *msp, i
+
+ #define START_GC_PAUSE(HEAP) { \
+ if (StatsOn) { \
++ struct timeval tv; \
+ heap_t *__heap = (HEAP); \
+ stat_rec_t *__p = &(StatsBuf[NStatsRecs]); \
+ Unsigned32_t __n = (Addr_t)(msp->ml_allocPtr) - \
+@@ -23,7 +24,10 @@ extern void ReportVM (ml_state_t *msp, i
+ CNTR_INCR(&(__heap->numAlloc), __n); \
+ __p->allocCnt = __heap->numAlloc; \
+ __p->numGens = 0; \
+- gettimeofday(&(__p->startTime), NIL(struct timezone *)); \
++ gettimeofday(&tv, NIL(struct timezone *)); \
++ /* XXX breaks in 2038 */ \
++ __p->startTime.seconds = tv.tv_sec; \
++ __p->startTime.uSeconds = tv.tv_usec; \
+ } \
+ }
+
+@@ -34,8 +38,11 @@ extern void ReportVM (ml_state_t *msp, i
+
+ #define STOP_GC_PAUSE() { \
+ if (StatsOn) { \
+- gettimeofday(&(StatsBuf[NStatsRecs].stopTime), \
+- NIL(struct timezone *)); \
++ struct timeval tv; \
++ gettimeofday(&tv, NIL(struct timezone *)); \
++ /* XXX breaks in 2038 */ \
++ StatsBuf[NStatsRecs].stopTime.seconds = tv.tv_sec; \
++ StatsBuf[NStatsRecs].stopTime.uSeconds = tv.tv_usec; \
+ STATS_FINISH(); \
+ } \
+ }
+
+
diff --git a/lang/smlnj/patches/patch-src_runtime_gc_init-gc.c b/lang/smlnj/patches/patch-src_runtime_gc_init-gc.c
new file mode 100644
index 00000000000..bdf1f70c862
--- /dev/null
+++ b/lang/smlnj/patches/patch-src_runtime_gc_init-gc.c
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_runtime_gc_init-gc.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use struct timeval instead of blithely assuming that some private
+struct declaration is always bit compatible with it. (Because it
+isn't.) From PR 40954.
+
+--- src/runtime/gc/init-gc.c.orig 2009-03-03 18:15:36.000000000 -0500
++++ src/runtime/gc/init-gc.c 2009-03-03 18:17:03.000000000 -0500
+@@ -218,12 +218,16 @@ void InitHeap (ml_state_t *msp, bool_t i
+ #if defined(COLLECT_STATS)
+ if (StatsFD > 0) {
+ stat_hdr_t hdr;
++ struct timeval tv;
+ CNTR_ZERO(&(heap->numAlloc));
+ hdr.mask = STATMASK_ALLOC|STATMASK_NGENS|STATMASK_START|STATMASK_STOP;
+ hdr.isNewRuntime = 1;
+ hdr.allocSzB = params->allocSz;
+ hdr.numGens = params->numGens;
+- gettimeofday (&(hdr.startTime), NIL(struct timezone *));
++ gettimeofday (&tv, NIL(struct timezone *));
++ /* XXX breaks in 2038 */
++ hdr.startTime.seconds = tv.tv_sec;
++ hdr.startTime.uSeconds = tv.tv_usec;
+ write (StatsFD, (char *)&hdr, sizeof(stat_hdr_t));
+ }
+ #endif
+
diff --git a/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c b/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
new file mode 100644
index 00000000000..6f9770d387e
--- /dev/null
+++ b/lang/smlnj/patches/patch-src_runtime_kernel_unix-timers.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_runtime_kernel_unix-timers.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Don't blithely assume that some internal type has the same layout as a
+system type. It doesn't. Same issue as PR 40954, but a new case that I
+either didn't find at the time or has appeared since.
+
+--- src/runtime/kernel/unix-timers.c~ 2000-06-01 18:34:03.000000000 +0000
++++ src/runtime/kernel/unix-timers.c
+@@ -18,7 +18,7 @@ typedef struct rusage time_struct_t;
+ #define GET_TIME(t) getrusage(RUSAGE_SELF, &(t))
+ #define SYS_TIME(t) ((t).ru_stime)
+ #define USR_TIME(t) ((t).ru_utime)
+-#define SET_TIME(tp, t) { *((struct timeval *)(tp)) = (t); }
++#define SET_TIME(tp, t) { (tp)->seconds = (t).tv_sec; (tp)->uSeconds = (t).tv_usec; }
+
+ #else /* !HAS_GETRUSAGE */
+
diff --git a/lang/smlnj/patches/patch-src_runtime_mach-dep_unix-prof.c b/lang/smlnj/patches/patch-src_runtime_mach-dep_unix-prof.c
new file mode 100644
index 00000000000..68f6c2eea38
--- /dev/null
+++ b/lang/smlnj/patches/patch-src_runtime_mach-dep_unix-prof.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_runtime_mach-dep_unix-prof.c,v 1.1 2016/04/14 21:58:22 dholland Exp $
+
+Use own abstractions correctly.
+
+--- src/runtime/mach-dep/unix-prof.c~ 2005-01-18 17:58:39.000000000 +0000
++++ src/runtime/mach-dep/unix-prof.c
+@@ -34,7 +34,7 @@ void EnableProfSignals ()
+ */
+ void DisableProfSignals ()
+ {
+- SIG_SetHandler (SIGVTALRM, SIG_DFL);
++ SIG_SetDefault (SIGVTALRM);
+
+ } /* end of DisableProfSignals */
+