$NetBSD: patch-da,v 1.6 2014/11/30 08:40:51 spz Exp $

Support 64-bit SunOS.

--- libgc/include/private/gcconfig.h.orig	2014-09-22 13:23:05.000000000 +0000
+++ libgc/include/private/gcconfig.h
@@ -169,6 +169,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
@@ -372,6 +377,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
@@ -711,6 +719,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
@@ -902,6 +914,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
@@ -1097,6 +1113,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
@@ -1390,6 +1410,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
@@ -1551,6 +1575,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__
@@ -1677,6 +1705,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
@@ -1944,6 +1976,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
@@ -2041,6 +2077,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
@@ -2159,6 +2199,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
@@ -2166,6 +2210,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
