$NetBSD: patch-da,v 1.2 2013/09/12 20:13:41 jperkin Exp $

* Support DragonFlyBSD
* Support 64-bit SunOS
* Use mmap on NetBSD

--- libgc/include/private/gcconfig.h.orig	2012-01-30 18:01:22.000000000 +0000
+++ libgc/include/private/gcconfig.h
@@ -163,6 +163,11 @@
 #    define SUNOS5
 #    define mach_type_known
 # endif
+# if defined(sun) && defined(__amd64)
+#    define X86_64
+#    define SUNOS5
+#    define mach_type_known
+# endif
 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
 #    define I386
 #    define OS2
@@ -361,6 +366,9 @@
 #   define OPENBSD
 #   define mach_type_known
 # endif
+# if defined(__DragonFly__)
+# define FREEBSD
+# endif
 # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
 #   define I386
 #   define mach_type_known
@@ -700,6 +708,10 @@
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
+#       ifndef USE_MMAP
+#         define USE_MMAP
+#       endif
+#       define USE_MMAP_ANON
 #	define HEURISTIC2
 #	ifdef __ELF__
 #	  define DATASTART GC_data_start
@@ -891,6 +903,10 @@
 #   ifdef NETBSD
 #     define ALIGNMENT 4
 #     define OS_TYPE "NETBSD"
+#     ifndef USE_MMAP
+#       define USE_MMAP
+#     endif
+#     define USE_MMAP_ANON
 #     define HEURISTIC2
       extern char etext[];
 #     define DATASTART GC_data_start
@@ -1062,6 +1078,10 @@
 #   endif
 #   ifdef NETBSD
 #     define OS_TYPE "NETBSD"
+#     ifndef USE_MMAP
+#       define USE_MMAP
+#     endif
+#     define USE_MMAP_ANON
 #     define HEURISTIC2
 #     ifdef __ELF__
 #	define DATASTART GC_data_start
@@ -1374,6 +1394,10 @@
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
+#       ifndef USE_MMAP
+#           define USE_MMAP
+#       endif
+#       define USE_MMAP_ANON
 #	ifdef __ELF__
 #	    define DYNAMIC_LOADING
 #	endif
@@ -1534,6 +1558,10 @@
 #   if defined(NETBSD)
 #     define ALIGNMENT 4
 #     define OS_TYPE "NETBSD"
+#     ifndef USE_MMAP
+#         define USE_MMAP
+#     endif
+#     define USE_MMAP_ANON
 #     define HEURISTIC2
 #     define USE_GENERIC_PUSH_REGS
 #     ifdef __ELF__
@@ -1660,6 +1688,10 @@
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
+#       ifndef USE_MMAP
+#           define USE_MMAP
+#       endif
+#       define USE_MMAP_ANON
 #	define HEURISTIC2
 #	define DATASTART GC_data_start
 #	define ELFCLASS32 32
@@ -1923,6 +1955,10 @@
 #   define ALIGNMENT 4
 #   ifdef NETBSD
 #       define OS_TYPE "NETBSD"
+#       ifndef USE_MMAP
+#           define USE_MMAP
+#       endif
+#       define USE_MMAP_ANON
 #       define HEURISTIC2
 #	ifdef __ELF__
 #          define DATASTART GC_data_start
@@ -2020,6 +2056,10 @@
 #   endif
 #   ifdef NETBSD
 #      define OS_TYPE "NETBSD"
+#      ifndef USE_MMAP
+#          define USE_MMAP
+#      endif
+#      define USE_MMAP_ANON
 #      define HEURISTIC2
 #      define DATASTART GC_data_start
 #       define USE_GENERIC_PUSH_REGS
@@ -2131,6 +2171,10 @@
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
+#       ifndef USE_MMAP
+#         define USE_MMAP
+#       endif
+#       define USE_MMAP_ANON
 #	ifdef __ELF__
 #	    define DYNAMIC_LOADING
 #	endif
@@ -2138,6 +2182,29 @@
 	extern char etext[];
 #	define SEARCH_FOR_DATA_START
 #   endif
+#   ifdef SUNOS5
+#	define OS_TYPE "SUNOS5"
+#	define ELF_CLASS ELFCLASS64
+	extern int _etext[], _end[];
+	extern ptr_t GC_SysVGetDataStart();
+#	define DATASTART GC_SysVGetDataStart(0x1000, _etext)
+#	define DATAEND (_end)
+#	include <sys/vmparam.h>
+#	ifdef USERLIMIT
+#	    define STACKBOTTOM USRSTACK
+#	else
+#	    define HEURISTIC2
+#	endif
+#	define DYNAMIC_LOADING
+#	if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
+#	    define USE_MMAP
+#	endif
+#	ifdef USE_MMAP
+#	    define HEAP_START (ptr_t)0x40000000
+#	else
+#	    define HEAP_START DATAEND
+#	endif
+#   endif
 #   ifdef OPENBSD
 #       define OS_TYPE "OPENBSD"
 #       define ELF_CLASS ELFCLASS64
