summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-08-25 15:16:23 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-08-25 15:16:23 +0000
commit36ee53dd0120e48bab5f6793e149d3b4df6fb3ee (patch)
tree1fe31a4c64b9d4225e96674a5f5b9dc2fab6fba4
parent5aa1a5ac2772b35cf67fa77bdb37a0423876f820 (diff)
Merge changes between r8789 and r8871 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8872 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog90
-rw-r--r--libc/locale/locale.h2
-rw-r--r--libc/math/math.h11
-rw-r--r--libc/math/math_private.h19
-rw-r--r--libc/math/s_fdim.c12
-rw-r--r--libc/math/s_fdimf.c12
-rw-r--r--libc/math/s_fdiml.c16
-rw-r--r--libc/nptl/ChangeLog49
-rw-r--r--libc/nptl/pthread_create.c13
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h10
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S4
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S5
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S4
-rw-r--r--libc/nptl_db/ChangeLog7
-rw-r--r--libc/nptl_db/td_ta_map_lwp2thr.c14
-rw-r--r--libc/posix/Makefile2
-rw-r--r--libc/posix/bug-regex29.c22
-rw-r--r--libc/posix/regcomp.c2
-rw-r--r--libc/posix/unistd.h40
-rw-r--r--libc/scripts/gen-as-const.awk3
-rw-r--r--libc/stdio-common/printf_fp.c9
-rw-r--r--libc/stdio-common/printf_fphex.c4
-rw-r--r--libc/stdio-common/tstdiomisc.c130
-rw-r--r--libc/stdlib/longlong.h7
-rw-r--r--libc/sysdeps/generic/elf/backtracesyms.c71
-rw-r--r--libc/sysdeps/generic/elf/backtracesymsfd.c58
-rw-r--r--libc/sysdeps/i386/fpu/bits/mathinline.h6
-rw-r--r--libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c67
-rw-r--r--libc/sysdeps/powerpc/powerpc32/__longjmp-common.S15
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S15
-rw-r--r--libc/sysdeps/unix/Makefile18
-rw-r--r--libc/sysdeps/unix/make-syscalls.sh33
-rw-r--r--libc/sysdeps/unix/syscall-template.S88
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S (renamed from libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S)31
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S (renamed from libc/sysdeps/powerpc/powerpc64/____longjmp_chk.S)32
-rw-r--r--libc/sysdeps/x86_64/fpu/bits/mathinline.h12
-rw-r--r--libc/sysdeps/x86_64/fpu/math_private.h37
-rw-r--r--libc/test-skeleton.c15
39 files changed, 821 insertions, 170 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 12fa4cda1..b2d98e4ee 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,89 @@
+2009-08-24 Ulrich Drepper <drepper@redhat.com>
+
+ * math/math_private.h (ieee_double_shape_type): Add uint64_t word to
+ union.
+ (EXTRACT_WORDS64, INSERT_WORDS64): Define.
+ * sysdeps/x86_64/fpu/math_private.h (EXTRACT_WORDS64, INSERT_WORDS64):
+ Redefine.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: New file.
+
+ * sysdeps/x86_64/fpu/math_private.h: Add specialized GET_FLOAT_WORD
+ and SET_FLOAT_WORD definitions.
+
+2009-08-24 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/syscall-template.S: New file.
+ * sysdeps/unix/make-syscalls.sh: Generate rules to use it.
+ * sysdeps/unix/Makefile (omit-deps): Do not omit syscall stubs' deps.
+ (compile-syscall): Pass mkdep and -g options as normal.
+ (s-proto.d, s-proto-cancel.d): Don't "-include" these.
+ (common-generated): Don't add them here.
+
+2009-08-24 Ulrich Drepper <drepper@redhat.com>
+
+ * math/s_fdim.c: In case of overflows set errno.
+ * math/s_fdimf.c: Likewise.
+ * math/s_fdiml.c: Likewise.
+
+ * math/math.h: Define math_errhandling of __FAST_MATH__ is not defined.
+ * sysdeps/i386/fpu/bits/mathinline.h: Undefine math_errhandling if we
+ are using the inline optimizations.
+
+ * sysdeps/x86_64/fpu/bits/mathinline.h (__signbit): Optimize.
+ (__signbitf): Likewise.
+
+2009-08-23 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/regcomp.c (parse_dup_op): Verify the expression is correctly
+ terminated.
+ * posix/Makefile (tests): Add bug-regex29.
+ * posix/bug-regex29.c: New file.
+
+ * posix/unistd.h: Define _POSIX_VERSION and _POSIX2_* correctly if
+ older POSIX versions are selected.
+
+ * stdio-common/printf_fp.c: ISO C expects to print the sign of NaN
+ as well.
+ * stdio-common/printf_fphex.c: Likewise.
+ * stdio-common/tstdiomisc.c: Add more tests.
+
+ * locale/locale.h: Include xlocale.h and the thread-local locale
+ declarations for XPG7, not XPG6.
+
+2009-08-21 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/powerpc/powerpc32/____longjmp_chk.S: Removed.
+ * sysdeps/powerpc/powerpc64/____longjmp_chk.S: Removed.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S: New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S: New file.
+ * sysdeps/powerpc/powerpc32/__longjmp-common.S: Move CHECK_SP earlier.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Likewise.
+
+2009-08-20 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/generic/elf/backtracesyms.c (__backtrace_symbols):
+ Use l_addr instead of l_map_start (dli_fbase).
+ Print "FILE([+-]OFFSET) [ADDRESS]" with the file-relative
+ address when there is no proximate symbol.
+ * sysdeps/generic/elf/backtracesymsfd.c (__backtrace_symbols_fd):
+ Likewise.
+
+2009-08-16 Ulrich Drepper <drepper@redhat.com>
+
+ * scripts/gen-as-const.awk: Fix test for 64-bit platform.
+
+2009-08-14 Ulrich Drepper <drepper@redhat.com>
+
+ * test-skeleton.c (signal_handler): Renamed from timeout_handler.
+ Also handle SIGINT. In that case only do the cleanup and then
+ re-raise the signal.
+ (main): Install handler for SIGINT.
+
+2009-08-10 SUGIOKA Toshinobu <sugioka@itonet.co.jp>
+
+ * stdlib/longlong.h [__sh__] (udiv_qrnnd, sub_ddmmss): Add "t" to
+ clobber list.
+
2009-08-01 H.J. Lu <hongjiu.lu@intel.com>
* elf/Makefile (distribute): Add tst-audit6.c tst-auditmod6a.c
@@ -46,7 +132,7 @@
* sysdeps/x86_64/strcmp.S: Add support to compile with
USE_SSSE3. In this case palignr is used.
- * sysdeps/x86_64/multiarch/strcmp.S (strcmp): If SSE4.3 is not
+ * sysdeps/x86_64/multiarch/strcmp.S (strcmp): If SSE4.2 is not
available but SSSE3 is, pick __str{,n}cmp_ssse3.
* sysdeps/x86_64/multiarch/Makefile [subdir=string] (sysdep_routines):
Add strcmp-ssse3 and strncmp-ssse3.
@@ -1791,7 +1877,7 @@
* sysdeps/x86_64/mp_clz_tab.c: New file.
2009-03-17 Ryan S. Arnold <rsa@us.ibm.com>
- Ulrich Drepper <drepper@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/fallocate.c: Handle old kernel headers.
* sysdeps/unix/sysv/linux/fallocate64.c: Likewise.
diff --git a/libc/locale/locale.h b/libc/locale/locale.h
index b24ae245f..2aa19e76a 100644
--- a/libc/locale/locale.h
+++ b/libc/locale/locale.h
@@ -130,7 +130,7 @@ extern struct lconv *localeconv (void) __THROW;
__END_NAMESPACE_STD
-#ifdef __USE_XOPEN2K
+#ifdef __USE_XOPEN2K8
/* The concept of one static locale per category is not very well
thought out. Many applications will need to process its data using
information from several different locales. Another application is
diff --git a/libc/math/math.h b/libc/math/math.h
index c50b2e7b0..4e65678b8 100644
--- a/libc/math/math.h
+++ b/libc/math/math.h
@@ -1,5 +1,5 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -101,7 +101,7 @@ __BEGIN_DECLS
&& (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
# ifdef __LDBL_COMPAT
-# ifdef __USE_ISOC99
+# ifdef __USE_ISOC99
extern float __nldbl_nexttowardf (float __x, long double __y)
__THROW __attribute__ ((__const__));
# ifdef __REDIRECT_NTH
@@ -277,6 +277,13 @@ enum
# define MATH_ERRNO 1 /* errno set by math functions. */
# define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */
+/* By default all functions support both errno and exception handling.
+ In gcc's fast math mode and if inline functions are defined this
+ might not be true. */
+# ifndef __FAST_MATH__
+# define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
+# endif
+
#endif /* Use ISO C99. */
#ifdef __USE_MISC
diff --git a/libc/math/math_private.h b/libc/math/math_private.h
index 129646f8c..fade7e118 100644
--- a/libc/math/math_private.h
+++ b/libc/math/math_private.h
@@ -17,6 +17,7 @@
#define _MATH_PRIVATE_H_
#include <endian.h>
+#include <stdint.h>
#include <sys/types.h>
/* The original fdlibm code used statements like:
@@ -43,6 +44,7 @@ typedef union
u_int32_t msw;
u_int32_t lsw;
} parts;
+ uint64_t word;
} ieee_double_shape_type;
#endif
@@ -57,6 +59,7 @@ typedef union
u_int32_t lsw;
u_int32_t msw;
} parts;
+ uint64_t word;
} ieee_double_shape_type;
#endif
@@ -89,6 +92,14 @@ do { \
(i) = gl_u.parts.lsw; \
} while (0)
+/* Get all in one, efficient on 64-bit machines. */
+#define EXTRACT_WORDS64(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.word; \
+} while (0)
+
/* Set a double from two 32 bit ints. */
#define INSERT_WORDS(d,ix0,ix1) \
@@ -99,6 +110,14 @@ do { \
(d) = iw_u.value; \
} while (0)
+/* Get all in one, efficient on 64-bit machines. */
+#define INSERT_WORDS64(i,d) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.word = (i); \
+ (d) = iw_u.value; \
+} while (0)
+
/* Set the more significant 32 bits of a double from an int. */
#define SET_HIGH_WORD(d,v) \
diff --git a/libc/math/s_fdim.c b/libc/math/s_fdim.c
index 5804e631c..677fdcde1 100644
--- a/libc/math/s_fdim.c
+++ b/libc/math/s_fdim.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <math.h>
double
@@ -31,7 +32,14 @@ __fdim (double x, double y)
/* Raise invalid flag. */
return x - y;
- return x <= y ? 0 : x - y;
+ if (x <= y)
+ return 0.0;
+
+ double r = x - y;
+ if (fpclassify (r) == FP_INFINITE)
+ __set_errno (ERANGE);
+
+ return r;
}
weak_alias (__fdim, fdim)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/math/s_fdimf.c b/libc/math/s_fdimf.c
index 2f3ce303a..737413a5f 100644
--- a/libc/math/s_fdimf.c
+++ b/libc/math/s_fdimf.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <math.h>
float
@@ -31,6 +32,13 @@ __fdimf (float x, float y)
/* Raise invalid flag. */
return x - y;
- return x <= y ? 0 : x - y;
+ if (x <= y)
+ return 0.0f;
+
+ float r = x - y;
+ if (fpclassify (r) == FP_INFINITE)
+ __set_errno (ERANGE);
+
+ return r;
}
weak_alias (__fdimf, fdimf)
diff --git a/libc/math/s_fdiml.c b/libc/math/s_fdiml.c
index 70246bafb..e1ff11b30 100644
--- a/libc/math/s_fdiml.c
+++ b/libc/math/s_fdiml.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,19 +18,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <math.h>
long double
__fdiml (long double x, long double y)
{
- int clsx = fpclassify (x);
- int clsy = fpclassify (y);
+ int clsx = fpclassifyl (x);
+ int clsy = fpclassifyl (y);
if (clsx == FP_NAN || clsy == FP_NAN
|| (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
/* Raise invalid flag. */
return x - y;
- return x <= y ? 0 : x - y;
+ if (x <= y)
+ return 0.0f;
+
+ long double r = x - y;
+ if (fpclassify (r) == FP_INFINITE)
+ __set_errno (ERANGE);
+
+ return r;
}
weak_alias (__fdiml, fdiml)
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 5be464e2f..3887969cb 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,30 @@
+2009-08-24 Ulrich Drepper <drepper@redhat.com>
+
+ * pthread_create.c (start_thread): Hint to the kernel that memory for
+ the stack can be reused. We do not mark all the memory. The part
+ still in use and some reserve are kept.
+
+2009-08-23 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/bits/posix_opt.h: Clean up namespace.
+
+2009-08-11 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S: Add CFI
+ directives.
+
+2009-08-10 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Add CFI
+ directives.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
+
+2009-08-10 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+ (__pthread_cond_signal): Don't clobber register used for syscall
+ number.
+
2009-08-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait):
@@ -1826,9 +1853,9 @@
* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Include endian.h.
Split __flags into __flags, __shared, __pad1 and __pad2.
* sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Use private
- futexes if they are available.
+ futexes if they are available.
* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Adjust so that change
- in libc-lowlevellock.S allow using private futexes.
+ in libc-lowlevellock.S allow using private futexes.
* sysdeps/unix/sysv/linux/sh/lowlevellock.h: Define
FUTEX_PRIVATE_FLAG. Add additional parameter to lll_futex_wait,
lll_futex_timed_wait and lll_futex_wake. Change lll_futex_wait
@@ -1836,12 +1863,12 @@
lll_private_futex_timed_wait and lll_private_futex_wake.
(lll_robust_mutex_unlock): Fix typo.
* sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Use private
- field in futex command setup.
+ field in futex command setup.
* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Use
COND_NWAITERS_SHIFT instead of COND_CLOCK_BITS.
* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_once.S: Use private futexes
- if they are available. Remove clear_once_control.
+ if they are available. Remove clear_once_control.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Use private
futexes if they are available.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Likewise.
@@ -1852,7 +1879,7 @@
Wake only when there are waiters.
* sysdeps/unix/sysv/linux/sh/sem_wait.S: Add private futex
support. Indicate that there are waiters. Remove unnecessary
- extra cancellation test.
+ extra cancellation test.
* sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Likewise. Removed
left-over duplication of __sem_wait_cleanup.
@@ -2566,14 +2593,14 @@
* tst-cancel25.c: New file.
2006-09-05 Jakub Jelinek <jakub@redhat.com>
- Ulrich Drepper <drepper@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/gai_misc.h (GAI_MISC_NOTIFY): Don't decrement
counterp if it is already zero.
* sysdeps/pthread/aio_misc.h (AIO_MISC_NOTIFY): Likewise..
2006-03-04 Jakub Jelinek <jakub@redhat.com>
- Roland McGrath <roland@redhat.com>
+ Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevellock.h
(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
@@ -2587,7 +2614,7 @@
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Likewise.
2006-03-03 Jakub Jelinek <jakub@redhat.com>
- Roland McGrath <roland@redhat.com>
+ Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
@@ -3160,7 +3187,7 @@
* sysdeps/pthread/pthread.h: Adjust mutex initializers.
* sysdeps/unix/sysv/linux/i386/not-cancel.h: Define openat_not_cancel,
- openat_not_cancel_3, openat64_not_cancel, and openat64_not_cancel_3.
+ openat_not_cancel_3, openat64_not_cancel, and openat64_not_cancel_3.
2006-02-08 Jakub Jelinek <jakub@redhat.com>
@@ -3582,7 +3609,7 @@
* Makefile ($(test-modules)): Remove static pattern rule.
2005-10-14 Jakub Jelinek <jakub@redhat.com>
- Ulrich Drepper <drepper@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Fix stack
alignment in callback function.
@@ -3600,7 +3627,7 @@
atomic_compare_and_exchange_bool_acq.
2005-10-01 Ulrich Drepper <drepper@redhat.com>
- Jakub Jelinek <jakub@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
* descr.h: Define SETXID_BIT and SETXID_BITMASK. Adjust
CANCEL_RESTMASK.
diff --git a/libc/nptl/pthread_create.c b/libc/nptl/pthread_create.c
index e17744aaf..ddf377cdb 100644
--- a/libc/nptl/pthread_create.c
+++ b/libc/nptl/pthread_create.c
@@ -382,6 +382,19 @@ start_thread (void *arg)
}
#endif
+ /* Mark the memory of the stack as usable to the kernel. We free
+ everything except for the space used for the TCB itself. */
+ size_t pagesize_m1 = __getpagesize () - 1;
+#ifdef _STACK_GROWS_DOWN
+ char *sp = CURRENT_STACK_FRAME;
+ size_t freesize = (sp - (char *) pd->stackblock) & ~pagesize_m1;
+#else
+# error "to do"
+#endif
+ assert (freesize < pd->stackblock_size);
+ if (freesize > PTHREAD_STACK_MIN)
+ madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
+
/* If the thread is detached free the TCB. */
if (IS_DETACHED (pd))
/* Free the TCB. */
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h b/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
index f9fa4e52e..2550355cd 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
@@ -85,15 +85,17 @@
/* We support priority inheritence. */
#define _POSIX_THREAD_PRIO_INHERIT 200809L
-/* We support priority inheritence for robust mutexes. */
-#define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L
-
/* We support priority protection, though only for non-robust
mutexes. */
#define _POSIX_THREAD_PRIO_PROTECT 200809L
+#ifdef __USE_XOPEN2K8
+/* We support priority inheritence for robust mutexes. */
+# define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L
+
/* We do not support priority protection for robust mutexes. */
-#define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1
+# define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1
+#endif
/* We support POSIX.1b semaphores. */
#define _POSIX_SEMAPHORES 200809L
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index 4d001eec7..d1d83a84f 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -64,9 +64,9 @@ __pthread_cond_signal:
/* Get the address of the mutex used. */
movq dep_mutex(%r8), %rcx
- movl MUTEX_KIND(%rcx), %eax
- andl $(ROBUST_BIT|PI_BIT), %eax
- cmpl $PI_BIT, %eax
+ movl MUTEX_KIND(%rcx), %r11d
+ andl $(ROBUST_BIT|PI_BIT), %r11d
+ cmpl $PI_BIT, %r11d
je 9f
#ifdef __ASSUME_PRIVATE_FUTEX
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
index 80fedd4ab..35eb09cd0 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -30,6 +30,7 @@
.type __pthread_rwlock_rdlock,@function
.align 16
__pthread_rwlock_rdlock:
+ cfi_startproc
xorq %r10, %r10
/* Get the lock. */
@@ -167,6 +168,7 @@ __pthread_rwlock_rdlock:
subq $MUTEX, %rdi
#endif
jmp 13b
+ cfi_endproc
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
.globl pthread_rwlock_rdlock
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
index cf7f607d9..03391d0fc 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -29,6 +29,7 @@
.type __pthread_rwlock_unlock,@function
.align 16
__pthread_rwlock_unlock:
+ cfi_startproc
/* Get the lock. */
movl $1, %esi
xorl %eax, %eax
@@ -119,7 +120,7 @@ __pthread_rwlock_unlock:
#endif
callq __lll_unlock_wake
jmp 8b
-
+ cfi_endproc
.size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock
.globl pthread_rwlock_unlock
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
index 209c0e9a9..be6b8d8e2 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -30,6 +30,7 @@
.type __pthread_rwlock_wrlock,@function
.align 16
__pthread_rwlock_wrlock:
+ cfi_startproc
xorq %r10, %r10
/* Get the lock. */
@@ -155,6 +156,7 @@ __pthread_rwlock_wrlock:
subq $MUTEX, %rdi
#endif
jmp 13b
+ cfi_endproc
.size __pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock
.globl pthread_rwlock_wrlock
diff --git a/libc/nptl_db/ChangeLog b/libc/nptl_db/ChangeLog
index 1ade1968a..f79fc18e4 100644
--- a/libc/nptl_db/ChangeLog
+++ b/libc/nptl_db/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-23 Roland McGrath <roland@redhat.com>
+
+ * td_ta_map_lwp2thr.c (__td_ta_lookup_th_unique): Move ta_ok check
+ and LOG call back to ...
+ (td_ta_map_lwp2thr): ... here.
+ Reported by Maciej W. Rozycki <macro@codesourcery.com>.
+
2009-05-25 Aurelien Jarno <aurelien@aurel32.net>
[BZ #10200]
diff --git a/libc/nptl_db/td_ta_map_lwp2thr.c b/libc/nptl_db/td_ta_map_lwp2thr.c
index 78cfcab76..4835f31f9 100644
--- a/libc/nptl_db/td_ta_map_lwp2thr.c
+++ b/libc/nptl_db/td_ta_map_lwp2thr.c
@@ -1,5 +1,5 @@
/* Which thread is running on an LWP?
- Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003,2004,2007,2009 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,12 +33,6 @@ __td_ta_lookup_th_unique (const td_thragent_t *ta_arg,
prgregset_t regs;
psaddr_t addr;
- LOG ("td_ta_map_lwp2thr");
-
- /* Test whether the TA parameter is ok. */
- if (! ta_ok (ta))
- return TD_BADTA;
-
if (ta->ta_howto == ta_howto_unknown)
{
/* We need to read in from the inferior the instructions what to do. */
@@ -181,6 +175,12 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
+ LOG ("td_ta_map_lwp2thr");
+
+ /* Test whether the TA parameter is ok. */
+ if (! ta_ok (ta))
+ return TD_BADTA;
+
/* We cannot rely on thread registers and such information at all
before __pthread_initialize_minimal has gotten far enough. They
sometimes contain garbage that would confuse us, left by the kernel
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index e978ecc7f..619c9bb8c 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -93,7 +93,7 @@ tests := tstgetopt testfnm runtests \
bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
bug-regex14 bug-regex15 \
bug-regex21 bug-regex24 \
- bug-regex27 bug-regex28 \
+ bug-regex27 bug-regex28 bug-regex29 \
tst-nice tst-nanosleep \
transbug \
tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
diff --git a/libc/posix/bug-regex29.c b/libc/posix/bug-regex29.c
new file mode 100644
index 000000000..bd796c6c2
--- /dev/null
+++ b/libc/posix/bug-regex29.c
@@ -0,0 +1,22 @@
+#include <regex.h>
+
+static int
+do_test (void)
+{
+ regex_t r;
+ int e = regcomp(&r, "xy\\{4,5,7\\}zabc", 0);
+ char buf[100];
+ regerror(e, &r, buf, sizeof (buf));
+ printf ("e = %d (%s)\n", e, buf);
+ int res = e != REG_BADBR;
+
+ e = regcomp(&r, "xy\\{4,5a\\}zabc", 0);
+ regerror(e, &r, buf, sizeof (buf));
+ printf ("e = %d (%s)\n", e, buf);
+ res |= e != REG_BADBR;
+
+ return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/posix/regcomp.c b/libc/posix/regcomp.c
index 312d83b1a..e2e9ad01f 100644
--- a/libc/posix/regcomp.c
+++ b/libc/posix/regcomp.c
@@ -2489,7 +2489,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
return elem;
}
- if (BE (end != -1 && start > end, 0))
+ if (BE ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM, 0))
{
/* First number greater than second. */
*err = REG_BADBR;
diff --git a/libc/posix/unistd.h b/libc/posix/unistd.h
index cbab9f939..d9ecb5e78 100644
--- a/libc/posix/unistd.h
+++ b/libc/posix/unistd.h
@@ -30,30 +30,58 @@ __BEGIN_DECLS
/* These may be used to determine what facilities are present at compile time.
Their values can be obtained at run time from `sysconf'. */
+#ifdef __USE_XOPEN2K8
/* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008. */
-#define _POSIX_VERSION 200809L
+# define _POSIX_VERSION 200809L
+#elif defined __USE_XOPEN2K
+/* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */
+# define _POSIX_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995. */
+# define _POSIX_VERSION 199506L
+#elif defined __USE_POSIX199309
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993. */
+# define _POSIX_VERSION 199309L
+#else
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990. */
+# define _POSIX_VERSION 199009L
+#endif
/* These are not #ifdef __USE_POSIX2 because they are
in the theoretically application-owned namespace. */
+#ifdef __USE_XOPEN2K8
+# define __POSIX2_THIS_VERSION 200809L
+/* The utilities on GNU systems also correspond to this version. */
+#elif defined __USE_XOPEN2K
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199506L
+#else
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199209L
+#endif
+
/* The utilities on GNU systems also correspond to this version. */
-#define _POSIX2_VERSION 200809L
+#define _POSIX2_VERSION __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Bindings Option. */
-#define _POSIX2_C_BIND 200809L
+#define _POSIX2_C_BIND __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Development Utilities Option. */
-#define _POSIX2_C_DEV 200809L
+#define _POSIX2_C_DEV __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
Software Development Utilities Option. */
-#define _POSIX2_SW_DEV 200809L
+#define _POSIX2_SW_DEV __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
creation of locales with the localedef utility. */
-#define _POSIX2_LOCALEDEF 200809L
+#define _POSIX2_LOCALEDEF __POSIX2_THIS_VERSION
/* X/Open version number to which the library conforms. It is selectable. */
#ifdef __USE_XOPEN2K8
diff --git a/libc/scripts/gen-as-const.awk b/libc/scripts/gen-as-const.awk
index 20d18c12a..1ffd5f2c1 100644
--- a/libc/scripts/gen-as-const.awk
+++ b/libc/scripts/gen-as-const.awk
@@ -16,7 +16,8 @@ NF >= 1 && !started {
if (test) {
print "\n#include <inttypes.h>";
print "\n#include <stdio.h>";
- print "\n#if __WORDSIZE__ == 64";
+ print "\n#include <bits/wordsize.h>";
+ print "\n#if __WORDSIZE == 64";
print "\ntypedef uint64_t c_t;";
print "\n#define U(n) UINT64_C (n)";
print "\n#define PRI PRId64";
diff --git a/libc/stdio-common/printf_fp.c b/libc/stdio-common/printf_fp.c
index e48590c54..99e52082f 100644
--- a/libc/stdio-common/printf_fp.c
+++ b/libc/stdio-common/printf_fp.c
@@ -28,6 +28,7 @@
#include <float.h>
#include <gmp-mparam.h>
#include <gmp.h>
+#include <ieee754.h>
#include <stdlib/gmp-impl.h>
#include <stdlib/longlong.h>
#include <stdlib/fpioconst.h>
@@ -357,6 +358,8 @@ ___printf_fp (FILE *fp,
/* Check for special values: not a number or infinity. */
if (__isnanl (fpnum.ldbl))
{
+ union ieee854_long_double u = { .d = fpnum.ldbl };
+ is_neg = u.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
@@ -367,10 +370,10 @@ ___printf_fp (FILE *fp,
special = "nan";
wspecial = L"nan";
}
- is_neg = 0;
}
else if (__isinfl (fpnum.ldbl))
{
+ is_neg = fpnum.ldbl < 0;
if (isupper (info->spec))
{
special = "INF";
@@ -381,7 +384,6 @@ ___printf_fp (FILE *fp,
special = "inf";
wspecial = L"inf";
}
- is_neg = fpnum.ldbl < 0;
}
else
{
@@ -401,7 +403,8 @@ ___printf_fp (FILE *fp,
/* Check for special values: not a number or infinity. */
if (__isnan (fpnum.dbl))
{
- is_neg = 0;
+ union ieee754_double u = { .d = fpnum.dbl };
+ is_neg = u.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
diff --git a/libc/stdio-common/printf_fphex.c b/libc/stdio-common/printf_fphex.c
index 670292920..8dbd49f86 100644
--- a/libc/stdio-common/printf_fphex.c
+++ b/libc/stdio-common/printf_fphex.c
@@ -185,6 +185,7 @@ __printf_fphex (FILE *fp,
/* Check for special values: not a number or infinity. */
if (__isnanl (fpnum.ldbl.d))
{
+ negative = fpnum.ldbl.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
@@ -195,7 +196,6 @@ __printf_fphex (FILE *fp,
special = "nan";
wspecial = L"nan";
}
- negative = 0;
}
else
{
@@ -224,6 +224,7 @@ __printf_fphex (FILE *fp,
/* Check for special values: not a number or infinity. */
if (__isnan (fpnum.dbl.d))
{
+ negative = fpnum.dbl.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
@@ -234,7 +235,6 @@ __printf_fphex (FILE *fp,
special = "nan";
wspecial = L"nan";
}
- negative = 0;
}
else
{
diff --git a/libc/stdio-common/tstdiomisc.c b/libc/stdio-common/tstdiomisc.c
index 32aed396a..356d50a5f 100644
--- a/libc/stdio-common/tstdiomisc.c
+++ b/libc/stdio-common/tstdiomisc.c
@@ -47,34 +47,132 @@ t2 (void)
}
volatile double nanval;
+volatile double infval;
+volatile long double lnanval;
+volatile long double linfval;
static int
F (void)
{
- char buf[20];
- wchar_t wbuf[10];
+ char buf[80];
+ wchar_t wbuf[40];
int result;
nanval = NAN;
- snprintf (buf, sizeof buf, "%f %F", nanval, nanval);
- result = strcmp (buf, "nan NAN") != 0;
- printf ("expected \"nan NAN\", got \"%s\"\n", buf);
+ snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+ nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+ result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
+ printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
- snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
- result |= strcmp (buf, "inf INF") != 0;
- printf ("expected \"inf INF\", got \"%s\"\n", buf);
+ snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+ -nanval, -nanval, -nanval, -nanval,
+ -nanval, -nanval, -nanval, -nanval);
+ result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+ printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
+ buf);
+
+ infval = DBL_MAX * DBL_MAX;
+
+ snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+ infval, infval, infval, infval, infval, infval, infval, infval);
+ result |= strcmp (buf, "inf INF inf INF inf INF inf INF") != 0;
+ printf ("expected \"inf INF inf INF inf INF inf INF\", got \"%s\"\n", buf);
+
+ snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+ -infval, -infval, -infval, -infval,
+ -infval, -infval, -infval, -infval);
+ result |= strcmp (buf, "-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+ buf);
+
+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+ nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+ result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
+ printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+ -nanval, -nanval, -nanval, -nanval,
+ -nanval, -nanval, -nanval, -nanval);
+ result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+ printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
+ wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+ infval, infval, infval, infval, infval, infval, infval, infval);
+ result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0;
+ printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+ -infval, -infval, -infval, -infval,
+ -infval, -infval, -infval, -infval);
+ result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+ wbuf);
+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ lnanval = NAN;
+
+ snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+ lnanval, lnanval, lnanval, lnanval,
+ lnanval, lnanval, lnanval, lnanval);
+ result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
+ printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
+
+ snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+ -lnanval, -lnanval, -lnanval, -lnanval,
+ -lnanval, -lnanval, -lnanval, -lnanval);
+ result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+ printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
+ buf);
+
+ linfval = LDBL_MAX * LDBL_MAX;
+
+ snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+ linfval, linfval, linfval, linfval,
+ linfval, linfval, linfval, linfval);
+ result |= strcmp (buf, "inf INF inf INF inf INF inf INF") != 0;
+ printf ("expected \"inf INF inf INF inf INF inf INF\", got \"%s\"\n", buf);
+
+ snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+ -linfval, -linfval, -linfval, -linfval,
+ -linfval, -linfval, -linfval, -linfval);
+ result |= strcmp (buf, "-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+ buf);
#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F", nanval, nanval);
- result |= wcscmp (wbuf, L"nan NAN") != 0;
- printf ("expected L\"nan NAN\", got L\"%S\"\n", wbuf);
-
- swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
- DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
- result |= wcscmp (wbuf, L"inf INF") != 0;
- printf ("expected L\"inf INF\", got L\"%S\"\n", wbuf);
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+ L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+ lnanval, lnanval, lnanval, lnanval,
+ lnanval, lnanval, lnanval, lnanval);
+ result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
+ printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+ L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+ -lnanval, -lnanval, -lnanval, -lnanval,
+ -lnanval, -lnanval, -lnanval, -lnanval);
+ result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+ printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
+ wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+ L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+ linfval, linfval, linfval, linfval,
+ linfval, linfval, linfval, linfval);
+ result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0;
+ printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+ L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+ -linfval, -linfval, -linfval, -linfval,
+ -linfval, -linfval, -linfval, -linfval);
+ result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+ wbuf);
#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
return result;
diff --git a/libc/stdlib/longlong.h b/libc/stdlib/longlong.h
index a2f38ae2a..e7d6099c7 100644
--- a/libc/stdlib/longlong.h
+++ b/libc/stdlib/longlong.h
@@ -1,6 +1,6 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -918,7 +918,7 @@ UDItype __umulsidi3 (USItype, USItype);
" or r1,%0" \
: "=r" (q), "=&z" (r) \
: "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
- : "r1", "r2", "r4", "r5", "r6", "pr"); \
+ : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \
} while (0)
#define UDIV_TIME 80
@@ -926,7 +926,8 @@ UDItype __umulsidi3 (USItype, USItype);
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("clrt;subc %5,%1; subc %4,%0" \
: "=r" (sh), "=r" (sl) \
- : "0" (ah), "1" (al), "r" (bh), "r" (bl))
+ : "0" (ah), "1" (al), "r" (bh), "r" (bl) \
+ : "t")
#endif /* __sh__ */
diff --git a/libc/sysdeps/generic/elf/backtracesyms.c b/libc/sysdeps/generic/elf/backtracesyms.c
index b31be6ac5..319b20760 100644
--- a/libc/sysdeps/generic/elf/backtracesyms.c
+++ b/libc/sysdeps/generic/elf/backtracesyms.c
@@ -1,5 +1,5 @@
/* Return list with names for address in backtrace.
- Copyright (C) 1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+ Copyright (C) 1998,1999,2000,2001,2003,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -48,15 +48,22 @@ __backtrace_symbols (array, size)
/* Fill in the information we can get from `dladdr'. */
for (cnt = 0; cnt < size; ++cnt)
{
- status[cnt] = _dl_addr (array[cnt], &info[cnt], NULL, NULL);
+ struct link_map *map;
+ status[cnt] = _dl_addr (array[cnt], &info[cnt], &map, NULL);
if (status[cnt] && info[cnt].dli_fname && info[cnt].dli_fname[0] != '\0')
- /* We have some info, compute the length of the string which will be
- "<file-name>(<sym-name>) [+offset]. */
- total += (strlen (info[cnt].dli_fname ?: "")
- + (info[cnt].dli_sname
- ? strlen (info[cnt].dli_sname) + 3 + WORD_WIDTH + 3
- : 1)
- + WORD_WIDTH + 5);
+ {
+ /* We have some info, compute the length of the string which will be
+ "<file-name>(<sym-name>+offset) [address]. */
+ total += (strlen (info[cnt].dli_fname ?: "")
+ + strlen (info[cnt].dli_sname ?: "")
+ + 3 + WORD_WIDTH + 3 + WORD_WIDTH + 5);
+
+ /* The load bias is more useful to the user than the load
+ address. The use of these addresses is to calculate an
+ address in the ELF file, so its prelinked bias is not
+ something we want to subtract out. */
+ info[cnt].dli_fbase = (void *) map->l_addr;
+ }
else
total += 5 + WORD_WIDTH;
}
@@ -71,25 +78,39 @@ __backtrace_symbols (array, size)
{
result[cnt] = last;
- if (status[cnt] && info[cnt].dli_fname
- && info[cnt].dli_fname[0] != '\0')
+ if (status[cnt]
+ && info[cnt].dli_fname != NULL && info[cnt].dli_fname[0] != '\0')
{
- char buf[20];
+ if (info[cnt].dli_sname == NULL)
+ /* We found no symbol name to use, so describe it as
+ relative to the file. */
+ info[cnt].dli_saddr = info[cnt].dli_fbase;
- if (array[cnt] >= (void *) info[cnt].dli_saddr)
- sprintf (buf, "+%#lx",
- (unsigned long)(array[cnt] - info[cnt].dli_saddr));
+ if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
+ last += 1 + sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
- sprintf (buf, "-%#lx",
- (unsigned long)(info[cnt].dli_saddr - array[cnt]));
-
- last += 1 + sprintf (last, "%s%s%s%s%s[%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ? "(" : "",
- info[cnt].dli_sname ?: "",
- info[cnt].dli_sname ? buf : "",
- info[cnt].dli_sname ? ") " : " ",
- array[cnt]);
+ {
+ char sign;
+ ptrdiff_t offset;
+ if (array[cnt] >= (void *) info[cnt].dli_saddr)
+ {
+ sign = '+';
+ offset = array[cnt] - info[cnt].dli_saddr;
+ }
+ else
+ {
+ sign = '-';
+ offset = info[cnt].dli_saddr - array[cnt];
+ }
+
+ last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
+ }
}
else
last += 1 + sprintf (last, "[%p]", array[cnt]);
diff --git a/libc/sysdeps/generic/elf/backtracesymsfd.c b/libc/sysdeps/generic/elf/backtracesymsfd.c
index 6754d145b..f0ab71587 100644
--- a/libc/sysdeps/generic/elf/backtracesymsfd.c
+++ b/libc/sysdeps/generic/elf/backtracesymsfd.c
@@ -1,5 +1,5 @@
/* Write formatted list with names for addresses in backtrace to a file.
- Copyright (C) 1998, 2000, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000,2003,2005,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -46,47 +46,63 @@ __backtrace_symbols_fd (array, size, fd)
{
char buf[WORD_WIDTH];
Dl_info info;
+ struct link_map *map;
size_t last = 0;
- if (_dl_addr (array[cnt], &info, NULL, NULL)
- && info.dli_fname && info.dli_fname[0] != '\0')
+ if (_dl_addr (array[cnt], &info, &map, NULL)
+ && info.dli_fname != NULL && info.dli_fname[0] != '\0')
{
/* Name of the file. */
iov[0].iov_base = (void *) info.dli_fname;
iov[0].iov_len = strlen (info.dli_fname);
last = 1;
- /* Symbol name. */
- if (info.dli_sname != NULL)
+ if (info.dli_sname != NULL || map->l_addr != 0)
{
char buf2[WORD_WIDTH];
size_t diff;
- iov[1].iov_base = (void *) "(";
- iov[1].iov_len = 1;
- iov[2].iov_base = (void *) info.dli_sname;
- iov[2].iov_len = strlen (info.dli_sname);
+ iov[last].iov_base = (void *) "(";
+ iov[last].iov_len = 1;
+ ++last;
+
+ if (info.dli_sname != NULL)
+ {
+ /* We have a symbol name. */
+ iov[last].iov_base = (void *) info.dli_sname;
+ iov[last].iov_len = strlen (info.dli_sname);
+ ++last;
+ }
+ else
+ /* We have no symbol, so describe it as relative to the file.
+ The load bias is more useful to the user than the load
+ address. The use of these addresses is to calculate an
+ address in the ELF file, so its prelinked bias is not
+ something we want to subtract out. */
+ info.dli_saddr = (void *) map->l_addr;
if (array[cnt] >= (void *) info.dli_saddr)
{
- iov[3].iov_base = (void *) "+0x";
+ iov[last].iov_base = (void *) "+0x";
diff = array[cnt] - info.dli_saddr;
}
else
{
- iov[3].iov_base = (void *) "-0x";
+ iov[last].iov_base = (void *) "-0x";
diff = info.dli_saddr - array[cnt];
}
- iov[3].iov_len = 3;
-
- iov[4].iov_base = _itoa_word ((unsigned long int) diff,
- &buf2[WORD_WIDTH], 16, 0);
- iov[4].iov_len = &buf2[WORD_WIDTH] - (char *) iov[4].iov_base;
-
- iov[5].iov_base = (void *) ")";
- iov[5].iov_len = 1;
-
- last = 6;
+ iov[last].iov_len = 3;
+ ++last;
+
+ iov[last].iov_base = _itoa_word ((unsigned long int) diff,
+ &buf2[WORD_WIDTH], 16, 0);
+ iov[last].iov_len = (&buf2[WORD_WIDTH]
+ - (char *) iov[last].iov_base);
+ ++last;
+
+ iov[last].iov_base = (void *) ")";
+ iov[last].iov_len = 1;
+ ++last;
}
}
diff --git a/libc/sysdeps/i386/fpu/bits/mathinline.h b/libc/sysdeps/i386/fpu/bits/mathinline.h
index a786cc69c..800599752 100644
--- a/libc/sysdeps/i386/fpu/bits/mathinline.h
+++ b/libc/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,2007
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -153,6 +153,10 @@ __NTH (__signbitl (long double __x))
#if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
&& defined __OPTIMIZE__)
+/* The inline functions do not set errno or raise necessarily the
+ correct exceptions. */
+# undef math_errhandling
+
/* A macro to define float, double, and long double versions of various
math functions for the ix87 FPU. FUNC is the function name (which will
be suffixed with f and l for the float and long double version,
diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
new file mode 100644
index 000000000..9123fdc7b
--- /dev/null
+++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
@@ -0,0 +1,67 @@
+/* @(#)s_ceil.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * ceil(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to ceil(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const double huge = 1.0e300;
+#else
+static double huge = 1.0e300;
+#endif
+
+#ifdef __STDC__
+ double __ceil(double x)
+#else
+ double __ceil(x)
+ double x;
+#endif
+{
+ int64_t i0,i;
+ int32_t j0;
+ EXTRACT_WORDS64(i0,x);
+ j0 = ((i0>>52)&0x7ff)-0x3ff;
+ if(j0<=51) {
+ if(j0<0) { /* raise inexact if x != 0 */
+ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+ if(i0<0) {i0=INT64_C(0x8000000000000000);}
+ else if(i0!=0) { i0=INT64_C(0x3ff0000000000000);}
+ }
+ } else {
+ i = INT64_C(0x000fffffffffffff)>>j0;
+ if((i0&i)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(i0>0) i0 += UINT64_C(0x0010000000000000)>>j0;
+ i0 &= (~i);
+ }
+ }
+ } else {
+ if(j0==0x400) return x+x; /* inf or NaN */
+ else return x; /* x is integral */
+ }
+ INSERT_WORDS64(x,i0);
+ return x;
+}
+weak_alias (__ceil, ceil)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ceil, __ceill)
+weak_alias (__ceil, ceill)
+#endif
diff --git a/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
index 7b1c01783..955161ef2 100644
--- a/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -33,6 +33,13 @@ ENTRY (BP_SYM (__longjmp))
#if defined PTR_DEMANGLE || defined CHECK_SP
lwz r24,(JB_GPR1*4)(r3)
+# ifdef CHECK_SP
+# ifdef PTR_DEMANGLE
+ PTR_DEMANGLE3 (r24, r24, r25)
+# endif
+ CHECK_SP (r24)
+ mr r1,r24
+# endif
#else
lwz r1,(JB_GPR1*4)(r3)
#endif
@@ -45,17 +52,11 @@ ENTRY (BP_SYM (__longjmp))
lwz r19,((JB_GPRS+5)*4)(r3)
lwz r20,((JB_GPRS+6)*4)(r3)
#ifdef PTR_DEMANGLE
-# ifdef CHECK_SP
- PTR_DEMANGLE3 (r24, r24, r25)
-# else
+# ifndef CHECK_SP
PTR_DEMANGLE3 (r1, r24, r25)
# endif
PTR_DEMANGLE2 (r0, r25)
#endif
-#ifdef CHECK_SP
- CHECK_SP (r24)
- mr r1,r24
-#endif
mtlr r0
lwz r21,((JB_GPRS+7)*4)(r3)
lwz r22,((JB_GPRS+8)*4)(r3)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index f105815b9..04ed6da68 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -116,6 +116,13 @@ L(no_vmx):
#endif
#if defined PTR_DEMANGLE || defined CHECK_SP
lwz r24,(JB_GPR1*4)(r3)
+# ifdef CHECK_SP
+# ifdef PTR_DEMANGLE
+ PTR_DEMANGLE3 (r24, r24, r25)
+# endif
+ CHECK_SP (r24)
+ mr r1,r24
+# endif
#else
lwz r1,(JB_GPR1*4)(r3)
#endif
@@ -135,17 +142,11 @@ L(no_vmx):
lwz r20,((JB_GPRS+6)*4)(r3)
lfd fp20,((JB_FPRS+6*2)*4)(r3)
#ifdef PTR_DEMANGLE
-# ifdef CHECK_SP
- PTR_DEMANGLE3 (r24, r24, r25)
-# else
+# ifndef CHECK_SP
PTR_DEMANGLE3 (r1, r24, r25)
# endif
PTR_DEMANGLE2 (r0, r25)
#endif
-#ifdef CHECK_SP
- CHECK_SP (r24)
- mr r1,r24
-#endif
mtlr r0
lwz r21,((JB_GPRS+7)*4)(r3)
lfd fp21,((JB_FPRS+7*2)*4)(r3)
diff --git a/libc/sysdeps/unix/Makefile b/libc/sysdeps/unix/Makefile
index 2696e7fb6..f7140884a 100644
--- a/libc/sysdeps/unix/Makefile
+++ b/libc/sysdeps/unix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003, 2006, 2008
+# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003,2006,2008,2009
# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -260,7 +260,6 @@ ifndef inhibit-unix-syscalls
# which specifies objects to be compiled as simple Unix system calls.
-include $(common-objpfx)sysd-syscalls
-omit-deps += $(foreach t,$(sysd-rules-targets),$(unix-syscalls:%=$t))
ifeq (misc,$(subdir))
sysdep_routines += $(unix-extra-syscalls)
@@ -306,9 +305,9 @@ endif
endif
# This is the end of the pipeline for compiling the syscall stubs.
-# The stdin in assembler with cpp using sysdep.h macros.
-# Be sure to disable debugging info since it would all just say "<stdin>".
-compile-syscall = $(filter-out -g%,$(COMPILE.S)) -x assembler-with-cpp -o $@ -
+# The stdin is assembler with cpp using sysdep.h macros.
+compile-syscall = $(COMPILE.S) -o $@ -x assembler-with-cpp - \
+ $(compile-mkdep-flags)
ifndef avoid-generated
$(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
@@ -323,16 +322,13 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
mv -f $@T $@
endif
-# The syscall objects depend on s-proto.d or s-proto-cancel.d, which
-# are generated to specify dependencies generated syscalls have on
-# headers.
+# The $(bppfx)syscall.ob objects depend on s-proto-bp.d, which are
+# generated to specify dependencies generated BP stubs have on headers.
# These deps use file names relative to a subdir, so don't
# include them in the parent directory.
ifneq (,$(filter $(unix-syscalls),$(routines) $(sysdep_routines) $(aux)))
ifndef no_deps
--include $(common-objpfx)s-proto.d
-include $(common-objpfx)s-proto-bp.d
--include $(common-objpfx)s-proto-cancel.d
endif
endif
@@ -340,7 +336,7 @@ $(common-objpfx)s-%.d: $(..)sysdeps/unix/s-%.S \
$(wildcard $(+sysdep_dirs:%=%/syscalls.list))
$(+make-deps)
-common-generated += s-proto.d s-proto-bp.d s-proto-cancel.d
+common-generated += s-proto-bp.d
postclean-generated += sysd-syscalls
endif
diff --git a/libc/sysdeps/unix/make-syscalls.sh b/libc/sysdeps/unix/make-syscalls.sh
index 8abb0349b..a8b8a262a 100644
--- a/libc/sysdeps/unix/make-syscalls.sh
+++ b/libc/sysdeps/unix/make-syscalls.sh
@@ -83,12 +83,13 @@ while read file srcfile caller syscall args strong weak; do
;;
esac
- cancellable=
- noerrno=
+ cancellable=0
+ noerrno=0
+ errval=0
case $args in
- C*) cancellable=-cancel; args=`echo $args | sed 's/C:\?//'`;;
- E*) noerrno=_NOERRNO; args=`echo $args | sed 's/E:\?//'`;;
- V*) noerrno=_ERRVAL; args=`echo $args | sed 's/V:\?//'`;;
+ C*) cancellable=1; args=`echo $args | sed 's/C:\?//'`;;
+ E*) noerrno=1; args=`echo $args | sed 's/E:\?//'`;;
+ V*) errval=1; args=`echo $args | sed 's/V:\?//'`;;
esac
# Derive the number of arguments from the argument signature
@@ -115,7 +116,7 @@ while read file srcfile caller syscall args strong weak; do
x--)
# Undefined callnum for an extra syscall.
if [ x$caller != x- ]; then
- if [ x$noerrno != x ]; then
+ if [ $noerrno != 0 ]; then
echo >&2 "$0: no number for $fileno, no-error syscall ($strong $weak)"
exit 2
fi
@@ -151,7 +152,7 @@ shared-only-routines += $file
;;
esac
- echo " \$(common-objpfx)s-proto$cancellable.d"
+ echo " \$(..)sysdeps/unix/make-syscalls.sh"
case x"$callnum" in
x_)
echo "\
@@ -161,11 +162,17 @@ shared-only-routines += $file
x*)
echo "\
\$(make-target-directory)
- (echo '#include <sysdep$cancellable.h>'; \\
- echo 'PSEUDO$noerrno ($strong, $syscall, $nargs)'; \\
- echo ' ret$noerrno'; \\
- echo 'PSEUDO_END$noerrno($strong)'; \\
- echo 'libc_hidden_def ($strong)'; \\"
+ (echo '#define SYSCALL_NAME $syscall'; \\
+ echo '#define SYSCALL_NARGS $nargs'; \\
+ echo '#define SYSCALL_SYMBOL $strong'; \\"
+ [ $cancellable = 0 ] || echo "\
+ echo '#define SYSCALL_CANCELLABLE 1'; \\"
+ [ $noerrno = 0 ] || echo "\
+ echo '#define SYSCALL_NOERRNO 1'; \\"
+ [ $errval = 0 ] || echo "\
+ echo '#define SYSCALL_ERRVAL 1'; \\"
+ echo "\
+ echo '#include <syscall-template.S>'; \\"
;;
esac
@@ -201,7 +208,7 @@ shared-only-routines += $file
vcount=`expr $vcount + 1`
echo " echo 'strong_alias ($strong, $source)'; \\"
fi
- echo " echo 'symbol_version($source, $base, $ver)'; \\"
+ echo " echo 'symbol_version ($source, $base, $ver)'; \\"
;;
!*)
name=`echo $name | sed 's/.//'`
diff --git a/libc/sysdeps/unix/syscall-template.S b/libc/sysdeps/unix/syscall-template.S
new file mode 100644
index 000000000..66319f158
--- /dev/null
+++ b/libc/sysdeps/unix/syscall-template.S
@@ -0,0 +1,88 @@
+/* Assembly code template for system call stubs.
+ Copyright (C) 2009 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. */
+
+/* The real guts of this work are in the macros defined in the
+ machine- and kernel-specific sysdep.h header file. When we
+ are defining a cancellable system call, the sysdep-cancel.h
+ versions of those macros are what we really use.
+
+ Each system call's object is built by a rule in sysd-syscalls
+ generated by make-syscalls.sh that #include's this file after
+ defining a few macros:
+ SYSCALL_NAME syscall name
+ SYSCALL_NARGS number of arguments this call takes
+ SYSCALL_SYMBOL primary symbol name
+ SYSCALL_CANCELLABLE 1 if the call is a cancelation point
+ SYSCALL_NOERRNO 1 to define a no-errno version (see below)
+ SYSCALL_ERRVAL 1 to define an error-value version (see below)
+
+ We used to simply pipe the correct three lines below through cpp into
+ the assembler. The main reason to have this file instead is so that
+ stub objects can be assembled with -g and get source line information
+ that leads a user back to a source file and these fine comments. The
+ average user otherwise has a hard time knowing which "syscall-like"
+ functions in libc are plain stubs and which have nontrivial C wrappers.
+ Some versions of the "plain" stub generation macros are more than a few
+ instructions long and the untrained eye might not distinguish them from
+ some compiled code that inexplicably lacks source line information. */
+
+#if SYSCALL_CANCELLABLE
+# include <sysdep-cancel.h>
+#else
+# include <sysdep.h>
+#endif
+
+#define T_PSEUDO(SYMBOL, NAME, N) PSEUDO (SYMBOL, NAME, N)
+#define T_PSEUDO_NOERRNO(SYMBOL, NAME, N) PSEUDO_NOERRNO (SYMBOL, NAME, N)
+#define T_PSEUDO_ERRVAL(SYMBOL, NAME, N) PSEUDO_ERRVAL (SYMBOL, NAME, N)
+#define T_PSEUDO_END(SYMBOL) PSEUDO_END (SYMBOL)
+#define T_PSEUDO_END_NOERRNO(SYMBOL) PSEUDO_END_NOERRNO (SYMBOL)
+#define T_PSEUDO_END_ERRVAL(SYMBOL) PSEUDO_END_ERRVAL (SYMBOL)
+
+#if SYSCALL_NOERRNO
+
+/* This kind of system call stub never returns an error.
+ We return the return value register to the caller unexamined. */
+
+T_PSEUDO_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
+ ret_NOERRNO
+T_PSEUDO_END_NOERRNO (SYSCALL_SYMBOL)
+
+#elif SYSCALL_ERRVAL
+
+/* This kind of system call stub returns the errno code as its return
+ value, or zero for success. We may massage the kernel's return value
+ to meet that ABI, but we never set errno here. */
+
+T_PSEUDO_ERRVAL (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
+ ret_ERRVAL
+T_PSEUDO_END_ERRVAL (SYSCALL_SYMBOL)
+
+#else
+
+/* This is a "normal" system call stub: if there is an error,
+ it returns -1 and sets errno. */
+
+T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
+ ret
+T_PSEUDO_END (SYSCALL_SYMBOL)
+
+#endif
+
+libc_hidden_def (SYSCALL_SYMBOL)
diff --git a/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
index 510ce5250..4cb968505 100644
--- a/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
@@ -19,7 +19,8 @@
#include <sysdep.h>
#include <rtld-global-offsets.h>
- .section .rodata.str1.1,"aMS",@progbits,1
+ .section .rodata.str1.4,"aMS",@progbits,1
+ .align 2
.LC0:
.string "longjmp causes uninitialized stack frame"
.text
@@ -49,8 +50,36 @@
#define CHECK_SP(reg) \
cmplw reg, r1; \
bge+ .Lok; \
+ mflr r0; \
+ stwu r1,-32(r1); \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (32); \
+ stw r0,36(r1); \
+ cfi_offset (lr, 4); \
+ mr r31,r3; \
+ mr r30,r4; \
+ li r3,0; \
+ addi r4,r1,8; \
+ li r0,__NR_sigaltstack; \
+ sc; \
+ /* Without working sigaltstack we cannot perform the test. */ \
+ bso .Lok2; \
+ lwz r0,12(r1); \
+ andi. r3,r0,1; \
+ beq .Lfail; \
+ lwz r0,16(r1); \
+ lwz r3,8(r1); \
+ add r3,r3,r0; \
+ sub r3,r3,reg; \
+ cmplw r3,r0; \
+ bge+ .Lok2; \
+.Lfail: \
LOAD_ARG; \
bl HIDDEN_JUMPTARGET (__fortify_fail); \
+.Lok2: \
+ mr r3,r31; \
+ mr r4,r30; \
+ cfi_restore_state; \
.Lok:
#include <__longjmp-common.S>
diff --git a/libc/sysdeps/powerpc/powerpc64/____longjmp_chk.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S
index 56549021a..936ace5f6 100644
--- a/libc/sysdeps/powerpc/powerpc64/____longjmp_chk.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S
@@ -19,7 +19,8 @@
#include <sysdep.h>
#include <rtld-global-offsets.h>
- .section .rodata.str1.1,"aMS",@progbits,1
+ .section .rodata.str1.8,"aMS",@progbits,1
+ .align 3
.LC0:
.string "longjmp causes uninitialized stack frame"
.section .toc,"aw"
@@ -32,8 +33,37 @@
#define CHECK_SP(reg) \
cmpld reg, r1; \
bge+ .Lok; \
+ mflr r0; \
+ std r0,16(r1); \
+ mr r31,r3; \
+ mr r30,r4; \
+ stdu r1,-144(r1); \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (144); \
+ cfi_offset (lr, 16); \
+ li r3,0; \
+ addi r4,r1,112; \
+ li r0,__NR_sigaltstack; \
+ sc; \
+ /* Without working sigaltstack we cannot perform the test. */ \
+ bso .Lok2; \
+ lwz r0,112+8(r1); \
+ andi. r4,r0,1; \
+ beq .Lfail; \
+ ld r0,112+16(r1); \
+ ld r4,112(r1); \
+ add r4,r4,r0; \
+ sub r3,r3,reg; \
+ cmpld r3,r0; \
+ bge+ .Lok2; \
+.Lfail: \
ld r3,.LC1@toc(2); \
bl HIDDEN_JUMPTARGET (__fortify_fail); \
+ nop; \
+.Lok2: \
+ mr r3,r31; \
+ mr r4,r30; \
+ cfi_restore_state; \
.Lok:
#include <__longjmp-common.S>
diff --git a/libc/sysdeps/x86_64/fpu/bits/mathinline.h b/libc/sysdeps/x86_64/fpu/bits/mathinline.h
index e8a919fe9..8d4850dfc 100644
--- a/libc/sysdeps/x86_64/fpu/bits/mathinline.h
+++ b/libc/sysdeps/x86_64/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
/* Inline math functions for x86-64.
- Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2002.
@@ -35,14 +35,16 @@
__MATH_INLINE int
__NTH (__signbitf (float __x))
{
- __extension__ union { float __f; int __i; } __u = { __f: __x };
- return __u.__i < 0;
+ int __m;
+ asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
+ return __m & 0x8;
}
__MATH_INLINE int
__NTH (__signbit (double __x))
{
- __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
- return __u.__i[1] < 0;
+ int __m;
+ asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
+ return __m & 0x80;
}
__MATH_INLINE int
__NTH (__signbitl (long double __x))
diff --git a/libc/sysdeps/x86_64/fpu/math_private.h b/libc/sysdeps/x86_64/fpu/math_private.h
index 4febcbb5e..4be753654 100644
--- a/libc/sysdeps/x86_64/fpu/math_private.h
+++ b/libc/sysdeps/x86_64/fpu/math_private.h
@@ -18,4 +18,41 @@ do \
while (0)
#include <math/math_private.h>
+
+/* We can do a few things better on x86-64. */
+
+/* Direct movement of float into integer register. */
+#undef EXTRACT_WORDS64
+#define EXTRACT_WORDS64(i,d) \
+do { \
+ long int i_; \
+ asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
+ (i) = i_; \
+} while (0)
+
+/* And the reverse. */
+#undef INSERT_WORDS64
+#define INSERT_WORDS64(d,i) \
+do { \
+ long int i_ = i; \
+ asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
+} while (0)
+
+/* Direct movement of float into integer register. */
+#undef GET_FLOAT_WORD
+#define GET_FLOAT_WORD(i,d) \
+do { \
+ int i_; \
+ asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
+ (i) = i_; \
+} while (0)
+
+/* And the reverse. */
+#undef SET_FLOAT_WORD
+#define SET_FLOAT_WORD(d,i) \
+do { \
+ int i_ = i; \
+ asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
+} while (0)
+
#endif
diff --git a/libc/test-skeleton.c b/libc/test-skeleton.c
index 23e40124b..0238db6b4 100644
--- a/libc/test-skeleton.c
+++ b/libc/test-skeleton.c
@@ -1,5 +1,5 @@
/* Skeleton for test programs.
- Copyright (C) 1998,2000-2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000-2004, 2005, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -132,7 +132,7 @@ create_temp_file (const char *base, char **filename)
/* Timeout handler. We kill the child and exit with an error. */
static void
__attribute__ ((noreturn))
-timeout_handler (int sig __attribute__ ((unused)))
+signal_handler (int sig __attribute__ ((unused)))
{
int killed;
int status;
@@ -167,6 +167,12 @@ timeout_handler (int sig __attribute__ ((unused)))
CLEANUP_HANDLER;
#endif
+ if (sig == SIGINT)
+ {
+ signal (sig, SIG_DFL);
+ raise (sig);
+ }
+
/* If we expected this signal: good! */
#ifdef EXPECTED_SIGNAL
if (EXPECTED_SIGNAL == SIGALRM)
@@ -325,9 +331,12 @@ main (int argc, char *argv[])
/* Default timeout is two seconds. */
# define TIMEOUT 2
#endif
- signal (SIGALRM, timeout_handler);
+ signal (SIGALRM, signal_handler);
alarm (TIMEOUT * timeoutfactor);
+ /* Make sure we clean up if the wrapper gets interrupted. */
+ signal (SIGINT, signal_handler);
+
/* Wait for the regular termination. */
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
if (termpid == -1)