about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-03 22:40:52 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-03 22:40:52 +0000
commit27b0258934adb212b760ead998d51f8005224abc (patch)
tree227015d0044b530f0bdf169f2088f956ef28fcaa
parent4bb8fc33018de0b3519b1069fa87d670f71249dc (diff)
downloadglibc-27b0258934adb212b760ead998d51f8005224abc.tar.gz
glibc-27b0258934adb212b760ead998d51f8005224abc.tar.xz
glibc-27b0258934adb212b760ead998d51f8005224abc.zip
Update.
2004-04-23  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ia64/fpu/libm_support.h (__libm_error_support): Add
	libc_hidden_proto.  Define to __GI___libm_error_support for
	assembly going into libc.so.
	* sysdeps/ia64/fpu/libc_libm_error.c (__libm_error_support): Add
	libc_hidden_def.

	* include/libc-symbols.h (HIDDEN_BUILTIN_JUMPTARGET): Define.
	* sysdeps/ia64/bcopy.S (bcopy): Use it for jump to memmove.

	* sysdeps/unix/sysv/linux/ia64/sysdep.S (__syscall_error): Access
	gprel errno if RTLD_PRIVATE_ERRNO or __thread __libc_errno/errno
	if USE___THREAD.
-rw-r--r--ChangeLog15
-rw-r--r--include/libc-symbols.h6
-rw-r--r--linuxthreads/ChangeLog24
-rw-r--r--linuxthreads/join.c13
-rw-r--r--linuxthreads/manager.c19
-rw-r--r--linuxthreads/pthread.c41
-rw-r--r--linuxthreads/semaphore.c5
-rw-r--r--linuxthreads/specific.c6
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h121
-rw-r--r--sysdeps/ia64/bcopy.S2
-rw-r--r--sysdeps/ia64/fpu/libc_libm_error.c1
-rw-r--r--sysdeps/ia64/fpu/libm_support.h8
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.S29
14 files changed, 199 insertions, 97 deletions
diff --git a/ChangeLog b/ChangeLog
index 75e536e3b4..50b88bde12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/ia64/fpu/libm_support.h (__libm_error_support): Add
+	libc_hidden_proto.  Define to __GI___libm_error_support for
+	assembly going into libc.so.
+	* sysdeps/ia64/fpu/libc_libm_error.c (__libm_error_support): Add
+	libc_hidden_def.
+
+	* include/libc-symbols.h (HIDDEN_BUILTIN_JUMPTARGET): Define.
+	* sysdeps/ia64/bcopy.S (bcopy): Use it for jump to memmove.
+
+	* sysdeps/unix/sysv/linux/ia64/sysdep.S (__syscall_error): Access
+	gprel errno if RTLD_PRIVATE_ERRNO or __thread __libc_errno/errno
+	if USE___THREAD.
+
 2004-05-03  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/bsd/bits/fcntl.h (F_SETOWN, F_GETOWN): Define if
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index e7074a6064..9cc72b261a 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -749,11 +749,17 @@ for linking")
 # define libc_hidden_builtin_def(name) libc_hidden_def (name)
 # define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
 # define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
+# ifdef __ASSEMBLER__
+#  define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
+# endif
 #else
 # define libc_hidden_builtin_proto(name, attrs...)
 # define libc_hidden_builtin_def(name)
 # define libc_hidden_builtin_weak(name)
 # define libc_hidden_builtin_ver(local, name)
+# ifdef __ASSEMBLER__
+#  define HIDDEN_BUILTIN_JUMPTARGET(name) JUMPTARGET(name)
+# endif
 #endif
 
 /* Get some dirty hacks.  */
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index d79cf86ba6..5840521e28 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,27 @@
+2004-05-02  Jakub Jelinek  <jakub@redhat.com>
+
+	* manager.c: Include not-cancel.h.
+	(__pthread_manager): Use read_not_cancel instead of __libc_read.
+	(pthread_start_thread, __pthread_manager_sighandler): Use
+	write_not_cancel instead of __libc_write.
+	(pthread_reap_children): Use waitpid_not_cancel instead of
+	__libc_waitpid.
+	* pthread.c: Include not-cancel.h.
+	(__pthread_initialize_minimal, __pthread_create_2_1,
+	pthread_onexit_process, __pthread_message): Use
+	write_not_cancel instead of __libc_write.
+	(__pthread_initialize_manager): Likewise.  Use close_not_cancel
+	instead of __libc_close.
+	(__pthread_reset_main_thread): Use close_not_cancel instead of
+	__libc_close.
+	* join.c: Include not-cancel.h.
+	(__pthread_do_exit, pthread_join, pthread_detach): Use
+	write_not_cancel instead of __libc_write.
+	* semaphore.c: Include not-cancel.h.
+	(__new_sem_post): Use write_not_cancel instead of __libc_write.
+	* specific.c: Include not-cancel.h.
+	(pthread_key_delete): Use write_not_cancel instead of __libc_write.
+
 2004-05-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* Versions (libc): Add __on_exit and __libc_sigaction.
diff --git a/linuxthreads/join.c b/linuxthreads/join.c
index 3d204296fc..148f222319 100644
--- a/linuxthreads/join.c
+++ b/linuxthreads/join.c
@@ -22,6 +22,7 @@
 #include "internals.h"
 #include "spinlock.h"
 #include "restart.h"
+#include <not-cancel.h>
 
 void __pthread_exit(void * retval)
 {
@@ -78,8 +79,8 @@ void __pthread_do_exit(void *retval, char *currentframe)
   if (self == __pthread_main_thread && __pthread_manager_request >= 0) {
     request.req_thread = self;
     request.req_kind = REQ_MAIN_THREAD_EXIT;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *)&request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *)&request, sizeof(request)));
     suspend(self);
     /* Main thread flushes stdio streams and runs atexit functions.
        It also calls a handler within LinuxThreads which sends a process exit
@@ -174,8 +175,8 @@ int pthread_join(pthread_t thread_id, void ** thread_return)
     request.req_thread = self;
     request.req_kind = REQ_FREE;
     request.req_args.free.thread_id = thread_id;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
   }
   return 0;
 }
@@ -212,8 +213,8 @@ int pthread_detach(pthread_t thread_id)
     request.req_thread = thread_self();
     request.req_kind = REQ_FREE;
     request.req_args.free.thread_id = thread_id;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
   }
   return 0;
 }
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 876dd32772..f21a6def6f 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -36,6 +36,7 @@
 #include "spinlock.h"
 #include "restart.h"
 #include "semaphore.h"
+#include <not-cancel.h>
 
 /* For debugging purposes put the maximum number of threads in a variable.  */
 const int __linuxthreads_pthread_threads_max = PTHREAD_THREADS_MAX;
@@ -141,8 +142,8 @@ __pthread_manager(void *arg)
   /* Raise our priority to match that of main thread */
   __pthread_manager_adjust_prio(__pthread_main_thread->p_priority);
   /* Synchronize debugging of the thread manager */
-  n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
-				     sizeof(request)));
+  n = TEMP_FAILURE_RETRY(read_not_cancel(reqfd, (char *)&request,
+					 sizeof(request)));
   ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG);
   ufd.fd = reqfd;
   ufd.events = POLLIN;
@@ -162,8 +163,8 @@ __pthread_manager(void *arg)
     }
     /* Read and execute request */
     if (n == 1 && (ufd.revents & POLLIN)) {
-      n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
-					 sizeof(request)));
+      n = TEMP_FAILURE_RETRY(read_not_cancel(reqfd, (char *)&request,
+					     sizeof(request)));
 #ifdef DEBUG
       if (n < 0) {
 	char d[64];
@@ -301,8 +302,8 @@ pthread_start_thread(void *arg)
   if (__pthread_threads_debug && __pthread_sig_debug > 0) {
     request.req_thread = self;
     request.req_kind = REQ_DEBUG;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
     suspend(self);
   }
   /* Run the thread code */
@@ -970,7 +971,7 @@ static void pthread_reap_children(void)
   pid_t pid;
   int status;
 
-  while ((pid = __libc_waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) {
+  while ((pid = waitpid_not_cancel(-1, &status, WNOHANG | __WCLONE)) > 0) {
     pthread_exited(pid);
     if (WIFSIGNALED(status)) {
       /* If a thread died due to a signal, send the same signal to
@@ -1090,8 +1091,8 @@ void __pthread_manager_sighandler(int sig)
     struct pthread_request request;
     request.req_thread = 0;
     request.req_kind = REQ_KICK;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
   }
 }
 
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 124aa5243d..6c98d73255 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -34,6 +34,7 @@
 #include <ldsodefs.h>
 #include <tls.h>
 #include <version.h>
+#include <not-cancel.h>
 
 /* Sanity check.  */
 #if !defined __SIGRTMIN || (__SIGRTMAX - __SIGRTMIN) < 3
@@ -328,8 +329,8 @@ __pthread_initialize_minimal(void)
 	{
 	  static const char msg[] = "\
 cannot allocate TLS data structures for initial thread\n";
-	  TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO,
-					    msg, sizeof msg - 1));
+	  TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO,
+						msg, sizeof msg - 1));
 	  abort ();
 	}
       const char *lossage = TLS_INIT_TP (tcbp, 0);
@@ -337,11 +338,11 @@ cannot allocate TLS data structures for initial thread\n";
 	{
 	  static const char msg[] = "cannot set up thread-local storage: ";
 	  const char nl = '\n';
-	  TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO,
-					    msg, sizeof msg - 1));
-	  TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO,
-					    lossage, strlen (lossage)));
-	  TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO, &nl, 1));
+	  TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO,
+						msg, sizeof msg - 1));
+	  TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO,
+						lossage, strlen (lossage)));
+	  TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO, &nl, 1));
 	}
 
       /* Though it was allocated with libc's malloc, that was done without
@@ -657,8 +658,8 @@ int __pthread_initialize_manager(void)
   tcbp = _dl_allocate_tls (NULL);
   if (tcbp == NULL) {
     free(__pthread_manager_thread_bos);
-    __libc_close(manager_pipe[0]);
-    __libc_close(manager_pipe[1]);
+    close_not_cancel(manager_pipe[0]);
+    close_not_cancel(manager_pipe[1]);
     return -1;
   }
 
@@ -787,8 +788,8 @@ int __pthread_initialize_manager(void)
     _dl_deallocate_tls (tcbp, true);
 #endif
     free(__pthread_manager_thread_bos);
-    __libc_close(manager_pipe[0]);
-    __libc_close(manager_pipe[1]);
+    close_not_cancel(manager_pipe[0]);
+    close_not_cancel(manager_pipe[1]);
     return -1;
   }
   mgr->p_tid = 2* PTHREAD_THREADS_MAX + 1;
@@ -803,8 +804,8 @@ int __pthread_initialize_manager(void)
     }
   /* Synchronize debugging of the thread manager */
   request.req_kind = REQ_DEBUG;
-  TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				  (char *) &request, sizeof(request)));
+  TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+				      (char *) &request, sizeof(request)));
   return 0;
 }
 
@@ -826,8 +827,8 @@ int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr,
   request.req_args.create.arg = arg;
   sigprocmask(SIG_SETMASK, (const sigset_t *) NULL,
               &request.req_args.create.mask);
-  TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				  (char *) &request, sizeof(request)));
+  TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+				      (char *) &request, sizeof(request)));
   suspend(self);
   retval = THREAD_GETMEM(self, p_retcode);
   if (__builtin_expect (retval, 0) == 0)
@@ -1004,8 +1005,8 @@ static void pthread_onexit_process(int retcode, void *arg)
     request.req_thread = self;
     request.req_kind = REQ_PROCESS_EXIT;
     request.req_args.exit.code = retcode;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
     suspend(self);
     /* Main thread should accumulate times for thread manager and its
        children, so that timings for main thread account for all threads. */
@@ -1127,8 +1128,8 @@ void __pthread_reset_main_thread(void)
     free(__pthread_manager_thread_bos);
     __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL;
     /* Close the two ends of the pipe */
-    __libc_close(__pthread_manager_request);
-    __libc_close(__pthread_manager_reader);
+    close_not_cancel(__pthread_manager_request);
+    close_not_cancel(__pthread_manager_reader);
     __pthread_manager_request = __pthread_manager_reader = -1;
   }
 
@@ -1399,7 +1400,7 @@ void __pthread_message(const char * fmt, ...)
   va_start(args, fmt);
   vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args);
   va_end(args);
-  TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer)));
+  TEMP_FAILURE_RETRY(write_not_cancel(2, buffer, strlen(buffer)));
 }
 
 #endif
diff --git a/linuxthreads/semaphore.c b/linuxthreads/semaphore.c
index 0793a5f712..017539e176 100644
--- a/linuxthreads/semaphore.c
+++ b/linuxthreads/semaphore.c
@@ -22,6 +22,7 @@
 #include "restart.h"
 #include "queue.h"
 #include <shlib-compat.h>
+#include <not-cancel.h>
 
 int __new_sem_init(sem_t *sem, int pshared, unsigned int value)
 {
@@ -168,8 +169,8 @@ int __new_sem_post(sem_t * sem)
     }
     request.req_kind = REQ_POST;
     request.req_args.post = sem;
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
+    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					(char *) &request, sizeof(request)));
   }
   return 0;
 }
diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c
index aa8fcb5ab3..f54fabaeb9 100644
--- a/linuxthreads/specific.c
+++ b/linuxthreads/specific.c
@@ -22,7 +22,7 @@
 #include "spinlock.h"
 #include "restart.h"
 #include <bits/libc-lock.h>
-
+#include <not-cancel.h>
 
 /* Table of keys. */
 
@@ -120,8 +120,8 @@ int pthread_key_delete(pthread_key_t key)
       request.req_args.for_each.arg = &args;
       request.req_args.for_each.fn = pthread_key_delete_helper;
 
-      TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				      (char *) &request, sizeof(request)));
+      TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
+					  (char *) &request, sizeof(request)));
       suspend(self);
     }
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 3432b1a5b4..078b4817d8 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SYSDEP_CANCEL_ERRNO,
+	SYSDEP_CANCEL_ERROR): Define.
+	(PSEUDO): Use it.
+
 2004-05-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* Versions (libpthread): Remove __pthread_cleanup_upto@@GLIBC_PRIVATE.
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
index 2fe1c6ad45..a360c68fe3 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -27,9 +27,58 @@
 
 # undef PSEUDO
 
-#ifndef USE_DL_SYSINFO
+# ifdef USE___THREAD
+#  ifndef NOT_IN_libc
+#   define SYSDEP_CANCEL_ERRNO __libc_errno
+#  else
+#   define SYSDEP_CANCEL_ERRNO errno
+#  endif
+#  define SYSDEP_CANCEL_ERROR(args)					      \
+.section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
+     .align 32;								      \
+     .proc __syscall_error_##args;					      \
+     .global __syscall_error_##args;					      \
+     .hidden __syscall_error_##args;					      \
+     .size __syscall_error_##args, 64;					      \
+__syscall_error_##args:							      \
+     .prologue;								      \
+     .regstk args, 5, args, 0;						      \
+     .save ar.pfs, loc0;						      \
+     .save rp, loc1;							      \
+     .body;								      \
+     addl loc4 = @ltoff(@tprel(SYSDEP_CANCEL_ERRNO)), gp;;		      \
+     ld8 loc4 = [loc4];							      \
+     mov rp = loc1;;							      \
+     mov r8 = -1;							      \
+     add loc4 = loc4, r13;;						      \
+     st4 [loc4] = loc3;							      \
+     mov ar.pfs = loc0
+# else
+#  define SYSDEP_CANCEL_ERROR(args)					      \
+.section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
+     .align 32;								      \
+     .proc __syscall_error_##args;					      \
+     .global __syscall_error_##args;					      \
+     .hidden __syscall_error_##args;					      \
+     .size __syscall_error_##args, 64;					      \
+__syscall_error_##args:							      \
+     .prologue;								      \
+     .regstk args, 5, args, 0;						      \
+     .save ar.pfs, loc0;						      \
+     .save rp, loc1;							      \
+     .body;								      \
+     mov loc4 = r1;;							      \
+     br.call.sptk.many b0 = __errno_location;;				      \
+     st4 [r8] = loc3;							      \
+     mov r1 = loc4;							      \
+     mov rp = loc1;							      \
+     mov r8 = -1;							      \
+     mov ar.pfs = loc0
+# endif
 
-# define PSEUDO(name, syscall_name, args)				      \
+# ifndef USE_DL_SYSINFO
+
+#  define PSEUDO(name, syscall_name, args)				      \
 .text;									      \
 ENTRY (name)								      \
      adds r14 = MULTIPLE_THREADS_OFFSET, r13;;				      \
@@ -71,29 +120,11 @@ __GC_##name:								      \
 .Lpseudo_end:								      \
      ret;								      \
      .endp __GC_##name;							      \
-.section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
-     .align 32;								      \
-     .proc __syscall_error_##args;					      \
-     .global __syscall_error_##args;					      \
-     .hidden __syscall_error_##args;					      \
-     .size __syscall_error_##args, 64;					      \
-__syscall_error_##args:							      \
-     .prologue;								      \
-     .regstk args, 5, args, 0;						      \
-     .save ar.pfs, loc0;						      \
-     .save rp, loc1;							      \
-     .body;								      \
-     mov loc4 = r1;;							      \
-     br.call.sptk.many b0 = __errno_location;;				      \
-     st4 [r8] = loc3;							      \
-     mov r1 = loc4;							      \
-     mov rp = loc1;							      \
-     mov r8 = -1;							      \
-     mov ar.pfs = loc0
+     SYSDEP_CANCEL_ERROR(args)
 
-#else /* USE_DL_SYSINFO */
+# else /* USE_DL_SYSINFO */
 
-# define PSEUDO(name, syscall_name, args)				      \
+#  define PSEUDO(name, syscall_name, args)				      \
 .text;									      \
 ENTRY (name)								      \
      .prologue;								      \
@@ -146,30 +177,12 @@ __GC_##name:								      \
 .Lpseudo_end:								      \
      ret;								      \
      .endp __GC_##name;							      \
-.section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
-     .align 32;								      \
-     .proc __syscall_error_##args;					      \
-     .global __syscall_error_##args;					      \
-     .hidden __syscall_error_##args;					      \
-     .size __syscall_error_##args, 64;					      \
-__syscall_error_##args:							      \
-     .prologue;								      \
-     .regstk args, 5, args, 0;						      \
-     .save ar.pfs, loc0;						      \
-     .save rp, loc1;							      \
-     .body;								      \
-     mov loc4 = r1;;							      \
-     br.call.sptk.many b0 = __errno_location;;				      \
-     st4 [r8] = loc3;							      \
-     mov r1 = loc4;							      \
-     mov rp = loc1;							      \
-     mov r8 = -1;							      \
-     mov ar.pfs = loc0
+     SYSDEP_CANCEL_ERROR(args)
 
-#endif /* USE_DL_SYSINFO */
+# endif /* USE_DL_SYSINFO */
 
-#undef PSEUDO_END
-#define PSEUDO_END(name) .endp
+# undef PSEUDO_END
+# define PSEUDO_END(name) .endp
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	br.call.sptk.many b0 = __pthread_enable_asynccancel
@@ -184,14 +197,14 @@ __syscall_error_##args:							      \
 #  error Unsupported library
 # endif
 
-#define COPY_ARGS_0	/* Nothing */
-#define COPY_ARGS_1	COPY_ARGS_0 mov out0 = in0;
-#define COPY_ARGS_2	COPY_ARGS_1 mov out1 = in1;
-#define COPY_ARGS_3	COPY_ARGS_2 mov out2 = in2;
-#define COPY_ARGS_4	COPY_ARGS_3 mov out3 = in3;
-#define COPY_ARGS_5	COPY_ARGS_4 mov out4 = in4;
-#define COPY_ARGS_6	COPY_ARGS_5 mov out5 = in5;
-#define COPY_ARGS_7	COPY_ARGS_6 mov out6 = in6;
+# define COPY_ARGS_0	/* Nothing */
+# define COPY_ARGS_1	COPY_ARGS_0 mov out0 = in0;
+# define COPY_ARGS_2	COPY_ARGS_1 mov out1 = in1;
+# define COPY_ARGS_3	COPY_ARGS_2 mov out2 = in2;
+# define COPY_ARGS_4	COPY_ARGS_3 mov out3 = in3;
+# define COPY_ARGS_5	COPY_ARGS_4 mov out4 = in4;
+# define COPY_ARGS_6	COPY_ARGS_5 mov out5 = in5;
+# define COPY_ARGS_7	COPY_ARGS_6 mov out6 = in6;
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
diff --git a/sysdeps/ia64/bcopy.S b/sysdeps/ia64/bcopy.S
index a41c21d5a7..bdabf5acdc 100644
--- a/sysdeps/ia64/bcopy.S
+++ b/sysdeps/ia64/bcopy.S
@@ -6,5 +6,5 @@ ENTRY(bcopy)
 	mov in0 = in1
 	;;
 	mov in1 = r8
-	br.cond.sptk.many HIDDEN_JUMPTARGET(memmove)
+	br.cond.sptk.many HIDDEN_BUILTIN_JUMPTARGET(memmove)
 END(bcopy)
diff --git a/sysdeps/ia64/fpu/libc_libm_error.c b/sysdeps/ia64/fpu/libc_libm_error.c
index 83a0bae4df..5a34878d71 100644
--- a/sysdeps/ia64/fpu/libc_libm_error.c
+++ b/sysdeps/ia64/fpu/libc_libm_error.c
@@ -11,3 +11,4 @@ __libm_error_support (void *arg1, void *arg2, void *retval,
 {
   __set_errno (ERANGE);
 }
+libc_hidden_def (__libm_error_support)
diff --git a/sysdeps/ia64/fpu/libm_support.h b/sysdeps/ia64/fpu/libm_support.h
index 68ebddec81..5d3498dfc9 100644
--- a/sysdeps/ia64/fpu/libm_support.h
+++ b/sysdeps/ia64/fpu/libm_support.h
@@ -239,6 +239,7 @@ typedef enum
 } error_types;
 
 void __libm_error_support(void*,void*,void*,error_types);
+libc_hidden_proto(__libm_error_support)
 
 #define BIAS_64  1023
 #define EXPINF_64  2047
@@ -340,6 +341,13 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
 // This is a run-time variable and may effect
 // floating point behavior of the libm functions
 
+#elif defined _LIBC
+
+# if !defined NOT_IN_libc && defined SHARED && defined DO_VERSIONING \
+     && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN
+#  define __libm_error_support  __GI___libm_error_support
+# endif
+
 #endif	/* __ASSEMBLER__ */
 
 /* Support for compatible assembler handling.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.S b/sysdeps/unix/sysv/linux/ia64/sysdep.S
index c053c3a053..24780a1692 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.S
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
@@ -19,9 +19,34 @@
 
 #include <sysdep.h>
 #include <features.h>
+#include <tls.h>
 
 ENTRY(__syscall_error)
-#ifdef _LIBC_REENTRANT
+#if RTLD_PRIVATE_ERRNO
+	/*
+	 * Note that the gp has to be set properly for this to work.
+	 * As long as all syscalls are in the same load unit
+	 * (executable or shared library) as this routine, we should
+	 * be fine.  Otherwise, we would have to first load the global
+	 * pointer register from __gp.
+	 */
+	addl	r2=@gprel(errno),gp
+	;;
+	st4	[r2]=r8
+	mov	r8=-1
+#elif defined USE___THREAD
+# ifndef NOT_IN_libc
+#  define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+#  define SYSCALL_ERROR_ERRNO errno
+# endif
+	addl	r2=@ltoff(@tprel(SYSCALL_ERROR_ERRNO)), gp;;
+	ld8	r2=[r2]
+	mov	r3=r8;;
+	mov	r8=-1
+	add	r2=r2,r13;;
+	st4	[r2]=r3
+#elif defined _LIBC_REENTRANT
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0)
 	alloc	r33=ar.pfs, 0, 4, 0, 0
 	mov	r32=rp