Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
On Apr 12, 2005 12:32 AM, Miguel de Icaza <[EMAIL PROTECTED]> wrote: > Preview=yes will become the new default. Ah. Thanks for the clarification. I guess the logic will have to be reversed in that test. And speaking of PREVIEW, I've been getting some strange errors lately when building the 2.0 classes with gmcs, and I thought I'd ask if anyone else is having the same sort of difficulties. It occurs mostly when building the I18N classes, both under windows and freebsd. It does not, however, occur every time under freebsd. But under windows, I currently cannot build I18N.dll at all within an ordinary make. >error CS0016: Could not write to file `../../../class/lib/net_2_0/I18N.dll', cause: Sharing violation on path ../../../class/lib/net_2_0\I18N.dll Compilation failed: 1 error(s), 0 warnings Under freebsd, where i use compile-time-errors, the errors look like the one below. It feels like it might be related to the parser. Any ideas? Bill MONO_PATH="../../../class/lib/net_2_0:$MONO_PATH" /home/wjm/src/mono/runtime/mono-wrapper ../../../gmcs/gmcs.exe /r:mscorlib.dll /r:I18N.dll -d:NET_1_1 -d:NET_2_0 -debug /noconfig /target:library /out:../../../class/lib/net_2_0/I18N.dll @I18N.dll.sources error CS0666: Compilation aborted: System.IO.IOException: Invalid handle to path "CP1256.cs" in <0x00085> System.IO.FileStream:ReadData (IntPtr handle, System.Byte[] buf, Int32 offset, Int32 count) in (wrapper remoting-invoke-with-check) System.IO.FileStream:ReadData (intptr,byte[],int,int) in <0x0002c> System.IO.FileStream:RefillBuffer () in (wrapper remoting-invoke-with-check) System.IO.FileStream:RefillBuffer () in <0x000ac> System.IO.FileStream:ReadInternal (System.Byte[] dest, Int32 dest_offset, Int32 count) in (wrapper remoting-invoke-with-check) System.IO.FileStream:ReadInternal (byte[],int,int) in <0x000af> System.IO.FileStream:Read (System.Byte[] dest, Int32 dest_offset, Int32 count) in <0x00039> System.IO.StreamReader:ReadBuffer () in (wrapper remoting-invoke-with-check) System.IO.StreamReader:ReadBuffer () in <0x0006c> System.IO.StreamReader:Read (System.Char[] dest_buffer, Int32 index, Int32 count) in <0x0002f> Mono.CSharp.SeekableStreamReader:ReadBuffer () in <0x0001f> Mono.CSharp.SeekableStreamReader:Read () in <0x0010b> Mono.CSharp.Tokenizer:consume_identifier (Int32 s, Boolean quoted) in <0x00044> Mono.CSharp.Tokenizer:consume_identifier (Int32 s) in <0x0006f> Mono.CSharp.Tokenizer:xtoken () in <0x00019> Mono.CSharp.Tokenizer:token () in <0x002cc> Mono.CSharp.CSharpParser:yyparse (yyInput yyLex) in <0x00054> Mono.CSharp.CSharpParser:parse () in <0x0010e> Mono.CSharp.Driver:parse (Mono.CSharp.SourceFile file) aborting... Abort trap (core dumped) ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
Hello, > Thanks Zoltan, we freebsd folks look forward to its inclusion. > > Regarding $PREVIEW I guess it's enabled by default in svn and will be > disabled in the release? Preview=yes will become the new default. Miguel ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
Hi Lupus, I will work up another patch to implement your suggestions. I based the original on the principle of "do the least harm", but I will remove the #ifdefs where you have suggested, and setup a check for ucontext.h in configure.in. See below. On Apr 11, 2005 7:17 PM, Paolo Molaro <[EMAIL PROTECTED]> wrote: > #if defined(__FreeBSD__) > #define CTX_REG_EAX(ctx) ((ctx)uc_mcontext.mc_eax) > ... > #else > #define CTX_REG_EAX(ctx) ((ctx)uc_mcontext.gregs [REG_EAX]) > ... > #endif > > This way the #ifdefs are moved to the header file and not in the middle > of the code. This one is a bit trickier. The current implementation relies on Zoltan's new sigcontext_to_monocontext() fix, and I don't know how he wants to handle it going forward. I'll defer to him. Thanks for the feedback. Bill ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
On 04/11/05 Bill Middleton wrote: > Index: mono/mini/exceptions-x86.c > === > --- mono/mini/exceptions-x86.c(revision 42774) > +++ mono/mini/exceptions-x86.c(working copy) > @@ -25,6 +25,10 @@ > #include "mini.h" > #include "mini-x86.h" > > +#if defined(__FreeBSD__) > +#include > +#endif Maybe it's better to check if the header is present in configure and use HAVE_UCONTEXT_H here? Same with checking for the gregs field in ctx->uc_mcontext. In any case it may be better to define the macros to access the registers in the context and use those in the file: #if defined(__FreeBSD__) #define CTX_REG_EAX(ctx) ((ctx)uc_mcontext.mc_eax) ... #else #define CTX_REG_EAX(ctx) ((ctx)uc_mcontext.gregs [REG_EAX]) ... #endif This way the #ifdefs are moved to the header file and not in the middle of the code. > Index: mono/mini/mini-x86.c > === > --- mono/mini/mini-x86.c (revision 42774) > +++ mono/mini/mini-x86.c (working copy) > @@ -4691,6 +4691,9 @@ > pthread_getattr_np( self, &attr ); > #else > #ifdef HAVE_PTHREAD_ATTR_GET_NP > +#if defined(__FreeBSD__) > + pthread_attr_init( &attr ); > +#endif This is likely a good idea on any platform, right? So no need for #ifdefs. > Index: mono/mini/mini-x86.h > === > --- mono/mini/mini-x86.h (revision 42774) > +++ mono/mini/mini-x86.h (working copy) > @@ -77,17 +77,21 @@ > #ifndef PLATFORM_WIN32 > > #ifdef HAVE_WORKING_SIGALTSTACK > - > #define MONO_ARCH_SIGSEGV_ON_ALTSTACK > #define MONO_ARCH_USE_SIGACTION > > -/* NetBSD doesn't define SA_STACK */ > -#ifndef SA_STACK > -#define SA_STACK SA_ONSTACK > -#endif > -#endif > +/* FreeBSD and NetBSD need SA_STACK and MAP_ANON re-definitions */ > +#if defined(__FreeBSD__) || defined(__NetBSD__) > +#ifndef SA_STACK > +#define SA_STACK SA_ONSTACK > +#endif > +#ifndef MAP_ANONYMOUS > +#define MAP_ANONYMOUS MAP_ANON > +#endif > +#endif /* BSDs */ This stuff doesn't belong to mini-x86.h, though mono-compiler.h is not a good place either. In any case, I don't see any need to make this conditional on __FreeBSD__/__NetBSD__, so remove at least that. Thanks! lupus -- - [EMAIL PROTECTED] debian/rules [EMAIL PROTECTED] Monkeys do it better ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
Thanks Zoltan, we freebsd folks look forward to its inclusion. Regarding $PREVIEW I guess it's enabled by default in svn and will be disabled in the release? Also, regarding the two nits I hurriedly sent, there's a Good Explanation (tm) for those. As I was finalizing the patch, I noticed that I had #ifdef'd only __FreeBSD__ for the sigaltstack changes in exceptions-x86.c, where I could have checked for both FreeBSD and NetBSD. I started to change it, then decided to double check. After a visit to the NetBSD source CVS archive, I found that NetBSD _does_ define gregs[], so the change was not needed. NetBSD sigaltstack should build out of the box now with the SA_STACK change to configure.in, and the command line option to configure. Still, I should have done that one, last test build. I know. Regards, Bill On Apr 11, 2005 2:43 PM, Zoltan Varga <[EMAIL PROTECTED]> wrote: > Hi, > > This looks ok to me, except this part: > > PREVIEW=yes > AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to > install the 2.0 FX preview],[ > - if test x$with_preview = xyes; then > - PREVIEW=yes > + if test x$with_preview = xno; then > + PREVIEW=no > fi > > Zoltan > > On Apr 11, 2005 12:48 PM, Bill Middleton <[EMAIL PROTECTED]> wrote: > > And one more. Thats what I get for doing last-minute touchups. > > > > 313c313 > > < +#if def(__FreeBSD__) > > --- > > > +#if defined(__FreeBSD__) > > > > Thanks for your patience, Complete, working patch attached. > > > > Bill > > > > > > > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
Hi, This looks ok to me, except this part: PREVIEW=yes AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to install the 2.0 FX preview],[ - if test x$with_preview = xyes; then - PREVIEW=yes + if test x$with_preview = xno; then + PREVIEW=no fi Zoltan On Apr 11, 2005 12:48 PM, Bill Middleton <[EMAIL PROTECTED]> wrote: > And one more. Thats what I get for doing last-minute touchups. > > 313c313 > < +#if def(__FreeBSD__) > --- > > +#if defined(__FreeBSD__) > > Thanks for your patience, Complete, working patch attached. > > Bill > > > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
And one more. Thats what I get for doing last-minute touchups. 313c313 < +#if def(__FreeBSD__) --- > +#if defined(__FreeBSD__) Thanks for your patience, Complete, working patch attached. Bill Index: libgc/include/private/gcconfig.h === --- libgc/include/private/gcconfig.h(revision 42774) +++ libgc/include/private/gcconfig.h(working copy) @@ -1186,8 +1186,8 @@ # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND SIGTSTP +# define SIG_THR_RESTART SIGCONT # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING @@ -1501,8 +1501,8 @@ # ifdef FREEBSD # define OS_TYPE "FREEBSD" /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */ -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND SIGTSTP +# define SIG_THR_RESTART SIGCONT # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING Index: libgc/configure.in === --- libgc/configure.in (revision 42774) +++ libgc/configure.in (working copy) @@ -124,6 +124,17 @@ THREADLIBS="$PTHREAD_LIBS" fi ;; + *-*-freebsd6*) + AC_DEFINE(GC_FREEBSD_THREADS) + if test "x$PTHREAD_CFLAGS" != "x"; then + INCLUDES="$INCLUDES $PTHREAD_CFLAGS" + fi + if test "x$PTHREAD_LIBS" = "x"; then + THREADLIBS=-lpthread + else + THREADLIBS="$PTHREAD_LIBS" + fi + ;; *-*-solaris*) AC_DEFINE(GC_SOLARIS_THREADS) AC_DEFINE(GC_SOLARIS_PTHREADS) Index: libgc/os_dep.c === --- libgc/os_dep.c (revision 42774) +++ libgc/os_dep.c (working copy) @@ -702,10 +702,10 @@ # endif # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ -|| defined(HURD) || defined(NETBSD) +|| defined(HURD) || defined(NETBSD) || defined(FREEBSD) static struct sigaction old_segv_act; # if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \ - || defined(HURD) || defined(NETBSD) + || defined(HURD) || defined(NETBSD) || defined(FREEBSD) static struct sigaction old_bus_act; # endif # else @@ -720,7 +720,7 @@ # endif { # if defined(SUNOS5SIGS) || defined(IRIX5) \ -|| defined(OSF1) || defined(HURD) || defined(NETBSD) +|| defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) struct sigaction act; act.sa_handler= h; @@ -740,7 +740,7 @@ #else (void) sigaction(SIGSEGV, &act, &old_segv_act); # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ - || defined(HPUX) || defined(HURD) || defined(NETBSD) + || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) /* Under Irix 5.x or HP/UX, we may get SIGBUS. */ /* Pthreads doesn't exist under Irix 5.x, so we */ /* don't have to worry in the threads case. */ @@ -776,10 +776,10 @@ void GC_reset_fault_handler() { # if defined(SUNOS5SIGS) || defined(IRIX5) \ - || defined(OSF1) || defined(HURD) || defined(NETBSD) + || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) (void) sigaction(SIGSEGV, &old_segv_act, 0); #if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ -|| defined(HPUX) || defined(HURD) || defined(NETBSD) +|| defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) (void) sigaction(SIGBUS, &old_bus_act, 0); #endif # else Index: libgc/dyn_load.c === --- libgc/dyn_load.c(revision 42774) +++ libgc/dyn_load.c(working copy) @@ -96,20 +96,28 @@ /* Newer versions of GNU/Linux define this macro. We * define it similarly for any ELF systems that don't. */ # ifndef ElfW -#ifdef NETBSD -# if ELFSIZE == 32 +#ifdef FREEBSD +# if __ELF_WORD_SIZE == 32 #define ElfW(type) Elf32_##type # else #define ElfW(type) Elf64_##type # endif #else -# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 -#define ElfW(type) Elf32_##type +# ifdef NETBSD +#if ELFSIZE == 32 +# define ElfW(type) Elf32_##type +#else +# define ElfW(type) Elf64_##type +#endif # else -#define ElfW(type) Elf64_##type +#if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 +# define ElfW(type) Elf32_##type +#else +# define
[Mono-devel-list] Re: Patch: 100% working mono under FreeBSD (small nit)
Some last minute touch-ups broke the patch to exceptions-x86.c, in the patch, please change the following: 286c286 < +#if def(__FreeBSD__) --- > +#if defined(__FreeBSD__) Sorry about that. Updated patch attached Bill Index: libgc/include/private/gcconfig.h === --- libgc/include/private/gcconfig.h(revision 42774) +++ libgc/include/private/gcconfig.h(working copy) @@ -1186,8 +1186,8 @@ # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND SIGTSTP +# define SIG_THR_RESTART SIGCONT # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING @@ -1501,8 +1501,8 @@ # ifdef FREEBSD # define OS_TYPE "FREEBSD" /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */ -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND SIGTSTP +# define SIG_THR_RESTART SIGCONT # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING Index: libgc/configure.in === --- libgc/configure.in (revision 42774) +++ libgc/configure.in (working copy) @@ -124,6 +124,17 @@ THREADLIBS="$PTHREAD_LIBS" fi ;; + *-*-freebsd6*) + AC_DEFINE(GC_FREEBSD_THREADS) + if test "x$PTHREAD_CFLAGS" != "x"; then + INCLUDES="$INCLUDES $PTHREAD_CFLAGS" + fi + if test "x$PTHREAD_LIBS" = "x"; then + THREADLIBS=-lpthread + else + THREADLIBS="$PTHREAD_LIBS" + fi + ;; *-*-solaris*) AC_DEFINE(GC_SOLARIS_THREADS) AC_DEFINE(GC_SOLARIS_PTHREADS) Index: libgc/os_dep.c === --- libgc/os_dep.c (revision 42774) +++ libgc/os_dep.c (working copy) @@ -702,10 +702,10 @@ # endif # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ -|| defined(HURD) || defined(NETBSD) +|| defined(HURD) || defined(NETBSD) || defined(FREEBSD) static struct sigaction old_segv_act; # if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \ - || defined(HURD) || defined(NETBSD) + || defined(HURD) || defined(NETBSD) || defined(FREEBSD) static struct sigaction old_bus_act; # endif # else @@ -720,7 +720,7 @@ # endif { # if defined(SUNOS5SIGS) || defined(IRIX5) \ -|| defined(OSF1) || defined(HURD) || defined(NETBSD) +|| defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) struct sigaction act; act.sa_handler= h; @@ -740,7 +740,7 @@ #else (void) sigaction(SIGSEGV, &act, &old_segv_act); # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ - || defined(HPUX) || defined(HURD) || defined(NETBSD) + || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) /* Under Irix 5.x or HP/UX, we may get SIGBUS. */ /* Pthreads doesn't exist under Irix 5.x, so we */ /* don't have to worry in the threads case. */ @@ -776,10 +776,10 @@ void GC_reset_fault_handler() { # if defined(SUNOS5SIGS) || defined(IRIX5) \ - || defined(OSF1) || defined(HURD) || defined(NETBSD) + || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) (void) sigaction(SIGSEGV, &old_segv_act, 0); #if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ -|| defined(HPUX) || defined(HURD) || defined(NETBSD) +|| defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD) (void) sigaction(SIGBUS, &old_bus_act, 0); #endif # else Index: libgc/dyn_load.c === --- libgc/dyn_load.c(revision 42774) +++ libgc/dyn_load.c(working copy) @@ -96,20 +96,28 @@ /* Newer versions of GNU/Linux define this macro. We * define it similarly for any ELF systems that don't. */ # ifndef ElfW -#ifdef NETBSD -# if ELFSIZE == 32 +#ifdef FREEBSD +# if __ELF_WORD_SIZE == 32 #define ElfW(type) Elf32_##type # else #define ElfW(type) Elf64_##type # endif #else -# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 -#define ElfW(type) Elf32_##type +# ifdef NETBSD +#if ELFSIZE == 32 +# define ElfW(type) Elf32_##type +#else +# define ElfW(type) Elf64_##type +#endif # else -#define ElfW(type) Elf64_##type +#if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 +# define ElfW(type) Elf32_##type +#