about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--dlfcn/dlopen.c2
-rw-r--r--dlfcn/dlopenold.c2
-rw-r--r--dlfcn/dlsym.c4
-rw-r--r--dlfcn/dlvsym.c4
-rw-r--r--elf/dl-profstub.c6
-rw-r--r--linuxthreads/ChangeLog7
-rw-r--r--linuxthreads/spinlock.c11
-rw-r--r--malloc/malloc.c11
-rw-r--r--sysdeps/generic/machine-gmon.h7
9 files changed, 29 insertions, 25 deletions
diff --git a/dlfcn/dlopen.c b/dlfcn/dlopen.c
index 76636fdba4..dae0b5880e 100644
--- a/dlfcn/dlopen.c
+++ b/dlfcn/dlopen.c
@@ -46,7 +46,7 @@ __dlopen_check (const char *file, int mode)
   struct dlopen_args args;
   args.file = file;
   args.mode = mode;
-  args.caller = __builtin_return_address (0);
+  args.caller = RETURN_ADDRESS (0);
 
   return _dlerror_run (dlopen_doit, &args) ? NULL : args.new;
 }
diff --git a/dlfcn/dlopenold.c b/dlfcn/dlopenold.c
index 3fc39d6999..d08427aef7 100644
--- a/dlfcn/dlopenold.c
+++ b/dlfcn/dlopenold.c
@@ -50,7 +50,7 @@ __dlopen_nocheck (const char *file, int mode)
 {
   struct dlopen_args args;
   args.file = file;
-  args.caller = __builtin_return_address (0);
+  args.caller = RETURN_ADDRESS (0);
 
   if ((mode & RTLD_BINDING_MASK) == 0)
     /* By default assume RTLD_LAZY.  */
diff --git a/dlfcn/dlsym.c b/dlfcn/dlsym.c
index d1c5f735f8..8793da9746 100644
--- a/dlfcn/dlsym.c
+++ b/dlfcn/dlsym.c
@@ -1,5 +1,5 @@
 /* Look up a symbol in a shared object loaded by `dlopen'.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 97, 98, 99, 2000 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
@@ -44,7 +44,7 @@ void *
 dlsym (void *handle, const char *name)
 {
   struct dlsym_args args;
-  args.who = __builtin_return_address (0);
+  args.who = RETURN_ADDRESS (0);
   args.handle = handle;
   args.name = name;
 
diff --git a/dlfcn/dlvsym.c b/dlfcn/dlvsym.c
index e316cb53e0..a46fc8cddf 100644
--- a/dlfcn/dlvsym.c
+++ b/dlfcn/dlvsym.c
@@ -1,5 +1,5 @@
 /* Look up a versioned symbol in a shared object loaded by `dlopen'.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 97, 98, 99, 2000 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
@@ -48,7 +48,7 @@ __dlvsym (void *handle, const char *name, const char *version_str)
 
   args.handle = handle;
   args.name = name;
-  args.who = __builtin_return_address (0);
+  args.who = RETURN_ADDRESS (0);
   args.version = version_str;
 
   return (_dlerror_run (dlvsym_doit, &args) ? NULL : args.sym);
diff --git a/elf/dl-profstub.c b/elf/dl-profstub.c
index db6693bdce..37b6631d52 100644
--- a/elf/dl-profstub.c
+++ b/elf/dl-profstub.c
@@ -30,8 +30,7 @@ extern struct link_map *_dl_profile_map;
 void
 _dl_mcount_wrapper (void *selfpc)
 {
-  _dl_mcount ((ElfW(Addr)) __builtin_return_address (0),
-	      (ElfW(Addr)) selfpc);
+  _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
 }
 
 
@@ -39,6 +38,5 @@ void
 _dl_mcount_wrapper_check (void *selfpc)
 {
   if (_dl_profile_map != NULL)
-    _dl_mcount ((ElfW(Addr)) __builtin_return_address (0),
-		(ElfW(Addr)) selfpc);
+    _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
 }
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 5d06c1c572..fe1a4ed2e0 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,10 @@
+2000-07-18 Kaz Kylheku <kaz@ashi.footprints.net>
+
+	* spinlock.c (__pthread_alt_lock, __pthread_alt_timedlock): Fixed
+	bug whereby thr field of waitnode structure would not be correctly
+	set unless a null self pointer is passed to the functions.
+	Eliminated redundant calls to thread_self().
+
 2000-07-18  Jakub Jelinek  <jakub@redhat.com>
 
 	* pthread.c (__pthread_initialize_manager): Lock
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 38d6b8ef30..43190a2eda 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -345,7 +345,7 @@ static void wait_node_dequeue(struct wait_node **pp_head,
   if (pp_node == pp_head) {
     long oldvalue = (long) p_node;
     long newvalue = (long) p_node->next;
-       
+
     if (__compare_and_swap((long *) pp_node, oldvalue, newvalue))
       return;
 
@@ -388,7 +388,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
 
       wait_node.abandoned = 0;
       wait_node.next = (struct wait_node *) lock->__status;
-      wait_node.thr = self = thread_self();
+      wait_node.thr = self;
       suspend_needed = 1;
     }
 
@@ -408,7 +408,8 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
       newstatus = 1;
     } else {
       if (self == NULL)
-	wait_node.thr = self = thread_self();
+	self = thread_self();
+      wait_node.thr = self;
       newstatus = (long) &wait_node;
     }
     wait_node.abandoned = 0;
@@ -461,7 +462,7 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
 
       p_wait_node->abandoned = 0;
       p_wait_node->next = (struct wait_node *) lock->__status;
-      p_wait_node->thr = self = thread_self();
+      p_wait_node->thr = self;
     }
 
     WRITE_MEMORY_BARRIER();
@@ -478,7 +479,7 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
       newstatus = 1;
     } else {
       if (self == NULL)
-	p_wait_node->thr = self = thread_self();
+	p_wait_node->thr = self;
       newstatus = (long) p_wait_node;
     }
     p_wait_node->abandoned = 0;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index f2246f6184..981aae690d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2678,7 +2678,7 @@ Void_t* mALLOc(bytes) size_t bytes;
     Void_t* result;
 
 #if defined __GNUC__ && __GNUC__ >= 2
-    result = (*__malloc_hook)(bytes, __builtin_return_address (0));
+    result = (*__malloc_hook)(bytes, RETURN_ADDRESS (0));
 #else
     result = (*__malloc_hook)(bytes, NULL);
 #endif
@@ -2996,7 +2996,7 @@ void fREe(mem) Void_t* mem;
 #if defined _LIBC || defined MALLOC_HOOKS
   if (__free_hook != NULL) {
 #if defined __GNUC__ && __GNUC__ >= 2
-    (*__free_hook)(mem, __builtin_return_address (0));
+    (*__free_hook)(mem, RETURN_ADDRESS (0));
 #else
     (*__free_hook)(mem, NULL);
 #endif
@@ -3201,7 +3201,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
     Void_t* result;
 
 #if defined __GNUC__ && __GNUC__ >= 2
-    result = (*__realloc_hook)(oldmem, bytes, __builtin_return_address (0));
+    result = (*__realloc_hook)(oldmem, bytes, RETURN_ADDRESS (0));
 #else
     result = (*__realloc_hook)(oldmem, bytes, NULL);
 #endif
@@ -3478,8 +3478,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
     Void_t* result;
 
 #if defined __GNUC__ && __GNUC__ >= 2
-    result = (*__memalign_hook)(alignment, bytes,
-				__builtin_return_address (0));
+    result = (*__memalign_hook)(alignment, bytes, RETURN_ADDRESS (0));
 #else
     result = (*__memalign_hook)(alignment, bytes, NULL);
 #endif
@@ -3671,7 +3670,7 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
   if (__malloc_hook != NULL) {
     sz = n * elem_size;
 #if defined __GNUC__ && __GNUC__ >= 2
-    mem = (*__malloc_hook)(sz, __builtin_return_address (0));
+    mem = (*__malloc_hook)(sz, RETURN_ADDRESS (0));
 #else
     mem = (*__malloc_hook)(sz, NULL);
 #endif
diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h
index 3b63707eaf..c0c1d7001e 100644
--- a/sysdeps/generic/machine-gmon.h
+++ b/sysdeps/generic/machine-gmon.h
@@ -1,5 +1,5 @@
 /* Machine-dependent definitions for profiling support.  Generic GCC 2 version.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000 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
@@ -22,7 +22,7 @@
      void *__builtin_return_address (unsigned int N)
    returns the return address of the frame N frames up.  */
 
-/* Be warned that GCC cannot usefully compile __builtin_return_address(N) 
+/* Be warned that GCC cannot usefully compile __builtin_return_address(N)
    for N != 0 on all machines.  In this case, you may have to write
    your own version of _mcount().  */
 
@@ -50,6 +50,5 @@ static inline void mcount_internal (u_long frompc, u_long selfpc)
 #define MCOUNT \
 void _mcount (void)							      \
 {									      \
-  mcount_internal ((u_long) __builtin_return_address (1),		      \
-		   (u_long) __builtin_return_address (0));		      \
+  mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \
 }