pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/35149: Mono build patches for NetBSD



>Number:         35149
>Category:       pkg
>Synopsis:       Mono build patches for NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 28 20:20:00 +0000 2006
>Originator:     Jeffrey Bedard
>Release:        3.1_STABLE
>Organization:
University of Rhode Island
>Environment:
NetBSD antiright.dyndns.org 3.1_STABLE NetBSD 3.1_STABLE (AR) #2: Mon Nov 27 
17:43:54 EST 2006  
root%antiright.dyndns.org@localhost:/usr/sources/src/sys/arch/amd64/compile/AR 
amd64
>Description:
mono does not currently build for NetBSD in pkgsrc.  I was able to build mono, 
however the mcs directory does not yet build.  The patches for building without 
mcs on NetBSD/amd64 are attached.
>How-To-Repeat:
Attempt a mono build on NetBSD/amd64.
>Fix:
--- ./mono/utils/mono-codeman.c.orig    2006-11-27 23:32:19.000000000 -0500
+++ ./mono/utils/mono-codeman.c 2006-11-27 23:34:02.000000000 -0500
@@ -46,7 +46,8 @@
 #endif
 
 #ifdef __x86_64__
-#define ARCH_MAP_FLAGS MAP_32BIT
+/*#define ARCH_MAP_FLAGS MAP_32BIT*/
+#define ARCH_MAP_FLAGS 0
 #else
 #define ARCH_MAP_FLAGS 0
 #endif
--- ./mono/io-layer/collection.c.orig   2006-11-27 23:34:35.000000000 -0500
+++ ./mono/io-layer/collection.c        2006-11-27 23:35:47.000000000 -0500
@@ -60,7 +60,7 @@
        g_assert (ret == 0);
        
 #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
-#ifdef __FreeBSD__
+#ifdef PLATFORM_BSD
        ret = pthread_attr_setstacksize (&attr, 65536);
 #else
        ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
--- ./mono/metadata/boehm-gc.c.orig  2006-11-27 23:40:40.000000000 -0500
+++ ./mono/metadata/boehm-gc.c  2006-11-27 23:42:42.000000000 -0500
@@ -76,23 +76,20 @@
 gboolean
 mono_gc_is_gc_thread (void)
 {
-#ifdef USE_INCLUDED_LIBGC
-       return GC_thread_is_registered ();
-#else
        return TRUE;
-#endif
 }
 
 gboolean
 mono_gc_register_thread (void *baseptr)
 {
        if (mono_gc_is_gc_thread())
+       {
                return TRUE;
-#if defined(USE_INCLUDED_LIBGC) && !defined(PLATFORM_WIN32)
-       return GC_thread_register_foreign (baseptr);
-#else
-       return FALSE;
-#endif
+       }
+       else
+       {
+               return FALSE;
+       }
 }
 
 extern int GC_is_marked (void *p);
--- ./mono/mini/exceptions-amd64.c.orig 2006-11-27 23:46:56.000000000 -0500
+++ ./mono/mini/exceptions-amd64.c      2006-11-27 23:56:01.000000000 -0500
@@ -21,6 +21,9 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/gc-internal.h>
 #include <mono/metadata/mono-debug.h>
+#ifdef PLATFORM_BSD
+#include <amd64/mcontext.h>
+#endif
 
 #include "mini.h"
 #include "mini-amd64.h"
@@ -634,7 +637,7 @@
 static inline guint64*
 gregs_from_ucontext (ucontext_t *ctx)
 {
-#ifdef __FreeBSD__
+#ifdef PLATFORM_BSD
     guint64 *gregs = (guint64 *) &ctx->uc_mcontext;
 #else
     guint64 *gregs = (guint64 *) &ctx->uc_mcontext.gregs;
@@ -649,7 +652,7 @@
        ucontext_t *ctx = (ucontext_t*)sigctx;
 
     guint64 *gregs = gregs_from_ucontext (ctx);
-
+#ifndef PLATFORM_BSD
        mctx->rax = gregs [REG_RAX];
        mctx->rbx = gregs [REG_RBX];
        mctx->rcx = gregs [REG_RCX];
@@ -663,6 +666,22 @@
        mctx->r13 = gregs [REG_R13];
        mctx->r14 = gregs [REG_R14];
        mctx->r15 = gregs [REG_R15];
+#else
+       mctx->rax = gregs [_REG_RAX];
+       mctx->rbx = gregs [_REG_RBX];
+       mctx->rcx = gregs [_REG_RCX];
+       mctx->rdx = gregs [_REG_RDX];
+       mctx->rbp = gregs [_REG_RBP];
+       mctx->rsp = gregs [_REG_URSP];
+       mctx->rsi = gregs [_REG_RSI];
+       mctx->rdi = gregs [_REG_RDI];
+       mctx->rip = gregs [_REG_RIP];
+       mctx->r12 = gregs [_REG_R12];
+       mctx->r13 = gregs [_REG_R13];
+       mctx->r14 = gregs [_REG_R14];
+       mctx->r15 = gregs [_REG_R15];
+
+#endif
 }
 
 void
@@ -671,7 +690,7 @@
        ucontext_t *ctx = (ucontext_t*)sigctx;
 
     guint64 *gregs = gregs_from_ucontext (ctx);
-
+#ifndef PLATFORM_BSD
        gregs [REG_RAX] = mctx->rax;
        gregs [REG_RBX] = mctx->rbx;
        gregs [REG_RCX] = mctx->rcx;
@@ -685,6 +704,22 @@
        gregs [REG_R13] = mctx->r13;
        gregs [REG_R14] = mctx->r14;
        gregs [REG_R15] = mctx->r15;
+#else
+       gregs [_REG_RAX] = mctx->rax;
+       gregs [_REG_RBX] = mctx->rbx;
+       gregs [_REG_RCX] = mctx->rcx;
+       gregs [_REG_RDX] = mctx->rdx;
+       gregs [_REG_RBP] = mctx->rbp;
+       gregs [_REG_URSP] = mctx->rsp;
+       gregs [_REG_RSI] = mctx->rsi;
+       gregs [_REG_RDI] = mctx->rdi;
+       gregs [_REG_RIP] = mctx->rip;
+       gregs [_REG_R12] = mctx->r12;
+       gregs [_REG_R13] = mctx->r13;
+       gregs [_REG_R14] = mctx->r14;
+       gregs [_REG_R15] = mctx->r15;
+
+#endif
 }
 
 gpointer
@@ -693,7 +728,10 @@
        ucontext_t *ctx = (ucontext_t*)sigctx;
 
     guint64 *gregs = gregs_from_ucontext (ctx);
-
+#ifndef PLATFORM_BSD
        return (gpointer)gregs [REG_RIP];
+#else
+       return (gpointer)gregs [_REG_RIP];
+#endif
 }
--- ./mono/mini/aot-runtime.c.orig      2006-11-27 23:56:52.000000000 -0500
+++ ./mono/mini/aot-runtime.c   2006-11-28 00:46:04.000000000 -0500
@@ -398,7 +398,7 @@
 
                        res = g_spawn_command_line_sync (cmd, &out, &err, 
&exit_status, NULL);
 
-#if !defined(PLATFORM_WIN32) && !defined(__ppc__) && !defined(__powerpc__)
+#if !defined(PLATFORM_WIN32) && !defined(__ppc__) && !defined(__powerpc__) && 
!defined(PLATFORM_BSD)
                        if (res) {
                                if (!WIFEXITED (exit_status) && (WEXITSTATUS 
(exit_status) == 0))
                                        mono_trace (G_LOG_LEVEL_MESSAGE, 
MONO_TRACE_AOT, "AOT failed: %s.", err);




Home | Main Index | Thread Index | Old Index