2003-01-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/ldsodefs.h (_dl_allocate_tls, _dl_deallocate_tls):
	Add rtld_hidden_proto.
	* sysdeps/generic/dl-tls.c (_dl_deallocate_tls): Add rtld_hidden_def.
	(_dl_allocate_tls): Likewise.  Remove INTDEF.
This commit is contained in:
Ulrich Drepper 2003-01-03 21:15:43 +00:00
parent 686b7223d5
commit 733f25e6d3
12 changed files with 82 additions and 47 deletions

View file

@ -1,3 +1,10 @@
2003-01-03 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/ldsodefs.h (_dl_allocate_tls, _dl_deallocate_tls):
Add rtld_hidden_proto.
* sysdeps/generic/dl-tls.c (_dl_deallocate_tls): Add rtld_hidden_def.
(_dl_allocate_tls): Likewise. Remove INTDEF.
2002-07-05 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/sh/memcpy.S: Optimize. Based on a patch by Toshiyasu

View file

@ -1,3 +1,7 @@
2003-01-03 Jakub Jelinek <jakub@redhat.com>
* Makefile ($(objpfx)libpthread.so): Depend on ld.so.
2003-01-02 Ulrich Drepper <drepper@redhat.com>
* tst-cancel-wrappers.sh: Exclude sigwait.c as well, it does not have

View file

@ -185,7 +185,9 @@ endif
# 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.
$(objpfx)libpthread.so: $(libc-link.so) $(common-objpfx)libc_nonshared.a
# Depend on ld.so too to get proper versions of ld.so symbols.
$(objpfx)libpthread.so: $(libc-link.so) $(common-objpfx)libc_nonshared.a \
$(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)
# Make sure we link with the thread library.
ifeq ($(build-shared),yes)

View file

@ -1,3 +1,14 @@
2003-01-03 Ulrich Drepper <drepper@redhat.com>
* atomic.h: Correct definitions of atomic_full_barrier,
atomic_read_barrier, atomic_write_barrier.
* old_pthread_cond_broadcast.c: Make memory allocate and initialization
race-free.
* old_pthread_cond_signal.c: Likewise.
* old_pthread_cond_timedwait.c: Likewise.
* old_pthread_cond_wait.c: Likewise.
2003-01-03 Jakub Jelinek <jakub@redhat.com>
* Makefile ($(objpfx)libpthread.so): Depend on ld.so.

View file

@ -212,8 +212,10 @@ $(objpfx)libpthread.so: +preinit += $(objpfx)crti.o
# 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.
# Depend on ld.so too to get proper versions of ld.so symbols.
$(objpfx)libpthread.so: $(common-objpfx)libc.so \
$(common-objpfx)libc_nonshared.a
$(common-objpfx)libc_nonshared.a \
$(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)
# Make sure we link with the thread library.
ifeq ($(build-shared),yes)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -93,17 +93,17 @@
#ifndef atomic_full_barrier
# define full_barrier() __asm ("" ::: "memory")
# define atomic_full_barrier() __asm ("" ::: "memory")
#endif
#ifndef atomic_read_barrier
# define read_barrier() full_barrier()
# define atomic_read_barrier() atomic_full_barrier()
#endif
#ifndef atomic_write_barrier
# define write_barrier() full_barrier()
# define atomic_write_barrier() atomic_full_barrier()
#endif
#endif /* atomic.h */

View file

@ -20,7 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <lowlevellock.h>
#include <atomic.h>
#include <shlib-compat.h>
@ -31,18 +31,19 @@ __pthread_cond_broadcast_2_0 (cond)
{
if (cond->cond == NULL)
{
lll_mutex_lock (cond->lock);
pthread_cond_t *newcond;
/* Check whether the condvar is still not allocated. */
if (cond->cond == NULL)
cond->cond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
lll_mutex_unlock (cond->lock);
if (cond->cond == NULL)
newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
if (newcond == NULL)
return ENOMEM;
*cond->cond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
*newcond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
atomic_write_barrier ();
if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0)
/* Somebody else just initialized the condvar. */
free (newcond);
}
return __pthread_cond_broadcast (cond->cond);

View file

@ -20,6 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <atomic.h>
#include <shlib-compat.h>
@ -30,18 +31,19 @@ __pthread_cond_signal_2_0 (cond)
{
if (cond->cond == NULL)
{
lll_mutex_lock (cond->lock);
pthread_cond_t *newcond;
/* Check whether the condvar is still not allocated. */
if (cond->cond == NULL)
cond->cond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
lll_mutex_unlock (cond->lock);
if (cond->cond == NULL)
newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
if (newcond == NULL)
return ENOMEM;
*cond->cond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
*newcond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
atomic_write_barrier ();
if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0)
/* Somebody else just initialized the condvar. */
free (newcond);
}
return __pthread_cond_signal (cond->cond);

View file

@ -20,6 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <atomic.h>
#include <shlib-compat.h>
@ -32,18 +33,19 @@ __pthread_cond_timedwait_2_0 (cond, mutex, abstime)
{
if (cond->cond == NULL)
{
lll_mutex_lock (cond->lock);
pthread_cond_t *newcond;
/* Check whether the condvar is still not allocated. */
if (cond->cond == NULL)
cond->cond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
lll_mutex_unlock (cond->lock);
if (cond->cond == NULL)
newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
if (newcond == NULL)
return ENOMEM;
*cond->cond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
*newcond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
atomic_write_barrier ();
if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0)
/* Somebody else just initialized the condvar. */
free (newcond);
}
return __pthread_cond_timedwait (cond->cond, mutex, abstime);

View file

@ -20,6 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <atomic.h>
#include <shlib-compat.h>
@ -31,18 +32,19 @@ __pthread_cond_wait_2_0 (cond, mutex)
{
if (cond->cond == NULL)
{
lll_mutex_lock (cond->lock);
pthread_cond_t *newcond;
/* Check whether the condvar is still not allocated. */
if (cond->cond == NULL)
cond->cond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
lll_mutex_unlock (cond->lock);
if (cond->cond == NULL)
newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
if (newcond == NULL)
return ENOMEM;
*cond->cond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
*newcond = (struct pthread_cond_t) PTHREAD_COND_INITIALIZER;
atomic_write_barrier ();
if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0)
/* Somebody else just initialized the condvar. */
free (newcond);
}
return __pthread_cond_wait (cond->cond, mutex);

View file

@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -388,7 +388,7 @@ _dl_allocate_tls (void *mem)
? _dl_allocate_tls_storage ()
: allocate_dtv (mem));
}
INTDEF(_dl_allocate_tls)
rtld_hidden_def (_dl_allocate_tls)
void
@ -409,7 +409,7 @@ _dl_deallocate_tls (void *tcb, bool dealloc_tcb)
free (tcb);
}
}
rtld_hidden_def (_dl_deallocate_tls)
# ifdef SHARED

View file

@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -769,6 +769,7 @@ rtld_hidden_proto (_dl_tls_setup)
/* Allocate memory for static TLS block (unless MEM is nonzero) and dtv. */
extern void *_dl_allocate_tls (void *mem) internal_function;
rtld_hidden_proto (_dl_allocate_tls)
/* Get size and alignment requirements of the static TLS block. */
extern void _dl_get_tls_static_info (size_t *sizep, size_t *alignp)
@ -783,6 +784,7 @@ rtld_hidden_proto (_dl_allocate_tls_init)
/* Deallocate memory allocated with _dl_allocate_tls. */
extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
rtld_hidden_proto (_dl_deallocate_tls)
/* Return the symbol address given the map of the module it is in and
the symbol record. */