From a35d65c3465de9661325a9295715b1ef298eb888 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 11 Nov 2009 11:18:21 +0000 Subject: [PATCH] Support for DragonFly BSD Patches from Goetz Isenmann , slightly updated for HEAD (the method for configuring platforms in configure.ac has changed). --- compiler/nativeGen/NCG.h | 6 ++++++ configure.ac | 2 +- driver/mangler/ghc-asm.lprl | 6 +++--- mk/config.mk.in | 2 +- rts/Linker.c | 8 ++++---- rts/RtsUtils.c | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/nativeGen/NCG.h b/compiler/nativeGen/NCG.h index b17f682..3a7bfcd 100644 --- a/compiler/nativeGen/NCG.h +++ b/compiler/nativeGen/NCG.h @@ -38,6 +38,12 @@ # define IF_OS_freebsd(x,y) y #endif -- - - - - - - - - - - - - - - - - - - - - - +#if dragonfly_TARGET_OS +# define IF_OS_dragonfly(x,y) x +#else +# define IF_OS_dragonfly(x,y) y +#endif +-- - - - - - - - - - - - - - - - - - - - - - #if netbsd_TARGET_OS # define IF_OS_netbsd(x,y) x #else diff --git a/configure.ac b/configure.ac index c11d663..60371a9 100644 --- a/configure.ac +++ b/configure.ac @@ -296,7 +296,7 @@ checkVendor() { checkOS() { case $1 in - linux|freebsd|netbsd|openbsd|osf1|osf3|hpux|linuxaout|kfreebsdgnu|freebsd2|solaris2|cygwin32|mingw32|darwin|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix) + linux|freebsd|netbsd|openbsd|dragonfly|osf1|osf3|hpux|linuxaout|kfreebsdgnu|freebsd2|solaris2|cygwin32|mingw32|darwin|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix) ;; *) echo "Unknown OS '$1'" diff --git a/driver/mangler/ghc-asm.lprl b/driver/mangler/ghc-asm.lprl index 34f4758..1ff78a4 100644 --- a/driver/mangler/ghc-asm.lprl +++ b/driver/mangler/ghc-asm.lprl @@ -160,12 +160,12 @@ sub init_TARGET_STUFF { $T_HDR_vector = "\.text\n\t\.align 4\n"; # NB: requires padding #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|gnu|freebsd|netbsd|openbsd|kfreebsdgnu)$/m ) { + } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|gnu|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu)$/m ) { $T_STABBY = 0; # 1 iff .stab things (usually if a.out format) $T_US = ''; # _ if symbols have an underscore on the front $T_PRE_APP = # regexp that says what comes before APP/NO_APP - ($TargetPlatform =~ /-(linux|gnu|freebsd|netbsd|openbsd)$/m) ? '#' : '/' ; + ($TargetPlatform =~ /-(linux|gnu|freebsd|dragonfly|netbsd|openbsd)$/m) ? '#' : '/' ; $T_CONST_LBL = '^\.LC(\d+):$'; # regexp for what such a lbl looks like $T_POST_LBL = ':'; $T_X86_PRE_LLBL_PAT = '\.L'; @@ -216,7 +216,7 @@ sub init_TARGET_STUFF { $T_HDR_vector = "\.text\n\t\.align 8\n"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|netbsd)$/m ) { + } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|dragonfly|netbsd)$/m ) { $T_STABBY = 0; # 1 iff .stab things (usually if a.out format) $T_US = ''; # _ if symbols have an underscore on the front diff --git a/mk/config.mk.in b/mk/config.mk.in index ee53a5a..36dd2d3 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -153,7 +153,7 @@ GhcWithSMP=$(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)), # Whether to include GHCi in the compiler. Depends on whether the RTS linker # has support for this OS/ARCH combination. -OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd netbsd openbsd darwin))) +OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin))) ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64))) ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES" diff --git a/rts/Linker.c b/rts/Linker.c index 1576e49..e3278b5 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -63,12 +63,12 @@ #include #endif -#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) +#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) #define USE_MMAP #include #include -#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) +#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) #ifdef HAVE_UNISTD_H #include #endif @@ -76,7 +76,7 @@ #endif -#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) +#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) # define OBJFORMAT_ELF #elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS) # define OBJFORMAT_PEi386 @@ -1403,7 +1403,7 @@ mmap_again: } else { if ((W_)result > 0x80000000) { // oops, we were given memory over 2Gb -#if defined(freebsd_HOST_OS) +#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) // Some platforms require MAP_FIXED. This is normally // a bad idea, because MAP_FIXED will overwrite // existing mappings. diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 1953e1e..51c1250 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -369,7 +369,7 @@ heapCheckFail( void ) * genericRaise(), rather than raise(3). */ int genericRaise(int sig) { -#if defined(THREADED_RTS) && (defined(openbsd_HOST_OS) || defined(freebsd_HOST_OS)) +#if defined(THREADED_RTS) && (defined(openbsd_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)) return pthread_kill(pthread_self(), sig); #else return raise(sig); -- 1.7.10.4