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.
This commit is contained in:
Ulrich Drepper 2004-05-03 22:40:52 +00:00
parent 4bb8fc3301
commit 27b0258934
14 changed files with 199 additions and 97 deletions

View File

@ -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

View File

@ -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. */

View File

@ -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.

View File

@ -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;
}

View File

@ -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)));
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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.

View File

@ -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 \

View File

@ -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)

View File

@ -11,3 +11,4 @@ __libm_error_support (void *arg1, void *arg2, void *retval,
{
__set_errno (ERANGE);
}
libc_hidden_def (__libm_error_support)

View File

@ -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. */

View File

@ -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