diff options
author | marcus <marcus@FreeBSD.org> | 2003-10-20 13:32:13 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2003-10-20 13:32:13 +0800 |
commit | 9216c632f1eca53df67371fa3cd1b43e32553edf (patch) | |
tree | 68871d372004add82bb5439ddda2b8bedd8c3936 /lang/guile | |
parent | 7d6fb622f7377ce30549760f2190f92298f62fd8 (diff) | |
download | freebsd-ports-gnome-9216c632f1eca53df67371fa3cd1b43e32553edf.tar.gz freebsd-ports-gnome-9216c632f1eca53df67371fa3cd1b43e32553edf.tar.zst freebsd-ports-gnome-9216c632f1eca53df67371fa3cd1b43e32553edf.zip |
Fix build and execution of guile on ia64:
* Use continuation->backing_store to determine if we return for the first
time from getcontext(). This avoids having to depend on non-POSIX semantics
of the Linux implementation.
* Avoid using __libc_ia64_register_backing_store_base by hardcoding the base
of the backing store. The kernel is changed to put the backing store at
this address. It's not entirely clean, but I want to avoid adding all sorts
of variables in our libc for this for now.
* Fix a genuine bug in the ia64 case: the ia64-specific fields are not
initialized. On FreeBSD this means they have garbage (= 0xd0). Call
memset() after allocation to make sure the contregs structure is properly
cleared. Since this may affect other architectures, this patch will be
ia64 only.
Submitted by: marcel
Diffstat (limited to 'lang/guile')
-rw-r--r-- | lang/guile/Makefile | 8 | ||||
-rw-r--r-- | lang/guile/files/extra-patch-ia64 | 96 | ||||
-rw-r--r-- | lang/guile/files/patch-libguile_gc_os_dep.c | 13 |
3 files changed, 112 insertions, 5 deletions
diff --git a/lang/guile/Makefile b/lang/guile/Makefile index 573cb63316f9..c5014fd14aa1 100644 --- a/lang/guile/Makefile +++ b/lang/guile/Makefile @@ -34,6 +34,12 @@ REINPLACE_FILES= libguile/gc.c libguile/mallocs.c \ INFO= goops guile-tut guile r5rs +.include <bsd.port.pre.mk> + +.if ${ARCH} == "ia64" +EXTRA_PATCHES= ${FILESDIR}/extra-patch-ia64 +.endif + post-extract: cd ${WRKSRC}; ${CHMOD} u+w ${REINPLACE_FILES} @${FIND} ${WRKSRC}/doc -name "*.info*" -delete @@ -44,4 +50,4 @@ post-patch: @${REINPLACE_CMD} -e 's|%%X11BASE%%|${X11BASE}|g ; \ s|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/libguile/load.c -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/lang/guile/files/extra-patch-ia64 b/lang/guile/files/extra-patch-ia64 new file mode 100644 index 000000000000..651ca73fe1c1 --- /dev/null +++ b/lang/guile/files/extra-patch-ia64 @@ -0,0 +1,96 @@ +--- libguile/continuations.c.orig Sat Dec 7 14:41:31 2002 ++++ libguile/continuations.c Sun Oct 19 21:44:01 2003 +@@ -114,16 +114,6 @@ + return 1; + } + +-#ifdef __ia64__ +-struct rv +-{ +- long retval; +- long first_return; +-}; +-extern struct rv getcontext (ucontext_t *); +-extern int setcontext (ucontext_t *); +-#endif /* __ia64__ */ +- + /* this may return more than once: the first time with the escape + procedure, then subsequently with the value to be passed to the + continuation. */ +@@ -136,9 +126,6 @@ + scm_t_contregs *rootcont = SCM_CONTREGS (scm_rootcont); + long stack_size; + SCM_STACKITEM * src; +-#ifdef __ia64__ +- struct rv rv; +-#endif + + SCM_ENTER_A_SECTION; + SCM_FLUSH_REGISTER_WINDOWS; +@@ -163,17 +150,15 @@ + memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size); + + #ifdef __ia64__ +- rv = getcontext (&continuation->ctx); +- if (rv.first_return) ++ continuation->backing_store = NULL; ++ getcontext(&continuation->ctx); ++ if (continuation->backing_store == NULL) + { + continuation->backing_store_size = +- continuation->ctx.uc_mcontext.sc_ar_bsp - +- __libc_ia64_register_backing_store_base; +- continuation->backing_store = NULL; ++ continuation->ctx.uc_mcontext.mc_special.bspstore - (4UL << 61); + continuation->backing_store = + scm_must_malloc (continuation->backing_store_size, FUNC_NAME); +- memcpy (continuation->backing_store, +- (void *) __libc_ia64_register_backing_store_base, ++ memcpy (continuation->backing_store, (void *)(4UL << 61), + continuation->backing_store_size); + *first = 1; + return cont; +@@ -236,8 +221,7 @@ + + continuation->throw_value = val; + #ifdef __ia64__ +- memcpy ((void *) __libc_ia64_register_backing_store_base, +- continuation->backing_store, ++ memcpy ((void *)(4UL << 61), continuation->backing_store, + continuation->backing_store_size); + setcontext (&continuation->ctx); + #else +--- libguile/gc.c.orig Sun Apr 20 11:16:59 2003 ++++ libguile/gc.c Sun Oct 19 21:44:01 2003 +@@ -1041,8 +1041,8 @@ + scm_mark_locations ((SCM_STACKITEM *) &ctx.uc_mcontext, \ + ((size_t) (sizeof (SCM_STACKITEM) - 1 + sizeof ctx.uc_mcontext) \ + / sizeof (SCM_STACKITEM))); \ +- bot = (SCM_STACKITEM *) __libc_ia64_register_backing_store_base; \ +- top = (SCM_STACKITEM *) ctx.uc_mcontext.sc_ar_bsp; \ ++ bot = (SCM_STACKITEM *) (4UL << 61); \ ++ top = (SCM_STACKITEM *) ctx.uc_mcontext.mc_special.bspstore; \ + scm_mark_locations (bot, top - bot); } while (0) + #else + # define SCM_MARK_BACKING_STORE() +--- libguile/init.c.orig Sat Dec 7 14:41:32 2002 ++++ libguile/init.c Sun Oct 19 21:44:01 2003 +@@ -188,6 +188,7 @@ + { + scm_t_contregs *contregs = scm_must_malloc (sizeof (scm_t_contregs), + "continuation"); ++ memset(contregs, 0, sizeof(*contregs)); + contregs->num_stack_items = 0; + contregs->seq = 0; + SCM_NEWSMOB (scm_rootcont, scm_tc16_continuation, contregs); +--- libguile/root.c.orig Sat Dec 7 14:41:32 2002 ++++ libguile/root.c Sun Oct 19 21:44:01 2003 +@@ -253,7 +253,7 @@ + { + scm_t_contregs *contregs = scm_must_malloc (sizeof (scm_t_contregs), + "inferior root continuation"); +- ++ memset(contregs, 0, sizeof(*contregs)); + contregs->num_stack_items = 0; + contregs->dynenv = SCM_EOL; + contregs->base = stack_start; diff --git a/lang/guile/files/patch-libguile_gc_os_dep.c b/lang/guile/files/patch-libguile_gc_os_dep.c index e16c5d1e9fa5..aed1efee3e07 100644 --- a/lang/guile/files/patch-libguile_gc_os_dep.c +++ b/lang/guile/files/patch-libguile_gc_os_dep.c @@ -1,5 +1,5 @@ ---- libguile/gc_os_dep.c.orig Wed Apr 16 13:16:21 2003 -+++ libguile/gc_os_dep.c Thu May 22 20:41:37 2003 +--- libguile/gc_os_dep.c.orig Mon Oct 20 01:22:19 2003 ++++ libguile/gc_os_dep.c Mon Oct 20 01:22:03 2003 @@ -93,6 +93,14 @@ # define OPENBSD # define mach_type_known @@ -15,11 +15,16 @@ # if defined(__NetBSD__) && defined(__powerpc__) # define POWERPC # define NETBSD -@@ -225,7 +233,11 @@ +@@ -225,7 +233,16 @@ # define ARM32 # define mach_type_known # endif -# if defined(__alpha) || defined(__alpha__) ++# if defined(__FreeBSD__) && defined(__ia64__) ++# define FREEBSD ++# define IA64 ++# define mach_type_known ++# endif +# if defined(__FreeBSD__) && defined(__alpha__) +# define FREEBSD +# define ALPHA @@ -28,7 +33,7 @@ # define ALPHA # if !defined(LINUX) # define OSF1 /* a.k.a Digital Unix */ -@@ -1468,7 +1480,7 @@ +@@ -1468,7 +1485,7 @@ # include <setjmp.h> #endif |