summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/.gitattributes1
-rw-r--r--libc/ChangeLog366
-rw-r--r--libc/Makeconfig16
-rw-r--r--libc/NEWS5
-rw-r--r--libc/Versions.def1
-rw-r--r--libc/assert/assert-perr.c10
-rw-r--r--libc/assert/assert.c11
-rw-r--r--libc/csu/elf-init.c6
-rw-r--r--libc/dlfcn/dlfcn.h5
-rw-r--r--libc/elf/Makefile161
-rw-r--r--libc/elf/dl-lookup.c17
-rw-r--r--libc/elf/dl-sysdep.c2
-rw-r--r--libc/elf/ifuncdep1.c3
-rw-r--r--libc/elf/ifuncdep1pic.c3
-rw-r--r--libc/elf/ifuncdep2.c72
-rw-r--r--libc/elf/ifuncdep2pic.c3
-rw-r--r--libc/elf/ifuncdep5.c3
-rw-r--r--libc/elf/ifuncdep5pic.c3
-rw-r--r--libc/elf/ifuncmain1.c66
-rw-r--r--libc/elf/ifuncmain1pic.c3
-rw-r--r--libc/elf/ifuncmain1picstatic.c3
-rw-r--r--libc/elf/ifuncmain1pie.c3
-rw-r--r--libc/elf/ifuncmain1static.c3
-rw-r--r--libc/elf/ifuncmain1staticpic.c3
-rw-r--r--libc/elf/ifuncmain1staticpie.c3
-rw-r--r--libc/elf/ifuncmain1vis.c89
-rw-r--r--libc/elf/ifuncmain1vispic.c3
-rw-r--r--libc/elf/ifuncmain1vispie.c3
-rw-r--r--libc/elf/ifuncmain2.c16
-rw-r--r--libc/elf/ifuncmain2pic.c3
-rw-r--r--libc/elf/ifuncmain2picstatic.c3
-rw-r--r--libc/elf/ifuncmain2static.c3
-rw-r--r--libc/elf/ifuncmain3.c120
-rw-r--r--libc/elf/ifuncmain4.c4
-rw-r--r--libc/elf/ifuncmain4picstatic.c3
-rw-r--r--libc/elf/ifuncmain4static.c3
-rw-r--r--libc/elf/ifuncmain5.c40
-rw-r--r--libc/elf/ifuncmain5pic.c3
-rw-r--r--libc/elf/ifuncmain5picstatic.c3
-rw-r--r--libc/elf/ifuncmain5pie.c3
-rw-r--r--libc/elf/ifuncmain5static.c3
-rw-r--r--libc/elf/ifuncmain5staticpic.c3
-rw-r--r--libc/elf/ifuncmain6pie.c63
-rw-r--r--libc/elf/ifuncmain7.c70
-rw-r--r--libc/elf/ifuncmain7pic.c7
-rw-r--r--libc/elf/ifuncmain7picstatic.c7
-rw-r--r--libc/elf/ifuncmain7pie.c7
-rw-r--r--libc/elf/ifuncmain7static.c7
-rw-r--r--libc/elf/ifuncmod1.c114
-rw-r--r--libc/elf/ifuncmod3.c8
-rw-r--r--libc/elf/ifuncmod5.c78
-rw-r--r--libc/elf/ifuncmod6.c19
-rw-r--r--libc/include/stdlib.h3
-rw-r--r--libc/include/unistd.h2
-rw-r--r--libc/inet/netinet/icmp6.h4
-rw-r--r--libc/libio/Makefile1
-rw-r--r--libc/libio/fileops.c6
-rw-r--r--libc/libio/tst-fgetwc.c2
-rw-r--r--libc/localedata/ChangeLog18
-rw-r--r--libc/localedata/SUPPORTED1
-rw-r--r--libc/localedata/locales/de_AT3
-rw-r--r--libc/localedata/locales/dv_MV180
-rw-r--r--libc/localedata/locales/ur_IN184
-rw-r--r--libc/login/Makefile20
-rw-r--r--libc/login/programs/pt_chown.c52
-rw-r--r--libc/malloc/malloc.c29
-rw-r--r--libc/manual/charset.texi2
-rw-r--r--libc/misc/sys/select.h4
-rw-r--r--libc/nis/nss_compat/compat-initgroups.c200
-rw-r--r--libc/nis/nss_nis/nis-pwd.c4
-rw-r--r--libc/nptl/ChangeLog15
-rw-r--r--libc/nptl/Makefile2
-rw-r--r--libc/nptl/Versions4
-rw-r--r--libc/nptl/sysdeps/pthread/bits/sigthread.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S2
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c83
-rw-r--r--libc/nscd/Makefile11
-rw-r--r--libc/nss/getent.c66
-rw-r--r--libc/po/bg.po16
-rw-r--r--libc/po/id.po10
-rw-r--r--libc/po/sv.po48
-rw-r--r--libc/posix/Makefile2
-rw-r--r--libc/posix/Versions3
-rw-r--r--libc/posix/execvp.c192
-rw-r--r--libc/posix/execvpe.c221
-rw-r--r--libc/posix/tst-cpucount.c3
-rw-r--r--libc/posix/unistd.h8
-rw-r--r--libc/resolv/res_send.c3
-rw-r--r--libc/stdlib/Versions2
-rw-r--r--libc/stdlib/abort.c6
-rw-r--r--libc/string/strncmp.c12
-rw-r--r--libc/string/test-memchr.c9
-rw-r--r--libc/sunrpc/rpcinfo.c3
-rw-r--r--libc/sysdeps/generic/pty-private.h5
-rw-r--r--libc/sysdeps/i386/dl-irel.h5
-rw-r--r--libc/sysdeps/i386/dl-machine.h4
-rw-r--r--libc/sysdeps/posix/libc_fatal.c17
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/memcpy.S56
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/memset.S6
-rw-r--r--libc/sysdeps/unix/grantpt.c28
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/socket.h6
-rw-r--r--libc/sysdeps/unix/sysv/linux/grantpt.c81
-rw-r--r--libc/sysdeps/unix/sysv/linux/libc_fatal.c18
-rw-r--r--libc/sysdeps/unix/sysv/linux/net/if_arp.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h16
-rw-r--r--libc/sysdeps/x86_64/bits/select.h36
-rw-r--r--libc/sysdeps/x86_64/dl-irel.h3
-rw-r--r--libc/sysdeps/x86_64/dl-machine.h4
-rw-r--r--libc/sysdeps/x86_64/memchr.S6
-rw-r--r--libc/sysdeps/x86_64/multiarch/Makefile5
-rw-r--r--libc/sysdeps/x86_64/multiarch/ifunc-defines.sym15
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.h5
-rw-r--r--libc/sysdeps/x86_64/multiarch/rawmemchr.S93
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcmp.S1677
-rw-r--r--libc/sysdeps/x86_64/multiarch/strlen.S93
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncmp-c.c8
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncmp.S3
-rw-r--r--libc/sysdeps/x86_64/rawmemchr.S7
-rw-r--r--libc/sysdeps/x86_64/strlen.S17
-rw-r--r--libc/time/tzfile.c13
-rw-r--r--libc/timezone/africa140
-rw-r--r--libc/timezone/antarctica4
-rw-r--r--libc/timezone/asia184
-rw-r--r--libc/timezone/australasia25
-rw-r--r--libc/timezone/backward6
-rw-r--r--libc/timezone/etcetera5
-rw-r--r--libc/timezone/europe65
-rw-r--r--libc/timezone/factory5
-rw-r--r--libc/timezone/iso3166.tab6
-rw-r--r--libc/timezone/leapseconds39
-rw-r--r--libc/timezone/northamerica43
-rw-r--r--libc/timezone/pacificnew5
-rw-r--r--libc/timezone/solar875
-rw-r--r--libc/timezone/solar885
-rw-r--r--libc/timezone/solar895
-rw-r--r--libc/timezone/southamerica160
-rw-r--r--libc/timezone/systemv5
-rw-r--r--libc/timezone/tzselect.ksh2
-rwxr-xr-xlibc/timezone/yearistype5
-rw-r--r--libc/timezone/zdump.c13
-rw-r--r--libc/timezone/zic.c6
-rw-r--r--libc/timezone/zone.tab28
-rw-r--r--ports/ChangeLog.arm16
-rw-r--r--ports/ChangeLog.mips5
-rw-r--r--ports/sysdeps/arm/eabi/Makefile4
-rw-r--r--ports/sysdeps/arm/eabi/backtrace.c126
-rw-r--r--ports/sysdeps/arm/preconfigure4
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/eabi/configure1
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in1
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h7
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/bits/socket.h8
151 files changed, 5390 insertions, 675 deletions
diff --git a/libc/.gitattributes b/libc/.gitattributes
new file mode 100644
index 000000000..8947e726a
--- /dev/null
+++ b/libc/.gitattributes
@@ -0,0 +1 @@
+timezone/* -whitespace
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 6355577d8..4ef72fc02 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,369 @@
+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: 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.
+
+ [BZ #10195]
+ * inet/netinet/icmp6.h (struct nd_opt_home_agent_info): Change type
+ of nd_opt_home_agent_info_preference to uint16_t.
+ Patch by Arnaud Ebalard <arno@natisbad.org>.
+
+ [BZ #10207]
+ * nss/getent.c: Add support for printing gshadow data.
+
+ [BZ #10203]
+ * nis/nss_nis/nis-pwd.c (internal_nis_endpwent): Free all buffers,
+ not just the currently used one and those which follow.
+ Patch by Joe Landers <jlanders@vmware.com>.
+
+ [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]
+ * stdlib/abort.c: Define variable __abort_msg.
+ * stdlib/Versions: Export __abort_msg with GLIBC_PRIVATE version.
+ * include/stdlib.h: Declare __abort_msg.
+ * assert/assert-perr.c: Don't free buffer for message immediately.
+ Store atomically in __abort_msg and free old buffer if necessary.
+ * assert/assert.c: Likewise.
+ * sysdeps/posix/libc_fatal.c: Allocate buffer for message, copy it,
+ store pointer in __abort_msg, and possibly free old string.
+ * sysdeps/unix/sysv/linux/libc_fatal.c: Likewise.
+
+ * time/tzfile.c (__tzfile_read): Correct computation of tzspec_len.
+
+ [BZ #10211]
+ * time/tzfile.c (__tzfile_compute): If we use the envvar format still
+ handle leap seconds if they are available.
+ Patch by Akinori Hattori <hattya@gentoo.org>.
+
+ * timezone/tzselect.ksh: Update from tzcode2009i.
+ * timezone/zdump.c: Likewise.
+ * timezone/zic.c: Likewise.
+
+ * timezone/africa: Update from tzdata2009i.
+ * timezone/antarctica: Likewise.
+ * timezone/asia: Likewise.
+ * timezone/australasia: Likewise.
+ * timezone/backward: Likewise.
+ * timezone/etcetera: Likewise.
+ * timezone/europe: Likewise.
+ * timezone/factory: Likewise.
+ * timezone/iso3166.tab: Likewise.
+ * timezone/leapseconds: Likewise.
+ * timezone/northamerica: Likewise.
+ * timezone/pacificnew: Likewise.
+ * timezone/solar87: Likewise.
+ * timezone/solar88: Likewise.
+ * timezone/solar89: Likewise.
+ * timezone/southamerica: Likewise.
+ * timezone/systemv: Likewise.
+ * timezone/yearistype: Likewise.
+ * timezone/zone.tab: Likewise.
+
+2009-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/dl-lookup.c (_dl_debug_bindings): When resolving to
+ STT_GNU_IFUNC symbol or in 8 into type_class.
+
+ * sysdeps/i386/dl-irel.h (elf_irel): Use Elf32_Addr type
+ instead of Elf64_Addr.
+
+2009-06-14 Ulrich Drepper <drepper@redhat.com>
+
+ * po/sv.po: Update from translation team.
+
+ [BZ #10229]
+ * misc/sys/select.h (__NFDBITS): Expression should have type int.
+ * sysdeps/x86_64/bits/select.h: Remove asm versions for __FD_SET,
+ __FD_CLR, and __FD_ISSET. gcc nowadays generates better code from
+ the C version.
+
+2009-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * Versions.def: Add GLIBC_2.11 for libpthread.
+
+2009-06-11 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/res_send.c (send_dg): Remember we switched to
+ single-request mode.
+
+2009-06-09 Ulrich Drepper <drepper@redhat.com>
+
+ * dlfcn/dlfcn.h: Remove comma at end of enum.
+ Patch by J.H.M. Dassen <rdassen@redhat.com>.
+
+ * libio/fileops.c (_IO_new_file_fopen): Don't prematurely stop
+ parsing mode string.
+
+2009-06-05 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/rawmemchr.S: Minor optimization.
+
+ * sysdeps/x86_64/multiarch/rawmemchr.S: New file.
+
+ * sysdeps/x86_64/multiarch/strlen.S: New file.
+ * sysdeps/x86_64/multiarch/ifunc-defines.sym: New file.
+ * sysdeps/x86_64/multiarch/Makefile: Add rule to build ifunc-defines.h.
+ * sysdeps/x86_64/multiarch/init-arch.h: Name structure with register
+ content.
+
+ * csu/elf-init.c: Only compile in IFUNC functionality if USE_MULTIARCH
+ is defined.
+
+2009-06-04 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/strlen.S: Minor optimizations.
+
+2009-06-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/Makefile (distribute): Add ifuncmain1.c, ifuncmain1pic.c,
+ ifuncmain1vis.c, ifuncmain1vispic.c, ifuncmain1static.c,
+ ifuncmain1staticpic.c, ifuncmain1picstatic.c, ifuncdep1.c,
+ ifuncdep1pic.c, ifuncmod1.c, ifuncmain1pie.c, ifuncmain1vispie.c,
+ ifuncmain2.c, ifuncmain2static.c, ifuncdep2.c,
+ funcmain2pic.c, ifuncmain2picstatic.c, ifuncdep2pic.c,
+ ifuncmain3.c, ifuncmod3.c,.
+ ifuncmain4.c, ifuncmain4static.c, ifuncmain4picstatic.c.
+ (tests-static): Add ifuncmain1static, ifuncmain1picstatic,
+ ifuncmain2static, ifuncmain2picstatic, ifuncmain4static,
+ ifuncmain4picstatic.
+ (tests): Add ifuncmain1, ifuncmain1pic, ifuncmain1vis,
+ ifuncmain1vispic, ifuncmain1staticpic, ifuncmain2, ifuncmain2pic,
+ ifuncmain3, ifuncmain4.
+ (tests): Depend on $(objpfx)ifuncmain1pie.out and
+ $(objpfx)ifuncmain1vispie.out.
+ (modules-names): Add ifuncmod1 ifuncmod3.
+ (generated): Add ifuncmain1pie ifuncmain1pie.out
+ ifuncmain1vispie ifuncmain1vispie.out.
+ Define rules to build and run the tests.
+ * elf/ifuncdep1.c: New file.
+ * elf/ifuncdep1pic.c: New file.
+ * elf/ifuncdep2.c: New file.
+ * elf/ifuncdep2pic.c: New file.
+ * elf/ifuncmain1.c: New file.
+ * elf/ifuncmain1pic.c: New file.
+ * elf/ifuncmain1picstatic.c: New file.
+ * elf/ifuncmain1pie.c: New file.
+ * elf/ifuncmain1static.c: New file.
+ * elf/ifuncmain1staticpic.c: New file.
+ * elf/ifuncmain1vis.c: New file..
+ * elf/ifuncmain1vispic.c: New file..
+ * elf/ifuncmain1vispie.c: New file.
+ * elf/ifuncmain2.c: New file.
+ * elf/ifuncmain2pic.c: New file.
+ * elf/ifuncmain2picstatic.c: New file.
+ * elf/ifuncmain2static.c: New file.
+ * elf/ifuncmain3.c: New file.
+ * elf/ifuncmain4.c: New file.
+ * elf/ifuncmain4picstatic.c: New file.
+ * elf/ifuncmain4static.c: New file.
+ * elf/ifuncmod1.c: New file.
+ * elf/ifuncmod3.c: New file.
+
+2009-06-03 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-sysdep.c (_dl_show_auxv): Terminate correct string.
+
+2009-06-02 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10221]
+ * posix/Makefile (routines): Add execvpe.
+ * posix/Versions: Export execvpe for GLIBC_2.11.
+ * posix/execvp.c: Now only a wrapper. Move code to...
+ * posix/execvpe.c: ...here. New file.
+ * posix/unistd.h: Declare execvpe.
+
+2009-06-01 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/i386/dl-machine.h (elf_machine_rel): Reorder conditions
+ for STT_GNU_IFUNC handling for efficiency.
+ * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
+
+ * sysdeps/i386/dl-irel.h (elf_irel): Use __libc_fatal instead of just
+ _exit.
+ * sysdeps/x86_64/dl-irel.h (elf_irela): Likewise.
+
2009-05-31 Ulrich Drepper <drepper@redhat.com>
* sysdeps/x86_64/multiarch/sched_cpucount.c: Also use optimized code
diff --git a/libc/Makeconfig b/libc/Makeconfig
index 6239966ac..4ddb087a3 100644
--- a/libc/Makeconfig
+++ b/libc/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/libc/NEWS b/libc/NEWS
index 5ca4e6058..6990dcc26 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2009-5-31
+GNU C Library NEWS -- history of user-visible changes. 2009-6-1
Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -7,6 +7,9 @@ using `glibc' in the "product" field.
Version 2.11
+* New interfaces: execvpe
+ Implemented by Ulrich Drepper.
+
* checking version of longjmp added that fails if an uninitialized stack
frame would be created. Implemented by Ulrich Drepper.
diff --git a/libc/Versions.def b/libc/Versions.def
index 558f7c3ed..a8a9cd275 100644
--- a/libc/Versions.def
+++ b/libc/Versions.def
@@ -89,6 +89,7 @@ libpthread {
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.6
+ GLIBC_2.11
GLIBC_PRIVATE
}
libresolv {
diff --git a/libc/assert/assert-perr.c b/libc/assert/assert-perr.c
index dd5424636..f239fab86 100644
--- a/libc/assert/assert-perr.c
+++ b/libc/assert/assert-perr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-1998,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1994-1998,2001,2002,2005,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
@@ -17,6 +17,7 @@
02111-1307 USA. */
#include <assert.h>
+#include <atomic.h>
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -64,9 +65,10 @@ __assert_perror_fail (int errnum,
(void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);
- /* We have to free the buffer since the appplication might catch the
- SIGABRT. */
- free (buf);
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
}
else
{
diff --git a/libc/assert/assert.c b/libc/assert/assert.c
index 0ef4ca62e..727fb1446 100644
--- a/libc/assert/assert.c
+++ b/libc/assert/assert.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1994-1996,1998,2001,2002,2005
+/* Copyright (C) 1991,1994-1996,1998,2001,2002,2005,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <assert.h>
+#include <atomic.h>
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,6 +44,7 @@ extern const char *__progname;
# include FATAL_PREPARE_INCLUDE
#endif
+
#undef __assert_fail
void
__assert_fail (const char *assertion, const char *file, unsigned int line,
@@ -64,9 +66,10 @@ __assert_fail (const char *assertion, const char *file, unsigned int line,
(void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);
- /* We have to free the buffer since the application might catch the
- SIGABRT. */
- free (buf);
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
}
else
{
diff --git a/libc/csu/elf-init.c b/libc/csu/elf-init.c
index 5a99a3a40..d5ec912cb 100644
--- a/libc/csu/elf-init.c
+++ b/libc/csu/elf-init.c
@@ -1,5 +1,5 @@
/* Startup support for ELF initializers/finalizers in the main executable.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 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
@@ -36,7 +36,7 @@
#include <stddef.h>
-#ifndef LIBC_NONSHARED
+#if defined USE_MULTIARCH && !defined LIBC_NONSHARED
# include <link.h>
# include <dl-irel.h>
@@ -80,7 +80,7 @@ __libc_csu_init (int argc, char **argv, char **envp)
/* For dynamically linked executables the preinit array is executed by
the dynamic linker (before initializing any shared object. */
-#ifndef LIBC_NONSHARED
+#if defined USE_MULTIARCH && !defined LIBC_NONSHARED
# ifdef ELF_MACHINE_IRELA
{
const size_t size = __rela_iplt_end - __rela_iplt_start;
diff --git a/libc/dlfcn/dlfcn.h b/libc/dlfcn/dlfcn.h
index 7e373eddf..3e461dfec 100644
--- a/libc/dlfcn/dlfcn.h
+++ b/libc/dlfcn/dlfcn.h
@@ -1,6 +1,5 @@
/* User functions for run-time dynamic loading.
- Copyright (C) 1995-1999,2000,2001,2003,2004,2006
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2001,2003,2004,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
@@ -164,7 +163,7 @@ enum
segment, or if the calling thread has not allocated a block for it. */
RTLD_DI_TLS_DATA = 10,
- RTLD_DI_MAX = 10,
+ RTLD_DI_MAX = 10
};
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index 7e433cd68..eb56734e9 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -93,7 +93,24 @@ distribute := rtld-Rules \
order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
tst-stackguard1.c tst-stackguard1-static.c \
tst-array5.c tst-array5-static.c tst-array5dep.c \
- tst-array5.exp tst-leaks1.c check-execstack.c
+ tst-array5.exp tst-leaks1.c check-execstack.c \
+ ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \
+ ifuncmain1vispic.c ifuncmain1static.c \
+ 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 \
+ 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
@@ -233,6 +250,28 @@ test-extras += $(modules-names)
# filtmod1.so has a special rule
modules-names-nobuild := filtmod1
+ifeq (yes,$(multi-arch))
+tests-static += ifuncmain1static ifuncmain1picstatic \
+ ifuncmain2static ifuncmain2picstatic \
+ ifuncmain4static ifuncmain4picstatic \
+ ifuncmain5static ifuncmain5picstatic \
+ ifuncmain7static ifuncmain7picstatic
+
+ifeq (yes,$(build-shared))
+tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
+ ifuncmain1staticpic \
+ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
+ ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
+ ifuncmain7 ifuncmain7pic
+ifeq (yes,$(have-fpie))
+tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out \
+ $(objpfx)ifuncmain1staticpie.out $(objpfx)ifuncmain5pie.out \
+ $(objpfx)ifuncmain6pie.out $(objpfx)ifuncmain7pie.out
+endif
+modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
+endif
+endif
+
include ../Rules
@@ -507,6 +546,9 @@ reldep8mod2.so-no-z-defs = yes
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.
@@ -834,14 +876,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
@@ -962,3 +997,111 @@ tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
$(objpfx)tst-addr1: $(libdl)
$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
+
+CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
+CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
+CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
+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) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
+ $(+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-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)
+$(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
+$(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
+$(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
+$(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
+$(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
+$(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
+$(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
+$(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
+$(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
+$(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/libc/elf/dl-lookup.c b/libc/elf/dl-lookup.c
index 92dc7b226..707d65071 100644
--- a/libc/elf/dl-lookup.c
+++ b/libc/elf/dl-lookup.c
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2005, 2006, 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
@@ -542,15 +542,20 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
conflict = 1;
}
- if (value->s
- && (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
- == STT_TLS, 0)))
- type_class = 4;
+ if (value->s)
+ {
+ if (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
+ == STT_TLS, 0))
+ type_class = 4;
+ else if (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
+ == STT_GNU_IFUNC, 0))
+ type_class |= 8;
+ }
if (conflict
|| GLRO(dl_trace_prelink_map) == undef_map
|| GLRO(dl_trace_prelink_map) == NULL
- || type_class == 4)
+ || type_class >= 4)
{
_dl_printf ("%s 0x%0*Zx 0x%0*Zx -> 0x%0*Zx 0x%0*Zx ",
conflict ? "conflict" : "lookup",
diff --git a/libc/elf/dl-sysdep.c b/libc/elf/dl-sysdep.c
index db1001253..5700272f1 100644
--- a/libc/elf/dl-sysdep.c
+++ b/libc/elf/dl-sysdep.c
@@ -335,7 +335,7 @@ _dl_show_auxv (void)
/* Unknown value: print a generic line. */
char buf2[17];
- buf[sizeof (buf2) - 1] = '\0';
+ buf2[sizeof (buf2) - 1] = '\0';
const char *val2 = _itoa ((unsigned long int) av->a_un.a_val,
buf2 + sizeof buf2 - 1, 16, 0);
const char *val = _itoa ((unsigned long int) av->a_type,
diff --git a/libc/elf/ifuncdep1.c b/libc/elf/ifuncdep1.c
new file mode 100644
index 000000000..77d663dce
--- /dev/null
+++ b/libc/elf/ifuncdep1.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols without -fPIC. */
+
+#include "ifuncmod1.c"
diff --git a/libc/elf/ifuncdep1pic.c b/libc/elf/ifuncdep1pic.c
new file mode 100644
index 000000000..b6381e486
--- /dev/null
+++ b/libc/elf/ifuncdep1pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmod1.c"
diff --git a/libc/elf/ifuncdep2.c b/libc/elf/ifuncdep2.c
new file mode 100644
index 000000000..fb21eef5c
--- /dev/null
+++ b/libc/elf/ifuncdep2.c
@@ -0,0 +1,72 @@
+/* Test 3 STT_GNU_IFUNC symbols. */
+
+extern int global;
+
+static int
+one (void)
+{
+ return 1;
+}
+
+static int
+minus_one (void)
+{
+ return -1;
+}
+
+static int
+zero (void)
+{
+ return 0;
+}
+
+void * foo1_ifunc (void) __asm__ ("foo1");
+__asm__(".type foo1, %gnu_indirect_function");
+
+void *
+foo1_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return minus_one;
+ default:
+ return zero;
+ }
+}
+
+void * foo2_ifunc (void) __asm__ ("foo2");
+__asm__(".type foo2, %gnu_indirect_function");
+
+void *
+foo2_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return minus_one;
+ case -1:
+ return one;
+ default:
+ return zero;
+ }
+}
+
+void * foo3_ifunc (void) __asm__ ("foo3");
+__asm__(".type foo3, %gnu_indirect_function");
+
+void *
+foo3_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return zero;
+ default:
+ return minus_one;
+ }
+}
diff --git a/libc/elf/ifuncdep2pic.c b/libc/elf/ifuncdep2pic.c
new file mode 100644
index 000000000..a84253dbc
--- /dev/null
+++ b/libc/elf/ifuncdep2pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncdep2.c"
diff --git a/libc/elf/ifuncdep5.c b/libc/elf/ifuncdep5.c
new file mode 100644
index 000000000..f26234336
--- /dev/null
+++ b/libc/elf/ifuncdep5.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols without -fPIC. */
+
+#include "ifuncmod5.c"
diff --git a/libc/elf/ifuncdep5pic.c b/libc/elf/ifuncdep5pic.c
new file mode 100644
index 000000000..3edb3a07c
--- /dev/null
+++ b/libc/elf/ifuncdep5pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmod5.c"
diff --git a/libc/elf/ifuncmain1.c b/libc/elf/ifuncmain1.c
new file mode 100644
index 000000000..de7ffe877
--- /dev/null
+++ b/libc/elf/ifuncmain1.c
@@ -0,0 +1,66 @@
+/* Test STT_GNU_IFUNC symbols:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Visibility without override.
+ */
+
+#include <stdlib.h>
+
+int global = -1;
+
+int ret_foo;
+int ret_foo_hidden;
+int ret_foo_protected;
+
+extern int foo (void);
+extern int foo_protected (void);
+
+#ifndef FOO_P
+typedef int (*foo_p) (void);
+#endif
+
+foo_p foo_ptr = foo;
+foo_p foo_procted_ptr = foo_protected;
+
+extern foo_p get_foo_p (void);
+extern foo_p get_foo_hidden_p (void);
+extern foo_p get_foo_protected_p (void);
+
+int
+main (void)
+{
+ foo_p p;
+
+ if (foo_ptr != foo)
+ abort ();
+ if (foo () != -1)
+ abort ();
+ if ((*foo_ptr) () != -1)
+ abort ();
+
+ if (foo_procted_ptr != foo_protected)
+ abort ();
+ if (foo_protected () != 0)
+ abort ();
+ if ((*foo_procted_ptr) () != 0)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if (ret_foo != -1 || (*p) () != ret_foo)
+ abort ();
+
+ p = get_foo_hidden_p ();
+ if (ret_foo_hidden != 1 || (*p) () != ret_foo_hidden)
+ abort ();
+
+ p = get_foo_protected_p ();
+ if (p != foo_protected)
+ abort ();
+ if (ret_foo_protected != 0 || (*p) () != ret_foo_protected)
+ abort ();
+
+ return 0;
+}
diff --git a/libc/elf/ifuncmain1pic.c b/libc/elf/ifuncmain1pic.c
new file mode 100644
index 000000000..db19dc967
--- /dev/null
+++ b/libc/elf/ifuncmain1pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1picstatic.c b/libc/elf/ifuncmain1picstatic.c
new file mode 100644
index 000000000..c93793302
--- /dev/null
+++ b/libc/elf/ifuncmain1picstatic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1pie.c b/libc/elf/ifuncmain1pie.c
new file mode 100644
index 000000000..c16ef6dd0
--- /dev/null
+++ b/libc/elf/ifuncmain1pie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1static.c b/libc/elf/ifuncmain1static.c
new file mode 100644
index 000000000..fdd1e0902
--- /dev/null
+++ b/libc/elf/ifuncmain1static.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1staticpic.c b/libc/elf/ifuncmain1staticpic.c
new file mode 100644
index 000000000..39e0cbb4b
--- /dev/null
+++ b/libc/elf/ifuncmain1staticpic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and no DSO. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1staticpie.c b/libc/elf/ifuncmain1staticpie.c
new file mode 100644
index 000000000..489111426
--- /dev/null
+++ b/libc/elf/ifuncmain1staticpie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE and no DSO. */
+
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain1vis.c b/libc/elf/ifuncmain1vis.c
new file mode 100644
index 000000000..a239d2dd0
--- /dev/null
+++ b/libc/elf/ifuncmain1vis.c
@@ -0,0 +1,89 @@
+/* Test STT_GNU_IFUNC symbols:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Visibility with override.
+ */
+
+#include <stdlib.h>
+
+int global = -1;
+
+int ret_foo;
+int ret_foo_hidden;
+int ret_foo_protected;
+
+extern int foo (void);
+extern int foo_protected (void);
+
+#ifndef FOO_P
+typedef int (*foo_p) (void);
+#endif
+
+foo_p foo_ptr = foo;
+foo_p foo_procted_ptr = foo_protected;
+
+extern foo_p get_foo_p (void);
+extern foo_p get_foo_hidden_p (void);
+extern foo_p get_foo_protected_p (void);
+
+int
+__attribute__ ((noinline))
+foo (void)
+{
+ return -30;
+}
+
+int
+__attribute__ ((noinline))
+foo_hidden (void)
+{
+ return -20;
+}
+
+int
+__attribute__ ((noinline))
+foo_protected (void)
+{
+ return -40;
+}
+
+int
+main (void)
+{
+ foo_p p;
+
+ if (foo_ptr != foo)
+ abort ();
+ if ((*foo_ptr) () != -30)
+ abort ();
+
+ if (foo_procted_ptr != foo_protected)
+ abort ();
+ if ((*foo_procted_ptr) () != -40)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if (foo () != -30)
+ abort ();
+ if (ret_foo != -30 || (*p) () != ret_foo)
+ abort ();
+
+ p = get_foo_hidden_p ();
+ if (foo_hidden () != -20)
+ abort ();
+ if (ret_foo_hidden != 1 || (*p) () != ret_foo_hidden)
+ abort ();
+
+ p = get_foo_protected_p ();
+ if (p == foo_protected)
+ abort ();
+ if (foo_protected () != -40)
+ abort ();
+ if (ret_foo_protected != 0 || (*p) () != ret_foo_protected)
+ abort ();
+
+ return 0;
+}
diff --git a/libc/elf/ifuncmain1vispic.c b/libc/elf/ifuncmain1vispic.c
new file mode 100644
index 000000000..f8c104d56
--- /dev/null
+++ b/libc/elf/ifuncmain1vispic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain1vis.c"
diff --git a/libc/elf/ifuncmain1vispie.c b/libc/elf/ifuncmain1vispie.c
new file mode 100644
index 000000000..ad06d2ba1
--- /dev/null
+++ b/libc/elf/ifuncmain1vispie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE. */
+
+#include "ifuncmain1vis.c"
diff --git a/libc/elf/ifuncmain2.c b/libc/elf/ifuncmain2.c
new file mode 100644
index 000000000..cd9b2c835
--- /dev/null
+++ b/libc/elf/ifuncmain2.c
@@ -0,0 +1,16 @@
+/* Test calling one STT_GNU_IFUNC function with 3 different
+ STT_GNU_IFUNC definitions. */
+
+#include <stdlib.h>
+
+int global = -1;
+
+extern int foo1 (void);
+
+int
+main (void)
+{
+ if (foo1 () != -1)
+ abort ();
+ return 0;
+}
diff --git a/libc/elf/ifuncmain2pic.c b/libc/elf/ifuncmain2pic.c
new file mode 100644
index 000000000..0006012a9
--- /dev/null
+++ b/libc/elf/ifuncmain2pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain2.c"
diff --git a/libc/elf/ifuncmain2picstatic.c b/libc/elf/ifuncmain2picstatic.c
new file mode 100644
index 000000000..3e89db536
--- /dev/null
+++ b/libc/elf/ifuncmain2picstatic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain2.c"
diff --git a/libc/elf/ifuncmain2static.c b/libc/elf/ifuncmain2static.c
new file mode 100644
index 000000000..6932ae806
--- /dev/null
+++ b/libc/elf/ifuncmain2static.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain2.c"
diff --git a/libc/elf/ifuncmain3.c b/libc/elf/ifuncmain3.c
new file mode 100644
index 000000000..5d067cced
--- /dev/null
+++ b/libc/elf/ifuncmain3.c
@@ -0,0 +1,120 @@
+/* Test STT_GNU_IFUNC symbols with dlopen:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Visibility with override.
+ */
+
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef int (*foo_p) (void);
+
+int
+__attribute__ ((noinline))
+foo (void)
+{
+ return -30;
+}
+
+int
+__attribute__ ((noinline))
+foo_hidden (void)
+{
+ return -20;
+}
+
+int
+__attribute__ ((noinline))
+foo_protected (void)
+{
+ return -40;
+}
+
+int
+main (void)
+{
+ foo_p p;
+ foo_p (*f) (void);
+ int *ret;
+
+ void *h = dlopen ("ifuncmod3.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ printf ("cannot load: %s\n", dlerror ());
+ return 1;
+ }
+
+ f = dlsym (h, "get_foo_p");
+ if (f == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ ret = dlsym (h, "ret_foo");
+ if (ret == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ p = (*f) ();
+ if (p != foo)
+ abort ();
+ if (foo () != -30)
+ abort ();
+ if (*ret != -30 || (*p) () != *ret)
+ abort ();
+
+ f = dlsym (h, "get_foo_hidden_p");
+ if (f == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ ret = dlsym (h, "ret_foo_hidden");
+ if (ret == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ p = (*f) ();
+ if (foo_hidden () != -20)
+ abort ();
+ if (*ret != 1 || (*p) () != *ret)
+ abort ();
+
+ f = dlsym (h, "get_foo_protected_p");
+ if (f == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ ret = dlsym (h, "ret_foo_protected");
+ if (ret == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+
+ p = (*f) ();
+ if (p == foo_protected)
+ abort ();
+ if (foo_protected () != -40)
+ abort ();
+ if (*ret != 0 || (*p) () != *ret)
+ abort ();
+
+ if (dlclose (h) != 0)
+ {
+ printf ("cannot close: %s\n", dlerror ());
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/libc/elf/ifuncmain4.c b/libc/elf/ifuncmain4.c
new file mode 100644
index 000000000..e55fee2eb
--- /dev/null
+++ b/libc/elf/ifuncmain4.c
@@ -0,0 +1,4 @@
+/* Test STT_GNU_IFUNC symbols in a single source file. */
+
+#include "ifuncmod1.c"
+#include "ifuncmain1.c"
diff --git a/libc/elf/ifuncmain4picstatic.c b/libc/elf/ifuncmain4picstatic.c
new file mode 100644
index 000000000..977d7f97f
--- /dev/null
+++ b/libc/elf/ifuncmain4picstatic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain4.c"
diff --git a/libc/elf/ifuncmain4static.c b/libc/elf/ifuncmain4static.c
new file mode 100644
index 000000000..c39997701
--- /dev/null
+++ b/libc/elf/ifuncmain4static.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain4.c"
diff --git a/libc/elf/ifuncmain5.c b/libc/elf/ifuncmain5.c
new file mode 100644
index 000000000..7f128d006
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain5pic.c b/libc/elf/ifuncmain5pic.c
new file mode 100644
index 000000000..e9144fbb2
--- /dev/null
+++ b/libc/elf/ifuncmain5pic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain5.c"
diff --git a/libc/elf/ifuncmain5picstatic.c b/libc/elf/ifuncmain5picstatic.c
new file mode 100644
index 000000000..a0afe905d
--- /dev/null
+++ b/libc/elf/ifuncmain5picstatic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain5.c"
diff --git a/libc/elf/ifuncmain5pie.c b/libc/elf/ifuncmain5pie.c
new file mode 100644
index 000000000..669f31eed
--- /dev/null
+++ b/libc/elf/ifuncmain5pie.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE. */
+
+#include "ifuncmain5.c"
diff --git a/libc/elf/ifuncmain5static.c b/libc/elf/ifuncmain5static.c
new file mode 100644
index 000000000..72504404a
--- /dev/null
+++ b/libc/elf/ifuncmain5static.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain5.c"
diff --git a/libc/elf/ifuncmain5staticpic.c b/libc/elf/ifuncmain5staticpic.c
new file mode 100644
index 000000000..9e8bac254
--- /dev/null
+++ b/libc/elf/ifuncmain5staticpic.c
@@ -0,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and no DSO. */
+
+#include "ifuncmain5.c"
diff --git a/libc/elf/ifuncmain6pie.c b/libc/elf/ifuncmain6pie.c
new file mode 100644
index 000000000..06f179bf9
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain7.c b/libc/elf/ifuncmain7.c
new file mode 100644
index 000000000..099e929ff
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain7pic.c b/libc/elf/ifuncmain7pic.c
new file mode 100644
index 000000000..fc37bf446
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain7picstatic.c b/libc/elf/ifuncmain7picstatic.c
new file mode 100644
index 000000000..baf8934b9
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain7pie.c b/libc/elf/ifuncmain7pie.c
new file mode 100644
index 000000000..254d453f1
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmain7static.c b/libc/elf/ifuncmain7static.c
new file mode 100644
index 000000000..e470d570e
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmod1.c b/libc/elf/ifuncmod1.c
new file mode 100644
index 000000000..a1697b596
--- /dev/null
+++ b/libc/elf/ifuncmod1.c
@@ -0,0 +1,114 @@
+/* Test STT_GNU_IFUNC symbols:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Visibility.
+ */
+
+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");
+
+extern int foo (void);
+extern int foo_hidden (void);
+extern int foo_protected (void);
+extern int ret_foo;
+extern int ret_foo_hidden;
+extern int ret_foo_protected;
+
+#define FOO_P
+typedef int (*foo_p) (void);
+
+foo_p
+get_foo_p (void)
+{
+ ret_foo = foo ();
+ return foo;
+}
+
+foo_p
+get_foo_hidden_p (void)
+{
+ ret_foo_hidden = foo_hidden ();
+ return foo_hidden;
+}
+
+foo_p
+get_foo_protected_p (void)
+{
+ ret_foo_protected = foo_protected ();
+ return foo_protected;
+}
diff --git a/libc/elf/ifuncmod3.c b/libc/elf/ifuncmod3.c
new file mode 100644
index 000000000..379d2c8d5
--- /dev/null
+++ b/libc/elf/ifuncmod3.c
@@ -0,0 +1,8 @@
+/* Test STT_GNU_IFUNC symbols with dlopen. */
+
+#include "ifuncmod1.c"
+
+int ret_foo;
+int ret_foo_hidden;
+int ret_foo_protected;
+int global = -1;
diff --git a/libc/elf/ifuncmod5.c b/libc/elf/ifuncmod5.c
new file mode 100644
index 000000000..2ca1c7154
--- /dev/null
+++ b/libc/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/libc/elf/ifuncmod6.c b/libc/elf/ifuncmod6.c
new file mode 100644
index 000000000..2e16c1d06
--- /dev/null
+++ b/libc/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/libc/include/stdlib.h b/libc/include/stdlib.h
index 883bc34d4..d90e6ff4f 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -221,6 +221,9 @@ extern int __qfcvt_r (long double __value, int __ndigit,
extern void *__default_morecore (ptrdiff_t) __THROW;
libc_hidden_proto (__default_morecore)
+extern char *__abort_msg;
+libc_hidden_proto (__abort_msg)
+
__END_DECLS
#undef __Need_M_And_C
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 34d7477f9..72d7e2e88 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -61,6 +61,8 @@ extern int __chdir (__const char *__path);
extern int __fchdir (int __fd);
extern char *__getcwd (char *__buf, size_t __size);
extern int __rmdir (const char *__path);
+extern int __execvpe (const char *file, char *const argv[],
+ char *const envp[]);
/* Get the canonical absolute name of the named directory, and put it in SIZE
bytes of BUF. Returns NULL if the directory couldn't be determined or
diff --git a/libc/inet/netinet/icmp6.h b/libc/inet/netinet/icmp6.h
index 0cb1aa6a6..82893daa9 100644
--- a/libc/inet/netinet/icmp6.h
+++ b/libc/inet/netinet/icmp6.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1997,2000,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997,2000,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
@@ -339,7 +339,7 @@ struct nd_opt_home_agent_info
uint8_t nd_opt_home_agent_info_type;
uint8_t nd_opt_home_agent_info_len;
uint16_t nd_opt_home_agent_info_reserved;
- int16_t nd_opt_home_agent_info_preference;
+ uint16_t nd_opt_home_agent_info_preference;
uint16_t nd_opt_home_agent_info_lifetime;
};
diff --git a/libc/libio/Makefile b/libc/libio/Makefile
index 971277fca..12afd7726 100644
--- a/libc/libio/Makefile
+++ b/libc/libio/Makefile
@@ -175,6 +175,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/libc/libio/fileops.c b/libc/libio/fileops.c
index 2d86013c9..94bbf839d 100644
--- a/libc/libio/fileops.c
+++ b/libc/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008
+/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -319,11 +319,11 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
continue;
case 'c':
fp->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- break;
+ continue;
#ifdef O_CLOEXEC
case 'e':
oflags |= O_CLOEXEC;
- break;
+ continue;
#endif
default:
/* Ignore. */
diff --git a/libc/libio/tst-fgetwc.c b/libc/libio/tst-fgetwc.c
index 9ccfeb152..06e4a424f 100644
--- a/libc/libio/tst-fgetwc.c
+++ b/libc/libio/tst-fgetwc.c
@@ -6,7 +6,7 @@
static int
do_test (void)
{
- if (setlocale (LC_ALL, "de_DE.utf8") == NULL)
+ if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
{
puts ("setlocale failed");
return 1;
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index b3db0766b..11d78fde3 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,21 @@
+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]
+ * SUPPORTED (SUPPORTED-LOCALES): Add dv_MV.UTF-8 entry.
+ * locales/dv_MV: New file.
+ Contributed by sofwathullah.mohamed@gmail.com.
+
+2009-06-09 Ulrich Drepper <drepper@redhat.com>
+
+ * locales/ur_IN: New file.
+ Contributed by Pravin Satpute <psatpute@redhat.com>.
+
2009-05-04 Ulrich Drepper <drepper@redhat.com>
* localedata/locales/bn_BD: Remove comment about missing collation
diff --git a/libc/localedata/SUPPORTED b/libc/localedata/SUPPORTED
index 9d000da45..6a75c9259 100644
--- a/libc/localedata/SUPPORTED
+++ b/libc/localedata/SUPPORTED
@@ -98,6 +98,7 @@ de_DE@euro/ISO-8859-15 \
de_LU.UTF-8/UTF-8 \
de_LU/ISO-8859-1 \
de_LU@euro/ISO-8859-15 \
+dv_MV/UTF-8 \
dz_BT/UTF-8 \
el_GR.UTF-8/UTF-8 \
el_GR/ISO-8859-7 \
diff --git a/libc/localedata/locales/de_AT b/libc/localedata/locales/de_AT
index 4ec42f470..4e0b7fb15 100644
--- a/libc/localedata/locales/de_AT
+++ b/libc/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/libc/localedata/locales/dv_MV b/libc/localedata/locales/dv_MV
new file mode 100644
index 000000000..064da132a
--- /dev/null
+++ b/libc/localedata/locales/dv_MV
@@ -0,0 +1,180 @@
+comment_char %
+escape_char /
+%
+% Dhivehi Language Locale for Maldives
+% Source:
+% Contact: Sofwathuallah Mohamed
+% Email: smohamed@wataniya-maldives.com , sofwath@hotmail.com
+% Language: dv
+% Territory: MV
+% Revision: 0.1
+% Date: 2006-05-13
+% Users: general
+% Charset: utf-8
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title "Dhivehi Language Locale for Maldives"
+source ""
+address ""
+contact ""
+email "sofwath@hotmail.com"
+tel ""
+fax ""
+language "Divehi"
+territory "Maldives"
+revision "0.1"
+date "2006-05-13"
+%
+category "dv_MV:2006";LC_IDENTIFICATION
+category "dv_MV:2006";LC_CTYPE
+category "dv_MV:2006";LC_COLLATE
+category "dv_MV:2006";LC_TIME
+category "dv_MV:2006";LC_NUMERIC
+category "dv_MV:2006";LC_MONETARY
+category "dv_MV:2006";LC_MESSAGES
+category "dv_MV:2006";LC_PAPER
+category "dv_MV:2006";LC_NAME
+category "dv_MV:2006";LC_ADDRESS
+category "dv_MV:2006";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+translit_start
+include "translit_combining";""
+
+
+translit_end
+END LC_CTYPE
+
+LC_COLLATE
+copy "en_DK"
+END LC_COLLATE
+
+LC_MONETARY
+% it is meant to be MVR, could you see if it is correct please
+int_curr_symbol "<U004D><U0056><U0052><U0020>"
+currency_symbol "<U0783><U002E>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep "<U002C>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 1
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 2
+n_sign_posn 1
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
+END LC_NUMERIC
+
+% Since their is no abbreviated version of the days in dhivehi I have used the
+% full names of the days and months
+LC_TIME
+
+abday "<U0787><U07A7><U078B><U07A9><U0787><U07B0><U078C><U07A6>";/
+ "<U0780><U07AF><U0789><U07A6>";/
+ "<U0787><U07A6><U0782><U07B0><U078E><U07A7><U0783><U07A6>";/
+ "<U0784><U07AA><U078B><U07A6>";/
+ "<U0784><U07AA><U0783><U07A7><U0790><U07B0><U078A><U07A6><U078C><U07A8>";/
+ "<U0780><U07AA><U0786><U07AA><U0783><U07AA>";/
+ "<U0780><U07AE><U0782><U07A8><U0780><U07A8><U0783><U07AA>"
+day "<U0787><U07A7><U078B><U07A9><U0787><U07B0><U078C><U07A6>";/
+ "<U0780><U07AF><U0789><U07A6>";/
+ "<U0787><U07A6><U0782><U07B0><U078E><U07A7><U0783><U07A6>";/
+ "<U0784><U07AA><U078B><U07A6>";/
+ "<U0784><U07AA><U0783><U07A7><U0790><U07B0><U078A><U07A6><U078C><U07A8>";/
+ "<U0780><U07AA><U0786><U07AA><U0783><U07AA>";/
+ "<U0780><U07AE><U0782><U07A8><U0780><U07A8><U0783><U07AA>"
+abmon "<U0796><U07AC><U0782><U07AA><U0787><U07A6><U0783><U07A9>";/
+ "<U078A><U07AC><U0784><U07B0><U0783><U07AA><U0787><U07A6><U0783><U07A9>";/
+ "<U0789><U07A7><U0783><U0797><U07B0>";/
+ "<U0787><U07AC><U0795><U07B0><U0783><U07A9><U078D><U07B0>";/
+ "<U0789><U07AC><U0787><U07A8>";/
+ "<U0796><U07AB><U0782><U07B0>";/
+ "<U0796><U07AA><U078D><U07A6><U0787><U07A8>";/
+ "<U0787><U07AE><U078E><U07A6><U0790><U07B0><U0793><U07B0>";/
+ "<U0790><U07AC><U0795><U07B0><U0793><U07AC><U0782><U07B0><U0784><U07A6><U0783>";/
+ "<U0787><U07AE><U0786><U07B0><U0793><U07AB><U0784><U07A6><U0783>";/
+ "<U0782><U07AE><U0788><U07AC><U0782><U07B0><U0784><U07A6><U0783>";/
+ "<U0791><U07A8><U0790><U07AC><U0782><U07B0><U0784><U07A6><U0783>"
+mon "<U0796><U07AC><U0782><U07AA><U0787><U07A6><U0783><U07A9>";/
+ "<U078A><U07AC><U0784><U07B0><U0783><U07AA><U0787><U07A6><U0783><U07A9>";/
+ "<U0789><U07A7><U0783><U0797><U07B0>";/
+ "<U0787><U07AC><U0795><U07B0><U0783><U07A9><U078D><U07B0>";/
+ "<U0789><U07AC><U0787><U07A8>";/
+ "<U0796><U07AB><U0782><U07B0>";/
+ "<U0796><U07AA><U078D><U07A6><U0787><U07A8>";/
+ "<U0787><U07AE><U078E><U07A6><U0790><U07B0><U0793><U07B0>";/
+ "<U0790><U07AC><U0795><U07B0><U0793><U07AC><U0782><U07B0><U0784><U07A6><U0783>";/
+ "<U0787><U07AE><U0786><U07B0><U0793><U07AB><U0784><U07A6><U0783>";/
+ "<U0782><U07AE><U0788><U07AC><U0782><U07B0><U0784><U07A6><U0783>";/
+ "<U0791><U07A8><U0790><U07AC><U0782><U07B0><U0784><U07A6><U0783>"
+
+% Date Time Format
+d_t_fmt "<U0025><U005A><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059><U0020><U0025><U0062><U0020><U0025><U0064><U0020><U0025><U0061>"
+
+% date Format. I have put this in reverse order to try to get the date
+% in R->L order
+d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
+
+% time format
+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+%<U0635> stands for <U0635><U0628><U062D>
+%<U0634> stands for <U0634><U0627><U0645>
+%am_pm "<U0020>";"<U0789><U07AC><U0782><U07B0><U078B><U07AA><U0782><U07AA><U0782><U07B0><U0787><U07A6><U0784><U07AA><U0783><U07A7>"
+am_pm "<U0789><U0786>";"<U0789><U078A>"
+
+% time format in 12 hour clock
+t_fmt_ampm "<U0025><U0050><U0020><U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+% display columns right to left ?
+cal_direction 3
+END LC_TIME
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+END LC_MESSAGES
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+tel_dom_fmt "<U0025><U0061><U0020><U0025><U006C>"
+int_select "<U0030><U0030>"
+int_prefix "<U0039><U0036><U0030>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_NAME
+name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+END LC_ADDRESS
diff --git a/libc/localedata/locales/ur_IN b/libc/localedata/locales/ur_IN
new file mode 100644
index 000000000..3ac8c737e
--- /dev/null
+++ b/libc/localedata/locales/ur_IN
@@ -0,0 +1,184 @@
+comment_char %
+escape_char /
+% Urdu language locale for India.
+% Contributed by Pravin Satpute <psatpute@redhat.com> and
+% Mrs. Nasreen Khan
+
+LC_IDENTIFICATION
+
+title "Urdu language locale for India"
+source "Red Hat, Pune"
+address "Marisfot III, Marigold Premises, East-Wing, Kalyaninagar, Pune, India-411014"
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Urdu"
+territory "India"
+revision "1.0"
+date "2009,June,09"
+%
+category "ur_IN:2009";LC_IDENTIFICATION
+category "ur_IN:2009";LC_CTYPE
+category "ur_IN:2009";LC_COLLATE
+category "ur_IN:2009";LC_TIME
+category "ur_IN:2009";LC_NUMERIC
+category "ur_IN:2009";LC_MONETARY
+category "ur_IN:2009";LC_MESSAGES
+category "ur_IN:2009";LC_PAPER
+category "ur_IN:2009";LC_NAME
+category "ur_IN:2009";LC_ADDRESS
+category "ur_IN:2009";LC_TELEPHONE
+
+
+END LC_IDENTIFICATION
+
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+
+LC_COLLATE
+% Copy the template from ISO/IEC 14651
+copy "iso14651_t1"
+
+END LC_COLLATE
+
+
+LC_MONETARY
+copy "ar_IN"
+END LC_MONETARY
+
+
+LC_NUMERIC
+copy "hi_IN"
+END LC_NUMERIC
+
+
+LC_TIME
+% This is the POSIX Locale definition for the LC_TIME category
+% generated by IBM Basic CountryPack Transformer.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode.
+%
+% Abbreviated weekday names (%a)
+abday "<U0627><U062A><U0648><U0627><U0631>";/
+ "<U067E><U06CC><U0631>";/
+ "<U0645><U0646><U06AF><U0644>";/
+ "<U0628><U062f><U06be>";/
+ "<U062C><U0645><U0639><U0631><U0627><U062A>";/
+ "<U062C><U0645><U0639><U06C1>";"<U0633><U0646><U06CC><U0686><U0631>"
+%
+% Full weekday names (%A)
+day "<U0627><U062A><U0648><U0627><U0631>";/
+ "<U067E><U06CC><U0631>";/
+ "<U0645><U0646><U06AF><U0644>";/
+ "<U0628><U062f><U06be>";/
+ "<U062C><U0645><U0639><U0631><U0627><U062A>";/
+ "<U062C><U0645><U0639><U06C1>";"<U0633><U0646><U06CC><U0686><U0631>"
+%
+% Abbreviated month names (%b)
+abmon "<U062C><U0646><U0648><U0631><U06CC>";/
+ "<U0641><U0631><U0648><U0631><U06CC>";/
+ "<U0645><U0627><U0631><U0686>";/
+ "<U0627><U067E><U0631><U06CC><U0644>";/
+ "<U0645><U0626><U06CC>";/
+ "<U062C><U0648><U0646>";/
+ "<U062C><U0648><U0644><U0627><U0626><U06CC>";/
+ "<U0627><U06AF><U0633><U062A>";/
+ "<U0633><U062A><U0645><U0628><U0631>";/
+ "<U0627><U0643><U062A><U0648><U0628><U0631>";/
+ "<U0646><U0648><U0645><U0628><U0631>";/
+ "<U062F><U0633><U0645><U0628><U0631>"
+%
+% Full month names (%B)
+mon "<U062C><U0646><U0648><U0631><U06CC>";/
+ "<U0641><U0631><U0648><U0631><U06CC>";/
+ "<U0645><U0627><U0631><U0686>";/
+ "<U0627><U067E><U0631><U06CC><U0644>";/
+ "<U0645><U0626><U06CC>";/
+ "<U062C><U0648><U0646>";/
+ "<U062C><U0648><U0644><U0627><U0626><U06CC>";/
+ "<U0627><U06AF><U0633><U062A>";/
+ "<U0633><U062A><U0645><U0628><U0631>";/
+ "<U0627><U0643><U062A><U0648><U0628><U0631>";/
+ "<U0646><U0648><U0645><U0628><U0631>";/
+ "<U062F><U0633><U0645><U0628><U0631>"
+%
+% Equivalent of AM PM
+am_pm "<U0041><U004D>";"<U0050><U004D>"
+%
+% Appropriate date and time representation
+% %A %d %b %Y%I:%M:%S %Z
+d_t_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059><U0020><U0025><U0049><U003A><U0025><U004D><U003A>/
+<U0025><U0053><U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+% Appropriate date representation
+% %A %d %b %Y
+d_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059>"
+%
+% Appropriate time representation
+% %I:%M:%S %Z
+t_fmt "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0020><U0025><U005A>"
+%
+% Appropriate 12 h time representation (%r)
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0025><U0070><U0020><U0025><U005A>"
+%
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U06C1><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U0646><U006E><U004E><U005D><U002E><U002A>"
+
+yesstr "<U06C1><U0627><U06BA>"
+nostr "<U0646><U06C1><U06CC><U06BA>"
+END LC_MESSAGES
+
+
+LC_PAPER
+copy "hi_IN"
+END LC_PAPER
+
+
+LC_NAME
+% This is the ISO_IEC TR14652 Locale definition for the LC_NAME category
+% generated by IBM Basic CountryPack Transformer.
+%
+%
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074><U0025><U0067>"
+name_gen ""
+name_mr "<U062C><U0646><U0627><U0628>"
+name_mrs "<U0645><U062D><U062A><U0631><U0645><U06C1>"
+name_miss "<U06AA><U0645><U0627><U0631><U064A>"
+name_ms "<U06AA><U0645><U0627><U0631>"
+
+END LC_NAME
+
+
+LC_ADDRESS
+copy "hi_IN"
+END LC_ADDRESS
+
+
+LC_TELEPHONE
+copy "hi_IN"
+END LC_TELEPHONE
+
+
+LC_MEASUREMENT
+copy "hi_IN"
+END LC_MEASUREMENT
diff --git a/libc/login/Makefile b/libc/login/Makefile
index 3b6140c1f..7877fd90f 100644
--- a/libc/login/Makefile
+++ b/libc/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
@@ -58,6 +58,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/libc/login/programs/pt_chown.c b/libc/login/programs/pt_chown.c
index 6b780ae40..828d92812 100644
--- a/libc/login/programs/pt_chown.c
+++ b/libc/login/programs/pt_chown.c
@@ -1,5 +1,5 @@
/* pt_chmod - helper program for `grantpt'.
- 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 C. Scott Ananian <cananian@alumni.princeton.edu>, 1998.
@@ -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. */
@@ -119,12 +123,13 @@ do_pt_chown (void)
/* Set the owner to the real user ID, and the group to that special
group ID. */
- if (chown (pty, getuid (), gid) < 0)
+ if (st.st_gid != gid && chown (pty, getuid (), gid) < 0)
return FAIL_EACCES;
/* Set the permission mode to readable and writable by the owner,
and writable by the group. */
- if (chmod (pty, S_IRUSR|S_IWUSR|S_IWGRP) < 0)
+ if ((st.st_mode & ACCESSPERMS) != (S_IRUSR|S_IWUSR|S_IWGRP)
+ && chmod (pty, S_IRUSR|S_IWUSR|S_IWGRP) < 0)
return FAIL_EACCES;
return 0;
@@ -135,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/libc/malloc/malloc.c b/libc/malloc/malloc.c
index 0b9facefd..516d40199 100644
--- a/libc/malloc/malloc.c
+++ b/libc/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/libc/manual/charset.texi b/libc/manual/charset.texi
index 8b2c09ca7..79854e50b 100644
--- a/libc/manual/charset.texi
+++ b/libc/manual/charset.texi
@@ -1234,7 +1234,7 @@ file_mbsrtowcs (int input, int output)
/* @r{If any characters must be carried forward,}
@r{put them at the beginning of @code{buffer}.} */
if (filled > 0)
- memmove (inp, buffer, filled);
+ memmove (buffer, inp, filled);
@}
return 1;
diff --git a/libc/misc/sys/select.h b/libc/misc/sys/select.h
index 2a408433e..f4a37be55 100644
--- a/libc/misc/sys/select.h
+++ b/libc/misc/sys/select.h
@@ -1,5 +1,5 @@
/* `fd_set' type and related macros, and `select'/`pselect' declarations.
- Copyright (C) 1996,97,98,99,2000,01,02,2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003, 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
@@ -59,7 +59,7 @@ typedef long int __fd_mask;
#undef __FDELT
#undef __FDMASK
/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
-#define __NFDBITS (8 * sizeof (__fd_mask))
+#define __NFDBITS (8 * (int) sizeof (__fd_mask))
#define __FDELT(d) ((d) / __NFDBITS)
#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS))
diff --git a/libc/nis/nss_compat/compat-initgroups.c b/libc/nis/nss_compat/compat-initgroups.c
index 76ca95d1e..07a3b9282 100644
--- a/libc/nis/nss_compat/compat-initgroups.c
+++ b/libc/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/libc/nis/nss_nis/nis-pwd.c b/libc/nis/nss_nis/nis-pwd.c
index 1b5206ad6..fdc7dc9e1 100644
--- a/libc/nis/nss_nis/nis-pwd.c
+++ b/libc/nis/nss_nis/nis-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2001-2003,2006,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -116,7 +116,7 @@ internal_nis_endpwent (void)
oldkeylen = 0;
}
- struct response_t *curr = intern.next;
+ struct response_t *curr = intern.start;
while (curr != NULL)
{
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index d83b46125..ec9ace7d3 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,18 @@
+2009-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile (libpthread-routines): Add pthread_sigqueue.
+ * Versions: Add pthread_sigqueue for GLIBC_2.11.
+ * sysdeps/pthread/bits/sigthread.h: Declare pthread_sigqueue.
+ * sysdeps/unix/sysv/linux/pthread_sigqueue.c: New file.
+
+2009-06-11 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10262]
+ * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+ (LOAD_FUTEX_WAIT_ABS): Fix futex parameter in case private futexes
+ cannot be assumed.
+ Patch by Bryan Kadzban <bz-glibc@kdzbn.homelinux.net>.
+
2009-05-16 Ulrich Drepper <drepper@redhat.com>
* libc-cancellation.c: Move __libc_cleanup_routine to...
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 0f6f12979..445688309 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -88,7 +88,7 @@ libpthread-routines = nptl-init vars events version \
pthread_barrierattr_setpshared \
pthread_key_create pthread_key_delete \
pthread_getspecific pthread_setspecific \
- pthread_sigmask pthread_kill \
+ pthread_sigmask pthread_kill pthread_sigqueue \
pthread_cancel pthread_testcancel \
pthread_setcancelstate pthread_setcanceltype \
pthread_once \
diff --git a/libc/nptl/Versions b/libc/nptl/Versions
index 54b9b9c6a..09098bf98 100644
--- a/libc/nptl/Versions
+++ b/libc/nptl/Versions
@@ -240,6 +240,10 @@ libpthread {
pthread_mutex_getprioceiling; pthread_mutex_setprioceiling;
};
+ GLIBC_2.11 {
+ pthread_sigqueue;
+ };
+
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
diff --git a/libc/nptl/sysdeps/pthread/bits/sigthread.h b/libc/nptl/sysdeps/pthread/bits/sigthread.h
index 960bde18a..9a524e57d 100644
--- a/libc/nptl/sysdeps/pthread/bits/sigthread.h
+++ b/libc/nptl/sysdeps/pthread/bits/sigthread.h
@@ -1,5 +1,5 @@
/* Signal handling function for threaded programs.
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 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
@@ -35,4 +35,10 @@ extern int pthread_sigmask (int __how,
/* Send signal SIGNO to the given thread. */
extern int pthread_kill (pthread_t __threadid, int __signo) __THROW;
+#ifdef __USE_GNU
+/* Queue signal and data to a thread. */
+extern int pthread_sigqueue (pthread_t __threadid, int __signo,
+ const union sigval __value) __THROW;
+#endif
+
#endif /* bits/sigthread.h */
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index 056b72900..7578c7ece 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -60,7 +60,7 @@
# define LOAD_FUTEX_WAIT_ABS(reg) \
xorl $FUTEX_PRIVATE_FLAG, reg ; \
andl %gs:PRIVATE_FUTEX, reg ; \
- orl $FUTEX_WAIT | FUTEX_CLOCK_REALTIME, reg
+ orl $FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg
# define LOAD_FUTEX_WAKE(reg) \
xorl $FUTEX_PRIVATE_FLAG, reg ; \
andl %gs:PRIVATE_FUTEX, reg ; \
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/libc/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
new file mode 100644
index 000000000..4440703b6
--- /dev/null
+++ b/libc/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
+
+ 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 <signal.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthreadP.h>
+#include <tls.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+
+int
+pthread_sigqueue (threadid, signo, value)
+ pthread_t threadid;
+ int signo;
+ const union sigval value;
+{
+#ifdef __NR_rt_tgsigqueueinfo
+ struct pthread *pd = (struct pthread *) threadid;
+
+ /* Make sure the descriptor is valid. */
+ if (DEBUGGING_P && INVALID_TD_P (pd))
+ /* Not a valid thread handle. */
+ return ESRCH;
+
+ /* Force load of pd->tid into local variable or register. Otherwise
+ if a thread exits between ESRCH test and tgkill, we might return
+ EINVAL, because pd->tid would be cleared by the kernel. */
+ pid_t tid = atomic_forced_read (pd->tid);
+ if (__builtin_expect (tid <= 0, 0))
+ /* Not a valid thread handle. */
+ return ESRCH;
+
+ /* Disallow sending the signal we use for cancellation, timers, for
+ for the setxid implementation. */
+ if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
+ return EINVAL;
+
+ /* Set up the siginfo_t structure. */
+ siginfo_t info;
+ memset (&info, '\0', sizeof (siginfo_t));
+ info.si_signo = signo;
+ info.si_code = SI_QUEUE;
+ info.si_pid = THREAD_GETMEM (THREAD_SELF, pid);
+ info.si_uid = getuid ();
+ info.si_value = value;
+
+ /* We have a special syscall to do the work. */
+ INTERNAL_SYSCALL_DECL (err);
+
+ /* One comment: The PID field in the TCB can temporarily be changed
+ (in fork). But this must not affect this code here. Since this
+ function would have to be called while the thread is executing
+ fork, it would have to happen in a signal handler. But this is
+ no allowed, pthread_sigqueue is not guaranteed to be async-safe. */
+ int val = INTERNAL_SYSCALL (rt_tgsigqueueinfo, err, 4,
+ THREAD_GETMEM (THREAD_SELF, pid),
+ tid, signo, &info);
+
+ return (INTERNAL_SYSCALL_ERROR_P (val, err)
+ ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
+#else
+ return ENOSYS;
+#endif
+}
diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile
index 3820366d1..15c3c7b9f 100644
--- a/libc/nscd/Makefile
+++ b/libc/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
@@ -137,13 +136,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/libc/nss/getent.c b/libc/nss/getent.c
index ea6efbce2..e2d928570 100644
--- a/libc/nss/getent.c
+++ b/libc/nss/getent.c
@@ -24,6 +24,7 @@
#include <ctype.h>
#include <error.h>
#include <grp.h>
+#include <gshadow.h>
#include <libintl.h>
#include <locale.h>
#include <mcheck.h>
@@ -237,6 +238,70 @@ group_keys (int number, char *key[])
return result;
}
+/* This is for gshadow */
+static void
+print_gshadow (struct sgrp *sg)
+{
+ unsigned int i = 0;
+
+ printf ("%s:%s:",
+ sg->sg_namp ? sg->sg_namp : "",
+ sg->sg_passwd ? sg->sg_passwd : "");
+
+ while (sg->sg_adm[i] != NULL)
+ {
+ fputs_unlocked (sg->sg_adm[i], stdout);
+ ++i;
+ if (sg->sg_adm[i] != NULL)
+ putchar_unlocked (',');
+ }
+
+ putchar_unlocked (':');
+
+ i = 0;
+ while (sg->sg_mem[i] != NULL)
+ {
+ fputs_unlocked (sg->sg_mem[i], stdout);
+ ++i;
+ if (sg->sg_mem[i] != NULL)
+ putchar_unlocked (',');
+ }
+
+ putchar_unlocked ('\n');
+}
+
+static int
+gshadow_keys (int number, char *key[])
+{
+ int result = 0;
+ int i;
+
+ if (number == 0)
+ {
+ struct sgrp *sg;
+
+ setsgent ();
+ while ((sg = getsgent ()) != NULL)
+ print_gshadow (sg);
+ endsgent ();
+ return result;
+ }
+
+ for (i = 0; i < number; ++i)
+ {
+ struct sgrp *sg;
+
+ sg = getsgnam (key[i]);
+
+ if (sg == NULL)
+ result = 2;
+ else
+ print_gshadow (sg);
+ }
+
+ return result;
+}
+
#if __OPTION_EGLIBC_INET
/* This is for hosts */
static void
@@ -778,6 +843,7 @@ DN(ahostsv6)
DA(aliases)
DN(ethers)
D(group)
+D(gshadow)
DN(hosts)
DN(netgroup)
DN(networks)
diff --git a/libc/po/bg.po b/libc/po/bg.po
index 1f41d3405..b7c79bd1c 100644
--- a/libc/po/bg.po
+++ b/libc/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/libc/po/id.po b/libc/po/id.po
index 777a55632..aabcc721d 100644
--- a/libc/po/id.po
+++ b/libc/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/libc/po/sv.po b/libc/po/sv.po
index 7c7937d59..8ff80e491 100644
--- a/libc/po/sv.po
+++ b/libc/po/sv.po
@@ -1,14 +1,14 @@
-# GNU libc message catalog for swedish
+# GNU libc message catalog for Swedish
# Copyright © 1996, 1998, 2001, 2002, 2003, 2006, 2008, 2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the glibc package.
# Jan Djärv <jan.h.d@swipnet.se>, 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009
-# Revision: 1.60
+# Revision: 1.61
#
msgid ""
msgstr ""
"Project-Id-Version: libc 2.9.90\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-02-28 17:57+0100\n"
+"PO-Revision-Date: 2009-06-14 20:41+0200\n"
"Last-Translator: Jan Djärv <jan.h.d@swipnet.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"MIME-Version: 1.0\n"
@@ -295,11 +295,11 @@ msgstr "Användning: xtrace [FLAGGA]... PROGRAM [PROGRAMFLAGGA}...\\n"
#: debug/xtrace.sh:33
msgid "Try \\`xtrace --help' for more information.\\n"
-msgstr "Försök med \\\"xtrace --help\\\" för mer information\\n"
+msgstr "Försök med \"xtrace --help\" för mer information\\n"
#: debug/xtrace.sh:39
msgid "xtrace: option \\`$1' requires an argument.\\n"
-msgstr "xtrace: flaggan \\\"$1\\\" behöver ett argument\\n"
+msgstr "xtrace: flaggan \"$1\" behöver ett argument\\n"
#: debug/xtrace.sh:46
msgid ""
@@ -328,7 +328,7 @@ msgstr ""
#: debug/xtrace.sh:127
msgid "xtrace: unrecognized option \\`$1'\\n"
-msgstr "xtrace: okänd flagga \\\"$1\\\"\\n"
+msgstr "xtrace: okänd flagga \"$1\"\\n"
#: debug/xtrace.sh:140
msgid "No program name given\\n"
@@ -337,12 +337,12 @@ msgstr "Inget programnamn givet\\n"
#: debug/xtrace.sh:148
#, sh-format
msgid "executable \\`$program' not found\\n"
-msgstr "program \\\"$program\\\" hittades inte\\n"
+msgstr "program \"$program\" hittades inte\\n"
#: debug/xtrace.sh:152
#, sh-format
msgid "\\`$program' is no executable\\n"
-msgstr "\\\"$program\\\" är inte en körbar binär\\n"
+msgstr "\"$program\" är inte en körbar binär\\n"
#: dlfcn/dlinfo.c:64
msgid "RTLD_SELF used in code not dynamically loaded"
@@ -932,7 +932,7 @@ msgstr ""
#: elf/ldd.bash.in:82
msgid "ldd: option \\`$1' is ambiguous"
-msgstr "ldd: flaggan \\\"$1\\\" är tvetydig"
+msgstr "ldd: flaggan \"$1\" är tvetydig"
#: elf/ldd.bash.in:89
msgid "unrecognized option"
@@ -940,7 +940,7 @@ msgstr "okänd flagga"
#: elf/ldd.bash.in:90 elf/ldd.bash.in:128
msgid "Try \\`ldd --help' for more information."
-msgstr "Försök med \\\"ldd --help\\\" för mer information"
+msgstr "Försök med \"ldd --help\" för mer information"
#: elf/ldd.bash.in:127
msgid "missing file arguments"
@@ -1051,7 +1051,7 @@ msgstr "Inget mål på rad %d\n"
#: elf/sln.c:179
#, c-format
msgid "%s: destination must not be a directory\n"
-msgstr "%s: målet måste vara en katalog\n"
+msgstr "%s: målet måste inte vara en katalog\n"
#: elf/sln.c:185
#, c-format
@@ -2824,11 +2824,11 @@ msgstr "felaktig mcheck_status, biblioteket är felaktigt\n"
#: malloc/memusage.sh:27
msgid "Try \\`memusage --help' for more information."
-msgstr "Försök med \\\"memusage --help\\\" för mer information"
+msgstr "Försök med \"memusage --help\" för mer information"
#: malloc/memusage.sh:33
msgid "memusage: option \\`$1' requires an argument"
-msgstr "memusage: flaggan \\\"$1\\\" behöver ett argument"
+msgstr "memusage: flaggan \"$1\" behöver ett argument"
#: malloc/memusage.sh:39
msgid ""
@@ -2897,11 +2897,11 @@ msgstr ""
#: malloc/memusage.sh:193
msgid "memusage: option \\`${1##*=}' is ambiguous"
-msgstr "memusage: flaggan \\\"${1##*=}\\\" är tvetydig"
+msgstr "memusage: flaggan \"${1##*=}\" är tvetydig"
#: malloc/memusage.sh:202
msgid "memusage: unrecognized option \\`$1'"
-msgstr "memusage: okänd flagga \\\"$1\\\""
+msgstr "memusage: okänd flagga \"$1\""
#: malloc/memusage.sh:215
msgid "No program name given"
@@ -3463,7 +3463,7 @@ msgstr "DES-post för nätnamn %s är inte unikt\n"
#: nis/nss_nisplus/nisplus-publickey.c:220
#, c-format
msgid "netname2user: missing group id list in `%s'"
-msgstr "netname2user: gruppid-lista saknas i \"%s\"."
+msgstr "netname2user: gruppid-lista saknas i \"%s\""
#: nis/nss_nisplus/nisplus-publickey.c:302
#: nis/nss_nisplus/nisplus-publickey.c:308
@@ -4371,10 +4371,10 @@ msgid ""
"\n"
msgstr ""
"Användning: getconf [-v SPEC] VAR\n"
-" eller: getconf [-v SPEC] PATH_VAR PATH\n"
+" eller: getconf [-v SPEC] VÄG_VAR VÄG\n"
"\n"
-"Hämta konfigureringsvärdet för variabeln VAR, eller för variabeln PATH_VAR\n"
-"för sökväg PATH. Om SPEC är given hämta värden för kompileringsspecifikationen\n"
+"Hämta konfigureringsvärdet för variabeln VAR, eller för variabeln VÄG_VAR\n"
+"för sökväg VÄG. Om SPEC är given hämta värden för kompileringsspecifikationen\n"
"SPEC.\n"
"\n"
@@ -4431,13 +4431,13 @@ msgstr "%s: okänd flagga \"%c%s\"\n"
#: posix/getopt.c:800 posix/getopt.c:803
#, c-format
msgid "%s: invalid option -- '%c'\n"
-msgstr "%s: ogiltig flagga -- %c\n"
+msgstr "%s: ogiltig flagga -- \"%c\"\n"
#: posix/getopt.c:853 posix/getopt.c:870 posix/getopt.c:1073
#: posix/getopt.c:1091
#, c-format
msgid "%s: option requires an argument -- '%c'\n"
-msgstr "%s: flaggan behöver ett argument -- %c\n"
+msgstr "%s: flaggan behöver ett argument -- \"%c\"\n"
#: posix/getopt.c:923 posix/getopt.c:939
#, c-format
@@ -4611,7 +4611,7 @@ msgstr "minnet slut\n"
#: sunrpc/auth_unix.c:350
msgid "auth_unix.c: Fatal marshalling problem"
-msgstr "auth_unix.c - Fatalt kodningsproblem"
+msgstr "auth_unix.c: Fatalt kodningsproblem"
#: sunrpc/clnt_perr.c:105 sunrpc/clnt_perr.c:121
#, c-format
@@ -4907,7 +4907,7 @@ msgstr "'-c\t\tgenerera XDR-funktioner\n"
#: sunrpc/rpc_main.c:1473
#, c-format
msgid "-C\t\tANSI C mode\n"
-msgstr "-C\t\tANSI-läge\n"
+msgstr "-C\t\tANSI C-läge\n"
#: sunrpc/rpc_main.c:1474
#, c-format
@@ -4917,7 +4917,7 @@ msgstr "-Dnamn[=värde]\tdefiniera en symbol (samma som #define)\n"
#: sunrpc/rpc_main.c:1475
#, c-format
msgid "-h\t\tgenerate header file\n"
-msgstr "-h\t\tgenerera huvudfiler\n"
+msgstr "-h\t\tgenerera huvudfil\n"
#: sunrpc/rpc_main.c:1476
#, c-format
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index 7a734c696..e978ecc7f 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -45,7 +45,7 @@ routines := \
wait waitpid wait3 wait4 waitid \
alarm sleep pause nanosleep \
fork vfork _exit \
- execve fexecve execv execle execl execvp execlp \
+ execve fexecve execv execle execl execvp execlp execvpe \
getpid getppid \
getuid geteuid getgid getegid getgroups setuid setgid group_member \
getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
diff --git a/libc/posix/Versions b/libc/posix/Versions
index 10625f19e..686c446bc 100644
--- a/libc/posix/Versions
+++ b/libc/posix/Versions
@@ -131,6 +131,9 @@ libc {
GLIBC_2.10 {
__posix_getopt;
}
+ GLIBC_2.11 {
+ execvpe;
+ }
GLIBC_PRIVATE {
__libc_fork; __libc_pwrite;
}
diff --git a/libc/posix/execvp.c b/libc/posix/execvp.c
index 887379e3a..81e6d589f 100644
--- a/libc/posix/execvp.c
+++ b/libc/posix/execvp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92, 1995-99, 2002, 2004, 2005, 2007
+/* Copyright (C) 1991,92, 1995-99, 2002, 2004, 2005, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,31 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <alloca.h>
#include <unistd.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <paths.h>
-
-
-/* The file is accessible but it is not an executable file. Invoke
- the shell to interpret it as a script. */
-static void
-internal_function
-scripts_argv (const char *file, char *const argv[], int argc, char **new_argv)
-{
- /* Construct an argument list for the shell. */
- new_argv[0] = (char *) _PATH_BSHELL;
- new_argv[1] = (char *) file;
- while (argc > 1)
- {
- new_argv[argc] = argv[argc - 1];
- --argc;
- }
-}
/* Execute FILE, searching in the `PATH' environment variable if it contains
@@ -51,170 +27,6 @@ execvp (file, argv)
const char *file;
char *const argv[];
{
- if (*file == '\0')
- {
- /* We check the simple case first. */
- __set_errno (ENOENT);
- return -1;
- }
-
- if (strchr (file, '/') != NULL)
- {
- /* Don't search when it contains a slash. */
- __execve (file, argv, __environ);
-
- if (errno == ENOEXEC)
- {
- /* Count the arguments. */
- int argc = 0;
- while (argv[argc++])
- ;
- size_t len = (argc + 1) * sizeof (char *);
- char **script_argv;
- void *ptr = NULL;
- if (__libc_use_alloca (len))
- script_argv = alloca (len);
- else
- script_argv = ptr = malloc (len);
-
- if (script_argv != NULL)
- {
- scripts_argv (file, argv, argc, script_argv);
- __execve (script_argv[0], script_argv, __environ);
-
- free (ptr);
- }
- }
- }
- else
- {
- size_t pathlen;
- size_t alloclen = 0;
- char *path = getenv ("PATH");
- if (path == NULL)
- {
- pathlen = confstr (_CS_PATH, (char *) NULL, 0);
- alloclen = pathlen + 1;
- }
- else
- pathlen = strlen (path);
-
- size_t len = strlen (file) + 1;
- alloclen += pathlen + len + 1;
-
- char *name;
- char *path_malloc = NULL;
- if (__libc_use_alloca (alloclen))
- name = alloca (alloclen);
- else
- {
- path_malloc = name = malloc (alloclen);
- if (name == NULL)
- return -1;
- }
-
- if (path == NULL)
- {
- /* There is no `PATH' in the environment.
- The default search path is the current directory
- followed by the path `confstr' returns for `_CS_PATH'. */
- path = name + pathlen + len + 1;
- path[0] = ':';
- (void) confstr (_CS_PATH, path + 1, pathlen);
- }
-
- /* Copy the file name at the top. */
- name = (char *) memcpy (name + pathlen + 1, file, len);
- /* And add the slash. */
- *--name = '/';
-
- char **script_argv = NULL;
- void *script_argv_malloc = NULL;
- bool got_eacces = false;
- char *p = path;
- do
- {
- char *startp;
-
- path = p;
- p = __strchrnul (path, ':');
-
- if (p == path)
- /* Two adjacent colons, or a colon at the beginning or the end
- of `PATH' means to search the current directory. */
- startp = name + 1;
- else
- startp = (char *) memcpy (name - (p - path), path, p - path);
-
- /* Try to execute this name. If it works, execve will not return. */
- __execve (startp, argv, __environ);
-
- if (errno == ENOEXEC)
- {
- if (script_argv == NULL)
- {
- /* Count the arguments. */
- int argc = 0;
- while (argv[argc++])
- ;
- size_t arglen = (argc + 1) * sizeof (char *);
- if (__libc_use_alloca (alloclen + arglen))
- script_argv = alloca (arglen);
- else
- script_argv = script_argv_malloc = malloc (arglen);
- if (script_argv == NULL)
- {
- /* A possible EACCES error is not as important as
- the ENOMEM. */
- got_eacces = false;
- break;
- }
- scripts_argv (startp, argv, argc, script_argv);
- }
-
- __execve (script_argv[0], script_argv, __environ);
- }
-
- switch (errno)
- {
- case EACCES:
- /* Record the we got a `Permission denied' error. If we end
- up finding no executable we can use, we want to diagnose
- that we did find one but were denied access. */
- got_eacces = true;
- case ENOENT:
- case ESTALE:
- case ENOTDIR:
- /* Those errors indicate the file is missing or not executable
- by us, in which case we want to just try the next path
- directory. */
- case ENODEV:
- case ETIMEDOUT:
- /* Some strange filesystems like AFS return even
- stranger error numbers. They cannot reasonably mean
- anything else so ignore those, too. */
- break;
-
- default:
- /* Some other error means we found an executable file, but
- something went wrong executing it; return the error to our
- caller. */
- return -1;
- }
- }
- while (*p++ != '\0');
-
- /* We tried every element and none of them worked. */
- if (got_eacces)
- /* At least one failure was due to permissions, so report that
- error. */
- __set_errno (EACCES);
-
- free (script_argv_malloc);
- free (path_malloc);
- }
-
- /* Return the error from the last attempt (probably ENOENT). */
- return -1;
+ return __execvpe (file, argv, __environ);
}
libc_hidden_def (execvp)
diff --git a/libc/posix/execvpe.c b/libc/posix/execvpe.c
new file mode 100644
index 000000000..b4f40d3a7
--- /dev/null
+++ b/libc/posix/execvpe.c
@@ -0,0 +1,221 @@
+/* Copyright (C) 1991,92, 1995-99, 2002, 2004, 2005, 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
+ 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 <alloca.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <paths.h>
+
+
+/* The file is accessible but it is not an executable file. Invoke
+ the shell to interpret it as a script. */
+static void
+internal_function
+scripts_argv (const char *file, char *const argv[], int argc, char **new_argv)
+{
+ /* Construct an argument list for the shell. */
+ new_argv[0] = (char *) _PATH_BSHELL;
+ new_argv[1] = (char *) file;
+ while (argc > 1)
+ {
+ new_argv[argc] = argv[argc - 1];
+ --argc;
+ }
+}
+
+
+/* Execute FILE, searching in the `PATH' environment variable if it contains
+ no slashes, with arguments ARGV and environment from ENVP. */
+int
+__execvpe (file, argv, envp)
+ const char *file;
+ char *const argv[];
+ char *const envp[];
+{
+ if (*file == '\0')
+ {
+ /* We check the simple case first. */
+ __set_errno (ENOENT);
+ return -1;
+ }
+
+ if (strchr (file, '/') != NULL)
+ {
+ /* Don't search when it contains a slash. */
+ __execve (file, argv, envp);
+
+ if (errno == ENOEXEC)
+ {
+ /* Count the arguments. */
+ int argc = 0;
+ while (argv[argc++])
+ ;
+ size_t len = (argc + 1) * sizeof (char *);
+ char **script_argv;
+ void *ptr = NULL;
+ if (__libc_use_alloca (len))
+ script_argv = alloca (len);
+ else
+ script_argv = ptr = malloc (len);
+
+ if (script_argv != NULL)
+ {
+ scripts_argv (file, argv, argc, script_argv);
+ __execve (script_argv[0], script_argv, envp);
+
+ free (ptr);
+ }
+ }
+ }
+ else
+ {
+ size_t pathlen;
+ size_t alloclen = 0;
+ char *path = getenv ("PATH");
+ if (path == NULL)
+ {
+ pathlen = confstr (_CS_PATH, (char *) NULL, 0);
+ alloclen = pathlen + 1;
+ }
+ else
+ pathlen = strlen (path);
+
+ size_t len = strlen (file) + 1;
+ alloclen += pathlen + len + 1;
+
+ char *name;
+ char *path_malloc = NULL;
+ if (__libc_use_alloca (alloclen))
+ name = alloca (alloclen);
+ else
+ {
+ path_malloc = name = malloc (alloclen);
+ if (name == NULL)
+ return -1;
+ }
+
+ if (path == NULL)
+ {
+ /* There is no `PATH' in the environment.
+ The default search path is the current directory
+ followed by the path `confstr' returns for `_CS_PATH'. */
+ path = name + pathlen + len + 1;
+ path[0] = ':';
+ (void) confstr (_CS_PATH, path + 1, pathlen);
+ }
+
+ /* Copy the file name at the top. */
+ name = (char *) memcpy (name + pathlen + 1, file, len);
+ /* And add the slash. */
+ *--name = '/';
+
+ char **script_argv = NULL;
+ void *script_argv_malloc = NULL;
+ bool got_eacces = false;
+ char *p = path;
+ do
+ {
+ char *startp;
+
+ path = p;
+ p = __strchrnul (path, ':');
+
+ if (p == path)
+ /* Two adjacent colons, or a colon at the beginning or the end
+ of `PATH' means to search the current directory. */
+ startp = name + 1;
+ else
+ startp = (char *) memcpy (name - (p - path), path, p - path);
+
+ /* Try to execute this name. If it works, execve will not return. */
+ __execve (startp, argv, envp);
+
+ if (errno == ENOEXEC)
+ {
+ if (script_argv == NULL)
+ {
+ /* Count the arguments. */
+ int argc = 0;
+ while (argv[argc++])
+ ;
+ size_t arglen = (argc + 1) * sizeof (char *);
+ if (__libc_use_alloca (alloclen + arglen))
+ script_argv = alloca (arglen);
+ else
+ script_argv = script_argv_malloc = malloc (arglen);
+ if (script_argv == NULL)
+ {
+ /* A possible EACCES error is not as important as
+ the ENOMEM. */
+ got_eacces = false;
+ break;
+ }
+ scripts_argv (startp, argv, argc, script_argv);
+ }
+
+ __execve (script_argv[0], script_argv, envp);
+ }
+
+ switch (errno)
+ {
+ case EACCES:
+ /* Record the we got a `Permission denied' error. If we end
+ up finding no executable we can use, we want to diagnose
+ that we did find one but were denied access. */
+ got_eacces = true;
+ case ENOENT:
+ case ESTALE:
+ case ENOTDIR:
+ /* Those errors indicate the file is missing or not executable
+ by us, in which case we want to just try the next path
+ directory. */
+ case ENODEV:
+ case ETIMEDOUT:
+ /* Some strange filesystems like AFS return even
+ stranger error numbers. They cannot reasonably mean
+ anything else so ignore those, too. */
+ break;
+
+ default:
+ /* Some other error means we found an executable file, but
+ something went wrong executing it; return the error to our
+ caller. */
+ return -1;
+ }
+ }
+ while (*p++ != '\0');
+
+ /* We tried every element and none of them worked. */
+ if (got_eacces)
+ /* At least one failure was due to permissions, so report that
+ error. */
+ __set_errno (EACCES);
+
+ free (script_argv_malloc);
+ free (path_malloc);
+ }
+
+ /* Return the error from the last attempt (probably ENOENT). */
+ return -1;
+}
+weak_alias (__execvpe, execvpe)
diff --git a/libc/posix/tst-cpucount.c b/libc/posix/tst-cpucount.c
index fe3cded73..b3691a18d 100644
--- a/libc/posix/tst-cpucount.c
+++ b/libc/posix/tst-cpucount.c
@@ -1,5 +1,6 @@
#include <sched.h>
#include <stdio.h>
+#include <sys/param.h>
static int
do_test (void)
@@ -8,7 +9,7 @@ do_test (void)
CPU_ZERO (&c);
- for (int cnt = 0; cnt < 130; ++cnt)
+ for (int cnt = 0; cnt < MIN (CPU_SETSIZE, 130); ++cnt)
{
int n = CPU_COUNT (&c);
if (n != cnt)
diff --git a/libc/posix/unistd.h b/libc/posix/unistd.h
index 24ec74e05..cbab9f939 100644
--- a/libc/posix/unistd.h
+++ b/libc/posix/unistd.h
@@ -551,6 +551,14 @@ extern int execvp (__const char *__file, char *__const __argv[])
extern int execlp (__const char *__file, __const char *__arg, ...)
__THROW __nonnull ((1));
+#ifdef __USE_GNU
+/* Execute FILE, searching in the `PATH' environment variable if it contains
+ no slashes, with arguments ARGV and environment from `environ'. */
+extern int execvpe (__const char *__file, char *__const __argv[],
+ char *__const __envp[])
+ __THROW __nonnull ((1));
+#endif
+
#if defined __USE_MISC || defined __USE_XOPEN
/* Add INC to priority of the current process. */
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index 25a854f72..39c69da2b 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -1008,7 +1008,7 @@ 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;// XXX
int save_gotsomewhere = *gotsomewhere;
retry:
evNowTime(&now);
@@ -1059,6 +1059,7 @@ send_dg(res_state statp,
have received the first answer. */
if (!single_request)
{
+ statp->options |= RES_SNGLKUP;
single_request = true;
*gotsomewhere = save_gotsomewhere;
goto retry;
diff --git a/libc/stdlib/Versions b/libc/stdlib/Versions
index 93c68f6e3..3e7b8921c 100644
--- a/libc/stdlib/Versions
+++ b/libc/stdlib/Versions
@@ -104,5 +104,7 @@ libc {
# functions which have an additional interface since they are
# are cancelable.
__libc_system;
+ # Variable which needs a dynamic symbol table entry.
+ __abort_msg;
}
}
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c
index 00788f22c..3c188c951 100644
--- a/libc/stdlib/abort.c
+++ b/libc/stdlib/abort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,93,95,96,97,98,2001,02 Free Software Foundation, Inc.
+/* Copyright (C) 1991,93,1995-1998,2001,02,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
@@ -36,6 +36,10 @@
# define fflush(s) _IO_flush_all_lockp (0)
#endif
+/* Exported variable to locate abort message in core files etc. */
+char *__abort_msg __attribute__ ((nocommon));
+libc_hidden_def (__abort_msg)
+
/* We must avoid to run in circles. Therefore we remember how far we
already got. */
static int stage;
diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c
index 1adb2c0eb..bb0cbfdf6 100644
--- a/libc/string/strncmp.c
+++ b/libc/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/libc/string/test-memchr.c b/libc/string/test-memchr.c
index c233ead5d..cd9a01e3d 100644
--- a/libc/string/test-memchr.c
+++ b/libc/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/libc/sunrpc/rpcinfo.c b/libc/sunrpc/rpcinfo.c
index aa315bf37..d92101d9a 100644
--- a/libc/sunrpc/rpcinfo.c
+++ b/libc/sunrpc/rpcinfo.c
@@ -687,7 +687,8 @@ usage (FILE *stream)
fputs (_(" rpcinfo -p [ host ]\n"), stream);
fputs (_(" rpcinfo -b prognum versnum\n"), stream);
fputs (_(" rpcinfo -d prognum versnum\n"), stream);
- fprintf (stream, _("\n\
+ fputc ('\n', stream);
+ fprintf (stream, _("\
For bug reporting instructions, please see:\n\
%s.\n"), REPORT_BUGS_TO);
}
diff --git a/libc/sysdeps/generic/pty-private.h b/libc/sysdeps/generic/pty-private.h
index d6ec2cee6..493f40551 100644
--- a/libc/sysdeps/generic/pty-private.h
+++ b/libc/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/libc/sysdeps/i386/dl-irel.h b/libc/sysdeps/i386/dl-irel.h
index 4acb862c6..30385a1ef 100644
--- a/libc/sysdeps/i386/dl-irel.h
+++ b/libc/sysdeps/i386/dl-irel.h
@@ -21,6 +21,7 @@
#ifndef _DL_IREL_H
#define _DL_IREL_H
+#include <stdio.h>
#include <unistd.h>
#define ELF_MACHINE_IREL 1
@@ -34,11 +35,11 @@ elf_irel (const Elf32_Rel *reloc)
if (__builtin_expect (r_type == R_386_IRELATIVE, 1))
{
- Elf64_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
+ Elf32_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
*reloc_addr = value;
}
else
- _exit (-1);
+ __libc_fatal ("unexpected reloc type in static binary");
}
#endif /* dl-irel.h */
diff --git a/libc/sysdeps/i386/dl-machine.h b/libc/sysdeps/i386/dl-machine.h
index efa929e57..a093d2b15 100644
--- a/libc/sysdeps/i386/dl-machine.h
+++ b/libc/sysdeps/i386/dl-machine.h
@@ -345,9 +345,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
if (sym != NULL
- && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
&& __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
- 0))
+ 0)
+ && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
value = ((Elf32_Addr (*) (void)) value) ();
switch (r_type)
diff --git a/libc/sysdeps/posix/libc_fatal.c b/libc/sysdeps/posix/libc_fatal.c
index c611b8436..4f11c0fcb 100644
--- a/libc/sysdeps/posix/libc_fatal.c
+++ b/libc/sysdeps/posix/libc_fatal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1994,1995,1997,2000,2004,2005
+/* Copyright (C) 1993-1995,1997,2000,2004,2005,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <atomic.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -123,6 +124,20 @@ __libc_message (int do_abort, const char *fmt, ...)
if (TEMP_FAILURE_RETRY (__writev (fd, iov, nlist)) == total)
written = true;
+
+ char *buf = do_abort ? malloc (total + 1) : NULL;
+ if (buf != NULL)
+ {
+ char *wp = buf;
+ for (int cnt = 0; cnt < nlist; ++cnt)
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+ *wp = '\0';
+
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
+ }
}
va_end (ap);
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S b/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
index ba45fd250..156b0bd8c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
+++ b/libc/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/libc/sysdeps/powerpc/powerpc32/power6/memset.S b/libc/sysdeps/powerpc/powerpc32/power6/memset.S
index 10fb7b978..cc65b7be9 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/libc/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/libc/sysdeps/unix/grantpt.c b/libc/sysdeps/unix/grantpt.c
index bdedbacec..8c299e914 100644
--- a/libc/sysdeps/unix/grantpt.c
+++ b/libc/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/libc/sysdeps/unix/sysv/linux/bits/socket.h b/libc/sysdeps/unix/sysv/linux/bits/socket.h
index 88062e59a..f23b338a3 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/libc/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/libc/sysdeps/unix/sysv/linux/grantpt.c b/libc/sysdeps/unix/sysv/linux/grantpt.c
deleted file mode 100644
index b894b8b63..000000000
--- a/libc/sysdeps/unix/sysv/linux/grantpt.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (C) 1998, 1999, 2001, 2002 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 and access permission are already set. */
- if (fsbuf.f_type == DEVPTS_SUPER_MAGIC || fsbuf.f_type == DEVFS_SUPER_MAGIC)
- return 0;
-
- return __unix_grantpt (fd);
-}
-
-#define grantpt static __unix_grantpt
-#include <sysdeps/unix/grantpt.c>
diff --git a/libc/sysdeps/unix/sysv/linux/libc_fatal.c b/libc/sysdeps/unix/sysv/linux/libc_fatal.c
index 8d37f1ad0..4206bb206 100644
--- a/libc/sysdeps/unix/sysv/linux/libc_fatal.c
+++ b/libc/sysdeps/unix/sysv/linux/libc_fatal.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1993-1995,1997,2000,2002-2005,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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <atomic.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -132,6 +134,20 @@ __libc_message (int do_abort, const char *fmt, ...)
if (cnt == total)
written = true;
+
+ char *buf = do_abort ? malloc (total + 1) : NULL;
+ if (buf != NULL)
+ {
+ char *wp = buf;
+ for (int cnt = 0; cnt < nlist; ++cnt)
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+ *wp = '\0';
+
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
+ }
}
va_end (ap);
diff --git a/libc/sysdeps/unix/sysv/linux/net/if_arp.h b/libc/sysdeps/unix/sysv/linux/net/if_arp.h
index 9608652ee..97cb61f62 100644
--- a/libc/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/libc/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/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h
index d43a3cdf7..a14807209 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h
+++ b/libc/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/libc/sysdeps/x86_64/bits/select.h b/libc/sysdeps/x86_64/bits/select.h
index 7f23cb59b..5f31b8408 100644
--- a/libc/sysdeps/x86_64/bits/select.h
+++ b/libc/sysdeps/x86_64/bits/select.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2001, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2001,2008,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
@@ -27,14 +27,8 @@
# if __WORDSIZE == 64
# define __FD_ZERO_STOS "stosq"
-# define __FD_SET_BTS "btsq"
-# define __FD_CLR_BTR "btrq"
-# define __FD_ISSET_BT "btq"
# else
# define __FD_ZERO_STOS "stosl"
-# define __FD_SET_BTS "btsl"
-# define __FD_CLR_BTR "btrl"
-# define __FD_ISSET_BT "btl"
# endif
# define __FD_ZERO(fdsp) \
@@ -48,26 +42,6 @@
: "memory"); \
} while (0)
-# define __FD_SET(fd, fdsp) \
- __asm__ __volatile__ (__FD_SET_BTS " %1,%0" \
- : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "r" (((int) (fd)) % __NFDBITS) \
- : "cc","memory")
-# define __FD_CLR(fd, fdsp) \
- __asm__ __volatile__ (__FD_CLR_BTR " %1,%0" \
- : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "r" (((int) (fd)) % __NFDBITS) \
- : "cc","memory")
-# define __FD_ISSET(fd, fdsp) \
- (__extension__ \
- ({register char __result; \
- __asm__ __volatile__ (__FD_ISSET_BT " %1,%2 ; setcb %b0" \
- : "=q" (__result) \
- : "r" (((int) (fd)) % __NFDBITS), \
- "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "cc"); \
- __result; }))
-
#else /* ! GNU CC */
/* We don't use `memset' because this would require a prototype and
@@ -79,8 +53,10 @@
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)
-# define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
-# define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
-# define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
#endif /* GNU CC */
+
+#define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
+#define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
+#define __FD_ISSET(d, set) \
+ ((__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) != 0)
diff --git a/libc/sysdeps/x86_64/dl-irel.h b/libc/sysdeps/x86_64/dl-irel.h
index 442ab71d2..d2d5c0670 100644
--- a/libc/sysdeps/x86_64/dl-irel.h
+++ b/libc/sysdeps/x86_64/dl-irel.h
@@ -21,6 +21,7 @@
#ifndef _DL_IREL_H
#define _DL_IREL_H
+#include <stdio.h>
#include <unistd.h>
#define ELF_MACHINE_IRELA 1
@@ -38,7 +39,7 @@ elf_irela (const Elf64_Rela *reloc)
*reloc_addr = value;
}
else
- _exit (-1);
+ __libc_fatal ("unexpected reloc type in static binary");
}
#endif /* dl-irel.h */
diff --git a/libc/sysdeps/x86_64/dl-machine.h b/libc/sysdeps/x86_64/dl-machine.h
index 1b5ce8e98..61a0556d5 100644
--- a/libc/sysdeps/x86_64/dl-machine.h
+++ b/libc/sysdeps/x86_64/dl-machine.h
@@ -297,9 +297,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
: (Elf64_Addr) sym_map->l_addr + sym->st_value);
if (sym != NULL
- && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
&& __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
- 0))
+ 0)
+ && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
value = ((Elf64_Addr (*) (void)) value) ();
# if defined RTLD_BOOTSTRAP && !USE___THREAD
diff --git a/libc/sysdeps/x86_64/memchr.S b/libc/sysdeps/x86_64/memchr.S
index 54b7af534..6082aa7f7 100644
--- a/libc/sysdeps/x86_64/memchr.S
+++ b/libc/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/libc/sysdeps/x86_64/multiarch/Makefile b/libc/sysdeps/x86_64/multiarch/Makefile
index 2a1e910e0..1c35e1ffb 100644
--- a/libc/sysdeps/x86_64/multiarch/Makefile
+++ b/libc/sysdeps/x86_64/multiarch/Makefile
@@ -1,3 +1,8 @@
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/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
new file mode 100644
index 000000000..48d128724
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
@@ -0,0 +1,15 @@
+#include "init-arch.h"
+#include <stddef.h>
+
+--
+
+CPU_FEATURES_SIZE sizeof (struct cpu_features)
+KIND_OFFSET offsetof (struct cpu_features, kind)
+CPUID_OFFSET offsetof (struct cpu_features, cpuid)
+CPUID_SIZE sizeof (struct cpuid_registers)
+CPUID_EAX_OFFSET offsetof (struct cpuid_registers, eax)
+CPUID_EBX_OFFSET offsetof (struct cpuid_registers, ebx)
+CPUID_ECX_OFFSET offsetof (struct cpuid_registers, ecx)
+CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx)
+
+COMMON_CPUID_INDEX_1
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.h b/libc/sysdeps/x86_64/multiarch/init-arch.h
index 40b804571..5c4892de3 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.h
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.h
@@ -35,7 +35,7 @@ extern struct cpu_features
arch_kind_other
} kind;
int max_cpuid;
- struct
+ struct cpuid_registers
{
unsigned int eax;
unsigned int ebx;
@@ -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/libc/sysdeps/x86_64/multiarch/rawmemchr.S b/libc/sysdeps/x86_64/multiarch/rawmemchr.S
new file mode 100644
index 000000000..93ca63163
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/rawmemchr.S
@@ -0,0 +1,93 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Ulrich Drepper <drepper@redhat.com>.
+ 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>
+
+
+/* Define multiple versions only for the definition in lib. */
+#ifndef NOT_IN_libc
+ .text
+ENTRY(rawmemchr)
+ .type rawmemchr, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq __rawmemchr_sse2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq __rawmemchr_sse42(%rip), %rax
+2: ret
+END(rawmemchr)
+strong_alias (rawmemchr, __rawmemchr)
+
+
+ .align 16
+ .type __rawmemchr_sse42, @function
+__rawmemchr_sse42:
+ cfi_startproc
+ CALL_MCOUNT
+ movd %esi, %xmm1
+ movq %rdi, %rcx
+ punpcklbw %xmm1, %xmm1
+ andq $~15, %rdi
+ punpcklbw %xmm1, %xmm1
+ orl $0xffffffff, %esi
+ movdqa (%rdi), %xmm0
+ pshufd $0, %xmm1, %xmm1
+ subq %rdi, %rcx
+ pcmpeqb %xmm1, %xmm0
+ shl %cl, %esi
+ pmovmskb %xmm0, %ecx
+ movl $16, %eax
+ movl $16, %edx
+ andl %esi, %ecx
+ jnz 1f
+
+2: pcmpestri $0x08, 16(%rdi), %xmm1
+ leaq 16(%rdi), %rdi
+ jnc 2b
+
+ leaq (%rdi,%rcx), %rax
+ ret
+
+1: bsfl %ecx, %eax
+ addq %rdi, %rax
+ ret
+ cfi_endproc
+ .size __rawmemchr_sse42, .-__rawmemchr_sse42
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __rawmemchr_sse2, @function; \
+ __rawmemchr_sse2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __rawmemchr_sse2, .-__rawmemchr_sse2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal rawmemchr 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___rawmemchr; __GI___rawmemchr = __rawmemchr_sse2
+#endif
+
+#include "../rawmemchr.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strcmp.S b/libc/sysdeps/x86_64/multiarch/strcmp.S
new file mode 100644
index 000000000..2f4bf17d9
--- /dev/null
+++ b/libc/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/libc/sysdeps/x86_64/multiarch/strlen.S b/libc/sysdeps/x86_64/multiarch/strlen.S
new file mode 100644
index 000000000..79e6a977e
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/strlen.S
@@ -0,0 +1,93 @@
+/* strlen(str) -- determine the length of the string STR.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Ulrich Drepper <drepper@redhat.com>.
+ 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>
+
+
+/* Define multiple versions only for the definition in libc and for
+ the DSO. In static binaries we need strlen before the initialization
+ happened. */
+#if defined SHARED && !defined NOT_IN_libc
+ .text
+ENTRY(strlen)
+ .type strlen, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq __strlen_sse2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq __strlen_sse42(%rip), %rax
+2: ret
+END(strlen)
+
+
+ .align 16
+ .type __strlen_sse42, @function
+__strlen_sse42:
+ cfi_startproc
+ CALL_MCOUNT
+ pxor %xmm2, %xmm2
+ movq %rdi, %rcx
+ movq %rdi, %r8
+ andq $~15, %rdi
+ movdqa %xmm2, %xmm1
+ pcmpeqb (%rdi), %xmm2
+ orl $0xffffffff, %esi
+ subq %rdi, %rcx
+ shll %cl, %esi
+ pmovmskb %xmm2, %edx
+ andl %esi, %edx
+ jnz 1f
+
+2: pcmpistri $0x08, 16(%rdi), %xmm1
+ leaq 16(%rdi), %rdi
+ jnz 2b
+
+ leaq (%rdi,%rcx), %rax
+ subq %r8, %rax
+ ret
+
+1: subq %r8, %rdi
+ bsfl %edx, %eax
+ addq %rdi, %rax
+ ret
+ cfi_endproc
+ .size __strlen_sse42, .-__strlen_sse42
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __strlen_sse2, @function; \
+ __strlen_sse2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __strlen_sse2, .-__strlen_sse2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal strlen 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_strlen; __GI_strlen = __strlen_sse2
+#endif
+
+#include "../strlen.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strncmp-c.c b/libc/sysdeps/x86_64/multiarch/strncmp-c.c
new file mode 100644
index 000000000..d4f74a418
--- /dev/null
+++ b/libc/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/libc/sysdeps/x86_64/multiarch/strncmp.S b/libc/sysdeps/x86_64/multiarch/strncmp.S
new file mode 100644
index 000000000..0af34e7f1
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/strncmp.S
@@ -0,0 +1,3 @@
+#define STRCMP strncmp
+#define USE_AS_STRNCMP
+#include "strcmp.S"
diff --git a/libc/sysdeps/x86_64/rawmemchr.S b/libc/sysdeps/x86_64/rawmemchr.S
index c3bd77163..cfb4cebf6 100644
--- a/libc/sysdeps/x86_64/rawmemchr.S
+++ b/libc/sysdeps/x86_64/rawmemchr.S
@@ -34,19 +34,18 @@ ENTRY (rawmemchr)
pcmpeqb %xmm1, %xmm0
shl %cl, %esi
pmovmskb %xmm0, %ecx
- leaq 16(%rdi), %rdi
andl %esi, %ecx
jnz 1f
-2: movdqa (%rdi), %xmm0
+2: movdqa 16(%rdi), %xmm0
leaq 16(%rdi), %rdi
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %ecx
testl %ecx, %ecx
jz 2b
-1: bsfl %ecx, %ecx
- leaq -16(%rcx,%rdi), %rax
+1: bsfl %ecx, %eax
+ addq %rdi, %rax
ret
END (rawmemchr)
diff --git a/libc/sysdeps/x86_64/strlen.S b/libc/sysdeps/x86_64/strlen.S
index 86bb8a50a..93aee6bef 100644
--- a/libc/sysdeps/x86_64/strlen.S
+++ b/libc/sysdeps/x86_64/strlen.S
@@ -23,30 +23,27 @@
.text
ENTRY(strlen)
+ pxor %xmm2, %xmm2
movq %rdi, %rcx
movq %rdi, %r8
andq $~15, %rdi
- pxor %xmm1, %xmm1
+ movdqa %xmm2, %xmm1
+ pcmpeqb (%rdi), %xmm2
orl $0xffffffff, %esi
- movdqa (%rdi), %xmm0
subq %rdi, %rcx
- leaq 16(%rdi), %rdi
- pcmpeqb %xmm1, %xmm0
- shl %cl, %esi
- pmovmskb %xmm0, %edx
- xorl %eax, %eax
- negq %r8
+ shll %cl, %esi
+ pmovmskb %xmm2, %edx
andl %esi, %edx
jnz 1f
-2: movdqa (%rdi), %xmm0
+2: movdqa 16(%rdi), %xmm0
leaq 16(%rdi), %rdi
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %edx
testl %edx, %edx
jz 2b
-1: leaq -16(%rdi,%r8), %rdi
+1: subq %r8, %rdi
bsfl %edx, %eax
addq %rdi, %rax
ret
diff --git a/libc/time/tzfile.c b/libc/time/tzfile.c
index 970022379..f4cba46e5 100644
--- a/libc/time/tzfile.c
+++ b/libc/time/tzfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993,1995-2001,2003,2004,2006, 2007
+/* Copyright (C) 1991-1993,1995-2001,2003,2004,2006,2007,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -248,7 +248,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
+ num_transitions * (8 + 1)
+ num_types * 6
+ chars
- + num_leaps * 8
+ + num_leaps * 12
+ num_isstd
+ num_isgmt) - 1 : 0);
@@ -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. */
@@ -659,9 +663,7 @@ __tzfile_compute (time_t timer, int use_localtime,
__tzname[1] = __tzstring (&zone_names[strlen (zone_names) + 1]);
}
- *leap_correct = 0L;
- *leap_hit = 0;
- return;
+ goto leap;
}
else
{
@@ -762,6 +764,7 @@ __tzfile_compute (time_t timer, int use_localtime,
tp->tm_gmtoff = info->offset;
}
+ leap:
*leap_correct = 0L;
*leap_hit = 0;
diff --git a/libc/timezone/africa b/libc/timezone/africa
index 304e7d3b7..3f92eb474 100644
--- a/libc/timezone/africa
+++ b/libc/timezone/africa
@@ -1,5 +1,7 @@
-# @(#)africa 8.16
# <pre>
+# @(#)africa 8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -236,7 +238,46 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
# unless discontinued, next DST may end Thursday 28 August 2008.
# From Paul Eggert (2007-08-17):
# For lack of better info, assume the new rule is last Thursday in August.
-Rule Egypt 2008 max - Aug lastThu 23:00s 0 -
+
+# From Petr Machata (2009-04-06):
+# The following appeared in Red Hat bugzilla[1] (edited):
+#
+# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
+# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC = Thu =
+# Apr 23
+# > 23:59:59 2009 EET isdst=0 gmtoff=7200
+# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC = Fri =
+# Apr 24
+# > 01:00:00 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC = Thu =
+# Aug 27
+# > 23:59:59 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC = Thu =
+# Aug 27
+# > 23:00:00 2009 EET isdst=0 gmtoff=7200
+#
+# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
+# :59)
+# > http://support.microsoft.com/kb/958729/
+#
+# timeanddate[2] and another site I've found[3] also support that.
+#
+# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=492263">
+# https://bugzilla.redhat.com/show_bug.cgi?id=492263
+# </a>
+# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=53">
+# http://www.timeanddate.com/worldclock/clockchange.html?n=53
+# </a>
+# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
+# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+# </a>
+
+# From Arthur David Olson (2009-04-20):
+# In 2009 (and for the next several years), Ramadan ends before the fourth
+# Thursday in September; Egypt is expected to revert to the last Thursday
+# in September.
+Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
+Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
@@ -438,8 +479,8 @@ Zone Africa/Nouakchott -1:03:48 - LMT 1912
# From Riad M. Hossen Ally (2008-08-03):
# The Government of Mauritius weblink
-# <a href="http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD">
-# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
+# <a href="http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD">
+# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
# </a>
# Cabinet Decision of July 18th, 2008 states as follows:
#
@@ -453,11 +494,19 @@ Zone Africa/Nouakchott -1:03:48 - LMT 1912
# year 2008 - 2009 will, therefore, be effective as from 26 October 2008
# and end on 29 March 2009.
+# From Ed Maste (2008-10-07):
+# THE TIME BILL (No. XXVII of 2008) Explanatory Memorandum states the
+# beginning / ending of summer time is 2 o'clock standard time in the
+# morning of the last Sunday of October / last Sunday of March.
+# <a href="http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf">
+# http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
+# </a>
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mauritius 1982 only - Oct 10 0:00 1:00 S
Rule Mauritius 1983 only - Mar 21 0:00 0 -
-Rule Mauritius 2008 max - Oct lastSun 2:00 1:00 S
-Rule Mauritius 2009 max - Mar lastSun 2:00 0 -
+Rule Mauritius 2008 max - Oct lastSun 2:00s 1:00 S
+Rule Mauritius 2009 max - Mar lastSun 2:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
4:00 Mauritius MU%sT # Mauritius Time
@@ -556,6 +605,40 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# <a href="http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html">
# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
# </a>
+
+# From Steffen Thorsen (2009-03-17):
+# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
+# to many sources, such as
+# <a href="http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html">
+# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
+# </a>
+# <a href="http://www.medi1sat.ma/fr/depeche.aspx?idp=2312">
+# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
+# </a>
+# (French)
+#
+# Our summary:
+# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html">
+# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
+# </a>
+
+# From Alexander Krivenyshev (2009-03-17):
+# Here is a link to official document from Royaume du Maroc Premier Ministre,
+# Ministere de la Modernisation des Secteurs Publics
+#
+# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
+# concerning the amendment of the legal time, the Ministry of Modernization of
+# Public Sectors announced that the official time in the Kingdom will be
+# advanced 60 minutes from Sunday 31 May 2009 at midnight.
+#
+# <a href="http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf">
+# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
+# </a>
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco03.html">
+# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
+# </a>
+
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
@@ -575,6 +658,8 @@ Rule Morocco 1978 only - Jun 1 0:00 1:00 S
Rule Morocco 1978 only - Aug 4 0:00 0 -
Rule Morocco 2008 only - Jun 1 0:00 1:00 S
Rule Morocco 2008 only - Sep 1 0:00 0 -
+Rule Morocco 2009 only - Jun 1 0:00 1:00 S
+Rule Morocco 2009 only - Aug 21 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
@@ -779,6 +864,43 @@ Zone Africa/Lome 0:04:52 - LMT 1893
# Ending : the last Sunday of October at 03:00 ...
# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
+# From Steffen Thorsen (2009-03-16):
+# According to several news sources, Tunisia will not observe DST this year.
+# (Arabic)
+# <a href="http://www.elbashayer.com/?page=viewn&nid=42546">
+# http://www.elbashayer.com/?page=viewn&nid=42546
+# </a>
+# <a href="http://www.babnet.net/kiwidetail-15295.asp">
+# http://www.babnet.net/kiwidetail-15295.asp
+# </a>
+#
+# We have also confirmed this with the US embassy in Tunisia.
+# We have a wrap-up about this on the following page:
+# <a href="http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html">
+# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
+# </a>
+
+# From Alexander Krivenyshev (2009-03-17):
+# Here is a link to Tunis Afrique Presse News Agency
+#
+# Standard time to be kept the whole year long (tap.info.tn):
+#
+# (in English)
+# <a href="http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157">
+# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
+# </a>
+#
+# (in Arabic)
+# <a href="http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1">
+# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
+# </a>
+
+# From Arthur David Olson (2009--3-18):
+# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
+# that the fasting month of ramadan coincides with the period concerned by summer time.
+# Therefore, the standard time will be kept unchanged the whole year long."
+# So foregoing DST seems to be an exception (albeit one that may be repeated in the future).
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Tunisia 1939 only - Apr 15 23:00s 1:00 S
Rule Tunisia 1939 only - Nov 18 23:00s 0 -
@@ -803,8 +925,10 @@ Rule Tunisia 1989 only - Mar 26 0:00s 1:00 S
Rule Tunisia 1990 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - Sep 30 1:00s 0 -
-Rule Tunisia 2006 max - Mar lastSun 2:00s 1:00 S
-Rule Tunisia 2006 max - Oct lastSun 2:00s 0 -
+Rule Tunisia 2006 2008 - Mar lastSun 2:00s 1:00 S
+Rule Tunisia 2006 2008 - Oct lastSun 2:00s 0 -
+Rule Tunisia 2010 max - Mar lastSun 2:00s 1:00 S
+Rule Tunisia 2010 max - Oct lastSun 2:00s 0 -
# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
# more precise 0:09:21.
# Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.
diff --git a/libc/timezone/antarctica b/libc/timezone/antarctica
index ef279cbed..8511ab207 100644
--- a/libc/timezone/antarctica
+++ b/libc/timezone/antarctica
@@ -1,5 +1,7 @@
-# @(#)antarctica 8.4
# <pre>
+# @(#)antarctica 8.5
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# From Paul Eggert (1999-11-15):
# To keep things manageable, we list only locations occupied year-round; see
diff --git a/libc/timezone/asia b/libc/timezone/asia
index 768850f3d..de2ca3935 100644
--- a/libc/timezone/asia
+++ b/libc/timezone/asia
@@ -1,5 +1,7 @@
-# @(#)asia 8.23
# <pre>
+# @(#)asia 8.34
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -125,6 +127,48 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
3:00 - AST
# Bangladesh
+# From Alexander Krivenyshev (2009-05-13):
+# According to newspaper Asian Tribune (May 6, 2009) Bangladesh may introduce
+# Daylight Saving Time from June 16 to Sept 30
+#
+# Bangladesh to introduce daylight saving time likely from June 16
+# <a href="http://www.asiantribune.com/?q=node/17288">
+# http://www.asiantribune.com/?q=node/17288
+# </a>
+# or
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html">
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html
+# </a>
+#
+# "... Bangladesh government has decided to switch daylight saving time from
+# June
+# 16 till September 30 in a bid to ensure maximum use of daylight to cope with
+# crippling power crisis. "
+#
+# The switch will remain in effect from June 16 to Sept 30 (2009) but if
+# implemented the next year, it will come in force from April 1, 2010
+
+# From Steffen Thorsen (2009-06-02):
+# They have finally decided now, but changed the start date to midnight between
+# the 19th and 20th, and they have not set the end date yet.
+#
+# Some sources:
+# <a href="http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601">
+# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
+# </a>
+# <a href="http://bdnews24.com/details.php?id=85889&cid=2">
+# http://bdnews24.com/details.php?id=85889&cid=2
+# </a>
+#
+# Our wrap-up:
+# <a href="http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html">
+# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
+# </a>
+
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Bang 2009 only - Jan 1 0:00 0 -
+Rule Bang 2009 only - Jun 20 0:00 1:00 S
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
5:53:20 - HMT 1941 Oct # Howrah Mean Time?
@@ -132,7 +176,8 @@ Zone Asia/Dhaka 6:01:40 - LMT 1890
5:30 - IST 1942 Sep
6:30 - BURT 1951 Sep 30
6:00 - DACT 1971 Mar 26 # Dacca Time
- 6:00 - BDT # Bangladesh Time
+ 6:00 - BDT 2009 # Bangladesh Time
+ 6:00 Bang BD%sT
# Bhutan
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -1049,6 +1094,40 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u
# http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
# "Jordan will switch to winter time on Friday, October 27".
#
+
+# From Phil Pizzey (2009-04-02):
+# ...I think I may have spotted an error in the timezone data for
+# Jordan.
+# The current (2009d) asia file shows Jordan going to daylight
+# saving
+# time on the last Thursday in March.
+#
+# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
+#
+# However timeanddate.com, which I usually find reliable, shows Jordan
+# going to daylight saving time on the last Friday in March since 2002.
+# Please see
+# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
+# http://www.timeanddate.com/worldclock/timezone.html?n=11
+# </a>
+
+# From Steffen Thorsen (2009-04-02):
+# This single one might be good enough, (2009-03-24, Arabic):
+# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
+# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
+# </a>
+#
+# Google's translation:
+#
+# > The Council of Ministers decided in 2002 to adopt the principle of timely
+# > submission of the summer at 60 minutes as of midnight on the last Thursday
+# > of the month of March of each year.
+#
+# So - this means the midnight between Thursday and Friday since 2002.
+
+# From Arthur David Olson (2009-04-06):
+# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Jordan 1973 only - Jun 6 0:00 1:00 S
Rule Jordan 1973 1975 - Oct 1 0:00 0 -
@@ -1071,8 +1150,9 @@ Rule Jordan 1993 1998 - Apr Fri>=1 0:00 1:00 S
Rule Jordan 1994 only - Sep Fri>=15 0:00 0 -
Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
-Rule Jordan 1999 2002 - Sep lastThu 0:00s 0 -
-Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
+Rule Jordan 1999 2002 - Sep lastFri 0:00s 0 -
+Rule Jordan 2000 2001 - Mar lastThu 0:00s 1:00 S
+Rule Jordan 2002 max - Mar lastThu 24:00 1:00 S
Rule Jordan 2003 only - Oct 24 0:00s 0 -
Rule Jordan 2004 only - Oct 15 0:00s 0 -
Rule Jordan 2005 only - Sep lastFri 0:00s 0 -
@@ -1474,7 +1554,7 @@ Zone Asia/Choibalsan 7:38:00 - LMT 1905 Aug
# Nepal
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Asia/Katmandu 5:41:16 - LMT 1920
+Zone Asia/Kathmandu 5:41:16 - LMT 1920
5:30 - IST 1986
5:45 - NPT # Nepal Time
@@ -1554,11 +1634,46 @@ Zone Asia/Muscat 3:54:20 - LMT 1920
# http://dailymailnews.com/200808/28/news/dmbrn03.html
# </a>
+# From Alexander Krivenyshev (2009-04-08):
+# Based on previous media reports that "... proposed plan to
+# advance clocks by one hour from May 1 will cause disturbance
+# to the working schedules rather than bringing discipline in
+# official working."
+# <a href="http://www.thenews.com.pk/daily_detail.asp?id=171280">
+# http://www.thenews.com.pk/daily_detail.asp?id=171280
+# </a>
+#
+# recent news that instead of May 2009 - Pakistan plan to
+# introduce DST from April 15, 2009
+#
+# FYI: Associated Press Of Pakistan
+# April 08, 2009
+# Cabinet okays proposal to advance clocks by one hour from April 15
+# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1">
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
+# </a>
+#
+# or
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html">
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
+# </a>
+#
+# ....
+# The Federal Cabinet on Wednesday approved the proposal to
+# advance clocks in the country by one hour from April 15 to
+# conserve energy"
+
+# From Arthur David Olson (2009-04-10):
+# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S
Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 -
Rule Pakistan 2008 only - Jun 1 0:00 1:00 S
Rule Pakistan 2008 only - Nov 1 0:00 0 -
+Rule Pakistan 2009 only - Apr 15 0:00 1:00 S
+Rule Pakistan 2009 only - Nov 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Karachi 4:28:12 - LMT 1907
5:30 - IST 1942 Sep
@@ -1695,6 +1810,22 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
# </a>
+# From Alexander Krivenyshev (2009-03-26):
+# According to the Palestine News Network (arabic.pnn.ps), Palestinian
+# government decided to start Daylight Time on Thursday night March
+# 26 and continue until the night of 27 September 2009.
+#
+# (in Arabic)
+# <a href="http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850">
+# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
+# </a>
+#
+# or
+# (English translation)
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank01.html">
+# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
+# </a>
+
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -1708,10 +1839,12 @@ Rule Palestine 1999 2005 - Apr Fri>=15 0:00 1:00 S
Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 -
Rule Palestine 2004 only - Oct 1 1:00 0 -
Rule Palestine 2005 only - Oct 4 2:00 0 -
-Rule Palestine 2006 max - Apr 1 0:00 1:00 S
+Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
Rule Palestine 2006 only - Sep 22 0:00 0 -
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
-Rule Palestine 2008 max - Aug lastThu 2:00 0 -
+Rule Palestine 2008 only - Aug lastFri 2:00 0 -
+Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
+Rule Palestine 2009 max - Sep lastMon 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
@@ -1957,8 +2090,41 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# compilers can't handle or having multiple Rules (a la Israel).
# For now, use "Apr Fri>=1", and go with IATA on a uniform Sep 30 end.
-Rule Syria 2008 max - Apr Fri>=1 0:00 1:00 S
-Rule Syria 2008 max - Oct 1 0:00 0 -
+# From Steffen Thorsen (2008-10-07):
+# Syria has now officially decided to end DST on 2008-11-01 this year,
+# according to the following article in the Syrian Arab News Agency (SANA).
+#
+# The article is in Arabic, and seems to tell that they will go back to
+# winter time on 2008-11-01 at 00:00 local daylight time (delaying/setting
+# clocks back 60 minutes).
+#
+# <a href="http://sana.sy/ara/2/2008/10/07/195459.htm">
+# http://sana.sy/ara/2/2008/10/07/195459.htm
+# </a>
+
+# From Steffen Thorsen (2009-03-19):
+# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
+# two examples:
+#
+# <a href="http://www.sana.sy/eng/21/2009/03/17/217563.htm">
+# http://www.sana.sy/eng/21/2009/03/17/217563.htm
+# </a>
+# (English, Syrian Arab News # Agency)
+# <a href="http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209">
+# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
+# </a>
+# (Arabic, gov-site)
+#
+# We have not found any sources saying anything about when DST ends this year.
+#
+# Our summary
+# <a href="http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html">
+# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
+# </a>
+
+Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
+Rule Syria 2008 max - Nov 1 0:00 0 -
+Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq
diff --git a/libc/timezone/australasia b/libc/timezone/australasia
index 41608cdc3..efcfec74d 100644
--- a/libc/timezone/australasia
+++ b/libc/timezone/australasia
@@ -1,5 +1,7 @@
-# @(#)australasia 8.9
# <pre>
+# @(#)australasia 8.11
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This file also includes Pacific islands.
@@ -1119,6 +1121,27 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# From Paul Eggert (2007-07-23):
# See "southeast Australia" above for 2008 and later.
+# From Steffen Thorsen (2009-04-28):
+# According to the official press release, South Australia's extended daylight
+# saving period will continue with the same rules as used during the 2008-2009
+# summer (southern hemisphere).
+#
+# From
+# <a href="http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf">
+# http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf
+# </a>
+# The extended daylight saving period that South Australia has been trialling
+# for over the last year is now set to be ongoing.
+# Daylight saving will continue to start on the first Sunday in October each
+# year and finish on the first Sunday in April the following year.
+# Industrial Relations Minister, Paul Caica, says this provides South Australia
+# with a consistent half hour time difference with NSW, Victoria, Tasmania and
+# the ACT for all 52 weeks of the year...
+#
+# We have a wrap-up here:
+# <a href="http://www.timeanddate.com/news/time/south-australia-extends-dst.html">
+# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
+# </a>
###############################################################################
# New Zealand
diff --git a/libc/timezone/backward b/libc/timezone/backward
index a65991c2d..c896968c9 100644
--- a/libc/timezone/backward
+++ b/libc/timezone/backward
@@ -1,4 +1,7 @@
-# @(#)backward 8.6
+# <pre>
+# @(#)backward 8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
@@ -24,6 +27,7 @@ Link America/St_Thomas America/Virgin
Link Asia/Ashgabat Asia/Ashkhabad
Link Asia/Chongqing Asia/Chungking
Link Asia/Dhaka Asia/Dacca
+Link Asia/Kathmandu Asia/Katmandu
Link Asia/Kolkata Asia/Calcutta
Link Asia/Macau Asia/Macao
Link Asia/Jerusalem Asia/Tel_Aviv
diff --git a/libc/timezone/etcetera b/libc/timezone/etcetera
index cddbe8a29..5c9368298 100644
--- a/libc/timezone/etcetera
+++ b/libc/timezone/etcetera
@@ -1,4 +1,7 @@
-# @(#)etcetera 8.1
+# <pre>
+# @(#)etcetera 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# These entries are mostly present for historical reasons, so that
# people in areas not otherwise covered by the tz files could "zic -l"
diff --git a/libc/timezone/europe b/libc/timezone/europe
index 7bb986473..3f39215bf 100644
--- a/libc/timezone/europe
+++ b/libc/timezone/europe
@@ -1,5 +1,7 @@
-# @(#)europe 8.18
# <pre>
+# @(#)europe 8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -2313,11 +2315,64 @@ Zone Europe/Stockholm 1:12:12 - LMT 1879 Jan 1
# mean time in preference to apparent time -- Geneva from 1780 ....
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
# From Whitman (who writes ``Midnight?''):
-Rule Swiss 1940 only - Nov 2 0:00 1:00 S
-Rule Swiss 1940 only - Dec 31 0:00 0 -
+# Rule Swiss 1940 only - Nov 2 0:00 1:00 S
+# Rule Swiss 1940 only - Dec 31 0:00 0 -
# From Shanks & Pottenger:
-Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 S
-Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0 -
+# Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 S
+# Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0 -
+
+# From Alois Treindl (2008-12-17):
+# I have researched the DST usage in Switzerland during the 1940ies.
+#
+# As I wrote in an earlier message, I suspected the current tzdata values
+# to be wrong. This is now verified.
+#
+# I have found copies of the original ruling by the Swiss Federal
+# government, in 'Eidgen[o]ssische Gesetzessammlung 1941 and 1942' (Swiss
+# federal law collection)...
+#
+# DST began on Monday 5 May 1941, 1:00 am by shifting the clocks to 2:00 am
+# DST ended on Monday 6 Oct 1941, 2:00 am by shifting the clocks to 1:00 am.
+#
+# DST began on Monday, 4 May 1942 at 01:00 am
+# DST ended on Monday, 5 Oct 1942 at 02:00 am
+#
+# There was no DST in 1940, I have checked the law collection carefully.
+# It is also indicated by the fact that the 1942 entry in the law
+# collection points back to 1941 as a reference, but no reference to any
+# other years are made.
+#
+# Newspaper articles I have read in the archives on 6 May 1941 reported
+# about the introduction of DST (Sommerzeit in German) during the previous
+# night as an absolute novelty, because this was the first time that such
+# a thing had happened in Switzerland.
+#
+# I have also checked 1916, because one book source (Gabriel, Traite de
+# l'heure dans le monde) claims that Switzerland had DST in 1916. This is
+# false, no official document could be found. Probably Gabriel got misled
+# by references to Germany, which introduced DST in 1916 for the first time.
+#
+# The tzdata rules for Switzerland must be changed to:
+# Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S
+# Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 -
+#
+# The 1940 rules must be deleted.
+#
+# One further detail for Switzerland, which is probably out of scope for
+# most users of tzdata:
+# The zone file
+# Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
+# 0:29:44 - BMT 1894 Jun #Bern Mean Time
+# 1:00 Swiss CE%sT 1981
+# 1:00 EU CE%sT
+# describes all of Switzerland correctly, with the exception of
+# the Cantone Geneve (Geneva, Genf). Between 1848 and 1894 Geneve did not
+# follow Bern Mean Time but kept its own local mean time.
+# To represent this, an extra zone would be needed.
+
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S
+Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
0:29:44 - BMT 1894 Jun # Bern Mean Time
diff --git a/libc/timezone/factory b/libc/timezone/factory
index 946063c0d..624ccc0c3 100644
--- a/libc/timezone/factory
+++ b/libc/timezone/factory
@@ -1,4 +1,7 @@
-# @(#)factory 8.1
+# <pre>
+# @(#)factory 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# For companies who don't want to put time zone specification in
# their installation procedures. When users run date, they'll get the message.
diff --git a/libc/timezone/iso3166.tab b/libc/timezone/iso3166.tab
index 8d6239958..b8a2592c0 100644
--- a/libc/timezone/iso3166.tab
+++ b/libc/timezone/iso3166.tab
@@ -1,7 +1,9 @@
+# <pre>
+# @(#)iso3166.tab 8.6
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# ISO 3166 alpha-2 country codes
#
-# @(#)iso3166.tab 8.5
-#
# From Paul Eggert (2006-09-27):
#
# This file contains a table with the following columns:
diff --git a/libc/timezone/leapseconds b/libc/timezone/leapseconds
index a2f4f0be3..d6343c020 100644
--- a/libc/timezone/leapseconds
+++ b/libc/timezone/leapseconds
@@ -1,4 +1,7 @@
-# @(#)leapseconds 8.6
+# <pre>
+# @(#)leapseconds 8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# Allowance for leapseconds added to each timezone file.
@@ -53,40 +56,32 @@ Leap 2008 Dec 31 23:59:60 + S
# SERVICE DE LA ROTATION TERRESTRE
# OBSERVATOIRE DE PARIS
# 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel. : 33 (0) 1 40 51 22 26
+# Tel. : 33 (0) 1 40 51 22 29
# FAX : 33 (0) 1 40 51 22 91
-# e-mail : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet : services.iers@obspm.fr
#
-# Paris, 4 July 2008
+# Paris, 15 January 2009
#
-# Bulletin C 36
+# Bulletin C 37
#
# To authorities responsible
# for the measurement and
# distribution of time
#
-# UTC TIME STEP
-# on the 1st of January 2009
+# INFORMATION ON UTC - TAI
#
-# A positive leap second will be introduced at the end of December 2008.
-# The sequence of dates of the UTC second markers will be:
+# NO positive leap second will be introduced at the end of June 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :
#
-# 2008 December 31, 23h 59m 59s
-# 2008 December 31, 23h 59m 60s
-# 2009 January 1, 0h 0m 0s
-#
-# The difference between UTC and the International Atomic Time TAI is:
-#
-# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s
-# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
#
# Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
# will be no time step at the next possible date.
#
# Daniel GAMBIS
-# Head
-# Earth Orientation Center of IERS
+# Head
+# Earth Orientation Center of the IERS
# Observatoire de Paris, France
diff --git a/libc/timezone/northamerica b/libc/timezone/northamerica
index b8b333cc5..236922d75 100644
--- a/libc/timezone/northamerica
+++ b/libc/timezone/northamerica
@@ -1,5 +1,7 @@
-# @(#)northamerica 8.24
# <pre>
+# @(#)northamerica 8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# also includes Central America and the Caribbean
@@ -1742,9 +1744,13 @@ Zone America/Dawson_Creek -8:00:56 - LMT 1884
# The individual that answered the phone confirmed that the clocks did not
# move at the end of daylight saving on October 29/2006. He also told me that
# the clocks did not move this past weekend (March 11/2007)....
-#
-# America/Resolute should use the "Canada" Rule up to October 29/2006.
-# After that it should be fixed on Eastern Standard Time until further notice.
+
+# From Chris Walton (2008-11-13):
+# ...the residents of Resolute believe that they are changing "time zones"
+# twice a year. In winter months, local time is qualified with "Eastern
+# Time" which is really "Eastern Standard Time (UTC-5)". In summer
+# months, local time is qualified with "Central Time" which is really
+# "Central Daylight Time (UTC-5)"...
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NT_YK 1918 only - Apr 14 2:00 1:00 D
@@ -1772,11 +1778,14 @@ Zone America/Iqaluit 0 - zzz 1942 Aug # Frobisher Bay est.
-6:00 Canada C%sT 2000 Oct 29 2:00
-5:00 Canada E%sT
# aka Qausuittuq
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Resolute 2006 max - Nov Sun>=1 2:00 0 ES
+Rule Resolute 2007 max - Mar Sun>=8 2:00 0 CD
Zone America/Resolute 0 - zzz 1947 Aug 31 # Resolute founded
-6:00 NT_YK C%sT 2000 Oct 29 2:00
-5:00 - EST 2001 Apr 1 3:00
-6:00 Canada C%sT 2006 Oct 29 2:00
- -5:00 - EST
+ -5:00 Resolute %sT
# aka Kangiqiniq
Zone America/Rankin_Inlet 0 - zzz 1957 # Rankin Inlet founded
-6:00 NT_YK C%sT 2000 Oct 29 2:00
@@ -2251,6 +2260,25 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# From Arthur David Olson (2008-03-12):
# Assume Sun>=15 (third Sunday) going forward.
+# From Alexander Krivenyshev (2009-03-04)
+# According to the Radio Reloj - Cuba will start Daylight Saving Time on
+# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
+# not on midnight March 14 / March 15 as previously thought.
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_cuba05.html">
+# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
+# (in Spanish)
+# </a>
+
+# From Arthur David Olson (2009-03-09)
+# I listened over the Internet to
+# <a href="http://media.enet.cu/readioreloj">
+# http://media.enet.cu/readioreloj
+# </a>
+# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
+# the time was announced as "diez cinco"--the same time as here, indicating
+# that has indeed switched to DST. Assume second Sunday from 2009 forward.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S
@@ -2280,10 +2308,11 @@ Rule Cuba 1996 only - Oct 6 0:00s 0 S
Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
-Rule Cuba 2000 2006 - Apr Sun>=1 0:00s 1:00 D
+Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
-Rule Cuba 2008 max - Mar Sun>=15 0:00s 1:00 D
+Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
+Rule Cuba 2009 max - Mar Sun>=8 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890
diff --git a/libc/timezone/pacificnew b/libc/timezone/pacificnew
index 667940bf5..e2512c1d1 100644
--- a/libc/timezone/pacificnew
+++ b/libc/timezone/pacificnew
@@ -1,4 +1,7 @@
-# @(#)pacificnew 8.1
+# <pre>
+# @(#)pacificnew 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# From Arthur David Olson (1989-04-05):
# On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill
diff --git a/libc/timezone/solar87 b/libc/timezone/solar87
index 71839320a..47ee7e7aa 100644
--- a/libc/timezone/solar87
+++ b/libc/timezone/solar87
@@ -1,4 +1,7 @@
-# @(#)solar87 8.1
+# <pre>
+# @(#)solar87 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# So much for footnotes about Saudi Arabia.
# Apparent noon times below are for Riyadh; your mileage will vary.
diff --git a/libc/timezone/solar88 b/libc/timezone/solar88
index b4cfe8e37..8db590edd 100644
--- a/libc/timezone/solar88
+++ b/libc/timezone/solar88
@@ -1,4 +1,7 @@
-# @(#)solar88 8.1
+# <pre>
+# @(#)solar88 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# Apparent noon times below are for Riyadh; they're a bit off for other places.
# Times were computed using formulas in the U.S. Naval Observatory's
diff --git a/libc/timezone/solar89 b/libc/timezone/solar89
index 8c4853146..d24de4a77 100644
--- a/libc/timezone/solar89
+++ b/libc/timezone/solar89
@@ -1,4 +1,7 @@
-# @(#)solar89 8.1
+# <pre>
+# @(#)solar89 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# Apparent noon times below are for Riyadh; they're a bit off for other places.
# Times were computed using a formula provided by the U. S. Naval Observatory:
diff --git a/libc/timezone/southamerica b/libc/timezone/southamerica
index e2244cf23..341e57ff9 100644
--- a/libc/timezone/southamerica
+++ b/libc/timezone/southamerica
@@ -1,5 +1,7 @@
-# @(#)southamerica 8.27
# <pre>
+# @(#)southamerica 8.36
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -177,6 +179,42 @@ Rule Arg 2000 only - Mar 3 0:00 0 -
# http://www.impulsobaires.com.ar/nota.php?id=57832 (in spanish)
# </a>
+# From Rodrigo Severo (2008-10-06):
+# Here is some info available at a Gentoo bug related to TZ on Argentina's DST:
+# ...
+# ------- Comment #1 from [jmdocile] 2008-10-06 16:28 0000 -------
+# Hi, there is a problem with timezone-data-2008e and maybe with
+# timezone-data-2008f
+# Argentinian law [Number] 25.155 is no longer valid.
+# <a href="http://www.infoleg.gov.ar/infolegInternet/anexos/60000-64999/60036/norma.htm">
+# http://www.infoleg.gov.ar/infolegInternet/anexos/60000-64999/60036/norma.htm
+# </a>
+# The new one is law [Number] 26.350
+# <a href="http://www.infoleg.gov.ar/infolegInternet/anexos/135000-139999/136191/norma.htm">
+# http://www.infoleg.gov.ar/infolegInternet/anexos/135000-139999/136191/norma.htm
+# </a>
+# So there is no summer time in Argentina for now.
+
+# From Mariano Absatz (2008-10-20):
+# Decree 1693/2008 applies Law 26.350 for the summer 2008/2009 establishing DST in Argentina
+# From 2008-10-19 until 2009-03-15
+# <a href="http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=16102008&pi=3&pf=4&s=0&sec=01">
+# http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=16102008&pi=3&pf=4&s=0&sec=01
+# </a>
+#
+# Decree 1705/2008 excepting 12 Provinces from applying DST in the summer 2008/2009:
+# Catamarca, La Rioja, Mendoza, Salta, San Juan, San Luis, La Pampa, Neuquen, Rio Negro, Chubut, Santa Cruz
+# and Tierra del Fuego
+# <a href="http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=17102008&pi=1&pf=1&s=0&sec=01">
+# http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=17102008&pi=1&pf=1&s=0&sec=01
+# </a>
+#
+# Press release 235 dated Saturday October 18th, from the Government of the Province of Jujuy saying
+# it will not apply DST either (even when it was not included in Decree 1705/2008)
+# <a href="http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc">
+# http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
+# </a>
+
Rule Arg 2007 only - Dec 30 0:00 1:00 S
Rule Arg 2008 max - Mar Sun>=15 0:00 0 -
Rule Arg 2008 max - Oct Sun>=15 0:00 1:00 S
@@ -315,6 +353,50 @@ Rule Arg 2008 max - Oct Sun>=15 0:00 1:00 S
# keep America/Cordoba a single region rather than splitting it into the
# other 5 subregions.
+# From Mariano Absatz (2009-03-13):
+# Yesterday (with our usual 2-day notice) the Province of San Luis
+# decided that next Sunday instead of "staying" @utc-03:00 they will go
+# to utc-04:00 until the second Saturday in October...
+#
+# The press release is at
+# <a href="http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102">
+# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
+# </a>
+# (I couldn't find the decree, but
+# <a href="http://www.sanluis.gov.ar">
+# www.sanluis.gov.ar
+# <a/>
+# is the official page for the Province Government).
+#
+# There's also a note in only one of the major national papers (La Nación) at
+# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
+# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
+# </a>
+#
+# The press release says:
+# (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
+# atrasar una hora sus relojes.
+#
+# A partir de entonces, San Luis establecerá el huso horario propio de
+# la Provincia. De esta manera, durante el periodo del calendario anual
+# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
+# domingo de marzo y las 24:00 del segundo sábado de octubre.
+# Quick&dirty translation
+# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
+# inhabitants) will have to turn back one hour their clocks
+#
+# Since then, San Luis will establish its own Province timezone. Thus,
+# during 2009, this timezone change will run from 00:00 the third Sunday
+# in March until 24:00 of the second Saturday in October.
+
+# From Arthur David Olson (2009-03-16):
+# The unofficial claim at
+# <a href="http://www.timeanddate.com/news/time/san-luis-new-time-zone.html">
+# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
+# </a>
+# is that "The province will most likely follow the next daylight saving schedule,
+# which is planned for the second Sunday in October."
+
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
@@ -327,9 +409,8 @@ Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 Arg AR%sT
#
-# Santa Fe (SF), Entre Rios (ER), Corrientes (CN), Misiones (MN), Chaco (CC),
-# Formosa (FM), Salta (SA), Santiago del Estero (SE), Cordoba (CB),
-# La Pampa (LP), Neuquen (NQ), Rio Negro (RN)
+# Cordoba (CB), Santa Fe (SF), Entre Rios (ER), Corrientes (CN), Misiones (MN),
+# Chaco (CC), Formosa (FM), Santiago del Estero (SE)
#
# Shanks & Pottenger also make the following claims, which we haven't verified:
# - Formosa switched to -3:00 on 1991-01-07.
@@ -348,6 +429,18 @@ Zone America/Argentina/Cordoba -4:16:48 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 Arg AR%sT
#
+# Salta (SA), La Pampa (LP), Neuquen (NQ), Rio Negro (RN)
+Zone America/Argentina/Salta -4:21:40 - LMT 1894 Oct 31
+ -4:16:48 - CMT 1920 May
+ -4:00 - ART 1930 Dec
+ -4:00 Arg AR%sT 1969 Oct 5
+ -3:00 Arg AR%sT 1991 Mar 3
+ -4:00 - WART 1991 Oct 20
+ -3:00 Arg AR%sT 1999 Oct 3
+ -4:00 Arg AR%sT 2000 Mar 3
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
+#
# Tucuman (TM)
Zone America/Argentina/Tucuman -4:20:52 - LMT 1894 Oct 31
-4:16:48 - CMT 1920 May
@@ -372,7 +465,8 @@ Zone America/Argentina/La_Rioja -4:27:24 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# San Juan (SJ)
Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31
@@ -385,7 +479,8 @@ Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# Jujuy (JY)
Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31
@@ -399,7 +494,8 @@ Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31
-3:00 1:00 ARST 1992
-3:00 Arg AR%sT 1999 Oct 3
-4:00 Arg AR%sT 2000 Mar 3
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# Catamarca (CT), Chubut (CH)
Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31
@@ -412,7 +508,8 @@ Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# Mendoza (MZ)
Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31
@@ -429,7 +526,8 @@ Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 23
-4:00 - WART 2004 Sep 26
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# San Luis (SL)
Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
@@ -446,7 +544,8 @@ Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 Arg AR%sT 2008 Jan 21
- -3:00 - ART
+ -3:00 - ART 2009 Mar 15
+ -4:00 Arg WAR%sT
#
# Santa Cruz (SC)
Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
@@ -457,7 +556,8 @@ Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
#
# Tierra del Fuego, Antartida e Islas del Atlantico Sur (TF)
Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31
@@ -468,7 +568,8 @@ Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 30
-4:00 - WART 2004 Jun 20
- -3:00 Arg AR%sT
+ -3:00 Arg AR%sT 2008 Oct 18
+ -3:00 - ART
# Aruba
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -575,8 +676,8 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# From Rodrigo Severo (2008-06-24):
# Just correcting the URL:
-# <a href="https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008">
-# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008
+# <a href="https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008">
+# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008
# </a>
#
# As a result of the above Decree I believe the America/Rio_Branco
@@ -619,7 +720,7 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# </a>
# Note that this link does not always work directly, but must be accessed
# by going to
-# <a href="http://www.mme.gov.br/first>"
+# <a href="http://www.mme.gov.br/first">
# http://www.mme.gov.br/first
# </a>
#
@@ -768,12 +869,33 @@ Rule Brazil 2007 only - Feb 25 0:00 0 -
# Decree <a href="http://pcdsh01.on.br/DecHV6212.gif">6,212</a> (2007-09-26),
# adopted by the same states as before.
Rule Brazil 2007 only - Oct Sun>=8 0:00 1:00 S
-Rule Brazil 2008 max - Feb Sun>=15 0:00 0 -
-Rule Brazil 2008 max - Oct Sun>=15 0:00 1:00 S
+# From Frederico A. C. Neves (2008-09-10):
+# Acording to this decree
+# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm">
+# http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm
+# </a>
+# [t]he DST period in Brazil now on will be from the 3rd Oct Sunday to the
+# 3rd Feb Sunday. There is an exception on the return date when this is
+# the Carnival Sunday then the return date will be the next Sunday...
+Rule Brazil 2008 max - Oct Sun>=15 0:00 1:00 S
+Rule Brazil 2008 2011 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2012 only - Feb Sun>=22 0:00 0 -
+Rule Brazil 2013 2014 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2015 only - Feb Sun>=22 0:00 0 -
+Rule Brazil 2016 2022 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2023 only - Feb Sun>=22 0:00 0 -
+Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2026 only - Feb Sun>=22 0:00 0 -
+Rule Brazil 2027 2033 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2034 only - Feb Sun>=22 0:00 0 -
+Rule Brazil 2035 2036 - Feb Sun>=15 0:00 0 -
+Rule Brazil 2037 only - Feb Sun>=22 0:00 0 -
+# From Arthur David Olson (2008-09-29):
+# The next is wrong in some years but is better than nothing.
+Rule Brazil 2038 max - Feb Sun>=15 0:00 0 -
+
# The latest ruleset listed above says that the following states observe DST:
# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP.
-# For dates after mid-2008, the above rules with TO="max" are guesses
-# and are quite possibly wrong, but are more likely than no DST at all.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
diff --git a/libc/timezone/systemv b/libc/timezone/systemv
index 6cf9645de..767388d6a 100644
--- a/libc/timezone/systemv
+++ b/libc/timezone/systemv
@@ -1,4 +1,7 @@
-# @(#)systemv 8.1
+# <pre>
+# @(#)systemv 8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
# Old rules, should the need arise.
# No attempt is made to handle Newfoundland, since it cannot be expressed
diff --git a/libc/timezone/tzselect.ksh b/libc/timezone/tzselect.ksh
index 30c8e5c99..9146d377d 100644
--- a/libc/timezone/tzselect.ksh
+++ b/libc/timezone/tzselect.ksh
@@ -1,6 +1,6 @@
#! @KSH@
-VERSION='@(#)tzselect.ksh 8.1'
+VERSION='@(#)tzselect.ksh 8.2'
PKGVERSION='@PKGVERSION@'
REPORT_BUGS_TO='@REPORT_BUGS_TO@'
diff --git a/libc/timezone/yearistype b/libc/timezone/yearistype
index d3a248032..66dbf89a2 100755
--- a/libc/timezone/yearistype
+++ b/libc/timezone/yearistype
@@ -1,6 +1,9 @@
#! /bin/sh
-: '@(#)yearistype.sh 7.8'
+: 'This file is in the public domain, so clarified as of'
+: '2006-07-17 by Arthur David Olson.'
+
+: '@(#)yearistype.sh 8.2'
case $#-$1 in
2-|2-0*|2-*[!0-9]*)
diff --git a/libc/timezone/zdump.c b/libc/timezone/zdump.c
index 590b548ad..0e9e545ab 100644
--- a/libc/timezone/zdump.c
+++ b/libc/timezone/zdump.c
@@ -1,4 +1,9 @@
-static char elsieid[] = "@(#)zdump.c 8.6";
+/*
+** This file is in the public domain, so clarified as of
+** 2009-05-17 by Arthur David Olson.
+*/
+
+static char elsieid[] = "@(#)zdump.c 8.9";
/*
** This code has been made independent of the rest of the time
@@ -361,13 +366,9 @@ char * argv[];
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
}
for ( ; ; ) {
- if (t >= cuthitime)
+ if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12)
break;
newt = t + SECSPERHOUR * 12;
- if (newt >= cuthitime)
- break;
- if (newt <= t)
- break;
newtmp = localtime(&newt);
if (newtmp != NULL)
newtm = *newtmp;
diff --git a/libc/timezone/zic.c b/libc/timezone/zic.c
index 6f654af19..34dd04858 100644
--- a/libc/timezone/zic.c
+++ b/libc/timezone/zic.c
@@ -3,7 +3,7 @@
** 2006-07-17 by Arthur David Olson.
*/
-static char elsieid[] = "@(#)zic.c 8.17";
+static char elsieid[] = "@(#)zic.c 8.19";
#ifdef CROSS_ZIC
#define REPORT_BUGS_TO ""
@@ -513,7 +513,7 @@ char * argv[];
while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
switch (c) {
default:
- usage(stderr, EXIT_FAILURE);
+ usage(stderr, EXIT_FAILURE);
case 'd':
if (directory == NULL)
directory = optarg;
@@ -2002,7 +2002,7 @@ const int zonecount;
min_year = max_year = EPOCH_YEAR;
if (leapseen) {
updateminmax(leapminyear);
- updateminmax(leapmaxyear);
+ updateminmax(leapmaxyear + (leapmaxyear < INT_MAX));
}
for (i = 0; i < zonecount; ++i) {
zp = &zpfirst[i];
diff --git a/libc/timezone/zone.tab b/libc/timezone/zone.tab
index 39cc55f81..18aff1bb5 100644
--- a/libc/timezone/zone.tab
+++ b/libc/timezone/zone.tab
@@ -1,4 +1,7 @@
-# @(#)zone.tab 8.18
+# <pre>
+# @(#)zone.tab 8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
#
# TZ zone descriptions
#
@@ -42,14 +45,15 @@ AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
-AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, LP, MN, NQ, RN, SA, SE, SF)
-AR -3319-06621 America/Argentina/San_Luis San Luis (SL)
+AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
+AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
AR -2411-06518 America/Argentina/Jujuy Jujuy (JY)
AR -2649-06513 America/Argentina/Tucuman Tucuman (TM)
AR -2828-06547 America/Argentina/Catamarca Catamarca (CT), Chubut (CH)
AR -2926-06651 America/Argentina/La_Rioja La Rioja (LR)
AR -3132-06831 America/Argentina/San_Juan San Juan (SJ)
AR -3253-06849 America/Argentina/Mendoza Mendoza (MZ)
+AR -3319-06621 America/Argentina/San_Luis San Luis (SL)
AR -5138-06913 America/Argentina/Rio_Gallegos Santa Cruz (SC)
AR -5448-06818 America/Argentina/Ushuaia Tierra del Fuego (TF)
AS -1416-17042 Pacific/Pago_Pago
@@ -100,7 +104,7 @@ BR -0640-06952 America/Eirunepe W Amazonas
BR -0958-06748 America/Rio_Branco Acre
BS +2505-07721 America/Nassau
BT +2728+08939 Asia/Thimphu
-BW -2545+02555 Africa/Gaborone
+BW -2439+02555 Africa/Gaborone
BY +5354+02734 Europe/Minsk
BZ +1730-08812 America/Belize
CA +4734-05243 America/St_Johns Newfoundland Time, including SE Labrador
@@ -115,7 +119,7 @@ CA +4901-08816 America/Nipigon Eastern Time - Ontario & Quebec - places that did
CA +4823-08915 America/Thunder_Bay Eastern Time - Thunder Bay, Ontario
CA +6344-06828 America/Iqaluit Eastern Time - east Nunavut - most locations
CA +6608-06544 America/Pangnirtung Eastern Time - Pangnirtung, Nunavut
-CA +744144-0944945 America/Resolute Eastern Time - Resolute, Nunavut
+CA +744144-0944945 America/Resolute Eastern Standard Time - Resolute, Nunavut
CA +484531-0913718 America/Atikokan Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
CA +624900-0920459 America/Rankin_Inlet Central Time - central Nunavut
CA +4953-09709 America/Winnipeg Central Time - Manitoba & west Ontario
@@ -284,16 +288,16 @@ MY +0310+10142 Asia/Kuala_Lumpur peninsular Malaysia
MY +0133+11020 Asia/Kuching Sabah & Sarawak
MZ -2558+03235 Africa/Maputo
NA -2234+01706 Africa/Windhoek
-NC -2216+16530 Pacific/Noumea
+NC -2216+16627 Pacific/Noumea
NE +1331+00207 Africa/Niamey
NF -2903+16758 Pacific/Norfolk
NG +0627+00324 Africa/Lagos
NI +1209-08617 America/Managua
NL +5222+00454 Europe/Amsterdam
NO +5955+01045 Europe/Oslo
-NP +2743+08519 Asia/Katmandu
+NP +2743+08519 Asia/Kathmandu
NR -0031+16655 Pacific/Nauru
-NU -1901+16955 Pacific/Niue
+NU -1901-16955 Pacific/Niue
NZ -3652+17446 Pacific/Auckland most locations
NZ -4357-17633 Pacific/Chatham Chatham Islands
OM +2336+05835 Asia/Muscat
@@ -364,7 +368,7 @@ TK -0922-17114 Pacific/Fakaofo
TL -0833+12535 Asia/Dili
TM +3757+05823 Asia/Ashgabat
TN +3648+01011 Africa/Tunis
-TO -2110+17510 Pacific/Tongatapu
+TO -2110-17510 Pacific/Tongatapu
TR +4101+02858 Europe/Istanbul
TT +1039-06131 America/Port_of_Spain
TV -0831+17913 Pacific/Funafuti
@@ -384,13 +388,13 @@ US +381515-0854534 America/Kentucky/Louisville Eastern Time - Kentucky - Louisvi
US +364947-0845057 America/Kentucky/Monticello Eastern Time - Kentucky - Wayne County
US +394606-0860929 America/Indiana/Indianapolis Eastern Time - Indiana - most locations
US +384038-0873143 America/Indiana/Vincennes Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
-US +411745-0863730 America/Indiana/Knox Eastern Time - Indiana - Starke County
US +410305-0863611 America/Indiana/Winamac Eastern Time - Indiana - Pulaski County
US +382232-0862041 America/Indiana/Marengo Eastern Time - Indiana - Crawford County
+US +382931-0871643 America/Indiana/Petersburg Eastern Time - Indiana - Pike County
US +384452-0850402 America/Indiana/Vevay Eastern Time - Indiana - Switzerland County
US +415100-0873900 America/Chicago Central Time
US +375711-0864541 America/Indiana/Tell_City Central Time - Indiana - Perry County
-US +382931-0871643 America/Indiana/Petersburg Central Time - Indiana - Pike County
+US +411745-0863730 America/Indiana/Knox Central Time - Indiana - Starke County
US +450628-0873651 America/Menominee Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota - Morton County (except Mandan area)
@@ -408,7 +412,7 @@ US +211825-1575130 Pacific/Honolulu Hawaii
UY -3453-05611 America/Montevideo
UZ +3940+06648 Asia/Samarkand west Uzbekistan
UZ +4120+06918 Asia/Tashkent east Uzbekistan
-VA +4154+01227 Europe/Vatican
+VA +415408+0122711 Europe/Vatican
VC +1309-06114 America/St_Vincent
VE +1030-06656 America/Caracas
VG +1827-06437 America/Tortola
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index 675095814..dbc00f6f2 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,19 @@
+2009-06-24 Maxim Kuvyrkov <maxim@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Kazu Hirata <kazu@codesourcery.com>
+
+ * sysdeps/arm/eabi/backtrace.c: New.
+ * sysdeps/arm/eabi/Makefile (CFLAGS-backtrace.c): Add
+ -funwind-tables.
+ * sysdeps/arm/preconfigure: Add -fno-unwind-tables to CFLAGS.
+ * sysdeps/unix/sysv/linux/arm/eabi/configure.in: Remove
+ -fno-unwind-tables from CFLAGS.
+ * sysdeps/unix/sysv/linux/arm/eabi/configure: Regenerate.
+ * sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h (_Unwind_Trace_Fn):
+ Define.
+ (_Unwind_Backtrace): Declare.
+
2009-05-18 Joseph Myers <joseph@codesourcery.com>
* sysdeps/arm/____longjmp_chk.S (CHECK_SP): Use unsigned
diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips
index 9b0b7bddf..fd858bdf7 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,3 +1,8 @@
+2009-06-18 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/bits/socket.h: Define PF_IEEE802154
+ and AF_IEEE802154.
+
2009-05-16 Joseph Myers <joseph@codesourcery.com>
* sysdeps/mips/____longjmp_chk.c: New file.
diff --git a/ports/sysdeps/arm/eabi/Makefile b/ports/sysdeps/arm/eabi/Makefile
index 8409ae630..4b7173bf3 100644
--- a/ports/sysdeps/arm/eabi/Makefile
+++ b/ports/sysdeps/arm/eabi/Makefile
@@ -14,6 +14,10 @@ static-only-routines += $(aeabi_constants)
gen-as-const-headers += rtld-global-offsets.sym
endif
+ifeq ($(subdir),debug)
+CFLAGS-backtrace.c += -funwind-tables
+endif
+
ifeq ($(subdir),elf)
sysdep_routines += aeabi_unwind_cpp_pr1 find_exidx
shared-only-routines += aeabi_unwind_cpp_pr1
diff --git a/ports/sysdeps/arm/eabi/backtrace.c b/ports/sysdeps/arm/eabi/backtrace.c
new file mode 100644
index 000000000..752a435f0
--- /dev/null
+++ b/ports/sysdeps/arm/eabi/backtrace.c
@@ -0,0 +1,126 @@
+/* Return backtrace of current program state.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Kazu Hirata <kazu@codesourcery.com>, 2008.
+
+ 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 <bits/libc-lock.h>
+#include <dlfcn.h>
+#include <execinfo.h>
+#include <stdlib.h>
+#include <unwind.h>
+
+struct trace_arg
+{
+ void **array;
+ int cnt, size;
+};
+
+#ifdef SHARED
+static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
+static _Unwind_VRS_Result (*unwind_vrs_get) (_Unwind_Context *,
+ _Unwind_VRS_RegClass,
+ _uw,
+ _Unwind_VRS_DataRepresentation,
+ void *);
+
+static void *libgcc_handle;
+
+static void
+init (void)
+{
+ libgcc_handle = __libc_dlopen ("libgcc_s.so.1");
+
+ if (libgcc_handle == NULL)
+ return;
+
+ unwind_backtrace = __libc_dlsym (libgcc_handle, "_Unwind_Backtrace");
+ unwind_vrs_get = __libc_dlsym (libgcc_handle, "_Unwind_VRS_Get");
+ if (unwind_vrs_get == NULL)
+ unwind_backtrace = NULL;
+}
+
+/* This function is identical to "_Unwind_GetGR", except that it uses
+ "unwind_vrs_get" instead of "_Unwind_VRS_Get". */
+static inline _Unwind_Word
+unwind_getgr (_Unwind_Context *context, int regno)
+{
+ _uw val;
+ unwind_vrs_get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
+ return val;
+}
+
+/* This macro is identical to the _Unwind_GetIP macro, except that it
+ uses "unwind_getgr" instead of "_Unwind_GetGR". */
+# define unwind_getip(context) \
+ (unwind_getgr (context, 15) & ~(_Unwind_Word)1)
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
+
+static _Unwind_Reason_Code
+backtrace_helper (struct _Unwind_Context *ctx, void *a)
+{
+ struct trace_arg *arg = a;
+
+ /* We are first called with address in the __backtrace function.
+ Skip it. */
+ if (arg->cnt != -1)
+ arg->array[arg->cnt] = (void *) unwind_getip (ctx);
+ if (++arg->cnt == arg->size)
+ return _URC_END_OF_STACK;
+ return _URC_NO_REASON;
+}
+
+int
+__backtrace (array, size)
+ void **array;
+ int size;
+{
+ struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+#ifdef SHARED
+ __libc_once_define (static, once);
+
+ __libc_once (once, init);
+ if (unwind_backtrace == NULL)
+ return 0;
+#endif
+
+ if (size >= 1)
+ unwind_backtrace (backtrace_helper, &arg);
+
+ if (arg.cnt > 1 && arg.array[arg.cnt - 1] == NULL)
+ --arg.cnt;
+ return arg.cnt != -1 ? arg.cnt : 0;
+}
+weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
+
+
+#ifdef SHARED
+/* Free all resources if necessary. */
+libc_freeres_fn (free_mem)
+{
+ unwind_backtrace = NULL;
+ if (libgcc_handle != NULL)
+ {
+ __libc_dlclose (libgcc_handle);
+ libgcc_handle = NULL;
+ }
+}
+#endif
diff --git a/ports/sysdeps/arm/preconfigure b/ports/sysdeps/arm/preconfigure
index 337e84f16..313da7969 100644
--- a/ports/sysdeps/arm/preconfigure
+++ b/ports/sysdeps/arm/preconfigure
@@ -11,3 +11,7 @@ arm*)
esac
;;
esac
+if [ "${CFLAGS+set}" != "set" ]; then
+ CFLAGS="-g -O2"
+fi
+CFLAGS="$CFLAGS -fno-unwind-tables"
diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/configure b/ports/sysdeps/unix/sysv/linux/arm/eabi/configure
index 28fb9ef2d..c7e20cfdc 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/configure
+++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/configure
@@ -3,3 +3,4 @@
arch_minimum_kernel=2.6.16
libc_cv_gcc_unwind_find_fde=no
+CFLAGS=${CFLAGS% -fno-unwind-tables}
diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in b/ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in
index d1fb7f422..cc0e9b5bd 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in
+++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in
@@ -3,3 +3,4 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
arch_minimum_kernel=2.6.16
libc_cv_gcc_unwind_find_fde=no
+CFLAGS=${CFLAGS% -fno-unwind-tables}
diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h
index d625fb288..eeb9cf8b6 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h
@@ -1,5 +1,5 @@
/* Header file for the ARM EABI unwinder
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
Contributed by Paul Brook
This file is free software; you can redistribute it and/or modify it
@@ -267,6 +267,11 @@ extern "C" {
#define _Unwind_SetIP(context, val) \
_Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
+typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)
+ (struct _Unwind_Context *, void *);
+
+extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h b/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h
index 60db51554..58a04099d 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -1,6 +1,6 @@
/* System-specific socket constants and types. Linux/MIPS version.
- Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006, 2007, 2008,
+ 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
@@ -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.