Subject: Re: boehm-gc in dynamic libs
To: Mario Kemper <magick@bundy.lip.owl.de>
From: SUNAGAWA Keiki <Keiki_SUNAGAWA@yokogawa.co.jp>
List: tech-pkg
Date: 12/02/1999 11:20:57
Hi,

magick@bundy.lip.owl.de (Mario Kemper) wrote:

>> What kind of architecture do you use?

Mario> i386-elf

Okey.  Please test the following and let me know if it
works?  Since I have no access to i386-elf system, I'm not
sure that this actually works on ELF system, though (it
works for me on i386/1.4.1).

1 replace boehm-gc/patches/patch-ac with the attached diff.

2 make makapatchsum && make

3 cd ${WRKDIR}/gc and do the following:

  ./test_cpp 1 2>/dev/null&&echo ok

--
SUNAGAWA Keiki <Keiki_SUNAGAWA@yokogawa.co.jp>



--- gcconfig.h.orig	Wed Sep 15 13:56:31 1999
+++ gcconfig.h	Thu Dec  2 10:16:32 1999
@@ -27,6 +27,11 @@
 #    define LINUX
 # endif
 
+# if defined(__NetBSD__)
+#    define NETBSD
+#    define unix /* symbol unix is no longer defined in NetBSD */
+# endif
+
 /* Determine the machine type: */
 # if defined(sun) && defined(mc68000)
 #    define M68K
@@ -50,7 +55,10 @@
 # endif
 # if defined(__NetBSD__) && defined(m68k)
 #    define M68K
-#    define NETBSD
+#    define mach_type_known
+# endif
+# if defined(__NetBSD__) && defined(__powerpc__)
+#    define POWERPC
 #    define mach_type_known
 # endif
 # if defined(vax)
@@ -106,7 +114,7 @@
 #   define mach_type_known
 # endif
 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
-     && !defined(__OpenBSD__)
+     && !defined(__OpenBSD__) && !(__NetBSD__)
 #   define SPARC
 #   define DRSNX
 #   define mach_type_known
@@ -115,6 +123,10 @@
 #   define RS6000
 #   define mach_type_known
 # endif
+# if defined(__NetBSD__) && defined(__sparc__)
+#   define SPARC
+#   define mach_type_known
+# endif
 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
 	/* The above test may need refinement	*/
 #   define I386
@@ -153,7 +165,7 @@
 # endif
 # if defined(__alpha) || defined(__alpha__)
 #   define ALPHA
-#   if !defined(LINUX)
+#   if !defined(LINUX) && !defined(NETBSD)
 #     define OSF1	/* a.k.a Digital Unix */
 #   endif
 #   define mach_type_known
@@ -202,7 +214,6 @@
 # endif
 # if defined(__NetBSD__) && defined(i386)
 #   define I386
-#   define NETBSD
 #   define mach_type_known
 # endif
 # if defined(bsdi) && defined(i386)
@@ -527,6 +538,14 @@
 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     define DATAEND	/* not needed */
 #   endif
+#   ifdef NETBSD
+#     define ALIGNMENT 4
+#     define OS_TYPE "NETBSD"
+#     define HEURISTIC2
+      extern char etext;
+#     define DATASTART GC_data_start
+#     define DYNAMIC_LOADING
+#   endif
 # endif
 
 # ifdef VAX
@@ -556,7 +575,6 @@
 #   define MACH_TYPE "SPARC"
 #   define ALIGNMENT 4	/* Required by hardware	*/
 #   define ALIGN_DOUBLE
-    extern int etext;
 #   ifdef SUNOS5
 #	define OS_TYPE "SUNOS5"
 	extern int _etext;
@@ -628,8 +646,16 @@
 #   ifdef OPENBSD
 #     define OS_TYPE "OPENBSD"
 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
+      extern int etext;
 #     define DATASTART ((ptr_t)(&etext))
 #   endif
+#   ifdef NETBSD
+#     define OS_TYPE "NETBSD"
+#     define HEURISTIC2
+/*      extern char etext; */
+#     define DATASTART GC_data_start
+#     define DYNAMIC_LOADING
+#   endif
 # endif
 
 # ifdef I386
@@ -786,6 +812,14 @@
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
+#	define HEURISTIC2
+	extern char etext;
+#	if defined(__ELF__)
+#	   define DATASTART GC_data_start
+#	   define DYNAMIC_LOADING
+#	else
+#	   define DATASTART ((ptr_t)(&etext))
+#	endif
 #   endif
 #   ifdef THREE86BSD
 #	define OS_TYPE "THREE86BSD"
@@ -793,7 +827,7 @@
 #   ifdef BSDI
 #	define OS_TYPE "BSDI"
 #   endif
-#   if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
+#   if defined(OPENBSD) || defined(FREEBSD) \
         || defined(THREE86BSD) || defined(BSDI)
 #	define HEURISTIC2
 	extern char etext;
@@ -919,6 +953,16 @@
 # ifdef ALPHA
 #   define MACH_TYPE "ALPHA"
 #   define ALIGNMENT 8
+#   ifdef NETBSD
+#	define OS_TYPE "NETBSD"
+#	define HEURISTIC2
+#	define DATASTART GC_data_start
+#	define ELFCLASS32 32
+#	define ELFCLASS64 64
+#	define ELF_CLASS ELFCLASS64
+#   	define CPP_WORDSZ 64
+#       define DYNAMIC_LOADING
+#   endif
 #   ifdef OSF1
 #	define OS_TYPE "OSF1"
 #   	define DATASTART ((ptr_t) 0x140000000)