1998-11-18  Ulrich Drepper  <drepper@cygnus.com>

	* Makefile (CFLAGS-mutex.c): Define as -D__NO_WEAK_PTHREAD_ALIASES.
	(CFLAGS-specific.c): Likewise.
	(CFLAGS-pthread.c): Likewise.
	(CFLAGS-ptfork.c): Likewise.
	(CFLAGS-cancel.c): Likewise.
	* sysdeps/pthread/bits/libc-lock.h: Don't mark __pthread_* functions
	as weak references if __NO_WEAK_PTHREAD_ALIASES is defined.

	* mutex.c (pthread_mutex_init): Define as strong symbol.
	(pthread_mutex_destroy): Likewise.
	(pthread_mutex_trylock): Likewise.
	(pthread_mutex_lock): Likewise.
	(pthread_mutex_unlock): Likewise.
	(pthread_mutexattr_init): Likewise.
	(pthread_mutexattr_destroy): Likewise.
	(pthread_once): Likewise.
	* ptfork.c (pthread_atfork): Likewise.
	* specific.c (pthread_key_create): Likewise.
	(pthread_setspecific): Likewise.
	(pthread_getspecific): Likewise.
This commit is contained in:
Ulrich Drepper 1998-11-18 17:02:37 +00:00
parent dfd2464b33
commit 97dac76c11
6 changed files with 63 additions and 32 deletions

View File

@ -1,3 +1,26 @@
1998-11-18 Ulrich Drepper <drepper@cygnus.com>
* Makefile (CFLAGS-mutex.c): Define as -D__NO_WEAK_PTHREAD_ALIASES.
(CFLAGS-specific.c): Likewise.
(CFLAGS-pthread.c): Likewise.
(CFLAGS-ptfork.c): Likewise.
(CFLAGS-cancel.c): Likewise.
* sysdeps/pthread/bits/libc-lock.h: Don't mark __pthread_* functions
as weak references if __NO_WEAK_PTHREAD_ALIASES is defined.
* mutex.c (pthread_mutex_init): Define as strong symbol.
(pthread_mutex_destroy): Likewise.
(pthread_mutex_trylock): Likewise.
(pthread_mutex_lock): Likewise.
(pthread_mutex_unlock): Likewise.
(pthread_mutexattr_init): Likewise.
(pthread_mutexattr_destroy): Likewise.
(pthread_once): Likewise.
* ptfork.c (pthread_atfork): Likewise.
* specific.c (pthread_key_create): Likewise.
(pthread_setspecific): Likewise.
(pthread_getspecific): Likewise.
1998-11-15 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* linuxthreads.texi: Fix punctuation after xref.

View File

@ -41,6 +41,12 @@ tests = ex1 ex2 ex3 ex4 ex5 ex6
include ../Rules
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This ensures they will load libc.so for needed symbols if loaded by
# a statically-linked program that hasn't already loaded it.

View File

@ -33,14 +33,14 @@ int __pthread_mutex_init(pthread_mutex_t * mutex,
mutex->__m_owner = NULL;
return 0;
}
weak_alias (__pthread_mutex_init, pthread_mutex_init)
strong_alias (__pthread_mutex_init, pthread_mutex_init)
int __pthread_mutex_destroy(pthread_mutex_t * mutex)
{
if (mutex->__m_lock.__status != 0) return EBUSY;
return 0;
}
weak_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
int __pthread_mutex_trylock(pthread_mutex_t * mutex)
{
@ -73,7 +73,7 @@ int __pthread_mutex_trylock(pthread_mutex_t * mutex)
return EINVAL;
}
}
weak_alias (__pthread_mutex_trylock, pthread_mutex_trylock)
strong_alias (__pthread_mutex_trylock, pthread_mutex_trylock)
int __pthread_mutex_lock(pthread_mutex_t * mutex)
{
@ -103,7 +103,7 @@ int __pthread_mutex_lock(pthread_mutex_t * mutex)
return EINVAL;
}
}
weak_alias (__pthread_mutex_lock, pthread_mutex_lock)
strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
int __pthread_mutex_unlock(pthread_mutex_t * mutex)
{
@ -129,20 +129,20 @@ int __pthread_mutex_unlock(pthread_mutex_t * mutex)
return EINVAL;
}
}
weak_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
int __pthread_mutexattr_init(pthread_mutexattr_t *attr)
{
attr->__mutexkind = PTHREAD_MUTEX_FAST_NP;
return 0;
}
weak_alias (__pthread_mutexattr_init, pthread_mutexattr_init)
strong_alias (__pthread_mutexattr_init, pthread_mutexattr_init)
int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
{
return 0;
}
weak_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy)
strong_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy)
int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
{
@ -196,4 +196,4 @@ int __pthread_once(pthread_once_t * once_control, void (*init_routine)(void))
pthread_mutex_unlock(&once_masterlock);
return 0;
}
weak_alias (__pthread_once, pthread_once)
strong_alias (__pthread_once, pthread_once)

View File

@ -66,7 +66,7 @@ int __pthread_atfork(void (*prepare)(void),
pthread_mutex_unlock(&pthread_atfork_lock);
return 0;
}
weak_alias (__pthread_atfork, pthread_atfork)
strong_alias (__pthread_atfork, pthread_atfork)
static inline void pthread_call_handlers(struct handler_list * list)
{

View File

@ -56,7 +56,7 @@ int __pthread_key_create(pthread_key_t * key, destr_function destr)
pthread_mutex_unlock(&pthread_keys_mutex);
return EAGAIN;
}
weak_alias (__pthread_key_create, pthread_key_create)
strong_alias (__pthread_key_create, pthread_key_create)
/* Delete a key */
@ -108,7 +108,7 @@ int __pthread_setspecific(pthread_key_t key, const void * pointer)
THREAD_GETMEM_NC(self, p_specific[idx1st])[idx2nd] = (void *) pointer;
return 0;
}
weak_alias (__pthread_setspecific, pthread_setspecific)
strong_alias (__pthread_setspecific, pthread_setspecific)
/* Get the value of a key */
@ -126,7 +126,7 @@ void * __pthread_getspecific(pthread_key_t key)
return NULL;
return THREAD_GETMEM_NC(self, p_specific[idx1st])[idx2nd];
}
weak_alias (__pthread_getspecific, pthread_getspecific)
strong_alias (__pthread_getspecific, pthread_getspecific)
/* Call the destruction routines on all keys */

View File

@ -170,7 +170,8 @@ extern int __libc_internal_tsd_set __P ((enum __libc_tsd_key_t,
/* Make the pthread functions weak so that we can elide them from
single-threaded processes. */
#ifdef weak_extern
#ifndef __NO_WEAK_PTHREAD_ALIASES
# ifdef weak_extern
weak_extern (__pthread_mutex_init)
weak_extern (__pthread_mutex_destroy)
weak_extern (__pthread_mutex_lock)
@ -189,25 +190,26 @@ weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
weak_extern (_pthread_cleanup_push_defer)
weak_extern (_pthread_cleanup_pop_restore)
#else
# pragma weak __pthread_mutex_init
# pragma weak __pthread_mutex_destroy
# pragma weak __pthread_mutex_lock
# pragma weak __pthread_mutex_trylock
# pragma weak __pthread_mutex_unlock
# pragma weak __pthread_mutexattr_init
# pragma weak __pthread_mutexattr_destroy
# pragma weak __pthread_mutexattr_settype
# pragma weak __pthread_key_create
# pragma weak __pthread_setspecific
# pragma weak __pthread_getspecific
# pragma weak __libc_internal_tsd_get
# pragma weak __libc_internal_tsd_set
# pragma weak __pthread_once
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
# pragma weak _pthread_cleanup_push_defer
# pragma weak _pthread_cleanup_pop_restore
# else
# pragma weak __pthread_mutex_init
# pragma weak __pthread_mutex_destroy
# pragma weak __pthread_mutex_lock
# pragma weak __pthread_mutex_trylock
# pragma weak __pthread_mutex_unlock
# pragma weak __pthread_mutexattr_init
# pragma weak __pthread_mutexattr_destroy
# pragma weak __pthread_mutexattr_settype
# pragma weak __pthread_key_create
# pragma weak __pthread_setspecific
# pragma weak __pthread_getspecific
# pragma weak __libc_internal_tsd_get
# pragma weak __libc_internal_tsd_set
# pragma weak __pthread_once
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
# pragma weak _pthread_cleanup_push_defer
# pragma weak _pthread_cleanup_pop_restore
# endif
#endif
/* We need portable names for some functions. E.g., when they are