[m-dev.] diff: fix problem with boehm_gc, -DLINUX_THREADS, and glibc 2.1

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 16 16:52:00 AEST 1999


boehm_gc/linux_threads.c:
	For glibc >= 2.0, disable the check for __pthread_initial_bos,
	since that is no longer exported from libpthread in glibc 2.1.

Workspace: /usr/hg2/fjh/mercury
Index: boehm_gc/linux_threads.c
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/linux_threads.c,v
retrieving revision 1.4
diff -u -r1.4 linux_threads.c
--- boehm_gc/linux_threads.c	1998/10/30 05:10:07	1.4
+++ boehm_gc/linux_threads.c	1999/09/16 06:38:14
@@ -40,6 +40,7 @@
 # include <sys/mman.h>
 # include <sys/time.h>
 # include <semaphore.h>
+# include <features.h>
 
 #undef pthread_create
 #undef pthread_sigmask
@@ -115,13 +116,20 @@
 GC_linux_thread_top_of_stack() relies on implementation details of
 LinuxThreads, namely that thread stacks are allocated on 2M boundaries
 and grow to no more than 2M.
-To make sure that we're using LinuxThreads and not some other thread
-package, we generate a dummy reference to `__pthread_initial_thread_bos',
-which is a symbol defined in LinuxThreads, but (hopefully) not in other
-thread packages.
+To make sure that we're using LinuxThreads (which more recently is part
+of glibc) and not some other thread package, we generate a dummy reference
+to `__pthread_initial_thread_bos', which is a symbol defined in LinuxThreads,
+but (hopefully) not in other thread packages.  However, unfortunately that
+doesn't work in glibc 2.1, because in glibc 2.1, it is defined as a local
+symbol.  So if we're using glibc >= 2.0, we just assume that it will work.
 */
-extern char * __pthread_initial_thread_bos;
-char **dummy_var_to_force_linux_threads = &__pthread_initial_thread_bos;
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+  /* better just hope and pray ... */
+#else
+  /* force a link error if we're not using LinuxThreads */
+  extern char * __pthread_initial_thread_bos;
+  char **dummy_var_to_force_linux_threads = &__pthread_initial_thread_bos;
+#endif
 
 #define LINUX_THREADS_STACK_SIZE  (2 * 1024 * 1024)
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list