summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-20 21:27:25 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:51 +0400
commitc4e4721f491632c2039cece14400f353794273f4 (patch)
tree81ea0ea761bfcdc92d55a67d28fc0f83659cf9dd /extra
parentf2127b50f72ad5449c24f1e0bd4b3d4ca88185d8 (diff)
downloadbdwgc-c4e4721f491632c2039cece14400f353794273f4.tar.gz
2009-10-20 Ivan Maidanski <ivmai@mail.ru> (really mostly OpenBSD contributors)
* configure.ac (openbsd): Define GC_OPENBSD_THREADS. * configure.ac: Add AM_CONDITIONAL(OPENBSD_THREADS). * configure.ac: Add sparc-openbsd case. * doc/README.macros (GC_NETBSD_THREADS, GC_OPENBSD_THREADS): Document. * tests/test.c (main): Handle OpenBSD case. * extra/threadlibs.c: Add the copyright header; expand all tabs to spaces; remove trailing spaces at EOLn. * include/private/pthread_stop_world.h: Ditto. * extra/threadlibs.c (main): Replace K&R-style function definition with the ANSI C one. * extra/threadlibs.c (main): Handle GC_OPENBSD_THREADS case. * dyn_load.c (OPENBSD): Recognize (similar to NETBSD). * include/gc_config_macros.h (GC_SOLARIS_THREADS): Recognize; define it for OpenBSD. * include/gc_pthread_redirects.h (GC_pthread_sigmask, pthread_sigmask): Don't declare and redefine for OpenBSD. * include/private/gcconfig.h: Handle OpenBSD (on arm, sh, i386, amd64, powerpc). * mach_dep.c (NO_GETCONTEXT): Ditto. * include/private/pthread_stop_world.h (thread_stop_info): Don't define last_stop_count field if OpenBSD. * misc.c (GC_init_dyld): Add declaration (if NetBSD). * misc.c (GC_init): Don't call GC_init_netbsd_elf() for OpenBSD. * os_dep.c (GC_init_netbsd_elf): Don't define for OpenBSD. * os_dep.c (old_segv_act, GC_jmp_buf_openbsd): New static variable (only if OpenBSD). * os_dep.c (GC_fault_handler_openbsd, GC_find_limit_openbsd, GC_skip_hole_openbsd): New static function (only if OpenBSD). * os_dep.c (GC_get_stack_base, GC_get_main_stack_base, GC_register_data_segments): Define specially for OpenBSD case. * os_dep.c (GC_fault_handler_lock): Initialize to AO_TS_INITIALIZER (instead of 0). * pthread_support.c (GC_allocate_lock): Ditto. * pthread_stop_world.c (NSIG, GC_print_sig_mask, GC_remove_allowed_signals, suspend_handler_mask, GC_stop_count, GC_world_is_stopped, GC_retry_signals, SIG_THR_RESTART, GC_suspend_ack_sem, GC_suspend_handler_inner, GC_suspend_handler, GC_restart_handler): Don't define and use if OpenBSD. * pthread_stop_world.c (GC_suspend_all, GC_stop_world, GC_start_world): Handle OpenBSD case. * pthread_stop_world.c (GC_stop_init): Define as empty if OpenBSD. * pthread_support.c (pthread_sigmask): Don't undefine the macro and don't define the wrapper function if OpenBSD. * pthread_support.c (GC_thr_init): Handle OpenBSD case. * configure: Regenerate. * include/private/config.h.in: Ditto.
Diffstat (limited to 'extra')
-rw-r--r--extra/threadlibs.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/extra/threadlibs.c b/extra/threadlibs.c
index f2ab5825..3b148bbd 100644
--- a/extra/threadlibs.c
+++ b/extra/threadlibs.c
@@ -1,27 +1,48 @@
+/*
+ * Copyright (c) 1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1998 by Fergus Henderson. All rights reserved.
+ * Copyright (c) 2000-2009 by Hewlett-Packard Development Company.
+ * All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
# include "gc_config_macros.h"
# include "private/gcconfig.h"
+
# include <stdio.h>
-int main()
+int main(void)
{
# if defined(GC_USE_LD_WRAP)
- printf("-Wl,--wrap -Wl,dlopen "
- "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join "
- "-Wl,--wrap -Wl,pthread_detach "
- "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
+ printf("-Wl,--wrap -Wl,dlopen "
+ "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join "
+ "-Wl,--wrap -Wl,pthread_detach "
+ "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
# endif
# if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
- || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
- || defined(GC_GNU_THREADS)
+ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
+ || defined(GC_GNU_THREADS)
# ifdef GC_USE_DLOPEN_WRAP
- printf("-ldl ");
-# endif
+ printf("-ldl ");
+# endif
printf("-lpthread\n");
# endif
+# if defined(GC_OPENBSD_THREADS)
+ printf("-pthread\n");
+# endif
# if defined(GC_FREEBSD_THREADS)
# ifdef GC_USE_DLOPEN_WRAP
- printf("-ldl ");
-# endif
+ printf("-ldl ");
+# endif
# if (__FREEBSD_version >= 500000)
printf("-lpthread\n");
# else
@@ -29,35 +50,34 @@ int main()
# endif
# endif
# if defined(GC_NETBSD_THREADS)
- printf("-lpthread -lrt\n");
+ printf("-lpthread -lrt\n");
# endif
# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS)
- printf("-lpthread -lrt\n");
+ printf("-lpthread -lrt\n");
# endif
# if defined(GC_SOLARIS_THREADS)
printf("-lthread -lposix4\n");
- /* Is this right for recent versions? */
+ /* Is this right for recent versions? */
# endif
# if defined(GC_WIN32_THREADS) && defined(CYGWIN32)
printf("-lpthread\n");
# endif
# if defined(GC_WIN32_PTHREADS)
# ifdef PTW32_STATIC_LIB
- /* assume suffix s for static version of the win32 pthread library */
+ /* assume suffix s for static version of the win32 pthread library */
printf("-lpthreadGC2s -lws2_32\n");
# else
printf("-lpthreadGC2\n");
# endif
# endif
# if defined(GC_OSF1_THREADS)
- printf("-pthread -lrt"); /* DOB: must be -pthread, not -lpthread */
+ printf("-pthread -lrt"); /* DOB: must be -pthread, not -lpthread */
# endif
- /* You need GCC 3.0.3 to build this one! */
+ /* You need GCC 3.0.3 to build this one! */
/* DG/UX native gcc doesnt know what "-pthread" is */
# if defined(GC_DGUX386_THREADS)
printf("-ldl -pthread\n");
# endif
return 0;
}
-