summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-01-26 11:27:38 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-01-26 11:27:38 +0000
commit75a8dd396d88f79e8e2660fefe5bd93cbff71f55 (patch)
treee7ff701c0888ad2e6d527fd0b3302bcc3663d3dd
parent42bc5058cebfefa9329005e1b3bc0525f7f7b67b (diff)
Merge changes between r9569 and r9736 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@9737 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog527
-rw-r--r--libc/Makeconfig8
-rw-r--r--libc/Versions.def1
-rw-r--r--libc/bits/confname.h11
-rw-r--r--libc/conform/conformtest.pl62
-rw-r--r--libc/conform/data/complex.h-data2
-rw-r--r--libc/conform/data/ctype.h-data22
-rw-r--r--libc/conform/data/dirent.h-data13
-rw-r--r--libc/conform/data/errno.h-data5
-rw-r--r--libc/conform/data/fcntl.h-data31
-rw-r--r--libc/conform/data/fmtmsg.h-data2
-rw-r--r--libc/conform/data/fnmatch.h-data2
-rw-r--r--libc/conform/data/ftw.h-data2
-rw-r--r--libc/conform/data/glob.h-data2
-rw-r--r--libc/conform/data/grp.h-data5
-rw-r--r--libc/conform/data/iconv.h-data3
-rw-r--r--libc/conform/data/inttypes.h-data4
-rw-r--r--libc/conform/data/langinfo.h-data8
-rw-r--r--libc/conform/data/libgen.h-data2
-rw-r--r--libc/conform/data/limits.h-data8
-rw-r--r--libc/conform/data/locale.h-data25
-rw-r--r--libc/conform/data/math.h-data33
-rw-r--r--libc/conform/data/monetary.h-data6
-rw-r--r--libc/conform/data/mqueue.h-data10
-rw-r--r--libc/conform/data/ndbm.h-data2
-rw-r--r--libc/conform/data/netdb.h-data2
-rw-r--r--libc/conform/data/pthread.h-data15
-rw-r--r--libc/conform/data/pwd.h-data5
-rw-r--r--libc/conform/data/regex.h-data2
-rw-r--r--libc/conform/data/sched.h-data6
-rw-r--r--libc/conform/data/search.h-data2
-rw-r--r--libc/conform/data/semaphore.h-data2
-rw-r--r--libc/conform/data/setjmp.h-data4
-rw-r--r--libc/conform/data/signal.h-data43
-rw-r--r--libc/conform/data/spawn.h-data6
-rw-r--r--libc/conform/data/stdio.h-data45
-rw-r--r--libc/conform/data/stdlib.h-data49
-rw-r--r--libc/conform/data/string.h-data28
-rw-r--r--libc/conform/data/strings.h-data13
-rw-r--r--libc/conform/data/sys/ipc.h-data2
-rw-r--r--libc/conform/data/sys/msg.h-data2
-rw-r--r--libc/conform/data/sys/resource.h-data2
-rw-r--r--libc/conform/data/sys/select.h-data12
-rw-r--r--libc/conform/data/sys/sem.h-data2
-rw-r--r--libc/conform/data/sys/shm.h-data2
-rw-r--r--libc/conform/data/sys/socket.h-data8
-rw-r--r--libc/conform/data/sys/stat.h-data44
-rw-r--r--libc/conform/data/sys/time.h-data2
-rw-r--r--libc/conform/data/sys/types.h-data9
-rw-r--r--libc/conform/data/sys/uio.h-data2
-rw-r--r--libc/conform/data/sys/wait.h-data8
-rw-r--r--libc/conform/data/syslog.h-data2
-rw-r--r--libc/conform/data/tar.h-data4
-rw-r--r--libc/conform/data/termios.h-data15
-rw-r--r--libc/conform/data/tgmath.h-data33
-rw-r--r--libc/conform/data/time.h-data20
-rw-r--r--libc/conform/data/ulimit.h-data2
-rw-r--r--libc/conform/data/unistd.h-data134
-rw-r--r--libc/conform/data/utmpx.h-data2
-rw-r--r--libc/conform/data/wchar.h-data58
-rw-r--r--libc/conform/data/wctype.h-data22
-rw-r--r--libc/conform/data/wordexp.h-data2
-rw-r--r--libc/dirent/dirent.h4
-rw-r--r--libc/elf/dl-open.c9
-rw-r--r--libc/elf/dl-sysdep.c15
-rw-r--r--libc/elf/dynamic-link.h15
-rw-r--r--libc/elf/elf.h14
-rw-r--r--libc/elf/rtld.c41
-rw-r--r--libc/grp/grp.h6
-rw-r--r--libc/iconv/iconv_prog.c2
-rw-r--r--libc/include/features.h21
-rw-r--r--libc/io/fcntl.h59
-rw-r--r--libc/io/sys/stat.h4
-rw-r--r--libc/libio/stdio.h24
-rw-r--r--libc/locale/C-address.c4
-rw-r--r--libc/locale/C-collate.c4
-rw-r--r--libc/locale/C-ctype.c4
-rw-r--r--libc/locale/C-identification.c4
-rw-r--r--libc/locale/C-measurement.c4
-rw-r--r--libc/locale/C-messages.c4
-rw-r--r--libc/locale/C-monetary.c4
-rw-r--r--libc/locale/C-name.c4
-rw-r--r--libc/locale/C-numeric.c4
-rw-r--r--libc/locale/C-paper.c4
-rw-r--r--libc/locale/C-telephone.c4
-rw-r--r--libc/locale/C-time.c4
-rw-r--r--libc/locale/findlocale.c33
-rw-r--r--libc/locale/global-locale.c4
-rw-r--r--libc/locale/loadarchive.c6
-rw-r--r--libc/locale/loadlocale.c13
-rw-r--r--libc/locale/localeinfo.h54
-rw-r--r--libc/locale/nl_langinfo_l.c4
-rw-r--r--libc/locale/setlocale.c14
-rw-r--r--libc/locale/xlocale.c4
-rw-r--r--libc/locale/xlocale.h4
-rw-r--r--libc/localedata/ChangeLog4
-rw-r--r--libc/localedata/locales/i18n3
-rw-r--r--libc/malloc/malloc.c41
-rw-r--r--libc/manual/install.texi11
-rw-r--r--libc/misc/bits/syslog.h6
-rw-r--r--libc/nptl/ChangeLog31
-rw-r--r--libc/nptl/Versions5
-rw-r--r--libc/nptl/pthread_mutex_consistent.c5
-rw-r--r--libc/nptl/pthread_mutexattr_getrobust.c5
-rw-r--r--libc/nptl/pthread_mutexattr_setrobust.c5
-rw-r--r--libc/nptl/sysdeps/pthread/pthread.h26
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S12
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S10
-rw-r--r--libc/posix/confstr.c22
-rw-r--r--libc/posix/confstr.inc194
-rw-r--r--libc/posix/glob.h5
-rw-r--r--libc/posix/regcomp.c128
-rw-r--r--libc/posix/regex_internal.c140
-rw-r--r--libc/posix/regexec.c211
-rw-r--r--libc/posix/sched.h10
-rw-r--r--libc/posix/sys/types.h11
-rw-r--r--libc/posix/sys/wait.h10
-rw-r--r--libc/posix/unistd.h43
-rw-r--r--libc/resolv/netdb.h16
-rw-r--r--libc/resolv/res_send.c44
-rw-r--r--libc/signal/signal.h6
-rw-r--r--libc/stdio-common/vfscanf.c22
-rw-r--r--libc/stdlib/stdlib.h24
-rw-r--r--libc/stdlib/strfmon_l.c4
-rw-r--r--libc/stdlib/strtod_l.c54
-rw-r--r--libc/stdlib/strtol_l.c4
-rw-r--r--libc/string/strcoll_l.c4
-rw-r--r--libc/string/string.h6
-rw-r--r--libc/string/strings.h33
-rw-r--r--libc/string/strxfrm_l.c7
-rw-r--r--libc/sysdeps/generic/ldsodefs.h5
-rw-r--r--libc/sysdeps/generic/netinet/ip.h43
-rw-r--r--libc/sysdeps/i386/i686/bcopy.S3
-rw-r--r--libc/sysdeps/i386/i686/cacheinfo.c1
-rw-r--r--libc/sysdeps/i386/i686/memcpy.S4
-rw-r--r--libc/sysdeps/i386/i686/memmove.S27
-rw-r--r--libc/sysdeps/i386/i686/mempcpy.S4
-rw-r--r--libc/sysdeps/i386/i686/memset.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/Makefile4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bcopy-ssse3.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bcopy.S89
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bzero-sse2-rep.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bzero-sse2.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bzero.S97
-rw-r--r--libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S1785
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy-ssse3.S1737
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy.S90
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy_chk.S64
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove-ssse3-rep.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove-ssse3.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove.S117
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove_chk.S112
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3-rep.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3.S4
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy.S93
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S64
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset-sse2-rep.S821
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset-sse2.S867
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset.S112
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset_chk.S116
-rw-r--r--libc/sysdeps/i386/sysdep.h3
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_ceill.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_expm1l.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_floorl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_log1pl.c1
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c17
-rw-r--r--libc/sysdeps/mach/hurd/bits/libc-lock.h3
-rw-r--r--libc/sysdeps/mach/hurd/bits/stat.h12
-rw-r--r--libc/sysdeps/powerpc/powerpc32/cell/memcpy.S245
-rw-r--r--libc/sysdeps/powerpc/powerpc64/cell/memcpy.S245
-rw-r--r--libc/sysdeps/s390/s390-32/dl-machine.h7
-rw-r--r--libc/sysdeps/s390/s390-32/elf/start.S82
-rw-r--r--libc/sysdeps/unix/bsd/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/sigaction.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h14
-rw-r--r--libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/ia64/bits/sigaction.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/ia64/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h14
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/fpu/Implies3
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/fpu/Implies1
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/sigaction.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c2
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h20
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/stat.h9
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/bits/stat.h9
-rw-r--r--libc/sysdeps/x86_64/cacheinfo.c10
-rw-r--r--libc/sysdeps/x86_64/multiarch/ifunc-defines.sym3
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.c18
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.h14
-rw-r--r--libc/sysdeps/x86_64/multiarch/strlen.S60
-rw-r--r--libc/sysdeps/x86_64/strcmp.S415
-rw-r--r--libc/termios/termios.h4
-rw-r--r--libc/time/alt_digit.c10
-rw-r--r--libc/time/asctime.c6
-rw-r--r--libc/time/era.c10
-rw-r--r--libc/time/lc-time-cleanup.c4
-rw-r--r--libc/time/strftime_l.c4
-rw-r--r--libc/time/strptime_l.c6
-rw-r--r--libc/wcsmbs/wcsmbsload.c6
-rw-r--r--libc/wcsmbs/wcsmbsload.h10
-rw-r--r--ports/ChangeLog.arm6
-rw-r--r--ports/ChangeLog.m68k13
-rw-r--r--ports/ChangeLog.mips18
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h12
-rw-r--r--ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h12
-rw-r--r--ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h9
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h14
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/bits/sigaction.h4
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/bits/stat.h9
221 files changed, 9642 insertions, 1123 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 9b1d78bca..48ca52e8a 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,530 @@
+2010-01-25 Andreas Schwab <schwab@redhat.com>
+
+ * iconv/iconv_prog.c (write_output): Fix check for open failure.
+
+2010-01-22 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #11200]
+ * locale/loadlocale.c (_nl_load_locale): Fix recognition of genuine
+ mmap resource problem. Patch by Joe Landers <jlanders@vmware.com>.
+
+2010-01-22 Jim Meyering <jim@meyering.net>
+
+ [BZ #11193]
+ * posix/regexec.c (extend_buffers): Avoid overflow in realloc
+ buffer length computation.
+
+ [BZ #11192]
+ * posix/regexec.c (re_copy_regs): Don't leak when allocation
+ of the start buffer succeeds but allocation of the "end" one fails.
+
+ [BZ #11191]
+ * posix/regexec.c (re_search_2_stub): Check for overflow
+ when adding the sizes of the two strings.
+
+ [BZ #11190]
+ * posix/regexec.c (re_search_internal): Avoid overflow
+ in computing re_malloc buffer size.
+
+ [BZ #11189]
+ * posix/regexec.c (prune_impossible_nodes): Avoid overflow
+ in computing re_malloc buffer size.
+
+ [BZ #11188]
+ * posix/regexec.c (build_trtable): Avoid arithmetic overflow
+ in size calculation.
+
+ [BZ #11187]
+ * posix/regexec.c (re_search_2_stub): Use simpler method than
+ boolean for freeing internal storage.
+
+2010-01-22 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/regex_internal.c (re_string_skip_chars): Simplify test for
+ failed mbrtowc call.
+
+2010-01-22 Jim Meyering <jim@meyering.net>
+
+ [BZ #11186]
+ * posix/regex_internal.c (re_string_skip_chars): Don't assume WEOF
+ fits in wchar_t. Problem reported by Eric Blake.
+
+ [BZ #11185]
+ * posix/regex_internal.c (re_string_reconstruct): Remove declaration
+ and stores into set-but-not-used local, "q".
+
+ [BZ #11184]
+ * posix/regex_internal.c (re_dfa_add_node): Extend the overflow
+ detection test. Patch by Paul Eggert.
+
+ [BZ #11183]
+ * posix/regex_internal.c (re_string_realloc_buffers):
+ Detect and handle internal overflow. Patch by Paul Eggert
+
+2010-01-20 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c
+ (CHECK_SP): Fix check for alternate stack.
+ * sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c
+ (CHECK_SP): Likewise.
+
+2010-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/i386/i686/multiarch/memmove.S: Also check
+ bit_Fast_Rep_String when SHARED isn't defined.
+
+2010-01-19 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #11194]
+ * misc/bits/syslog.h (syslog, vsyslog): Remove unnecessary return.
+
+2010-01-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * sysdeps/mach/hurd/bits/libc-lock.h
+ (__rtld_lock_recursive_t): New type.
+ (__rtld_lock_initialize): New macro.
+
+2010-01-14 Ryan S. Arnold <rsa@us.ibm.com>
+
+ * sysdeps/powerpc/powerpc32/cell/memcpy.S: New file.
+ * sysdeps/powerpc/powerpc64/cell/memcpy.S: New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/fpu/Implies: New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/fpu/Implies: New file.
+
+2010-01-18 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Remove duplicate
+ definitions of O_DSYNC and O_RSYNC.
+
+ * elf/dynamic-link.h (elf_get_dynamic_info): Use correct type when
+ casting d_tag.
+
+ * elf/dynamic-link.h (elf_get_dynamic_info): Ignore negative
+ dynamic entry types.
+
+2010-01-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/ieee754/ldbl-128/s_ceill.c (huge): Add L suffix to the
+ constant.
+ * sysdeps/ieee754/ldbl-128/s_floorl.c (huge): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_expm1l.c (big): Decrease to avoid
+ overflow.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (big): Remove unused variable.
+
+ * sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf): Use
+ math_opt_barrier and math_force_eval macros.
+
+2010-01-15 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/regcomp.c: Fix a few more cases of ignored return values.
+ * posix/regex_internal.c: Likewise.
+ * posix/regexec.c: Likewise.
+
+ * include/features.h: _XOPEN_SOURCE_EXTENDED is not defined to be
+ used without _XOPEN_SOURCE. Don't base any decisions on this macro
+ if _XOPEN_SOURCE is not defined as well.
+
+2010-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * sysdeps/s390/s390-32/elf/start.S (_start): Added check for the
+ high gprs kernel facility.
+ * sysdeps/s390/s390-32/dl-machine.h (elf_machine_matches_host):
+ Added high gprs check for DSOs.
+ * elf/elf.h (EF_S390_HIGH_GPRS): Added macro definition for the
+ new elf header flag.
+
+2010-01-13 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * elf/dl-sysdep.c (_dl_sysdep_start): Added the auxv parameter to
+ dl_main.
+ * elf/dl-open.c (_dl_sysdep_start): Likewise..
+ * sysdeps/generic/ldsodefs.h (_dl_sysdep_start): Likewise.
+ * elf/rtld.c (dl_main): Added new parameter auxv. Adjust the
+ AT_PHDR, AT_PHNUM and AT_ENTRY fields if the ld.so is directly
+ started.
+
+2010-01-14 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #11027]
+ * sysdeps/generic/netinet/ip.h: Define IPTOS_CLASS_* macros according
+ to RFC 2474.
+ Patch by Philip Prindeville <philipp@redfish-solutions.com>.
+
+ [BZ #11141]
+ * resolv/res_send.c (reopen): Don't use IPv6 sockets for IPv4
+ addresses.
+
+ [BZ #11127]
+ * posix/regcomp.c (alc_eclosure_iter): Do not ignore
+ re_node_set_insert failure; return REG_ESPACE.
+ Patch by Paul Eggert.
+
+ * bits/confname.h: Make pre-C99-safe.
+
+2010-01-14 Ryan S. Arnold <rsa@us.ibm.com>
+
+ * Makeconfig (+prector, +postctor, +prectorS, +postctorS): Add
+ $(sysdep-LDFLAGS) to pre and post ctors so that the proper .o
+ files are found by GCC.
+
+2010-01-14 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/unistd.h: Relax conditions for ualarm, usleep, getwd, vfork,
+ brk, and sbrk.
+
+ * string/strings.h: Relax condition for bcmp, bcopy, bzero, ffs,
+ index, and rindex.
+
+ * stdlib/stdlib.h: Relax conditions for *cvt functions and valloc.
+
+ * Versions.def: Add GLIBC_2.12 for libpthread.
+
+ [BZ #11126]
+ * malloc/malloc.c (malloc_info): Initialize malloc if not already
+ done. Handle empty bin lists.
+
+ * posix/unistd.h: Change getpagesize and getdtablesize declaration
+ visibility some more.
+
+ * resolv/netdb.h: Relax condition to elide obsolete resolver constants.
+
+ * posix/unistd.h: Declare getpagesize in _GNU_SOURCE mode.
+
+ [BZ #11120]
+ * sysdeps/x86_64/strcmp.S: Prevent silent errors should strncmp be
+ needed outside libc.
+
+2010-01-13 Ulrich Drepper <drepper@redhat.com>
+
+ * stdlib/stdlib.h: Parameter of unsetenv must not be NULL.
+
+2010-01-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86_64/multiarch/strlen.S: Unroll the loop.
+
+2010-01-13 Ulrich Drepper <drepper@redhat.com>
+
+ * stdlib/stdlib.h: Be a bit more relaxed about obsoleted mktemp symbol.
+
+2010-01-12 Ulrich Drepper <drepper@redhat.com>
+
+ * conform/data/complex.h-data: Test for POSIX2008.
+
+ * conform/data/ctype.h-data: Fix POSIX testing.
+
+ * conform/data/dirent.h-data: ino_t only needed for XSI.
+
+ * grp/grp.h: Declare getgrent and endgrent for XPG7.
+
+ * conform/data/inttypes.h-data: Use same types as the headers.
+
+ * resolv/netdb.h: Don't define old resolver macros for XPG7.
+
+ * conform/data/sys/uio.h-data: Don't exclude POSIX2008.
+
+ * conform/conformtest.pl: Implement tag for allow-header.
+ Fix newline handling in allow-header implementation.
+
+ * conform/data/time.h-data: Use allow-header instead of duplicating
+ information.
+
+ * conform/data/time.h-data: Allow sigevent tag.
+
+ * posix/sched.h: Define time_t and pid_t for XPG7.
+
+2010-01-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/i386/i686/bcopy.S: New file.
+
+ * sysdeps/i386/i686/cacheinfo.c (__x86_64_data_cache_size): Define.
+
+ * sysdeps/i386/i686/memcpy.S (__memcpy_chk): Use ENTRY_CHK
+ and END_CHK.
+ * sysdeps/i386/i686/memmove.S (__memmove_chk): Likewise.
+ * sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
+ * sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
+
+ * sysdeps/i386/i686/memmove.S: Support USE_AS_BCOPY.
+
+ * sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add
+ bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 memmove-ssse3
+ memcpy-ssse3-rep mempcpy-ssse3-rep memmove-ssse3-rep
+ bcopy-ssse3 bcopy-ssse3-rep memset-sse2-rep bzero-sse2-rep
+ * sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/bcopy-ssse3.S: New file.
+ * sysdeps/i386/i686/multiarch/bcopy.S: New file.
+ * sysdeps/i386/i686/multiarch/bzero-sse2-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/bzero-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/bzero.S: New file.
+ * sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/memcpy-ssse3.S: New file.
+ * sysdeps/i386/i686/multiarch/memcpy.S: New file.
+ * sysdeps/i386/i686/multiarch/memcpy_chk.S: New file.
+ * sysdeps/i386/i686/multiarch/memmove-ssse3-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/memmove-ssse3.S: New file.
+ * sysdeps/i386/i686/multiarch/memmove.S: New file.
+ * sysdeps/i386/i686/multiarch/memmove_chk.S: New file.
+ * sysdeps/i386/i686/multiarch/mempcpy-ssse3-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/mempcpy-ssse3.S: New file.
+ * sysdeps/i386/i686/multiarch/mempcpy.S: New file.
+ * sysdeps/i386/i686/multiarch/mempcpy_chk.S: New file.
+ * sysdeps/i386/i686/multiarch/memset-sse2-rep.S: New file.
+ * sysdeps/i386/i686/multiarch/memset-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/memset.S: New file.
+ * sysdeps/i386/i686/multiarch/memset_chk.S: New file.
+
+ * sysdeps/i386/sysdep.h (ENTRY_CHK): New.
+ (END_CHK): Likewise.
+
+ * sysdeps/i386/i686/multiarch/ifunc-defines.sym: Add
+ FEATURE_OFFSET, FEATURE_SIZE and FEATURE_INDEX_1.
+ * sysdeps/x86_64/multiarch/ifunc-defines.sym: Likewise.
+
+ * sysdeps/x86_64/cacheinfo.c (intel_02_cache_info): Add entries
+ for 0x0e and 0x80.
+ (__x86_64_data_cache_size): New.
+ (init_cacheinfo): Set __x86_64_data_cache_size.
+
+ * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): Turn
+ on bit_Fast_Rep_String for Intel Core i7.
+
+ * sysdeps/x86_64/multiarch/init-arch.h (bit_Fast_Rep_String): New.
+ (index_Fast_Rep_String): Likewise.
+ (FEATURE_INDEX_1): Likewise.
+ (FEATURE_INDEX_MAX): Likewise.
+ (cpu_features): Add feature.
+
+2010-01-12 Ulrich Drepper <drepper@redhat.com>
+
+ * conform/data/sys/select.h-data: Fix up for XPG7.
+
+2010-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ * posix/sys/wait.h: Don't define W* macros etc. if
+ stdlib.h has been included with _POSIX_C_SOURCE >= 200809L.
+
+2010-01-11 Ulrich Drepper <drepper@redhat.com>
+
+ * io/sys/stat.h: Declare fchmod for XPG7.
+ * conform/data/sys/stat.h-data: Fix up for XPG7.
+
+ * termios/termios.h: Define pid_t for XPG7.
+
+ * conform/data/math.h-data: Fix up for XPG6 and XPG7.
+ * conform/data/tgmath.h-data: Likewise.
+
+ * conform/data/time.h-data: Fix POSIX tests.
+
+ * conform/data/wchar.h-data: Fix up XPG7 tests.
+
+ * include/features.h: Fix __USE_ISOC95 handling.
+
+ * conform/data/wordexp.h-data: Fix typo in last change.
+
+ * conform/data/unistd.h-data: Fix up older POSIX tests.
+
+ * stdlib/stdlib.h: Fix handling symbols removed in XPG7.
+ * posix/unistd.h: Likewise.
+
+ * posix/unistd.h: Include environments.h also for XPG6 and up.
+ Define intptr_t for XPG6 and up.
+ Fix up for XPG7.
+ * conform/data/unistd.h-data: Fix up for XPG6 and XPG7.
+
+ * conform/data/sys/types.h-data: Fix up for XPG7.
+
+ * sysdeps/unix/bsd/bits/stat.h: Fix double-inclusion problem.
+ * sysdeps/unix/sysv/linux/powerpc/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/bits/stat.h: Likewise.
+ * sysdeps/mach/hurd/bits/stat.h: Likewise.
+
+ * bits/confname.h: Fix typo in last change.
+
+ * conform/data/unistd.h-data: lockf-constants Not needed for POSIX.
+
+2010-01-10 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/bits/sigaction.h: SA_RESTART, SA_NODEFER,
+ and SA_RESETHAND now available in Base.
+ * sysdeps/unix/sysv/linux/ia64/bits/sigaction.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/sigaction.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise.
+ * conform/data/signal.h-data: Update for XPG7.
+
+ * posix/sys/types.h: Define id_t, clock_t, blksize_t for XPG7.
+
+ * string/strings.h: Don't declare obsolete functions for XPG7.
+ Declare ffs only for XSI.
+ * conform/data/strings.h-data: Update for XPG7.
+
+2010-01-10 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #11125]
+ * libio/stdio.h: Define va_list, off_t, and ssize_t.
+
+ * posix/glob.h: Define size_t.
+
+ * posix/sys/wait.h: Define idtype_t and declare waitid for XPG7.
+
+ * signal/signal.h: Define size_t, mcontext_t, and ucontext_t for XPG7.
+
+2010-01-10 Ulrich Drepper <drepper@redhat.com>
+
+ * conform/conformtest.pl: For XPG7 testing the headers are supposed to
+ be self-contained.
+
+ * conform/data/stdio.h-data: Expect off_t and ssize_t.
+
+2010-01-09 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/stdio.h: Define va_list also for XPG7.
+
+ * conform/conformtest.pl: Update for XPG7 and some bug fixes.
+ * conform/data/ctype.h-data: Likewise.
+ * conform/data/dirent.h-data: Likewise.
+ * conform/data/errno.h-data: Likewise.
+ * conform/data/fcntl.h-data: Likewise.
+ * conform/data/fmtmsg.h-data: Likewise.
+ * conform/data/fnmatch.h-data: Likewise.
+ * conform/data/ftw.h-data: Likewise.
+ * conform/data/glob.h-data: Likewise.
+ * conform/data/grp.h-data: Likewise.
+ * conform/data/iconv.h-data: Likewise.
+ * conform/data/langinfo.h-data: Likewise.
+ * conform/data/libgen.h-data: Likewise.
+ * conform/data/limits.h-data: Likewise.
+ * conform/data/locale.h-data: Likewise.
+ * conform/data/math.h-data: Likewise.
+ * conform/data/monetary.h-data: Likewise.
+ * conform/data/mqueue.h-data: Likewise.
+ * conform/data/ndbm.h-data: Likewise.
+ * conform/data/netdb.h-data: Likewise.
+ * conform/data/pthread.h-data: Likewise.
+ * conform/data/pwd.h-data: Likewise.
+ * conform/data/regex.h-data: Likewise.
+ * conform/data/sched.h-data: Likewise.
+ * conform/data/search.h-data: Likewise.
+ * conform/data/semaphore.h-data: Likewise.
+ * conform/data/setjmp.h-data: Likewise.
+ * conform/data/signal.h-data: Likewise.
+ * conform/data/spawn.h-data: Likewise.
+ * conform/data/stdio.h-data: Likewise.
+ * conform/data/stdlib.h-data: Likewise.
+ * conform/data/string.h-data: Likewise.
+ * conform/data/strings.h-data: Likewise.
+ * conform/data/sys/ipc.h-data: Likewise.
+ * conform/data/sys/msg.h-data: Likewise.
+ * conform/data/sys/resource.h-data: Likewise.
+ * conform/data/sys/sem.h-data: Likewise.
+ * conform/data/sys/shm.h-data: Likewise.
+ * conform/data/sys/socket.h-data: Likewise.
+ * conform/data/sys/stat.h-data: Likewise.
+ * conform/data/sys/time.h-data: Likewise.
+ * conform/data/sys/types.h-data: Likewise.
+ * conform/data/sys/uio.h-data: Likewise.
+ * conform/data/sys/wait.h-data: Likewise.
+ * conform/data/syslog.h-data: Likewise.
+ * conform/data/tar.h-data: Likewise.
+ * conform/data/termios.h-data: Likewise.
+ * conform/data/time.h-data: Likewise.
+ * conform/data/ulimit.h-data: Likewise.
+ * conform/data/unistd.h-data: Likewise.
+ * conform/data/utmpx.h-data: Likewise.
+ * conform/data/wchar.h-data: Likewise.
+ * conform/data/wctype.h-data: Likewise.
+ * conform/data/wordexp.h-data: Likewise.
+
+ * io/fcntl.h: Define mode_t macros instead of including sys/stat.h.
+ * sysdeps/unix/bsd/bits/stat.h: Enable using from fcntl.h.
+ * sysdeps/unix/sysv/linux/powerpc/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/bits/stat.h: Likewise.
+ * sysdeps/mach/hurd/bits/stat.h: Likewise.
+
+ * stdlib/stdlib.h: Define wait-related bits for XPG7.
+ Don't declare valloc, mktemp, ecvt, fcvt, gcvt for XPG6 and up.
+ Declare mkstemp and getsubopt for XPG7.
+ Declare posix_openpt for XPG6 XSI.
+
+ * include/features.h: Define __USE_XOPEN2KXSI for _XOPEN_SOURCE >= 600
+ and __USE_XOPEN2K8XSI for _XOPEN_SOURCE >= 700.
+
+ * string/string.h: Declare strdup for XPG7.
+
+2010-01-08 Ulrich Drepper <drepper@redhat.com>
+
+ * bits/confname.h: Define _CS_V6_ENV and _CS_V7_ENV.
+ * posix/confstr.c: Implement _CS_V6_ENV and _CS_V7_ENV.
+
+ * dirent/dirent.h: Really fix feature selection.
+
+ * locale/localeinfo.h: Rename struct locale_data to __locale_data.
+ Fix all users.
+ * locale/C-address.c: Fix all users.
+ * locale/C-collate.c: Likewise.
+ * locale/C-ctype.c: Likewise.
+ * locale/C-identification.c: Likewise.
+ * locale/C-measurement.c: Likewise.
+ * locale/C-messages.c: Likewise.
+ * locale/C-monetary.c: Likewise.
+ * locale/C-name.c: Likewise.
+ * locale/C-numeric.c: Likewise.
+ * locale/C-paper.c: Likewise.
+ * locale/C-telephone.c: Likewise.
+ * locale/C-time.c: Likewise.
+ * locale/findlocale.c: Likewise.
+ * locale/global-locale.c: Likewise.
+ * locale/loadarchive.c: Likewise.
+ * locale/loadlocale.c: Likewise.
+ * locale/nl_langinfo_l.c: Likewise.
+ * locale/setlocale.c: Likewise.
+ * locale/xlocale.c: Likewise.
+ * locale/xlocale.h: Likewise.
+ * stdio-common/vfscanf.c: Likewise.
+ * stdlib/strfmon_l.c: Likewise.
+ * stdlib/strtod_l.c: Likewise.
+ * stdlib/strtol_l.c: Likewise.
+ * string/strcoll_l.c: Likewise.
+ * string/strxfrm_l.c: Likewise.
+ * time/alt_digit.c: Likewise.
+ * time/asctime.c: Likewise.
+ * time/era.c: Likewise.
+ * time/lc-time-cleanup.c: Likewise.
+ * time/strftime_l.c: Likewise.
+ * time/strptime_l.c: Likewise.
+ * wcsmbs/wcsmbsload.c: Likewise.
+ * wcsmbs/wcsmbsload.h: Likewise.
+
+ * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Define O_DIRECTORY,
+ O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN
+ for XPG7.
+ * sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+
+2010-01-07 Roland McGrath <roland@redhat.com>
+
+ * elf/elf.h (PN_XNUM): New macro.
+
+ * elf/dl-sysdep.c (_dl_important_hwcaps): Use NT_GNU_HWCAP instead of
+ literal 2.
+
+2010-01-06 Ulrich Drepper <drepper@redhat.com>
+
+ * dirent/dirent.h: Fix typo in feature selection macro use.
+
2009-12-15 Maciej W. Rozycki <macro@codesourcery.com>
[BZ #11115]
diff --git a/libc/Makeconfig b/libc/Makeconfig
index 4ddb087a3..3888448fb 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -549,11 +549,11 @@ endif
ifeq ($(elf),yes)
+preinit = $(addprefix $(csu-objpfx),crti.o)
+postinit = $(addprefix $(csu-objpfx),crtn.o)
-+prector = `$(CC) --print-file-name=crtbegin.o`
-+postctor = `$(CC) --print-file-name=crtend.o`
++prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
++postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
# Variants of the two previous definitions for linking PIE programs.
-+prectorS = `$(CC) --print-file-name=crtbeginS.o`
-+postctorS = `$(CC) --print-file-name=crtendS.o`
++prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
++postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+interp = $(addprefix $(elf-objpfx),interp.os)
endif
csu-objpfx = $(common-objpfx)csu/
diff --git a/libc/Versions.def b/libc/Versions.def
index 70de1c14f..eab006b83 100644
--- a/libc/Versions.def
+++ b/libc/Versions.def
@@ -91,6 +91,7 @@ libpthread {
GLIBC_2.4
GLIBC_2.6
GLIBC_2.11
+ GLIBC_2.12
GLIBC_PRIVATE
}
libresolv {
diff --git a/libc/bits/confname.h b/libc/bits/confname.h
index 757ed4f3c..45fcafbff 100644
--- a/libc/bits/confname.h
+++ b/libc/bits/confname.h
@@ -1,5 +1,5 @@
/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
- Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009
+ Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -527,7 +527,7 @@ enum
_SC_THREAD_ROBUST_PRIO_INHERIT,
#define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT
- _SC_THREAD_ROBUST_PRIO_PROTECT,
+ _SC_THREAD_ROBUST_PRIO_PROTECT
#define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT
};
@@ -667,6 +667,11 @@ enum
#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS,
#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
- _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+ _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS,
#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+
+ _CS_V6_ENV,
+#define _CS_V6_ENV _CS_V6_ENV
+ _CS_V7_ENV
+#define _CS_V7_ENV _CS_V7_ENV
};
diff --git a/libc/conform/conformtest.pl b/libc/conform/conformtest.pl
index b15656bd6..d324d81c5 100644
--- a/libc/conform/conformtest.pl
+++ b/libc/conform/conformtest.pl
@@ -1,6 +1,7 @@
#! /usr/bin/perl
use Getopt::Long;
+use POSIX;
$CC = "gcc";
@@ -30,7 +31,8 @@ if (@headers == ()) {
}
if ($dialect ne "ISO" && $dialect ne "POSIX" && $dialect ne "XPG3"
- && $dialect ne "XPG4" && $dialect ne "UNIX98" && $dialect ne "XOPEN2K") {
+ && $dialect ne "XPG4" && $dialect ne "UNIX98" && $dialect ne "XOPEN2K"
+ && $dialect ne "XOPEN2K8" && $dialect ne "POSIX2008") {
die "unknown dialect \"$dialect\"";
}
@@ -40,6 +42,8 @@ $CFLAGS{"XPG3"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE";
$CFLAGS{"XPG4"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE_EXTENDED";
$CFLAGS{"UNIX98"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
$CFLAGS{"XOPEN2K"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
+$CFLAGS{"XOPEN2K8"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=700";
+$CFLAGS{"POSIX2008"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_POSIX_C_SOURCE=200809L";
# These are the ISO C99 keywords.
@@ -52,14 +56,17 @@ $CFLAGS{"XOPEN2K"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=600
# These are symbols which are known to pollute the namespace.
@knownproblems = ('unix', 'linux', 'i386');
-# Some headers need a bit more attention.
-$mustprepend{'inttypes.h'} = "#include <stddef.h>\n";
-$mustprepend{'regex.h'} = "#include <sys/types.h>\n";
-$mustprepend{'sched.h'} = "#include <sys/types.h>\n";
-$mustprepend{'signal.h'} = "#include <pthread.h>\n";
-$mustprepend{'stdio.h'} = "#include <sys/types.h>\n";
-$mustprepend{'wchar.h'} = "#include <stdarg.h>\n";
-$mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
+if ($dialect ne "XOPEN2K8" && $dialect ne "POSIX2008") {
+ # Some headers need a bit more attention. At least with XPG7
+ # all headers should be self-contained.
+ $mustprepend{'inttypes.h'} = "#include <stddef.h>\n";
+ $mustprepend{'regex.h'} = "#include <sys/types.h>\n";
+ $mustprepend{'sched.h'} = "#include <sys/types.h>\n";
+ $mustprepend{'signal.h'} = "#include <pthread.h>\n";
+ $mustprepend{'stdio.h'} = "#include <sys/types.h>\n";
+ $mustprepend{'wchar.h'} = "#include <stdarg.h>\n";
+ $mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
+}
# Make a hash table from this information.
while ($#keywords >= 0) {
@@ -71,7 +78,10 @@ while ($#knownproblems >= 0) {
$isknown{pop (@knownproblems)} = 1;
}
-$tmpdir = "/tmp";
+$uid = getuid();
+($pwname,$pwpasswd,$pwuid,$pwgid,
+ $pwquota,$pwcomment,$pwgcos,$pwdir,$pwshell,$pwexpire) = getpwuid($uid);
+$tmpdir = "$pwdir";
$verbose = 1;
@@ -660,9 +670,6 @@ while ($#headers >= 0) {
$maybe_opaque = 1;
}
- # Remember that this name is allowed.
- push @allow, $type;
-
# Generate a program to test for the availability of this constant.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
@@ -690,9 +697,6 @@ while ($#headers >= 0) {
$maybe_opaque = 1;
}
- # Remember that this name is allowed.
- push @allow, $type;
-
# Generate a program to test for the availability of this type.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
@@ -706,6 +710,27 @@ while ($#headers >= 0) {
compiletest ($fnamebase, "Testing for type $type",
"Type \"$type\" not available.", $missing, 0);
+ } elsif (/^tag *({([^}]*)|([a-zA-Z0-9_]*))/) {
+ my($type) = "$2$3";
+
+ # Remember that this name is allowed.
+ if ($type =~ /^struct *(.*)/) {
+ push @allow, $1;
+ } elsif ($type =~ /^union *(.*)/) {
+ push @allow, $1;
+ } else {
+ push @allow, $type;
+ }
+
+ # Generate a program to test for the availability of this type.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "$type;\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Testing for type $type",
+ "Type \"$type\" not available.", $missing, 0);
} elsif (/^optional-function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
my($rettype) = "$2$3";
my($fname) = "$4";
@@ -1023,6 +1048,7 @@ while ($#headers >= 0) {
open (ALLOW, "$CC -E -D$dialect - < data/$ah-data |");
acontrol: while (<ALLOW>) {
+ chop;
next acontrol if (/^#/);
next acontrol if (/^[ ]*$/);
@@ -1032,8 +1058,8 @@ while ($#headers >= 0) {
push @allow, $1;
} elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
push @allow, 1;
- } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
- my($type) = "$2$3";
+ } elsif (/^(type|tag) *({([^}]*)|([a-zA-Z0-9_]*))/) {
+ my($type) = "$3$4";
# Remember that this name is allowed.
if ($type =~ /^struct *(.*)/) {
diff --git a/libc/conform/data/complex.h-data b/libc/conform/data/complex.h-data
index 5c5eedd18..006d6e4de 100644
--- a/libc/conform/data/complex.h-data
+++ b/libc/conform/data/complex.h-data
@@ -1,4 +1,4 @@
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined POSIX2008
macro complex
macro _Complex_I
optional-macro imaginary
diff --git a/libc/conform/data/ctype.h-data b/libc/conform/data/ctype.h-data
index 7454bd328..091d377be 100644
--- a/libc/conform/data/ctype.h-data
+++ b/libc/conform/data/ctype.h-data
@@ -12,13 +12,32 @@ function int isxdigit (int)
function int tolower (int)
function int toupper (int)
-#ifndef ISO
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function int isascii (int)
function int toascii (int)
// XPG says the following two are macros. But we test a bit more strictly.
function int _toupper (int)
function int _tolower (int)
+#endif
+
+# if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+
+function int isalnum_l (int, locale_t)
+function int isalpha_l (int, locale_t)
+function int iscntrl_l (int, locale_t)
+function int isdigit_l (int, locale_t)
+function int isgraph_l (int, locale_t)
+function int islower_l (int, locale_t)
+function int isprint_l (int, locale_t)
+function int ispunct_l (int, locale_t)
+function int isspace_l (int, locale_t)
+function int isupper_l (int, locale_t)
+function int isxdigit_l (int, locale_t)
+function int tolower_l (int, locale_t)
+function int toupper_l (int, locale_t)
+# endif
// The following is not entirely correct. It should be is[a-z]* but the
// replacement fnmatch implementation does not grok it.
@@ -26,4 +45,3 @@ allow is*
allow to*
allow *_t
-#endif
diff --git a/libc/conform/data/dirent.h-data b/libc/conform/data/dirent.h-data
index e496dab0d..f1cd59cda 100644
--- a/libc/conform/data/dirent.h-data
+++ b/libc/conform/data/dirent.h-data
@@ -3,19 +3,32 @@ type DIR
type {struct dirent}
+# if !defined POSIX && !defined POSIX2008
element {struct dirent} ino_t d_ino
+# endif
element {struct dirent} char d_name []
+# if !defined POSIX && !defined POSIX2008
type ino_t
+#endif
function int closedir (DIR*)
function {DIR*} opendir (const char*)
function {struct dirent*} readdir (DIR*)
function int readdir_r (DIR*, struct dirent*, struct dirent**)
function void rewinddir (DIR*)
+# if !defined POSIX && !defined POSIX2008
function void seekdir (DIR*, long int)
function {long int} telldir (DIR*)
+# endif
allow d_*
allow *_t
+
+# if defined XOPEN2K8 || defined POSIX2008
+function int alphasort (const struct dirent**, const struct dirent**)
+function int dirfd (DIR*)
+function int scandir (const char*, struct dirent***, int(*)(const struct dirent*), int(*)(const struct dirent**,const struct dirent **))
+function {DIR*} fdopendir (int)
+# endif
#endif
diff --git a/libc/conform/data/errno.h-data b/libc/conform/data/errno.h-data
index 67225248a..ffdf6b5c4 100644
--- a/libc/conform/data/errno.h-data
+++ b/libc/conform/data/errno.h-data
@@ -79,6 +79,11 @@ constant ETXTBSY
constant EWOULDBLOCK
constant EXDEV
+# if defined XOPEN2K8 || defined POSIX2008
+constant ENOTRECOVERABLE
+constant EOWNERDEAD
+# endif
+
// variable int errno
allow errno
diff --git a/libc/conform/data/fcntl.h-data b/libc/conform/data/fcntl.h-data
index c8caf0360..7769a446d 100644
--- a/libc/conform/data/fcntl.h-data
+++ b/libc/conform/data/fcntl.h-data
@@ -60,9 +60,11 @@ constant S_IWOTH
constant S_IXOTH
constant S_ISUID
constant S_ISGID
+#if !defined POSIX && !defined POSIX2008
constant S_ISVTX
+#endif
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
constant POSIX_FADV_NORMAL
constant POSIX_FADV_SEQUENTIAL
constant POSIX_FADV_RANDOM
@@ -86,11 +88,32 @@ type pid_t
function int creat (const char*, mode_t)
function int fcntl (int, int, ...)
function int open (const char*, int, ...)
-#ifdef XOPEN2K
+#if defined XOPEN2K8 || defined POSIX2008
+function int openat (int, const char*, int, ...)
+#endif
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int posix_fadvise (int, off_t, off_t, int)
function int posix_fallocate (int, off_t, off_t)
#endif
+#if defined XOPEN2K8 || defined POSIX2008
+constant O_TTY_INIT
+constant O_CLOEXEC
+constant O_EXEC
+constant O_SEARCH
+constant O_DIRECTORY
+constant O_NOFOLLOW
+constant FD_CLOEXEC
+constant F_DUPFD_CLOEXEC
+constant AT_FDCWD
+constant AT_EACCESS
+constant AT_SYMLINK_NOFOLLOW
+constant AT_SYMLINK_FOLLOW
+constant AT_REMOVEDIR
+
+function int openat(int, const char*, int, ...)
+#endif
+
allow-header sys/stat.h
allow-header unistd.h
@@ -99,4 +122,8 @@ allow F_*
allow O_*
allow S_*
allow *_t
+
+allow timespec
+allow tv_nsec
+allow tv_sec
#endif
diff --git a/libc/conform/data/fmtmsg.h-data b/libc/conform/data/fmtmsg.h-data
index da1ed65ac..67c35c1c9 100644
--- a/libc/conform/data/fmtmsg.h-data
+++ b/libc/conform/data/fmtmsg.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined POSIX && !defined POSIX2008
macro MM_HARD
constant MM_HARD
diff --git a/libc/conform/data/fnmatch.h-data b/libc/conform/data/fnmatch.h-data
index ef34fc4e0..96591d6d4 100644
--- a/libc/conform/data/fnmatch.h-data
+++ b/libc/conform/data/fnmatch.h-data
@@ -3,7 +3,9 @@ constant FNM_NOMATCH
constant FNM_PATHNAME
constant FNM_PERIOD
constant FNM_NOESCAPE
+#if !defined XOPEN2K8 && !defined POSIX2008
constant FNM_NOSYS
+#endif
function int fnmatch (const char*, const char*, int)
diff --git a/libc/conform/data/ftw.h-data b/libc/conform/data/ftw.h-data
index 81c50070d..eb499243a 100644
--- a/libc/conform/data/ftw.h-data
+++ b/libc/conform/data/ftw.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct FTW}
element {struct FTW} int base
element {struct FTW} int level
diff --git a/libc/conform/data/glob.h-data b/libc/conform/data/glob.h-data
index 221a3154c..9f90f8b84 100644
--- a/libc/conform/data/glob.h-data
+++ b/libc/conform/data/glob.h-data
@@ -15,7 +15,9 @@ constant GLOB_NOSORT
constant GLOB_ABORTED
constant GLOB_NOMATCH
constant GLOB_NOSPACE
+# if !defined XOPEN2K8 && !defined POSIX2008
constant GLOB_NOSYS
+# endif
function int glob (const char*, int, int (*) (const char*, int), glob_t*)
function void globfree (glob_t *)
diff --git a/libc/conform/data/grp.h-data b/libc/conform/data/grp.h-data
index 91401b31d..16519506e 100644
--- a/libc/conform/data/grp.h-data
+++ b/libc/conform/data/grp.h-data
@@ -7,6 +7,9 @@ element {struct group} {char**} gr_mem
# ifndef POSIX
type gid_t
# endif
+# if defined XOPEN2K8 || defined POSIX2008
+type size_t
+# endif
function {struct group*} getgrgid (gid_t)
function {struct group*} getgrnam (const char*)
@@ -15,7 +18,9 @@ function int getgrgid_r (gid_t, struct group*, char *, size_t, struct group**)
function int getgrnam_r (const char *, struct group *, char *, size_t, struct group**)
function {struct group*} getgrent (void)
function void endgrent (void)
+# ifndef POSIX2008
function void setgrent (void)
+# endif
# endif
allow gr_*
diff --git a/libc/conform/data/iconv.h-data b/libc/conform/data/iconv.h-data
index f1e2ea052..7071d90f6 100644
--- a/libc/conform/data/iconv.h-data
+++ b/libc/conform/data/iconv.h-data
@@ -1,5 +1,8 @@
#if !defined ISO && !defined POSIX
type iconv_t
+# if defined XOPEN2K8 || defined POSIX2008
+type size_t
+# endif
function iconv_t iconv_open (const char*, const char*)
function size_t iconv (iconv_t, char**, size_t*, char**, size_t*)
diff --git a/libc/conform/data/inttypes.h-data b/libc/conform/data/inttypes.h-data
index 93e4713c9..17d2b9717 100644
--- a/libc/conform/data/inttypes.h-data
+++ b/libc/conform/data/inttypes.h-data
@@ -17,8 +17,8 @@ function intmax_t imaxabs (intmax_t)
function imaxdiv_t imaxdiv (intmax_t, intmax_t)
function intmax_t strtoimax (const char*, char**, int)
function uintmax_t strtoumax (const char*, char**, int)
-function intmax_t wcstoimax (const wchar_t*, wchar_t**, int)
-function uintmax_t wcstoumax (const wchar_t*, wchar_t**, int)
+function intmax_t wcstoimax (const __gwchar_t*, __gwchar_t**, int)
+function uintmax_t wcstoumax (const __gwchar_t*, __gwchar_t**, int)
allow PRI*
allow SCN*
diff --git a/libc/conform/data/langinfo.h-data b/libc/conform/data/langinfo.h-data
index 2fe38a266..95bc3f934 100644
--- a/libc/conform/data/langinfo.h-data
+++ b/libc/conform/data/langinfo.h-data
@@ -55,7 +55,15 @@ constant YESEXPR
constant NOEXPR
constant CRNCYSTR
+type nl_item
+# if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+# endif
+
function {char*} nl_langinfo (nl_item)
+# if defined XOPEN2K8 || defined POSIX2008
+function {char*} nl_langinfo_l (nl_item, locale_t)
+# endif
allow-header nl_types.h
diff --git a/libc/conform/data/libgen.h-data b/libc/conform/data/libgen.h-data
index ca0126fbb..b749b8dcd 100644
--- a/libc/conform/data/libgen.h-data
+++ b/libc/conform/data/libgen.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function {char*} basename (char*)
function {char*} dirname (char*)
diff --git a/libc/conform/data/limits.h-data b/libc/conform/data/limits.h-data
index 9801ddeb8..2e720a9b7 100644
--- a/libc/conform/data/limits.h-data
+++ b/libc/conform/data/limits.h-data
@@ -11,7 +11,9 @@ allow LOGIN_NAME_MAX
allow MQ_OPEN_MAX
allow OPEN_MAX
allow PAGESIZE
+#if !defined POSIX && !defined POSIX2008
allow PAGE_SIZE
+#endif
allow PTHREAD_DESTRUCTOR_ITERATIONS
allow PTHREAD_KEYS_MAX
allow PTHREAD_STACK_MIN
@@ -131,12 +133,18 @@ constant SHRT_MIN <= -32767
optional-constant CHARCLASS_NAME_MAX >= 14
optional-constant NL_ARGMAX >= 9
+#if !defined POSIX && !defined POSIX2008
optional-constant NL_LANGMAX >= 14
+#endif
optional-constant NL_MSGMAX >= 32767
+#if !defined XOPEN2K8 && !defined POSIX2008
optional-constant NL_NMAX
+#endif
optional-constant NL_SETMAX >= 255
optional-constant NL_TEXTMAX
+#if !defined POSIX && !defined POSIX2008
optional-constant NZERO >= 20
+#endif
optional-constant TMP_MAX >= 10000
allow *_MAX
diff --git a/libc/conform/data/locale.h-data b/libc/conform/data/locale.h-data
index 84bd6abc0..f6e6c22c8 100644
--- a/libc/conform/data/locale.h-data
+++ b/libc/conform/data/locale.h-data
@@ -17,7 +17,7 @@ element {struct lconv} char p_cs_precedes
element {struct lconv} char p_sep_by_space
element {struct lconv} char p_sign_posn
element {struct lconv} {char*} thousands_sep
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
element {struct lconv} char int_n_cs_precedes
element {struct lconv} char int_n_sep_by_space
element {struct lconv} char int_n_sign_posn
@@ -36,8 +36,31 @@ macro LC_MONETARY
macro LC_NUMERIC
macro LC_TIME
+#if defined XOPEN2K8 || defined POSIX2008
+constant LC_GLOBAL_LOCALE
+
+macro LC_COLLATE_MASK
+macro LC_CTYPE_MASK
+macro LC_MESSAGES_MASK
+macro LC_MONETARY_MASK
+macro LC_NUMERIC_MASK
+macro LC_TIME_MASK
+macro LC_ALL_MASK
+
+type locale_t
+#endif
+
function {struct lconv*} localeconv (void)
function {char*} setlocale (int, const char*)
+#if defined XOPEN2K8 || defined POSIX2008
+function locale_t duplocale (locale_t)
+function void freelocale (locale_t)
+function locale_t newlocale (int, const char*, locale_t)
+function locale_t uselocale (locale_t)
+#endif
allow LC_*
allow *_t
+#if defined XOPEN2K8 || defined POSIX2008
+allow LC_*_MASK
+#endif
diff --git a/libc/conform/data/math.h-data b/libc/conform/data/math.h-data
index 40312effd..f55e63298 100644
--- a/libc/conform/data/math.h-data
+++ b/libc/conform/data/math.h-data
@@ -12,6 +12,7 @@ macro islessequal
macro islessgreater
macro isunordered
+# ifndef POSIX2008
constant M_E
constant M_LOG2E
constant M_LOG10E
@@ -27,6 +28,7 @@ constant M_SQRT2
constant M_SQRT1_2
constant MAXFLOAT
+# endif
constant HUGE_VAL
constant HUGE_VALF
constant HUGE_VALL
@@ -50,6 +52,8 @@ macro MATH_ERRNO == 1
macro MATH_ERREXCEPT == 2
#endif
+macro math_errhandling
+
function double acos (double)
function double asin (double)
function double atan (double)
@@ -77,17 +81,22 @@ function double tan (double)
function double tanh (double)
function double erf (double)
function double erfc (double)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function double gamma (double)
+#endif
function double hypot (double, double)
+#if !defined POSIX && !defined POSIX2008
function double j0 (double)
function double j1 (double)
function double jn (int, double)
+#endif
function double lgamma (double)
function double tgamma (double)
+#if !defined POSIX && !defined POSIX2008
function double y0 (double)
function double y1 (double)
function double yn (int, double)
-function int isnan (double)
+#endif
function double acosh (double)
function double asinh (double)
function double atanh (double)
@@ -108,7 +117,9 @@ function {long long} llrint (double)
function long lround (double)
function {long long} llround (double)
function double remquo (double, double, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function double scalb (double, double)
+#endif
function double scalbn (double, int)
function double scalbln (double, long)
function double fdim (double, double)
@@ -117,8 +128,10 @@ function double fmin (double, double)
function double fma (double, double, double)
function double nan (const char*)
+#if !defined POSIX && !defined POSIX2008
// variable signgam
allow signgam
+#endif
#if !defined ISO && !defined POSIX
function float acosf (float)
@@ -148,17 +161,22 @@ function float tanf (float)
function float tanhf (float)
function float erff (float)
function float erfcf (float)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function float gammaf (float)
+#endif
function float hypotf (float, float)
+#if !defined POSIX && !defined POSIX2008
function float j0f (float)
function float j1f (float)
function float jnf (int, float)
+#endif
function float lgammaf (float)
function float tgammaf (float)
+#if !defined POSIX && !defined POSIX2008
function float y0f (float)
function float y1f (float)
function float ynf (int, float)
-function int isnanf (float)
+#endif
function float acoshf (float)
function float asinhf (float)
function float atanhf (float)
@@ -179,7 +197,9 @@ function {long long} llrintf (float)
function long lroundf (float)
function {long long} llroundf (float)
function float remquof (float, float, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function float scalbf (float, float)
+#endif
function float scalbnf (float, int)
function float scalblnf (float, long)
function float fdimf (float, float)
@@ -215,17 +235,22 @@ function {long double} tanl (long double)
function {long double} tanhl (long double)
function {long double} erfl (long double)
function {long double} erfcl (long double)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function {long double} gammal (long double)
+#endif
function {long double} hypotl (long double, long double)
+#if !defined POSIX && !defined POSIX2008
function {long double} j0l (long double)
function {long double} j1l (long double)
function {long double} jnl (int, long double)
+#endif
function {long double} lgammal (long double)
function {long double} tgammal (long double)
+#if !defined POSIX && !defined POSIX2008
function {long double} y0l (long double)
function {long double} y1l (long double)
function {long double} ynl (int, long double)
-function int isnanl (long double)
+#endif
function {long double} acoshl (long double)
function {long double} asinhl (long double)
function {long double} atanhl (long double)
@@ -246,7 +271,9 @@ function {long long} llrintl (long double)
function long lroundl (long double)
function {long long} llroundl (long double)
function {long double} remquol (long double, long double, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function {long double} scalbl (long double, long double)
+#endif
function {long double} scalbnl (long double, int)
function {long double} scalblnl (long double, long)
function {long double} fdiml (long double, long double)
diff --git a/libc/conform/data/monetary.h-data b/libc/conform/data/monetary.h-data
index eab8384d7..7935f2ab8 100644
--- a/libc/conform/data/monetary.h-data
+++ b/libc/conform/data/monetary.h-data
@@ -1,8 +1,14 @@
#if !defined ISO && !defined POSIX
type size_t
type ssize_t
+# if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+# endif
function ssize_t strfmon (char*, size_t, const char*, ...)
+# if defined XOPEN2K8 || defined POSIX2008
+function ssize_t strfmon_l (char*, size_t, locale_t, const char*, ...)
+# endif
allow *_t
#endif
diff --git a/libc/conform/data/mqueue.h-data b/libc/conform/data/mqueue.h-data
index 6ec1e312d..16335a556 100644
--- a/libc/conform/data/mqueue.h-data
+++ b/libc/conform/data/mqueue.h-data
@@ -18,11 +18,19 @@ function ssize_t mq_receive (mqd_t, char*, size_t, unsigned int*)
function int mq_send (mqd_t, const char*, size_t, unsigned int)
function int mq_setattr (mqd_t, const struct mq_attr*, struct mq_attr*)
function int mq_unlink (const char*)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
optional-function ssize_t mq_timedreceive (mqd_t, char*, size_t, unsigned int*, const struct timespec*)
optional-function int mq_timedsend (mqd_t, const char*, size_t, unsigned int, const struct timespec*)
#endif
+#if defined XOPEN2K8 || defined POSIX2008
+type pthread_attr_t
+type size_t
+type ssize_t
+type {struct timespec}
+type {struct sigevent}
+#endif
+
allow-header fcntl.h
allow-header signal.h
allow-header sys/types.h
diff --git a/libc/conform/data/ndbm.h-data b/libc/conform/data/ndbm.h-data
index 6e606e589..af091de0f 100644
--- a/libc/conform/data/ndbm.h-data
+++ b/libc/conform/data/ndbm.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type datum
element datum {void*} dptr
element datum size_t dsize
diff --git a/libc/conform/data/netdb.h-data b/libc/conform/data/netdb.h-data
index 483a3fcc9..254ea6502 100644
--- a/libc/conform/data/netdb.h-data
+++ b/libc/conform/data/netdb.h-data
@@ -34,6 +34,7 @@ element {struct servent} {char*} s_proto
macro IPPORT_RESERVED
+#if !defined XOPEN2K8 && !defined POSIX2008
// variable int h_errno
allow h_errno
@@ -41,6 +42,7 @@ macro HOST_NOT_FOUND
macro NO_DATA
macro NO_RECOVERY
macro TRY_AGAIN
+#endif
type {struct addrinfo}
element {struct addrinfo} int ai_flags
diff --git a/libc/conform/data/pthread.h-data b/libc/conform/data/pthread.h-data
index aa5861f1d..5a536c7bf 100644
--- a/libc/conform/data/pthread.h-data
+++ b/libc/conform/data/pthread.h-data
@@ -25,6 +25,10 @@ macro PTHREAD_MUTEX_INITIALIZER
constant PTHREAD_MUTEX_RECURSIVE
macro PTHREAD_RWLOCK_INITIALIZER
# endif
+# if defined XOPEN2K8 || defined POSIX2008
+constant PTHREAD_MUTEX_ROBUST
+constant PTHREAD_MUTEX_STALLED
+# endif
type pthread_attr_t
type pthread_barrier_t
@@ -90,7 +94,7 @@ function int pthread_create (pthread_t*, const pthread_attr_t*, void *(*) (void*
function int pthread_detach (pthread_t)
function int pthread_equal (pthread_t, pthread_t)
function void pthread_exit (void*)
-# ifndef POSIX
+# if !defined POSIX && !defined POSIX2008
function int pthread_getconcurrency (void)
# endif
function int pthread_getcpuclockid (pthread_t, clockid_t*)
@@ -135,12 +139,12 @@ function int pthread_rwlockattr_setpshared (pthread_rwlockattr_t*, int)
function pthread_t pthread_self (void)
function int pthread_setcancelstate (int, int*)
function int pthread_setcanceltype (int, int*)
-# ifndef POSIX
+# if !defined POSIX && !defined POSIX2008
function int pthread_setconcurrency (int)
# endif
function int pthread_setschedparam (pthread_t, int, const struct sched_param*)
function int pthread_setspecific (pthread_key_t, const void*)
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int pthread_sigmask (int, const sigset_t*, sigset_t*)
#endif
function int pthread_spin_destroy (pthread_spinlock_t*)
@@ -149,6 +153,11 @@ function int pthread_spin_lock (pthread_spinlock_t*)
function int pthread_spin_trylock (pthread_spinlock_t*)
function int pthread_spin_unlock (pthread_spinlock_t*)
function void pthread_testcancel (void)
+# if defined XOPEN2K8 || defined POSIX2008
+function int pthread_mutex_consistent (pthread_mutex_t *)
+function int pthread_mutexattr_getrobust (__const pthread_mutexattr_t*, int*)
+function int pthread_mutexattr_setrobust (pthread_mutexattr_t*, int)
+# endif
allow-header sched.h
allow-header time.h
diff --git a/libc/conform/data/pwd.h-data b/libc/conform/data/pwd.h-data
index 1267708b9..a8edf2773 100644
--- a/libc/conform/data/pwd.h-data
+++ b/libc/conform/data/pwd.h-data
@@ -9,15 +9,20 @@ element {struct passwd} {char*} pw_shell
# ifndef POSIX
type uid_t
type gid_t
+# if defined XOPEN2K8 || defined POSIX2008
+type size_t
+# endif
# endif
function {struct passwd*} getpwnam (const char*)
function {struct passwd*} getpwuid (uid_t)
function int getpwnam_r (const char*, struct passwd*, char*, size_t, struct passwd**)
function int getpwuid_r (uid_t, struct passwd*, char*, size_t, struct passwd**)
+# ifndef POSIX2008
function void endpwent (void)
function {struct passwd*} getpwent (void)
function void setpwent (void)
+# endif
allow pw_*
allow *_t
diff --git a/libc/conform/data/regex.h-data b/libc/conform/data/regex.h-data
index 38495d5b8..73e06a826 100644
--- a/libc/conform/data/regex.h-data
+++ b/libc/conform/data/regex.h-data
@@ -28,7 +28,9 @@ constant REG_EBRACE
constant REG_BADBR
constant REG_ESPACE
constant REG_BADRPT
+# if !defined XOPEN2K8 && !defined POSIX2008
constant REG_ENOSYS
+# endif
function int regcomp (regex_t*, const char*, int)
function int regexec (const regex_t*, const char*, size_t, regmatch_t[], int)
diff --git a/libc/conform/data/sched.h-data b/libc/conform/data/sched.h-data
index d4c5ae72c..585145011 100644
--- a/libc/conform/data/sched.h-data
+++ b/libc/conform/data/sched.h-data
@@ -6,6 +6,12 @@ optional-element {struct sched_param} {struct timespec} sched_ss_repl_period
optional-element {struct sched_param} {struct timespec} sched_ss_init_budget
optional-element {struct sched_param} int sched_ss_max_repl
+# if defined XOPEN2K8 || defined POSIX2008
+type pid_t
+type time_t
+type {struct timespec}
+# endif
+
constant SCHED_FIFO
constant SCHED_RR
optional-constant SCHED_SPORADIC
diff --git a/libc/conform/data/search.h-data b/libc/conform/data/search.h-data
index da7f2a133..dadb1ff71 100644
--- a/libc/conform/data/search.h-data
+++ b/libc/conform/data/search.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type ENTRY
type {struct entry}
element {struct entry} {char*} key
diff --git a/libc/conform/data/semaphore.h-data b/libc/conform/data/semaphore.h-data
index 20fe0706b..5484884ff 100644
--- a/libc/conform/data/semaphore.h-data
+++ b/libc/conform/data/semaphore.h-data
@@ -14,7 +14,7 @@ function int sem_trywait (sem_t*)
function int sem_unlink (const char*)
function int sem_wait (sem_t*)
-# if !defined POSIX
+# ifndef POSIX
allow-header fcntl.h
allow-header sys/types.h
# endif
diff --git a/libc/conform/data/setjmp.h-data b/libc/conform/data/setjmp.h-data
index ef29c9cbe..a89a33fa7 100644
--- a/libc/conform/data/setjmp.h-data
+++ b/libc/conform/data/setjmp.h-data
@@ -6,7 +6,7 @@ type sigjmp_buf
function void longjmp (jmp_buf, int)
#ifndef ISO
function void siglongjmp (sigjmp_buf, int)
-# ifndef POSIX
+# if !defined POSIX && !defined POSIX2008
function void _longjmp (jmp_buf, int)
# endif
#endif
@@ -14,7 +14,7 @@ function void _longjmp (jmp_buf, int)
macro-function int setjmp (jmp_buf)
#ifndef ISO
macro-function int sigsetjmp (sigjmp_buf, int)
-# ifndef POSIX
+# if !defined POSIX && !defined POSIX2008
macro-function int _setjmp (jmp_buf)
# endif
#endif
diff --git a/libc/conform/data/signal.h-data b/libc/conform/data/signal.h-data
index 95bd37299..6dbf1fb84 100644
--- a/libc/conform/data/signal.h-data
+++ b/libc/conform/data/signal.h-data
@@ -1,11 +1,30 @@
typed-constant SIG_DFL {void(*)(int)}
typed-constant SIG_ERR {void(*)(int)}
+#if !defined ISO && !defined POSIX && !defined POSIX2008
typed-constant SIG_HOLD {void(*)(int)}
+#endif
typed-constant SIG_IGN {void(*)(int)}
type sig_atomic_t
type sigset_t
type pid_t
+#if defined XOPEN2K8 || defined POSIX2008
+type size_t
+type pthread_t
+type uid_t
+
+type mcontext_t
+
+type ucontext_t
+element ucontext_t {ucontext_t*} uc_link
+element ucontext_t sigset_t uc_sigmask
+element ucontext_t stack_t uc_stack
+element ucontext_t mcontext_t uc_mcontext
+
+type {struct timespec}
+element {struct timespec} __time_t tv_sec
+element {struct timespec} long tv_nsec
+#endif
element {union sigval} int sival_int
element {union sigval} {void*} sival_ptr
@@ -52,7 +71,9 @@ constant SIGBUS
constant SIGPOLL
constant SIGPROF
constant SIGSYS
+#if !defined POSIX && !defined POSIX2008
constant SIGTRAP
+#endif
constant SIGURG
constant SIGVTALRM
constant SIGXCPU
@@ -69,16 +90,20 @@ constant SA_NOCLDSTOP
constant SIG_BLOCK
constant SIG_UNBLOCK
constant SIG_SETMASK
+#if !defined POSIX && !defined POSIX2008
constant SA_ONSTACK
+#endif
constant SA_RESETHAND
constant SA_RESTART
constant SA_SIGINFO
constant SA_NOCLDWAIT
constant SA_NODEFER
+#if !defined POSIX && !defined POSIX2008
constant SS_ONSTACK
constant SS_DISABLE
constant MINSIGSTKSZ
constant SIGSTKSZ
+#endif
type ucontext_t
@@ -101,7 +126,9 @@ element {struct sigstack} {void*} ss_sp
type siginfo_t
element siginfo_t int si_signo
+#if !defined POSIX && !defined POSIX2008
element siginfo_t int si_errno
+#endif
element siginfo_t int si_code
element siginfo_t pid_t si_pid
element siginfo_t uid_t si_uid
@@ -151,34 +178,50 @@ constant SI_TIMER
constant SI_ASYNCIO
constant SI_MESGQ
+#if !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function void (*bsd_signal (int, void(*)(int)))(int)
+#endif
function int kill (pid_t, int)
+#if !defined POSIX && !defined POSIX2008
function int killpg (pid_t, int)
+#endif
function int pthread_kill (pthread_t, int)
function int pthread_sigmask (int, const sigset_t*, sigset_t*)
function int raise (int)
function int sigaction (int, const struct sigaction*, struct sigaction*)
function int sigaddset (sigset_t*, int)
+#if !defined POSIX && !defined POSIX2008
function int sigaltstack (const stack_t*, stack_t*)
+#endif
function int sigdelset (sigset_t*, int)
function int sigemptyset (sigset_t*)
function int sigfillset (sigset_t*)
+#if !defined POSIX && !defined POSIX2008
function int sighold (int)
function int sigignore (int)
function int siginterrupt (int, int)
+#endif
function int sigismember (const sigset_t*, int)
function void (*signal (int, void(*)(int)))(int)
+#if !defined POSIX && !defined POSIX2008
function int sigpause (int)
+#endif
function int sigpending (sigset_t*)
function int sigprocmask (int, const sigset_t*, sigset_t*)
function int sigqueue (pid_t, int, const union sigval)
+#if !defined POSIX && !defined POSIX2008
function int sigrelse (int)
function void (*sigset (int, void(*)(int)))(int)
+#endif
function int sigstack (struct sigstack*, struct sigstack*)
function int sigsuspend (const sigset_t*)
function int sigtimedwait (const sigset_t*, siginfo_t*, const struct timespec*)
function int sigwait (const sigset_t*, int*)
function int sigwaitinfo (const sigset_t*, siginfo_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function void psiginfo (const siginfo_t*, const char*)
+function void psignal (int, const char*)
+#endif
// The following expressions are not entirely correct but the current
// poorfnmatch implementation doesn't grok the right form.
diff --git a/libc/conform/data/spawn.h-data b/libc/conform/data/spawn.h-data
index 8afca0221..81f32d030 100644
--- a/libc/conform/data/spawn.h-data
+++ b/libc/conform/data/spawn.h-data
@@ -1,6 +1,12 @@
#ifndef ISO
type posix_spawnattr_t
type posix_spawn_file_actions_t
+# if defined XOPEN2K8 || defined POSIX2008
+type mode_t
+type pid_t
+type sigset_t
+type {struct sched_param}
+# endif
constant POSIX_SPAWN_RESETIDS
constant POSIX_SPAWN_SETPGROUP
diff --git a/libc/conform/data/stdio.h-data b/libc/conform/data/stdio.h-data
index c3f071e8f..cba7721d9 100644
--- a/libc/conform/data/stdio.h-data
+++ b/libc/conform/data/stdio.h-data
@@ -7,7 +7,9 @@ constant _IOLBF
constant _IONBF
constant L_ctermid
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
constant L_cuserid
+#endif
constant L_tmpnam
constant SEEK_CUR
@@ -20,7 +22,9 @@ constant EOF
constant NULL
+#if !defined POSIX && !defined POSIX2008
constant P_tmpdir
+#endif
macro stdin
macro stdout
@@ -30,10 +34,19 @@ type FILE
type fpos_t
type va_list
type size_t
+#if defined XOPEN2K8 || defined POSIX2008
+type off_t
+type ssize_t
+#endif
function void clearerr (FILE*)
function {char*} ctermid (char*)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function {char*} cuserid (char*)
+#endif
+#if defined XOPEN2K8 || defined POSIX2008
+function int dprintf (int, const char*, ...)
+#endif
function int fclose (FILE*)
function {FILE*} fdopen (int, const char*)
function int feof (FILE*)
@@ -44,6 +57,9 @@ function int fgetpos (FILE*, fpos_t*)
function {char*} fgets (char*, int, FILE*)
function int fileno (FILE*)
function void flockfile (FILE*)
+#if defined XOPEN2K8 || defined POSIX2008
+function {FILE*} fmemopen (void*, size_t, const char*)
+#endif
function {FILE*} fopen (const char*, const char*)
function int fprintf (FILE*, const char*, ...)
function int fputc (int, FILE*)
@@ -63,13 +79,20 @@ function int getc (FILE*)
function int getchar (void)
function int getc_unlocked (FILE*)
function int getchar_unlocked ()
-#ifndef XOPEN2K
+#if defined XOPEN2K8 || defined POSIX2008
+function ssize_t getdelim (char**, size_t*, int, FILE*)
+function ssize_t getline (char**, size_t*, FILE*)
+#endif
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int getopt (int, char *const[], const char *)
#endif
function {char*} gets (char*)
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int getw (FILE*)
#endif
+#if defined XOPEN2K8 || defined POSIX2008
+function {FILE*} open_memstream (char**, size_t*)
+#endif
function int pclose (FILE*)
function void perror (const char*)
function {FILE*} popen (const char*, const char*)
@@ -79,11 +102,14 @@ function int putchar (int)
function int putc_unlocked (int, FILE*)
function int putchar_unlocked (int)
function int puts (const char*)
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int putw (int, FILE*)
#endif
function int remove (const char*)
function int rename (const char*, const char*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int renameat (int, const char*, int, const char*)
+#endif
function void rewind (FILE*)
function int scanf (const char*, ...)
function void setbuf (FILE*, char*)
@@ -91,26 +117,31 @@ function int setvbuf (FILE*, char*, int, size_t)
function int snprintf (char*, size_t, const char*, ...)
function int sprintf (char *, const char *, ...)
function int sscanf (const char*, const char*, ...)
+#if !defined POSIX && !defined POSIX2008
function {char*} tempnam (const char*, const char*)
+#endif
function {FILE*} tmpfile (void)
function {char*} tmpnam (char*)
function int ungetc (int, FILE*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int vdprintf (int, const char*, va_list)
+#endif
function int vfprintf (FILE*, const char*, va_list)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int vfscanf (FILE*, const char*, va_list)
#endif
function int vprintf (const char*, va_list)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int vscanf (const char*, va_list)
#endif
function int vsnprintf (char*, size_t, const char*, va_list)
function int vsprintf (char*, const char*, va_list)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int vsscanf (const char*, const char*, va_list)
#endif
#if !defined ISO && !defined POSIX
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
variable {char*} optarg
variable int opterr
variable int optind
diff --git a/libc/conform/data/stdlib.h-data b/libc/conform/data/stdlib.h-data
index c639bb52d..760b5b3b4 100644
--- a/libc/conform/data/stdlib.h-data
+++ b/libc/conform/data/stdlib.h-data
@@ -10,7 +10,7 @@ element div_t int rem
type ldiv_t
element ldiv_t long quot
element ldiv_t long rem
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
type lldiv_t
element lldiv_t {long long} quot
element lldiv_t {long long} rem
@@ -29,77 +29,116 @@ macro WSTOPSIG
macro WTERMSIG
function void _Exit (int)
+#if !defined POSIX && !defined POSIX2008
function long a64l (const char*)
+#endif
function void abort (void)
function int abs (int)
function int atexit (void(*)(void))
function double atof (const char*)
function int atoi (const char*)
function {long int} atol (const char*)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function {long long} atoll (const char*)
#endif
function {void*} bsearch (const void*, const void*, size_t, size_t, int(*)(const void*, const void*))
function {void*} calloc (size_t, size_t)
function div_t div (int, int)
+#if !defined POSIX && !defined POSIX2008
function double drand48 (void)
+#endif
+#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
function {char*} ecvt (double, int, int*, int*)
+#endif
+#if !defined POSIX && !defined POSIX2008
function double erand48 (unsigned short int[3])
+#endif
function void exit (int)
+#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
function {char*} fcvt (double, int, int*, int*)
+#endif
function void free (void*)
+#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
function {char*} gcvt (double, int, char*)
+#endif
function {char*} getenv (const char*)
function int getsubopt (char**, char *const*, char**)
+#if !defined POSIX && !defined POSIX2008
function int grantpt (int)
function {char*} initstate (unsigned int, char*, size_t)
function {long int} jrand48 (unsigned short int[3])
function {char*} l64a (long)
+#endif
function {long int} labs (long int)
+#if !defined POSIX && !defined POSIX2008
function void lcong48 (unsigned short int[7])
+#endif
function ldiv_t ldiv (long int, long int)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function {long long} llabs (long long)
function lldiv_t lldiv (long long, long long)
#endif
+#if !defined POSIX && !defined POSIX2008
function {long int} lrand48 (void)
+#endif
function {void*} malloc (size_t)
function int mblen (const char*, size_t)
function size_t mbstowcs (wchar_t*, const char*, size_t)
function int mbtowc (wchar_t*, const char*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function {char*} mkdtemp (char*)
+#endif
+#if !defined XOPEN2K8 && !defined POSIX2008
function {char*} mktemp (char*)
+#endif
function int mkstemp (char*)
+#if !defined POSIX && !defined POSIX2008
function {long int} mrand48 (void)
function {long int} nrand48 (unsigned short int[3])
+#endif
function int posix_memalign (void**, size_t, size_t)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8
function int posix_openpt (int)
#endif
+#if !defined POSIX && !defined POSIX2008
function {char*} ptsname (int)
function int putenv (char*)
+#endif
function void qsort (void*, size_t, size_t, int(*)(const void*, const void*))
function int rand (void)
function int rand_r (unsigned int*)
+#if !defined POSIX && !defined POSIX2008
function long random (void)
+#endif
function {void*} realloc (void*, size_t)
+#if !defined POSIX && !defined POSIX2008
function {char*} realpath (const char*, char*)
function {unsigned short int*} seed48 (unsigned short int[3])
+#endif
function int setenv (const char*, const char*, int)
+#if !defined POSIX && !defined POSIX2008
function void setkey (const char*)
function {char*} setstate (char*)
+#endif
function void srand (unsigned int)
+#if !defined POSIX && !defined POSIX2008
function void srand48 (long int)
function void srandom (unsigned)
+#endif
function double strtod (const char*, char**)
function {long int} strtol (const char*, char**, int)
function {unsigned long int} strtoul (const char*, char**, int)
function int system (const char*)
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int ttyslot (void)
#endif
+#if !defined POSIX && !defined POSIX2008
function int unlockpt (int)
+#endif
function int unsetenv (const char*)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function {void*} valloc (size_t)
+#endif
function size_t wcstombs (char*, const wchar_t*, size_t)
function int wctomb (char*, wchar_t)
diff --git a/libc/conform/data/string.h-data b/libc/conform/data/string.h-data
index 19c06d292..1c4ae0814 100644
--- a/libc/conform/data/string.h-data
+++ b/libc/conform/data/string.h-data
@@ -1,35 +1,61 @@
constant NULL
type size_t
+#if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+#endif
+#if !defined POSIX && !defined POSIX2008
function {void*} memccpy (void*, const void*, int, size_t)
+#endif
function {void*} memchr (const void*, int, size_t)
function int memcmp (const void*, const void*, size_t)
function {void*} memcpy (void*, const void*, size_t)
function {void*} memmove (void*, const void*, size_t)
function {void*} memset (void*, int, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function {char*} stpcpy (char*, const char*)
+function {char*} stpncpy (char*, const char*, size_t)
+
+#endif
function {char*} strcat (char*, const char*)
function {char*} strchr (const char*, int)
function int strcmp (const char*, const char*)
function int strcoll (const char*, const char*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int strcoll_l (const char*, const char*, locale_t)
+#endif
function {char*} strcpy (char*, const char*)
function size_t strcspn (const char*, const char*)
function {char*} strdup (const char*)
function {char*} strerror (int)
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int strerror_r (int, char*, size_t)
#endif
+#if defined XOPEN2K8 || defined POSIX2008
+function {char*} strerror_l (int, locale_t)
+#endif
function size_t strlen (const char*)
function {char*} strncat (char*, const char*, size_t)
function int strncmp (const char*, const char*, size_t)
function {char*} strncpy (char*, const char*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function {char*} strndup (const char*, size_t)
+function size_t strnlen (const char*, size_t)
+#endif
function {char*} strpbrk (const char*, const char*)
function {char*} strrchr (const char*, int)
+#if defined XOPEN2K8 || defined POSIX2008
+function {char*} strsignal (int)
+#endif
function size_t strspn (const char*, const char*)
function {char*} strstr (const char*, const char*)
function {char*} strtok (char*, const char*)
function {char*} strtok_r (char*, const char*, char**)
function size_t strxfrm (char*, const char*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function size_t strxfrm_l (char*, const char*, size_t, locale_t)
+#endif
allow-header stddef.h
diff --git a/libc/conform/data/strings.h-data b/libc/conform/data/strings.h-data
index 201780c8d..01cd86742 100644
--- a/libc/conform/data/strings.h-data
+++ b/libc/conform/data/strings.h-data
@@ -1,12 +1,23 @@
+#if !defined XOPEN2K8 && !defined POSIX2008
function int bcmp (const void*, const void*, size_t)
function void bcopy (const void*, void*, size_t)
function void bzero (void*, size_t)
-function int ffs (int)
function {char*} index (const char*, int)
function {char*} rindex (const char*, int)
+#endif
+#if !defined POSIX && !defined POSIX2008
+function int ffs (int)
+#endif
function int strcasecmp (const char*, const char*)
function int strncasecmp (const char*, const char*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function int strcasecmp_l (const char*, const char*, locale_t)
+function int strncasecmp_l (const char*, const char*, size_t, locale_t)
+#endif
type size_t
+#if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+#endif
allow *_t
diff --git a/libc/conform/data/sys/ipc.h-data b/libc/conform/data/sys/ipc.h-data
index 1b2ec99d3..28918c196 100644
--- a/libc/conform/data/sys/ipc.h-data
+++ b/libc/conform/data/sys/ipc.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct ipc_perm}
element {struct ipc_perm} uid_t uid
@@ -26,3 +27,4 @@ function key_t ftok (const char*, int)
allow ipc_*
allow IPC_*
allow *_t
+#endif
diff --git a/libc/conform/data/sys/msg.h-data b/libc/conform/data/sys/msg.h-data
index 7a1df4cbe..ae83356b5 100644
--- a/libc/conform/data/sys/msg.h-data
+++ b/libc/conform/data/sys/msg.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct msqid_ds}
type msgqnum_t
@@ -30,3 +31,4 @@ allow-header sys/ipc.h
allow msg*
allow MSG*
allow *_h
+#endif
diff --git a/libc/conform/data/sys/resource.h-data b/libc/conform/data/sys/resource.h-data
index d9f9b9ab8..52f83f523 100644
--- a/libc/conform/data/sys/resource.h-data
+++ b/libc/conform/data/sys/resource.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
constant PRIO_PROCESS
constant PRIO_PGRP
constant PRIO_USER
@@ -48,3 +49,4 @@ allow RLIM_*
allow RLIMIT_*
allow RUSAGE_*
allow *_t
+#endif
diff --git a/libc/conform/data/sys/select.h-data b/libc/conform/data/sys/select.h-data
index 51f7844cb..ea890d6ae 100644
--- a/libc/conform/data/sys/select.h-data
+++ b/libc/conform/data/sys/select.h-data
@@ -13,16 +13,18 @@ element {struct timespec} time_t tv_sec
element {struct timespec} long tv_nsec
type fd_set
+#if defined XPG3 || defined XPG4 || defined UNIX98
element fd_set long fds_bits []
+#endif
-function-macro void FD_CLR (int, fd_set*)
-function-macro int FD_ISSET (int, fd_set*)
-function-macro void FD_SET (int, fd_set*)
-function-macro void FD_ZERO (fd_set*)
+macro FD_CLR
+macro FD_ISSET
+macro FD_SET
+macro FD_ZERO
macro FD_SETSIZE
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined POSIX2008
function int pselect (int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*)
#endif
function int select (int, fd_set*, fd_set*, fd_set*, struct timeval*)
diff --git a/libc/conform/data/sys/sem.h-data b/libc/conform/data/sys/sem.h-data
index 8b4598b7b..665b397c5 100644
--- a/libc/conform/data/sys/sem.h-data
+++ b/libc/conform/data/sys/sem.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
constant SEM_UNDO
constant GETNCNT
@@ -35,3 +36,4 @@ allow-header sys/ipc.h
allow sem*
allow SEM_*
allow *_t
+#endif
diff --git a/libc/conform/data/sys/shm.h-data b/libc/conform/data/sys/shm.h-data
index cac016340..39df8944a 100644
--- a/libc/conform/data/sys/shm.h-data
+++ b/libc/conform/data/sys/shm.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
constant SHM_RDONLY
symbol SHMLBA
constant SHM_RND
@@ -30,3 +31,4 @@ allow-header sys/ipc.h
allow shm*
allow SHM*
allow *_t
+#endif
diff --git a/libc/conform/data/sys/socket.h-data b/libc/conform/data/sys/socket.h-data
index dd1f265b2..5fdd6cf6b 100644
--- a/libc/conform/data/sys/socket.h-data
+++ b/libc/conform/data/sys/socket.h-data
@@ -3,6 +3,11 @@ type socklen_t
type sa_family_t
+# if defined XOPEN2K8 || defined POSIX2008
+type size_t
+type ssize_t
+# endif
+
type {struct sockaddr}
element {struct sockaddr} sa_family_t sa_family
@@ -76,6 +81,9 @@ macro MSG_OOB
macro MSG_PEEK
macro MSG_TRUNC
macro MSG_WAITALL
+# if defined XOPEN2K8 || defined POSIX2008
+constant MSG_NOSIGNAL
+# endif
macro AF_UNIX
macro AF_UNSPEC
diff --git a/libc/conform/data/sys/stat.h-data b/libc/conform/data/sys/stat.h-data
index c0f8d45a3..df39fd3d8 100644
--- a/libc/conform/data/sys/stat.h-data
+++ b/libc/conform/data/sys/stat.h-data
@@ -8,16 +8,22 @@ element {struct stat} mode_t st_mode
element {struct stat} nlink_t st_nlink
element {struct stat} uid_t st_uid
element {struct stat} gid_t st_gid
+#if !defined POSIX && !defined POSIX2008
element {struct stat} dev_t st_rdev
+#endif
element {struct stat} off_t st_size
element {struct stat} time_t st_atime
element {struct stat} time_t st_mtime
element {struct stat} time_t st_ctime
+#if !defined POSIX && !defined POSIX2008
element {struct stat} blksize_t st_blksize
element {struct stat} blkcnt_t st_blocks
+#endif
+#if !defined POSIX && !defined POSIX2008
type blkcnt_t
type blksize_t
+#endif
type dev_t
type ino_t
type mode_t
@@ -26,7 +32,13 @@ type uid_t
type gid_t
type off_t
type time_t
+# if defined XOPEN2K8 || defined POSIX2008
+type {struct timespec}
+element {struct timespec} time_t tv_sec
+element {struct timespec} long tv_nsec
+# endif
+#if !defined POSIX && !defined POSIX2008
constant S_IFMT
constant S_IFBLK
constant S_IFCHR
@@ -34,6 +46,8 @@ constant S_IFIFO
constant S_IFREG
constant S_IFDIR
constant S_IFLNK
+constant S_IFSOCK
+#endif
constant S_IRWXU
constant S_IRUSR
@@ -48,14 +62,20 @@ constant S_IWOTH
constant S_IXOTH
constant S_ISUID
constant S_ISGID
+#if !defined POSIX && !defined POSIX2008
constant S_ISVTX
+#endif
+#if !defined POSIX && !defined POSIX2008
+macro S_IFMT
macro S_ISBLK
macro S_ISCHR
macro S_ISDIR
macro S_ISFIFO
macro S_ISREG
macro S_ISLNK
+macro S_IFSOCK
+#endif
// How to represent optional tests?
optional-macro S_TYPEISMQ
@@ -63,15 +83,39 @@ optional-macro S_TYPEISSEM
optional-macro S_TYPEISSHM
optional-macro S_TYPEISTMO
+# if defined XOPEN2K8 || defined POSIX2008
+constant UTIME_NOW
+constant UTIME_OMIT
+# endif
+
function int chmod (const char*, mode_t)
function int fchmod (int, mode_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function int fchmodat (int, const char*, mode_t, int)
+# endif
function int fstat (int, struct stat*)
+# if defined XOPEN2K8 || defined POSIX2008
+function int fstatat (int, const char*, struct stat*, int)
+function int futimens (int, const struct timespec[2])
+# endif
function int lstat (const char*, struct stat*)
function int mkdir (const char*, mode_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function int mkdirat (int, const char*, mode_t)
+# endif
function int mkfifo (const char*, mode_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function int mkfifoat (int, const char*, mode_t)
+# endif
+# if !defined POSIX && !defined POSIX2008
function int mknod (const char*, mode_t, dev_t)
+function int mknodat (int, const char*, mode_t, dev_t)
+# endif
function int stat (const char*, struct stat*)
function mode_t umask (mode_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function int utimensat (int, const char*, const struct timespec[2], int)
+# endif
allow st_*
allow S_*
diff --git a/libc/conform/data/sys/time.h-data b/libc/conform/data/sys/time.h-data
index 174708b53..7e3407ab0 100644
--- a/libc/conform/data/sys/time.h-data
+++ b/libc/conform/data/sys/time.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct timeval}
element {struct timeval} time_t tv_sec
diff --git a/libc/conform/data/sys/types.h-data b/libc/conform/data/sys/types.h-data
index ed7236b8b..4070be5c5 100644
--- a/libc/conform/data/sys/types.h-data
+++ b/libc/conform/data/sys/types.h-data
@@ -1,14 +1,19 @@
+#ifndef ISO
type blkcnt_t
type blksize_t
type clock_t
type clockid_t
type dev_t
+# if !defined POSIX
type fsblkcnt_t
type fsfilcnt_t
+# endif
type gid_t
type id_t
type ino_t
+# if !defined POSIX && !defined POSIX2008
type key_t
+# endif
type mode_t
type nlink_t
type off_t
@@ -28,10 +33,12 @@ type pthread_spinlock_t
type pthread_t
type size_t
type ssize_t
+# if !defined POSIX && !defined POSIX2008
type suseconds_t
+# endif
type time_t
type timer_t
type uid_t
-type useconds_t
allow *_t
+#endif
diff --git a/libc/conform/data/sys/uio.h-data b/libc/conform/data/sys/uio.h-data
index 258032b87..03d0a3bf3 100644
--- a/libc/conform/data/sys/uio.h-data
+++ b/libc/conform/data/sys/uio.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX
type {struct iovec}
element {struct iovec} {void*} iov_base
@@ -10,3 +11,4 @@ allow iov_*
allow IOV_*
allow *_t
allow UIO_MAXIOV
+#endif
diff --git a/libc/conform/data/sys/wait.h-data b/libc/conform/data/sys/wait.h-data
index 731c9551f..2fd4c8dec 100644
--- a/libc/conform/data/sys/wait.h-data
+++ b/libc/conform/data/sys/wait.h-data
@@ -1,8 +1,11 @@
+#ifndef ISO
constant WNOHANG
constant WUNTRACED
macro WEXITSTATUS
+# if !defined POSIX && !defined POSIX2008
macro WIFCONTINUED
+# endif
macro WIFEXITED
macro WIFSIGNALED
macro WIFSTOPPED
@@ -11,7 +14,9 @@ macro WTERMSIG
constant WEXITED
constant WSTOPPED
+# if !defined POSIX && !defined POSIX2008
constant WCONTINUED
+# endif
constant WNOHANG
constant WNOWAIT
@@ -43,7 +48,9 @@ element {struct rusage} {struct timeval} ru_stime
type pid_t
function pid_t wait (int*)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function pid_t wait3 (int*, int, struct rusage*)
+#endif
function int waitid (idtype_t, id_t, siginfo_t*, int)
function pid_t waitpid (pid_t, int*, int)
@@ -62,3 +69,4 @@ allow SEGV_
allow SI_
allow TRAP_
allow *_t
+#endif
diff --git a/libc/conform/data/syslog.h-data b/libc/conform/data/syslog.h-data
index 87414e8a7..f0aa65c69 100644
--- a/libc/conform/data/syslog.h-data
+++ b/libc/conform/data/syslog.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
constant LOG_PID
constant LOG_CONS
constant LOG_NDELAY
@@ -40,3 +41,4 @@ function void syslog (int, const char*, ...)
allow LOG_*
allow *_t
+#endif
diff --git a/libc/conform/data/tar.h-data b/libc/conform/data/tar.h-data
index 919167d92..fcbfb127b 100644
--- a/libc/conform/data/tar.h-data
+++ b/libc/conform/data/tar.h-data
@@ -1,3 +1,4 @@
+#ifndef ISO
macro-str TMAGIC "ustar"
constant TMAGLEN 6
macro-str TVERSION "00"
@@ -15,7 +16,9 @@ constant CONTTYPE
constant TSUID 04000
constant TSGID 02000
+# if !defined POSIX && !defined POSIX2008
constant TSVTX 01000
+# endif
constant TUREAD 00400
constant TUWRITE 00200
constant TUEXEC 00100
@@ -27,3 +30,4 @@ constant TOWRITE 00002
constant TOEXEC 00001
allow *_t
+#endif
diff --git a/libc/conform/data/termios.h-data b/libc/conform/data/termios.h-data
index d867d4cd6..d32bd6bf3 100644
--- a/libc/conform/data/termios.h-data
+++ b/libc/conform/data/termios.h-data
@@ -1,9 +1,14 @@
+#ifndef ISO
type cc_t
type speed_t
type tcflag_t
type {struct termios}
+#if defined XOPEN2K8 || defined POSIX2008
+type pid_t
+#endif
+
element {struct termios} tcflag_t c_iflag
element {struct termios} tcflag_t c_oflag
element {struct termios} tcflag_t c_cflag
@@ -32,18 +37,24 @@ constant IGNPAR
constant INLCR
constant INPCK
constant ISTRIP
+# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
constant IUCLC
+# <endif
constant IXANY
constant IXOFF
constant IXON
constant PARMRK
constant OPOST
+# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
constant OLCUC
+# endif
+# if !defined POSIX && !defined POSIX2008
constant ONLCR
constant OCRNL
constant ONOCR
constant ONLRET
+constant OFDEL
constant OFILL
constant NLDLY
constant NL0
@@ -67,6 +78,7 @@ constant VT1
constant FFDLY
constant FF0
constant FF1
+# endif
constant B0
constant B50
@@ -106,7 +118,9 @@ constant IEXTEN
constant ISIG
constant NOFLSH
constant TOSTOP
+# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
constant XCASE
+# endif
constant TCSANOW
constant TCSADRAIN
@@ -157,3 +171,4 @@ allow O*
allow TC*
allow B*
allow *_t
+#endif
diff --git a/libc/conform/data/tgmath.h-data b/libc/conform/data/tgmath.h-data
index 2a6bd0cd9..ce4f301de 100644
--- a/libc/conform/data/tgmath.h-data
+++ b/libc/conform/data/tgmath.h-data
@@ -1,4 +1,4 @@
-#ifdef XOPEN2K
+#if defined XOPEN2K || defined POSIX2008
// <math.h>
macro fpclassify
macro isfinite
@@ -13,6 +13,7 @@ macro islessequal
macro islessgreater
macro isunordered
+#ifndef POSIX2008
constant M_E
constant M_LOG2E
constant M_LOG10E
@@ -28,6 +29,7 @@ constant M_SQRT2
constant M_SQRT1_2
constant MAXFLOAT
+#endif
constant HUGE_VAL
constant HUGE_VALF
constant HUGE_VALL
@@ -50,6 +52,8 @@ constant FP_ILOGBNAN
macro MATH_ERRNO == 1
macro MATH_ERREXCEPT == 2
+macro math_errhandling
+
function double acos (double)
function double asin (double)
function double atan (double)
@@ -77,17 +81,22 @@ function double tan (double)
function double tanh (double)
function double erf (double)
function double erfc (double)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function double gamma (double)
+#endif
function double hypot (double, double)
+#if !defined POSIX && !defined POSIX2008
function double j0 (double)
function double j1 (double)
function double jn (int, double)
+#endif
function double lgamma (double)
function double tgamma (double)
+#if !defined POSIX && !defined POSIX2008
function double y0 (double)
function double y1 (double)
function double yn (int, double)
-function int isnan (double)
+#endif
function double acosh (double)
function double asinh (double)
function double atanh (double)
@@ -108,7 +117,9 @@ function {long long} llrint (double)
function long lround (double)
function {long long} llround (double)
function double remquo (double, double, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function double scalb (double, double)
+#endif
function double scalbn (double, int)
function double scalbln (double, long)
function double fdim (double, double)
@@ -147,17 +158,22 @@ function float tanf (float)
function float tanhf (float)
function float erff (float)
function float erfcf (float)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function float gammaf (float)
+#endif
function float hypotf (float, float)
+#if !defined POSIX && !defined POSIX2008
function float j0f (float)
function float j1f (float)
function float jnf (int, float)
+#endif
function float lgammaf (float)
function float tgammaf (float)
+#if !defined POSIX && !defined POSIX2008
function float y0f (float)
function float y1f (float)
function float ynf (int, float)
-function int isnanf (float)
+#endif
function float acoshf (float)
function float asinhf (float)
function float atanhf (float)
@@ -178,7 +194,9 @@ function {long long} llrintf (float)
function long lroundf (float)
function {long long} llroundf (float)
function float remquof (float, float, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function float scalbf (float, float)
+#endif
function float scalbnf (float, int)
function float scalblnf (float, long)
function float fdimf (float, float)
@@ -214,17 +232,22 @@ function {long double} tanl (long double)
function {long double} tanhl (long double)
function {long double} erfl (long double)
function {long double} erfcl (long double)
+#if defined XPG3 || defined XPG4 || defined UNIX98
function {long double} gammal (long double)
+#endif
function {long double} hypotl (long double, long double)
+#if !defined POSIX && !defined POSIX2008
function {long double} j0l (long double)
function {long double} j1l (long double)
function {long double} jnl (int, long double)
+#endif
function {long double} lgammal (long double)
function {long double} tgammal (long double)
+#if !defined POSIX && !defined POSIX2008
function {long double} y0l (long double)
function {long double} y1l (long double)
function {long double} ynl (int, long double)
-function int isnanl (long double)
+#endif
function {long double} acoshl (long double)
function {long double} asinhl (long double)
function {long double} atanhl (long double)
@@ -245,7 +268,9 @@ function {long long} llrintl (long double)
function long lroundl (long double)
function {long long} llroundl (long double)
function {long double} remquol (long double, long double, int*)
+#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
function {long double} scalbl (long double, long double)
+#endif
function {long double} scalbnl (long double, int)
function {long double} scalblnl (long double, long)
function {long double} fdiml (long double, long double)
diff --git a/libc/conform/data/time.h-data b/libc/conform/data/time.h-data
index 805c48dd6..e2ff298ea 100644
--- a/libc/conform/data/time.h-data
+++ b/libc/conform/data/time.h-data
@@ -11,7 +11,7 @@ element {struct tm} int tm_yday
element {struct tm} int tm_isdst
constant NULL
-#ifndef XOPEN2K
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
constant CLK_TCK
#endif
constant CLOCKS_PER_SEC
@@ -38,7 +38,15 @@ type size_t
type time_t
type timer_t
+#if defined XOPEN2K8 || defined POSIX2008
+type pid_t
+type locale_t
+tag {struct sigevent}
+#endif
+
+#if !defined POSIX && !defined POSIX2008
variable int getdate_err
+#endif
function {char*} asctime (const struct tm*)
function {char*} asctime_r (const struct tm*, char*)
@@ -51,7 +59,9 @@ function int clock_settime (clockid_t, const struct timespec*)
function {char*} ctime (const time_t*)
function {char*} ctime_r (const time_t*, char*)
function double difftime (time_t, time_t)
+#if !defined POSIX && !defined POSIX2008
function {struct tm*} getdate (const char*)
+#endif
function {struct tm*} gmtime (const time_t*)
function {struct tm*} gmtime_r (const time_t*, struct tm*)
function {struct tm*} localtime (const time_t*)
@@ -59,7 +69,12 @@ function {struct tm*} localtime_r (const time_t*, struct tm*)
function time_t mktime (struct tm*)
function int nanosleep (const struct timespec*, struct timespec*)
function size_t strftime (char*, size_t, const char*, const struct tm*)
+#if defined XOPEN2K8 || defined POSIX2008
+function size_t strftime_l (char*, size_t, const char*, const struct tm*, locale_t)
+#endif
+#if !defined POSIX && !defined POSIX2008
function {char*} strptime (const char*, const char*, struct tm*)
+#endif
function time_t time (time_t*)
function int timer_create (clockid_t, struct sigevent*, timer_t*)
function int timer_delete (timer_t)
@@ -68,8 +83,10 @@ function int timer_getoverrun (timer_t)
function int timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*)
function void tzset (void)
+#if !defined POSIX && !defined POSIX2008
variable int daylight
variable {long int} timezone
+#endif
variable {char*} tzname [2]
allow tm_*
@@ -80,3 +97,4 @@ allow tv_*
allow CLOCK_*
allow TIMER_*
allow *_t
+allow sigevent
diff --git a/libc/conform/data/ulimit.h-data b/libc/conform/data/ulimit.h-data
index 84ab56c1d..9e7e6f4e9 100644
--- a/libc/conform/data/ulimit.h-data
+++ b/libc/conform/data/ulimit.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
constant UL_GETFSIZE
constant UL_SETFSIZE
@@ -5,3 +6,4 @@ function {long int} ulimit (int, ...)
allow UL_*
allow *_t
+#endif
diff --git a/libc/conform/data/unistd.h-data b/libc/conform/data/unistd.h-data
index b6effa064..72fbdd62b 100644
--- a/libc/conform/data/unistd.h-data
+++ b/libc/conform/data/unistd.h-data
@@ -41,10 +41,24 @@ optional-constant _POSIX_THREAD_PROCESS_SHARED
optional-constant _POSIX_THREAD_SAFE_FUNCTIONS
optional-constant _POSIX_THREAD_SPORADIC_SERVER
+# ifdef XOPEN2K
+optional-constant _POSIX_V6_ILP32_OFF32
+optional-constant _POSIX_V6_ILP32_OFFBIG
+optional-constant _POSIX_V6_LP64_OFF64
+optional-constant _POSIX_V6_LPBIG_OFFBIG
+# endif
+# if defined XOPEN2K8 || defined POSIX2008
+optional-constant _POSIX_V7_ILP32_OFF32
+optional-constant _POSIX_V7_ILP32_OFFBIG
+optional-constant _POSIX_V7_LP64_OFF64
+optional-constant _POSIX_V7_LPBIG_OFFBIG
+# endif
+
optional-constant _POSIX2_C_DEV
optional-constant _POSIX2_FORT_DEV
optional-constant _POSIX2_FORT_RUN
optional-constant _POSIX2_SW_DEV
+# if !defined POSIX && !defined POSIX2008
optional-constant _XOPEN_CRYPT
optional-constant _XOPEN_ENH_I18N
optional-constant _XOPEN_LEGACY
@@ -52,6 +66,7 @@ optional-constant _XOPEN_REALTIME
optional-constant _XOPEN_REALTIME_THREADS
optional-constant _XOPEN_SHM
optional-constant _XOPEN_STREAMS
+# endif
allow _XBS5_ILP32_OFF32
allow _XBS5_ILP32_OFBIG
allow _XBS5_LP64_OFF64
@@ -89,6 +104,8 @@ optional-constant _POSIX2_PBS_LOCATE
optional-constant _POSIX2_PBS_MESSAGE
optional-constant _POSIX2_PBS_TRACK
+optional-constant _POSIX_TIMESTAMP_RESOLUTION
+
constant NULL
constant R_OK
@@ -219,7 +236,20 @@ constant _SC_TYPED_MEMORY_OBJECTS
constant _SC_TZNAME_MAX
constant _SC_USER_GROUPS
constant _SC_USER_GROUPS_R
+# ifdef XOPEN2K
+constant _SC_V6_ILP32_OFF32
+constant _SC_V6_ILP32_OFFBIG
+constant _SC_V6_LP64_OFF64
+constant _SC_V6_LPBIG_OFFBIG
+# endif
+# if defined XOPEN2K8 || defined POSIX2008
+constant _SC_V7_ILP32_OFF32
+constant _SC_V7_ILP32_OFFBIG
+constant _SC_V7_LP64_OFF64
+constant _SC_V7_LPBIG_OFFBIG
+# endif
constant _SC_VERSION
+# if !defined POSIX && !defined POSIX2008
constant _SC_XOPEN_VERSION
constant _SC_XOPEN_CRYPT
constant _SC_XOPEN_ENH_I18N
@@ -229,16 +259,53 @@ constant _SC_XOPEN_XCU_VERSION
constant _SC_XOPEN_LEGACY
constant _SC_XOPEN_REALTIME
constant _SC_XOPEN_REALTIME_THREADS
+# endif
constant _SC_STREAMS
constant _SC_XBS5_ILP32_OFF32
constant _SC_XBS5_ILP32_OFFBIG
constant _SC_XBS5_LP64_OFF64
constant _SC_XBS5_LPBIG_OFFBIG
+# ifdef XOPEN2K
+constant _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+constant _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+constant _CS_POSIX_V6_ILP32_OFF32_LIBS
+constant _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+constant _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+constant _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+constant _CS_POSIX_V6_LP64_OFF64_CFLAGS
+constant _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+constant _CS_POSIX_V6_LP64_OFF64_LIBS
+constant _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+constant _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+constant _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+constant _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+constant _CS_V6_ENV
+# endif
+# if defined XOPEN2K8 || defined POSIX2008
+constant _CS_POSIX_V7_ILP32_OFF32_CFLAGS
+constant _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
+constant _CS_POSIX_V7_ILP32_OFF32_LIBS
+constant _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
+constant _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
+constant _CS_POSIX_V7_ILP32_OFFBIG_LIBS
+constant _CS_POSIX_V7_LP64_OFF64_CFLAGS
+constant _CS_POSIX_V7_LP64_OFF64_LDFLAGS
+constant _CS_POSIX_V7_LP64_OFF64_LIBS
+constant _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
+constant _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
+constant _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
+constant _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
+constant _CS_V7_ENV
+# endif
+constant _SC_THREAD_ROBUST_PRIO_INHERIT
+constant _SC_THREAD_ROBUST_PRIO_PROTECT
+#if !defined POSIX && !defined POSIX2008
constant F_LOCK
constant F_ULOCK
constant F_TEST
constant F_TLOCK
+#endif
constant _PC_ASYNC_IO
constant _PC_CHOWN_RESTRICTED
@@ -275,7 +342,9 @@ type intptr_t
function int access (const char*, int)
function {unsigned int} alarm (unsigned int)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function int brk (void*)
+#endif
function int chdir (const char*)
#if defined XPG3 || defined XPG4 || defined UNIX98
function int chroot (const char*)
@@ -283,14 +352,18 @@ function int chroot (const char*)
function int chown (const char*, uid_t, gid_t)
function int close (int)
function size_t confstr (int, char*, size_t)
+#if !defined POSIX && !defined POSIX2008
function {char*} crypt (const char*, const char*)
+#endif
function {char*} ctermid (char*)
#if defined XPG3 || defined XPG4 || defined UNIX98
function {char*} cuserid (char*)
#endif
function int dup (int)
function int dup2 (int, int)
+#if !defined POSIX && !defined POSIX2008
function void encrypt (char[64], int)
+#endif
function int execl (const char*, const char*, ...)
function int execle (const char*, const char*, ...)
function int execlp (const char*, const char*, ...)
@@ -298,76 +371,133 @@ function int execv (const char*, char *const[])
function int execve (const char*, char *const[], char *const[])
function int execvp (const char*, char *const[])
function void _exit (int)
+# if defined XOPEN2K8 || defined POSIX2008
+function int faccessat (int, const char*, int, int)
+# endif
function int fchown (int, uid_t, gid_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function int fchownat (int, const char*, uid_t, gid_t, int)
+# endif
+#ifndef POSIX
function int fchdir (int)
+#endif
function int fdatasync (int)
+# if defined XOPEN2K8 || defined POSIX2008
+function int fexecve (int, char *const[], char *const[])
+# endif
function pid_t fork (void)
function {long int} fpathconf (int, int)
function int fsync (int)
function int ftruncate (int, off_t)
function {char*} getcwd (char*, size_t)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function int getdtablesize (void)
+#endif
function gid_t getegid (void)
function uid_t geteuid (void)
function gid_t getgid (void)
function int getgroups (int, gid_t[])
+#if !defined POSIX && !defined POSIX2008
function long gethostid (void)
+#endif
function int gethostname (char*, size_t)
function {char*} getlogin (void)
function int getlogin_r (char*, size_t)
function int getopt (int, char*const[], const char*)
-function int getpagesize (void)
#if defined XPG3 || defined XPG4 || defined UNIX98
+function int getpagesize (void)
function {char*} getpass (const char*)
#endif
+#ifndef POSIX
function pid_t getpgid (pid_t)
+#endif
function pid_t getpgrp (void)
function pid_t getpid (void)
function pid_t getppid (void)
+#ifndef POSIX
function pid_t getsid (pid_t)
+#endif
function uid_t getuid (void)
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function {char*} getwd (char*)
+#endif
function int isatty (int)
+#ifndef POSIX
function int lchown (const char*, uid_t, gid_t)
+#endif
function int link (const char*, const char*)
+# if defined XOPEN2K8 || defined POSIX2008
+function int linkat (int, const char*, int, const char*, int)
+# endif
+# if !defined POSIX && !defined POSIX2008
function int lockf (int, int, off_t)
+# endif
function off_t lseek (int, off_t, int)
+# if !defined POSIX && !defined POSIX2008
function int nice (int)
+# endif
function {long int} pathconf (const char*, int)
function int pause (void)
function int pipe (int[2])
+#ifndef POSIX
function ssize_t pread (int, void*, size_t, off_t)
-#ifndef XOPEN2K
+#endif
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
function int pthread_atfork (void(*)(void), void(*)(void), void(*)(void))
#endif
+#ifndef POSIX
function ssize_t pwrite (int, const void*, size_t, off_t)
+#endif
function ssize_t read (int, void*, size_t)
function ssize_t readlink (const char*, char*, size_t)
+# if defined XOPEN2K8 || defined POSIX2008
+function ssize_t readlinkat (int, const char*, char*, size_t)
+# endif
function int rmdir (const char*)
+#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function {void*} sbrk (intptr_t)
+#endif
function int setegid (gid_t)
function int seteuid (uid_t)
function int setgid (gid_t)
function int setpgid (pid_t, pid_t)
+# if !defined POSIX && !defined POSIX2008
function pid_t setpgrp (void)
function int setregid (gid_t, gid_t)
function int setreuid (uid_t, uid_t)
+# endif
function pid_t setsid (void)
function int setuid (uid_t)
function {unsigned int} sleep (unsigned int)
+# if !defined POSIX && !defined POSIX2008
function void swab (const void*, void*, ssize_t)
+# endif
function int symlink (const char*, const char*)
+# if defined XOPEN2K8 || defined POSIX2008
+function int symlinkat (const char*, int, const char*)
+# endif
+# if !defined POSIX && !defined POSIX2008
function void sync (void)
+# endif
function {long int} sysconf (int)
function pid_t tcgetpgrp (int)
function int tcsetpgrp (int, pid_t)
+#ifndef POSIX
function int truncate (const char*, off_t)
+#endif
function {char*} ttyname (int)
function int ttyname_r (int, char*, size_t)
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function useconds_t ualarm (useconds_t, useconds_t)
+#endif
function int unlink (const char*)
+# if defined XOPEN2K8 || defined POSIX2008
+function int unlinkat (int, const char*, int)
+# endif
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function int usleep (useconds_t)
function pid_t vfork (void)
+#endif
function ssize_t write (int, const void*, size_t)
variable {char*} optarg
diff --git a/libc/conform/data/utmpx.h-data b/libc/conform/data/utmpx.h-data
index ba034f0de..af3c229fc 100644
--- a/libc/conform/data/utmpx.h-data
+++ b/libc/conform/data/utmpx.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct utmpx}
element {struct utmpx} char ut_user []
@@ -34,3 +35,4 @@ allow-header sys/time.h
allow ut_*
allow *_t
+#endif
diff --git a/libc/conform/data/wchar.h-data b/libc/conform/data/wchar.h-data
index 7c1589506..bf9e1a92e 100644
--- a/libc/conform/data/wchar.h-data
+++ b/libc/conform/data/wchar.h-data
@@ -1,14 +1,19 @@
type wchar_t
type wint_t
+# if !defined ISO && !defined POSIX && !defined POSIX2008
type wctype_t
+#endif
type mbstate_t
type FILE
type size_t
+#if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+#endif
function wint_t btowc (int)
function int fwprintf (FILE*, const wchar_t*, ...)
function int fwscanf (FILE*, const wchar_t*, ...)
-#if !ISO
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function int iswalnum (wint_t)
function int iswalpha (wint_t)
function int iswcntrl (wint_t)
@@ -32,32 +37,62 @@ function wint_t getwchar (void)
function int mbsinit (const mbstate_t*)
function size_t mbrlen (const char*, size_t, mbstate_t*)
function size_t mbrtowc (wchar_t*, const char*, size_t, mbstate_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function size_t mbsnrtowcs (wchar_t*, const char**, size_t, size_t, mbstate_t*)
+#endif
function size_t mbsrtowcs (wchar_t*, const char**, size_t, mbstate_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function {FILE*} open_wmemstream (wchar_t**, size_t*)
+#endif
function wint_t putwc (wchar_t, FILE*)
function wint_t putwchar (wchar_t)
function int swprintf (wchar_t*, size_t, const wchar_t*, ...)
function int swscanf (const wchar_t*, const wchar_t*, ...)
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function wint_t towlower (wint_t)
function wint_t towupper (wint_t)
+#endif
function wint_t ungetwc (wint_t, FILE*)
-function int vfwprintf (FILE*, const wchar_t*, va_list)
-function int vfwscanf (FILE*, const wchar_t*, va_list)
-function int vwprintf (const wchar_t*, va_list)
-function int vwscanf (const wchar_t*, va_list)
-function int vswprintf (wchar_t*, size_t, const wchar_t*, va_list)
-function int vswscanf (const wchar_t*, const wchar_t*, va_list)
+function int vfwprintf (FILE*, const wchar_t*, __gnuc_va_list)
+function int vfwscanf (FILE*, const wchar_t*, __gnuc_va_list)
+function int vwprintf (const wchar_t*, __gnuc_va_list)
+function int vwscanf (const wchar_t*, __gnuc_va_list)
+function int vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
+function int vswscanf (const wchar_t*, const wchar_t*, __gnuc_va_list)
+#if defined XOPEN2K8 || defined POSIX2008
+function {wchar_t*} wcpcpy (wchar_t*, const wchar_t*)
+function {wchar_t*} wcpncpy (wchar_t*, const wchar_t*, size_t)
+#endif
function size_t wcrtomb (char*, wchar_t, mbstate_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int wcscasecmp(const wchar_t*, const wchar_t*)
+function int wcscasecmp_l(const wchar_t*, const wchar_t*, locale_t)
+#endif
function {wchar_t*} wcscat (wchar_t*, const wchar_t*)
function {wchar_t*} wcschr (const wchar_t*, wchar_t)
function int wcscmp (const wchar_t*, const wchar_t*)
function int wcscoll (const wchar_t*, const wchar_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int wcscoll_l (const wchar_t*, const wchar_t*, locale_t)
+#endif
function {wchar_t*} wcscpy (wchar_t*, const wchar_t*)
function size_t wcscspn (const wchar_t*, const wchar_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function {wchar_t*} wcsdup (const wchar_t*)
+#endif
function size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*)
function size_t wcslen (const wchar_t*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int wcsncasecmp (const wchar_t*, const wchar_t*, size_t)
+function int wcsncasecmp_l (const wchar_t*, const wchar_t*, size_t, locale_t)
+#endif
function {wchar_t*} wcsncat (wchar_t*, const wchar_t*, size_t)
function int wcsncmp (const wchar_t*, const wchar_t*, size_t)
function {wchar_t*} wcsncpy (wchar_t*, const wchar_t*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function size_t wcsnlen (const wchar_t*, size_t)
+function size_t wcsnrtombs (char*, const wchar_t**, size_t, size_t, mbstate_t*)
+#endif
function {wchar_t*} wcspbrk (const wchar_t*, const wchar_t*)
function {wchar_t*} wcsrchr (const wchar_t*, wchar_t)
function size_t wcsrtombs (char*, const wchar_t**, size_t, mbstate_t*)
@@ -67,12 +102,21 @@ function double wcstod (const wchar_t*, wchar_t**)
function {wchar_t*} wcstok (wchar_t*, const wchar_t*, wchar_t**)
function {long int} wcstol (const wchar_t*, wchar_t**, int)
function {unsigned long int} wcstoul (const wchar_t*, wchar_t**, int)
+#if defined UNIX98 || defined XOPEN2K
function {wchar_t*} wcswcs (const wchar_t*, const wchar_t*)
+#endif
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function int wcswidth (const wchar_t*, size_t)
+#endif
function size_t wcsxfrm (wchar_t*, const wchar_t*, size_t)
+#if defined XOPEN2K8 || defined POSIX2008
+function size_t wcsxfrm_l (wchar_t*, const wchar_t*, size_t, locale_t)
+#endif
function int wctob (wint_t)
+#if !defined ISO && !defined POSIX && !defined POSIX2008
function wctype_t wctype (const char*)
function int wcwidth (wchar_t)
+#endif
function {wchar_t*} wmemchr (const wchar_t*, wchar_t, size_t)
function int wmemcmp (const wchar_t*, const wchar_t*, size_t)
function {wchar_t*} wmemcpy (wchar_t*, const wchar_t*, size_t)
diff --git a/libc/conform/data/wctype.h-data b/libc/conform/data/wctype.h-data
index 230d7482a..a3f8c54a8 100644
--- a/libc/conform/data/wctype.h-data
+++ b/libc/conform/data/wctype.h-data
@@ -1,6 +1,9 @@
type wint_t
type wctrans_t
type wctype_t
+#if defined XOPEN2K8 || defined POSIX2008
+type locale_t
+#endif
function int iswalnum (wint_t)
function int iswalpha (wint_t)
@@ -19,6 +22,25 @@ function wint_t towlower (wint_t)
function wint_t towupper (wint_t)
function wctrans_t wctrans (const char*)
function wctype_t wctype (const char*)
+#if defined XOPEN2K8 || defined POSIX2008
+function int iswalnum_l (wint_t, locale_t)
+function int iswalpha_l (wint_t, locale_t)
+function int iswcntrl_l (wint_t, locale_t)
+function int iswdigit_l (wint_t, locale_t)
+function int iswgraph_l (wint_t, locale_t)
+function int iswlower_l (wint_t, locale_t)
+function int iswprint_l (wint_t, locale_t)
+function int iswpunct_l (wint_t, locale_t)
+function int iswspace_l (wint_t, locale_t)
+function int iswupper_l (wint_t, locale_t)
+function int iswxdigit_l (wint_t, locale_t)
+function int iswctype_l (wint_t, wctype_t, locale_t)
+function wint_t towctrans_l (wint_t, wctrans_t, locale_t)
+function wint_t towlower_l (wint_t, locale_t)
+function wint_t towupper_l (wint_t, locale_t)
+function wctrans_t wctrans_l (const char*, locale_t)
+function wctype_t wctype_l (const char*, locale_t)
+#endif
macro WEOF
diff --git a/libc/conform/data/wordexp.h-data b/libc/conform/data/wordexp.h-data
index bfa66e8f1..acbed7495 100644
--- a/libc/conform/data/wordexp.h-data
+++ b/libc/conform/data/wordexp.h-data
@@ -14,7 +14,9 @@ constant WRDE_UNDEF
constant WRDE_BADCHAR
constant WRDE_CMDSUB
constant WRDE_NOSPACE
+#if !defined XOPEN2K8 && !defined POSIX2008
constant WRDE_NOSYS
+#endif
constant WRDE_SYNTAX
function int wordexp (const char*, wordexp_t*, int)
diff --git a/libc/dirent/dirent.h b/libc/dirent/dirent.h
index 369ccdc9e..bb4ede158 100644
--- a/libc/dirent/dirent.h
+++ b/libc/dirent/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2000, 2003-2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2000,2003-2005,2009,2010 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
@@ -218,7 +218,7 @@ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_MISC || defined __XOPEN_2K8
+#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K8
/* Return the file descriptor used by DIRP. */
extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
diff --git a/libc/elf/dl-open.c b/libc/elf/dl-open.c
index e920c7738..754a263fa 100644
--- a/libc/elf/dl-open.c
+++ b/libc/elf/dl-open.c
@@ -1,5 +1,5 @@
/* Load a shared object at runtime, relocate it, and run its initializer.
- Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -40,7 +40,8 @@
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
void (*dl_main) (const ElfW(Phdr) *phdr,
ElfW(Word) phnum,
- ElfW(Addr) *user_entry));
+ ElfW(Addr) *user_entry,
+ ElfW(auxv_t) *auxv));
weak_extern (BP_SYM (_dl_sysdep_start))
extern int __libc_multiple_libcs; /* Defined in init-first.c. */
@@ -346,8 +347,8 @@ dl_open_worker (void *a)
{
/* If this here is the shared object which we want to profile
make sure the profile is started. We can find out whether
- this is necessary or not by observing the `_dl_profile_map'
- variable. If was NULL but is not NULL afterwars we must
+ this is necessary or not by observing the `_dl_profile_map'
+ variable. If was NULL but is not NULL afterwars we must
start the profiling. */
struct link_map *old_profile_map = GL(dl_profile_map);
diff --git a/libc/elf/dl-sysdep.c b/libc/elf/dl-sysdep.c
index 5700272f1..5507e57b9 100644
--- a/libc/elf/dl-sysdep.c
+++ b/libc/elf/dl-sysdep.c
@@ -1,5 +1,6 @@
/* Operating system support for run-time dynamic linker. Generic Unix version.
- Copyright (C) 1995-1998, 2000-2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998,2000-2008,2009,2010
+ 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
@@ -84,7 +85,7 @@ void *_dl_random attribute_relro = NULL;
ElfW(Addr)
_dl_sysdep_start (void **start_argptr,
void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
- ElfW(Addr) *user_entry))
+ ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv))
{
const ElfW(Phdr) *phdr = NULL;
ElfW(Word) phnum = 0;
@@ -240,7 +241,7 @@ _dl_sysdep_start (void **start_argptr,
if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
__libc_check_standard_fds ();
- (*dl_main) (phdr, phnum, &user_entry);
+ (*dl_main) (phdr, phnum, &user_entry, _dl_auxv);
return user_entry;
}
@@ -390,7 +391,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz)
{
#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
- if (note->type == 2
+ if (note->type == NT_GNU_HWCAP
&& note->vendorlen == sizeof "GNU"
&& !memcmp ((note + 1), "GNU", sizeof "GNU")
&& note->datalen > 2 * sizeof (ElfW(Word)) + 2)
@@ -510,9 +511,9 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
/* Fill in the information. This follows the following scheme
(indeces from TEMP for four strings):
entry #0: 0, 1, 2, 3 binary: 1111
- #1: 0, 1, 3 1101
- #2: 0, 2, 3 1011
- #3: 0, 3 1001
+ #1: 0, 1, 3 1101
+ #2: 0, 2, 3 1011
+ #3: 0, 3 1001
This allows the representation of all possible combinations of
capability names in the string. First generate the strings. */
result[1].str = result[0].str = cp = (char *) (result + *sz);
diff --git a/libc/elf/dynamic-link.h b/libc/elf/dynamic-link.h
index c34cbcd43..6d7e14282 100644
--- a/libc/elf/dynamic-link.h
+++ b/libc/elf/dynamic-link.h
@@ -103,6 +103,11 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
{
ElfW(Dyn) *dyn = l->l_ld;
ElfW(Dyn) **info;
+#if __ELF_NATIVE_CLASS == 32
+ typedef Elf32_Word d_tag_utype;
+#elif __ELF_NATIVE_CLASS == 64
+ typedef Elf64_Xword d_tag_utype;
+#endif
#ifndef RTLD_BOOTSTRAP
if (dyn == NULL)
@@ -113,20 +118,20 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
while (dyn->d_tag != DT_NULL)
{
- if (dyn->d_tag < DT_NUM)
+ if ((d_tag_utype) dyn->d_tag < DT_NUM)
info[dyn->d_tag] = dyn;
else if (dyn->d_tag >= DT_LOPROC &&
dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
- else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
+ else if ((d_tag_utype) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
info[VERSYMIDX (dyn->d_tag)] = dyn;
- else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
+ else if ((d_tag_utype) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
info[DT_EXTRATAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
+ DT_VERSIONTAGNUM] = dyn;
- else if ((Elf32_Word) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
+ else if ((d_tag_utype) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
+ DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn;
- else if ((Elf32_Word) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
+ else if ((d_tag_utype) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
+ DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
++dyn;
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index c772ff41a..8af7c177c 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009
+ Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -558,6 +558,12 @@ typedef struct
Elf64_Xword p_align; /* Segment alignment */
} Elf64_Phdr;
+/* Special value for e_phnum. This indicates that the real number of
+ program headers is too large to fit into e_phnum. Instead the real
+ value is in the field sh_info of section 0. */
+
+#define PN_XNUM 0xffff
+
/* Legal values for p_type (segment type). */
#define PT_NULL 0 /* Program header table entry unused */
@@ -2487,6 +2493,12 @@ typedef Elf32_Addr Elf32_Conflict;
/* Keep this the last entry. */
#define R_SH_NUM 256
+/* S/390 specific definitions. */
+
+/* Valid values for the e_flags field. */
+
+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */
+
/* Additional s390 relocs */
#define R_390_NONE 0 /* No reloc. */
diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c
index 55b84c3bf..3afb997f8 100644
--- a/libc/elf/rtld.c
+++ b/libc/elf/rtld.c
@@ -1,5 +1,5 @@
/* Run time dynamic linker.
- Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 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
@@ -182,7 +182,7 @@ extern struct rtld_global_ro _rtld_local_ro
static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
- ElfW(Addr) *user_entry);
+ ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv);
/* These two variables cannot be moved into .data.rel.ro. */
static struct libname_list _dl_rtld_libname;
@@ -882,7 +882,8 @@ static int version_info attribute_relro;
static void
dl_main (const ElfW(Phdr) *phdr,
ElfW(Word) phnum,
- ElfW(Addr) *user_entry)
+ ElfW(Addr) *user_entry,
+ ElfW(auxv_t) *auxv)
{
const ElfW(Phdr) *ph;
enum mode mode;
@@ -927,6 +928,8 @@ dl_main (const ElfW(Phdr) *phdr,
if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
{
+ ElfW(auxv_t) *av;
+
/* Ho ho. We are not the program interpreter! We are the program
itself! This means someone ran ld.so as a command. Well, that
might be convenient to do sometimes. We support it by
@@ -1013,11 +1016,11 @@ of this helper program; chances are you did not intend to run this program.\n\
\n\
--list list all dependencies and how they are resolved\n\
--verify verify that given object really is a dynamically linked\n\
- object we can handle\n\
+ object we can handle\n\
--library-path PATH use given PATH instead of content of the environment\n\
- variable LD_LIBRARY_PATH\n\
+ variable LD_LIBRARY_PATH\n\
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
- in LIST\n\
+ in LIST\n\
--audit LIST use objects named in LIST as auditors\n");
++_dl_skip_args;
@@ -1082,6 +1085,22 @@ of this helper program; chances are you did not intend to run this program.\n\
makes sense to free the old string first. */
main_map->l_name = (char *) "";
*user_entry = main_map->l_entry;
+
+ /* Adjust the on-stack auxiliary vector so that it looks like the
+ binary was executed directly. */
+ for (av = auxv; av->a_type != AT_NULL; av++)
+ switch (av->a_type)
+ {
+ case AT_PHDR:
+ av->a_un.a_val = phdr;
+ break;
+ case AT_PHNUM:
+ av->a_un.a_val = phnum;
+ break;
+ case AT_ENTRY:
+ av->a_un.a_val = *user_entry;
+ break;
+ }
}
else
{
@@ -2013,7 +2032,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_relocate_object (&GL(dl_rtld_map),
main_map->l_scope, 0, 0);
}
- }
+ }
#define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
if (version_info)
{
@@ -2682,10 +2701,10 @@ process_envvars (enum mode *modep)
while (*nextp != '\0');
if (__access ("/etc/suid-debug", F_OK) != 0)
- {
+ {
unsetenv ("MALLOC_CHECK_");
GLRO(dl_debug_mask) = 0;
- }
+ }
if (mode != normal)
_exit (5);
@@ -2752,7 +2771,7 @@ print_statistics (hp_timing_t *rtld_total_timep)
}
*wp = '\0';
_dl_debug_printf ("\
- time needed for relocation: %s (%s%%)\n", buf, pbuf);
+ time needed for relocation: %s (%s%%)\n", buf, pbuf);
}
#endif
@@ -2815,7 +2834,7 @@ print_statistics (hp_timing_t *rtld_total_timep)
}
*wp = '\0';
_dl_debug_printf ("\
- time needed to load objects: %s (%s%%)\n",
+ time needed to load objects: %s (%s%%)\n",
buf, pbuf);
}
#endif
diff --git a/libc/grp/grp.h b/libc/grp/grp.h
index d7cc69d0e..c06ef03ae 100644
--- a/libc/grp/grp.h
+++ b/libc/grp/grp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1992,1995-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995-2001,2003,2004,2010
+ 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
@@ -61,7 +62,10 @@ struct group
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void setgrent (void);
+#endif
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED \
+ || defined __USE_XOPEN2K8
/* Close the group-file stream.
This function is a possible cancellation point and therefore not
diff --git a/libc/iconv/iconv_prog.c b/libc/iconv/iconv_prog.c
index 7b4a0be02..a2c0ad687 100644
--- a/libc/iconv/iconv_prog.c
+++ b/libc/iconv/iconv_prog.c
@@ -453,7 +453,7 @@ write_output (const char *outbuf, const char *outptr, FILE **output,
if (output_file != NULL && strcmp (output_file, "-") != 0)
{
*output = fopen (output_file, "w");
- if (output == NULL)
+ if (*output == NULL)
error (EXIT_FAILURE, errno, _("cannot open output file"));
}
else
diff --git a/libc/include/features.h b/libc/include/features.h
index 273283559..34af792ac 100644
--- a/libc/include/features.h
+++ b/libc/include/features.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993,1995-2006,2007,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2007,2009,2010 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
@@ -66,7 +66,8 @@
__USE_XOPEN_EXTENDED Define X/Open Unix things.
__USE_UNIX98 Define Single Unix V2 things.
__USE_XOPEN2K Define XPG6 things.
- __USE_XOPEN2K8 Define XPG7 things.
+ __USE_XOPEN2KXSI Define XPG6 XSI things.
+ __USE_XOPEN2K8XSI Define XPG7 XSI things.
__USE_LARGEFILE Define correct standard I/O things.
__USE_LARGEFILE64 Define LFS things with separate names.
__USE_FILE_OFFSET64 Define 64bit interface as default.
@@ -102,7 +103,9 @@
#undef __USE_XOPEN_EXTENDED
#undef __USE_UNIX98
#undef __USE_XOPEN2K
+#undef __USE_XOPEN2KXSI
#undef __USE_XOPEN2K8
+#undef __USE_XOPEN2K8XSI
#undef __USE_LARGEFILE
#undef __USE_LARGEFILE64
#undef __USE_FILE_OFFSET64
@@ -143,13 +146,14 @@
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
- defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
- defined _GNU_SOURCE || defined _SVID_SOURCE)
+ defined _XOPEN_SOURCE || defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
#ifdef _GNU_SOURCE
+# undef _ISOC95_SOURCE
+# define _ISOC95_SOURCE 1
# undef _ISOC99_SOURCE
# define _ISOC99_SOURCE 1
# undef _POSIX_SOURCE
@@ -174,8 +178,7 @@
define _BSD_SOURCE and _SVID_SOURCE. */
#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
- !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
- !defined _BSD_SOURCE && !defined _SVID_SOURCE)
+ !defined _XOPEN_SOURCE && !defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE 1
# define _SVID_SOURCE 1
#endif
@@ -230,6 +233,8 @@
#if (_POSIX_C_SOURCE - 0) >= 200112L
# define __USE_XOPEN2K 1
+# undef __USE_ISOC95
+# define __USE_ISOC95 1
# undef __USE_ISOC99
# define __USE_ISOC99 1
#endif
@@ -250,8 +255,12 @@
# if (_XOPEN_SOURCE - 0) >= 600
# if (_XOPEN_SOURCE - 0) >= 700
# define __USE_XOPEN2K8 1
+# define __USE_XOPEN2K8XSI 1
# endif
# define __USE_XOPEN2K 1
+# define __USE_XOPEN2KXSI 1
+# undef __USE_ISOC95
+# define __USE_ISOC95 1
# undef __USE_ISOC99
# define __USE_ISOC99 1
# endif
diff --git a/libc/io/fcntl.h b/libc/io/fcntl.h
index 2a2a29dc7..4eb003be4 100644
--- a/libc/io/fcntl.h
+++ b/libc/io/fcntl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007, 2009
+/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -34,8 +34,54 @@ __BEGIN_DECLS
#include <bits/fcntl.h>
/* For XPG all symbols from <sys/stat.h> should also be available. */
-#ifdef __USE_XOPEN
-# include <sys/stat.h>
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+# include <bits/types.h> /* For __mode_t and __dev_t. */
+# define __need_timespec
+# include <time.h>
+# include <bits/stat.h>
+
+# define S_IFMT __S_IFMT
+# define S_IFDIR __S_IFDIR
+# define S_IFCHR __S_IFCHR
+# define S_IFBLK __S_IFBLK
+# define S_IFREG __S_IFREG
+# ifdef __S_IFIFO
+# define S_IFIFO __S_IFIFO
+# endif
+# ifdef __S_IFLNK
+# define S_IFLNK __S_IFLNK
+# endif
+# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
+# define S_IFSOCK __S_IFSOCK
+# endif
+
+/* Protection bits. */
+
+# define S_ISUID __S_ISUID /* Set user ID on execution. */
+# define S_ISGID __S_ISGID /* Set group ID on execution. */
+
+# if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN
+/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
+# define S_ISVTX __S_ISVTX
+# endif
+
+# define S_IRUSR __S_IREAD /* Read by owner. */
+# define S_IWUSR __S_IWRITE /* Write by owner. */
+# define S_IXUSR __S_IEXEC /* Execute by owner. */
+/* Read, write, and execute by owner. */
+# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
+
+# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
+# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
+# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
+/* Read, write, and execute by group. */
+# define S_IRWXG (S_IRWXU >> 3)
+
+# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
+# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
+# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
+/* Read, write, and execute by others. */
+# define S_IRWXO (S_IRWXG >> 3)
#endif
#ifdef __USE_MISC
@@ -49,8 +95,8 @@ __BEGIN_DECLS
# endif
#endif /* Use misc. */
-/* XPG wants the following symbols. */
-#ifdef __USE_XOPEN /* <stdio.h> has the same definitions. */
+/* XPG wants the following symbols. <stdio.h> has the same definitions. */
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Seek from end of file. */
@@ -116,9 +162,10 @@ extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag,
# define openat openat64
# endif
# endif
-
+# ifdef __USE_LARGEFILE64
extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
__nonnull ((2));
+# endif
#endif
/* Create and open FILE, with mode MODE. This takes an `int' MODE
diff --git a/libc/io/sys/stat.h b/libc/io/sys/stat.h
index c0b2bf9d2..7afee9c67 100644
--- a/libc/io/sys/stat.h
+++ b/libc/io/sys/stat.h
@@ -29,7 +29,7 @@
#include <bits/types.h> /* For __mode_t and __dev_t. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_MISC \
- || defined __USE_ATFILE
+ || defined __USE_ATFILE
# if defined __USE_XOPEN || defined __USE_XOPEN2K
# define __need_time_t
# endif
@@ -293,7 +293,7 @@ extern int lchmod (__const char *__file, __mode_t __mode)
#endif
/* Set file access permissions of the file FD is open on to MODE. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif
diff --git a/libc/libio/stdio.h b/libc/libio/stdio.h
index d7d241c92..85542b1cf 100644
--- a/libc/libio/stdio.h
+++ b/libc/libio/stdio.h
@@ -1,5 +1,5 @@
/* Define ISO C stdio on top of C++ iostreams.
- Copyright (C) 1991, 1994-2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994-2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -74,7 +74,7 @@ typedef struct _IO_FILE __FILE;
#include <libio.h>
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# ifdef __GNUC__
# ifndef _VA_LIST_DEFINED
typedef _G_va_list va_list;
@@ -85,6 +85,26 @@ typedef _G_va_list va_list;
# endif
#endif
+#ifdef __USE_XOPEN2K8
+# ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
+# endif
+# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+# define __off64_t_defined
+# endif
+
+# ifndef __ssize_t_defined
+typedef __ssize_t ssize_t;
+# define __ssize_t_defined
+# endif
+#endif
+
/* The type of the second argument to `fgetpos' and `fsetpos'. */
__BEGIN_NAMESPACE_STD
#ifndef __USE_FILE_OFFSET64
diff --git a/libc/locale/C-address.c b/libc/locale/C-address.c
index e9e6b1aa8..0d3005261 100644
--- a/libc/locale/C-address.c
+++ b/libc/locale/C-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.10 "LC_ADDRESS". */
-const struct locale_data _nl_C_LC_ADDRESS attribute_hidden =
+const struct __locale_data _nl_C_LC_ADDRESS attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-collate.c b/libc/locale/C-collate.c
index cc8c8ee81..a7e440fda 100644
--- a/libc/locale/C-collate.c
+++ b/libc/locale/C-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,1999,2000,2001,2002,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -98,7 +98,7 @@ static const uint32_t collseqwc[] =
L'\xf8', L'\xf9', L'\xfa', L'\xfb', L'\xfc', L'\xfd', L'\xfe', L'\xff'
};
-const struct locale_data _nl_C_LC_COLLATE attribute_hidden =
+const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-ctype.c b/libc/locale/C-ctype.c
index 1b2792a03..55cd19db1 100644
--- a/libc/locale/C-ctype.c
+++ b/libc/locale/C-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -541,7 +541,7 @@ _nl_C_LC_CTYPE_width attribute_hidden =
NR_FIXED == _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1). */
typedef int assertion1[1 - 2 * (NR_FIXED != _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1))];
-const struct locale_data _nl_C_LC_CTYPE attribute_hidden =
+const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-identification.c b/libc/locale/C-identification.c
index 628e8f145..da465d2c8 100644
--- a/libc/locale/C-identification.c
+++ b/libc/locale/C-identification.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.12 "LC_IDENTIFICATION". */
-const struct locale_data _nl_C_LC_IDENTIFICATION attribute_hidden =
+const struct __locale_data _nl_C_LC_IDENTIFICATION attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-measurement.c b/libc/locale/C-measurement.c
index 796fe29ce..16e45f650 100644
--- a/libc/locale/C-measurement.c
+++ b/libc/locale/C-measurement.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.12 "LC_MEASUREMENT". */
-const struct locale_data _nl_C_LC_MEASUREMENT attribute_hidden =
+const struct __locale_data _nl_C_LC_MEASUREMENT attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-messages.c b/libc/locale/C-messages.c
index 499d4bf5a..0d2a05f80 100644
--- a/libc/locale/C-messages.c
+++ b/libc/locale/C-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000,2001,2002,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -24,7 +24,7 @@
The last two fields are a GNU extension. */
-const struct locale_data _nl_C_LC_MESSAGES attribute_hidden =
+const struct __locale_data _nl_C_LC_MESSAGES attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-monetary.c b/libc/locale/C-monetary.c
index 8cccf9637..e18c059e0 100644
--- a/libc/locale/C-monetary.c
+++ b/libc/locale/C-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -28,7 +28,7 @@ static const char not_available[] = "\377";
static const char not_available[] = "\177";
#endif
-const struct locale_data _nl_C_LC_MONETARY attribute_hidden =
+const struct __locale_data _nl_C_LC_MONETARY attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-name.c b/libc/locale/C-name.c
index 65033d675..e59b42fa0 100644
--- a/libc/locale/C-name.c
+++ b/libc/locale/C-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.9 "LC_NAME". */
-const struct locale_data _nl_C_LC_NAME attribute_hidden =
+const struct __locale_data _nl_C_LC_NAME attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-numeric.c b/libc/locale/C-numeric.c
index 377c51cdf..a16a841c7 100644
--- a/libc/locale/C-numeric.c
+++ b/libc/locale/C-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000,2001,2002,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -21,7 +21,7 @@
/* This table's entries are taken from POSIX.2 Table 2-10
``LC_NUMERIC Category Definition in the POSIX Locale''. */
-const struct locale_data _nl_C_LC_NUMERIC attribute_hidden =
+const struct __locale_data _nl_C_LC_NUMERIC attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-paper.c b/libc/locale/C-paper.c
index 74e6401de..2d060ca8b 100644
--- a/libc/locale/C-paper.c
+++ b/libc/locale/C-paper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.8 "LC_PAPER". */
-const struct locale_data _nl_C_LC_PAPER attribute_hidden =
+const struct __locale_data _nl_C_LC_PAPER attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-telephone.c b/libc/locale/C-telephone.c
index 561a1ef28..522388866 100644
--- a/libc/locale/C-telephone.c
+++ b/libc/locale/C-telephone.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,7 @@
/* This table's entries are taken from ISO 14652, the table in section
4.11 "LC_TELEPHONE". */
-const struct locale_data _nl_C_LC_TELEPHONE attribute_hidden =
+const struct __locale_data _nl_C_LC_TELEPHONE attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/C-time.c b/libc/locale/C-time.c
index 368ffce7a..16d387b93 100644
--- a/libc/locale/C-time.c
+++ b/libc/locale/C-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2004, 2007, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -23,7 +23,7 @@
``LC_TIME Category Definition in the POSIX Locale'',
with additions from ISO 14652, section 4.6. */
-const struct locale_data _nl_C_LC_TIME attribute_hidden =
+const struct __locale_data _nl_C_LC_TIME attribute_hidden =
{
_nl_C_name,
NULL, 0, 0, /* no file mapped */
diff --git a/libc/locale/findlocale.c b/libc/locale/findlocale.c
index ea24170df..6b88c9634 100644
--- a/libc/locale/findlocale.c
+++ b/libc/locale/findlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -33,14 +33,14 @@
#ifdef NL_CURRENT_INDIRECT
# define DEFINE_CATEGORY(category, category_name, items, a) \
-extern struct locale_data _nl_C_##category; \
+extern struct __locale_data _nl_C_##category; \
weak_extern (_nl_C_##category)
# include "categories.def"
# undef DEFINE_CATEGORY
/* Array indexed by category of pointers to _nl_C_CATEGORY slots.
Elements are zero for categories whose data is never used. */
-struct locale_data *const _nl_C[] attribute_hidden =
+struct __locale_data *const _nl_C[] attribute_hidden =
{
# define DEFINE_CATEGORY(category, category_name, items, a) \
[category] = &_nl_C_##category,
@@ -59,7 +59,7 @@ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
-struct locale_data *
+struct __locale_data *
internal_function
_nl_find_locale (const char *locale_path, size_t locale_path_len,
int category, const char **name)
@@ -104,7 +104,8 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
but only if there was no LOCPATH environment variable specified. */
if (__builtin_expect (locale_path == NULL, 1))
{
- struct locale_data *data = _nl_load_locale_from_archive (category, name);
+ struct __locale_data *data
+ = _nl_load_locale_from_archive (category, name);
if (__builtin_expect (data != NULL, 1))
return data;
@@ -214,12 +215,12 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
[__LC_MEASUREMENT] = _NL_ITEM_INDEX (_NL_MEASUREMENT_CODESET),
[__LC_IDENTIFICATION] = _NL_ITEM_INDEX (_NL_IDENTIFICATION_CODESET)
};
- const struct locale_data *data;
+ const struct __locale_data *data;
const char *locale_codeset;
char *clocale_codeset;
char *ccodeset;
- data = (const struct locale_data *) locale_file->data;
+ data = (const struct __locale_data *) locale_file->data;
locale_codeset =
(const char *) data->values[codeset_idx[category]].string;
assert (locale_codeset != NULL);
@@ -241,7 +242,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
/* Determine the locale name for which loading succeeded. This
information comes from the file name. The form is
<path>/<locale>/LC_foo. We must extract the <locale> part. */
- if (((const struct locale_data *) locale_file->data)->name == NULL)
+ if (((const struct __locale_data *) locale_file->data)->name == NULL)
{
char *cp, *endp;
@@ -249,20 +250,20 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
cp = endp - 1;
while (cp[-1] != '/')
--cp;
- ((struct locale_data *) locale_file->data)->name = __strndup (cp,
- endp - cp);
+ ((struct __locale_data *) locale_file->data)->name
+ = __strndup (cp, endp - cp);
}
/* Determine whether the user wants transliteration or not. */
if (modifier != NULL && __strcasecmp (modifier, "TRANSLIT") == 0)
- ((struct locale_data *) locale_file->data)->use_translit = 1;
+ ((struct __locale_data *) locale_file->data)->use_translit = 1;
/* Increment the usage count. */
- if (((const struct locale_data *) locale_file->data)->usage_count
+ if (((const struct __locale_data *) locale_file->data)->usage_count
< MAX_USAGE_COUNT)
- ++((struct locale_data *) locale_file->data)->usage_count;
+ ++((struct __locale_data *) locale_file->data)->usage_count;
- return (struct locale_data *) locale_file->data;
+ return (struct __locale_data *) locale_file->data;
}
@@ -270,7 +271,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
is acquired. */
void
internal_function
-_nl_remove_locale (int locale, struct locale_data *data)
+_nl_remove_locale (int locale, struct __locale_data *data)
{
if (--data->usage_count == 0)
{
@@ -281,7 +282,7 @@ _nl_remove_locale (int locale, struct locale_data *data)
/* Search for the entry. It must be in the list. Otherwise it
is a bug and we crash badly. */
- while ((struct locale_data *) ptr->data != data)
+ while ((struct __locale_data *) ptr->data != data)
ptr = ptr->next;
/* Mark the data as not available anymore. So when the data has
diff --git a/libc/locale/global-locale.c b/libc/locale/global-locale.c
index 771742e1b..63d1238fb 100644
--- a/libc/locale/global-locale.c
+++ b/libc/locale/global-locale.c
@@ -1,5 +1,5 @@
/* Locale object representing the global locale controlled by setlocale.
- Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2008, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
#include "localeinfo.h"
#define DEFINE_CATEGORY(category, category_name, items, a) \
-extern struct locale_data _nl_C_##category; weak_extern (_nl_C_##category)
+extern struct __locale_data _nl_C_##category; weak_extern (_nl_C_##category)
#include "categories.def"
#undef DEFINE_CATEGORY
diff --git a/libc/locale/loadarchive.c b/libc/locale/loadarchive.c
index d545f17fb..663202e54 100644
--- a/libc/locale/loadarchive.c
+++ b/libc/locale/loadarchive.c
@@ -1,5 +1,5 @@
/* Code to load locale data from the locale archive file.
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2005, 2010 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,7 +85,7 @@ struct locale_in_archive
{
struct locale_in_archive *next;
char *name;
- struct locale_data *data[__LC_LAST];
+ struct __locale_data *data[__LC_LAST];
};
static struct locale_in_archive *archloaded;
@@ -129,7 +129,7 @@ calculate_head_size (const struct locarhead *h)
already been loaded from the archive, just returns the existing data
structure. If successful, sets *NAMEP to point directly into the mapped
archive string table; that way, the next call can short-circuit strcmp. */
-struct locale_data *
+struct __locale_data *
internal_function
_nl_load_locale_from_archive (int category, const char **namep)
{
diff --git a/libc/locale/loadlocale.c b/libc/locale/loadlocale.c
index 467dff157..61e6f7f0a 100644
--- a/libc/locale/loadlocale.c
+++ b/libc/locale/loadlocale.c
@@ -1,5 +1,5 @@
/* Functions to read locale data files.
- Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1996-2004, 2005, 2006, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -61,7 +61,7 @@ static const enum value_type *const _nl_value_types[] =
};
-struct locale_data *
+struct __locale_data *
internal_function
_nl_intern_locale_data (int category, const void *data, size_t datasize)
{
@@ -71,7 +71,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
unsigned int nstrings;
unsigned int strindex[0];
} *const filedata = data;
- struct locale_data *newdata;
+ struct __locale_data *newdata;
size_t cnt;
if (__builtin_expect (datasize < sizeof *filedata, 0)
@@ -166,7 +166,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
int fd;
void *filedata;
struct stat64 st;
- struct locale_data *newdata;
+ struct __locale_data *newdata;
int save_err;
int alloc = ld_mapped;
@@ -187,7 +187,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
if (__builtin_expect (S_ISDIR (st.st_mode), 0))
{
/* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo
- instead. */
+ instead. */
char *newp;
size_t filenamelen;
@@ -224,6 +224,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
if (__builtin_expect (filedata == MAP_FAILED, 0))
{
+ filedata = NULL;
if (__builtin_expect (errno, ENOSYS) == ENOSYS)
{
#endif /* _POSIX_MAPPED_FILES */
@@ -282,7 +283,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
void
internal_function
-_nl_unload_locale (struct locale_data *locale)
+_nl_unload_locale (struct __locale_data *locale)
{
if (locale->private.cleanup)
(*locale->private.cleanup) (locale);
diff --git a/libc/locale/localeinfo.h b/libc/locale/localeinfo.h
index 19ea41ae6..72e9d3a6e 100644
--- a/libc/locale/localeinfo.h
+++ b/libc/locale/localeinfo.h
@@ -1,5 +1,5 @@
/* Declarations for internal libc locale interfaces
- Copyright (C) 1995-2003, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 1995-2003, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -42,13 +42,13 @@
/* Two special weight constants for the collation data. */
#define IGNORE_CHAR 2
-/* We use a special value for the usage counter in `locale_data' to
+/* We use a special value for the usage counter in `__locale_data' to
signal that this data must never be removed anymore. */
#define MAX_USAGE_COUNT (UINT_MAX - 1)
#define UNDELETABLE UINT_MAX
/* Structure describing locale data in core for a category. */
-struct locale_data
+struct __locale_data
{
const char *name;
const char *filedata; /* Region mapping the file data. */
@@ -65,7 +65,7 @@ struct locale_data
the data. */
struct
{
- void (*cleanup) (struct locale_data *) internal_function;
+ void (*cleanup) (struct __locale_data *) internal_function;
union
{
void *data;
@@ -145,7 +145,7 @@ struct era_entry
};
/* Structure caching computed data about information from LC_TIME.
- The `private.time' member of `struct locale_data' points to this. */
+ The `private.time' member of `struct __locale_data' points to this. */
struct lc_time_data
{
struct era_entry *eras;
@@ -232,12 +232,12 @@ __libc_tsd_define (extern, __locale_t, LOCALE)
and we arrange that linking that module is what brings in all the code
associated with this category. */
#define DEFINE_CATEGORY(category, category_name, items, a) \
-extern __thread struct locale_data *const *_nl_current_##category \
+extern __thread struct __locale_data *const *_nl_current_##category \
attribute_hidden attribute_tls_model_ie;
#include "categories.def"
#undef DEFINE_CATEGORY
-/* Return a pointer to the current `struct locale_data' for CATEGORY. */
+/* Return a pointer to the current `struct __locale_data' for CATEGORY. */
#define _NL_CURRENT_DATA(category) (*_nl_current_##category)
/* Extract the current CATEGORY locale's string for ITEM. */
@@ -254,7 +254,7 @@ extern __thread struct locale_data *const *_nl_current_##category \
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
#define _NL_CURRENT_DEFINE(category) \
- __thread struct locale_data *const *_nl_current_##category \
+ __thread struct __locale_data *const *_nl_current_##category \
attribute_hidden = &_nl_global_locale.__locales[category]; \
asm (_NL_CURRENT_DEFINE_STRINGIFY (ASM_GLOBAL_DIRECTIVE) \
" " __SYMBOL_PREFIX "_nl_current_" #category "_used\n" \
@@ -272,7 +272,7 @@ extern __thread struct locale_data *const *_nl_current_##category \
/* All categories are always loaded in the shared library, so there is no
point in having lots of separate symbols for linking. */
-/* Return a pointer to the current `struct locale_data' for CATEGORY. */
+/* Return a pointer to the current `struct __locale_data' for CATEGORY. */
# define _NL_CURRENT_DATA(category) \
(_NL_CURRENT_LOCALE->__locales[category])
@@ -304,9 +304,9 @@ extern const char _nl_default_locale_path[] attribute_hidden;
those directories are searched for the locale files. If it's null,
the locale archive is checked first and then _nl_default_locale_path
is searched for locale files. */
-extern struct locale_data *_nl_find_locale (const char *locale_path,
- size_t locale_path_len,
- int category, const char **name)
+extern struct __locale_data *_nl_find_locale (const char *locale_path,
+ size_t locale_path_len,
+ int category, const char **name)
internal_function attribute_hidden;
/* Try to load the file described by FILE. */
@@ -314,11 +314,11 @@ extern void _nl_load_locale (struct loaded_l10nfile *file, int category)
internal_function attribute_hidden;
/* Free all resource. */
-extern void _nl_unload_locale (struct locale_data *locale)
+extern void _nl_unload_locale (struct __locale_data *locale)
internal_function attribute_hidden;
/* Free the locale and give back all memory if the usage count is one. */
-extern void _nl_remove_locale (int locale, struct locale_data *data)
+extern void _nl_remove_locale (int locale, struct __locale_data *data)
internal_function attribute_hidden;
/* Find the locale *NAMEP in the locale archive, and return the
@@ -326,8 +326,8 @@ extern void _nl_remove_locale (int locale, struct locale_data *data)
already been loaded from the archive, just returns the existing data
structure. If successful, sets *NAMEP to point directly into the mapped
archive string table; that way, the next call can short-circuit strcmp. */
-extern struct locale_data *_nl_load_locale_from_archive (int category,
- const char **namep)
+extern struct __locale_data *_nl_load_locale_from_archive (int category,
+ const char **namep)
internal_function attribute_hidden;
/* Subroutine of setlocale's __libc_subfreeres hook. */
@@ -341,42 +341,42 @@ extern void _nl_locale_subfreeres (void) attribute_hidden;
and `name' fields uninitialized, for the caller to fill in.
If any bogons are detected in the data, this will refuse to
intern it, and return a null pointer instead. */
-extern struct locale_data *_nl_intern_locale_data (int category,
- const void *data,
- size_t datasize)
+extern struct __locale_data *_nl_intern_locale_data (int category,
+ const void *data,
+ size_t datasize)
internal_function attribute_hidden;
/* Return `era' entry which corresponds to TP. Used in strftime. */
extern struct era_entry *_nl_get_era_entry (const struct tm *tp,
- struct locale_data *lc_time)
+ struct __locale_data *lc_time)
internal_function attribute_hidden;
/* Return `era' cnt'th entry . Used in strptime. */
extern struct era_entry *_nl_select_era_entry (int cnt,
- struct locale_data *lc_time)
- internal_function attribute_hidden;
+ struct __locale_data *lc_time)
+ internal_function attribute_hidden;
/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
extern const char *_nl_get_alt_digit (unsigned int number,
- struct locale_data *lc_time)
- internal_function attribute_hidden;
+ struct __locale_data *lc_time)
+ internal_function attribute_hidden;
/* Similar, but now for wide characters. */
extern const wchar_t *_nl_get_walt_digit (unsigned int number,
- struct locale_data *lc_time)
+ struct __locale_data *lc_time)
internal_function attribute_hidden;
/* Parse string as alternative digit and return numeric value. */
extern int _nl_parse_alt_digit (const char **strp,
- struct locale_data *lc_time)
+ struct __locale_data *lc_time)
internal_function attribute_hidden;
/* Postload processing. */
extern void _nl_postload_ctype (void);
/* Functions used for the `private.cleanup' hook. */
-extern void _nl_cleanup_time (struct locale_data *)
+extern void _nl_cleanup_time (struct __locale_data *)
internal_function attribute_hidden;
diff --git a/libc/locale/nl_langinfo_l.c b/libc/locale/nl_langinfo_l.c
index 08e1534a8..573fed0c4 100644
--- a/libc/locale/nl_langinfo_l.c
+++ b/libc/locale/nl_langinfo_l.c
@@ -1,5 +1,5 @@
/* User interface for extracting locale-dependent parameters.
- Copyright (C) 1995-1997,1999-2002,2005,2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-1997,1999-2002,2005,2007,2010 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,7 +33,7 @@ __nl_langinfo_l (item, l)
{
int category = _NL_ITEM_CATEGORY (item);
unsigned int index = _NL_ITEM_INDEX (item);
- const struct locale_data *data;
+ const struct __locale_data *data;
if (category < 0 || category == LC_ALL || category >= __LC_LAST)
/* Bogus category: bogus item. */
diff --git a/libc/locale/setlocale.c b/libc/locale/setlocale.c
index 9593483d9..fad726287 100644
--- a/libc/locale/setlocale.c
+++ b/libc/locale/setlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006, 2008
+/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006, 2008, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -177,7 +177,7 @@ setname (int category, const char *name)
/* Put DATA in *_nl_current[CATEGORY]. */
static inline void
-setdata (int category, struct locale_data *data)
+setdata (int category, struct __locale_data *data)
{
if (CATEGORY_USED (category))
{
@@ -243,7 +243,7 @@ setlocale (int category, const char *locale)
composite locale name. This is a semi-colon separated list
of entries of the form `CATEGORY=VALUE'. */
const char *newnames[__LC_LAST];
- struct locale_data *newdata[__LC_LAST];
+ struct __locale_data *newdata[__LC_LAST];
/* Set all name pointers to the argument name. */
for (category = 0; category < __LC_LAST; ++category)
@@ -370,7 +370,7 @@ setlocale (int category, const char *locale)
}
else
{
- struct locale_data *newdata = NULL;
+ struct __locale_data *newdata = NULL;
const char *newname[1] = { locale };
if (CATEGORY_USED (category))
@@ -435,7 +435,7 @@ libc_hidden_def (setlocale)
static void __libc_freeres_fn_section
free_category (int category,
- struct locale_data *here, struct locale_data *c_data)
+ struct __locale_data *here, struct locale_data *c_data)
{
struct loaded_l10nfile *runp = _nl_locale_file_list[category];
@@ -451,7 +451,7 @@ free_category (int category,
while (runp != NULL)
{
struct loaded_l10nfile *curr = runp;
- struct locale_data *data = (struct locale_data *) runp->data;
+ struct __locale_data *data = (struct locale_data *) runp->data;
if (data != NULL && data != c_data)
_nl_unload_locale (data);
@@ -472,7 +472,7 @@ _nl_locale_subfreeres (void)
# define DEFINE_CATEGORY(category, category_name, items, a) \
if (CATEGORY_USED (category)) \
{ \
- extern struct locale_data _nl_C_##category; \
+ extern struct __locale_data _nl_C_##category; \
weak_extern (_nl_C_##category) \
free_category (category, *_nl_current_##category, &_nl_C_##category); \
}
diff --git a/libc/locale/xlocale.c b/libc/locale/xlocale.c
index 944378bc9..a492d27cb 100644
--- a/libc/locale/xlocale.c
+++ b/libc/locale/xlocale.c
@@ -1,5 +1,5 @@
/* C locale object.
- Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
@@ -23,7 +23,7 @@
#include "localeinfo.h"
#define DEFINE_CATEGORY(category, category_name, items, a) \
-extern struct locale_data _nl_C_##category;
+extern struct __locale_data _nl_C_##category;
#include "categories.def"
#undef DEFINE_CATEGORY
diff --git a/libc/locale/xlocale.h b/libc/locale/xlocale.h
index e879212b7..ce541528c 100644
--- a/libc/locale/xlocale.h
+++ b/libc/locale/xlocale.h
@@ -1,5 +1,5 @@
/* Definition of locale datatype.
- Copyright (C) 1997,2000,2002,2009 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,2002,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,7 +28,7 @@
typedef struct __locale_struct
{
/* Note: LC_ALL is not a valid index into this array. */
- struct locale_data *__locales[13]; /* 13 = __LC_LAST. */
+ struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */
/* To increase the speed of this solution we add some special members. */
const unsigned short int *__ctype_b;
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 88284268a..e2f26deec 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-25 Andreas Schwab <schwab@redhat.com>
+
+ * locales/i18n: Don't map U00DF to U1E9E in toupper table.
+
2009-11-24 Ulrich Drepper <drepper@redhat.com>
* locales/hsb_DE: Define week, first_weekday, and first_workday.
diff --git a/libc/localedata/locales/i18n b/libc/localedata/locales/i18n
index 8afbb717f..4f8b9e159 100644
--- a/libc/localedata/locales/i18n
+++ b/libc/localedata/locales/i18n
@@ -928,8 +928,7 @@ toupper /
(<U006D>,<U004D>);(<U006E>,<U004E>);(<U006F>,<U004F>);(<U0070>,<U0050>);/
(<U0071>,<U0051>);(<U0072>,<U0052>);(<U0073>,<U0053>);(<U0074>,<U0054>);/
(<U0075>,<U0055>);(<U0076>,<U0056>);(<U0077>,<U0057>);(<U0078>,<U0058>);/
- (<U0079>,<U0059>);(<U007A>,<U005A>);(<U00B5>,<U039C>);(<U00DF>,<U1E9E>);/
- (<U00E0>,<U00C0>);/
+ (<U0079>,<U0059>);(<U007A>,<U005A>);(<U00B5>,<U039C>);(<U00E0>,<U00C0>);/
(<U00E1>,<U00C1>);(<U00E2>,<U00C2>);(<U00E3>,<U00C3>);(<U00E4>,<U00C4>);/
(<U00E5>,<U00C5>);(<U00E6>,<U00C6>);(<U00E7>,<U00C7>);(<U00E8>,<U00C8>);/
(<U00E9>,<U00C9>);(<U00EA>,<U00CA>);(<U00EB>,<U00CB>);(<U00EC>,<U00CC>);/
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index ea10d17f8..b43e454f6 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -6369,16 +6369,19 @@ malloc_info (int options, FILE *fp)
mbinptr bin = bin_at (ar_ptr, 1);
struct malloc_chunk *r = bin->fd;
- while (r != bin)
+ if (r != NULL)
{
- ++sizes[NFASTBINS].count;
- sizes[NFASTBINS].total += r->size;
- sizes[NFASTBINS].from = MIN (sizes[NFASTBINS].from, r->size);
- sizes[NFASTBINS].to = MAX (sizes[NFASTBINS].to, r->size);
- r = r->fd;
+ while (r != bin)
+ {
+ ++sizes[NFASTBINS].count;
+ sizes[NFASTBINS].total += r->size;
+ sizes[NFASTBINS].from = MIN (sizes[NFASTBINS].from, r->size);
+ sizes[NFASTBINS].to = MAX (sizes[NFASTBINS].to, r->size);
+ r = r->fd;
+ }
+ nblocks += sizes[NFASTBINS].count;
+ avail += sizes[NFASTBINS].total;
}
- nblocks += sizes[NFASTBINS].count;
- avail += sizes[NFASTBINS].total;
for (size_t i = 2; i < NBINS; ++i)
{
@@ -6388,17 +6391,18 @@ malloc_info (int options, FILE *fp)
sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
= sizes[NFASTBINS - 1 + i].count = 0;
- while (r != bin)
- {
- ++sizes[NFASTBINS - 1 + i].count;
- sizes[NFASTBINS - 1 + i].total += r->size;
- sizes[NFASTBINS - 1 + i].from = MIN (sizes[NFASTBINS - 1 + i].from,
+ if (r != NULL)
+ while (r != bin)
+ {
+ ++sizes[NFASTBINS - 1 + i].count;
+ sizes[NFASTBINS - 1 + i].total += r->size;
+ sizes[NFASTBINS - 1 + i].from
+ = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
+ sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
r->size);
- sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
- r->size);
- r = r->fd;
- }
+ r = r->fd;
+ }
if (sizes[NFASTBINS - 1 + i].count == 0)
sizes[NFASTBINS - 1 + i].from = 0;
@@ -6460,6 +6464,9 @@ malloc_info (int options, FILE *fp)
fputs ("</heap>\n", fp);
}
+ if(__malloc_initialized < 0)
+ ptmalloc_init ();
+
fputs ("<malloc version=\"1\">\n", fp);
/* Iterate over all arenas currently in use. */
diff --git a/libc/manual/install.texi b/libc/manual/install.texi
index 58f2d3d35..6744699b8 100644
--- a/libc/manual/install.texi
+++ b/libc/manual/install.texi
@@ -330,16 +330,15 @@ bugs or lack features.
@item
GCC 3.4 or newer, GCC 4.1 recommended
-The GNU C library can only be compiled with the GNU C compiler family.
-For the 2.3 releases, GCC 3.2 or higher is required; GCC 3.4 is the
-compiler we advise to use for 2.3 versions.
-For the 2.4 release, GCC 3.4 or higher is required; as of this
-writing, GCC 4.1 is the compiler we advise to use for current versions.
+For the 2.4 release or later, GCC 3.4 or higher is required; as of this
+writing, GCC 4.4 is the compiler we advise to use for current versions.
On certain machines including @code{powerpc64}, compilers prior to GCC
4.0 have bugs that prevent them compiling the C library code in the
2.4 release. On other machines, GCC 4.1 is required to build the C
library with support for the correct @code{long double} type format;
-these include @code{powerpc} (32 bit), @code{s390} and @code{s390x}.
+these include @code{powerpc} (32 bit), @code{s390} and @code{s390x}. For
+other architectures special compiler-provided headers are needed
+(like @file{cpuid.h} on x86) which only come with later compiler versions.
You can use whatever compiler you like to compile programs that use GNU
libc, but be aware that both GCC 2.7 and 2.8 have bugs in their
diff --git a/libc/misc/bits/syslog.h b/libc/misc/bits/syslog.h
index 853b30c84..5d64d7acb 100644
--- a/libc/misc/bits/syslog.h
+++ b/libc/misc/bits/syslog.h
@@ -1,5 +1,5 @@
/* Checking macros for syslog functions.
- Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2010 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,7 +29,7 @@ extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...)
__extern_always_inline void
syslog (int __pri, __const char *__fmt, ...)
{
- return __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
+ __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
}
#elif !defined __cplusplus
# define syslog(pri, ...) \
@@ -45,6 +45,6 @@ extern void __vsyslog_chk (int __pri, int __flag, __const char *__fmt,
__extern_always_inline void
vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
{
- return __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
+ __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
}
#endif
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 389bed4a6..c81eb03b7 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,34 @@
+2010-01-15 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
+ Fix unwind info.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
+
+2010-01-15 Michal Schmidt <mschmidt@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
+ Fix pthread_cond_timedwait with requeue-PI.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
+ Fix pthread_cond_wait with requeue-PI.
+
+2010-01-14 Ulrich Drepper <drepper@redhat.com>
+
+ * Versions: Add pthread_mutex_consistent, pthread_mutexattr_getrobust,
+ and pthread_mutexattr_setrobust for GLIBC_2.12.
+ * pthread_mutex_consistent.c: Define alias pthread_mutex_consistent.
+ * pthread_mutexattr_getrobust.c: Define alias
+ pthread_mutexattr_getrobust.
+ * pthread_mutexattr_setrobust.c: Define alias
+ pthread_mutexattr_setrobust.
+
+2010-01-12 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/pthread/pthread.h: Cleanup. Fix up for XPG7.
+
+2010-01-08 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/pthread/pthread.h: Fix pthread_mutex_consistent declaration.
+
2009-12-18 Thomas Schwinge <thomas@codesourcery.com>
* sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c (_init): Don't
diff --git a/libc/nptl/Versions b/libc/nptl/Versions
index 09098bf98..1f2de79fd 100644
--- a/libc/nptl/Versions
+++ b/libc/nptl/Versions
@@ -244,6 +244,11 @@ libpthread {
pthread_sigqueue;
};
+ GLIBC_2.12 {
+ pthread_mutex_consistent; pthread_mutexattr_getrobust;
+ pthread_mutexattr_setrobust;
+ };
+
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
diff --git a/libc/nptl/pthread_mutex_consistent.c b/libc/nptl/pthread_mutex_consistent.c
index d4f287b75..9ca3e1397 100644
--- a/libc/nptl/pthread_mutex_consistent.c
+++ b/libc/nptl/pthread_mutex_consistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -22,7 +22,7 @@
int
-pthread_mutex_consistent_np (mutex)
+pthread_mutex_consistent (mutex)
pthread_mutex_t *mutex;
{
/* Test whether this is a robust mutex with a dead owner. */
@@ -34,3 +34,4 @@ pthread_mutex_consistent_np (mutex)
return 0;
}
+weak_alias (pthread_mutex_consistent, pthread_mutex_consistent_np)
diff --git a/libc/nptl/pthread_mutexattr_getrobust.c b/libc/nptl/pthread_mutexattr_getrobust.c
index 5ec43d1f7..9e61bb0f0 100644
--- a/libc/nptl/pthread_mutexattr_getrobust.c
+++ b/libc/nptl/pthread_mutexattr_getrobust.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -21,7 +21,7 @@
int
-pthread_mutexattr_getrobust_np (attr, robustness)
+pthread_mutexattr_getrobust (attr, robustness)
const pthread_mutexattr_t *attr;
int *robustness;
{
@@ -34,3 +34,4 @@ pthread_mutexattr_getrobust_np (attr, robustness)
return 0;
}
+weak_alias (pthread_mutexattr_getrobust, pthread_mutexattr_getrobust_np)
diff --git a/libc/nptl/pthread_mutexattr_setrobust.c b/libc/nptl/pthread_mutexattr_setrobust.c
index cf95e35b6..df51ef53b 100644
--- a/libc/nptl/pthread_mutexattr_setrobust.c
+++ b/libc/nptl/pthread_mutexattr_setrobust.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -22,7 +22,7 @@
int
-pthread_mutexattr_setrobust_np (attr, robustness)
+pthread_mutexattr_setrobust (attr, robustness)
pthread_mutexattr_t *attr;
int robustness;
{
@@ -41,3 +41,4 @@ pthread_mutexattr_setrobust_np (attr, robustness)
return 0;
}
+weak_alias (pthread_mutexattr_setrobust, pthread_mutexattr_setrobust_np)
diff --git a/libc/nptl/sysdeps/pthread/pthread.h b/libc/nptl/sysdeps/pthread/pthread.h
index d71b4cc47..b84fd5c7a 100644
--- a/libc/nptl/sysdeps/pthread/pthread.h
+++ b/libc/nptl/sysdeps/pthread/pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,8 +25,6 @@
#include <sched.h>
#include <time.h>
-#define __need_sigset_t
-#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
#include <bits/wordsize.h>
@@ -49,7 +47,7 @@ enum
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ADAPTIVE_NP
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
,
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
@@ -739,8 +737,8 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
- __const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __const struct timespec *__restrict
+ __abstime) __THROW __nonnull ((1, 2));
#endif
/* Unlock a mutex. */
@@ -748,7 +746,6 @@ extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
__THROW __nonnull ((1));
-#ifdef __USE_UNIX98
/* Get the priority ceiling of MUTEX. */
extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
__restrict __mutex,
@@ -761,12 +758,11 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
int __prioceiling,
int *__restrict __old_ceiling)
__THROW __nonnull ((1, 3));
-#endif
#ifdef __USE_XOPEN2K8
/* Declare the state protected by MUTEX as consistent. */
-extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
+extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
__THROW __nonnull ((1));
# ifdef __USE_GNU
extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
@@ -797,7 +793,7 @@ extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
int __pshared)
__THROW __nonnull ((1));
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
/* Return in *KIND the mutex kind attribute in *ATTR. */
extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
__attr, int *__restrict __kind)
@@ -808,6 +804,7 @@ extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
PTHREAD_MUTEX_DEFAULT). */
extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
__THROW __nonnull ((1));
+#endif
/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */
extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
@@ -831,7 +828,6 @@ extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
int __prioceiling)
__THROW __nonnull ((1));
-#endif
#ifdef __USE_XOPEN2K
/* Get the robustness flag of the mutex attribute ATTR. */
@@ -990,13 +986,13 @@ extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
/* Get the process-shared flag of the condition variable attribute ATTR. */
extern int pthread_condattr_getpshared (__const pthread_condattr_t *
- __restrict __attr,
- int *__restrict __pshared)
+ __restrict __attr,
+ int *__restrict __pshared)
__THROW __nonnull ((1, 2));
/* Set the process-shared flag of the condition variable attribute ATTR. */
extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
- int __pshared) __THROW __nonnull ((1));
+ int __pshared) __THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
/* Get the clock selected for the conditon variable attribute ATTR. */
@@ -1071,7 +1067,7 @@ extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
/* Set the process-shared flag of the barrier attribute ATTR. */
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
- int __pshared)
+ int __pshared)
__THROW __nonnull ((1));
#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 218762a8a..dee73f0c3 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004, 2006-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004,2006-2007,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -57,7 +57,6 @@ __pthread_cond_timedwait:
pushl %ebx
cfi_adjust_cfa_offset(4)
cfi_rel_offset(%ebx, 0)
- cfi_remember_state
movl 20(%esp), %ebx
movl 28(%esp), %ebp
@@ -99,6 +98,7 @@ __pthread_cond_timedwait:
#define FRAME_SIZE 32
subl $FRAME_SIZE, %esp
cfi_adjust_cfa_offset(FRAME_SIZE)
+ cfi_remember_state
/* Get and store current wakeup_seq value. */
movl wakeup_seq(%ebx), %edi
@@ -326,14 +326,12 @@ __pthread_cond_timedwait:
#endif
jne 10f
-11: xorl %eax, %eax
+11: movl 24+FRAME_SIZE(%esp), %eax
/* With requeue_pi, the mutex lock is held in the kernel. */
movl 24(%esp), %ecx
testl %ecx, %ecx
- jnz 26f
+ jnz 27f
- /* Remove cancellation handler. */
- movl 24+FRAME_SIZE(%esp), %eax
call __pthread_mutex_cond_lock
26: addl $FRAME_SIZE, %esp
cfi_adjust_cfa_offset(-FRAME_SIZE);
@@ -366,8 +364,10 @@ __pthread_cond_timedwait:
cfi_restore_state
27: call __pthread_mutex_cond_lock_adjust
+ xorl %eax, %eax
jmp 26b
+ cfi_adjust_cfa_offset(-FRAME_SIZE);
/* Initial locking failed. */
1:
#if cond_lock == 0
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index b3b8bc4be..53970d755 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004, 2006-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004,2006-2007,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -57,7 +57,6 @@ __pthread_cond_wait:
pushl %ebx
cfi_adjust_cfa_offset(4)
cfi_rel_offset(%ebx, 0)
- cfi_remember_state
xorl %esi, %esi
movl 20(%esp), %ebx
@@ -95,6 +94,7 @@ __pthread_cond_wait:
#define FRAME_SIZE 20
subl $FRAME_SIZE, %esp
cfi_adjust_cfa_offset(FRAME_SIZE)
+ cfi_remember_state
/* Get and store current wakeup_seq value. */
movl wakeup_seq(%ebx), %edi
@@ -247,12 +247,11 @@ __pthread_cond_wait:
jne 10f
/* With requeue_pi, the mutex lock is held in the kernel. */
-11: xorl %eax, %eax
+11: movl 24+FRAME_SIZE(%esp), %eax
movl 16(%esp), %ecx
testl %ecx, %ecx
- jnz 20f
+ jnz 21f
- movl 24+FRAME_SIZE(%esp), %eax
call __pthread_mutex_cond_lock
20: addl $FRAME_SIZE, %esp
cfi_adjust_cfa_offset(-FRAME_SIZE);
@@ -279,6 +278,7 @@ __pthread_cond_wait:
xorl %eax, %eax
jmp 20b
+ cfi_adjust_cfa_offset(-FRAME_SIZE);
/* Initial locking failed. */
1:
#if cond_lock == 0
diff --git a/libc/posix/confstr.c b/libc/posix/confstr.c
index 91cd144ed..b5b41854d 100644
--- a/libc/posix/confstr.c
+++ b/libc/posix/confstr.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1996,1997,2000-2004,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1996,1997,2000-2004,2009,2010 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,7 +58,7 @@ confstr (name, buf, len)
# error "__ILP32_OFF32_CFLAGS should not be defined"
# elif !defined _POSIX_V7_ILP32_OFF32
if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
- break;
+ break;
# endif
string = __ILP32_OFF32_CFLAGS;
string_len = sizeof (__ILP32_OFF32_CFLAGS);
@@ -72,7 +73,7 @@ confstr (name, buf, len)
# error "__ILP32_OFFBIG_CFLAGS should not be defined"
# elif !defined _POSIX_V7_ILP32_OFFBIG
if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
- break;
+ break;
# endif
string = __ILP32_OFFBIG_CFLAGS;
string_len = sizeof (__ILP32_OFFBIG_CFLAGS);
@@ -87,7 +88,7 @@ confstr (name, buf, len)
# error "__LP64_OFF64_CFLAGS should not be defined"
# elif !defined _POSIX_V7_LP64_OFF64
if (__sysconf (_SC_V7_LP64_OFF64) < 0)
- break;
+ break;
# endif
string = __LP64_OFF64_CFLAGS;
string_len = sizeof (__LP64_OFF64_CFLAGS);
@@ -102,7 +103,7 @@ confstr (name, buf, len)
# error "__ILP32_OFF32_LDFLAGS should not be defined"
# elif !defined _POSIX_V7_ILP32_OFF32
if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
- break;
+ break;
# endif
string = __ILP32_OFF32_LDFLAGS;
string_len = sizeof (__ILP32_OFF32_LDFLAGS);
@@ -117,7 +118,7 @@ confstr (name, buf, len)
# error "__ILP32_OFFBIG_LDFLAGS should not be defined"
# elif !defined _POSIX_V7_ILP32_OFFBIG
if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
- break;
+ break;
# endif
string = __ILP32_OFFBIG_LDFLAGS;
string_len = sizeof (__ILP32_OFFBIG_LDFLAGS);
@@ -132,7 +133,7 @@ confstr (name, buf, len)
# error "__LP64_OFF64_LDFLAGS should not be defined"
# elif !defined _POSIX_V7_LP64_OFF64
if (__sysconf (_SC_V7_LP64_OFF64) < 0)
- break;
+ break;
# endif
string = __LP64_OFF64_LDFLAGS;
string_len = sizeof (__LP64_OFF64_LDFLAGS);
@@ -217,6 +218,13 @@ confstr (name, buf, len)
return 0;
#endif
+ case _CS_V6_ENV:
+ case _CS_V7_ENV:
+ /* Maybe something else is needed in future. */
+ string = "POSIXLY_CORRECT=1";
+ string_len = sizeof ("POSIXLY_CORRECT=1");
+ break;
+
default:
__set_errno (EINVAL);
return 0;
diff --git a/libc/posix/confstr.inc b/libc/posix/confstr.inc
index d046edb1a..ee8830408 100644
--- a/libc/posix/confstr.inc
+++ b/libc/posix/confstr.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008
+/* Copyright (C) 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -33,52 +33,52 @@
string_len = 0;
#ifndef _POSIX_V7_ILP32_OFF32
- if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
#endif
#if !defined _POSIX_V7_ILP32_OFF32 || _POSIX_V7_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
- sizeof "POSIX_V7_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
+ sizeof "POSIX_V7_ILP32_OFF32" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _POSIX_V7_ILP32_OFFBIG
- if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
#endif
#if !defined _POSIX_V7_ILP32_OFFBIG || _POSIX_V7_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
- sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
+ sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _POSIX_V7_LP64_OFF64
- if (__sysconf (_SC_V7_LP64_OFF64) > 0)
+ if (__sysconf (_SC_V7_LP64_OFF64) > 0)
#endif
#if !defined _POSIX_V7_LP64_OFF64 || _POSIX_V7_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
- sizeof "POSIX_V7_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
+ sizeof "POSIX_V7_LP64_OFF64" - 1);
+ string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
+ }
#endif
#ifndef _POSIX_V7_LPBIG_OFFBIG
- if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
#endif
#if !defined _POSIX_V7_LPBIG_OFFBIG || _POSIX_V7_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
- sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
+ sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
string = restenvs;
}
break;
@@ -96,52 +96,52 @@
string_len = 0;
#ifndef _POSIX_V6_ILP32_OFF32
- if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
#endif
#if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32",
- sizeof "POSIX_V6_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32",
+ sizeof "POSIX_V6_ILP32_OFF32" - 1);
+ string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _POSIX_V6_ILP32_OFFBIG
- if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
#endif
#if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG",
- sizeof "POSIX_V6_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG",
+ sizeof "POSIX_V6_ILP32_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _POSIX_V6_LP64_OFF64
- if (__sysconf (_SC_V6_LP64_OFF64) > 0)
+ if (__sysconf (_SC_V6_LP64_OFF64) > 0)
#endif
#if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64",
- sizeof "POSIX_V6_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V6_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64",
+ sizeof "POSIX_V6_LP64_OFF64" - 1);
+ string_len += sizeof "POSIX_V6_LP64_OFF64" - 1;
+ }
#endif
#ifndef _POSIX_V6_LPBIG_OFFBIG
- if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
#endif
#if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG",
- sizeof "POSIX_V6_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG",
+ sizeof "POSIX_V6_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
string = restenvs;
}
break;
@@ -159,52 +159,52 @@
string_len = 0;
#ifndef _XBS5_ILP32_OFF32
- if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
#endif
#if !defined _XBS5_ILP32_OFF32 || _XBS5_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
- sizeof "XBS5_ILP32_OFF32" - 1);
- string_len += sizeof "XBS5_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
+ sizeof "XBS5_ILP32_OFF32" - 1);
+ string_len += sizeof "XBS5_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _XBS5_ILP32_OFFBIG
- if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
#endif
#if !defined _XBS5_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
- sizeof "XBS5_ILP32_OFFBIG" - 1);
- string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
+ sizeof "XBS5_ILP32_OFFBIG" - 1);
+ string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _XBS5_LP64_OFF64
- if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
+ if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
#endif
#if !defined _XBS5_LP64_OFF64 || _XBS5_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
- sizeof "XBS5_LP64_OFF64" - 1);
- string_len += sizeof "XBS5_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
+ sizeof "XBS5_LP64_OFF64" - 1);
+ string_len += sizeof "XBS5_LP64_OFF64" - 1;
+ }
#endif
#ifndef _XBS5_LPBIG_OFFBIG
- if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
#endif
#if !defined _XBS5_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
- sizeof "XBS5_LPBIG_OFFBIG" - 1);
- string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
+ sizeof "XBS5_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
string = restenvs;
}
break;
diff --git a/libc/posix/glob.h b/libc/posix/glob.h
index 3d401f082..89a1886b2 100644
--- a/libc/posix/glob.h
+++ b/libc/posix/glob.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995-1998,2000,2001,2004,2010
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +28,7 @@ __BEGIN_DECLS
#ifndef __size_t
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
-# ifdef __USE_XOPEN
+# if defined __USE_XOPEN || __USE_XOPEN2K8
typedef __SIZE_TYPE__ size_t;
# endif
# else
diff --git a/libc/posix/regcomp.c b/libc/posix/regcomp.c
index eefe1b124..4f35d6b55 100644
--- a/libc/posix/regcomp.c
+++ b/libc/posix/regcomp.c
@@ -1,6 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002,2003,2004,2005,2006,2007,2009
- Free Software Foundation, Inc.
+ Copyright (C) 2002-2007,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -416,8 +415,8 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
!= (size_t) -1)
re_set_fastmap (fastmap, false, *(unsigned char *) buf);
}
- }
- }
+ }
+ }
}
#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
else if (type == OP_PERIOD
@@ -622,7 +621,7 @@ free_dfa_content (re_dfa_t *dfa)
re_dfastate_t *state = entry->array[j];
free_state (state);
}
- re_free (entry->array);
+ re_free (entry->array);
}
re_free (dfa->state_table);
#ifdef RE_ENABLE_I18N
@@ -1010,7 +1009,11 @@ create_initial_state (re_dfa_t *dfa)
int dest_idx = dfa->edests[node_idx].elems[0];
if (!re_node_set_contains (&init_nodes, dest_idx))
{
- re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
+ reg_errcode_t err = re_node_set_merge (&init_nodes,
+ dfa->eclosures
+ + dest_idx);
+ if (err != REG_NOERROR)
+ return err;
i = 0;
}
}
@@ -1076,8 +1079,8 @@ optimize_utf8 (re_dfa_t *dfa)
}
break;
case OP_PERIOD:
- has_period = 1;
- break;
+ has_period = 1;
+ break;
case OP_BACK_REF:
case OP_ALT:
case END_OF_RE:
@@ -1090,7 +1093,7 @@ optimize_utf8 (re_dfa_t *dfa)
case SIMPLE_BRACKET:
/* Just double check. The non-ASCII range starts at 0x80. */
assert (0x80 % BITSET_WORD_BITS == 0);
- for (i = 0x80 / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
+ for (i = 0x80 / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
if (dfa->nodes[node].opr.sbcset[i])
return;
break;
@@ -1171,7 +1174,7 @@ analyze (regex_t *preg)
{
dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len);
if (BE (dfa->inveclosures == NULL, 0))
- return REG_ESPACE;
+ return REG_ESPACE;
ret = calc_inveclosure (dfa);
}
@@ -1193,16 +1196,16 @@ postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
if that's the only child). */
while (node->left || node->right)
if (node->left)
- node = node->left;
- else
- node = node->right;
+ node = node->left;
+ else
+ node = node->right;
do
{
reg_errcode_t err = fn (extra, node);
if (BE (err != REG_NOERROR, 0))
return err;
- if (node->parent == NULL)
+ if (node->parent == NULL)
return REG_NOERROR;
prev = node;
node = node->parent;
@@ -1236,7 +1239,7 @@ preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
prev = node;
node = node->parent;
if (!node)
- return REG_NOERROR;
+ return REG_NOERROR;
}
node = node->right;
}
@@ -1259,13 +1262,13 @@ optimize_subexps (void *extra, bin_tree_t *node)
}
else if (node->token.type == SUBEXP
- && node->left && node->left->token.type == SUBEXP)
+ && node->left && node->left->token.type == SUBEXP)
{
int other_idx = node->left->token.opr.idx;
node->left = node->left->left;
if (node->left)
- node->left->parent = node;
+ node->left->parent = node;
dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx];
if (other_idx < BITSET_WORD_BITS)
@@ -1350,9 +1353,9 @@ calc_first (void *extra, bin_tree_t *node)
node->first = node;
node->node_idx = re_dfa_add_node (dfa, node->token);
if (BE (node->node_idx == -1, 0))
- return REG_ESPACE;
+ return REG_ESPACE;
if (node->token.type == ANCHOR)
- dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
+ dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
}
return REG_NOERROR;
}
@@ -1374,7 +1377,7 @@ calc_next (void *extra, bin_tree_t *node)
if (node->left)
node->left->next = node->next;
if (node->right)
- node->right->next = node->next;
+ node->right->next = node->next;
break;
}
return REG_NOERROR;
@@ -1425,7 +1428,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node)
case OP_BACK_REF:
dfa->nexts[idx] = node->next->node_idx;
if (node->token.type == OP_BACK_REF)
- re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
+ err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
break;
default:
@@ -1653,9 +1656,10 @@ static reg_errcode_t
calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
{
reg_errcode_t err;
- int i, incomplete;
+ int i;
re_node_set eclosure;
- incomplete = 0;
+ int ret;
+ int incomplete = 0;
err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
if (BE (err != REG_NOERROR, 0))
return err;
@@ -1700,7 +1704,9 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
else
eclosure_elem = dfa->eclosures[edest];
/* Merge the epsilon closure of `edest'. */
- re_node_set_merge (&eclosure, &eclosure_elem);
+ err = re_node_set_merge (&eclosure, &eclosure_elem);
+ if (BE (err != REG_NOERROR, 0))
+ return err;
/* If the epsilon closure of `edest' is incomplete,
the epsilon closure of this node is also incomplete. */
if (dfa->eclosures[edest].nelem == 0)
@@ -1710,8 +1716,10 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
}
}
- /* Epsilon closures include itself. */
- re_node_set_insert (&eclosure, node);
+ /* An epsilon closure includes itself. */
+ ret = re_node_set_insert (&eclosure, node);
+ if (BE (ret < 0, 0))
+ return REG_ESPACE;
if (incomplete && !root)
dfa->eclosures[node].nelem = 0;
else
@@ -2295,7 +2303,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
&& dfa->word_ops_used == 0)
init_word_char (dfa);
if (token->opr.ctx_type == WORD_DELIM
- || token->opr.ctx_type == NOT_WORD_DELIM)
+ || token->opr.ctx_type == NOT_WORD_DELIM)
{
bin_tree_t *tree_first, *tree_last;
if (token->opr.ctx_type == WORD_DELIM)
@@ -2303,13 +2311,13 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
token->opr.ctx_type = WORD_FIRST;
tree_first = create_token_tree (dfa, NULL, NULL, token);
token->opr.ctx_type = WORD_LAST;
- }
- else
- {
+ }
+ else
+ {
token->opr.ctx_type = INSIDE_WORD;
tree_first = create_token_tree (dfa, NULL, NULL, token);
token->opr.ctx_type = INSIDE_NOTWORD;
- }
+ }
tree_last = create_token_tree (dfa, NULL, NULL, token);
tree = create_tree (dfa, tree_first, tree_last, OP_ALT);
if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0))
@@ -2420,7 +2428,7 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
- *err = REG_EPAREN;
+ *err = REG_EPAREN;
if (BE (*err != REG_NOERROR, 0))
return NULL;
}
@@ -2551,11 +2559,11 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
elem = duplicate_tree (elem, dfa);
tree = create_tree (dfa, tree, elem, CONCAT);
if (BE (elem == NULL || tree == NULL, 0))
- goto parse_dup_op_espace;
+ goto parse_dup_op_espace;
tree = create_tree (dfa, tree, NULL, OP_ALT);
if (BE (tree == NULL, 0))
- goto parse_dup_op_espace;
+ goto parse_dup_op_espace;
}
if (old_tree)
@@ -2636,9 +2644,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
no MBCSET if dfa_mb_cur_max (dfa) == 1. */
if (mbcset)
{
- /* Check the space of the arrays. */
- if (BE (*range_alloc == mbcset->nranges, 0))
- {
+ /* Check the space of the arrays. */
+ if (BE (*range_alloc == mbcset->nranges, 0))
+ {
/* There is not enough space, need realloc. */
wchar_t *new_array_start, *new_array_end;
int new_nranges;
@@ -2648,9 +2656,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
/* Use realloc since mbcset->range_starts and mbcset->range_ends
are NULL if *range_alloc == 0. */
new_array_start = re_realloc (mbcset->range_starts, wchar_t,
- new_nranges);
+ new_nranges);
new_array_end = re_realloc (mbcset->range_ends, wchar_t,
- new_nranges);
+ new_nranges);
if (BE (new_array_start == NULL || new_array_end == NULL, 0))
return REG_ESPACE;
@@ -2658,10 +2666,10 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
mbcset->range_starts = new_array_start;
mbcset->range_ends = new_array_end;
*range_alloc = new_nranges;
- }
+ }
- mbcset->range_starts[mbcset->nranges] = start_wc;
- mbcset->range_ends[mbcset->nranges++] = end_wc;
+ mbcset->range_starts[mbcset->nranges] = start_wc;
+ mbcset->range_ends[mbcset->nranges++] = end_wc;
}
/* Build the table for single byte characters. */
@@ -2888,8 +2896,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
build below suffices. */
if (nrules > 0 || dfa_mb_cur_max (dfa) > 1)
{
- /* Check the space of the arrays. */
- if (BE (*range_alloc == mbcset->nranges, 0))
+ /* Check the space of the arrays. */
+ if (BE (*range_alloc == mbcset->nranges, 0))
{
/* There is not enough space, need realloc. */
uint32_t *new_array_start;
@@ -2901,18 +2909,18 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
new_array_start = re_realloc (mbcset->range_starts, uint32_t,
new_nranges);
new_array_end = re_realloc (mbcset->range_ends, uint32_t,
- new_nranges);
+ new_nranges);
if (BE (new_array_start == NULL || new_array_end == NULL, 0))
- return REG_ESPACE;
+ return REG_ESPACE;
mbcset->range_starts = new_array_start;
mbcset->range_ends = new_array_end;
*range_alloc = new_nranges;
}
- mbcset->range_starts[mbcset->nranges] = start_collseq;
- mbcset->range_ends[mbcset->nranges++] = end_collseq;
+ mbcset->range_starts[mbcset->nranges] = start_collseq;
+ mbcset->range_ends[mbcset->nranges++] = end_collseq;
}
/* Build the table for single byte characters. */
@@ -3254,17 +3262,17 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
of having both SIMPLE_BRACKET and COMPLEX_BRACKET. */
if (sbc_idx < BITSET_WORDS)
{
- /* Build a tree for simple bracket. */
- br_token.type = SIMPLE_BRACKET;
- br_token.opr.sbcset = sbcset;
- work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
- if (BE (work_tree == NULL, 0))
- goto parse_bracket_exp_espace;
+ /* Build a tree for simple bracket. */
+ br_token.type = SIMPLE_BRACKET;
+ br_token.opr.sbcset = sbcset;
+ work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+ if (BE (work_tree == NULL, 0))
+ goto parse_bracket_exp_espace;
- /* Then join them by ALT node. */
- work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
- if (BE (work_tree == NULL, 0))
- goto parse_bracket_exp_espace;
+ /* Then join them by ALT node. */
+ work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
+ if (BE (work_tree == NULL, 0))
+ goto parse_bracket_exp_espace;
}
else
{
@@ -3283,7 +3291,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
br_token.opr.sbcset = sbcset;
work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
if (BE (work_tree == NULL, 0))
- goto parse_bracket_exp_espace;
+ goto parse_bracket_exp_espace;
}
return work_tree;
@@ -3838,7 +3846,7 @@ duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
node = node->parent;
dup_node = dup_node->parent;
if (!node)
- return dup_root;
+ return dup_root;
}
node = node->right;
p_new = &dup_node->right;
diff --git a/libc/posix/regex_internal.c b/libc/posix/regex_internal.c
index 86acf93fb..c481d2fdb 100644
--- a/libc/posix/regex_internal.c
+++ b/libc/posix/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -36,7 +36,7 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
re_string_reconstruct before using the object. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
{
@@ -64,7 +64,7 @@ re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
/* This function allocate the buffers, and initialize them. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_string_construct (re_string_t *pstr, const char *str, int len,
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
{
@@ -127,13 +127,20 @@ re_string_construct (re_string_t *pstr, const char *str, int len,
/* Helper functions for re_string_allocate, and re_string_construct. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
{
#ifdef RE_ENABLE_I18N
if (string_mb_cur_max (pstr) > 1)
{
- wint_t *new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
+ wint_t *new_wcs;
+
+ /* Avoid overflow in realloc. */
+ const size_t max_object_size = MAX (sizeof (wint_t), sizeof (int));
+ if (BE (SIZE_MAX / max_object_size < new_buf_len, 0))
+ return REG_ESPACE;
+
+ new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
if (BE (new_wcs == NULL, 0))
return REG_ESPACE;
pstr->wcs = new_wcs;
@@ -260,7 +267,7 @@ build_wcs_buffer (re_string_t *pstr)
but for REG_ICASE. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
build_wcs_upper_buffer (re_string_t *pstr)
{
mbstate_t prev_st;
@@ -423,8 +430,8 @@ build_wcs_upper_buffer (re_string_t *pstr)
src_idx += mbclen;
continue;
}
- else
- memcpy (pstr->mbs + byte_idx, p, mbclen);
+ else
+ memcpy (pstr->mbs + byte_idx, p, mbclen);
}
else
memcpy (pstr->mbs + byte_idx, p, mbclen);
@@ -482,18 +489,18 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc)
mbstate_t prev_st;
int rawbuf_idx;
size_t mbclen;
- wchar_t wc = WEOF;
+ wint_t wc = WEOF;
/* Skip the characters which are not necessary to check. */
for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len;
rawbuf_idx < new_raw_idx;)
{
- int remain_len;
- remain_len = pstr->len - rawbuf_idx;
+ wchar_t wc2;
+ int remain_len = pstr->len - rawbuf_idx;
prev_st = pstr->cur_state;
- mbclen = __mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx,
+ mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
remain_len, &pstr->cur_state);
- if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0))
+ if (BE ((ssize_t) mbclen <= 0, 0))
{
/* We treat these cases as a single byte character. */
if (mbclen == 0 || remain_len == 0)
@@ -503,10 +510,12 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc)
mbclen = 1;
pstr->cur_state = prev_st;
}
+ else
+ wc = (wint_t) wc2;
/* Then proceed the next character. */
rawbuf_idx += mbclen;
}
- *last_wc = (wint_t) wc;
+ *last_wc = wc;
return rawbuf_idx;
}
#endif /* RE_ENABLE_I18N */
@@ -560,7 +569,7 @@ re_string_translate_buffer (re_string_t *pstr)
REG_ICASE, apply translation. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
{
int offset = idx - pstr->raw_mbs_idx;
@@ -695,7 +704,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
if (pstr->is_utf8)
{
- const unsigned char *raw, *p, *q, *end;
+ const unsigned char *raw, *p, *end;
/* Special case UTF-8. Multi-byte chars start with any
byte other than 0x80 - 0xbf. */
@@ -724,13 +733,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
unsigned char buf[6];
size_t mbclen;
- q = p;
if (BE (pstr->trans != NULL, 0))
{
int i = mlen < 6 ? mlen : 6;
while (--i >= 0)
buf[i] = pstr->trans[p[i]];
- q = buf;
}
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
@@ -952,7 +959,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
/* Functions for set operation. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_alloc (re_node_set *set, int size)
{
set->alloc = size;
@@ -964,7 +971,7 @@ re_node_set_alloc (re_node_set *set, int size)
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_init_1 (re_node_set *set, int elem)
{
set->alloc = 1;
@@ -980,7 +987,7 @@ re_node_set_init_1 (re_node_set *set, int elem)
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
{
set->alloc = 2;
@@ -1010,7 +1017,7 @@ re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
{
dest->nelem = src->nelem;
@@ -1035,7 +1042,7 @@ re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
Note: We assume dest->elems is NULL, when dest->alloc is 0. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
const re_node_set *src2)
{
@@ -1050,7 +1057,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
int new_alloc = src1->nelem + src2->nelem + dest->alloc;
int *new_elems = re_realloc (dest->elems, int, new_alloc);
if (BE (new_elems == NULL, 0))
- return REG_ESPACE;
+ return REG_ESPACE;
dest->elems = new_elems;
dest->alloc = new_alloc;
}
@@ -1069,8 +1076,8 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
while (id >= 0 && dest->elems[id] > src1->elems[i1])
--id;
- if (id < 0 || dest->elems[id] != src1->elems[i1])
- dest->elems[--sbase] = src1->elems[i1];
+ if (id < 0 || dest->elems[id] != src1->elems[i1])
+ dest->elems[--sbase] = src1->elems[i1];
if (--i1 < 0 || --i2 < 0)
break;
@@ -1100,20 +1107,20 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
if (delta > 0 && id >= 0)
for (;;)
{
- if (dest->elems[is] > dest->elems[id])
- {
- /* Copy from the top. */
- dest->elems[id + delta--] = dest->elems[is--];
- if (delta == 0)
- break;
- }
- else
- {
- /* Slide from the bottom. */
- dest->elems[id + delta] = dest->elems[id];
- if (--id < 0)
- break;
- }
+ if (dest->elems[is] > dest->elems[id])
+ {
+ /* Copy from the top. */
+ dest->elems[id + delta--] = dest->elems[is--];
+ if (delta == 0)
+ break;
+ }
+ else
+ {
+ /* Slide from the bottom. */
+ dest->elems[id + delta] = dest->elems[id];
+ if (--id < 0)
+ break;
+ }
}
/* Copy remaining SRC elements. */
@@ -1126,7 +1133,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
const re_node_set *src2)
{
@@ -1179,7 +1186,7 @@ re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_merge (re_node_set *dest, const re_node_set *src)
{
int is, id, sbase, delta;
@@ -1208,11 +1215,11 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; )
{
if (dest->elems[id] == src->elems[is])
- is--, id--;
+ is--, id--;
else if (dest->elems[id] < src->elems[is])
- dest->elems[--sbase] = src->elems[is--];
+ dest->elems[--sbase] = src->elems[is--];
else /* if (dest->elems[id] > src->elems[is]) */
- --id;
+ --id;
}
if (is >= 0)
@@ -1234,21 +1241,21 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
for (;;)
{
if (dest->elems[is] > dest->elems[id])
- {
+ {
/* Copy from the top. */
- dest->elems[id + delta--] = dest->elems[is--];
+ dest->elems[id + delta--] = dest->elems[is--];
if (delta == 0)
break;
}
else
- {
- /* Slide from the bottom. */
- dest->elems[id + delta] = dest->elems[id];
+ {
+ /* Slide from the bottom. */
+ dest->elems[id + delta] = dest->elems[id];
if (--id < 0)
{
/* Copy remaining SRC elements. */
memcpy (dest->elems, dest->elems + sbase,
- delta * sizeof (int));
+ delta * sizeof (int));
break;
}
}
@@ -1262,7 +1269,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
return -1 if an error is occured, return 1 otherwise. */
static int
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_insert (re_node_set *set, int elem)
{
int idx;
@@ -1300,12 +1307,12 @@ re_node_set_insert (re_node_set *set, int elem)
{
idx = 0;
for (idx = set->nelem; idx > 0; idx--)
- set->elems[idx] = set->elems[idx - 1];
+ set->elems[idx] = set->elems[idx - 1];
}
else
{
for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
- set->elems[idx] = set->elems[idx - 1];
+ set->elems[idx] = set->elems[idx - 1];
}
/* Insert the new element. */
@@ -1319,7 +1326,7 @@ re_node_set_insert (re_node_set *set, int elem)
Return -1 if an error is occured, return 1 otherwise. */
static int
-internal_function
+internal_function __attribute_warn_unused_result__
re_node_set_insert_last (re_node_set *set, int elem)
{
/* Realloc if we need. */
@@ -1405,8 +1412,11 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
re_node_set *new_edests, *new_eclosures;
re_token_t *new_nodes;
- /* Avoid overflows. */
- if (BE (new_nodes_alloc < dfa->nodes_alloc, 0))
+ /* Avoid overflows in realloc. */
+ const size_t max_object_size = MAX (sizeof (re_token_t),
+ MAX (sizeof (re_node_set),
+ sizeof (int)));
+ if (BE (SIZE_MAX / max_object_size < new_nodes_alloc, 0))
return -1;
new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc);
@@ -1459,7 +1469,7 @@ calc_state_hash (const re_node_set *nodes, unsigned int context)
optimization. */
static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
const re_node_set *nodes)
{
@@ -1503,7 +1513,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
optimization. */
static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
const re_node_set *nodes, unsigned int context)
{
@@ -1540,6 +1550,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
indicates the error code if failed. */
static reg_errcode_t
+__attribute_warn_unused_result__
register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
unsigned int hash)
{
@@ -1555,7 +1566,8 @@ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
{
int elem = newstate->nodes.elems[i];
if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
- re_node_set_insert_last (&newstate->non_eps_nodes, elem);
+ if (re_node_set_insert_last (&newstate->non_eps_nodes, elem) < 0)
+ return REG_ESPACE;
}
spot = dfa->state_table + (hash & dfa->state_hash_mask);
@@ -1593,7 +1605,7 @@ free_state (re_dfastate_t *state)
Return the new state if succeeded, otherwise return NULL. */
static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
unsigned int hash)
{
@@ -1643,7 +1655,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
Return the new state if succeeded, otherwise return NULL. */
static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
unsigned int context, unsigned int hash)
{
@@ -1692,7 +1704,9 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
free_state (newstate);
return NULL;
}
- re_node_set_init_copy (newstate->entrance_nodes, nodes);
+ if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
+ != REG_NOERROR)
+ return NULL;
nctx_nodes = 0;
newstate->has_constraint = 1;
}
diff --git a/libc/posix/regexec.c b/libc/posix/regexec.c
index ad38ecbeb..f9bcd233c 100644
--- a/libc/posix/regexec.c
+++ b/libc/posix/regexec.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2005, 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -354,16 +354,16 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
const char *str;
int rval;
int len = length1 + length2;
- int free_str = 0;
+ char *s = NULL;
- if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
+ if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
return -2;
/* Concatenate the strings. */
if (length2 > 0)
if (length1 > 0)
{
- char *s = re_malloc (char, len);
+ s = re_malloc (char, len);
if (BE (s == NULL, 0))
return -2;
@@ -374,17 +374,14 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
memcpy (s + length1, string2, length2);
#endif
str = s;
- free_str = 1;
}
else
str = string2;
else
str = string1;
- rval = re_search_stub (bufp, str, len, start, range, stop, regs,
- ret_len);
- if (free_str)
- re_free ((char *) str);
+ rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len);
+ re_free (s);
return rval;
}
@@ -498,9 +495,14 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
if (regs_allocated == REGS_UNALLOCATED)
{ /* No. So allocate them with malloc. */
regs->start = re_malloc (regoff_t, need_regs);
- regs->end = re_malloc (regoff_t, need_regs);
- if (BE (regs->start == NULL, 0) || BE (regs->end == NULL, 0))
+ if (BE (regs->start == NULL, 0))
return REGS_UNALLOCATED;
+ regs->end = re_malloc (regoff_t, need_regs);
+ if (BE (regs->end == NULL, 0))
+ {
+ re_free (regs->start);
+ return REGS_UNALLOCATED;
+ }
regs->num_regs = need_regs;
}
else if (regs_allocated == REGS_REALLOCATE)
@@ -510,9 +512,15 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
if (BE (need_regs > regs->num_regs, 0))
{
regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs);
- regoff_t *new_end = re_realloc (regs->end, regoff_t, need_regs);
- if (BE (new_start == NULL, 0) || BE (new_end == NULL, 0))
+ regoff_t *new_end;
+ if (BE (new_start == NULL, 0))
return REGS_UNALLOCATED;
+ new_end = re_realloc (regs->end, regoff_t, need_regs);
+ if (BE (new_end == NULL, 0))
+ {
+ re_free (new_start);
+ return REGS_UNALLOCATED;
+ }
regs->start = new_start;
regs->end = new_end;
regs->num_regs = need_regs;
@@ -603,6 +611,7 @@ re_exec (s)
(START + RANGE >= 0 && START + RANGE <= LENGTH) */
static reg_errcode_t
+__attribute_warn_unused_result__
re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
eflags)
const regex_t *preg;
@@ -654,7 +663,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
|| !preg->newline_anchor))
{
if (start != 0 && start + range != 0)
- return REG_NOMATCH;
+ return REG_NOMATCH;
start = range = 0;
}
@@ -679,6 +688,13 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
multi character collating element. */
if (nmatch > 1 || dfa->has_mb_node)
{
+ /* Avoid overflow. */
+ if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= mctx.input.bufs_len, 0))
+ {
+ err = REG_ESPACE;
+ goto free_return;
+ }
+
mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1);
if (BE (mctx.state_log == NULL, 0))
{
@@ -786,10 +802,10 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
break;
match_first += incr;
if (match_first < left_lim || match_first > right_lim)
- {
- err = REG_NOMATCH;
- goto free_return;
- }
+ {
+ err = REG_NOMATCH;
+ goto free_return;
+ }
}
break;
}
@@ -903,14 +919,14 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
}
if (dfa->subexp_map)
- for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
- if (dfa->subexp_map[reg_idx] != reg_idx)
- {
- pmatch[reg_idx + 1].rm_so
- = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
- pmatch[reg_idx + 1].rm_eo
- = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
- }
+ for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
+ if (dfa->subexp_map[reg_idx] != reg_idx)
+ {
+ pmatch[reg_idx + 1].rm_so
+ = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
+ pmatch[reg_idx + 1].rm_eo
+ = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
+ }
}
free_return:
@@ -922,6 +938,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
}
static reg_errcode_t
+__attribute_warn_unused_result__
prune_impossible_nodes (mctx)
re_match_context_t *mctx;
{
@@ -936,6 +953,11 @@ prune_impossible_nodes (mctx)
#endif
match_last = mctx->match_last;
halt_node = mctx->last_node;
+
+ /* Avoid overflow. */
+ if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= match_last, 0))
+ return REG_ESPACE;
+
sifted_states = re_malloc (re_dfastate_t *, match_last + 1);
if (BE (sifted_states == NULL, 0))
{
@@ -1055,7 +1077,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
index of the buffer. */
static int
-internal_function
+internal_function __attribute_warn_unused_result__
check_matching (re_match_context_t *mctx, int fl_longest_match,
int *p_match_first)
{
@@ -1094,7 +1116,7 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
{
err = transit_state_bkref (mctx, &cur_state->nodes);
if (BE (err != REG_NOERROR, 0))
- return err;
+ return err;
}
}
}
@@ -1121,16 +1143,16 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
int next_char_idx = re_string_cur_idx (&mctx->input) + 1;
if (BE (next_char_idx >= mctx->input.bufs_len, 0)
- || (BE (next_char_idx >= mctx->input.valid_len, 0)
- && mctx->input.valid_len < mctx->input.len))
- {
- err = extend_buffers (mctx);
- if (BE (err != REG_NOERROR, 0))
+ || (BE (next_char_idx >= mctx->input.valid_len, 0)
+ && mctx->input.valid_len < mctx->input.len))
+ {
+ err = extend_buffers (mctx);
+ if (BE (err != REG_NOERROR, 0))
{
assert (err == REG_ESPACE);
return -2;
}
- }
+ }
cur_state = transit_state (&err, mctx, cur_state);
if (mctx->state_log != NULL)
@@ -1249,20 +1271,20 @@ proceed_next_node (const re_match_context_t *mctx, int nregs, regmatch_t *regs,
int candidate = edests->elems[i];
if (!re_node_set_contains (cur_nodes, candidate))
continue;
- if (dest_node == -1)
+ if (dest_node == -1)
dest_node = candidate;
- else
+ else
{
/* In order to avoid infinite loop like "(a*)*", return the second
- epsilon-transition if the first was already considered. */
+ epsilon-transition if the first was already considered. */
if (re_node_set_contains (eps_via_nodes, dest_node))
- return candidate;
+ return candidate;
/* Otherwise, push the second epsilon-transition on the fail stack. */
else if (fs != NULL
&& push_fail_stack (fs, *pidx, candidate, nregs, regs,
- eps_via_nodes))
+ eps_via_nodes))
return -2;
/* We know we are going to exit. */
@@ -1328,7 +1350,7 @@ proceed_next_node (const re_match_context_t *mctx, int nregs, regmatch_t *regs,
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
push_fail_stack (struct re_fail_stack_t *fs, int str_idx, int dest_node,
int nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
{
@@ -1375,7 +1397,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, int nregs,
pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
regmatch_t *pmatch, int fl_backtrack)
{
@@ -1610,7 +1632,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
if (mctx->state_log[str_idx])
{
err = build_sifted_states (mctx, sctx, str_idx, &cur_dest);
- if (BE (err != REG_NOERROR, 0))
+ if (BE (err != REG_NOERROR, 0))
goto free_return;
}
@@ -1629,7 +1651,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
int str_idx, re_node_set *cur_dest)
{
@@ -1791,7 +1813,7 @@ update_cur_sifted_state (const re_match_context_t *mctx,
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
const re_node_set *candidates)
{
@@ -1806,10 +1828,14 @@ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
{
err = re_node_set_alloc (&state->inveclosure, dest_nodes->nelem);
if (BE (err != REG_NOERROR, 0))
- return REG_ESPACE;
+ return REG_ESPACE;
for (i = 0; i < dest_nodes->nelem; i++)
- re_node_set_merge (&state->inveclosure,
- dfa->inveclosures + dest_nodes->elems[i]);
+ {
+ err = re_node_set_merge (&state->inveclosure,
+ dfa->inveclosures + dest_nodes->elems[i]);
+ if (BE (err != REG_NOERROR, 0))
+ return REG_ESPACE;
+ }
}
return re_node_set_add_intersect (dest_nodes, candidates,
&state->inveclosure);
@@ -1921,7 +1947,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
{
struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
do
- {
+ {
int dst, cpos;
if (ent->node != node)
@@ -1942,9 +1968,9 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
if (dst == from_node)
{
if (boundaries & 1)
- return -1;
+ return -1;
else /* if (boundaries & 2) */
- return 0;
+ return 0;
}
cpos =
@@ -1958,7 +1984,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
if (subexp_idx < BITSET_WORD_BITS)
ent->eps_reachable_subexps_map
&= ~((bitset_word_t) 1 << subexp_idx);
- }
+ }
while (ent++->more);
}
break;
@@ -2100,7 +2126,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
}
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
int str_idx, const re_node_set *candidates)
{
@@ -2183,7 +2209,7 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
re_node_set_remove (&local_sctx.limits, enabled_idx);
/* mctx->bkref_ents may have changed, reload the pointer. */
- entry = mctx->bkref_ents + enabled_idx;
+ entry = mctx->bkref_ents + enabled_idx;
}
while (enabled_idx++, entry++->more);
}
@@ -2230,7 +2256,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
update the destination of STATE_LOG. */
static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
transit_state (reg_errcode_t *err, re_match_context_t *mctx,
re_dfastate_t *state)
{
@@ -2264,7 +2290,7 @@ transit_state (reg_errcode_t *err, re_match_context_t *mctx,
trtable = state->word_trtable;
if (BE (trtable != NULL, 1))
- {
+ {
unsigned int context;
context
= re_string_context_at (&mctx->input,
@@ -2310,21 +2336,21 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
unsigned int context;
re_node_set next_nodes, *log_nodes, *table_nodes = NULL;
/* If (state_log[cur_idx] != 0), it implies that cur_idx is
- the destination of a multibyte char/collating element/
- back reference. Then the next state is the union set of
- these destinations and the results of the transition table. */
+ the destination of a multibyte char/collating element/
+ back reference. Then the next state is the union set of
+ these destinations and the results of the transition table. */
pstate = mctx->state_log[cur_idx];
log_nodes = pstate->entrance_nodes;
if (next_state != NULL)
- {
- table_nodes = next_state->entrance_nodes;
- *err = re_node_set_init_union (&next_nodes, table_nodes,
+ {
+ table_nodes = next_state->entrance_nodes;
+ *err = re_node_set_init_union (&next_nodes, table_nodes,
log_nodes);
- if (BE (*err != REG_NOERROR, 0))
+ if (BE (*err != REG_NOERROR, 0))
return NULL;
- }
+ }
else
- next_nodes = *log_nodes;
+ next_nodes = *log_nodes;
/* Note: We already add the nodes of the initial state,
then we don't need to add them here. */
@@ -2332,12 +2358,12 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
re_string_cur_idx (&mctx->input) - 1,
mctx->eflags);
next_state = mctx->state_log[cur_idx]
- = re_acquire_state_context (err, dfa, &next_nodes, context);
+ = re_acquire_state_context (err, dfa, &next_nodes, context);
/* We don't need to check errors here, since the return value of
- this function is next_state and ERR is already set. */
+ this function is next_state and ERR is already set. */
if (table_nodes != NULL)
- re_node_set_free (&next_nodes);
+ re_node_set_free (&next_nodes);
}
if (BE (dfa->nbackref, 0) && next_state != NULL)
@@ -2378,9 +2404,9 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
do
{
- if (++cur_str_idx > max)
- return NULL;
- re_string_skip_bytes (&mctx->input, 1);
+ if (++cur_str_idx > max)
+ return NULL;
+ re_string_skip_bytes (&mctx->input, 1);
}
while (mctx->state_log[cur_str_idx] == NULL);
@@ -2487,7 +2513,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
re_dfastate_t *dest_state;
if (!dfa->nodes[cur_node_idx].accept_mb)
- continue;
+ continue;
if (dfa->nodes[cur_node_idx].constraint)
{
@@ -2655,7 +2681,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
delay these checking for prune_impossible_nodes(). */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
{
const re_dfa_t *const dfa = mctx->dfa;
@@ -2668,7 +2694,7 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
const struct re_backref_cache_entry *entry
= mctx->bkref_ents + cache_idx;
do
- if (entry->node == bkref_node)
+ if (entry->node == bkref_node)
return REG_NOERROR; /* We already checked it. */
while (entry++->more);
}
@@ -2855,7 +2881,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
int top_str, int last_node, int last_str, int type)
{
@@ -3016,7 +3042,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
Can't we unify them? */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
re_node_set *cur_nodes, re_node_set *next_nodes)
{
@@ -3148,7 +3174,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
problematic append it to DST_NODES. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
int target, int ex_subexp, int type)
{
@@ -3192,7 +3218,7 @@ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
in MCTX->BKREF_ENTS. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
int cur_str, int subexp_num, int type)
{
@@ -3342,6 +3368,13 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
if (BE (err != REG_NOERROR, 0))
goto out_free;
+ /* Avoid arithmetic overflow in size calculation. */
+ if (BE ((((SIZE_MAX - (sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX)
+ / (3 * sizeof (re_dfastate_t *)))
+ < ndests),
+ 0))
+ goto out_free;
+
if (__libc_use_alloca ((sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX
+ ndests * 3 * sizeof (re_dfastate_t *)))
dest_states = (re_dfastate_t **)
@@ -3550,13 +3583,13 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
}
#ifdef RE_ENABLE_I18N
else if (type == OP_UTF8_PERIOD)
- {
+ {
memset (accepts, '\xff', sizeof (bitset_t) / 2);
if (!(dfa->syntax & RE_DOT_NEWLINE))
bitset_clear (accepts, '\n');
if (dfa->syntax & RE_DOT_NOT_NULL)
bitset_clear (accepts, '\0');
- }
+ }
#endif
else
continue;
@@ -3761,7 +3794,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
if (node->type == OP_PERIOD)
{
if (char_len <= 1)
- return 0;
+ return 0;
/* FIXME: I don't think this if is needed, as both '\n'
and '\0' are char_len == 1. */
/* '.' accepts any one character except the following two cases. */
@@ -4019,18 +4052,18 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
{
case CHARACTER:
if (node->opr.c != ch)
- return 0;
+ return 0;
break;
case SIMPLE_BRACKET:
if (!bitset_contain (node->opr.sbcset, ch))
- return 0;
+ return 0;
break;
#ifdef RE_ENABLE_I18N
case OP_UTF8_PERIOD:
if (ch >= 0x80)
- return 0;
+ return 0;
/* FALLTHROUGH */
#endif
case OP_PERIOD:
@@ -4059,12 +4092,16 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
/* Extend the buffers, if the buffers have run out. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
extend_buffers (re_match_context_t *mctx)
{
reg_errcode_t ret;
re_string_t *pstr = &mctx->input;
+ /* Avoid overflow. */
+ if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
+ return REG_ESPACE;
+
/* Double the lengthes of the buffers. */
ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
if (BE (ret != REG_NOERROR, 0))
@@ -4118,7 +4155,7 @@ extend_buffers (re_match_context_t *mctx)
/* Initialize MCTX. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
match_ctx_init (re_match_context_t *mctx, int eflags, int n)
{
mctx->eflags = eflags;
@@ -4191,7 +4228,7 @@ match_ctx_free (re_match_context_t *mctx)
*/
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
match_ctx_add_entry (re_match_context_t *mctx, int node, int str_idx, int from,
int to)
{
@@ -4263,7 +4300,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, int str_idx)
at STR_IDX. */
static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
match_ctx_add_subtop (re_match_context_t *mctx, int node, int str_idx)
{
#ifdef DEBUG
diff --git a/libc/posix/sched.h b/libc/posix/sched.h
index e95c80f56..55bc487b3 100644
--- a/libc/posix/sched.h
+++ b/libc/posix/sched.h
@@ -1,5 +1,6 @@
/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
- Copyright (C) 1996,1997,1999,2001-2004,2007 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1999,2001-2004,2007,2010
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,9 +29,16 @@
#define __need_size_t
#include <stddef.h>
+#define __need_time_t
#define __need_timespec
#include <time.h>
+#ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined
+#endif
+
+
/* Get system specific constant and data structure definitions. */
#include <bits/sched.h>
/* Define the real names for the elements of `struct sched_param'. */
diff --git a/libc/posix/sys/types.h b/libc/posix/sys/types.h
index 04563a4ab..a7e9084e2 100644
--- a/libc/posix/sys/types.h
+++ b/libc/posix/sys/types.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-2002,2006,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -101,7 +100,8 @@ typedef __pid_t pid_t;
# define __pid_t_defined
#endif
-#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined
+#if (defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8) \
+ && !defined __id_t_defined
typedef __id_t id_t;
# define __id_t_defined
#endif
@@ -124,7 +124,7 @@ typedef __key_t key_t;
# define __key_t_defined
#endif
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# define __need_clock_t
#endif
#define __need_time_t
@@ -224,7 +224,8 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
#endif /* Use BSD. */
-#if defined __USE_UNIX98 && !defined __blksize_t_defined
+#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
+ && !defined __blksize_t_defined
typedef __blksize_t blksize_t;
# define __blksize_t_defined
#endif
diff --git a/libc/posix/sys/wait.h b/libc/posix/sys/wait.h
index d9248426d..6d7f0684c 100644
--- a/libc/posix/sys/wait.h
+++ b/libc/posix/sys/wait.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009
+/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -32,7 +32,7 @@ __BEGIN_DECLS
#include <sys/resource.h>
/* These macros could also be defined in <stdlib.h>. */
-#if !defined _STDLIB_H || !defined __USE_XOPEN
+#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
@@ -45,7 +45,7 @@ __BEGIN_DECLS
# if defined __GNUC__ && !defined __cplusplus
# define __WAIT_INT(status) \
(__extension__ (((union { __typeof(status) __in; int __i; }) \
- { .__in = (status) }).__i))
+ { .__in = (status) }).__i))
# else
# define __WAIT_INT(status) (*(__const int *) &(status))
# endif
@@ -98,7 +98,7 @@ typedef union
#endif
/* The following values are used by the `waitid' function. */
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
typedef enum
{
P_ALL, /* Wait for any child. */
@@ -138,7 +138,7 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc);
__THROW. */
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
# define __need_siginfo_t
# include <bits/siginfo.h>
/* Wait for a childing matching IDTYPE and ID to change the status and
diff --git a/libc/posix/unistd.h b/libc/posix/unistd.h
index b46a885af..f8b84e3cb 100644
--- a/libc/posix/unistd.h
+++ b/libc/posix/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2009, 2010 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
@@ -203,7 +203,7 @@ __BEGIN_DECLS
#include <bits/posix_opt.h>
/* Get the environment definitions from Unix98. */
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/environments.h>
#endif
@@ -263,7 +263,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
@@ -362,7 +362,7 @@ extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;
__THROW. */
extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur;
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
@@ -440,7 +440,8 @@ extern unsigned int alarm (unsigned int __seconds) __THROW;
__THROW. */
extern unsigned int sleep (unsigned int __seconds);
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ || defined __USE_BSD
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
@@ -469,7 +470,7 @@ extern int pause (void);
extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
@@ -492,7 +493,7 @@ extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
/* Change the process's working directory to PATH. */
extern int chdir (__const char *__path) __THROW __nonnull ((1)) __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
#endif
@@ -513,7 +514,8 @@ extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
extern char *get_current_dir_name (void) __THROW;
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ || defined __USE_BSD
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
@@ -639,7 +641,7 @@ extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
/* Get the process group ID of process PID. */
extern __pid_t __getpgid (__pid_t __pid) __THROW;
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern __pid_t getpgid (__pid_t __pid) __THROW;
#endif
@@ -683,7 +685,7 @@ extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
are set to the process ID of the calling process, which is returned. */
extern __pid_t setsid (void) __THROW;
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Return the session ID of the given process. */
extern __pid_t getsid (__pid_t __pid) __THROW;
#endif
@@ -772,13 +774,14 @@ extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
and the process ID of the new process to the old process. */
extern __pid_t fork (void) __THROW;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ || defined __USE_BSD
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
extern __pid_t vfork (void) __THROW;
-#endif /* Use BSD. */
+#endif /* Use BSD or XPG < 7. */
/* Return the pathname of the terminal FD is open on, or NULL on errors.
@@ -888,7 +891,7 @@ extern int setlogin (__const char *__name) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
@@ -983,6 +986,7 @@ extern long int gethostid (void);
extern void sync (void) __THROW;
+# if defined __USE_BSD || !defined __USE_XOPEN2K
/* Return the number of bytes in a page. This is the system's page size,
which is not necessarily the same as the hardware page size. */
extern int getpagesize (void) __THROW __attribute__ ((__const__));
@@ -991,7 +995,12 @@ extern int getpagesize (void) __THROW __attribute__ ((__const__));
/* Return the maximum number of file descriptors
the current process could possibly have. */
extern int getdtablesize (void) __THROW;
+# endif
+#endif /* Use BSD || X/Open Unix. */
+
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Truncate FILE to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
@@ -1011,9 +1020,6 @@ extern int truncate64 (__const char *__file, __off64_t __length)
__THROW __nonnull ((1)) __wur;
# endif
-#endif /* Use BSD || X/Open Unix. */
-
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Truncate the file FD is open on to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
@@ -1033,7 +1039,8 @@ extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
#endif /* Use BSD || X/Open Unix || POSIX 2003. */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
+ || defined __USE_MISC
/* Set the end of accessible data space (aka "the break") to ADDR.
Returns zero on success and -1 for errors (with errno set). */
@@ -1139,7 +1146,7 @@ extern void swab (__const void *__restrict __from, void *__restrict __to,
/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
diff --git a/libc/resolv/netdb.h b/libc/resolv/netdb.h
index dc1f7cec6..7671c6aca 100644
--- a/libc/resolv/netdb.h
+++ b/libc/resolv/netdb.h
@@ -1,4 +1,4 @@
- /* Copyright (C) 1996-2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+ /* Copyright (C) 1996-2004, 2009, 2010 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,22 +53,24 @@
__BEGIN_DECLS
+#if defined __USE_MISC || !defined __USE_XOPEN2K8
/* Error status for non-reentrant lookup functions.
We use a macro to access always the thread-specific `h_errno' variable. */
-#define h_errno (*__h_errno_location ())
+# define h_errno (*__h_errno_location ())
/* Function to get address of global `h_errno' variable. */
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
/* Possible values left in `h_errno'. */
-#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
-#define TRY_AGAIN 2 /* Non-Authoritative Host not found,
+# define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
+# define TRY_AGAIN 2 /* Non-Authoritative Host not found,
or SERVERFAIL. */
-#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
+# define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
NOTIMP. */
-#define NO_DATA 4 /* Valid name, no data record of requested
+# define NO_DATA 4 /* Valid name, no data record of requested
type. */
+#endif
#if defined __USE_MISC || defined __USE_GNU
# define NETDB_INTERNAL -1 /* See errno. */
# define NETDB_SUCCESS 0 /* No problem. */
@@ -85,7 +87,7 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
# define SCOPE_DELIMITER '%'
#endif
-#if defined __USE_MISC || defined __USE_GNU
+#ifdef __USE_MISC
/* Print error indicated by `h_errno' variable on standard error. STR
if non-null is printed before the error string. */
extern void herror (__const char *__str) __THROW;
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index e2bbfcc83..28a47e42b 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -199,10 +199,6 @@ static void Perror(const res_state, FILE *, const char *, int);
#endif
static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
-/* Reachover. */
-
-static void convaddr4to6(struct sockaddr_in6 *sa);
-
/* Public. */
/* int
@@ -911,10 +907,12 @@ static int
reopen (res_state statp, int *terrno, int ns)
{
if (EXT(statp).nssocks[ns] == -1) {
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+ struct sockaddr *nsap
+ = (struct sockaddr *) EXT(statp).nsaddrs[ns];
+ socklen_t slen;
/* only try IPv6 if IPv6 NS and if not failed before */
- if ((EXT(statp).nscount6 > 0) && !statp->ipv6_unavail) {
+ if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
@@ -931,12 +929,8 @@ reopen (res_state statp, int *terrno, int ns)
socket(PF_INET6, SOCK_DGRAM, 0);
if (EXT(statp).nssocks[ns] < 0)
statp->ipv6_unavail = errno == EAFNOSUPPORT;
- /* If IPv6 socket and nsap is IPv4, make it
- IPv4-mapped */
- else if (nsap->sin6_family == AF_INET)
- convaddr4to6(nsap);
- }
- if (EXT(statp).nssocks[ns] < 0) {
+ slen = sizeof (struct sockaddr_in6);
+ } else if (nsap->sa_family == AF_INET) {
if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
@@ -951,6 +945,7 @@ reopen (res_state statp, int *terrno, int ns)
if (__builtin_expect (__have_o_nonblock < 0, 0))
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM, 0);
+ slen = sizeof (struct sockaddr_in);
}
if (EXT(statp).nssocks[ns] < 0) {
*terrno = errno;
@@ -969,10 +964,8 @@ reopen (res_state statp, int *terrno, int ns)
* error message is received. We can thus detect
* the absence of a nameserver without timing out.
*/
- if (connect(EXT(statp).nssocks[ns], (struct sockaddr *)nsap,
- sizeof *nsap) < 0) {
- Aerror(statp, stderr, "connect(dg)", errno,
- (struct sockaddr *) nsap);
+ if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) {
+ Aerror(statp, stderr, "connect(dg)", errno, nsap);
__res_iclose(statp, false);
return (0);
}
@@ -1415,22 +1408,3 @@ sock_eq(struct sockaddr_in6 *a1, struct sockaddr_in6 *a2) {
(a1->sin6_addr.s6_addr32[3] ==
((struct sockaddr_in *)a2)->sin_addr.s_addr));
}
-
-/*
- * Converts IPv4 family, address and port to
- * IPv6 family, IPv4-mapped IPv6 address and port.
- */
-static void
-convaddr4to6(struct sockaddr_in6 *sa)
-{
- struct sockaddr_in *sa4p = (struct sockaddr_in *) sa;
- in_port_t port = sa4p->sin_port;
- in_addr_t addr = sa4p->sin_addr.s_addr;
-
- sa->sin6_family = AF_INET6;
- sa->sin6_port = port;
- sa->sin6_addr.s6_addr32[0] = 0;
- sa->sin6_addr.s6_addr32[1] = 0;
- sa->sin6_addr.s6_addr32[2] = htonl(0xFFFF);
- sa->sin6_addr.s6_addr32[3] = addr;
-}
diff --git a/libc/signal/signal.h b/libc/signal/signal.h
index 67f8cb4d3..2bdf648df 100644
--- a/libc/signal/signal.h
+++ b/libc/signal/signal.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003, 2004, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2004, 2007, 2009, 2010 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
@@ -344,7 +344,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
#endif /* use BSD. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
# define __need_size_t
# include <stddef.h>
@@ -354,7 +354,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
extern int siginterrupt (int __sig, int __interrupt) __THROW;
# include <bits/sigstack.h>
-# ifdef __USE_XOPEN
+# if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* This will define `ucontext_t' and `mcontext_t'. */
# include <sys/ucontext.h>
# endif
diff --git a/libc/stdio-common/vfscanf.c b/libc/stdio-common/vfscanf.c
index c35e1b725..bf89ec5f9 100644
--- a/libc/stdio-common/vfscanf.c
+++ b/libc/stdio-common/vfscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006, 2007, 2010 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
@@ -223,7 +223,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
int errval = 0;
#ifndef COMPILE_WSCANF
__locale_t loc = _NL_CURRENT_LOCALE;
- struct locale_data *const curctype = loc->__locales[LC_CTYPE];
+ struct __locale_data *const curctype = loc->__locales[LC_CTYPE];
#endif
/* Errno of last failed inchar call. */
@@ -301,7 +301,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
#if __OPTION_EGLIBC_LOCALE_CODE && !defined (COMPILE_WSCANF)
- struct locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
+ struct __locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
#endif
#if __OPTION_EGLIBC_LOCALE_CODE
@@ -1420,7 +1420,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
#ifdef COMPILE_WSCANF
wcdigits[n] = (const wchar_t *)
- _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n);
+ _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n);
wchar_t *wc_extended = (wchar_t *)
alloca ((to_level + 2) * sizeof (wchar_t));
@@ -1430,7 +1430,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
wcdigits_extended[n] = wc_extended;
#else
mbdigits[n]
- = curctype->values[_NL_CTYPE_INDIGITS0_MB + n].string;
+ = curctype->values[_NL_CTYPE_INDIGITS0_MB + n].string;
/* Get the equivalent wide char in map. */
wint_t extra_wcdigit = __towctrans (L'0' + n, map);
@@ -2079,9 +2079,9 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
wcdigits[11] = __towctrans (L'.', map);
/* If we have not read any character or have just read
- locale decimal point which matches the decimal point
- for localized FP numbers, then we may have localized
- digits. Note, we test GOT_DOT above. */
+ locale decimal point which matches the decimal point
+ for localized FP numbers, then we may have localized
+ digits. Note, we test GOT_DOT above. */
#ifdef COMPILE_WSCANF
if (wpsize == 0 || (wpsize == 1 && wcdigits[11] == decimal))
#else
@@ -2118,7 +2118,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
bool have_locthousands = (flags & GROUP) != 0;
/* Now get the digits and the thousands-sep equivalents. */
- for (int n = 0; n < 11; ++n)
+ for (int n = 0; n < 11; ++n)
{
if (n < 10)
wcdigits[n] = __towctrans (L'0' + n, map);
@@ -2422,7 +2422,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (wc <= runp[1] && not_in)
{
/* The current character is not in the
- scanset. */
+ scanset. */
ungetc (c, s);
goto out;
}
@@ -2648,7 +2648,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (wc <= runp[1] && not_in)
{
/* The current character is not in the
- scanset. */
+ scanset. */
ungetc (c, s);
goto out2;
}
diff --git a/libc/stdlib/stdlib.h b/libc/stdlib/stdlib.h
index dc51d6717..d1f3841f1 100644
--- a/libc/stdlib/stdlib.h
+++ b/libc/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2007, 2009, 2010 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,7 +37,7 @@ __BEGIN_DECLS
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
@@ -91,7 +91,7 @@ typedef union
# ifdef __WIFCONTINUED
# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
# endif
-#endif /* X/Open and <sys/wait.h> not included. */
+#endif /* X/Open or XPG7 and <sys/wait.h> not included. */
__BEGIN_NAMESPACE_STD
/* Returned by `div'. */
@@ -497,7 +497,8 @@ extern void cfree (void *__ptr) __THROW;
# include <alloca.h>
#endif /* Use GNU, BSD, or misc. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
+ || defined __USE_BSD
/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
#endif
@@ -585,7 +586,7 @@ extern int setenv (__const char *__name, __const char *__value, int __replace)
__THROW __nonnull ((2));
/* Remove the variable NAME from the environment. */
-extern int unsetenv (__const char *__name) __THROW;
+extern int unsetenv (__const char *__name) __THROW __nonnull ((1));
#endif
#ifdef __USE_MISC
@@ -596,13 +597,17 @@ extern int clearenv (void) __THROW;
#endif
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC \
+ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K)
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */
extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
+#endif
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \
+ || defined __USE_XOPEN2K8
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique.
@@ -792,7 +797,8 @@ __END_NAMESPACE_C99
#endif
-#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
+ || defined __USE_SVID
/* Convert floating point numbers to strings. The returned values are
valid only until another call to the same function. */
@@ -880,7 +886,7 @@ extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur;
#endif
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Parse comma separated suboption from *OPTIONP and match against
strings in TOKENS. If found return index and set *VALUEP to
optional value introduced by an equal sign. If the suboption is
@@ -902,7 +908,7 @@ extern void setkey (__const char *__key) __THROW __nonnull ((1));
/* X/Open pseudo terminal handling. */
-#ifdef __USE_XOPEN2K
+#ifdef __USE_XOPEN2KXSI
/* Return a master pseudo-terminal handle. */
extern int posix_openpt (int __oflag) __wur;
#endif
diff --git a/libc/stdlib/strfmon_l.c b/libc/stdlib/strfmon_l.c
index eb7a17801..7642753cb 100644
--- a/libc/stdlib/strfmon_l.c
+++ b/libc/stdlib/strfmon_l.c
@@ -1,5 +1,5 @@
/* Formatting a monetary value according to the given locale.
- Copyright (C) 1996,1997,2002,2004,2006,2009 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,2002,2004,2006,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -88,7 +88,7 @@ ssize_t
__vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
va_list ap)
{
- struct locale_data *current = loc->__locales[LC_MONETARY];
+ struct __locale_data *current = loc->__locales[LC_MONETARY];
_IO_strfile f;
struct printf_info info;
char *dest; /* Pointer so copy the output. */
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index b48b9c1ca..e34ec14c3 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to float value, using given locale.
- Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009
+ Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -215,15 +215,15 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
!= 0);
(void) __mpn_rshift (retval, &retval[shift / BITS_PER_MP_LIMB],
- RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB),
- shift % BITS_PER_MP_LIMB);
- MPN_ZERO (&retval[RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB)],
- shift / BITS_PER_MP_LIMB);
+ RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB),
+ shift % BITS_PER_MP_LIMB);
+ MPN_ZERO (&retval[RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB)],
+ shift / BITS_PER_MP_LIMB);
}
else if (shift > 0)
{
- round_limb = retval[0];
- round_bit = shift - 1;
+ round_limb = retval[0];
+ round_bit = shift - 1;
(void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, shift);
}
/* This is a hook for the m68k long double format, where the
@@ -238,14 +238,14 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
&& (more_bits || (retval[0] & 1) != 0
- || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
+ || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
{
mp_limb_t cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
if (((MANT_DIG % BITS_PER_MP_LIMB) == 0 && cy) ||
- ((MANT_DIG % BITS_PER_MP_LIMB) != 0 &&
- (retval[RETURN_LIMB_SIZE - 1]
- & (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0))
+ ((MANT_DIG % BITS_PER_MP_LIMB) != 0 &&
+ (retval[RETURN_LIMB_SIZE - 1]
+ & (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0))
{
++exponent;
(void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, 1);
@@ -467,7 +467,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
int cnt;
#if __OPTION_EGLIBC_LOCALE_CODE
- struct locale_data *current = loc->__locales[LC_NUMERIC];
+ struct __locale_data *current = loc->__locales[LC_NUMERIC];
if (__builtin_expect (group, 0))
{
@@ -751,7 +751,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
grouping);
#endif
if (cp != tp)
- {
+ {
/* Less than the entire string was correctly grouped. */
if (tp == start_of_digits)
@@ -1126,14 +1126,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
memcpy (retval, &num[least_idx],
RETURN_LIMB_SIZE * sizeof (mp_limb_t));
else
- {
- for (i = least_idx; i < numsize - 1; ++i)
- retval[i - least_idx] = (num[i] >> least_bit)
- | (num[i + 1]
- << (BITS_PER_MP_LIMB - least_bit));
- if (i - least_idx < RETURN_LIMB_SIZE)
- retval[RETURN_LIMB_SIZE - 1] = num[i] >> least_bit;
- }
+ {
+ for (i = least_idx; i < numsize - 1; ++i)
+ retval[i - least_idx] = (num[i] >> least_bit)
+ | (num[i + 1]
+ << (BITS_PER_MP_LIMB - least_bit));
+ if (i - least_idx < RETURN_LIMB_SIZE)
+ retval[RETURN_LIMB_SIZE - 1] = num[i] >> least_bit;
+ }
/* Check whether any limb beside the ones in RETVAL are non-zero. */
for (i = 0; num[i] == 0; ++i)
@@ -1187,7 +1187,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
#if RETURN_LIMB_SIZE > 1
if (numsize < RETURN_LIMB_SIZE)
# if RETURN_LIMB_SIZE == 2
- retval[numsize] = 0;
+ retval[numsize] = 0;
# else
MPN_ZERO (retval + numsize, RETURN_LIMB_SIZE - numsize);
# endif
@@ -1214,14 +1214,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* For the fractional part we need not process too many digits. One
decimal digits gives us log_2(10) ~ 3.32 bits. If we now compute
- ceil(BITS / 3) =: N
+ ceil(BITS / 3) =: N
digits we should have enough bits for the result. The remaining
decimal digits give us the information that more bits are following.
This can be used while rounding. (Two added as a safety margin.) */
if (dig_no - int_no > (MANT_DIG - bits + 2) / 3 + 2)
{
- dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2;
- more_bits = 1;
+ dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2;
+ more_bits = 1;
}
else
more_bits = 0;
@@ -1277,9 +1277,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
digits. This is done by a "quasi fix point" number representation.
num: ddddddddddd . 0000000000000000000000
- |--- m ---|
+ |--- m ---|
den: ddddddddddd n >= m
- |--- n ---|
+ |--- n ---|
*/
count_leading_zeros (cnt, den[densize - 1]);
diff --git a/libc/stdlib/strtol_l.c b/libc/stdlib/strtol_l.c
index ba0aba791..9181bf10e 100644
--- a/libc/stdlib/strtol_l.c
+++ b/libc/stdlib/strtol_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997, 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -243,7 +243,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
#endif
#ifdef USE_NUMBER_GROUPING
- struct locale_data *current = loc->__locales[LC_NUMERIC];
+ struct __locale_data *current = loc->__locales[LC_NUMERIC];
/* The thousands character of the current locale. */
# ifdef USE_WIDE_CHAR
wchar_t thousands = L'\0';
diff --git a/libc/string/strcoll_l.c b/libc/string/strcoll_l.c
index 92c5c69f1..9e55c911a 100644
--- a/libc/string/strcoll_l.c
+++ b/libc/string/strcoll_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,96,97,2002, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,2002,2004,2007,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -49,7 +49,7 @@ STRCOLL (s1, s2, l)
const STRING_TYPE *s2;
__locale_t l;
{
- struct locale_data *current = l->__locales[LC_COLLATE];
+ struct __locale_data *current = l->__locales[LC_COLLATE];
#if __OPTION_EGLIBC_LOCALE_CODE
uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
#else
diff --git a/libc/string/string.h b/libc/string/string.h
index 3c760092f..388402189 100644
--- a/libc/string/string.h
+++ b/libc/string/string.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1993,1995-2004,2007,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2004,2007,2009,2010
+ 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
@@ -168,7 +169,8 @@ extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n,
__locale_t __l) __THROW __nonnull ((2, 4));
#endif
-#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED \
+ || defined __USE_XOPEN2K8
/* Duplicate S, returning an identical malloc'd string. */
extern char *strdup (__const char *__s)
__THROW __attribute_malloc__ __nonnull ((1));
diff --git a/libc/string/strings.h b/libc/string/strings.h
index 16ab6b1c4..2ab83caa0 100644
--- a/libc/string/strings.h
+++ b/libc/string/strings.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,96,97,99,2000,2001,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1996,1997,1999,2000,2001,2009,2010
+ 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
@@ -35,6 +36,7 @@
__BEGIN_DECLS
+# if defined __USE_MISC || !defined __USE_XOPEN2K8
/* Compare N bytes of S1 and S2 (same as memcmp). */
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
__THROW __attribute_pure__;
@@ -45,12 +47,8 @@ extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW;
/* Set N bytes of S to 0. */
extern void bzero (void *__s, size_t __n) __THROW;
-/* Return the position of the first bit set in I, or 0 if none are set.
- The least-significant bit is position 1, the most-significant 32. */
-extern int ffs (int __i) __THROW __attribute__ ((const));
-
/* Find the first occurrence of C in S (same as strchr). */
-# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
+# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
extern "C++"
{
extern char *index (char *__s, int __c)
@@ -58,7 +56,7 @@ extern char *index (char *__s, int __c)
extern __const char *index (__const char *__s, int __c)
__THROW __asm ("index") __attribute_pure__ __nonnull ((1));
-# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
+# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
__extern_always_inline char *
index (char *__s, int __c) __THROW
{
@@ -70,15 +68,15 @@ index (__const char *__s, int __c) __THROW
{
return __builtin_index (__s, __c);
}
-# endif
+# endif
}
-# else
+# else
extern char *index (__const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
-# endif
+# endif
/* Find the last occurrence of C in S (same as strrchr). */
-# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
+# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
extern "C++"
{
extern char *rindex (char *__s, int __c)
@@ -86,7 +84,7 @@ extern char *rindex (char *__s, int __c)
extern __const char *rindex (__const char *__s, int __c)
__THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
-# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
+# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
__extern_always_inline char *
rindex (char *__s, int __c) __THROW
{
@@ -98,13 +96,20 @@ rindex (__const char *__s, int __c) __THROW
{
return __builtin_rindex (__s, __c);
}
-#endif
+# endif
}
-# else
+# else
extern char *rindex (__const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
+# endif
# endif
+#if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI
+/* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+extern int ffs (int __i) __THROW __attribute__ ((const));
+#endif
+
/* Compare S1 and S2, ignoring case. */
extern int strcasecmp (__const char *__s1, __const char *__s2)
__THROW __attribute_pure__;
diff --git a/libc/string/strxfrm_l.c b/libc/string/strxfrm_l.c
index 33070e563..932bf1922 100644
--- a/libc/string/strxfrm_l.c
+++ b/libc/string/strxfrm_l.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2002, 2004, 2005, 2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,2002,2004-2006,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -87,7 +86,7 @@ utf8_encode (char *buf, int val)
size_t
STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
{
- struct locale_data *current = l->__locales[LC_COLLATE];
+ struct __locale_data *current = l->__locales[LC_COLLATE];
#if __OPTION_EGLIBC_LOCALE_CODE
uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
#else
@@ -142,7 +141,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
if (srclen == 0)
{
if (n != 0)
- *dest = L('\0');
+ *dest = L('\0');
return 0;
}
diff --git a/libc/sysdeps/generic/ldsodefs.h b/libc/sysdeps/generic/ldsodefs.h
index e18e60f73..230c39a63 100644
--- a/libc/sysdeps/generic/ldsodefs.h
+++ b/libc/sysdeps/generic/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2009, 2010 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
@@ -1015,7 +1015,8 @@ extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep,
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
void (*dl_main) (const ElfW(Phdr) *phdr,
ElfW(Word) phnum,
- ElfW(Addr) *user_entry))
+ ElfW(Addr) *user_entry,
+ ElfW(auxv_t) *auxv))
attribute_hidden;
extern void _dl_sysdep_start_cleanup (void)
diff --git a/libc/sysdeps/generic/netinet/ip.h b/libc/sysdeps/generic/netinet/ip.h
index 38bd7556d..a837b9814 100644
--- a/libc/sysdeps/generic/netinet/ip.h
+++ b/libc/sysdeps/generic/netinet/ip.h
@@ -189,7 +189,26 @@ struct ip_timestamp
#define IPTOS_DSCP_EF 0xb8
/*
- * Definitions for IP type of service (ip_tos)
+ * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
+ * the old ToS Precedence values.
+ */
+
+#define IPTOS_CLASS_MASK 0xe0
+#define IPTOS_CLASS(class) ((tos) & IPTOS_CLASS_MASK)
+#define IPTOS_CLASS_CS0 0x00
+#define IPTOS_CLASS_CS1 0x20
+#define IPTOS_CLASS_CS2 0x40
+#define IPTOS_CLASS_CS3 0x60
+#define IPTOS_CLASS_CS4 0x80
+#define IPTOS_CLASS_CS5 0xa0
+#define IPTOS_CLASS_CS6 0xc0
+#define IPTOS_CLASS_CS7 0xe0
+
+#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
+
+/*
+ * Definitions for IP type of service (ip_tos) [deprecated; use DSCP
+ * and CS definitions above instead.]
*/
#define IPTOS_TOS_MASK 0x1E
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
@@ -200,18 +219,18 @@ struct ip_timestamp
#define IPTOS_MINCOST IPTOS_LOWCOST
/*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ * Definitions for IP precedence (also in ip_tos) [also deprecated.]
*/
-#define IPTOS_PREC_MASK 0xe0
-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
+#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
+#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
+#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
+#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
+#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
+#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
+#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
+#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
+#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
+#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
/*
* Definitions for options.
diff --git a/libc/sysdeps/i386/i686/bcopy.S b/libc/sysdeps/i386/i686/bcopy.S
new file mode 100644
index 000000000..15ef9419a
--- /dev/null
+++ b/libc/sysdeps/i386/i686/bcopy.S
@@ -0,0 +1,3 @@
+#define USE_AS_BCOPY
+#define memmove bcopy
+#include <sysdeps/i386/i686/memmove.S>
diff --git a/libc/sysdeps/i386/i686/cacheinfo.c b/libc/sysdeps/i386/i686/cacheinfo.c
index 82e4cd223..f8b7f521c 100644
--- a/libc/sysdeps/i386/i686/cacheinfo.c
+++ b/libc/sysdeps/i386/i686/cacheinfo.c
@@ -1,3 +1,4 @@
+#define __x86_64_data_cache_size __x86_data_cache_size
#define __x86_64_data_cache_size_half __x86_data_cache_size_half
#define __x86_64_shared_cache_size __x86_shared_cache_size
#define __x86_64_shared_cache_size_half __x86_shared_cache_size_half
diff --git a/libc/sysdeps/i386/i686/memcpy.S b/libc/sysdeps/i386/i686/memcpy.S
index 0b2da1ea2..86ee082be 100644
--- a/libc/sysdeps/i386/i686/memcpy.S
+++ b/libc/sysdeps/i386/i686/memcpy.S
@@ -32,11 +32,11 @@
.text
#if defined PIC && !defined NOT_IN_libc
-ENTRY (__memcpy_chk)
+ENTRY_CHK (__memcpy_chk)
movl 12(%esp), %eax
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
-END (__memcpy_chk)
+END_CHK (__memcpy_chk)
#endif
ENTRY (BP_SYM (memcpy))
ENTER
diff --git a/libc/sysdeps/i386/i686/memmove.S b/libc/sysdeps/i386/i686/memmove.S
index b93b5c729..981f14f4e 100644
--- a/libc/sysdeps/i386/i686/memmove.S
+++ b/libc/sysdeps/i386/i686/memmove.S
@@ -26,18 +26,27 @@
#define PARMS LINKAGE+4 /* one spilled register */
#define RTN PARMS
-#define DEST RTN+RTN_SIZE
-#define SRC DEST+PTR_SIZE
-#define LEN SRC+PTR_SIZE
.text
-#if defined PIC && !defined NOT_IN_libc
-ENTRY (__memmove_chk)
+
+#ifdef USE_AS_BCOPY
+# define SRC RTN+RTN_SIZE
+# define DEST SRC+PTR_SIZE
+# define LEN DEST+PTR_SIZE
+#else
+# define DEST RTN+RTN_SIZE
+# define SRC DEST+PTR_SIZE
+# define LEN SRC+PTR_SIZE
+
+# if defined PIC && !defined NOT_IN_libc
+ENTRY_CHK (__memmove_chk)
movl 12(%esp), %eax
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
-END (__memmove_chk)
+END_CHK (__memmove_chk)
+# endif
#endif
+
ENTRY (BP_SYM (memmove))
ENTER
@@ -69,8 +78,10 @@ ENTRY (BP_SYM (memmove))
movsl
movl %edx, %esi
cfi_restore (esi)
+#ifndef USE_AS_BCOPY
movl DEST(%esp), %eax
RETURN_BOUNDED_POINTER (DEST(%esp))
+#endif
popl %edi
cfi_adjust_cfa_offset (-4)
@@ -101,8 +112,10 @@ ENTRY (BP_SYM (memmove))
movsl
movl %edx, %esi
cfi_restore (esi)
+#ifndef USE_AS_BCOPY
movl DEST(%esp), %eax
RETURN_BOUNDED_POINTER (DEST(%esp))
+#endif
cld
popl %edi
@@ -112,4 +125,6 @@ ENTRY (BP_SYM (memmove))
LEAVE
RET_PTR
END (BP_SYM (memmove))
+#ifndef USE_AS_BCOPY
libc_hidden_builtin_def (memmove)
+#endif
diff --git a/libc/sysdeps/i386/i686/mempcpy.S b/libc/sysdeps/i386/i686/mempcpy.S
index 6437e4a5d..c10686fb3 100644
--- a/libc/sysdeps/i386/i686/mempcpy.S
+++ b/libc/sysdeps/i386/i686/mempcpy.S
@@ -32,11 +32,11 @@
.text
#if defined PIC && !defined NOT_IN_libc
-ENTRY (__mempcpy_chk)
+ENTRY_CHK (__mempcpy_chk)
movl 12(%esp), %eax
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
-END (__mempcpy_chk)
+END_CHK (__mempcpy_chk)
#endif
ENTRY (BP_SYM (__mempcpy))
ENTER
diff --git a/libc/sysdeps/i386/i686/memset.S b/libc/sysdeps/i386/i686/memset.S
index dfa1aa701..b343af7b6 100644
--- a/libc/sysdeps/i386/i686/memset.S
+++ b/libc/sysdeps/i386/i686/memset.S
@@ -40,11 +40,11 @@
.text
#if defined PIC && !defined NOT_IN_libc && !BZERO_P
-ENTRY (__memset_chk)
+ENTRY_CHK (__memset_chk)
movl 12(%esp), %eax
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
-END (__memset_chk)
+END_CHK (__memset_chk)
#endif
ENTRY (BP_SYM (memset))
ENTER
diff --git a/libc/sysdeps/i386/i686/multiarch/Makefile b/libc/sysdeps/i386/i686/multiarch/Makefile
index e1553b284..fbad9ae73 100644
--- a/libc/sysdeps/i386/i686/multiarch/Makefile
+++ b/libc/sysdeps/i386/i686/multiarch/Makefile
@@ -4,6 +4,10 @@ gen-as-const-headers += ifunc-defines.sym
endif
ifeq ($(subdir),string)
+sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \
+ memmove-ssse3 memcpy-ssse3-rep mempcpy-ssse3-rep \
+ memmove-ssse3-rep bcopy-ssse3 bcopy-ssse3-rep \
+ memset-sse2-rep bzero-sse2-rep
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
CFLAGS-strcspn-c.c += -msse4
diff --git a/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S b/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S
new file mode 100644
index 000000000..cbc8b420e
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMMOVE
+#define USE_AS_BCOPY
+#define MEMCPY __bcopy_ssse3_rep
+#include "memcpy-ssse3-rep.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3.S b/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3.S
new file mode 100644
index 000000000..36aac44b9
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bcopy-ssse3.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMMOVE
+#define USE_AS_BCOPY
+#define MEMCPY __bcopy_ssse3
+#include "memcpy-ssse3.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/bcopy.S b/libc/sysdeps/i386/i686/multiarch/bcopy.S
new file mode 100644
index 000000000..8671bf684
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bcopy.S
@@ -0,0 +1,89 @@
+/* Multiple versions of bcopy
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(bcopy)
+ .type bcopy, @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 __bcopy_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __bcopy_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __bcopy_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(bcopy)
+# else
+ .text
+ENTRY(bcopy)
+ .type bcopy, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __bcopy_ia32, %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
+ jz 2f
+ leal __bcopy_ssse3, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __bcopy_ssse3_rep, %eax
+2: ret
+END(bcopy)
+# endif
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __bcopy_ia32, @function; \
+ .p2align 4; \
+ __bcopy_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __bcopy_ia32, .-__bcopy_ia32
+
+#endif
+
+#include "../bcopy.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/bzero-sse2-rep.S b/libc/sysdeps/i386/i686/multiarch/bzero-sse2-rep.S
new file mode 100644
index 000000000..507b288bb
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bzero-sse2-rep.S
@@ -0,0 +1,3 @@
+#define USE_AS_BZERO
+#define __memset_sse2_rep __bzero_sse2_rep
+#include "memset-sse2-rep.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/bzero-sse2.S b/libc/sysdeps/i386/i686/multiarch/bzero-sse2.S
new file mode 100644
index 000000000..8d04512e4
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bzero-sse2.S
@@ -0,0 +1,3 @@
+#define USE_AS_BZERO
+#define __memset_sse2 __bzero_sse2
+#include "memset-sse2.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/bzero.S b/libc/sysdeps/i386/i686/multiarch/bzero.S
new file mode 100644
index 000000000..8c740a42d
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/bzero.S
@@ -0,0 +1,97 @@
+/* Multiple versions of bzero
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(__bzero)
+ .type __bzero, @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 __bzero_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __bzero_sse2@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __bzero_sse2_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__bzero)
+# else
+ .text
+ENTRY(__bzero)
+ .type __bzero, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __bzero_ia32, %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
+ jz 2f
+ leal __bzero_sse2, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __bzero_sse2_rep, %eax
+2: ret
+END(__bzero)
+# endif
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __bzero_ia32, @function; \
+ .p2align 4; \
+ __bzero_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __bzero_ia32, .-__bzero_ia32
+
+# ifdef SHARED
+# undef libc_hidden_builtin_def
+/* IFUNC doesn't work with the hidden functions in shared library since
+ they will be called without setting up EBX needed for PLT which is
+ used by IFUNC. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI___bzero; __GI___bzero = __bzero_ia32
+# endif
+#endif
+
+#include "../bzero.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym b/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym
index e2021cdf8..eb1538abc 100644
--- a/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym
+++ b/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym
@@ -13,5 +13,8 @@ CPUID_ECX_OFFSET offsetof (struct cpuid_registers, ecx)
CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx)
FAMILY_OFFSET offsetof (struct cpu_features, family)
MODEL_OFFSET offsetof (struct cpu_features, model)
+FEATURE_OFFSET offsetof (struct cpu_features, feature)
+FEATURE_SIZE sizeof (unsigned int)
COMMON_CPUID_INDEX_1
+FEATURE_INDEX_1
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
new file mode 100644
index 000000000..b26037d27
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
@@ -0,0 +1,1785 @@
+/* memcpy with SSSE3 and REP string.
+ Copyright (C) 2010 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>
+
+#if !defined NOT_IN_libc \
+ && (defined SHARED \
+ || defined USE_AS_MEMMOVE \
+ || !defined USE_MULTIARCH)
+
+#include "asm-syntax.h"
+
+#ifndef MEMCPY
+# define MEMCPY __memcpy_ssse3_rep
+# define MEMCPY_CHK __memcpy_chk_ssse3_rep
+#endif
+
+#ifdef USE_AS_BCOPY
+# define SRC PARMS
+# define DEST SRC+4
+# define LEN DEST+4
+#else
+# define DEST PARMS
+# define SRC DEST+4
+# define LEN SRC+4
+#endif
+
+#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)
+
+#ifdef SHARED
+# define PARMS 8 /* Preserve EBX. */
+# define ENTRANCE PUSH (%ebx);
+# define RETURN_END POP (%ebx); ret
+# define RETURN RETURN_END; CFI_PUSH (%ebx)
+# define JMPTBL(I, B) I - B
+
+/* Load an entry in a jump table into EBX and branch to it. TABLE is a
+ jump table with relative offsets. INDEX is a register contains the
+ index into the jump table. SCALE is the scale of INDEX. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
+ /* We first load PC into EBX. */ \
+ call __i686.get_pc_thunk.bx; \
+ /* Get the address of the jump table. */ \
+ addl $(TABLE - .), %ebx; \
+ /* Get the entry and convert the relative offset to the \
+ absolute address. */ \
+ addl (%ebx,INDEX,SCALE), %ebx; \
+ /* We loaded the jump table. Go. */ \
+ jmp *%ebx
+
+# define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) \
+ addl $(TABLE - .), %ebx
+
+# define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
+ addl (%ebx,INDEX,SCALE), %ebx; \
+ /* We loaded the jump table. Go. */ \
+ jmp *%ebx
+
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ ALIGN (4)
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#else
+# define PARMS 4
+# define ENTRANCE
+# define RETURN_END ret
+# define RETURN RETURN_END
+# define JMPTBL(I, B) I
+
+/* Branch to an entry in a jump table. TABLE is a jump table with
+ absolute offsets. INDEX is a register contains the index into the
+ jump table. SCALE is the scale of INDEX. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
+ jmp *TABLE(,INDEX,SCALE)
+
+# define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE)
+
+# define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
+ jmp *TABLE(,INDEX,SCALE)
+#endif
+
+ .section .text.ssse3,"ax",@progbits
+#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
+ENTRY (MEMCPY_CHK)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (MEMCPY_CHK)
+#endif
+ENTRY (MEMCPY)
+ ENTRANCE
+ movl LEN(%esp), %ecx
+ movl SRC(%esp), %eax
+ movl DEST(%esp), %edx
+
+#ifdef USE_AS_MEMMOVE
+ cmp %eax, %edx
+ jb L(copy_forward)
+ je L(fwd_write_0bytes)
+ cmp $32, %ecx
+ jge L(memmove_bwd)
+ jmp L(bk_write_less32bytes_2)
+L(memmove_bwd):
+ add %ecx, %eax
+ cmp %eax, %edx
+ movl SRC(%esp), %eax
+ jb L(copy_backward)
+
+L(copy_forward):
+#endif
+ cmp $48, %ecx
+ jge L(48bytesormore)
+
+L(fwd_write_less32bytes):
+#ifndef USE_AS_MEMMOVE
+ cmp %dl, %al
+ jl L(bk_write)
+#endif
+ add %ecx, %edx
+ add %ecx, %eax
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+#ifndef USE_AS_MEMMOVE
+L(bk_write):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
+#endif
+
+ ALIGN (4)
+/* ECX > 32 and EDX is 4 byte aligned. */
+L(48bytesormore):
+ movdqu (%eax), %xmm0
+ PUSH (%edi)
+ movl %edx, %edi
+ and $-16, %edx
+ PUSH (%esi)
+ add $16, %edx
+ movl %edi, %esi
+ sub %edx, %edi
+ add %edi, %ecx
+ sub %edi, %eax
+
+#ifdef SHARED_CACHE_SIZE_HALF
+ cmp $SHARED_CACHE_SIZE_HALF, %ecx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx
+# else
+ cmp __x86_shared_cache_size_half, %ecx
+# endif
+#endif
+
+ mov %eax, %edi
+ jge L(large_page)
+ and $0xf, %edi
+ jz L(shl_0)
+
+ BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %edi, 4)
+
+ ALIGN (4)
+L(shl_0):
+ movdqu %xmm0, (%esi)
+ xor %edi, %edi
+ cmp $127, %ecx
+ ja L(shl_0_gobble)
+ lea -32(%ecx), %ecx
+L(shl_0_loop):
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+L(shl_0_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ add %edi, %eax
+ POP (%esi)
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+L(shl_0_gobble):
+
+#ifdef DATA_CACHE_SIZE_HALF
+ cmp $DATA_CACHE_SIZE_HALF, %ecx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ mov __x86_data_cache_size_half@GOTOFF(%ebx), %edi
+# else
+ mov __x86_data_cache_size_half, %edi
+# endif
+#endif
+ mov %edi, %esi
+ shr $3, %esi
+ sub %esi, %edi
+ cmp %edi, %ecx
+ jge L(shl_0_gobble_mem_start)
+ lea -128(%ecx), %ecx
+ ALIGN (4)
+L(shl_0_gobble_cache_loop):
+ movdqa (%eax), %xmm0
+ movaps 0x10(%eax), %xmm1
+ movaps 0x20(%eax), %xmm2
+ movaps 0x30(%eax), %xmm3
+ movaps 0x40(%eax), %xmm4
+ movaps 0x50(%eax), %xmm5
+ movaps 0x60(%eax), %xmm6
+ movaps 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movaps %xmm1, 0x10(%edx)
+ movaps %xmm2, 0x20(%edx)
+ movaps %xmm3, 0x30(%edx)
+ movaps %xmm4, 0x40(%edx)
+ movaps %xmm5, 0x50(%edx)
+ movaps %xmm6, 0x60(%edx)
+ movaps %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+
+ jge L(shl_0_gobble_cache_loop)
+L(shl_0_gobble_cache_loop_tail):
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(shl_0_cache_less_64bytes)
+
+ movdqa (%eax), %xmm0
+ sub $0x40, %ecx
+ movdqa 0x10(%eax), %xmm1
+
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+
+ movdqa 0x20(%eax), %xmm0
+ movdqa 0x30(%eax), %xmm1
+ add $0x40, %eax
+
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm1, 0x30(%edx)
+ add $0x40, %edx
+L(shl_0_cache_less_64bytes):
+ cmp $0x20, %ecx
+ jl L(shl_0_cache_less_32bytes)
+ movdqa (%eax), %xmm0
+ sub $0x20, %ecx
+ movdqa 0x10(%eax), %xmm1
+ add $0x20, %eax
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ add $0x20, %edx
+L(shl_0_cache_less_32bytes):
+ cmp $0x10, %ecx
+ jl L(shl_0_cache_less_16bytes)
+ sub $0x10, %ecx
+ movdqa (%eax), %xmm0
+ add $0x10, %eax
+ movdqa %xmm0, (%edx)
+ add $0x10, %edx
+L(shl_0_cache_less_16bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ POP (%esi)
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_0_gobble_mem_start):
+ cmp %al, %dl
+ je L(copy_page_by_rep)
+ lea -128(%ecx), %ecx
+L(shl_0_gobble_mem_loop):
+ prefetchnta 0x1c0(%eax)
+ prefetchnta 0x280(%eax)
+ prefetchnta 0x1c0(%edx)
+ prefetchnta 0x280(%edx)
+
+ movdqa (%eax), %xmm0
+ movaps 0x10(%eax), %xmm1
+ movaps 0x20(%eax), %xmm2
+ movaps 0x30(%eax), %xmm3
+ movaps 0x40(%eax), %xmm4
+ movaps 0x50(%eax), %xmm5
+ movaps 0x60(%eax), %xmm6
+ movaps 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+ sub $0x80, %ecx
+ movdqa %xmm0, (%edx)
+ movaps %xmm1, 0x10(%edx)
+ movaps %xmm2, 0x20(%edx)
+ movaps %xmm3, 0x30(%edx)
+ movaps %xmm4, 0x40(%edx)
+ movaps %xmm5, 0x50(%edx)
+ movaps %xmm6, 0x60(%edx)
+ movaps %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+
+ jge L(shl_0_gobble_mem_loop)
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(shl_0_mem_less_64bytes)
+
+ movdqa (%eax), %xmm0
+ sub $0x40, %ecx
+ movdqa 0x10(%eax), %xmm1
+
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+
+ movdqa 0x20(%eax), %xmm0
+ movdqa 0x30(%eax), %xmm1
+ add $0x40, %eax
+
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm1, 0x30(%edx)
+ add $0x40, %edx
+L(shl_0_mem_less_64bytes):
+ cmp $0x20, %ecx
+ jl L(shl_0_mem_less_32bytes)
+ movdqa (%eax), %xmm0
+ sub $0x20, %ecx
+ movdqa 0x10(%eax), %xmm1
+ add $0x20, %eax
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ add $0x20, %edx
+L(shl_0_mem_less_32bytes):
+ cmp $0x10, %ecx
+ jl L(shl_0_mem_less_16bytes)
+ sub $0x10, %ecx
+ movdqa (%eax), %xmm0
+ add $0x10, %eax
+ movdqa %xmm0, (%edx)
+ add $0x10, %edx
+L(shl_0_mem_less_16bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ POP (%esi)
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_1):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -1(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_1_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $1, %xmm2, %xmm3
+ palignr $1, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_1_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $1, %xmm2, %xmm3
+ palignr $1, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_1_loop)
+
+L(shl_1_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 1(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_2):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -2(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_2_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $2, %xmm2, %xmm3
+ palignr $2, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_2_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $2, %xmm2, %xmm3
+ palignr $2, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_2_loop)
+
+L(shl_2_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 2(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_3):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -3(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_3_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $3, %xmm2, %xmm3
+ palignr $3, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_3_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $3, %xmm2, %xmm3
+ palignr $3, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_3_loop)
+
+L(shl_3_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 3(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_4):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -4(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_4_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $4, %xmm2, %xmm3
+ palignr $4, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_4_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $4, %xmm2, %xmm3
+ palignr $4, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_4_loop)
+
+L(shl_4_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 4(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_5):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -5(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_5_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $5, %xmm2, %xmm3
+ palignr $5, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_5_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $5, %xmm2, %xmm3
+ palignr $5, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_5_loop)
+
+L(shl_5_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 5(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_6):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -6(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_6_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $6, %xmm2, %xmm3
+ palignr $6, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_6_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $6, %xmm2, %xmm3
+ palignr $6, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_6_loop)
+
+L(shl_6_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 6(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_7):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -7(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_7_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $7, %xmm2, %xmm3
+ palignr $7, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_7_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $7, %xmm2, %xmm3
+ palignr $7, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_7_loop)
+
+L(shl_7_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 7(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_8):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -8(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_8_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $8, %xmm2, %xmm3
+ palignr $8, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_8_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $8, %xmm2, %xmm3
+ palignr $8, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_8_loop)
+
+L(shl_8_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 8(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_9):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -9(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_9_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $9, %xmm2, %xmm3
+ palignr $9, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_9_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $9, %xmm2, %xmm3
+ palignr $9, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_9_loop)
+
+L(shl_9_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 9(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_10):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -10(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_10_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $10, %xmm2, %xmm3
+ palignr $10, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_10_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $10, %xmm2, %xmm3
+ palignr $10, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_10_loop)
+
+L(shl_10_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 10(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_11):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -11(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_11_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $11, %xmm2, %xmm3
+ palignr $11, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_11_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $11, %xmm2, %xmm3
+ palignr $11, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_11_loop)
+
+L(shl_11_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 11(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_12):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -12(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_12_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $12, %xmm2, %xmm3
+ palignr $12, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_12_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $12, %xmm2, %xmm3
+ palignr $12, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_12_loop)
+
+L(shl_12_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 12(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_13):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -13(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_13_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $13, %xmm2, %xmm3
+ palignr $13, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_13_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $13, %xmm2, %xmm3
+ palignr $13, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_13_loop)
+
+L(shl_13_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 13(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_14):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -14(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_14_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $14, %xmm2, %xmm3
+ palignr $14, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_14_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $14, %xmm2, %xmm3
+ palignr $14, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_14_loop)
+
+L(shl_14_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 14(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_15):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -15(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_15_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $15, %xmm2, %xmm3
+ palignr $15, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_15_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $15, %xmm2, %xmm3
+ palignr $15, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_15_loop)
+
+L(shl_15_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 15(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(fwd_write_44bytes):
+ movl -44(%eax), %ecx
+ movl %ecx, -44(%edx)
+L(fwd_write_40bytes):
+ movl -40(%eax), %ecx
+ movl %ecx, -40(%edx)
+L(fwd_write_36bytes):
+ movl -36(%eax), %ecx
+ movl %ecx, -36(%edx)
+L(fwd_write_32bytes):
+ movl -32(%eax), %ecx
+ movl %ecx, -32(%edx)
+L(fwd_write_28bytes):
+ movl -28(%eax), %ecx
+ movl %ecx, -28(%edx)
+L(fwd_write_24bytes):
+ movl -24(%eax), %ecx
+ movl %ecx, -24(%edx)
+L(fwd_write_20bytes):
+ movl -20(%eax), %ecx
+ movl %ecx, -20(%edx)
+L(fwd_write_16bytes):
+ movl -16(%eax), %ecx
+ movl %ecx, -16(%edx)
+L(fwd_write_12bytes):
+ movl -12(%eax), %ecx
+ movl %ecx, -12(%edx)
+L(fwd_write_8bytes):
+ movl -8(%eax), %ecx
+ movl %ecx, -8(%edx)
+L(fwd_write_4bytes):
+ movl -4(%eax), %ecx
+ movl %ecx, -4(%edx)
+L(fwd_write_0bytes):
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_5bytes):
+ movl -5(%eax), %ecx
+ movl -4(%eax), %eax
+ movl %ecx, -5(%edx)
+ movl %eax, -4(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_45bytes):
+ movl -45(%eax), %ecx
+ movl %ecx, -45(%edx)
+L(fwd_write_41bytes):
+ movl -41(%eax), %ecx
+ movl %ecx, -41(%edx)
+L(fwd_write_37bytes):
+ movl -37(%eax), %ecx
+ movl %ecx, -37(%edx)
+L(fwd_write_33bytes):
+ movl -33(%eax), %ecx
+ movl %ecx, -33(%edx)
+L(fwd_write_29bytes):
+ movl -29(%eax), %ecx
+ movl %ecx, -29(%edx)
+L(fwd_write_25bytes):
+ movl -25(%eax), %ecx
+ movl %ecx, -25(%edx)
+L(fwd_write_21bytes):
+ movl -21(%eax), %ecx
+ movl %ecx, -21(%edx)
+L(fwd_write_17bytes):
+ movl -17(%eax), %ecx
+ movl %ecx, -17(%edx)
+L(fwd_write_13bytes):
+ movl -13(%eax), %ecx
+ movl %ecx, -13(%edx)
+L(fwd_write_9bytes):
+ movl -9(%eax), %ecx
+ movl %ecx, -9(%edx)
+ movl -5(%eax), %ecx
+ movl %ecx, -5(%edx)
+L(fwd_write_1bytes):
+ movzbl -1(%eax), %ecx
+ movb %cl, -1(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_46bytes):
+ movl -46(%eax), %ecx
+ movl %ecx, -46(%edx)
+L(fwd_write_42bytes):
+ movl -42(%eax), %ecx
+ movl %ecx, -42(%edx)
+L(fwd_write_38bytes):
+ movl -38(%eax), %ecx
+ movl %ecx, -38(%edx)
+L(fwd_write_34bytes):
+ movl -34(%eax), %ecx
+ movl %ecx, -34(%edx)
+L(fwd_write_30bytes):
+ movl -30(%eax), %ecx
+ movl %ecx, -30(%edx)
+L(fwd_write_26bytes):
+ movl -26(%eax), %ecx
+ movl %ecx, -26(%edx)
+L(fwd_write_22bytes):
+ movl -22(%eax), %ecx
+ movl %ecx, -22(%edx)
+L(fwd_write_18bytes):
+ movl -18(%eax), %ecx
+ movl %ecx, -18(%edx)
+L(fwd_write_14bytes):
+ movl -14(%eax), %ecx
+ movl %ecx, -14(%edx)
+L(fwd_write_10bytes):
+ movl -10(%eax), %ecx
+ movl %ecx, -10(%edx)
+L(fwd_write_6bytes):
+ movl -6(%eax), %ecx
+ movl %ecx, -6(%edx)
+L(fwd_write_2bytes):
+ movzwl -2(%eax), %ecx
+ movw %cx, -2(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_47bytes):
+ movl -47(%eax), %ecx
+ movl %ecx, -47(%edx)
+L(fwd_write_43bytes):
+ movl -43(%eax), %ecx
+ movl %ecx, -43(%edx)
+L(fwd_write_39bytes):
+ movl -39(%eax), %ecx
+ movl %ecx, -39(%edx)
+L(fwd_write_35bytes):
+ movl -35(%eax), %ecx
+ movl %ecx, -35(%edx)
+L(fwd_write_31bytes):
+ movl -31(%eax), %ecx
+ movl %ecx, -31(%edx)
+L(fwd_write_27bytes):
+ movl -27(%eax), %ecx
+ movl %ecx, -27(%edx)
+L(fwd_write_23bytes):
+ movl -23(%eax), %ecx
+ movl %ecx, -23(%edx)
+L(fwd_write_19bytes):
+ movl -19(%eax), %ecx
+ movl %ecx, -19(%edx)
+L(fwd_write_15bytes):
+ movl -15(%eax), %ecx
+ movl %ecx, -15(%edx)
+L(fwd_write_11bytes):
+ movl -11(%eax), %ecx
+ movl %ecx, -11(%edx)
+L(fwd_write_7bytes):
+ movl -7(%eax), %ecx
+ movl %ecx, -7(%edx)
+L(fwd_write_3bytes):
+ movzwl -3(%eax), %ecx
+ movzbl -1(%eax), %eax
+ movw %cx, -3(%edx)
+ movb %al, -1(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(large_page):
+ movdqu (%eax), %xmm1
+ lea 16(%eax), %eax
+ movdqu %xmm0, (%esi)
+ movntdq %xmm1, (%edx)
+ lea 16(%edx), %edx
+ cmp %al, %dl
+ je L(copy_page_by_rep)
+L(large_page_loop_init):
+ POP (%esi)
+ lea -0x90(%ecx), %ecx
+ POP (%edi)
+L(large_page_loop):
+ prefetchnta 0x1c0(%eax)
+ prefetchnta 0x280(%eax)
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ movdqu 0x20(%eax), %xmm2
+ movdqu 0x30(%eax), %xmm3
+ movdqu 0x40(%eax), %xmm4
+ movdqu 0x50(%eax), %xmm5
+ movdqu 0x60(%eax), %xmm6
+ movdqu 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+ lfence
+ sub $0x80, %ecx
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ movntdq %xmm2, 0x20(%edx)
+ movntdq %xmm3, 0x30(%edx)
+ movntdq %xmm4, 0x40(%edx)
+ movntdq %xmm5, 0x50(%edx)
+ movntdq %xmm6, 0x60(%edx)
+ movntdq %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+ jae L(large_page_loop)
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(large_page_less_64bytes)
+
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ movdqu 0x20(%eax), %xmm2
+ movdqu 0x30(%eax), %xmm3
+ lea 0x40(%eax), %eax
+
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ movntdq %xmm2, 0x20(%edx)
+ movntdq %xmm3, 0x30(%edx)
+ lea 0x40(%edx), %edx
+ sub $0x40, %ecx
+L(large_page_less_64bytes):
+ cmp $32, %ecx
+ jl L(large_page_less_32bytes)
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ lea 0x20(%eax), %eax
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ lea 0x20(%edx), %edx
+ sub $0x20, %ecx
+L(large_page_less_32bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ sfence
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(copy_page_by_rep):
+ mov %eax, %esi
+ mov %edx, %edi
+ mov %ecx, %edx
+ shr $2, %ecx
+ and $3, %edx
+ rep movsl
+ jz L(copy_page_by_rep_exit)
+ cmp $2, %edx
+ jb L(copy_page_by_rep_left_1)
+ movzwl (%esi), %eax
+ movw %ax, (%edi)
+ add $2, %esi
+ add $2, %edi
+ sub $2, %edx
+ jz L(copy_page_by_rep_exit)
+L(copy_page_by_rep_left_1):
+ movzbl (%esi), %eax
+ movb %al, (%edi)
+L(copy_page_by_rep_exit):
+ POP (%esi)
+ POP (%edi)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_44bytes):
+ movl 40(%eax), %ecx
+ movl %ecx, 40(%edx)
+L(bk_write_40bytes):
+ movl 36(%eax), %ecx
+ movl %ecx, 36(%edx)
+L(bk_write_36bytes):
+ movl 32(%eax), %ecx
+ movl %ecx, 32(%edx)
+L(bk_write_32bytes):
+ movl 28(%eax), %ecx
+ movl %ecx, 28(%edx)
+L(bk_write_28bytes):
+ movl 24(%eax), %ecx
+ movl %ecx, 24(%edx)
+L(bk_write_24bytes):
+ movl 20(%eax), %ecx
+ movl %ecx, 20(%edx)
+L(bk_write_20bytes):
+ movl 16(%eax), %ecx
+ movl %ecx, 16(%edx)
+L(bk_write_16bytes):
+ movl 12(%eax), %ecx
+ movl %ecx, 12(%edx)
+L(bk_write_12bytes):
+ movl 8(%eax), %ecx
+ movl %ecx, 8(%edx)
+L(bk_write_8bytes):
+ movl 4(%eax), %ecx
+ movl %ecx, 4(%edx)
+L(bk_write_4bytes):
+ movl (%eax), %ecx
+ movl %ecx, (%edx)
+L(bk_write_0bytes):
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_45bytes):
+ movl 41(%eax), %ecx
+ movl %ecx, 41(%edx)
+L(bk_write_41bytes):
+ movl 37(%eax), %ecx
+ movl %ecx, 37(%edx)
+L(bk_write_37bytes):
+ movl 33(%eax), %ecx
+ movl %ecx, 33(%edx)
+L(bk_write_33bytes):
+ movl 29(%eax), %ecx
+ movl %ecx, 29(%edx)
+L(bk_write_29bytes):
+ movl 25(%eax), %ecx
+ movl %ecx, 25(%edx)
+L(bk_write_25bytes):
+ movl 21(%eax), %ecx
+ movl %ecx, 21(%edx)
+L(bk_write_21bytes):
+ movl 17(%eax), %ecx
+ movl %ecx, 17(%edx)
+L(bk_write_17bytes):
+ movl 13(%eax), %ecx
+ movl %ecx, 13(%edx)
+L(bk_write_13bytes):
+ movl 9(%eax), %ecx
+ movl %ecx, 9(%edx)
+L(bk_write_9bytes):
+ movl 5(%eax), %ecx
+ movl %ecx, 5(%edx)
+L(bk_write_5bytes):
+ movl 1(%eax), %ecx
+ movl %ecx, 1(%edx)
+L(bk_write_1bytes):
+ movzbl (%eax), %ecx
+ movb %cl, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_46bytes):
+ movl 42(%eax), %ecx
+ movl %ecx, 42(%edx)
+L(bk_write_42bytes):
+ movl 38(%eax), %ecx
+ movl %ecx, 38(%edx)
+L(bk_write_38bytes):
+ movl 34(%eax), %ecx
+ movl %ecx, 34(%edx)
+L(bk_write_34bytes):
+ movl 30(%eax), %ecx
+ movl %ecx, 30(%edx)
+L(bk_write_30bytes):
+ movl 26(%eax), %ecx
+ movl %ecx, 26(%edx)
+L(bk_write_26bytes):
+ movl 22(%eax), %ecx
+ movl %ecx, 22(%edx)
+L(bk_write_22bytes):
+ movl 18(%eax), %ecx
+ movl %ecx, 18(%edx)
+L(bk_write_18bytes):
+ movl 14(%eax), %ecx
+ movl %ecx, 14(%edx)
+L(bk_write_14bytes):
+ movl 10(%eax), %ecx
+ movl %ecx, 10(%edx)
+L(bk_write_10bytes):
+ movl 6(%eax), %ecx
+ movl %ecx, 6(%edx)
+L(bk_write_6bytes):
+ movl 2(%eax), %ecx
+ movl %ecx, 2(%edx)
+L(bk_write_2bytes):
+ movzwl (%eax), %ecx
+ movw %cx, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_47bytes):
+ movl 43(%eax), %ecx
+ movl %ecx, 43(%edx)
+L(bk_write_43bytes):
+ movl 39(%eax), %ecx
+ movl %ecx, 39(%edx)
+L(bk_write_39bytes):
+ movl 35(%eax), %ecx
+ movl %ecx, 35(%edx)
+L(bk_write_35bytes):
+ movl 31(%eax), %ecx
+ movl %ecx, 31(%edx)
+L(bk_write_31bytes):
+ movl 27(%eax), %ecx
+ movl %ecx, 27(%edx)
+L(bk_write_27bytes):
+ movl 23(%eax), %ecx
+ movl %ecx, 23(%edx)
+L(bk_write_23bytes):
+ movl 19(%eax), %ecx
+ movl %ecx, 19(%edx)
+L(bk_write_19bytes):
+ movl 15(%eax), %ecx
+ movl %ecx, 15(%edx)
+L(bk_write_15bytes):
+ movl 11(%eax), %ecx
+ movl %ecx, 11(%edx)
+L(bk_write_11bytes):
+ movl 7(%eax), %ecx
+ movl %ecx, 7(%edx)
+L(bk_write_7bytes):
+ movl 3(%eax), %ecx
+ movl %ecx, 3(%edx)
+L(bk_write_3bytes):
+ movzwl 1(%eax), %ecx
+ movw %cx, 1(%edx)
+ movzbl (%eax), %eax
+ movb %al, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN_END
+
+
+ .pushsection .rodata.ssse3,"a",@progbits
+ ALIGN (2)
+L(table_48bytes_fwd):
+ .int JMPTBL (L(fwd_write_0bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_1bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_2bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_3bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_4bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_5bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_6bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_7bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_8bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_9bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_10bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_11bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_12bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_13bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_14bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_15bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_16bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_17bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_18bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_19bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_20bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_21bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_22bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_23bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_24bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_25bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_26bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_27bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_28bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_29bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_30bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_31bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_32bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_33bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_34bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_35bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_36bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_37bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_38bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_39bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_40bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_41bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_42bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_43bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_44bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_45bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_46bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_47bytes), L(table_48bytes_fwd))
+
+ ALIGN (2)
+L(shl_table):
+ .int JMPTBL (L(shl_0), L(shl_table))
+ .int JMPTBL (L(shl_1), L(shl_table))
+ .int JMPTBL (L(shl_2), L(shl_table))
+ .int JMPTBL (L(shl_3), L(shl_table))
+ .int JMPTBL (L(shl_4), L(shl_table))
+ .int JMPTBL (L(shl_5), L(shl_table))
+ .int JMPTBL (L(shl_6), L(shl_table))
+ .int JMPTBL (L(shl_7), L(shl_table))
+ .int JMPTBL (L(shl_8), L(shl_table))
+ .int JMPTBL (L(shl_9), L(shl_table))
+ .int JMPTBL (L(shl_10), L(shl_table))
+ .int JMPTBL (L(shl_11), L(shl_table))
+ .int JMPTBL (L(shl_12), L(shl_table))
+ .int JMPTBL (L(shl_13), L(shl_table))
+ .int JMPTBL (L(shl_14), L(shl_table))
+ .int JMPTBL (L(shl_15), L(shl_table))
+
+ ALIGN (2)
+L(table_48_bytes_bwd):
+ .int JMPTBL (L(bk_write_0bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_1bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_2bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_3bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_4bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_5bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_6bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_7bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_8bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_9bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_10bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_11bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_12bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_13bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_14bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_15bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_16bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_17bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_18bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_19bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_20bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_21bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_22bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_23bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_24bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_25bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_26bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_27bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_28bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_29bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_30bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_31bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_32bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_33bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_34bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_35bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_36bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_37bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_38bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_39bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_40bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_41bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_42bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_43bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_44bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_45bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_46bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_47bytes), L(table_48_bytes_bwd))
+
+ .popsection
+
+#ifdef USE_AS_MEMMOVE
+ ALIGN (4)
+L(copy_backward):
+ PUSH (%esi)
+ movl %eax, %esi
+ lea (%ecx,%edx,1),%edx
+ lea (%ecx,%esi,1),%esi
+ testl $0x3, %edx
+ jnz L(bk_align)
+
+L(bk_aligned_4):
+ cmp $64, %ecx
+ jge L(bk_write_more64bytes)
+
+L(bk_write_64bytesless):
+ cmp $32, %ecx
+ jl L(bk_write_less32bytes)
+
+L(bk_write_more32bytes):
+ /* Copy 32 bytes at a time. */
+ sub $32, %ecx
+ movl -4(%esi), %eax
+ movl %eax, -4(%edx)
+ movl -8(%esi), %eax
+ movl %eax, -8(%edx)
+ movl -12(%esi), %eax
+ movl %eax, -12(%edx)
+ movl -16(%esi), %eax
+ movl %eax, -16(%edx)
+ movl -20(%esi), %eax
+ movl %eax, -20(%edx)
+ movl -24(%esi), %eax
+ movl %eax, -24(%edx)
+ movl -28(%esi), %eax
+ movl %eax, -28(%edx)
+ movl -32(%esi), %eax
+ movl %eax, -32(%edx)
+ sub $32, %edx
+ sub $32, %esi
+
+L(bk_write_less32bytes):
+ movl %esi, %eax
+ sub %ecx, %edx
+ sub %ecx, %eax
+ POP (%esi)
+L(bk_write_less32bytes_2):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
+
+ ALIGN (4)
+L(bk_align):
+ cmp $8, %ecx
+ jle L(bk_write_less32bytes)
+ testl $1, %edx
+ /* We get here only if (EDX & 3 ) != 0 so if (EDX & 1) ==0,
+ then (EDX & 2) must be != 0. */
+ jz L(bk_got2)
+ sub $1, %esi
+ sub $1, %ecx
+ sub $1, %edx
+ movzbl (%esi), %eax
+ movb %al, (%edx)
+
+ testl $2, %edx
+ jz L(bk_aligned_4)
+
+L(bk_got2):
+ sub $2, %esi
+ sub $2, %ecx
+ sub $2, %edx
+ movzwl (%esi), %eax
+ movw %ax, (%edx)
+ jmp L(bk_aligned_4)
+
+ ALIGN (4)
+L(bk_write_more64bytes):
+ /* Check alignment of last byte. */
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+/* EDX is aligned 4 bytes, but not 16 bytes. */
+L(bk_ssse3_align):
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+L(bk_ssse3_cpy_pre):
+ cmp $64, %ecx
+ jl L(bk_write_more32bytes)
+
+L(bk_ssse3_cpy):
+ sub $64, %esi
+ sub $64, %ecx
+ sub $64, %edx
+ movdqu 0x30(%esi), %xmm3
+ movdqa %xmm3, 0x30(%edx)
+ movdqu 0x20(%esi), %xmm2
+ movdqa %xmm2, 0x20(%edx)
+ movdqu 0x10(%esi), %xmm1
+ movdqa %xmm1, 0x10(%edx)
+ movdqu (%esi), %xmm0
+ movdqa %xmm0, (%edx)
+ cmp $64, %ecx
+ jge L(bk_ssse3_cpy)
+ jmp L(bk_write_64bytesless)
+
+#endif
+
+END (MEMCPY)
+
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3.S b/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
new file mode 100644
index 000000000..749c82d37
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
@@ -0,0 +1,1737 @@
+/* memcpy with SSSE3
+ Copyright (C) 2010 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>
+
+#if !defined NOT_IN_libc \
+ && (defined SHARED \
+ || defined USE_AS_MEMMOVE \
+ || !defined USE_MULTIARCH)
+
+#include "asm-syntax.h"
+
+#ifndef MEMCPY
+# define MEMCPY __memcpy_ssse3
+# define MEMCPY_CHK __memcpy_chk_ssse3
+#endif
+
+#ifdef USE_AS_BCOPY
+# define SRC PARMS
+# define DEST SRC+4
+# define LEN DEST+4
+#else
+# define DEST PARMS
+# define SRC DEST+4
+# define LEN SRC+4
+#endif
+
+#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)
+
+#ifdef SHARED
+# define PARMS 8 /* Preserve EBX. */
+# define ENTRANCE PUSH (%ebx);
+# define RETURN_END POP (%ebx); ret
+# define RETURN RETURN_END; CFI_PUSH (%ebx)
+# define JMPTBL(I, B) I - B
+
+/* Load an entry in a jump table into EBX and branch to it. TABLE is a
+ jump table with relative offsets. INDEX is a register contains the
+ index into the jump table. SCALE is the scale of INDEX. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
+ /* We first load PC into EBX. */ \
+ call __i686.get_pc_thunk.bx; \
+ /* Get the address of the jump table. */ \
+ addl $(TABLE - .), %ebx; \
+ /* Get the entry and convert the relative offset to the \
+ absolute address. */ \
+ addl (%ebx,INDEX,SCALE), %ebx; \
+ /* We loaded the jump table. Go. */ \
+ jmp *%ebx
+
+# define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) \
+ addl $(TABLE - .), %ebx
+
+# define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
+ addl (%ebx,INDEX,SCALE), %ebx; \
+ /* We loaded the jump table. Go. */ \
+ jmp *%ebx
+
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ ALIGN (4)
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#else
+# define PARMS 4
+# define ENTRANCE
+# define RETURN_END ret
+# define RETURN RETURN_END
+# define JMPTBL(I, B) I
+
+/* Branch to an entry in a jump table. TABLE is a jump table with
+ absolute offsets. INDEX is a register contains the index into the
+ jump table. SCALE is the scale of INDEX. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
+ jmp *TABLE(,INDEX,SCALE)
+
+# define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE)
+
+# define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
+ jmp *TABLE(,INDEX,SCALE)
+#endif
+
+ .section .text.ssse3,"ax",@progbits
+#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
+ENTRY (MEMCPY_CHK)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (MEMCPY_CHK)
+#endif
+ENTRY (MEMCPY)
+ ENTRANCE
+ movl LEN(%esp), %ecx
+ movl SRC(%esp), %eax
+ movl DEST(%esp), %edx
+
+#ifdef USE_AS_MEMMOVE
+ cmp %eax, %edx
+ jb L(copy_forward)
+ je L(fwd_write_0bytes)
+ cmp $32, %ecx
+ jge L(memmove_bwd)
+ jmp L(bk_write_less32bytes_2)
+L(memmove_bwd):
+ add %ecx, %eax
+ cmp %eax, %edx
+ movl SRC(%esp), %eax
+ jb L(copy_backward)
+
+L(copy_forward):
+#endif
+ cmp $48, %ecx
+ jge L(48bytesormore)
+
+L(fwd_write_less32bytes):
+#ifndef USE_AS_MEMMOVE
+ cmp %dl, %al
+ jl L(bk_write)
+#endif
+ add %ecx, %edx
+ add %ecx, %eax
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+#ifndef USE_AS_MEMMOVE
+L(bk_write):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
+#endif
+
+ ALIGN (4)
+/* ECX > 32 and EDX is 4 byte aligned. */
+L(48bytesormore):
+ movdqu (%eax), %xmm0
+ PUSH (%edi)
+ movl %edx, %edi
+ and $-16, %edx
+ PUSH (%esi)
+ add $16, %edx
+ movl %edi, %esi
+ sub %edx, %edi
+ add %edi, %ecx
+ sub %edi, %eax
+
+#ifdef SHARED_CACHE_SIZE_HALF
+ cmp $SHARED_CACHE_SIZE_HALF, %ecx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx
+# else
+ cmp __x86_shared_cache_size_half, %ecx
+# endif
+#endif
+
+ mov %eax, %edi
+ jge L(large_page)
+ and $0xf, %edi
+ jz L(shl_0)
+
+ BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %edi, 4)
+
+ ALIGN (4)
+L(shl_0):
+ movdqu %xmm0, (%esi)
+ xor %edi, %edi
+ POP (%esi)
+ cmp $127, %ecx
+ ja L(shl_0_gobble)
+ lea -32(%ecx), %ecx
+L(shl_0_loop):
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+ jl L(shl_0_end)
+
+ movdqa (%eax, %edi), %xmm0
+ movdqa 16(%eax, %edi), %xmm1
+ sub $32, %ecx
+ movdqa %xmm0, (%edx, %edi)
+ movdqa %xmm1, 16(%edx, %edi)
+ lea 32(%edi), %edi
+L(shl_0_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ add %edi, %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+L(shl_0_gobble):
+
+#ifdef DATA_CACHE_SIZE_HALF
+ cmp $DATA_CACHE_SIZE_HALF, %ecx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx
+# else
+ cmp __x86_data_cache_size_half, %ecx
+# endif
+#endif
+
+ POP (%edi)
+ lea -128(%ecx), %ecx
+ jge L(shl_0_gobble_mem_loop)
+L(shl_0_gobble_cache_loop):
+ movdqa (%eax), %xmm0
+ movdqa 0x10(%eax), %xmm1
+ movdqa 0x20(%eax), %xmm2
+ movdqa 0x30(%eax), %xmm3
+ movdqa 0x40(%eax), %xmm4
+ movdqa 0x50(%eax), %xmm5
+ movdqa 0x60(%eax), %xmm6
+ movdqa 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ movdqa %xmm2, 0x20(%edx)
+ movdqa %xmm3, 0x30(%edx)
+ movdqa %xmm4, 0x40(%edx)
+ movdqa %xmm5, 0x50(%edx)
+ movdqa %xmm6, 0x60(%edx)
+ movdqa %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+
+ jge L(shl_0_gobble_cache_loop)
+L(shl_0_gobble_cache_loop_tail):
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(shl_0_cache_less_64bytes)
+
+ movdqa (%eax), %xmm0
+ sub $0x40, %ecx
+ movdqa 0x10(%eax), %xmm1
+
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+
+ movdqa 0x20(%eax), %xmm0
+ movdqa 0x30(%eax), %xmm1
+ add $0x40, %eax
+
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm1, 0x30(%edx)
+ add $0x40, %edx
+L(shl_0_cache_less_64bytes):
+ cmp $0x20, %ecx
+ jl L(shl_0_cache_less_32bytes)
+ movdqa (%eax), %xmm0
+ sub $0x20, %ecx
+ movdqa 0x10(%eax), %xmm1
+ add $0x20, %eax
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ add $0x20, %edx
+L(shl_0_cache_less_32bytes):
+ cmp $0x10, %ecx
+ jl L(shl_0_cache_less_16bytes)
+ sub $0x10, %ecx
+ movdqa (%eax), %xmm0
+ add $0x10, %eax
+ movdqa %xmm0, (%edx)
+ add $0x10, %edx
+L(shl_0_cache_less_16bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_0_gobble_mem_loop):
+ prefetcht0 0x1c0(%eax)
+ prefetcht0 0x280(%eax)
+ prefetcht0 0x1c0(%edx)
+
+ movdqa (%eax), %xmm0
+ movdqa 0x10(%eax), %xmm1
+ movdqa 0x20(%eax), %xmm2
+ movdqa 0x30(%eax), %xmm3
+ movdqa 0x40(%eax), %xmm4
+ movdqa 0x50(%eax), %xmm5
+ movdqa 0x60(%eax), %xmm6
+ movdqa 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+ sub $0x80, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ movdqa %xmm2, 0x20(%edx)
+ movdqa %xmm3, 0x30(%edx)
+ movdqa %xmm4, 0x40(%edx)
+ movdqa %xmm5, 0x50(%edx)
+ movdqa %xmm6, 0x60(%edx)
+ movdqa %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+
+ jge L(shl_0_gobble_mem_loop)
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(shl_0_mem_less_64bytes)
+
+ movdqa (%eax), %xmm0
+ sub $0x40, %ecx
+ movdqa 0x10(%eax), %xmm1
+
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+
+ movdqa 0x20(%eax), %xmm0
+ movdqa 0x30(%eax), %xmm1
+ add $0x40, %eax
+
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm1, 0x30(%edx)
+ add $0x40, %edx
+L(shl_0_mem_less_64bytes):
+ cmp $0x20, %ecx
+ jl L(shl_0_mem_less_32bytes)
+ movdqa (%eax), %xmm0
+ sub $0x20, %ecx
+ movdqa 0x10(%eax), %xmm1
+ add $0x20, %eax
+ movdqa %xmm0, (%edx)
+ movdqa %xmm1, 0x10(%edx)
+ add $0x20, %edx
+L(shl_0_mem_less_32bytes):
+ cmp $0x10, %ecx
+ jl L(shl_0_mem_less_16bytes)
+ sub $0x10, %ecx
+ movdqa (%eax), %xmm0
+ add $0x10, %eax
+ movdqa %xmm0, (%edx)
+ add $0x10, %edx
+L(shl_0_mem_less_16bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_1):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -1(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_1_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $1, %xmm2, %xmm3
+ palignr $1, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_1_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $1, %xmm2, %xmm3
+ palignr $1, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_1_loop)
+
+L(shl_1_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 1(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_2):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -2(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_2_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $2, %xmm2, %xmm3
+ palignr $2, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_2_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $2, %xmm2, %xmm3
+ palignr $2, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_2_loop)
+
+L(shl_2_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 2(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_3):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -3(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_3_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $3, %xmm2, %xmm3
+ palignr $3, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_3_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $3, %xmm2, %xmm3
+ palignr $3, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_3_loop)
+
+L(shl_3_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 3(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_4):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -4(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_4_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $4, %xmm2, %xmm3
+ palignr $4, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_4_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $4, %xmm2, %xmm3
+ palignr $4, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_4_loop)
+
+L(shl_4_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 4(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_5):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -5(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_5_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $5, %xmm2, %xmm3
+ palignr $5, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_5_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $5, %xmm2, %xmm3
+ palignr $5, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_5_loop)
+
+L(shl_5_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 5(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_6):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -6(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_6_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $6, %xmm2, %xmm3
+ palignr $6, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_6_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $6, %xmm2, %xmm3
+ palignr $6, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_6_loop)
+
+L(shl_6_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 6(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_7):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -7(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_7_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $7, %xmm2, %xmm3
+ palignr $7, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_7_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $7, %xmm2, %xmm3
+ palignr $7, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_7_loop)
+
+L(shl_7_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 7(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_8):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -8(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_8_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $8, %xmm2, %xmm3
+ palignr $8, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_8_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $8, %xmm2, %xmm3
+ palignr $8, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_8_loop)
+
+L(shl_8_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 8(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_9):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -9(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_9_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $9, %xmm2, %xmm3
+ palignr $9, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_9_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $9, %xmm2, %xmm3
+ palignr $9, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_9_loop)
+
+L(shl_9_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 9(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_10):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -10(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_10_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $10, %xmm2, %xmm3
+ palignr $10, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_10_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $10, %xmm2, %xmm3
+ palignr $10, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_10_loop)
+
+L(shl_10_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 10(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_11):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -11(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_11_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $11, %xmm2, %xmm3
+ palignr $11, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_11_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $11, %xmm2, %xmm3
+ palignr $11, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_11_loop)
+
+L(shl_11_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 11(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_12):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -12(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_12_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $12, %xmm2, %xmm3
+ palignr $12, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_12_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $12, %xmm2, %xmm3
+ palignr $12, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_12_loop)
+
+L(shl_12_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 12(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_13):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -13(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_13_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $13, %xmm2, %xmm3
+ palignr $13, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_13_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $13, %xmm2, %xmm3
+ palignr $13, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_13_loop)
+
+L(shl_13_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 13(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+ ALIGN (4)
+L(shl_14):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -14(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_14_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $14, %xmm2, %xmm3
+ palignr $14, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_14_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $14, %xmm2, %xmm3
+ palignr $14, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_14_loop)
+
+L(shl_14_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 14(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(shl_15):
+ BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
+ lea -15(%eax), %eax
+ movaps (%eax), %xmm1
+ xor %edi, %edi
+ lea -32(%ecx), %ecx
+ movdqu %xmm0, (%esi)
+ POP (%esi)
+L(shl_15_loop):
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm4
+ palignr $15, %xmm2, %xmm3
+ palignr $15, %xmm1, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jl L(shl_15_end)
+
+ movdqa 16(%eax, %edi), %xmm2
+ sub $32, %ecx
+ movdqa 32(%eax, %edi), %xmm3
+ movdqa %xmm3, %xmm1
+ palignr $15, %xmm2, %xmm3
+ palignr $15, %xmm4, %xmm2
+ lea 32(%edi), %edi
+ movdqa %xmm2, -32(%edx, %edi)
+ movdqa %xmm3, -16(%edx, %edi)
+
+ jae L(shl_15_loop)
+
+L(shl_15_end):
+ lea 32(%ecx), %ecx
+ add %ecx, %edi
+ add %edi, %edx
+ lea 15(%edi, %eax), %eax
+ POP (%edi)
+ BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(fwd_write_44bytes):
+ movl -44(%eax), %ecx
+ movl %ecx, -44(%edx)
+L(fwd_write_40bytes):
+ movl -40(%eax), %ecx
+ movl %ecx, -40(%edx)
+L(fwd_write_36bytes):
+ movl -36(%eax), %ecx
+ movl %ecx, -36(%edx)
+L(fwd_write_32bytes):
+ movl -32(%eax), %ecx
+ movl %ecx, -32(%edx)
+L(fwd_write_28bytes):
+ movl -28(%eax), %ecx
+ movl %ecx, -28(%edx)
+L(fwd_write_24bytes):
+ movl -24(%eax), %ecx
+ movl %ecx, -24(%edx)
+L(fwd_write_20bytes):
+ movl -20(%eax), %ecx
+ movl %ecx, -20(%edx)
+L(fwd_write_16bytes):
+ movl -16(%eax), %ecx
+ movl %ecx, -16(%edx)
+L(fwd_write_12bytes):
+ movl -12(%eax), %ecx
+ movl %ecx, -12(%edx)
+L(fwd_write_8bytes):
+ movl -8(%eax), %ecx
+ movl %ecx, -8(%edx)
+L(fwd_write_4bytes):
+ movl -4(%eax), %ecx
+ movl %ecx, -4(%edx)
+L(fwd_write_0bytes):
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_5bytes):
+ movl -5(%eax), %ecx
+ movl -4(%eax), %eax
+ movl %ecx, -5(%edx)
+ movl %eax, -4(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_45bytes):
+ movl -45(%eax), %ecx
+ movl %ecx, -45(%edx)
+L(fwd_write_41bytes):
+ movl -41(%eax), %ecx
+ movl %ecx, -41(%edx)
+L(fwd_write_37bytes):
+ movl -37(%eax), %ecx
+ movl %ecx, -37(%edx)
+L(fwd_write_33bytes):
+ movl -33(%eax), %ecx
+ movl %ecx, -33(%edx)
+L(fwd_write_29bytes):
+ movl -29(%eax), %ecx
+ movl %ecx, -29(%edx)
+L(fwd_write_25bytes):
+ movl -25(%eax), %ecx
+ movl %ecx, -25(%edx)
+L(fwd_write_21bytes):
+ movl -21(%eax), %ecx
+ movl %ecx, -21(%edx)
+L(fwd_write_17bytes):
+ movl -17(%eax), %ecx
+ movl %ecx, -17(%edx)
+L(fwd_write_13bytes):
+ movl -13(%eax), %ecx
+ movl %ecx, -13(%edx)
+L(fwd_write_9bytes):
+ movl -9(%eax), %ecx
+ movl %ecx, -9(%edx)
+ movl -5(%eax), %ecx
+ movl %ecx, -5(%edx)
+L(fwd_write_1bytes):
+ movzbl -1(%eax), %ecx
+ movb %cl, -1(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_46bytes):
+ movl -46(%eax), %ecx
+ movl %ecx, -46(%edx)
+L(fwd_write_42bytes):
+ movl -42(%eax), %ecx
+ movl %ecx, -42(%edx)
+L(fwd_write_38bytes):
+ movl -38(%eax), %ecx
+ movl %ecx, -38(%edx)
+L(fwd_write_34bytes):
+ movl -34(%eax), %ecx
+ movl %ecx, -34(%edx)
+L(fwd_write_30bytes):
+ movl -30(%eax), %ecx
+ movl %ecx, -30(%edx)
+L(fwd_write_26bytes):
+ movl -26(%eax), %ecx
+ movl %ecx, -26(%edx)
+L(fwd_write_22bytes):
+ movl -22(%eax), %ecx
+ movl %ecx, -22(%edx)
+L(fwd_write_18bytes):
+ movl -18(%eax), %ecx
+ movl %ecx, -18(%edx)
+L(fwd_write_14bytes):
+ movl -14(%eax), %ecx
+ movl %ecx, -14(%edx)
+L(fwd_write_10bytes):
+ movl -10(%eax), %ecx
+ movl %ecx, -10(%edx)
+L(fwd_write_6bytes):
+ movl -6(%eax), %ecx
+ movl %ecx, -6(%edx)
+L(fwd_write_2bytes):
+ movzwl -2(%eax), %ecx
+ movw %cx, -2(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(fwd_write_47bytes):
+ movl -47(%eax), %ecx
+ movl %ecx, -47(%edx)
+L(fwd_write_43bytes):
+ movl -43(%eax), %ecx
+ movl %ecx, -43(%edx)
+L(fwd_write_39bytes):
+ movl -39(%eax), %ecx
+ movl %ecx, -39(%edx)
+L(fwd_write_35bytes):
+ movl -35(%eax), %ecx
+ movl %ecx, -35(%edx)
+L(fwd_write_31bytes):
+ movl -31(%eax), %ecx
+ movl %ecx, -31(%edx)
+L(fwd_write_27bytes):
+ movl -27(%eax), %ecx
+ movl %ecx, -27(%edx)
+L(fwd_write_23bytes):
+ movl -23(%eax), %ecx
+ movl %ecx, -23(%edx)
+L(fwd_write_19bytes):
+ movl -19(%eax), %ecx
+ movl %ecx, -19(%edx)
+L(fwd_write_15bytes):
+ movl -15(%eax), %ecx
+ movl %ecx, -15(%edx)
+L(fwd_write_11bytes):
+ movl -11(%eax), %ecx
+ movl %ecx, -11(%edx)
+L(fwd_write_7bytes):
+ movl -7(%eax), %ecx
+ movl %ecx, -7(%edx)
+L(fwd_write_3bytes):
+ movzwl -3(%eax), %ecx
+ movzbl -1(%eax), %eax
+ movw %cx, -3(%edx)
+ movb %al, -1(%edx)
+#ifndef USE_AS_BCOPY
+# ifdef USE_AS_MEMPCPY
+ movl %edx, %eax
+# else
+ movl DEST(%esp), %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(large_page):
+ movdqu (%eax), %xmm1
+ lea 16(%eax), %eax
+ movdqu %xmm0, (%esi)
+ movntdq %xmm1, (%edx)
+ lea 16(%edx), %edx
+ POP (%esi)
+ lea -0x90(%ecx), %ecx
+ POP (%edi)
+L(large_page_loop):
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ movdqu 0x20(%eax), %xmm2
+ movdqu 0x30(%eax), %xmm3
+ movdqu 0x40(%eax), %xmm4
+ movdqu 0x50(%eax), %xmm5
+ movdqu 0x60(%eax), %xmm6
+ movdqu 0x70(%eax), %xmm7
+ lea 0x80(%eax), %eax
+
+ sub $0x80, %ecx
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ movntdq %xmm2, 0x20(%edx)
+ movntdq %xmm3, 0x30(%edx)
+ movntdq %xmm4, 0x40(%edx)
+ movntdq %xmm5, 0x50(%edx)
+ movntdq %xmm6, 0x60(%edx)
+ movntdq %xmm7, 0x70(%edx)
+ lea 0x80(%edx), %edx
+ jae L(large_page_loop)
+ cmp $-0x40, %ecx
+ lea 0x80(%ecx), %ecx
+ jl L(large_page_less_64bytes)
+
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ movdqu 0x20(%eax), %xmm2
+ movdqu 0x30(%eax), %xmm3
+ lea 0x40(%eax), %eax
+
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ movntdq %xmm2, 0x20(%edx)
+ movntdq %xmm3, 0x30(%edx)
+ lea 0x40(%edx), %edx
+ sub $0x40, %ecx
+L(large_page_less_64bytes):
+ cmp $32, %ecx
+ jl L(large_page_less_32bytes)
+ movdqu (%eax), %xmm0
+ movdqu 0x10(%eax), %xmm1
+ lea 0x20(%eax), %eax
+ movntdq %xmm0, (%edx)
+ movntdq %xmm1, 0x10(%edx)
+ lea 0x20(%edx), %edx
+ sub $0x20, %ecx
+L(large_page_less_32bytes):
+ add %ecx, %edx
+ add %ecx, %eax
+ sfence
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
+
+
+ ALIGN (4)
+L(bk_write_44bytes):
+ movl 40(%eax), %ecx
+ movl %ecx, 40(%edx)
+L(bk_write_40bytes):
+ movl 36(%eax), %ecx
+ movl %ecx, 36(%edx)
+L(bk_write_36bytes):
+ movl 32(%eax), %ecx
+ movl %ecx, 32(%edx)
+L(bk_write_32bytes):
+ movl 28(%eax), %ecx
+ movl %ecx, 28(%edx)
+L(bk_write_28bytes):
+ movl 24(%eax), %ecx
+ movl %ecx, 24(%edx)
+L(bk_write_24bytes):
+ movl 20(%eax), %ecx
+ movl %ecx, 20(%edx)
+L(bk_write_20bytes):
+ movl 16(%eax), %ecx
+ movl %ecx, 16(%edx)
+L(bk_write_16bytes):
+ movl 12(%eax), %ecx
+ movl %ecx, 12(%edx)
+L(bk_write_12bytes):
+ movl 8(%eax), %ecx
+ movl %ecx, 8(%edx)
+L(bk_write_8bytes):
+ movl 4(%eax), %ecx
+ movl %ecx, 4(%edx)
+L(bk_write_4bytes):
+ movl (%eax), %ecx
+ movl %ecx, (%edx)
+L(bk_write_0bytes):
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_45bytes):
+ movl 41(%eax), %ecx
+ movl %ecx, 41(%edx)
+L(bk_write_41bytes):
+ movl 37(%eax), %ecx
+ movl %ecx, 37(%edx)
+L(bk_write_37bytes):
+ movl 33(%eax), %ecx
+ movl %ecx, 33(%edx)
+L(bk_write_33bytes):
+ movl 29(%eax), %ecx
+ movl %ecx, 29(%edx)
+L(bk_write_29bytes):
+ movl 25(%eax), %ecx
+ movl %ecx, 25(%edx)
+L(bk_write_25bytes):
+ movl 21(%eax), %ecx
+ movl %ecx, 21(%edx)
+L(bk_write_21bytes):
+ movl 17(%eax), %ecx
+ movl %ecx, 17(%edx)
+L(bk_write_17bytes):
+ movl 13(%eax), %ecx
+ movl %ecx, 13(%edx)
+L(bk_write_13bytes):
+ movl 9(%eax), %ecx
+ movl %ecx, 9(%edx)
+L(bk_write_9bytes):
+ movl 5(%eax), %ecx
+ movl %ecx, 5(%edx)
+L(bk_write_5bytes):
+ movl 1(%eax), %ecx
+ movl %ecx, 1(%edx)
+L(bk_write_1bytes):
+ movzbl (%eax), %ecx
+ movb %cl, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_46bytes):
+ movl 42(%eax), %ecx
+ movl %ecx, 42(%edx)
+L(bk_write_42bytes):
+ movl 38(%eax), %ecx
+ movl %ecx, 38(%edx)
+L(bk_write_38bytes):
+ movl 34(%eax), %ecx
+ movl %ecx, 34(%edx)
+L(bk_write_34bytes):
+ movl 30(%eax), %ecx
+ movl %ecx, 30(%edx)
+L(bk_write_30bytes):
+ movl 26(%eax), %ecx
+ movl %ecx, 26(%edx)
+L(bk_write_26bytes):
+ movl 22(%eax), %ecx
+ movl %ecx, 22(%edx)
+L(bk_write_22bytes):
+ movl 18(%eax), %ecx
+ movl %ecx, 18(%edx)
+L(bk_write_18bytes):
+ movl 14(%eax), %ecx
+ movl %ecx, 14(%edx)
+L(bk_write_14bytes):
+ movl 10(%eax), %ecx
+ movl %ecx, 10(%edx)
+L(bk_write_10bytes):
+ movl 6(%eax), %ecx
+ movl %ecx, 6(%edx)
+L(bk_write_6bytes):
+ movl 2(%eax), %ecx
+ movl %ecx, 2(%edx)
+L(bk_write_2bytes):
+ movzwl (%eax), %ecx
+ movw %cx, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN
+
+ ALIGN (4)
+L(bk_write_47bytes):
+ movl 43(%eax), %ecx
+ movl %ecx, 43(%edx)
+L(bk_write_43bytes):
+ movl 39(%eax), %ecx
+ movl %ecx, 39(%edx)
+L(bk_write_39bytes):
+ movl 35(%eax), %ecx
+ movl %ecx, 35(%edx)
+L(bk_write_35bytes):
+ movl 31(%eax), %ecx
+ movl %ecx, 31(%edx)
+L(bk_write_31bytes):
+ movl 27(%eax), %ecx
+ movl %ecx, 27(%edx)
+L(bk_write_27bytes):
+ movl 23(%eax), %ecx
+ movl %ecx, 23(%edx)
+L(bk_write_23bytes):
+ movl 19(%eax), %ecx
+ movl %ecx, 19(%edx)
+L(bk_write_19bytes):
+ movl 15(%eax), %ecx
+ movl %ecx, 15(%edx)
+L(bk_write_15bytes):
+ movl 11(%eax), %ecx
+ movl %ecx, 11(%edx)
+L(bk_write_11bytes):
+ movl 7(%eax), %ecx
+ movl %ecx, 7(%edx)
+L(bk_write_7bytes):
+ movl 3(%eax), %ecx
+ movl %ecx, 3(%edx)
+L(bk_write_3bytes):
+ movzwl 1(%eax), %ecx
+ movw %cx, 1(%edx)
+ movzbl (%eax), %eax
+ movb %al, (%edx)
+#ifndef USE_AS_BCOPY
+ movl DEST(%esp), %eax
+# ifdef USE_AS_MEMPCPY
+ movl LEN(%esp), %ecx
+ add %ecx, %eax
+# endif
+#endif
+ RETURN_END
+
+
+ .pushsection .rodata.ssse3,"a",@progbits
+ ALIGN (2)
+L(table_48bytes_fwd):
+ .int JMPTBL (L(fwd_write_0bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_1bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_2bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_3bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_4bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_5bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_6bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_7bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_8bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_9bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_10bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_11bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_12bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_13bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_14bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_15bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_16bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_17bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_18bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_19bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_20bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_21bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_22bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_23bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_24bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_25bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_26bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_27bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_28bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_29bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_30bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_31bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_32bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_33bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_34bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_35bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_36bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_37bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_38bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_39bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_40bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_41bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_42bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_43bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_44bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_45bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_46bytes), L(table_48bytes_fwd))
+ .int JMPTBL (L(fwd_write_47bytes), L(table_48bytes_fwd))
+
+ ALIGN (2)
+L(shl_table):
+ .int JMPTBL (L(shl_0), L(shl_table))
+ .int JMPTBL (L(shl_1), L(shl_table))
+ .int JMPTBL (L(shl_2), L(shl_table))
+ .int JMPTBL (L(shl_3), L(shl_table))
+ .int JMPTBL (L(shl_4), L(shl_table))
+ .int JMPTBL (L(shl_5), L(shl_table))
+ .int JMPTBL (L(shl_6), L(shl_table))
+ .int JMPTBL (L(shl_7), L(shl_table))
+ .int JMPTBL (L(shl_8), L(shl_table))
+ .int JMPTBL (L(shl_9), L(shl_table))
+ .int JMPTBL (L(shl_10), L(shl_table))
+ .int JMPTBL (L(shl_11), L(shl_table))
+ .int JMPTBL (L(shl_12), L(shl_table))
+ .int JMPTBL (L(shl_13), L(shl_table))
+ .int JMPTBL (L(shl_14), L(shl_table))
+ .int JMPTBL (L(shl_15), L(shl_table))
+
+ ALIGN (2)
+L(table_48_bytes_bwd):
+ .int JMPTBL (L(bk_write_0bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_1bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_2bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_3bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_4bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_5bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_6bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_7bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_8bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_9bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_10bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_11bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_12bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_13bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_14bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_15bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_16bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_17bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_18bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_19bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_20bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_21bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_22bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_23bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_24bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_25bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_26bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_27bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_28bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_29bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_30bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_31bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_32bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_33bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_34bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_35bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_36bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_37bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_38bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_39bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_40bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_41bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_42bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_43bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_44bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_45bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_46bytes), L(table_48_bytes_bwd))
+ .int JMPTBL (L(bk_write_47bytes), L(table_48_bytes_bwd))
+
+ .popsection
+
+#ifdef USE_AS_MEMMOVE
+ ALIGN (4)
+L(copy_backward):
+ PUSH (%esi)
+ movl %eax, %esi
+ lea (%ecx,%edx,1),%edx
+ lea (%ecx,%esi,1),%esi
+ testl $0x3, %edx
+ jnz L(bk_align)
+
+L(bk_aligned_4):
+ cmp $64, %ecx
+ jge L(bk_write_more64bytes)
+
+L(bk_write_64bytesless):
+ cmp $32, %ecx
+ jl L(bk_write_less32bytes)
+
+L(bk_write_more32bytes):
+ /* Copy 32 bytes at a time. */
+ sub $32, %ecx
+ movl -4(%esi), %eax
+ movl %eax, -4(%edx)
+ movl -8(%esi), %eax
+ movl %eax, -8(%edx)
+ movl -12(%esi), %eax
+ movl %eax, -12(%edx)
+ movl -16(%esi), %eax
+ movl %eax, -16(%edx)
+ movl -20(%esi), %eax
+ movl %eax, -20(%edx)
+ movl -24(%esi), %eax
+ movl %eax, -24(%edx)
+ movl -28(%esi), %eax
+ movl %eax, -28(%edx)
+ movl -32(%esi), %eax
+ movl %eax, -32(%edx)
+ sub $32, %edx
+ sub $32, %esi
+
+L(bk_write_less32bytes):
+ movl %esi, %eax
+ sub %ecx, %edx
+ sub %ecx, %eax
+ POP (%esi)
+L(bk_write_less32bytes_2):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
+
+ ALIGN (4)
+L(bk_align):
+ cmp $8, %ecx
+ jle L(bk_write_less32bytes)
+ testl $1, %edx
+ /* We get here only if (EDX & 3 ) != 0 so if (EDX & 1) ==0,
+ then (EDX & 2) must be != 0. */
+ jz L(bk_got2)
+ sub $1, %esi
+ sub $1, %ecx
+ sub $1, %edx
+ movzbl (%esi), %eax
+ movb %al, (%edx)
+
+ testl $2, %edx
+ jz L(bk_aligned_4)
+
+L(bk_got2):
+ sub $2, %esi
+ sub $2, %ecx
+ sub $2, %edx
+ movzwl (%esi), %eax
+ movw %ax, (%edx)
+ jmp L(bk_aligned_4)
+
+ ALIGN (4)
+L(bk_write_more64bytes):
+ /* Check alignment of last byte. */
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+/* EDX is aligned 4 bytes, but not 16 bytes. */
+L(bk_ssse3_align):
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+ testl $15, %edx
+ jz L(bk_ssse3_cpy_pre)
+
+ sub $4, %esi
+ sub $4, %ecx
+ sub $4, %edx
+ movl (%esi), %eax
+ movl %eax, (%edx)
+
+L(bk_ssse3_cpy_pre):
+ cmp $64, %ecx
+ jl L(bk_write_more32bytes)
+
+L(bk_ssse3_cpy):
+ sub $64, %esi
+ sub $64, %ecx
+ sub $64, %edx
+ movdqu 0x30(%esi), %xmm3
+ movdqa %xmm3, 0x30(%edx)
+ movdqu 0x20(%esi), %xmm2
+ movdqa %xmm2, 0x20(%edx)
+ movdqu 0x10(%esi), %xmm1
+ movdqa %xmm1, 0x10(%edx)
+ movdqu (%esi), %xmm0
+ movdqa %xmm0, (%edx)
+ cmp $64, %ecx
+ jge L(bk_ssse3_cpy)
+ jmp L(bk_write_64bytesless)
+
+#endif
+
+END (MEMCPY)
+
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy.S b/libc/sysdeps/i386/i686/multiarch/memcpy.S
new file mode 100644
index 000000000..bf1c7cc2d
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy.S
@@ -0,0 +1,90 @@
+/* Multiple versions of memcpy
+ Copyright (C) 2010 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 lib and for
+ DSO. In static binaries we need memcpy before the initialization
+ happened. */
+#if defined SHARED && !defined 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(memcpy)
+ .type memcpy, @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 __memcpy_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memcpy_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memcpy_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(memcpy)
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __memcpy_ia32, @function; \
+ .p2align 4; \
+ __memcpy_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __memcpy_ia32, .-__memcpy_ia32
+
+# undef ENTRY_CHK
+# define ENTRY_CHK(name) \
+ .type __memcpy_chk_ia32, @function; \
+ .globl __memcpy_chk_ia32; \
+ .p2align 4; \
+ __memcpy_chk_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END_CHK
+# define END_CHK(name) \
+ cfi_endproc; .size __memcpy_chk_ia32, .-__memcpy_chk_ia32
+
+# undef libc_hidden_builtin_def
+/* IFUNC doesn't work with the hidden functions in shared library since
+ they will be called without setting up EBX needed for PLT which is
+ used by IFUNC. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_memcpy; __GI_memcpy = __memcpy_ia32
+#endif
+
+#include "../memcpy.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S b/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S
new file mode 100644
index 000000000..171ac8ade
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S
@@ -0,0 +1,64 @@
+/* Multiple versions of __memcpy_chk
+ Copyright (C) 2010 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 lib and for
+ DSO. There are no multiarch memcpy functions for static binaries.
+ */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(__memcpy_chk)
+ .type __memcpy_chk, @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 __memcpy_chk_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memcpy_chk_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memcpy_chk_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__memcpy_chk)
+# else
+# include "../memcpy_chk.S"
+# endif
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove-ssse3-rep.S b/libc/sysdeps/i386/i686/multiarch/memmove-ssse3-rep.S
new file mode 100644
index 000000000..d202fc4a1
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memmove-ssse3-rep.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMMOVE
+#define MEMCPY __memmove_ssse3_rep
+#define MEMCPY_CHK __memmove_chk_ssse3_rep
+#include "memcpy-ssse3-rep.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove-ssse3.S b/libc/sysdeps/i386/i686/multiarch/memmove-ssse3.S
new file mode 100644
index 000000000..295430b1e
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memmove-ssse3.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMMOVE
+#define MEMCPY __memmove_ssse3
+#define MEMCPY_CHK __memmove_chk_ssse3
+#include "memcpy-ssse3.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove.S b/libc/sysdeps/i386/i686/multiarch/memmove.S
new file mode 100644
index 000000000..e0529c012
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memmove.S
@@ -0,0 +1,117 @@
+/* Multiple versions of memmove
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(memmove)
+ .type memmove, @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 __memmove_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memmove_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memmove_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(memmove)
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __memmove_ia32, @function; \
+ .p2align 4; \
+ __memmove_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# else
+ .text
+ENTRY(memmove)
+ .type memmove, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __memmove_ia32, %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
+ jz 2f
+ leal __memmove_ssse3, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __memmove_ssse3_rep, %eax
+2: ret
+END(memmove)
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __memmove_ia32, @function; \
+ .globl __memmove_ia32; \
+ .p2align 4; \
+ __memmove_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# endif
+
+# undef END
+# define END(name) \
+ cfi_endproc; .size __memmove_ia32, .-__memmove_ia32
+
+# undef ENTRY_CHK
+# define ENTRY_CHK(name) \
+ .type __memmove_chk_ia32, @function; \
+ .globl __memmove_chk_ia32; \
+ .p2align 4; \
+ __memmove_chk_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END_CHK
+# define END_CHK(name) \
+ cfi_endproc; .size __memmove_chk_ia32, .-__memmove_chk_ia32
+
+# ifdef SHARED
+# undef libc_hidden_builtin_def
+/* IFUNC doesn't work with the hidden functions in shared library since
+ they will be called without setting up EBX needed for PLT which is
+ used by IFUNC. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_memmove; __GI_memmove = __memmove_ia32
+# endif
+#endif
+
+#include "../memmove.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove_chk.S b/libc/sysdeps/i386/i686/multiarch/memmove_chk.S
new file mode 100644
index 000000000..e33f2a31b
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memmove_chk.S
@@ -0,0 +1,112 @@
+/* Multiple versions of __memmove_chk
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(__memmove_chk)
+ .type __memmove_chk, @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 __memmove_chk_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memmove_chk_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memmove_chk_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__memmove_chk)
+# else
+ .text
+ENTRY(__memmove_chk)
+ .type __memmove_chk, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __memmove_chk_ia32, %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
+ jz 2f
+ leal __memmove_chk_ssse3, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __memmove_chk_ssse3_rep, %eax
+2: ret
+END(__memmove_chk)
+
+ .type __memmove_chk_ssse3, @function
+ .p2align 4;
+__memmove_chk_ssse3:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memmove_ssse3
+ cfi_endproc
+ .size __memmove_chk_ssse3, .-__memmove_chk_ssse3
+
+ .type __memmove_chk_ssse3_rep, @function
+ .p2align 4;
+__memmove_chk_ssse3_rep:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memmove_ssse3_rep
+ cfi_endproc
+ .size __memmove_chk_ssse3_rep, .-__memmove_chk_ssse3_rep
+
+ .type __memmove_chk_ia32, @function
+ .p2align 4;
+__memmove_chk_ia32:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memmove_ia32
+ cfi_endproc
+ .size __memmove_chk_ia32, .-__memmove_chk_ia32
+# endif
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3-rep.S b/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3-rep.S
new file mode 100644
index 000000000..5357b33e1
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3-rep.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMPCPY
+#define MEMCPY __mempcpy_ssse3_rep
+#define MEMCPY_CHK __mempcpy_chk_ssse3_rep
+#include "memcpy-ssse3-rep.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3.S b/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3.S
new file mode 100644
index 000000000..822d98e95
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy-ssse3.S
@@ -0,0 +1,4 @@
+#define USE_AS_MEMPCPY
+#define MEMCPY __mempcpy_ssse3
+#define MEMCPY_CHK __mempcpy_chk_ssse3
+#include "memcpy-ssse3.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy.S b/libc/sysdeps/i386/i686/multiarch/mempcpy.S
new file mode 100644
index 000000000..df830d2e6
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy.S
@@ -0,0 +1,93 @@
+/* Multiple versions of mempcpy
+ Copyright (C) 2010 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 lib and for
+ DSO. In static binaries we need mempcpy before the initialization
+ happened. */
+#if defined SHARED && !defined 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(__mempcpy)
+ .type __mempcpy, @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 __mempcpy_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __mempcpy_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __mempcpy_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__mempcpy)
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __mempcpy_ia32, @function; \
+ .p2align 4; \
+ __mempcpy_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __mempcpy_ia32, .-__mempcpy_ia32
+
+# undef ENTRY_CHK
+# define ENTRY_CHK(name) \
+ .type __mempcpy_chk_ia32, @function; \
+ .globl __mempcpy_chk_ia32; \
+ .p2align 4; \
+ __mempcpy_chk_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END_CHK
+# define END_CHK(name) \
+ cfi_endproc; .size __mempcpy_chk_ia32, .-__mempcpy_chk_ia32
+
+# undef libc_hidden_def
+# undef libc_hidden_builtin_def
+/* IFUNC doesn't work with the hidden functions in shared library since
+ they will be called without setting up EBX needed for PLT which is
+ used by IFUNC. */
+# define libc_hidden_def(name) \
+ .globl __GI_mempcpy; __GI_mempcpy = __mempcpy_ia32
+# define libc_hidden_builtin_def(name) \
+ .globl __GI___mempcpy; __GI___mempcpy = __mempcpy_ia32
+#endif
+
+#include "../mempcpy.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S b/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S
new file mode 100644
index 000000000..828fb5e60
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S
@@ -0,0 +1,64 @@
+/* Multiple versions of __mempcpy_chk
+ Copyright (C) 2010 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 lib and for
+ DSO. There are no multiarch mempcpy functions for static binaries.
+ */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(__mempcpy_chk)
+ .type __mempcpy_chk, @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 __mempcpy_chk_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __mempcpy_chk_ssse3@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __mempcpy_chk_ssse3_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__mempcpy_chk)
+# else
+# include "../mempcpy_chk.S"
+# endif
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memset-sse2-rep.S b/libc/sysdeps/i386/i686/multiarch/memset-sse2-rep.S
new file mode 100644
index 000000000..84afffeb6
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memset-sse2-rep.S
@@ -0,0 +1,821 @@
+/* memset with SSE2 and REP string.
+ Copyright (C) 2010 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>
+#include "asm-syntax.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)
+
+#ifdef USE_AS_BZERO
+# define DEST PARMS
+# define LEN DEST+4
+# define SETRTNVAL
+#else
+# define DEST PARMS
+# define CHR DEST+4
+# define LEN CHR+4
+# define SETRTNVAL movl DEST(%esp), %eax
+#endif
+
+#ifdef SHARED
+# define ENTRANCE PUSH (%ebx);
+# define RETURN_END POP (%ebx); ret
+# define RETURN RETURN_END; CFI_PUSH (%ebx)
+# define PARMS 8 /* Preserve EBX. */
+# define JMPTBL(I, B) I - B
+
+/* Load an entry in a jump table into EBX and branch to it. TABLE is a
+ jump table with relative offsets. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
+ /* We first load PC into EBX. */ \
+ call __i686.get_pc_thunk.bx; \
+ /* Get the address of the jump table. */ \
+ add $(TABLE - .), %ebx; \
+ /* Get the entry and convert the relative offset to the \
+ absolute address. */ \
+ add (%ebx,%ecx,4), %ebx; \
+ add %ecx, %edx; \
+ /* We loaded the jump table and adjuested EDX. Go. */ \
+ jmp *%ebx
+
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ ALIGN (4)
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#else
+# define ENTRANCE
+# define RETURN_END ret
+# define RETURN RETURN_END
+# define PARMS 4
+# define JMPTBL(I, B) I
+
+/* Branch to an entry in a jump table. TABLE is a jump table with
+ absolute offsets. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
+ add %ecx, %edx; \
+ jmp *TABLE(,%ecx,4)
+#endif
+
+ .section .text.sse2,"ax",@progbits
+#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BZERO
+ENTRY (__memset_chk_sse2_rep)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memset_chk_sse2_rep)
+#endif
+ENTRY (__memset_sse2_rep)
+ ENTRANCE
+
+ movl LEN(%esp), %ecx
+#ifdef USE_AS_BZERO
+ xor %eax, %eax
+#else
+ movzbl CHR(%esp), %eax
+ movb %al, %ah
+ /* Fill the whole EAX with pattern. */
+ movl %eax, %edx
+ shl $16, %eax
+ or %edx, %eax
+#endif
+ movl DEST(%esp), %edx
+ cmp $32, %ecx
+ jae L(32bytesormore)
+
+L(write_less32bytes):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_less_32bytes))
+
+
+ .pushsection .rodata.sse2,"a",@progbits
+ ALIGN (2)
+L(table_less_32bytes):
+ .int JMPTBL (L(write_0bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_1bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_2bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_3bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_4bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_5bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_6bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_7bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_8bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_9bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_10bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_11bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_12bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_13bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_14bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_15bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_16bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_17bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_18bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_19bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_20bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_21bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_22bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_23bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_24bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_25bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_26bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_27bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_28bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_29bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_30bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_31bytes), L(table_less_32bytes))
+ .popsection
+
+ ALIGN (4)
+L(write_28bytes):
+ movl %eax, -28(%edx)
+L(write_24bytes):
+ movl %eax, -24(%edx)
+L(write_20bytes):
+ movl %eax, -20(%edx)
+L(write_16bytes):
+ movl %eax, -16(%edx)
+L(write_12bytes):
+ movl %eax, -12(%edx)
+L(write_8bytes):
+ movl %eax, -8(%edx)
+L(write_4bytes):
+ movl %eax, -4(%edx)
+L(write_0bytes):
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_29bytes):
+ movl %eax, -29(%edx)
+L(write_25bytes):
+ movl %eax, -25(%edx)
+L(write_21bytes):
+ movl %eax, -21(%edx)
+L(write_17bytes):
+ movl %eax, -17(%edx)
+L(write_13bytes):
+ movl %eax, -13(%edx)
+L(write_9bytes):
+ movl %eax, -9(%edx)
+L(write_5bytes):
+ movl %eax, -5(%edx)
+L(write_1bytes):
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_30bytes):
+ movl %eax, -30(%edx)
+L(write_26bytes):
+ movl %eax, -26(%edx)
+L(write_22bytes):
+ movl %eax, -22(%edx)
+L(write_18bytes):
+ movl %eax, -18(%edx)
+L(write_14bytes):
+ movl %eax, -14(%edx)
+L(write_10bytes):
+ movl %eax, -10(%edx)
+L(write_6bytes):
+ movl %eax, -6(%edx)
+L(write_2bytes):
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_31bytes):
+ movl %eax, -31(%edx)
+L(write_27bytes):
+ movl %eax, -27(%edx)
+L(write_23bytes):
+ movl %eax, -23(%edx)
+L(write_19bytes):
+ movl %eax, -19(%edx)
+L(write_15bytes):
+ movl %eax, -15(%edx)
+L(write_11bytes):
+ movl %eax, -11(%edx)
+L(write_7bytes):
+ movl %eax, -7(%edx)
+L(write_3bytes):
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+/* ECX > 32 and EDX is 4 byte aligned. */
+L(32bytesormore):
+ /* Fill xmm0 with the pattern. */
+#ifdef USE_AS_BZERO
+ pxor %xmm0, %xmm0
+#else
+ movd %eax, %xmm0
+ punpcklbw %xmm0, %xmm0
+ pshufd $0, %xmm0, %xmm0
+#endif
+ testl $0xf, %edx
+ jz L(aligned_16)
+/* ECX > 32 and EDX is not 16 byte aligned. */
+L(not_aligned_16):
+ movdqu %xmm0, (%edx)
+ movl %edx, %eax
+ and $-16, %edx
+ add $16, %edx
+ sub %edx, %eax
+ add %eax, %ecx
+ movd %xmm0, %eax
+
+ ALIGN (4)
+L(aligned_16):
+ cmp $128, %ecx
+ jge L(128bytesormore)
+
+L(aligned_16_less128bytes):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+ ALIGN (4)
+L(128bytesormore):
+ PUSH (%edi)
+#ifdef DATA_CACHE_SIZE
+ PUSH (%ebx)
+ mov $DATA_CACHE_SIZE, %ebx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ mov __x86_data_cache_size@GOTOFF(%ebx), %ebx
+# else
+ PUSH (%ebx)
+ mov __x86_data_cache_size, %ebx
+# endif
+#endif
+ mov %ebx, %edi
+ shr $4, %ebx
+ sub %ebx, %edi
+#if defined DATA_CACHE_SIZE || !defined SHARED
+ POP (%ebx)
+#endif
+/*
+ * When data size approximate the end of L1 cache,
+ * fast string will prefetch and combine data efficiently.
+ */
+ cmp %edi, %ecx
+ jae L(128bytesormore_nt)
+ subl $128, %ecx
+L(128bytesormore_normal):
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm0, 0x10(%edx)
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm0, 0x30(%edx)
+ movdqa %xmm0, 0x40(%edx)
+ movdqa %xmm0, 0x50(%edx)
+ movdqa %xmm0, 0x60(%edx)
+ movdqa %xmm0, 0x70(%edx)
+ lea 128(%edx), %edx
+ jl L(128bytesless_normal)
+
+
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm0, 0x10(%edx)
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm0, 0x30(%edx)
+ movdqa %xmm0, 0x40(%edx)
+ movdqa %xmm0, 0x50(%edx)
+ movdqa %xmm0, 0x60(%edx)
+ movdqa %xmm0, 0x70(%edx)
+ lea 128(%edx), %edx
+ jge L(128bytesormore_normal)
+
+L(128bytesless_normal):
+ POP (%edi)
+ lea 128(%ecx), %ecx
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+ ALIGN (4)
+L(128bytesormore_nt):
+ mov %edx, %edi
+ mov %ecx, %edx
+ shr $2, %ecx
+ and $3, %edx
+ rep stosl
+ jz L(copy_page_by_rep_exit)
+ cmp $2, %edx
+ jb L(copy_page_by_rep_left_1)
+ movw %ax, (%edi)
+ add $2, %edi
+ sub $2, %edx
+ jz L(copy_page_by_rep_exit)
+L(copy_page_by_rep_left_1):
+ movb %al, (%edi)
+L(copy_page_by_rep_exit):
+ POP (%edi)
+ SETRTNVAL
+ RETURN
+
+ .pushsection .rodata.sse2,"a",@progbits
+ ALIGN (2)
+L(table_16_128bytes):
+ .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_1bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_2bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_3bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_5bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_6bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_7bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_9bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_10bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_11bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_13bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_14bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_15bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_17bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_18bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_19bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_21bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_22bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_23bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_25bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_26bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_27bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_29bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_30bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_31bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_33bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_34bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_35bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_37bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_38bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_39bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_41bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_42bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_43bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_45bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_46bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_47bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_49bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_50bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_51bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_53bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_54bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_55bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_57bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_58bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_59bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_61bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_62bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_63bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_65bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_66bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_67bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_69bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_70bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_71bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_73bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_74bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_75bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_77bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_78bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_79bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_81bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_82bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_83bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_85bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_86bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_87bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_89bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_90bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_91bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_93bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_94bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_95bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_97bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_98bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_99bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_101bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_102bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_103bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_105bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_106bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_107bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_109bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_110bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_111bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_113bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_114bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_115bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_117bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_118bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_119bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_121bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_122bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_123bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_125bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_126bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_127bytes), L(table_16_128bytes))
+ .popsection
+
+ ALIGN (4)
+L(aligned_16_112bytes):
+ movdqa %xmm0, -112(%edx)
+L(aligned_16_96bytes):
+ movdqa %xmm0, -96(%edx)
+L(aligned_16_80bytes):
+ movdqa %xmm0, -80(%edx)
+L(aligned_16_64bytes):
+ movdqa %xmm0, -64(%edx)
+L(aligned_16_48bytes):
+ movdqa %xmm0, -48(%edx)
+L(aligned_16_32bytes):
+ movdqa %xmm0, -32(%edx)
+L(aligned_16_16bytes):
+ movdqa %xmm0, -16(%edx)
+L(aligned_16_0bytes):
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_113bytes):
+ movdqa %xmm0, -113(%edx)
+L(aligned_16_97bytes):
+ movdqa %xmm0, -97(%edx)
+L(aligned_16_81bytes):
+ movdqa %xmm0, -81(%edx)
+L(aligned_16_65bytes):
+ movdqa %xmm0, -65(%edx)
+L(aligned_16_49bytes):
+ movdqa %xmm0, -49(%edx)
+L(aligned_16_33bytes):
+ movdqa %xmm0, -33(%edx)
+L(aligned_16_17bytes):
+ movdqa %xmm0, -17(%edx)
+L(aligned_16_1bytes):
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_114bytes):
+ movdqa %xmm0, -114(%edx)
+L(aligned_16_98bytes):
+ movdqa %xmm0, -98(%edx)
+L(aligned_16_82bytes):
+ movdqa %xmm0, -82(%edx)
+L(aligned_16_66bytes):
+ movdqa %xmm0, -66(%edx)
+L(aligned_16_50bytes):
+ movdqa %xmm0, -50(%edx)
+L(aligned_16_34bytes):
+ movdqa %xmm0, -34(%edx)
+L(aligned_16_18bytes):
+ movdqa %xmm0, -18(%edx)
+L(aligned_16_2bytes):
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_115bytes):
+ movdqa %xmm0, -115(%edx)
+L(aligned_16_99bytes):
+ movdqa %xmm0, -99(%edx)
+L(aligned_16_83bytes):
+ movdqa %xmm0, -83(%edx)
+L(aligned_16_67bytes):
+ movdqa %xmm0, -67(%edx)
+L(aligned_16_51bytes):
+ movdqa %xmm0, -51(%edx)
+L(aligned_16_35bytes):
+ movdqa %xmm0, -35(%edx)
+L(aligned_16_19bytes):
+ movdqa %xmm0, -19(%edx)
+L(aligned_16_3bytes):
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_116bytes):
+ movdqa %xmm0, -116(%edx)
+L(aligned_16_100bytes):
+ movdqa %xmm0, -100(%edx)
+L(aligned_16_84bytes):
+ movdqa %xmm0, -84(%edx)
+L(aligned_16_68bytes):
+ movdqa %xmm0, -68(%edx)
+L(aligned_16_52bytes):
+ movdqa %xmm0, -52(%edx)
+L(aligned_16_36bytes):
+ movdqa %xmm0, -36(%edx)
+L(aligned_16_20bytes):
+ movdqa %xmm0, -20(%edx)
+L(aligned_16_4bytes):
+ movl %eax, -4(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_117bytes):
+ movdqa %xmm0, -117(%edx)
+L(aligned_16_101bytes):
+ movdqa %xmm0, -101(%edx)
+L(aligned_16_85bytes):
+ movdqa %xmm0, -85(%edx)
+L(aligned_16_69bytes):
+ movdqa %xmm0, -69(%edx)
+L(aligned_16_53bytes):
+ movdqa %xmm0, -53(%edx)
+L(aligned_16_37bytes):
+ movdqa %xmm0, -37(%edx)
+L(aligned_16_21bytes):
+ movdqa %xmm0, -21(%edx)
+L(aligned_16_5bytes):
+ movl %eax, -5(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_118bytes):
+ movdqa %xmm0, -118(%edx)
+L(aligned_16_102bytes):
+ movdqa %xmm0, -102(%edx)
+L(aligned_16_86bytes):
+ movdqa %xmm0, -86(%edx)
+L(aligned_16_70bytes):
+ movdqa %xmm0, -70(%edx)
+L(aligned_16_54bytes):
+ movdqa %xmm0, -54(%edx)
+L(aligned_16_38bytes):
+ movdqa %xmm0, -38(%edx)
+L(aligned_16_22bytes):
+ movdqa %xmm0, -22(%edx)
+L(aligned_16_6bytes):
+ movl %eax, -6(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_119bytes):
+ movdqa %xmm0, -119(%edx)
+L(aligned_16_103bytes):
+ movdqa %xmm0, -103(%edx)
+L(aligned_16_87bytes):
+ movdqa %xmm0, -87(%edx)
+L(aligned_16_71bytes):
+ movdqa %xmm0, -71(%edx)
+L(aligned_16_55bytes):
+ movdqa %xmm0, -55(%edx)
+L(aligned_16_39bytes):
+ movdqa %xmm0, -39(%edx)
+L(aligned_16_23bytes):
+ movdqa %xmm0, -23(%edx)
+L(aligned_16_7bytes):
+ movl %eax, -7(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_120bytes):
+ movdqa %xmm0, -120(%edx)
+L(aligned_16_104bytes):
+ movdqa %xmm0, -104(%edx)
+L(aligned_16_88bytes):
+ movdqa %xmm0, -88(%edx)
+L(aligned_16_72bytes):
+ movdqa %xmm0, -72(%edx)
+L(aligned_16_56bytes):
+ movdqa %xmm0, -56(%edx)
+L(aligned_16_40bytes):
+ movdqa %xmm0, -40(%edx)
+L(aligned_16_24bytes):
+ movdqa %xmm0, -24(%edx)
+L(aligned_16_8bytes):
+ movq %xmm0, -8(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_121bytes):
+ movdqa %xmm0, -121(%edx)
+L(aligned_16_105bytes):
+ movdqa %xmm0, -105(%edx)
+L(aligned_16_89bytes):
+ movdqa %xmm0, -89(%edx)
+L(aligned_16_73bytes):
+ movdqa %xmm0, -73(%edx)
+L(aligned_16_57bytes):
+ movdqa %xmm0, -57(%edx)
+L(aligned_16_41bytes):
+ movdqa %xmm0, -41(%edx)
+L(aligned_16_25bytes):
+ movdqa %xmm0, -25(%edx)
+L(aligned_16_9bytes):
+ movq %xmm0, -9(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_122bytes):
+ movdqa %xmm0, -122(%edx)
+L(aligned_16_106bytes):
+ movdqa %xmm0, -106(%edx)
+L(aligned_16_90bytes):
+ movdqa %xmm0, -90(%edx)
+L(aligned_16_74bytes):
+ movdqa %xmm0, -74(%edx)
+L(aligned_16_58bytes):
+ movdqa %xmm0, -58(%edx)
+L(aligned_16_42bytes):
+ movdqa %xmm0, -42(%edx)
+L(aligned_16_26bytes):
+ movdqa %xmm0, -26(%edx)
+L(aligned_16_10bytes):
+ movq %xmm0, -10(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_123bytes):
+ movdqa %xmm0, -123(%edx)
+L(aligned_16_107bytes):
+ movdqa %xmm0, -107(%edx)
+L(aligned_16_91bytes):
+ movdqa %xmm0, -91(%edx)
+L(aligned_16_75bytes):
+ movdqa %xmm0, -75(%edx)
+L(aligned_16_59bytes):
+ movdqa %xmm0, -59(%edx)
+L(aligned_16_43bytes):
+ movdqa %xmm0, -43(%edx)
+L(aligned_16_27bytes):
+ movdqa %xmm0, -27(%edx)
+L(aligned_16_11bytes):
+ movq %xmm0, -11(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_124bytes):
+ movdqa %xmm0, -124(%edx)
+L(aligned_16_108bytes):
+ movdqa %xmm0, -108(%edx)
+L(aligned_16_92bytes):
+ movdqa %xmm0, -92(%edx)
+L(aligned_16_76bytes):
+ movdqa %xmm0, -76(%edx)
+L(aligned_16_60bytes):
+ movdqa %xmm0, -60(%edx)
+L(aligned_16_44bytes):
+ movdqa %xmm0, -44(%edx)
+L(aligned_16_28bytes):
+ movdqa %xmm0, -28(%edx)
+L(aligned_16_12bytes):
+ movq %xmm0, -12(%edx)
+ movl %eax, -4(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_125bytes):
+ movdqa %xmm0, -125(%edx)
+L(aligned_16_109bytes):
+ movdqa %xmm0, -109(%edx)
+L(aligned_16_93bytes):
+ movdqa %xmm0, -93(%edx)
+L(aligned_16_77bytes):
+ movdqa %xmm0, -77(%edx)
+L(aligned_16_61bytes):
+ movdqa %xmm0, -61(%edx)
+L(aligned_16_45bytes):
+ movdqa %xmm0, -45(%edx)
+L(aligned_16_29bytes):
+ movdqa %xmm0, -29(%edx)
+L(aligned_16_13bytes):
+ movq %xmm0, -13(%edx)
+ movl %eax, -5(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_126bytes):
+ movdqa %xmm0, -126(%edx)
+L(aligned_16_110bytes):
+ movdqa %xmm0, -110(%edx)
+L(aligned_16_94bytes):
+ movdqa %xmm0, -94(%edx)
+L(aligned_16_78bytes):
+ movdqa %xmm0, -78(%edx)
+L(aligned_16_62bytes):
+ movdqa %xmm0, -62(%edx)
+L(aligned_16_46bytes):
+ movdqa %xmm0, -46(%edx)
+L(aligned_16_30bytes):
+ movdqa %xmm0, -30(%edx)
+L(aligned_16_14bytes):
+ movq %xmm0, -14(%edx)
+ movl %eax, -6(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_127bytes):
+ movdqa %xmm0, -127(%edx)
+L(aligned_16_111bytes):
+ movdqa %xmm0, -111(%edx)
+L(aligned_16_95bytes):
+ movdqa %xmm0, -95(%edx)
+L(aligned_16_79bytes):
+ movdqa %xmm0, -79(%edx)
+L(aligned_16_63bytes):
+ movdqa %xmm0, -63(%edx)
+L(aligned_16_47bytes):
+ movdqa %xmm0, -47(%edx)
+L(aligned_16_31bytes):
+ movdqa %xmm0, -31(%edx)
+L(aligned_16_15bytes):
+ movq %xmm0, -15(%edx)
+ movl %eax, -7(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN_END
+
+END (__memset_sse2_rep)
+
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memset-sse2.S b/libc/sysdeps/i386/i686/multiarch/memset-sse2.S
new file mode 100644
index 000000000..b2b979193
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memset-sse2.S
@@ -0,0 +1,867 @@
+/* memset with SSE2
+ Copyright (C) 2010 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>
+#include "asm-syntax.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)
+
+#ifdef USE_AS_BZERO
+# define DEST PARMS
+# define LEN DEST+4
+# define SETRTNVAL
+#else
+# define DEST PARMS
+# define CHR DEST+4
+# define LEN CHR+4
+# define SETRTNVAL movl DEST(%esp), %eax
+#endif
+
+#ifdef SHARED
+# define ENTRANCE PUSH (%ebx);
+# define RETURN_END POP (%ebx); ret
+# define RETURN RETURN_END; CFI_PUSH (%ebx)
+# define PARMS 8 /* Preserve EBX. */
+# define JMPTBL(I, B) I - B
+
+/* Load an entry in a jump table into EBX and branch to it. TABLE is a
+ jump table with relative offsets. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
+ /* We first load PC into EBX. */ \
+ call __i686.get_pc_thunk.bx; \
+ /* Get the address of the jump table. */ \
+ add $(TABLE - .), %ebx; \
+ /* Get the entry and convert the relative offset to the \
+ absolute address. */ \
+ add (%ebx,%ecx,4), %ebx; \
+ add %ecx, %edx; \
+ /* We loaded the jump table and adjuested EDX. Go. */ \
+ jmp *%ebx
+
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ ALIGN (4)
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#else
+# define ENTRANCE
+# define RETURN_END ret
+# define RETURN RETURN_END
+# define PARMS 4
+# define JMPTBL(I, B) I
+
+/* Branch to an entry in a jump table. TABLE is a jump table with
+ absolute offsets. */
+# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
+ add %ecx, %edx; \
+ jmp *TABLE(,%ecx,4)
+#endif
+
+ .section .text.sse2,"ax",@progbits
+#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BZERO
+ENTRY (__memset_chk_sse2)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memset_chk_sse2)
+#endif
+ENTRY (__memset_sse2)
+ ENTRANCE
+
+ movl LEN(%esp), %ecx
+#ifdef USE_AS_BZERO
+ xor %eax, %eax
+#else
+ movzbl CHR(%esp), %eax
+ movb %al, %ah
+ /* Fill the whole EAX with pattern. */
+ movl %eax, %edx
+ shl $16, %eax
+ or %edx, %eax
+#endif
+ movl DEST(%esp), %edx
+ cmp $32, %ecx
+ jae L(32bytesormore)
+
+L(write_less32bytes):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_less_32bytes))
+
+
+ .pushsection .rodata.sse2,"a",@progbits
+ ALIGN (2)
+L(table_less_32bytes):
+ .int JMPTBL (L(write_0bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_1bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_2bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_3bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_4bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_5bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_6bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_7bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_8bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_9bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_10bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_11bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_12bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_13bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_14bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_15bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_16bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_17bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_18bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_19bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_20bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_21bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_22bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_23bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_24bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_25bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_26bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_27bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_28bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_29bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_30bytes), L(table_less_32bytes))
+ .int JMPTBL (L(write_31bytes), L(table_less_32bytes))
+ .popsection
+
+ ALIGN (4)
+L(write_28bytes):
+ movl %eax, -28(%edx)
+L(write_24bytes):
+ movl %eax, -24(%edx)
+L(write_20bytes):
+ movl %eax, -20(%edx)
+L(write_16bytes):
+ movl %eax, -16(%edx)
+L(write_12bytes):
+ movl %eax, -12(%edx)
+L(write_8bytes):
+ movl %eax, -8(%edx)
+L(write_4bytes):
+ movl %eax, -4(%edx)
+L(write_0bytes):
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_29bytes):
+ movl %eax, -29(%edx)
+L(write_25bytes):
+ movl %eax, -25(%edx)
+L(write_21bytes):
+ movl %eax, -21(%edx)
+L(write_17bytes):
+ movl %eax, -17(%edx)
+L(write_13bytes):
+ movl %eax, -13(%edx)
+L(write_9bytes):
+ movl %eax, -9(%edx)
+L(write_5bytes):
+ movl %eax, -5(%edx)
+L(write_1bytes):
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_30bytes):
+ movl %eax, -30(%edx)
+L(write_26bytes):
+ movl %eax, -26(%edx)
+L(write_22bytes):
+ movl %eax, -22(%edx)
+L(write_18bytes):
+ movl %eax, -18(%edx)
+L(write_14bytes):
+ movl %eax, -14(%edx)
+L(write_10bytes):
+ movl %eax, -10(%edx)
+L(write_6bytes):
+ movl %eax, -6(%edx)
+L(write_2bytes):
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(write_31bytes):
+ movl %eax, -31(%edx)
+L(write_27bytes):
+ movl %eax, -27(%edx)
+L(write_23bytes):
+ movl %eax, -23(%edx)
+L(write_19bytes):
+ movl %eax, -19(%edx)
+L(write_15bytes):
+ movl %eax, -15(%edx)
+L(write_11bytes):
+ movl %eax, -11(%edx)
+L(write_7bytes):
+ movl %eax, -7(%edx)
+L(write_3bytes):
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+/* ECX > 32 and EDX is 4 byte aligned. */
+L(32bytesormore):
+ /* Fill xmm0 with the pattern. */
+#ifdef USE_AS_BZERO
+ pxor %xmm0, %xmm0
+#else
+ movd %eax, %xmm0
+ punpcklbw %xmm0, %xmm0
+ pshufd $0, %xmm0, %xmm0
+#endif
+ testl $0xf, %edx
+ jz L(aligned_16)
+/* ECX > 32 and EDX is not 16 byte aligned. */
+L(not_aligned_16):
+ movdqu %xmm0, (%edx)
+ movl %edx, %eax
+ and $-16, %edx
+ add $16, %edx
+ sub %edx, %eax
+ add %eax, %ecx
+ movd %xmm0, %eax
+
+ ALIGN (4)
+L(aligned_16):
+ cmp $128, %ecx
+ jge L(128bytesormore)
+
+L(aligned_16_less128bytes):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+ ALIGN (4)
+L(128bytesormore):
+#ifdef SHARED_CACHE_SIZE
+ PUSH (%ebx)
+ mov $SHARED_CACHE_SIZE, %ebx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx
+# else
+ PUSH (%ebx)
+ mov __x86_shared_cache_size, %ebx
+# endif
+#endif
+ cmp %ebx, %ecx
+ jae L(128bytesormore_nt_start)
+
+
+#ifdef DATA_CACHE_SIZE
+ POP (%ebx)
+ cmp $DATA_CACHE_SIZE, %ecx
+#else
+# ifdef SHARED
+ call __i686.get_pc_thunk.bx
+ add $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx
+# else
+ POP (%ebx)
+ cmp __x86_data_cache_size, %ecx
+# endif
+#endif
+
+ jae L(128bytes_L2_normal)
+ subl $128, %ecx
+L(128bytesormore_normal):
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm0, 0x10(%edx)
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm0, 0x30(%edx)
+ movdqa %xmm0, 0x40(%edx)
+ movdqa %xmm0, 0x50(%edx)
+ movdqa %xmm0, 0x60(%edx)
+ movdqa %xmm0, 0x70(%edx)
+ lea 128(%edx), %edx
+ jl L(128bytesless_normal)
+
+
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm0, 0x10(%edx)
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm0, 0x30(%edx)
+ movdqa %xmm0, 0x40(%edx)
+ movdqa %xmm0, 0x50(%edx)
+ movdqa %xmm0, 0x60(%edx)
+ movdqa %xmm0, 0x70(%edx)
+ lea 128(%edx), %edx
+ jge L(128bytesormore_normal)
+
+L(128bytesless_normal):
+ lea 128(%ecx), %ecx
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+ ALIGN (4)
+L(128bytes_L2_normal):
+ prefetcht0 0x380(%edx)
+ prefetcht0 0x3c0(%edx)
+ sub $128, %ecx
+ movdqa %xmm0, (%edx)
+ movaps %xmm0, 0x10(%edx)
+ movaps %xmm0, 0x20(%edx)
+ movaps %xmm0, 0x30(%edx)
+ movaps %xmm0, 0x40(%edx)
+ movaps %xmm0, 0x50(%edx)
+ movaps %xmm0, 0x60(%edx)
+ movaps %xmm0, 0x70(%edx)
+ add $128, %edx
+ cmp $128, %ecx
+ jge L(128bytes_L2_normal)
+
+L(128bytesless_L2_normal):
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+L(128bytesormore_nt_start):
+ sub %ebx, %ecx
+ ALIGN (4)
+L(128bytesormore_shared_cache_loop):
+ prefetcht0 0x3c0(%edx)
+ prefetcht0 0x380(%edx)
+ sub $0x80, %ebx
+ movdqa %xmm0, (%edx)
+ movdqa %xmm0, 0x10(%edx)
+ movdqa %xmm0, 0x20(%edx)
+ movdqa %xmm0, 0x30(%edx)
+ movdqa %xmm0, 0x40(%edx)
+ movdqa %xmm0, 0x50(%edx)
+ movdqa %xmm0, 0x60(%edx)
+ movdqa %xmm0, 0x70(%edx)
+ add $0x80, %edx
+ cmp $0x80, %ebx
+ jge L(128bytesormore_shared_cache_loop)
+ cmp $0x80, %ecx
+ jb L(shared_cache_loop_end)
+ ALIGN (4)
+L(128bytesormore_nt):
+ sub $0x80, %ecx
+ movntdq %xmm0, (%edx)
+ movntdq %xmm0, 0x10(%edx)
+ movntdq %xmm0, 0x20(%edx)
+ movntdq %xmm0, 0x30(%edx)
+ movntdq %xmm0, 0x40(%edx)
+ movntdq %xmm0, 0x50(%edx)
+ movntdq %xmm0, 0x60(%edx)
+ movntdq %xmm0, 0x70(%edx)
+ add $0x80, %edx
+ cmp $0x80, %ecx
+ jge L(128bytesormore_nt)
+ sfence
+L(shared_cache_loop_end):
+#if defined DATA_CACHE_SIZE || !defined SHARED
+ POP (%ebx)
+#endif
+ BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+
+
+ .pushsection .rodata.sse2,"a",@progbits
+ ALIGN (2)
+L(table_16_128bytes):
+ .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_1bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_2bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_3bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_5bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_6bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_7bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_9bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_10bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_11bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_13bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_14bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_15bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_17bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_18bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_19bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_21bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_22bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_23bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_25bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_26bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_27bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_29bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_30bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_31bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_33bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_34bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_35bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_37bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_38bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_39bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_41bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_42bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_43bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_45bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_46bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_47bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_49bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_50bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_51bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_53bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_54bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_55bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_57bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_58bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_59bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_61bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_62bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_63bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_65bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_66bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_67bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_69bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_70bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_71bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_73bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_74bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_75bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_77bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_78bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_79bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_81bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_82bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_83bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_85bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_86bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_87bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_89bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_90bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_91bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_93bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_94bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_95bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_97bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_98bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_99bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_101bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_102bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_103bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_105bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_106bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_107bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_109bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_110bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_111bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_113bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_114bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_115bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_117bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_118bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_119bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_121bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_122bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_123bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_125bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_126bytes), L(table_16_128bytes))
+ .int JMPTBL (L(aligned_16_127bytes), L(table_16_128bytes))
+ .popsection
+
+ ALIGN (4)
+L(aligned_16_112bytes):
+ movdqa %xmm0, -112(%edx)
+L(aligned_16_96bytes):
+ movdqa %xmm0, -96(%edx)
+L(aligned_16_80bytes):
+ movdqa %xmm0, -80(%edx)
+L(aligned_16_64bytes):
+ movdqa %xmm0, -64(%edx)
+L(aligned_16_48bytes):
+ movdqa %xmm0, -48(%edx)
+L(aligned_16_32bytes):
+ movdqa %xmm0, -32(%edx)
+L(aligned_16_16bytes):
+ movdqa %xmm0, -16(%edx)
+L(aligned_16_0bytes):
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_113bytes):
+ movdqa %xmm0, -113(%edx)
+L(aligned_16_97bytes):
+ movdqa %xmm0, -97(%edx)
+L(aligned_16_81bytes):
+ movdqa %xmm0, -81(%edx)
+L(aligned_16_65bytes):
+ movdqa %xmm0, -65(%edx)
+L(aligned_16_49bytes):
+ movdqa %xmm0, -49(%edx)
+L(aligned_16_33bytes):
+ movdqa %xmm0, -33(%edx)
+L(aligned_16_17bytes):
+ movdqa %xmm0, -17(%edx)
+L(aligned_16_1bytes):
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_114bytes):
+ movdqa %xmm0, -114(%edx)
+L(aligned_16_98bytes):
+ movdqa %xmm0, -98(%edx)
+L(aligned_16_82bytes):
+ movdqa %xmm0, -82(%edx)
+L(aligned_16_66bytes):
+ movdqa %xmm0, -66(%edx)
+L(aligned_16_50bytes):
+ movdqa %xmm0, -50(%edx)
+L(aligned_16_34bytes):
+ movdqa %xmm0, -34(%edx)
+L(aligned_16_18bytes):
+ movdqa %xmm0, -18(%edx)
+L(aligned_16_2bytes):
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_115bytes):
+ movdqa %xmm0, -115(%edx)
+L(aligned_16_99bytes):
+ movdqa %xmm0, -99(%edx)
+L(aligned_16_83bytes):
+ movdqa %xmm0, -83(%edx)
+L(aligned_16_67bytes):
+ movdqa %xmm0, -67(%edx)
+L(aligned_16_51bytes):
+ movdqa %xmm0, -51(%edx)
+L(aligned_16_35bytes):
+ movdqa %xmm0, -35(%edx)
+L(aligned_16_19bytes):
+ movdqa %xmm0, -19(%edx)
+L(aligned_16_3bytes):
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_116bytes):
+ movdqa %xmm0, -116(%edx)
+L(aligned_16_100bytes):
+ movdqa %xmm0, -100(%edx)
+L(aligned_16_84bytes):
+ movdqa %xmm0, -84(%edx)
+L(aligned_16_68bytes):
+ movdqa %xmm0, -68(%edx)
+L(aligned_16_52bytes):
+ movdqa %xmm0, -52(%edx)
+L(aligned_16_36bytes):
+ movdqa %xmm0, -36(%edx)
+L(aligned_16_20bytes):
+ movdqa %xmm0, -20(%edx)
+L(aligned_16_4bytes):
+ movl %eax, -4(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_117bytes):
+ movdqa %xmm0, -117(%edx)
+L(aligned_16_101bytes):
+ movdqa %xmm0, -101(%edx)
+L(aligned_16_85bytes):
+ movdqa %xmm0, -85(%edx)
+L(aligned_16_69bytes):
+ movdqa %xmm0, -69(%edx)
+L(aligned_16_53bytes):
+ movdqa %xmm0, -53(%edx)
+L(aligned_16_37bytes):
+ movdqa %xmm0, -37(%edx)
+L(aligned_16_21bytes):
+ movdqa %xmm0, -21(%edx)
+L(aligned_16_5bytes):
+ movl %eax, -5(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_118bytes):
+ movdqa %xmm0, -118(%edx)
+L(aligned_16_102bytes):
+ movdqa %xmm0, -102(%edx)
+L(aligned_16_86bytes):
+ movdqa %xmm0, -86(%edx)
+L(aligned_16_70bytes):
+ movdqa %xmm0, -70(%edx)
+L(aligned_16_54bytes):
+ movdqa %xmm0, -54(%edx)
+L(aligned_16_38bytes):
+ movdqa %xmm0, -38(%edx)
+L(aligned_16_22bytes):
+ movdqa %xmm0, -22(%edx)
+L(aligned_16_6bytes):
+ movl %eax, -6(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_119bytes):
+ movdqa %xmm0, -119(%edx)
+L(aligned_16_103bytes):
+ movdqa %xmm0, -103(%edx)
+L(aligned_16_87bytes):
+ movdqa %xmm0, -87(%edx)
+L(aligned_16_71bytes):
+ movdqa %xmm0, -71(%edx)
+L(aligned_16_55bytes):
+ movdqa %xmm0, -55(%edx)
+L(aligned_16_39bytes):
+ movdqa %xmm0, -39(%edx)
+L(aligned_16_23bytes):
+ movdqa %xmm0, -23(%edx)
+L(aligned_16_7bytes):
+ movl %eax, -7(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_120bytes):
+ movdqa %xmm0, -120(%edx)
+L(aligned_16_104bytes):
+ movdqa %xmm0, -104(%edx)
+L(aligned_16_88bytes):
+ movdqa %xmm0, -88(%edx)
+L(aligned_16_72bytes):
+ movdqa %xmm0, -72(%edx)
+L(aligned_16_56bytes):
+ movdqa %xmm0, -56(%edx)
+L(aligned_16_40bytes):
+ movdqa %xmm0, -40(%edx)
+L(aligned_16_24bytes):
+ movdqa %xmm0, -24(%edx)
+L(aligned_16_8bytes):
+ movq %xmm0, -8(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_121bytes):
+ movdqa %xmm0, -121(%edx)
+L(aligned_16_105bytes):
+ movdqa %xmm0, -105(%edx)
+L(aligned_16_89bytes):
+ movdqa %xmm0, -89(%edx)
+L(aligned_16_73bytes):
+ movdqa %xmm0, -73(%edx)
+L(aligned_16_57bytes):
+ movdqa %xmm0, -57(%edx)
+L(aligned_16_41bytes):
+ movdqa %xmm0, -41(%edx)
+L(aligned_16_25bytes):
+ movdqa %xmm0, -25(%edx)
+L(aligned_16_9bytes):
+ movq %xmm0, -9(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_122bytes):
+ movdqa %xmm0, -122(%edx)
+L(aligned_16_106bytes):
+ movdqa %xmm0, -106(%edx)
+L(aligned_16_90bytes):
+ movdqa %xmm0, -90(%edx)
+L(aligned_16_74bytes):
+ movdqa %xmm0, -74(%edx)
+L(aligned_16_58bytes):
+ movdqa %xmm0, -58(%edx)
+L(aligned_16_42bytes):
+ movdqa %xmm0, -42(%edx)
+L(aligned_16_26bytes):
+ movdqa %xmm0, -26(%edx)
+L(aligned_16_10bytes):
+ movq %xmm0, -10(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_123bytes):
+ movdqa %xmm0, -123(%edx)
+L(aligned_16_107bytes):
+ movdqa %xmm0, -107(%edx)
+L(aligned_16_91bytes):
+ movdqa %xmm0, -91(%edx)
+L(aligned_16_75bytes):
+ movdqa %xmm0, -75(%edx)
+L(aligned_16_59bytes):
+ movdqa %xmm0, -59(%edx)
+L(aligned_16_43bytes):
+ movdqa %xmm0, -43(%edx)
+L(aligned_16_27bytes):
+ movdqa %xmm0, -27(%edx)
+L(aligned_16_11bytes):
+ movq %xmm0, -11(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_124bytes):
+ movdqa %xmm0, -124(%edx)
+L(aligned_16_108bytes):
+ movdqa %xmm0, -108(%edx)
+L(aligned_16_92bytes):
+ movdqa %xmm0, -92(%edx)
+L(aligned_16_76bytes):
+ movdqa %xmm0, -76(%edx)
+L(aligned_16_60bytes):
+ movdqa %xmm0, -60(%edx)
+L(aligned_16_44bytes):
+ movdqa %xmm0, -44(%edx)
+L(aligned_16_28bytes):
+ movdqa %xmm0, -28(%edx)
+L(aligned_16_12bytes):
+ movq %xmm0, -12(%edx)
+ movl %eax, -4(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_125bytes):
+ movdqa %xmm0, -125(%edx)
+L(aligned_16_109bytes):
+ movdqa %xmm0, -109(%edx)
+L(aligned_16_93bytes):
+ movdqa %xmm0, -93(%edx)
+L(aligned_16_77bytes):
+ movdqa %xmm0, -77(%edx)
+L(aligned_16_61bytes):
+ movdqa %xmm0, -61(%edx)
+L(aligned_16_45bytes):
+ movdqa %xmm0, -45(%edx)
+L(aligned_16_29bytes):
+ movdqa %xmm0, -29(%edx)
+L(aligned_16_13bytes):
+ movq %xmm0, -13(%edx)
+ movl %eax, -5(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_126bytes):
+ movdqa %xmm0, -126(%edx)
+L(aligned_16_110bytes):
+ movdqa %xmm0, -110(%edx)
+L(aligned_16_94bytes):
+ movdqa %xmm0, -94(%edx)
+L(aligned_16_78bytes):
+ movdqa %xmm0, -78(%edx)
+L(aligned_16_62bytes):
+ movdqa %xmm0, -62(%edx)
+L(aligned_16_46bytes):
+ movdqa %xmm0, -46(%edx)
+L(aligned_16_30bytes):
+ movdqa %xmm0, -30(%edx)
+L(aligned_16_14bytes):
+ movq %xmm0, -14(%edx)
+ movl %eax, -6(%edx)
+ movw %ax, -2(%edx)
+ SETRTNVAL
+ RETURN
+
+ ALIGN (4)
+L(aligned_16_127bytes):
+ movdqa %xmm0, -127(%edx)
+L(aligned_16_111bytes):
+ movdqa %xmm0, -111(%edx)
+L(aligned_16_95bytes):
+ movdqa %xmm0, -95(%edx)
+L(aligned_16_79bytes):
+ movdqa %xmm0, -79(%edx)
+L(aligned_16_63bytes):
+ movdqa %xmm0, -63(%edx)
+L(aligned_16_47bytes):
+ movdqa %xmm0, -47(%edx)
+L(aligned_16_31bytes):
+ movdqa %xmm0, -31(%edx)
+L(aligned_16_15bytes):
+ movq %xmm0, -15(%edx)
+ movl %eax, -7(%edx)
+ movw %ax, -3(%edx)
+ movb %al, -1(%edx)
+ SETRTNVAL
+ RETURN_END
+
+END (__memset_sse2)
+
+#endif
diff --git a/libc/sysdeps/i386/i686/multiarch/memset.S b/libc/sysdeps/i386/i686/multiarch/memset.S
new file mode 100644
index 000000000..34dddcef7
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memset.S
@@ -0,0 +1,112 @@
+/* Multiple versions of memset
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(memset)
+ .type memset, @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 __memset_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memset_sse2@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memset_sse2_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(memset)
+# else
+ .text
+ENTRY(memset)
+ .type memset, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __memset_ia32, %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
+ jz 2f
+ leal __memset_sse2, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __memset_sse2_rep, %eax
+2: ret
+END(memset)
+# endif
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __memset_ia32, @function; \
+ .globl __memset_ia32; \
+ .p2align 4; \
+ __memset_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __memset_ia32, .-__memset_ia32
+
+# undef ENTRY_CHK
+# define ENTRY_CHK(name) \
+ .type __memset_chk_ia32, @function; \
+ .globl __memset_chk_ia32; \
+ .p2align 4; \
+ __memset_chk_ia32: cfi_startproc; \
+ CALL_MCOUNT
+# undef END_CHK
+# define END_CHK(name) \
+ cfi_endproc; .size __memset_chk_ia32, .-__memset_chk_ia32
+
+# ifdef SHARED
+# undef libc_hidden_builtin_def
+/* IFUNC doesn't work with the hidden functions in shared library since
+ they will be called without setting up EBX needed for PLT which is
+ used by IFUNC. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_memset; __GI_memset = __memset_ia32
+# endif
+
+# undef strong_alias
+# define strong_alias(original, alias)
+#endif
+
+#include "../memset.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/memset_chk.S b/libc/sysdeps/i386/i686/multiarch/memset_chk.S
new file mode 100644
index 000000000..d659c7e56
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/memset_chk.S
@@ -0,0 +1,116 @@
+/* Multiple versions of __memset_chk
+ Copyright (C) 2010 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 lib. */
+#ifndef NOT_IN_libc
+# ifdef SHARED
+ .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(__memset_chk)
+ .type __memset_chk, @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 __memset_chk_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memset_chk_sse2@GOTOFF(%ebx), %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __memset_chk_sse2_rep@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(__memset_chk)
+
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+ .section .gnu.warning.__memset_zero_constant_len_parameter
+ .string "memset used with constant zero length parameter; this could be due to transposed parameters"
+# else
+ .text
+ENTRY(__memset_chk)
+ .type __memset_chk, @gnu_indirect_function
+ cmpl $0, KIND_OFFSET+__cpu_features
+ jne 1f
+ call __init_cpu_features
+1: leal __memset_chk_ia32, %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
+ jz 2f
+ leal __memset_chk_sse2, %eax
+ testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features
+ jz 2f
+ leal __memset_chk_sse2_rep, %eax
+2: ret
+END(__memset_chk)
+
+ .type __memset_chk_sse2, @function
+ .p2align 4;
+__memset_chk_sse2:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memset_sse2
+ cfi_endproc
+ .size __memset_chk_sse2, .-__memset_chk_sse2
+
+ .type __memset_chk_sse2_rep, @function
+ .p2align 4;
+__memset_chk_sse2_rep:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memset_sse2_rep
+ cfi_endproc
+ .size __memset_chk_sse2_rep, .-__memset_chk_sse2_rep
+
+ .type __memset_chk_ia32, @function
+ .p2align 4;
+__memset_chk_ia32:
+ cfi_startproc
+ CALL_MCOUNT
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb __chk_fail
+ jmp __memset_ia32
+ cfi_endproc
+ .size __memset_chk_ia32, .-__memset_chk_ia32
+# endif
+#endif
diff --git a/libc/sysdeps/i386/sysdep.h b/libc/sysdeps/i386/sysdep.h
index e03a8e926..efdc82dde 100644
--- a/libc/sysdeps/i386/sysdep.h
+++ b/libc/sysdeps/i386/sysdep.h
@@ -67,6 +67,9 @@
ASM_SIZE_DIRECTIVE(name) \
STABS_FUN_END(name)
+#define ENTRY_CHK(name) ENTRY (name)
+#define END_CHK(name) END (name)
+
#ifdef HAVE_CPP_ASM_DEBUGINFO
/* Disable that goop, because we just pass -g through to the assembler
and it generates proper line number information directly. */
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_ceill.c b/libc/sysdeps/ieee754/ldbl-128/s_ceill.c
index 76bda9fc0..71f2fee91 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_ceill.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_ceill.c
@@ -30,9 +30,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
-static const long double huge = 1.0e4930;
+static const long double huge = 1.0e4930L;
#else
-static long double huge = 1.0e4930;
+static long double huge = 1.0e4930L;
#endif
#ifdef __STDC__
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c b/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c
index a82489bb2..dec6404af 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c
@@ -86,7 +86,7 @@ static const long double
/* ln (2^16384 * (1 - 2^-113)) */
maxlog = 1.1356523406294143949491931077970764891253E4L,
/* ln 2^-114 */
- minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e4932L;
+ minarg = -7.9018778583833765273564461846232128760607E1L, big = 1e4932L;
long double
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_floorl.c b/libc/sysdeps/ieee754/ldbl-128/s_floorl.c
index ff5b98da9..2a60a79fc 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_floorl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_floorl.c
@@ -30,9 +30,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
-static const long double huge = 1.0e4930;
+static const long double huge = 1.0e4930L;
#else
-static long double huge = 1.0e4930;
+static long double huge = 1.0e4930L;
#endif
#ifdef __STDC__
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_log1pl.c b/libc/sysdeps/ieee754/ldbl-128/s_log1pl.c
index 4480dc9f2..6e50575ac 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_log1pl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_log1pl.c
@@ -120,7 +120,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
static const long double sqrth = 0.7071067811865475244008443621048490392848L;
/* ln (2^16384 * (1 - 2^-113)) */
static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
-static const long double big = 2e4932L;
static const long double zero = 0.0L;
long double
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
index 1a22e0102..1f37d80e0 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
@@ -44,10 +44,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if((long double) x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
- float x2;
+ float u;
SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
- x2 = x*x;
- if(x2==x) return x2; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(hy<0||(ix>>23)>(iy>>48)-0x3f80
@@ -68,12 +70,9 @@ static char rcsid[] = "$NetBSD: $";
}
hy = hx&0x7f800000;
if(hy>=0x7f800000) return x+x; /* overflow */
- if(hy<0x00800000) { /* underflow */
- float x2 = x*x;
- if(x2!=x) { /* raise underflow flag */
- SET_FLOAT_WORD(x2,hx);
- return x2;
- }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_FLOAT_WORD(x,hx);
return x;
diff --git a/libc/sysdeps/mach/hurd/bits/libc-lock.h b/libc/sysdeps/mach/hurd/bits/libc-lock.h
index 0fa90bcc3..90e46e02f 100644
--- a/libc/sysdeps/mach/hurd/bits/libc-lock.h
+++ b/libc/sysdeps/mach/hurd/bits/libc-lock.h
@@ -31,6 +31,7 @@ typedef struct
void *owner;
int count;
} __libc_lock_recursive_t;
+typedef __libc_lock_recursive_t __rtld_lock_recursive_t;
#define __libc_lock_owner_self() ((void *) __hurd_threadvar_location (0))
@@ -121,6 +122,8 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
#define __rtld_lock_init_recursive(NAME) \
__libc_lock_init_recursive (NAME)
+#define __rtld_lock_initialize(NAME) \
+ (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
#define __rtld_lock_trylock_recursive(NAME) \
__libc_lock_trylock_recursive (NAME)
#define __rtld_lock_lock_recursive(NAME) \
diff --git a/libc/sysdeps/mach/hurd/bits/stat.h b/libc/sysdeps/mach/hurd/bits/stat.h
index c3f96660c..b64a658fb 100644
--- a/libc/sysdeps/mach/hurd/bits/stat.h
+++ b/libc/sysdeps/mach/hurd/bits/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,93,94,96,97,99,2000,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1994,1996,1997,1999,2000,2005,2010
+ 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
@@ -16,10 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
#include <bits/types.h>
/* NOTE: The size of this structure (32 ints) is known in
@@ -192,5 +196,7 @@ struct stat64
/* Default file creation mask (umask). */
#ifdef __USE_BSD
-#define CMASK 0022
+# define CMASK 0022
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/powerpc/powerpc32/cell/memcpy.S b/libc/sysdeps/powerpc/powerpc32/cell/memcpy.S
new file mode 100644
index 000000000..cc1da99fd
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/cell/memcpy.S
@@ -0,0 +1,245 @@
+/* Optimized memcpy implementation for CELL BE PowerPC.
+ Copyright (C) 2010 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>
+
+#define PREFETCH_AHEAD 6 /* no cache lines SRC prefetching ahead */
+#define ZERO_AHEAD 4 /* no cache lines DST zeroing ahead */
+
+/* memcpy routine optimized for CELL-BE-PPC v2.0
+ *
+ * The CELL PPC core has 1 integer unit and 1 load/store unit
+ * CELL:
+ * 1st level data cache = 32K
+ * 2nd level data cache = 512K
+ * 3rd level data cache = 0K
+ * With 3.2 GHz clockrate the latency to 2nd level cache is >36 clocks,
+ * latency to memory is >400 clocks
+ * To improve copy performance we need to prefetch source data
+ * far ahead to hide this latency
+ * For best performance instructionforms ending in "." like "andi."
+ * should be avoided as the are implemented in microcode on CELL.
+ * The below code is loop unrolled for the CELL cache line of 128 bytes
+ */
+
+.align 7
+
+EALIGN (BP_SYM (memcpy), 5, 0)
+ CALL_MCOUNT
+
+ dcbt 0,r4 /* Prefetch ONE SRC cacheline */
+ cmplwi cr1,r5,16 /* is size < 16 ? */
+ mr r6,r3
+ blt+ cr1,.Lshortcopy
+
+.Lbigcopy:
+ neg r8,r3 /* LS 3 bits = # bytes to 8-byte dest bdry */
+ clrlwi r8,r8,32-4 /* aling to 16byte boundary */
+ sub r7,r4,r3
+ cmplwi cr0,r8,0
+ beq+ .Ldst_aligned
+
+.Ldst_unaligned:
+ mtcrf 0x01,r8 /* put #bytes to boundary into cr7 */
+ subf r5,r8,r5
+
+ bf cr7*4+3,1f
+ lbzx r0,r7,r6 /* copy 1 byte */
+ stb r0,0(r6)
+ addi r6,r6,1
+1: bf cr7*4+2,2f
+ lhzx r0,r7,r6 /* copy 2 byte */
+ sth r0,0(r6)
+ addi r6,r6,2
+2: bf cr7*4+1,4f
+ lwzx r0,r7,r6 /* copy 4 byte */
+ stw r0,0(r6)
+ addi r6,r6,4
+4: bf cr7*4+0,8f
+ lfdx fp9,r7,r6 /* copy 8 byte */
+ stfd fp9,0(r6)
+ addi r6,r6,8
+8:
+ add r4,r7,r6
+
+.Ldst_aligned:
+
+ cmpwi cr5,r5,128-1
+
+ neg r7,r6
+ addi r6,r6,-8 /* prepare for stfdu */
+ addi r4,r4,-8 /* prepare for lfdu */
+
+ clrlwi r7,r7,32-7 /* align to cacheline boundary */
+ ble+ cr5,.Llessthancacheline
+
+ cmplwi cr6,r7,0
+ subf r5,r7,r5
+ srwi r7,r7,4 /* divide size by 16 */
+ srwi r10,r5,7 /* number of cache lines to copy */
+
+ cmplwi r10,0
+ li r11,0 /* number cachelines to copy with prefetch */
+ beq .Lnocacheprefetch
+
+ cmplwi r10,PREFETCH_AHEAD
+ li r12,128+8 /* prefetch distance */
+ ble .Llessthanmaxprefetch
+
+ subi r11,r10,PREFETCH_AHEAD
+ li r10,PREFETCH_AHEAD
+
+.Llessthanmaxprefetch:
+ mtctr r10
+
+.LprefetchSRC:
+ dcbt r12,r4
+ addi r12,r12,128
+ bdnz .LprefetchSRC
+
+.Lnocacheprefetch:
+ mtctr r7
+ cmplwi cr1,r5,128
+ clrlwi r5,r5,32-7
+ beq cr6,.Lcachelinealigned
+
+.Laligntocacheline:
+ lfd fp9,0x08(r4)
+ lfdu fp10,0x10(r4)
+ stfd fp9,0x08(r6)
+ stfdu fp10,0x10(r6)
+ bdnz .Laligntocacheline
+
+
+.Lcachelinealigned: /* copy while cache lines */
+
+ blt- cr1,.Llessthancacheline /* size <128 */
+
+.Louterloop:
+ cmpwi r11,0
+ mtctr r11
+ beq- .Lendloop
+
+ li r11,128*ZERO_AHEAD +8 /* DCBZ dist */
+
+.align 4
+ /* Copy whole cachelines, optimized by prefetching SRC cacheline */
+.Lloop: /* Copy aligned body */
+ dcbt r12,r4 /* PREFETCH SOURCE some cache lines ahead */
+ lfd fp9, 0x08(r4)
+ dcbz r11,r6
+ lfd fp10, 0x10(r4) /* 4 register stride copy is optimal */
+ lfd fp11, 0x18(r4) /* to hide 1st level cache lantency. */
+ lfd fp12, 0x20(r4)
+ stfd fp9, 0x08(r6)
+ stfd fp10, 0x10(r6)
+ stfd fp11, 0x18(r6)
+ stfd fp12, 0x20(r6)
+ lfd fp9, 0x28(r4)
+ lfd fp10, 0x30(r4)
+ lfd fp11, 0x38(r4)
+ lfd fp12, 0x40(r4)
+ stfd fp9, 0x28(r6)
+ stfd fp10, 0x30(r6)
+ stfd fp11, 0x38(r6)
+ stfd fp12, 0x40(r6)
+ lfd fp9, 0x48(r4)
+ lfd fp10, 0x50(r4)
+ lfd fp11, 0x58(r4)
+ lfd fp12, 0x60(r4)
+ stfd fp9, 0x48(r6)
+ stfd fp10, 0x50(r6)
+ stfd fp11, 0x58(r6)
+ stfd fp12, 0x60(r6)
+ lfd fp9, 0x68(r4)
+ lfd fp10, 0x70(r4)
+ lfd fp11, 0x78(r4)
+ lfdu fp12, 0x80(r4)
+ stfd fp9, 0x68(r6)
+ stfd fp10, 0x70(r6)
+ stfd fp11, 0x78(r6)
+ stfdu fp12, 0x80(r6)
+
+ bdnz .Lloop
+
+.Lendloop:
+ cmpwi r10,0
+ slwi r10,r10,2 /* adjust from 128 to 32 byte stride */
+ beq- .Lendloop2
+ mtctr r10
+
+.Lloop2: /* Copy aligned body */
+ lfd fp9, 0x08(r4)
+ lfd fp10, 0x10(r4)
+ lfd fp11, 0x18(r4)
+ lfdu fp12, 0x20(r4)
+ stfd fp9, 0x08(r6)
+ stfd fp10, 0x10(r6)
+ stfd fp11, 0x18(r6)
+ stfdu fp12, 0x20(r6)
+
+ bdnz .Lloop2
+.Lendloop2:
+
+.Llessthancacheline: /* less than cache to do ? */
+ cmplwi cr0,r5,16
+ srwi r7,r5,4 /* divide size by 16 */
+ blt- .Ldo_lt16
+ mtctr r7
+
+.Lcopy_remaining:
+ lfd fp9,0x08(r4)
+ lfdu fp10,0x10(r4)
+ stfd fp9,0x08(r6)
+ stfdu fp10,0x10(r6)
+ bdnz .Lcopy_remaining
+
+.Ldo_lt16: /* less than 16 ? */
+ cmplwi cr0,r5,0 /* copy remaining bytes (0-15) */
+ beqlr+ /* no rest to copy */
+ addi r4,r4,8
+ addi r6,r6,8
+
+.Lshortcopy: /* SIMPLE COPY to handle size =< 15 bytes */
+ mtcrf 0x01,r5
+ sub r7,r4,r6
+ bf- cr7*4+0,8f
+ lfdx fp9,r7,r6 /* copy 8 byte */
+ stfd fp9,0(r6)
+ addi r6,r6,8
+8:
+ bf cr7*4+1,4f
+ lwzx r0,r7,r6 /* copy 4 byte */
+ stw r0,0(r6)
+ addi r6,r6,4
+4:
+ bf cr7*4+2,2f
+ lhzx r0,r7,r6 /* copy 2 byte */
+ sth r0,0(r6)
+ addi r6,r6,2
+2:
+ bf cr7*4+3,1f
+ lbzx r0,r7,r6 /* copy 1 byte */
+ stb r0,0(r6)
+1: blr
+
+END (BP_SYM (memcpy))
+libc_hidden_builtin_def (memcpy)
diff --git a/libc/sysdeps/powerpc/powerpc64/cell/memcpy.S b/libc/sysdeps/powerpc/powerpc64/cell/memcpy.S
new file mode 100644
index 000000000..c6ee730e4
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc64/cell/memcpy.S
@@ -0,0 +1,245 @@
+/* Optimized memcpy implementation for CELL BE PowerPC.
+ Copyright (C) 2010 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>
+
+#define PREFETCH_AHEAD 6 /* no cache lines SRC prefetching ahead */
+#define ZERO_AHEAD 4 /* no cache lines DST zeroing ahead */
+
+/* memcpy routine optimized for CELL-BE-PPC v2.0
+ *
+ * The CELL PPC core has 1 integer unit and 1 load/store unit
+ * CELL:
+ * 1st level data cache = 32K
+ * 2nd level data cache = 512K
+ * 3rd level data cache = 0K
+ * With 3.2 GHz clockrate the latency to 2nd level cache is >36 clocks,
+ * latency to memory is >400 clocks
+ * To improve copy performance we need to prefetch source data
+ * far ahead to hide this latency
+ * For best performance instructionforms ending in "." like "andi."
+ * should be avoided as the are implemented in microcode on CELL.
+ * The below code is loop unrolled for the CELL cache line of 128 bytes
+ */
+
+.align 7
+
+EALIGN (BP_SYM (memcpy), 5, 0)
+ CALL_MCOUNT 3
+
+ dcbt 0,r4 /* Prefetch ONE SRC cacheline */
+ cmpldi cr1,r5,16 /* is size < 16 ? */
+ mr r6,r3
+ blt+ cr1,.Lshortcopy
+
+.Lbigcopy:
+ neg r8,r3 /* LS 3 bits = # bytes to 8-byte dest bdry */
+ clrldi r8,r8,64-4 /* aling to 16byte boundary */
+ sub r7,r4,r3
+ cmpldi cr0,r8,0
+ beq+ .Ldst_aligned
+
+.Ldst_unaligned:
+ mtcrf 0x01,r8 /* put #bytes to boundary into cr7 */
+ subf r5,r8,r5
+
+ bf cr7*4+3,1f
+ lbzx r0,r7,r6 /* copy 1 byte */
+ stb r0,0(r6)
+ addi r6,r6,1
+1: bf cr7*4+2,2f
+ lhzx r0,r7,r6 /* copy 2 byte */
+ sth r0,0(r6)
+ addi r6,r6,2
+2: bf cr7*4+1,4f
+ lwzx r0,r7,r6 /* copy 4 byte */
+ stw r0,0(r6)
+ addi r6,r6,4
+4: bf cr7*4+0,8f
+ ldx r0,r7,r6 /* copy 8 byte */
+ std r0,0(r6)
+ addi r6,r6,8
+8:
+ add r4,r7,r6
+
+.Ldst_aligned:
+
+ cmpdi cr5,r5,128-1
+
+ neg r7,r6
+ addi r6,r6,-8 /* prepare for stdu */
+ addi r4,r4,-8 /* prepare for ldu */
+
+ clrldi r7,r7,64-7 /* align to cacheline boundary */
+ ble+ cr5,.Llessthancacheline
+
+ cmpldi cr6,r7,0
+ subf r5,r7,r5
+ srdi r7,r7,4 /* divide size by 16 */
+ srdi r10,r5,7 /* number of cache lines to copy */
+
+ cmpldi r10,0
+ li r11,0 /* number cachelines to copy with prefetch */
+ beq .Lnocacheprefetch
+
+ cmpldi r10,PREFETCH_AHEAD
+ li r12,128+8 /* prefetch distance */
+ ble .Llessthanmaxprefetch
+
+ subi r11,r10,PREFETCH_AHEAD
+ li r10,PREFETCH_AHEAD
+
+.Llessthanmaxprefetch:
+ mtctr r10
+
+.LprefetchSRC:
+ dcbt r12,r4
+ addi r12,r12,128
+ bdnz .LprefetchSRC
+
+.Lnocacheprefetch:
+ mtctr r7
+ cmpldi cr1,r5,128
+ clrldi r5,r5,64-7
+ beq cr6,.Lcachelinealigned
+
+.Laligntocacheline:
+ ld r9,0x08(r4)
+ ldu r7,0x10(r4)
+ std r9,0x08(r6)
+ stdu r7,0x10(r6)
+ bdnz .Laligntocacheline
+
+
+.Lcachelinealigned: /* copy while cache lines */
+
+ blt- cr1,.Llessthancacheline /* size <128 */
+
+.Louterloop:
+ cmpdi r11,0
+ mtctr r11
+ beq- .Lendloop
+
+ li r11,128*ZERO_AHEAD +8 /* DCBZ dist */
+
+.align 4
+ /* Copy whole cachelines, optimized by prefetching SRC cacheline */
+.Lloop: /* Copy aligned body */
+ dcbt r12,r4 /* PREFETCH SOURCE some cache lines ahead */
+ ld r9, 0x08(r4)
+ dcbz r11,r6
+ ld r7, 0x10(r4) /* 4 register stride copy is optimal */
+ ld r8, 0x18(r4) /* to hide 1st level cache lantency. */
+ ld r0, 0x20(r4)
+ std r9, 0x08(r6)
+ std r7, 0x10(r6)
+ std r8, 0x18(r6)
+ std r0, 0x20(r6)
+ ld r9, 0x28(r4)
+ ld r7, 0x30(r4)
+ ld r8, 0x38(r4)
+ ld r0, 0x40(r4)
+ std r9, 0x28(r6)
+ std r7, 0x30(r6)
+ std r8, 0x38(r6)
+ std r0, 0x40(r6)
+ ld r9, 0x48(r4)
+ ld r7, 0x50(r4)
+ ld r8, 0x58(r4)
+ ld r0, 0x60(r4)
+ std r9, 0x48(r6)
+ std r7, 0x50(r6)
+ std r8, 0x58(r6)
+ std r0, 0x60(r6)
+ ld r9, 0x68(r4)
+ ld r7, 0x70(r4)
+ ld r8, 0x78(r4)
+ ldu r0, 0x80(r4)
+ std r9, 0x68(r6)
+ std r7, 0x70(r6)
+ std r8, 0x78(r6)
+ stdu r0, 0x80(r6)
+
+ bdnz .Lloop
+
+.Lendloop:
+ cmpdi r10,0
+ sldi r10,r10,2 /* adjust from 128 to 32 byte stride */
+ beq- .Lendloop2
+ mtctr r10
+
+.Lloop2: /* Copy aligned body */
+ ld r9, 0x08(r4)
+ ld r7, 0x10(r4)
+ ld r8, 0x18(r4)
+ ldu r0, 0x20(r4)
+ std r9, 0x08(r6)
+ std r7, 0x10(r6)
+ std r8, 0x18(r6)
+ stdu r0, 0x20(r6)
+
+ bdnz .Lloop2
+.Lendloop2:
+
+.Llessthancacheline: /* less than cache to do ? */
+ cmpldi cr0,r5,16
+ srdi r7,r5,4 /* divide size by 16 */
+ blt- .Ldo_lt16
+ mtctr r7
+
+.Lcopy_remaining:
+ ld r8,0x08(r4)
+ ldu r7,0x10(r4)
+ std r8,0x08(r6)
+ stdu r7,0x10(r6)
+ bdnz .Lcopy_remaining
+
+.Ldo_lt16: /* less than 16 ? */
+ cmpldi cr0,r5,0 /* copy remaining bytes (0-15) */
+ beqlr+ /* no rest to copy */
+ addi r4,r4,8
+ addi r6,r6,8
+
+.Lshortcopy: /* SIMPLE COPY to handle size =< 15 bytes */
+ mtcrf 0x01,r5
+ sub r7,r4,r6
+ bf- cr7*4+0,8f
+ ldx r0,r7,r6 /* copy 8 byte */
+ std r0,0(r6)
+ addi r6,r6,8
+8:
+ bf cr7*4+1,4f
+ lwzx r0,r7,r6 /* copy 4 byte */
+ stw r0,0(r6)
+ addi r6,r6,4
+4:
+ bf cr7*4+2,2f
+ lhzx r0,r7,r6 /* copy 2 byte */
+ sth r0,0(r6)
+ addi r6,r6,2
+2:
+ bf cr7*4+3,1f
+ lbzx r0,r7,r6 /* copy 1 byte */
+ stb r0,0(r6)
+1: blr
+
+END_GEN_TB (BP_SYM (memcpy),TB_TOCLESS)
+libc_hidden_builtin_def (memcpy)
diff --git a/libc/sysdeps/s390/s390-32/dl-machine.h b/libc/sysdeps/s390/s390-32/dl-machine.h
index 251a5f692..415b38801 100644
--- a/libc/sysdeps/s390/s390-32/dl-machine.h
+++ b/libc/sysdeps/s390/s390-32/dl-machine.h
@@ -27,6 +27,7 @@
#include <sys/param.h>
#include <string.h>
#include <link.h>
+#include <sysdeps/s390/dl-procinfo.h>
/* This is an older, now obsolete value. */
#define EM_S390_OLD 0xA390
@@ -35,6 +36,12 @@
static inline int
elf_machine_matches_host (const Elf32_Ehdr *ehdr)
{
+ /* Check if the kernel provides the high gpr facility if needed by
+ the binary. */
+ if ((ehdr->e_flags & EF_S390_HIGH_GPRS)
+ && !(GLRO (dl_hwcap) & HWCAP_S390_HIGH_GPRS))
+ return 0;
+
return (ehdr->e_machine == EM_S390 || ehdr->e_machine == EM_S390_OLD)
&& ehdr->e_ident[EI_CLASS] == ELFCLASS32;
}
diff --git a/libc/sysdeps/s390/s390-32/elf/start.S b/libc/sysdeps/s390/s390-32/elf/start.S
index f7290106c..066f7f0aa 100644
--- a/libc/sysdeps/s390/s390-32/elf/start.S
+++ b/libc/sysdeps/s390/s390-32/elf/start.S
@@ -59,6 +59,88 @@
.globl _start
.type _start,@function
_start:
+ /* Check if the kernel provides highgprs facility if needed by
+ the binary. */
+
+ lr %r6,%r15
+ la %r6,4(%r6) /* Skip the argument counter. */
+
+.L11: l %r5,0(%r6) /* Skip the argument vector. */
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jne .L11
+
+.L12: l %r5,0(%r6) /* Skip the environment vector. */
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jne .L12
+
+ /* Obtain the needed values from the auxiliary vector. */
+
+ lhi %r7,16 /* AT_HWCAP */
+ lhi %r8,3 /* AT_PHDR */
+ lhi %r9,5 /* AT_PHNUM */
+ lhi %r2,4 /* AT_PHENT */
+.L13: l %r5,0(%r6)
+ clr %r5,%r7
+ jne .L15
+ l %r10,4(%r6) /* r10 = AT_HWCAP value. */
+.L15: clr %r5,%r8
+ jne .L16
+ l %r11,4(%r6) /* r11 = AT_PHDR value. */
+.L16: clr %r5,%r9
+ jne .L17
+ l %r12,4(%r6) /* r12 = AT_PHNUM value. */
+.L17: clr %r5,%r2
+ jne .L18
+ l %r0,4(%r6) /* r0 = AT_PHENT value. */
+.L18: ltr %r5,%r5
+ la %r6,8(%r6)
+ jnz .L13
+
+ /* Locate the ELF header by looking for the first PT_LOAD
+ segment with a p_offset of zero. */
+
+ lr %r4,%r11 /* Backup AT_PHDR. */
+ lhi %r7,1 /* PT_LOAD id */
+ lhi %r8,0
+.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
+ jne .L20
+ cl %r8,4(%r4) /* p_offset == 0? */
+ jne .L20
+ l %r9,8(%r4) /* r9 = p_vaddr <- ELF header address */
+ j .L24
+.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
+ brct %r12,.L19
+
+ j .+2 /* Trap, there must be such a phdr. */
+
+.L24: lr %r4,%r11 /* Backup AT_PHDR. */
+ lhi %r2,6 /* PT_PHDR id */
+.L23: cl %r2,0(%r4)
+ jne .L22
+ l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
+ j .L25
+.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
+ brct %r12,.L23
+
+ ltr %r9,%r9 /* Load address == 0? */
+ jz .L14 /* No checking for PIE without PT_PHDR. */
+ j .L21
+
+.L25: clr %r3,%r11 /* PT_PHDR p_vaddr == AT_PHDR? */
+ je .L21
+ lr %r9,%r11
+ slr %r9,%r3 /* elf_header_addr = AT_PHDR - PT_PHDR.p_vaddr */
+
+.L21: l %r5,36(%r9) /* Load the e_flags field. */
+ tml %r5,1
+ jz .L14 /* Binary does not require highgprs facility. */
+
+ tml %r10,512 /* Check the AT_HWCAP value. */
+ jz 2 /* Trap if no highgprs facility available. */
+.L14:
+
/* Setup pointer to literal pool of _start */
basr %r13,0
.L0: ahi %r13,.Llit-.L0
diff --git a/libc/sysdeps/unix/bsd/bits/stat.h b/libc/sysdeps/unix/bsd/bits/stat.h
index 84a58ffbc..6eeab3b0e 100644
--- a/libc/sysdeps/unix/bsd/bits/stat.h
+++ b/libc/sysdeps/unix/bsd/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 96, 97, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1996-2000,2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
#include <bits/types.h>
/* Structure describing file characteristics. */
@@ -84,3 +87,5 @@ struct stat
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/bits/stat.h b/libc/sysdeps/unix/sysv/bits/stat.h
index f9a9e614d..2fb619a2e 100644
--- a/libc/sysdeps/unix/sysv/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 2000, 2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
struct stat
{
short int st_dev;
@@ -63,3 +66,5 @@ struct stat
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/bits/sigaction.h b/libc/sysdeps/unix/sysv/linux/bits/sigaction.h
index 48cc5312f..62be06920 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/sigaction.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/sigaction.h
@@ -1,5 +1,5 @@
/* The proper definitions for Linux's sigaction.
- Copyright (C) 1993-1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1993-1999, 2000, 2010 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,8 @@ struct sigaction
three arguments instead of one. */
#if defined __USE_UNIX98 || defined __USE_MISC
# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when
its handler is being executed. */
diff --git a/libc/sysdeps/unix/sysv/linux/bits/stat.h b/libc/sysdeps/unix/sysv/linux/bits/stat.h
index be5272333..8ac3cd472 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2001, 2002, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2009, 2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -166,3 +169,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 8eaf7c368..669388954 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -45,13 +45,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0200000 /* Must be a directory. */
# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
/* For now Linux has synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
@@ -84,7 +86,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -100,6 +102,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index c65a11e1c..33635fd9e 100644
--- a/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux/IA64.
- Copyright (C) 1999,2000,2004,2006,2007,2009 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2004, 2006, 2007, 2009, 2010
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,13 +45,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 040000
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0200000 /* must be a directory */
# define O_NOFOLLOW 0400000 /* don't follow links */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 040000
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
#ifdef __USE_LARGEFILE64
/* Not necessary, files are always with 64bit off_t. */
@@ -80,7 +83,7 @@
#define F_SETLK64 6 /* Set record locking info (non-blocking). */
#define F_SETLKW64 7 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -96,6 +99,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/ia64/bits/sigaction.h b/libc/sysdeps/unix/sysv/linux/ia64/bits/sigaction.h
index 11599d520..b557eaa3e 100644
--- a/libc/sysdeps/unix/sysv/linux/ia64/bits/sigaction.h
+++ b/libc/sysdeps/unix/sysv/linux/ia64/bits/sigaction.h
@@ -1,5 +1,5 @@
/* Definitions for Linux/ia64 sigaction.
- Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000, 2003, 2010 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,6 +53,8 @@ struct sigaction
#define SA_SIGINFO 0x00000004
#if defined __USE_UNIX98 || defined __USE_MISC
# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
# define SA_NODEFER 0x40000000 /* Don't automatically block the signal
when its handler is being executed. */
diff --git a/libc/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/libc/sysdeps/unix/sysv/linux/ia64/bits/stat.h
index 75a331828..86acd27ae 100644
--- a/libc/sysdeps/unix/sysv/linux/ia64/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/ia64/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2002, 2009, 2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_KERNEL 0
#define _STAT_VER_LINUX 1
@@ -143,3 +146,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits//stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 40fe1e50d..fea347bfc 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/PowerPC.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007, 2009
+ Copyright (C) 1995-1998, 2000, 2003, 2004, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -45,13 +45,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 0400000 /* Direct disk access. */
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 040000 /* Must be a directory. */
# define O_NOFOLLOW 0100000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 0400000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
#ifdef __USE_LARGEFILE64
# define O_LARGEFILE 0200000
@@ -84,7 +86,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -100,6 +102,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
index 81879ca1f..6e4a55f87 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2009
+/* Copyright (C) 1992, 1995-2002, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,10 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
#include <bits/wordsize.h>
/* Versions of the `struct stat' data structure. */
@@ -270,3 +273,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/fpu/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/fpu/Implies
new file mode 100644
index 000000000..7c381f043
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/fpu/Implies
@@ -0,0 +1,3 @@
+# Make sure this comes before the powerpc/powerpc32/fpu that's
+# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies.
+powerpc/powerpc32/cell/fpu
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/fpu/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/fpu/Implies
new file mode 100644
index 000000000..b6720ecda
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/cell/fpu
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index c9e6a4504..aeb1e0fe9 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000,2001,2002,2004,2006,2007,2009 Free Software Foundation, Inc.
+ Copyright (C) 2000-2002,2004,2006,2007,2009,2010
+ 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,13 +46,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0200000 /* Must be a directory. */
# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
#ifdef __USE_LARGEFILE64
# if __WORDSIZE == 64
@@ -99,7 +102,7 @@
# define F_SETLKW64 14 /* Set record locking info (blocking). */
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -115,6 +118,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/sigaction.h b/libc/sysdeps/unix/sysv/linux/s390/bits/sigaction.h
index 308cb5bd7..8767d6785 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/bits/sigaction.h
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/sigaction.h
@@ -1,5 +1,5 @@
/* Definitions for 31 & 64 bit S/390 sigaction.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2010 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
@@ -90,6 +90,8 @@ struct sigaction
three arguments instead of one. */
#if defined __USE_UNIX98 || defined __USE_MISC
# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when
its handler is being executed. */
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/stat.h b/libc/sysdeps/unix/sysv/linux/s390/bits/stat.h
index 64be9a10f..9d62ad26f 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2009, 2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
#include <bits/wordsize.h>
#if __WORDSIZE == 64
@@ -259,3 +262,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c
index b28e58749..f2c151857 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c
@@ -46,7 +46,7 @@
{ \
if ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \
- >= oss.ss_size)) \
+ < oss.ss_size)) \
__fortify_fail ("longjmp causes uninitialized stack frame");\
} \
} \
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c b/libc/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c
index dcf58fb50..261be250d 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c
@@ -46,7 +46,7 @@
{ \
if ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \
- >= oss.ss_size)) \
+ < oss.ss_size)) \
__fortify_fail ("longjmp causes uninitialized stack frame");\
} \
} \
diff --git a/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index 8eaf7c368..2a4123c61 100644
--- a/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -45,14 +45,17 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0200000 /* Must be a directory. */
# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
+
/* For now Linux has synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
this is a superset. */
@@ -84,7 +87,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -100,6 +103,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 03c5ba59b..1dc45b7d8 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/SPARC.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007, 2009
+ Copyright (C) 1995-1998, 2000, 2003, 2004, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -44,12 +44,14 @@
#define O_NDELAY (0x0004 | O_NONBLOCK)
#define O_NOCTTY 0x8000 /* not fcntl */
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0x10000 /* must be a directory */
# define O_NOFOLLOW 0x20000 /* don't follow links */
+# define O_CLOEXEC 0x400000 /* Set close_on_exit. */
+#endif
+#ifdef __USE_GNU
# define O_DIRECT 0x100000 /* direct disk access hint */
# define O_NOATIME 0x200000 /* Do not set atime. */
-# define O_CLOEXEC 0x400000 /* Set close_on_exit. */
#endif
#ifdef __USE_LARGEFILE64
@@ -68,21 +70,13 @@
# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC O_SYNC /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
#define F_SETFD 2 /* Set file descriptor flags. */
#define F_GETFL 3 /* Get file status flags. */
#define F_SETFL 4 /* Set file status flags. */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_GETOWN 5 /* Get owner (process receiving SIGIO). */
# define F_SETOWN 6 /* Set owner (process receiving SIGIO). */
#endif
@@ -107,6 +101,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
index ee4196764..e474dbe26 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
@@ -1,5 +1,5 @@
/* The proper definitions for Linux/SPARC sigaction.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996-2000, 2010 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
@@ -58,6 +58,8 @@ struct sigaction
three arguments instead of one. */
#if defined __USE_UNIX98 || defined __USE_MISC
# define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
# define SA_RESTART 0x00000002 /* Restart syscall on signal return. */
# define SA_INTERRUPT 0x00000010 /* Historical no-op. */
# define SA_NOMASK 0x00000020 /* Don't automatically block the signal when
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/stat.h
index 175fdb857..eaab95a1c 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2002, 2006, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995-2002,2006,2009,2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -167,3 +170,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index 43835081c..aa04e0e49 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux/x86-64.
- Copyright (C) 2001,2002,2004,2006,2007,2009 Free Software Foundation, Inc.
+ Copyright (C) 2001,2002,2004,2006,2007,2009,2010
+ 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,13 +46,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 0200000 /* Must be a directory. */
# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#endif
/* For now Linux has synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
@@ -98,7 +101,7 @@
# define F_SETLKW64 14 /* Set record locking info (blocking). */
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -114,6 +117,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/libc/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
index 9d12315e1..c7e4e1f0d 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2003,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003,2009,2010 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
@@ -16,10 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_KERNEL 0
@@ -206,3 +209,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/sysdeps/x86_64/cacheinfo.c b/libc/sysdeps/x86_64/cacheinfo.c
index 5b66c62eb..54220379e 100644
--- a/libc/sysdeps/x86_64/cacheinfo.c
+++ b/libc/sysdeps/x86_64/cacheinfo.c
@@ -74,6 +74,7 @@ static const struct intel_02_cache_info
{ 0x0a, 2, 32, M(_SC_LEVEL1_DCACHE_SIZE), 8192 },
{ 0x0c, 4, 32, M(_SC_LEVEL1_DCACHE_SIZE), 16384 },
{ 0x0d, 4, 64, M(_SC_LEVEL1_DCACHE_SIZE), 16384 },
+ { 0x0e, 6, 64, M(_SC_LEVEL1_DCACHE_SIZE), 24576 },
{ 0x21, 8, 64, M(_SC_LEVEL2_CACHE_SIZE), 262144 },
{ 0x22, 4, 64, M(_SC_LEVEL3_CACHE_SIZE), 524288 },
{ 0x23, 8, 64, M(_SC_LEVEL3_CACHE_SIZE), 1048576 },
@@ -113,6 +114,7 @@ static const struct intel_02_cache_info
{ 0x7c, 8, 64, M(_SC_LEVEL2_CACHE_SIZE), 1048576 },
{ 0x7d, 8, 64, M(_SC_LEVEL2_CACHE_SIZE), 2097152 },
{ 0x7f, 2, 64, M(_SC_LEVEL2_CACHE_SIZE), 524288 },
+ { 0x80, 8, 64, M(_SC_LEVEL2_CACHE_SIZE), 524288 },
{ 0x82, 8, 32, M(_SC_LEVEL2_CACHE_SIZE), 262144 },
{ 0x83, 8, 32, M(_SC_LEVEL2_CACHE_SIZE), 524288 },
{ 0x84, 8, 32, M(_SC_LEVEL2_CACHE_SIZE), 1048576 },
@@ -452,9 +454,10 @@ __cache_sysconf (int name)
}
-/* Half the data cache size for use in memory and string routines, typically
+/* Data cache size for use in memory and string routines, typically
L1 size. */
long int __x86_64_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
+long int __x86_64_data_cache_size attribute_hidden = 32 * 1024;
/* Shared cache size for use in memory and string routines, typically
L2 or L3 size. */
long int __x86_64_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
@@ -657,7 +660,10 @@ init_cacheinfo (void)
}
if (data > 0)
- __x86_64_data_cache_size_half = data / 2;
+ {
+ __x86_64_data_cache_size_half = data / 2;
+ __x86_64_data_cache_size = data;
+ }
if (shared > 0)
{
diff --git a/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
index e2021cdf8..eb1538abc 100644
--- a/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
+++ b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
@@ -13,5 +13,8 @@ CPUID_ECX_OFFSET offsetof (struct cpuid_registers, ecx)
CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx)
FAMILY_OFFSET offsetof (struct cpu_features, family)
MODEL_OFFSET offsetof (struct cpu_features, model)
+FEATURE_OFFSET offsetof (struct cpu_features, feature)
+FEATURE_SIZE sizeof (unsigned int)
COMMON_CPUID_INDEX_1
+FEATURE_INDEX_1
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.c b/libc/sysdeps/x86_64/multiarch/init-arch.c
index 7823aceb9..50b2a38fb 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.c
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.c
@@ -64,7 +64,23 @@ __init_cpu_features (void)
__cpu_features.model += extended_model;
}
else if (__cpu_features.family == 0x06)
- __cpu_features.model += extended_model;
+ {
+ __cpu_features.model += extended_model;
+ switch (__cpu_features.model)
+ {
+ case 0x1a:
+ case 0x1e:
+ case 0x1f:
+ case 0x25:
+ case 0x2e:
+ case 0x2f:
+ /* Rep string instructions are fast on Intel Core i3, i5
+ and i7. */
+ __cpu_features.feature[index_Fast_Rep_String]
+ |= bit_Fast_Rep_String;
+ break;
+ }
+ }
}
/* This spells out "AuthenticAMD". */
else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.h b/libc/sysdeps/x86_64/multiarch/init-arch.h
index 0f8f77a8a..69492cb3b 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.h
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.h
@@ -16,6 +16,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define bit_Fast_Rep_String (1 << 0)
+
#ifdef __ASSEMBLER__
#include <ifunc-defines.h>
@@ -28,6 +30,8 @@
#define index_SSSE3 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
#define index_SSE4_2 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
+#define index_Fast_Rep_String FEATURE_INDEX_1*FEATURE_SIZE
+
#else /* __ASSEMBLER__ */
#include <sys/param.h>
@@ -39,6 +43,13 @@ enum
COMMON_CPUID_INDEX_MAX
};
+enum
+ {
+ FEATURE_INDEX_1 = 0,
+ /* Keep the following line at the end. */
+ FEATURE_INDEX_MAX
+ };
+
extern struct cpu_features
{
enum
@@ -58,6 +69,7 @@ extern struct cpu_features
} cpuid[COMMON_CPUID_INDEX_MAX];
unsigned int family;
unsigned int model;
+ unsigned int feature[FEATURE_INDEX_MAX];
} __cpu_features attribute_hidden;
@@ -86,4 +98,6 @@ extern const struct cpu_features *__get_cpu_features (void)
#define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 20)
#define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12)
+#define index_Fast_Rep_String FEATURE_INDEX_1
+
#endif /* __ASSEMBLER__ */
diff --git a/libc/sysdeps/x86_64/multiarch/strlen.S b/libc/sysdeps/x86_64/multiarch/strlen.S
index 509f9c960..f9641131f 100644
--- a/libc/sysdeps/x86_64/multiarch/strlen.S
+++ b/libc/sysdeps/x86_64/multiarch/strlen.S
@@ -46,28 +46,58 @@ END(strlen)
__strlen_sse42:
cfi_startproc
CALL_MCOUNT
- pxor %xmm2, %xmm2
- movq %rdi, %rcx
+ pxor %xmm1, %xmm1
+ movl %edi, %ecx
movq %rdi, %r8
andq $~15, %rdi
- movdqa %xmm2, %xmm1
- pcmpeqb (%rdi), %xmm2
- orl $0xffffffff, %esi
- subq %rdi, %rcx
- shll %cl, %esi
- pmovmskb %xmm2, %edx
- andl %esi, %edx
- jnz 1f
-
-2: pcmpistri $0x08, 16(%rdi), %xmm1
- leaq 16(%rdi), %rdi
- jnz 2b
+ xor %edi, %ecx
+ pcmpeqb (%rdi), %xmm1
+ pmovmskb %xmm1, %edx
+ shrl %cl, %edx
+ shll %cl, %edx
+ andl %edx, %edx
+ jnz L(less16bytes)
+ pxor %xmm1, %xmm1
+ .p2align 4
+L(more64bytes_loop):
+ pcmpistri $0x08, 16(%rdi), %xmm1
+ jz L(more32bytes)
+
+ pcmpistri $0x08, 32(%rdi), %xmm1
+ jz L(more48bytes)
+
+ pcmpistri $0x08, 48(%rdi), %xmm1
+ jz L(more64bytes)
+
+ add $64, %rdi
+ pcmpistri $0x08, (%rdi), %xmm1
+ jnz L(more64bytes_loop)
leaq (%rdi,%rcx), %rax
subq %r8, %rax
ret
-1: subq %r8, %rdi
+ .p2align 4
+L(more32bytes):
+ leaq 16(%rdi,%rcx, 1), %rax
+ subq %r8, %rax
+ ret
+
+ .p2align 4
+L(more48bytes):
+ leaq 32(%rdi,%rcx, 1), %rax
+ subq %r8, %rax
+ ret
+
+ .p2align 4
+L(more64bytes):
+ leaq 48(%rdi,%rcx, 1), %rax
+ subq %r8, %rax
+ ret
+
+ .p2align 4
+L(less16bytes):
+ subq %r8, %rdi
bsfl %edx, %eax
addq %rdi, %rax
ret
diff --git a/libc/sysdeps/x86_64/strcmp.S b/libc/sysdeps/x86_64/strcmp.S
index 650ec173b..ac3fe1467 100644
--- a/libc/sysdeps/x86_64/strcmp.S
+++ b/libc/sysdeps/x86_64/strcmp.S
@@ -1,5 +1,5 @@
/* Highly optimized version for x86-64.
- Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009
+ Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on i686 version contributed by Ulrich Drepper
@@ -33,6 +33,13 @@
#endif
#ifdef USE_AS_STRNCMP
+/* The simplified code below is not set up to handle strncmp() so far.
+ Should this become necessary it has to be implemented. For now
+ just report the problem. */
+# ifdef NOT_IN_lib
+# error "strncmp not implemented so far"
+# endif
+
/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
if the new counter > the old one or is 0. */
# define UPDATE_STRNCMP_COUNTER \
@@ -54,7 +61,7 @@
#ifndef USE_SSSE3
.text
#else
- .section .text.ssse3,"ax",@progbits
+ .section .text.ssse3,"ax",@progbits
#endif
ENTRY (BP_SYM (STRCMP))
@@ -80,13 +87,13 @@ END (BP_SYM (STRCMP))
/*
* This implementation uses SSE to compare up to 16 bytes at a time.
*/
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
test %rdx, %rdx
je LABEL(strcmp_exitz)
cmp $1, %rdx
je LABEL(Byte0)
mov %rdx, %r11
-#endif
+# endif
mov %esi, %ecx
mov %edi, %eax
/* Use 64bit AND here to avoid long NOP padding. */
@@ -107,10 +114,10 @@ END (BP_SYM (STRCMP))
pmovmskb %xmm1, %edx
sub $0xffff, %edx /* if first 16 bytes are same, edx == 0xffff */
jnz LABEL(less16bytes) /* If not, find different value or null char */
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz) /* finish comparision */
-#endif
+# endif
add $16, %rsi /* prepare to search next 16 bytes */
add $16, %rdi /* prepare to search next 16 bytes */
@@ -184,10 +191,10 @@ LABEL(loop_ashr_0):
sub $0xffff, %edx
jnz LABEL(exit) /* mismatch or null char seen */
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa (%rsi, %rcx), %xmm1
movdqa (%rdi, %rcx), %xmm2
@@ -198,10 +205,10 @@ LABEL(loop_ashr_0):
pmovmskb %xmm1, %edx
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
jmp LABEL(loop_ashr_0)
@@ -249,13 +256,13 @@ LABEL(gobble_ashr_1):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4 /* store for next cycle */
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $1, %xmm3
pslldq $15, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $1, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -264,10 +271,10 @@ LABEL(gobble_ashr_1):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -278,13 +285,13 @@ LABEL(gobble_ashr_1):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4 /* store for next cycle */
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $1, %xmm3
pslldq $15, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $1, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -293,10 +300,10 @@ LABEL(gobble_ashr_1):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
jmp LABEL(loop_ashr_1)
@@ -312,10 +319,10 @@ LABEL(nibble_ashr_1):
test $0xfffe, %edx
jnz LABEL(ashr_1_exittail) /* find null char*/
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $14, %r11
jbe LABEL(ashr_1_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10 /* substract 4K from %r10 */
@@ -334,7 +341,7 @@ LABEL(ashr_1_exittail):
/*
* The following cases will be handled by ashr_2
- * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
* n(14~15) n -14 1(15 +(n-14) - n) ashr_2
*/
.p2align 4
@@ -376,13 +383,13 @@ LABEL(gobble_ashr_2):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $2, %xmm3
pslldq $14, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $2, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -391,10 +398,10 @@ LABEL(gobble_ashr_2):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -406,13 +413,13 @@ LABEL(gobble_ashr_2):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $2, %xmm3
pslldq $14, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $2, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -421,10 +428,10 @@ LABEL(gobble_ashr_2):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -437,10 +444,10 @@ LABEL(nibble_ashr_2):
test $0xfffc, %edx
jnz LABEL(ashr_2_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $13, %r11
jbe LABEL(ashr_2_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -498,13 +505,13 @@ LABEL(gobble_ashr_3):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $3, %xmm3
pslldq $13, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $3, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -513,10 +520,10 @@ LABEL(gobble_ashr_3):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -528,13 +535,13 @@ LABEL(gobble_ashr_3):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $3, %xmm3
pslldq $13, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $3, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -543,10 +550,10 @@ LABEL(gobble_ashr_3):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -559,10 +566,10 @@ LABEL(nibble_ashr_3):
test $0xfff8, %edx
jnz LABEL(ashr_3_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $12, %r11
jbe LABEL(ashr_3_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -620,13 +627,13 @@ LABEL(gobble_ashr_4):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $4, %xmm3
pslldq $12, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $4, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -635,10 +642,10 @@ LABEL(gobble_ashr_4):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -650,13 +657,13 @@ LABEL(gobble_ashr_4):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $4, %xmm3
pslldq $12, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $4, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -665,10 +672,10 @@ LABEL(gobble_ashr_4):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -681,10 +688,10 @@ LABEL(nibble_ashr_4):
test $0xfff0, %edx
jnz LABEL(ashr_4_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $11, %r11
jbe LABEL(ashr_4_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -700,7 +707,7 @@ LABEL(ashr_4_exittail):
/*
* The following cases will be handled by ashr_5
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(11~15) n - 11 4(15 +(n-11) - n) ashr_5
+ * n(11~15) n - 11 4(15 +(n-11) - n) ashr_5
*/
.p2align 4
LABEL(ashr_5):
@@ -742,13 +749,13 @@ LABEL(gobble_ashr_5):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $5, %xmm3
pslldq $11, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $5, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -757,10 +764,10 @@ LABEL(gobble_ashr_5):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -772,13 +779,13 @@ LABEL(gobble_ashr_5):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $5, %xmm3
pslldq $11, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $5, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -787,10 +794,10 @@ LABEL(gobble_ashr_5):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -803,10 +810,10 @@ LABEL(nibble_ashr_5):
test $0xffe0, %edx
jnz LABEL(ashr_5_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $10, %r11
jbe LABEL(ashr_5_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -822,7 +829,7 @@ LABEL(ashr_5_exittail):
/*
* The following cases will be handled by ashr_6
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(10~15) n - 10 5(15 +(n-10) - n) ashr_6
+ * n(10~15) n - 10 5(15 +(n-10) - n) ashr_6
*/
.p2align 4
LABEL(ashr_6):
@@ -864,13 +871,13 @@ LABEL(gobble_ashr_6):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $6, %xmm3
pslldq $10, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $6, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -879,10 +886,10 @@ LABEL(gobble_ashr_6):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -894,13 +901,13 @@ LABEL(gobble_ashr_6):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $6, %xmm3
pslldq $10, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $6, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -909,10 +916,10 @@ LABEL(gobble_ashr_6):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -925,10 +932,10 @@ LABEL(nibble_ashr_6):
test $0xffc0, %edx
jnz LABEL(ashr_6_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $9, %r11
jbe LABEL(ashr_6_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -944,7 +951,7 @@ LABEL(ashr_6_exittail):
/*
* The following cases will be handled by ashr_7
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(9~15) n - 9 6(15 +(n - 9) - n) ashr_7
+ * n(9~15) n - 9 6(15 +(n - 9) - n) ashr_7
*/
.p2align 4
LABEL(ashr_7):
@@ -986,13 +993,13 @@ LABEL(gobble_ashr_7):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $7, %xmm3
pslldq $9, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $7, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1001,10 +1008,10 @@ LABEL(gobble_ashr_7):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1016,13 +1023,13 @@ LABEL(gobble_ashr_7):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $7, %xmm3
pslldq $9, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $7, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1031,10 +1038,10 @@ LABEL(gobble_ashr_7):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1047,10 +1054,10 @@ LABEL(nibble_ashr_7):
test $0xff80, %edx
jnz LABEL(ashr_7_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $8, %r11
jbe LABEL(ashr_7_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1066,7 +1073,7 @@ LABEL(ashr_7_exittail):
/*
* The following cases will be handled by ashr_8
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(8~15) n - 8 7(15 +(n - 8) - n) ashr_8
+ * n(8~15) n - 8 7(15 +(n - 8) - n) ashr_8
*/
.p2align 4
LABEL(ashr_8):
@@ -1108,13 +1115,13 @@ LABEL(gobble_ashr_8):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $8, %xmm3
pslldq $8, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $8, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1123,10 +1130,10 @@ LABEL(gobble_ashr_8):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1138,13 +1145,13 @@ LABEL(gobble_ashr_8):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $8, %xmm3
pslldq $8, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $8, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1153,10 +1160,10 @@ LABEL(gobble_ashr_8):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1169,10 +1176,10 @@ LABEL(nibble_ashr_8):
test $0xff00, %edx
jnz LABEL(ashr_8_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $7, %r11
jbe LABEL(ashr_8_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1188,7 +1195,7 @@ LABEL(ashr_8_exittail):
/*
* The following cases will be handled by ashr_9
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(7~15) n - 7 8(15 +(n - 7) - n) ashr_9
+ * n(7~15) n - 7 8(15 +(n - 7) - n) ashr_9
*/
.p2align 4
LABEL(ashr_9):
@@ -1230,13 +1237,13 @@ LABEL(gobble_ashr_9):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $9, %xmm3
pslldq $7, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $9, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1245,10 +1252,10 @@ LABEL(gobble_ashr_9):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1260,13 +1267,13 @@ LABEL(gobble_ashr_9):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $9, %xmm3
pslldq $7, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $9, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1275,10 +1282,10 @@ LABEL(gobble_ashr_9):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3 /* store for next cycle */
@@ -1291,10 +1298,10 @@ LABEL(nibble_ashr_9):
test $0xfe00, %edx
jnz LABEL(ashr_9_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $6, %r11
jbe LABEL(ashr_9_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1310,7 +1317,7 @@ LABEL(ashr_9_exittail):
/*
* The following cases will be handled by ashr_10
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(6~15) n - 6 9(15 +(n - 6) - n) ashr_10
+ * n(6~15) n - 6 9(15 +(n - 6) - n) ashr_10
*/
.p2align 4
LABEL(ashr_10):
@@ -1352,13 +1359,13 @@ LABEL(gobble_ashr_10):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $10, %xmm3
pslldq $6, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $10, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1367,10 +1374,10 @@ LABEL(gobble_ashr_10):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1382,13 +1389,13 @@ LABEL(gobble_ashr_10):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $10, %xmm3
pslldq $6, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $10, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1397,10 +1404,10 @@ LABEL(gobble_ashr_10):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1413,10 +1420,10 @@ LABEL(nibble_ashr_10):
test $0xfc00, %edx
jnz LABEL(ashr_10_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $5, %r11
jbe LABEL(ashr_10_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1432,7 +1439,7 @@ LABEL(ashr_10_exittail):
/*
* The following cases will be handled by ashr_11
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(5~15) n - 5 10(15 +(n - 5) - n) ashr_11
+ * n(5~15) n - 5 10(15 +(n - 5) - n) ashr_11
*/
.p2align 4
LABEL(ashr_11):
@@ -1474,13 +1481,13 @@ LABEL(gobble_ashr_11):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $11, %xmm3
pslldq $5, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $11, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1489,10 +1496,10 @@ LABEL(gobble_ashr_11):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1504,13 +1511,13 @@ LABEL(gobble_ashr_11):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $11, %xmm3
pslldq $5, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $11, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1519,10 +1526,10 @@ LABEL(gobble_ashr_11):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1535,10 +1542,10 @@ LABEL(nibble_ashr_11):
test $0xf800, %edx
jnz LABEL(ashr_11_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $4, %r11
jbe LABEL(ashr_11_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1554,7 +1561,7 @@ LABEL(ashr_11_exittail):
/*
* The following cases will be handled by ashr_12
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(4~15) n - 4 11(15 +(n - 4) - n) ashr_12
+ * n(4~15) n - 4 11(15 +(n - 4) - n) ashr_12
*/
.p2align 4
LABEL(ashr_12):
@@ -1596,13 +1603,13 @@ LABEL(gobble_ashr_12):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $12, %xmm3
pslldq $4, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $12, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1611,10 +1618,10 @@ LABEL(gobble_ashr_12):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1626,13 +1633,13 @@ LABEL(gobble_ashr_12):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $12, %xmm3
pslldq $4, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $12, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1641,10 +1648,10 @@ LABEL(gobble_ashr_12):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1657,10 +1664,10 @@ LABEL(nibble_ashr_12):
test $0xf000, %edx
jnz LABEL(ashr_12_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $3, %r11
jbe LABEL(ashr_12_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1676,7 +1683,7 @@ LABEL(ashr_12_exittail):
/*
* The following cases will be handled by ashr_13
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(3~15) n - 3 12(15 +(n - 3) - n) ashr_13
+ * n(3~15) n - 3 12(15 +(n - 3) - n) ashr_13
*/
.p2align 4
LABEL(ashr_13):
@@ -1718,13 +1725,13 @@ LABEL(gobble_ashr_13):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $13, %xmm3
pslldq $3, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $13, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1733,10 +1740,10 @@ LABEL(gobble_ashr_13):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1748,13 +1755,13 @@ LABEL(gobble_ashr_13):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $13, %xmm3
pslldq $3, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $13, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1763,10 +1770,10 @@ LABEL(gobble_ashr_13):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1779,10 +1786,10 @@ LABEL(nibble_ashr_13):
test $0xe000, %edx
jnz LABEL(ashr_13_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $2, %r11
jbe LABEL(ashr_13_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1798,7 +1805,7 @@ LABEL(ashr_13_exittail):
/*
* The following cases will be handled by ashr_14
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(2~15) n - 2 13(15 +(n - 2) - n) ashr_14
+ * n(2~15) n - 2 13(15 +(n - 2) - n) ashr_14
*/
.p2align 4
LABEL(ashr_14):
@@ -1840,13 +1847,13 @@ LABEL(gobble_ashr_14):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $14, %xmm3
pslldq $2, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $14, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1855,10 +1862,10 @@ LABEL(gobble_ashr_14):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1870,13 +1877,13 @@ LABEL(gobble_ashr_14):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $14, %xmm3
pslldq $2, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $14, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1885,10 +1892,10 @@ LABEL(gobble_ashr_14):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1901,10 +1908,10 @@ LABEL(nibble_ashr_14):
test $0xc000, %edx
jnz LABEL(ashr_14_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
cmp $1, %r11
jbe LABEL(ashr_14_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -1920,7 +1927,7 @@ LABEL(ashr_14_exittail):
/*
* The following cases will be handled by ashr_15
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
- * n(1~15) n - 1 14(15 +(n - 1) - n) ashr_15
+ * n(1~15) n - 1 14(15 +(n - 1) - n) ashr_15
*/
.p2align 4
LABEL(ashr_15):
@@ -1964,13 +1971,13 @@ LABEL(gobble_ashr_15):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $15, %xmm3
pslldq $1, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $15, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -1979,10 +1986,10 @@ LABEL(gobble_ashr_15):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -1994,13 +2001,13 @@ LABEL(gobble_ashr_15):
movdqa (%rdi, %rcx), %xmm2
movdqa %xmm2, %xmm4
-#ifndef USE_SSSE3
+# ifndef USE_SSSE3
psrldq $15, %xmm3
pslldq $1, %xmm2
por %xmm3, %xmm2 /* merge into one 16byte value */
-#else
+# else
palignr $15, %xmm3, %xmm2 /* merge into one 16byte value */
-#endif
+# endif
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm1
@@ -2009,10 +2016,10 @@ LABEL(gobble_ashr_15):
sub $0xffff, %edx
jnz LABEL(exit)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub $16, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
add $16, %rcx
movdqa %xmm4, %xmm3
@@ -2025,10 +2032,10 @@ LABEL(nibble_ashr_15):
test $0x8000, %edx
jnz LABEL(ashr_15_exittail)
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
test %r11, %r11
je LABEL(ashr_15_exittail)
-#endif
+# endif
pxor %xmm0, %xmm0
sub $0x1000, %r10
@@ -2062,10 +2069,10 @@ LABEL(ret):
LABEL(less16bytes):
bsf %rdx, %rdx /* find and store bit index in %rdx */
-#ifdef USE_AS_STRNCMP
+# ifdef USE_AS_STRNCMP
sub %rdx, %r11
jbe LABEL(strcmp_exitz)
-#endif
+# endif
movzbl (%rsi, %rdx), %ecx
movzbl (%rdi, %rdx), %eax
diff --git a/libc/termios/termios.h b/libc/termios/termios.h
index 9698b1fbd..fdde6d352 100644
--- a/libc/termios/termios.h
+++ b/libc/termios/termios.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-1999,2003,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
#define _TERMIOS_H 1
#include <features.h>
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
/* We need `pid_t'. */
# include <bits/types.h>
# ifndef __pid_t_defined
diff --git a/libc/time/alt_digit.c b/libc/time/alt_digit.c
index 95e4f07c7..923891114 100644
--- a/libc/time/alt_digit.c
+++ b/libc/time/alt_digit.c
@@ -1,5 +1,5 @@
/* Helper functions used by strftime/strptime to handle alternate digits.
- Copyright (C) 1995-2002, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2008, 2010 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,7 +31,7 @@ __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
((wchar_t *) current->values[_NL_ITEM_INDEX (item)].wstr)
static void
-_nl_init_alt_digit (struct locale_data *current)
+_nl_init_alt_digit (struct __locale_data *current)
{
struct lc_time_data *data;
@@ -70,7 +70,7 @@ _nl_init_alt_digit (struct locale_data *current)
const char *
internal_function
-_nl_get_alt_digit (unsigned int number, struct locale_data *current)
+_nl_get_alt_digit (unsigned int number, struct __locale_data *current)
{
const char *result;
@@ -96,7 +96,7 @@ _nl_get_alt_digit (unsigned int number, struct locale_data *current)
const wchar_t *
internal_function
-_nl_get_walt_digit (unsigned int number, struct locale_data *current)
+_nl_get_walt_digit (unsigned int number, struct __locale_data *current)
{
const wchar_t *result = NULL;
struct lc_time_data *data;
@@ -149,7 +149,7 @@ _nl_get_walt_digit (unsigned int number, struct locale_data *current)
int
internal_function
-_nl_parse_alt_digit (const char **strp, struct locale_data *current)
+_nl_parse_alt_digit (const char **strp, struct __locale_data *current)
{
const char *str = *strp;
int result = -1;
diff --git a/libc/time/asctime.c b/libc/time/asctime.c
index dc4fd54f4..8cf266a3f 100644
--- a/libc/time/asctime.c
+++ b/libc/time/asctime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1995-1997,2000,2002,2005
+/* Copyright (C) 1991,1993,1995-1997,2000,2002,2005,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,12 +24,12 @@
#include <time.h>
/* This is defined in locale/C-time.c in the GNU libc. */
-extern const struct locale_data _nl_C_LC_TIME attribute_hidden;
+extern const struct __locale_data _nl_C_LC_TIME attribute_hidden;
#define ab_day_name(DAY) (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)+(DAY)].string)
#define ab_month_name(MON) (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)+(MON)].string)
static const char format[] = "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n";
-static char result[ 3+1+ 3+1+20+1+20+1+20+1+20+1+20+1 + 1];
+static char result[ 3+1+ 3+1+20+1+20+1+20+1+20+1+20+1 + 1];
static char *
diff --git a/libc/time/era.c b/libc/time/era.c
index a6f4a4cb0..6630747cc 100644
--- a/libc/time/era.c
+++ b/libc/time/era.c
@@ -1,5 +1,5 @@
/* Helper functions used by strftime/strptime to handle locale-specific "eras".
- Copyright (C) 1995-2002, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2008, 2010 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,7 +36,7 @@ __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
/* Look up the era information in CURRENT's locale strings and
cache it in CURRENT->private. */
static void internal_function
-_nl_init_era_entries (struct locale_data *current)
+_nl_init_era_entries (struct __locale_data *current)
{
size_t cnt;
struct lc_time_data *data;
@@ -83,7 +83,7 @@ _nl_init_era_entries (struct locale_data *current)
data->num_eras = 0;
data->eras = NULL;
}
- else
+ else
{
const char *ptr = CURRENT (_NL_TIME_ERA_ENTRIES);
data->num_eras = new_num_eras;
@@ -140,7 +140,7 @@ _nl_init_era_entries (struct locale_data *current)
struct era_entry *
internal_function
-_nl_get_era_entry (const struct tm *tp, struct locale_data *current)
+_nl_get_era_entry (const struct tm *tp, struct __locale_data *current)
{
if (current->private.time == NULL || !current->private.time->era_initialized)
_nl_init_era_entries (current);
@@ -167,7 +167,7 @@ _nl_get_era_entry (const struct tm *tp, struct locale_data *current)
struct era_entry *
internal_function
-_nl_select_era_entry (int cnt, struct locale_data *current)
+_nl_select_era_entry (int cnt, struct __locale_data *current)
{
if (current->private.time == NULL || !current->private.time->era_initialized)
_nl_init_era_entries (current);
diff --git a/libc/time/lc-time-cleanup.c b/libc/time/lc-time-cleanup.c
index 6777f487a..aa91e3eb2 100644
--- a/libc/time/lc-time-cleanup.c
+++ b/libc/time/lc-time-cleanup.c
@@ -1,5 +1,5 @@
/* Cleanup code for data structures kept by strftime/strptime helper functions.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
#include <stdlib.h>
void internal_function
-_nl_cleanup_time (struct locale_data *locale)
+_nl_cleanup_time (struct __locale_data *locale)
{
struct lc_time_data *const data = locale->private.time;
if (data != NULL)
diff --git a/libc/time/strftime_l.c b/libc/time/strftime_l.c
index fcc57d59f..93974a4ab 100644
--- a/libc/time/strftime_l.c
+++ b/libc/time/strftime_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2007-2009, 2010 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
@@ -506,7 +506,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
LOCALE_PARAM_DECL
{
#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
- struct locale_data *const current = loc->__locales[LC_TIME];
+ struct __locale_data *const current = loc->__locales[LC_TIME];
#endif
int hour12 = tp->tm_hour;
diff --git a/libc/time/strptime_l.c b/libc/time/strptime_l.c
index 58741b78b..2559cc35f 100644
--- a/libc/time/strptime_l.c
+++ b/libc/time/strptime_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2004,2005,2007,2008,2010 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
@@ -120,7 +120,7 @@ localtime_r (t, tp)
#ifdef _LIBC
/* This is defined in locale/C-time.c in the GNU libc. */
-extern const struct locale_data _nl_C_LC_TIME attribute_hidden;
+extern const struct __locale_data _nl_C_LC_TIME attribute_hidden;
# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
# define ab_weekday_name \
@@ -250,7 +250,7 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
LOCALE_PARAM_DECL
{
#ifdef _LIBC
- struct locale_data *const current = locale->__locales[LC_TIME];
+ struct __locale_data *const current = locale->__locales[LC_TIME];
#endif
const char *rp_backup;
diff --git a/libc/wcsmbs/wcsmbsload.c b/libc/wcsmbs/wcsmbsload.c
index 6061e4200..faa2a5b40 100644
--- a/libc/wcsmbs/wcsmbsload.c
+++ b/libc/wcsmbs/wcsmbsload.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2002,2004,2005,2008 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2002,2004,2005,2008,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -152,7 +152,7 @@ __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
/* Load conversion functions for the currently selected locale. */
void
internal_function
-__wcsmbs_load_conv (struct locale_data *new_category)
+__wcsmbs_load_conv (struct __locale_data *new_category)
{
/* Acquire the lock. */
__libc_rwlock_wrlock (__libc_setlocale_lock);
@@ -266,7 +266,7 @@ __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
}
void internal_function
-_nl_cleanup_ctype (struct locale_data *locale)
+_nl_cleanup_ctype (struct __locale_data *locale)
{
const struct gconv_fcts *const data = locale->private.ctype;
if (data != NULL)
diff --git a/libc/wcsmbs/wcsmbsload.h b/libc/wcsmbs/wcsmbsload.h
index 0cf5da4f8..e2b1bfa9c 100644
--- a/libc/wcsmbs/wcsmbsload.h
+++ b/libc/wcsmbs/wcsmbsload.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2002, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -38,7 +38,7 @@ struct gconv_fcts
extern const struct gconv_fcts __wcsmbs_gconv_fcts_c attribute_hidden;
/* Load conversion functions for the currently selected locale. */
-extern void __wcsmbs_load_conv (struct locale_data *new_category)
+extern void __wcsmbs_load_conv (struct __locale_data *new_category)
internal_function;
/* Clone the current `__wcsmbs_load_conv' value. */
@@ -50,7 +50,7 @@ extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
internal_function;
/* Function used for the `private.cleanup' hook. */
-extern void _nl_cleanup_ctype (struct locale_data *)
+extern void _nl_cleanup_ctype (struct __locale_data *)
internal_function attribute_hidden;
@@ -62,12 +62,12 @@ extern struct __gconv_step *__wcsmbs_getfct (const char *to, const char *from,
size_t *nstepsp)
attribute_hidden;
-extern const struct locale_data _nl_C_LC_CTYPE attribute_hidden;
+extern const struct __locale_data _nl_C_LC_CTYPE attribute_hidden;
/* Check whether the LC_CTYPE locale changed since the last call.
Update the pointers appropriately. */
static inline const struct gconv_fcts *
-get_gconv_fcts (struct locale_data *data)
+get_gconv_fcts (struct __locale_data *data)
{
if (__builtin_expect (data->private.ctype == NULL, 0))
{
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index db1e93c11..9f3ee5391 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,9 @@
+2010-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/arm/bits/fcntl.h: Define O_DIRECTORY,
+ O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN for
+ XPG7.
+
2009-12-16 Thomas Schwinge <thomas@codesourcery.com>
* sysdeps/arm/eabi/Makefile [gmon] (sysdep_routines): Add arm-mcount.
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
index 978cd1a88..cdc9242e4 100644
--- a/ports/ChangeLog.m68k
+++ b/ports/ChangeLog.m68k
@@ -1,3 +1,16 @@
+2010-01-11 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Fix double-inclusion
+ problem.
+
+2010-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Define O_DIRECTORY,
+ O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN for
+ XPG7.
+ * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Enable using from
+ fcntl.h.
+
2009-12-16 Joseph Myers <joseph@codesourcery.com>
[BZ #11093]
diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips
index 68ba90da5..5795926d3 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,3 +1,21 @@
+2010-01-11 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/bits/stat.h: Fix double-inclusion
+ problem.
+
+2010-01-11 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Define
+ SA_RESTART, SA_NODEFER and SA_RESETHAND if __USE_XOPEN2K8.
+
+2010-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Define O_DIRECTORY,
+ O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN for
+ XPG7.
+ * sysdeps/unix/sysv/linux/mips/bits/stat.h: Enable using from
+ fcntl.h.
+
2009-12-16 Joseph Myers <joseph@codesourcery.com>
[BZ #11093]
diff --git a/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
index 4971473c0..77d6c5c76 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2009
+ Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -45,12 +45,14 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 040000 /* Must be a directory. */
# define O_NOFOLLOW 0100000 /* Do not follow links. */
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
+#endif
+#ifdef __USE_GNU
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -84,7 +86,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
@@ -100,6 +102,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
index 1f98cf583..d1eb706c6 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000, 2004, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,12 +44,14 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
# define O_DIRECTORY 040000 /* Must be a directory. */
# define O_NOFOLLOW 0100000 /* Do not follow links. */
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
+#endif
+#ifdef __USE_GNU
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -83,7 +85,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
#endif
@@ -99,6 +101,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
index 780104365..0c1d149d8 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002,2008,2009
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002,2008,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,10 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -167,3 +170,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */
diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 24fb97407..37fb7e02c 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -1,6 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2006,
- 2007, 2009 Free Software Foundation, Inc.
+ 2007, 2009, 2010 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,13 +46,15 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 0x1000
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
# define O_NOFOLLOW 0x20000 /* Do not follow links. */
-# define O_DIRECT 0x8000 /* Direct disk access hint. */
# define O_DIRECTORY 0x10000 /* Must be a directory. */
-# define O_NOATIME 0x40000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
+#ifdef __USE_GNU
+# define O_DIRECT 0x8000 /* Direct disk access hint. */
+# define O_NOATIME 0x40000 /* Do not set atime. */
+#endif
/* For now Linux has no synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
@@ -86,7 +88,7 @@
#define F_SETLK64 34 /* Set record locking info (non-blocking). */
#define F_SETLKW64 35 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
# define F_SETOWN 24 /* Get owner (process receiving SIGIO). */
# define F_GETOWN 23 /* Set owner (process receiving SIGIO). */
#endif
@@ -102,6 +104,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#endif
+#ifdef __USE_XOPEN2K8
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
close-on-exit set. */
#endif
diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/sigaction.h b/ports/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
index d04e25f76..ecddaf655 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
@@ -1,5 +1,5 @@
/* The proper definitions for Linux/MIPS's sigaction.
- Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2003
+ Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2003, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -64,6 +64,8 @@ struct sigaction
three arguments instead of one. */
#if defined __USE_UNIX98 || defined __USE_MISC
# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */
# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when
diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/stat.h b/ports/sysdeps/unix/sysv/linux/mips/bits/stat.h
index 7eb86a4cc..e8b016c94 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -1,5 +1,5 @@
/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
- 2007, 2009 Free Software Foundation, Inc.
+ 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,10 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _SYS_STAT_H
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
#include <sgidefs.h>
/* Versions of the `struct stat' data structure. */
@@ -258,3 +261,5 @@ struct stat64
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
+
+#endif /* bits/stat.h */