1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

* elf/tst-tlsmod4.c (in_dso): Insert a random library call before use

of the TLS macros, otherwise the compiler might not have initialized
	the PIC register yet when we use the PLT via asm.
	* elf/tst-tlsmod3.c (in_dso2): Likewise.
	* elf/tst-tlsmod2.c (in_dso): Likewise.
This commit is contained in:
Roland McGrath
2002-08-12 06:25:47 +00:00
parent 7a8bdff02c
commit e6f526809d
7 changed files with 35 additions and 6 deletions

View File

@ -1,5 +1,11 @@
2002-08-11 Roland McGrath <roland@redhat.com> 2002-08-11 Roland McGrath <roland@redhat.com>
* elf/tst-tlsmod4.c (in_dso): Insert a random library call before use
of the TLS macros, otherwise the compiler might not have initialized
the PIC register yet when we use the PLT via asm.
* elf/tst-tlsmod3.c (in_dso2): Likewise.
* elf/tst-tlsmod2.c (in_dso): Likewise.
* sunrpc/svc_authux.c (_svcauth_unix): Remove spurious printf (ugh!). * sunrpc/svc_authux.c (_svcauth_unix): Remove spurious printf (ugh!).
* sysdeps/i386/bits/byteswap.h (__bswap_16, __bswap_32, __bswap_64): * sysdeps/i386/bits/byteswap.h (__bswap_16, __bswap_32, __bswap_64):

View File

@ -12,9 +12,13 @@ COMMON_INT_DEF(foo);
int int
in_dso (int n, int *caller_foop) in_dso (int n, int *caller_foop)
{ {
int *foop = TLS_GD (foo); int *foop;
int result = 0; int result = 0;
puts ("foo"); /* Make sure PLT is used before macros. */
foop = TLS_GD (foo);
if (caller_foop != NULL && foop != caller_foop) if (caller_foop != NULL && foop != caller_foop)
{ {
printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop); printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);

View File

@ -15,10 +15,15 @@ COMMON_INT_DEF(comm_n);
int int
in_dso2 (void) in_dso2 (void)
{ {
int *foop = TLS_GD (foo); int *foop;
int result = 0; int result = 0;
static int n; static int n;
int *np = TLS_GD (comm_n); int *np;
puts ("foo"); /* Make sure PLT is used before macros. */
foop = TLS_GD (foo);
np = TLS_GD (comm_n);
if (n != *np) if (n != *np)
{ {

View File

@ -12,9 +12,13 @@ COMMON_INT_DEF(baz);
int int
in_dso (int n, int *caller_bazp) in_dso (int n, int *caller_bazp)
{ {
int *bazp = TLS_GD (baz); int *bazp;
int result = 0; int result = 0;
puts ("foo"); /* Make sure PLT is used before macros. */
bazp = TLS_GD (baz);
if (caller_bazp != NULL && bazp != caller_bazp) if (caller_bazp != NULL && bazp != caller_bazp)
{ {
printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp); printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp);

View File

@ -1,3 +1,13 @@
2002-08-11 Roland McGrath <roland@redhat.com>
* pthread.c (__pthread_initialize_manager): Initialize
p_header.data.tcb field of manager thread's descriptor.
(__pthread_initialize_minimal): Don't initialize p_header.data.self
field, already done by TLS_INIT_TP.
* manager.c (pthread_handle_create): Move p_header field initializers
together.
2002-08-08 Ulrich Drepper <drepper@redhat.com> 2002-08-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/tls.h (TLS_DO_SET_THREAD_AREA): Removed. * sysdeps/i386/tls.h (TLS_DO_SET_THREAD_AREA): Removed.

View File

@ -644,6 +644,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
/* Initialize the thread descriptor. Elements which have to be /* Initialize the thread descriptor. Elements which have to be
initialized to zero already have this value. */ initialized to zero already have this value. */
new_thread->p_header.data.tcb = new_thread; new_thread->p_header.data.tcb = new_thread;
new_thread->p_header.data.self = new_thread;
new_thread->p_tid = new_thread_id; new_thread->p_tid = new_thread_id;
new_thread->p_lock = &(__pthread_handles[sseg].h_lock); new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE; new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
@ -655,7 +656,6 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
#endif #endif
new_thread->p_guardaddr = guardaddr; new_thread->p_guardaddr = guardaddr;
new_thread->p_guardsize = guardsize; new_thread->p_guardsize = guardsize;
new_thread->p_header.data.self = new_thread;
new_thread->p_nr = sseg; new_thread->p_nr = sseg;
new_thread->p_inheritsched = attr ? attr->__inheritsched : 0; new_thread->p_inheritsched = attr ? attr->__inheritsched : 0;
/* Initialize the thread handle */ /* Initialize the thread handle */

View File

@ -429,7 +429,6 @@ __pthread_initialize_minimal(void)
part of the TLS allocation. We have to initialize the data part of the TLS allocation. We have to initialize the data
structure by hand. This initialization must mirror the struct structure by hand. This initialization must mirror the struct
definition above. */ definition above. */
self->p_header.data.self = self;
self->p_nextlive = self->p_prevlive = self; self->p_nextlive = self->p_prevlive = self;
self->p_tid = PTHREAD_THREADS_MAX; self->p_tid = PTHREAD_THREADS_MAX;
self->p_lock = &__pthread_handles[0].h_lock; self->p_lock = &__pthread_handles[0].h_lock;
@ -633,6 +632,7 @@ int __pthread_initialize_manager(void)
} }
/* Initialize the descriptor. */ /* Initialize the descriptor. */
tcb->p_header.data.tcb = tcb;
tcb->p_header.data.self = tcb; tcb->p_header.data.self = tcb;
tcb->p_lock = &__pthread_handles[1].h_lock; tcb->p_lock = &__pthread_handles[1].h_lock;
# ifndef HAVE___THREAD # ifndef HAVE___THREAD