diff options
Diffstat (limited to 'sysdeps')
64 files changed, 739 insertions, 1166 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 29f500b2d0..88c357ea07 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -232,14 +232,14 @@ $fixup_stack: \n\ to one of the main executable's symbols, as for a COPY reloc. This is unused on Alpha. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD -# define elf_machine_type_class(type) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) +#define elf_machine_type_class(type) \ (((type) == R_ALPHA_JMP_SLOT \ || (type) == R_ALPHA_DTPMOD64 \ || (type) == R_ALPHA_DTPREL64 \ || (type) == R_ALPHA_TPREL64) * ELF_RTYPE_CLASS_PLT) #else -# define elf_machine_type_class(type) \ +#define elf_machine_type_class(type) \ (((type) == R_ALPHA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) #endif @@ -439,40 +439,40 @@ elf_machine_rela (struct link_map *map, memcpy (reloc_addr_arg, &sym_value, 8); } #endif -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) else if (r_type == R_ALPHA_DTPMOD64) { -# ifdef RTLD_BOOTSTRAP +#ifdef RTLD_BOOTSTRAP /* During startup the dynamic linker is always index 1. */ *reloc_addr = 1; -# else +#else /* Get the information from the link map returned by the resolv function. */ if (sym_map != NULL) *reloc_addr = sym_map->l_tls_modid; -# endif +#endif } else if (r_type == R_ALPHA_DTPREL64) { -# ifndef RTLD_BOOTSTRAP +#ifndef RTLD_BOOTSTRAP /* During relocation all TLS symbols are defined and used. Therefore the offset is already correct. */ *reloc_addr = sym_raw_value; -# endif +#endif } else if (r_type == R_ALPHA_TPREL64) { -# ifdef RTLD_BOOTSTRAP +#ifdef RTLD_BOOTSTRAP *reloc_addr = sym_raw_value + map->l_tls_offset; -# else +#else if (sym_map) { CHECK_STATIC_TLS (map, sym_map); *reloc_addr = sym_raw_value + sym_map->l_tls_offset; } -# endif - } #endif + } +#endif /* USE_TLS */ else _dl_reloc_bad_type (map, r_type, 0); } diff --git a/sysdeps/alpha/libc-tls.c b/sysdeps/alpha/libc-tls.c index 7e02769171..24629e9aca 100644 --- a/sysdeps/alpha/libc-tls.c +++ b/sysdeps/alpha/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. Alpha version. - Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 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 @@ -20,6 +20,8 @@ #include <csu/libc-tls.c> #include <dl-tls.h> +#if USE_TLS + /* On Alpha, linker optimizations are not required, so __tls_get_addr can be called even in statically linked binaries. In this case module must be always 1 and PT_TLS segment exist in the binary, otherwise it @@ -31,3 +33,5 @@ __tls_get_addr (tls_index *ti) dtv_t *dtv = THREAD_DTV (); return (char *) dtv[1].pointer.val + ti->ti_offset; } + +#endif diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index dda91bb806..b7d0f9b7e7 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -38,7 +38,6 @@ #include <bits/libc-lock.h> #include <hp-timing.h> #include <tls.h> -#include <rtld-lowlevel.h> __BEGIN_DECLS @@ -377,6 +376,8 @@ struct rtld_global struct link_map *_ns_loaded; /* Number of object in the _dl_loaded list. */ unsigned int _ns_nloaded; + /* Array representing global scope. */ + struct r_scope_elem *_ns_global_scope[2]; /* Direct pointer to the searchlist of the main object. */ struct r_scope_elem *_ns_main_searchlist; /* This is zero at program start to signal that the global scope map is @@ -447,6 +448,11 @@ struct rtld_global It returns an errno code or zero on success. */ EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function; + /* Keep the conditional TLS members at the end so the layout of the + structure used by !USE_TLS code matches the prefix of the layout in + the USE_TLS rtld. Note that `struct link_map' is conditionally + defined as well, so _dl_rtld_map needs to be last before this. */ +#ifdef USE_TLS /* Highest dtv index currently needed. */ EXTERN size_t _dl_tls_max_dtv_idx; /* Flag signalling whether there are gaps in the module ID allocation. */ @@ -474,10 +480,10 @@ struct rtld_global /* Number of additional entries in the slotinfo array of each slotinfo list element. A large number makes it almost certain take we never have to iterate beyond the first element in the slotinfo list. */ -#define TLS_SLOTINFO_SURPLUS (62) +# define TLS_SLOTINFO_SURPLUS (62) /* Number of additional slots in the dtv allocated. */ -#define DTV_SURPLUS (14) +# define DTV_SURPLUS (14) /* Initial dtv of the main thread, not allocated with normal malloc. */ EXTERN void *_dl_initial_dtv; @@ -485,18 +491,23 @@ struct rtld_global EXTERN size_t _dl_tls_generation; EXTERN void (*_dl_init_static_tls) (struct link_map *); +#endif #ifdef SHARED }; # define __rtld_global_attribute__ # ifdef IS_IN_rtld -# ifdef HAVE_SDATA_SECTION -# define __rtld_local_attribute__ \ +# ifdef HAVE_VISIBILITY_ATTRIBUTE +# ifdef HAVE_SDATA_SECTION +# define __rtld_local_attribute__ \ __attribute__ ((visibility ("hidden"), section (".sdata"))) -# undef __rtld_global_attribute__ -# define __rtld_global_attribute__ __attribute__ ((section (".sdata"))) +# undef __rtld_global_attribute__ +# define __rtld_global_attribute__ __attribute__ ((section (".sdata"))) +# else +# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden"))) +# endif # else -# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden"))) +# define __rtld_local_attribute__ # endif extern struct rtld_global _rtld_local __rtld_local_attribute__; # undef __rtld_local_attribute__ @@ -658,7 +669,11 @@ struct rtld_global_ro }; # define __rtld_global_attribute__ # ifdef IS_IN_rtld -# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden"))) +# ifdef HAVE_VISIBILITY_ATTRIBUTE +# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden"))) +# else +# define __rtld_local_attribute__ +# endif extern struct rtld_global_ro _rtld_local_ro attribute_relro __rtld_local_attribute__; extern struct rtld_global_ro _rtld_global_ro @@ -1023,7 +1038,9 @@ rtld_hidden_proto (_dl_allocate_tls_init) extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function; rtld_hidden_proto (_dl_deallocate_tls) +#if defined USE_TLS extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden; +#endif /* Find origin of the executable. */ extern const char *_dl_get_origin (void) attribute_hidden; diff --git a/sysdeps/generic/sysdep-cancel.h b/sysdeps/generic/sysdep-cancel.h index ba6a1e04ba..f07b784f2e 100644 --- a/sysdeps/generic/sysdep-cancel.h +++ b/sysdeps/generic/sysdep-cancel.h @@ -2,7 +2,6 @@ /* No multi-thread handling enabled. */ #define SINGLE_THREAD_P (1) -#define RTLD_SINGLE_THREAD_P (1) #define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */ #define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */ #define LIBC_CANCEL_HANDLED() /* Nothing. */ diff --git a/sysdeps/generic/tls.h b/sysdeps/generic/tls.h index 06e41ad121..6a23ec05e1 100644 --- a/sysdeps/generic/tls.h +++ b/sysdeps/generic/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. Generic version. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002 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 @@ -17,6 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +/* By default no TLS support is available. This is signaled by the + absence of the symbol USE_TLS. */ +#undef USE_TLS + + /* An architecture-specific version of this file has to defined a number of symbols: diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h index d5b8119c9c..a7378b742f 100644 --- a/sysdeps/generic/unsecvars.h +++ b/sysdeps/generic/unsecvars.h @@ -18,7 +18,6 @@ "LOCALDOMAIN\0" \ "LOCPATH\0" \ "MALLOC_TRACE\0" \ - "NIS_PATH\0" \ "NLSPATH\0" \ "RESOLV_HOST_CONF\0" \ "RES_OPTIONS\0" \ diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk index 307c4d7020..ab67a18f64 100644 --- a/sysdeps/gnu/errlist-compat.awk +++ b/sysdeps/gnu/errlist-compat.awk @@ -1,5 +1,5 @@ # awk script to generate errlist-compat.c -# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004 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 @@ -92,18 +92,16 @@ END { printf "# include <bits/wordsize.h>\n"; printf "extern const char *const __sys_errlist_%s[NERR];\n", old; printf "const int __sys_nerr_%s = %d;\n", old, n; - printf "declare_symbol_alias (__sys_errlist_%s, _sys_errlist_internal,", \ - old; - printf " object, __WORDSIZE/8*%d)\n", n; + printf "strong_alias (_sys_errlist_internal, __sys_errlist_%s)\n", old; + printf "declare_symbol (__sys_errlist_%s, object, __WORDSIZE/8*%d)\n", \ + old, n; printf "compat_symbol (libc, __sys_errlist_%s, sys_errlist, %s);\n", \ old, old; printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old; printf "extern const char *const ___sys_errlist_%s[NERR];\n", old; printf "extern const int __sys_nerr_%s;\n", old; - printf "declare_symbol_alias (___sys_errlist_%s, _sys_errlist_internal,", \ - old; - printf " object, __WORDSIZE/8*%d)\n", n; + printf "strong_alias (__sys_errlist_%s, ___sys_errlist_%s)\n", old, old; printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old; printf "compat_symbol (libc, ___sys_errlist_%s, _sys_errlist, %s);\n", \ old, old; diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h index 2c04ec9b7f..87099ec14a 100644 --- a/sysdeps/gnu/netinet/tcp.h +++ b/sysdeps/gnu/netinet/tcp.h @@ -49,7 +49,6 @@ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ #define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */ -#define TCP_CONGESTION 13 /* Congestion control algorithm. */ #ifdef __USE_MISC # include <sys/types.h> diff --git a/sysdeps/gnu/siglist.c b/sysdeps/gnu/siglist.c index 3005f867f0..cb1875f9eb 100644 --- a/sysdeps/gnu/siglist.c +++ b/sysdeps/gnu/siglist.c @@ -1,5 +1,5 @@ /* Define list of all signal numbers and their names. - Copyright (C) 1997-2000, 2002, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-2000, 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 @@ -40,30 +40,27 @@ const char *const __new_sys_sigabbrev[NSIG] = strong_alias (__new_sys_sigabbrev, _sys_sigabbrev_internal) #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -declare_symbol_alias (__old_sys_siglist, __new_sys_siglist, object, - OLD_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (_sys_siglist_internal, __old_sys_siglist) +declare_symbol (__old_sys_siglist, object, OLD_SIGLIST_SIZE * __WORDSIZE / 8) -declare_symbol_alias (__old_sys_sigabbrev, __new_sys_sigabbrev, object, - OLD_SIGLIST_SIZE * __WORDSIZE / 8) - -declare_symbol_alias (_old_sys_siglist, __new_sys_siglist, object, - OLD_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (_sys_sigabbrev_internal, __old_sys_sigabbrev) +declare_symbol (__old_sys_sigabbrev, object, OLD_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (__old_sys_siglist, _old_sys_siglist) compat_symbol (libc, __old_sys_siglist, _sys_siglist, GLIBC_2_0); compat_symbol (libc, _old_sys_siglist, sys_siglist, GLIBC_2_0); compat_symbol (libc, __old_sys_sigabbrev, sys_sigabbrev, GLIBC_2_0); #endif #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3) && defined OLD2_SIGLIST_SIZE -declare_symbol_alias (__old2_sys_siglist, __new_sys_siglist, object, - OLD2_SIGLIST_SIZE * __WORDSIZE / 8) - -declare_symbol_alias (__old2_sys_sigabbrev, __new_sys_sigabbrev, object, - OLD2_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (_sys_siglist_internal, __old2_sys_siglist) +declare_symbol (__old2_sys_siglist, object, OLD2_SIGLIST_SIZE * __WORDSIZE / 8) -declare_symbol_alias (_old2_sys_siglist, __new_sys_siglist, object, - OLD2_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (_sys_sigabbrev_internal, __old2_sys_sigabbrev) +declare_symbol (__old2_sys_sigabbrev, object, + OLD2_SIGLIST_SIZE * __WORDSIZE / 8) +strong_alias (__old2_sys_siglist, _old2_sys_siglist) compat_symbol (libc, __old2_sys_siglist, _sys_siglist, GLIBC_2_1); compat_symbol (libc, _old2_sys_siglist, sys_siglist, GLIBC_2_1); compat_symbol (libc, __old2_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1); diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 04296d2a9a..df3edf5460 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. i386 version. - Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 2005 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 @@ -34,7 +34,9 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr) } -#ifdef PI_STATIC_AND_HIDDEN +#if defined PI_STATIC_AND_HIDDEN \ + && defined HAVE_VISIBILITY_ATTRIBUTE && defined HAVE_HIDDEN \ + && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT, a special entry that is never relocated. */ @@ -242,7 +244,7 @@ _dl_start_user:\n\ define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32 \ || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32 \ @@ -350,7 +352,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, *reloc_addr = value; break; -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) case R_386_TLS_DTPMOD32: # ifdef RTLD_BOOTSTRAP /* During startup the dynamic linker is always the module @@ -474,6 +476,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr); break; +# ifdef USE_TLS case R_386_TLS_DTPMOD32: /* Get the information from the link map returned by the resolv function. */ @@ -510,6 +513,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + reloc->r_addend; } break; +# endif /* use TLS */ case R_386_COPY: if (sym == NULL) /* This can happen in trace mode if an object could not be diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index 28547d44b8..e04ce95099 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Inline math functions for i387. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995. @@ -529,38 +529,24 @@ __inline_mathcodeNP (tanh, __x, \ __inline_mathcodeNP (floor, __x, \ register long double __value; \ - register int __ignore; \ - unsigned short int __cw; \ - unsigned short int __cwtmp; \ - __asm __volatile ("fnstcw %3\n\t" \ - "movzwl %3, %1\n\t" \ - "andl $0xf3ff, %1\n\t" \ - "orl $0x0400, %1\n\t" /* rounding down */ \ - "movw %w1, %2\n\t" \ - "fldcw %2\n\t" \ - "frndint\n\t" \ - "fldcw %3" \ - : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ - "=m" (__cw) \ - : "0" (__x)); \ + __volatile unsigned short int __cw; \ + __volatile unsigned short int __cwtmp; \ + __asm __volatile ("fnstcw %0" : "=m" (__cw)); \ + __cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */ \ + __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \ + __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \ + __asm __volatile ("fldcw %0" : : "m" (__cw)); \ return __value) __inline_mathcodeNP (ceil, __x, \ register long double __value; \ - register int __ignore; \ - unsigned short int __cw; \ - unsigned short int __cwtmp; \ - __asm __volatile ("fnstcw %3\n\t" \ - "movzwl %3, %1\n\t" \ - "andl $0xf3ff, %1\n\t" \ - "orl $0x0800, %1\n\t" /* rounding up */ \ - "movw %w1, %2\n\t" \ - "fldcw %2\n\t" \ - "frndint\n\t" \ - "fldcw %3" \ - : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ - "=m" (__cw) \ - : "0" (__x)); \ + __volatile unsigned short int __cw; \ + __volatile unsigned short int __cwtmp; \ + __asm __volatile ("fnstcw %0" : "=m" (__cw)); \ + __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */ \ + __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \ + __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \ + __asm __volatile ("fldcw %0" : : "m" (__cw)); \ return __value) #ifdef __FAST_MATH__ diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h index a27734c37e..c748761758 100644 --- a/sysdeps/i386/i486/bits/atomic.h +++ b/sysdeps/i386/i486/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -18,7 +18,6 @@ 02111-1307 USA. */ #include <stdint.h> -#include <tls.h> /* For tcbhead_t. */ typedef int8_t atomic8_t; @@ -77,40 +76,6 @@ typedef uintmax_t uatomic_max_t; : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) - -#define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%gs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - -#define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%gs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - -#define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%gs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - /* XXX We do not really need 64-bit compare-and-exchange. At least not in the moment. Using it would mean causing portability problems since not many other 32-bit architectures have support for @@ -120,8 +85,6 @@ typedef uintmax_t uatomic_max_t; #if 1 # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); }) -# define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); }) #else # ifdef __PIC__ # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ @@ -137,24 +100,6 @@ typedef uintmax_t uatomic_max_t; & 0xffffffff), \ "d" (((unsigned long long int) (oldval)) >> 32)); \ ret; }) - -# define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("xchgl %2, %%ebx\n\t" \ - "cmpl $0, %%gs:%P7\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchg8b %1\n\t" \ - "xchgl %2, %%ebx" \ - : "=A" (ret), "=m" (*mem) \ - : "DS" (((unsigned long long int) (newval)) \ - & 0xffffffff), \ - "c" (((unsigned long long int) (newval)) >> 32), \ - "m" (*mem), "a" (((unsigned long long int) (oldval)) \ - & 0xffffffff), \ - "d" (((unsigned long long int) (oldval)) >> 32), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) # else # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ @@ -167,22 +112,6 @@ typedef uintmax_t uatomic_max_t; & 0xffffffff), \ "d" (((unsigned long long int) (oldval)) >> 32)); \ ret; }) - -# define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%gs:%P7\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchg8b %1" \ - : "=A" (ret), "=m" (*mem) \ - : "b" (((unsigned long long int) (newval)) \ - & 0xffffffff), \ - "c" (((unsigned long long int) (newval)) >> 32), \ - "m" (*mem), "a" (((unsigned long long int) (oldval)) \ - & 0xffffffff), \ - "d" (((unsigned long long int) (oldval)) >> 32), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) # endif #endif @@ -210,24 +139,21 @@ typedef uintmax_t uatomic_max_t; result; }) -#define __arch_exchange_and_add_body(lock, pfx, mem, value) \ +#define atomic_exchange_and_add(mem, value) \ ({ __typeof (*mem) __result; \ __typeof (value) __addval = (value); \ if (sizeof (*mem) == 1) \ - __asm __volatile (lock "xaddb %b0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ : "=r" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "xaddw %w0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ : "=r" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "xaddl %0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ : "=r" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else \ { \ __typeof (mem) __memp = (mem); \ @@ -235,64 +161,41 @@ typedef uintmax_t uatomic_max_t; __result = *__memp; \ do \ __tmpval = __result; \ - while ((__result = pfx##_compare_and_exchange_val_64_acq \ + while ((__result = __arch_compare_and_exchange_val_64_acq \ (__memp, __result + __addval, __result)) == __tmpval); \ } \ __result; }) -#define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, __arch, mem, value) - -#define __arch_exchange_and_add_cprefix \ - "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t" - -#define catomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c, \ - mem, value) - - -#define __arch_add_body(lock, pfx, mem, value) \ - do { \ - if (__builtin_constant_p (value) && (value) == 1) \ - atomic_increment (mem); \ - else if (__builtin_constant_p (value) && (value) == -1) \ - atomic_decrement (mem); \ - else if (sizeof (*mem) == 1) \ - __asm __volatile (lock "addb %b1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "addw %w1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "addl %1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - { \ - __typeof (value) __addval = (value); \ - __typeof (mem) __memp = (mem); \ - __typeof (*mem) __oldval = *__memp; \ - __typeof (*mem) __tmpval; \ - do \ - __tmpval = __oldval; \ - while ((__oldval = pfx##_compare_and_exchange_val_64_acq \ - (__memp, __oldval + __addval, __oldval)) == __tmpval); \ - } \ - } while (0) #define atomic_add(mem, value) \ - __arch_add_body (LOCK_PREFIX, __arch, mem, value) - -#define __arch_add_cprefix \ - "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t" - -#define catomic_add(mem, value) \ - __arch_add_body (__arch_add_cprefix, __arch_c, mem, value) + (void) ({ if (__builtin_constant_p (value) && (value) == 1) \ + atomic_increment (mem); \ + else if (__builtin_constant_p (value) && (value) == -1) \ + atomic_decrement (mem); \ + else if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "addl %1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else \ + { \ + __typeof (value) __addval = (value); \ + __typeof (mem) __memp = (mem); \ + __typeof (*mem) __oldval = *__memp; \ + __typeof (*mem) __tmpval; \ + do \ + __tmpval = __oldval; \ + while ((__oldval = __arch_compare_and_exchange_val_64_acq \ + (__memp, __oldval + __addval, __oldval)) == __tmpval); \ + } \ + }) #define atomic_add_negative(mem, value) \ @@ -333,42 +236,30 @@ typedef uintmax_t uatomic_max_t; __result; }) -#define __arch_increment_body(lock, pfx, mem) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "incb %b0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "incw %w0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "incl %0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - { \ - __typeof (mem) __memp = (mem); \ - __typeof (*mem) __oldval = *__memp; \ - __typeof (*mem) __tmpval; \ - do \ - __tmpval = __oldval; \ - while ((__oldval = pfx##_compare_and_exchange_val_64_acq \ - (__memp, __oldval + 1, __oldval)) == __tmpval); \ - } \ - } while (0) - -#define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem) - -#define __arch_increment_cprefix \ - "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t" - -#define catomic_increment(mem) \ - __arch_increment_body (__arch_increment_cprefix, __arch_c, mem) +#define atomic_increment(mem) \ + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "incb %b0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "incw %w0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "incl %0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else \ + { \ + __typeof (mem) __memp = (mem); \ + __typeof (*mem) __oldval = *__memp; \ + __typeof (*mem) __tmpval; \ + do \ + __tmpval = __oldval; \ + while ((__oldval = __arch_compare_and_exchange_val_64_acq \ + (__memp, __oldval + 1, __oldval)) == __tmpval); \ + } \ + }) #define atomic_increment_and_test(mem) \ @@ -390,42 +281,30 @@ typedef uintmax_t uatomic_max_t; __result; }) -#define __arch_decrement_body(lock, pfx, mem) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "decb %b0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "decw %w0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "decl %0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - { \ - __typeof (mem) __memp = (mem); \ - __typeof (*mem) __oldval = *__memp; \ - __typeof (*mem) __tmpval; \ - do \ - __tmpval = __oldval; \ - while ((__oldval = pfx##_compare_and_exchange_val_64_acq \ - (__memp, __oldval - 1, __oldval)) == __tmpval); \ - } \ - } while (0) - -#define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem) - -#define __arch_decrement_cprefix \ - "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t" - -#define catomic_decrement(mem) \ - __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem) +#define atomic_decrement(mem) \ + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "decb %b0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "decw %w0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "decl %0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else \ + { \ + __typeof (mem) __memp = (mem); \ + __typeof (*mem) __oldval = *__memp; \ + __typeof (*mem) __tmpval; \ + do \ + __tmpval = __oldval; \ + while ((__oldval = __arch_compare_and_exchange_val_64_acq \ + (__memp, __oldval - 1, __oldval)) == __tmpval); \ + } \ + }) #define atomic_decrement_and_test(mem) \ @@ -448,22 +327,21 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_set(mem, bit) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1 << (bit))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1 << (bit))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "orl %2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1 << (bit))); \ - else \ - abort (); \ - } while (0) + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1 << (bit))); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1 << (bit))); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "orl %2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1 << (bit))); \ + else \ + abort (); \ + }) #define atomic_bit_test_set(mem, bit) \ @@ -486,51 +364,3 @@ typedef uintmax_t uatomic_max_t; #define atomic_delay() asm ("rep; nop") - - -#define atomic_and(mem, mask) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "andb %1, %b0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "andw %1, %w0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "andl %1, %0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else \ - abort (); \ - } while (0) - - -#define __arch_or_body(lock, mem, mask) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "orb %1, %b0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "orw %1, %w0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "orl %1, %0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - abort (); \ - } while (0) - -#define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask) - -#define __arch_or_cprefix \ - "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t" - -#define catomic_or(mem, mask) __arch_or_body (__arch_or_cprefix, mem, mask) diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S index 4fa6adea98..4bd5394bec 100644 --- a/sysdeps/i386/i686/memcmp.S +++ b/sysdeps/i386/i686/memcmp.S @@ -1,5 +1,5 @@ /* Compare two memory blocks for differences in the first COUNT bytes. - Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 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,9 +44,13 @@ absolute address. */ \ addl (%ebx,INDEX,4), %ebx +#ifdef HAVE_HIDDEN .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits .globl __i686.get_pc_thunk.bx .hidden __i686.get_pc_thunk.bx +#else + .text +#endif ALIGN (4) .type __i686.get_pc_thunk.bx,@function __i686.get_pc_thunk.bx: @@ -380,38 +384,38 @@ END (BP_SYM (memcmp)) .section .rodata ALIGN (2) L(table_32bytes) : - .long L(0bytes) - L(table_32bytes) - .long L(1bytes) - L(table_32bytes) - .long L(2bytes) - L(table_32bytes) - .long L(3bytes) - L(table_32bytes) - .long L(4bytes) - L(table_32bytes) - .long L(5bytes) - L(table_32bytes) - .long L(6bytes) - L(table_32bytes) - .long L(7bytes) - L(table_32bytes) - .long L(8bytes) - L(table_32bytes) - .long L(9bytes) - L(table_32bytes) - .long L(10bytes) - L(table_32bytes) - .long L(11bytes) - L(table_32bytes) - .long L(12bytes) - L(table_32bytes) - .long L(13bytes) - L(table_32bytes) - .long L(14bytes) - L(table_32bytes) - .long L(15bytes) - L(table_32bytes) - .long L(16bytes) - L(table_32bytes) - .long L(17bytes) - L(table_32bytes) - .long L(18bytes) - L(table_32bytes) - .long L(19bytes) - L(table_32bytes) - .long L(20bytes) - L(table_32bytes) - .long L(21bytes) - L(table_32bytes) - .long L(22bytes) - L(table_32bytes) - .long L(23bytes) - L(table_32bytes) - .long L(24bytes) - L(table_32bytes) - .long L(25bytes) - L(table_32bytes) - .long L(26bytes) - L(table_32bytes) - .long L(27bytes) - L(table_32bytes) - .long L(28bytes) - L(table_32bytes) - .long L(29bytes) - L(table_32bytes) - .long L(30bytes) - L(table_32bytes) - .long L(31bytes) - L(table_32bytes) + .long L(0bytes) - . + 0x0 + .long L(1bytes) - . + 0x4 + .long L(2bytes) - . + 0x8 + .long L(3bytes) - . + 0xc + .long L(4bytes) - . + 0x10 + .long L(5bytes) - . + 0x14 + .long L(6bytes) - . + 0x18 + .long L(7bytes) - . + 0x1c + .long L(8bytes) - . + 0x20 + .long L(9bytes) - . + 0x24 + .long L(10bytes) - . + 0x28 + .long L(11bytes) - . + 0x2c + .long L(12bytes) - . + 0x30 + .long L(13bytes) - . + 0x34 + .long L(14bytes) - . + 0x38 + .long L(15bytes) - . + 0x3c + .long L(16bytes) - . + 0x40 + .long L(17bytes) - . + 0x44 + .long L(18bytes) - . + 0x48 + .long L(19bytes) - . + 0x4c + .long L(20bytes) - . + 0x50 + .long L(21bytes) - . + 0x54 + .long L(22bytes) - . + 0x58 + .long L(23bytes) - . + 0x5c + .long L(24bytes) - . + 0x60 + .long L(25bytes) - . + 0x64 + .long L(26bytes) - . + 0x68 + .long L(27bytes) - . + 0x6c + .long L(28bytes) - . + 0x70 + .long L(29bytes) - . + 0x74 + .long L(30bytes) - . + 0x78 + .long L(31bytes) - . + 0x7c #undef bcmp diff --git a/sysdeps/i386/soft-fp/sfp-machine.h b/sysdeps/i386/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..ed71ae418a --- /dev/null +++ b/sysdeps/i386/soft-fp/sfp-machine.h @@ -0,0 +1,89 @@ +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \ + __asm__("addl %5,%1; adcl %3,%0" \ + : "=r"(rh), "=r"(rl) \ + : "%0"(xh), "g"(yh), "%1"(xl), "g"(yl) \ + : "cc") + +#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + __asm__ volatile("addl %5,%1; adcl %3,%0" \ + : "=r"(r1), "=r"(r0) \ + : "%0"(x1), "g"(y1), "%1"(x0), "g"(y0) \ + : "cc"); \ + __asm__ volatile("adcl %5,%1; adcl %3,%0" \ + : "=r"(r3), "=r"(r2) \ + : "%0"(x3), "g"(y3), "%1"(x2), "g"(y2) \ + : "cc"); \ + } while (0) + +#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \ + __asm__("subl %5,%1; sbbl %4,%0" \ + : "=r"(rh), "=r"(rl) \ + : "0"(xh), "1"(xl), "g"(yh), "g"(yl) \ + : "cc") + +#define __FP_CLZ(r, x) \ + do { \ + __asm__("bsrl %1,%0" : "=r"(r) : "g"(x) : "cc"); \ + r ^= 31; \ + } while (0) + +#define _i386_mul_32_64(rh, rl, x, y) \ + __asm__("mull %2" : "=d"(rh), "=a"(rl) : "%g"(x), "1"(y) : "cc") + +#define _i386_div_64_32(q, r, nh, nl, d) \ + __asm__ ("divl %4" : "=a"(q), "=d"(r) : "0"(nl), "1"(nh), "g"(d) : "cc") + + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,_i386_mul_32_64) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,_i386_mul_32_64) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) + +#define _FP_NANFRAC_S _FP_QNANBIT_S +#define _FP_NANFRAC_D _FP_QNANBIT_D, 0 +#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 +#define _FP_NANSIGN_Q 1 + +#define _FP_KEEPNANFRACP 1 +/* Here is something Intel misdesigned: the specs don't define + the case where we have two NaNs with same mantissas, but + different sign. Different operations pick up different NaNs. + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if (_FP_FRAC_GT_##wc(X, Y) \ + || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +#define FP_EX_INVALID (1 << 0) +#define FP_EX_DENORM (1 << 1) +#define FP_EX_DIVZERO (1 << 2) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 4) +#define FP_EX_INEXACT (1 << 5) + +#define FP_RND_NEAREST 0 +#define FP_RND_ZERO 3 +#define FP_RND_PINF 2 +#define FP_RND_MINF 1 diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index e03a8e926d..2739cb00b3 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -1,6 +1,5 @@ /* Assembler macros for i386. - Copyright (C) 1991-93,95,96,98,2002,2003,2005,2006 - Free Software Foundation, Inc. + Copyright (C) 1991-93,95,96,98,2002,2003,2005 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 @@ -133,7 +132,15 @@ lose: SYSCALL_PIC_SETUP \ cfi_adjust_cfa_offset (-4); \ addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx; -# define SETUP_PIC_REG(reg) \ +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG(reg) \ + call 1f; \ + .subsection 1; \ +1:movl (%esp), %e##reg; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG(reg) \ .ifndef __i686.get_pc_thunk.reg; \ .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \ .globl __i686.get_pc_thunk.reg; \ @@ -146,6 +153,7 @@ __i686.get_pc_thunk.reg: \ .previous; \ .endif; \ call __i686.get_pc_thunk.reg +# endif # define LOAD_PIC_REG(reg) \ SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 61b4ea99a7..55349690e3 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. IA-64 version. - Copyright (C) 1995-1997, 2000-2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 2000-2004, 2005 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 @@ -311,7 +311,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) of the main executable's symbols, as for a COPY reloc, which we don't use. */ /* ??? Ignore *MSB for now. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) #define elf_machine_type_class(type) \ (((type) == R_IA64_IPLTLSB || (type) == R_IA64_DTPMOD64LSB \ || (type) == R_IA64_DTPREL64LSB || (type) == R_IA64_TPREL64LSB) \ @@ -432,7 +432,7 @@ elf_machine_rela (struct link_map *map, value = _dl_make_fptr (sym_map, sym, value); else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB)) value -= (Elf64_Addr) reloc_addr & -16; -#if !defined RTLD_BOOTSTRAP || defined USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || defined USE___THREAD) else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPMOD64LSB)) # ifdef RTLD_BOOTSTRAP /* During startup the dynamic linker is always index 1. */ diff --git a/sysdeps/ia64/libc-tls.c b/sysdeps/ia64/libc-tls.c index 9751284008..2c0eeae86f 100644 --- a/sysdeps/ia64/libc-tls.c +++ b/sysdeps/ia64/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. IA-64 version. - Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 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 @@ -19,6 +19,8 @@ #include <csu/libc-tls.c> +#if USE_TLS + /* On IA-64, as it lacks linker optimizations, __tls_get_addr can be called even in statically linked binaries. In this case module must be always 1 and PT_TLS segment @@ -30,3 +32,5 @@ __tls_get_addr (size_t m, size_t offset) dtv_t *dtv = THREAD_DTV (); return (char *) dtv[1].pointer.val + offset; } + +#endif diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c index 3288f186e5..fa7da60204 100644 --- a/sysdeps/mach/hurd/fork.c +++ b/sysdeps/mach/hurd/fork.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994,1995,1996,1997,1999,2001,2002,2004,2005,2006 +/* Copyright (C) 1994,1995,1996,1997,1999,2001,2002,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -532,9 +532,11 @@ __fork (void) /* Set the child user thread up to return 1 from the setjmp above. */ _hurd_longjmp_thread_state (&state, env, 1); +#if USE_TLS /* Do special thread setup for TLS if needed. */ if (err = _hurd_tls_fork (thread, &state)) LOSE; +#endif if (err = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR, (natural_t *) &state, statecount)) diff --git a/sysdeps/mach/hurd/futimes.c b/sysdeps/mach/hurd/futimes.c index 4628eee2c3..ca687b8bdf 100644 --- a/sysdeps/mach/hurd/futimes.c +++ b/sysdeps/mach/hurd/futimes.c @@ -1,5 +1,5 @@ /* futimes -- change access and modification times of open file. Hurd version. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002 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 @@ -28,24 +28,20 @@ int __futimes (int fd, const struct timeval tvp[2]) { - union tv - { - struct timeval tv; - time_value_t tvt; - }; - const union tv *u = (const union tv *) tvp; - union tv nulltv[2]; + struct timeval timevals[2]; error_t err; if (tvp == NULL) { /* Setting the number of microseconds to `-1' tells the underlying filesystems to use the current time. */ - nulltv[0].tvt.microseconds = nulltv[1].tvt.microseconds = -1; - u = nulltv; + timevals[1].tv_usec = timevals[0].tv_usec = (time_t)-1; + tvp = timevals; } - err = HURD_DPORT_USE (fd, __file_utimes (port, u[0].tvt, u[1].tvt)); + err = HURD_DPORT_USE (fd, __file_utimes (port, + *(time_value_t *) &tvp[0], + *(time_value_t *) &tvp[1])); return err ? __hurd_dfail (fd, err) : 0; } weak_alias (__futimes, futimes) diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 972cac57a1..223a47d2f2 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -1,5 +1,5 @@ /* Definitions for thread-local data handling. Hurd/i386 version. - Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004 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 @@ -25,6 +25,9 @@ /* Some things really need not be machine-dependent. */ # include <sysdeps/mach/hurd/tls.h> +/* Indiciate that TLS support is available. */ +# define USE_TLS 1 + /* The TCB can have any size and the memory following the address the thread pointer points to is unspecified. Allocate the TCB there. */ # define TLS_TCB_AT_TP 1 diff --git a/sysdeps/mach/hurd/lutimes.c b/sysdeps/mach/hurd/lutimes.c index bf5610c467..cf89d8862f 100644 --- a/sysdeps/mach/hurd/lutimes.c +++ b/sysdeps/mach/hurd/lutimes.c @@ -1,5 +1,5 @@ /* lutimes -- change access and modification times of a symlink. Hurd version. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002 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 @@ -28,13 +28,7 @@ int __lutimes (const char *file, const struct timeval tvp[2]) { - union tv - { - struct timeval tv; - time_value_t tvt; - }; - const union tv *u = (const union tv *) tvp; - union tv nulltv[2]; + struct timeval timevals[2]; error_t err; file_t port; @@ -42,14 +36,15 @@ __lutimes (const char *file, const struct timeval tvp[2]) { /* Setting the number of microseconds to `-1' tells the underlying filesystems to use the current time. */ - nulltv[0].tvt.microseconds = nulltv[1].tvt.microseconds = -1; - u = nulltv; + timevals[1].tv_usec = timevals[0].tv_usec = (time_t)-1; + tvp = timevals; } port = __file_name_lookup (file, O_NOLINK, 0); if (port == MACH_PORT_NULL) return -1; - err = __file_utimes (port, u[0].tvt, u[1].tvt); + err = __file_utimes (port, + *(time_value_t *) &tvp[0], *(time_value_t *) &tvp[1]); __mach_port_deallocate (__mach_task_self (), port); if (err) return __hurd_fail (err); diff --git a/sysdeps/mach/hurd/utimes.c b/sysdeps/mach/hurd/utimes.c index fdc1427feb..74f3a342f4 100644 --- a/sysdeps/mach/hurd/utimes.c +++ b/sysdeps/mach/hurd/utimes.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991-1995,1997,1999,2000,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1991-1995, 97, 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 @@ -29,13 +28,7 @@ __utimes (file, tvp) const char *file; const struct timeval tvp[2]; { - union tv - { - struct timeval tv; - time_value_t tvt; - }; - const union tv *u = (const union tv *) tvp; - union tv nulltv[2]; + struct timeval timevals[2]; error_t err; file_t port; @@ -43,17 +36,19 @@ __utimes (file, tvp) { /* Setting the number of microseconds to `-1' tells the underlying filesystems to use the current time. */ - nulltv[0].tvt.microseconds = nulltv[1].tvt.microseconds = -1; - u = nulltv; + timevals[1].tv_usec = timevals[0].tv_usec = (time_t)-1; + tvp = timevals; } port = __file_name_lookup (file, 0, 0); if (port == MACH_PORT_NULL) return -1; - err = __file_utimes (port, u[0].tvt, u[1].tvt); + err = __file_utimes (port, + *(time_value_t *) &tvp[0], *(time_value_t *) &tvp[1]); __mach_port_deallocate (__mach_task_self (), port); if (err) return __hurd_fail (err); return 0; } + weak_alias (__utimes, utimes) diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index b4966852a7..9387e20db2 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1395,10 +1395,10 @@ rfc3484_sort (const void *p1, const void *p2) { if (!(a1->source_addr_flags & in6ai_homeaddress) && (a2->source_addr_flags & in6ai_homeaddress)) - return 1; + return -1; if ((a1->source_addr_flags & in6ai_homeaddress) && !(a2->source_addr_flags & in6ai_homeaddress)) - return -1; + return 1; } /* Rule 5: Prefer matching label. */ @@ -1435,11 +1435,11 @@ rfc3484_sort (const void *p1, const void *p2) if (a1->got_source_addr) { if (!(a1->source_addr_flags & in6ai_temporary) - && (a2->source_addr_flags & in6ai_temporary)) + && (a1->source_addr_flags & in6ai_temporary)) return -1; if ((a1->source_addr_flags & in6ai_temporary) - && !(a2->source_addr_flags & in6ai_temporary)) - return 1; + && !(a1->source_addr_flags & in6ai_temporary)) + return -1; /* XXX Do we need to check anything beside temporary addresses? */ } @@ -2085,12 +2085,10 @@ getaddrinfo (const char *name, const char *service, if (q->ai_family == PF_INET6 && in6ai != NULL) { - /* See whether the source address is the list of - deprecated or temporary addresses. */ + /* See whether the address is the list of deprecated + or temporary addresses. */ struct in6addrinfo tmp; - struct sockaddr_in6 *sin6p - = (struct sockaddr_in6 *) &results[i].source_addr; - memcpy (tmp.addr, &sin6p->sin6_addr, IN6ADDRSZ); + memcpy (tmp.addr, q->ai_addr, IN6ADDRSZ); struct in6addrinfo *found = bsearch (&tmp, in6ai, in6ailen, sizeof (*in6ai), diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c index a732e94fa8..196f9bd65c 100644 --- a/sysdeps/powerpc/dl-procinfo.c +++ b/sysdeps/powerpc/dl-procinfo.c @@ -46,11 +46,10 @@ #if !defined PROCINFO_DECL && defined SHARED ._dl_powerpc_cap_flags #else -PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10] +PROCINFO_CLASS const char _dl_powerpc_cap_flags[20][10] #endif #ifndef PROCINFO_DECL = { - "power6x", "dfp", "pa6t", "arch_2_05", "ic_snoop", "smt", "booke", "cellbe", "power5+", "power5", "power4", "notb", "efpdouble", "efpsingle", "spe", @@ -67,17 +66,11 @@ PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10] #if !defined PROCINFO_DECL && defined SHARED ._dl_powerpc_platforms #else -PROCINFO_CLASS const char _dl_powerpc_platforms[7][12] +PROCINFO_CLASS const char _dl_powerpc_platforms[6][12] #endif #ifndef PROCINFO_DECL = { - [PPC_PLATFORM_POWER4] = "power4", - [PPC_PLATFORM_PPC970] = "ppc970", - [PPC_PLATFORM_POWER5] = "power5", - [PPC_PLATFORM_POWER5_PLUS] = "power5+", - [PPC_PLATFORM_POWER6] = "power6", - [PPC_PLATFORM_CELL_BE] = "ppc-cell-be", - [PPC_PLATFORM_POWER6X] = "power6x" + "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be" } #endif #if !defined SHARED || defined PROCINFO_DECL diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h index 0bf935385a..f63da6d555 100644 --- a/sysdeps/powerpc/dl-procinfo.h +++ b/sysdeps/powerpc/dl-procinfo.h @@ -24,29 +24,19 @@ #include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */ /* There are 20 bits used, but they are bits 12..31. */ -#define _DL_HWCAP_FIRST 9 +#define _DL_HWCAP_FIRST 12 #define _DL_HWCAP_COUNT 32 /* These bits influence library search. */ -#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \ - + PPC_FEATURE_HAS_DFP) +#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC) -#define _DL_PLATFORMS_COUNT 7 +#define _DL_PLATFORMS_COUNT 6 #define _DL_FIRST_PLATFORM 32 /* Mask to filter out platforms. */ #define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \ << _DL_FIRST_PLATFORM) -/* Platform bits (relative to _DL_FIRST_PLATFORM). */ -#define PPC_PLATFORM_POWER4 0 -#define PPC_PLATFORM_PPC970 1 -#define PPC_PLATFORM_POWER5 2 -#define PPC_PLATFORM_POWER5_PLUS 3 -#define PPC_PLATFORM_POWER6 4 -#define PPC_PLATFORM_CELL_BE 5 -#define PPC_PLATFORM_POWER6X 6 - static inline const char * __attribute__ ((unused)) _dl_hwcap_string (int idx) @@ -78,30 +68,22 @@ _dl_string_platform (const char *str) if (str == NULL) return -1; - if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_POWER4], 5) == 0) + if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0) { int ret; str += 5; switch (*str) { case '4': - ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER4; + ret = _DL_FIRST_PLATFORM + 0; break; case '5': - ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5; + ret = _DL_FIRST_PLATFORM + 2; if (str[1] == '+') - { - ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5_PLUS; - ++str; - } + ++ret, ++str; break; case '6': - ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6; - if (str[1] == 'x') - { - ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6X; - ++str; - } + ret = _DL_FIRST_PLATFORM + 4; break; default: return -1; @@ -109,16 +91,12 @@ _dl_string_platform (const char *str) if (str[1] == '\0') return ret; } - else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970], - 3) == 0) + else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0) { - if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970] - + 3) == 0) - return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC970; - else if (strcmp (str + 3, - GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3) - == 0) - return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE; + if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0) + return _DL_FIRST_PLATFORM + 1; + else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0) + return _DL_FIRST_PLATFORM + 5; } return -1; diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h index 04478309d9..aed899e882 100644 --- a/sysdeps/powerpc/fpu/bits/mathinline.h +++ b/sysdeps/powerpc/fpu/bits/mathinline.h @@ -121,4 +121,62 @@ __NTH (fdimf (float __x, float __y)) #endif /* __USE_ISOC99 */ #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ + +/* This code is used internally in the GNU libc. */ +#ifdef __LIBC_INTERNAL_MATH_INLINES + +#include <sysdep.h> +#include <ldsodefs.h> +#include <dl-procinfo.h> + +# if __WORDSIZE == 64 || defined _ARCH_PWR4 +# define __CPU_HAS_FSQRT 1 +# else +# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) +# endif + +extern double __slow_ieee754_sqrt (double); +__MATH_INLINE double +__NTH (__ieee754_sqrt (double __x)) +{ + double __z; + + /* If the CPU is 64-bit we can use the optional FP instructions. */ + if (__CPU_HAS_FSQRT) + { + /* Volatile is required to prevent the compiler from moving the + fsqrt instruction above the branch. */ + __asm __volatile ( + " fsqrt %0,%1\n" + : "=f" (__z) + : "f" (__x)); + } + else + __z = __slow_ieee754_sqrt(__x); + + return __z; +} + +extern float __slow_ieee754_sqrtf (float); +__MATH_INLINE float +__NTH (__ieee754_sqrtf (float __x)) +{ + float __z; + + /* If the CPU is 64-bit we can use the optional FP instructions. */ + if (__CPU_HAS_FSQRT) + { + /* Volatile is required to prevent the compiler from moving the + fsqrts instruction above the branch. */ + __asm __volatile ( + " fsqrts %0,%1\n" + : "=f" (__z) + : "f" (__x)); + } + else + __z = __slow_ieee754_sqrtf(__x); + + return __z; +} +#endif /* __LIBC_INTERNAL_MATH_INLINES */ #endif /* __GNUC__ && !_SOFT_FLOAT */ diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h deleted file mode 100644 index 90021c6d3c..0000000000 --- a/sysdeps/powerpc/fpu/math_private.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Private inline math functions for powerpc. - Copyright (C) 2006 - 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, - MA 02110-1301 USA */ - -#ifndef _PPC_MATH_PRIVATE_H_ -#define _PPC_MATH_PRIVATE_H_ - -#include <sysdep.h> -#include <ldsodefs.h> -#include <dl-procinfo.h> - -# if __WORDSIZE == 64 || defined _ARCH_PWR4 -# define __CPU_HAS_FSQRT 1 -# else -# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) -# endif - -# ifndef __LIBC_INTERNAL_MATH_INLINES -extern double __slow_ieee754_sqrt (double); -__inline double -__ieee754_sqrt (double __x) -{ - double __z; - - /* If the CPU is 64-bit we can use the optional FP instructions. */ - if (__CPU_HAS_FSQRT) - { - /* Volatile is required to prevent the compiler from moving the - fsqrt instruction above the branch. */ - __asm __volatile ( - " fsqrt %0,%1\n" - : "=f" (__z) - : "f" (__x)); - } - else - __z = __slow_ieee754_sqrt(__x); - - return __z; -} - -extern float __slow_ieee754_sqrtf (float); - -__inline float -__ieee754_sqrtf (float __x) -{ - float __z; - - /* If the CPU is 64-bit we can use the optional FP instructions. */ - if (__CPU_HAS_FSQRT) - { - /* Volatile is required to prevent the compiler from moving the - fsqrts instruction above the branch. */ - __asm __volatile ( - " fsqrts %0,%1\n" - : "=f" (__z) - : "f" (__x)); - } - else - __z = __slow_ieee754_sqrtf(__x); - - return __z; -} -#endif /* __LIBC_INTERNAL_MATH_INLINES */ - -#include <math/math_private.h> - -#endif /* _PPC_MATH_PRIVATE_H_ */ diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c index fc460993b1..4120a02382 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.c +++ b/sysdeps/powerpc/powerpc32/dl-machine.c @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation functions. PowerPC version. - Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004, 2005 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 @@ -564,12 +564,13 @@ __process_machine_rela (struct link_map *map, } break; +#ifdef USE_TLS #define CHECK_STATIC_TLS(map, sym_map) \ do { \ if (__builtin_expect ((sym_map)->l_tls_offset == NO_TLS_OFFSET, 0)) \ _dl_allocate_static_tls (sym_map); \ } while (0) -#define DO_TLS_RELOC(suffix) \ +# define DO_TLS_RELOC(suffix) \ case R_PPC_DTPREL##suffix: \ /* During relocation all TLS symbols are defined and used. \ Therefore the offset is already correct. */ \ @@ -608,6 +609,7 @@ __process_machine_rela (struct link_map *map, DO_TLS_RELOC (16_LO) DO_TLS_RELOC (16_HI) DO_TLS_RELOC (16_HA) +#endif default: _dl_reloc_bad_type (map, rinfo, 0); diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index a50ffdd1c2..496fa71ecc 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. PowerPC version. - Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2005 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 @@ -138,7 +138,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, /* We never want to use a PLT entry as the destination of a reloc, when what is being relocated is a branch. This is partly for efficiency, but mostly so we avoid loops. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) #define elf_machine_type_class(type) \ ((((type) == R_PPC_JMP_SLOT \ || (type) == R_PPC_REL24 \ @@ -330,7 +330,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = value; break; -#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \ && !defined RESOLVE_CONFLICT_FIND_MAP # ifdef RTLD_BOOTSTRAP # define NOT_BOOTSTRAP 0 @@ -361,7 +361,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = TLS_TPREL_VALUE (sym_map, sym, reloc); } break; -#endif +#endif /* USE_TLS etc. */ case R_PPC_JMP_SLOT: #ifdef RESOLVE_CONFLICT_FIND_MAP diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h index 88cfe71e0b..8fc624ebd9 100644 --- a/sysdeps/powerpc/powerpc32/sysdep.h +++ b/sysdeps/powerpc/powerpc32/sysdep.h @@ -96,7 +96,7 @@ #endif #if defined SHARED && defined DO_VERSIONING && defined PIC \ - && !defined NO_HIDDEN + && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN # undef HIDDEN_JUMPTARGET # define HIDDEN_JUMPTARGET(name) __GI_##name##@local #endif diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 89a69e1a23..cec271bb3a 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -1,6 +1,7 @@ /* Machine-dependent ELF dynamic relocation inline functions. PowerPC64 version. - Copyright 1995-2005, 2006 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + 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 @@ -259,7 +260,7 @@ BODY_PREFIX "_dl_start_user:\n" \ ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) #define elf_machine_type_class(type) \ /* This covers all the TLS relocs, though most won't appear. */ \ (((((type) >= R_PPC64_DTPMOD64 && (type) <= R_PPC64_TPREL16_HIGHESTA) \ @@ -494,7 +495,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) /* This computes the value used by TPREL* relocs. */ auto inline Elf64_Addr __attribute__ ((always_inline, const)) elf_machine_tprel (struct link_map *map, @@ -561,7 +562,7 @@ elf_machine_rela (struct link_map *map, #endif return; -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) case R_PPC64_DTPMOD64: # ifdef RTLD_BOOTSTRAP /* During startup the dynamic linker is always index 1. */ @@ -644,7 +645,7 @@ elf_machine_rela (struct link_map *map, value = elf_machine_tprel (map, sym_map, sym, reloc); *(Elf64_Half *) reloc_addr = PPC_HIGHESTA (value); break; -#endif +#endif /* USE_TLS etc. */ #ifndef RTLD_BOOTSTRAP /* None of the following appear in ld.so */ case R_PPC64_ADDR16_LO_DS: diff --git a/sysdeps/powerpc/sysdep.h b/sysdeps/powerpc/sysdep.h index 2ae52b78c0..a376e4dac3 100644 --- a/sysdeps/powerpc/sysdep.h +++ b/sysdeps/powerpc/sysdep.h @@ -34,16 +34,13 @@ #define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 /* SPE Double. */ #define PPC_FEATURE_NO_TB 0x00100000 /* 601/403gx have no timebase */ #define PPC_FEATURE_POWER4 0x00080000 /* POWER4 ISA 2.00 */ -#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.02 */ -#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.03 */ +#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.01 */ +#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.02 */ #define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */ #define PPC_FEATURE_BOOKE 0x00008000 -#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous Multi-Threading */ +#define PPC_FEATURE_SMT 0x00004000 #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 #define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */ -#define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */ -#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal FP Unit */ -#define PPC_FEATURE_POWER6_EXT 0x00000200 /* P6 + mffgpr/mftgpr */ #define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC) #ifdef __ASSEMBLER__ diff --git a/sysdeps/s390/libc-tls.c b/sysdeps/s390/libc-tls.c index 766d565a9c..f177f436e9 100644 --- a/sysdeps/s390/libc-tls.c +++ b/sysdeps/s390/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. S390 version. - Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 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 @@ -20,9 +20,11 @@ #include <stdlib.h> #include <csu/libc-tls.c> +#if USE_TLS + /* On s390, the literal pool entry that refers to __tls_get_offset is not removed, even if all branches that use the literal pool - entry gets removed by TLS optimizations. To get binaries + entry gets removed by TLS optimizations. To get binaries statically linked __tls_get_offset is defined here but aborts if it is used. */ @@ -31,3 +33,5 @@ __tls_get_offset (size_t m, size_t offset) { abort (); } + +#endif diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 64bf3423b6..8bbf858fbf 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. S390 Version. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Carl Pederson & Martin Schwidefsky. This file is part of the GNU C Library. @@ -209,11 +209,17 @@ _dl_start_user:\n\ define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#define elf_machine_type_class(type) \ +#ifdef USE_TLS +# define elf_machine_type_class(type) \ ((((type) == R_390_JMP_SLOT || (type) == R_390_TLS_DTPMOD \ || (type) == R_390_TLS_DTPOFF || (type) == R_390_TLS_TPOFF) \ * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY)) +#else +# define elf_machine_type_class(type) \ + ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY)) +#endif /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT @@ -309,7 +315,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = value + reloc->r_addend; break; -#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \ && !defined RESOLVE_CONFLICT_FIND_MAP case R_390_TLS_DTPMOD: # ifdef RTLD_BOOTSTRAP diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index fa893befdf..5026a2edad 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. 64 bit S/390 Version. - Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -192,11 +192,17 @@ _dl_start_user:\n\ define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#define elf_machine_type_class(type) \ +#ifdef USE_TLS +# define elf_machine_type_class(type) \ ((((type) == R_390_JMP_SLOT || (type) == R_390_TLS_DTPMOD \ || (type) == R_390_TLS_DTPOFF || (type) == R_390_TLS_TPOFF) \ * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY)) +#else +# define elf_machine_type_class(type) \ + ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY)) +#endif /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT @@ -288,7 +294,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, *reloc_addr = value + reloc->r_addend; break; -#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \ && !defined RESOLVE_CONFLICT_FIND_MAP case R_390_TLS_DTPMOD: # ifdef RTLD_BOOTSTRAP diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 78f70e3880..e73c6d79c3 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SH version. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -208,7 +208,7 @@ __fpscr_values:\n\ define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_SH_JMP_SLOT || (type) == R_SH_TLS_DTPMOD32 \ || (type) == R_SH_TLS_DTPOFF32 || (type) == R_SH_TLS_TPOFF32) \ @@ -354,7 +354,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, /* These addresses are always aligned. */ *reloc_addr = value; break; -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) /* XXX Remove TLS relocations which are not needed. */ case R_SH_TLS_DTPMOD32: # ifdef RTLD_BOOTSTRAP diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 19aac6a7fe..02dabaabb4 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -188,7 +188,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) PLT entries should not be allowed to define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_SPARC_JMP_SLOT \ || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \ @@ -459,7 +459,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, so we can optimize the first instruction of .plt out. */ sparc_fixup_plt (reloc, reloc_addr, value, 0); break; -#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \ && !defined RESOLVE_CONFLICT_FIND_MAP case R_SPARC_TLS_DTPMOD32: /* Get the information from the link map returned by the diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 3eee672912..314a784dbc 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -240,7 +240,7 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, PLT entries should not be allowed to define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_SPARC_JMP_SLOT \ || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \ @@ -589,7 +589,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, sparc64_fixup_plt (map, reloc, reloc_addr, value, reloc->r_addend, 0); #endif break; -#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \ +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \ && !defined RESOLVE_CONFLICT_FIND_MAP case R_SPARC_TLS_DTPMOD64: /* Get the information from the link map returned by the diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 137b44c2b8..7c015b1d62 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -126,9 +126,6 @@ libc { GLIBC_2.5 { splice; sync_file_range; tee; vmsplice; } - GLIBC_2.6 { - epoll_pwait; - } GLIBC_PRIVATE { # functions used in other libraries __syscall_rt_sigqueueinfo; diff --git a/sysdeps/unix/sysv/linux/bits/statvfs.h b/sysdeps/unix/sysv/linux/bits/statvfs.h index 84717c3d96..cca0871ac0 100644 --- a/sysdeps/unix/sysv/linux/bits/statvfs.h +++ b/sysdeps/unix/sysv/linux/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2001,2002,2006 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2002 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 @@ -101,9 +101,7 @@ enum # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME - ST_NODIRATIME = 2048, /* Do not update directory access times. */ + ST_NODIRATIME = 2048 /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME - ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ -# define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S index f73a4b5195..54524ec120 100644 --- a/sysdeps/unix/sysv/linux/i386/clone.S +++ b/sysdeps/unix/sysv/linux/i386/clone.S @@ -120,9 +120,6 @@ L(pseudo_end): ret L(thread_start): - cfi_startproc; - /* Clearing frame pointer is insufficient, use CFI. */ - cfi_undefined (eip); /* Note: %esi is zero. */ movl %esi,%ebp /* terminate the stack frame */ #ifdef RESET_PID @@ -155,7 +152,6 @@ L(nomoregetpid): jmp L(haspid) .previous #endif - cfi_endproc; cfi_startproc PSEUDO_END (BP_SYM (__clone)) diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c index f69baf943b..b7a0a4efd4 100644 --- a/sysdeps/unix/sysv/linux/i386/getgroups.c +++ b/sysdeps/unix/sysv/linux/i386/getgroups.c @@ -52,6 +52,8 @@ __getgroups (int n, gid_t *groups) } else { + int i, ngids; + __kernel_gid_t kernel_groups[n = MIN (n, __sysconf (_SC_NGROUPS_MAX))]; # ifdef __NR_getgroups32 if (__libc_missing_32bit_uids <= 0) { @@ -67,9 +69,6 @@ __getgroups (int n, gid_t *groups) } # endif /* __NR_getgroups32 */ - int i, ngids; - __kernel_gid_t kernel_groups[n = MIN (n, __sysconf (_SC_NGROUPS_MAX))]; - ngids = INLINE_SYSCALL (getgroups, 2, n, CHECK_N (kernel_groups, n)); if (n != 0 && ngids > 0) for (i = 0; i < ngids; i++) diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index b5c1b98573..299574dac4 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/i386. - Copyright (C) 1991,1995-2000,2002-2005,2006 Free Software Foundation, Inc. + Copyright (C) 1991,1995-2000,2002-2004,2005 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 @@ -46,10 +46,18 @@ int __libc_missing_rt_sigs; /* Using the hidden attribute here does not change the code but it helps to avoid warnings. */ -#ifdef __NR_rt_sigaction +#if defined HAVE_HIDDEN && defined HAVE_VISIBILITY_ATTRIBUTE \ + && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE +# ifdef __NR_rt_sigaction extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; -#endif +# endif extern void restore (void) asm ("__restore") attribute_hidden; +#else +# ifdef __NR_rt_sigaction +static void restore_rt (void) asm ("__restore_rt"); +# endif +static void restore (void) asm ("__restore"); +#endif /* If ACT is not NULL, change the action for SIG to *ACT. diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c index 2ffbd5227b..25b9ba734e 100644 --- a/sysdeps/unix/sysv/linux/i386/sysconf.c +++ b/sysdeps/unix/sysv/linux/i386/sysconf.c @@ -97,7 +97,7 @@ static const struct intel_02_cache_info { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 }, { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 }, { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 }, - { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 }, + { 0x49, _SC_LEVEL3_CACHE_SIZE, 4194304, 16, 64 }, { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 }, { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 }, { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 }, @@ -140,7 +140,6 @@ intel_02_known_compare (const void *p1, const void *p2) static long int -__attribute__ ((noinline)) intel_check_word (int name, unsigned int value, bool *has_level_2, bool *no_level_2_or_3) { @@ -167,33 +166,6 @@ intel_check_word (int name, unsigned int value, bool *has_level_2, } else { - if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE) - { - /* Intel reused this value. For family 15, model 6 it - specifies the 3rd level cache. Otherwise the 2nd - level cache. */ - unsigned int eax; - unsigned int ebx; - unsigned int ecx; - unsigned int edx; - asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" - : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx) - : "0" (1)); - - unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf); - unsigned int model = ((((eax >>16) & 0xf) << 4) - + ((eax >> 4) & 0xf)); - if (family == 15 && model == 6) - { - /* The level 3 cache is encoded for this model like - the level 2 cache is for other models. Pretend - the caller asked for the level 2 cache. */ - name = (_SC_LEVEL2_CACHE_SIZE - + (name - _SC_LEVEL3_CACHE_SIZE)); - folded_name = _SC_LEVEL3_CACHE_SIZE; - } - } - struct intel_02_cache_info *found; struct intel_02_cache_info search; diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 5286676fc1..90423d8434 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -297,7 +297,7 @@ cfi_restore (edi); L(POPDI1): #define PUSHARGS_6 _PUSHARGS_6 -#define DOARGS_6 _DOARGS_6 (40) +#define DOARGS_6 _DOARGS_6 (36) #define POPARGS_6 _POPARGS_6 #define _PUSHARGS_6 pushl %ebp; cfi_adjust_cfa_offset (4); \ cfi_rel_offset (ebp, 0); L(PUSHBP1): _PUSHARGS_5 diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c index 28c1cb691f..73317ecafd 100644 --- a/sysdeps/unix/sysv/linux/internal_statvfs.c +++ b/sysdeps/unix/sysv/linux/internal_statvfs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -156,8 +156,6 @@ __statvfs_getflags (const char *name, int fstype, struct stat64 *st) result |= ST_NOATIME; else if (strcmp (opt, "nodiratime") == 0) result |= ST_NODIRATIME; - else if (strcmp (opt, "relatime") == 0) - result |= ST_RELATIME; /* We can stop looking for more entries. */ success = true; diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S index 9451f9eb36..208a375ef3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S @@ -26,7 +26,9 @@ ENTRY(__makecontext) /* Set up the first 7 args to the function in its registers */ - lwz r11,_UC_REGS_PTR(r3) + addi r11,r3,_UC_REG_SPACE+12 + clrrwi r11,r11,4 + stw r11,_UC_REGS_PTR(r3) stw r6,_UC_GREGS+(PT_R3*4)(r11) stw r7,_UC_GREGS+(PT_R4*4)(r11) stw r8,_UC_GREGS+(PT_R5*4)(r11) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S index 1f2e250057..7e9213c2d6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S @@ -1,5 +1,5 @@ /* Jump to a new context. - Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 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 @@ -20,7 +20,6 @@ #include <sysdep.h> #include <rtld-global-offsets.h> #include <shlib-compat.h> -#include <kernel-features.h> #define __ASSEMBLY__ #include <asm/ptrace.h> diff --git a/sysdeps/unix/sysv/linux/sh/bits/shm.h b/sysdeps/unix/sysv/linux/sh/bits/shm.h deleted file mode 100644 index 189179394b..0000000000 --- a/sysdeps/unix/sysv/linux/sh/bits/shm.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 1995,1996,1997,2000,2002,2004,2006 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_SHM_H -# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." -#endif - -#include <bits/types.h> - -/* Permission flag for shmget. */ -#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ -#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ - -/* Flags for `shmat'. */ -#define SHM_RDONLY 010000 /* attach read-only else read-write */ -#define SHM_RND 020000 /* round attach address to SHMLBA */ -#define SHM_REMAP 040000 /* take-over region on attach */ - -/* Commands for `shmctl'. */ -#define SHM_LOCK 11 /* lock segment (root only) */ -#define SHM_UNLOCK 12 /* unlock segment (root only) */ - -__BEGIN_DECLS - -/* Segment low boundary address multiple. */ -#define SHMLBA 0x4000 - -/* Type to count number of attaches. */ -typedef unsigned long int shmatt_t; - -/* Data structure describing a set of semaphores. */ -struct shmid_ds - { - struct ipc_perm shm_perm; /* operation permission struct */ - size_t shm_segsz; /* size of segment in bytes */ - __time_t shm_atime; /* time of last shmat() */ - unsigned long int __unused1; - __time_t shm_dtime; /* time of last shmdt() */ - unsigned long int __unused2; - __time_t shm_ctime; /* time of last change by shmctl() */ - unsigned long int __unused3; - __pid_t shm_cpid; /* pid of creator */ - __pid_t shm_lpid; /* pid of last shmop */ - shmatt_t shm_nattch; /* number of current attaches */ - unsigned long int __unused4; - unsigned long int __unused5; - }; - -#ifdef __USE_MISC - -/* ipcs ctl commands */ -# define SHM_STAT 13 -# define SHM_INFO 14 - -/* shm_mode upper byte flags */ -# define SHM_DEST 01000 /* segment will be destroyed on last detach */ -# define SHM_LOCKED 02000 /* segment will not be swapped */ -# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ -# define SHM_NORESERVE 010000 /* don't check for reservations */ - -struct shminfo - { - unsigned long int shmmax; - unsigned long int shmmin; - unsigned long int shmmni; - unsigned long int shmseg; - unsigned long int shmall; - unsigned long int __unused1; - unsigned long int __unused2; - unsigned long int __unused3; - unsigned long int __unused4; - }; - -struct shm_info - { - int used_ids; - unsigned long int shm_tot; /* total allocated shm */ - unsigned long int shm_rss; /* total resident shm */ - unsigned long int shm_swp; /* total swapped shm */ - unsigned long int swap_attempts; - unsigned long int swap_successes; - }; - -#endif /* __USE_MISC */ - -__END_DECLS diff --git a/sysdeps/unix/sysv/linux/sh/sys/io.h b/sysdeps/unix/sysv/linux/sh/sys/io.h new file mode 100644 index 0000000000..6fdc44ff89 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sh/sys/io.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1996, 1998, 1999, 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IO_H + +#define _SYS_IO_H 1 +#include <features.h> + +__BEGIN_DECLS + +/* If TURN_ON is TRUE, request for permission to do direct i/o on the + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O + permission off for that range. This call requires root privileges. */ +extern int ioperm (unsigned long int __from, unsigned long int __num, + int __turn_on) __THROW; + +/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero, + permission to access any I/O port is granted. This call requires + root privileges. */ +extern int iopl (int __level) __THROW; + +/* The functions that actually perform reads and writes. */ +extern unsigned char inb (unsigned long int port) __THROW; +extern unsigned short int inw (unsigned long int port) __THROW; +extern unsigned long int inl (unsigned long int port) __THROW; + +extern void outb (unsigned char value, unsigned long int port) __THROW; +extern void outw (unsigned short value, unsigned long int port) __THROW; +extern void outl (unsigned long value, unsigned long int port) __THROW; + +__END_DECLS + +#endif /* _SYS_IO_H */ diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index d8901f7d53..68f173a04d 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 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,14 +22,6 @@ #include <stdint.h> #include <sys/types.h> -/* Get __sigset_t. */ -#include <bits/sigset.h> - -#ifndef __sigset_t_defined -# define __sigset_t_defined -typedef __sigset_t sigset_t; -#endif - enum EPOLL_EVENTS { @@ -113,16 +105,6 @@ extern int epoll_ctl (int __epfd, int __op, int __fd, extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); - -/* Same as epoll_wait, but the thread's signal mask is temporarily - and atomically replaced with the one provided as parameter. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int epoll_pwait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout, - __const __sigset_t *__ss); - __END_DECLS #endif /* sys/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 5776673733..fca29b26ff 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -10,7 +10,6 @@ delete_module EXTRA delete_module 3 delete_module epoll_create EXTRA epoll_create i:i epoll_create epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait -epoll_pwait EXTRA epoll_pwait Ci:ipiipi epoll_pwait fdatasync - fdatasync i:i fdatasync flock - flock i:ii __flock flock fork - fork i: __libc_fork __fork fork diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index 1b79787515..aed0fd8e0a 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c +++ b/sysdeps/unix/sysv/linux/ttyname.c @@ -22,7 +22,6 @@ #include <dirent.h> #include <sys/types.h> #include <sys/stat.h> -#include <termios.h> #include <unistd.h> #include <string.h> #include <stdlib.h> @@ -119,12 +118,12 @@ ttyname (int fd) int dostat = 0; char *name; int save = errno; - struct termios term; - /* isatty check, tcgetattr is used because it sets the correct - errno (EBADF resp. ENOTTY) on error. */ - if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0)) - return NULL; + if (__builtin_expect (!__isatty (fd), 0)) + { + __set_errno (ENOTTY); + return NULL; + } /* We try using the /proc filesystem. */ *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0'; diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index cef8624dc6..bd415f167b 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c +++ b/sysdeps/unix/sysv/linux/ttyname_r.c @@ -22,7 +22,6 @@ #include <dirent.h> #include <sys/types.h> #include <sys/stat.h> -#include <termios.h> #include <unistd.h> #include <string.h> #include <stdlib.h> @@ -116,11 +115,11 @@ __ttyname_r (int fd, char *buf, size_t buflen) return ERANGE; } - /* isatty check, tcgetattr is used because it sets the correct - errno (EBADF resp. ENOTTY) on error. */ - struct termios term; - if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0)) - return errno; + if (__builtin_expect (!__isatty (fd), 0)) + { + __set_errno (ENOTTY); + return ENOTTY; + } /* We try using the /proc filesystem. */ *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0'; diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile index bdad5063df..0f20367236 100644 --- a/sysdeps/unix/sysv/linux/x86_64/Makefile +++ b/sysdeps/unix/sysv/linux/x86_64/Makefile @@ -10,6 +10,6 @@ ifeq ($(subdir),stdlib) sysdep_routines += __start_context endif -ifeq ($(subdir),csu) +ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S index db42f209c9..8a12b09035 100644 --- a/sysdeps/unix/sysv/linux/x86_64/clone.S +++ b/sysdeps/unix/sysv/linux/x86_64/clone.S @@ -89,9 +89,6 @@ L(pseudo_end): ret L(thread_start): - cfi_startproc; - /* Clearing frame pointer is insufficient, use CFI. */ - cfi_undefined (rip); /* Clear the frame pointer. The ABI suggests this be done, to mark the outermost frame obviously. */ xorl %ebp, %ebp @@ -116,7 +113,6 @@ L(thread_start): /* Call exit with return value from function call. */ movq %rax, %rdi call HIDDEN_JUMPTARGET (_exit) - cfi_endproc; cfi_startproc; PSEUDO_END (BP_SYM (__clone)) diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c index ab10123858..d6f4558cef 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c +++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/x86-64. - Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2005 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 @@ -33,14 +33,17 @@ translate it here. */ #include <kernel_sigaction.h> -#include "ucontext_i.h" - /* We do not globally define the SA_RESTORER flag so do it here. */ #define SA_RESTORER 0x04000000 /* Using the hidden attribute here does not change the code but it helps to avoid warnings. */ +#if defined HAVE_HIDDEN && defined HAVE_VISIBILITY_ATTRIBUTE \ + && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; +#else +static void restore_rt (void) asm ("__restore_rt"); +#endif /* If ACT is not NULL, change the action for SIG to *ACT. @@ -92,95 +95,18 @@ weak_alias (__libc_sigaction, sigaction) signal handlers work right. Important are both the names (__restore_rt) and the exact instruction sequence. If you ever feel the need to make any changes, please notify the - appropriate GDB maintainer. - - The unwind information starts a byte before __restore_rt, so that - it is found when unwinding, to get an address the unwinder assumes - will be in the middle of a call instruction. See the Linux kernel - (the i386 vsyscall, in particular) for an explanation of the complex - unwind information used here in order to get the traditional CFA. - We do not restore cs - it's only stored as two bytes here so that's - a bit tricky. We don't use the gas cfi directives, so that we can - reliably add .cfi_signal_frame. */ - -#define do_cfa_expr \ - " .byte 0x0f\n" /* DW_CFA_def_cfa_expression */ \ - " .uleb128 2f-1f\n" /* length */ \ - "1: .byte 0x77\n" /* DW_OP_breg7 */ \ - " .sleb128 " CFI_STRINGIFY (oRSP) "\n" \ - " .byte 0x06\n" /* DW_OP_deref */ \ - "2:" - -#define do_expr(regno, offset) \ - " .byte 0x10\n" /* DW_CFA_expression */ \ - " .uleb128 " CFI_STRINGIFY (regno) "\n" \ - " .uleb128 2f-1f\n" /* length */ \ - "1: .byte 0x77\n" /* DW_OP_breg7 */ \ - " .sleb128 " CFI_STRINGIFY (offset) "\n" \ - "2:" + appropriate GDB maintainer. */ #define RESTORE(name, syscall) RESTORE2 (name, syscall) # define RESTORE2(name, syscall) \ -asm \ - ( \ - /* `nop' for debuggers assuming `call' should not disalign the code. */ \ - " nop\n" \ - ".align 16\n" \ - ".LSTART_" #name ":\n" \ - " .type __" #name ",@function\n" \ - "__" #name ":\n" \ - " movq $" #syscall ", %rax\n" \ - " syscall\n" \ - ".LEND_" #name ":\n" \ - ".section .eh_frame,\"a\",@progbits\n" \ - ".LSTARTFRAME_" #name ":\n" \ - " .long .LENDCIE_" #name "-.LSTARTCIE_" #name "\n" \ - ".LSTARTCIE_" #name ":\n" \ - " .long 0\n" /* CIE ID */ \ - " .byte 1\n" /* Version number */ \ - " .string \"zRS\"\n" /* NUL-terminated augmentation string */ \ - " .uleb128 1\n" /* Code alignment factor */ \ - " .sleb128 -8\n" /* Data alignment factor */ \ - " .uleb128 16\n" /* Return address register column (rip) */ \ - /* Augmentation value length */ \ - " .uleb128 .LENDAUGMNT_" #name "-.LSTARTAUGMNT_" #name "\n" \ - ".LSTARTAUGMNT_" #name ":\n" \ - " .byte 0x1b\n" /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ \ - ".LENDAUGMNT_" #name ":\n" \ - " .align 8\n" \ - ".LENDCIE_" #name ":\n" \ - " .long .LENDFDE_" #name "-.LSTARTFDE_" #name "\n" /* FDE len */ \ - ".LSTARTFDE_" #name ":\n" \ - " .long .LSTARTFDE_" #name "-.LSTARTFRAME_" #name "\n" /* CIE */ \ - /* `LSTART_' is subtracted 1 as debuggers assume a `call' here. */ \ - " .long (.LSTART_" #name "-1)-.\n" /* PC-relative start addr. */ \ - " .long .LEND_" #name "-(.LSTART_" #name "-1)\n" \ - " .uleb128 0\n" /* FDE augmentation length */ \ - do_cfa_expr \ - do_expr (8 /* r8 */, oR8) \ - do_expr (9 /* r9 */, oR9) \ - do_expr (10 /* r10 */, oR10) \ - do_expr (11 /* r11 */, oR11) \ - do_expr (12 /* r12 */, oR12) \ - do_expr (13 /* r13 */, oR13) \ - do_expr (14 /* r14 */, oR14) \ - do_expr (15 /* r15 */, oR15) \ - do_expr (5 /* rdi */, oRDI) \ - do_expr (4 /* rsi */, oRSI) \ - do_expr (6 /* rbp */, oRBP) \ - do_expr (3 /* rbx */, oRBX) \ - do_expr (1 /* rdx */, oRDX) \ - do_expr (0 /* rax */, oRAX) \ - do_expr (2 /* rcx */, oRCX) \ - do_expr (7 /* rsp */, oRSP) \ - do_expr (16 /* rip */, oRIP) \ - /* libgcc-4.1.1 has only `DWARF_FRAME_REGISTERS == 17'. */ \ - /* do_expr (49 |* rflags *|, oEFL) */ \ - /* `cs'/`ds'/`fs' are unaligned and a different size. */ \ - /* gas: Error: register save offset not a multiple of 8 */ \ - " .align 8\n" \ - ".LENDFDE_" #name ":\n" \ - " .previous\n" \ +asm \ + ( \ + ".align 16\n" \ + CFI_STARTPROC "\n" \ + "__" #name ":\n" \ + " movq $" #syscall ", %rax\n" \ + " syscall\n" \ + CFI_ENDPROC "\n" \ ); /* The return code for realtime-signals. */ RESTORE (restore_rt, __NR_rt_sigreturn) diff --git a/sysdeps/unix/sysv/linux/x86_64/sysconf.c b/sysdeps/unix/sysv/linux/x86_64/sysconf.c index 5a898b7857..726c5e33ac 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysconf.c +++ b/sysdeps/unix/sysv/linux/x86_64/sysconf.c @@ -58,7 +58,7 @@ static const struct intel_02_cache_info { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 }, { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 }, { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 }, - { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 }, + { 0x49, _SC_LEVEL3_CACHE_SIZE, 4194304, 16, 64 }, { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 }, { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 }, { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 }, @@ -101,7 +101,6 @@ intel_02_known_compare (const void *p1, const void *p2) static long int -__attribute__ ((noinline)) intel_check_word (int name, unsigned int value, bool *has_level_2, bool *no_level_2_or_3) { @@ -128,33 +127,6 @@ intel_check_word (int name, unsigned int value, bool *has_level_2, } else { - if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE) - { - /* Intel reused this value. For family 15, model 6 it - specifies the 3rd level cache. Otherwise the 2nd - level cache. */ - unsigned int eax; - unsigned int ebx; - unsigned int ecx; - unsigned int edx; - asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" - : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx) - : "0" (1)); - - unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf); - unsigned int model = ((((eax >>16) & 0xf) << 4) - + ((eax >> 4) & 0xf)); - if (family == 15 && model == 6) - { - /* The level 3 cache is encoded for this model like - the level 2 cache is for other models. Pretend - the caller asked for the level 2 cache. */ - name = (_SC_LEVEL2_CACHE_SIZE - + (name - _SC_LEVEL3_CACHE_SIZE)); - folded_name = _SC_LEVEL3_CACHE_SIZE; - } - } - struct intel_02_cache_info *found; struct intel_02_cache_info search; diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym index af3e0e544b..b3cfe9aa4c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym @@ -18,8 +18,6 @@ oRSP mreg (RSP) oRBX mreg (RBX) oR8 mreg (R8) oR9 mreg (R9) -oR10 mreg (R10) -oR11 mreg (R11) oR12 mreg (R12) oR13 mreg (R13) oR14 mreg (R14) @@ -30,7 +28,6 @@ oRDX mreg (RDX) oRAX mreg (RAX) oRCX mreg (RCX) oRIP mreg (RIP) -oEFL mreg (EFL) oFPREGS mcontext (fpregs) oSIGMASK ucontext (uc_sigmask) oFPREGSMEM ucontext (__fpregs_mem) diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h index 65d6b02008..133a68d192 100644 --- a/sysdeps/x86_64/bits/atomic.h +++ b/sysdeps/x86_64/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -18,7 +18,6 @@ 02111-1307 USA. */ #include <stdint.h> -#include <tls.h> /* For tcbhead_t. */ typedef int8_t atomic8_t; @@ -81,54 +80,8 @@ typedef uintmax_t uatomic_max_t; ({ __typeof (*mem) ret; \ __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "r" ((long int) (newval)), "m" (*mem), \ - "0" ((long int) (oldval))); \ - ret; }) - - -#define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - -#define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - -#define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - ret; }) - -#define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgq %q2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" ((long int) (newval)), "m" (*mem), \ - "0" ((long int)oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "r" ((long) (newval)), "m" (*mem), \ + "0" ((long) (oldval))); \ ret; }) @@ -154,76 +107,49 @@ typedef uintmax_t uatomic_max_t; result; }) -#define __arch_exchange_and_add_body(lock, mem, value) \ +#define atomic_exchange_and_add(mem, value) \ ({ __typeof (*mem) result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (lock "xaddb %b0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "xaddw %w0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "xaddl %0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (value), "m" (*mem)); \ else \ - __asm __volatile (lock "xaddq %q0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddq %q0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" ((long) (value)), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" ((long) (value)), "m" (*mem)); \ result; }) -#define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, mem, value) - -#define __arch_exchange_and_add_cprefix \ - "cmpl $0, %%fs:%P4\n\tje 0f\n\tlock\n0:\t" - -#define catomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, mem, value) - - -#define __arch_add_body(lock, pfx, mem, value) \ - do { \ - if (__builtin_constant_p (value) && (value) == 1) \ - pfx##_increment (mem); \ - else if (__builtin_constant_p (value) && (value) == -1) \ - pfx##_decrement (mem); \ - else if (sizeof (*mem) == 1) \ - __asm __volatile (lock "addb %b1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "addw %w1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "addl %1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - __asm __volatile (lock "addq %q1, %0" \ - : "=m" (*mem) \ - : "ir" ((long) (value)), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - } while (0) #define atomic_add(mem, value) \ - __arch_add_body (LOCK_PREFIX, atomic, mem, value) - -#define __arch_add_cprefix \ - "cmpl $0, %%fs:%P3\n\tje 0f\n\tlock\n0:\t" - -#define catomic_add(mem, value) \ - __arch_add_body (__arch_add_cprefix, catomic, mem, value) + (void) ({ if (__builtin_constant_p (value) && (value) == 1) \ + atomic_increment (mem); \ + else if (__builtin_constant_p (value) && (value) == 1) \ + atomic_decrement (mem); \ + else if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "addl %1, %0" \ + : "=m" (*mem) \ + : "ir" (value), "m" (*mem)); \ + else \ + __asm __volatile (LOCK_PREFIX "addq %q1, %0" \ + : "=m" (*mem) \ + : "ir" ((long) (value)), "m" (*mem)); \ + }) #define atomic_add_negative(mem, value) \ @@ -268,37 +194,24 @@ typedef uintmax_t uatomic_max_t; __result; }) -#define __arch_increment_body(lock, mem) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "incb %b0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "incw %w0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "incl %0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - __asm __volatile (lock "incq %q0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - } while (0) - -#define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, mem) - -#define __arch_increment_cprefix \ - "cmpl $0, %%fs:%P2\n\tje 0f\n\tlock\n0:\t" - -#define catomic_increment(mem) \ - __arch_increment_body (__arch_increment_cprefix, mem) +#define atomic_increment(mem) \ + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "incb %b0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "incw %w0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "incl %0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else \ + __asm __volatile (LOCK_PREFIX "incq %q0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + }) #define atomic_increment_and_test(mem) \ @@ -322,37 +235,24 @@ typedef uintmax_t uatomic_max_t; __result; }) -#define __arch_decrement_body(lock, mem) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "decb %b0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "decw %w0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "decl %0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - __asm __volatile (lock "decq %q0" \ - : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - } while (0) - -#define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, mem) - -#define __arch_decrement_cprefix \ - "cmpl $0, %%fs:%P2\n\tje 0f\n\tlock\n0:\t" - -#define catomic_decrement(mem) \ - __arch_decrement_body (__arch_decrement_cprefix, mem) +#define atomic_decrement(mem) \ + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "decb %b0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "decw %w0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "decl %0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + else \ + __asm __volatile (LOCK_PREFIX "decq %q0" \ + : "=m" (*mem) \ + : "m" (*mem)); \ + }) #define atomic_decrement_and_test(mem) \ @@ -377,28 +277,27 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_set(mem, bit) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "orl %2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (__builtin_constant_p (bit) && (bit) < 32) \ - __asm __volatile (LOCK_PREFIX "orq %2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "i" (1L << (bit))); \ - else \ - __asm __volatile (LOCK_PREFIX "orq %q2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "r" (1UL << (bit))); \ - } while (0) + (void) ({ if (sizeof (*mem) == 1) \ + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1L << (bit))); \ + else if (sizeof (*mem) == 2) \ + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1L << (bit))); \ + else if (sizeof (*mem) == 4) \ + __asm __volatile (LOCK_PREFIX "orl %2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "ir" (1L << (bit))); \ + else if (__builtin_constant_p (bit) && (bit) < 32) \ + __asm __volatile (LOCK_PREFIX "orq %2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "i" (1L << (bit))); \ + else \ + __asm __volatile (LOCK_PREFIX "orq %q2, %0" \ + : "=m" (*mem) \ + : "m" (*mem), "r" (1UL << (bit))); \ + }) #define atomic_bit_test_set(mem, bit) \ @@ -423,56 +322,3 @@ typedef uintmax_t uatomic_max_t; #define atomic_delay() asm ("rep; nop") - - -#define atomic_and(mem, mask) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "andb %1, %b0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "andw %1, %w0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "andl %1, %0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "andq %1, %q0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem)); \ - } while (0) - - -#define __arch_or_body(lock, mem, mask) \ - do { \ - if (sizeof (*mem) == 1) \ - __asm __volatile (lock "orb %1, %b0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (lock "orw %1, %w0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (lock "orl %1, %0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - else \ - __asm __volatile (lock "orq %1, %q0" \ - : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ - } while (0) - -#define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask) - -#define __arch_or_cprefix \ - "cmpl $0, %%fs:%P3\n\tje 0f\n\tlock\n0:\t" - -#define catomic_or(mem, mask) __arch_or_body (__arch_or_cprefix, mem, mask) diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 31a7013d50..73e271775a 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version. - Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -190,7 +190,7 @@ _dl_start_user:\n\ define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one of the main executable's symbols, as for a COPY reloc. */ -#if !defined RTLD_BOOTSTRAP || USE___THREAD +#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_X86_64_JUMP_SLOT \ || (type) == R_X86_64_DTPMOD64 \ @@ -300,7 +300,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, *reloc_addr = value + reloc->r_addend; break; -#ifndef RESOLVE_CONFLICT_FIND_MAP +#if defined USE_TLS && !defined RESOLVE_CONFLICT_FIND_MAP case R_X86_64_DTPMOD64: # ifdef RTLD_BOOTSTRAP /* During startup the dynamic linker is always the module @@ -339,7 +339,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, - sym_map->l_tls_offset); } break; -#endif +#endif /* use TLS */ #ifndef RTLD_BOOTSTRAP case R_X86_64_64: diff --git a/sysdeps/x86_64/fpu/s_copysign.S b/sysdeps/x86_64/fpu/s_copysign.S index f3d9b0cbb4..f1ebcf8bf1 100644 --- a/sysdeps/x86_64/fpu/s_copysign.S +++ b/sysdeps/x86_64/fpu/s_copysign.S @@ -1,5 +1,5 @@ /* copy sign, double version. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2002. @@ -31,8 +31,6 @@ signmask: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 .byte 0, 0, 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(signmask) - ASM_TYPE_DIRECTIVE(othermask,@object) othermask: .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f .byte 0, 0, 0, 0, 0, 0, 0, 0 @@ -44,7 +42,6 @@ othermask: #define MO(op) op #endif - .text ENTRY(__copysign) andpd MO(othermask),%xmm0 andpd MO(signmask),%xmm1 diff --git a/sysdeps/x86_64/fpu/s_copysignf.S b/sysdeps/x86_64/fpu/s_copysignf.S index 0fbe1d4c96..f5dc5f78ad 100644 --- a/sysdeps/x86_64/fpu/s_copysignf.S +++ b/sysdeps/x86_64/fpu/s_copysignf.S @@ -1,5 +1,5 @@ /* copy sign, double version. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2002. @@ -38,7 +38,6 @@ mask: #define MO(op) op #endif - .text ENTRY(__copysignf) movss MO(mask),%xmm3 andps %xmm3,%xmm0 diff --git a/sysdeps/x86_64/soft-fp/sfp-machine.h b/sysdeps/x86_64/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..77df02380c --- /dev/null +++ b/sysdeps/x86_64/soft-fp/sfp-machine.h @@ -0,0 +1,51 @@ +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define __FP_CLZ(r, x) \ + do { \ + __asm__("bsrq %1,%0" : "=r"(r) : "g"(x) : "cc"); \ + r ^= 63; \ + } while (0) + +#define _FP_NANFRAC_S _FP_QNANBIT_S +#define _FP_NANFRAC_D _FP_QNANBIT_D, 0 +#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 +#define _FP_NANSIGN_Q 1 + +#define _FP_KEEPNANFRACP 1 +/* Here is something Intel misdesigned: the specs don't define + the case where we have two NaNs with same mantissas, but + different sign. Different operations pick up different NaNs. + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if (_FP_FRAC_GT_##wc(X, Y) \ + || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +#define FP_EX_INVALID (1 << 0) +#define FP_EX_DENORM (1 << 1) +#define FP_EX_DIVZERO (1 << 2) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 4) +#define FP_EX_INEXACT (1 << 5) + +#define FP_RND_NEAREST 0 +#define FP_RND_ZERO 3 +#define FP_RND_PINF 2 +#define FP_RND_MINF 1 + |