beginning of a alpha*-*-freebsd* configuration patch

Loren James Rittle rittle@latour.rsch.comm.mot.com
Thu Mar 21 10:55:00 GMT 2002


Without this patch, alpha*-*-freebsd* fails to build during bootstrap.
With this patch, it will build as expected; however `make check' still
fails.  The problem is that during the first mark pass, a non-mapped
memory region is found within a static root region.  In particular,
inside GC_mark_from(), limit (eventually) equals 0x120006220, yet
*limit points to an unmapped hole.  Under the debugger:

(gdb) print *limit
Error accessing memory address 0x120006220: Bad address.
(gdb) call GC_dump()
***Static roots:
From 0x120003a74 to 0x120024428 
[...]

DATASTART and DATAEND are both defined as FreeBSD/i386.  I have not
fully investigated whether merely using DATASTART2 and DATAEND2 is
enough to solve the problem.

	* include/private/gcconfig.h: Add unified test for FreeBSD.
	Support FreeBSD/alpha.
	* os_dep.c: Do not include <machine/trap.h> unless available.
	(GC_freebsd_stack_base): Fix types.

Index: include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.11
diff -c -r1.11 gcconfig.h
*** gcconfig.h	2002/02/12 04:37:57	1.11
--- gcconfig.h	2002/03/21 06:37:08
***************
*** 38,43 ****
--- 38,48 ----
  #    define OPENBSD
  # endif
  
+ /* And one for FreeBSD: */
+ # if defined(__FreeBSD__)
+ #    define FREEBSD
+ # endif
+ 
  /* Determine the machine type: */
  # if defined(__XSCALE__)
  #    define ARM32
***************
*** 214,220 ****
  # endif
  # if defined(__alpha) || defined(__alpha__)
  #   define ALPHA
! #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
  #     define OSF1	/* a.k.a Digital Unix */
  #   endif
  #   define mach_type_known
--- 219,225 ----
  # endif
  # if defined(__alpha) || defined(__alpha__)
  #   define ALPHA
! #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
  #     define OSF1	/* a.k.a Digital Unix */
  #   endif
  #   define mach_type_known
***************
*** 262,270 ****
  #   define OPENBSD
  #   define mach_type_known
  # endif
! # if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
  #   define I386
- #   define FREEBSD
  #   define mach_type_known
  # endif
  # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
--- 267,274 ----
  #   define OPENBSD
  #   define mach_type_known
  # endif
! # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
  #   define I386
  #   define mach_type_known
  # endif
  # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
***************
*** 1329,1334 ****
--- 1333,1351 ----
  #       else		/* ECOFF, until OpenBSD/Alpha 2.7 */
  #   	   define DATASTART ((ptr_t) 0x140000000)
  #   	endif
+ #   endif
+ #   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 FREEBSD_STACKBOTTOM
+ #	ifdef __ELF__
+ #	    define DYNAMIC_LOADING
+ #	endif
+ 	extern char etext;
+ #	define DATASTART ((ptr_t)(&etext))
+ #	define CPP_WORDSZ 64
  #   endif
  #   ifdef OSF1
  #	define OS_TYPE "OSF1"
Index: os_dep.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/os_dep.c,v
retrieving revision 1.22
diff -c -r1.22 os_dep.c
*** os_dep.c	2002/03/12 19:06:36	1.22
--- os_dep.c	2002/03/21 06:37:08
***************
*** 84,90 ****
  #   include <setjmp.h>
  #endif
  
! #ifdef FREEBSD
  #  include <machine/trap.h>
  #endif
  
--- 84,90 ----
  #   include <setjmp.h>
  #endif
  
! #if defined(FREEBSD) && defined(I386)
  #  include <machine/trap.h>
  #endif
  
***************
*** 747,760 ****
  
    ptr_t GC_freebsd_stack_base(void)
    {
!     int nm[2] = { CTL_KERN, KERN_USRSTACK}, base, len, r;
      
-     len = sizeof(int);
-     r = sysctl(nm, 2, &base, &len, NULL, 0);
-     
      if (r) ABORT("Error getting stack base");
  
!     return (ptr_t)base;
    }
  
  #endif /* FREEBSD_STACKBOTTOM */
--- 747,760 ----
  
    ptr_t GC_freebsd_stack_base(void)
    {
!     int nm[2] = {CTL_KERN, KERN_USRSTACK};
!     ptr_t base;
!     size_t len = sizeof(ptr_t);
!     int r = sysctl(nm, 2, &base, &len, NULL, 0);
      
      if (r) ABORT("Error getting stack base");
  
!     return base;
    }
  
  #endif /* FREEBSD_STACKBOTTOM */



More information about the Java-patches mailing list