Skip to content

Commit

Permalink
2006-06-06 Hans Boehm <[email protected]> (Really Petr Salinger)
Browse files Browse the repository at this point in the history
	* configure.ac, dyn_load.c, doc/README.changes, include/gc.h,
	include/private/gcconfig.h: Add macro tests and configuration
	information to support kFreeBSD + glibc.
  • Loading branch information
hboehm authored and ivmai committed Jul 26, 2011
1 parent 2245796 commit 49e069b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 10 deletions.
13 changes: 12 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AC_INIT(gc,7.0alpha6,[email protected])
AC_CONFIG_SRCDIR(gcj_mlc.c)
AC_CANONICAL_TARGET
AC_PREREQ(2.53)
AC_REVISION($Revision: 1.12 $)
AC_REVISION($Revision: 1.13 $)
GC_SET_VERSION
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
AM_MAINTAINER_MODE
Expand Down Expand Up @@ -117,6 +117,17 @@ case "$THREADS" in
AC_DEFINE(GC_FREEBSD_THREADS)
INCLUDES="$INCLUDES -pthread"
;;
*-*-kfreebsd*-gnu)
AC_DEFINE(GC_FREEBSD_THREADS)
INCLUDES="$INCLUDES -pthread"
THREADDLLIBS=-pthread
AC_DEFINE(_REENTRANT)
if test "${enable_parallel_mark}" = yes; then
AC_DEFINE(PARALLEL_MARK)
fi
AC_DEFINE(THREAD_LOCAL_ALLOC)
AC_DEFINE(USE_COMPILER_TLS)
;;
*-*-netbsd*)
AC_MSG_WARN("Only on NetBSD 2.0 or later.")
AC_DEFINE(GC_NETBSD_THREADS)
Expand Down
1 change: 1 addition & 0 deletions doc/README.changes
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,7 @@ Since gc6.7:
- GC_unix_get_mem could neglect to release the malloc lock on Irix, under
extremely unlikely circumstances. Thanks to Jean-Baptiste Nivois for
some careful code reading.
- Added support for kFreeBSD + glibc (Thanks to Petr Salinger)

Since gc6.8:
- Remove GC_PROTO, VOLATILE, GC_PTR, and GC_CONST. Assume ANSI C compiler
Expand Down
4 changes: 2 additions & 2 deletions dyn_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
#if defined(__linux__) && !defined(_GNU_SOURCE)
#if (defined(__linux__) || defined(__GLIBC__)) && !defined(_GNU_SOURCE)
/* Can't test LINUX, since this must be define before other includes */
# define _GNU_SOURCE
#endif
Expand Down Expand Up @@ -319,7 +319,7 @@ GC_bool GC_register_main_static_data()
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */

# if defined(LINUX) /* Are others OK here, too? */ \
# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))

Expand Down
2 changes: 1 addition & 1 deletion include/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ GC_API void * GC_malloc_atomic_ignore_off_page(size_t lb);
# define GC_RETURN_ADDR (GC_word)__return_address
#endif

#ifdef __linux__
#if defined(__linux__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
&& !defined(__ia64__)
Expand Down
43 changes: 37 additions & 6 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
# endif

/* And one for FreeBSD: */
# if (defined(__FreeBSD__) || defined(__DragonFly__)) && !defined(FREEBSD)
# if (defined(__FreeBSD__) || defined(__DragonFly__) || \
defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
# define FREEBSD
# endif

Expand Down Expand Up @@ -1191,8 +1192,15 @@
# ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
# ifdef __GLIBC__
# define SIG_SUSPEND (32+6)
# define SIG_THR_RESTART (32+5)
extern int _end[];
# define DATAEND (_end)
# else
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
# endif
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
Expand Down Expand Up @@ -1849,6 +1857,28 @@
# define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
# endif
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
# ifdef __GLIBC__
# define SIG_SUSPEND (32+6)
# define SIG_THR_RESTART (32+5)
extern int _end[];
# define DATAEND (_end)
# else
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
# endif
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
# endif
extern char etext[];
extern char * GC_FreeBSDGetDataStart();
# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# ifdef __ELF__
Expand Down Expand Up @@ -1935,7 +1965,8 @@
# define SUNOS5SIGS
# endif

# if defined(FREEBSD) && (defined(__DragonFly__) || __FreeBSD__ >= 4)
# if defined(FREEBSD) && \
(defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4))
# define SUNOS5SIGS
# endif

Expand Down Expand Up @@ -2004,7 +2035,7 @@
# define CACHE_LINE_SIZE 32 /* Wild guess */
# endif

# ifdef LINUX
# if defined(LINUX) || defined(__GLIBC__)
# define REGISTER_LIBRARIES_EARLY
/* We sometimes use dl_iterate_phdr, which may acquire an internal */
/* lock. This isn't safe after the world has stopped. So we must */
Expand Down Expand Up @@ -2088,7 +2119,7 @@
#if defined(SPARC)
# define CAN_SAVE_CALL_ARGS
#endif
#if (defined(I386) || defined(X86_64)) && defined(LINUX)
#if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
# define CAN_SAVE_CALL_ARGS
Expand Down

0 comments on commit 49e069b

Please sign in to comment.