summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <aschwab@redhat.com>2009-06-26 13:14:24 +0200
committerAndreas Schwab <aschwab@redhat.com>2009-06-26 13:14:24 +0200
commita879c2cb1753c3aa868aa1e9d2107e9f0deb0dc2 (patch)
treea919978ad8a178a0e6013f1ee43ab54f60a13493
parent5f9df8e7b478cafd4528a133201f4611a963292e (diff)
parent44d20bca52ace85850012b0ead37b360e3ecd96e (diff)
Merge commit 'origin/master' into fedora/master
-rw-r--r--ChangeLog203
-rw-r--r--Makeconfig16
-rwxr-xr-xdebug/xtrace.sh2
-rw-r--r--elf/Makefile109
-rw-r--r--elf/ifuncdep5.c3
-rw-r--r--elf/ifuncdep5pic.c3
-rw-r--r--elf/ifuncmain1staticpie.c3
-rw-r--r--elf/ifuncmain5.c40
-rw-r--r--elf/ifuncmain5pic.c3
-rw-r--r--elf/ifuncmain5picstatic.c3
-rw-r--r--elf/ifuncmain5pie.c3
-rw-r--r--elf/ifuncmain5static.c3
-rw-r--r--elf/ifuncmain5staticpic.c3
-rw-r--r--elf/ifuncmain6pie.c63
-rw-r--r--elf/ifuncmain7.c70
-rw-r--r--elf/ifuncmain7pic.c7
-rw-r--r--elf/ifuncmain7picstatic.c7
-rw-r--r--elf/ifuncmain7pie.c7
-rw-r--r--elf/ifuncmain7static.c7
-rw-r--r--elf/ifuncmod5.c78
-rw-r--r--elf/ifuncmod6.c19
-rw-r--r--elf/sln.c4
-rw-r--r--libio/Makefile1
-rw-r--r--localedata/ChangeLog6
-rw-r--r--localedata/locales/de_AT3
-rw-r--r--login/Makefile20
-rw-r--r--login/programs/pt_chown.c45
-rw-r--r--malloc/malloc.c29
-rwxr-xr-xmalloc/memusage.sh2
-rw-r--r--nis/nss_compat/compat-initgroups.c200
-rw-r--r--nscd/Makefile11
-rw-r--r--nss/getent.c4
-rw-r--r--po/bg.po16
-rw-r--r--po/id.po10
-rw-r--r--posix/getconf.c4
-rw-r--r--resolv/res_init.c3
-rw-r--r--resolv/res_send.c68
-rw-r--r--resolv/resolv.h2
-rw-r--r--string/strncmp.c12
-rw-r--r--string/test-memchr.c9
-rw-r--r--sunrpc/rpcinfo.c4
-rw-r--r--sysdeps/generic/pty-private.h5
-rw-r--r--sysdeps/powerpc/powerpc32/____longjmp_chk.S23
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S4
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S4
-rw-r--r--sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S4
-rw-r--r--sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S4
-rw-r--r--sysdeps/powerpc/powerpc32/power6/memcpy.S56
-rw-r--r--sysdeps/powerpc/powerpc32/power6/memset.S6
-rw-r--r--sysdeps/unix/grantpt.c28
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h6
-rw-r--r--sysdeps/unix/sysv/linux/grantpt.c88
-rw-r--r--sysdeps/unix/sysv/linux/lddlibc4.c4
-rw-r--r--sysdeps/unix/sysv/linux/net/if_arp.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/socket.h16
-rw-r--r--sysdeps/x86_64/memchr.S6
-rw-r--r--sysdeps/x86_64/multiarch/Makefile4
-rw-r--r--sysdeps/x86_64/multiarch/init-arch.h3
-rw-r--r--sysdeps/x86_64/multiarch/strcmp.S1677
-rw-r--r--sysdeps/x86_64/multiarch/strncmp-c.c8
-rw-r--r--sysdeps/x86_64/multiarch/strncmp.S3
-rw-r--r--time/tzfile.c4
62 files changed, 2741 insertions, 321 deletions
diff --git a/ChangeLog b/ChangeLog
index d6b66bad7a..00c46a1038 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,206 @@
+2009-06-26 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/resolv.h: Define RES_SNGLKUPREOP.
+ * resolv/res_init.c (res_setoptions): Recognize single-request-reopen
+ option.
+ * resolv/res_send.c (reopen): New function. Broken out of...
+ (send_dg): ... here. Recognize RES_SNGLKUPREOP. Implement second
+ fallback mechanism. If single-request fails switch to
+ single-request-reopen mode which opens a new socket for the second
+ request.
+
+2009-06-25 Andreas Schwab <aschwab@redhat.com>
+
+ * sysdeps/powerpc/powerpc32/____longjmp_chk.S (LOAD_ARG): Define.
+ (CHECK_SP): Use it.
+
+2009-06-24 Andreas Schwab <aschwab@redhat.com>
+
+ * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S: Fix cfa offset
+ for saved registers.
+ * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S: Likewise.
+
+2009-06-23 Andreas Schwab <aschwab@redhat.com>
+
+ * time/tzfile.c (__tzfile_read): Don't use an empty TZ string.
+
+2009-06-22 Ulrich Drepper <drepper@redhat.com>
+
+ * po/id.po: Update from translation team.
+
+ * po/bg.po: Update from translation team.
+
+2009-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * string/strncmp.c (STRNCMP): New. Defined to strncmp if not
+ defined.
+ (strncmp): Renamed to STRNCMP.
+ * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+ strncmp-c for string.
+ * sysdeps/x86_64/multiarch/init-arch.h (HAS_SSE4_2): Define.
+ * sysdeps/x86_64/multiarch/strcmp.S: New file.
+ * sysdeps/x86_64/multiarch/strncmp.S: New file.
+ * sysdeps/x86_64/multiarch/strncmp-c.c: New file.
+
+2009-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/Makefile (distribute): Add ifuncmain1staticpie.c,
+ ifuncmain5.c, ifuncmain5pic.c, ifuncmain5picstatic.c,
+ ifuncmain5pie.c, ifuncmain5static.c, ifuncmain5staticpic.c,
+ ifuncdep5.c, ifuncdep5pic.c, ifuncmod5.c, ifuncmain7.c,
+ ifuncmain7pic.c, ifuncmain7picstatic.c, ifuncmain7pie.c, and
+ ifuncmain7static.c.
+ (tests-static): Add ifuncmain5static, ifuncmain5picstatic,
+ ifuncmain7static, and ifuncmain7picstatic.
+ (tests): Also depend on $(objpfx)ifuncmain1staticpie.out,
+ $(objpfx)ifuncmain5pie.out, $(objpfx)ifuncmain6pie.out, and
+ $(objpfx)ifuncmain7pie.out.
+ (modules-names): Add ifuncmod5 ifuncmod6
+ (ifuncmod5.so-no-z-defs): Define.
+ (ifuncmod6.so-no-z-defs): Define.
+ (CFLAGS-ifuncmain5pic.c): Define.
+ (CFLAGS-ifuncmain5picstatic.c): Define.
+ (CFLAGS-ifuncmain5staticpic.c): Define.
+ (CFLAGS-ifuncdep5pic.c): Define.
+ (CFLAGS-ifuncmain7pic.c): Define.
+ (CFLAGS-ifuncmain7picstatic.c): Define.
+ (CFLAGS-ifuncmain1staticpie.c): Define.
+ (CFLAGS-ifuncmain5pie.c): Define.
+ (CFLAGS-ifuncmain6pie.c): Define.
+ (CFLAGS-ifuncmain7pie.c): Define.
+ ($(objpfx)ifuncmain1staticpie.out): Define.
+ ($(objpfx)ifuncmain1staticpie): Define.
+ ($(objpfx)ifuncmain5pie.out): Define.
+ ($(objpfx)ifuncmain5pie): Define.
+ ($(objpfx)ifuncmain6pie.out): Define.
+ ($(objpfx)ifuncmain6pie): Define.
+ ($(objpfx)ifuncmain5): Define.
+ ($(objpfx)ifuncmain5pic): Define.
+ ($(objpfx)ifuncmain5static): Define.
+ ($(objpfx)ifuncmain5staticpic): Define.
+ ($(objpfx)ifuncmain5picstatic): Define.
+ (generated): Add ifuncmain1staticpie, ifuncmain1staticpie.out,
+ ifuncmain5pie, ifuncmain5pie.out, ifuncmain6pie, and
+ ifuncmain6pie.out.
+ * elf/b/elf/ifuncmain1staticpie.c: New file.
+ * elf/ifuncdep5.c: New file.
+ * elf/ifuncdep5pic.c: New file.
+ * elf/ifuncmain5.c: New file.
+ * elf/ifuncmain5pic.c: New file.
+ * elf/ifuncmain5picstatic.c: New file.
+ * elf/ifuncmain5pie.c: New file.
+ * elf/ifuncmain5static.c: New file.
+ * elf/ifuncmain5staticpic.c: New file.
+ * elf/ifuncmain6pie.c: New file.
+ * elf/ifuncmain7.c: New file.
+ * elf/ifuncmain7pic.c: New file.
+ * elf/ifuncmain7picstatic.c: New file.
+ * elf/ifuncmain7pie.c: New file.
+ * elf/ifuncmain7static.c: New file.
+ * elf/ifuncmod5.c: New file.
+ * elf/ifuncmod6.c: New file.
+
+2009-06-20 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10085]
+ * nis/nss_compat/compat-initgroups.c (nss_setgrent): New variable.
+ (nss_endgrent): New variable.
+ (struct ent_t): Add need_endgrent and skip_initgroups_dyn
+ fields. Change type of files to bool and adjust all users.
+ (init_nss_interface): Initialize nss_setgrent and nss_endgrent.
+ (internal_endgrent): Call nss_endgrent if necessary.
+ (add_group): New function. Broken out of...
+ (check_and_add_group): ...here.
+ (getgrent_next_nss): Remove test that any callback is available.
+ Use skip_initgroups_dyn to determine whether to use initgroups_dyn
+ callback. If there is no blacklist we can trust the results returned
+ by the initgroups_dyn callback. In case there is a callback and we
+ find a group entry for the group ID but it doesn't contain the
+ correct member, switch to the slow mode and use getgrent_r.
+ (internal_getgrent_r): When we see a +: entry, determine whether
+ there is any callback and which we can use the initgroups_dyn
+ callback.
+
+2009-06-18 Ulrich Drepper <drepper@redhat.com>
+
+ * malloc/malloc.c (_int_malloc): Add some consistency checks.
+ (_int_free): Likewise.
+
+ * sysdeps/unix/sysv/linux/bits/socket.h: Define PF_IEEE802154 and
+ AF_IEEE802154.
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Likewise.
+ * sysdeps/unix/sysv/linux/net/if_arp.h: Define ARPHRD_IEEE802154
+ and ARPHRD_IEEE802154_PHY.
+
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Add missing definitions
+ relative to generic Linux version.
+
+2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/Makefile ($(objpfx)ifuncmain1pie): Use $(+link-pie).
+ ($(objpfx)ifuncmain1vispie): Likewise.
+
+2009-06-16 Ulrich Drepper <drepper@redhat.com>
+
+ * login/Makefile: Build pt_chown as PIE.
+
+2009-06-15 Andreas Schwab <aschwab@redhat.com>
+
+ * debug/xtrace.sh (do_help): Don't treat bug reporting message as
+ a format string.
+ * elf/sln.c (usage): Likewise.
+ * malloc/memusage.sh (do_help): Likewise.
+ * nss/getent.c (more_help): Likewise.
+ * posix/getconf.c (main): Likewise.
+ * sunrpc/rpcinfo.c (usage): Likewise.
+ * sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
+
+2009-06-16 Ulrich Drepper <drepper@redhat.com>
+
+ * login/programs/pt_chown.c: Use libcap to drop privileges other than
+ those needed.
+ * login/Makefile: If necessary link pt_chown with -lcap.
+ * sysdeps/generic/pty-private.h: Define FAIL_ENOMEM.
+ * sysdeps/unix/grantpt.c: Handle FAIL_ENOMEM.
+
+2009-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/x86_64/memchr.S (memchr): Use unsigned instead of signed
+ comparisons.
+ * string/test-memchr.c (do_random_tests): Test very large lengths
+ as well.
+
+2009-06-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makeconfig (+link-pie): Define.
+ (+prectorS): Define.
+ (+postctorS): Define.
+ * elf/Makefile ($(objpfx)tst-pie1): Use $(+link-pie).
+ * nscd/Makefile ($(objpfx)nscd): Likewise.
+
+2009-04-22 Ryan S. Arnold <rsa@us.ibm.com>
+
+ [BZ #10107]
+ * sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Replace cmpldi
+ with cmplwi.
+ * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise.
+
+2009-06-16 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/grantpt.c: Remove file after folding changes
+ into ...
+ * sysdeps/unix/grantpt.c: ...here.
+
2009-06-15 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/grantpt.c (grantpt): Only call chown and
chmod if it is necessary.
[BZ #10166]
- * sysdeps/unix/sysv/linux/grantpt.c: If slave device is on devpts or
- devfs, the mode might not be correct. Check it and return only if it
- is correct.
+ * sysdeps/unix/sysv/linux/grantpt.c: Remove shortcut which was used
+ when the slave device is in devpts or devfs.
[BZ #10183]
* posix/tst-cpucount.c: Don't try more than CPU_SETSIZE bits.
@@ -17,7 +211,7 @@
Patch by Arnaud Ebalard <arno@natisbad.org>.
[BZ #10207]
- * nss/getent.c: Add support for print gshadow data.
+ * nss/getent.c: Add support for printing gshadow data.
[BZ #10203]
* nis/nss_nis/nis-pwd.c (internal_nis_endpwent): Free all buffers,
@@ -26,6 +220,7 @@
[BZ #10196]
* libio/tst-fgetwc.c (do_test): Use de_DE.UTF-8 as locale name.
+ * libio/Makefile: Run tst-fgetwc with necessary envvar.
Patch by Bruce Dubbs <bdubbs@linuxfromscratch.org>.
[BZ #10217]
diff --git a/Makeconfig b/Makeconfig
index 875fb679aa..9f134cc137 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -434,6 +434,19 @@ ifndef +link
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
endif
+# Command for linking PIE programs with the C library.
+ifndef +link-pie
++link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+ $(addprefix $(csu-objpfx),S$(start-installed-name)) \
+ $(+preinit) $(+prectorS) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ S$(start-installed-name))\
+ $(+preinit) $(link-extra-libs) \
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+endif
# Command for statically linking programs with the C library.
ifndef +link-static
+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
@@ -538,6 +551,9 @@ ifeq ($(elf),yes)
+postinit = $(addprefix $(csu-objpfx),crtn.o)
+prector = `$(CC) --print-file-name=crtbegin.o`
+postctor = `$(CC) --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`
+interp = $(addprefix $(elf-objpfx),interp.os)
endif
csu-objpfx = $(common-objpfx)csu/
diff --git a/debug/xtrace.sh b/debug/xtrace.sh
index e3b9daa433..8ef507ef38 100755
--- a/debug/xtrace.sh
+++ b/debug/xtrace.sh
@@ -55,7 +55,7 @@ Mandatory arguments to long options are also mandatory for any corresponding
short options.
"
- printf $"For bug reporting instructions, please see:
+ echo $"For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
"
exit 0
diff --git a/elf/Makefile b/elf/Makefile
index 6bcbb5142f..56935d5a1a 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -99,10 +99,18 @@ distribute := rtld-Rules \
ifuncmain1staticpic.c ifuncmain1picstatic.c \
ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \
ifuncmain1pie.c ifuncmain1vispie.c \
+ ifuncmain1staticpie.c \
ifuncmain2.c ifuncmain2static.c ifuncdep2.c \
ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \
ifuncmain3.c ifuncmod3.c \
- ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c
+ ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \
+ ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \
+ ifuncmain5pie.c ifuncmain5static.c \
+ ifuncmain5staticpic.c \
+ ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
+ ifuncmain6pie.c ifuncmod6.c \
+ ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
+ ifuncmain7pie.c ifuncmain7static.c
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -244,16 +252,22 @@ modules-names-nobuild := filtmod1
ifeq (yes,$(multi-arch))
tests-static += ifuncmain1static ifuncmain1picstatic \
ifuncmain2static ifuncmain2picstatic \
- ifuncmain4static ifuncmain4picstatic
+ ifuncmain4static ifuncmain4picstatic \
+ ifuncmain5static ifuncmain5picstatic \
+ ifuncmain7static ifuncmain7picstatic
ifeq (yes,$(build-shared))
tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
ifuncmain1staticpic \
- ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4
+ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
+ ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
+ ifuncmain7 ifuncmain7pic
ifeq (yes,$(have-fpie))
-tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out
+tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out \
+ $(objpfx)ifuncmain1staticpie.out $(objpfx)ifuncmain5pie.out \
+ $(objpfx)ifuncmain6pie.out $(objpfx)ifuncmain7pie.out
endif
-modules-names += ifuncmod1 ifuncmod3
+modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
endif
endif
@@ -530,6 +544,8 @@ reldep9mod1.so-no-z-defs = yes
unload3mod4.so-no-z-defs = yes
unload4mod1.so-no-z-defs = yes
ifuncmod1.so-no-z-defs = yes
+ifuncmod5.so-no-z-defs = yes
+ifuncmod6.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
@@ -852,14 +868,7 @@ $(objpfx)tst-pie1.out: $(objpfx)tst-pie1
$< > $@
$(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
- $(LINK.o) -pie -Wl,-O1 \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- $(LDFLAGS) $(LDFLAGS-$(@F)) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
- -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
- $(common-objpfx)libc_nonshared.a
+ $(+link-pie)
generated += tst-pie1 tst-pie1.out tst-pie1.o
endif
@@ -987,12 +996,22 @@ CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
+CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
ifeq (yesyes,$(have-fpie)$(build-shared))
CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
+CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
+CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
+CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
+CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
$(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
$(elf-objpfx)$(rtld-installed-name) \
@@ -1000,33 +1019,59 @@ $(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
$< > $@
$(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
- $(LINK.o) -pie -Wl,-O1 \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- $(LDFLAGS) $(LDFLAGS-$(@F)) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
- -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
- $(common-objpfx)libc_nonshared.a
+ $(+link-pie)
generated += ifuncmain1pie ifuncmain1pie.out
+$(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
+ $(+link-pie)
+
+generated += ifuncmain1staticpie ifuncmain1staticpie.out
+
$(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so
- $(LINK.o) -pie -Wl,-O1 \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- $(LDFLAGS) $(LDFLAGS-$(@F)) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
- -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
- $(common-objpfx)libc_nonshared.a
+ $(+link-pie)
generated += ifuncmain1vispie ifuncmain1vispie.out
+
+$(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
+ $(+link-pie)
+
+generated += ifuncmain5pie ifuncmain5pie.out
+
+$(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
+ $(+link-pie)
+
+generated += ifuncmain6pie ifuncmain6pie.out
+
+$(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
+ $(+link-pie)
+
+generated += ifuncmain7pie ifuncmain7pie.out
endif
$(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
@@ -1043,3 +1088,9 @@ $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
$(objpfx)ifuncmain3: $(libdl)
$(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
+
+$(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
+$(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
+$(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
+$(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
+$(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
diff --git a/elf/ifuncdep5.c b/elf/ifuncdep5.c
new file mode 100644
index 0000000000..f26234336e
--- /dev/null
+++ b/elf/ifuncdep5.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols without -fPIC. */
+
+#include "ifuncmod5.c"
diff --git a/elf/ifuncdep5pic.c b/elf/ifuncdep5pic.c
new file mode 100644
index 0000000000..3edb3a07c6
--- /dev/null
+++ b/elf/ifuncdep5pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmod5.c"
diff --git a/elf/ifuncmain1staticpie.c b/elf/ifuncmain1staticpie.c
new file mode 100644
index 0000000000..4891114260
--- /dev/null
+++ b/elf/ifuncmain1staticpie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE and no DSO. */
+
+#include "ifuncmain1.c"
diff --git a/elf/ifuncmain5.c b/elf/ifuncmain5.c
new file mode 100644
index 0000000000..7f128d006e
--- /dev/null
+++ b/elf/ifuncmain5.c
@@ -0,0 +1,40 @@
+/* Test STT_GNU_IFUNC symbols with dynamic function pointer only. */
+
+#include <stdlib.h>
+
+int global = -1;
+
+extern int foo (void);
+extern int foo_protected (void);
+
+typedef int (*foo_p) (void);
+
+foo_p
+__attribute__ ((noinline))
+get_foo (void)
+{
+ return foo;
+}
+
+foo_p
+__attribute__ ((noinline))
+get_foo_protected (void)
+{
+ return foo_protected;
+}
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if ((*p) () != -1)
+ abort ();
+
+ p = get_foo_protected ();
+ if ((*p) () != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/elf/ifuncmain5pic.c b/elf/ifuncmain5pic.c
new file mode 100644
index 0000000000..e9144fbb20
--- /dev/null
+++ b/elf/ifuncmain5pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain5.c"
diff --git a/elf/ifuncmain5picstatic.c b/elf/ifuncmain5picstatic.c
new file mode 100644
index 0000000000..a0afe905d7
--- /dev/null
+++ b/elf/ifuncmain5picstatic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain5.c"
diff --git a/elf/ifuncmain5pie.c b/elf/ifuncmain5pie.c
new file mode 100644
index 0000000000..669f31eeda
--- /dev/null
+++ b/elf/ifuncmain5pie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE. */
+
+#include "ifuncmain5.c"
diff --git a/elf/ifuncmain5static.c b/elf/ifuncmain5static.c
new file mode 100644
index 0000000000..72504404a5
--- /dev/null
+++ b/elf/ifuncmain5static.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain5.c"
diff --git a/elf/ifuncmain5staticpic.c b/elf/ifuncmain5staticpic.c
new file mode 100644
index 0000000000..9e8bac254f
--- /dev/null
+++ b/elf/ifuncmain5staticpic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and no DSO. */
+
+#include "ifuncmain5.c"
diff --git a/elf/ifuncmain6pie.c b/elf/ifuncmain6pie.c
new file mode 100644
index 0000000000..06f179bf9d
--- /dev/null
+++ b/elf/ifuncmain6pie.c
@@ -0,0 +1,63 @@
+/* Test STT_GNU_IFUNC symbols in PIE:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Reference from a shared library.
+ */
+
+#include <stdlib.h>
+
+typedef int (*foo_p) (void);
+extern foo_p foo_ptr;
+
+static int
+one (void)
+{
+ return -30;
+}
+
+void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+void *
+foo_ifunc (void)
+{
+ return one;
+}
+
+extern int foo (void);
+extern foo_p get_foo (void);
+extern foo_p get_foo_p (void);
+
+foo_p my_foo_ptr = foo;
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ if (foo_ptr != foo)
+ abort ();
+ if (my_foo_ptr != foo)
+ abort ();
+ if ((*foo_ptr) () != -30)
+ abort ();
+ if ((*my_foo_ptr) () != -30)
+ abort ();
+ if (foo () != -30)
+ abort ();
+
+ return 0;
+}
diff --git a/elf/ifuncmain7.c b/elf/ifuncmain7.c
new file mode 100644
index 0000000000..099e929ffc
--- /dev/null
+++ b/elf/ifuncmain7.c
@@ -0,0 +1,70 @@
+/* Test local STT_GNU_IFUNC symbols:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include <stdlib.h>
+
+extern int foo (void);
+
+static int
+one (void)
+{
+ return -30;
+}
+
+static void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+static void *
+__attribute__ ((used))
+foo_ifunc (void)
+{
+ return one;
+}
+
+typedef int (*foo_p) (void);
+
+foo_p foo_ptr = foo;
+
+foo_p
+__attribute__ ((noinline))
+get_foo_p (void)
+{
+ return foo_ptr;
+}
+
+foo_p
+__attribute__ ((noinline))
+get_foo (void)
+{
+ return foo;
+}
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ if (foo_ptr != foo)
+ abort ();
+ if ((*foo_ptr) () != -30)
+ abort ();
+ if (foo () != -30)
+ abort ();
+
+ return 0;
+}
diff --git a/elf/ifuncmain7pic.c b/elf/ifuncmain7pic.c
new file mode 100644
index 0000000000..fc37bf4469
--- /dev/null
+++ b/elf/ifuncmain7pic.c
@@ -0,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -fPIC:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
diff --git a/elf/ifuncmain7picstatic.c b/elf/ifuncmain7picstatic.c
new file mode 100644
index 0000000000..baf8934b95
--- /dev/null
+++ b/elf/ifuncmain7picstatic.c
@@ -0,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -fPIC and -static:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
diff --git a/elf/ifuncmain7pie.c b/elf/ifuncmain7pie.c
new file mode 100644
index 0000000000..254d453f1e
--- /dev/null
+++ b/elf/ifuncmain7pie.c
@@ -0,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with PIE:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
diff --git a/elf/ifuncmain7static.c b/elf/ifuncmain7static.c
new file mode 100644
index 0000000000..e470d570ef
--- /dev/null
+++ b/elf/ifuncmain7static.c
@@ -0,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -static:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
diff --git a/elf/ifuncmod5.c b/elf/ifuncmod5.c
new file mode 100644
index 0000000000..2ca1c71541
--- /dev/null
+++ b/elf/ifuncmod5.c
@@ -0,0 +1,78 @@
+/* Test STT_GNU_IFUNC symbols without direct function call. */
+
+extern int global;
+
+static int
+one (void)
+{
+ return 1;
+}
+
+static int
+minus_one (void)
+{
+ return -1;
+}
+
+static int
+zero (void)
+{
+ return 0;
+}
+
+void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+void *
+foo_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return minus_one;
+ default:
+ return zero;
+ }
+}
+
+void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
+__asm__(".type foo_hidden, %gnu_indirect_function");
+
+void *
+foo_hidden_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return minus_one;
+ case -1:
+ return one;
+ default:
+ return zero;
+ }
+}
+
+void * foo_protected_ifunc (void) __asm__ ("foo_protected");
+__asm__(".type foo_protected, %gnu_indirect_function");
+
+void *
+foo_protected_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return zero;
+ default:
+ return minus_one;
+ }
+}
+
+/* Test hidden indirect function. */
+__asm__(".hidden foo_hidden");
+
+/* Test protected indirect function. */
+__asm__(".protected foo_protected");
diff --git a/elf/ifuncmod6.c b/elf/ifuncmod6.c
new file mode 100644
index 0000000000..2e16c1d06d
--- /dev/null
+++ b/elf/ifuncmod6.c
@@ -0,0 +1,19 @@
+/* Test STT_GNU_IFUNC symbol reference in a shared library. */
+
+extern int foo (void);
+
+typedef int (*foo_p) (void);
+
+foo_p foo_ptr = foo;
+
+foo_p
+get_foo_p (void)
+{
+ return foo_ptr;
+}
+
+foo_p
+get_foo (void)
+{
+ return foo;
+}
diff --git a/elf/sln.c b/elf/sln.c
index a8210c1fc0..71707f5d30 100644
--- a/elf/sln.c
+++ b/elf/sln.c
@@ -83,8 +83,8 @@ static void
usage (void)
{
printf (_("Usage: sln src dest|file\n\n"));
- printf (_("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+ fputs (_("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
}
static int
diff --git a/libio/Makefile b/libio/Makefile
index b94d047f5a..501e80c2ee 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -153,6 +153,7 @@ tst-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
+tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
generated = tst-fopenloc.mtrace tst-fopenloc.check
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index a55ab50b76..11d78fde3f 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-16 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10011]
+ * locales/de_AT: Define week, first_weekday, first_workday.
+ Patch by Paul Marcher <flyer@gmail.com>.
+
2009-06-15 Ulrich Drepper <drepper@redhat.com>
[BZ #10213]
diff --git a/localedata/locales/de_AT b/localedata/locales/de_AT
index 4ec42f470e..4e0b7fb158 100644
--- a/localedata/locales/de_AT
+++ b/localedata/locales/de_AT
@@ -121,6 +121,9 @@ t_fmt_ampm ""
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+week 7;19971130;4
+first_weekday 2
+first_workday 2
END LC_TIME
LC_PAPER
diff --git a/login/Makefile b/login/Makefile
index b02d385b66..beb2a5c3a8 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-1998,2000-2002,2003,2007 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998,2000-2003,2007, 2009 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -54,6 +54,24 @@ otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
$(resolvobjdir)/libresolv.a $(common-objpfx)libc.a
endif
+ifeq (yesyes,$(have-fpie)$(build-shared))
+pt_chown-cflags += $(pie-ccflag)
+endif
+ifeq (yes,$(have-ssp))
+pt_chown-cflags += -fstack-protector
+endif
+ifeq (yes,$(have-libcap))
+libcap = -lcap
+endif
+CFLAGS-pt_chown.c = $(pt_chown-cflags)
+LDLIBS-pt_chown = $(libcap)
+ifeq (yesyes,$(have-fpie)$(build-shared))
+LDFLAGS-pt_chown = -Wl,-z,now
+
+$(objpfx)pt_chown: $(objpfx)pt_chown.o
+ $(+link-pie)
+endif
+
# pt_chown needs to be setuid root.
$(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(+force)
$(make-target-directory)
diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c
index 5167b29225..7e279a5f3b 100644
--- a/login/programs/pt_chown.c
+++ b/login/programs/pt_chown.c
@@ -29,6 +29,10 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef HAVE_LIBCAP
+# include <sys/capability.h>
+# include <sys/prctl.h>
+#endif
#include "pty-private.h"
@@ -99,7 +103,7 @@ static int
do_pt_chown (void)
{
char *pty;
- struct stat st;
+ struct stat64 st;
struct group *p;
gid_t gid;
@@ -110,7 +114,7 @@ do_pt_chown (void)
/* Check that the returned slave pseudo terminal is a
character device. */
- if (stat (pty, &st) < 0 || !S_ISCHR(st.st_mode))
+ if (stat64 (pty, &st) < 0 || !S_ISCHR (st.st_mode))
return FAIL_EINVAL;
/* Get the group ID of the special `tty' group. */
@@ -136,16 +140,43 @@ int
main (int argc, char *argv[])
{
uid_t euid = geteuid ();
+ uid_t uid = getuid ();
int remaining;
- /* Normal invocation of this program is with no arguments and
- with privileges.
- FIXME: Should use capable (CAP_CHOWN|CAP_FOWNER). */
if (argc == 1 && euid == 0)
- return do_pt_chown ();
+ {
+#ifdef HAVE_LIBCAP
+ /* Drop privileges. */
+ if (uid != euid)
+ {
+ static const cap_value_t cap_list[] =
+ { CAP_CHOWN, CAP_FOWNER };
+# define ncap_list (sizeof (cap_list) / sizeof (cap_list[0]))
+ cap_t caps = cap_init ();
+ if (caps == NULL)
+ error (FAIL_ENOMEM, errno,
+ _("Failed to initialize drop of capabilities"));
+
+ /* There is no reason why these should not work. */
+ cap_set_flag (caps, CAP_PERMITTED, ncap_list, cap_list, CAP_SET);
+ cap_set_flag (caps, CAP_EFFECTIVE, ncap_list, cap_list, CAP_SET);
+
+ int res = cap_set_proc (caps);
+
+ cap_free (caps);
+
+ if (__builtin_expect (res != 0, 0))
+ error (FAIL_EXEC, errno, _("cap_set_proc failed"));
+ }
+#endif
+
+ /* Normal invocation of this program is with no arguments and
+ with privileges. */
+ return do_pt_chown ();
+ }
/* We aren't going to be using privileges, so drop them right now. */
- setuid (getuid ());
+ setuid (uid);
/* Set locale via LC_ALL. */
setlocale (LC_ALL, "");
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0b9facefd4..516d401991 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4241,6 +4241,8 @@ _int_malloc(mstate av, size_t bytes)
mchunkptr fwd; /* misc temp for linking */
mchunkptr bck; /* misc temp for linking */
+ const char *errstr = NULL;
+
/*
Convert request size to internal form by adding SIZE_SZ bytes
overhead plus possibly more to obtain necessary alignment and/or
@@ -4276,8 +4278,11 @@ _int_malloc(mstate av, size_t bytes)
#endif
if (victim != 0) {
if (__builtin_expect (fastbin_index (chunksize (victim)) != idx, 0))
- malloc_printerr (check_action, "malloc(): memory corruption (fast)",
- chunk2mem (victim));
+ {
+ errstr = "malloc(): memory corruption (fast)";
+ errout:
+ malloc_printerr (check_action, errstr, chunk2mem (victim));
+ }
#ifndef ATOMIC_FASTBINS
*fb = victim->fd;
#endif
@@ -4306,6 +4311,11 @@ _int_malloc(mstate av, size_t bytes)
malloc_consolidate(av);
else {
bck = victim->bk;
+ if (__builtin_expect (bck->fd != victim, 0))
+ {
+ errstr = "malloc(): smallbin double linked list corrupted";
+ goto errout;
+ }
set_inuse_bit_at_offset(victim, nb);
bin->bk = bck;
bck->fd = bin;
@@ -4515,6 +4525,11 @@ _int_malloc(mstate av, size_t bytes)
have to perform a complete insert here. */
bck = unsorted_chunks(av);
fwd = bck->fd;
+ if (__builtin_expect (fwd->bk != bck, 0))
+ {
+ errstr = "malloc(): corrupted unsorted chunks";
+ goto errout;
+ }
remainder->bk = bck;
remainder->fd = fwd;
bck->fd = remainder;
@@ -4610,6 +4625,11 @@ _int_malloc(mstate av, size_t bytes)
have to perform a complete insert here. */
bck = unsorted_chunks(av);
fwd = bck->fd;
+ if (__builtin_expect (fwd->bk != bck, 0))
+ {
+ errstr = "malloc(): corrupted unsorted chunks 2";
+ goto errout;
+ }
remainder->bk = bck;
remainder->fd = fwd;
bck->fd = remainder;
@@ -4901,6 +4921,11 @@ _int_free(mstate av, mchunkptr p)
bck = unsorted_chunks(av);
fwd = bck->fd;
+ if (__builtin_expect (fwd->bk != bck, 0))
+ {
+ errstr = "free(): corrupted unsorted chunks";
+ goto errout;
+ }
p->fd = fwd;
p->bk = bck;
if (!in_smallbin_range(size))
diff --git a/malloc/memusage.sh b/malloc/memusage.sh
index 8b372e4b8e..9fab0a3b8b 100755
--- a/malloc/memusage.sh
+++ b/malloc/memusage.sh
@@ -62,7 +62,7 @@ Mandatory arguments to long options are also mandatory for any corresponding
short options.
"
- print $"For bug reporting instructions, please see:
+ echo $"For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
"
exit 0
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 76ca95d1e6..07a3b9282c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -43,8 +43,10 @@ static enum nss_status (*nss_getgrnam_r) (const char *name,
static enum nss_status (*nss_getgrgid_r) (gid_t gid, struct group * grp,
char *buffer, size_t buflen,
int *errnop);
+static enum nss_status (*nss_setgrent) (int stayopen);
static enum nss_status (*nss_getgrent_r) (struct group * grp, char *buffer,
size_t buflen, int *errnop);
+static enum nss_status (*nss_endgrent) (void);
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
@@ -68,7 +70,9 @@ struct blacklist_t
struct ent_t
{
- bool_t files;
+ bool files;
+ bool need_endgrent;
+ bool skip_initgroups_dyn;
FILE *stream;
struct blacklist_t blacklist;
};
@@ -106,7 +110,9 @@ init_nss_interface (void)
nss_initgroups_dyn = __nss_lookup_function (ni, "initgroups_dyn");
nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
nss_getgrgid_r = __nss_lookup_function (ni, "getgrgid_r");
+ nss_setgrent = __nss_lookup_function (ni, "setgrent");
nss_getgrent_r = __nss_lookup_function (ni, "getgrent_r");
+ nss_endgrent = __nss_lookup_function (ni, "endgrent");
}
__libc_lock_unlock (lock);
@@ -117,7 +123,7 @@ internal_setgrent (ent_t *ent)
{
enum nss_status status = NSS_STATUS_SUCCESS;
- ent->files = TRUE;
+ ent->files = true;
if (ni == NULL)
init_nss_interface ();
@@ -195,54 +201,68 @@ internal_endgrent (ent_t *ent)
else
ent->blacklist.current = 0;
+ if (ent->need_endgrent && nss_endgrent != NULL)
+ nss_endgrent ();
+
return NSS_STATUS_SUCCESS;
}
-/* This function checks, if the user is a member of this group and if
- yes, add the group id to the list. */
+/* Add new group record. */
static void
+add_group (long int *start, long int *size, gid_t **groupsp, long int limit,
+ gid_t gid)
+{
+ gid_t *groups = *groupsp;
+
+ /* Matches user. Insert this group. */
+ if (__builtin_expect (*start == *size, 0))
+ {
+ /* Need a bigger buffer. */
+ gid_t *newgroups;
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ return;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
+ if (newgroups == NULL)
+ return;
+ *groupsp = groups = newgroups;
+ *size = newsize;
+ }
+
+ groups[*start] = gid;
+ *start += 1;
+}
+
+/* This function checks, if the user is a member of this group and if
+ yes, add the group id to the list. Return nonzero is we couldn't
+ handle the group because the user is not in the member list. */
+static int
check_and_add_group (const char *user, gid_t group, long int *start,
long int *size, gid_t **groupsp, long int limit,
struct group *grp)
{
- gid_t *groups = *groupsp;
char **member;
/* Don't add main group to list of groups. */
if (grp->gr_gid == group)
- return;
+ return 0;
for (member = grp->gr_mem; *member != NULL; ++member)
if (strcmp (*member, user) == 0)
{
- /* Matches user. Insert this group. */
- if (*start == *size)
- {
- /* Need a bigger buffer. */
- gid_t *newgroups;
- long int newsize;
-
- if (limit > 0 && *size == limit)
- /* We reached the maximum. */
- return;
-
- if (limit <= 0)
- newsize = 2 * *size;
- else
- newsize = MIN (limit, 2 * *size);
-
- newgroups = realloc (groups, newsize * sizeof (*groups));
- if (newgroups == NULL)
- return;
- *groupsp = groups = newgroups;
- *size = newsize;
- }
-
- groups[*start] = grp->gr_gid;
- *start += 1;
-
- break;
+ add_group (start, size, groupsp, limit, grp->gr_gid);
+ return 0;
}
+
+ return 1;
}
/* Get the next group from NSS (+ entry). If the NSS module supports
@@ -255,15 +275,10 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
enum nss_status status;
struct group grpbuf;
- /* if this module does not support getgrent_r and initgroups_dyn,
- abort. We cannot find the needed group entries. */
- if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
- return NSS_STATUS_UNAVAIL;
-
/* Try nss_initgroups_dyn if supported. We also need getgrgid_r.
If this function is not supported, step through the whole group
database with getgrent_r. */
- if (nss_initgroups_dyn && nss_getgrgid_r)
+ if (! ent->skip_initgroups_dyn)
{
long int mystart = 0;
long int mysize = limit <= 0 ? *size : limit;
@@ -282,39 +297,56 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
limit, errnop) == NSS_STATUS_SUCCESS)
{
- /* A temporary buffer. We use the normal buffer, until we find
- an entry, for which this buffer is to small. In this case, we
- overwrite the pointer with one to a bigger buffer. */
- char *tmpbuf = buffer;
- size_t tmplen = buflen;
- int i;
-
- for (i = 0; i < mystart; i++)
+ /* If there is no blacklist we can trust the underlying
+ initgroups implementation. */
+ if (ent->blacklist.current <= 1)
+ for (int i = 0; i < mystart; i++)
+ add_group (start, size, groupsp, limit, mygroups[i]);
+ else
{
- while ((status = nss_getgrgid_r (mygroups[i], &grpbuf, tmpbuf,
- tmplen,
- errnop)) == NSS_STATUS_TRYAGAIN
- && *errnop == ERANGE)
- if (tmpbuf == buffer)
- {
- tmplen *= 2;
- tmpbuf = __alloca (tmplen);
- }
- else
- tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
-
- if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
+ /* A temporary buffer. We use the normal buffer, until we find
+ an entry, for which this buffer is to small. In this case, we
+ overwrite the pointer with one to a bigger buffer. */
+ char *tmpbuf = buffer;
+ size_t tmplen = buflen;
+
+ for (int i = 0; i < mystart; i++)
{
- if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
+ while ((status = nss_getgrgid_r (mygroups[i], &grpbuf,
+ tmpbuf, tmplen, errnop))
+ == NSS_STATUS_TRYAGAIN
+ && *errnop == ERANGE)
+ if (tmpbuf == buffer)
+ {
+ tmplen *= 2;
+ tmpbuf = __alloca (tmplen);
+ }
+ else
+ tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
+
+ if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
{
- free (mygroups);
- return status;
+ if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
+ {
+ free (mygroups);
+ return status;
+ }
+
+ if (!in_blacklist (grpbuf.gr_name,
+ strlen (grpbuf.gr_name), ent)
+ && check_and_add_group (user, group, start, size,
+ groupsp, limit, &grpbuf))
+ {
+ if (nss_setgrent != NULL)
+ {
+ nss_setgrent (1);
+ ent->need_endgrent = true;
+ }
+ ent->skip_initgroups_dyn = true;
+
+ goto iter;
+ }
}
-
- if (!in_blacklist (grpbuf.gr_name,
- strlen (grpbuf.gr_name), ent))
- check_and_add_group (user, group, start, size, groupsp,
- limit, &grpbuf);
}
}
@@ -327,17 +359,21 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
}
/* If we come here, the NSS module does not support initgroups_dyn
- and we have to step through the whole list ourself. */
+ or we were confronted with a split group. In these cases we have
+ to step through the whole list ourself. */
+ iter:
do
{
if ((status = nss_getgrent_r (&grpbuf, buffer, buflen, errnop)) !=
NSS_STATUS_SUCCESS)
- return status;
+ break;
}
while (in_blacklist (grpbuf.gr_name, strlen (grpbuf.gr_name), ent));
- check_and_add_group (user, group, start, size, groupsp, limit, &grpbuf);
- return NSS_STATUS_SUCCESS;
+ if (status == NSS_STATUS_SUCCESS)
+ check_and_add_group (user, group, start, size, groupsp, limit, &grpbuf);
+
+ return status;
}
static enum nss_status
@@ -435,7 +471,21 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
/* +:... */
if (grpbuf.gr_name[0] == '+' && grpbuf.gr_name[1] == '\0')
{
- ent->files = FALSE;
+ /* If the selected module does not support getgrent_r or
+ initgroups_dyn, abort. We cannot find the needed group
+ entries. */
+ if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
+ return NSS_STATUS_UNAVAIL;
+
+ ent->files = false;
+
+ if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
+ {
+ nss_setgrent (1);
+ ent->need_endgrent = true;
+ }
+ ent->skip_initgroups_dyn = true;
+
return getgrent_next_nss (ent, buffer, buflen, user, group,
start, size, groupsp, limit, errnop);
}
@@ -455,7 +505,7 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *tmpbuf;
enum nss_status status;
- ent_t intern = { TRUE, NULL, {NULL, 0, 0} };
+ ent_t intern = { true, false, false, NULL, {NULL, 0, 0} };
status = internal_setgrent (&intern);
if (status != NSS_STATUS_SUCCESS)
diff --git a/nscd/Makefile b/nscd/Makefile
index 364ddfe8dd..4abae8c661 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1998,2000,2002,2003,2004,2005,2006,2007,2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1998,2000,2002-2009 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -128,13 +127,7 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
relro-LDFLAGS += -Wl,-z,now
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
- $(LINK.o) -pie -Wl,-O1 $(nscd-cflags) \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(relro-LDFLAGS) \
- $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- $(LDFLAGS) $(LDFLAGS-$(@F)) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
- -o $@ $^ $(LDLIBS-nscd) $(common-objpfx)libc_nonshared.a
+ $(+link-pie)
endif
# This makes sure -DNOT_IN_libc is passed for all these modules.
diff --git a/nss/getent.c b/nss/getent.c
index dbcae26809..3a9430fd66 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -905,9 +905,9 @@ more_help (int key, const char *text, void *input)
fputs ("\n\n", fp);
- fprintf (fp, gettext ("\
+ fputs (gettext ("\
For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+<http://www.gnu.org/software/libc/bugs.html>.\n"), fp);
if (fclose (fp) == 0)
return doc;
diff --git a/po/bg.po b/po/bg.po
index 1f41d34053..b7c79bd1cf 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -6,9 +6,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: libc 2.9.90\n"
+"Project-Id-Version: libc 2.10.1\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-02-28 12:36+0200\n"
+"PO-Revision-Date: 2009-06-23 01:27+0300\n"
"Last-Translator: Roumen Petrov <transl@roumenpetrov.info>\n"
"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
"MIME-Version: 1.0\n"
@@ -651,7 +651,7 @@ msgstr "не може да се задели памет в статичен TSL
#: elf/dl-reloc.c:211
msgid "cannot make segment writable for relocation"
-msgstr "дялът не може да се маркира като записваем за \"непреместваем код\""
+msgstr "дялът не може да се маркира като записваем за \"преместваем код\""
#: elf/dl-reloc.c:277
#, c-format
@@ -661,7 +661,7 @@ msgstr "%s: не е намерен PLTREL за обекта %s\n"
#: elf/dl-reloc.c:288
#, c-format
msgid "%s: out of memory to store relocation results for %s\n"
-msgstr "%s: недостиг на памет за съхраняване на резултата за \"непреместваем код\" на %s\n"
+msgstr "%s: недостиг на памет за съхраняване на резултата за \"преместваем код\" на %s\n"
#: elf/dl-reloc.c:304
msgid "cannot restore segment prot after reloc"
@@ -922,8 +922,8 @@ msgstr ""
"Употреба: ldd [ОПЦИЯ]... ФАЙЛ...\n"
" --help Извеждане на тази помощ и изход\n"
" --version Извеждане на информация за версията и изход\n"
-" -d, --data-relocs Обработване на непреместваеми данни\n"
-" -r, --function-relocs Обработване на непреместваеми данни и функции\n"
+" -d, --data-relocs Обработване на преместваеми данни\n"
+" -r, --function-relocs Обработване на преместваеми данни и функции\n"
" -u, --unused Извеждане на неизползваните директни зависимости\n"
" -v, --verbose Извеждане на подробна информация\n"
@@ -1591,7 +1591,7 @@ msgstr "неизвестен знак \"%s\""
#: locale/programs/charmap.c:888
#, c-format
msgid "number of bytes for byte sequence of beginning and end of range not the same: %d vs %d"
-msgstr "боя на байтовете, в последователност от байтове за начало и край на диапазон, не е същия: %d vs %d"
+msgstr "боя на байтовете, в последователност от байтове за начало и край на диапазон, не е същия: %d с/у %d"
#: locale/programs/charmap.c:993 locale/programs/ld-collate.c:3044
#: locale/programs/repertoire.c:419
@@ -4791,7 +4791,7 @@ msgstr "не е намерен Си препроцесор: %s \n"
#: sunrpc/rpc_main.c:352
msgid "cannot find any C preprocessor (cpp)\n"
-msgstr "не е намерен някакъв Си препроцесор (cpp)\n"
+msgstr "не е намерен никакъв Си препроцесор (cpp)\n"
#: sunrpc/rpc_main.c:421
#, c-format
diff --git a/po/id.po b/po/id.po
index 777a556329..aabcc721d0 100644
--- a/po/id.po
+++ b/po/id.po
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: libc 2.9.90\n"
+"Project-Id-Version: libc 2.10.1\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-03-10 11:30+0700\n"
+"PO-Revision-Date: 2009-06-23 12:30+0700\n"
"Last-Translator: Arif E. Nugroho <arif_endro@yahoo.com>\n"
"Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
@@ -86,7 +86,7 @@ msgstr "%s: Terlalu banyak argumen\n"
#: argp/argp-parse.c:766
msgid "(PROGRAM ERROR) Option should have been recognized!?"
-msgstr "(APLIKASI ERROR) Opsi seharusnya telah dikenal!?"
+msgstr "(APLIKASI ERROR) Pilihan seharusnya telah dikenal!?"
#: assert/assert-perr.c:57
#, c-format
@@ -2864,7 +2864,7 @@ msgstr ""
" --usage Tampilkan sebuah pesan penggunaan singkat\n"
" -V,--version Tampilkan informasi versi dan keluar\n"
"\n"
-" Opsi berikut hanya berlaku ketika menghasilkan keluaran graphis:\n"
+" Pilihan berikut hanya berlaku ketika menghasilkan keluaran graphis:\n"
" -t,--time-based Buat graphis linear dengan waktu\n"
" -T,--total Juga gambar graphis dari total penggunaan memori\n"
" --title=STRING Gunakan STRING sebagai judul dari grapik\n"
@@ -3987,7 +3987,7 @@ msgstr "Harus menspesifikasikan nilai untuk pilihan restart-interval"
#: nscd/nscd_conf.c:274
#, c-format
msgid "Unknown option: %s %s %s"
-msgstr "Opsi tidak dikenal: %s %s %s"
+msgstr "Pilihan tidak dikenal: %s %s %s"
#: nscd/nscd_conf.c:287
#, c-format
diff --git a/posix/getconf.c b/posix/getconf.c
index 59ccab606c..c9e1300e49 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -1118,8 +1118,8 @@ Usage: getconf [-v SPEC] VAR\n\
Get the configuration value for variable VAR, or for variable PATH_VAR\n\
for path PATH. If SPEC is given, give values for compilation\n\
environment SPEC.\n\n"));
- printf (gettext ("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+ fputs (gettext ("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
return 0;
}
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 8841fe9faa..40dbe7d7e5 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -540,6 +540,9 @@ res_setoptions(res_state statp, const char *options, const char *source) {
statp->options |= RES_NOCHECKNAME;
} else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
statp->options |= RES_USE_EDNS0;
+ } else if (!strncmp(cp, "single-request-reopen",
+ sizeof("single-request-reopen") - 1)) {
+ statp->options |= RES_SNGLKUPREOP;
} else if (!strncmp(cp, "single-request",
sizeof("single-request") - 1)) {
statp->options |= RES_SNGLKUP;
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 39c69da2bc..971a4afb6f 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -908,24 +908,11 @@ send_vc(res_state statp,
}
static int
-send_dg(res_state statp,
- const u_char *buf, int buflen, const u_char *buf2, int buflen2,
- u_char **ansp, int *anssizp,
- int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp,
- u_char **ansp2, int *anssizp2, int *resplen2)
+reopen (res_state statp, int *terrno, int ns)
{
- const HEADER *hp = (HEADER *) buf;
- const HEADER *hp2 = (HEADER *) buf2;
- u_char *ans = *ansp;
- int orig_anssizp = *anssizp;
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
- struct timespec now, timeout, finish;
- struct pollfd pfd[1];
- int ptimeout;
- struct sockaddr_in6 from;
- int resplen, n;
-
if (EXT(statp).nssocks[ns] == -1) {
+ struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+
/* only try IPv6 if IPv6 NS and if not failed before */
if ((EXT(statp).nscount6 > 0) && !statp->ipv6_unavail) {
if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
@@ -1000,6 +987,26 @@ send_dg(res_state statp,
}
}
+ return 1;
+}
+
+static int
+send_dg(res_state statp,
+ const u_char *buf, int buflen, const u_char *buf2, int buflen2,
+ u_char **ansp, int *anssizp,
+ int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp,
+ u_char **ansp2, int *anssizp2, int *resplen2)
+{
+ const HEADER *hp = (HEADER *) buf;
+ const HEADER *hp2 = (HEADER *) buf2;
+ u_char *ans = *ansp;
+ int orig_anssizp = *anssizp;
+ struct timespec now, timeout, finish;
+ struct pollfd pfd[1];
+ int ptimeout;
+ struct sockaddr_in6 from;
+ int resplen, n;
+
/*
* Compute time for the total operation.
*/
@@ -1008,8 +1015,15 @@ send_dg(res_state statp,
seconds /= statp->nscount;
if (seconds <= 0)
seconds = 1;
- bool single_request = (statp->options & RES_SNGLKUP) != 0;// XXX
+ bool single_request = (statp->options & RES_SNGLKUP) != 0;
+ bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0;
int save_gotsomewhere = *gotsomewhere;
+
+ int retval;
+ retry_reopen:
+ retval = reopen (statp, terrno, ns);
+ if (retval <= 0)
+ return retval;
retry:
evNowTime(&now);
evConsTime(&timeout, seconds, 0);
@@ -1064,6 +1078,14 @@ send_dg(res_state statp,
*gotsomewhere = save_gotsomewhere;
goto retry;
}
+ else if (!single_request_reopen)
+ {
+ statp->options |= RES_SNGLKUPREOP;
+ single_request_reopen = true;
+ *gotsomewhere = save_gotsomewhere;
+ __res_iclose (statp, false);
+ goto retry_reopen;
+ }
*resplen2 = 1;
return resplen;
@@ -1092,7 +1114,8 @@ send_dg(res_state statp,
Perror(statp, stderr, "send", errno);
goto err_out;
}
- if (nwritten != 0 || buf2 == NULL || single_request)
+ if (nwritten != 0 || buf2 == NULL
+ || single_request || single_request_reopen)
pfd[0].events = POLLIN;
else
pfd[0].events = POLLIN | POLLOUT;
@@ -1306,8 +1329,15 @@ send_dg(res_state statp,
recvresp2 = 1;
/* Repeat waiting if we have a second answer to arrive. */
if ((recvresp1 & recvresp2) == 0) {
- if (single_request)
+ if (single_request || single_request_reopen) {
pfd[0].events = POLLOUT;
+ if (single_request_reopen) {
+ __res_iclose (statp, false);
+ retval = reopen (statp, terrno, ns);
+ if (retval <= 0)
+ return retval;
+ }
+ }
goto wait;
}
/*
diff --git a/resolv/resolv.h b/resolv/resolv.h
index c6e695dc72..3ef714f458 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -216,6 +216,8 @@ struct res_sym {
reverse lookup */
#define RES_USE_EDNS0 0x00100000 /* Use EDNS0. */
#define RES_SNGLKUP 0x00200000 /* one outstanding request at a time */
+#define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each
+ request */
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
diff --git a/string/strncmp.c b/string/strncmp.c
index 1adb2c0ebd..bb0cbfdf65 100644
--- a/string/strncmp.c
+++ b/string/strncmp.c
@@ -21,15 +21,16 @@
#undef strncmp
+#ifndef STRNCMP
+#define STRNCMP strncmp
+#endif
+
/* Compare no more than N characters of S1 and S2,
returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or
greater than S2. */
int
-strncmp (s1, s2, n)
- const char *s1;
- const char *s2;
- size_t n;
+STRNCMP (const char *s1, const char *s2, size_t n)
{
unsigned reg_char c1 = '\0';
unsigned reg_char c2 = '\0';
@@ -70,4 +71,5 @@ strncmp (s1, s2, n)
return c1 - c2;
}
-libc_hidden_builtin_def (strncmp)
+
+libc_hidden_builtin_def (STRNCMP)
diff --git a/string/test-memchr.c b/string/test-memchr.c
index c233ead5dd..cd9a01e3da 100644
--- a/string/test-memchr.c
+++ b/string/test-memchr.c
@@ -1,5 +1,5 @@
/* Test and measure memchr functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -144,7 +144,12 @@ do_random_tests (void)
}
if (pos < len)
- result = (char *) (p + pos + align);
+ {
+ size_t r = random ();
+ if ((r & 31) == 0)
+ len = ~(uintptr_t) (p + align) - ((r >> 5) & 31);
+ result = (char *) (p + pos + align);
+ }
else
result = NULL;
diff --git a/sunrpc/rpcinfo.c b/sunrpc/rpcinfo.c
index 5e00be9f78..6020cd5b9d 100644
--- a/sunrpc/rpcinfo.c
+++ b/sunrpc/rpcinfo.c
@@ -688,9 +688,9 @@ usage (FILE *stream)
fputs (_(" rpcinfo -b prognum versnum\n"), stream);
fputs (_(" rpcinfo -d prognum versnum\n"), stream);
fputc ('\n', stream);
- fprintf (stream, _("\
+ fputs (_("\
For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stream);
}
static void
diff --git a/sysdeps/generic/pty-private.h b/sysdeps/generic/pty-private.h
index d6ec2cee68..493f40551d 100644
--- a/sysdeps/generic/pty-private.h
+++ b/sysdeps/generic/pty-private.h
@@ -1,5 +1,5 @@
/* Internal defenitions and declarations for pseudo terminal functions.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
@@ -39,7 +39,8 @@ enum /* failure modes */
FAIL_EBADF = 1,
FAIL_EINVAL,
FAIL_EACCES,
- FAIL_EXEC
+ FAIL_EXEC,
+ FAIL_ENOMEM
};
#endif /* pty-private.h */
diff --git a/sysdeps/powerpc/powerpc32/____longjmp_chk.S b/sysdeps/powerpc/powerpc32/____longjmp_chk.S
index 5c1f648661..510ce5250d 100644
--- a/sysdeps/powerpc/powerpc32/____longjmp_chk.S
+++ b/sysdeps/powerpc/powerpc32/____longjmp_chk.S
@@ -26,11 +26,30 @@
#define __longjmp ____longjmp_chk
+#ifdef PIC
+# ifdef HAVE_ASM_PPC_REL16
+# define LOAD_ARG \
+ bcl 20,31,1f; \
+1: mflr r3; \
+ addis r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha; \
+ addi r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l; \
+ lwz r3,.LC0@got(r3)
+# else
+# define LOAD_ARG \
+ bl _GLOBAL_OFFSET_TABLE_-4@local; \
+ mflr r3; \
+ lwz r3,.LC0@got(r3)
+# endif
+#else
+# define LOAD_ARG \
+ lis r3,.LC0@ha; \
+ la r3,.LC0@l(r3)
+#endif
+
#define CHECK_SP(reg) \
cmplw reg, r1; \
bge+ .Lok; \
- lis r3,.LC0@ha; \
- la r3,.LC0@l(r3); \
+ LOAD_ARG; \
bl HIDDEN_JUMPTARGET (__fortify_fail); \
.Lok:
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
index 6aef4e301b..95a0b3915d 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
@@ -60,8 +60,8 @@ EALIGN (__sqrt, 5, 0)
fmr fp12,fp2
stw r0,20(r1)
stw r30,8(r1)
- cfi_offset(lr,20)
- cfi_offset(r30,8)
+ cfi_offset(lr,20-16)
+ cfi_offset(r30,8-16)
#ifdef SHARED
# ifdef HAVE_ASM_PPC_REL16
bcl 20,31,.LCF1
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
index e5b8b9d565..c31555194b 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
@@ -60,8 +60,8 @@ EALIGN (__sqrtf, 5, 0)
fmr fp12,fp2
stw r0,20(r1)
stw r30,8(r1)
- cfi_offset(lr,20)
- cfi_offset(r30,8)
+ cfi_offset(lr,20-16)
+ cfi_offset(r30,8-16)
#ifdef SHARED
# ifdef HAVE_ASM_PPC_REL16
bcl 20,31,.LCF1
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
index 925930bf77..105b5912a1 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
@@ -60,8 +60,8 @@ EALIGN (__sqrt, 5, 0)
fmr fp12,fp2
stw r0,20(r1)
stw r30,8(r1)
- cfi_offset(lr,20)
- cfi_offset(r30,8)
+ cfi_offset(lr,20-16)
+ cfi_offset(r30,8-16)
#ifdef SHARED
# ifdef HAVE_ASM_PPC_REL16
bcl 20,31,.LCF1
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
index 891e69c9c0..14bc0a2ceb 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
@@ -60,8 +60,8 @@ EALIGN (__sqrtf, 5, 0)
fmr fp12,fp2
stw r0,20(r1)
stw r30,8(r1)
- cfi_offset(lr,20)
- cfi_offset(r30,8)
+ cfi_offset(lr,20-16)
+ cfi_offset(r30,8-16)
#ifdef SHARED
# ifdef HAVE_ASM_PPC_REL16
bcl 20,31,.LCF1
diff --git a/sysdeps/powerpc/powerpc32/power6/memcpy.S b/sysdeps/powerpc/powerpc32/power6/memcpy.S
index ba45fd250c..156b0bd8cc 100644
--- a/sysdeps/powerpc/powerpc32/power6/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/power6/memcpy.S
@@ -1,5 +1,5 @@
/* Optimized memcpy implementation for PowerPC32 on POWER6.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,9 +25,9 @@
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks
- (no loops) of lwz/stw. The tail (remaining 1-3) bytes is handled
- with the appropriate combination of byte and halfword load/stores.
- There is minimal effort to optimize the alignment of short moves.
+ (no loops) of lwz/stw. The tail (remaining 1-3) bytes is handled
+ with the appropriate combination of byte and halfword load/stores.
+ There is minimal effort to optimize the alignment of short moves.
Longer moves (>= 32-bytes) justify the effort to get at least the
destination word (4-byte) aligned. Further optimization is
@@ -80,11 +80,11 @@ EALIGN (BP_SYM (memcpy), 5, 0)
bne- cr6,L(wdu) /* If source is not word aligned. .L6 */
clrlwi 11,31,30 /* calculate the number of tail bytes */
b L(word_aligned)
- /* Copy words from source to destination, assuming the destination is
+ /* Copy words from source to destination, assuming the destination is
aligned on a word boundary.
At this point we know there are at least 29 bytes left (32-3) to copy.
- The next step is to determine if the source is also word aligned.
+ The next step is to determine if the source is also word aligned.
If not branch to the unaligned move code at .L6. which uses
a load, shift, store strategy.
@@ -100,9 +100,9 @@ EALIGN (BP_SYM (memcpy), 5, 0)
/* Move words where destination and source are word aligned.
Use an unrolled loop to copy 4 words (16-bytes) per iteration.
- If the the copy is not an exact multiple of 16 bytes, 1-3
+ If the the copy is not an exact multiple of 16 bytes, 1-3
words are copied as needed to set up the main loop. After
- the main loop exits there may be a tail of 1-3 bytes. These bytes are
+ the main loop exits there may be a tail of 1-3 bytes. These bytes are
copied a halfword/byte at a time as needed to preserve alignment. */
L(word_aligned):
mtcrf 0x01,9
@@ -121,7 +121,7 @@ L(word_aligned):
addi 10,3,8
bf 31,4f
lwz 0,8(12)
- stw 0,8(3)
+ stw 0,8(3)
blt cr1,3f
addi 11,12,12
addi 10,3,12
@@ -135,7 +135,7 @@ L(word_aligned):
addi 11,12,4
stw 6,0(3)
addi 10,3,4
-
+
.align 4
4:
lwz 6,0(11)
@@ -149,14 +149,14 @@ L(word_aligned):
addi 11,11,16
addi 10,10,16
bdnz 4b
-3:
+3:
clrrwi 0,31,2
mtcrf 0x01,31
beq cr6,0f
.L9:
add 3,3,0
add 12,12,0
-
+
/* At this point we have a tail of 0-3 bytes and we know that the
destination is word aligned. */
2: bf 30,1f
@@ -175,7 +175,7 @@ L(word_aligned):
addi 1,1,32
blr
-/* Copy up to 31 bytes. This divided into two cases 0-8 bytes and 9-31
+/* Copy up to 31 bytes. This divided into two cases 0-8 bytes and 9-31
bytes. Each case is handled without loops, using binary (1,2,4,8)
tests.
@@ -208,7 +208,7 @@ L(word_unaligned_short):
andi. 0,8,3
beq cr6,L(wus_8) /* Handle moves of 8 bytes. */
/* At least 9 bytes left. Get the source word aligned. */
- cmpldi cr1,5,16
+ cmplwi cr1,5,16
mr 12,4
ble cr6,L(wus_4) /* Handle moves of 0-8 bytes. */
mr 11,3
@@ -241,7 +241,7 @@ L(wus_tail):
/* At least 6 bytes left and the source is word aligned. This allows
some speculative loads up front. */
/* We need to special case the fall-through because the biggest delays
- are due to address computation not being ready in time for the
+ are due to address computation not being ready in time for the
AGEN. */
lwz 6,0(12)
lwz 7,4(12)
@@ -336,7 +336,7 @@ L(wus_tail4): /* Move 4 bytes. */
L(wus_tail2): /* Move 2-3 bytes. */
bf 30,L(wus_tail1)
lhz 6,0(12)
- sth 6,0(11)
+ sth 6,0(11)
bf 31,L(wus_tailX)
lbz 7,2(12)
stb 7,2(11)
@@ -368,7 +368,7 @@ L(wus_4):
stw 6,0(3)
bf 30,L(wus_5)
lhz 7,4(4)
- sth 7,4(3)
+ sth 7,4(3)
bf 31,L(wus_0)
lbz 8,6(4)
stb 8,6(3)
@@ -386,7 +386,7 @@ L(wus_5):
L(wus_2): /* Move 2-3 bytes. */
bf 30,L(wus_1)
lhz 6,0(4)
- sth 6,0(3)
+ sth 6,0(3)
bf 31,L(wus_0)
lbz 7,2(4)
stb 7,2(3)
@@ -410,13 +410,13 @@ L(wdu):
/* Copy words where the destination is aligned but the source is
not. For power4, power5 and power6 machines there is penalty for
- unaligned loads (src) that cross 32-byte, cacheline, or page
+ unaligned loads (src) that cross 32-byte, cacheline, or page
boundaries. So we want to use simple (unaligned) loads where
posible but avoid them where we know the load would span a 32-byte
- boundary.
+ boundary.
At this point we know we have at least 29 (32-3) bytes to copy
- the src is unaligned. and we may cross at least one 32-byte
+ the src is unaligned. and we may cross at least one 32-byte
boundary. Also we have the following regester values:
r3 == adjusted dst, word aligned
r4 == unadjusted src
@@ -427,7 +427,7 @@ L(wdu):
r31 == adjusted len
First we need to copy word upto but not crossing the next 32-byte
- boundary. Then perform aligned loads just before and just after
+ boundary. Then perform aligned loads just before and just after
the boundary and use shifts and or to gernerate the next aligned
word for dst. If more then 32 bytes remain we copy (unaligned src)
the next 7 words and repeat the loop until less then 32-bytes
@@ -442,7 +442,7 @@ L(wdu):
mr 4,12 /* restore unaligned adjusted src ptr */
clrlwi 0,12,27 /* Find dist from previous 32-byte boundary. */
slwi 10,10,3 /* calculate number of bits to shift 1st word left */
- cmplwi cr5,0,16
+ cmplwi cr5,0,16
subfic 8,0,32 /* Number of bytes to next 32-byte boundary. */
mtcrf 0x01,8
@@ -532,7 +532,7 @@ L(wdu_32):
lwz 6,0(12)
cmplwi cr6,31,4
srwi 8,31,5 /* calculate the 32 byte loop count */
- slw 0,6,10
+ slw 0,6,10
clrlwi 31,31,27 /* The remaining bytes, < 32. */
blt cr5,L(wdu_32tail)
mtctr 8
@@ -543,7 +543,7 @@ L(wdu_loop32):
lwz 8,4(12)
addi 12,12,32
lwz 7,4(4)
- srw 8,8,9
+ srw 8,8,9
or 0,0,8
stw 0,0(3)
stw 7,4(3)
@@ -562,7 +562,7 @@ L(wdu_loop32):
stw 6,24(3)
stw 7,28(3)
addi 3,3,32
- slw 0,8,10
+ slw 0,8,10
bdnz+ L(wdu_loop32)
L(wdu_32tail):
@@ -571,7 +571,7 @@ L(wdu_32tail):
blt cr6,L(wdu_4tail)
/* calculate and store the final word */
lwz 8,4(12)
- srw 8,8,9
+ srw 8,8,9
or 6,0,8
b L(wdu_32tailx)
#endif
@@ -816,7 +816,7 @@ L(wdu_4tail):
beq cr6,L(wdus_0) /* If the tail is 0 bytes we are done! */
bf 30,L(wdus_3)
lhz 7,0(4)
- sth 7,0(3)
+ sth 7,0(3)
bf 31,L(wdus_0)
lbz 8,2(4)
stb 8,2(3)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index 10fb7b9786..cc65b7be9a 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -1,5 +1,5 @@
/* Optimized 32-bit memset implementation for POWER6.
- Copyright (C) 1997,99, 2000,02,03,06,2007 Free Software Foundation, Inc.
+ Copyright (C) 1997,99,2000,02,03,06,2007,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -240,7 +240,7 @@ L(nzCacheAligned256):
cmplwi cr1,rLEN,256
addi rMEMP3,rMEMP,64
#ifdef NOT_IN_libc
-/* When we are not in libc we should use only GPRs to avoid the FPU lock
+/* When we are not in libc we should use only GPRs to avoid the FPU lock
interrupt. */
stw rCHR,0(rMEMP)
stw rCHR,4(rMEMP)
@@ -381,7 +381,7 @@ L(cacheAligned):
blt cr1,L(cacheAligned1)
li rMEMP2,128
L(cacheAlignedx):
- cmpldi cr5,rLEN,640
+ cmplwi cr5,rLEN,640
blt cr6,L(cacheAligned128)
bgt cr5,L(cacheAligned512)
cmplwi cr6,rLEN,512
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index bdedbacec8..8c299e9147 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
@@ -19,6 +19,7 @@
#include <assert.h>
#include <errno.h>
+#include <fcntl.h>
#include <grp.h>
#include <limits.h>
#include <stdlib.h>
@@ -115,8 +116,24 @@ grantpt (int fd)
gid_t gid;
pid_t pid;
- if (pts_name (fd, &buf, sizeof (_buf)))
- return -1;
+ if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0))
+ {
+ int save_errno = errno;
+
+ /* Check, if the file descriptor is valid. pts_name returns the
+ wrong errno number, so we cannot use that. */
+ if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF)
+ return -1;
+
+ /* If the filedescriptor is no TTY, grantpt has to set errno
+ to EINVAL. */
+ if (save_errno == ENOTTY)
+ __set_errno (EINVAL);
+ else
+ __set_errno (save_errno);
+
+ return -1;
+ }
if (__xstat64 (_STAT_VER, buf, &st) < 0)
goto cleanup;
@@ -185,7 +202,7 @@ grantpt (int fd)
if (!WIFEXITED (w))
__set_errno (ENOEXEC);
else
- switch (WEXITSTATUS(w))
+ switch (WEXITSTATUS (w))
{
case 0:
retval = 0;
@@ -202,6 +219,9 @@ grantpt (int fd)
case FAIL_EXEC:
__set_errno (ENOEXEC);
break;
+ case FAIL_ENOMEM:
+ __set_errno (ENOMEM);
+ break;
default:
assert(! "getpt: internal error: invalid exit code from pt_chown");
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 88062e59ad..f23b338a35 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -1,5 +1,5 @@
/* System-specific socket constants and types. Linux version.
- Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -108,7 +108,8 @@ enum __socket_type
#define PF_RXRPC 33 /* RxRPC sockets. */
#define PF_ISDN 34 /* mISDN sockets. */
#define PF_PHONET 35 /* Phonet sockets. */
-#define PF_MAX 36 /* For now.. */
+#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */
+#define PF_MAX 37 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
@@ -148,6 +149,7 @@ enum __socket_type
#define AF_RXRPC PF_RXRPC
#define AF_ISDN PF_ISDN
#define AF_PHONET PF_PHONET
+#define AF_IEEE802154 PF_IEEE802154
#define AF_MAX PF_MAX
/* Socket level values. Others are defined in the appropriate headers.
diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
deleted file mode 100644
index c858f89c8b..0000000000
--- a/sysdeps/unix/sysv/linux/grantpt.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 1998, 1999, 2001, 2002, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/statfs.h>
-
-#include "linux_fsinfo.h"
-
-/* Prototype for function that changes ownership and access permission
- for slave pseudo terminals that do not live on a `devpts'
- filesystem. */
-static int __unix_grantpt (int fd);
-
-/* Prototype for private function that gets the name of the slave
- pseudo terminal in a safe way. */
-static int pts_name (int fd, char **pts, size_t buf_len);
-
-/* Change the ownership and access permission of the slave pseudo
- terminal associated with the master pseudo terminal specified
- by FD. */
-int
-grantpt (int fd)
-{
- struct statfs fsbuf;
-#ifdef PATH_MAX
- char _buf[PATH_MAX];
-#else
- char _buf[512];
-#endif
- char *buf = _buf;
-
- if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0))
- {
- int save_errno = errno;
-
- /* Check, if the file descriptor is valid. pts_name returns the
- wrong errno number, so we cannot use that. */
- if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF)
- return -1;
-
- /* If the filedescriptor is no TTY, grantpt has to set errno
- to EINVAL. */
- if (save_errno == ENOTTY)
- __set_errno (EINVAL);
- else
- __set_errno (save_errno);
-
- return -1;
- }
-
- if (__statfs (buf, &fsbuf) < 0)
- return -1;
-
- /* If the slave pseudo terminal lives on a `devpts' filesystem, the
- ownership is already set and the access permission might already
- be set. */
- if (fsbuf.f_type == DEVPTS_SUPER_MAGIC || fsbuf.f_type == DEVFS_SUPER_MAGIC)
- {
- struct stat64 st;
-
- if (fstat (fd, &st) == 0
- && (st.st_mode & ACCESSPERMS) == (S_IRUSR|S_IWUSR|S_IWGRP))
- return 0;
- }
-
- return __unix_grantpt (fd);
-}
-
-#define grantpt static __unix_grantpt
-#include <sysdeps/unix/grantpt.c>
diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
index 694d1291cd..6d57190508 100644
--- a/sysdeps/unix/sysv/linux/lddlibc4.c
+++ b/sysdeps/unix/sysv/linux/lddlibc4.c
@@ -59,8 +59,8 @@ main (int argc, char *argv[])
if (strcmp (argv[1], "--help") == 0)
{
printf (gettext ("Usage: lddlibc4 FILE\n\n"));
- printf (gettext ("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+ fputs (gettext ("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
return 0;
}
else if (strcmp (argv[1], "--version") == 0)
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index 9608652ee4..97cb61f62b 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -1,5 +1,5 @@
/* Definitions for Address Resolution Protocol.
- Copyright (C) 1997,1999,2001,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -128,6 +128,8 @@ struct arphdr
#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */
#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */
+#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */
+#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */
#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */
#define ARPHRD_NONE 0xFFFE /* Zero header length. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h
index d43a3cdf79..a148072095 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h
@@ -1,5 +1,5 @@
/* System-specific socket constants and types. Linux/SPARC version.
- Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -94,15 +94,21 @@ enum __socket_type
#define PF_ASH 18 /* Ash. */
#define PF_ECONET 19 /* Acorn Econet. */
#define PF_ATMSVC 20 /* ATM SVCs. */
+#define PF_RDS 21 /* RDS sockets. */
#define PF_SNA 22 /* Linux SNA Project */
#define PF_IRDA 23 /* IRDA sockets. */
#define PF_PPPOX 24 /* PPPoX sockets. */
#define PF_WANPIPE 25 /* Wanpipe API sockets. */
+#define PF_LLC 26 /* Linux LLC. */
+#define PF_CAN 29 /* Controller Area Network. */
+#define PF_TIPC 30 /* TIPC sockets. */
#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
#define PF_IUCV 32 /* IUCV sockets. */
#define PF_RXRPC 33 /* RxRPC sockets. */
#define PF_ISDN 34 /* mISDN sockets. */
-#define PF_MAX 35 /* For now.. */
+#define PF_PHONET 35 /* Phonet sockets. */
+#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */
+#define PF_MAX 37 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
@@ -129,14 +135,20 @@ enum __socket_type
#define AF_ASH PF_ASH
#define AF_ECONET PF_ECONET
#define AF_ATMSVC PF_ATMSVC
+#define AF_RDS PF_RDS
#define AF_SNA PF_SNA
#define AF_IRDA PF_IRDA
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
+#define AF_LLC PF_LLC
+#define AF_CAN PF_CAN
+#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
#define AF_ISDN PF_ISDN
+#define AF_PHONET PF_PHONET
+#define AF_IEEE802154 PF_IEEE802154
#define AF_MAX PF_MAX
/* Socket level values. Others are defined in the appropriate headers.
diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S
index 54b7af534c..6082aa7f76 100644
--- a/sysdeps/x86_64/memchr.S
+++ b/sysdeps/x86_64/memchr.S
@@ -41,7 +41,7 @@ ENTRY (memchr)
movl $16, %esi
jnz 1f
cmpq %rsi, %rdx
- jle 3f
+ jbe 3f
2: movdqa (%rdi,%rsi), %xmm0
leaq 16(%rsi), %rsi
@@ -50,7 +50,7 @@ ENTRY (memchr)
testl %ecx, %ecx
jnz 1f
cmpq %rsi, %rdx
- jg 2b
+ ja 2b
3: xorl %eax, %eax
ret
@@ -60,7 +60,7 @@ ENTRY (memchr)
addq %rcx, %rax
leaq -16(%rsi,%rcx), %rsi
cmpq %rsi, %rdx
- jle 3b
+ jbe 3b
ret
END (memchr)
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index 33d98c36e6..1c35e1ffb4 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -2,3 +2,7 @@ ifeq ($(subdir),csu)
aux += init-arch
gen-as-const-headers += ifunc-defines.sym
endif
+
+ifeq ($(subdir),string)
+sysdep_routines += strncmp-c
+endif
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index f160ba2a94..5c4892de38 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -56,3 +56,6 @@ extern void __init_cpu_features (void) attribute_hidden;
#define HAS_POPCOUNT \
((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
+
+#define HAS_SSE4_2 \
+ ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0)
diff --git a/sysdeps/x86_64/multiarch/strcmp.S b/sysdeps/x86_64/multiarch/strcmp.S
new file mode 100644
index 0000000000..2f4bf17d95
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strcmp.S
@@ -0,0 +1,1677 @@
+/* strcmp with SSE4.2
+ Copyright (C) 2009 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 <ifunc-defines.h>
+
+#ifdef USE_AS_STRNCMP
+/* 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 \
+ /* calculate left number to compare */ \
+ lea -16(%rcx, %r11), %r9; \
+ cmp %r9, %r11; \
+ jb LABEL(strcmp_exitz); \
+ test %r9, %r9; \
+ je LABEL(strcmp_exitz); \
+ mov %r9, %r11
+
+#define STRCMP_SSE42 __strncmp_sse42
+#define STRCMP_SSE2 __strncmp_sse2
+#define __GI_STRCMP __GI_strncmp
+#else
+#define UPDATE_STRNCMP_COUNTER
+#ifndef STRCMP
+#define STRCMP strcmp
+#define STRCMP_SSE42 __strcmp_sse42
+#define STRCMP_SSE2 __strcmp_sse2
+#define __GI_STRCMP __GI_strcmp
+#endif
+#endif
+
+#ifndef LABEL
+#define LABEL(l) L(l)
+#endif
+
+/* Define multiple versions only for the definition in libc. Don't
+ define multiple versions for strncmp in static library since we
+ need strncmp before the initialization happened. */
+#if (defined SHARED || !defined USE_AS_STRNCMP) && !defined NOT_IN_libc
+ .text
+ENTRY(STRCMP)
+ .type STRCMP, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq STRCMP_SSE2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq STRCMP_SSE42(%rip), %rax
+2: ret
+END(STRCMP)
+
+/* We use 0x1a:
+ _SIDD_SBYTE_OPS
+ | _SIDD_CMP_EQUAL_EACH
+ | _SIDD_NEGATIVE_POLARITY
+ | _SIDD_LEAST_SIGNIFICANT
+ on pcmpistri to find out if two 16byte data elements are the same
+ and the offset of the first different byte. There are 4 cases:
+
+ 1. Both 16byte data elements are valid and identical.
+ 2. Both 16byte data elements have EOS and identical.
+ 3. Both 16byte data elements are valid and they differ at offset X.
+ 4. At least one 16byte data element has EOS at offset X. Two 16byte
+ data elements must differ at or before offset X.
+
+ Here is the table of ECX, CFlag, ZFlag and SFlag for 4 cases:
+
+ case ECX CFlag ZFlag SFlag
+ 1 16 0 0 0
+ 2 16 0 1 1
+ 3 X 1 0 0
+ 4 0 <= X 1 0/1 0/1
+
+ We exit from the loop for cases 2, 3 and 4 with jbe which branches
+ when either CFlag or ZFlag is 1. If CFlag == 0, we return 0 for
+ case 2. */
+
+ /* Put all SSE 4.2 functions together. */
+ .section .text.sse4.2,"ax",@progbits
+ .align 16
+ .type STRCMP_SSE42, @function
+STRCMP_SSE42:
+ cfi_startproc
+ CALL_MCOUNT
+
+/*
+ * This implementation uses SSE to compare up to 16 bytes at a time.
+ */
+#ifdef USE_AS_STRNCMP
+ test %rdx, %rdx
+ je LABEL(strcmp_exitz)
+ cmp $1, %rdx
+ je LABEL(Byte0)
+ mov %rdx, %r11
+#endif
+ mov %esi, %ecx
+ mov %edi, %eax
+/* Use 64bit AND here to avoid long NOP padding. */
+ and $0x3f, %rcx /* rsi alignment in cache line */
+ and $0x3f, %rax /* rdi alignment in cache line */
+ cmp $0x30, %ecx
+ ja LABEL(crosscache) /* rsi: 16-byte load will cross cache line */
+ cmp $0x30, %eax
+ ja LABEL(crosscache) /* rdi: 16-byte load will cross cache line */
+ movlpd (%rdi), %xmm1
+ movlpd (%rsi), %xmm2
+ movhpd 8(%rdi), %xmm1
+ movhpd 8(%rsi), %xmm2
+ pxor %xmm0, %xmm0 /* clear %xmm0 for null char checks */
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pcmpeqb %xmm2, %xmm1 /* compare first 16 bytes for equality */
+ psubb %xmm0, %xmm1 /* packed sub of comparison results*/
+ 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
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz) /* finish comparision */
+#endif
+ add $16, %rsi /* prepare to search next 16 bytes */
+ add $16, %rdi /* prepare to search next 16 bytes */
+
+ /*
+ * Determine source and destination string offsets from 16-byte alignment.
+ * Use relative offset difference between the two to determine which case
+ * below to use.
+ */
+ .p2align 4
+LABEL(crosscache):
+ and $0xfffffffffffffff0, %rsi /* force %rsi is 16 byte aligned */
+ and $0xfffffffffffffff0, %rdi /* force %rdi is 16 byte aligned */
+ mov $0xffff, %edx /* for equivalent offset */
+ xor %r8d, %r8d
+ and $0xf, %ecx /* offset of rsi */
+ and $0xf, %eax /* offset of rdi */
+ cmp %eax, %ecx
+ je LABEL(ashr_0) /* rsi and rdi relative offset same */
+ ja LABEL(bigger)
+ mov %edx, %r8d /* r8d is offset flag for exit tail */
+ xchg %ecx, %eax
+ xchg %rsi, %rdi
+LABEL(bigger):
+ lea 15(%rax), %r9
+ sub %rcx, %r9
+ lea LABEL(unaligned_table)(%rip), %r10
+ movslq (%r10, %r9,4), %r9
+ lea (%r10, %r9), %r10
+ jmp *%r10 /* jump to corresponding case */
+
+/*
+ * The following cases will be handled by ashr_0
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(0~15) n(0~15) 15(15+ n-n) ashr_0
+ */
+ .p2align 4
+LABEL(ashr_0):
+
+ movdqa (%rsi), %xmm1
+ pxor %xmm0, %xmm0 /* clear %xmm0 for null char check */
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pcmpeqb (%rdi), %xmm1 /* compare 16 bytes for equality */
+ psubb %xmm0, %xmm1 /* packed sub of comparison results*/
+ pmovmskb %xmm1, %r9d
+ shr %cl, %edx /* adjust 0xffff for offset */
+ shr %cl, %r9d /* adjust for 16-byte offset */
+ sub %r9d, %edx
+ /*
+ * edx must be the same with r9d if in left byte (16-rcx) is equal to
+ * the start from (16-rax) and no null char was seen.
+ */
+ jne LABEL(less32bytes) /* mismatch or null char */
+ UPDATE_STRNCMP_COUNTER
+ mov $16, %rcx
+ mov $16, %r9
+ pxor %xmm0, %xmm0 /* clear xmm0, may have changed above */
+
+ /*
+ * Now both strings are aligned at 16-byte boundary. Loop over strings
+ * checking 32-bytes per iteration.
+ */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+ .p2align 4
+LABEL(ashr_0_use_sse4_2):
+ movdqa (%rdi,%rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ lea 16(%rdx), %rdx
+ jbe LABEL(ashr_0_use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ movdqa (%rdi,%rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ lea 16(%rdx), %rdx
+ jbe LABEL(ashr_0_use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ jmp LABEL(ashr_0_use_sse4_2)
+
+
+ .p2align 4
+LABEL(ashr_0_use_sse4_2_exit):
+ jnc LABEL(strcmp_exitz)
+#ifdef USE_AS_STRNCMP
+ sub %rcx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ lea -16(%rdx, %rcx), %rcx
+ movzbl (%rdi, %rcx), %eax
+ movzbl (%rsi, %rcx), %edx
+ sub %edx, %eax
+ ret
+
+
+
+
+/*
+ * The following cases will be handled by ashr_1
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(15) n -15 0(15 +(n-15) - n) ashr_1
+ */
+ .p2align 4
+LABEL(ashr_1):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pslldq $15, %xmm2 /* shift first string to align with second */
+ pcmpeqb %xmm1, %xmm2 /* compare 16 bytes for equality */
+ psubb %xmm0, %xmm2 /* packed sub of comparison results*/
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx /* adjust 0xffff for offset */
+ shr %cl, %r9d /* adjust for 16-byte offset */
+ sub %r9d, %edx
+ jnz LABEL(less32bytes) /* mismatch or null char seen */
+ movdqa (%rdi), %xmm3
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads*/
+ mov $1, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 1(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_1_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_1_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $1, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_1_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $1, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_1_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_1_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $1, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $14, %ecx
+ ja LABEL(loop_ashr_1_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_2
+ * 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
+LABEL(ashr_2):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $14, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $2, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 2(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_2_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_2_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $2, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_2_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $2, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_2_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_2_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $2, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $13, %ecx
+ ja LABEL(loop_ashr_2_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_3
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(13~15) n -13 2(15 +(n-13) - n) ashr_3
+ */
+ .p2align 4
+LABEL(ashr_3):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $13, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $3, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 3(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+LABEL(loop_ashr_3_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_3_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $3, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_3_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $3, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_3_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_3_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $3, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $12, %ecx
+ ja LABEL(loop_ashr_3_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_4
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(12~15) n -12 3(15 +(n-12) - n) ashr_4
+ */
+ .p2align 4
+LABEL(ashr_4):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $12, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $4, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 4(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_4_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_4_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $4, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_4_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $4, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_4_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_4_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $4, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $11, %ecx
+ ja LABEL(loop_ashr_4_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_5):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $11, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $5, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 5(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_5_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_5_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $5, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_5_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+
+ palignr $5, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_5_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_5_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $5, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $10, %ecx
+ ja LABEL(loop_ashr_5_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_6):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $10, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $6, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 6(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_6_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_6_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $6, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_6_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $6, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_6_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_6_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $6, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $9, %ecx
+ ja LABEL(loop_ashr_6_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_7):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $9, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $7, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 7(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_7_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_7_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $7, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_7_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $7, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_7_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_7_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $7, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $8, %ecx
+ ja LABEL(loop_ashr_7_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_8):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $8, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $8, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 8(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_8_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_8_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $8, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_8_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $8, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_8_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_8_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $8, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $7, %ecx
+ ja LABEL(loop_ashr_8_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_9):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $7, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $9, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 9(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_9_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_9_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+
+ palignr $9, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_9_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $9, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_9_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_9_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $9, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $6, %ecx
+ ja LABEL(loop_ashr_9_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_10):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $6, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $10, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 10(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_10_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_10_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $10, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_10_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $10, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_10_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_10_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $10, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $5, %ecx
+ ja LABEL(loop_ashr_10_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_11):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $5, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $11, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 11(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_11_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_11_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $11, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_11_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $11, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_11_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_11_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $11, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $4, %ecx
+ ja LABEL(loop_ashr_11_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_12):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $4, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $12, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 12(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_12_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_12_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $12, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_12_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $12, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_12_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_12_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $12, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $3, %ecx
+ ja LABEL(loop_ashr_12_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_13):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $3, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $13, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 13(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_13_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_13_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $13, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_13_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $13, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_13_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_13_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $13, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $2, %ecx
+ ja LABEL(loop_ashr_13_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_14):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $2, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $14, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 14(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_14_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_14_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $14, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_14_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $14, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_14_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_14_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $14, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $1, %ecx
+ ja LABEL(loop_ashr_14_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * 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
+ */
+ .p2align 4
+LABEL(ashr_15):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $1, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $15, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 15(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_15_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_15_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $15, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_15_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $15, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_15_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_15_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $15, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $0, %ecx
+ ja LABEL(loop_ashr_15_use_sse4_2)
+
+LABEL(nibble_ashr_use_sse4_2_exit):
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ .p2align 4
+LABEL(use_sse4_2_exit):
+ jnc LABEL(strcmp_exitz)
+#ifdef USE_AS_STRNCMP
+ sub %rcx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add %rcx, %rdx
+ lea -16(%rdi, %r9), %rdi
+ movzbl (%rdi, %rdx), %eax
+ movzbl (%rsi, %rdx), %edx
+ test %r8d, %r8d
+ jz LABEL(use_sse4_2_ret)
+ xchg %eax, %edx
+LABEL(use_sse4_2_ret):
+ sub %edx, %eax
+ ret
+
+ .p2align 4
+LABEL(aftertail):
+ pcmpeqb %xmm3, %xmm1
+ psubb %xmm0, %xmm1
+ pmovmskb %xmm1, %edx
+ not %edx
+
+ .p2align 4
+LABEL(exit):
+ lea -16(%r9, %rcx), %rax /* locate the exact offset for rdi */
+LABEL(less32bytes):
+ lea (%rdi, %rax), %rdi /* locate the exact address for first operand(rdi) */
+ lea (%rsi, %rcx), %rsi /* locate the exact address for second operand(rsi) */
+ test %r8d, %r8d
+ jz LABEL(ret)
+ xchg %rsi, %rdi /* recover original order according to flag(%r8d) */
+
+ .p2align 4
+LABEL(ret):
+LABEL(less16bytes):
+ /*
+ * Check to see if BSF is fast on this processor. If not, use a different
+ * exit tail.
+ */
+ bsf %rdx, %rdx /* find and store bit index in %rdx */
+
+#ifdef USE_AS_STRNCMP
+ sub %rdx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ xor %ecx, %ecx /* clear %ecx */
+ xor %eax, %eax /* clear %eax */
+
+ movb (%rsi, %rdx), %cl
+ movb (%rdi, %rdx), %al
+
+ sub %ecx, %eax
+ ret
+
+LABEL(strcmp_exitz):
+ xor %eax, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte0):
+ /*
+ * never need to handle byte 0 for strncmpy
+#ifdef USE_AS_STRNCMP
+ sub $0, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ */
+ movzx (%rsi), %ecx
+ movzx (%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte1):
+
+#ifdef USE_AS_STRNCMP
+ sub $1, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 1(%rsi), %ecx
+ movzx 1(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte2):
+
+#ifdef USE_AS_STRNCMP
+ sub $2, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 2(%rsi), %ecx
+ movzx 2(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte3):
+
+#ifdef USE_AS_STRNCMP
+ sub $3, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 3(%rsi), %ecx
+ movzx 3(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte4):
+
+#ifdef USE_AS_STRNCMP
+ sub $4, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 4(%rsi), %ecx
+ movzx 4(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte5):
+
+#ifdef USE_AS_STRNCMP
+ sub $5, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 5(%rsi), %ecx
+ movzx 5(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte6):
+
+#ifdef USE_AS_STRNCMP
+ sub $6, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 6(%rsi), %ecx
+ movzx 6(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(next_8_bytes):
+ add $8, %rdi
+ add $8, %rsi
+#ifdef USE_AS_STRNCMP
+ sub $8, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ test $0x01, %dh
+ jnz LABEL(Byte0)
+
+ test $0x02, %dh
+ jnz LABEL(Byte1)
+
+ test $0x04, %dh
+ jnz LABEL(Byte2)
+
+ test $0x08, %dh
+ jnz LABEL(Byte3)
+
+ test $0x10, %dh
+ jnz LABEL(Byte4)
+
+ test $0x20, %dh
+ jnz LABEL(Byte5)
+
+ test $0x40, %dh
+ jnz LABEL(Byte6)
+
+#ifdef USE_AS_STRNCMP
+ sub $7, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 7(%rsi), %ecx
+ movzx 7(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+ cfi_endproc
+ .size STRCMP_SSE42, .-STRCMP_SSE42
+
+ /* Put all SSE 4.2 functions together. */
+ .section .rodata.sse4.2,"a",@progbits
+ .p2align 4
+LABEL(unaligned_table):
+ .int LABEL(ashr_1) - LABEL(unaligned_table)
+ .int LABEL(ashr_2) - LABEL(unaligned_table)
+ .int LABEL(ashr_3) - LABEL(unaligned_table)
+ .int LABEL(ashr_4) - LABEL(unaligned_table)
+ .int LABEL(ashr_5) - LABEL(unaligned_table)
+ .int LABEL(ashr_6) - LABEL(unaligned_table)
+ .int LABEL(ashr_7) - LABEL(unaligned_table)
+ .int LABEL(ashr_8) - LABEL(unaligned_table)
+ .int LABEL(ashr_9) - LABEL(unaligned_table)
+ .int LABEL(ashr_10) - LABEL(unaligned_table)
+ .int LABEL(ashr_11) - LABEL(unaligned_table)
+ .int LABEL(ashr_12) - LABEL(unaligned_table)
+ .int LABEL(ashr_13) - LABEL(unaligned_table)
+ .int LABEL(ashr_14) - LABEL(unaligned_table)
+ .int LABEL(ashr_15) - LABEL(unaligned_table)
+ .int LABEL(ashr_0) - LABEL(unaligned_table)
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type STRCMP_SSE2, @function; \
+ STRCMP_SSE2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size STRCMP_SSE2, .-STRCMP_SSE2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal strcmp calls through a PLT.
+ The speedup we get from using SSE4.2 instruction is likely eaten away
+ by the indirect call in the PLT. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_STRCMP; __GI_STRCMP = STRCMP_SSE2
+#endif
+
+#ifndef USE_AS_STRNCMP
+#include "../strcmp.S"
+#endif
diff --git a/sysdeps/x86_64/multiarch/strncmp-c.c b/sysdeps/x86_64/multiarch/strncmp-c.c
new file mode 100644
index 0000000000..d4f74a418d
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strncmp-c.c
@@ -0,0 +1,8 @@
+#ifdef SHARED
+#define STRNCMP __strncmp_sse2
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strncmp_sse2, __GI_strncmp, __strncmp_sse2);
+#endif
+
+#include "strncmp.c"
diff --git a/sysdeps/x86_64/multiarch/strncmp.S b/sysdeps/x86_64/multiarch/strncmp.S
new file mode 100644
index 0000000000..0af34e7f15
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strncmp.S
@@ -0,0 +1,3 @@
+#define STRCMP strncmp
+#define USE_AS_STRNCMP
+#include "strcmp.S"
diff --git a/time/tzfile.c b/time/tzfile.c
index d8bd55a130..f4cba46e50 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -419,6 +419,10 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
tzspec = __tzstring (tzstr);
}
+ /* Don't use an empty TZ string. */
+ if (tzspec != NULL && tzspec[0] == '\0')
+ tzspec = NULL;
+
fclose (f);
/* First "register" all timezone names. */