summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-12-22 19:27:39 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-12-22 19:27:39 +0000
commit8a031172c235ab0def5763dd5f3a00f9ff10c053 (patch)
tree11ba9c29e8edc754174f18e6db425971144769c9 /libc
parenta179b968417641981213cfe422c741141d8394e4 (diff)
downloadeglibc2-8a031172c235ab0def5763dd5f3a00f9ff10c053.tar.gz
Merge changes between r16068 and r16332 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@16333 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
-rw-r--r--libc/ChangeLog235
-rw-r--r--libc/NEWS14
-rw-r--r--libc/iconv/gconv.h5
-rw-r--r--libc/iconvdata/unicode.c8
-rw-r--r--libc/iconvdata/utf-16.c57
-rw-r--r--libc/iconvdata/utf-32.c21
-rw-r--r--libc/inet/Makefile6
-rw-r--r--libc/inet/netinet/in.h72
-rw-r--r--libc/inet/tst-checks.c173
-rw-r--r--libc/libidn/ChangeLog4
-rw-r--r--libc/libidn/idna.c7
-rw-r--r--libc/locale/iso-639.def1
-rw-r--r--libc/localedata/ChangeLog21
-rw-r--r--libc/localedata/SUPPORTED4
-rw-r--r--libc/localedata/locales/bho_IN164
-rw-r--r--libc/localedata/locales/brx_IN185
-rw-r--r--libc/localedata/locales/es_CU122
-rw-r--r--libc/localedata/locales/nl_BE2
-rw-r--r--libc/localedata/locales/unm_US150
-rw-r--r--libc/malloc/mcheck.h4
-rw-r--r--libc/malloc/mtrace.c8
-rw-r--r--libc/manual/resource.texi2
-rw-r--r--libc/math/bits/math-finite.h187
-rw-r--r--libc/math/libm-test.inc4
-rw-r--r--libc/math/s_cacosh.c11
-rw-r--r--libc/math/s_cacoshf.c28
-rw-r--r--libc/math/s_cacoshl.c12
-rw-r--r--libc/nis/nis_findserv.c6
-rw-r--r--libc/nptl/ChangeLog15
-rw-r--r--libc/nptl/allocatestack.c16
-rw-r--r--libc/nptl/pthread_create.c5
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c11
-rw-r--r--libc/nscd/aicache.c7
-rw-r--r--libc/resolv/res_init.c2
-rw-r--r--libc/stdio-common/vfprintf.c13
-rw-r--r--libc/stdlib/strtod_l.c2
-rw-r--r--libc/string/test-strcmp.c19
-rw-r--r--libc/string/test-strcpy.c110
-rw-r--r--libc/string/test-strrchr.c132
-rw-r--r--libc/sunrpc/clnt_tcp.c15
-rw-r--r--libc/sunrpc/clnt_udp.c3
-rw-r--r--libc/sunrpc/clnt_unix.c16
-rw-r--r--libc/sysdeps/generic/dl-hash.h53
-rw-r--r--libc/sysdeps/i386/i686/multiarch/Makefile3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcschr-c.c8
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S220
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcschr.S54
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcscpy-c.c5
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S621
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcscpy.S46
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c5
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S355
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcsrchr.S54
-rw-r--r--libc/sysdeps/powerpc/Makefile2
-rw-r--r--libc/sysdeps/powerpc/fpu/e_hypot.c2
-rw-r--r--libc/sysdeps/powerpc/locale-defines.sym5
-rw-r--r--libc/sysdeps/powerpc/powerpc32/a2/memcpy.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/dl-start.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/elf/start.S14
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S80
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S70
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_round.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/memset.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/Makefile4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S132
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S5
-rw-r--r--libc/sysdeps/powerpc/powerpc32/sysdep.h10
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S68
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S59
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/Makefile5
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strcasecmp.S125
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S5
-rw-r--r--libc/sysdeps/unix/sysv/linux/Makefile66
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/Makefile7
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S16
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/Makefile7
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/Makefile6
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h6
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/epoll.h6
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/Makefile7
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h6
-rw-r--r--libc/sysdeps/x86_64/fpu/bits/fenv.h4
-rw-r--r--libc/sysdeps/x86_64/fpu/s_scalbln.c2
-rw-r--r--libc/sysdeps/x86_64/fpu/s_scalbn.c9
-rw-r--r--libc/sysdeps/x86_64/multiarch/Makefile6
-rw-r--r--libc/sysdeps/x86_64/multiarch/wcscpy-c.c5
-rw-r--r--libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S565
-rw-r--r--libc/sysdeps/x86_64/multiarch/wcscpy.S43
-rw-r--r--libc/sysdeps/x86_64/multiarch/wmemcmp-c.c4
-rw-r--r--libc/sysdeps/x86_64/wcschr.S155
-rw-r--r--libc/sysdeps/x86_64/wcsrchr.S283
-rw-r--r--libc/time/tzfile.c53
-rw-r--r--libc/wcsmbs/Makefile2
-rw-r--r--libc/wcsmbs/test-wcscpy.c2
-rw-r--r--libc/wcsmbs/test-wcsrchr.c2
-rw-r--r--libc/wcsmbs/wcschr.c5
120 files changed, 4835 insertions, 573 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index f83bf4f56..f74e0a5d8 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,238 @@
+2011-12-22 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/Makefile (syscall-list-variants)
+ (syscall-list-default-options, syscall-list-default-condition)
+ (syscall-list-includes): Define.
+ ($(objpfx)syscall-%.h $(objpfx)syscall-%.d): Support arbitrary
+ list of ABIs and options and #if conditions for each ABI. Do not
+ handle common syscalls between ABIs specially.
+ * sysdeps/unix/sysv/linux/powerpc/Makefile (64bit-predefine):
+ Remove.
+ (syscall-list-variants, syscall-list-32bit-options)
+ (syscall-list-32bit-condition, syscall-list-64bit-options)
+ (syscall-list-64bit-condition): Define.
+ * sysdeps/unix/sysv/linux/s390/Makefile (64bit-predefine): Remove.
+ (syscall-list-variants, syscall-list-32bit-options)
+ (syscall-list-32bit-condition, syscall-list-64bit-options)
+ (syscall-list-64bit-condition): Define.
+ * sysdeps/unix/sysv/linux/sparc/Makefile (64bit-predefine):
+ Remove.
+ (syscall-list-variants, syscall-list-32bit-options)
+ (syscall-list-32bit-condition, syscall-list-64bit-options)
+ (syscall-list-64bit-condition): Define.
+ * sysdeps/unix/sysv/linux/x86_64/Makefile (64bit-predefine):
+ Remove.
+ (syscall-list-variants, syscall-list-32bit-options)
+ (syscall-list-32bit-condition, syscall-list-64bit-options)
+ (syscall-list-64bit-condition): Define.
+
+2011-12-22 Ulrich Drepper <drepper@gmail.com>
+
+ * locale/iso-639.def: Add brx entry.
+
+ [BZ #13328]
+ * malloc/mtrace.c (tr_freehook): Avoid unnecessary unlock/lock.
+ Proposed by Mariusz_Cukr <marcukr@op.pl>.
+
+ * sysdeps/x86_64/fpu/bits/fenv.h: Use __REDIRECT_NTH for
+ __feraiseexcept_renamed.
+
+2011-12-21 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13538]
+ * sysdeps/unix/sysv/linux/sys/epoll.h: Initialize EPOLLONESHOT and
+ EPOLLET with unsigned values.
+ * sysdeps/unix/sysv/linux/x86_64/sys/epoll.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sys/epoll.h: Likewise.
+
+ * math/s_cacosh.c: Use Kahan's formula if the subtraction could lead
+ to large cancellation.
+ * math/s_cacoshf.c: Likewise.
+ * math/s_cacoshl.c: Likewise.
+
+2011-11-18 Richard B. Kreckel <kreckel@ginac.de>
+
+ [BZ #13305]
+ * math/s_cacosh.c: Fix rare miscomputation in cacosh().
+ * math/s_cacoshf.c: Likewise.
+ * math/s_cacoshl.c: Likewise.
+
+2011-12-21 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13439]
+ * iconv/gconv.h: Define __GCONV_SWAP.
+ * iconvdata/unicode.c: The swap bit must be stored in __flags.
+ * iconvdata/utf-16.c: Likewise.
+ * iconvdata/utf-32.c: Likewise.
+
+2011-12-21 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #13524]
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Clear lowest limb of
+ numerator after shifting it by one limb.
+
+2011-12-19 Rafael Ãvila de Espíndola <rafael.espindola@gmail.com>
+
+ * sysdeps/x86_64/fpu/bits/fenv.h (feraiseexcept): Define it only
+ under [__USE_EXTERN_INLINES].
+
+2011-12-17 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13446]
+ * stdio-common/vfprintf.c (vfprintf): Fix extension of specs array.
+
+2011-11-22 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
+ * sysdeps/powerpc/locale-defines.sym: Locale definitions for strcasecmp
+ optimized code.
+ * sysdeps/powerpc/powerpc32/power7/Makefile: New file.
+ * sysdeps/powerpc/powerpc32/power7/strcasecmp.S: New file.
+ * sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S: New file.
+ * sysdeps/powerpc/powerpc64/power7/Makefile: Added unroll-loop option
+ for strncasecmp/strncasecmp_l compilation.
+ * sysdeps/powerpc/powerpc64/power7/strcasecmp.S: New file.
+ * sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S: New file.
+
+2011-12-08 Marek Polacek <mpolacek@redhat.com>
+
+ [BZ #13484]
+ * math/bits/math-finite.h: Use __REDIRECT_NTH and __NTH instead
+ of __asm__.
+
+2011-12-17 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13506]
+ * time/tzfile.c (__tzfile_read): Check values from file header.
+
+2011-11-21 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * powerpc/powerpc32/sysdep.h: Define SETUP_GOT_ACCESS() macro.
+ * powerpc/powerpc32/a2/memcpy.S: Use SETUP_GOT_ACCESS() macro.
+ * powerpc/powerpc32/dl-start.S: Likewise.
+ * powerpc/powerpc32/elf/start.S: Likewise.
+ * powerpc/powerpc32/fpu/__longjmp-common.S: Likewise.
+ * powerpc/powerpc32/fpu/s_ceil.S: Likewise.
+ * powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_floor.S: Likewise.
+ * powerpc/powerpc32/fpu/s_floorf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_lround.S: Likewise.
+ * powerpc/powerpc32/fpu/s_rint.S: Likewise.
+ * powerpc/powerpc32/fpu/s_rintf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_round.S: Likewise.
+ * powerpc/powerpc32/fpu/s_roundf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_trunc.S: Likewise.
+ * powerpc/powerpc32/fpu/s_truncf.S: Likewise.
+ * powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
+ * powerpc/powerpc32/memset.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/s_llround.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/w_sqrt.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/w_sqrtf.S: Likewise.
+ * powerpc/powerpc32/power5/fpu/w_sqrt.S: Likewise.
+ * powerpc/powerpc32/power5/fpu/w_sqrtf.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/brk.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Likewise.
+
+2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * math/libm-test.inc: Added more nearbyint tests.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file.
+
+2011-11-21 Ross Lagerwall <rosslagerwall@gmail.com>
+
+ * resolv/res_init.c (__res_vinit): Open /etc/resolv.conf with
+ FD_CLOEXEC.
+
+2011-11-14 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
+
+ * sysdeps/x86_64/multiarch/Makefile [subdir=wcsmbs] (sysdep_routines):
+ Add wcscpy-ssse3 wcscpy-c.
+ * sysdeps/x86_64/multiarch/wcscpy-ssse3.S: New file.
+ * sysdeps/x86_64/multiarch/wcscpy-c.c: New file.
+ * sysdeps/x86_64/multiarch/wcscpy.S: New file.
+ * sysdeps/x86_64/wcschr.S: New file.
+ * sysdeps/x86_64/wcsrchr.S: New file.
+ * string/test-strcmp.c: Remove checking of wcscmp function for
+ wrong alignments.
+ * sysdeps/i386/i686/multiarch/Makefile [subdir=wcsmbs]
+ (sysdep_routines): Add wcscpy-ssse3 wcscpy-c wcschr-sse2 wcschr-c
+ wcsrchr-sse2 wcsrchr-c.
+ * sysdeps/i386/i686/multiarch/wcschr.S: New file.
+ * sysdeps/i386/i686/multiarch/wcschr-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcschr-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr.S: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy.S: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy-ssse3.S: New file.
+ * wcsmbc/wcschr.c (WCSCHR): New macro.
+
+2011-11-17 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
+
+ * wcsmbs/Makefile (strop-tests): Add wcsrchr wcscpy.
+ * wcsmbs/test-wcsrchr.c: New file.
+ * string/test-strrchr.c: Add wcsrchr support.
+ (WIDE): New macro.
+ * wcsmbs/test-wcscpy.c: New file.
+ * string/test-strcpy.c: Add wcscpy support.
+ (WIDE): New macro.
+
+2011-12-10 Ulrich Drepper <drepper@gmail.com>
+
+ * sysdeps/generic/dl-hash.h (_dl_elf_hash): Lift one operation out of
+ the inner loop.
+
+2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #13472]
+ * sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
+
+2011-12-04 Ulrich Drepper <drepper@gmail.com>
+
+ * sysdeps/generic/dl-hash.h (_dl_elf_hash): Fix attribute.
+ Minor optimizations.
+
+ * sunrpc/clnt_unix.c (clntunix_control): Fix aliasing issues.
+ * sunrpc/clnt_tcp.c (clnttcp_control): Likewise.
+ * sunrpc/clnt_udp.c (clntudp_call): Likewise.
+
+2011-12-03 Ulrich Drepper <drepper@gmail.com>
+
+ * inet/netinet/in.h: Provide versions of IN6_IS_ADDR_UNSPECIFIED,
+ IN6_IS_ADDR_LOOPBACK, IN6_IS_ADDR_LINKLOCAL, IN6_IS_ADDR_SITELOCAL,
+ IN6_IS_ADDR_V4MAPPED, IN6_IS_ADDR_V4COMPAT, and IN6_ARE_ADDR_EQUAL
+ for gcc to avoid warnings.
+ * inet/Makefile (tests): Add tst-checks.
+ * inet/tst-checks.c: New file.
+
+ * sysdeps/generic/dl-hash.h (_dl_elf_hash): Add attribute to avoid
+ warning.
+
+ * sysdeps/x86_64/multiarch/wmemcmp-c.c: Provide prototype for
+ __wmemcmp_sse2.
+
+ * sysdeps/x86_64/fpu/s_scalbln.c: Removed.
+ * sysdeps/x86_64/fpu/s_scalbn.c: Removed.
+
+ * malloc/mcheck.h: Fix use of incorrect encoding in comment.
+
+2011-12-02 Ulrich Drepper <drepper@gmail.com>
+
+ * nis/nis_findserv.c (__nis_findfastest_with_timeout): Avoid aliasing
+ problem.
+
+ * nscd/aicache.c (addhstaiX): Avoid unused variable warning.
+
2011-11-29 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/sh/bits/atomic.h (rNOSP): Define
diff --git a/libc/NEWS b/libc/NEWS
index 5b5324c03..8d2fbbe41 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-11-14
+GNU C Library NEWS -- history of user-visible changes. 2011-12-22
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -12,7 +12,9 @@ Version 2.15
6779, 6783, 9696, 10103, 10709, 11589, 12403, 12847, 12868, 12852, 12874,
12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
- 13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367
+ 13268, 13276, 13282, 13291, 13305, 13328, 13335, 13337, 13344, 13358,
+ 13367, 13413, 13416, 13423, 13439, 13446, 13472, 13484, 13506, 13515,
+ 13523, 13524, 13538
* New program pldd to list loaded object of a process
Implemented by Ulrich Drepper.
@@ -34,7 +36,8 @@ Version 2.15
* Optimized strchr and strrchr for SSE on x86-32.
Contributed by Liubov Dmitrieva.
-* Optimized memchr, memrchr, rawmemchr, memcmp, wmemcmp for x86-64 and x86-32.
+* Optimized memchr, memrchr, rawmemchr, memcmp, wmemcmp, wcschr, wcscpy
+ for x86-64 and x86-32.
Contributed by Liubov Dmitrieva.
* New interfaces: scandirat, scandirat64
@@ -59,6 +62,11 @@ Version 2.15
* Optimized strcasecmp and strncasecmp for SSSE3 and SSE4.2 on x86-32.
Implemented by Ulrich Drepper.
+
+* Optimized nearbyint and strcasecmp for PPC.
+ Implemented by Adhemerval Zanella.
+
+* New locales: bho_IN, unm_US, es_CU
Version 2.14
diff --git a/libc/iconv/gconv.h b/libc/iconv/gconv.h
index 2946335e5..bc6d381aa 100644
--- a/libc/iconv/gconv.h
+++ b/libc/iconv/gconv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-1999, 2000-2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1997-1999, 2000-2002, 2007, 2011 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
@@ -56,7 +56,8 @@ enum
enum
{
__GCONV_IS_LAST = 0x0001,
- __GCONV_IGNORE_ERRORS = 0x0002
+ __GCONV_IGNORE_ERRORS = 0x0002,
+ __GCONV_SWAP = 0x0004
};
diff --git a/libc/iconvdata/unicode.c b/libc/iconvdata/unicode.c
index df452d2a1..dba4c34d6 100644
--- a/libc/iconvdata/unicode.c
+++ b/libc/iconvdata/unicode.c
@@ -1,5 +1,5 @@
/* Conversion module for Unicode
- Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -57,7 +57,7 @@
*inptrp = inptr += 2; \
else if (get16u (inptr) == BOM_OE) \
{ \
- ((struct unicode_data *) step->__data)->swap = 1; \
+ data->__flags |= __GCONV_SWAP; \
*inptrp = inptr += 2; \
} \
} \
@@ -71,7 +71,7 @@
put16u (outbuf, BOM); \
outbuf += 2; \
} \
- swap = ((struct unicode_data *) step->__data)->swap;
+ swap = data->__flags & __GCONV_SWAP;
#define EXTRA_LOOP_ARGS , swap
@@ -86,7 +86,6 @@ enum direction
struct unicode_data
{
enum direction dir;
- int swap;
};
@@ -110,7 +109,6 @@ gconv_init (struct __gconv_step *step)
if (new_data != NULL)
{
new_data->dir = dir;
- new_data->swap = 0;
step->__data = new_data;
if (dir == from_unicode)
diff --git a/libc/iconvdata/utf-16.c b/libc/iconvdata/utf-16.c
index 7f6c76090..e34d23fdf 100644
--- a/libc/iconvdata/utf-16.c
+++ b/libc/iconvdata/utf-16.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-16.
- Copyright (C) 1999, 2000-2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002, 2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -44,35 +44,42 @@
#define PREPARE_LOOP \
enum direction dir = ((struct utf16_data *) step->__data)->dir; \
enum variant var = ((struct utf16_data *) step->__data)->var; \
- if (__builtin_expect (data->__invocation_counter == 0, 0) && var == UTF_16) \
+ if (__builtin_expect (data->__invocation_counter == 0, 0)) \
{ \
- if (FROM_DIRECTION) \
+ if (var == UTF_16) \
{ \
- /* We have to find out which byte order the file is encoded in. */ \
- if (inptr + 2 > inend) \
- return (inptr == inend \
- ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \
- \
- if (get16u (inptr) == BOM) \
- /* Simply ignore the BOM character. */ \
- *inptrp = inptr += 2; \
- else if (get16u (inptr) == BOM_OE) \
+ if (FROM_DIRECTION) \
{ \
- ((struct utf16_data *) step->__data)->swap = 1; \
- *inptrp = inptr += 2; \
+ /* We have to find out which byte order the file is \
+ encoded in. */ \
+ if (inptr + 2 > inend) \
+ return (inptr == inend \
+ ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \
+ \
+ if (get16u (inptr) == BOM) \
+ /* Simply ignore the BOM character. */ \
+ *inptrp = inptr += 2; \
+ else if (get16u (inptr) == BOM_OE) \
+ { \
+ data->__flags |= __GCONV_SWAP; \
+ *inptrp = inptr += 2; \
+ } \
} \
- } \
- else if (!FROM_DIRECTION && !data->__internal_use) \
- { \
- /* Emit the Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 2 > outend, 0)) \
- return __GCONV_FULL_OUTPUT; \
+ else if (!FROM_DIRECTION && !data->__internal_use) \
+ { \
+ /* Emit the Byte Order Mark. */ \
+ if (__builtin_expect (outbuf + 2 > outend, 0)) \
+ return __GCONV_FULL_OUTPUT; \
\
- put16u (outbuf, BOM); \
- outbuf += 2; \
+ put16u (outbuf, BOM); \
+ outbuf += 2; \
+ } \
} \
+ else if ((var == UTF_16LE && BYTE_ORDER == BIG_ENDIAN) \
+ || (var == UTF_16BE && BYTE_ORDER == LITTLE_ENDIAN)) \
+ data->__flags |= __GCONV_SWAP; \
} \
- int swap = ((struct utf16_data *) step->__data)->swap;
+ const int swap = data->__flags & __GCONV_SWAP;
#define EXTRA_LOOP_ARGS , swap
@@ -96,7 +103,6 @@ struct utf16_data
{
enum direction dir;
enum variant var;
- int swap;
};
@@ -151,9 +157,6 @@ gconv_init (struct __gconv_step *step)
{
new_data->dir = dir;
new_data->var = var;
- new_data->swap = ((var == UTF_16LE && BYTE_ORDER == BIG_ENDIAN)
- || (var == UTF_16BE
- && BYTE_ORDER == LITTLE_ENDIAN));
step->__data = new_data;
if (dir == from_utf16)
diff --git a/libc/iconvdata/utf-32.c b/libc/iconvdata/utf-32.c
index cc0265137..27ea3db60 100644
--- a/libc/iconvdata/utf-32.c
+++ b/libc/iconvdata/utf-32.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-32.
- Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002, 2011 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
@@ -45,7 +45,7 @@
int swap; \
if (FROM_DIRECTION && var == UTF_32) \
{ \
- if (data->__invocation_counter == 0) \
+ if (__builtin_expect (data->__invocation_counter == 0, 0)) \
{ \
/* We have to find out which byte order the file is encoded in. */ \
if (inptr + 4 > inend) \
@@ -57,7 +57,7 @@
*inptrp = inptr += 4; \
else if (get32u (inptr) == BOM_OE) \
{ \
- ((struct utf32_data *) step->__data)->swap = 1; \
+ data->__flags |= __GCONV_SWAP; \
*inptrp = inptr += 4; \
} \
} \
@@ -72,7 +72,11 @@
put32u (outbuf, BOM); \
outbuf += 4; \
} \
- swap = ((struct utf32_data *) step->__data)->swap;
+ else if (__builtin_expect (data->__invocation_counter == 0, 0) \
+ && ((var == UTF_32LE && BYTE_ORDER == BIG_ENDIAN) \
+ || (var == UTF_32BE && BYTE_ORDER == LITTLE_ENDIAN))) \
+ data->__flags |= __GCONV_SWAP; \
+ swap = data->__flags & __GCONV_SWAP;
#define EXTRA_LOOP_ARGS , var, swap
@@ -96,7 +100,6 @@ struct utf32_data
{
enum direction dir;
enum variant var;
- int swap;
};
@@ -151,9 +154,6 @@ gconv_init (struct __gconv_step *step)
{
new_data->dir = dir;
new_data->var = var;
- new_data->swap = ((var == UTF_32LE && BYTE_ORDER == BIG_ENDIAN)
- || (var == UTF_32BE
- && BYTE_ORDER == LITTLE_ENDIAN));
step->__data = new_data;
if (dir == from_utf32)
@@ -216,9 +216,8 @@ gconv_end (struct __gconv_step *data)
} \
\
if (swap) \
- put32 (outptr, bswap_32 (c)); \
- else \
- put32 (outptr, c); \
+ c = bswap_32 (c); \
+ put32 (outptr, c); \
\
outptr += 4; \
inptr += 4; \
diff --git a/libc/inet/Makefile b/libc/inet/Makefile
index cd7c8cbf6..bbe3fbb6a 100644
--- a/libc/inet/Makefile
+++ b/libc/inet/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006, 2007, 2009, 2011 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
@@ -60,7 +60,7 @@ aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq
tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
tst-gethnm test-ifaddrs bug-if1 tst-ether_line \
- tst-getni1 tst-getni2 tst-inet6_rth
+ tst-getni1 tst-getni2 tst-inet6_rth tst-checks
tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt
include ../Rules
@@ -105,5 +105,5 @@ endif
ifeq (yes,$(build-static-nss))
otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
+ $(resolvobjdir)/libresolv.a
endif
diff --git a/libc/inet/netinet/in.h b/libc/inet/netinet/in.h
index 180227af5..2c2c1847a 100644
--- a/libc/inet/netinet/in.h
+++ b/libc/inet/netinet/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008
+/* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -396,44 +396,96 @@ extern uint16_t htons (uint16_t __hostshort)
# endif
#endif
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
+#ifdef __GNUC__
+# define IN6_IS_ADDR_UNSPECIFIED(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ __a->s6_addr32[0] == 0 \
+ && __a->s6_addr32[1] == 0 \
+ && __a->s6_addr32[2] == 0 \
+ && __a->s6_addr32[3] == 0; }))
+
+# define IN6_IS_ADDR_LOOPBACK(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ __a->s6_addr32[0] == 0 \
+ && __a->s6_addr32[1] == 0 \
+ && __a->s6_addr32[2] == 0 \
+ && __a->s6_addr32[3] == htonl (1); }))
+
+# define IN6_IS_ADDR_LINKLOCAL(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
+
+# define IN6_IS_ADDR_SITELOCAL(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
+
+# define IN6_IS_ADDR_V4MAPPED(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ __a->s6_addr32[0] == 0 \
+ && __a->s6_addr32[1] == 0 \
+ && __a->s6_addr32[2] == htonl (0xffff); }))
+
+# define IN6_IS_ADDR_V4COMPAT(a) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ __a->s6_addr32[0] == 0 \
+ && __a->s6_addr32[1] == 0 \
+ && __a->s6_addr32[2] == 0 \
+ && ntohl (__a->s6_addr32[3]) > 1; }))
+
+# define IN6_ARE_ADDR_EQUAL(a,b) \
+ (__extension__ \
+ ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a); \
+ __const struct in6_addr *__b = (__const struct in6_addr *) (b); \
+ __a->s6_addr32[0] == __b->s6_addr32[0] \
+ && __a->s6_addr32[1] == __b->s6_addr32[1] \
+ && __a->s6_addr32[2] == __b->s6_addr32[2] \
+ && __a->s6_addr32[3] == __b->s6_addr32[3]; }))
+#else
+# define IN6_IS_ADDR_UNSPECIFIED(a) \
(((__const uint32_t *) (a))[0] == 0 \
&& ((__const uint32_t *) (a))[1] == 0 \
&& ((__const uint32_t *) (a))[2] == 0 \
&& ((__const uint32_t *) (a))[3] == 0)
-#define IN6_IS_ADDR_LOOPBACK(a) \
+# define IN6_IS_ADDR_LOOPBACK(a) \
(((__const uint32_t *) (a))[0] == 0 \
&& ((__const uint32_t *) (a))[1] == 0 \
&& ((__const uint32_t *) (a))[2] == 0 \
&& ((__const uint32_t *) (a))[3] == htonl (1))
-#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
-
-#define IN6_IS_ADDR_LINKLOCAL(a) \
+# define IN6_IS_ADDR_LINKLOCAL(a) \
((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfe800000))
-#define IN6_IS_ADDR_SITELOCAL(a) \
+# define IN6_IS_ADDR_SITELOCAL(a) \
((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfec00000))
-#define IN6_IS_ADDR_V4MAPPED(a) \
+# define IN6_IS_ADDR_V4MAPPED(a) \
((((__const uint32_t *) (a))[0] == 0) \
&& (((__const uint32_t *) (a))[1] == 0) \
&& (((__const uint32_t *) (a))[2] == htonl (0xffff)))
-#define IN6_IS_ADDR_V4COMPAT(a) \
+# define IN6_IS_ADDR_V4COMPAT(a) \
((((__const uint32_t *) (a))[0] == 0) \
&& (((__const uint32_t *) (a))[1] == 0) \
&& (((__const uint32_t *) (a))[2] == 0) \
&& (ntohl (((__const uint32_t *) (a))[3]) > 1))
-#define IN6_ARE_ADDR_EQUAL(a,b) \
+# define IN6_ARE_ADDR_EQUAL(a,b) \
((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
&& (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
&& (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
&& (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+#endif
+
+#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
#if defined __USE_MISC || defined __USE_GNU
/* Bind socket to a privileged IP port. */
diff --git a/libc/inet/tst-checks.c b/libc/inet/tst-checks.c
new file mode 100644
index 000000000..5d97564cd
--- /dev/null
+++ b/libc/inet/tst-checks.c
@@ -0,0 +1,173 @@
+#include <stdio.h>
+#include <string.h>
+#include <netinet/in.h>
+
+
+static int
+do_test (void)
+{
+ int result = 0;
+ char buf[16];
+ memset (buf, '\0', 16);
+
+ if (! IN6_IS_ADDR_UNSPECIFIED (buf))
+ {
+ puts ("positive IN6_IS_ADDR_UNSPECIFIED failed");
+ result = 1;
+ }
+ for (size_t i = 0; i < 16; ++i)
+ {
+ buf[i] = 1;
+ if (IN6_IS_ADDR_UNSPECIFIED (buf))
+ {
+ printf ("negative IN6_IS_ADDR_UNSPECIFIED with byte %zu failed\n",
+ i);
+ result = 1;
+ }
+ buf[i] = 0;
+ }
+
+ if (IN6_IS_ADDR_LOOPBACK (buf))
+ {
+ puts ("negative IN6_IS_ADDR_UNSPECIFIED failed");
+ result = 1;
+ }
+ buf[15] = 1;
+ if (! IN6_IS_ADDR_LOOPBACK (buf))
+ {
+ puts ("positive IN6_IS_ADDR_UNSPECIFIED failed");
+ result = 1;
+ }
+ buf[15] = 0;
+
+ buf[0] = 0xfe;
+ buf[1] = 0x80;
+ if (! IN6_IS_ADDR_LINKLOCAL (buf))
+ {
+ puts ("positive IN6_IS_ADDR_LINKLOCAL failed");
+ result = 1;
+ }
+ for (size_t i = 1; i < 16; ++i)
+ {
+ buf[i] ^= 1;
+ if (! IN6_IS_ADDR_LINKLOCAL (buf))
+ {
+ printf ("positive IN6_IS_ADDR_LINKLOCAL byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 1;
+ }
+ buf[0] = 0xff;
+ buf[1] = 0x80;
+ if (IN6_IS_ADDR_LINKLOCAL (buf))
+ {
+ puts ("negative IN6_IS_ADDR_LINKLOCAL failed");
+ result = 1;
+ }
+ buf[0] = 0xfe;
+ buf[1] = 0xc0;
+ if (IN6_IS_ADDR_LINKLOCAL (buf))
+ {
+ puts ("negative IN6_IS_ADDR_LINKLOCAL #2 failed");
+ result = 1;
+ }
+
+ buf[0] = 0xfe;
+ buf[1] = 0xc0;
+ if (! IN6_IS_ADDR_SITELOCAL (buf))
+ {
+ puts ("positive IN6_IS_ADDR_SITELOCAL failed");
+ result = 1;
+ }
+ for (size_t i = 1; i < 16; ++i)
+ {
+ buf[i] ^= 1;
+ if (! IN6_IS_ADDR_SITELOCAL (buf))
+ {
+ printf ("positive IN6_IS_ADDR_SITELOCAL byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 1;
+ }
+ buf[0] = 0xff;
+ buf[1] = 0x80;
+ if (IN6_IS_ADDR_SITELOCAL (buf))
+ {
+ puts ("negative IN6_IS_ADDR_SITELOCAL failed");
+ result = 1;
+ }
+ buf[0] = 0xf8;
+ buf[1] = 0xc0;
+ if (IN6_IS_ADDR_SITELOCAL (buf))
+ {
+ puts ("negative IN6_IS_ADDR_SITELOCAL #2 failed");
+ result = 1;
+ }
+
+ memset (buf, '\0', 16);
+ buf[10] = 0xff;
+ buf[11] = 0xff;
+ if (! IN6_IS_ADDR_V4MAPPED (buf))
+ {
+ puts ("positive IN6_IS_ADDR_V4MAPPED failed");
+ result = 1;
+ }
+ for (size_t i = 12; i < 16; ++i)
+ {
+ buf[i] ^= 1;
+ if (! IN6_IS_ADDR_V4MAPPED (buf))
+ {
+ printf ("positive IN6_IS_ADDR_V4MAPPED byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 1;
+ }
+ for (size_t i = 0; i < 12; ++i)
+ {
+ buf[i] ^= 1;
+ if (IN6_IS_ADDR_V4MAPPED (buf))
+ {
+ printf ("negative IN6_IS_ADDR_V4MAPPED byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 1;
+ }
+
+ memset (buf, '\0', 16);
+ for (size_t i = 12; i < 16; ++i)
+ {
+ buf[i] ^= 2;
+ if (! IN6_IS_ADDR_V4COMPAT (buf))
+ {
+ printf ("positive IN6_IS_ADDR_V4COMPAT byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 2;
+ }
+ for (size_t i = 0; i < 12; ++i)
+ {
+ buf[i] ^= 1;
+ if (IN6_IS_ADDR_V4COMPAT (buf))
+ {
+ printf ("negative IN6_IS_ADDR_V4COMPAT byte %zu failed\n", i);
+ result = 1;
+ }
+ buf[i] ^= 1;
+ }
+ if (IN6_IS_ADDR_V4COMPAT (buf))
+ {
+ puts ("negative IN6_IS_ADDR_V4COMPAT #2 failed");
+ result = 1;
+ }
+ buf[15] = 1;
+ if (IN6_IS_ADDR_V4COMPAT (buf))
+ {
+ puts ("negative IN6_IS_ADDR_V4COMPAT #3 failed");
+ result = 1;
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/libidn/ChangeLog b/libc/libidn/ChangeLog
index 15efe0e88..a718a9f2a 100644
--- a/libc/libidn/ChangeLog
+++ b/libc/libidn/ChangeLog
@@ -1,3 +1,7 @@
+2011-12-03 Ulrich Drepper <drepper@gmail.com>
+
+ * idna.c (idna_to_unicode_4z4z): Remove variable rc.
+
2008-02-10 Jim Meyering <meyering@redhat.com>
* stringprep.c (stringprep, stringprep_profile): Remove useless
diff --git a/libc/libidn/idna.c b/libc/libidn/idna.c
index cf9529159..f93b90368 100644
--- a/libc/libidn/idna.c
+++ b/libc/libidn/idna.c
@@ -1,5 +1,5 @@
/* idna.c Convert to or from IDN strings.
- * Copyright (C) 2002, 2003, 2004 Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2011 Simon Josefsson
*
* This file is part of GNU Libidn.
*
@@ -614,7 +614,6 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags)
size_t buflen;
uint32_t *out = NULL;
size_t outlen = 0;
- int rc;
*output = NULL;
@@ -630,8 +629,8 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags)
if (!buf)
return IDNA_MALLOC_ERROR;
- rc = idna_to_unicode_44i (start, end - start, buf, &buflen, flags);
- /* don't check rc as per specification! */
+ idna_to_unicode_44i (start, end - start, buf, &buflen, flags);
+ /* don't check return value as per specification! */
if (out)
{
diff --git a/libc/locale/iso-639.def b/libc/locale/iso-639.def
index f62559439..17bb9f2ae 100644
--- a/libc/locale/iso-639.def
+++ b/libc/locale/iso-639.def
@@ -70,6 +70,7 @@ DEFINE_LANGUAGE_CODE3 ("Bikol", bik, bik)
DEFINE_LANGUAGE_CODE3 ("Bini", bin, bin)
DEFINE_LANGUAGE_CODE ("Bislama", bi, bis, bis)
DEFINE_LANGUAGE_CODE3 ("Blin; Bilin", byn, byn)
+DEFINE_LANGUAGE_CODE3 ("Bodo", brx, brx)
DEFINE_LANGUAGE_CODE ("Bosnian", bs, bos, bos)
DEFINE_LANGUAGE_CODE3 ("Braj", bra, bra)
DEFINE_LANGUAGE_CODE ("Breton", br, bre, bre)
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 43bd3bf17..17c135dfe 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,24 @@
+2011-12-22 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13282]
+ * locales/brx_IN: New file.
+ * SUPPORTED (SUPPORTED-LOCALES): Add appropriate entry
+
+ [BZ #13413]
+ * locales/nl_BE: Use LC_MONETARY from nl_NL.
+
+ [BZ #13416]
+ * locales/es_CU: New file.
+ * SUPPORTED (SUPPORTED-LOCALES): Add appropriate entry
+
+ [BZ #13423]
+ * locales/unm_US: New file.
+ * SUPPORTED (SUPPORTED-LOCALES): Add appropriate entry
+
+ [BZ #13523]
+ * locales/bho_IN: New file.
+ * SUPPORTED (SUPPORTED-LOCALES): Add appropriate entry
+
2011-11-17 Ulrich Drepper <drepper@gmail.com>
* Makefile (charmaps): Not need to filter out any of the VC
diff --git a/libc/localedata/SUPPORTED b/libc/localedata/SUPPORTED
index 2813c921a..a4e639794 100644
--- a/libc/localedata/SUPPORTED
+++ b/libc/localedata/SUPPORTED
@@ -58,6 +58,7 @@ ber_DZ/UTF-8 \
ber_MA/UTF-8 \
bg_BG.UTF-8/UTF-8 \
bg_BG/CP1251 \
+bho_IN/UTF-8 \
bn_BD/UTF-8 \
bn_IN/UTF-8 \
bo_CN/UTF-8 \
@@ -65,6 +66,7 @@ bo_IN/UTF-8 \
br_FR.UTF-8/UTF-8 \
br_FR/ISO-8859-1 \
br_FR@euro/ISO-8859-15 \
+brx_IN/UTF-8 \
bs_BA.UTF-8/UTF-8 \
bs_BA/ISO-8859-2 \
byn_ER/UTF-8 \
@@ -147,6 +149,7 @@ es_CO.UTF-8/UTF-8 \
es_CO/ISO-8859-1 \
es_CR.UTF-8/UTF-8 \
es_CR/ISO-8859-1 \
+es_CU/UTF-8 \
es_DO.UTF-8/UTF-8 \
es_DO/ISO-8859-1 \
es_EC.UTF-8/UTF-8 \
@@ -399,6 +402,7 @@ tt_RU@iqtelif/UTF-8 \
ug_CN/UTF-8 \
uk_UA.UTF-8/UTF-8 \
uk_UA/KOI8-U \
+unm_US/UTF-8 \
ur_PK/UTF-8 \
uz_UZ/ISO-8859-1 \
uz_UZ@cyrillic/UTF-8 \
diff --git a/libc/localedata/locales/bho_IN b/libc/localedata/locales/bho_IN
new file mode 100644
index 000000000..b5c926e1a
--- /dev/null
+++ b/libc/localedata/locales/bho_IN
@@ -0,0 +1,164 @@
+comment_char %
+escape_char /
+% Bhojpuri language locale for India.
+% Contributed by Alok Ranjan <ranjan_aalok@yahoo.com>,
+% Dr.Chandra Mohan <cmkumar1@rediffmail.com>,
+% Rajesh Ranjan <rajeshkajha@yahoo.com> and Pravin Satpute <psatpute@redhat.com>
+
+LC_IDENTIFICATION
+title "Bhojpuri language locale for India"
+source ""
+address ""
+contact ""
+email "bhashaghar@googlegroups.com"
+tel ""
+fax ""
+language "Bhojpuri"
+territory "India"
+revision "0.1"
+date "2011-12-20"
+%
+category "bho_IN:2011";LC_IDENTIFICATION
+category "bho_IN:2011";LC_CTYPE
+category "bho_IN:2011";LC_COLLATE
+category "bho_IN:2011";LC_TIME
+category "bho_IN:2011";LC_NUMERIC
+category "bho_IN:2011";LC_MONETARY
+category "bho_IN:2011";LC_MESSAGES
+category "bho_IN:2011";LC_PAPER
+category "bho_IN:2011";LC_NAME
+category "bho_IN:2011";LC_ADDRESS
+category "bho_IN:2011";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "hi_IN"
+END LC_CTYPE
+
+LC_COLLATE
+copy "hi_IN"
+END LC_COLLATE
+
+LC_MONETARY
+copy "hi_IN"
+END LC_MONETARY
+
+
+LC_NUMERIC
+copy "hi_IN"
+END LC_NUMERIC
+
+
+LC_TIME
+% This is the POSIX Locale definition for the LC_TIME category.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode/Java
+%
+% Abbreviated weekday names (%a)
+abday "<U0930><U0935><U093F><U0020>";/
+ "<U0938><U094B><U092E><U0020>";/
+ "<U092E><U0902><U0917><U0932><U0020>";/
+ "<U092C><U0941><U0927><U0020>";/
+ "<U0917><U0941><U0930><U0941><U0020>";/
+ "<U0936><U0941><U0915><U094D><U0930><U0020>";/
+ "<U0936><U0928><U093F><U0020>"
+%
+% Full weekday names (%A)
+day "<U0930><U0935><U093F><U0935><U093E><U0930><U0020>";/
+ "<U0938><U094B><U092E><U0935><U093E><U0930><U0020>";/
+ "<U092E><U0902><U0917><U0932><U0935><U093E><U0930><U0020>";/
+ "<U092C><U0941><U0927><U0935><U093E><U0930><U0020>";/
+ "<U0917><U0941><U0930><U0941><U0935><U093E><U0930><U0020>";/
+ "<U0936><U0941><U0915><U094D><U0930><U0935><U093E><U0930><U0020>";/
+ "<U0936><U0928><U093F><U0935><U093E><U0930><U0020>"
+%
+% Abbreviated month names (%b)
+abmon "<U091C><U0928><U0935><U0930><U0940>";/
+ "<U092B><U0930><U0935><U0930><U0940>";/
+ "<U092E><U093E><U0930><U094D><U091A>";/
+ "<U0905><U092A><U094D><U0930><U0948><U0932>";/
+ "<U092E><U0908>";"<U091C><U0942><U0928>";/
+ "<U091C><U0941><U0932><U093E><U0908>";/
+ "<U0905><U0917><U0938><U094D><U0924>";/
+ "<U0938><U093F><U0924><U092E><U094D><U092C><U0930>";/
+ "<U0905><U0915><U094D><U091F><U0942><U092C><U0930>";/
+ "<U0928><U0935><U092E><U094D><U092C><U0930>";/
+ "<U0926><U093F><U0938><U092E><U094D><U092C><U0930>"%
+% Full month names (%B)
+mon "<U091C><U0928><U0935><U0930><U0940>";/
+ "<U092B><U0930><U0935><U0930><U0940>";/
+ "<U092E><U093E><U0930><U094D><U091A>";/
+ "<U0905><U092A><U094D><U0930><U0948><U0932>";/
+ "<U092E><U0908>";"<U091C><U0942><U0928>";/
+ "<U091C><U0941><U0932><U093E><U0908>";/
+ "<U0905><U0917><U0938><U094D><U0924>";/
+ "<U0938><U093F><U0924><U092E><U094D><U092C><U0930>";/
+ "<U0905><U0915><U094D><U091F><U0942><U092C><U0930>";/
+ "<U0928><U0935><U092E><U094D><U092C><U0930>";/
+ "<U0926><U093F><U0938><U092E><U094D><U092C><U0930>"%
+%
+% Equivalent of AM PM
+am_pm "<U092A><U0942><U0930><U094D><U0935><U093E><U0939><U094D><U0928>";/
+ "<U0905><U092A><U0930><U093E><U0939><U094D><U0928>"
+%
+% Appropriate date and time representation
+% %A %d %b %Y%I:%M:%S %Z
+d_t_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059><U0020><U0025><U0049><U003A><U0025><U004D><U003A>/
+<U0025><U0053><U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+% Appropriate date representation
+% %A %d %b %Y
+d_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059>"
+%
+% Appropriate time representation
+% %I:%M:%S %Z
+t_fmt "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0020><U0025><U005A>"
+%
+% Appropriate 12 h time representation (%r)
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+
+LC_MESSAGES
+copy "hi_IN"
+END LC_MESSAGES
+
+
+LC_PAPER
+copy "hi_IN"
+END LC_PAPER
+
+
+LC_NAME
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
+<U0025><U0067>"
+name_gen ""
+name_mr "<U0936><U094D><U0930><U0940>"
+name_mrs "<U0936><U094D><U0930><U0940><U092E><U0924><U0940>"
+name_miss "<U0915><U0941><U092E><U093E><U0930><U0940>"
+name_ms "<U0915><U0941><U092E><U093E><U0930>"
+END LC_NAME
+
+
+LC_ADDRESS
+copy "hi_IN"
+END LC_ADDRESS
+
+
+LC_TELEPHONE
+copy "hi_IN"
+END LC_TELEPHONE
+
+
+LC_MEASUREMENT
+copy "hi_IN"
+END LC_MEASUREMENT
diff --git a/libc/localedata/locales/brx_IN b/libc/localedata/locales/brx_IN
new file mode 100644
index 000000000..0277a8e0a
--- /dev/null
+++ b/libc/localedata/locales/brx_IN
@@ -0,0 +1,185 @@
+comment_char %
+escape_char /
+% Bodo language locale for India.
+% Contributed by Pravin Satpute <psatpute@redhat.com> and Sanjib Narzary <alayaran@gmail.com>
+% Reference http://www.unicode.org/cldr/trac/browser/trunk/common/main/brx.xml
+
+LC_IDENTIFICATION
+title "Bodo language locale for India"
+source "Red Hat Pune"
+address "Level 1, Tower X, Cybercity, Magarpatta City, Hadapsar, Pune-411013 "
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Bodo"
+territory "India"
+revision "1.0"
+date "2011-10-17"
+%
+category "brx_IN:2011";LC_IDENTIFICATION
+category "brx_IN:2011";LC_CTYPE
+category "brx_IN:2011";LC_COLLATE
+category "brx_IN:2011";LC_TIME
+category "brx_IN:2011";LC_NUMERIC
+category "brx_IN:2011";LC_MONETARY
+category "brx_IN:2011";LC_MESSAGES
+category "brx_IN:2011";LC_PAPER
+category "brx_IN:2011";LC_NAME
+category "brx_IN:2011";LC_ADDRESS
+category "brx_IN:2011";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "hi_IN"
+END LC_CTYPE
+
+LC_COLLATE
+copy "hi_IN"
+END LC_COLLATE
+
+LC_MONETARY
+copy "hi_IN"
+END LC_MONETARY
+
+
+LC_NUMERIC
+copy "hi_IN"
+END LC_NUMERIC
+
+
+LC_TIME
+% This is the POSIX Locale definition for the LC_TIME category
+% generated by IBM Basic CountryPack Transformer.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode.
+%
+% Abbreviated weekday names (%a)
+abday "<U0930><U092C><U093F>";"<U0938><U092E>";/
+ "<U092E><U0902><U0917><U0932>";"<U092C><U0941><U0926>";/
+ "<U092C><U093F><U0938><U0925><U093F>";/
+ "<U0938><U0941><U0916><U0941><U0930>";"<U0938><U0941><U0928><U093F>"
+%
+
+% Full weekday names (%A)
+day "<U0930><U092C><U093F><U092C><U093E><U0930>";/
+ "<U0938><U094B><U092C><U093E><U0930>";/
+ "<U092E><U0902><U0917><U0932><U092C><U093E><U0930>";/
+ "<U092C><U0941><U0926><U092C><U093E><U0930>";/
+ "<U092C><U093F><U0938><U0925><U093F><U092C><U093E><U0930>";/
+ "<U0938><U0941><U0916><U0941><U0930><U092C><U093E><U0930>";/
+ "<U0938><U0941><U0928><U093F><U092C><U093E><U0930>"
+%
+% Abbreviated month names (%b)
+abmon "<U091C><U093E><U0928><U0941><U0935><U093E><U0930><U0940>";/
+ "<U092B><U0947><U092C><U094D><U0930><U0941><U0935><U093E><U0930><U0940>";/
+ "<U092E><U093E><U0930><U094D><U0938>";/
+ "<U090F><U092A><U094D><U0930><U093F><U0932>";/
+ "<U092E><U0947>";/
+ "<U091C><U0941><U0928>";/
+ "<U091C><U0941><U0932><U093E><U0907>";/
+ "<U0906><U0917><U0938><U094D><U0925>";/
+ "<U0938><U0947><U092C><U0925><U0947><U091C><U094D><U092C><U093C><U0930>";/
+ "<U0905><U0916><U0925><U092C><U0930>";/
+ "<U0928><U092C><U0947><U091C><U094D><U092C><U093C><U0930>";/
+ "<U0926><U093F><U0938><U0947><U091C><U094D><U092C><U093C><U0930>"
+%
+
+% Full month names (%B)
+mon "<U091C><U093E><U0928><U0941><U0935><U093E><U0930><U0940>";/
+ "<U092B><U0947><U092C><U094D><U0930><U0941><U0935><U093E><U0930><U0940>";/
+ "<U092E><U093E><U0930><U094D><U0938>";/
+ "<U090F><U092A><U094D><U0930><U093F><U0932>";/
+ "<U092E><U0947>";/
+ "<U091C><U0941><U0928>";/
+ "<U091C><U0941><U0932><U093E><U0907>";/
+ "<U0906><U0917><U0938><U094D><U0925>";/
+ "<U0938><U0947><U092C><U0925><U0947><U091C><U094D><U092C><U093C><U0930>";/
+ "<U0905><U0916><U0925><U092C><U0930>";/
+ "<U0928><U092C><U0947><U091C><U094D><U092C><U093C><U0930>";/
+ "<U0926><U093F><U0938><U0947><U091C><U094D><U092C><U093C><U0930>"
+%
+% Equivalent of AM PM
+
+am_pm "<U092B><U0941><U0902><U002E>";/
+ "<U092C><U0947><U0932><U093E><U0938><U0947><U002E>"
+%
+% Appropriate date and time representation
+% %A %d %b %Y%I:%M:%S %Z
+d_t_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059><U0020><U0025><U0049><U003A><U0025><U004D><U003A>/
+<U0025><U0053><U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+% Appropriate date representation
+% %A %d %b %Y
+d_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059>"
+%
+% Appropriate time representation
+% %I:%M:%S %Z
+t_fmt "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0020><U0025><U005A>"
+%
+% Appropriate 12 h time representation (%r)
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+
+LC_MESSAGES
+% This is the POSIX Locale definition for the LC_MESSAGES category
+% generated by IBM Basic CountryPack Transformer.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode.
+%
+% ^(Yes|[yY])
+yesexpr "<U005E><U0028><U0928><U0902><U0917><U094C><U007C><U005B><U0079>/
+<U0059><U005D><U0029>"
+%
+% ^(No|[nN])
+noexpr "<U005E><U0028><U0928><U0919><U093E><U007C><U005B><U006E><U004E>/
+<U005D><U0029>"
+%
+END LC_MESSAGES
+
+
+LC_PAPER
+copy "hi_IN"
+END LC_PAPER
+
+
+LC_NAME
+% This is the ISO_IEC TR14652 Locale definition for the LC_NAME category
+% generated by IBM Basic CountryPack Transformer.
+%
+%
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
+<U0025><U0067>"
+name_gen ""
+name_mr "<U004D><U0072><U002E>"
+name_mrs "<U004D><U0072><U0073><U002E>"
+name_miss "<U004D><U0069><U0073><U0073><U002E>"
+name_ms "<U004D><U0073><U002E>"
+
+END LC_NAME
+
+
+LC_ADDRESS
+copy "hi_IN"
+END LC_ADDRESS
+
+
+LC_TELEPHONE
+copy "hi_IN"
+END LC_TELEPHONE
+
+
+LC_MEASUREMENT
+copy "hi_IN"
+END LC_MEASUREMENT
diff --git a/libc/localedata/locales/es_CU b/libc/localedata/locales/es_CU
new file mode 100644
index 000000000..67fb5f9a0
--- /dev/null
+++ b/libc/localedata/locales/es_CU
@@ -0,0 +1,122 @@
+comment_char %
+escape_char /
+%
+% Spanish Language Locale for Cuba
+% Address: San Antonio de los Ba<U00F8>os Highway, Kilometer 1 1/2,
+% University of Informatic Sciences
+% Contact: Rosniel Arian Montanet
+% Email: ramontanet@estudiantes.uci.cu
+% Tel: +45 - 837-2531
+% Fax: +45 - 0000000
+% Language: es
+% Territory: CU
+% Revision: 0.1
+% Date: 2011-10-19
+% Application: general
+% Users: general
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title "Spanish locale for Cuba"
+source ""
+address "San Antonio de los Ba<U00F8>os Highway, Kilometer 1 1/2, University of Informatic Sciences "
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Spanish"
+territory "Cuba"
+revision "0.1"
+date "2011-10-19"
+%
+category "es_CU:2000";LC_IDENTIFICATION
+category "es_CU:2000";LC_CTYPE
+category "es_CU:2000";LC_COLLATE
+category "es_CU:2000";LC_TIME
+category "es_CU:2000";LC_NUMERIC
+category "es_CU:2000";LC_MONETARY
+category "es_CU:2000";LC_MESSAGES
+category "es_CU:2000";LC_PAPER
+category "es_CU:2000";LC_NAME
+category "es_CU:2000";LC_ADDRESS
+category "es_CU:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_COLLATE
+% Copy the template from ISO/IEC 14651
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+LC_MESSAGES
+copy "es_ES"
+END LC_MESSAGES
+
+LC_MONETARY
+int_curr_symbol "<U0043><U0055><U0050><U0020>"
+currency_symbol "<U0024>"
+mon_decimal_point "<U002C>"
+mon_thousands_sep "<U0020>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 0
+p_sep_by_space 1
+n_cs_precedes 0
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 1
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "<U002C>"
+thousands_sep ""
+grouping 0;0
+END LC_NUMERIC
+
+LC_TIME
+copy "es_ES"
+END LC_TIME
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+int_prefix "<U0035><U0033>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+% FIXME
+measurement 1
+END LC_MEASUREMENT
+
+LC_NAME
+name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0043><U0055>"
+country_ab3 "<U0043><U0055><U0042>"
+country_num 192
+END LC_ADDRESS
diff --git a/libc/localedata/locales/nl_BE b/libc/localedata/locales/nl_BE
index 33f3e1cdb..869eda682 100644
--- a/libc/localedata/locales/nl_BE
+++ b/libc/localedata/locales/nl_BE
@@ -59,7 +59,7 @@ copy "nl_NL"
END LC_MESSAGES
LC_MONETARY
-copy "fr_BE"
+copy "nl_NL"
END LC_MONETARY
LC_NUMERIC
diff --git a/libc/localedata/locales/unm_US b/libc/localedata/locales/unm_US
new file mode 100644
index 000000000..9734e25b3
--- /dev/null
+++ b/libc/localedata/locales/unm_US
@@ -0,0 +1,150 @@
+comment_char %
+escape_char /
+%
+% Unami Delaware Locale for U.S.A.
+% Language: unm
+% Contact: lugubrili@hotmail.com
+% Territory: US
+% Date: 2011-10-27
+% Application: general
+% Users: general
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title "Unami Delaware locale for the USA"
+source ""
+address ""
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Unami Delaware"
+territory "USA"
+revision "1.0"
+date "2011-10-27"
+%
+category "unm_US:2011";LC_IDENTIFICATION
+category "unm_US:2011";LC_CTYPE
+category "unm_US:2011";LC_COLLATE
+category "unm_US:2011";LC_TIME
+category "unm_US:2011";LC_NUMERIC
+category "unm_US:2011";LC_MONETARY
+category "unm_US:2011";LC_MESSAGES
+category "unm_US:2011";LC_PAPER
+category "unm_US:2011";LC_NAME
+category "unm_US:2011";LC_ADDRESS
+category "unm_US:2011";LC_TELEPHONE
+category "unm_US:2011";LC_MEASUREMENT
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% ken, man, tus, lel, tas, pel, sat
+abday "<U006B><U0065><U006E>";"<U006D><U0061><U006E>";/
+ "<U0074><U0075><U0073>";"<U006C><U0065><U006C>";/
+ "<U0074><U0061><U0073>";"<U0070><U0065><U006C>";/
+ "<U0073><U0061><U0074>"
+% kentuwei, manteke, tusteke, lelai, tasteke, pelaiteke, sateteke
+day "<U006B><U0065><U006E><U0074><U0075><U0077><U0065><U0069>";/
+ "<U006D><U0061><U006E><U0074><U0065><U006B><U0065>";/
+ "<U0074><U0075><U0073><U0074><U0065><U006B><U0065>";/
+ "<U006C><U0065><U006C><U0061><U0069>";/
+ "<U0074><U0061><U0073><U0074><U0065><U006B><U0065>";/
+ "<U0070><U0065><U006C><U0061><U0069><U0074><U0065><U006B><U0065>";/
+ "<U0073><U0061><U0074><U0065><U0074><U0065><U006B><U0065>"
+% eni, chk, xam, kwe, tai, nip, lai, win, tah, puk, kun, mux
+abmon "<U0065><U006E><U0069>";"<U0063><U0068><U006B>";/
+ "<U0078><U0061><U006D>";"<U006B><U0077><U0065>";/
+ "<U0074><U0061><U0069>";"<U006E><U0069><U0070>";/
+ "<U006C><U0061><U0069>";"<U0077><U0069><U006E>";/
+ "<U0074><U0061><U0068>";"<U0070><U0075><U006B>";/
+ "<U006B><U0075><U006E>";"<U006D><U0075><U0078>"
+% enikwsi, chkwali, xamokhwite, kwetayoxe, tainipen, kichinipen
+% lainipen, winaminke, kichitahkok, puksit, wini, muxkotae
+mon "<U0065><U006E><U0069><U006B><U0077><U0073><U0069>";/
+ "<U0063><U0068><U006B><U0077><U0061><U006C><U0069>";/
+ "<U0078><U0061><U006D><U006F><U006B><U0068><U0077><U0069><U0074><U0065>";/
+ "<U006B><U0077><U0065><U0074><U0061><U0079><U006F><U0078><U0065>";/
+ "<U0074><U0061><U0069><U006E><U0069><U0070><U0065><U006E>";/
+ "<U006B><U0069><U0063><U0068><U0069><U006E><U0069><U0070><U0065><U006E>";/
+ "<U006C><U0061><U0069><U006E><U0069><U0070><U0065><U006E>";/
+ "<U0077><U0069><U006E><U0061><U006D><U0069><U006E><U006B><U0065>";/
+ "<U006B><U0069><U0063><U0068><U0069><U0074><U0061><U0068><U006B><U006F><U006B>";/
+ "<U0070><U0075><U006B><U0073><U0069><U0074>";/
+ "<U0077><U0069><U006E><U0069>";/
+ "<U006D><U0075><U0078><U006B><U006F><U0074><U0061><U0065>"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
+t_fmt "<U0025><U0054>"
+am_pm "";""
+t_fmt_ampm ""
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+week 7;19971130;4
+first_weekday 1
+first_workday 2
+END LC_TIME
+
+LC_NUMERIC
+decimal_point "<U002E>"
+thousands_sep "<U0020>"
+grouping 2;2;2;3
+END LC_NUMERIC
+
+LC_MONETARY
+int_curr_symbol "<U0055><U0053><U0044><U0020>"
+currency_symbol "<U0024>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep "<U0020>"
+mon_grouping 3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 0
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+END LC_MONETARY
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U006B><U004B><U006D><U004D><U005D><U002E><U002A>"
+END LC_MESSAGES
+
+LC_PAPER
+copy "en_US"
+END LC_PAPER
+
+LC_NAME
+name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+copy "en_US"
+END LC_ADDRESS
+
+LC_TELEPHONE
+copy "en_US"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "en_US"
+END LC_MEASUREMENT
diff --git a/libc/malloc/mcheck.h b/libc/malloc/mcheck.h
index 225f21e1a..462b944af 100644
--- a/libc/malloc/mcheck.h
+++ b/libc/malloc/mcheck.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2000,2011 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
@@ -41,7 +41,7 @@ enum mcheck_status
null, the standard function prints on stderr and then calls `abort'. */
extern int mcheck (void (*__abortfunc) (enum mcheck_status)) __THROW;
-/* Similar to `mcheck´ but performs checks for all block whenever one of
+/* Similar to `mcheck' but performs checks for all block whenever one of
the memory handling functions is called. This can be very slow. */
extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status)) __THROW;
diff --git a/libc/malloc/mtrace.c b/libc/malloc/mtrace.c
index b55449f1e..0d0cb35ff 100644
--- a/libc/malloc/mtrace.c
+++ b/libc/malloc/mtrace.c
@@ -146,10 +146,12 @@ tr_freehook (ptr, caller)
tr_where (caller, info);
/* Be sure to print it first. */
fprintf (mallstream, "- %p\n", ptr);
- __libc_lock_unlock (lock);
if (ptr == mallwatch)
- tr_break ();
- __libc_lock_lock (lock);
+ {
+ __libc_lock_unlock (lock);
+ tr_break ();
+ __libc_lock_lock (lock);
+ }
__free_hook = tr_old_free_hook;
if (tr_old_free_hook != NULL)
(*tr_old_free_hook) (ptr, caller);
diff --git a/libc/manual/resource.texi b/libc/manual/resource.texi
index 05495722f..8e3155cb0 100644
--- a/libc/manual/resource.texi
+++ b/libc/manual/resource.texi
@@ -1607,7 +1607,7 @@ processors and so the call
@end smallexample
@noindent
-returns the number of processors which are currently inline (i.e.,
+returns the number of processors which are currently online (i.e.,
available).
For these two pieces of information the GNU C library also provides
diff --git a/libc/math/bits/math-finite.h b/libc/math/bits/math-finite.h
index 7443d26ad..dcf427ca8 100644
--- a/libc/math/bits/math-finite.h
+++ b/libc/math/bits/math-finite.h
@@ -22,155 +22,159 @@
#endif
/* acos. */
-extern double acos (double) __asm__ ("__acos_finite");
-extern float acosf (float) __asm__ ("__acosf_finite");
+extern double __REDIRECT_NTH (acos, (double), __acos_finite);
+extern float __REDIRECT_NTH (acosf, (float), __acosf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double acosl (long double) __asm__ ("__acosl_finite");
+extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* acosh. */
-extern double acosh (double) __asm__ ("__acosh_finite");
-extern float acoshf (float) __asm__ ("__acoshf_finite");
+extern double __REDIRECT_NTH (acosh, (double), __acosh_finite);
+extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double acoshl (long double) __asm__ ("__acoshl_finite");
+extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
# endif
#endif
/* asin. */
-extern double asin (double) __asm__ ("__asin_finite");
-extern float asinf (float) __asm__ ("__asinf_finite");
+extern double __REDIRECT_NTH (asin, (double), __asin_finite);
+extern float __REDIRECT_NTH (asinf, (float), __asinf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double asinl (long double) __asm__ ("__asinl_finite");
+extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
#endif
/* atan2. */
-extern double atan2 (double, double) __asm__ ("__atan2_finite");
-extern float atan2f (float, float) __asm__ ("__atan2f_finite");
+extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
+extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double atan2l (long double, long double) __asm__ ("__atan2l_finite");
+extern long double __REDIRECT_NTH (atan2l, (long double, long double),
+ __atan2l_finite);
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* atanh. */
-extern double atanh (double) __asm__ ("__atanh_finite");
-extern float atanhf (float) __asm__ ("__atanhf_finite");
+extern double __REDIRECT_NTH (atanh, (double), __atanh_finite);
+extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double atanhl (long double) __asm__ ("__atanhl_finite");
+extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
# endif
#endif
/* cosh. */
-extern double cosh (double) __asm__ ("__cosh_finite");
-extern float coshf (float) __asm__ ("__coshf_finite");
+extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
+extern float __REDIRECT_NTH (coshf, (float), __coshf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double coshl (long double) __asm__ ("__coshl_finite");
+extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
#endif
/* exp. */
-extern double exp (double) __asm__ ("__exp_finite");
-extern float expf (float) __asm__ ("__expf_finite");
+extern double __REDIRECT_NTH (exp, (double), __exp_finite);
+extern float __REDIRECT_NTH (expf, (float), __expf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double expl (long double) __asm__ ("__expl_finite");
+extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
#endif
#ifdef __USE_GNU
/* exp10. */
-extern double exp10 (double) __asm__ ("__exp10_finite");
-extern float exp10f (float) __asm__ ("__exp10f_finite");
+extern double __REDIRECT_NTH (exp10, (double), __exp10_finite);
+extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double exp10l (long double) __asm__ ("__exp10l_finite");
+extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
# endif
/* pow10. */
-extern double pow10 (double) __asm__ ("__exp10_finite");
-extern float pow10f (float) __asm__ ("__exp10f_finite");
+extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
+extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double pow10l (long double) __asm__ ("__exp10l_finite");
+extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite);
# endif
#endif
#ifdef __USE_ISOC99
/* exp2. */
-extern double exp2 (double) __asm__ ("__exp2_finite");
-extern float exp2f (float) __asm__ ("__exp2f_finite");
+extern double __REDIRECT_NTH (exp2, (double), __exp2_finite);
+extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double exp2l (long double) __asm__ ("__exp2l_finite");
+extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
# endif
#endif
/* fmod. */
-extern double fmod (double, double) __asm__ ("__fmod_finite");
-extern float fmodf (float, float) __asm__ ("__fmodf_finite");
+extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
+extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double fmodl (long double, long double) __asm__ ("__fmodl_finite");
+extern long double __REDIRECT_NTH (fmodl, (long double, long double),
+ __fmodl_finite);
#endif
#ifdef __USE_ISOC99
/* hypot. */
-extern double hypot (double, double) __asm__ ("__hypot_finite");
-extern float hypotf (float, float) __asm__ ("__hypotf_finite");
+extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite);
+extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double hypotl (long double, long double) __asm__ ("__hypotl_finite");
+extern long double __REDIRECT_NTH (hypotl, (long double, long double),
+ __hypotl_finite);
# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
/* j0. */
-extern double j0 (double) __asm__ ("__j0_finite");
-extern float j0f (float) __asm__ ("__j0f_finite");
+extern double __REDIRECT_NTH (j0, (double), __j0_finite);
+extern float __REDIRECT_NTH (j0f, (float), __j0f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double j0l (long double) __asm__ ("__j0l_finite");
+extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
# endif
/* y0. */
-extern double y0 (double) __asm__ ("__y0_finite");
-extern float y0f (float) __asm__ ("__y0f_finite");
+extern double __REDIRECT_NTH (y0, (double), __y0_finite);
+extern float __REDIRECT_NTH (y0f, (float), __y0f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double y0l (long double) __asm__ ("__y0l_finite");
+extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
# endif
/* j1. */
-extern double j1 (double) __asm__ ("__j1_finite");
-extern float j1f (float) __asm__ ("__j1f_finite");
+extern double __REDIRECT_NTH (j1, (double), __j1_finite);
+extern float __REDIRECT_NTH (j1f, (float), __j1f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double j1l (long double) __asm__ ("__j1l_finite");
+extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
# endif
/* y1. */
-extern double y1 (double) __asm__ ("__y1_finite");
-extern float y1f (float) __asm__ ("__y1f_finite");
+extern double __REDIRECT_NTH (y1, (double), __y1_finite);
+extern float __REDIRECT_NTH (y1f, (float), __y1f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double y1l (long double) __asm__ ("__y1l_finite");
+extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
# endif
/* jn. */
-extern double jn (int, double) __asm__ ("__jn_finite");
-extern float jnf (int, float) __asm__ ("__jnf_finite");
+extern double __REDIRECT_NTH (jn, (int, double), __jn_finite);
+extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double jnl (int, long double) __asm__ ("__jnl_finite");
+extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
# endif
/* yn. */
-extern double yn (int, double) __asm__ ("__yn_finite");
-extern float ynf (int, float) __asm__ ("__ynf_finite");
+extern double __REDIRECT_NTH (yn, (int, double), __yn_finite);
+extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double ynl (int, long double) __asm__ ("__ynl_finite");
+extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
# endif
#endif
#ifdef __USE_MISC
/* lgamma_r. */
-extern double lgamma_r (double, int *) __asm__ ("__lgamma_r_finite");
-extern float lgammaf_r (float, int *) __asm__ ("__lgammaf_r_finite");
+extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite);
+extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double lgammal_r (long double, int *) __asm__ ("__lgammal_r_finite");
+extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
+ __lgammal_r_finite);
# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
/* lgamma. */
-__extern_always_inline double lgamma (double __d)
+__extern_always_inline double __NTH (lgamma (double __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -179,7 +183,7 @@ __extern_always_inline double lgamma (double __d)
return lgamma_r (__d, &signgam);
# endif
}
-__extern_always_inline float lgammaf (float __d)
+__extern_always_inline float __NTH (lgammaf (float __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -189,7 +193,7 @@ __extern_always_inline float lgammaf (float __d)
# endif
}
# ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double lgammal (long double __d)
+__extern_always_inline long double __NTH (lgammal (long double __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -203,7 +207,7 @@ __extern_always_inline long double lgammal (long double __d)
#if defined __USE_MISC || defined __USE_XOPEN
/* gamma. */
-__extern_always_inline double gamma (double __d)
+__extern_always_inline double __NTH (gamma (double __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -212,7 +216,7 @@ __extern_always_inline double gamma (double __d)
return lgamma_r (__d, &signgam);
# endif
}
-__extern_always_inline float gammaf (float __d)
+__extern_always_inline float __NTH (gammaf (float __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -222,7 +226,7 @@ __extern_always_inline float gammaf (float __d)
# endif
}
# ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double gammal (long double __d)
+__extern_always_inline long double __NTH (gammal (long double __d))
{
# ifdef __USE_ISOC99
int __local_signgam = 0;
@@ -235,76 +239,79 @@ __extern_always_inline long double gammal (long double __d)
#endif
/* log. */
-extern double log (double) __asm__ ("__log_finite");
-extern float logf (float) __asm__ ("__logf_finite");
+extern double __REDIRECT_NTH (log, (double), __log_finite);
+extern float __REDIRECT_NTH (logf, (float), __logf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double logl (long double) __asm__ ("__logl_finite");
+extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
#endif
/* log10. */
-extern double log10 (double) __asm__ ("__log10_finite");
-extern float log10f (float) __asm__ ("__log10f_finite");
+extern double __REDIRECT_NTH (log10, (double), __log10_finite);
+extern float __REDIRECT_NTH (log10f, (float), __log10f_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double log10l (long double) __asm__ ("__log10l_finite");
+extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
#endif
#ifdef __USE_ISOC99
/* log2. */
-extern double log2 (double) __asm__ ("__log2_finite");
-extern float log2f (float) __asm__ ("__log2f_finite");
+extern double __REDIRECT_NTH (log2, (double), __log2_finite);
+extern float __REDIRECT_NTH (log2f, (float), __log2f_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double log2l (long double) __asm__ ("__log2l_finite");
+extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
# endif
#endif
/* pow. */
-extern double pow (double, double) __asm__ ("__pow_finite");
-extern float powf (float, float) __asm__ ("__powf_finite");
+extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
+extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double powl (long double, long double) __asm__ ("__powl_finite");
+extern long double __REDIRECT_NTH (powl, (long double, long double),
+ __powl_finite);
#endif
/* remainder. */
-extern double remainder (double, double) __asm__ ("__remainder_finite");
-extern float remainderf (float, float) __asm__ ("__remainderf_finite");
+extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite);
+extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double remainderl (long double, long double) __asm__ ("__remainderl_finite");
+extern long double __REDIRECT_NTH (remainderl, (long double, long double),
+ __remainderl_finite);
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* scalb. */
-extern double scalb (double, double) __asm__ ("__scalb_finite");
-extern float scalbf (float, float) __asm__ ("__scalbf_finite");
+extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite);
+extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite);
# ifdef __MATH_DECLARE_LDOUBLE
-extern long double scalbl (long double, long double) __asm__ ("__scalbl_finite");
+extern long double __REDIRECT_NTH (scalbl, (long double, long double),
+ __scalbl_finite);
# endif
#endif
/* sinh. */
-extern double sinh (double) __asm__ ("__sinh_finite");
-extern float sinhf (float) __asm__ ("__sinhf_finite");
+extern double __REDIRECT_NTH (sinh, (double), __sinh_finite);
+extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double sinhl (long double) __asm__ ("__sinhl_finite");
+extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
#endif
/* sqrt. */
-extern double sqrt (double) __asm__ ("__sqrt_finite");
-extern float sqrtf (float) __asm__ ("__sqrtf_finite");
+extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
+extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite);
#ifdef __MATH_DECLARE_LDOUBLE
-extern long double sqrtl (long double) __asm__ ("__sqrtl_finite");
+extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
#endif
#ifdef __USE_ISOC99
/* tgamma. */
extern double __gamma_r_finite (double, int *);
-__extern_always_inline double tgamma (double __d)
+__extern_always_inline double __NTH (tgamma (double __d))
{
int __local_signgam = 0;
double __res = __gamma_r_finite (__d, &__local_signgam);
return __local_signgam < 0 ? -__res : __res;
}
extern float __gammaf_r_finite (float, int *);
-__extern_always_inline float tgammaf (float __d)
+__extern_always_inline float __NTH (tgammaf (float __d))
{
int __local_signgam = 0;
float __res = __gammaf_r_finite (__d, &__local_signgam);
@@ -312,7 +319,7 @@ __extern_always_inline float tgammaf (float __d)
}
# ifdef __MATH_DECLARE_LDOUBLE
extern long double __gammal_r_finite (long double, int *);
-__extern_always_inline long double tgammal (long double __d)
+__extern_always_inline long double __NTH (tgammal (long double __d))
{
int __local_signgam = 0;
long double __res = __gammal_r_finite (__d, &__local_signgam);
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc
index d07ab6c48..f295da873 100644
--- a/libc/math/libm-test.inc
+++ b/libc/math/libm-test.inc
@@ -4631,6 +4631,10 @@ nearbyint_test (void)
TEST_f_f (nearbyint, minus_infty, minus_infty);
TEST_f_f (nearbyint, nan_value, nan_value);
+ /* Subnormal values */
+ TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
+ TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
+
/* Default rounding mode is round to nearest. */
TEST_f_f (nearbyint, 0.5, 0.0);
TEST_f_f (nearbyint, 1.5, 2.0);
diff --git a/libc/math/s_cacosh.c b/libc/math/s_cacosh.c
index bec6d3827..cb01ca87c 100644
--- a/libc/math/s_cacosh.c
+++ b/libc/math/s_cacosh.c
@@ -65,6 +65,11 @@ __cacosh (__complex__ double x)
__real__ res = 0.0;
__imag__ res = __copysign (M_PI_2, __imag__ x);
}
+ /* The factor 16 is just a guess. */
+ else if (16.0 * fabs (__imag__ x) < fabs (__real__ x))
+ /* Kahan's formula which avoid cancellation through subtraction in
+ some cases. */
+ res = 2.0 * __clog (__csqrt ((x + 1.0) / 2.0) + __csqrt ((x - 1.0) / 2.0));
else
{
__complex__ double y;
@@ -74,17 +79,13 @@ __cacosh (__complex__ double x)
y = __csqrt (y);
- if (__real__ x < 0.0)
+ if (signbit (__real__ x))
y = -y;
__real__ y += __real__ x;
__imag__ y += __imag__ x;
res = __clog (y);
-
- /* We have to use the positive branch. */
- if (__real__ res < 0.0)
- res = -res;
}
return res;
diff --git a/libc/math/s_cacoshf.c b/libc/math/s_cacoshf.c
index 0d6bd75dd..fe046929e 100644
--- a/libc/math/s_cacoshf.c
+++ b/libc/math/s_cacoshf.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for float value.
- Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -65,9 +65,14 @@ __cacoshf (__complex__ float x)
__real__ res = 0.0;
__imag__ res = __copysignf (M_PI_2, __imag__ x);
}
+ /* The factor 16 is just a guess. */
+ else if (16.0 * fabsf (__imag__ x) < fabsf (__real__ x))
+ /* Kahan's formula which avoid cancellation through subtraction in
+ some cases. */
+ res = 2.0 * __clogf (__csqrtf ((x + 1.0) / 2.0)
+ + __csqrtf ((x - 1.0) / 2.0));
else
{
-#if 1
__complex__ float y;
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
@@ -75,30 +80,13 @@ __cacoshf (__complex__ float x)
y = __csqrtf (y);
- if (__real__ x < 0.0)
+ if (signbit (__real__ x))
y = -y;
__real__ y += __real__ x;
__imag__ y += __imag__ x;
res = __clogf (y);
-#else
- float re2 = __real__ x * __real__ x;
- float im2 = __imag__ x * __imag__ x;
- float sq = re2 - im2 - 1.0;
- float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
- float a = __ieee754_sqrtf ((sq + ro) / 2.0);
- float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
-
- __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
- + im2 + __imag__ x * 2 * b
- + ro);
- __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
-#endif
-
- /* We have to use the positive branch. */
- if (__real__ res < 0.0)
- res = -res;
}
return res;
diff --git a/libc/math/s_cacoshl.c b/libc/math/s_cacoshl.c
index 36f7a5f70..84c2715d2 100644
--- a/libc/math/s_cacoshl.c
+++ b/libc/math/s_cacoshl.c
@@ -65,6 +65,12 @@ __cacoshl (__complex__ long double x)
__real__ res = 0.0;
__imag__ res = __copysignl (M_PI_2l, __imag__ x);
}
+ /* The factor 16 is just a guess. */
+ else if (16.0L * fabsl (__imag__ x) < fabsl (__real__ x))
+ /* Kahan's formula which avoid cancellation through subtraction in
+ some cases. */
+ res = 2.0L * __clogl (__csqrtl ((x + 1.0L) / 2.0L)
+ + __csqrtl ((x - 1.0L) / 2.0L));
else
{
__complex__ long double y;
@@ -74,17 +80,13 @@ __cacoshl (__complex__ long double x)
y = __csqrtl (y);
- if (__real__ x < 0.0)
+ if (signbit (__real__ x))
y = -y;
__real__ y += __real__ x;
__imag__ y += __imag__ x;
res = __clogl (y);
-
- /* We have to use the positive branch. */
- if (__real__ res < 0.0)
- res = -res;
}
return res;
diff --git a/libc/nis/nis_findserv.c b/libc/nis/nis_findserv.c
index b1a9aa7e0..b02c63bdb 100644
--- a/libc/nis/nis_findserv.c
+++ b/libc/nis/nis_findserv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2001, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -175,7 +175,9 @@ __nis_findfastest_with_timeout (dir_binding *bind,
(xdrproc_t) xdr_void, (caddr_t) 0,
*timeout);
if (RPC_SUCCESS == rc) {
- fastest = *((u_int32_t *) (cu->cu_inbuf)) - xid_seed;
+ u_int32_t val;
+ memcpy (&val, cu->cu_inbuf, sizeof (u_int32_t));
+ fastest = val - xid_seed;
if (fastest < pings_count) {
bind->server_used = pings[fastest].server_nr;
bind->current_ep = pings[fastest].server_ep;
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 448aa9357..31177bf17 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,18 @@
+2011-12-21 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #13515]
+ * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
+ Correct reading name from file.
+
+2011-12-14 Carlos O'Donell <carlos@systemhalted.org>
+
+ * allocatestack.c (allocate_stack): Return errno on failure.
+
+2011-12-14 Jeff Law <law@redhat.com>
+
+ [BZ #5245]
+ * pthread_create.c (__pthread_create_2_1): Translate ENOMEM to EAGAIN.
+
2011-11-28 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Handle
diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c
index 36b4aa16f..b1b17ceba 100644
--- a/libc/nptl/allocatestack.c
+++ b/libc/nptl/allocatestack.c
@@ -435,7 +435,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
{
/* Something went wrong. */
assert (errno == ENOMEM);
- return EAGAIN;
+ return errno;
}
@@ -496,12 +496,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
if (__builtin_expect (mem == MAP_FAILED, 0))
- {
- if (errno == ENOMEM)
- __set_errno (EAGAIN);
-
- return errno;
- }
+ return errno;
/* SIZE is guaranteed to be greater than zero.
So we can never get a null pointer back from mmap. */
@@ -581,7 +576,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* Free the stack memory we just allocated. */
(void) munmap (mem, size);
- return EAGAIN;
+ return errno;
}
@@ -636,10 +631,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
#endif
if (mprotect (guard, guardsize, PROT_NONE) != 0)
{
- int err;
mprot_error:
- err = errno == ENOMEM ? EAGAIN : errno;
-
lll_lock (stack_cache_lock, LLL_PRIVATE);
/* Remove the thread from the list. */
@@ -657,7 +649,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
is nothing we could do. */
(void) munmap (mem, size);
- return err;
+ return errno;
}
pd->guardsize = guardsize;
diff --git a/libc/nptl/pthread_create.c b/libc/nptl/pthread_create.c
index 499e92e88..43d428239 100644
--- a/libc/nptl/pthread_create.c
+++ b/libc/nptl/pthread_create.c
@@ -462,8 +462,9 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
int err = ALLOCATE_STACK (iattr, &pd);
if (__builtin_expect (err != 0, 0))
/* Something went wrong. Maybe a parameter of the attributes is
- invalid or we could not allocate memory. */
- return err;
+ invalid or we could not allocate memory. Note we have to
+ translate error codes. */
+ return err == ENOMEM ? EAGAIN : err;
/* Initialize the TCB. All initializations with zero should be
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c b/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c
index 6e7786f98..2c5ee6305 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c
@@ -1,5 +1,5 @@
/* pthread_getname_np -- Get thread name. Linux version
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 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
@@ -57,6 +57,15 @@ pthread_getname_np (th, buf, len)
ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, len));
if (n < 0)
res = errno;
+ else
+ {
+ if (buf[n - 1] == '\n')
+ buf[n - 1] = '\0';
+ else if (n == len)
+ res = ERANGE;
+ else
+ buf[n] = '\0';
+ }
close_not_cancel_no_status (fd);
diff --git a/libc/nscd/aicache.c b/libc/nscd/aicache.c
index 8d100f8d3..aaaf80df9 100644
--- a/libc/nscd/aicache.c
+++ b/libc/nscd/aicache.c
@@ -461,9 +461,12 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
+# ifndef __ASSUME_SENDFILE
ssize_t written;
- written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp
- - (char *) db->head, dataset->head.recsize);
+ written =
+# endif
+ sendfileall (fd, db->wr_fd, (char *) &dataset->resp
+ - (char *) db->head, dataset->head.recsize);
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
diff --git a/libc/resolv/res_init.c b/libc/resolv/res_init.c
index 73caaa4c5..c58c76384 100644
--- a/libc/resolv/res_init.c
+++ b/libc/resolv/res_init.c
@@ -233,7 +233,7 @@ __res_vinit(res_state statp, int preinit) {
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
- if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
+ if ((fp = fopen(_PATH_RESCONF, "rce")) != NULL) {
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
/* read the config file */
diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c
index 41f09a16e..63b73e6a1 100644
--- a/libc/stdio-common/vfprintf.c
+++ b/libc/stdio-common/vfprintf.c
@@ -1661,9 +1661,9 @@ do_positional:
/* Array with information about the needed arguments. This has to
be dynamically extensible. */
size_t nspecs = 0;
- size_t nspecs_max = 32; /* A more or less arbitrary start value. */
- struct printf_spec *specs
- = alloca (nspecs_max * sizeof (struct printf_spec));
+ /* A more or less arbitrary start value. */
+ size_t nspecs_size = 32 * sizeof (struct printf_spec);
+ struct printf_spec *specs = alloca (nspecs_size);
/* The number of arguments the format string requests. This will
determine the size of the array needed to store the argument
@@ -1702,15 +1702,14 @@ do_positional:
for (f = lead_str_end; *f != L_('\0'); f = specs[nspecs++].next_fmt)
{
- if (nspecs >= nspecs_max)
+ if (nspecs * sizeof (*specs) >= nspecs_size)
{
/* Extend the array of format specifiers. */
struct printf_spec *old = specs;
- specs = extend_alloca (specs, nspecs_max,
- 2 * nspecs_max * sizeof (*specs));
+ specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
/* Copy the old array's elements to the new space. */
- memmove (specs, old, nspecs * sizeof (struct printf_spec));
+ memmove (specs, old, nspecs * sizeof (*specs));
}
/* Parse the format specifier. */
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index f24758b70..ac590df65 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -1526,6 +1526,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
assert (numsize == densize);
for (i = numsize; i > 0; --i)
num[i] = num[i - 1];
+ num[0] = 0;
}
den[densize] = 0;
@@ -1570,6 +1571,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
n0 = num[densize] = num[densize - 1];
for (i = densize - 1; i > 0; --i)
num[i] = num[i - 1];
+ num[0] = 0;
got_limb;
}
diff --git a/libc/string/test-strcmp.c b/libc/string/test-strcmp.c
index 9ea4df759..62a42eba8 100644
--- a/libc/string/test-strcmp.c
+++ b/libc/string/test-strcmp.c
@@ -221,14 +221,16 @@ do_test (size_t align1, size_t align2, size_t len, int max_char,
static void
do_random_tests (void)
{
- for (size_t a = 0; a < CHARBYTES; a += CHARALIGN)
- for (size_t b = 0; b < CHARBYTES; b += CHARALIGN)
- {
- UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES - a);
- UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES - b);
+ UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES);
+ UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES);
for (size_t n = 0; n < ITERATIONS; n++)
{
+ /* for wcscmp case align1 and align2 mean here alignment
+ in wchar_t symbols, it equal 4*k alignment in bytes, we
+ don't check other alignments like for example
+ p1 = (wchar_t *)(buf1 + 1)
+ because it's wrong using of wchar_t type. */
size_t align1 = random () & 31;
size_t align2;
if (random () & 1)
@@ -274,7 +276,7 @@ do_random_tests (void)
}
int result = 0;
- MEMCPY ((CHAR *) (p2 + align2), (CHAR *) (p1 + align1), pos);
+ MEMCPY (p2 + align2, p1 + align1, pos);
if (pos < len1)
{
if (p2[align2 + pos] == p1[align1 + pos])
@@ -302,13 +304,12 @@ do_random_tests (void)
|| (r < 0 && result >= 0)
|| (r > 0 && result <= 0))
{
- error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p",
+ error (0, 0, "Iteration %zd - wrong result in function %s (align in bytes: %zd, align in bytes: %zd, len1: %zd, len2: %zd, pos: %zd) %d != %d, p1 %p p2 %p",
n, impl->name, (size_t) (p1 + align1) & 63, (size_t) (p1 + align2) & 63, len1, len2, pos, r, result, p1, p2);
ret = 1;
}
}
- }
- }
+ }
}
static void
diff --git a/libc/string/test-strcpy.c b/libc/string/test-strcpy.c
index 6a2ea2510..01a46de3c 100644
--- a/libc/string/test-strcpy.c
+++ b/libc/string/test-strcpy.c
@@ -1,7 +1,8 @@
/* Test and measure strcpy functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
+ Added wcscpy support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,29 +19,55 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#ifdef WIDE
+# include <wchar.h>
+# define CHAR wchar_t
+# define UCHAR wchar_t
+# define BIG_CHAR WCHAR_MAX
+# define SMALL_CHAR 1273
+# define STRCMP wcscmp
+# define MEMCMP wmemcmp
+# define MEMSET wmemset
+#else
+# define CHAR char
+# define UCHAR unsigned char
+# define BIG_CHAR CHAR_MAX
+# define SMALL_CHAR 127
+# define STRCMP strcmp
+# define MEMCMP memcmp
+# define MEMSET memset
+#endif
+
#ifndef STRCPY_RESULT
# define STRCPY_RESULT(dst, len) dst
# define TEST_MAIN
# include "test-string.h"
+# ifndef WIDE
+# define SIMPLE_STRCPY simple_strcpy
+# define STRCPY strcpy
+# else
+# define SIMPLE_STRCPY simple_wcscpy
+# define STRCPY wcscpy
+# endif
-char *simple_strcpy (char *, const char *);
+CHAR *SIMPLE_STRCPY (CHAR *, const CHAR *);
-IMPL (simple_strcpy, 0)
-IMPL (strcpy, 1)
+IMPL (SIMPLE_STRCPY, 0)
+IMPL (STRCPY, 1)
-char *
-simple_strcpy (char *dst, const char *src)
+CHAR *
+SIMPLE_STRCPY (CHAR *dst, const CHAR *src)
{
- char *ret = dst;
+ CHAR *ret = dst;
while ((*dst++ = *src++) != '\0');
return ret;
}
#endif
-typedef char *(*proto_t) (char *, const char *);
+typedef CHAR *(*proto_t) (CHAR *, const CHAR *);
static void
-do_one_test (impl_t *impl, char *dst, const char *src,
+do_one_test (impl_t *impl, CHAR *dst, const CHAR *src,
size_t len __attribute__((unused)))
{
if (CALL (impl, dst, src) != STRCPY_RESULT (dst, len))
@@ -51,7 +78,7 @@ do_one_test (impl_t *impl, char *dst, const char *src,
return;
}
- if (strcmp (dst, src) != 0)
+ if (STRCMP (dst, src) != 0)
{
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
impl->name, dst, src);
@@ -82,25 +109,27 @@ static void
do_test (size_t align1, size_t align2, size_t len, int max_char)
{
size_t i;
- char *s1, *s2;
-
+ CHAR *s1, *s2;
+/* For wcscpy: align1 and align2 here mean alignment not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
+ len for wcschr here isn't in bytes but it's number of wchar_t symbols. */
align1 &= 7;
- if (align1 + len >= page_size)
+ if ((align1 + len) * sizeof(CHAR) >= page_size)
return;
align2 &= 7;
- if (align2 + len >= page_size)
+ if ((align2 + len) * sizeof(CHAR) >= page_size)
return;
- s1 = (char *) (buf1 + align1);
- s2 = (char *) (buf2 + align2);
+ s1 = (CHAR *) (buf1) + align1;
+ s2 = (CHAR *) (buf2) + align2;
for (i = 0; i < len; i++)
s1[i] = 32 + 23 * i % (max_char - 32);
s1[len] = 0;
if (HP_TIMING_AVAIL)
- printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
+ printf ("Length %4zd, alignments in bytes %2zd/%2zd:", len, align1 * sizeof(CHAR), align2 * sizeof(CHAR));
FOR_EACH_IMPL (impl, 0)
do_one_test (impl, s2, s1, len);
@@ -113,15 +142,21 @@ static void
do_random_tests (void)
{
size_t i, j, n, align1, align2, len;
- unsigned char *p1 = buf1 + page_size - 512;
- unsigned char *p2 = buf2 + page_size - 512;
- unsigned char *res;
+ UCHAR *p1 = (UCHAR *) (buf1 + page_size) - 512;
+ UCHAR *p2 = (UCHAR *) (buf2 + page_size) - 512;
+ UCHAR *res;
for (n = 0; n < ITERATIONS; n++)
{
- align1 = random () & 31;
+ /* For wcsrchr: align1 and align2 here mean align not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof
+ (wchar_t)). For strrchr we need to check all alignments from
+ 0 to 63 since some assembly implementations have separate
+ prolog for alignments more 48. */
+
+ align1 = random () & (63 / sizeof(CHAR));
if (random () & 1)
- align2 = random () & 31;
+ align2 = random () & (63 / sizeof(CHAR));
else
align2 = align1 + (random () & 24);
len = random () & 511;
@@ -139,17 +174,16 @@ do_random_tests (void)
p1[i] = 0;
else
{
- p1[i] = random () & 255;
+ p1[i] = random () & BIG_CHAR;
if (i >= align1 && i < len + align1 && !p1[i])
- p1[i] = (random () & 127) + 3;
+ p1[i] = (random () & SMALL_CHAR) + 3;
}
}
FOR_EACH_IMPL (impl, 1)
{
- memset (p2 - 64, '\1', 512 + 64);
- res = (unsigned char *) CALL (impl, (char *) (p2 + align2),
- (char *) (p1 + align1));
+ MEMSET (p2 - 64, '\1', 512 + 64);
+ res = (UCHAR *) CALL (impl, (CHAR *) (p2 + align2), (CHAR *) (p1 + align1));
if (res != STRCPY_RESULT (p2 + align2, len))
{
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
@@ -177,7 +211,7 @@ do_random_tests (void)
break;
}
}
- if (memcmp (p1 + align1, p2 + align2, len + 1))
+ if (MEMCMP (p1 + align1, p2 + align2, len + 1))
{
error (0, 0, "Iteration %zd - different strings, %s (%zd, %zd, %zd)",
n, impl->name, align1, align2, len);
@@ -201,24 +235,24 @@ test_main (void)
for (i = 0; i < 16; ++i)
{
- do_test (0, 0, i, 127);
- do_test (0, 0, i, 255);
- do_test (0, i, i, 127);
- do_test (i, 0, i, 255);
+ do_test (0, 0, i, SMALL_CHAR);
+ do_test (0, 0, i, BIG_CHAR);
+ do_test (0, i, i, SMALL_CHAR);
+ do_test (i, 0, i, BIG_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (0, 0, 8 << i, 127);
- do_test (8 - i, 2 * i, 8 << i, 127);
+ do_test (0, 0, 8 << i, SMALL_CHAR);
+ do_test (8 - i, 2 * i, 8 << i, SMALL_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (i, 2 * i, 8 << i, 127);
- do_test (2 * i, i, 8 << i, 255);
- do_test (i, i, 8 << i, 127);
- do_test (i, i, 8 << i, 255);
+ do_test (i, 2 * i, 8 << i, SMALL_CHAR);
+ do_test (2 * i, i, 8 << i, BIG_CHAR);
+ do_test (i, i, 8 << i, SMALL_CHAR);
+ do_test (i, i, 8 << i, BIG_CHAR);
}
do_random_tests ();
diff --git a/libc/string/test-strrchr.c b/libc/string/test-strrchr.c
index 92e8ab1bb..484c2f302 100644
--- a/libc/string/test-strrchr.c
+++ b/libc/string/test-strrchr.c
@@ -1,7 +1,9 @@
-/* Test and measure strrchr functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Test and measure STRCHR functions.
+ Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
+ Added wcsrrchr support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>,
+ 2011.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,28 +23,45 @@
#define TEST_MAIN
#include "test-string.h"
-typedef char *(*proto_t) (const char *, int);
-char *simple_strrchr (const char *, int);
-
-IMPL (simple_strrchr, 0)
-IMPL (strrchr, 1)
-
-char *
-simple_strrchr (const char *s, int c)
+#ifdef WIDE
+# include <wchar.h>
+# define SIMPLE_STRRCHR simple_wcsrchr
+# define STRRCHR wcsrchr
+# define CHAR wchar_t
+# define UCHAR wchar_t
+# define BIG_CHAR WCHAR_MAX
+# define SMALL_CHAR 1273
+#else
+# define SIMPLE_STRRCHR simple_strrchr
+# define STRRCHR strrchr
+# define CHAR char
+# define UCHAR unsigned char
+# define BIG_CHAR CHAR_MAX
+# define SMALL_CHAR 127
+#endif
+
+typedef CHAR *(*proto_t) (const CHAR *, int);
+CHAR *SIMPLE_STRRCHR (const CHAR *, int);
+
+IMPL (SIMPLE_STRRCHR, 0)
+IMPL (STRRCHR, 1)
+
+CHAR *
+SIMPLE_STRRCHR (const CHAR *s, int c)
{
- const char *ret = NULL;
+ const CHAR *ret = NULL;
for (; *s != '\0'; ++s)
- if (*s == (char) c)
+ if (*s == (CHAR) c)
ret = s;
- return (char *) (c == '\0' ? s : ret);
+ return (CHAR *) (c == '\0' ? s : ret);
}
static void
-do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
+do_one_test (impl_t *impl, const CHAR *s, int c, CHAR *exp_res)
{
- char *res = CALL (impl, s, c);
+ CHAR *res = CALL (impl, s, c);
if (res != exp_res)
{
error (0, 0, "Wrong result in function %s %p %p", impl->name,
@@ -72,41 +91,45 @@ do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
static void
do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
+/* For wcsrchr: align here means align not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
+ len for wcschr here isn't in bytes but it's number of wchar_t symbols. */
{
size_t i;
- char *result;
+ CHAR *result;
+ CHAR *buf = (CHAR *) buf1;
align &= 7;
- if (align + len >= page_size)
+ if ( (align + len) * sizeof(CHAR) >= page_size)
return;
for (i = 0; i < len; ++i)
{
- buf1[align + i] = random () & max_char;
- if (!buf1[align + i])
- buf1[align + i] = random () & max_char;
- if (!buf1[align + i])
- buf1[align + i] = 1;
- if ((i > pos || pos >= len) && buf1[align + i] == seek_char)
- buf1[align + i] = seek_char + 10 + (random () & 15);
+ buf[align + i] = (random () * random ()) & max_char;
+ if (!buf[align + i])
+ buf[align + i] = (random () * random ()) & max_char;
+ if (!buf[align + i])
+ buf[align + i] = 1;
+ if ((i > pos || pos >= len) && buf[align + i] == seek_char)
+ buf[align + i] = seek_char + 10 + (random () & 15);
}
- buf1[align + len] = 0;
+ buf[align + len] = 0;
if (pos < len)
{
- buf1[align + pos] = seek_char;
- result = (char *) (buf1 + align + pos);
+ buf[align + pos] = seek_char;
+ result = (CHAR *) (buf + align + pos);
}
else if (seek_char == 0)
- result = (char *) (buf1 + align + len);
+ result = (CHAR *) (buf + align + len);
else
result = NULL;
if (HP_TIMING_AVAIL)
- printf ("Length %4zd, alignment %2zd:", pos, align);
+ printf ("Length %4zd, alignment in bytes %2zd:", pos, align * sizeof(CHAR));
FOR_EACH_IMPL (impl, 0)
- do_one_test (impl, (char *) (buf1 + align), seek_char, result);
+ do_one_test (impl, (CHAR *) (buf + align), seek_char, result);
if (HP_TIMING_AVAIL)
putchar ('\n');
@@ -117,20 +140,27 @@ do_random_tests (void)
{
size_t i, j, n, align, pos, len;
int seek_char;
- char *result;
- unsigned char *p = buf1 + page_size - 512;
+ CHAR *result;
+ UCHAR *p = (UCHAR *) (buf1 + page_size) - 512;
for (n = 0; n < ITERATIONS; n++)
{
- align = random () & 15;
+ align = random () & (63 / sizeof(CHAR));
+ /* For wcsrchr: align here means align not in bytes, but in wchar_ts,
+ in bytes it will equal to align * (sizeof (wchar_t)).
+ For strrchr we need to check all alignments from 0 to 63 since
+ some assembly implementations have separate prolog for alignments
+ more 48. */
pos = random () & 511;
if (pos + align >= 511)
pos = 510 - align - (random () & 7);
len = random () & 511;
+ /* len for wcschr here isn't in bytes but it's number of wchar_t
+ symbols. */
if (pos >= len)
len = pos + (random () & 7);
if (len + align >= 512)
- len = 511 - align - (random () & 7);
+ len = 511 - align - (random () & 7);
seek_char = random () & 255;
if (seek_char && pos == len)
{
@@ -141,7 +171,7 @@ do_random_tests (void)
}
j = len + align + 64;
if (j > 512)
- j = 512;
+ j = 512;
for (i = 0; i < j; i++)
{
@@ -165,18 +195,18 @@ do_random_tests (void)
}
if (pos <= len)
- result = (char *) (p + pos + align);
+ result = (CHAR *) (p + pos + align);
else if (seek_char == 0)
- result = (char *) (p + len + align);
+ result = (CHAR *) (p + len + align);
else
result = NULL;
FOR_EACH_IMPL (impl, 1)
- if (CALL (impl, (char *) (p + align), seek_char) != result)
+ if (CALL (impl, (CHAR *) (p + align), seek_char) != result)
{
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
n, impl->name, align, seek_char, len, pos,
- CALL (impl, (char *) (p + align), seek_char), result, p);
+ CALL (impl, (CHAR *) (p + align), seek_char), result, p);
ret = 1;
}
}
@@ -196,38 +226,38 @@ test_main (void)
for (i = 1; i < 8; ++i)
{
- do_test (0, 16 << i, 2048, 23, 127);
- do_test (i, 16 << i, 2048, 23, 127);
+ do_test (0, 16 << i, 2048, 23, SMALL_CHAR);
+ do_test (i, 16 << i, 2048, 23, SMALL_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (i, 64, 256, 23, 127);
- do_test (i, 64, 256, 23, 255);
+ do_test (i, 64, 256, 23, SMALL_CHAR);
+ do_test (i, 64, 256, 23, BIG_CHAR);
}
for (i = 0; i < 32; ++i)
{
- do_test (0, i, i + 1, 23, 127);
- do_test (0, i, i + 1, 23, 255);
+ do_test (0, i, i + 1, 23, SMALL_CHAR);
+ do_test (0, i, i + 1, 23, BIG_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (0, 16 << i, 2048, 0, 127);
- do_test (i, 16 << i, 2048, 0, 127);
+ do_test (0, 16 << i, 2048, 0, SMALL_CHAR);
+ do_test (i, 16 << i, 2048, 0, SMALL_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (i, 64, 256, 0, 127);
- do_test (i, 64, 256, 0, 255);
+ do_test (i, 64, 256, 0, SMALL_CHAR);
+ do_test (i, 64, 256, 0, BIG_CHAR);
}
for (i = 0; i < 32; ++i)
{
- do_test (0, i, i + 1, 0, 127);
- do_test (0, i, i + 1, 0, 255);
+ do_test (0, i, i + 1, 0, SMALL_CHAR);
+ do_test (0, i, i + 1, 0, BIG_CHAR);
}
do_random_tests ();
diff --git a/libc/sunrpc/clnt_tcp.c b/libc/sunrpc/clnt_tcp.c
index 7cfbe9e8d..d1fc43dbf 100644
--- a/libc/sunrpc/clnt_tcp.c
+++ b/libc/sunrpc/clnt_tcp.c
@@ -364,6 +364,8 @@ static bool_t
clnttcp_control (CLIENT *cl, int request, char *info)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
+ u_long *mcall_ptr;
+ u_long ul;
switch (request)
@@ -393,11 +395,24 @@ clnttcp_control (CLIENT *cl, int request, char *info)
* first element in the call structure *.
* This will get the xid of the PREVIOUS call
*/
+#if 0
+ /* This original code has aliasing issues. */
*(u_long *)info = ntohl (*(u_long *)ct->ct_mcall);
+#else
+ mcall_ptr = (u_long *)ct->ct_mcall;
+ ul = ntohl (*mcall_ptr);
+ memcpy (info, &ul, sizeof (ul));
+#endif
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
+#if 0
+ /* This original code has aliasing issues. */
*(u_long *)ct->ct_mcall = htonl (*(u_long *)info - 1);
+#else
+ ul = ntohl (*(u_long *)info - 1);
+ memcpy (ct->ct_mcall, &ul, sizeof (ul));
+#endif
/* decrement by 1 as clnttcp_call() increments once */
break;
case CLGET_VERS:
diff --git a/libc/sunrpc/clnt_udp.c b/libc/sunrpc/clnt_udp.c
index babee9abf..294e13a58 100644
--- a/libc/sunrpc/clnt_udp.c
+++ b/libc/sunrpc/clnt_udp.c
@@ -473,8 +473,7 @@ send_again:
/* see if reply transaction id matches sent id.
Don't do this if we only wait for a replay */
if (xargs != NULL
- && (*((u_int32_t *) (cu->cu_inbuf))
- != *((u_int32_t *) (cu->cu_outbuf))))
+ && memcmp (cu->cu_inbuf, cu->cu_outbuf, sizeof (u_int32_t)) != 0)
continue;
/* we now assume we have the proper reply */
break;
diff --git a/libc/sunrpc/clnt_unix.c b/libc/sunrpc/clnt_unix.c
index 62dc8c604..282127bb8 100644
--- a/libc/sunrpc/clnt_unix.c
+++ b/libc/sunrpc/clnt_unix.c
@@ -338,7 +338,8 @@ static bool_t
clntunix_control (CLIENT *cl, int request, char *info)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
-
+ u_long *mcall_ptr;
+ u_long ul;
switch (request)
{
@@ -366,11 +367,24 @@ clntunix_control (CLIENT *cl, int request, char *info)
* first element in the call structure *.
* This will get the xid of the PREVIOUS call
*/
+#if 0
+ /* This original code has aliasing issues. */
*(u_long *) info = ntohl (*(u_long *)ct->ct_mcall);
+#else
+ mcall_ptr = (u_long *)ct->ct_mcall;
+ ul = ntohl (*mcall_ptr);
+ memcpy (info, &ul, sizeof (ul));
+#endif
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
+#if 0
+ /* This original code has aliasing issues. */
*(u_long *) ct->ct_mcall = htonl (*(u_long *)info - 1);
+#else
+ ul = ntohl (*(u_long *)info - 1);
+ memcpy (ct->ct_mcall, &ul, sizeof (ul));
+#endif
/* decrement by 1 as clntunix_call() increments once */
break;
case CLGET_VERS:
diff --git a/libc/sysdeps/generic/dl-hash.h b/libc/sysdeps/generic/dl-hash.h
index 243ae14b5..e0db00edc 100644
--- a/libc/sysdeps/generic/dl-hash.h
+++ b/libc/sysdeps/generic/dl-hash.h
@@ -1,5 +1,5 @@
/* Compute hash value for given string according to ELF standard.
- Copyright (C) 1995,1996,1997,1998,2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998,2003,2005,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,46 +25,47 @@
first five operations no overflow is possible so we optimized it a
bit. */
static unsigned int
+__attribute__ ((unused))
_dl_elf_hash (const char *name_arg)
{
const unsigned char *name = (const unsigned char *) name_arg;
- unsigned long int hash = 0;
- if (*name != '\0')
+ unsigned long int hash = *name;
+ if (hash != 0 && name[1] != '\0')
{
- hash = *name++;
- if (*name != '\0')
+ hash = (hash << 4) + name[1];
+ if (name[2] != '\0')
{
- hash = (hash << 4) + *name++;
- if (*name != '\0')
+ hash = (hash << 4) + name[2];
+ if (name[3] != '\0')
{
- hash = (hash << 4) + *name++;
- if (*name != '\0')
+ hash = (hash << 4) + name[3];
+ if (name[4] != '\0')
{
- hash = (hash << 4) + *name++;
- if (*name != '\0')
+ hash = (hash << 4) + name[4];
+ name += 5;
+ while (*name != '\0')
{
+ unsigned long int hi;
hash = (hash << 4) + *name++;
- while (*name != '\0')
- {
- unsigned long int hi;
- hash = (hash << 4) + *name++;
- hi = hash & 0xf0000000;
+ hi = hash & 0xf0000000;
- /* The algorithm specified in the ELF ABI is as
- follows:
+ /* The algorithm specified in the ELF ABI is as
+ follows:
- if (hi != 0)
- hash ^= hi >> 24;
+ if (hi != 0)
+ hash ^= hi >> 24;
- hash &= ~hi;
+ hash &= ~hi;
- But the following is equivalent and a lot
- faster, especially on modern processors. */
+ But the following is equivalent and a lot
+ faster, especially on modern processors. */
- hash ^= hi;
- hash ^= hi >> 24;
- }
+ hash ^= hi >> 24;
}
+
+ /* Second part of the modified formula. This
+ operation can be lifted outside the loop. */
+ hash &= 0x0fffffff;
}
}
}
diff --git a/libc/sysdeps/i386/i686/multiarch/Makefile b/libc/sysdeps/i386/i686/multiarch/Makefile
index 426b718e4..b764e5b82 100644
--- a/libc/sysdeps/i386/i686/multiarch/Makefile
+++ b/libc/sysdeps/i386/i686/multiarch/Makefile
@@ -37,7 +37,8 @@ endif
ifeq ($(subdir),wcsmbs)
sysdep_routines += wcscmp-sse2 wcscmp-c wcslen-sse2 wcslen-c \
- wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c
+ wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcschr-sse2 \
+ wcschr-c wcsrchr-sse2 wcsrchr-c wcscpy-ssse3 wcscpy-c
endif
ifeq (mathyes,$(subdir)$(config-cflags-avx))
diff --git a/libc/sysdeps/i386/i686/multiarch/wcschr-c.c b/libc/sysdeps/i386/i686/multiarch/wcschr-c.c
new file mode 100644
index 000000000..a63e50e28
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcschr-c.c
@@ -0,0 +1,8 @@
+#ifndef NOT_IN_libc
+# undef libc_hidden_def
+# define libc_hidden_def(name) \
+ __hidden_ver1 (__wcschr_ia32, __GI_wcschr, __wcschr_ia32);
+# define WCSCHR __wcschr_ia32
+#endif
+
+#include "wcsmbs/wcschr.c"
diff --git a/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S b/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S
new file mode 100644
index 000000000..cc8204cfe
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S
@@ -0,0 +1,220 @@
+/* wcschr with SSE2, without using bsf instructions
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 4
+# define STR1 PARMS
+# define STR2 STR1+4
+
+ atom_text_section
+ENTRY (__wcschr_sse2)
+
+ mov STR1(%esp), %ecx
+ movd STR2(%esp), %xmm1
+
+ mov %ecx, %eax
+ punpckldq %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ punpckldq %xmm1, %xmm1
+
+ and $63, %eax
+ cmp $48, %eax
+ ja L(cross_cache)
+
+ movdqu (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ and $-16, %ecx
+ jmp L(loop)
+
+ .p2align 4
+L(cross_cache):
+ PUSH (%edi)
+ mov %ecx, %edi
+ mov %eax, %ecx
+ and $-16, %edi
+ and $15, %ecx
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+
+ sarl %cl, %edx
+ sarl %cl, %eax
+ test %eax, %eax
+ jz L(unaligned_no_match)
+
+ add %edi, %ecx
+ POP (%edi)
+
+ test %edx, %edx
+ jz L(match_case1)
+ test %al, %al
+ jz L(match_higth_case2)
+ test $15, %al
+ jnz L(match_case2_4)
+ test $15, %dl
+ jnz L(return_null)
+ lea 4(%ecx), %eax
+ ret
+
+ CFI_PUSH (%edi)
+
+ .p2align 4
+L(unaligned_no_match):
+ mov %edi, %ecx
+ POP (%edi)
+
+ test %edx, %edx
+ jnz L(return_null)
+
+ pxor %xmm2, %xmm2
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ add $16, %ecx
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jz L(loop)
+
+ .p2align 4
+L(matches):
+ pmovmskb %xmm2, %edx
+ test %eax, %eax
+ jz L(return_null)
+ test %edx, %edx
+ jz L(match_case1)
+
+ .p2align 4
+L(match_case2):
+ test %al, %al
+ jz L(match_higth_case2)
+ test $15, %al
+ jnz L(match_case2_4)
+ test $15, %dl
+ jnz L(return_null)
+ lea 4(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case2_4):
+ mov %ecx, %eax
+ ret
+
+ .p2align 4
+L(match_higth_case2):
+ test %dl, %dl
+ jnz L(return_null)
+ test $15, %ah
+ jnz L(match_case2_12)
+ test $15, %dh
+ jnz L(return_null)
+ lea 12(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case2_12):
+ lea 8(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case1):
+ test %al, %al
+ jz L(match_higth_case1)
+
+ test $0x01, %al
+ jnz L(exit0)
+ lea 4(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_higth_case1):
+ test $0x01, %ah
+ jnz L(exit3)
+ lea 12(%ecx), %eax
+ ret
+
+ .p2align 4
+L(exit0):
+ mov %ecx, %eax
+ ret
+
+ .p2align 4
+L(exit3):
+ lea 8(%ecx), %eax
+ ret
+
+ .p2align 4
+L(return_null):
+ xor %eax, %eax
+ ret
+
+END (__wcschr_sse2)
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/wcschr.S b/libc/sysdeps/i386/i686/multiarch/wcschr.S
new file mode 100644
index 000000000..bf0d6d575
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcschr.S
@@ -0,0 +1,54 @@
+/* Multiple versions of wcschr
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+#include <init-arch.h>
+
+#ifndef NOT_IN_libc
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .p2align 4
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
+ .text
+ENTRY(wcschr)
+ .type wcschr, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcschr_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcschr_sse2@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4);
+ cfi_restore (ebx)
+ ret
+END(wcschr)
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c b/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c
new file mode 100644
index 000000000..a3c4024c0
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c
@@ -0,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcscpy __wcscpy_ia32
+#endif
+
+#include "wcsmbs/wcscpy.c"
diff --git a/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S b/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S
new file mode 100644
index 000000000..84d92a8bd
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S
@@ -0,0 +1,621 @@
+/* wcscpy with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 4
+# define RETURN POP (%edi); ret; CFI_PUSH (%edi)
+# define STR1 PARMS
+# define STR2 STR1+4
+# define LEN STR2+4
+
+ atom_text_section
+ENTRY (__wcscpy_ssse3)
+ mov STR1(%esp), %edx
+ mov STR2(%esp), %ecx
+
+ cmp $0, (%ecx)
+ jz L(ExitTail4)
+ cmp $0, 4(%ecx)
+ jz L(ExitTail8)
+ cmp $0, 8(%ecx)
+ jz L(ExitTail12)
+ cmp $0, 12(%ecx)
+ jz L(ExitTail16)
+
+ PUSH (%edi)
+ mov %edx, %edi
+
+ PUSH (%esi)
+ lea 16(%ecx), %esi
+
+ and $-16, %esi
+
+ pxor %xmm0, %xmm0
+ pcmpeqd (%esi), %xmm0
+ movdqu (%ecx), %xmm1
+ movdqu %xmm1, (%edx)
+
+ pmovmskb %xmm0, %eax
+ sub %ecx, %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ mov %edx, %eax
+ lea 16(%edx), %edx
+ and $-16, %edx
+ sub %edx, %eax
+
+ sub %eax, %ecx
+ mov %ecx, %eax
+ and $0xf, %eax
+ mov $0, %esi
+
+ jz L(Align16Both)
+ cmp $4, %eax
+ je L(Shl4)
+ cmp $8, %eax
+ je L(Shl8)
+ jmp L(Shl12)
+
+L(Align16Both):
+ movaps (%ecx), %xmm1
+ movaps 16(%ecx), %xmm2
+ movaps %xmm1, (%edx)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm3
+ movaps %xmm2, (%edx, %esi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm4
+ movaps %xmm3, (%edx, %esi)
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm1
+ movaps %xmm4, (%edx, %esi)
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm2
+ movaps %xmm1, (%edx, %esi)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm3
+ movaps %xmm2, (%edx, %esi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm3, (%edx, %esi)
+ mov %ecx, %eax
+ lea 16(%ecx, %esi), %ecx
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ sub %eax, %edx
+
+ mov $-0x40, %esi
+
+L(Aligned64Loop):
+ movaps (%ecx), %xmm2
+ movaps 32(%ecx), %xmm3
+ movaps %xmm2, %xmm4
+ movaps 16(%ecx), %xmm5
+ movaps %xmm3, %xmm6
+ movaps 48(%ecx), %xmm7
+ pminub %xmm5, %xmm2
+ pminub %xmm7, %xmm3
+ pminub %xmm2, %xmm3
+ lea 64(%edx), %edx
+ pcmpeqd %xmm0, %xmm3
+ lea 64(%ecx), %ecx
+ pmovmskb %xmm3, %eax
+
+ test %eax, %eax
+ jnz L(Aligned64Leave)
+ movaps %xmm4, -64(%edx)
+ movaps %xmm5, -48(%edx)
+ movaps %xmm6, -32(%edx)
+ movaps %xmm7, -16(%edx)
+ jmp L(Aligned64Loop)
+
+L(Aligned64Leave):
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm5, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm4, -64(%edx)
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm6, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm5, -48(%edx)
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm6, -32(%edx)
+ pcmpeqd %xmm7, %xmm0
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ mov $-0x40, %esi
+ movaps %xmm7, -16(%edx)
+ jmp L(Aligned64Loop)
+
+ .p2align 4
+L(Shl4):
+ movaps -4(%ecx), %xmm1
+ movaps 12(%ecx), %xmm2
+L(Shl4Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 28(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -12(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -4(%ecx), %xmm1
+
+L(Shl4LoopStart):
+ movaps 12(%ecx), %xmm2
+ movaps 28(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 44(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 60(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $4, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $4, %xmm3, %xmm4
+ jnz L(Shl4Start)
+
+ palignr $4, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl4LoopStart)
+
+L(Shl4LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $12, %xmm6
+ palignr $4, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+ add $12, %edx
+ add $12, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(Shl8):
+ movaps -8(%ecx), %xmm1
+ movaps 8(%ecx), %xmm2
+L(Shl8Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 24(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -8(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -8(%ecx), %xmm1
+
+L(Shl8LoopStart):
+ movaps 8(%ecx), %xmm2
+ movaps 24(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 40(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 56(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $8, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $8, %xmm3, %xmm4
+ jnz L(Shl8Start)
+
+ palignr $8, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl8LoopStart)
+
+L(Shl8LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $8, %xmm6
+ palignr $8, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+ add $8, %edx
+ add $8, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(Shl12):
+ movaps -12(%ecx), %xmm1
+ movaps 4(%ecx), %xmm2
+L(Shl12Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 20(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -4(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -12(%ecx), %xmm1
+
+L(Shl12LoopStart):
+ movaps 4(%ecx), %xmm2
+ movaps 20(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 36(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 52(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $12, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $12, %xmm3, %xmm4
+ jnz L(Shl12Start)
+
+ palignr $12, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl12LoopStart)
+
+L(Shl12LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $4, %xmm6
+ mov $4, %esi
+ palignr $12, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+
+ .p2align 4
+L(CopyFrom1To16Bytes):
+ add %esi, %edx
+ add %esi, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(ExitHigh):
+ test $0x01, %ah
+ jnz L(Exit12)
+ movdqu (%ecx), %xmm0
+ movdqu %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(Exit4):
+ movl (%ecx), %eax
+ movl %eax, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(Exit12):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl 8(%ecx), %eax
+ movl %eax, 8(%edx)
+ movl %edi, %eax
+ RETURN
+
+CFI_POP (%edi)
+
+ .p2align 4
+L(ExitTail4):
+ movl (%ecx), %eax
+ movl %eax, (%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail8):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail12):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl 8(%ecx), %eax
+ movl %eax, 8(%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail16):
+ movdqu (%ecx), %xmm0
+ movdqu %xmm0, (%edx)
+ movl %edx, %eax
+ ret
+
+END (__wcscpy_ssse3)
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/wcscpy.S b/libc/sysdeps/i386/i686/multiarch/wcscpy.S
new file mode 100644
index 000000000..c7bafbe82
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcscpy.S
@@ -0,0 +1,46 @@
+/* Multiple versions of wcscpy
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+#include <init-arch.h>
+
+/* Define multiple versions only for the definition in libc. */
+#ifndef NOT_IN_libc
+ .text
+ENTRY(wcscpy)
+ .type wcscpy, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcscpy_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcscpy_ssse3@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(wcscpy)
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c b/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c
new file mode 100644
index 000000000..c7444ce89
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c
@@ -0,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcsrchr __wcsrchr_ia32
+#endif
+
+#include "wcsmbs/wcsrchr.c"
diff --git a/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S b/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S
new file mode 100644
index 000000000..2859f7e9f
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S
@@ -0,0 +1,355 @@
+/* wcsrchr with SSE2, without using bsf instructions.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 8
+# define ENTRANCE PUSH (%edi);
+# define RETURN POP (%edi); ret; CFI_PUSH (%edi);
+# define STR1 PARMS
+# define STR2 STR1+4
+
+ atom_text_section
+ENTRY (__wcsrchr_sse2)
+
+ ENTRANCE
+ mov STR1(%esp), %ecx
+ movd STR2(%esp), %xmm1
+
+ mov %ecx, %edi
+ punpckldq %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ punpckldq %xmm1, %xmm1
+
+/* ECX has OFFSET. */
+ and $63, %ecx
+ cmp $48, %ecx
+ ja L(crosscache)
+
+/* unaligned string. */
+ movdqu (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+/* Find where NULL is. */
+ pmovmskb %xmm2, %ecx
+/* Check if there is a match. */
+ pmovmskb %xmm0, %eax
+ add $16, %edi
+
+ test %eax, %eax
+ jnz L(unaligned_match1)
+
+ test %ecx, %ecx
+ jnz L(return_null)
+
+ and $-16, %edi
+
+ PUSH (%esi)
+
+ xor %edx, %edx
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(unaligned_match1):
+ test %ecx, %ecx
+ jnz L(prolog_find_zero_1)
+
+ PUSH (%esi)
+
+/* Save current match */
+ mov %eax, %edx
+ mov %edi, %esi
+ and $-16, %edi
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(crosscache):
+/* Hancle unaligned string. */
+ and $15, %ecx
+ and $-16, %edi
+ pxor %xmm3, %xmm3
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm3
+ pcmpeqd %xmm1, %xmm0
+/* Find where NULL is. */
+ pmovmskb %xmm3, %edx
+/* Check if there is a match. */
+ pmovmskb %xmm0, %eax
+/* Remove the leading bytes. */
+ shr %cl, %edx
+ shr %cl, %eax
+ add $16, %edi
+
+ test %eax, %eax
+ jnz L(unaligned_match)
+
+ test %edx, %edx
+ jnz L(return_null)
+
+ PUSH (%esi)
+
+ xor %edx, %edx
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(unaligned_match):
+ test %edx, %edx
+ jnz L(prolog_find_zero)
+
+ PUSH (%esi)
+
+ mov %eax, %edx
+ lea (%edi, %ecx), %esi
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm0, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm3
+ pcmpeqd %xmm3, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm3
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm3, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm4
+ pcmpeqd %xmm4, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm4
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm4, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm5
+ pcmpeqd %xmm5, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm5
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm5, %eax
+ or %eax, %ecx
+ jz L(loop)
+
+ .p2align 4
+L(matches):
+ test %eax, %eax
+ jnz L(match)
+L(return_value):
+ test %edx, %edx
+ jz L(return_null_1)
+ mov %edx, %eax
+ mov %esi, %edi
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(return_null_1):
+ POP (%esi)
+
+ xor %eax, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(match):
+ pmovmskb %xmm2, %ecx
+ test %ecx, %ecx
+ jnz L(find_zero)
+/* save match info */
+ mov %eax, %edx
+ mov %edi, %esi
+ jmp L(loop)
+
+ .p2align 4
+L(find_zero):
+ test %cl, %cl
+ jz L(find_zero_in_third_or_fourth_wchar)
+ test $15, %cl
+ jz L(find_zero_in_second_wchar)
+ and $1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_second_wchar):
+ and $1 << 5 - 1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_third_or_fourth_wchar):
+ test $15, %ch
+ jz L(find_zero_in_fourth_wchar)
+ and $1 << 9 - 1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_fourth_wchar):
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(match_second_wchar):
+ lea -12(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_third_or_fourth_wchar):
+ test $15 << 4, %ah
+ jnz L(match_fourth_wchar)
+ lea -8(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_third_wchar):
+ lea -8(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_fourth_wchar):
+ lea -4(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(return_null):
+ xor %eax, %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero):
+ add %ecx, %edi
+ mov %edx, %ecx
+L(prolog_find_zero_1):
+ test %cl, %cl
+ jz L(prolog_find_zero_in_third_or_fourth_wchar)
+ test $15, %cl
+ jz L(prolog_find_zero_in_second_wchar)
+ and $1, %eax
+ jz L(return_null)
+
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_second_wchar):
+ and $1 << 5 - 1, %eax
+ jz L(return_null)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_third_or_fourth_wchar):
+ test $15, %ch
+ jz L(prolog_find_zero_in_fourth_wchar)
+ and $1 << 9 - 1, %eax
+ jz L(return_null)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_fourth_wchar):
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+END (__wcsrchr_sse2)
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/wcsrchr.S b/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
new file mode 100644
index 000000000..8240063dd
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
@@ -0,0 +1,54 @@
+/* Multiple versions of wcsrchr
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+#include <init-arch.h>
+
+#ifndef NOT_IN_libc
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .p2align 4
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
+ .text
+ENTRY(wcsrchr)
+ .type wcsrchr, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcsrchr_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcsrchr_sse2@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4);
+ cfi_restore (ebx)
+ ret
+END(wcsrchr)
+#endif
diff --git a/libc/sysdeps/powerpc/Makefile b/libc/sysdeps/powerpc/Makefile
index e43ca704f..23a9a1673 100644
--- a/libc/sysdeps/powerpc/Makefile
+++ b/libc/sysdeps/powerpc/Makefile
@@ -23,4 +23,6 @@ endif
ifeq ($(subdir),csu)
# get offset to rtld_global._dl_hwcap
gen-as-const-headers += rtld-global-offsets.sym
+# get offset to __locale_struct.__ctype_tolower
+gen-as-const-headers += locale-defines.sym
endif
diff --git a/libc/sysdeps/powerpc/fpu/e_hypot.c b/libc/sysdeps/powerpc/fpu/e_hypot.c
index a8d67d875..3731c58a3 100644
--- a/libc/sysdeps/powerpc/fpu/e_hypot.c
+++ b/libc/sysdeps/powerpc/fpu/e_hypot.c
@@ -26,7 +26,7 @@ static const double two500 = 3.2733906078961419e+150;
static const double two600 = 4.149515568880993e+180;
static const double two1022 = 4.49423283715579e+307;
static const double twoM500 = 3.054936363499605e-151;
-static const double twoM600 = 4.616489308892868e-128;
+static const double twoM600 = 2.4099198651028841e-181;
static const double pdnum = 2.225073858507201e-308;
/* __ieee754_hypot(x,y)
diff --git a/libc/sysdeps/powerpc/locale-defines.sym b/libc/sysdeps/powerpc/locale-defines.sym
new file mode 100644
index 000000000..af64b920a
--- /dev/null
+++ b/libc/sysdeps/powerpc/locale-defines.sym
@@ -0,0 +1,5 @@
+#include <locale/localeinfo.h>
+
+--
+
+LOCALE_CTYPE_TOLOWER offsetof (struct __locale_struct, __ctype_tolower)
diff --git a/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S b/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S
index 472f7a393..f4c3c1841 100644
--- a/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S
@@ -1,5 +1,5 @@
/* Optimized memcpy implementation for PowerPC A2.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Michael Brutman <brutman@us.ibm.com>.
This file is part of the GNU C Library.
@@ -113,11 +113,9 @@ L(dst_aligned):
mflr r0
/* Establishes GOT addressability so we can load __cache_line_size
from static. This value was set from the aux vector during startup. */
- bcl 20,31,1f
-1:
- mflr r9
- addis r9,r9,__cache_line_size-1b@ha
- lwz r9,__cache_line_size-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,__cache_line_size-got_label@ha
+ lwz r9,__cache_line_size-got_label@l(r9)
mtlr r0
#else
/* Load __cache_line_size from static. This value was set from the
diff --git a/libc/sysdeps/powerpc/powerpc32/dl-start.S b/libc/sysdeps/powerpc/powerpc32/dl-start.S
index ae41f47ed..c2fcc3746 100644
--- a/libc/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/libc/sysdeps/powerpc/powerpc32/dl-start.S
@@ -1,5 +1,6 @@
/* Machine-dependent ELF startup code. PowerPC version.
- Copyright (C) 1995-2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2002, 2004, 2005, 2006, 2011
+ 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
@@ -47,10 +48,9 @@ _dl_start_user:
passed by value!). */
/* Put our GOT pointer in r31, */
- bcl 20,31,1f
-1: mflr r31
- addis r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r31,got_label)
+ addis r31,r31,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r31,r31,_GLOBAL_OFFSET_TABLE_-got_label@l
/* the address of _start in r30, */
mr r30,r3
/* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */
diff --git a/libc/sysdeps/powerpc/powerpc32/elf/start.S b/libc/sysdeps/powerpc/powerpc32/elf/start.S
index dc89a5e10..a26ba430f 100644
--- a/libc/sysdeps/powerpc/powerpc32/elf/start.S
+++ b/libc/sysdeps/powerpc/powerpc32/elf/start.S
@@ -1,5 +1,5 @@
/* Startup code for programs linked with GNU libc.
- Copyright (C) 1998,1999,2000,2001,2002,2003,2009
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -59,10 +59,8 @@ ENTRY(_start)
/* Set up an initial stack frame, and clear the LR. */
clrrwi r1,r1,4
#ifdef PIC
- bcl 20,31,L(branch)
-L(branch):
+ SETUP_GOT_ACCESS(r13,got_label)
li r0,0
- mflr r13
#else
li r0,0
#endif
@@ -73,10 +71,10 @@ L(branch):
start_addresses in r8. Also load the GOT pointer so that new PLT
calls work, like the one to __libc_start_main. */
#ifdef PIC
- addis r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha
- addis r8,r13,L(start_addresses)-L(branch)@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l
- lwzu r13,L(start_addresses)-L(branch)@l(r8)
+ addis r30,r13,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addis r8,r13,L(start_addresses)-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
+ lwzu r13, L(start_addresses)-got_label@l(r8)
#else
lis r8,L(start_addresses)@ha
lwzu r13,L(start_addresses)@l(r8)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index e1ac064a5..b509ef3b3 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -1,5 +1,6 @@
/* longjmp for PowerPC.
- Copyright (C) 1995-99, 2000, 2003-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-99, 2000, 2003-2006, 2009, 2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,10 +35,9 @@ ENTRY (BP_SYM (__longjmp))
# ifdef PIC
mflr r6
cfi_register (lr,r6)
- bcl 20,31,1f
-1: mflr r5
- addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r5,got_label)
+ addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r5,_rtld_global_ro@got(r5)
mtlr r6
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
index 80e72ca2b..a231448d3 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
@@ -1,5 +1,5 @@
/* ceil function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -31,10 +31,9 @@ ENTRY (__ceil)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
index ce6d71e4f..bfd5c61e6 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
@@ -1,5 +1,5 @@
/* float ceil function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,10 +30,9 @@ ENTRY (__ceilf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S
index 0dd0dbe6c..73971acb4 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S
@@ -1,5 +1,5 @@
/* Floor function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -31,10 +31,9 @@ ENTRY (__floor)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
index 98a47458b..562349e17 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
@@ -1,5 +1,5 @@
/* float Floor function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,10 +30,9 @@ ENTRY (__floorf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index 3bf1ffaea..b29ee9d28 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -1,5 +1,5 @@
/* lround function. PowerPC32 version.
- Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2007, 2008, 2011 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
@@ -45,10 +45,9 @@ ENTRY (__lround)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp10,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp10,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
new file mode 100644
index 000000000..0102aa331
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
@@ -0,0 +1,80 @@
+/* Round to int floating-point values. PowerPC32 version.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
+
+ 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., 1 Franklin Street, Fifth Floor, Boston MA
+ 02110-1301 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+
+/* double [fp1] nearbyint(double [fp1] x) */
+
+ .section .rodata.cst4,"aM",@progbits,4
+ .align 2
+.LC0: /* 2**52 */
+ .long 0x59800000 /* TWO52: 2**52 */
+
+ .section ".text"
+ENTRY (__nearbyint)
+#ifdef SHARED
+ mflr r11
+ cfi_register(lr,r11)
+ bcl 20,31,1f
+1: mflr r9
+ addis r9,r9,.LC0-1b@ha
+ lfs fp13,.LC0-1b@l(r9)
+ mtlr r11
+ cfi_same_value (lr)
+#else
+ lis r9,.LC0@ha
+ lfs fp13,.LC0@l(r9)
+#endif
+ fabs fp0,fp1
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */
+ bgelr cr7
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
+ ble cr7,L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadd fp0,fp1,fp13 /* x += TWO52 */
+ fsub fp1,fp0,fp13 /* x -= TWO52 */
+ fabs fp1,fp1 /* if (x == 0.0 */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr
+L(lessthanzero):
+ bgelr cr7
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fsub fp0,fp13,fp1 /* x -= TWO52 */
+ fsub fp0,fp0,fp13 /* x += TWO52 */
+ fneg fp1,fp0 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr
+END (__nearbyint)
+
+weak_alias (__nearbyint, nearbyint)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__nearbyint, nearbyintl)
+strong_alias (__nearbyint, __nearbyintl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0)
+#endif
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
new file mode 100644
index 000000000..519022806
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
@@ -0,0 +1,70 @@
+/* Round to int floating-point values. PowerPC32 version.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
+
+ 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., 1 Franklin Street, Fifth Floor, Boston MA
+ 02110-1301 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <sysdep.h>
+
+
+/* float [fp1] nearbyintf(float [fp1] x) */
+
+ .section .rodata.cst4,"aM",@progbits,4
+ .align 2
+.LC0:
+ .long 0x4B000000 /* TWO23: 2**23 */
+
+ .section ".text"
+ENTRY (__nearbyintf)
+#ifdef SHARED
+ mflr r11
+ cfi_register(lr,r11)
+ bcl 20,31,1f
+1: mflr r9
+ addis r9,r9,.LC0-1b@ha
+ lfs fp13,.LC0-1b@l(r9)
+ mtlr r11
+ cfi_same_value (lr)
+#else
+ lis r9,.LC0@ha
+ lfs fp13,.LC0@l(r9)
+#endif
+ fabs fp0,fp1
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */
+ bgelr cr7
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
+ ble cr7,L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadds fp0,fp1,fp13 /* x += TWO23 */
+ fsubs fp1,fp0,fp13 /* x -= TWO23 */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr
+L(lessthanzero):
+ bgelr cr7
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fsubs fp0,fp13,fp1 /* x -= TWO23 */
+ fsubs fp0,fp0,fp13 /* x += TWO23 */
+ fneg fp1,fp0 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr
+END (__nearbyintf)
+
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S
index 93133718a..17cd0bd90 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S
@@ -1,5 +1,5 @@
/* Round to int floating-point values. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,10 +33,9 @@ ENTRY (__rint)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
index 1e0fbb1f0..d5115bc25 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
@@ -1,5 +1,5 @@
/* Round float to int floating-point values. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,10 +29,9 @@ ENTRY (__rintf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S
index 48b346e65..dcb8dbedc 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S
@@ -1,5 +1,5 @@
/* round function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,10 +43,9 @@ ENTRY (__round)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- addi r9,r9,.LC0-1b@l
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
lfs fp13,0(r9)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
index 88125aad0..0da925124 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
@@ -1,5 +1,5 @@
/* roundf function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -42,10 +42,9 @@ ENTRY (__roundf )
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- addi r9,r9,.LC0-1b@l
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
lfs fp13,0(r9)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
index c3c021716..b731cb7c8 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
@@ -1,5 +1,5 @@
/* trunc function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,10 +38,9 @@ ENTRY (__trunc)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
index eddef070c..e14ec1b5d 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
@@ -1,5 +1,5 @@
/* truncf function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -37,10 +37,9 @@ ENTRY (__truncf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfs fp13,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index 131e7a332..90e20ba57 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -1,5 +1,5 @@
/* setjmp for PowerPC.
- Copyright (C) 1995-2000, 2003-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2003-2005, 2006, 2011 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
@@ -85,10 +85,9 @@ ENTRY (BP_SYM (__sigsetjmp))
# ifdef PIC
mflr r6
cfi_register(lr,r6)
- bcl 20,31,1f
-1: mflr r5
- addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r5,got_label)
+ addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l
mtlr r6
cfi_same_value (lr)
# ifdef SHARED
diff --git a/libc/sysdeps/powerpc/powerpc32/memset.S b/libc/sysdeps/powerpc/powerpc32/memset.S
index b4ce218e2..9803e7efd 100644
--- a/libc/sysdeps/powerpc/powerpc32/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/memset.S
@@ -1,5 +1,6 @@
/* Optimized memset implementation for PowerPC.
- Copyright (C) 1997, 1999, 2000, 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2003, 2007, 2011
+ 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
@@ -256,10 +257,9 @@ L(checklinesize):
beq L(medium)
/* Establishes GOT addressability so we can load __cache_line_size
from static. This value was set from the aux vector during startup. */
- bcl 20,31,1f
-1: mflr rGOT
- addis rGOT,rGOT,__cache_line_size-1b@ha
- lwz rCLS,__cache_line_size-1b@l(rGOT)
+ SETUP_GOT_ACCESS(rGOT,got_label)
+ addis rGOT,rGOT,__cache_line_size-got_label@ha
+ lwz rCLS,__cache_line_size-got_label@l(rGOT)
mtlr rTMP
#else
/* Load __cache_line_size from static. This value was set from the
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
index b03e041d8..591fcfb3c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
@@ -1,5 +1,5 @@
/* llround function. PowerPC32 on PowerPC64 version.
- Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2007, 2008, 2011 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
@@ -53,10 +53,9 @@ ENTRY (__llround)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- addi r9,r9,.LC0-1b@l
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
lfd fp9,0(r9)
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
index c03dfa37f..e04968e6f 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
@@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30,got_label)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
index 050323da5..356d3edac 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
@@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30,got_label)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
index 1c0f70dc5..f89b651e4 100644
--- a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
+++ b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
@@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30,got_label)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
index e638cc102..e9dde1676 100644
--- a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
@@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30,got_label)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/Makefile b/libc/sysdeps/powerpc/powerpc32/power7/Makefile
new file mode 100644
index 000000000..5e8f4a28b
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/power7/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),string)
+CFLAGS-strncase.c += -funroll-loops
+CFLAGS-strncase_l.c += -funroll-loops
+endif
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
index 5b0d950c7..40e6679d1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
@@ -1,5 +1,5 @@
/* finite(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@ ENTRY (__finite)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfd fp0,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfd fp0,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
index 297953491..a026583a1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
@@ -1,5 +1,5 @@
/* isinf(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@ ENTRY (__isinf)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfd fp0,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfd fp0,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
index 852539f24..123260bbb 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
@@ -1,5 +1,5 @@
/* isnan(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@ ENTRY (__isnan)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfd fp0,.LC0-1b@l(r9)
+ SETUP_GOT_ACCESS(r9,got_label)
+ addis r9,r9,.LC0-got_label@ha
+ lfd fp0,.LC0-got_label@l(r9)
mtlr r11
cfi_same_value (lr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S
new file mode 100644
index 000000000..5d84fce47
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S
@@ -0,0 +1,132 @@
+/* Optimized strcasecmp implementation for PowerPC32.
+ Copyright (C) 2011 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 <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+#include <locale-defines.h>
+
+/* int [r3] strcasecmp (const char *s1 [r3], const char *s2 [r4] )
+
+ or if defined USE_IN_EXTENDED_LOCALE_MODEL:
+
+ int [r3] strcasecmp_l (const char *s1 [r3], const char *s2 [r4],
+ __locale_t loc [r5]) */
+
+#ifndef STRCMP
+# define __STRCMP __strcasecmp
+# define STRCMP strcasecmp
+#endif
+
+ENTRY (BP_SYM (__STRCMP))
+
+#define rRTN r3 /* Return value */
+#define rSTR1 r5 /* 1st string */
+#define rSTR2 r4 /* 2nd string */
+#define rLOCARG r5 /* 3rd argument: locale_t */
+#define rCHAR1 r6 /* Byte readed from 1st string */
+#define rCHAR2 r7 /* Byte readed from 2nd string */
+#define rADDR1 r8 /* Address of tolower(rCHAR1) */
+#define rADDR2 r12 /* Address of tolower(rCHAR2) */
+#define rLWR1 r8 /* Byte tolower(rCHAR1) */
+#define rLWR2 r12 /* Byte tolower(rCHAR2) */
+#define rTMP r0
+#define rGOT r9 /* Address of the Global Offset Table */
+#define rLOC r11 /* Default locale address */
+
+ cmpw cr7, r3, r4
+#ifndef USE_IN_EXTENDED_LOCALE_MODEL
+# ifdef SHARED
+ mflr rTMP
+ bcl 20,31,.L1
+.L1: mflr rGOT
+ addis rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@ha
+ addi rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@l
+ lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT)
+ add rLOC, rLOC, __libc_tsd_LOCALE@tls
+ lwz rLOC, 0(rLOC)
+ mtlr rTMP
+# else
+ lis rTMP,_GLOBAL_OFFSET_TABLE_@ha
+ la rLOC,_GLOBAL_OFFSET_TABLE_@l(rTMP)
+ lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT)
+ add rLOC, rLOC, __libc_tsd_LOCALE@tls
+ lwz rLOC, 0(rLOC)
+# endif /* SHARED */
+#else
+ mr rLOC, rLOCARG
+#endif
+ mr rSTR1, rRTN
+ lwz rLOC, LOCALE_CTYPE_TOLOWER(rLOC)
+ li rRTN, 0
+ beqlr cr7
+
+ /* Unrolling loop for POWER: loads are done with 'lbz' plus
+ offset and string descriptors are only updated in the end
+ of loop unrolling. */
+
+L(loop):
+ lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
+ lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
+ sldi rADDR1, rCHAR1, 2 /* Calculate address for tolower(*s1) */
+ sldi rADDR2, rCHAR2, 2 /* Calculate address for tolower(*s2) */
+ lwzx rLWR1, rLOC, rADDR1 /* Load tolower(*s1) */
+ lwzx rLWR2, rLOC, rADDR2 /* Load tolower(*s2) */
+ cmpwi cr7, rCHAR1, 0 /* *s1 == '\0' ? */
+ subf. r3, rLWR2, rLWR1
+ bnelr
+ beqlr cr7
+ lbz rCHAR1, 1(rSTR1)
+ lbz rCHAR2, 1(rSTR2)
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpwi cr7, rCHAR1, 0
+ subf. r3, rLWR2, rLWR1
+ bnelr
+ beqlr cr7
+ lbz rCHAR1, 2(rSTR1)
+ lbz rCHAR2, 2(rSTR2)
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpwi cr7, rCHAR1, 0
+ subf. r3, rLWR2, rLWR1
+ bnelr
+ beqlr cr7
+ lbz rCHAR1, 3(rSTR1)
+ lbz rCHAR2, 3(rSTR2)
+ /* Increment both string descriptors */
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpwi cr7, rCHAR1, 0
+ subf. r3, rLWR2, rLWR1
+ bnelr
+ bne cr7,L(loop)
+ blr
+END (BP_SYM (__STRCMP))
+
+weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP))
+libc_hidden_builtin_def (__STRCMP)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
new file mode 100644
index 000000000..c13c4ebcb
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
@@ -0,0 +1,5 @@
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#define STRCMP strcasecmp_l
+#define __STRCMP __strcasecmp_l
+
+#include "strcasecmp.S"
diff --git a/libc/sysdeps/powerpc/powerpc32/sysdep.h b/libc/sysdeps/powerpc/powerpc32/sysdep.h
index 88cfe71e0..c824c0a85 100644
--- a/libc/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/libc/sysdeps/powerpc/powerpc32/sysdep.h
@@ -1,5 +1,6 @@
/* Assembly macros for 32-bit PowerPC.
- Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,6 +47,13 @@
cfi_startproc; \
CALL_MCOUNT
+/* helper macro for accessing the 32-bit powerpc GOT. */
+
+#define SETUP_GOT_ACCESS(regname,GOT_LABEL) \
+ bcl 20,31,GOT_LABEL ; \
+GOT_LABEL: ; \
+ mflr (regname)
+
#define EALIGN_W_0 /* No words to insert. */
#define EALIGN_W_1 nop
#define EALIGN_W_2 nop;nop
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
new file mode 100644
index 000000000..436160f48
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
@@ -0,0 +1,68 @@
+/* Round to int floating-point values. PowerPC64 version.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
+
+ 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. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+
+/* double [fp1] nearbyint(double [fp1] x) */
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+ .section ".text"
+
+EALIGN (__nearbyint, 4, 0)
+ CALL_MCOUNT 0
+ fabs fp0,fp1
+ lfd fp13,.LC0@toc(2)
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ bgelr cr7
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
+ ble cr7, L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadd fp1,fp1,fp13 /* x+= TWO52 */
+ fsub fp1,fp1,fp13 /* x-= TWO52 */
+ fabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr /* x = 0.0; */
+L(lessthanzero):
+ bgelr cr7 /* if (x < 0.0) */
+ mtfsb0 4*cr7+lt
+ fsub fp1,fp1,fp13 /* x -= TWO52 */
+ fadd fp1,fp1,fp13 /* x += TWO52 */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq
+ blr /* x = -0.0; */
+END (__nearbyint)
+
+weak_alias (__nearbyint, nearbyint)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__nearbyint, nearbyint)
+strong_alias (__nearbyint, __nearbyintl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0)
+#endif
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
new file mode 100644
index 000000000..c337e7937
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
@@ -0,0 +1,59 @@
+/* Round to int floating-point values. PowerPC64 version.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
+
+ 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. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <sysdep.h>
+
+
+/* float [fp1] nearbyintf(float [fp1]) */
+
+ .section ".toc","aw"
+.LC0: /* 2**23 */
+ .tc FD_4b000000_0[TC],0x4b00000000000000
+ .section ".text"
+
+EALIGN (__nearbyintf, 4, 0)
+ CALL_MCOUNT 0
+ fabs fp0,fp1
+ lfs fp13,.LC0@toc(2)
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ bgelr cr7
+ fsubs fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
+ ble cr7, L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadds fp1,fp1,fp13 /* x += TWO23 */
+ fsubs fp1,fp1,fp13 /* x -= TWO23 */
+ fabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
+ blr /* x = 0.0; */
+L(lessthanzero):
+ bgelr cr7 /* if (x < 0.0) */
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fsubs fp1,fp1,fp13 /* x -= TWO23 */
+ fadds fp1,fp1,fp13 /* x += TWO23 */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
+ blr /* x = -0.0; */
+END (__nearbyintf)
+
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/Makefile b/libc/sysdeps/powerpc/powerpc64/power7/Makefile
index b0f45205b..40aacfa15 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/Makefile
+++ b/libc/sysdeps/powerpc/powerpc64/power7/Makefile
@@ -3,3 +3,8 @@ ifeq ($(subdir),elf)
# optimization may require a TOC reference before relocations are resolved.
CFLAGS-rtld.c += -mno-vsx
endif
+
+ifeq ($(subdir),string)
+CFLAGS-strncase.c += -funroll-loops
+CFLAGS-strncase_l.c += -funroll-loops
+endif
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp.S b/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
new file mode 100644
index 000000000..1477b2e17
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
@@ -0,0 +1,125 @@
+/* Optimized strcasecmp implementation for PowerPC64.
+ Copyright (C) 2011 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 <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+#include <locale-defines.h>
+
+/* int [r3] strcasecmp (const char *s1 [r3], const char *s2 [r4] )
+
+ or if defined USE_IN_EXTENDED_LOCALE_MODEL:
+
+ int [r3] strcasecmp_l (const char *s1 [r3], const char *s2 [r4],
+ __locale_t loc [r5]) */
+
+#ifndef STRCMP
+# define __STRCMP __strcasecmp
+# define STRCMP strcasecmp
+#endif
+
+ENTRY (BP_SYM (__STRCMP))
+ CALL_MCOUNT 2
+
+#define rRTN r3 /* Return value */
+#define rSTR1 r5 /* 1st string */
+#define rSTR2 r4 /* 2nd string */
+#define rLOCARG r5 /* 3rd argument: locale_t */
+#define rCHAR1 r6 /* Byte readed from 1st string */
+#define rCHAR2 r7 /* Byte readed from 2nd string */
+#define rADDR1 r8 /* Address of tolower(rCHAR1) */
+#define rADDR2 r12 /* Address of tolower(rCHAR2) */
+#define rLWR1 r8 /* Word tolower(rCHAR1) */
+#define rLWR2 r12 /* Word tolower(rCHAR2) */
+#define rTMP r9
+#define rLOC r11 /* Default locale address */
+
+ cmpd cr7, r3, r4
+#ifndef USE_IN_EXTENDED_LOCALE_MODEL
+ ld rTMP, __libc_tsd_LOCALE@got@tprel(r2)
+ add rLOC, rTMP, __libc_tsd_LOCALE@tls
+ ld rLOC, 0(rLOC)
+#else
+ mr rLOC, rLOCARG
+#endif
+ ld rLOC, LOCALE_CTYPE_TOLOWER(rLOC)
+ mr rSTR1, rRTN
+ li rRTN, 0
+ beqlr cr7
+
+
+ /* Unrolling loop for POWER: loads are done with 'lbz' plus
+ offset and string descriptors are only updated in the end
+ of loop unrolling. */
+
+ lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
+ lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
+L(loop):
+ cmpdi rCHAR1, 0 /* *s1 == '\0' ? */
+ sldi rADDR1, rCHAR1, 2 /* Calculate address for tolower(*s1) */
+ sldi rADDR2, rCHAR2, 2 /* Calculate address for tolower(*s2) */
+ lwzx rLWR1, rLOC, rADDR1 /* Load tolower(*s1) */
+ lwzx rLWR2, rLOC, rADDR2 /* Load tolower(*s2) */
+ cmpw cr1, rLWR1, rLWR2 /* r = tolower(*s1) == tolower(*s2) ? */
+ crorc 4*cr1+eq,eq,4*cr1+eq /* (*s1 != '\0') || (r == 1) */
+ beq cr1, L(done)
+ lbz rCHAR1, 1(rSTR1)
+ lbz rCHAR2, 1(rSTR2)
+ cmpdi rCHAR1, 0
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1, L(done)
+ lbz rCHAR1, 2(rSTR1)
+ lbz rCHAR2, 2(rSTR2)
+ cmpdi rCHAR1, 0
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1, L(done)
+ lbz rCHAR1, 3(rSTR1)
+ lbz rCHAR2, 3(rSTR2)
+ cmpdi rCHAR1, 0
+ /* Increment both string descriptors */
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1,L(done)
+ lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
+ lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
+ b L(loop)
+L(done):
+ subf r0, rLWR2, rLWR1
+ extsw rRTN, r0
+ blr
+END (BP_SYM (__STRCMP))
+
+weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP))
+libc_hidden_builtin_def (__STRCMP)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S b/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S
new file mode 100644
index 000000000..c13c4ebcb
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S
@@ -0,0 +1,5 @@
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#define STRCMP strcasecmp_l
+#define __STRCMP __strcasecmp_l
+
+#include "strcasecmp.S"
diff --git a/libc/sysdeps/unix/sysv/linux/Makefile b/libc/sysdeps/unix/sysv/linux/Makefile
index bd4fae2e5..d75a461c0 100644
--- a/libc/sysdeps/unix/sysv/linux/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/Makefile
@@ -40,8 +40,27 @@ install-headers-nosubdir: $(inst_includedir)/bits/syscall.h
tests += tst-clone
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
-# For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
-# we generate a file that uses <bits/wordsize.h>.
+
+# If there is more than one syscall list for different architecture
+# variants, the CPU/Makefile defines syscall-list-variants to be a
+# list of names for those variants (e.g. 32bit 64bit), and, for each
+# variant, defines syscall-list-$(variant)-options to be compiler
+# options to cause <asm/unistd.h> to define the desired list of
+# syscalls and syscall-list-$(variant)-condition to be the condition
+# for those options to use in a C #if condition.
+# syscall-list-includes may be defined to a list of headers to include
+# in the generated header, if the default does not suffice.
+
+ifndef syscall-list-variants
+syscall-list-variants := default
+syscall-list-default-options :=
+syscall-list-default-condition :=
+endif
+
+ifndef syscall-list-includes
+syscall-list-includes := bits/wordsize.h
+endif
+
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
$(make-target-directory)
{ \
@@ -51,37 +70,30 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
echo '#endif'; \
echo ''; \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t1 -MT '$(@:.d=.h) $(@:.h=.d)' \
- -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \
- $(addprefix -D,$(32bit-predefine)) -D_LIBC -dM | \
- sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
- LC_ALL=C sort > $(@:.d=.h).new32; \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t2 -MT '$(@:.d=.h) $(@:.h=.d)' \
- -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \
- $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
+ $(foreach h,$(syscall-list-includes), echo '#include <$(h)>';) \
+ echo ''; \
+ $(foreach v,$(syscall-list-variants),\
+ $(CC) -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
+ -x c $(sysincludes) $< $(syscall-list-$(v)-options) \
+ -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
- LC_ALL=C sort > $(@:.d=.h).new64; \
- if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
- cat $(@:.d=.h).new32; \
- else \
- echo '#include <bits/wordsize.h>'; \
- echo ''; \
- LC_ALL=C comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
- echo '#if __WORDSIZE == 64'; \
- LC_ALL=C comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
- echo '#else'; \
- LC_ALL=C comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
- echo '#endif'; \
- fi; \
- rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
+ LC_ALL=C sort > $(@:.d=.h).new$(v); \
+ $(if $(syscall-list-$(v)-condition),\
+ echo '#if $(syscall-list-$(v)-condition)';) \
+ cat $(@:.d=.h).new$(v); \
+ $(if $(syscall-list-$(v)-condition),echo '#endif';) \
+ rm -f $(@:.d=.h).new$(v); \
+ ) \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
ifneq (,$(objpfx))
- sed $(sed-remove-objpfx) $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
+ sed $(sed-remove-objpfx) \
+ $(foreach v,$(syscall-list-variants),$(@:.h=.d)-t$(v)) > $(@:.h=.d)-t3
else
- cat $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
+ cat $(foreach v,$(syscall-list-variants),$(@:.h=.d)-t$(v)) \
+ > $(@:.h=.d)-t3
endif
- rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
+ rm -f $(foreach v,$(syscall-list-variants),$(@:.h=.d)-t$(v))
mv -f $(@:.h=.d)-t3 $(@:.h=.d)
$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
index d1281cf46..55311a4fc 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -1,4 +1,9 @@
-64bit-predefine = __powerpc64__
+syscall-list-variants := 32bit 64bit
+syscall-list-32bit-options := -U__powerpc64__
+syscall-list-32bit-condition := __WORDSIZE == 32
+syscall-list-64bit-options := -D__powerpc64__
+syscall-list-64bit-condition := __WORDSIZE == 64
+
ifeq ($(subdir),rt)
librt-routines += rt-sysdep
endif
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
index cfd9864f6..2b97f01b4 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,10 +29,9 @@
#ifdef PIC
# define LOAD_ARG \
- bcl 20,31,1f; \
-1: mflr r3; \
- addis r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha; \
- addi r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l; \
+ SETUP_GOT_ACCESS(r3,got_label2); \
+ addis r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@ha; \
+ addi r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@l; \
lwz r3,.LC0@got(r3)
#else
# define LOAD_ARG \
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index 4c8c6b433..928ba217b 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -1,5 +1,5 @@
/* brk system call for Linux/ppc.
- Copyright (C) 1995-97, 1999, 2000, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-97, 1999, 2000, 2006, 2011 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
@@ -36,10 +36,9 @@ ENTRY (BP_SYM (__brk))
DO_CALL(SYS_ify(brk))
lwz r6,8(r1)
#ifdef PIC
- bcl 20,31,1f
-1: mflr r5
- addis r5,r5,__curbrk-1b@ha
- stw r3,__curbrk-1b@l(r5)
+ SETUP_GOT_ACCESS(r5,got_label)
+ addis r5,r5,__curbrk-got_label@ha
+ stw r3,__curbrk-got_label@l(r5)
#else
lis r4,__curbrk@ha
stw r3,__curbrk@l(r4)
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
index fea41cd3a..e2e8f8b3c 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -1,5 +1,5 @@
/* Save current context, powerpc32 common.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2011 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
@@ -145,10 +145,9 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef __CONTEXT_ENABLE_VRS
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
index 4b8ee5e16..c35bf9008 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -1,5 +1,5 @@
/* Jump to a new context powerpc32 common.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 2009, 2011 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
@@ -73,10 +73,9 @@ ENTRY(__CONTEXT_FUNC_NAME)
#ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index 71c0ce57a..dbdee3c94 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -1,5 +1,5 @@
/* Save current context and jump to a new context.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 2009, 2011 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
@@ -146,10 +146,9 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
@@ -303,10 +302,9 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef PIC
mflr r8
# ifdef HAVE_ASM_PPC_REL16
- bcl 20,31,5f
-5: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-5b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-5b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
diff --git a/libc/sysdeps/unix/sysv/linux/s390/Makefile b/libc/sysdeps/unix/sysv/linux/s390/Makefile
index 72eae688d..fb20fb05a 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/s390/Makefile
@@ -1,4 +1,9 @@
-64bit-predefine = __s390x__
+syscall-list-variants := 32bit 64bit
+syscall-list-32bit-options := -U__s390x__
+syscall-list-32bit-condition := __WORDSIZE == 32
+syscall-list-64bit-options := -D__s390x__
+syscall-list-64bit-condition := __WORDSIZE == 64
+
ifeq ($(subdir),rt)
librt-routines += rt-sysdep
endif
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/Makefile b/libc/sysdeps/unix/sysv/linux/sparc/Makefile
index 9cb2a634d..96bf0bbd1 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -1,4 +1,8 @@
-64bit-predefine = __sparc_v9__ __arch64__
+syscall-list-variants := 32bit 64bit
+syscall-list-32bit-options := -U__sparc_v9__ -U__arch64__
+syscall-list-32bit-condition := __WORDSIZE == 32
+syscall-list-64bit-options := -D__sparc_v9__ -D__arch64__
+syscall-list-64bit-condition := __WORDSIZE == 64
ifeq ($(subdir),rt)
librt-routines += rt-sysdep
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
index 9943f2138..2dfc4fcc2 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007, 2008, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2008, 2010, 2011 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
@@ -65,9 +65,9 @@ enum EPOLL_EVENTS
#define EPOLLHUP EPOLLHUP
EPOLLRDHUP = 0x2000,
#define EPOLLRDHUP EPOLLRDHUP
- EPOLLONESHOT = (1 << 30),
+ EPOLLONESHOT = 1u << 30,
#define EPOLLONESHOT EPOLLONESHOT
- EPOLLET = (1 << 31)
+ EPOLLET = 1u << 31
#define EPOLLET EPOLLET
};
diff --git a/libc/sysdeps/unix/sysv/linux/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/sys/epoll.h
index ca1d3d045..f23db922e 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/epoll.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2009, 2011 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
@@ -65,9 +65,9 @@ enum EPOLL_EVENTS
#define EPOLLHUP EPOLLHUP
EPOLLRDHUP = 0x2000,
#define EPOLLRDHUP EPOLLRDHUP
- EPOLLONESHOT = (1 << 30),
+ EPOLLONESHOT = 1u << 30,
#define EPOLLONESHOT EPOLLONESHOT
- EPOLLET = (1 << 31)
+ EPOLLET = 1u << 31
#define EPOLLET EPOLLET
};
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/Makefile b/libc/sysdeps/unix/sysv/linux/x86_64/Makefile
index 6e2741a96..9c9e6151d 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -1,5 +1,8 @@
-32bit-predefine = __i386__
-64bit-predefine = __x86_64__
+syscall-list-variants := 32bit 64bit
+syscall-list-32bit-options := -D__i386__ -U__x86_64__
+syscall-list-32bit-condition := __WORDSIZE == 32
+syscall-list-64bit-options := -U__i386__ -D__x86_64__
+syscall-list-64bit-condition := __WORDSIZE == 64
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
index d799c845c..6b5ef35f4 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2008, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2008, 2010, 2011 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
@@ -65,9 +65,9 @@ enum EPOLL_EVENTS
#define EPOLLHUP EPOLLHUP
EPOLLRDHUP = 0x2000,
#define EPOLLRDHUP EPOLLRDHUP
- EPOLLONESHOT = (1 << 30),
+ EPOLLONESHOT = 1u << 30,
#define EPOLLONESHOT EPOLLONESHOT
- EPOLLET = (1 << 31)
+ EPOLLET = 1u << 31
#define EPOLLET EPOLLET
};
diff --git a/libc/sysdeps/x86_64/fpu/bits/fenv.h b/libc/sysdeps/x86_64/fpu/bits/fenv.h
index 4af164374..8bc245083 100644
--- a/libc/sysdeps/x86_64/fpu/bits/fenv.h
+++ b/libc/sysdeps/x86_64/fpu/bits/fenv.h
@@ -97,11 +97,11 @@ fenv_t;
#endif
-#ifdef __OPTIMIZE__
+#ifdef __USE_EXTERN_INLINES
__BEGIN_DECLS
/* Optimized versions. */
-extern int __NTH (__feraiseexcept_renamed (int)) __asm__ ("feraiseexcept");
+extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
__extern_inline int
__NTH (feraiseexcept (int __excepts))
{
diff --git a/libc/sysdeps/x86_64/fpu/s_scalbln.c b/libc/sysdeps/x86_64/fpu/s_scalbln.c
deleted file mode 100644
index 1009713fb..000000000
--- a/libc/sysdeps/x86_64/fpu/s_scalbln.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Nothing to do. This function is the same as scalbn. So we define an
- alias. */
diff --git a/libc/sysdeps/x86_64/fpu/s_scalbn.c b/libc/sysdeps/x86_64/fpu/s_scalbn.c
deleted file mode 100644
index 74d34655a..000000000
--- a/libc/sysdeps/x86_64/fpu/s_scalbn.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#define scalbln __renamed_scalbln
-#define __scalbln __renamed___scalbln
-
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c>
-
-#undef scalbln
-#undef __scalbln
-strong_alias (__scalbn, __scalbln)
-weak_alias (__scalbn, scalbln)
diff --git a/libc/sysdeps/x86_64/multiarch/Makefile b/libc/sysdeps/x86_64/multiarch/Makefile
index 4cf4cf4b2..9a183f068 100644
--- a/libc/sysdeps/x86_64/multiarch/Makefile
+++ b/libc/sysdeps/x86_64/multiarch/Makefile
@@ -16,7 +16,7 @@ sysdep_routines += strncat-c stpncpy-c strncpy-c strcmp-ssse3 strncmp-ssse3 \
strcat-sse2-unaligned strncat-sse2-unaligned \
strcat-ssse3 strncat-ssse3 strlen-sse2-pminub \
strnlen-sse2-no-bsf strrchr-sse2-no-bsf strchr-sse2-no-bsf \
- memcmp-ssse3 wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c
+ memcmp-ssse3
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c varshift
CFLAGS-varshift.c += -msse4
@@ -28,3 +28,7 @@ CFLAGS-strcasestr.c += -msse4
CFLAGS-strcasestr-nonascii.c += -msse4
endif
endif
+
+ifeq ($(subdir),wcsmbs)
+sysdep_routines += wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcscpy-ssse3 wcscpy-c
+endif
diff --git a/libc/sysdeps/x86_64/multiarch/wcscpy-c.c b/libc/sysdeps/x86_64/multiarch/wcscpy-c.c
new file mode 100644
index 000000000..f27c06919
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/wcscpy-c.c
@@ -0,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcscpy __wcscpy_sse2
+#endif
+
+#include "wcsmbs/wcscpy.c"
diff --git a/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S b/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S
new file mode 100644
index 000000000..4e292f3c2
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S
@@ -0,0 +1,565 @@
+/* wcscpy with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+.text
+ENTRY (__wcscpy_ssse3)
+ mov %rsi, %rcx
+ mov %rdi, %rdx
+
+ cmpl $0, (%rcx)
+ jz L(Exit4)
+ cmpl $0, 4(%rcx)
+ jz L(Exit8)
+ cmpl $0, 8(%rcx)
+ jz L(Exit12)
+ cmpl $0, 12(%rcx)
+ jz L(Exit16)
+
+ lea 16(%rcx), %rsi
+ and $-16, %rsi
+
+ pxor %xmm0, %xmm0
+ mov (%rcx), %r9
+ mov %r9, (%rdx)
+
+ pcmpeqd (%rsi), %xmm0
+ mov 8(%rcx), %r9
+ mov %r9, 8(%rdx)
+
+ pmovmskb %xmm0, %rax
+ sub %rcx, %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ mov %rdx, %rax
+ lea 16(%rdx), %rdx
+ and $-16, %rdx
+ sub %rdx, %rax
+ sub %rax, %rcx
+ mov %rcx, %rax
+ and $0xf, %rax
+ mov $0, %rsi
+
+/* case: rcx_offset == rdx_offset */
+
+ jz L(Align16Both)
+
+ cmp $4, %rax
+ je L(Shl4)
+ cmp $8, %rax
+ je L(Shl8)
+ jmp L(Shl12)
+
+L(Align16Both):
+ movaps (%rcx), %xmm1
+ movaps 16(%rcx), %xmm2
+ movaps %xmm1, (%rdx)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%rcx, %rsi), %xmm3
+ movaps %xmm2, (%rdx, %rsi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%rcx, %rsi), %xmm4
+ movaps %xmm3, (%rdx, %rsi)
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%rcx, %rsi), %xmm1
+ movaps %xmm4, (%rdx, %rsi)
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%rcx, %rsi), %xmm2
+ movaps %xmm1, (%rdx, %rsi)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%rcx, %rsi), %xmm3
+ movaps %xmm2, (%rdx, %rsi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm3, (%rdx, %rsi)
+ mov %rcx, %rax
+ lea 16(%rcx, %rsi), %rcx
+ and $-0x40, %rcx
+ sub %rcx, %rax
+ sub %rax, %rdx
+
+ mov $-0x40, %rsi
+
+L(Aligned64Loop):
+ movaps (%rcx), %xmm2
+ movaps %xmm2, %xmm4
+ movaps 16(%rcx), %xmm5
+ movaps 32(%rcx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 48(%rcx), %xmm7
+ pminub %xmm5, %xmm2
+ pminub %xmm7, %xmm3
+ pminub %xmm2, %xmm3
+ pcmpeqd %xmm0, %xmm3
+ pmovmskb %xmm3, %rax
+ lea 64(%rdx), %rdx
+ lea 64(%rcx), %rcx
+ test %rax, %rax
+ jnz L(Aligned64Leave)
+ movaps %xmm4, -64(%rdx)
+ movaps %xmm5, -48(%rdx)
+ movaps %xmm6, -32(%rdx)
+ movaps %xmm7, -16(%rdx)
+ jmp L(Aligned64Loop)
+
+L(Aligned64Leave):
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %rax
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm5, %xmm0
+
+ pmovmskb %xmm0, %rax
+ movaps %xmm4, -64(%rdx)
+ test %rax, %rax
+ lea 16(%rsi), %rsi
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm6, %xmm0
+
+ pmovmskb %xmm0, %rax
+ movaps %xmm5, -48(%rdx)
+ test %rax, %rax
+ lea 16(%rsi), %rsi
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm6, -32(%rdx)
+ pcmpeqd %xmm7, %xmm0
+
+ pmovmskb %xmm0, %rax
+ lea 16(%rsi), %rsi
+ test %rax, %rax
+ jnz L(CopyFrom1To16Bytes)
+
+ mov $-0x40, %rsi
+ movaps %xmm7, -16(%rdx)
+ jmp L(Aligned64Loop)
+
+ .p2align 4
+L(Shl4):
+ movaps -4(%rcx), %xmm1
+ movaps 12(%rcx), %xmm2
+L(Shl4Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %rax
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 28(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm2, (%rdx)
+ movaps 28(%rcx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 28(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+
+ test %rax, %rax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ lea 28(%rcx), %rcx
+ lea 16(%rdx), %rdx
+
+ mov %rcx, %rax
+ and $-0x40, %rcx
+ sub %rcx, %rax
+ lea -12(%rcx), %rcx
+ sub %rax, %rdx
+
+ movaps -4(%rcx), %xmm1
+
+L(Shl4LoopStart):
+ movaps 12(%rcx), %xmm2
+ movaps 28(%rcx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 44(%rcx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 60(%rcx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %rax
+ movaps %xmm5, %xmm7
+ palignr $4, %xmm4, %xmm5
+ test %rax, %rax
+ palignr $4, %xmm3, %xmm4
+ jnz L(Shl4Start)
+
+ palignr $4, %xmm2, %xmm3
+ lea 64(%rcx), %rcx
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%rdx)
+ movaps %xmm4, 32(%rdx)
+ movaps %xmm3, 16(%rdx)
+ movaps %xmm2, (%rdx)
+ lea 64(%rdx), %rdx
+ jmp L(Shl4LoopStart)
+
+L(Shl4LoopExit):
+ movaps (%rdx), %xmm6
+ psrldq $12, %xmm6
+ mov $12, %rsi
+ palignr $4, %xmm1, %xmm6
+ movaps %xmm6, (%rdx)
+ jmp L(CopyFrom1To16Bytes)
+
+ .p2align 4
+L(Shl8):
+ movaps -8(%rcx), %xmm1
+ movaps 8(%rcx), %xmm2
+L(Shl8Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %rax
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 24(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm2, (%rdx)
+ movaps 24(%rcx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 24(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ lea 24(%rcx), %rcx
+ lea 16(%rdx), %rdx
+
+ mov %rcx, %rax
+ and $-0x40, %rcx
+ sub %rcx, %rax
+ lea -8(%rcx), %rcx
+ sub %rax, %rdx
+
+ movaps -8(%rcx), %xmm1
+
+L(Shl8LoopStart):
+ movaps 8(%rcx), %xmm2
+ movaps 24(%rcx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 40(%rcx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 56(%rcx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %rax
+ movaps %xmm5, %xmm7
+ palignr $8, %xmm4, %xmm5
+ test %rax, %rax
+ palignr $8, %xmm3, %xmm4
+ jnz L(Shl8Start)
+
+ palignr $8, %xmm2, %xmm3
+ lea 64(%rcx), %rcx
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%rdx)
+ movaps %xmm4, 32(%rdx)
+ movaps %xmm3, 16(%rdx)
+ movaps %xmm2, (%rdx)
+ lea 64(%rdx), %rdx
+ jmp L(Shl8LoopStart)
+
+L(Shl8LoopExit):
+ movaps (%rdx), %xmm6
+ psrldq $8, %xmm6
+ mov $8, %rsi
+ palignr $8, %xmm1, %xmm6
+ movaps %xmm6, (%rdx)
+ jmp L(CopyFrom1To16Bytes)
+
+ .p2align 4
+L(Shl12):
+ movaps -12(%rcx), %xmm1
+ movaps 4(%rcx), %xmm2
+L(Shl12Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %rax
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 20(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm2, (%rdx)
+ movaps 20(%rcx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ movaps 20(%rcx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%rdx), %rdx
+ pmovmskb %xmm0, %rax
+ lea 16(%rcx), %rcx
+ movaps %xmm2, %xmm3
+
+ test %rax, %rax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%rdx)
+ lea 20(%rcx), %rcx
+ lea 16(%rdx), %rdx
+
+ mov %rcx, %rax
+ and $-0x40, %rcx
+ sub %rcx, %rax
+ lea -4(%rcx), %rcx
+ sub %rax, %rdx
+
+ movaps -12(%rcx), %xmm1
+
+L(Shl12LoopStart):
+ movaps 4(%rcx), %xmm2
+ movaps 20(%rcx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 36(%rcx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 52(%rcx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %rax
+ movaps %xmm5, %xmm7
+ palignr $12, %xmm4, %xmm5
+ test %rax, %rax
+ palignr $12, %xmm3, %xmm4
+ jnz L(Shl12Start)
+ palignr $12, %xmm2, %xmm3
+ lea 64(%rcx), %rcx
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%rdx)
+ movaps %xmm4, 32(%rdx)
+ movaps %xmm3, 16(%rdx)
+ movaps %xmm2, (%rdx)
+ lea 64(%rdx), %rdx
+ jmp L(Shl12LoopStart)
+
+L(Shl12LoopExit):
+ movaps (%rdx), %xmm6
+ psrldq $4, %xmm6
+ mov $4, %rsi
+ palignr $12, %xmm1, %xmm6
+ movaps %xmm6, (%rdx)
+
+ .p2align 4
+L(CopyFrom1To16Bytes):
+ add %rsi, %rdx
+ add %rsi, %rcx
+
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+
+ mov (%rcx), %rax
+ mov %rax, (%rdx)
+ mov %rdi, %rax
+ ret
+
+ .p2align 4
+L(ExitHigh):
+ test $0x01, %ah
+ jnz L(Exit12)
+
+ mov (%rcx), %rax
+ mov %rax, (%rdx)
+ mov 8(%rcx), %rax
+ mov %rax, 8(%rdx)
+ mov %rdi, %rax
+ ret
+
+ .p2align 4
+L(Exit4):
+ movl (%rcx), %eax
+ movl %eax, (%rdx)
+ mov %rdi, %rax
+ ret
+
+ .p2align 4
+L(Exit8):
+ mov (%rcx), %rax
+ mov %rax, (%rdx)
+ mov %rdi, %rax
+ ret
+
+ .p2align 4
+L(Exit12):
+ mov (%rcx), %rax
+ mov %rax, (%rdx)
+ mov 8(%rcx), %eax
+ mov %eax, 8(%rdx)
+ mov %rdi, %rax
+ ret
+
+ .p2align 4
+L(Exit16):
+ movdqu (%rcx), %xmm0
+ movdqu %xmm0, (%rdx)
+ mov %rdi, %rax
+ ret
+
+END(__wcscpy_ssse3)
+#endif
diff --git a/libc/sysdeps/x86_64/multiarch/wcscpy.S b/libc/sysdeps/x86_64/multiarch/wcscpy.S
new file mode 100644
index 000000000..818c5549e
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/wcscpy.S
@@ -0,0 +1,43 @@
+/* Multiple versions of wcscpy
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+#include <init-arch.h>
+
+/* Define multiple versions only for the definition in libc. */
+#ifndef NOT_IN_libc
+
+ .text
+ENTRY(wcscpy)
+ .type wcscpy, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features(%rip)
+ jne 1f
+ call __init_cpu_features
+
+1: testl $bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
+ jnz 2f
+ leaq __wcscpy_sse2(%rip), %rax
+ ret
+
+2: leaq __wcscpy_ssse3(%rip), %rax
+ ret
+
+END(wcscpy)
+#endif
diff --git a/libc/sysdeps/x86_64/multiarch/wmemcmp-c.c b/libc/sysdeps/x86_64/multiarch/wmemcmp-c.c
index 793f059af..1074238da 100644
--- a/libc/sysdeps/x86_64/multiarch/wmemcmp-c.c
+++ b/libc/sysdeps/x86_64/multiarch/wmemcmp-c.c
@@ -1,5 +1,9 @@
#ifndef NOT_IN_libc
+# include <wchar.h>
+
# define WMEMCMP __wmemcmp_sse2
+
+extern __typeof (wmemcmp) __wmemcmp_sse2;
#endif
#include "wcsmbs/wmemcmp.c"
diff --git a/libc/sysdeps/x86_64/wcschr.S b/libc/sysdeps/x86_64/wcschr.S
new file mode 100644
index 000000000..b3a1b3b71
--- /dev/null
+++ b/libc/sysdeps/x86_64/wcschr.S
@@ -0,0 +1,155 @@
+/* wcschr with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+
+ .text
+ENTRY (wcschr)
+
+ movd %rsi, %xmm1
+ pxor %xmm2, %xmm2
+ mov %rdi, %rcx
+ punpckldq %xmm1, %xmm1
+ punpckldq %xmm1, %xmm1
+
+ and $63, %rcx
+ cmp $48, %rcx
+ ja L(cross_cache)
+
+ movdqu (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+
+ and $-16, %rdi
+
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+
+ jmp L(loop)
+
+L(cross_cache):
+ and $15, %rcx
+ and $-16, %rdi
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+
+ sar %cl, %rdx
+ sar %cl, %rax
+ test %rax, %rax
+ je L(unaligned_no_match)
+
+ bsf %rax, %rax
+ test %rdx, %rdx
+ je L(unaligned_match)
+ bsf %rdx, %rdx
+ cmp %rdx, %rax
+ ja L(return_null)
+
+L(unaligned_match):
+ add %rdi, %rax
+ add %rcx, %rax
+ ret
+
+ .p2align 4
+L(unaligned_no_match):
+ test %rdx, %rdx
+ jne L(return_null)
+ pxor %xmm2, %xmm2
+
+ add $16, %rdi
+
+ .p2align 4
+/* Loop start on aligned string. */
+L(loop):
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rdx
+ pmovmskb %xmm0, %rax
+ or %rax, %rdx
+ jnz L(matches)
+ jmp L(loop)
+
+ .p2align 4
+L(matches):
+ pmovmskb %xmm2, %rdx
+ test %rax, %rax
+ jz L(return_null)
+ bsf %rax, %rax
+ test %rdx, %rdx
+ je L(match)
+ bsf %rdx, %rcx
+ cmp %rcx, %rax
+ ja L(return_null)
+L(match):
+ sub $16, %rdi
+ add %rdi, %rax
+ ret
+
+ .p2align 4
+L(return_null):
+ xor %rax, %rax
+ ret
+
+END (wcschr)
+
+libc_hidden_def(wcschr)
diff --git a/libc/sysdeps/x86_64/wcsrchr.S b/libc/sysdeps/x86_64/wcsrchr.S
new file mode 100644
index 000000000..c2e4b7e97
--- /dev/null
+++ b/libc/sysdeps/x86_64/wcsrchr.S
@@ -0,0 +1,283 @@
+/* wcsrchr with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+
+ .text
+ENTRY (wcsrchr)
+
+ movd %rsi, %xmm1
+ mov %rdi, %rcx
+ punpckldq %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ punpckldq %xmm1, %xmm1
+ and $63, %rcx
+ cmp $48, %rcx
+ ja L(crosscache)
+
+ movdqu (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rcx
+ pmovmskb %xmm0, %rax
+ add $16, %rdi
+
+ test %rax, %rax
+ jnz L(unaligned_match1)
+
+ test %rcx, %rcx
+ jnz L(return_null)
+
+ and $-16, %rdi
+ xor %r8, %r8
+ jmp L(loop)
+
+ .p2align 4
+L(unaligned_match1):
+ test %rcx, %rcx
+ jnz L(prolog_find_zero_1)
+
+ mov %rax, %r8
+ mov %rdi, %rsi
+ and $-16, %rdi
+ jmp L(loop)
+
+ .p2align 4
+L(crosscache):
+ and $15, %rcx
+ and $-16, %rdi
+ pxor %xmm3, %xmm3
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm3
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm3, %rdx
+ pmovmskb %xmm0, %rax
+ shr %cl, %rdx
+ shr %cl, %rax
+ add $16, %rdi
+
+ test %rax, %rax
+ jnz L(unaligned_match)
+
+ test %rdx, %rdx
+ jnz L(return_null)
+
+ xor %r8, %r8
+ jmp L(loop)
+
+ .p2align 4
+L(unaligned_match):
+ test %rdx, %rdx
+ jnz L(prolog_find_zero)
+
+ mov %rax, %r8
+ lea (%rdi, %rcx), %rsi
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ movdqa (%rdi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %rcx
+ pmovmskb %xmm0, %rax
+ or %rax, %rcx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm3
+ pcmpeqd %xmm3, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm3
+ pmovmskb %xmm2, %rcx
+ pmovmskb %xmm3, %rax
+ or %rax, %rcx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm4
+ pcmpeqd %xmm4, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm4
+ pmovmskb %xmm2, %rcx
+ pmovmskb %xmm4, %rax
+ or %rax, %rcx
+ jnz L(matches)
+
+ movdqa (%rdi), %xmm5
+ pcmpeqd %xmm5, %xmm2
+ add $16, %rdi
+ pcmpeqd %xmm1, %xmm5
+ pmovmskb %xmm2, %rcx
+ pmovmskb %xmm5, %rax
+ or %rax, %rcx
+ jz L(loop)
+
+ .p2align 4
+L(matches):
+ test %rax, %rax
+ jnz L(match)
+L(return_value):
+ test %r8, %r8
+ jz L(return_null)
+ mov %r8, %rax
+ mov %rsi, %rdi
+
+ test $15 << 4, %ah
+ jnz L(match_fourth_wchar)
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(match):
+ pmovmskb %xmm2, %rcx
+ test %rcx, %rcx
+ jnz L(find_zero)
+ mov %rax, %r8
+ mov %rdi, %rsi
+ jmp L(loop)
+
+ .p2align 4
+L(find_zero):
+ test $15, %cl
+ jnz L(find_zero_in_first_wchar)
+ test %cl, %cl
+ jnz L(find_zero_in_second_wchar)
+ test $15, %ch
+ jnz L(find_zero_in_third_wchar)
+
+ and $1 << 13 - 1, %rax
+ jz L(return_value)
+
+ test $15 << 4, %ah
+ jnz L(match_fourth_wchar)
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(find_zero_in_first_wchar):
+ test $1, %rax
+ jz L(return_value)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(find_zero_in_second_wchar):
+ and $1 << 5 - 1, %rax
+ jz L(return_value)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(find_zero_in_third_wchar):
+ and $1 << 9 - 1, %rax
+ jz L(return_value)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(prolog_find_zero):
+ add %rcx, %rdi
+ mov %rdx, %rcx
+L(prolog_find_zero_1):
+ test $15, %cl
+ jnz L(prolog_find_zero_in_first_wchar)
+ test %cl, %cl
+ jnz L(prolog_find_zero_in_second_wchar)
+ test $15, %ch
+ jnz L(prolog_find_zero_in_third_wchar)
+
+ and $1 << 13 - 1, %rax
+ jz L(return_null)
+
+ test $15 << 4, %ah
+ jnz L(match_fourth_wchar)
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(prolog_find_zero_in_first_wchar):
+ test $1, %rax
+ jz L(return_null)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(prolog_find_zero_in_second_wchar):
+ and $1 << 5 - 1, %rax
+ jz L(return_null)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(prolog_find_zero_in_third_wchar):
+ and $1 << 9 - 1, %rax
+ jz L(return_null)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%rdi), %rax
+ ret
+
+ .p2align 4
+L(match_second_wchar):
+ lea -12(%rdi), %rax
+ ret
+
+ .p2align 4
+L(match_third_wchar):
+ lea -8(%rdi), %rax
+ ret
+
+ .p2align 4
+L(match_fourth_wchar):
+ lea -4(%rdi), %rax
+ ret
+
+ .p2align 4
+L(return_null):
+ xor %rax, %rax
+ ret
+
+END (wcsrchr)
diff --git a/libc/time/tzfile.c b/libc/time/tzfile.c
index 144e20ba2..a8c1c0e4c 100644
--- a/libc/time/tzfile.c
+++ b/libc/time/tzfile.c
@@ -234,23 +234,58 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
goto read_again;
}
+ if (__builtin_expect (num_transitions
+ > ((SIZE_MAX - (__alignof__ (struct ttinfo) - 1))
+ / (sizeof (time_t) + 1)), 0))
+ goto lose;
total_size = num_transitions * (sizeof (time_t) + 1);
total_size = ((total_size + __alignof__ (struct ttinfo) - 1)
& ~(__alignof__ (struct ttinfo) - 1));
types_idx = total_size;
- total_size += num_types * sizeof (struct ttinfo) + chars;
+ if (__builtin_expect (num_types
+ > (SIZE_MAX - total_size) / sizeof (struct ttinfo), 0))
+ goto lose;
+ total_size += num_types * sizeof (struct ttinfo);
+ if (__builtin_expect (chars > SIZE_MAX - total_size, 0))
+ goto lose;
+ total_size += chars;
+ if (__builtin_expect (__alignof__ (struct leap) - 1
+ > SIZE_MAX - total_size, 0))
+ goto lose;
total_size = ((total_size + __alignof__ (struct leap) - 1)
& ~(__alignof__ (struct leap) - 1));
leaps_idx = total_size;
+ if (__builtin_expect (num_leaps
+ > (SIZE_MAX - total_size) / sizeof (struct leap), 0))
+ goto lose;
total_size += num_leaps * sizeof (struct leap);
- tzspec_len = (sizeof (time_t) == 8 && trans_width == 8
- ? st.st_size - (ftello (f)
- + num_transitions * (8 + 1)
- + num_types * 6
- + chars
- + num_leaps * 12
- + num_isstd
- + num_isgmt) - 1 : 0);
+ tzspec_len = 0;
+ if (sizeof (time_t) == 8 && trans_width == 8)
+ {
+ off_t rem = st.st_size - ftello (f);
+ if (__builtin_expect (rem < 0
+ || (size_t) rem < (num_transitions * (8 + 1)
+ + num_types * 6
+ + chars), 0))
+ goto lose;
+ tzspec_len = (size_t) rem - (num_transitions * (8 + 1)
+ + num_types * 6
+ + chars);
+ if (__builtin_expect (num_leaps > SIZE_MAX / 12
+ || tzspec_len < num_leaps * 12, 0))
+ goto lose;
+ tzspec_len -= num_leaps * 12;
+ if (__builtin_expect (tzspec_len < num_isstd, 0))
+ goto lose;
+ tzspec_len -= num_isstd;
+ if (__builtin_expect (tzspec_len == 0 || tzspec_len - 1 < num_isgmt, 0))
+ goto lose;
+ tzspec_len -= num_isgmt + 1;
+ if (__builtin_expect (SIZE_MAX - total_size < tzspec_len, 0))
+ goto lose;
+ }
+ if (__builtin_expect (SIZE_MAX - total_size - tzspec_len < extra, 0))
+ goto lose;
/* Allocate enough memory including the extra block requested by the
caller. */
diff --git a/libc/wcsmbs/Makefile b/libc/wcsmbs/Makefile
index bffdaf4c8..a908128c6 100644
--- a/libc/wcsmbs/Makefile
+++ b/libc/wcsmbs/Makefile
@@ -49,7 +49,7 @@ routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+= isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
-strop-tests := wcscmp wmemcmp wcslen wcschr
+strop-tests := wcscmp wmemcmp wcslen wcschr wcsrchr wcscpy
tests := tst-wchar-h
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb
diff --git a/libc/wcsmbs/test-wcscpy.c b/libc/wcsmbs/test-wcscpy.c
new file mode 100644
index 000000000..b7cad535f
--- /dev/null
+++ b/libc/wcsmbs/test-wcscpy.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strcpy.c"
diff --git a/libc/wcsmbs/test-wcsrchr.c b/libc/wcsmbs/test-wcsrchr.c
new file mode 100644
index 000000000..95a556874
--- /dev/null
+++ b/libc/wcsmbs/test-wcsrchr.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strrchr.c"
diff --git a/libc/wcsmbs/wcschr.c b/libc/wcsmbs/wcschr.c
index 15b55d454..1a31f7481 100644
--- a/libc/wcsmbs/wcschr.c
+++ b/libc/wcsmbs/wcschr.c
@@ -18,8 +18,11 @@
#include <wchar.h>
-
/* Find the first occurrence of WC in WCS. */
+#ifdef WCSCHR
+# define wcschr WCSCHR
+#endif
+
wchar_t *
wcschr (wcs, wc)
register const wchar_t *wcs;