From jakub@redhat.com Thu Mar 1 15:33:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 01 Mar 2007 15:33:00 -0000 Subject: [PATCH] pow{,f,l} NaN handling fixes Message-ID: <20070301153533.GD1826@sunsite.mff.cuni.cz> Hi! http://www.opengroup.org/onlinepubs/009695399/functions/pow.html says that pow{,f,l} should return NaN when either x or y is NaN, except for the few exceptions (pow (1, NAN) and pow (NAN, +-0) should return 1.0). But dbl-64 generic pow was checking for NAN too late and missed a couple of cases. While adding tests I noticed the i386/x86_64 assembly pow* raise invalid exception when they should not, so that's fixed in the patch as well. 2007-03-01 Jakub Jelinek [BZ #4096] * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Check for NaN earlier. * math/libm-test.inc (pow_test): Add more tests involving NaNs. * sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Avoid invalid exception for x qNaN and y either +-inf or non-integer value. * sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Likewise. * sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise. * sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise. --- libc/math/libm-test.inc.jj 2006-09-20 21:36:26.000000000 +0200 +++ libc/math/libm-test.inc 2007-03-01 15:06:05.000000000 +0100 @@ -4614,6 +4614,17 @@ pow_test (void) /* pow (x, NaN) == NaN. */ TEST_ff_f (pow, 3.0, nan_value, nan_value); + TEST_ff_f (pow, minus_zero, nan_value, nan_value); + TEST_ff_f (pow, plus_infty, nan_value, nan_value); + TEST_ff_f (pow, -3.0, nan_value, nan_value); + TEST_ff_f (pow, minus_infty, nan_value, nan_value); + + TEST_ff_f (pow, nan_value, 3.0, nan_value); + TEST_ff_f (pow, nan_value, -3.0, nan_value); + TEST_ff_f (pow, nan_value, plus_infty, nan_value); + TEST_ff_f (pow, nan_value, minus_infty, nan_value); + TEST_ff_f (pow, nan_value, 2.5, nan_value); + TEST_ff_f (pow, nan_value, -2.5, nan_value); TEST_ff_f (pow, 1, plus_infty, 1); TEST_ff_f (pow, -1, plus_infty, 1); --- libc/sysdeps/i386/fpu/e_pow.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_pow.S 2007-03-01 16:10:28.000000000 +0100 @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -161,10 +161,11 @@ ENTRY(__ieee754_pow) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -197,9 +198,10 @@ ENTRY(__ieee754_pow) // y == ??inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldl 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + fldl 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah --- libc/sysdeps/i386/fpu/e_powl.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_powl.S 2007-03-01 16:02:21.000000000 +0100 @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -161,10 +161,11 @@ ENTRY(__ieee754_powl) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -210,9 +211,10 @@ ENTRY(__ieee754_powl) // y == ??inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldt 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + fldt 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah --- libc/sysdeps/i386/fpu/e_powf.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_powf.S 2007-03-01 16:11:59.000000000 +0100 @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005 + Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -155,10 +155,11 @@ ENTRY(__ieee754_powf) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -191,9 +192,10 @@ ENTRY(__ieee754_powf) // y == ??inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - flds 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + flds 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah --- libc/sysdeps/ieee754/dbl-64/e_pow.c.jj 2004-01-23 14:16:24.000000000 +0100 +++ libc/sysdeps/ieee754/dbl-64/e_pow.c 2007-03-01 14:23:31.000000000 +0100 @@ -106,20 +106,28 @@ double __ieee754_pow(double x, double y) else return y < 0 ? 1.0/ABS(x) : 0.0; /* return 0 */ } + + qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */ + qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */ + + if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) return NaNQ.x; + if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0)) + return x == 1.0 ? 1.0 : NaNQ.x; + /* if x<0 */ if (u.i[HIGH_HALF] < 0) { k = checkint(y); if (k==0) { - if ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) { + if (qy == 0x7ff00000) { if (x == -1.0) return 1.0; else if (x > -1.0) return v.i[HIGH_HALF] < 0 ? INF.x : 0.0; else return v.i[HIGH_HALF] < 0 ? 0.0 : INF.x; } - else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) + else if (qx == 0x7ff00000) return y < 0 ? 0.0 : INF.x; return NaNQ.x; /* y not integer and x<0 */ } - else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) + else if (qx == 0x7ff00000) { if (k < 0) return y < 0 ? nZERO.x : nINF.x; @@ -129,14 +137,6 @@ double __ieee754_pow(double x, double y) return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */ } /* x>0 */ - qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */ - qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */ - - if (qx > 0x7ff00000 || (qx == 0x7ff00000 && u.i[LOW_HALF] != 0)) return NaNQ.x; - /* if 0 0x7ff00000 || (qy == 0x7ff00000 && v.i[LOW_HALF] != 0)) - return x == 1.0 ? 1.0 : NaNQ.x; - /* if y<2^-0x7fe */ if (qx == 0x7ff00000) /* x= 2^-0x3ff */ {if (y == 0) return NaNQ.x; --- libc/sysdeps/x86_64/fpu/e_powl.S.jj 2004-07-20 09:05:58.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/e_powl.S 2007-03-01 15:30:42.000000000 +0100 @@ -1,5 +1,6 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -146,10 +147,11 @@ ENTRY(__ieee754_powl) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y test $4500,%eax @@ -190,9 +192,10 @@ ENTRY(__ieee754_powl) // y == ??inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldt 8(%rsp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + fldt 8(%rsp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah Jakub From jakub@redhat.com Fri Mar 2 14:58:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 02 Mar 2007 14:58:00 -0000 Subject: [PATCH] Fix ifaddrs error handling Message-ID: <20070302145954.GF1826@sunsite.mff.cuni.cz> Hi! netlink apparently only allows one pending dumper for one netlink connection: /* A dump is in progress... */ spin_lock(&nlk->cb_lock); if (nlk->cb) { spin_unlock(&nlk->cb_lock); netlink_destroy_callback(cb); sock_put(sk); return -EBUSY; } nlk->cb = cb; spin_unlock(&nlk->cb_lock); If some box has too many interfaces and the 4K default buffer isn't sufficient, some messages can be truncated (with MSG_TRUNC set in flags). glibc in this case increments the sequence counter, resends the request and ignores all responses with older sequence numbers. If the old responses all were into the message that got truncated, maybe with NLMSG_DONE alone in a next message, then this will work just fine, but if MSG_TRUNC happens say on the 1st out of 3 response messages, when we reissue the request a NLMSG_ERR -EBUSY response is queued. The following patch fixes that by retrying with a new socket (should be very rare, most of the people don't have so many interfaces and even if they have so many, the incremented buffer size is remembered within the application, so further getifaddrs etc. calls will start with a big enough buffer). Alternatively, perhaps we could when we see MSG_TRUNC recvmsg in a loop until we see NLMSG_DONE with that seq number (though, I'm not sure if we have a guarantee NLMSG_DONE was not in a MSG_TRUNC message). This is reproduceable on ia64 with ~ 80 interfaces, or e.g. on x86_64 with 80 interfaces too, if initial buf_size in __netlink_request is artificially lowered to say 250. 2007-03-02 Jakub Jelinek * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Retry with a new netlink socket if NLMSG_ERR -EBUSY is seen after some MSG_TRUNC message. --- libc/sysdeps/unix/sysv/linux/ifaddrs.c.jj 2007-03-02 14:52:11.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/ifaddrs.c 2007-03-02 15:14:22.000000000 +0100 @@ -135,6 +135,7 @@ __netlink_request (struct netlink_handle return -1; size_t this_buf_size = buf_size; + size_t orig_this_buf_size = this_buf_size; if (__libc_use_alloca (this_buf_size)) buf = alloca (this_buf_size); else @@ -236,6 +237,36 @@ __netlink_request (struct netlink_handle struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh); if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) errno = EIO; + else if (nlerr->error == -EBUSY + && orig_this_buf_size != this_buf_size) + { + /* If EBUSY and MSG_TRUNC was seen, try again with a new + netlink socket. */ + struct netlink_handle hold = *h; + if (__netlink_open (h) < 0) + { + *h = hold; + goto out_fail; + } + __netlink_close (&hold); + orig_this_buf_size = this_buf_size; + nlm_next = *new_nlm_list; + while (nlm_next != NULL) + { + struct netlink_res *tmpptr; + + tmpptr = nlm_next->next; + free (nlm_next); + nlm_next = tmpptr; + } + *new_nlm_list = NULL; + count = 0; + h->seq++; + + if (__netlink_sendreq (h, type) < 0) + goto out_fail; + break; + } else errno = -nlerr->error; goto out_fail; Jakub From drepper@redhat.com Mon Mar 5 19:45:00 2007 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 05 Mar 2007 19:45:00 -0000 Subject: [PATCH] Speed up find_transition In-Reply-To: <20070228134538.GC1826@sunsite.mff.cuni.cz> References: <20070228134538.GC1826@sunsite.mff.cuni.cz> Message-ID: <45EC70C5.7050908@redhat.com> Jakub Jelinek wrote: > The following patch speeds up find_transition. Applied. > BTW, shouldn't we for the 64-bit tables generate transitions till more than > 2037 for all locales that are still changing DST? Or teach glibc tz reader > to grok the POSIX tz string stored at the end of TZif2 files and handle > timer >= transitions[num_transitions - 1] specially (guess the env string > should be parsed just lazily, because people will rarely query years above > last transition)? I think we should start supporting the tz string at some point. Blindly extending the range of the table means lots of wasted disk space and CPU cycles. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From munroesj@us.ibm.com Wed Mar 7 20:54:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Wed, 07 Mar 2007 20:54:00 -0000 Subject: [PATCH] localedata/tst-sscanf should use internal test locales Message-ID: <45EF2A13.2020205@us.ibm.com> The new test ./localedata/tst-sscanf.s attempts to set locale fa_IR. this locale is not built internal to glibc for make check (fa_IR.UTF-8 is) and the LOCPATH is not set. This patch sets tst-sscanf-ENV in the Makefile and changes tst-sscanf.c to use fa_IR.UTF-8. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: libc-tst-sscanf-20070307.txt URL: From rth@twiddle.net Tue Mar 13 16:48:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Tue, 13 Mar 2007 16:48:00 -0000 Subject: [rfa] fix alpha ld.so undef symbol Message-ID: <20070313164816.GA5635@twiddle.net> Since 2007-02-12 Ulrich Drepper * elf/rtld.c (RESOLVE_MAP): Always return bootstrap_map reference. * elf/Makefile ($(objpfx)ld.so): Check that ld.so has no undefined references. ld.so has failed on alpha, because we'd had an undef weak symbol that was resolved from libc.so. This patch rearranges things so that the symbol is now defined in ld.so instead. Of course, that meant that I had to find a new place to get the symbol defined for the static libc, and in the process I discovered that we weren't processing the auxv entries for the static libc either. This patch fixes that with one ifdef in common code. Ok? r~ 2007-03-13 Richard Henderson * elf/dl-support.c (_dl_aux_init): Honor DL_PLATFORM_AUXV. * sysdeps/unix/sysv/linux/alpha/dl-auxv.h: New file. * sysdeps/unix/sysv/linux/alpha/dl-support.c: New file. * sysdeps/unix/sysv/linux/alpha/dl-sysdep.c (__libc_alpha_cache_shape): Move to dl-auxv.h; initialize instead of extern weak. (DL_PLATFORM_AUXV): Move to dl-auxv.h; don't test for undef weak symbol. * sysdeps/unix/sysv/linux/alpha/sysconf.c (__libc_alpha_cache_shape): Extern instead of initialized. Index: elf/dl-support.c =================================================================== RCS file: /cvs/glibc/libc/elf/dl-support.c,v retrieving revision 1.91 diff -u -p -r1.91 dl-support.c --- elf/dl-support.c 19 Dec 2006 15:23:02 -0000 1.91 +++ elf/dl-support.c 13 Mar 2007 16:09:45 -0000 @@ -211,6 +211,9 @@ _dl_aux_init (ElfW(auxv_t) *av) __libc_enable_secure = av->a_un.a_val; __libc_enable_secure_decided = 1; break; +#ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV +#endif } if (seen == 0xf) { Index: sysdeps/unix/sysv/linux/alpha/dl-auxv.h =================================================================== RCS file: sysdeps/unix/sysv/linux/alpha/dl-auxv.h diff -N sysdeps/unix/sysv/linux/alpha/dl-auxv.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/alpha/dl-auxv.h 13 Mar 2007 16:09:50 -0000 @@ -0,0 +1,36 @@ +/* Auxiliary vector processing for Linux/Alpha. + Copyright (C) 2007 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. */ + +/* Scan the Aux Vector for the cache shape entries. */ + +long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 }; + +#define DL_PLATFORM_AUXV \ + case AT_L1I_CACHESHAPE: \ + __libc_alpha_cache_shape[0] = av->a_un.a_val; \ + break; \ + case AT_L1D_CACHESHAPE: \ + __libc_alpha_cache_shape[1] = av->a_un.a_val; \ + break; \ + case AT_L2_CACHESHAPE: \ + __libc_alpha_cache_shape[2] = av->a_un.a_val; \ + break; \ + case AT_L3_CACHESHAPE: \ + __libc_alpha_cache_shape[3] = av->a_un.a_val; \ + break; Index: sysdeps/unix/sysv/linux/alpha/dl-support.c =================================================================== RCS file: sysdeps/unix/sysv/linux/alpha/dl-support.c diff -N sysdeps/unix/sysv/linux/alpha/dl-support.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/alpha/dl-support.c 13 Mar 2007 16:09:50 -0000 @@ -0,0 +1,2 @@ +#include "dl-auxv.h" +#include Index: sysdeps/unix/sysv/linux/alpha/dl-sysdep.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c,v retrieving revision 1.2 diff -u -p -r1.2 dl-sysdep.c --- sysdeps/unix/sysv/linux/alpha/dl-sysdep.c 8 Jan 2006 08:21:16 -0000 1.2 +++ sysdeps/unix/sysv/linux/alpha/dl-sysdep.c 13 Mar 2007 16:09:50 -0000 @@ -1,59 +1,2 @@ -/* Operating system support for run-time dynamic linker. Linux/Alpha version. - Copyright (C) 1997, 1998, 2001, 2003, 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. */ - -#include -#include -#include - -extern long __libc_alpha_cache_shape[4]; -weak_extern (__libc_alpha_cache_shape); - - -/* Scan the Aux Vector for the cache shape entries. */ -#define DL_PLATFORM_AUXV \ - case AT_L1I_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[0] = av->a_un.a_val; \ - break; \ - } \ - case AT_L1D_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[1] = av->a_un.a_val; \ - break; \ - } \ - case AT_L2_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[2] = av->a_un.a_val; \ - break; \ - } \ - case AT_L3_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[3] = av->a_un.a_val; \ - break; \ - } - +#include "dl-auxv.h" #include Index: sysdeps/unix/sysv/linux/alpha/sysconf.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sysconf.c,v retrieving revision 1.1 diff -u -p -r1.1 sysconf.c --- sysdeps/unix/sysv/linux/alpha/sysconf.c 7 May 2004 01:57:19 -0000 1.1 +++ sysdeps/unix/sysv/linux/alpha/sysconf.c 13 Mar 2007 16:09:51 -0000 @@ -27,7 +27,7 @@ static long int linux_sysconf (int name) #define CSHAPE(totalsize, linesize, assoc) \ ((totalsize & ~0xff) | (linesize << 4) | assoc) -long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 }; +extern long __libc_alpha_cache_shape[4]; static inline unsigned long implver (void) From rth@twiddle.net Tue Mar 13 17:19:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Tue, 13 Mar 2007 17:19:00 -0000 Subject: incorrect double search paths w/ ieee754/ldbl-opt Message-ID: <20070313171853.GA5781@twiddle.net> Putting ieee754/ldbl-opt in sysdeps/unix/sysv/linux/*/Implies results in that directory being searched before the sysdeps/cpu/fpu directory. Any suggestions for how to rearrange things so that the native fpu stuff comes first? r~ From sjmunroe@us.ibm.com Tue Mar 13 17:53:00 2007 From: sjmunroe@us.ibm.com (Steve Munroe) Date: Tue, 13 Mar 2007 17:53:00 -0000 Subject: incorrect double search paths w/ ieee754/ldbl-opt In-Reply-To: <20070313171853.GA5781@twiddle.net> Message-ID: Richard Henderson wrote on 03/13/2007 12:18:53 PM: > Putting ieee754/ldbl-opt in sysdeps/unix/sysv/linux/*/Implies results in > that directory being searched before the sysdeps/cpu/fpu directory. > > Any suggestions for how to rearrange things so that the native fpu stuff > comes first? > This is similar to the problem I had with the powerpc-cpu add-on. I added Implies in ./sysdeps/unix/sysv/linux/*/fpu/ with refs to the native sysdeps//fpu dirs Steven J. Munroe Linux on Power Toolchain Architect IBM Corporation, Linux Technology Center From roland@redhat.com Tue Mar 13 20:17:00 2007 From: roland@redhat.com (Roland McGrath) Date: Tue, 13 Mar 2007 20:17:00 -0000 Subject: [rfa] fix alpha ld.so undef symbol In-Reply-To: Richard Henderson's message of Tuesday, 13 March 2007 09:48:16 -0700 <20070313164816.GA5635@twiddle.net> Message-ID: <20070313201706.8D8351801C5@magilla.sf.frob.com> > +#ifdef DL_PLATFORM_AUXV > + DL_PLATFORM_AUXV > +#endif This looks ok to me, but make it # ifdef there inside another #ifdef. This will also affect powerpc, which AFAICT was also failing to set its __cache_line_size in static programs. It looks to me like that will be fine. Thanks, Roland From munroesj@us.ibm.com Tue Mar 13 20:41:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Tue, 13 Mar 2007 20:41:00 -0000 Subject: [rfa] fix alpha ld.so undef symbol In-Reply-To: <20070313201706.8D8351801C5@magilla.sf.frob.com> References: <20070313201706.8D8351801C5@magilla.sf.frob.com> Message-ID: <45F71009.8020705@us.ibm.com> Roland McGrath wrote: >> +#ifdef DL_PLATFORM_AUXV >> + DL_PLATFORM_AUXV >> +#endif >> > > This looks ok to me, but make it # ifdef there inside another #ifdef. > > This will also affect powerpc, which AFAICT was also failing to set its > __cache_line_size in static programs. It looks to me like that will be fine. > > hmmm looks like powerpc needs a sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV and include /elf/dl-support.c ? From roland@redhat.com Tue Mar 13 21:04:00 2007 From: roland@redhat.com (Roland McGrath) Date: Tue, 13 Mar 2007 21:04:00 -0000 Subject: [rfa] fix alpha ld.so undef symbol In-Reply-To: Steven Munroe's message of Tuesday, 13 March 2007 15:56:41 -0500 <45F71009.8020705@us.ibm.com> Message-ID: <20070313210419.D2B961801C5@magilla.sf.frob.com> > hmmm looks like powerpc needs a > sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV > and include /elf/dl-support.c ? Ah yes, you are right. From rth@twiddle.net Tue Mar 13 21:15:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Tue, 13 Mar 2007 21:15:00 -0000 Subject: [rfa] fix alpha ld.so undef symbol In-Reply-To: <20070313201706.8D8351801C5@magilla.sf.frob.com> References: <20070313164816.GA5635@twiddle.net> <20070313201706.8D8351801C5@magilla.sf.frob.com> Message-ID: <20070313211447.GA7188@twiddle.net> On Tue, Mar 13, 2007 at 01:17:06PM -0700, Roland McGrath wrote: > This will also affect powerpc, which AFAICT was also failing to set its > __cache_line_size in static programs. It looks to me like that will be fine. ppc can be improved by this patch, but is currently setting __cache_line_size via a separate loop over auxv in their libc-start.c. r~ From rth@twiddle.net Tue Mar 13 21:30:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Tue, 13 Mar 2007 21:30:00 -0000 Subject: [alpha] cfi changes for new assembler Message-ID: <20070313212957.GA7259@twiddle.net> A newer assembler doesn't allow cfi regions to span subsections. Which I thought a cute solution, but not strictly necessary. Fixed by using one cfi region for each subsection. Committed. r~ * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Use two separate cfi regions for the two subsections. Index: sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h =================================================================== RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h,v retrieving revision 1.6 diff -u -p -r1.6 sysdep-cancel.h --- sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 29 Oct 2006 21:48:06 -0000 1.6 +++ sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 13 Mar 2007 21:25:58 -0000 @@ -55,6 +55,7 @@ __LABEL(name) \ bne a3, SYSCALL_ERROR_LABEL; \ __LABEL($pseudo_ret) \ .subsection 2; \ + cfi_startproc; \ __LABEL($pseudo_cancel) \ subq sp, 64, sp; \ cfi_def_cfa_offset(64); \ @@ -90,12 +91,13 @@ __LABEL($multi_error) \ cfi_def_cfa_offset(0); \ __LABEL($syscall_error) \ SYSCALL_ERROR_HANDLER; \ + cfi_endproc; \ .previous # undef PSEUDO_END # define PSEUDO_END(sym) \ - .subsection 2; \ cfi_endproc; \ + .subsection 2; \ .size sym, .-sym # define SAVE_ARGS_0 /* Nothing. */ From rth@twiddle.net Tue Mar 13 21:43:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Tue, 13 Mar 2007 21:43:00 -0000 Subject: incorrect double search paths w/ ieee754/ldbl-opt In-Reply-To: References: <20070313171853.GA5781@twiddle.net> Message-ID: <20070313214319.GA7325@twiddle.net> On Tue, Mar 13, 2007 at 12:49:57PM -0500, Steve Munroe wrote: > I added Implies in ./sysdeps/unix/sysv/linux/*/fpu/ > with refs to the native sysdeps//fpu dirs Ah, thanks. That seems to work. r~ From rth@twiddle.net Wed Mar 14 00:43:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Wed, 14 Mar 2007 00:43:00 -0000 Subject: [alpha] math test fixups Message-ID: <20070314004256.GA8280@twiddle.net> Committed. r~ * sysdeps/alpha/Makefile (sysdep-CFLAGS): Force dynamic rounding. * sysdeps/alpha/fpu/bits/mathinline.h (__signbitl): New. * sysdeps/alpha/fpu/libm-test-ulps: Regenerate. * sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies: New file. * sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies: New file. * sysdeps/unix/sysv/linux/alpha/fpu/Implies: New file. Index: sysdeps/alpha/Makefile =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/Makefile,v retrieving revision 1.19 diff -u -p -r1.19 Makefile --- sysdeps/alpha/Makefile 27 Mar 2004 00:32:27 -0000 1.19 +++ sysdeps/alpha/Makefile 14 Mar 2007 00:38:23 -0000 @@ -38,9 +38,10 @@ ifeq ($(subdir),elf) CFLAGS-rtld.c = -mbuild-constants endif -# For now, build everything with full IEEE math support. -# TODO: build separate libm and libm-ieee. -sysdep-CFLAGS += -mieee +# Build everything with full IEEE math support, and with dynamic rounding; +# there are a number of math routines that are defined to work with the +# "current" rounding mode, and it's easiest to set this with all of them. +sysdep-CFLAGS += -mieee -mfp-rounding-mode=d # libc.so requires about 16k for the small data area, which is well # below the 64k maximum. Index: sysdeps/alpha/fpu/libm-test-ulps =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/libm-test-ulps,v retrieving revision 1.14 diff -u -p -r1.14 libm-test-ulps --- sysdeps/alpha/fpu/libm-test-ulps 15 Jan 2006 17:59:37 -0000 1.14 +++ sysdeps/alpha/fpu/libm-test-ulps 14 Mar 2007 00:38:24 -0000 @@ -2,34 +2,40 @@ # atan2 Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": -float: 6 -ifloat: 6 +ildouble: 1 +ldouble: 1 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": -float: 3 -ifloat: 3 +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": -float: 3 -ifloat: 3 +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # atanh Test "atanh (0.75) == 0.972955074527656652552676371721589865": float: 1 ifloat: 1 +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + # cacosh -Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": -double: 1 -float: 7 -idouble: 1 -ifloat: 7 Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": -double: 1 -float: 3 -idouble: 1 -ifloat: 3 +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 # casin Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": @@ -37,6 +43,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 # casinh Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": @@ -44,48 +53,55 @@ double: 5 float: 1 idouble: 5 ifloat: 1 +ildouble: 4 +ldouble: 4 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": double: 3 float: 6 idouble: 3 ifloat: 6 +ildouble: 2 +ldouble: 2 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # catan -Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": -float: 3 -ifloat: 3 Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": double: 1 float: 1 idouble: 1 ifloat: 1 -Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": -float: 4 -ifloat: 4 +Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +ildouble: 1 +ldouble: 1 # catanh Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": double: 4 idouble: 4 -Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": -float: 4 -ifloat: 4 Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": -float: 6 -ifloat: 6 +ildouble: 1 +ldouble: 1 # cbrt +Test "cbrt (-0.001) == -0.1": +ildouble: 1 +ldouble: 1 Test "cbrt (-27.0) == -3.0": double: 1 idouble: 1 @@ -97,9 +113,14 @@ double: 1 idouble: 1 # ccos +Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": double: 1 float: 1 @@ -113,9 +134,13 @@ ifloat: 1 Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": double: 1 float: 1 @@ -126,89 +151,130 @@ float: 1 ifloat: 1 # cexp +Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": float: 1 ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 # clog -Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": -float: 3 -ifloat: 3 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # clog10 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 +Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": double: 1 -float: 5 idouble: 1 -ifloat: 5 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": float: 1 ifloat: 1 +Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 float: 1 +idouble: 1 ifloat: 1 # cos Test "cos (M_PI_6l * 2.0) == 0.5": double: 1 -float: 1 idouble: 1 -ifloat: 1 +ildouble: 1 +ldouble: 1 Test "cos (M_PI_6l * 4.0) == -0.5": double: 2 float: 1 idouble: 2 ifloat: 1 -Test "cos (pi/2) == 0": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +ildouble: 1 +ldouble: 1 # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": @@ -222,16 +288,31 @@ double: 1 float: 4 idouble: 1 ifloat: 4 +ildouble: 4 +ldouble: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": double: 2 float: 3 idouble: 2 ifloat: 3 +ildouble: 10 +ldouble: 10 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 2 +ldouble: 2 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": double: 1 float: 4 idouble: 1 ifloat: 4 +ildouble: 3 +ldouble: 3 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": float: 2 ifloat: 2 @@ -240,8 +321,21 @@ double: 2 float: 2 idouble: 2 ifloat: 2 +ildouble: 1 +ldouble: 1 + +# csin +Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +ildouble: 1 +ldouble: 1 # csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": double: 1 idouble: 1 @@ -256,14 +350,29 @@ ifloat: 1 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i": +ildouble: 1 +ldouble: 1 # ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": double: 1 idouble: 1 +ildouble: 2 +ldouble: 2 # ctanh Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": @@ -271,6 +380,11 @@ double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": float: 1 ifloat: 1 @@ -287,6 +401,9 @@ idouble: 1 Test "erfc (2.0) == 0.00467773498104726583793074363274707139": double: 1 idouble: 1 +Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318": +ildouble: 1 +ldouble: 1 Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": double: 1 idouble: 1 @@ -307,14 +424,30 @@ double: 6 float: 2 idouble: 6 ifloat: 2 +ildouble: 1 +ldouble: 1 + +# exp2 +Test "exp2 (10) == 1024": +ildouble: 2 +ldouble: 2 # expm1 Test "expm1 (0.75) == 1.11700001661267466854536981983709561": double: 1 idouble: 1 Test "expm1 (1) == M_El - 1.0": +double: 1 float: 1 +idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 # hypot Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": @@ -356,9 +489,13 @@ double: 2 float: 1 idouble: 2 ifloat: 1 +ildouble: 2 +ldouble: 2 Test "j0 (2.0) == 0.223890779141235668051827454649948626": float: 2 ifloat: 2 +ildouble: 2 +ldouble: 2 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 float: 1 @@ -367,17 +504,32 @@ ifloat: 1 Test "j0 (8.0) == 0.171650807137553906090869407851972001": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # j1 +Test "j1 (-1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "j1 (0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "j1 (1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 Test "j1 (10.0) == 0.0434727461688614366697487680258592883": float: 2 ifloat: 2 +ildouble: 2 +ldouble: 2 Test "j1 (2.0) == 0.576724807756873387202448242269137087": double: 1 idouble: 1 Test "j1 (8.0) == 0.234636346853914624381276651590454612": double: 1 idouble: 1 +ildouble: 4 +ldouble: 4 # jn Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": @@ -393,9 +545,13 @@ double: 2 float: 1 idouble: 2 ifloat: 1 +ildouble: 2 +ldouble: 2 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": float: 2 ifloat: 2 +ildouble: 2 +ldouble: 2 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 float: 1 @@ -404,30 +560,57 @@ ifloat: 1 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, -1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "jn (1, 1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": float: 2 ifloat: 2 +ildouble: 2 +ldouble: 2 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": double: 1 idouble: 1 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": double: 1 idouble: 1 +ildouble: 4 +ldouble: 4 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": double: 4 float: 3 idouble: 4 ifloat: 3 +ildouble: 2 +ldouble: 2 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": float: 4 ifloat: 4 @@ -446,6 +629,8 @@ double: 3 float: 1 idouble: 3 ifloat: 1 +ildouble: 2 +ldouble: 2 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": double: 1 float: 2 @@ -453,16 +638,23 @@ idouble: 1 ifloat: 2 # lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 Test "lgamma (0.7) == 0.260867246531666514385732417016759578": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 # log10 Test "log10 (0.75) == -0.124938736608299953132449886193870744": @@ -473,36 +665,54 @@ ifloat: 2 Test "log10 (e) == log10(e)": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # log1p Test "log1p (-0.25) == -0.287682072451780927439219005993827432": float: 1 ifloat: 1 +# log2 +Test "log2 (0.75) == -.415037499278843818546261056052183492": +ildouble: 1 +ldouble: 1 + # sincos Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 -float: 1 idouble: 1 -ifloat: 1 +ildouble: 1 +ldouble: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": double: 1 float: 1 idouble: 1 ifloat: 1 -Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +ildouble: 1 +ldouble: 1 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": float: 1 ifloat: 1 -# tan -Test "tan (pi/4) == 1": -double: 1 -idouble: 1 +# sqrt +Test "sqrt (2) == M_SQRT2l": +ildouble: 1 +ldouble: 1 + +# tanh +Test "tanh (-0.75) == -0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (-1.0) == -0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 +Test "tanh (0.75) == 0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (1.0) == 0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 # tgamma Test "tgamma (-0.5) == -2 sqrt (pi)": @@ -510,6 +720,8 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "tgamma (0.5) == sqrt (pi)": float: 1 ifloat: 1 @@ -518,6 +730,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "tgamma (4) == 6": +ildouble: 1 +ldouble: 1 # y0 Test "y0 (1.0) == 0.0882569642156769579829267660235151628": @@ -533,19 +748,28 @@ ifloat: 1 Test "y0 (10.0) == 0.0556711672835993914244598774101900481": float: 1 ifloat: 1 +ildouble: 3 +ldouble: 3 Test "y0 (8.0) == 0.223521489387566220527323400498620359": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 3 +ldouble: 3 # y1 Test "y1 (0.125) == -5.19993611253477499595928744876579921": double: 1 idouble: 1 +Test "y1 (0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 Test "y1 (1.5) == -0.412308626973911295952829820633445323": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "y1 (10.0) == 0.249015424206953883923283474663222803": double: 3 float: 1 @@ -556,11 +780,15 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "y1 (8.0) == -0.158060461731247494255555266187483550": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 # yn Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": @@ -576,17 +804,26 @@ ifloat: 1 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": float: 1 ifloat: 1 +ildouble: 3 +ldouble: 3 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 3 +ldouble: 3 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": double: 1 idouble: 1 +Test "yn (1, 0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": double: 3 float: 1 @@ -597,30 +834,44 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 Test "yn (10, 0.125) == -127057845771019398.252538486899753195": double: 1 idouble: 1 +ildouble: 2 +ldouble: 2 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 5 +ldouble: 5 Test "yn (10, 1.0) == -121618014.278689189288130426667971145": double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 2 +ldouble: 2 Test "yn (10, 2.0) == -129184.542208039282635913145923304214": double: 2 idouble: 2 +ildouble: 2 +ldouble: 2 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": double: 1 idouble: 1 @@ -629,35 +880,39 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 2 +ldouble: 2 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": double: 1 idouble: 1 # Maximal error of functions: Function: "atan2": -float: 6 -ifloat: 6 +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "atanh": float: 1 ifloat: 1 -Function: Real part of "cacosh": -double: 1 -float: 7 -idouble: 1 -ifloat: 7 +Function: Imaginary part of "cacos": +ildouble: 1 +ldouble: 1 Function: Imaginary part of "cacosh": -double: 1 -float: 3 -idouble: 1 -ifloat: 3 +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "casin": double: 1 @@ -665,107 +920,147 @@ float: 1 idouble: 1 ifloat: 1 +Function: Imaginary part of "casin": +ildouble: 1 +ldouble: 1 + Function: Real part of "casinh": double: 5 float: 1 idouble: 5 ifloat: 1 +ildouble: 4 +ldouble: 4 Function: Imaginary part of "casinh": double: 3 float: 6 idouble: 3 ifloat: 6 - -Function: Real part of "catan": -float: 4 -ifloat: 4 +ildouble: 2 +ldouble: 2 Function: Imaginary part of "catan": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "catanh": double: 4 idouble: 4 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "catanh": -float: 6 -ifloat: 6 +ildouble: 1 +ldouble: 1 Function: "cbrt": double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "ccos": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ccos": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "ccosh": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ccosh": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "cexp": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "cexp": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "clog": float: 1 ifloat: 1 - -Function: Imaginary part of "clog": -float: 3 -ifloat: 3 +ildouble: 1 +ldouble: 1 Function: Real part of "clog10": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "clog10": double: 1 -float: 5 +float: 1 idouble: 1 -ifloat: 5 +ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "cos": double: 2 float: 1 idouble: 2 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Real part of "cpow": double: 2 float: 4 idouble: 2 ifloat: 4 +ildouble: 10 +ldouble: 10 Function: Imaginary part of "cpow": double: 2 float: 2 idouble: 2 ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +ildouble: 1 +ldouble: 1 Function: Real part of "csinh": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "csinh": double: 1 @@ -776,20 +1071,36 @@ ifloat: 1 Function: Real part of "csqrt": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csqrt": +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan": +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ctan": double: 1 idouble: 1 +ildouble: 2 +ldouble: 2 Function: Real part of "ctanh": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ctanh": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "erf": double: 1 @@ -798,18 +1109,32 @@ idouble: 1 Function: "erfc": double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 Function: "exp10": double: 6 float: 2 idouble: 6 ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "exp2": +ildouble: 2 +ldouble: 2 Function: "expm1": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 Function: "hypot": float: 1 @@ -820,67 +1145,101 @@ double: 2 float: 2 idouble: 2 ifloat: 2 +ildouble: 2 +ldouble: 2 Function: "j1": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 4 +ldouble: 4 Function: "jn": double: 4 float: 4 idouble: 4 ifloat: 4 +ildouble: 4 +ldouble: 4 Function: "lgamma": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 Function: "log10": double: 1 float: 2 idouble: 1 ifloat: 2 +ildouble: 1 +ldouble: 1 Function: "log1p": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log2": +ildouble: 1 +ldouble: 1 Function: "sincos": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sqrt": +ildouble: 1 +ldouble: 1 Function: "tan": double: 1 idouble: 1 +Function: "tanh": +ildouble: 1 +ldouble: 1 + Function: "tgamma": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "y0": double: 2 float: 1 idouble: 2 ifloat: 1 +ildouble: 3 +ldouble: 3 Function: "y1": double: 3 float: 2 idouble: 3 ifloat: 2 +ildouble: 1 +ldouble: 1 Function: "yn": double: 3 float: 2 idouble: 3 ifloat: 2 +ildouble: 5 +ldouble: 5 # end of automatic generation Index: sysdeps/alpha/fpu/bits/mathinline.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/bits/mathinline.h,v retrieving revision 1.15 diff -u -p -r1.15 mathinline.h --- sysdeps/alpha/fpu/bits/mathinline.h 8 Feb 2005 04:37:48 -0000 1.15 +++ sysdeps/alpha/fpu/bits/mathinline.h 14 Mar 2007 00:38:24 -0000 @@ -178,6 +178,16 @@ __NTH (__signbit (double __x)) return __u.__i < 0; } +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + __extension__ union { + long double __d; + long __i[sizeof(long double)/sizeof(long)]; + } __u = { __d: __x }; + return __u.__i[sizeof(long double)/sizeof(long) - 1] < 0; +} + #endif /* C99 */ #endif /* __NO_MATH_INLINES */ Index: sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies =================================================================== RCS file: sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies diff -N sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies 14 Mar 2007 00:38:25 -0000 @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev6/fpu Index: sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies =================================================================== RCS file: sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies diff -N sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies 14 Mar 2007 00:38:25 -0000 @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev67/fpu Index: sysdeps/unix/sysv/linux/alpha/fpu/Implies =================================================================== RCS file: sysdeps/unix/sysv/linux/alpha/fpu/Implies diff -N sysdeps/unix/sysv/linux/alpha/fpu/Implies --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/alpha/fpu/Implies 14 Mar 2007 00:38:26 -0000 @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/fpu From rth@twiddle.net Wed Mar 14 00:45:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Wed, 14 Mar 2007 00:45:00 -0000 Subject: [rfa] ldbl-128 missing long-double-fcts Message-ID: <20070314004536.GA8310@twiddle.net> Before Steve pointed me at the extra Implies files, I was testing alpha without backward compatibility with 64-bit long double, and in the process I discovered that using plain ldbl-128 doesn't work. Ok? r~ Index: sysdeps/ieee754/ldbl-128/Makefile =================================================================== RCS file: sysdeps/ieee754/ldbl-128/Makefile diff -N sysdeps/ieee754/ldbl-128/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/ieee754/ldbl-128/Makefile 14 Mar 2007 00:43:17 -0000 @@ -0,0 +1 @@ +long-double-fcts = yes From roland@redhat.com Wed Mar 14 00:58:00 2007 From: roland@redhat.com (Roland McGrath) Date: Wed, 14 Mar 2007 00:58:00 -0000 Subject: [rfa] ldbl-128 missing long-double-fcts In-Reply-To: Richard Henderson's message of Tuesday, 13 March 2007 17:45:36 -0700 <20070314004536.GA8310@twiddle.net> Message-ID: <20070314005749.80CAC1801C5@magilla.sf.frob.com> Yeah, that seems like it's got to be fine. Anyone adding ldbl-128 to their Implies files should already know to worry about the compat issue, and new platforms with no compat issue shouldn't need the extra tweak. Thanks, Roland From rth@twiddle.net Wed Mar 14 17:48:00 2007 From: rth@twiddle.net (Richard Henderson) Date: Wed, 14 Mar 2007 17:48:00 -0000 Subject: [alpha] math routine improvements Message-ID: <20070314174806.GA13985@twiddle.net> Branchless versions of some existing rounding routines. Implement some easy functions that were missing. Remove inline versions of fdim, because they handle inf incorrectly. Committed. r~ * sysdeps/alpha/fpu/s_ceil.c: Rewrite without branches. * sysdeps/alpha/fpu/s_ceilf.c: Likewise. * sysdeps/alpha/fpu/s_floor.c: Likewise. * sysdeps/alpha/fpu/s_floorf.c: Likewise. * sysdeps/alpha/fpu/s_rint.c: Likewise. * sysdeps/alpha/fpu/s_rintf.c: Likewise. * sysdeps/alpha/fpu/s_fmax.S: New file. * sysdeps/alpha/fpu/s_fmaxf.S: New file. * sysdeps/alpha/fpu/s_fmin.S: New file. * sysdeps/alpha/fpu/s_fminf.S: New file. * sysdeps/alpha/fpu/s_isnan.c: New file. * sysdeps/alpha/fpu/s_isnanf.c: New file. * sysdeps/alpha/fpu/s_llrint.c: New file. * sysdeps/alpha/fpu/s_llrintf.c: New file. * sysdeps/alpha/fpu/s_lrint.c: New file. * sysdeps/alpha/fpu/s_lrintf.c: New file. * sysdeps/alpha/fpu/s_nearbyint.c: New file. * sysdeps/alpha/fpu/s_nearbyintf.c: New file. * sysdeps/alpha/fpu/bits/mathinline.h (__floorf, __floor): Remove. (__fdimf, fdimf, __fdim, fdim): Remove. (__signbitf, __signbit, __signbitl): Use gcc builtin if available. (__isnanf, __isnan, __isnanl): New. Index: sysdeps/alpha/fpu/s_ceil.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_ceil.c,v retrieving revision 1.4 diff -u -p -r1.4 s_ceil.c --- sysdeps/alpha/fpu/s_ceil.c 1 Feb 2006 03:13:45 -0000 1.4 +++ sysdeps/alpha/fpu/s_ceil.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -27,25 +27,20 @@ double __ceil (double x) { - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - new_x = -x; - __asm ( + double two52 = copysign (0x1.0p52, x); + double r, tmp; + + __asm ( #ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" + "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0" #else - "cvttq/svm %2,%1\n\t" + "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0" #endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(new_x)); - - /* Fix up the negation we did above, as well as handling -0 properly. */ - x = copysign(new_x, x); - } - return x; + : "=&f"(r), "=&f"(tmp) + : "f"(-x), "f"(-two52)); + + /* Fix up the negation we did above, as well as handling -0 properly. */ + return copysign (r, x); } weak_alias (__ceil, ceil) Index: sysdeps/alpha/fpu/s_ceilf.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_ceilf.c,v retrieving revision 1.3 diff -u -p -r1.3 s_ceilf.c --- sysdeps/alpha/fpu/s_ceilf.c 6 Jul 2001 04:55:47 -0000 1.3 +++ sysdeps/alpha/fpu/s_ceilf.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -26,30 +26,20 @@ float __ceilf (float x) { - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a - restricted T_Floating format, so we don't even need to - convert back to S_Floating in the end. The initial - conversion to T_Floating is needed to handle denormals. */ - - float tmp1, tmp2, new_x; - - new_x = -x; - __asm ("cvtst/s %3,%2\n\t" + float two23 = copysignf (0x1.0p23, x); + float r, tmp; + + __asm ( #ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" + "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0" #else - "cvttq/svm %2,%1\n\t" + "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0" #endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(new_x)); - - /* Fix up the negation we did above, as well as handling -0 properly. */ - x = copysignf(new_x, x); - } - return x; + : "=&f"(r), "=&f"(tmp) + : "f"(-x), "f"(-two23)); + + /* Fix up the negation we did above, as well as handling -0 properly. */ + return copysignf (r, x); } weak_alias (__ceilf, ceilf) Index: sysdeps/alpha/fpu/s_floor.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_floor.c,v retrieving revision 1.6 diff -u -p -r1.6 s_floor.c --- sysdeps/alpha/fpu/s_floor.c 1 Feb 2006 03:13:45 -0000 1.6 +++ sysdeps/alpha/fpu/s_floor.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -28,25 +28,21 @@ double __floor (double x) { - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - __asm ( + double two52 = copysign (0x1.0p52, x); + double r, tmp; + + __asm ( #ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" + "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0" #else - "cvttq/svm %2,%1\n\t" + "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0" #endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(x)); - - /* floor(-0) == -0, and in general we'll always have the same - sign as our input. */ - x = copysign(new_x, x); - } - return x; + : "=&f"(r), "=&f"(tmp) + : "f"(x), "f"(two52)); + + /* floor(-0) == -0, and in general we'll always have the same + sign as our input. */ + return copysign (r, x); } weak_alias (__floor, floor) Index: sysdeps/alpha/fpu/s_floorf.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_floorf.c,v retrieving revision 1.5 diff -u -p -r1.5 s_floorf.c --- sysdeps/alpha/fpu/s_floorf.c 6 Jul 2001 04:55:47 -0000 1.5 +++ sysdeps/alpha/fpu/s_floorf.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -27,30 +27,21 @@ float __floorf (float x) { - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a - restricted T_Floating format, so we don't even need to - convert back to S_Floating in the end. The initial - conversion to T_Floating is needed to handle denormals. */ - - float tmp1, tmp2, new_x; - - __asm ("cvtst/s %3,%2\n\t" + float two23 = copysignf (0x1.0p23, x); + float r, tmp; + + __asm ( #ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" + "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0" #else - "cvttq/svm %2,%1\n\t" + "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0" #endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(x)); - - /* floor(-0) == -0, and in general we'll always have the same - sign as our input. */ - x = copysignf(new_x, x); - } - return x; + : "=&f"(r), "=&f"(tmp) + : "f"(x), "f"(two23)); + + /* floor(-0) == -0, and in general we'll always have the same + sign as our input. */ + return copysignf (r, x); } weak_alias (__floorf, floorf) Index: sysdeps/alpha/fpu/s_fmax.S =================================================================== RCS file: sysdeps/alpha/fpu/s_fmax.S diff -N sysdeps/alpha/fpu/s_fmax.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_fmax.S 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,58 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson. + + 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. */ + +#include +#include + + .set noat + .set noreorder + + .text +ENTRY (__fmax) + .prologue 0 + + cmptun/su $f16, $f16, $f10 + cmptun/su $f17, $f17, $f11 + fmov $f17, $f0 + unop + + trapb + fbne $f10, $ret + fmov $f16, $f0 + fbne $f11, $ret + + cmptlt/su $f16, $f17, $f11 + trapb + fcmovne $f11, $f17, $f0 +$ret: ret + +END (__fmax) + +/* Given the in-register format of single-precision, this works there too. */ +strong_alias (__fmax, __fmaxf) +weak_alias (__fmaxf, fmaxf) + +weak_alias (__fmax, fmax) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmax, __fmaxl) +weak_alias (__fmaxl, fmaxl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __fmax, fmaxl, GLIBC_2_0); +#endif Index: sysdeps/alpha/fpu/s_fmaxf.S =================================================================== RCS file: sysdeps/alpha/fpu/s_fmaxf.S diff -N sysdeps/alpha/fpu/s_fmaxf.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_fmaxf.S 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1 @@ +/* __fmaxf is in s_fmax.c */ Index: sysdeps/alpha/fpu/s_fmin.S =================================================================== RCS file: sysdeps/alpha/fpu/s_fmin.S diff -N sysdeps/alpha/fpu/s_fmin.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_fmin.S 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,58 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson. + + 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. */ + +#include +#include + + .set noat + .set noreorder + + .text +ENTRY (__fmin) + .prologue 0 + + cmptun/su $f16, $f16, $f10 + cmptun/su $f17, $f17, $f11 + fmov $f17, $f0 + unop + + trapb + fbne $f10, $ret + fmov $f16, $f0 + fbne $f11, $ret + + cmptlt/su $f17, $f16, $f11 + trapb + fcmovne $f11, $f17, $f0 +$ret: ret + +END (__fmin) + +/* Given the in-register format of single-precision, this works there too. */ +strong_alias (__fmin, __fminf) +weak_alias (__fminf, fminf) + +weak_alias (__fmin, fmin) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmin, __fminl) +weak_alias (__fminl, fminl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __fmin, fminl, GLIBC_2_0); +#endif Index: sysdeps/alpha/fpu/s_fminf.S =================================================================== RCS file: sysdeps/alpha/fpu/s_fminf.S diff -N sysdeps/alpha/fpu/s_fminf.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_fminf.S 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1 @@ +/* __fminf is in s_fmin.c */ Index: sysdeps/alpha/fpu/s_isnan.c =================================================================== RCS file: sysdeps/alpha/fpu/s_isnan.c diff -N sysdeps/alpha/fpu/s_isnan.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_isnan.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,58 @@ +/* Return 1 if argument is a NaN, else 0. + Copyright (C) 2007 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. */ + +/* Ugly kludge to avoid declarations. */ +#define __isnanf not___isnanf +#define isnanf not_isnanf +#define __GI___isnanf not__GI___isnanf + +#include +#include + +#undef __isnanf +#undef isnanf +#undef __GI___isnanf + +/* The hidden_proto in include/math.h was obscured by the macro hackery. */ +__typeof (__isnan) __isnanf; +hidden_proto (__isnanf) + + +int +__isnan (double x) +{ + return isunordered (x, x); +} + +hidden_def (__isnan) +weak_alias (__isnan, isnan) + +/* It turns out that the 'double' version will also always work for + single-precision. */ +strong_alias (__isnan, __isnanf) +hidden_def (__isnanf) +weak_alias (__isnanf, isnanf) + +#ifdef NO_LONG_DOUBLE +strong_alias (__isnan, __isnanl) +weak_alias (__isnan, isnanl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __isnan, isnanl, GLIBC_2_0); +#endif Index: sysdeps/alpha/fpu/s_isnanf.c =================================================================== RCS file: sysdeps/alpha/fpu/s_isnanf.c diff -N sysdeps/alpha/fpu/s_isnanf.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_isnanf.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1 @@ +/* In s_isnan.c */ Index: sysdeps/alpha/fpu/s_llrint.c =================================================================== RCS file: sysdeps/alpha/fpu/s_llrint.c diff -N sysdeps/alpha/fpu/s_llrint.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_llrint.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1 @@ +/* In s_lrint.c */ Index: sysdeps/alpha/fpu/s_llrintf.c =================================================================== RCS file: sysdeps/alpha/fpu/s_llrintf.c diff -N sysdeps/alpha/fpu/s_llrintf.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_llrintf.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1 @@ +/* In s_lrintf.c */ Index: sysdeps/alpha/fpu/s_lrint.c =================================================================== RCS file: sysdeps/alpha/fpu/s_lrint.c diff -N sysdeps/alpha/fpu/s_lrint.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_lrint.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,48 @@ +/* Copyright (C) 2007 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. */ + +#define __llrint not___llrint +#define llrint not_llrint +#include +#include +#undef __llrint +#undef llrint + +long int +__lrint (double x) +{ + long ret; + + __asm ("cvttq/svd %1,%0" : "=&f"(ret) : "f"(x)); + + return ret; +} + +strong_alias (__lrint, __llrint) +weak_alias (__lrint, lrint) +weak_alias (__llrint, llrint) +#ifdef NO_LONG_DOUBLE +strong_alias (__lrint, __lrintl) +strong_alias (__lrint, __llrintl) +weak_alias (__lrintl, lrintl) +weak_alias (__llrintl, llrintl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __lrint, lrintl, GLIBC_2_0); +compat_symbol (libm, __llrint, llrintl, GLIBC_2_0); +#endif Index: sysdeps/alpha/fpu/s_lrintf.c =================================================================== RCS file: sysdeps/alpha/fpu/s_lrintf.c diff -N sysdeps/alpha/fpu/s_lrintf.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_lrintf.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,39 @@ +/* Copyright (C) 2007 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. */ + +#define __llrintf not___llrintf +#define llrintf not_llrintf +#include +#undef __llrintf +#undef llrintf + +long int +__lrintf (float x) +{ + double tmp; + long ret; + + __asm ("cvtst/s %2,%1\n\tcvttq/svd %1,%0" + : "=&f"(ret), "=&f"(tmp) : "f"(x)); + + return ret; +} + +strong_alias (__lrintf, __llrintf) +weak_alias (__lrintf, lrintf) +weak_alias (__llrintf, llrintf) Index: sysdeps/alpha/fpu/s_nearbyint.c =================================================================== RCS file: sysdeps/alpha/fpu/s_nearbyint.c diff -N sysdeps/alpha/fpu/s_nearbyint.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_nearbyint.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,48 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson. + + 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. */ + +#include +#include + +#ifdef _IEEE_FP_INEXACT +#error "Don't compile with -mieee-with-inexact" +#endif + +double +__nearbyint (double x) +{ + double two52 = copysign (0x1.0p52, x); + double r; + + r = x + two52; + r = r - two52; + + /* nearbyint(-0.1) == -0, and in general we'll always have the same sign + as our input. */ + return copysign (r, x); +} + +weak_alias (__nearbyint, nearbyint) +#ifdef NO_LONG_DOUBLE +strong_alias (__nearbyint, __nearbyintl) +weak_alias (__nearbyint, nearbyintl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0); +#endif Index: sysdeps/alpha/fpu/s_nearbyintf.c =================================================================== RCS file: sysdeps/alpha/fpu/s_nearbyintf.c diff -N sysdeps/alpha/fpu/s_nearbyintf.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/alpha/fpu/s_nearbyintf.c 14 Mar 2007 17:37:15 -0000 @@ -0,0 +1,40 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson. + + 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. */ + +#include + +#ifdef _IEEE_FP_INEXACT +#error "Don't compile with -mieee-with-inexact" +#endif + +float +__nearbyintf (float x) +{ + float two23 = copysignf (0x1.0p23, x); + float r; + + r = x + two23; + r = r - two23; + + /* nearbyint(-0.1) == -0, and in general we'll always have the same sign + as our input. */ + return copysign (r, x); +} + +weak_alias (__nearbyintf, nearbyintf) Index: sysdeps/alpha/fpu/s_rint.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_rint.c,v retrieving revision 1.3 diff -u -p -r1.3 s_rint.c --- sysdeps/alpha/fpu/s_rint.c 1 Feb 2006 03:13:45 -0000 1.3 +++ sysdeps/alpha/fpu/s_rint.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -24,24 +24,15 @@ double __rint (double x) { - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - __asm ( -#ifdef _IEEE_FP_INEXACT - "cvttq/svid %2,%1\n\t" -#else - "cvttq/svd %2,%1\n\t" -#endif - "cvtqt/d %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(x)); - - /* rint(-0.1) == -0, and in general we'll always have the same - sign as our input. */ - x = copysign(new_x, x); - } - return x; + double two52 = copysign (0x1.0p52, x); + double r; + + r = x + two52; + r = r - two52; + + /* rint(-0.1) == -0, and in general we'll always have the same sign + as our input. */ + return copysign (r, x); } weak_alias (__rint, rint) Index: sysdeps/alpha/fpu/s_rintf.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/s_rintf.c,v retrieving revision 1.2 diff -u -p -r1.2 s_rintf.c --- sysdeps/alpha/fpu/s_rintf.c 6 Jul 2001 04:55:47 -0000 1.2 +++ sysdeps/alpha/fpu/s_rintf.c 14 Mar 2007 17:37:15 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -23,30 +23,15 @@ float __rintf (float x) { - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a - restricted T_Floating format, so we don't even need to - convert back to S_Floating in the end. The initial - conversion to T_Floating is needed to handle denormals. */ - - float tmp1, tmp2, new_x; - - __asm ("cvtst/s %3,%2\n\t" -#ifdef _IEEE_FP_INEXACT - "cvttq/svid %2,%1\n\t" -#else - "cvttq/svd %2,%1\n\t" -#endif - "cvtqt/d %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(x)); - - /* rint(-0.1) == -0, and in general we'll always have the same - sign as our input. */ - x = copysignf(new_x, x); - } - return x; + float two23 = copysignf (0x1.0p23, x); + float r; + + r = x + two23; + r = r - two23; + + /* rint(-0.1) == -0, and in general we'll always have the same sign + as our input. */ + return copysign (r, x); } weak_alias (__rintf, rintf) Index: sysdeps/alpha/fpu/bits/mathinline.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/alpha/fpu/bits/mathinline.h,v retrieving revision 1.16 diff -u -p -r1.16 mathinline.h --- sysdeps/alpha/fpu/bits/mathinline.h 14 Mar 2007 00:40:50 -0000 1.16 +++ sysdeps/alpha/fpu/bits/mathinline.h 14 Mar 2007 17:37:15 -0000 @@ -1,5 +1,6 @@ /* Inline math functions for Alpha. - Copyright (C) 1996, 1997, 1999-2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999-2001, 2004, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger-Tang. @@ -83,111 +84,64 @@ __inline_fabs (fabs, double) # undef __inline_fabs #endif - -/* Use the -inf rounding mode conversion instructions to implement - floor. We note when the exponent is large enough that the value - must be integral, as this avoids unpleasant integer overflows. */ - -__MATH_INLINE float -__NTH (__floorf (float __x)) -{ - /* Check not zero since floor(-0) == -0. */ - if (__x != 0 && fabsf (__x) < 16777216.0f) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a - restricted T_Floating format, so we don't even need to - convert back to S_Floating in the end. The initial - conversion to T_Floating is needed to handle denormals. */ - - float __tmp1, __tmp2; - - __asm ("cvtst/s %3,%2\n\t" -#ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" -#else - "cvttq/svm %2,%1\n\t" -#endif - "cvtqt/m %1,%0\n\t" - : "=f"(__x), "=&f"(__tmp1), "=&f"(__tmp2) - : "f"(__x)); - } - return __x; -} - -__MATH_INLINE double -__NTH (__floor (double __x)) -{ - if (__x != 0 && fabs (__x) < 9007199254740992.0) /* 1 << DBL_MANT_DIG */ - { - double __tmp1; - __asm ( -#ifdef _IEEE_FP_INEXACT - "cvttq/svim %2,%1\n\t" -#else - "cvttq/svm %2,%1\n\t" -#endif - "cvtqt/m %1,%0\n\t" - : "=f"(__x), "=&f"(__tmp1) - : "f"(__x)); - } - return __x; -} - -__MATH_INLINE float __NTH (floorf (float __x)) { return __floorf(__x); } -__MATH_INLINE double __NTH (floor (double __x)) { return __floor(__x); } - - #ifdef __USE_ISOC99 -__MATH_INLINE float -__NTH (__fdimf (float __x, float __y)) -{ - return __x <= __y ? 0.0f : __x - __y; -} - -__MATH_INLINE float -__NTH (fdimf (float __x, float __y)) -{ - return __x <= __y ? 0.0f : __x - __y; -} - -__MATH_INLINE double -__NTH (__fdim (double __x, double __y)) -{ - return __x <= __y ? 0.0 : __x - __y; -} - -__MATH_INLINE double -__NTH (fdim (double __x, double __y)) -{ - return __x <= __y ? 0.0 : __x - __y; -} - /* Test for negative number. Used in the signbit() macro. */ __MATH_INLINE int __NTH (__signbitf (float __x)) { +#if !__GNUC_PREREQ (4, 0) __extension__ union { float __f; int __i; } __u = { __f: __x }; return __u.__i < 0; +#else + return __builtin_signbitf (__x); +#endif } __MATH_INLINE int __NTH (__signbit (double __x)) { +#if !__GNUC_PREREQ (4, 0) __extension__ union { double __d; long __i; } __u = { __d: __x }; return __u.__i < 0; +#else + return __builtin_signbit (__x); +#endif } __MATH_INLINE int __NTH (__signbitl (long double __x)) { +#if !__GNUC_PREREQ (4, 0) __extension__ union { long double __d; long __i[sizeof(long double)/sizeof(long)]; } __u = { __d: __x }; return __u.__i[sizeof(long double)/sizeof(long) - 1] < 0; +#else + return __builtin_signbitl (__x); +#endif } +/* Test for NaN. Used in the isnan() macro. */ + +__MATH_INLINE int +__NTH (__isnanf (float __x)) +{ + return isunordered (__x, __x); +} + +__MATH_INLINE int +__NTH (__isnan (double __x)) +{ + return isunordered (__x, __x); +} + +__MATH_INLINE int +__NTH (__isnanl (long double __x)) +{ + return isunordered (__x, __x); +} #endif /* C99 */ #endif /* __NO_MATH_INLINES */ * sysdeps/alpha/fpu/s_ceilf.c: Likewise. * sysdeps/alpha/fpu/s_floor.c: Likewise. * sysdeps/alpha/fpu/s_floorf.c: Likewise. * sysdeps/alpha/fpu/s_rint.c: Likewise. * sysdeps/alpha/fpu/s_rintf.c: Likewise. * sysdeps/alpha/fpu/s_fmax.S: New file. * sysdeps/alpha/fpu/s_fmaxf.S: New file. * sysdeps/alpha/fpu/s_fmin.S: New file. * sysdeps/alpha/fpu/s_fminf.S: New file. * sysdeps/alpha/fpu/s_isnan.c: New file. * sysdeps/alpha/fpu/s_isnanf.c: New file. * sysdeps/alpha/fpu/s_llrint.c: New file. * sysdeps/alpha/fpu/s_llrintf.c: New file. * sysdeps/alpha/fpu/s_lrint.c: New file. * sysdeps/alpha/fpu/s_lrintf.c: New file. * sysdeps/alpha/fpu/s_nearbyint.c: New file. * sysdeps/alpha/fpu/s_nearbyintf.c: New file. * sysdeps/alpha/fpu/bits/mathinline.h (__floorf, __floor): Remove. (__fdimf, fdimf, __fdim, fdim): Remove. (__signbitf, __signbit, __signbitl): Use gcc builtin if available. (__isnanf, __isnan, __isnanl): New. From jakub@redhat.com Wed Mar 14 18:16:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 14 Mar 2007 18:16:00 -0000 Subject: [PATCH] Better fix for ifaddrs Message-ID: <20070314182000.GK1826@sunsite.mff.cuni.cz> Hi! David Miller said kernel guarantees that netlink requests are split into at most page sized chunks. This patch removes again all the MSG_TRUNC handling and instead uses page sized buffer. I believe a page should be ok with alloca/VLA always, so I have removed even the use_malloc etc. stuff, if you think I should use __libc_use_alloca even for this, please let me know. Tested on ia64 with 80 interfaces. 2007-03-14 Jakub Jelinek * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Revert 2005-06-13, 2007-02-27 and 2007-03-02 changes. Use page sized buffer. * sysdeps/unix/sysv/linux/check_pf.c (make_request): Use page sized buffer. --- libc/sysdeps/unix/sysv/linux/check_pf.c.jj 2007-01-03 11:04:37.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/check_pf.c 2007-03-13 18:16:12.000000000 +0100 @@ -1,5 +1,5 @@ /* Determine protocol families for which interfaces exist. Linux version. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2007 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 @@ -80,8 +80,9 @@ make_request (int fd, pid_t pid, bool *s *seen_ipv6 = false; bool done = false; - char buf[4096]; - struct iovec iov = { buf, sizeof (buf) }; + size_t buf_size = __getpagesize (); + char buf[buf_size]; + struct iovec iov = { buf, buf_size }; struct in6ailist { struct in6addrinfo info; --- libc/sysdeps/unix/sysv/linux/ifaddrs.c.jj 2007-03-13 17:42:17.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/ifaddrs.c 2007-03-13 18:17:06.000000000 +0100 @@ -122,37 +122,17 @@ int __netlink_request (struct netlink_handle *h, int type) { struct netlink_res *nlm_next; - struct netlink_res **new_nlm_list; - static volatile size_t buf_size = 4096; - char *buf; + size_t buf_size = __getpagesize (); + char buf[buf_size]; struct sockaddr_nl nladdr; struct nlmsghdr *nlmh; ssize_t read_len; bool done = false; - bool use_malloc = false; if (__netlink_sendreq (h, type) < 0) return -1; - size_t this_buf_size = buf_size; - size_t orig_this_buf_size = this_buf_size; - if (__libc_use_alloca (this_buf_size)) - buf = alloca (this_buf_size); - else - { - buf = malloc (this_buf_size); - if (buf != NULL) - use_malloc = true; - else - goto out_fail; - } - - struct iovec iov = { buf, this_buf_size }; - - if (h->nlm_list != NULL) - new_nlm_list = &h->end_ptr->next; - else - new_nlm_list = &h->nlm_list; + struct iovec iov = { buf, buf_size }; while (! done) { @@ -166,54 +146,13 @@ __netlink_request (struct netlink_handle read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0)); if (read_len < 0) - goto out_fail; + return -1; if (nladdr.nl_pid != 0) continue; if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0)) - { - if (this_buf_size >= SIZE_MAX / 2) - goto out_fail; - - nlm_next = *new_nlm_list; - while (nlm_next != NULL) - { - struct netlink_res *tmpptr; - - tmpptr = nlm_next->next; - free (nlm_next); - nlm_next = tmpptr; - } - *new_nlm_list = NULL; - - if (__libc_use_alloca (2 * this_buf_size)) - buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size); - else - { - this_buf_size *= 2; - - char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size); - if (new_buf == NULL) - goto out_fail; - buf = new_buf; - - use_malloc = true; - } - buf_size = this_buf_size; - - iov.iov_base = buf; - iov.iov_len = this_buf_size; - - /* Increase sequence number, so that we can distinguish - between old and new request messages. */ - h->seq++; - - if (__netlink_sendreq (h, type) < 0) - goto out_fail; - - continue; - } + return -1; size_t count = 0; size_t remaining_len = read_len; @@ -237,39 +176,9 @@ __netlink_request (struct netlink_handle struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh); if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) errno = EIO; - else if (nlerr->error == -EBUSY - && orig_this_buf_size != this_buf_size) - { - /* If EBUSY and MSG_TRUNC was seen, try again with a new - netlink socket. */ - struct netlink_handle hold = *h; - if (__netlink_open (h) < 0) - { - *h = hold; - goto out_fail; - } - __netlink_close (&hold); - orig_this_buf_size = this_buf_size; - nlm_next = *new_nlm_list; - while (nlm_next != NULL) - { - struct netlink_res *tmpptr; - - tmpptr = nlm_next->next; - free (nlm_next); - nlm_next = tmpptr; - } - *new_nlm_list = NULL; - count = 0; - h->seq++; - - if (__netlink_sendreq (h, type) < 0) - goto out_fail; - break; - } else errno = -nlerr->error; - goto out_fail; + return -1; } } @@ -281,7 +190,7 @@ __netlink_request (struct netlink_handle nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res) + read_len); if (nlm_next == NULL) - goto out_fail; + return -1; nlm_next->next = NULL; nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len); nlm_next->size = read_len; @@ -293,14 +202,7 @@ __netlink_request (struct netlink_handle h->end_ptr = nlm_next; } - if (use_malloc) - free (buf); return 0; - -out_fail: - if (use_malloc) - free (buf); - return -1; } Jakub From drepper@redhat.com Wed Mar 14 22:34:00 2007 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 14 Mar 2007 22:34:00 -0000 Subject: [PATCH] localedata/tst-sscanf should use internal test locales In-Reply-To: <45EF2A13.2020205@us.ibm.com> References: <45EF2A13.2020205@us.ibm.com> Message-ID: <45F87848.1060407@redhat.com> Steven Munroe wrote: > This patch sets tst-sscanf-ENV in the Makefile and changes tst-sscanf.c > to use fa_IR.UTF-8. OK, but of course there was again a problem with the patch. localedata has it's own ChangeLog file. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Thu Mar 15 00:45:00 2007 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 15 Mar 2007 00:45:00 -0000 Subject: [PATCH] Better fix for ifaddrs In-Reply-To: <20070314182000.GK1826@sunsite.mff.cuni.cz> References: <20070314182000.GK1826@sunsite.mff.cuni.cz> Message-ID: <45F8971B.9080708@redhat.com> Jakub Jelinek wrote: > if you think I should use > __libc_use_alloca even for this, please let me know. I fear for archs like ia64 and ppc64 where the page size can widely vary we need this. But I think that this code should be optional, i.e., only for those archs. No need to slow down the rest of the world. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Thu Mar 15 08:37:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 08:37:00 -0000 Subject: [PATCH] Better fix for ifaddrs In-Reply-To: <45F8971B.9080708@redhat.com> References: <20070314182000.GK1826@sunsite.mff.cuni.cz> <45F8971B.9080708@redhat.com> Message-ID: <20070315084129.GL1826@sunsite.mff.cuni.cz> On Wed, Mar 14, 2007 at 05:45:15PM -0700, Ulrich Drepper wrote: > Jakub Jelinek wrote: > > if you think I should use > > __libc_use_alloca even for this, please let me know. > > I fear for archs like ia64 and ppc64 where the page size can widely vary > we need this. But I think that this code should be optional, i.e., only > for those archs. No need to slow down the rest of the world. Ok, how about this then? On x86_64/i386 where PAGE_SIZE is defined, constant and <= PTHREAD_STACK_MIN/4 the malloc+free are completely optimized out by the compiler, the only bad thing there is that it will still use char *buf = alloca (4096); rather than char buf[4096]; which is a few instructions more expensive. But even that is fixable in the compiler (if alloca with a constant argument is always reachable from the entry BB, then the compiler can just create a char array with that size instead of alloca). Working around this in glibc would be ugly, hardcoding what __libc_use_alloca does internally e.g. in preprocessor directive would be bad. 2007-03-15 Jakub Jelinek * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Never reallocate the buffer, instead fail for MSG_TRUNC or for EBUSY NLMSG_ERR. Instead use a page sized buffer. * sysdeps/unix/sysv/linux/check_pf.c (make_request): Use page sized buffer. --- libc/sysdeps/unix/sysv/linux/check_pf.c.jj 2007-01-03 11:04:37.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/check_pf.c 2007-03-15 09:20:11.000000000 +0100 @@ -1,5 +1,5 @@ /* Determine protocol families for which interfaces exist. Linux version. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2007 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 @@ -71,17 +71,38 @@ make_request (int fd, pid_t pid, bool *s memset (&nladdr, '\0', sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; +#ifdef PAGE_SIZE + /* Help the compiler optimize out the malloc call if PAGE_SIZE + is constant and smaller or equal to PTHREAD_STACK_MIN/4. */ + const size_t buf_size = PAGE_SIZE; +#else + const size_t buf_size = __getpagesize (); +#endif + bool use_malloc = false; + char *buf; + + if (__libc_use_alloca (buf_size)) + buf = alloca (buf_size); + else + { + buf = malloc (buf_size); + if (buf != NULL) + use_malloc = true; + else + goto out_fail; + } + + struct iovec iov = { buf, buf_size }; + if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0, (struct sockaddr *) &nladdr, sizeof (nladdr))) < 0) - return -1; + goto out_fail; *seen_ipv4 = false; *seen_ipv6 = false; bool done = false; - char buf[4096]; - struct iovec iov = { buf, sizeof (buf) }; struct in6ailist { struct in6addrinfo info; @@ -101,10 +122,10 @@ make_request (int fd, pid_t pid, bool *s ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0)); if (read_len < 0) - return -1; + goto out_fail; if (msg.msg_flags & MSG_TRUNC) - return -1; + goto out_fail; struct nlmsghdr *nlmh; for (nlmh = (struct nlmsghdr *) buf; @@ -186,7 +207,7 @@ make_request (int fd, pid_t pid, bool *s { *in6ai = malloc (in6ailistlen * sizeof (**in6ai)); if (*in6ai == NULL) - return -1; + goto out_fail; *in6ailen = in6ailistlen; @@ -198,6 +219,13 @@ make_request (int fd, pid_t pid, bool *s while (in6ailist != NULL); } + if (use_malloc) + free (buf); + return 0; + +out_fail: + if (use_malloc) + free (buf); return 0; } --- libc/sysdeps/unix/sysv/linux/ifaddrs.c.jj 2007-03-13 17:42:17.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/ifaddrs.c 2007-03-15 09:18:43.000000000 +0100 @@ -122,37 +122,36 @@ int __netlink_request (struct netlink_handle *h, int type) { struct netlink_res *nlm_next; - struct netlink_res **new_nlm_list; - static volatile size_t buf_size = 4096; - char *buf; struct sockaddr_nl nladdr; struct nlmsghdr *nlmh; ssize_t read_len; bool done = false; - bool use_malloc = false; - if (__netlink_sendreq (h, type) < 0) - return -1; +#ifdef PAGE_SIZE + /* Help the compiler optimize out the malloc call if PAGE_SIZE + is constant and smaller or equal to PTHREAD_STACK_MIN/4. */ + const size_t buf_size = PAGE_SIZE; +#else + const size_t buf_size = __getpagesize (); +#endif + bool use_malloc = false; + char *buf; - size_t this_buf_size = buf_size; - size_t orig_this_buf_size = this_buf_size; - if (__libc_use_alloca (this_buf_size)) - buf = alloca (this_buf_size); + if (__libc_use_alloca (buf_size)) + buf = alloca (buf_size); else { - buf = malloc (this_buf_size); + buf = malloc (buf_size); if (buf != NULL) use_malloc = true; else goto out_fail; } - struct iovec iov = { buf, this_buf_size }; + struct iovec iov = { buf, buf_size }; - if (h->nlm_list != NULL) - new_nlm_list = &h->end_ptr->next; - else - new_nlm_list = &h->nlm_list; + if (__netlink_sendreq (h, type) < 0) + goto out_fail; while (! done) { @@ -172,48 +171,7 @@ __netlink_request (struct netlink_handle continue; if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0)) - { - if (this_buf_size >= SIZE_MAX / 2) - goto out_fail; - - nlm_next = *new_nlm_list; - while (nlm_next != NULL) - { - struct netlink_res *tmpptr; - - tmpptr = nlm_next->next; - free (nlm_next); - nlm_next = tmpptr; - } - *new_nlm_list = NULL; - - if (__libc_use_alloca (2 * this_buf_size)) - buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size); - else - { - this_buf_size *= 2; - - char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size); - if (new_buf == NULL) - goto out_fail; - buf = new_buf; - - use_malloc = true; - } - buf_size = this_buf_size; - - iov.iov_base = buf; - iov.iov_len = this_buf_size; - - /* Increase sequence number, so that we can distinguish - between old and new request messages. */ - h->seq++; - - if (__netlink_sendreq (h, type) < 0) - goto out_fail; - - continue; - } + goto out_fail; size_t count = 0; size_t remaining_len = read_len; @@ -237,36 +195,6 @@ __netlink_request (struct netlink_handle struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh); if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) errno = EIO; - else if (nlerr->error == -EBUSY - && orig_this_buf_size != this_buf_size) - { - /* If EBUSY and MSG_TRUNC was seen, try again with a new - netlink socket. */ - struct netlink_handle hold = *h; - if (__netlink_open (h) < 0) - { - *h = hold; - goto out_fail; - } - __netlink_close (&hold); - orig_this_buf_size = this_buf_size; - nlm_next = *new_nlm_list; - while (nlm_next != NULL) - { - struct netlink_res *tmpptr; - - tmpptr = nlm_next->next; - free (nlm_next); - nlm_next = tmpptr; - } - *new_nlm_list = NULL; - count = 0; - h->seq++; - - if (__netlink_sendreq (h, type) < 0) - goto out_fail; - break; - } else errno = -nlerr->error; goto out_fail; Jakub From jakub@redhat.com Thu Mar 15 11:46:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 11:46:00 -0000 Subject: [PATCH] Fix inet6_opt_{append,finish} Message-ID: <20070315115024.GM1826@sunsite.mff.cuni.cz> Hi! As the attached testcase shows, there have been several bugs: 1) if extbuf == NULL, extlen shouldn't be checked (happened both in inet6_opt_{append,finish}) 2) if the last option's end was 8 byte aligned already, inet6_opt_finish would say it needs 0 bytes to fill it, but then adding IP6OPT_PAD1 254 254x'\0' BTW, the npad calculations are too complicated: int npad = (align - data_offset % align) & (align - 1); is I believe the same as: int npad = -data_offset & (align - 1); and int npad = (8 - (offset & 7)) & 7; is int npad = -offset & 7; Apparently at least the latter isn't fully optimized on i?86 (but is on x86_64), guess ++todo for GCC. 2007-03-15 Jakub Jelinek [BZ #4181] * inet/inet6_opt.c (add_padding): Only insert padding if npad > 0. (inet6_opt_append): Don't check extlen is big enough if extbuf is NULL. (inet6_opt_finish): Likewise. * inet/Makefile (tests): Add test-inet6_opt. * inet/test-inet6_opt.c: New test. --- libc/inet/inet6_opt.c.jj 2006-05-25 06:38:02.000000000 +0200 +++ libc/inet/inet6_opt.c 2007-03-15 12:15:02.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2006. @@ -51,7 +51,7 @@ add_padding (uint8_t *extbuf, int offset { if (npad == 1) extbuf[offset] = IP6OPT_PAD1; - else + else if (npad > 0) { struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset); @@ -102,21 +102,17 @@ inet6_opt_append (void *extbuf, socklen_ int data_offset = offset + sizeof (struct ip6_opt); int npad = (align - data_offset % align) & (align - 1); - /* Now we can check whether the buffer is large enough. */ - if (data_offset + npad + len > extlen) - return -1; - - if (npad != 0) + if (extbuf != NULL) { - if (extbuf != NULL) - add_padding (extbuf, offset, npad); + /* Now we can check whether the buffer is large enough. */ + if (data_offset + npad + len > extlen) + return -1; + + add_padding (extbuf, offset, npad); offset += npad; - } - /* Now prepare the option itself. */ - if (extbuf != NULL) - { + /* Now prepare the option itself. */ struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); opt->ip6o_type = type; @@ -124,6 +120,8 @@ inet6_opt_append (void *extbuf, socklen_ *databufp = opt + 1; } + else + offset += npad; return offset + sizeof (struct ip6_opt) + len; } @@ -145,12 +143,14 @@ inet6_opt_finish (void *extbuf, socklen_ /* Required padding at the end. */ int npad = (8 - (offset & 7)) & 7; - /* Make sure the buffer is large enough. */ - if (offset + npad > extlen) - return -1; - if (extbuf != NULL) - add_padding (extbuf, offset, npad); + { + /* Make sure the buffer is large enough. */ + if (offset + npad > extlen) + return -1; + + add_padding (extbuf, offset, npad); + } return offset + npad; } --- libc/inet/Makefile.jj 2007-01-15 23:25:26.000000000 +0100 +++ libc/inet/Makefile 2007-03-15 12:26:53.000000000 +0100 @@ -52,7 +52,7 @@ routines := htonl htons \ aux := check_pf ifreq tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \ - tst-gethnm test-ifaddrs bug-if1 + tst-gethnm test-ifaddrs bug-if1 test-inet6_opt include ../Rules --- libc/inet/test-inet6_opt.c.jj 2007-03-15 11:57:02.000000000 +0100 +++ libc/inet/test-inet6_opt.c 2007-03-15 12:29:21.000000000 +0100 @@ -0,0 +1,207 @@ +#include +#include +#include +#include + +#define OPT_X 42 +#define OPT_Y 43 +#define OPT_Z 44 + +static void * +encode_inet6_opt (socklen_t *elp) +{ + void *eb = NULL; + socklen_t el; + int cl; + void *db; + int offset; + uint8_t val1; + uint16_t val2; + uint32_t val4; + uint64_t val8; + + *elp = 0; +#define CHECK() \ + if (cl == -1) \ + { \ + printf ("cl == -1 on line %d\n", __LINE__); \ + free (eb); \ + return NULL; \ + } + + /* Estimate the length */ + cl = inet6_opt_init (NULL, 0); + CHECK (); + cl = inet6_opt_append (NULL, 0, cl, OPT_X, 12, 8, NULL); + CHECK (); + cl = inet6_opt_append (NULL, 0, cl, OPT_Y, 7, 4, NULL); + CHECK (); + cl = inet6_opt_append (NULL, 0, cl, OPT_Z, 7, 1, NULL); + CHECK (); + cl = inet6_opt_finish (NULL, 0, cl); + CHECK (); + el = cl; + + eb = malloc (el + 8); + if (eb == NULL) + { + puts ("malloc failed"); + return NULL; + } + /* Canary. */ + memcpy (eb + el, "deadbeef", 8); + + cl = inet6_opt_init (eb, el); + CHECK (); + + cl = inet6_opt_append (eb, el, cl, OPT_X, 12, 8, &db); + CHECK (); + val4 = 0x12345678; + offset = inet6_opt_set_val (db, 0, &val4, sizeof (val4)); + val8 = 0x0102030405060708LL; + inet6_opt_set_val (db, offset, &val8, sizeof (val8)); + + cl = inet6_opt_append (eb, el, cl, OPT_Y, 7, 4, &db); + CHECK (); + val1 = 0x01; + offset = inet6_opt_set_val (db, 0, &val1, sizeof (val1)); + val2 = 0x1331; + offset = inet6_opt_set_val (db, offset, &val2, sizeof (val2)); + val4 = 0x01020304; + inet6_opt_set_val (db, offset, &val4, sizeof (val4)); + + cl = inet6_opt_append (eb, el, cl, OPT_Z, 7, 1, &db); + CHECK (); + inet6_opt_set_val (db, 0, (void *) "abcdefg", 7); + + cl = inet6_opt_finish (eb, el, cl); + CHECK (); + + if (memcmp (eb + el, "deadbeef", 8) != 0) + { + puts ("Canary corrupted"); + free (eb); + return NULL; + } + *elp = el; + return eb; +} + +int +decode_inet6_opt (void *eb, socklen_t el) +{ + int ret = 0; + int seq = 0; + int cl = 0; + int offset; + uint8_t type; + socklen_t len; + uint8_t val1; + uint16_t val2; + uint32_t val4; + uint64_t val8; + void *db; + char buf[8]; + + while ((cl = inet6_opt_next (eb, el, cl, &type, &len, &db)) != -1) + switch (type) + { + case OPT_X: + if (seq++ != 0) + { + puts ("OPT_X is not first"); + ret = 1; + } + if (len != 12) + { + printf ("OPT_X's length %d != 12\n", len); + ret = 1; + } + offset = inet6_opt_get_val (db, 0, &val4, sizeof (val4)); + if (val4 != 0x12345678) + { + printf ("OPT_X's val4 %x != 0x12345678\n", val4); + ret = 1; + } + offset = inet6_opt_get_val (db, offset, &val8, sizeof (val8)); + if (offset != len || val8 != 0x0102030405060708LL) + { + printf ("OPT_X's val8 %llx != 0x0102030405060708\n", + (long long) val8); + ret = 1; + } + break; + case OPT_Y: + if (seq++ != 1) + { + puts ("OPT_Y is not second"); + ret = 1; + } + if (len != 7) + { + printf ("OPT_Y's length %d != 7\n", len); + ret = 1; + } + offset = inet6_opt_get_val (db, 0, &val1, sizeof (val1)); + if (val1 != 0x01) + { + printf ("OPT_Y's val1 %x != 0x01\n", val1); + ret = 1; + } + offset = inet6_opt_get_val (db, offset, &val2, sizeof (val2)); + if (val2 != 0x1331) + { + printf ("OPT_Y's val2 %x != 0x1331\n", val2); + ret = 1; + } + offset = inet6_opt_get_val (db, offset, &val4, sizeof (val4)); + if (offset != len || val4 != 0x01020304) + { + printf ("OPT_Y's val4 %x != 0x01020304\n", val4); + ret = 1; + } + break; + case OPT_Z: + if (seq++ != 2) + { + puts ("OPT_Z is not third"); + ret = 1; + } + if (len != 7) + { + printf ("OPT_Z's length %d != 7\n", len); + ret = 1; + } + offset = inet6_opt_get_val (db, 0, buf, 7); + if (offset != len || memcmp (buf, "abcdefg", 7) != 0) + { + buf[7] = '\0'; + printf ("OPT_Z's buf \"%s\" != \"abcdefg\"\n", buf); + ret = 1; + } + break; + default: + printf ("Unknown option %d\n", type); + ret = 1; + break; + } + if (seq != 3) + { + puts ("Didn't see all of OPT_X, OPT_Y and OPT_Z"); + ret = 1; + } + return ret; +} + +int +main (void) +{ + void *eb; + socklen_t el; + eb = encode_inet6_opt (&el); + if (eb == NULL) + return 1; + if (decode_inet6_opt (eb, el)) + return 1; + return 0; +} Jakub From jakub@redhat.com Thu Mar 15 12:35:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 12:35:00 -0000 Subject: [PATCH] Fix updwtmp on 32-bit arches Message-ID: <20070315123939.GN1826@sunsite.mff.cuni.cz> Hi! updwtmp etc. can't apparently handle >= 2GB wtmp on 32-bit architectures. 2007-03-15 Jakub Jelinek [BZ #4130] * login/utmp_file.c (setutent_file): Use O_LARGEFILE for open_not_cancel_2. (updwtmp_file): Likewise. --- libc/login/utmp_file.c.jj 2005-12-14 12:33:40.000000000 +0100 +++ libc/login/utmp_file.c 2007-03-15 13:30:19.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper and Paul Janzen , 1996. @@ -140,11 +140,11 @@ setutent_file (void) file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name); - file_fd = open_not_cancel_2 (file_name, O_RDWR); + file_fd = open_not_cancel_2 (file_name, O_RDWR | O_LARGEFILE); if (file_fd == -1) { /* Hhm, read-write access did not work. Try read-only. */ - file_fd = open_not_cancel_2 (file_name, O_RDONLY); + file_fd = open_not_cancel_2 (file_name, O_RDONLY | O_LARGEFILE); if (file_fd == -1) return 0; } @@ -459,7 +459,7 @@ updwtmp_file (const char *file, const st int fd; /* Open WTMP file. */ - fd = open_not_cancel_2 (file, O_WRONLY); + fd = open_not_cancel_2 (file, O_WRONLY | O_LARGEFILE); if (fd < 0) return -1; Jakub From jakub@redhat.com Thu Mar 15 13:34:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 13:34:00 -0000 Subject: [PATCH] Fix argp-help Message-ID: <20070315133820.GO1826@sunsite.mff.cuni.cz> Hi! I have managed to write a testcase that reproduces the bug reported in BZ#4101. But when that is fixed, I see another crash. argp_help calls _help with state == NULL, this for ARGP_HELP_LONG calls hol_help, also with state == NULL. This can call: if (hhstate.suppressed_dup_arg && uparams.dup_args_note) { const char *tstr = dgettext (state == NULL ? NULL : state->root_argp->argp_domain, "\ Mandatory or optional arguments to long options are also mandatory or \ optional for any corresponding short options."); const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, state ? state->root_argp : 0, state); and as state is NULL, filter_doc is called with argp == NULL. But filter_doc dereferences argp to check argp->argp_filter in the first statement. 2007-03-15 Jakub Jelinek [BZ #4101] * argp/argp-help.c (hol_cluster_cmp): Fix comparisons used to find ancestors with the same depths. Patch by Niels Moeller . (filter_doc): Don't crash if argp is NULL. * argp/Makefile (tests): Add tst-argp2. * argp/tst-argp2.c: New test. --- libc/argp/argp-help.c.jj 2006-05-10 08:28:06.000000000 +0200 +++ libc/argp/argp-help.c 2007-03-15 14:17:18.000000000 +0100 @@ -1,5 +1,6 @@ /* Hierarchial argument parsing help output - Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -672,9 +673,9 @@ hol_cluster_cmp (const struct hol_cluste { /* If one cluster is deeper than the other, use its ancestor at the same level, so that finding the common ancestor is straightforward. */ - while (cl1->depth < cl2->depth) + while (cl1->depth > cl2->depth) cl1 = cl1->parent; - while (cl2->depth < cl1->depth) + while (cl2->depth > cl1->depth) cl2 = cl2->parent; /* Now reduce both clusters to their ancestors at the point where both have @@ -987,7 +988,7 @@ static const char * filter_doc (const char *doc, int key, const struct argp *argp, const struct argp_state *state) { - if (argp->help_filter) + if (argp && argp->help_filter) /* We must apply a user filter to this output. */ { void *input = __argp_input (argp, state); --- libc/argp/Makefile.jj 2006-05-10 00:42:24.000000000 +0200 +++ libc/argp/Makefile 2007-03-15 14:19:32.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright (C) 1997, 2002, 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 1997, 2002, 2003, 2006, 2007 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 @@ -26,7 +26,7 @@ distribute = argp-fmtstream.h argp-namef routines = $(addprefix argp-, ba fmtstream fs-xinl help parse pv \ pvh xinl eexst) -tests = argp-test tst-argp1 bug-argp1 +tests = argp-test tst-argp1 bug-argp1 tst-argp2 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions CFLAGS-argp-parse.c = $(uses-callbacks) --- libc/argp/tst-argp2.c.jj 2007-03-15 13:52:52.000000000 +0100 +++ libc/argp/tst-argp2.c 2007-03-15 14:06:27.000000000 +0100 @@ -0,0 +1,101 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2007. + + 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. */ + +#include + +static const struct argp_option opt1[] = + { + { "opt1", '1', "NUMBER", 0, "Option 1" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt2[] = + { + { "opt2", '2', "NUMBER", 0, "Option 2" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt3[] = + { + { "opt3", '3', "NUMBER", 0, "Option 3" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt4[] = + { + { "opt4", '4', "NUMBER", 0, "Option 4" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt5[] = + { + { "opt5", '5', "NUMBER", 0, "Option 5" }, + { NULL, 0, NULL, 0, NULL } + }; + +static struct argp argp5 = + { + opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL + }; + +static struct argp argp4 = + { + opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL + }; + +static struct argp argp3 = + { + opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL + }; + +static struct argp_child children2[] = + { + { &argp4, 0, "child3", 3 }, + { &argp5, 0, "child4", 4 }, + { NULL, 0, NULL, 0 } + }; + +static struct argp argp2 = + { + opt2, NULL, "args doc2", "doc2", children2, NULL, NULL + }; + +static struct argp_child children1[] = + { + { &argp2, 0, "child1", 1 }, + { &argp3, 0, "child2", 2 }, + { NULL, 0, NULL, 0 } + }; + +static struct argp argp1 = + { + opt1, NULL, "args doc1", "doc1", children1, NULL, NULL + }; + + +static int +do_test (void) +{ + argp_help (&argp1, stdout, ARGP_HELP_LONG, "tst-argp2"); + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" Jakub From jakub@redhat.com Thu Mar 15 17:15:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 17:15:00 -0000 Subject: [PATCH] Fix i386/x86_64 log{,10,2,1p}{,f,l} Message-ID: <20070315171923.GP1826@sunsite.mff.cuni.cz> Hi! As the added tests show, we had some issues in hand written log* assembly: 1) logl(NAN) on x86_64 and log{,f,l}(NAN) on i386 raised FE_INVALID, while it shouldn't, at least neither Domain nor Pole error is documented for x is NaN case in http://www.opengroup.org/onlinepubs/009695399/functions/logl.html 2) log{2,10}l(-HUGE_VALL) on x86_64 didn't raise FE_INVALID, while it was supposed to (Domain error is documented for that the same as it is for negative finite arguments) 3) log1pl(-HUGE_VALL) returned -HUGE_VALL instead of NAN and didn't raise FE_INVALID on x86_64 2) and 3) were caused by broken conversion from sahf: the original i386 code did: sahf; jc 3f; 4: ... 3: jp 4b; (wanted to execute code after jp only for NaN (i.e. (%ah & 0x45) == 1) and code at 4: for other cases. This was converted to andb $1, %ah; jnz 3f; 4: ... 3: jp 4b; but of course jp never branched, because the result of andb was always 1. This can be either done as in the patch below (testb $1, %ah; jnz 3f; 4: ... 3: testb $4, %ah; jnz 4b;) or perhaps could be done as shorter (but more insns in the common case) andb $0x45, %ah; cmpb $1, %ah; jz 3f; 4: ... 3: 2007-03-15 Jakub Jelinek [BZ #3919] * math/libm-test.inc (log_test): Test -Inf and NaN. (log10_test, log1p_test, log2_test): Test -Inf. * sysdeps/i386/fpu/e_log.S (__ieee754_log): Don't raise FE_INVALID when argument is qNaN. * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise. * sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Replace andb $1, %ah with testb $1, %ah, don't test for parity, instead testb $4, %ah and jump if non-zero. * sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise. * sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise. --- libc/math/libm-test.inc.jj 2007-03-13 17:42:15.000000000 +0100 +++ libc/math/libm-test.inc 2007-03-15 16:14:28.000000000 +0100 @@ -4127,7 +4127,9 @@ log_test (void) TEST_f_f (log, 1, 0); TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log, plus_infty, plus_infty); + TEST_f_f (log, nan_value, nan_value); TEST_f_f (log, M_El, 1); TEST_f_f (log, 1.0 / M_El, -1); @@ -4157,6 +4159,7 @@ log10_test (void) /* log10 (x) == NaN plus invalid exception if x < 0. */ TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log10, plus_infty, plus_infty); TEST_f_f (log10, nan_value, nan_value); @@ -4188,6 +4191,7 @@ log1p_test (void) TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION); TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION); + TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log1p, plus_infty, plus_infty); TEST_f_f (log1p, nan_value, nan_value); @@ -4218,6 +4222,7 @@ log2_test (void) TEST_f_f (log2, 1, 0); TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log2, plus_infty, plus_infty); TEST_f_f (log2, nan_value, nan_value); --- libc/sysdeps/i386/fpu/e_log.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_log.S 2007-03-15 17:57:18.000000000 +0100 @@ -36,11 +36,15 @@ limit: .double 0.29 ENTRY(__ieee754_log) fldln2 // log(2) fldl 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -54,4 +58,9 @@ ENTRY(__ieee754_log) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_log) --- libc/sysdeps/i386/fpu/e_logf.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_logf.S 2007-03-15 17:56:15.000000000 +0100 @@ -37,11 +37,15 @@ limit: .double 0.29 ENTRY(__ieee754_logf) fldln2 // log(2) flds 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -55,4 +59,9 @@ ENTRY(__ieee754_logf) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_logf) --- libc/sysdeps/i386/fpu/e_logl.S.jj 2005-05-04 19:45:15.000000000 +0200 +++ libc/sysdeps/i386/fpu/e_logl.S 2007-03-15 17:54:29.000000000 +0100 @@ -37,11 +37,15 @@ limit: .double 0.29 ENTRY(__ieee754_logl) fldln2 // log(2) fldt 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -55,4 +59,9 @@ ENTRY(__ieee754_logl) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_logl) --- libc/sysdeps/x86_64/fpu/s_log1pl.S.jj 2001-09-19 12:24:08.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/s_log1pl.S 2007-03-15 17:47:56.000000000 +0100 @@ -45,7 +45,7 @@ ENTRY(__log1pl) fxam fnstsw fld %st - andb $1,%ah + testb $1, %ah jnz 3f // in case x is NaN or ??Inf 4: fabs @@ -62,7 +62,8 @@ ENTRY(__log1pl) 2: fyl2xp1 ret -3: jp 4b // in case x is ??Inf +3: testb $4, %ah + jnz 4b // in case x is ??Inf fstp %st(1) fstp %st(1) ret --- libc/sysdeps/x86_64/fpu/e_log10l.S.jj 2001-09-19 12:24:08.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/e_log10l.S 2007-03-15 17:46:02.000000000 +0100 @@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l) fxam fnstsw fld %st // x : x : log10(2) - andb $1,%ah + testb $1, %ah jnz 3f // in case x is NaN or ??Inf 4: fsubl MO(one) // x-1 : x : log10(2) fld %st // x-1 : x-1 : x : log10(2) @@ -59,7 +59,8 @@ ENTRY(__ieee754_log10l) fyl2x // log10(x) ret -3: jp 4b // in case x is ??Inf +3: testb $4, %ah + jnz 4b // in case x is ??Inf fstp %st(1) fstp %st(1) ret --- libc/sysdeps/x86_64/fpu/e_log2l.S.jj 2001-09-19 12:24:08.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/e_log2l.S 2007-03-15 17:45:27.000000000 +0100 @@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l) fxam fnstsw fld %st // x : x : 1 - andb $1,%ah + testb $1, %ah jnz 3f // in case x is NaN or ??Inf 4: fsub %st(2), %st // x-1 : x : 1 fld %st // x-1 : x-1 : x : 1 @@ -56,7 +56,8 @@ ENTRY(__ieee754_log2l) fyl2x // log(x) ret -3: jp 4b // in case x is ??Inf +3: testb $4, %ah + jnz 4b // in case x is ??Inf fstp %st(1) fstp %st(1) ret --- libc/sysdeps/x86_64/fpu/e_logl.S.jj 2001-09-19 12:24:08.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/e_logl.S 2007-03-15 17:46:16.000000000 +0100 @@ -38,8 +38,12 @@ limit: .double 0.29 ENTRY(__ieee754_logl) fldln2 // log(2) fldt 8(%rsp) // x : log(2) + fxam + fnstsw fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + testb $1, %ah + jnz 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -53,4 +57,10 @@ ENTRY(__ieee754_logl) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: testb $4, %ah + jnz 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_logl) Jakub From jakub@redhat.com Thu Mar 15 22:20:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Mar 2007 22:20:00 -0000 Subject: [PATCH] Robustify localedef Message-ID: <20070315222344.GQ1826@sunsite.mff.cuni.cz> Hi! cd /etc/sysconfig localedef hu_HU.iso88592 -i hu_HU -f iso88592 segfaults after printing a bunch of various errors (errors are ok and expected, but the segfault is not). /etc/sysconfig is just a random directory that contains for localedef bogus i18n source: LANG="en_US.UTF-8" SYSFONT="latarcyrheb-sun16" and in addition to this user error there is also invalid charmap name. With this, localedef calls find_translit eventhough there is locale->categories[LC_CTYPE].ctype == NULL (locale->avail has CTYPE_LOCALE bit set only because locfile_read ors it at the end with not_here). When locale->categories[LC_CTYPE].ctype == NULL, we know localedef will warn and set LC_CTYPE category to a default, which certainly has both translit and translit_include set to NULL, so IMHO returning NULL from find_translit in this case right away is the right thing to do. 2007-03-15 Jakub Jelinek * locale/programs/ld-ctype.c (find_translit): Return NULL if ctype is NULL. --- libc/locale/programs/ld-ctype.c.jj 2006-11-16 17:38:02.000000000 +0100 +++ libc/locale/programs/ld-ctype.c 2007-03-15 22:46:37.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -1866,6 +1866,9 @@ find_translit (struct localedef_t *local assert (locale != NULL); ctype = locale->categories[LC_CTYPE].ctype; + if (ctype == NULL) + return NULL; + if (ctype->translit != NULL) result = find_translit2 (ctype, charmap, wch); Jakub From jakub@redhat.com Fri Mar 16 17:14:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 16 Mar 2007 17:14:00 -0000 Subject: [PATCH] Updated __extern_inline patch Message-ID: <20070316171759.GR1826@sunsite.mff.cuni.cz> Hi! This is my Nov'06 __extern_inline patch updated for current tree. GCC 4.3 now has -fgnu89-inline switch which restores the sane inline semantics even with -std=gnu99 and -std=c99 and this patch adds that to glibc's configury, therefore only installed headers need to be tweaked. 2007-03-16 Jakub Jelinek * configure.in (libc_cv_gnu89_inline): Test for -fgnu89-inline. * configure: Rebuilt. * config.make.in (gnu89-inline-CFLAGS): New variable. * Makeconfig (CFLAGS): Use $(gnu89-inline-CFLAGS) together with -std=gnu99. * misc/sys/cdefs.h (__extern_inline, __extern_always_inline): Define. * argp/argp.h: Use it. * bits/mathinline.h: Likewise. * bits/sigset.h: Likewise. * bits/string.h: Likewise. * ctype/ctype.h: Likewise. * hurd/hurd.h: Likewise. * hurd/hurd/fd.h: Likewise. * hurd/hurd/port.h: Likewise. * hurd/hurd/signal.h: Likewise. * hurd/hurd/threadvar.h: Likewise. * hurd/hurd/userlink.h: Likewise. * io/sys/stat.h: Likewise. * libio/bits/stdio.h: Likewise. * libio/bits/stdio2.h: Likewise. * mach/lock-intern.h: Likewise. * mach/mach/mig_support.h: Likewise. * math/bits/cmathcalls.h: Likewise. * posix/bits/unistd.h: Likewise. * socket/bits/socket2.h: Likewise. * stdlib/bits/stdlib.h: Likewise. * stdlib/stdlib.h: Likewise. * string/argz.h: Likewise. * string/bits/string2.h: Likewise. * string/bits/string3.h: Likewise. * sysdeps/alpha/fpu/bits/mathinline.h: Likewise. * sysdeps/generic/inttypes.h: Likewise. * sysdeps/generic/machine-lock.h: Likewise. * sysdeps/generic/machine-sp.h: Likewise. * sysdeps/i386/fpu/bits/mathinline.h: Likewise. * sysdeps/i386/i486/bits/string.h: Likewise. * sysdeps/ia64/fpu/bits/mathinline.h: Likewise. * sysdeps/mach/alpha/machine-lock.h: Likewise. * sysdeps/mach/alpha/machine-sp.h: Likewise. * sysdeps/mach/i386/machine-lock.h: Likewise. * sysdeps/mach/powerpc/machine-lock.h: Likewise. * sysdeps/mach/powerpc/machine-sp.h: Likewise. * sysdeps/powerpc/fpu/bits/mathinline.h: Likewise. * sysdeps/s390/bits/string.h: Likewise. * sysdeps/s390/fpu/bits/mathinline.h: Likewise. * sysdeps/sparc/fpu/bits/mathinline.h: Likewise. * sysdeps/unix/bsd/bsd4.4/bits/socket.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigset.h: Likewise. * sysdeps/unix/sysv/linux/bits/socket.h: Likewise. * sysdeps/unix/sysv/linux/sys/sysmacros.h: Likewise. * sysdeps/x86_64/fpu/bits/mathinline.h: Likewise. * wcsmbs/bits/wchar2.h: Likewise. * wcsmbs/wchar.h: Likewise. * stdlib/gmp.h: Likewise. Include to get __extern_inline definition. nptl/ * sysdeps/pthread/bits/libc-lock.h: Use __extern_inline and __extern_always_inline where appropriate. * sysdeps/pthread/pthread.h: Likewise. --- libc/misc/sys/cdefs.h.jj 2006-01-14 21:14:36.000000000 +0100 +++ libc/misc/sys/cdefs.h 2007-03-16 15:48:53.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006 +/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -279,6 +279,17 @@ # define __always_inline __inline #endif +/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. */ +#ifdef __GNUC_STDC_INLINE__ +# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) +# define __extern_always_inline \ + extern __always_inline __attribute__ ((__gnu_inline__)) +#else +# define __extern_inline extern __inline +# define __extern_always_inline extern __always_inline +#endif + /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before --- libc/mach/mach/mig_support.h.jj 2001-07-06 06:55:35.000000000 +0200 +++ libc/mach/mach/mig_support.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,94,97,99,2001 Free Software Foundation, Inc. +/* Copyright (C) 1993,94,97,99,2001,2007 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 @@ -67,12 +67,12 @@ extern void mig_reply_setup (const mach_ /* Idiocy support function. */ extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len); extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t); -extern __inline vm_size_t +__extern_inline vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t __len) { return __stpncpy (__dst, __src, __len) - __dst; } -extern __inline vm_size_t +__extern_inline vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len) { return __mig_strncpy (__dst, __src, __len); --- libc/mach/lock-intern.h.jj 2001-07-06 06:55:34.000000000 +0200 +++ libc/mach/lock-intern.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1996, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ #include #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif --- libc/config.make.in.jj 2006-10-31 23:05:27.000000000 +0100 +++ libc/config.make.in 2007-03-16 16:58:02.000000000 +0100 @@ -53,6 +53,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_as enable-check-abi = @enable_check_abi@ have-forced-unwind = @libc_cv_forced_unwind@ have-fpie = @libc_cv_fpie@ +gnu89-inline-CFLAGS = @libc_cv_gnu89_inline@ have-ssp = @libc_cv_ssp@ have-selinux = @have_selinux@ have-libaudit = @have_libaudit@ --- libc/stdlib/stdlib.h.jj 2006-10-31 23:05:34.000000000 +0100 +++ libc/stdlib/stdlib.h 2007-03-16 17:01:25.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2003,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991-2003,2004,2005,2006,2007 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 @@ -324,18 +324,18 @@ extern unsigned long long int __strtoull /* Define inline functions which call the internal entry points. */ __BEGIN_NAMESPACE_STD -extern __inline double +__extern_inline double __NTH (strtod (__const char *__restrict __nptr, char **__restrict __endptr)) { return __strtod_internal (__nptr, __endptr, 0); } -extern __inline long int +__extern_inline long int __NTH (strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base)) { return __strtol_internal (__nptr, __endptr, __base, 0); } -extern __inline unsigned long int +__extern_inline unsigned long int __NTH (strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base)) { @@ -345,13 +345,13 @@ __END_NAMESPACE_STD # ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 -extern __inline float +__extern_inline float __NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr)) { return __strtof_internal (__nptr, __endptr, 0); } # ifndef __LDBL_COMPAT -extern __inline long double +__extern_inline long double __NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr)) { return __strtold_internal (__nptr, __endptr, 0); @@ -361,13 +361,13 @@ __END_NAMESPACE_C99 # endif # ifdef __USE_BSD -__extension__ extern __inline long long int +__extension__ __extern_inline long long int __NTH (strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base)) { return __strtoll_internal (__nptr, __endptr, __base, 0); } -__extension__ extern __inline unsigned long long int +__extension__ __extern_inline unsigned long long int __NTH (strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base)) { @@ -377,13 +377,13 @@ __NTH (strtouq (__const char *__restrict # if defined __USE_MISC || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 -__extension__ extern __inline long long int +__extension__ __extern_inline long long int __NTH (strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base)) { return __strtoll_internal (__nptr, __endptr, __base, 0); } -__extension__ extern __inline unsigned long long int +__extension__ __extern_inline unsigned long long int __NTH (strtoull (__const char * __restrict __nptr, char **__restrict __endptr, int __base)) { @@ -393,17 +393,17 @@ __END_NAMESPACE_C99 # endif __BEGIN_NAMESPACE_STD -extern __inline double +__extern_inline double __NTH (atof (__const char *__nptr)) { return strtod (__nptr, (char **) NULL); } -extern __inline int +__extern_inline int __NTH (atoi (__const char *__nptr)) { return (int) strtol (__nptr, (char **) NULL, 10); } -extern __inline long int +__extern_inline long int __NTH (atol (__const char *__nptr)) { return strtol (__nptr, (char **) NULL, 10); @@ -412,7 +412,7 @@ __END_NAMESPACE_STD # if defined __USE_MISC || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 -__extension__ extern __inline long long int +__extension__ __extern_inline long long int __NTH (atoll (__const char *__nptr)) { return strtoll (__nptr, (char **) NULL, 10); --- libc/stdlib/bits/stdlib.h.jj 2005-08-22 17:06:07.000000000 +0200 +++ libc/stdlib/bits/stdlib.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,5 +1,5 @@ /* Checking macros for stdlib functions. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2007 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,7 +28,7 @@ extern char *__REDIRECT_NTH (__realpath_ (__const char *__restrict __name, char *__restrict __resolved), realpath) __wur; -extern __always_inline __wur char * +__extern_always_inline __wur char * __NTH (realpath (__const char *__restrict __name, char *__restrict __resolved)) { if (__bos (__resolved) != (size_t) -1) @@ -44,7 +44,7 @@ extern int __REDIRECT_NTH (__ptsname_r_a size_t __buflen), ptsname_r) __nonnull ((2)); -extern __always_inline int +__extern_always_inline int __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 @@ -59,7 +59,7 @@ extern int __wctomb_chk (char *__s, wcha extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar), wctomb) __wur; -extern __always_inline __wur int +__extern_always_inline __wur int __NTH (wctomb (char *__s, wchar_t __wchar)) { /* We would have to include to get a definition of MB_LEN_MAX. @@ -83,7 +83,7 @@ extern size_t __REDIRECT_NTH (__mbstowcs __const char *__restrict __src, size_t __len), mbstowcs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src, size_t __len)) { @@ -104,7 +104,7 @@ extern size_t __REDIRECT_NTH (__wcstombs __const wchar_t *__restrict __src, size_t __len), wcstombs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src, size_t __len)) { --- libc/stdlib/gmp.h.jj 2002-08-27 00:39:44.000000000 +0200 +++ libc/stdlib/gmp.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,6 +1,6 @@ /* gmp.h -- Definitions for GNU multiple precision functions. -Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1995, 1996, 2007 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -21,6 +21,8 @@ MA 02111-1307, USA. */ #ifndef __GMP_H__ +#include + #ifndef __GNU_MP__ #define __GNU_MP__ 2 #define __need_size_t @@ -41,7 +43,7 @@ MA 02111-1307, USA. */ #ifndef _EXTERN_INLINE #ifdef __GNUC__ -#define _EXTERN_INLINE extern __inline__ +#define _EXTERN_INLINE __extern_inline #else #define _EXTERN_INLINE static #endif --- libc/ctype/ctype.h.jj 2004-09-08 00:23:45.000000000 +0200 +++ libc/ctype/ctype.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,2002,2004 +/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,2002,2004,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -187,13 +187,13 @@ __exctype (_tolower); # endif # ifdef __USE_EXTERN_INLINES -extern __inline int +__extern_inline int __NTH (tolower (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c; } -extern __inline int +__extern_inline int __NTH (toupper (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c; --- libc/nptl/sysdeps/pthread/bits/libc-lock.h.jj 2007-01-17 11:18:43.000000000 +0100 +++ libc/nptl/sysdeps/pthread/bits/libc-lock.h 2007-03-16 15:29:22.000000000 +0100 @@ -414,7 +414,7 @@ extern void _pthread_cleanup_pop_restore /* Normal cleanup handling, based on C cleanup attribute. */ -extern __inline void +__extern_inline void __libc_cleanup_routine (struct __pthread_cleanup_frame *f) { if (f->__do_it) --- libc/nptl/sysdeps/pthread/pthread.h.jj 2007-01-03 11:04:36.000000000 +0100 +++ libc/nptl/sysdeps/pthread/pthread.h 2007-03-16 17:01:34.000000000 +0100 @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + 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 @@ -572,7 +573,7 @@ class __pthread_cleanup_class function the compiler is free to decide inlining the change when needed or fall back on the copy which must exist somewhere else. */ -extern __inline void +__extern_inline void __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) { if (__frame->__do_it) @@ -1103,7 +1104,7 @@ extern int pthread_atfork (void (*__prep #ifdef __USE_EXTERN_INLINES /* Optimizations. */ -extern __inline int +__extern_inline int __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) { return __thread1 == __thread2; --- libc/configure.in.jj 2006-11-06 20:53:08.000000000 +0100 +++ libc/configure.in 2007-03-16 16:57:42.000000000 +0100 @@ -1641,6 +1641,30 @@ fi rm -f conftest*]) AC_SUBST(libc_cv_ssp) +AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl +cat > conftest.c <&AS_MESSAGE_LOG_FD]) +then + libc_cv_gnu89_inline=yes +else + libc_cv_gnu89_inline=no +fi +rm -f conftest*]) +if test $libc_cv_gnu89_inline = yes; then + libc_cv_gnu89_inline=-fgnu89-inline +else + libc_cv_gnu89_inline= +fi +AC_SUBST(libc_cv_gnu89_inline) + if test $elf != yes; then AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini, [AC_TRY_COMPILE(, [asm (".section .init"); --- libc/bits/mathinline.h.jj 1997-10-13 05:53:18.000000000 +0200 +++ libc/bits/mathinline.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,6 +1,6 @@ /* This file should provide inline versions of math functions. - Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'. + Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. This file should define __MATH_INLINES if functions are actually defined as inlines. */ --- libc/bits/string.h.jj 1997-10-13 05:53:19.000000000 +0200 +++ libc/bits/string.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,6 +1,6 @@ /* This file should provide inline versions of string functions. - Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'. + Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. This file should define __STRING_INLINES if functions are actually defined as inlines. */ --- libc/bits/sigset.h.jj 2001-07-06 06:55:50.000000000 +0200 +++ libc/bits/sigset.h 2007-03-16 15:29:22.000000000 +0100 @@ -1,5 +1,6 @@ /* __sig_atomic_t, __sigset_t, and related definitions. Generic/BSD version. - Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007 + 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 @@ -38,7 +39,7 @@ typedef unsigned long int __sigset_t; #define _SIGSET_H_fns 1 #ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline #endif /* Return a mask that includes SIG only. The cast to `sigset_t' avoids --- libc/libio/bits/stdio.h.jj 2004-09-08 00:23:44.000000000 +0200 +++ libc/libio/bits/stdio.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Optimizing macros and inline functions for stdio functions. - Copyright (C) 1998, 2000, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001, 2004, 2007 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 @@ -24,7 +24,7 @@ #ifdef __cplusplus # define __STDIO_INLINE inline #else -# define __STDIO_INLINE extern __inline +# define __STDIO_INLINE __extern_inline #endif --- libc/libio/bits/stdio2.h.jj 2005-03-19 01:14:58.000000000 +0100 +++ libc/libio/bits/stdio2.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Checking macros for stdio functions. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007 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 @@ -75,7 +75,7 @@ extern int __vprintf_chk (int __flag, __ extern char *__gets_chk (char *__str, size_t) __wur; extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur; -extern __always_inline __wur char * +__extern_always_inline __wur char * gets (char *__str) { if (__bos (__str) != (size_t) -1) @@ -89,7 +89,7 @@ extern char *__REDIRECT (__fgets_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets) __wur; -extern __always_inline __wur char * +__extern_always_inline __wur char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 @@ -105,7 +105,7 @@ extern char *__REDIRECT (__fgets_unlocke (char *__restrict __s, int __n, FILE *__restrict __stream), fgets_unlocked) __wur; -extern __always_inline __wur char * +__extern_always_inline __wur char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 --- libc/argp/argp.h.jj 2006-04-22 17:08:26.000000000 +0200 +++ libc/argp/argp.h 2007-03-16 17:01:47.000000000 +0100 @@ -1,5 +1,6 @@ /* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-1999,2003,2004,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -558,7 +559,7 @@ extern void *__argp_input (__const struc # endif # ifndef ARGP_EI -# define ARGP_EI extern __inline__ +# define ARGP_EI __extern_inline # endif ARGP_EI void --- libc/configure.jj 2006-11-06 20:53:08.000000000 +0100 +++ libc/configure 2007-03-16 17:05:21.000000000 +0100 @@ -313,7 +313,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5959,6 +5959,42 @@ echo "$as_me:$LINENO: result: $libc_cv_s echo "${ECHO_T}$libc_cv_ssp" >&6 +echo "$as_me:$LINENO: checking for -fgnu89-inline" >&5 +echo $ECHO_N "checking for -fgnu89-inline... $ECHO_C" >&6 +if test "${libc_cv_gnu89_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } +then + libc_cv_gnu89_inline=yes +else + libc_cv_gnu89_inline=no +fi +rm -f conftest* +fi +echo "$as_me:$LINENO: result: $libc_cv_gnu89_inline" >&5 +echo "${ECHO_T}$libc_cv_gnu89_inline" >&6 +if test $libc_cv_gnu89_inline = yes; then + libc_cv_gnu89_inline=-fgnu89-inline +else + libc_cv_gnu89_inline= +fi + + if test $elf != yes; then echo "$as_me:$LINENO: checking for .init and .fini sections" >&5 echo $ECHO_N "checking for .init and .fini sections... $ECHO_C" >&6 @@ -8517,6 +8553,7 @@ s,@libc_cv_fpie@,$libc_cv_fpie,;t t s,@libc_cv_hashstyle@,$libc_cv_hashstyle,;t t s,@fno_unit_at_a_time@,$fno_unit_at_a_time,;t t s,@libc_cv_ssp@,$libc_cv_ssp,;t t +s,@libc_cv_gnu89_inline@,$libc_cv_gnu89_inline,;t t s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t s,@no_whole_archive@,$no_whole_archive,;t t s,@exceptions@,$exceptions,;t t --- libc/io/sys/stat.h.jj 2006-01-06 13:14:05.000000000 +0100 +++ libc/io/sys/stat.h 2007-03-16 17:02:03.000000000 +0100 @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007 + 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 @@ -430,28 +431,28 @@ extern int __xmknodat (int __ver, int __ #if defined __GNUC__ && __GNUC__ >= 2 /* Inlined versions of the real stat and mknod functions. */ -extern __inline__ int +__extern_inline int __NTH (stat (__const char *__path, struct stat *__statbuf)) { return __xstat (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern __inline__ int +__extern_inline int __NTH (lstat (__const char *__path, struct stat *__statbuf)) { return __lxstat (_STAT_VER, __path, __statbuf); } # endif -extern __inline__ int +__extern_inline int __NTH (fstat (int __fd, struct stat *__statbuf)) { return __fxstat (_STAT_VER, __fd, __statbuf); } # ifdef __USE_ATFILE -extern __inline__ int +__extern_inline int __NTH (fstatat (int __fd, __const char *__filename, struct stat *__statbuf, int __flag)) { @@ -460,7 +461,7 @@ __NTH (fstatat (int __fd, __const char * # endif # if defined __USE_MISC || defined __USE_BSD -extern __inline__ int +__extern_inline int __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev)) { return __xmknod (_MKNOD_VER, __path, __mode, &__dev); @@ -468,7 +469,7 @@ __NTH (mknod (__const char *__path, __mo # endif # ifdef __USE_ATFILE -extern __inline__ int +__extern_inline int __NTH (mknodat (int __fd, __const char *__path, __mode_t __mode, __dev_t __dev)) { @@ -479,28 +480,28 @@ __NTH (mknodat (int __fd, __const char * # if defined __USE_LARGEFILE64 \ && (! defined __USE_FILE_OFFSET64 \ || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) -extern __inline__ int +__extern_inline int __NTH (stat64 (__const char *__path, struct stat64 *__statbuf)) { return __xstat64 (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern __inline__ int +__extern_inline int __NTH (lstat64 (__const char *__path, struct stat64 *__statbuf)) { return __lxstat64 (_STAT_VER, __path, __statbuf); } # endif -extern __inline__ int +__extern_inline int __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) { return __fxstat64 (_STAT_VER, __fd, __statbuf); } # ifdef __USE_GNU -extern __inline__ int +__extern_inline int __NTH (fstatat64 (int __fd, __const char *__filename, struct stat64 *__statbuf, int __flag)) { --- libc/wcsmbs/wchar.h.jj 2007-02-26 18:13:49.000000000 +0100 +++ libc/wcsmbs/wchar.h 2007-03-16 15:29:23.000000000 +0100 @@ -326,19 +326,19 @@ __END_NAMESPACE_C99 locales must use ASCII encoding for the values in the ASCII range and because the wchar_t encoding is always ISO 10646. */ extern wint_t __btowc_alias (int __c) __asm ("btowc"); -extern __inline wint_t +__extern_inline wint_t __NTH (btowc (int __c)) { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' ? (wint_t) __c : __btowc_alias (__c)); } extern int __wctob_alias (wint_t __c) __asm ("wctob"); -extern __inline int +__extern_inline int __NTH (wctob (wint_t __wc)) { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f' ? (int) __wc : __wctob_alias (__wc)); } # endif -extern __inline size_t +__extern_inline size_t __NTH (mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps)) { return (__ps != NULL @@ -548,38 +548,38 @@ extern unsigned long long int __wcstoull /* Define inline functions which call the internal entry points. */ __BEGIN_NAMESPACE_C99 -extern __inline double +__extern_inline double __NTH (wcstod (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr)) { return __wcstod_internal (__nptr, __endptr, 0); } -extern __inline long int +__extern_inline long int __NTH (wcstol (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)) { return __wcstol_internal (__nptr, __endptr, __base, 0); } -extern __inline unsigned long int +__extern_inline unsigned long int __NTH (wcstoul (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)) { return __wcstoul_internal (__nptr, __endptr, __base, 0); } __END_NAMESPACE_C99 # ifdef __USE_GNU -extern __inline float +__extern_inline float __NTH (wcstof (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr)) { return __wcstof_internal (__nptr, __endptr, 0); } # ifndef __LDBL_COMPAT -extern __inline long double +__extern_inline long double __NTH (wcstold (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr)) { return __wcstold_internal (__nptr, __endptr, 0); } # endif __extension__ -extern __inline long long int +__extern_inline long long int __NTH (wcstoq (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)) { return __wcstoll_internal (__nptr, __endptr, __base, 0); } __extension__ -extern __inline unsigned long long int +__extern_inline unsigned long long int __NTH (wcstouq (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)) { return __wcstoull_internal (__nptr, __endptr, __base, 0); } --- libc/wcsmbs/bits/wchar2.h.jj 2006-01-14 13:09:47.000000000 +0100 +++ libc/wcsmbs/bits/wchar2.h 2007-03-16 17:02:07.000000000 +0100 @@ -1,5 +1,5 @@ /* Checking macros for wchar functions. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 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 @@ -30,7 +30,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemcp __const wchar_t *__restrict __s2, size_t __n), wmemcpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n)) { @@ -46,7 +46,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemmo __const wchar_t *__s2, size_t __n), wmemmove); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n)) { @@ -65,7 +65,7 @@ extern wchar_t *__REDIRECT_NTH (__wmempc __const wchar_t *__restrict __s2, size_t __n), wmempcpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n)) { @@ -81,7 +81,7 @@ extern wchar_t *__wmemset_chk (wchar_t * extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, size_t __n), wmemset); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n)) { if (__bos0 (__s) != (size_t) -1) @@ -97,7 +97,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src), wcscpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) @@ -112,7 +112,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy __const wchar_t *__src), wcpcpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) @@ -129,7 +129,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsncp __const wchar_t *__restrict __src, size_t __n), wcsncpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 @@ -148,7 +148,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpncp __const wchar_t *__restrict __src, size_t __n), wcpncpy); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 @@ -166,7 +166,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src), wcscat); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcscat (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) @@ -183,7 +183,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsnca __const wchar_t *__restrict __src, size_t __n), wcsncat); -extern __always_inline wchar_t * +__extern_always_inline wchar_t * __NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1) @@ -246,7 +246,7 @@ extern wchar_t *__REDIRECT (__fgetws_ali (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream), fgetws) __wur; -extern __always_inline __wur wchar_t * +__extern_always_inline __wur wchar_t * fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 @@ -264,7 +264,7 @@ extern wchar_t *__REDIRECT (__fgetws_unl __FILE *__restrict __stream), fgetws_unlocked) __wur; -extern __always_inline __wur wchar_t * +__extern_always_inline __wur wchar_t * fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 @@ -281,7 +281,7 @@ extern size_t __REDIRECT_NTH (__wcrtomb_ (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps), wcrtomb) __wur; -extern __always_inline __wur size_t +__extern_always_inline __wur size_t __NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps)) { /* We would have to include to get a definition of MB_LEN_MAX. @@ -307,7 +307,7 @@ extern size_t __REDIRECT_NTH (__mbsrtowc size_t __len, mbstate_t *__restrict __ps), mbsrtowcs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { @@ -330,7 +330,7 @@ extern size_t __REDIRECT_NTH (__wcsrtomb size_t __len, mbstate_t *__restrict __ps), wcsrtombs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { @@ -352,7 +352,7 @@ extern size_t __REDIRECT_NTH (__mbsnrtow size_t __len, mbstate_t *__restrict __ps), mbsnrtowcs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) { @@ -376,7 +376,7 @@ extern size_t __REDIRECT_NTH (__wcsnrtom size_t __nwc, size_t __len, mbstate_t *__restrict __ps), wcsnrtombs); -extern __always_inline size_t +__extern_always_inline size_t __NTH (wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) { --- libc/socket/bits/socket2.h.jj 2005-08-08 21:00:53.000000000 +0200 +++ libc/socket/bits/socket2.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Checking macros for socket functions. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2007 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 @@ -26,7 +26,7 @@ extern ssize_t __recv_chk (int __fd, voi extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, int __flags), recv); -extern __always_inline ssize_t +__extern_always_inline ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { if (__bos0 (__buf) != (size_t) -1 @@ -44,7 +44,7 @@ extern ssize_t __REDIRECT (__recvfrom_al int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), recvfrom); -extern __always_inline ssize_t +__extern_always_inline ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { --- libc/posix/bits/unistd.h.jj 2006-08-24 08:47:31.000000000 +0200 +++ libc/posix/bits/unistd.h 2007-03-16 17:02:14.000000000 +0100 @@ -1,5 +1,5 @@ /* Checking macros for unistd functions. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 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 @@ -26,7 +26,7 @@ extern ssize_t __read_chk (int __fd, voi extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, size_t __nbytes), read) __wur; -extern __always_inline __wur ssize_t +__extern_always_inline __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { if (__bos0 (__buf) != (size_t) -1 @@ -48,7 +48,7 @@ extern ssize_t __REDIRECT (__pread64_ali __off64_t __offset), pread64) __wur; # ifndef __USE_FILE_OFFSET64 -extern __always_inline __wur ssize_t +__extern_always_inline __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -57,7 +57,7 @@ pread (int __fd, void *__buf, size_t __n return __pread_alias (__fd, __buf, __nbytes, __offset); } # else -extern __always_inline __wur ssize_t +__extern_always_inline __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -68,7 +68,7 @@ pread (int __fd, void *__buf, size_t __n # endif # ifdef __USE_LARGEFILE64 -extern __always_inline __wur ssize_t +__extern_always_inline __wur ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -89,7 +89,7 @@ extern ssize_t __REDIRECT_NTH (__readlin char *__restrict __buf, size_t __len), readlink) __nonnull ((1, 2)) __wur; -extern __always_inline __nonnull ((1, 2)) __wur ssize_t +__extern_always_inline __nonnull ((1, 2)) __wur ssize_t __NTH (readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len)) { @@ -111,7 +111,7 @@ extern ssize_t __REDIRECT_NTH (__readlin readlinkat) __nonnull ((2, 3)) __wur; -extern __always_inline __nonnull ((2, 3)) __wur ssize_t +__extern_always_inline __nonnull ((2, 3)) __wur ssize_t __NTH (readlinkat (int __fd, __const char *__restrict __path, char *__restrict __buf, size_t __len)) { @@ -127,7 +127,7 @@ extern char *__getcwd_chk (char *__buf, extern char *__REDIRECT_NTH (__getcwd_alias, (char *__buf, size_t __size), getcwd) __wur; -extern __always_inline __wur char * +__extern_always_inline __wur char * __NTH (getcwd (char *__buf, size_t __size)) { if (__bos (__buf) != (size_t) -1 @@ -142,7 +142,7 @@ extern char *__getwd_chk (char *__buf, s extern char *__REDIRECT_NTH (__getwd_alias, (char *__buf), getwd) __nonnull ((1)) __wur; -extern __always_inline __nonnull ((1)) __attribute_deprecated__ __wur char * +__extern_always_inline __nonnull ((1)) __attribute_deprecated__ __wur char * __NTH (getwd (char *__buf)) { if (__bos (__buf) != (size_t) -1) @@ -156,7 +156,7 @@ extern size_t __confstr_chk (int __name, extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, size_t __len), confstr); -extern __always_inline size_t +__extern_always_inline size_t __NTH (confstr (int __name, char *__buf, size_t __len)) { if (__bos (__buf) != (size_t) -1 @@ -171,7 +171,7 @@ extern int __getgroups_chk (int __size, extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), getgroups) __wur; -extern __always_inline int +__extern_always_inline int __NTH (getgroups (int __size, __gid_t __list[])) { if (__bos (__list) != (size_t) -1 @@ -188,7 +188,7 @@ extern int __REDIRECT_NTH (__ttyname_r_a size_t __buflen), ttyname_r) __nonnull ((2)); -extern __always_inline int +__extern_always_inline int __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 @@ -204,7 +204,7 @@ extern int __getlogin_r_chk (char *__buf extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), getlogin_r) __nonnull ((1)); -extern __always_inline int +__extern_always_inline int getlogin_r (char *__buf, size_t __buflen) { if (__bos (__buf) != (size_t) -1 @@ -221,7 +221,7 @@ extern int __gethostname_chk (char *__bu extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), gethostname) __nonnull ((1)); -extern __always_inline int +__extern_always_inline int __NTH (gethostname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 @@ -239,7 +239,7 @@ extern int __REDIRECT_NTH (__getdomainna size_t __buflen), getdomainname) __nonnull ((1)) __wur; -extern __always_inline int +__extern_always_inline int __NTH (getdomainname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 --- libc/string/bits/string3.h.jj 2005-08-08 21:02:31.000000000 +0200 +++ libc/string/bits/string3.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2007 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 @@ -151,7 +151,7 @@ extern char *__REDIRECT_NTH (__stpncpy_a __const char *__src, size_t __n), stpncpy); -extern __always_inline char * +__extern_always_inline char * __NTH (stpncpy (char *__dest, __const char *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 --- libc/string/bits/string2.h.jj 2004-05-28 08:39:13.000000000 +0200 +++ libc/string/bits/string2.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-independant string function optimizations. - Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997-2003, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -43,7 +43,7 @@ # ifdef __cplusplus # define __STRING_INLINE inline # else -# define __STRING_INLINE extern __inline +# define __STRING_INLINE __extern_inline # endif #endif --- libc/string/argz.h.jj 2004-09-08 00:23:43.000000000 +0200 +++ libc/string/argz.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Routines for dealing with '\0' separated arg vectors. - Copyright (C) 1995,96,97,98,99,2000,2004 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2000,2004,2007 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 @@ -160,7 +160,7 @@ extern char *argz_next (__const char *__ __const char *__restrict __entry) __THROW; #ifdef __USE_EXTERN_INLINES -extern inline char * +__extern_inline char * __NTH (__argz_next (__const char *__argz, size_t __argz_len, __const char *__entry)) { @@ -174,7 +174,7 @@ __NTH (__argz_next (__const char *__argz else return __argz_len > 0 ? (char *) __argz : 0; } -extern inline char * +__extern_inline char * __NTH (argz_next (__const char *__argz, size_t __argz_len, __const char *__entry)) { --- libc/Makeconfig.jj 2006-10-31 23:05:27.000000000 +0100 +++ libc/Makeconfig 2007-03-16 17:02:23.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2003,2004,2005,2006 Free Software Foundation, Inc. +# Copyright (C) 1991-2003,2004,2005,2006,2007 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 @@ -672,7 +672,7 @@ CPPFLAGS = $($(subdir)-CPPFLAGS) $(+incl $(foreach lib,$(libof-$(basename $(@F))) \ $(libof-$(. - Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2001, 2007 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 @@ -135,21 +135,21 @@ __MATHDECL (_Mdouble_,creal, (_Mdouble_c #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ /* Imaginary part of Z. */ -extern __inline _Mdouble_ +__extern_inline _Mdouble_ __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW { return __imag__ __z; } /* Real part of Z. */ -extern __inline _Mdouble_ +__extern_inline _Mdouble_ __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW { return __real__ __z; } /* Complex conjugate of Z. */ -extern __inline _Mdouble_complex_ +__extern_inline _Mdouble_complex_ __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW { return __extension__ ~__z; --- libc/hurd/hurd.h.jj 2002-01-02 10:52:20.000000000 +0100 +++ libc/hurd/hurd.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,4 +1,5 @@ -/* Copyright (C) 1993,94,95,96,97,98,99,2001,02 Free Software Foundation, Inc. +/* Copyright (C) 1993,94,95,96,97,98,99,2001,2002,2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,7 +45,7 @@ #include #ifndef _HURD_H_EXTERN_INLINE -#define _HURD_H_EXTERN_INLINE extern __inline +#define _HURD_H_EXTERN_INLINE __extern_inline #endif _HURD_H_EXTERN_INLINE int --- libc/hurd/hurd/port.h.jj 2001-07-06 06:54:47.000000000 +0200 +++ libc/hurd/hurd/port.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,6 @@ /* Lightweight user references for ports. - Copyright (C) 1993, 1994, 1995, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 1999, 2007 + 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 @@ -55,7 +56,7 @@ struct hurd_port #ifndef _HURD_PORT_H_EXTERN_INLINE -#define _HURD_PORT_H_EXTERN_INLINE extern __inline +#define _HURD_PORT_H_EXTERN_INLINE __extern_inline #endif --- libc/hurd/hurd/threadvar.h.jj 2002-09-02 09:08:53.000000000 +0200 +++ libc/hurd/hurd/threadvar.h 2007-03-16 17:02:29.000000000 +0100 @@ -1,5 +1,5 @@ /* Internal per-thread variables for the Hurd. - Copyright (C) 1994,95,97,98,99,2001,02 Free Software Foundation, Inc. + Copyright (C) 1994,95,97,98,99,2001,02,06,07 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 @@ -74,7 +74,7 @@ enum __hurd_threadvar_index #ifndef _HURD_THREADVAR_H_EXTERN_INLINE -#define _HURD_THREADVAR_H_EXTERN_INLINE extern __inline +#define _HURD_THREADVAR_H_EXTERN_INLINE __extern_inline #endif /* Return the location of the value for the per-thread variable with index --- libc/hurd/hurd/fd.h.jj 2006-03-06 08:59:07.000000000 +0100 +++ libc/hurd/hurd/fd.h 2007-03-16 17:02:35.000000000 +0100 @@ -1,5 +1,5 @@ /* File descriptors. - Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006 + Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -52,7 +52,7 @@ extern struct mutex _hurd_dtable_lock; / #include #ifndef _HURD_FD_H_EXTERN_INLINE -#define _HURD_FD_H_EXTERN_INLINE extern __inline +#define _HURD_FD_H_EXTERN_INLINE __extern_inline #endif /* Returns the descriptor cell for FD. If FD is invalid or unused, return --- libc/hurd/hurd/signal.h.jj 2002-02-18 21:57:11.000000000 +0100 +++ libc/hurd/hurd/signal.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Implementing POSIX.1 signals under the Hurd. - Copyright (C) 1993,94,95,96,98,99,2002 Free Software Foundation, Inc. + Copyright (C) 1993,94,95,96,98,99,2002,2007 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 @@ -126,7 +126,7 @@ extern struct hurd_sigstate *_hurd_self_ __attribute__ ((__const__)); #ifndef _HURD_SIGNAL_H_EXTERN_INLINE -#define _HURD_SIGNAL_H_EXTERN_INLINE extern __inline +#define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline #endif _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate * --- libc/hurd/hurd/userlink.h.jj 2001-07-06 06:54:47.000000000 +0200 +++ libc/hurd/hurd/userlink.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Support for chains recording users of a resource; `struct hurd_userlink'. - Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1997, 1999, 2007 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 @@ -71,7 +71,7 @@ struct hurd_userlink #ifndef _HURD_USERLINK_H_EXTERN_INLINE -#define _HURD_USERLINK_H_EXTERN_INLINE extern __inline +#define _HURD_USERLINK_H_EXTERN_INLINE __extern_inline #endif --- libc/sysdeps/mach/alpha/machine-sp.h.jj 2001-07-06 06:55:56.000000000 +0200 +++ libc/sysdeps/mach/alpha/machine-sp.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific function to return the stack pointer. Alpha version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2007 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 @@ -23,7 +23,7 @@ /* Return the current stack pointer. */ #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif _EXTERN_INLINE void * --- libc/sysdeps/mach/alpha/machine-lock.h.jj 2003-02-26 01:01:15.000000000 +0100 +++ libc/sysdeps/mach/alpha/machine-lock.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific definition for spin locks. Alpha version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2007 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 @@ -30,7 +30,7 @@ typedef __volatile long int __spin_lock_ #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif /* Unlock LOCK. */ --- libc/sysdeps/mach/i386/machine-lock.h.jj 2001-07-06 06:56:00.000000000 +0200 +++ libc/sysdeps/mach/i386/machine-lock.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific definition for spin locks. i386 version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2007 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 @@ -30,7 +30,7 @@ typedef __volatile int __spin_lock_t; #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif /* Unlock LOCK. */ --- libc/sysdeps/mach/powerpc/machine-sp.h.jj 2002-08-27 00:39:44.000000000 +0200 +++ libc/sysdeps/mach/powerpc/machine-sp.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific function to return the stack pointer. PowerPC version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2007 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 @@ -27,7 +27,7 @@ # ifdef _HURD_THREADVAR_H_EXTERN_INLINE # define _EXTERN_INLINE _HURD_THREADVAR_H_EXTERN_INLINE # else -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif #endif --- libc/sysdeps/mach/powerpc/machine-lock.h.jj 2002-02-17 08:13:25.000000000 +0100 +++ libc/sysdeps/mach/powerpc/machine-lock.h 2007-03-16 15:29:23.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific definition for spin locks. PowerPC version. - Copyright (C) 1994,97,2002 Free Software Foundation, Inc. + Copyright (C) 1994,97,2002,2007 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 @@ -30,7 +30,7 @@ typedef __volatile long int __spin_lock_ #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif /* Unlock LOCK. */ --- libc/sysdeps/alpha/fpu/bits/mathinline.h.jj 2007-03-16 11:33:55.000000000 +0100 +++ libc/sysdeps/alpha/fpu/bits/mathinline.h 2007-03-16 15:29:33.000000000 +0100 @@ -26,7 +26,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0) --- libc/sysdeps/ia64/fpu/bits/mathinline.h.jj 2004-09-08 23:44:02.000000000 +0200 +++ libc/sysdeps/ia64/fpu/bits/mathinline.h 2007-03-16 15:29:33.000000000 +0100 @@ -1,5 +1,5 @@ /* Inline math functions for ia64. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2007 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 @@ -24,7 +24,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 --- libc/sysdeps/i386/fpu/bits/mathinline.h.jj 2006-11-16 17:38:10.000000000 +0100 +++ libc/sysdeps/i386/fpu/bits/mathinline.h 2007-03-16 15:53:13.000000000 +0100 @@ -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,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by John C. Bowman , 1995. @@ -26,7 +26,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif --- libc/sysdeps/i386/i486/bits/string.h.jj 2004-12-15 21:30:16.000000000 +0100 +++ libc/sysdeps/i386/i486/bits/string.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Optimized, inlined string functions. i486 version. - Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004 + Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -35,7 +35,7 @@ # ifdef __cplusplus # define __STRING_INLINE inline # else -# define __STRING_INLINE extern __inline +# define __STRING_INLINE __extern_inline # endif #endif --- libc/sysdeps/generic/inttypes.h.jj 2004-09-08 00:23:42.000000000 +0200 +++ libc/sysdeps/generic/inttypes.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997-2001, 2004, 2007 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 @@ -330,7 +330,7 @@ extern long int __strtol_internal (__con int __base, int __group) __THROW; # define __strtol_internal_defined 1 # endif -extern __inline intmax_t +__extern_inline intmax_t __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr, int base)) { @@ -345,7 +345,7 @@ extern unsigned long int __strtoul_inter int __base, int __group) __THROW; # define __strtoul_internal_defined 1 # endif -extern __inline uintmax_t +__extern_inline uintmax_t __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr, int base)) { @@ -359,7 +359,7 @@ extern long int __wcstol_internal (__con int __base, int __group) __THROW; # define __wcstol_internal_defined 1 # endif -extern __inline intmax_t +__extern_inline intmax_t __NTH (wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { @@ -376,7 +376,7 @@ extern unsigned long int __wcstoul_inter int __base, int __group) __THROW; # define __wcstoul_internal_defined 1 # endif -extern __inline uintmax_t +__extern_inline uintmax_t __NTH (wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { @@ -393,7 +393,7 @@ extern long long int __strtoll_internal int __base, int __group) __THROW; # define __strtoll_internal_defined 1 # endif -extern __inline intmax_t +__extern_inline intmax_t __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr, int base)) { @@ -411,7 +411,7 @@ extern unsigned long long int __strtoull int __group) __THROW; # define __strtoull_internal_defined 1 # endif -extern __inline uintmax_t +__extern_inline uintmax_t __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr, int base)) { @@ -427,7 +427,7 @@ extern long long int __wcstoll_internal int __base, int __group) __THROW; # define __wcstoll_internal_defined 1 # endif -extern __inline intmax_t +__extern_inline intmax_t __NTH (wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { @@ -446,7 +446,7 @@ extern unsigned long long int __wcstoull int __group) __THROW; # define __wcstoull_internal_defined 1 # endif -extern __inline uintmax_t +__extern_inline uintmax_t __NTH (wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { --- libc/sysdeps/generic/machine-sp.h.jj 2001-07-06 06:55:49.000000000 +0200 +++ libc/sysdeps/generic/machine-sp.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific function to return the stack pointer. Stub version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2007 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 @@ -23,7 +23,7 @@ /* Return the current stack pointer. */ #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif _EXTERN_INLINE void * --- libc/sysdeps/generic/machine-lock.h.jj 2001-07-06 06:55:49.000000000 +0200 +++ libc/sysdeps/generic/machine-lock.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Machine-specific definition for spin locks. Stub version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2007 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 @@ -30,7 +30,7 @@ typedef volatile int __spin_lock_t; #ifndef _EXTERN_INLINE -#define _EXTERN_INLINE extern __inline +#define _EXTERN_INLINE __extern_inline #endif /* Unlock LOCK. */ --- libc/sysdeps/s390/bits/string.h.jj 2005-01-28 22:44:42.000000000 +0100 +++ libc/sysdeps/s390/bits/string.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Optimized, inlined string functions. S/390 version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -34,7 +34,7 @@ # ifdef __cplusplus # define __STRING_INLINE inline # else -# define __STRING_INLINE extern __inline +# define __STRING_INLINE __extern_inline # endif #endif --- libc/sysdeps/s390/fpu/bits/mathinline.h.jj 2006-02-01 04:00:20.000000000 +0100 +++ libc/sysdeps/s390/fpu/bits/mathinline.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Inline math functions for s390. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2007 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 @@ -24,7 +24,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ --- libc/sysdeps/powerpc/fpu/bits/mathinline.h.jj 2006-11-06 20:53:15.000000000 +0100 +++ libc/sysdeps/powerpc/fpu/bits/mathinline.h 2007-03-16 17:02:38.000000000 +0100 @@ -1,5 +1,5 @@ /* Inline math functions for powerpc. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,7 +25,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif /* __cplusplus */ #if defined __GNUC__ && !defined _SOFT_FLOAT --- libc/sysdeps/x86_64/fpu/bits/mathinline.h.jj 2004-09-08 00:18:59.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/bits/mathinline.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* Inline math functions for x86-64. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2002. @@ -25,7 +25,7 @@ #ifdef __cplusplus # define __MATH_INLINE __inline #else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline #endif --- libc/sysdeps/sparc/fpu/bits/mathinline.h.jj 2006-01-14 13:09:02.000000000 +0100 +++ libc/sysdeps/sparc/fpu/bits/mathinline.h 2007-03-16 17:02:41.000000000 +0100 @@ -1,5 +1,5 @@ /* Inline math functions for SPARC. - Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006 + Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek . @@ -131,7 +131,7 @@ # ifdef __cplusplus # define __MATH_INLINE __inline # else -# define __MATH_INLINE extern __inline +# define __MATH_INLINE __extern_inline # endif /* __cplusplus */ /* The gcc, version 2.7 or below, has problems with all this inlining --- libc/sysdeps/unix/bsd/bsd4.4/bits/socket.h.jj 2004-09-11 18:28:10.000000000 +0200 +++ libc/sysdeps/unix/bsd/bsd4.4/bits/socket.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,5 @@ /* System-specific socket constants and types. 4.4 BSD version. - Copyright (C) 1991,92,1994-2002,2004 Free Software Foundation, Inc. + Copyright (C) 1991,92,1994-2002,2004,2007 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 @@ -227,7 +227,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st struct cmsghdr *__cmsg) __THROW; #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) --- libc/sysdeps/unix/sysv/linux/bits/socket.h.jj 2006-04-02 19:25:37.000000000 +0200 +++ libc/sysdeps/unix/sysv/linux/bits/socket.h 2007-03-16 17:02:53.000000000 +0100 @@ -1,5 +1,6 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007 + 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 @@ -264,7 +265,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st struct cmsghdr *__cmsg) __THROW; #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) --- libc/sysdeps/unix/sysv/linux/bits/sigset.h.jj 2001-07-06 06:56:14.000000000 +0200 +++ libc/sysdeps/unix/sysv/linux/bits/sigset.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,6 @@ /* __sig_atomic_t, __sigset_t, and related definitions. Linux version. - Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007 + 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 @@ -43,7 +44,7 @@ typedef struct # define _SIGSET_H_fns 1 # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif /* Return a mask that includes the bit for SIG only. */ --- libc/sysdeps/unix/sysv/linux/sys/sysmacros.h.jj 2004-09-08 00:18:59.000000000 +0200 +++ libc/sysdeps/unix/sysv/linux/sys/sysmacros.h 2007-03-16 15:29:34.000000000 +0100 @@ -1,5 +1,6 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2003, 2004, 2007 + 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 @@ -27,30 +28,30 @@ they need. */ #ifdef __GLIBC_HAVE_LONG_LONG __extension__ -extern __inline unsigned int gnu_dev_major (unsigned long long int __dev) +__extern_inline unsigned int gnu_dev_major (unsigned long long int __dev) __THROW; __extension__ -extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev) +__extern_inline unsigned int gnu_dev_minor (unsigned long long int __dev) __THROW; __extension__ -extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major, +__extern_inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW; # if defined __GNUC__ && __GNUC__ >= 2 -__extension__ extern __inline unsigned int +__extension__ __extern_inline unsigned int __NTH (gnu_dev_major (unsigned long long int __dev)) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } -__extension__ extern __inline unsigned int +__extension__ __extern_inline unsigned int __NTH (gnu_dev_minor (unsigned long long int __dev)) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } -__extension__ extern __inline unsigned long long int +__extension__ __extern_inline unsigned long long int __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) Jakub From jakub@redhat.com Fri Mar 16 18:59:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 16 Mar 2007 18:59:00 -0000 Subject: [PATCH] Small glibc fixes Message-ID: <20070316190251.GS1826@sunsite.mff.cuni.cz> Hi! While building glibc with gcc 4.3 I looked at a few warnings (some new with 4.3, some older). dl_open_worker reported an uninitialized variable, because DL_DST_REQ_STATIC used l var, but that wasn't passed through as macro argument. All other users of DL_DST_REQUIRED passed l as first argument to it, so it made no difference, but dl_open_worker does not. I have rearranged the code so that without dl-dst.h fix it actually errored out - l was used independently in 2 different scopes. include/dlfcn.h is included with #define link_map link_map_public and that struct isn't declared yet, so gcc was warning. gcc 4.3 now complains about (socklen_t) (((struct sockaddr_un *) NULL)->sun_path) claiming a pointer on 64-bit target is truncated to 32-bit int. It was a fancy way of writing offsetof anyway. tst-mktime2.c actually got killed when compiled with gcc 4.3, which assumed the loop will never wrap and so after calling the function with INT_MAX/2+1 it called it with INT_MIN and then forever with 0. _itoa is now a macro, so when vfwprintf wants to redefine to _itowa, it should undef it first. And lastly, strerror_l was using free, but didn't have a prototype for that. 2007-03-16 Jakub Jelinek * elf/dl-open.c (dl_open_worker): Declare l in 2 different smaller scopes. * elf/dl-dst.h (DL_DST_REQ_STATIC): Add l as macro argument. (DL_DST_REQUIRED): Adjust user. * include/dlfcn.h (struct link_map): New forward decl. * inet/getnameinfo.c: Include stddef.h. (getnameinfo): Use offsetof. * time/tst-mktime2.c (do_test): Don't rely on signed wrap. * stdio-common/vfprintf.c (_itoa): Undef before redefining. * string/strerror_l.c: Include stdlib.h. --- libc/elf/dl-open.c.jj 2007-03-16 18:26:45.000000000 +0100 +++ libc/elf/dl-open.c 2007-03-16 18:26:45.000000000 +0100 @@ -161,7 +161,7 @@ dl_open_worker (void *a) struct dl_open_args *args = a; const char *file = args->file; int mode = args->mode; - struct link_map *new, *l; + struct link_map *new; int lazy; unsigned int i; bool any_tls = false; @@ -186,6 +186,7 @@ dl_open_worker (void *a) By default we assume this is the main application. */ call_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded; + struct link_map *l; for (Lmid_t ns = 0; ns < DL_NNS; ++ns) for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next) if (caller_dlopen >= (const void *) l->l_map_start @@ -325,7 +326,7 @@ dl_open_worker (void *a) /* Relocate the objects loaded. We do this in reverse order so that copy relocs of earlier objects overwrite the data written by later objects. */ - l = new; + struct link_map *l = new; while (l->l_next) l = l->l_next; while (1) --- libc/elf/dl-dst.h.jj 2006-10-19 17:28:02.000000000 +0200 +++ libc/elf/dl-dst.h 2007-03-16 19:21:29.000000000 +0100 @@ -1,5 +1,6 @@ /* Handling of dynamic sring tokens. - Copyright (C) 1999,2001,2002,2003,2004,2006 Free Software Foundation, Inc. + Copyright (C) 1999,2001,2002,2003,2004,2006,2007 + 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 @@ -50,7 +51,7 @@ \ First get the origin string if it is not available yet. \ This can only happen for the map of the executable. */ \ - DL_DST_REQ_STATIC \ + DL_DST_REQ_STATIC (l) \ if ((l)->l_origin == NULL) \ { \ assert ((l)->l_name[0] == '\0'); \ @@ -68,9 +69,9 @@ __len; }) #ifdef SHARED -# define DL_DST_REQ_STATIC /* nothing */ +# define DL_DST_REQ_STATIC(l) /* nothing */ #else -# define DL_DST_REQ_STATIC \ +# define DL_DST_REQ_STATIC(l) \ if ((l) == NULL) \ { \ const char *origin = _dl_get_origin (); \ --- libc/include/dlfcn.h.jj 2006-10-31 23:05:31.000000000 +0100 +++ libc/include/dlfcn.h 2007-03-16 18:30:41.000000000 +0100 @@ -45,6 +45,8 @@ extern int _dl_addr (const void *address libc_hidden_proto (_dl_addr) #endif +struct link_map; + /* Close an object previously opened by _dl_open. */ extern void _dl_close (void *map) attribute_hidden; /* Same as above, but without locking and safety checks for user --- libc/inet/getnameinfo.c.jj 2006-08-28 18:23:18.000000000 +0200 +++ libc/inet/getnameinfo.c 2007-03-16 18:24:16.000000000 +0100 @@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI #include #include #include +#include #include #include #include @@ -180,7 +181,7 @@ getnameinfo (const struct sockaddr *sa, switch (sa->sa_family) { case AF_LOCAL: - if (addrlen < (socklen_t) (((struct sockaddr_un *) NULL)->sun_path)) + if (addrlen < (socklen_t) offsetof (struct sockaddr_un, sun_path)) return EAI_FAMILY; break; case AF_INET: --- libc/time/tst-mktime2.c.jj 2004-12-01 20:55:52.000000000 +0100 +++ libc/time/tst-mktime2.c 2007-03-16 17:42:27.000000000 +0100 @@ -102,7 +102,8 @@ static int do_test (void) { time_t t, delta; - int i, j; + int i; + unsigned int j; setenv ("TZ", "America/Sao_Paulo", 1); /* This test makes some buggy mktime implementations loop. @@ -128,7 +129,7 @@ do_test (void) mktime_test ((time_t) (60 * 60)); mktime_test ((time_t) (60 * 60 * 24)); - for (j = 1; 0 < j; j *= 2) + for (j = 1; j <= INT_MAX; j *= 2) bigtime_test (j); bigtime_test (j - 1); } --- libc/stdio-common/vfprintf.c.jj 2007-01-22 16:47:39.000000000 +0100 +++ libc/stdio-common/vfprintf.c 2007-03-16 18:15:18.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006 +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -99,6 +99,7 @@ # define PUTC(C, F) _IO_putwc_unlocked (C, F) # define ORIENT if (_IO_fwide (s, 1) != 1) return -1 +# undef _itoa # define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case) # define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case) # undef EOF --- libc/string/strerror_l.c.jj 2007-02-01 17:08:31.000000000 +0100 +++ libc/string/strerror_l.c 2007-03-16 18:17:33.000000000 +0100 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include Jakub From jakub@redhat.com Sun Mar 18 17:46:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Sun, 18 Mar 2007 17:46:00 -0000 Subject: [PATCH] Fix nscd build on ia64 Message-ID: <20070318175006.GT1826@sunsite.mff.cuni.cz> Hi! __libc_alloca_cutoff is only defined in libc.so. After the latest changes to check_pf.c nscd fails to link on ia64, because it is not defined. For nscd we know the stack size (at least for non-initial threads) and limiting alloca to __MAX_ALLOCA_CUTOFF is ok. 2007-03-18 Jakub Jelinek * nscd/gai.c: Include alloca.h. (__libc_use_alloca): Define. --- libc/nscd/gai.c 2007-01-17 10:00:57.000000000 +0100 +++ libc/nscd/gai.c 2007-03-18 13:00:25.000000000 +0100 @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include /* This file uses the getaddrinfo code but it compiles it without NSCD support. We just need a few symbol renames. */ #define __inet_aton inet_aton @@ -25,6 +26,8 @@ #define __sendto sendto #define __strchrnul strchrnul #define __getline getline +/* nscd uses 1MB or 2MB thread stacks. */ +#define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF) #include Jakub From jakub@redhat.com Sun Mar 18 19:02:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Sun, 18 Mar 2007 19:02:00 -0000 Subject: [alpha] math routine improvements In-Reply-To: <20070314174806.GA13985@twiddle.net> References: <20070314174806.GA13985@twiddle.net> Message-ID: <20070318190641.GU1826@sunsite.mff.cuni.cz> On Wed, Mar 14, 2007 at 10:48:06AM -0700, Richard Henderson wrote: > Branchless versions of some existing rounding routines. > Implement some easy functions that were missing. > Remove inline versions of fdim, because they handle inf incorrectly. Have you checked libc.so/libm.so ABI before/after the patch (I'm using: for i in `find . -name '*.so*' -a -type f`; do readelf -Ws $i \ | sed -n '/\.symtab/,$d;/ UND /d;/@GLIBC_PRIVATE/d;/\(GLOBAL\|WEAK\)/p' \ | awk '{ if ($4 == "OBJECT") { printf "%s %s %s %s %s\n", $8, $4, $5, $6, $3 } else { printf "%s %s %s %s\n", $8, $4, $5, $6 }}' \ | LC_ALL=C sort -u > ~/xxabilist/$1-$2-$3/$b/`echo $i | sed 's|^\./||;s|/|.|g'`.abi done and then diff the files)? >From a quick glance at the new files and math/Versions and/or sysdeps/ldbl-opt/ compat_symbol versions I'd say following is needed, but it is untested. 2007-03-18 Jakub Jelinek * sysdeps/alpha/fpu/s_nearbyint.c (nearbyintl): Fix version on compat_symbol to GLIBC_2_1. * sysdeps/alpha/fpu/s_fmin.S (fminl): Likewise. * sysdeps/alpha/fpu/s_trunc.c (truncl): Likewise. * sysdeps/alpha/fpu/s_fmax.S (fmaxl): Likewise. * sysdeps/alpha/fpu/s_lrint.c (lrintl, llrintl): Likewise. * sysdeps/alpha/fpu/s_lround.c (lroundl, llroundl): Likewise. * sysdeps/alpha/fpu/s_round.c (roundl): Likewise. * sysdeps/alpha/fpu/s_isnan.c (isnanl): Provide compat_symbol in libc, not libm. (__isnanl): New compat_symbol. --- libc/sysdeps/alpha/fpu/s_nearbyint.c.jj 2007-03-14 18:44:14.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_nearbyint.c 2007-03-18 19:25:04.000000000 +0100 @@ -43,6 +43,6 @@ weak_alias (__nearbyint, nearbyint) strong_alias (__nearbyint, __nearbyintl) weak_alias (__nearbyint, nearbyintl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_isnan.c.jj 2007-03-14 18:44:14.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_isnan.c 2007-03-18 19:27:46.000000000 +0100 @@ -53,6 +53,9 @@ weak_alias (__isnanf, isnanf) strong_alias (__isnan, __isnanl) weak_alias (__isnan, isnanl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __isnan, isnanl, GLIBC_2_0); +#ifndef IS_IN_libm +# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); +compat_symbol (libc, isnan, isnanl, GLIBC_2_0); +# endif #endif --- libc/sysdeps/alpha/fpu/s_fmin.S.jj 2007-03-14 18:44:14.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_fmin.S 2007-03-18 19:28:09.000000000 +0100 @@ -53,6 +53,6 @@ weak_alias (__fmin, fmin) strong_alias (__fmin, __fminl) weak_alias (__fminl, fminl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __fmin, fminl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __fmin, fminl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_trunc.c.jj 2007-03-14 21:01:05.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_trunc.c 2007-03-18 19:24:22.000000000 +0100 @@ -48,6 +48,6 @@ weak_alias (__trunc, trunc) strong_alias (__trunc, __truncl) weak_alias (__trunc, truncl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __trunc, truncl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __trunc, truncl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_fmax.S.jj 2007-03-14 18:44:14.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_fmax.S 2007-03-18 19:28:20.000000000 +0100 @@ -53,6 +53,6 @@ weak_alias (__fmax, fmax) strong_alias (__fmax, __fmaxl) weak_alias (__fmaxl, fmaxl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __fmax, fmaxl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_lrint.c.jj 2007-03-14 18:44:14.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_lrint.c 2007-03-18 19:26:07.000000000 +0100 @@ -42,7 +42,7 @@ strong_alias (__lrint, __llrintl) weak_alias (__lrintl, lrintl) weak_alias (__llrintl, llrintl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_0); -compat_symbol (libm, __llrint, llrintl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __lrint, lrintl, GLIBC_2_1); +compat_symbol (libm, __llrint, llrintl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_lround.c.jj 2007-03-14 21:01:05.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_lround.c 2007-03-18 19:25:43.000000000 +0100 @@ -42,7 +42,7 @@ strong_alias (__lround, __llroundl) weak_alias (__lroundl, lroundl) weak_alias (__llroundl, llroundl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __lround, lroundl, GLIBC_2_0); -compat_symbol (libm, __llround, llroundl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __lround, lroundl, GLIBC_2_1); +compat_symbol (libm, __llround, llroundl, GLIBC_2_1); #endif --- libc/sysdeps/alpha/fpu/s_round.c.jj 2007-03-14 21:01:05.000000000 +0100 +++ libc/sysdeps/alpha/fpu/s_round.c 2007-03-18 19:24:40.000000000 +0100 @@ -44,6 +44,6 @@ weak_alias (__round, round) strong_alias (__round, __roundl) weak_alias (__roundl, roundl) #endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __round, roundl, GLIBC_2_0); +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __round, roundl, GLIBC_2_1); #endif Jakub From jakub@redhat.com Tue Mar 20 12:36:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 20 Mar 2007 12:36:00 -0000 Subject: [PATCH] Fix up ppc __cache_line_size In-Reply-To: <45F71009.8020705@us.ibm.com> References: <20070313201706.8D8351801C5@magilla.sf.frob.com> <45F71009.8020705@us.ibm.com> Message-ID: <20070320123958.GW1826@sunsite.mff.cuni.cz> On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote: > Roland McGrath wrote: > >> +#ifdef DL_PLATFORM_AUXV > >> + DL_PLATFORM_AUXV > >> +#endif > >> > > > > This looks ok to me, but make it # ifdef there inside another #ifdef. > > > > This will also affect powerpc, which AFAICT was also failing to set its > > __cache_line_size in static programs. It looks to me like that will be fine. > > > > > hmmm looks like powerpc needs a > sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV > and include /elf/dl-support.c ? IMHO there is no reason to use weak_extern for __cache_line_size. Code to check the weak references and only conditionally set it is certainly bigger than just defining the hidden variables in libc-start.c and dl-sysdep.c. Additionally, if you build power4+ optimized ld.so, __cache_line_size isn't defined at all and thus dl-machine.c will never use it. The following patch works for me (though only tested with binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size references don't need runtime relocation). Not sure if we still support older binutils. 2007-03-20 Jakub Jelinek * sysdeps/unix/sysv/linux/powerpc/libc-start.c (__cache_line_size): Define the variable here. Add attribute_hidden, remove weak_extern. (__libc_start_main): Set __cache_line_size unconditionally. * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c (__cache_line_size): Define the variable here. Add attribute_hidden, remove weak_extern. (DL_PLATFORM_AUXV): Set __cache_line_size unconditionally. * sysdeps/powerpc/powerpc32/dl-machine.c (__cache_line_size): Remove weak_extern, add attribute_hidden. (__elf_machine_runtime_setup): Assume __cache_line_size is always defined in ld.so. * sysdeps/powerpc/powerpc32/memset.S (__cache_line_size): Remove definition. * sysdeps/powerpc/powerpc64/memset.S (__cache_line_size): Likewise. --- libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c.jj 2005-12-30 08:30:11.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2007-03-20 11:56:13.000000000 +0100 @@ -1,4 +1,5 @@ -/* Copyright (C) 1998,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + 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,8 +23,7 @@ #include #include -extern int __cache_line_size; -weak_extern (__cache_line_size) +int __cache_line_size attribute_hidden; /* The main work is done in the generic function. */ #define LIBC_START_MAIN generic_start_main #define LIBC_START_DISABLE_INLINE @@ -113,11 +113,7 @@ int switch (av->a_type) { case AT_DCACHEBSIZE: - { - int *cls = &__cache_line_size; - if (cls != NULL) - *cls = av->a_un.a_val; - } + __cache_line_size = av->a_un.a_val; break; } #ifdef SHARED --- libc/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c.jj 2006-01-11 16:55:32.000000000 +0100 +++ libc/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2007-03-20 11:57:19.000000000 +0100 @@ -1,5 +1,6 @@ /* Operating system support for run-time dynamic linker. Linux/PPC version. - Copyright (C) 1997, 1998, 2001, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2001, 2003, 2006, 2007 + 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 @@ -21,8 +22,7 @@ #include #include -extern int __cache_line_size; -weak_extern (__cache_line_size) +int __cache_line_size attribute_hidden; /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found verify that the static extern __cache_line_size is defined by checking @@ -30,12 +30,8 @@ weak_extern (__cache_line_size) value to __cache_line_size. */ #define DL_PLATFORM_AUXV \ case AT_DCACHEBSIZE: \ - { \ - int *cls = & __cache_line_size; \ - if (cls != NULL) \ - *cls = av->a_un.a_val; \ - } \ - break; + __cache_line_size = av->a_un.a_val; \ + break; #ifndef __ASSUME_STD_AUXV --- libc/sysdeps/powerpc/powerpc64/memset.S.jj 2005-06-06 14:36:11.000000000 +0200 +++ libc/sysdeps/powerpc/powerpc64/memset.S 2007-03-20 11:59:30.000000000 +0100 @@ -1,5 +1,6 @@ /* Optimized memset implementation for PowerPC64. - Copyright (C) 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2002, 2003, 2007 + 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 @@ -21,12 +22,6 @@ #include #include -/* Define a global static that can hold the cache line size. The - assumption is that startup code will access the "aux vector" to - to obtain the value set by the kernel and store it into this - variable. */ - .globl __cache_line_size - .lcomm __cache_line_size,4,4 .section ".toc","aw" .LC0: .tc __cache_line_size[TC],__cache_line_size --- libc/sysdeps/powerpc/powerpc32/memset.S.jj 2005-06-22 18:34:22.000000000 +0200 +++ libc/sysdeps/powerpc/powerpc32/memset.S 2007-03-20 12:01:36.000000000 +0100 @@ -1,5 +1,5 @@ /* Optimized memset implementation for PowerPC. - Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2003, 2007 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 @@ -21,14 +21,6 @@ #include #include -/* Define a global static that can hold the cache line size. The - assumption is that startup code will access the "aux vector" to - to obtain the value set by the kernel and store it into this - variable. */ - - .globl __cache_line_size - .lcomm __cache_line_size,4,4 - /* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5])); Returns 's'. --- libc/sysdeps/powerpc/powerpc32/dl-machine.c.jj 2006-11-28 11:25:24.000000000 +0100 +++ libc/sysdeps/powerpc/powerpc32/dl-machine.c 2007-03-20 12:06:30.000000000 +0100 @@ -26,10 +26,9 @@ #include #include -/* The value __cache_line_size is defined in memset.S and is initialised +/* The value __cache_line_size is defined in dl-sysdep.c and is initialised by _dl_sysdep_start via DL_PLATFORM_INIT. */ -extern int __cache_line_size; -weak_extern (__cache_line_size) +extern int __cache_line_size attribute_hidden; /* Because ld.so is now versioned, these functions can be in their own file; no relocations need to be done to call them. @@ -318,15 +317,9 @@ __elf_machine_runtime_setup (struct link /* Default minimum 4 words per cache line. */ int line_size_words = 4; - /* Don't try this until ld.so has relocated itself! */ - int *line_size_ptr = &__cache_line_size; - if (lazy && line_size_ptr != NULL) - { - /* Verify that __cache_line_size is defined and set. */ - if (*line_size_ptr != 0) - /* Convert bytes to words. */ - line_size_words = *line_size_ptr / 4; - } + if (lazy && __cache_line_size != 0) + /* Convert bytes to words. */ + line_size_words = __cache_line_size / 4; size_modified = lazy ? rel_offset_words : 6; for (i = 0; i < size_modified; i += line_size_words) Jakub From munroesj@us.ibm.com Tue Mar 20 14:59:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Tue, 20 Mar 2007 14:59:00 -0000 Subject: [PATCH] Fix up ppc __cache_line_size In-Reply-To: <20070320123958.GW1826@sunsite.mff.cuni.cz> References: <20070313201706.8D8351801C5@magilla.sf.frob.com> <45F71009.8020705@us.ibm.com> <20070320123958.GW1826@sunsite.mff.cuni.cz> Message-ID: <45FFFA7D.6000508@us.ibm.com> Jakub Jelinek wrote: > On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote: > >> Roland McGrath wrote: >> >>>> +#ifdef DL_PLATFORM_AUXV >>>> + DL_PLATFORM_AUXV >>>> +#endif >>>> >>>> >>> This looks ok to me, but make it # ifdef there inside another #ifdef. >>> >>> This will also affect powerpc, which AFAICT was also failing to set its >>> __cache_line_size in static programs. It looks to me like that will be fine. >>> >>> >>> >> hmmm looks like powerpc needs a >> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV >> and include /elf/dl-support.c ? >> > > IMHO there is no reason to use weak_extern for __cache_line_size. > Code to check the weak references and only conditionally set it is > certainly bigger than just defining the hidden variables in libc-start.c > and dl-sysdep.c. > Additionally, if you build power4+ optimized ld.so, __cache_line_size > isn't defined at all and thus dl-machine.c will never use it. > > The following patch works for me (though only tested with > binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size > references don't need runtime relocation). Not sure if we still support > older binutils. > Looks good, I'll verify this against the powerpc-cpu add-on as soon as I finish testing and submitt the MUTEX_HINTS patch I am working on ... Thanks From jakub@redhat.com Thu Mar 22 14:49:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 22 Mar 2007 14:49:00 -0000 Subject: [PATCH] fenv fixes for x86_64/i386/ia64 Message-ID: <20070322145345.GZ1826@sunsite.mff.cuni.cz> Hi! feholdexcept is supposed to clear the sticky exception bits: "The feholdexcept function saves the current floating-point environment in the object pointed to by envp, clears the floating-point status flags, and then installs a non-stop (continue on floating-point exceptions) mode, if available, for all floating-point exceptions." and "A floating-point status flag is a system variable whose value is set (but never cleared) when a floating-point exception is raised, which occurs as a side effect of exceptional floating-point arithmetic to provide auxiliary information." Several feholdexcept implementations didn't handle this right. Also, e.g. feupdateenv was a stub on x86_64 eventhough it is IMHO easily implementable and other arches had bugs in it too (e.g. ia64 would rise wrong exceptions and always return a failure). I added a new testcase for feholdexcept/feupdateenv (hopefully I haven't misinterpreted the standard) and I believe other arches (ppc*, s390*, ...) will need some care too. 2007-03-22 Jakub Jelinek [BZ #3427] * sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions both in SW and MXCSR. * sysdeps/x86_64/fpu/feupdateenv.c: New file. * sysdeps/x86_64/fpu/feenablxcpt.c (feenableexcept): Remove dead code. * sysdeps/x86_64/fpu/fedisblxcpt.c (fedisableexcept): Likewise. * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions in MXCSR if SSE is available. * sysdeps/i386/fpu/feupdateenv.c: Include unistd.h, dl-procinfo.h and ldsodefs.h. (__feupdateenv): Query exceptions also from MXCSR if SSE is available. Fix comment typo. * sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions. Return 0 rather than 1. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Fix comment typo. Remove incorrect part of a comment. Fix argument to feraiseexcept. * math/test-fenv.c (feholdexcept_tests): New function. (main): Call it. 2007-01-05 Richard B. Kreckel [BZ #3427] * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions in SW. --- libc/math/test-fenv.c.jj 2003-05-22 04:08:50.000000000 +0200 +++ libc/math/test-fenv.c 2007-03-22 14:41:33.000000000 +0100 @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2003, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger and Ulrich Drepper , 1997. @@ -636,6 +637,102 @@ feenv_tests (void) } +static void +feholdexcept_tests (void) +{ + fenv_t saved, saved2; + int res; + + feclearexcept (FE_ALL_EXCEPT); + fedisableexcept (FE_ALL_EXCEPT); +#ifdef FE_DIVBYZERO + feraiseexcept (FE_DIVBYZERO); +#endif + test_exceptions ("feholdexcept_tests FE_DIVBYZERO test", + DIVBYZERO_EXC, 0); + res = feholdexcept (&saved); + if (res != 0) + { + printf ("feholdexcept failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_TOWARDZERO + res = fesetround (FE_TOWARDZERO); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests 0 test", NO_EXC, 0); + feraiseexcept (FE_INVALID); + test_exceptions ("feholdexcept_tests FE_INVALID test", + INVALID_EXC, 0); + res = feupdateenv (&saved); + if (res != 0) + { + printf ("feupdateenv failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_TOWARDZERO + res = fegetround (); + if (res != FE_TONEAREST) + { + printf ("feupdateenv didn't restore rounding mode: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests FE_DIVBYZERO|FE_INVALID test", + DIVBYZERO_EXC | INVALID_EXC, 0); + feclearexcept (FE_ALL_EXCEPT); + feraiseexcept (FE_INVALID); +#if defined FE_TONEAREST && defined FE_UPWARD + res = fesetround (FE_UPWARD); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + res = feholdexcept (&saved2); + if (res != 0) + { + printf ("feholdexcept failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_UPWARD + res = fesetround (FE_TONEAREST); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests 0 2nd test", NO_EXC, 0); + feraiseexcept (FE_INEXACT); + test_exceptions ("feholdexcept_tests FE_INEXACT test", + INEXACT_EXC, 0); + res = feupdateenv (&saved2); + if (res != 0) + { + printf ("feupdateenv failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_UPWARD + res = fegetround (); + if (res != FE_UPWARD) + { + printf ("feupdateenv didn't restore rounding mode: %d\n", res); + ++count_errors; + } + fesetround (FE_TONEAREST); +#endif + test_exceptions ("feholdexcept_tests FE_INEXACT|FE_INVALID test", + INVALID_EXC | INEXACT_EXC, 0); + feclearexcept (FE_ALL_EXCEPT); +} + + /* IEC 559 and ISO C99 define a default startup environment */ static void initial_tests (void) @@ -654,6 +751,7 @@ main (void) initial_tests (); fe_tests (); feenv_tests (); + feholdexcept_tests (); if (count_errors) { --- libc/sysdeps/ia64/fpu/feholdexcpt.c.jj 2005-07-08 20:52:46.000000000 +0200 +++ libc/sysdeps/ia64/fpu/feholdexcpt.c 2007-03-22 13:28:45.000000000 +0100 @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1999, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Christian Boissat , 1999 @@ -23,12 +23,20 @@ int feholdexcept (fenv_t *envp) { + fenv_t fpsr; /* Save the current state. */ - fegetenv (envp); + __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr)); + *envp = fpsr; - /* set the trap disable bit */ - __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (*envp | FE_ALL_EXCEPT)); + /* Set the trap disable bits. */ + fpsr |= FE_ALL_EXCEPT; - return 1; + /* And clear the exception bits. */ + fpsr &= ~(fenv_t) (FE_ALL_EXCEPT << 13); + + __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr)); + + /* Success. */ + return 0; } libm_hidden_def (feholdexcept) --- libc/sysdeps/ia64/fpu/feupdateenv.c.jj 2001-07-06 06:55:54.000000000 +0200 +++ libc/sysdeps/ia64/fpu/feupdateenv.c 2007-03-22 13:27:28.000000000 +0100 @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Christian Boissat , 1999. @@ -32,10 +32,8 @@ feupdateenv (const fenv_t *envp) /* Install new environment. */ fesetenv (envp); - /* Raise the safed exception. Incidently for us the implementation - defined format of the values in objects of type fexcept_t is the - same as the ones specified using the FE_* constants. */ - feraiseexcept ((int) fpsr & FE_ALL_EXCEPT); + /* Raise the saved exceptions. */ + feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT); /* Success. */ return 0; --- libc/sysdeps/i386/fpu/feholdexcpt.c.jj 2005-07-08 20:52:47.000000000 +0200 +++ libc/sysdeps/i386/fpu/feholdexcpt.c 2007-03-22 14:56:35.000000000 +0100 @@ -1,5 +1,6 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2003, 2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -26,14 +27,19 @@ int feholdexcept (fenv_t *envp) { - unsigned short int work; + fenv_t temp; /* Store the environment. */ - __asm__ ("fnstenv %0" : "=m" (*envp)); + __asm__ ("fnstenv %0" : "=m" (temp)); + *envp = temp; /* Now set all exceptions to non-stop. */ - work = envp->__control_word | 0x3f; - __asm__ ("fldcw %0" : : "m" (*&work)); + temp.__control_word |= 0x3f; + + /* And clear all exceptions. */ + temp.__status_word &= ~0x3f; + + __asm__ ("fldenv %0" : : "m" (temp)); /* If the CPU supports SSE we set the MXCSR as well. */ if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) @@ -43,8 +49,8 @@ feholdexcept (fenv_t *envp) /* Get the current control word. */ __asm__ ("stmxcsr %0" : "=m" (*&xwork)); - /* Set all exceptions to non-stop. */ - xwork |= 0x1f80; + /* Set all exceptions to non-stop and clear them. */ + xwork = (xwork | 0x1f80) & ~0x3f; __asm__ ("ldmxcsr %0" : : "m" (*&xwork)); } --- libc/sysdeps/i386/fpu/feupdateenv.c.jj 2001-07-06 06:55:53.000000000 +0200 +++ libc/sysdeps/i386/fpu/feupdateenv.c 2007-03-22 14:47:22.000000000 +0100 @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,20 +20,29 @@ #include #include +#include +#include +#include int __feupdateenv (const fenv_t *envp) { fexcept_t temp; + unsigned int xtemp = 0; /* Save current exceptions. */ __asm__ ("fnstsw %0" : "=m" (*&temp)); - temp &= FE_ALL_EXCEPT; + + /* If the CPU supports SSE we test the MXCSR as well. */ + if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + __asm__ ("stmxcsr %0" : "=m" (*&xtemp)); + + temp = (temp | xtemp) & FE_ALL_EXCEPT; /* Install new environment. */ fesetenv (envp); - /* Raise the safed exception. Incidently for us the implementation + /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the same as the ones specified using the FE_* constants. */ feraiseexcept ((int) temp); --- libc/sysdeps/x86_64/fpu/feholdexcpt.c.jj 2005-07-08 20:52:45.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/feholdexcpt.c 2007-03-22 11:46:47.000000000 +0100 @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007 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,19 +22,24 @@ int feholdexcept (fenv_t *envp) { - unsigned short int work; unsigned int mxcsr; + fenv_t temp; /* Store the environment. */ __asm__ ("fnstenv %0\n" - "stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr)); + "stmxcsr %1" : "=m" (temp), "=m" (temp.__mxcsr)); + *envp = temp; /* Now set all exceptions to non-stop, first the x87 FPU. */ - work = envp->__control_word | 0x3f; - __asm__ ("fldcw %0" : : "m" (*&work)); + temp.__control_word |= 0x3f; + + /* And clear all exceptions. */ + temp.__status_word &= ~0x3f; + + __asm__ ("fldenv %0" : : "m" (temp)); /* Set the SSE MXCSR register. */ - mxcsr = envp->__mxcsr | 0x1f80; + mxcsr = (envp->__mxcsr | 0x1f80) & ~0x3f; __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr)); return 0; --- libc/sysdeps/x86_64/fpu/feupdateenv.c.jj 2007-03-22 12:11:41.000000000 +0100 +++ libc/sysdeps/x86_64/fpu/feupdateenv.c 2007-03-22 12:19:23.000000000 +0100 @@ -0,0 +1,51 @@ +/* Install given floating-point environment and raise exceptions. + Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include + +int +__feupdateenv (const fenv_t *envp) +{ + fexcept_t temp; + unsigned int xtemp; + + /* Save current exceptions. */ + __asm__ ("fnstsw %0\n\tstmxcsr %1" : "=m" (*&temp), "=m" (xtemp)); + temp = (temp | xtemp) & FE_ALL_EXCEPT; + + /* Install new environment. */ + fesetenv (envp); + + /* Raise the saved exception. Incidently for us the implementation + defined format of the values in objects of type fexcept_t is the + same as the ones specified using the FE_* constants. */ + feraiseexcept ((int) temp); + + /* Success. */ + return 0; +} + +#include +#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +strong_alias (__feupdateenv, __old_feupdateenv) +compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1); +#endif + +versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2); --- libc/sysdeps/x86_64/fpu/feenablxcpt.c.jj 2001-09-19 12:23:17.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/feenablxcpt.c 2007-03-22 11:24:28.000000000 +0100 @@ -1,5 +1,5 @@ /* Enable floating-point exceptions. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2001. @@ -24,7 +24,7 @@ int feenableexcept (int excepts) { unsigned short int new_exc, old_exc; - unsigned int new, old; + unsigned int new; excepts &= FE_ALL_EXCEPT; @@ -40,8 +40,6 @@ feenableexcept (int excepts) __asm__ ("stmxcsr %0" : "=m" (*&new)); /* The SSE exception masks are shifted by 7 bits. */ - old = (~new) & (FE_ALL_EXCEPT << 7); - new &= ~(excepts << 7); __asm__ ("ldmxcsr %0" : : "m" (*&new)); --- libc/sysdeps/x86_64/fpu/fedisblxcpt.c.jj 2001-09-19 12:23:17.000000000 +0200 +++ libc/sysdeps/x86_64/fpu/fedisblxcpt.c 2007-03-22 11:26:35.000000000 +0100 @@ -1,5 +1,5 @@ /* Disable floating-point exceptions. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2001. @@ -24,7 +24,7 @@ int fedisableexcept (int excepts) { unsigned short int new_exc, old_exc; - unsigned int new, old; + unsigned int new; excepts &= FE_ALL_EXCEPT; @@ -40,8 +40,6 @@ fedisableexcept (int excepts) __asm__ ("stmxcsr %0" : "=m" (*&new)); /* The SSE exception masks are shifted by 7 bits. */ - old = (~new) & (FE_ALL_EXCEPT << 7); - new |= excepts << 7; __asm__ ("ldmxcsr %0" : : "m" (*&new)); Jakub From jakub@redhat.com Thu Mar 22 16:38:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 22 Mar 2007 16:38:00 -0000 Subject: [PATCH] Fix nscd HAVE_LIBCAP Message-ID: <20070322164224.GA1826@sunsite.mff.cuni.cz> Hi! While configure.in has AC_DEFINE(HAVE_LIBCAP), config.h.in doesn't and so it was never defined. After defining this I found a couple of compile time bugs that were masked by it. 2007-03-22 Jakub Jelinek * config.h.in (HAVE_LIBCAP): Add. * nscd/selinux.h: Include sys/capability.h rather than non-existent sys/capabilities.h. * nscd/selinux.c (preserve_capabilities): Use cap_free instead of free_caps. Cast away const from 4th cap_set_flag argument. --- libc/config.h.in.jj 2006-10-31 23:05:27.000000000 +0100 +++ libc/config.h.in 2007-03-22 16:39:46.000000000 +0100 @@ -19,6 +19,9 @@ /* Defined if building with SELinux support & audit libs are detected. */ #undef HAVE_LIBAUDIT +/* Defined if building with SELinux support & libcap libs are detected. */ +#undef HAVE_LIBCAP + /* Define if using XCOFF. Set by --with-xcoff. */ #undef HAVE_XCOFF --- libc/nscd/selinux.h.jj 2006-04-26 18:27:39.000000000 +0200 +++ libc/nscd/selinux.h 2007-03-22 16:47:50.000000000 +0100 @@ -1,5 +1,5 @@ /* Header for nscd SELinux access controls. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Matthew Rickard , 2004. @@ -23,7 +23,7 @@ #include "nscd.h" #ifdef HAVE_LIBCAP -# include +# include #endif #ifdef HAVE_SELINUX --- libc/nscd/selinux.c.jj 2007-01-15 23:25:28.000000000 +0100 +++ libc/nscd/selinux.c 2007-03-22 17:21:36.000000000 +0100 @@ -187,18 +187,22 @@ preserve_capabilities (void) if (tmp_caps == NULL || new_caps == NULL) { if (tmp_caps != NULL) - free_caps (tmp_caps); + cap_free (tmp_caps); dbg_log (_("Failed to initialize drop of capabilities")); error (EXIT_FAILURE, 0, _("cap_init failed")); } /* There is no reason why these should not work. */ - cap_set_flag (new_caps, CAP_PERMITTED, nnew_cap_list, new_cap_list, CAP_SET); - cap_set_flag (new_caps, CAP_EFFECTIVE, nnew_cap_list, new_cap_list, CAP_SET); - - cap_set_flag (tmp_caps, CAP_PERMITTED, ntmp_cap_list, tmp_cap_list, CAP_SET); - cap_set_flag (tmp_caps, CAP_EFFECTIVE, ntmp_cap_list, tmp_cap_list, CAP_SET); + cap_set_flag (new_caps, CAP_PERMITTED, nnew_cap_list, + (cap_value_t *) new_cap_list, CAP_SET); + cap_set_flag (new_caps, CAP_EFFECTIVE, nnew_cap_list, + (cap_value_t *) new_cap_list, CAP_SET); + + cap_set_flag (tmp_caps, CAP_PERMITTED, ntmp_cap_list, + (cap_value_t *) tmp_cap_list, CAP_SET); + cap_set_flag (tmp_caps, CAP_EFFECTIVE, ntmp_cap_list, + (cap_value_t *) tmp_cap_list, CAP_SET); int res = cap_set_proc (tmp_caps); Jakub From munroesj@us.ibm.com Thu Mar 22 21:46:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Thu, 22 Mar 2007 21:46:00 -0000 Subject: [PATCH] fenv fixes for x86_64/i386/ia64 In-Reply-To: <20070322145345.GZ1826@sunsite.mff.cuni.cz> References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> Message-ID: <4602FCE5.7060203@us.ibm.com> Jakub Jelinek wrote: > Hi! > > feholdexcept is supposed to clear the sticky exception bits: > "The feholdexcept function saves the current floating-point environment in the object > pointed to by envp, clears the floating-point status flags, and then installs a non-stop > (continue on floating-point exceptions) mode, if available, for all floating-point > exceptions." > and > "A floating-point status flag is a system variable whose value is set > (but never cleared) when a floating-point exception is raised, which occurs as a side effect > of exceptional floating-point arithmetic to provide auxiliary information." > > Several feholdexcept implementations didn't handle this right. > Also, e.g. feupdateenv was a stub on x86_64 eventhough it is IMHO easily > implementable and other arches had bugs in it too (e.g. ia64 would rise > wrong exceptions and always return a failure). > I added a new testcase for feholdexcept/feupdateenv (hopefully I haven't > misinterpreted the standard) and I believe other arches (ppc*, s390*, ...) > will need some care too. > powerpc32 and powerpc64 both show two failures with the new test-fenv: Test: feholdexcept_tests FE_DIVBYZERO|FE_INVALID test Fail: Exception "DIVBYZERO" is not set Pass: Exception "INVALID" is set Pass: Exception "INEXACT" is not set Pass: Exception "UNDERFLOW" is not set Pass: Exception "OVERFLOW" is not set and Test: feholdexcept_tests FE_INEXACT|FE_INVALID test Pass: Exception "DIVBYZERO" is not set Fail: Exception "INVALID" is not set Pass: Exception "INEXACT" is set Pass: Exception "UNDERFLOW" is not set Pass: Exception "OVERFLOW" is not set We will look into this. From munroesj@us.ibm.com Thu Mar 22 22:01:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Thu, 22 Mar 2007 22:01:00 -0000 Subject: [PATCH] Fix up ppc __cache_line_size In-Reply-To: <20070320123958.GW1826@sunsite.mff.cuni.cz> References: <20070313201706.8D8351801C5@magilla.sf.frob.com> <45F71009.8020705@us.ibm.com> <20070320123958.GW1826@sunsite.mff.cuni.cz> Message-ID: <4603005D.1010104@us.ibm.com> Jakub Jelinek wrote: > On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote: > >> Roland McGrath wrote: >> >>>> +#ifdef DL_PLATFORM_AUXV >>>> + DL_PLATFORM_AUXV >>>> +#endif >>>> >>>> >>> This looks ok to me, but make it # ifdef there inside another #ifdef. >>> >>> This will also affect powerpc, which AFAICT was also failing to set its >>> __cache_line_size in static programs. It looks to me like that will be fine. >>> >>> >>> >> hmmm looks like powerpc needs a >> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV >> and include /elf/dl-support.c ? >> > > IMHO there is no reason to use weak_extern for __cache_line_size. > Code to check the weak references and only conditionally set it is > certainly bigger than just defining the hidden variables in libc-start.c > and dl-sysdep.c. > Additionally, if you build power4+ optimized ld.so, __cache_line_size > isn't defined at all and thus dl-machine.c will never use it. > Yup, on power4/5/6 processors we know the cache_line_size is 128 and for 970 the L:inux kernel always sets 128 byte cache lines. So we took the dynamic cache line size code out of the CPU tuned version. Unfortunately this also remove the definition of __cache_line_size for the CPU tuned stuff which we still need for dl-machine. So moving the definition of __cache_line_size to dl-sysdep.c is the correct answer. > The following patch works for me (though only tested with > binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size > references don't need runtime relocation). Not sure if we still support > older binutils. > HAVE_ASM_PPC_REL16 is required for -msecure-plt and this binutils is a prereq for -mlong-double-128 (GCC-4.1). So I suspect building with older binutils is not really an option any more. So this patch is Ok with me. From jakub@redhat.com Fri Mar 23 16:10:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 23 Mar 2007 16:10:00 -0000 Subject: [PATCH] Fix nscd HAVE_LIBCAP In-Reply-To: <20070322164224.GA1826@sunsite.mff.cuni.cz> References: <20070322164224.GA1826@sunsite.mff.cuni.cz> Message-ID: <20070323161435.GB1826@sunsite.mff.cuni.cz> On Thu, Mar 22, 2007 at 05:42:25PM +0100, Jakub Jelinek wrote: > 2007-03-22 Jakub Jelinek > > * config.h.in (HAVE_LIBCAP): Add. > * nscd/selinux.h: Include sys/capability.h rather than non-existent > sys/capabilities.h. > * nscd/selinux.c (preserve_capabilities): Use cap_free instead of > free_caps. Cast away const from 4th cap_set_flag argument. When this is applied, check-local-headers complains about sys/capability.h, which isn't a glibc header. Fixed thusly: 2007-03-23 Jakub Jelinek * scripts/check-local-headers.sh: Filter out sys/capability.h. --- libc/scripts/check-local-headers.sh.jj 2007-01-15 23:25:30.000000000 +0100 +++ libc/scripts/check-local-headers.sh 2007-03-23 17:05:08.000000000 +0100 @@ -30,6 +30,7 @@ if fgrep "$includedir" */*.{o,os,oS}.d | fgrep -v "$includedir/asm" | fgrep -v "$includedir/linux" | fgrep -v "$includedir/selinux" | +fgrep -v "$includedir/sys/capability.h" | fgrep -v "$includedir/gd"; then # If we found a match something is wrong. exit 1 Jakub From aj@suse.de Sat Mar 24 16:28:00 2007 From: aj@suse.de (Andreas Jaeger) Date: Sat, 24 Mar 2007 16:28:00 -0000 Subject: bits/in.h patch In-Reply-To: <20070219095519.A05651800E4@magilla.sf.frob.com> (Roland McGrath's message of "Mon\, 19 Feb 2007 01\:55\:19 -0800 \(PST\)") References: <20070219095519.A05651800E4@magilla.sf.frob.com> Message-ID: Roland McGrath writes: > The Hurd does not have working ipv6 support yet, and when it does it will > be fine to have it use the Linux numbers for socket options in the user API > (it will probably be using the Linux ipv6 code anyway). So, should my patch go in? Or how should we solve this? Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N?rnberg) Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From jakub@redhat.com Tue Mar 27 13:08:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 27 Mar 2007 13:08:00 -0000 Subject: [PATCH] Fix next{after,toward}{,f,l} underflow (and overflow) handling Message-ID: <20070327131242.GD1826@sunsite.mff.cuni.cz> Hi! Apparently GCC will DCE even floating point operations that might raise exceptions and clearly has been doing that for years. But POSIX requires exceptions to be raised in certain situations from nextafter*/nexttoward*, particularly if x != y and the return value is 0 or subnormal, FE_UNDERFLOW should be raised and if FE_OVERFLOW if it is returning +-Inf. The generic math_opt_barrier and math_force_eval definitions ought to work everywhere, but on some arches might pessimize the code. The first macro should just return its argument and hide it from the optimizer, so generally doesn't need to go through mem, if some arch has special constraints for floating point regs, it should use them. There is no need for this macro to force rounding to the actual type. math_force_eval needs to ensure rounding to the actual type of the var and then the result can be thrown away, all we care about is side-effects. 2007-03-27 Jakub Jelinek [BZ #3306] * math/math_private.h (math_opt_barrier, math_force_eval): Define. * sysdeps/i386/fpu/math_private.h: New file. * sysdeps/x86_64/fpu/math_private.h: New file. * math/s_nexttowardf.c (__nexttowardf): Use math_opt_barrier and math_force_eval macros. Use "+m" constraint on asm rather than "=m" and "m". * math/s_nextafter.c (__nextafter): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/flt-32/s_nextafterf.c (__nextafterf): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Use math_opt_barrier and math_force_eval macros. * sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl): Likewise. * sysdeps/ieee754/ldbl-96/s_nextafterl.c (__nextafterl): Likewise. * sysdeps/i386/fpu/s_nexttoward.c: Include float.h. (__nexttoward): Use math_opt_barrier and math_force_eval macros. Use "+m" constraint on asm rather than "=m" and "m". Only use asm to force double result if FLT_EVAL_METHOD is 2. * sysdeps/i386/fpu/s_nexttowardf.c: Include float.h. (__nexttowardf): Use math_opt_barrier and math_force_eval macros. Use "+m" constraint on asm rather than "=m" and "m". Only use asm to force double result if FLT_EVAL_METHOD is not 0. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include float.h. (__nexttowardf): Use math_opt_barrier and math_force_eval macros. If FLT_EVAL_METHOD is not 0, force x to float using asm. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include float.h. (__nldbl_nexttowardf): Use math_opt_barrier and math_force_eval macros. If FLT_EVAL_METHOD is not 0, force x to float using asm. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include float.h. (__nexttowardf): Use math_opt_barrier and math_force_eval macros. If FLT_EVAL_METHOD is not 0, force x to float using asm. * math/bug-nextafter.c (zero, inf): New variables. (main): Add new tests. * math/bug-nexttoward.c (zero, inf): New variables. (main): Add new tests. --- libc/math/s_nexttowardf.c.jj 2005-12-14 11:34:14.000000000 +0100 +++ libc/math/s_nexttowardf.c 2007-03-27 14:05:13.000000000 +0200 @@ -21,7 +21,7 @@ */ #include -#include "math_private.h" +#include #include #ifdef __STDC__ @@ -45,10 +45,12 @@ return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>20)-0x380 @@ -70,15 +72,12 @@ x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0) /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; } - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/math/bug-nextafter.c.jj 2003-12-09 19:10:47.000000000 +0100 +++ libc/math/bug-nextafter.c 2007-03-23 15:25:00.000000000 +0100 @@ -4,6 +4,9 @@ #include #include +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -34,6 +37,81 @@ main (void) ++result; } + i = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (m, i); + if (i < 0 || i >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + i = 0; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (-m, -i); + if (i > 0 || i <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + i = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, i) != 0.0) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, -i) != 0.0) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + double di = INFINITY; double dm = DBL_MAX; feclearexcept (FE_ALL_EXCEPT); @@ -59,5 +137,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, di) != 0.0) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, -di) != 0.0) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != li) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (-lm, -li) != -li) + { + puts ("nextafterl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != 0.0) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, -li) != 0.0) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } +#endif + return result; } --- libc/math/s_nextafter.c.jj 2005-12-14 11:33:59.000000000 +0100 +++ libc/math/s_nextafter.c 2007-03-27 14:05:23.000000000 +0200 @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: s_nextaf #define nexttoward __internal_nexttoward #include -#include "math_private.h" +#include #include #ifdef __STDC__ @@ -49,9 +49,12 @@ static char rcsid[] = "$NetBSD: s_nextaf return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ + double u; INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u*u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ @@ -74,15 +77,12 @@ static char rcsid[] = "$NetBSD: s_nextaf if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; /* overflow */ } - if(hy<0x00100000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - INSERT_WORDS(y,hx,lx); - return y; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; --- libc/math/math_private.h.jj 2005-11-21 16:43:03.000000000 +0100 +++ libc/math/math_private.h 2007-03-23 14:32:06.000000000 +0100 @@ -332,4 +332,10 @@ extern double __slowexp (double __x); extern double __slowpow (double __x, double __y, double __z); extern void __docos (double __x, double __dx, double __v[]); +#ifndef math_opt_barrier +#define math_opt_barrier(x) \ +({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; }) +#define math_force_eval(x) __asm __volatile ("" : : "m" (x)) +#endif + #endif /* _MATH_PRIVATE_H_ */ --- libc/math/bug-nexttoward.c.jj 2003-12-07 22:13:09.000000000 +0100 +++ libc/math/bug-nexttoward.c 2007-03-23 15:47:10.000000000 +0100 @@ -4,6 +4,9 @@ #include #include +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -35,6 +38,81 @@ main (void) ++result; } + fi = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (m, fi); + if (fi < 0 || fi >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + fi = 0; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (-m, -fi); + if (fi > 0 || fi <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + fi = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, fi) != 0.0) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, -fi) != 0.0) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + tl = (long double) DBL_MAX + 1.0e305L; double di = INFINITY; double dm = DBL_MAX; @@ -61,5 +139,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, di) != 0.0) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, -di) != 0.0) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != li) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (-lm, -li) != -li) + { + puts ("nexttowardl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != 0.0) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, -li) != 0.0) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } +#endif + return result; } --- libc/sysdeps/i386/fpu/s_nextafterl.c.jj 2003-02-15 06:22:58.000000000 +0100 +++ libc/sysdeps/i386/fpu/s_nextafterl.c 2007-03-27 13:50:40.000000000 +0200 @@ -27,7 +27,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -52,9 +52,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(esx>=0) { /* x > 0 */ if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) { @@ -109,12 +112,9 @@ static char rcsid[] = "$NetBSD: $"; } esy = esx&0x7fff; if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } + if(esy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; --- libc/sysdeps/i386/fpu/s_nexttoward.c.jj 2007-03-27 13:28:32.000000000 +0200 +++ libc/sysdeps/i386/fpu/s_nexttoward.c 2007-03-27 14:09:50.000000000 +0200 @@ -27,7 +27,8 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include +#include #ifdef __STDC__ double __nexttoward(double x, long double y) @@ -52,10 +53,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 @@ -85,16 +88,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7ff00000; if(hy>=0x7ff00000) { x = x+x; /* overflow */ - /* Force conversion to double. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; --- libc/sysdeps/i386/fpu/s_nexttowardf.c.jj 2003-12-07 22:12:13.000000000 +0100 +++ libc/sysdeps/i386/fpu/s_nexttowardf.c 2007-03-27 14:09:58.000000000 +0200 @@ -19,7 +19,8 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include +#include #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -44,10 +45,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 @@ -69,16 +72,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7f800000; if(hy>=0x7f800000) { x = x+x; /* overflow */ - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/sysdeps/i386/fpu/math_private.h.jj 2007-03-23 14:30:22.000000000 +0100 +++ libc/sysdeps/i386/fpu/math_private.h 2007-03-23 15:32:38.000000000 +0100 @@ -0,0 +1,18 @@ +#ifndef _MATH_PRIVATE_H + +#define math_opt_barrier(x) \ +({ __typeof(x) __x; \ + __asm ("" : "=t" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "m" (x)); \ + else \ + __asm __volatile ("" : : "f" (x)); \ + } \ +while (0) + +#include +#endif --- libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c.jj 2006-01-28 01:07:25.000000000 +0100 +++ libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c 2007-03-27 14:06:04.000000000 +0200 @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #include #include @@ -55,10 +55,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (hy<0||(ix>>20)>(iy>>52) @@ -89,16 +91,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; --- libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c.jj 2006-01-28 01:07:25.000000000 +0100 +++ libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c 2007-03-27 14:11:11.000000000 +0200 @@ -19,8 +19,9 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include #include +#include #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -46,10 +47,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>52)-0x380 @@ -69,13 +72,16 @@ static char rcsid[] = "$NetBSD: $"; } } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + float u = x*x; + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/sysdeps/ieee754/flt-32/s_nextafterf.c.jj 2003-12-07 21:53:59.000000000 +0100 +++ libc/sysdeps/ieee754/flt-32/s_nextafterf.c 2007-03-27 14:06:23.000000000 +0200 @@ -18,7 +18,7 @@ static char rcsid[] = "$NetBSD: s_nextaf #endif #include "math.h" -#include "math_private.h" +#include #include #ifdef __STDC__ @@ -40,9 +40,12 @@ static char rcsid[] = "$NetBSD: s_nextaf return x+y; if(x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ + float u; SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u*u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy) { /* x > y, x -= ulp */ @@ -61,15 +64,12 @@ static char rcsid[] = "$NetBSD: s_nextaf if(hy>=0x7f800000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0) - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; /* overflow */ } - if(hy<0x00800000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(y,hx); - return y; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/sysdeps/ieee754/ldbl-128/s_nextafterl.c.jj 1999-07-14 02:09:34.000000000 +0200 +++ libc/sysdeps/ieee754/ldbl-128/s_nextafterl.c 2007-03-27 13:51:15.000000000 +0200 @@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -47,9 +47,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ @@ -70,12 +73,9 @@ static char rcsid[] = "$NetBSD: $"; } hy = hx&0x7fff000000000000LL; if(hy==0x7fff000000000000LL) return x+x;/* overflow */ - if(hy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS64(y,hx,lx); - return y; - } + if(hy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS64(x,hx,lx); return x; --- libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c.jj 2003-12-07 22:21:29.000000000 +0100 +++ libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c 2007-03-27 14:06:31.000000000 +0200 @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #include #ifdef __STDC__ @@ -53,10 +53,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (hy<0||(ix>>20)>(iy>>48)-0x3c00 @@ -87,16 +89,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; --- libc/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c.jj 2006-01-21 20:43:12.000000000 +0100 +++ libc/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c 2007-03-27 14:12:02.000000000 +0200 @@ -20,7 +20,10 @@ * Special cases: */ +#include +#include #include +#include float __nldbl_nexttowardf(float x, double y); @@ -39,10 +42,12 @@ float __nldbl_nexttowardf(float x, doubl return x+y; if((double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>20)-0x380 @@ -60,13 +65,16 @@ float __nldbl_nexttowardf(float x, doubl hx += 1; } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c.jj 2001-10-16 13:02:24.000000000 +0200 +++ libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c 2007-03-27 13:51:30.000000000 +0200 @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -48,9 +48,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(esx<0x8000) { /* x > 0 */ if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { @@ -85,13 +88,10 @@ static char rcsid[] = "$NetBSD: $"; } } esy = esx&0x7fff; - if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; --- libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c.jj 2006-01-14 13:08:51.000000000 +0100 +++ libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c 2007-03-27 14:06:48.000000000 +0200 @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include #include #ifdef __STDC__ @@ -50,10 +50,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 @@ -84,16 +86,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; --- libc/sysdeps/ieee754/ldbl-96/s_nexttowardf.c.jj 2001-06-16 05:34:42.000000000 +0200 +++ libc/sysdeps/ieee754/ldbl-96/s_nexttowardf.c 2007-03-27 14:10:56.000000000 +0200 @@ -18,7 +18,8 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include +#include #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -41,10 +42,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 @@ -64,13 +67,16 @@ static char rcsid[] = "$NetBSD: $"; } } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; --- libc/sysdeps/x86_64/fpu/math_private.h.jj 2007-03-23 14:30:22.000000000 +0100 +++ libc/sysdeps/x86_64/fpu/math_private.h 2007-03-27 14:01:30.000000000 +0200 @@ -0,0 +1,21 @@ +#ifndef _MATH_PRIVATE_H + +#define math_opt_barrier(x) \ +({ __typeof(x) __x; \ + if (sizeof (x) <= sizeof (double)) \ + __asm ("" : "=x" (__x) : "0" (x)); \ + else \ + __asm ("" : "=t" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "x" (x)); \ + else \ + __asm __volatile ("" : : "f" (x)); \ + } \ +while (0) + +#include +#endif Jakub From munroesj@us.ibm.com Tue Mar 27 15:53:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Tue, 27 Mar 2007 15:53:00 -0000 Subject: [PATCH] PPC fenv fixes. In-Reply-To: <4602FCE5.7060203@us.ibm.com> References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> <4602FCE5.7060203@us.ibm.com> Message-ID: <460941B8.2050501@us.ibm.com> Steven Munroe wrote: > Jakub Jelinek wrote: > >> Hi! >> >> feholdexcept is supposed to clear the sticky exception bits: >> "The feholdexcept function saves the current floating-point environment in the object >> pointed to by envp, clears the floating-point status flags, and then installs a non-stop >> (continue on floating-point exceptions) mode, if available, for all floating-point >> exceptions." >> and >> "A floating-point status flag is a system variable whose value is set >> (but never cleared) when a floating-point exception is raised, which occurs as a side effect >> of exceptional floating-point arithmetic to provide auxiliary information." >> >> Several feholdexcept implementations didn't handle this right. >> Also, e.g. feupdateenv was a stub on x86_64 eventhough it is IMHO easily >> implementable and other arches had bugs in it too (e.g. ia64 would rise >> wrong exceptions and always return a failure). >> I added a new testcase for feholdexcept/feupdateenv (hopefully I haven't >> misinterpreted the standard) and I believe other arches (ppc*, s390*, ...) >> will need some care too. >> >> > > powerpc32 and powerpc64 both show two failures with the new test-fenv: > > Test: feholdexcept_tests FE_DIVBYZERO|FE_INVALID test > Fail: Exception "DIVBYZERO" is not set > Pass: Exception "INVALID" is set > Pass: Exception "INEXACT" is not set > Pass: Exception "UNDERFLOW" is not set > Pass: Exception "OVERFLOW" is not set > > and > > Test: feholdexcept_tests FE_INEXACT|FE_INVALID test > Pass: Exception "DIVBYZERO" is not set > Fail: Exception "INVALID" is not set > Pass: Exception "INEXACT" is set > Pass: Exception "UNDERFLOW" is not set > Pass: Exception "OVERFLOW" is not set > > We will look into this. > feupdateenv was not merging pending and current exceptions correctly and caused 2 failures with the new feholdexcept tests. The attached patch fixes feupdateenv for ppc32/ppc64. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ppc-feupdateenv-20070327.txt URL: From munroesj@us.ibm.com Tue Mar 27 18:07:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Tue, 27 Mar 2007 18:07:00 -0000 Subject: [PATCH] PPC fenv fixes. In-Reply-To: <20070327160708.GA355@devserv.devel.redhat.com> References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> <4602FCE5.7060203@us.ibm.com> <460941B8.2050501@us.ibm.com> <20070327160708.GA355@devserv.devel.redhat.com> Message-ID: <46096124.6050504@us.ibm.com> Jakub Jelinek wrote: > On Tue, Mar 27, 2007 at 11:09:28AM -0500, Steven Munroe wrote: > >> 2007-03-26 Steven Munroe >> >> * sysdeps/powerpc/fpu/feupdateenv.c: Change mask to merge exceptions >> from env. >> > > Will that actually raise SIGFPE signals when exceptions are enabled? > From my reading of POSIX that's what should happen with the > `old' exceptions (and other arches are calling feraiseexcept that will do > that). I didn't add a testcase for it because I'm not 100% sure about that. > > hmmm not unless the SIGFPE is eanbled by the MSR FE bits. So we will need to call __fe_nomask_env() in feupdateenv similar to what we do in feenableexcept(). Probably should add the __fe_mask_env() call for when the application remasks FP exceptions. This allows the hardware to run faster when we are taking the default action. I will rework the patch. From munroesj@us.ibm.com Wed Mar 28 15:29:00 2007 From: munroesj@us.ibm.com (Steven Munroe) Date: Wed, 28 Mar 2007 15:29:00 -0000 Subject: [PATCH] PPC fenv fixes. In-Reply-To: <46096124.6050504@us.ibm.com> References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> <4602FCE5.7060203@us.ibm.com> <460941B8.2050501@us.ibm.com> <20070327160708.GA355@devserv.devel.redhat.com> <46096124.6050504@us.ibm.com> Message-ID: <460A8D78.6060303@us.ibm.com> Steven Munroe wrote: > Jakub Jelinek wrote: > >> On Tue, Mar 27, 2007 at 11:09:28AM -0500, Steven Munroe wrote: >> >>> 2007-03-26 Steven Munroe >>> >>> * sysdeps/powerpc/fpu/feupdateenv.c: Change mask to merge exceptions >>> from env. >>> >> Will that actually raise SIGFPE signals when exceptions are enabled? >> From my reading of POSIX that's what should happen with the >> `old' exceptions (and other arches are calling feraiseexcept that will do >> that). I didn't add a testcase for it because I'm not 100% sure about that. >> >> > hmmm not unless the SIGFPE is eanbled by the MSR FE bits. So we will > need to call __fe_nomask_env() in feupdateenv similar to what we do in > feenableexcept(). Probably should add the __fe_mask_env() call for when > the application remasks FP exceptions. This allows the hardware to run > faster when we are taking the default action. > > I will rework the patch. > Merges my patch with one from Peter Bergner to use the prctl system to eanble/disable FP exception when ever the FPSCR exeptions bits: FPSCR_VE, /* invalid operation exception enable */ FPSCR_OE, /* overflow exception enable */ FPSCR_UE, /* underflow exception enable */ FPSCR_ZE, /* zero divide exception enable */ FPSCR_XE, /* inexact exception enable */ Change from all disabled to any enabled or any eanbled to all disabled. This check was already in feenableexcept(). This patch adds the appropriate eanble/disable calls to fedisableexcept() and __feupdateenv(). -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ppc-fenv-20070320.txt URL: From jakub@redhat.com Fri Mar 30 11:41:00 2007 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 30 Mar 2007 11:41:00 -0000 Subject: [PATCH] __THROW in libio revisited Message-ID: <20070330114616.GE1826@sunsite.mff.cuni.cz> Hi! The following functions either directly call cancellation points (usually open, write, read) or can call it indirectly. This patch itself doesn't fix BZ#2748, but together with building involved objects with -fexceptions it would. While I think I prefer just compiling whole glibc with -fasynchronous-unwind-tables which doesn't actually require the __THROW removal (except on exported functions), IMHO nuking __THROW even just for documentation purposes that a function is a possible cancellation point is a good idea. 2007-03-30 Jakub Jelinek * libio/libio.h (__underflow, __uflow, __overflow, __wunderflow, __wuflow, __woverflow, _IO_getc, _IO_putc, _IO_peekc_locked, _IO_padn, _IO_sgetn, _IO_seekoff, _IO_seekpos, _IO_getwc, _IO_putwc, _IO_wpadn): Remove __THROW. * libio/fileops.c (new_do_write, _IO_file_xsgetn_mmap, _IO_file_xsgetn_maybe_mmap): Likewise. * libio/oldfileops.c (old_do_write): Likewise. * libio/libioP.h (_IO_switch_to_get_mode, _IO_switch_to_wget_mode, _IO_init_marker, _IO_init_wmarker, _IO_default_uflow, _IO_wdefault_uflow, _IO_default_setbuf, _IO_default_seekpos, _IO_do_write, _IO_new_do_write, _IO_old_do_write, _IO_wdo_write, _IO_flush_all_lockp, _IO_flush_all, _IO_cleanup, _IO_flush_all_linebuffered, _IO_new_fgetpos, _IO_old_fgetpos, _IO_new_fsetpos, _IO_old_fsetpos, _IO_new_fgetpos64, _IO_old_fgetpos64, _IO_new_fsetpos64, _IO_old_fsetpos64, _IO_file_setbuf, _IO_file_seekoff, _IO_file_xsputn, _IO_file_xsgetn, _IO_file_underflow, _IO_file_underflow_mmap, _IO_file_underflow_maybe_mmap, _IO_file_overflow, _IO_file_attach, _IO_file_open, _IO_file_fopen, _IO_file_write, _IO_file_read, _IO_file_sync, _IO_file_close_it, _IO_file_finish, _IO_new_file_attach, _IO_new_file_close_it, _IO_new_file_finish, _IO_new_file_fopen, _IO_new_file_setbuf, _IO_file_setbuf_mmap, _IO_new_file_sync, _IO_new_file_underflow, _IO_new_file_overflow, _IO_new_file_seekoff, _IO_new_file_write, _IO_new_file_xsputn, _IO_old_file_setbuf, _IO_old_file_seekoff, _IO_old_file_xsputn, _IO_old_file_underflow, _IO_old_file_overflow, _IO_old_file_attach, _IO_old_file_fopen, _IO_old_file_write, _IO_old_file_sync, _IO_old_file_close_it, _IO_old_file_finish, _IO_wfile_xsputn, _IO_wfile_setbuf, _IO_wfile_sync, _IO_wfile_underflow, _IO_wfile_overflow, _IO_wfile_seekoff, _IO_old_proc_open, _IO_old_proc_close, _IO_getdelim, _IO_flush_all_internal, _IO_adjust_column_internal, _IO_default_uflow_internal, _IO_default_xsgetn_internal, _IO_wdefault_xsputn_internal, _IO_wdefault_xsgetn_internal, _IO_wdefault_uflow_internal, _IO_file_setbuf_internal, _IO_file_seekoff_internal, _IO_file_xsputn_internal, _IO_file_xsgetn_internal, _IO_file_close_it_internal, _IO_file_underflow_internal, _IO_file_overflow_internal, _IO_file_attach_internal, _IO_file_fopen_internal, _IO_file_sync_internal, _IO_file_finish_internal, _IO_wfile_xsputn_internal, _IO_wfile_seekoff_internal, _IO_wfile_sync_internal, _IO_switch_to_wget_mode_internal, _IO_padn_internal, _IO_switch_to_get_mode_internal, _IO_seekoff_unlocked, _IO_seekpos_unlocked): Likewise. (_IO_strtod, _IO_dtoa, _IO_outfloat, _IO_read, _IO_write, _IO_lseek, _IO_close, _IO_fstat): Remove unused prototypes. --- libc/libio/libio.h.jj 2007-01-03 10:59:40.000000000 +0100 +++ libc/libio/libio.h 2007-03-29 18:50:38.000000000 +0200 @@ -410,12 +410,12 @@ extern void _IO_cookie_init (struct _IO_ extern "C" { #endif -extern int __underflow (_IO_FILE *) __THROW; -extern int __uflow (_IO_FILE *) __THROW; -extern int __overflow (_IO_FILE *, int) __THROW; -extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW; -extern _IO_wint_t __wuflow (_IO_FILE *) __THROW; -extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW; +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +extern _IO_wint_t __wunderflow (_IO_FILE *); +extern _IO_wint_t __wuflow (_IO_FILE *); +extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t); #if __GNUC__ >= 3 # define _IO_BE(expr, res) __builtin_expect ((expr), res) @@ -448,12 +448,12 @@ extern _IO_wint_t __woverflow (_IO_FILE #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) -extern int _IO_getc (_IO_FILE *__fp) __THROW; -extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW; +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); extern int _IO_feof (_IO_FILE *__fp) __THROW; extern int _IO_ferror (_IO_FILE *__fp) __THROW; -extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW; +extern int _IO_peekc_locked (_IO_FILE *__fp); /* This one is for Emacs. */ #define _IO_PENDING_OUTPUT_COUNT(_fp) \ @@ -482,17 +482,17 @@ extern int _IO_vfscanf (_IO_FILE * __res _IO_va_list, int *__restrict); extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, _IO_va_list); -extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW; -extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW; +extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t); +extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t); -extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW; +extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int); extern void _IO_free_backup_area (_IO_FILE *) __THROW; #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW; -extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW; +extern _IO_wint_t _IO_getwc (_IO_FILE *__fp); +extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp); extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW; # if __GNUC__ >= 2 /* While compiling glibc we have to handle compatibility with very old @@ -531,7 +531,7 @@ extern int _IO_vfwscanf (_IO_FILE * __re _IO_va_list, int *__restrict); extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict, _IO_va_list); -extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW; +extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t); extern void _IO_free_wbackup_area (_IO_FILE *) __THROW; #endif --- libc/libio/fileops.c.jj 2007-01-17 11:18:43.000000000 +0100 +++ libc/libio/fileops.c 2007-03-29 18:55:52.000000000 +0200 @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995, 1997-2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner . @@ -472,7 +473,7 @@ _IO_file_setbuf_mmap (fp, p, len) return result; } -static _IO_size_t new_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; +static _IO_size_t new_do_write (_IO_FILE *, const char *, _IO_size_t); /* Write TO_DO bytes from DATA to FP. Then mark FP as having empty buffers. */ @@ -1468,8 +1469,7 @@ _IO_file_xsgetn (fp, data, n) } INTDEF(_IO_file_xsgetn) -static _IO_size_t _IO_file_xsgetn_mmap (_IO_FILE *, void *, _IO_size_t) - __THROW; +static _IO_size_t _IO_file_xsgetn_mmap (_IO_FILE *, void *, _IO_size_t); static _IO_size_t _IO_file_xsgetn_mmap (fp, data, n) _IO_FILE *fp; @@ -1528,8 +1528,7 @@ _IO_file_xsgetn_mmap (fp, data, n) return s - (char *) data; } -static _IO_size_t _IO_file_xsgetn_maybe_mmap (_IO_FILE *, void *, _IO_size_t) - __THROW; +static _IO_size_t _IO_file_xsgetn_maybe_mmap (_IO_FILE *, void *, _IO_size_t); static _IO_size_t _IO_file_xsgetn_maybe_mmap (fp, data, n) _IO_FILE *fp; --- libc/libio/oldfileops.c.jj 2005-10-17 17:54:13.000000000 +0200 +++ libc/libio/oldfileops.c 2007-03-29 18:54:48.000000000 +0200 @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995, 1997-2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997-2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner . @@ -271,7 +272,7 @@ _IO_old_file_setbuf (fp, p, len) return fp; } -static int old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; +static int old_do_write (_IO_FILE *, const char *, _IO_size_t); /* Write TO_DO bytes from DATA to FP. Then mark FP as having empty buffers. */ --- libc/libio/libioP.h.jj 2006-01-14 13:09:46.000000000 +0100 +++ libc/libio/libioP.h 2007-03-29 18:38:10.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1997-2003,2004,2005,2006 +/* Copyright (C) 1993, 1997-2003,2004,2005,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -380,7 +380,7 @@ typedef struct _IO_FILE *_IO_ITER; extern void _IO_switch_to_main_get_area (_IO_FILE *) __THROW; extern void _IO_switch_to_backup_area (_IO_FILE *) __THROW; -extern int _IO_switch_to_get_mode (_IO_FILE *) __THROW; +extern int _IO_switch_to_get_mode (_IO_FILE *); extern void _IO_init (_IO_FILE *, int) __THROW; extern int _IO_sputbackc (_IO_FILE *, int) __THROW; extern int _IO_sungetc (_IO_FILE *) __THROW; @@ -394,7 +394,7 @@ extern unsigned _IO_adjust_column (unsig extern void _IO_switch_to_main_wget_area (_IO_FILE *) __THROW; extern void _IO_switch_to_wbackup_area (_IO_FILE *) __THROW; -extern int _IO_switch_to_wget_mode (_IO_FILE *) __THROW; +extern int _IO_switch_to_wget_mode (_IO_FILE *); extern void _IO_wsetb (_IO_FILE *, wchar_t *, wchar_t *, int) __THROW; extern wint_t _IO_sputbackwc (_IO_FILE *, wint_t) __THROW; extern wint_t _IO_sungetwc (_IO_FILE *) __THROW; @@ -404,8 +404,8 @@ extern unsigned _IO_adjust_wcolumn (unsi /* Marker-related function. */ -extern void _IO_init_marker (struct _IO_marker *, _IO_FILE *) __THROW; -extern void _IO_init_wmarker (struct _IO_marker *, _IO_FILE *) __THROW; +extern void _IO_init_marker (struct _IO_marker *, _IO_FILE *); +extern void _IO_init_wmarker (struct _IO_marker *, _IO_FILE *); extern void _IO_remove_marker (struct _IO_marker *) __THROW; extern int _IO_marker_difference (struct _IO_marker *, struct _IO_marker *) __THROW; @@ -434,22 +434,22 @@ libc_hidden_proto (_IO_list_resetlock) /* Default jumptable functions. */ extern int _IO_default_underflow (_IO_FILE *) __THROW; -extern int _IO_default_uflow (_IO_FILE *) __THROW; -extern wint_t _IO_wdefault_uflow (_IO_FILE *) __THROW; +extern int _IO_default_uflow (_IO_FILE *); +extern wint_t _IO_wdefault_uflow (_IO_FILE *); extern int _IO_default_doallocate (_IO_FILE *) __THROW; extern int _IO_wdefault_doallocate (_IO_FILE *) __THROW; extern void _IO_default_finish (_IO_FILE *, int) __THROW; extern void _IO_wdefault_finish (_IO_FILE *, int) __THROW; extern int _IO_default_pbackfail (_IO_FILE *, int) __THROW; extern wint_t _IO_wdefault_pbackfail (_IO_FILE *, wint_t) __THROW; -extern _IO_FILE* _IO_default_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; +extern _IO_FILE* _IO_default_setbuf (_IO_FILE *, char *, _IO_ssize_t); extern _IO_size_t _IO_default_xsputn (_IO_FILE *, const void *, _IO_size_t); extern _IO_size_t _IO_wdefault_xsputn (_IO_FILE *, const void *, _IO_size_t); extern _IO_size_t _IO_default_xsgetn (_IO_FILE *, void *, _IO_size_t); extern _IO_size_t _IO_wdefault_xsgetn (_IO_FILE *, void *, _IO_size_t); extern _IO_off64_t _IO_default_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_off64_t _IO_default_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW; +extern _IO_off64_t _IO_default_seekpos (_IO_FILE *, _IO_off64_t, int); extern _IO_ssize_t _IO_default_write (_IO_FILE *, const void *, _IO_ssize_t); extern _IO_ssize_t _IO_default_read (_IO_FILE *, void *, _IO_ssize_t); extern int _IO_default_stat (_IO_FILE *, void *) __THROW; @@ -473,22 +473,22 @@ extern const struct _IO_jump_t _IO_old_p extern const struct _IO_jump_t _IO_str_jumps attribute_hidden; extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden; extern const struct _IO_codecvt __libio_codecvt attribute_hidden; -extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t) __THROW; -extern int _IO_flush_all_lockp (int) __THROW; -extern int _IO_flush_all (void) __THROW; -extern int _IO_cleanup (void) __THROW; -extern void _IO_flush_all_linebuffered (void) __THROW; -extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *) __THROW; -extern int _IO_old_fgetpos (_IO_FILE *, _IO_fpos_t *) __THROW; -extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *) __THROW; -extern int _IO_old_fsetpos (_IO_FILE *, const _IO_fpos_t *) __THROW; -extern int _IO_new_fgetpos64 (_IO_FILE *, _IO_fpos64_t *) __THROW; -extern int _IO_old_fgetpos64 (_IO_FILE *, _IO_fpos64_t *) __THROW; -extern int _IO_new_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *) __THROW; -extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *) __THROW; +extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t); +extern int _IO_flush_all_lockp (int); +extern int _IO_flush_all (void); +extern int _IO_cleanup (void); +extern void _IO_flush_all_linebuffered (void); +extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *); +extern int _IO_old_fgetpos (_IO_FILE *, _IO_fpos_t *); +extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *); +extern int _IO_old_fsetpos (_IO_FILE *, const _IO_fpos_t *); +extern int _IO_new_fgetpos64 (_IO_FILE *, _IO_fpos64_t *); +extern int _IO_old_fgetpos64 (_IO_FILE *, _IO_fpos64_t *); +extern int _IO_new_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *); +extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *); extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW; @@ -534,95 +534,79 @@ extern void _IO_old_init (_IO_FILE *fp, /* Jumptable functions for files. */ extern int _IO_file_doallocate (_IO_FILE *) __THROW; -extern _IO_FILE* _IO_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_off64_t _IO_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; +extern _IO_FILE* _IO_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_off64_t _IO_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); extern _IO_off64_t _IO_file_seekoff_mmap (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_size_t _IO_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern _IO_size_t _IO_file_xsgetn (_IO_FILE *, void *, _IO_size_t) __THROW; +extern _IO_size_t _IO_file_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern _IO_size_t _IO_file_xsgetn (_IO_FILE *, void *, _IO_size_t); extern int _IO_file_stat (_IO_FILE *, void *) __THROW; extern int _IO_file_close (_IO_FILE *) __THROW; extern int _IO_file_close_mmap (_IO_FILE *) __THROW; -extern int _IO_file_underflow (_IO_FILE *) __THROW; -extern int _IO_file_underflow_mmap (_IO_FILE *) __THROW; -extern int _IO_file_underflow_maybe_mmap (_IO_FILE *) __THROW; -extern int _IO_file_overflow (_IO_FILE *, int) __THROW; +extern int _IO_file_underflow (_IO_FILE *); +extern int _IO_file_underflow_mmap (_IO_FILE *); +extern int _IO_file_underflow_maybe_mmap (_IO_FILE *); +extern int _IO_file_overflow (_IO_FILE *, int); #define _IO_file_is_open(__fp) ((__fp)->_fileno != -1) extern void _IO_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_file_attach (_IO_FILE *, int) __THROW; -extern _IO_FILE* _IO_file_open (_IO_FILE *, const char *, int, int, int, int) - __THROW; +extern _IO_FILE* _IO_file_attach (_IO_FILE *, int); +extern _IO_FILE* _IO_file_open (_IO_FILE *, const char *, int, int, int, int); libc_hidden_proto (_IO_file_open) -extern _IO_FILE* _IO_file_fopen (_IO_FILE *, const char *, const char *, int) - __THROW; -extern _IO_ssize_t _IO_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern _IO_ssize_t _IO_file_read (_IO_FILE *, void *, _IO_ssize_t) __THROW; -extern int _IO_file_sync (_IO_FILE *) __THROW; -extern int _IO_file_close_it (_IO_FILE *) __THROW; +extern _IO_FILE* _IO_file_fopen (_IO_FILE *, const char *, const char *, int); +extern _IO_ssize_t _IO_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern _IO_ssize_t _IO_file_read (_IO_FILE *, void *, _IO_ssize_t); +extern int _IO_file_sync (_IO_FILE *); +extern int _IO_file_close_it (_IO_FILE *); extern _IO_off64_t _IO_file_seek (_IO_FILE *, _IO_off64_t, int) __THROW; -extern void _IO_file_finish (_IO_FILE *, int) __THROW; +extern void _IO_file_finish (_IO_FILE *, int); -extern _IO_FILE* _IO_new_file_attach (_IO_FILE *, int) __THROW; -extern int _IO_new_file_close_it (_IO_FILE *) __THROW; -extern void _IO_new_file_finish (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_new_file_attach (_IO_FILE *, int); +extern int _IO_new_file_close_it (_IO_FILE *); +extern void _IO_new_file_finish (_IO_FILE *, int); extern _IO_FILE* _IO_new_file_fopen (_IO_FILE *, const char *, const char *, - int) __THROW; + int); extern void _IO_no_init (_IO_FILE *, int, int, struct _IO_wide_data *, const struct _IO_jump_t *) __THROW; extern void _IO_new_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_new_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_FILE* _IO_file_setbuf_mmap (_IO_FILE *, char *, _IO_ssize_t) - __THROW; -extern int _IO_new_file_sync (_IO_FILE *) __THROW; -extern int _IO_new_file_underflow (_IO_FILE *) __THROW; -extern int _IO_new_file_overflow (_IO_FILE *, int) __THROW; -extern _IO_off64_t _IO_new_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; -extern _IO_ssize_t _IO_new_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern _IO_size_t _IO_new_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; - -extern _IO_FILE* _IO_old_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_off64_t _IO_old_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; -extern _IO_size_t _IO_old_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern int _IO_old_file_underflow (_IO_FILE *) __THROW; -extern int _IO_old_file_overflow (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_new_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_FILE* _IO_file_setbuf_mmap (_IO_FILE *, char *, _IO_ssize_t); +extern int _IO_new_file_sync (_IO_FILE *); +extern int _IO_new_file_underflow (_IO_FILE *); +extern int _IO_new_file_overflow (_IO_FILE *, int); +extern _IO_off64_t _IO_new_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_ssize_t _IO_new_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern _IO_size_t _IO_new_file_xsputn (_IO_FILE *, const void *, _IO_size_t); + +extern _IO_FILE* _IO_old_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_off64_t _IO_old_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_size_t _IO_old_file_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern int _IO_old_file_underflow (_IO_FILE *); +extern int _IO_old_file_overflow (_IO_FILE *, int); extern void _IO_old_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_old_file_attach (_IO_FILE *, int) __THROW; -extern _IO_FILE* _IO_old_file_fopen (_IO_FILE *, const char *, const char *) - __THROW; -extern _IO_ssize_t _IO_old_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern int _IO_old_file_sync (_IO_FILE *) __THROW; -extern int _IO_old_file_close_it (_IO_FILE *) __THROW; -extern void _IO_old_file_finish (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_old_file_attach (_IO_FILE *, int); +extern _IO_FILE* _IO_old_file_fopen (_IO_FILE *, const char *, const char *); +extern _IO_ssize_t _IO_old_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern int _IO_old_file_sync (_IO_FILE *); +extern int _IO_old_file_close_it (_IO_FILE *); +extern void _IO_old_file_finish (_IO_FILE *, int); extern int _IO_wfile_doallocate (_IO_FILE *) __THROW; -extern _IO_size_t _IO_wfile_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern _IO_FILE* _IO_wfile_setbuf (_IO_FILE *, wchar_t *, _IO_ssize_t) __THROW; -extern wint_t _IO_wfile_sync (_IO_FILE *) __THROW; -extern wint_t _IO_wfile_underflow (_IO_FILE *) __THROW; -extern wint_t _IO_wfile_overflow (_IO_FILE *, wint_t) __THROW; -extern _IO_off64_t _IO_wfile_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; +extern _IO_size_t _IO_wfile_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern _IO_FILE* _IO_wfile_setbuf (_IO_FILE *, wchar_t *, _IO_ssize_t); +extern wint_t _IO_wfile_sync (_IO_FILE *); +extern wint_t _IO_wfile_underflow (_IO_FILE *); +extern wint_t _IO_wfile_overflow (_IO_FILE *, wint_t); +extern _IO_off64_t _IO_wfile_seekoff (_IO_FILE *, _IO_off64_t, int, int); /* Jumptable functions for proc_files. */ extern _IO_FILE* _IO_proc_open (_IO_FILE *, const char *, const char *) __THROW; extern _IO_FILE* _IO_new_proc_open (_IO_FILE *, const char *, const char *) __THROW; -extern _IO_FILE* _IO_old_proc_open (_IO_FILE *, const char *, const char *) - __THROW; +extern _IO_FILE* _IO_old_proc_open (_IO_FILE *, const char *, const char *); extern int _IO_proc_close (_IO_FILE *) __THROW; extern int _IO_new_proc_close (_IO_FILE *) __THROW; -extern int _IO_old_proc_close (_IO_FILE *) __THROW; +extern int _IO_old_proc_close (_IO_FILE *); /* Jumptable functions for strfiles. */ extern int _IO_str_underflow (_IO_FILE *) __THROW; @@ -660,73 +644,62 @@ extern int _IO_vsnprintf (char *string, extern _IO_size_t _IO_getline (_IO_FILE *,char *, _IO_size_t, int, int); extern _IO_size_t _IO_getline_info (_IO_FILE *,char *, _IO_size_t, int, int, int *); -extern _IO_ssize_t _IO_getdelim (char **, _IO_size_t *, int, _IO_FILE *) - __THROW; +extern _IO_ssize_t _IO_getdelim (char **, _IO_size_t *, int, _IO_FILE *); extern _IO_size_t _IO_getwline (_IO_FILE *,wchar_t *, _IO_size_t, wint_t, int); extern _IO_size_t _IO_getwline_info (_IO_FILE *,wchar_t *, _IO_size_t, wint_t, int, wint_t *); -extern double _IO_strtod (const char *, char **) __THROW; -extern char *_IO_dtoa (double __d, int __mode, int __ndigits, - int *__decpt, int *__sign, char **__rve) __THROW; -extern int _IO_outfloat (double __value, _IO_FILE *__sb, int __type, - int __width, int __precision, int __flags, - int __sign_mode, int __fill) __THROW; extern struct _IO_FILE_plus *_IO_list_all; extern void (*_IO_cleanup_registration_needed) (void); /* Prototype for functions with alternative entry point. */ -extern int _IO_flush_all_internal (void) __THROW; -extern unsigned _IO_adjust_column_internal (unsigned, const char *, int) - __THROW; +extern int _IO_flush_all_internal (void); +extern unsigned _IO_adjust_column_internal (unsigned, const char *, int); -extern int _IO_default_uflow_internal (_IO_FILE *) __THROW; +extern int _IO_default_uflow_internal (_IO_FILE *); extern void _IO_default_finish_internal (_IO_FILE *, int) __THROW; extern int _IO_default_pbackfail_internal (_IO_FILE *, int) __THROW; extern _IO_size_t _IO_default_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; -extern _IO_size_t _IO_default_xsgetn_internal (_IO_FILE *, void *, _IO_size_t) - __THROW; + _IO_size_t); +extern _IO_size_t _IO_default_xsgetn_internal (_IO_FILE *, void *, _IO_size_t); extern int _IO_default_doallocate_internal (_IO_FILE *) __THROW; extern void _IO_wdefault_finish_internal (_IO_FILE *, int) __THROW; extern wint_t _IO_wdefault_pbackfail_internal (_IO_FILE *, wint_t) __THROW; extern _IO_size_t _IO_wdefault_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; + _IO_size_t); extern _IO_size_t _IO_wdefault_xsgetn_internal (_IO_FILE *, void *, - _IO_size_t) __THROW; + _IO_size_t); extern int _IO_wdefault_doallocate_internal (_IO_FILE *) __THROW; -extern wint_t _IO_wdefault_uflow_internal (_IO_FILE *) __THROW; +extern wint_t _IO_wdefault_uflow_internal (_IO_FILE *); extern int _IO_file_doallocate_internal (_IO_FILE *) __THROW; -extern _IO_FILE* _IO_file_setbuf_internal (_IO_FILE *, char *, _IO_ssize_t) - __THROW; +extern _IO_FILE* _IO_file_setbuf_internal (_IO_FILE *, char *, _IO_ssize_t); extern _IO_off64_t _IO_file_seekoff_internal (_IO_FILE *, _IO_off64_t, - int, int) __THROW; + int, int); extern _IO_size_t _IO_file_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; -extern _IO_size_t _IO_file_xsgetn_internal (_IO_FILE *, void *, _IO_size_t) - __THROW; + _IO_size_t); +extern _IO_size_t _IO_file_xsgetn_internal (_IO_FILE *, void *, _IO_size_t); extern int _IO_file_stat_internal (_IO_FILE *, void *) __THROW; extern int _IO_file_close_internal (_IO_FILE *) __THROW; -extern int _IO_file_close_it_internal (_IO_FILE *) __THROW; -extern int _IO_file_underflow_internal (_IO_FILE *) __THROW; -extern int _IO_file_overflow_internal (_IO_FILE *, int) __THROW; +extern int _IO_file_close_it_internal (_IO_FILE *); +extern int _IO_file_underflow_internal (_IO_FILE *); +extern int _IO_file_overflow_internal (_IO_FILE *, int); extern void _IO_file_init_internal (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_file_attach_internal (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_file_attach_internal (_IO_FILE *, int); extern _IO_FILE* _IO_file_fopen_internal (_IO_FILE *, const char *, - const char *, int) __THROW; + const char *, int); extern _IO_ssize_t _IO_file_read_internal (_IO_FILE *, void *, _IO_ssize_t); -extern int _IO_file_sync_internal (_IO_FILE *) __THROW; +extern int _IO_file_sync_internal (_IO_FILE *); extern _IO_off64_t _IO_file_seek_internal (_IO_FILE *, _IO_off64_t, int) __THROW; -extern void _IO_file_finish_internal (_IO_FILE *, int) __THROW; +extern void _IO_file_finish_internal (_IO_FILE *, int); extern _IO_size_t _IO_wfile_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; + _IO_size_t); extern _IO_off64_t _IO_wfile_seekoff_internal (_IO_FILE *, _IO_off64_t, - int, int) __THROW; -extern wint_t _IO_wfile_sync_internal (_IO_FILE *) __THROW; + int, int); +extern wint_t _IO_wfile_sync_internal (_IO_FILE *); extern int _IO_str_underflow_internal (_IO_FILE *) __THROW; extern int _IO_str_overflow_internal (_IO_FILE *, int) __THROW; @@ -747,12 +720,12 @@ extern void _IO_wdoallocbuf_internal (_I extern _IO_size_t _IO_sgetn_internal (_IO_FILE *, void *, _IO_size_t); extern void _IO_flush_all_linebuffered_internal (void) __THROW; -extern int _IO_switch_to_wget_mode_internal (_IO_FILE *) __THROW; +extern int _IO_switch_to_wget_mode_internal (_IO_FILE *); extern void _IO_unsave_markers_internal (_IO_FILE *) __THROW; extern void _IO_switch_to_main_wget_area_internal (_IO_FILE *) __THROW; extern int _IO_wdo_write_internal (_IO_FILE *, const wchar_t *, _IO_size_t); extern int _IO_do_write_internal (_IO_FILE *, const char *, _IO_size_t); -extern _IO_ssize_t _IO_padn_internal (_IO_FILE *, int, _IO_ssize_t) __THROW; +extern _IO_ssize_t _IO_padn_internal (_IO_FILE *, int, _IO_ssize_t); extern _IO_size_t _IO_getline_info_internal (_IO_FILE *,char *, _IO_size_t, int, int, int *); extern _IO_size_t _IO_getline_internal (_IO_FILE *, char *, _IO_size_t, int, @@ -762,7 +735,7 @@ extern void _IO_free_backup_area_interna extern void _IO_switch_to_wbackup_area_internal (_IO_FILE *) __THROW; extern void _IO_setb_internal (_IO_FILE *, char *, char *, int) __THROW; extern wint_t _IO_sputbackwc_internal (_IO_FILE *, wint_t) __THROW; -extern int _IO_switch_to_get_mode_internal (_IO_FILE *) __THROW; +extern int _IO_switch_to_get_mode_internal (_IO_FILE *); extern int _IO_vfscanf_internal (_IO_FILE * __restrict, const char * __restrict, _IO_va_list, int *__restrict); @@ -772,9 +745,9 @@ extern void _IO_doallocbuf_internal (_IO extern void _IO_wsetb_internal (_IO_FILE *, wchar_t *, wchar_t *, int) __THROW; extern _IO_off64_t _IO_seekoff_unlocked (_IO_FILE *, _IO_off64_t, int, int) - attribute_hidden __THROW; + attribute_hidden; extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int) - attribute_hidden __THROW; + attribute_hidden; extern int _IO_putc_internal (int __c, _IO_FILE *__fp); extern void _IO_init_internal (_IO_FILE *, int) __THROW; extern void _IO_un_link_internal (struct _IO_FILE_plus *) __THROW; @@ -866,12 +839,6 @@ extern void _IO_un_link_internal (struct #ifndef OS_FSTAT # define OS_FSTAT fstat #endif -struct stat; -extern _IO_ssize_t _IO_read (int, void *, _IO_size_t); -extern _IO_ssize_t _IO_write (int, const void *, _IO_size_t); -extern _IO_off64_t _IO_lseek (int, _IO_off64_t, int) __THROW; -extern int _IO_close (int); -extern int _IO_fstat (int, struct stat *) __THROW; extern int _IO_vscanf (const char *, _IO_va_list) __THROW; /* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */ Jakub