summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-01-06 06:07:52 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-01-06 06:07:52 +0000
commitcad1dd7bb48ce31f7da38885f47db0af6cae5bc5 (patch)
tree570c18845a855821b82c68e6b2476e1199c4af4e
parent069154d55f4e6cb7243ee37c5aa0391aa639e721 (diff)
Notes
-rw-r--r--lib/libc_r/uthread/uthread_init.c32
-rw-r--r--lib/libkse/thread/thr_init.c32
-rw-r--r--lib/libpthread/thread/thr_init.c32
3 files changed, 96 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/uthread_init.c b/lib/libc_r/uthread/uthread_init.c
index be671a139c422..93d7849394bf9 100644
--- a/lib/libc_r/uthread/uthread_init.c
+++ b/lib/libc_r/uthread/uthread_init.c
@@ -54,6 +54,31 @@
#include <pthread.h>
#include "pthread_private.h"
+/*
+ * These are needed when linking statically. All references within
+ * libgcc (and in the future libc) to these routines are weak, but
+ * if they are not (strongly) referenced by the application or other
+ * libraries, then the actual functions will not be loaded.
+ */
+static void *thread_references[] = {
+ &pthread_once,
+ &pthread_key_create,
+ &pthread_key_delete,
+ &pthread_getspecific,
+ &pthread_setspecific,
+ &pthread_mutex_init,
+ &pthread_mutex_destroy,
+ &pthread_mutex_lock,
+ &pthread_mutex_trylock,
+ &pthread_mutex_unlock,
+ &pthread_cond_init,
+ &pthread_cond_destroy,
+ &pthread_cond_wait,
+ &pthread_cond_timedwait,
+ &pthread_cond_signal,
+ &pthread_cond_broadcast
+};
+
#ifdef GCC_2_8_MADE_THREAD_AWARE
typedef void *** (*dynamic_handler_allocator)();
extern void __set_dynamic_handler_allocator(dynamic_handler_allocator);
@@ -99,6 +124,13 @@ _thread_init(void)
return;
/*
+ * Make gcc quiescent about thread_references not being
+ * referenced:
+ */
+ if (thread_references[0] == NULL)
+ PANIC("Mandatory pthread_* functions not loaded");
+
+ /*
* Check for the special case of this process running as
* or in place of init as pid = 1:
*/
diff --git a/lib/libkse/thread/thr_init.c b/lib/libkse/thread/thr_init.c
index be671a139c422..93d7849394bf9 100644
--- a/lib/libkse/thread/thr_init.c
+++ b/lib/libkse/thread/thr_init.c
@@ -54,6 +54,31 @@
#include <pthread.h>
#include "pthread_private.h"
+/*
+ * These are needed when linking statically. All references within
+ * libgcc (and in the future libc) to these routines are weak, but
+ * if they are not (strongly) referenced by the application or other
+ * libraries, then the actual functions will not be loaded.
+ */
+static void *thread_references[] = {
+ &pthread_once,
+ &pthread_key_create,
+ &pthread_key_delete,
+ &pthread_getspecific,
+ &pthread_setspecific,
+ &pthread_mutex_init,
+ &pthread_mutex_destroy,
+ &pthread_mutex_lock,
+ &pthread_mutex_trylock,
+ &pthread_mutex_unlock,
+ &pthread_cond_init,
+ &pthread_cond_destroy,
+ &pthread_cond_wait,
+ &pthread_cond_timedwait,
+ &pthread_cond_signal,
+ &pthread_cond_broadcast
+};
+
#ifdef GCC_2_8_MADE_THREAD_AWARE
typedef void *** (*dynamic_handler_allocator)();
extern void __set_dynamic_handler_allocator(dynamic_handler_allocator);
@@ -99,6 +124,13 @@ _thread_init(void)
return;
/*
+ * Make gcc quiescent about thread_references not being
+ * referenced:
+ */
+ if (thread_references[0] == NULL)
+ PANIC("Mandatory pthread_* functions not loaded");
+
+ /*
* Check for the special case of this process running as
* or in place of init as pid = 1:
*/
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index be671a139c422..93d7849394bf9 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -54,6 +54,31 @@
#include <pthread.h>
#include "pthread_private.h"
+/*
+ * These are needed when linking statically. All references within
+ * libgcc (and in the future libc) to these routines are weak, but
+ * if they are not (strongly) referenced by the application or other
+ * libraries, then the actual functions will not be loaded.
+ */
+static void *thread_references[] = {
+ &pthread_once,
+ &pthread_key_create,
+ &pthread_key_delete,
+ &pthread_getspecific,
+ &pthread_setspecific,
+ &pthread_mutex_init,
+ &pthread_mutex_destroy,
+ &pthread_mutex_lock,
+ &pthread_mutex_trylock,
+ &pthread_mutex_unlock,
+ &pthread_cond_init,
+ &pthread_cond_destroy,
+ &pthread_cond_wait,
+ &pthread_cond_timedwait,
+ &pthread_cond_signal,
+ &pthread_cond_broadcast
+};
+
#ifdef GCC_2_8_MADE_THREAD_AWARE
typedef void *** (*dynamic_handler_allocator)();
extern void __set_dynamic_handler_allocator(dynamic_handler_allocator);
@@ -99,6 +124,13 @@ _thread_init(void)
return;
/*
+ * Make gcc quiescent about thread_references not being
+ * referenced:
+ */
+ if (thread_references[0] == NULL)
+ PANIC("Mandatory pthread_* functions not loaded");
+
+ /*
* Check for the special case of this process running as
* or in place of init as pid = 1:
*/