summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-10-25 17:18:12 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-10-25 17:18:12 +0000
commitd9732ccbecc3dd820e2f6496e792f5e839208312 (patch)
treeb8f21a4f63875068370dbc498c5e7919a7a6ca3e
parent12348b1583437f6382553bde4a32c2615216fec6 (diff)
downloadeglibc2-d9732ccbecc3dd820e2f6496e792f5e839208312.tar.gz
Merge changes between r21108 and r21352 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@21353 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog702
-rw-r--r--libc/Makeconfig87
-rw-r--r--libc/NEWS30
-rw-r--r--libc/Rules20
-rw-r--r--libc/catgets/Makefile4
-rw-r--r--libc/config.h.in3
-rwxr-xr-xlibc/configure249
-rw-r--r--libc/configure.in56
-rw-r--r--libc/crypt/Makefile2
-rw-r--r--libc/crypt/badsalttest.c86
-rw-r--r--libc/crypt/crypt-entry.c30
-rw-r--r--libc/crypt/crypt-private.h3
-rw-r--r--libc/crypt/crypt_util.c42
-rw-r--r--libc/crypt/md5c-test.c5
-rw-r--r--libc/debug/Makefile3
-rw-r--r--libc/debug/test-stpcpy_chk-ifunc.c20
-rw-r--r--libc/debug/test-stpcpy_chk.c3
-rw-r--r--libc/debug/test-strcpy_chk-ifunc.c20
-rw-r--r--libc/debug/test-strcpy_chk.c3
-rw-r--r--libc/dlfcn/Makefile6
-rw-r--r--libc/elf/Makefile77
-rw-r--r--libc/elf/dl-load.c14
-rw-r--r--libc/elf/dl-open.c2
-rw-r--r--libc/elf/tst-leaks1-static.c1
-rwxr-xr-xlibc/elf/tst-pathopt.sh9
-rwxr-xr-xlibc/elf/tst-rtld-load-self.sh12
-rw-r--r--libc/grp/Makefile7
-rw-r--r--libc/grp/tst_fgetgrent.sh17
-rw-r--r--libc/iconv/Makefile4
-rw-r--r--libc/iconvdata/Makefile8
-rwxr-xr-xlibc/iconvdata/run-iconv-test.sh37
-rwxr-xr-xlibc/iconvdata/tst-table.sh8
-rwxr-xr-xlibc/iconvdata/tst-tables.sh10
-rw-r--r--libc/include/ifunc-impl-list.h56
-rw-r--r--libc/include/string.h1
-rw-r--r--libc/include/time.h6
-rw-r--r--libc/intl/Makefile16
-rwxr-xr-xlibc/intl/tst-gettext.sh9
-rw-r--r--libc/intl/tst-gettext2.sh7
-rwxr-xr-xlibc/intl/tst-translit.sh7
-rw-r--r--libc/io/Makefile18
-rw-r--r--libc/io/fcntl.h56
-rw-r--r--libc/io/ftwtest-sh37
-rw-r--r--libc/libio/Makefile13
-rw-r--r--libc/libio/fileops.c53
-rw-r--r--libc/libio/freopen64.c5
-rw-r--r--libc/libio/fseeko64.c5
-rw-r--r--libc/libio/ftello64.c5
-rw-r--r--libc/libio/iofgetpos64.c5
-rw-r--r--libc/libio/iofopen64.c5
-rw-r--r--libc/libio/iofsetpos64.c5
-rw-r--r--libc/libio/libio.h1
-rw-r--r--libc/libio/oldiofgetpos64.c8
-rw-r--r--libc/libio/oldiofsetpos64.c8
-rw-r--r--libc/localedata/ChangeLog31
-rw-r--r--libc/localedata/Makefile8
-rw-r--r--libc/localedata/locales/de_AT2
-rw-r--r--libc/localedata/locales/mr_IN17
-rwxr-xr-xlibc/localedata/tst-fmon.sh8
-rw-r--r--libc/localedata/tst-numeric.sh3
-rwxr-xr-xlibc/localedata/tst-rpmatch.sh3
-rw-r--r--libc/malloc/Makefile6
-rwxr-xr-xlibc/malloc/tst-mtrace.sh5
-rw-r--r--libc/manual/memory.texi5
-rw-r--r--libc/math/Makefile3
-rw-r--r--libc/math/libm-test.inc3
-rw-r--r--libc/misc/Makefile6
-rw-r--r--libc/misc/Versions1
-rw-r--r--libc/misc/ifunc-impl-list.c32
-rw-r--r--libc/nptl/ChangeLog89
-rw-r--r--libc/nptl/Makefile64
-rw-r--r--libc/nptl/sysdeps/pthread/pthread.h4
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S21
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S23
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym1
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S21
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S22
-rw-r--r--libc/nptl/tst-cancel-wrappers.sh6
-rw-r--r--libc/nptl/tst-cond25.c278
-rw-r--r--libc/nptl/tst-oddstacklimit.c73
-rwxr-xr-xlibc/nptl/tst-tls6.sh24
-rw-r--r--libc/nscd/Makefile4
-rw-r--r--libc/ports/ChangeLog.alpha5
-rw-r--r--libc/ports/ChangeLog.arm14
-rw-r--r--libc/ports/ChangeLog.hppa13
-rw-r--r--libc/ports/ChangeLog.ia648
-rw-r--r--libc/ports/ChangeLog.m68k6
-rw-r--r--libc/ports/ChangeLog.mips12
-rw-r--r--libc/ports/ChangeLog.powerpc7
-rw-r--r--libc/ports/ChangeLog.tile13
-rw-r--r--libc/ports/sysdeps/hppa/nptl/Makefile8
-rw-r--r--libc/ports/sysdeps/hppa/nptl/shlib-versions1
-rw-r--r--libc/ports/sysdeps/hppa/nptl/tst-oddstacklimit.c26
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h281
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-initfini.c108
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h22
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c8
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h270
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/sched_getcpu.c87
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist5
-rw-r--r--libc/posix/Makefile30
-rwxr-xr-xlibc/posix/globtest.sh26
-rw-r--r--libc/posix/tst-getconf.sh26
-rwxr-xr-xlibc/posix/wordexp-tst.sh8
-rw-r--r--libc/resolv/Makefile8
-rw-r--r--libc/rt/Makefile9
-rw-r--r--libc/rt/Versions14
-rw-r--r--libc/rt/clock-compat.c65
-rw-r--r--libc/rt/clock_getcpuclockid.c4
-rw-r--r--libc/rt/clock_getres.c4
-rw-r--r--libc/rt/clock_gettime.c5
-rw-r--r--libc/rt/clock_nanosleep.c1
-rw-r--r--libc/rt/clock_settime.c4
-rwxr-xr-xlibc/scripts/run-with-env.sh32
-rw-r--r--libc/stdio-common/Makefile4
-rw-r--r--libc/stdlib/Makefile4
-rw-r--r--libc/string/Makefile8
-rw-r--r--libc/string/memmem.c3
-rw-r--r--libc/string/str-two-way.h4
-rw-r--r--libc/string/test-bcopy-ifunc.c20
-rw-r--r--libc/string/test-bcopy.c20
-rw-r--r--libc/string/test-bzero-ifunc.c20
-rw-r--r--libc/string/test-bzero.c19
-rw-r--r--libc/string/test-memccpy-ifunc.c20
-rw-r--r--libc/string/test-memccpy.c3
-rw-r--r--libc/string/test-memchr-ifunc.c20
-rw-r--r--libc/string/test-memchr.c3
-rw-r--r--libc/string/test-memcmp-ifunc.c20
-rw-r--r--libc/string/test-memcmp.c5
-rw-r--r--libc/string/test-memcpy-ifunc.c20
-rw-r--r--libc/string/test-memcpy.c3
-rw-r--r--libc/string/test-memmem-ifunc.c20
-rw-r--r--libc/string/test-memmem.c38
-rw-r--r--libc/string/test-memmove-ifunc.c20
-rw-r--r--libc/string/test-memmove.c40
-rw-r--r--libc/string/test-mempcpy-ifunc.c20
-rw-r--r--libc/string/test-mempcpy.c3
-rw-r--r--libc/string/test-memset-ifunc.c20
-rw-r--r--libc/string/test-memset.c68
-rw-r--r--libc/string/test-rawmemchr-ifunc.c20
-rw-r--r--libc/string/test-rawmemchr.c3
-rw-r--r--libc/string/test-stpcpy-ifunc.c20
-rw-r--r--libc/string/test-stpcpy.c3
-rw-r--r--libc/string/test-stpncpy-ifunc.c20
-rw-r--r--libc/string/test-stpncpy.c3
-rw-r--r--libc/string/test-strcasecmp-ifunc.c20
-rw-r--r--libc/string/test-strcasecmp.c3
-rw-r--r--libc/string/test-strcasestr-ifunc.c20
-rw-r--r--libc/string/test-strcasestr.c3
-rw-r--r--libc/string/test-strcat-ifunc.c20
-rw-r--r--libc/string/test-strcat.c3
-rw-r--r--libc/string/test-strchr-ifunc.c20
-rw-r--r--libc/string/test-strchr.c11
-rw-r--r--libc/string/test-strchrnul-ifunc.c20
-rw-r--r--libc/string/test-strcmp-ifunc.c20
-rw-r--r--libc/string/test-strcmp.c5
-rw-r--r--libc/string/test-strcpy-ifunc.c20
-rw-r--r--libc/string/test-strcpy.c7
-rw-r--r--libc/string/test-strcspn-ifunc.c20
-rw-r--r--libc/string/test-strcspn.c3
-rw-r--r--libc/string/test-string.h57
-rw-r--r--libc/string/test-strlen-ifunc.c20
-rw-r--r--libc/string/test-strlen.c7
-rw-r--r--libc/string/test-strncasecmp-ifunc.c20
-rw-r--r--libc/string/test-strncasecmp.c1
-rw-r--r--libc/string/test-strncat-ifunc.c20
-rw-r--r--libc/string/test-strncat.c3
-rw-r--r--libc/string/test-strncmp-ifunc.c20
-rw-r--r--libc/string/test-strncmp.c3
-rw-r--r--libc/string/test-strncpy-ifunc.c20
-rw-r--r--libc/string/test-strncpy.c3
-rw-r--r--libc/string/test-strnlen-ifunc.c20
-rw-r--r--libc/string/test-strnlen.c3
-rw-r--r--libc/string/test-strpbrk-ifunc.c20
-rw-r--r--libc/string/test-strpbrk.c3
-rw-r--r--libc/string/test-strrchr-ifunc.c20
-rw-r--r--libc/string/test-strrchr.c7
-rw-r--r--libc/string/test-strspn-ifunc.c20
-rw-r--r--libc/string/test-strspn.c3
-rw-r--r--libc/string/test-strstr-ifunc.c20
-rw-r--r--libc/string/test-strstr.c3
-rw-r--r--libc/sysdeps/generic/_G_config.h5
-rw-r--r--libc/sysdeps/generic/fips-private.h36
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bcopy.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/bzero.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/ifunc-impl-list.c326
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcmp.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memcpy_chk.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memmove_chk.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memrchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/memset_chk.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/rawmemchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/stpcpy.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/stpncpy.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcasecmp.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcasecmp_l.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcasestr-c.c2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcat.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcmp.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcpy.S3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strcspn.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strlen.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strncase.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strncase_l.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strncat.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strncmp.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strncpy.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strnlen.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strpbrk.S2
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strrchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strspn.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/strstr-c.c3
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcschr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcscmp.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcscpy.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcslen.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wcsrchr.S1
-rw-r--r--libc/sysdeps/i386/i686/multiarch/wmemcmp.S1
-rw-r--r--libc/sysdeps/posix/clock_getres.c3
-rw-r--r--libc/sysdeps/posix/opendir.c15
-rw-r--r--libc/sysdeps/unix/clock_gettime.c4
-rw-r--r--libc/sysdeps/unix/clock_nanosleep.c3
-rw-r--r--libc/sysdeps/unix/clock_settime.c3
-rw-r--r--libc/sysdeps/unix/sysv/linux/Makefile1
-rw-r--r--libc/sysdeps/unix/sysv/linux/_G_config.h5
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h386
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c1
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_nanosleep.c1
-rw-r--r--libc/sysdeps/unix/sysv/linux/fips-private.h74
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/get_clockfreq.c8
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/Makefile2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c10
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h298
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h281
-rw-r--r--libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h273
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c30
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h290
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist5
-rw-r--r--libc/sysdeps/x86/bits/byteswap.h13
-rw-r--r--libc/sysdeps/x86_64/multiarch/bcopy.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/bzero.S35
-rw-r--r--libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c283
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcmp.S5
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcpy.S6
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcpy_chk.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/memmove.c1
-rw-r--r--libc/sysdeps/x86_64/multiarch/memmove_chk.c3
-rw-r--r--libc/sysdeps/x86_64/multiarch/mempcpy.S5
-rw-r--r--libc/sysdeps/x86_64/multiarch/mempcpy_chk.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/memset.S8
-rw-r--r--libc/sysdeps/x86_64/multiarch/memset_chk.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/rawmemchr.S8
-rw-r--r--libc/sysdeps/x86_64/multiarch/stpcpy.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/stpncpy.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcasecmp_l.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcasestr-c.c3
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcat.S5
-rw-r--r--libc/sysdeps/x86_64/multiarch/strchr.S8
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcmp-sse42.S4
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcmp.S8
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcpy.S5
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcspn.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/strlen.S7
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncase_l.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncat.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncmp.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncpy.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strnlen.S5
-rw-r--r--libc/sysdeps/x86_64/multiarch/strpbrk.S2
-rw-r--r--libc/sysdeps/x86_64/multiarch/strrchr.S9
-rw-r--r--libc/sysdeps/x86_64/multiarch/strspn.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/strstr-c.c1
-rw-r--r--libc/sysdeps/x86_64/multiarch/wcscpy.S3
-rw-r--r--libc/sysdeps/x86_64/multiarch/wmemcmp.S3
-rw-r--r--libc/wcsmbs/Makefile2
-rw-r--r--libc/wcsmbs/test-wcschr-ifunc.c20
-rw-r--r--libc/wcsmbs/test-wcscmp-ifunc.c20
-rw-r--r--libc/wcsmbs/test-wcscpy-ifunc.c20
-rw-r--r--libc/wcsmbs/test-wcslen-ifunc.c20
-rw-r--r--libc/wcsmbs/test-wcsrchr-ifunc.c20
-rw-r--r--libc/wcsmbs/test-wmemcmp-ifunc.c20
307 files changed, 4956 insertions, 2633 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index a3e846e34..a62630fac 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,705 @@
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+ Jim Blandy <jimb@codesourcery.com>
+
+ * Makeconfig (test-wrapper): New variable,
+ (test-wrapper-env): Likewise.
+ [$(cross-compiling) = yes && $(test-wrapper) != ""]
+ (run-built-tests): Define to yes.
+ (run-program-prefix): Use $(test-wrapper).
+ (built-program-cmd): Likewise.
+ * Rules (make-test-out): Use $(test-wrapper-env) and
+ $(host-built-program-cmd).
+ * elf/Makefile ($(objpfx)order.out): Use $(test-wrapper).
+ ($(objpfx)tst-pathopt.out): Pass $(test-wrapper-env) to
+ tst-pathopt.sh.
+ ($(objpfx)tst-rtld-load-self.out): Pass $(test-wrapper) and
+ $(test-wrapper-env) to tst-rtld-load-self.sh.
+ ($(objpfx)order2.out): Use $(test-wrapper).
+ ($(objpfx)tst-initorder.out): Likewise.
+ ($(objpfx)tst-initorder2.out): Likewise.
+ ($(objpfx)tst-unused-dep.out): Use $(test-wrapper-env).
+ * elf/tst-pathopt.sh (run_program_prefix): Remove unused variable.
+ (test_wrapper_env): New variable. Use it to run ld.so.
+ * elf/tst-rtld-load-self.sh (test_wrapper): New variable.
+ Use it to run ld.so.
+ (test_wrapper_env): Likewise.
+ * iconvdata/Makefile ($(objpfx)iconv-test.out): Pass
+ $(test-wrapper) to run-iconv-test.sh.
+ * iconvdata/run-iconv-test.sh (test_wrapper): New variable.
+ (ICONV): Use $test_wrapper.
+ * posix/Makefile ($(objpfx)globtest.out): Pass
+ $(run-via-rtld-prefix), $(test-wrapper) and $(test-wrapper-env) to
+ globtest.sh, not $(run-program-prefix).
+ * posix/globtest.sh (run_via_rtld_prefix): New variable.
+ (test_wrapper): Likewise.
+ (test_wrapper_env): Likewise. Use it to run globtest with HOME
+ set together with run_via_rtld_prefix.
+ (run_program_prefix): Define in terms of test_wrapper and
+ run_via_rtld_prefix.
+
+2012-10-24 Roland McGrath <roland@hack.frob.com>
+
+ * nscd/Makefile ($(objpfx)nscd): Remove librt dependency.
+ * posix/Makefile ($(objpfx)tst-regex, $(objpfx)tst-regex2):
+ Targets removed.
+
+ [BZ #14743]
+ * include/time.h: Remove librt_hidden_proto (clock_gettime).
+ Declare __clock_getres, __clock_gettime, __clock_settime,
+ __clock_nanosleep, and __clock_getcpuclockid.
+ * rt/clock_gettime.c: Define __clock_gettime as an alias.
+ Remove librt_hidden_def (clock_gettime).
+ * sysdeps/unix/clock_gettime.c: Likewise.
+ * rt/clock_getcpuclockid.c: Define __clock_getcpuclockid as an alias.
+ * sysdeps/unix/sysv/linux/clock_getcpuclockid.c: Likewise.
+ * rt/clock_getres.c: Define __clock_getres as an alias.
+ * sysdeps/posix/clock_getres.c: Likewise.
+ * rt/clock_settime.c: Define __clock_settime as an alias.
+ * sysdeps/unix/clock_settime.c: Likewise.
+ * rt/clock_nanosleep.c: Define __clock_nanosleep as an alias.
+ * sysdeps/unix/clock_nanosleep.c: Likewise.
+ * sysdeps/unix/sysv/linux/clock_nanosleep.c: Likewise.
+ * rt/clock-compat.c: New file.
+ * rt/Makefile (librt-routines): Add clock-compat and move
+ $(clock-routines) to ...
+ (routines): ... here, new variable.
+ * sysdeps/unix/sysv/linux/powerpc/Makefile (sysdep_routines):
+ Don't add get_clockfreq here.
+ * rt/Versions (libc: GLIBC_2.17): New version set.
+ Add clock_* symbols here.
+ (libc: GLIBC_PRIVATE): New version set. Add __clock_* symbols here.
+ * sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sh/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist: Likewise.
+ * NEWS: Mention the move.
+
+ * sysdeps/unix/sysv/linux/i386/get_clockfreq.c (__get_clockfreq):
+ Use __open, __read, __close rather than their public counterparts.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
+ (__get_clockfreq_via_cpuinfo): Likewise.
+ (__get_clockfreq_via_proc_openprom): Likewise, and __getdirentries.
+ (__get_clockfreq_via_dev_openprom): Likewise, and __ioctl.
+
+ * config.h.in (HAVE_IFUNC): New #undef.
+ * configure.in: Define it if libc_cv_ld_gnu_indirect_function
+ was successful.
+ * configure: Regenerated.
+
+2012-10-24 Mike Frysinger <vapier@gentoo.org>
+
+ * configure.in: Move READELF check to start of file.
+ (libc_cv_ld_gnu_indirect_function): Change to a link test. Rename from
+ libc_cv_asm_gnu_indirect_function in the process.
+ * configure: Regenerated.
+
+2012-10-24 Mike Frysinger <vapier@gentoo.org>
+
+ * configure.in (libc_cv_gcc_static_libgcc): Drop -q flag to grep and
+ send the output to /dev/null.
+ (libc_cv_cc_with_libunwind): Likewise.
+ (libc_cv_as_noexecstack): Likewise.
+ * configure: Regenerate.
+
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+
+ * io/ftwtest-sh (tmp): Define to ${objpfx}io, not using `pwd`.
+
+ * posix/globtest.sh (TMPDIR): Do not set.
+ (testdir): Define using ${common_objpfx}posix not $TMPDIR.
+ (testout): Likewise.
+
+2012-10-24 Andreas Jaeger <aj@suse.de>
+
+ * io/fcntl.h: Always define mode_t, off_t, pid_t and use these
+ types for creat, creat64, lockf, posix_fadvise, posix_fallocate.
+ [__USE_LARGEFILE64 && !__off64_t_defined]: Define off64_t.
+ [__USE_LARGEFILE64]: Use off64_t in declaration of lock64,
+ posix_fadvise64, posix_fallocate64.
+
+ * sysdeps/unix/sysv/linux/x86/bits/fcntl.h (F_GETLK, F_SETLK)
+ (F_SETLKW) [__x86_64]: Remove, provided by <bits/fcntl-linux.h>.
+ (F_GETLK, F_SETLK, F_SETLKW) [!__USE_FILE_OFFSET64 && !__x86_64__]:
+ Likewise.
+ (F_GETLK, F_SETLK, F_SETLKW) [__USE_FILE_OFFSET64 && ! __x86_64__]:
+ Likewise.
+ (F_GETLK64, F_SETLK64, F_SETLKW64) [!__x86_64__]: Likewise.
+
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (F_GETLK, F_SETLK)
+ (F_SETLKW) [__USE_FILE_OFFSET64]: Remove, provided by
+ <bits/fcntl-linux.h>.
+ (F_GETLK64, F_SETLK64, F_SETLKW64) [__WORDSIZE == 64]: Likewise.
+
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h (F_DUPFD, F_GETFD)
+ (F_SETFD, F_GETFL, F_SETFL): Remove, provided by <bits/fcntl-linux.h>.
+ (F_GETLK, F_SETLK, F_SETLKW) [__WORDSIZE == 64]: Likewise.
+ (F_GETLK, F_SETLK, F_SETLKW, F_GETLK64, F_SETLK64, F_SETLKW64)
+ [__WORDSIZE != 64]: Likewise.
+
+2012-10-23 Joseph Myers <joseph@codesourcery.com>
+
+ * Makeconfig (run-built-tests): New variable.
+ * Rules [$(cross-compiling) = yes]: Change condition to
+ [$(run-built-tests) = no].
+ * catgets/Makefile [$(cross-compiling) != yes]: Change condition
+ to [$(run-built-tests) = yes].
+ * elf/Makefile [$(cross-compiling) = no]: Likewise
+ * grp/Makefile [$(cross-compiling) = no]: Likewise.
+ * iconv/Makefile [$(cross-compiling) != yes]: Likewise.
+ * iconvdata/Makefile [$(cross-compiling) = no]: Likewise.
+ * intl/Makefile [$(cross-compiling) = no]: Likewise.
+ * io/Makefile [$(cross-compiling) = no]: Likewise.
+ * libio/Makefile [$(cross-compiling) = no]: Likewise.
+ * malloc/Makefile [$(cross-compiling) = no]: Likewise.
+ * misc/Makefile [$(cross-compiling) = no]: Likewise.
+ * posix/Makefile [$(cross-compiling) = no]: Likewise.
+ * resolv/Makefile [$(cross-compiling) = no]: Likewise.
+ * stdio-common/Makefile [$(cross-compiling) = no]: Likewise.
+ * stdlib/Makefile [$(cross-compiling) = no]: Likewise.
+ * string/Makefile [$(cross-compiling) = no]: Likewise.
+
+ * posix/Makefile ($(objpfx)globtest.out): Pass
+ $(run-program-prefix) to globtest.sh, not $(elf-objpfx) and
+ $(rtld-installed-name).
+ * posix/globtest.sh (elf_objpfx): Remove variable.
+ (rtld_installed_name): Likewise.
+ (library_path): Likewise.
+ (run_program_prefix): New variable. Use for running globtest
+ binary.
+
+2012-10-23 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makeconfig (host-built-program-cmd): New variable.
+ * elf/Makefile (tst-stackguard1-ARGS): Use
+ $(host-built-program-cmd).
+ * posix/Makefile (tst-exec-ARGS): Use $(host-built-program-cmd).
+ (tst-spawn-ARGS): Likewise.
+ * rt/Makefile (tst-mqueue7-ARGS): Use $(host-built-program-cmd).
+
+2012-10-23 Joseph Myers <joseph@codesourcery.com>
+ Jim Blandy <jimb@codesourcery.com>
+
+ * Makeconfig (run-via-rtld-prefix): New variable.
+ (run-program-prefix): Define in terms of $(run-via-rtld-prefix).
+ (built-program-cmd): Likewise.
+
+2012-10-22 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/bits/fcntl-linux.h (O_RSYNC): Define to
+ __O_RSYNC if it exists, otherwise to O_SYNC.
+
+2012-10-22 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * iconvdata/run-iconv-test.sh: Redirect iconv stdin in loops from
+ /dev/null.
+ * iconvdata/tst-tables.sh: Redirect tst-table.sh stdin in loop
+ from /dev/null
+ * posix/tst-getconf.sh: Redirect getconf stdin in loop from
+ /dev/null.
+
+2012-10-22 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (__O_LARGEFILE):
+ Define always.
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h (__O_LARGEFILE): Likewise.
+
+ * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
+ bits/fcntl-linux.h.
+
+ * sysdeps/unix/sysv/linux/bits/fcntl-linux.h (F_GETLK, F_SETLK)
+ (F_SETLKW) [!F_GETLK]: Define values for [!__USE_FILE_OFFSET64].
+
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h (O_LARGEFILE): Rename
+ to __O_LARGEFILE.
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (O_LARGEFILE): Rename
+ to __O_LARGEFILE.
+
+2012-10-21 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * config.make.in (NM): New variable.
+
+2012-10-21 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
+2012-10-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14683]
+ * elf/Makefile (tests-static): Add tst-leaks1-static.
+ (tests): Also depend on $(objpfx)tst-leaks1-static-mem.
+ ($(objpfx)tst-leaks1-static): New rule.
+ ($(objpfx)tst-leaks1-static-mem): Likewise.
+ (tst-leaks1-static-ENV): New macro.
+ * elf/dl-open.c (dl_open_worker): Check the main application
+ only if SHARED is defined.
+ * elf/tst-leaks1-static.c: New file.
+
+2012-10-20 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: New file, contains
+ generic values for Linux.
+ * sysdeps/unix/sysv/linux/x86/bits/fcntl.h: Remove all definitions
+ and declarations that are provided by <bits/fcntl-linux.h> and
+ include <bits/fcntl-linux.h>.
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+
+2012-10-20 Roland McGrath <roland@hack.frob.com>
+
+ * io/fcntl.h: Move include of <bits/types.h> to the top and
+ include it unconditionally.
+
+2012-10-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ * wcsmbs/Makefile (tests-ifunc): New variable.
+ (tests): Add $(tests-ifunc).
+ * wcsmbs/test-wcschr-ifunc.c: New file.
+ * wcsmbs/test-wcscmp-ifunc.c: Likewise.
+ * wcsmbs/test-wcscpy-ifunc.c: Likewise.
+ * wcsmbs/test-wcslen-ifunc.c: Likewise.
+ * wcsmbs/test-wcsrchr-ifunc.c: Likewise.
+ * wcsmbs/test-wmemcmp-ifunc.c: Likewise.
+
+ * string/Makefile (tests-ifunc): New variable.
+ (tests): Add $(tests-ifunc).
+ * string/test-memccpy.c (TEST_NAME): New macro.
+ * string/test-memchr.c (TEST_NAME): Likewise.
+ * string/test-memcmp.c (TEST_NAME): Likewise.
+ * string/test-memcpy.c (TEST_NAME): Likewise.
+ * string/test-memmem.c (TEST_NAME): Likewise.
+ * string/test-memmove.c (TEST_NAME): Likewise.
+ * string/test-memset.c (TEST_NAME): Likewise.
+ * string/test-rawmemchr.c (TEST_NAME): Likewise.
+ * string/test-stpcpy.c (TEST_NAME): Likewise.
+ * string/test-stpncpy.c (TEST_NAME): Likewise.
+ * string/test-strcasecmp.c (TEST_NAME): Likewise.
+ * string/test-strcasestr.c (TEST_NAME): Likewise.
+ * string/test-strcat.c (TEST_NAME): Likewise.
+ * string/test-strchr.c (TEST_NAME): Likewise.
+ * string/test-strcmp.c(TEST_NAME): Likewise.
+ * string/test-strcpy.c (TEST_NAME): Likewise.
+ * string/test-strcspn.c (TEST_NAME): Likewise.
+ * string/test-strlen.c (TEST_NAME): Likewise.
+ * string/test-strncasecmp.c (TEST_NAME): Likewise.
+ * string/test-strncmp.c (TEST_NAME): Likewise.
+ * string/test-strncpy.c (TEST_NAME): Likewise.
+ * string/test-strnlen.c (TEST_NAME): Likewise.
+ * string/test-strpbrk.c (TEST_NAME): Likewise.
+ * string/test-strrchr.c (TEST_NAME): Likewise.
+ * string/test-strspn.c (TEST_NAME): Likewise.
+ * string/test-strstr.c (TEST_NAME): Likewise.
+ * string/test-bcopy-ifunc.c: New file.
+ * string/test-bzero-ifunc.c: Likewise.
+ * string/test-memccpy-ifunc.c: Likewise.
+ * string/test-memchr-ifunc.c: Likewise.
+ * string/test-memcmp-ifunc.c: Likewise.
+ * string/test-memcpy-ifunc.c: Likewise.
+ * string/test-memmem-ifunc.c: Likewise.
+ * string/test-memmove-ifunc.c: Likewise.
+ * string/test-mempcpy-ifunc.c: Likewise.
+ * string/test-memset-ifunc.c: Likewise.
+ * string/test-rawmemchr-ifunc.c: Likewise.
+ * string/test-stpcpy-ifunc.c: Likewise.
+ * string/test-stpncpy-ifunc.c: Likewise.
+ * string/test-strcasecmp-ifunc.c: Likewise.
+ * string/test-strcasestr-ifunc.c: Likewise.
+ * string/test-strcat-ifunc.c: Likewise.
+ * string/test-strchr-ifunc.c: Likewise.
+ * string/test-strchrnul-ifunc.c: Likewise.
+ * string/test-strcmp-ifunc.c: Likewise.
+ * string/test-strcpy-ifunc.c: Likewise.
+ * string/test-strcspn-ifunc.c: Likewise.
+ * string/test-strlen-ifunc.c: Likewise.
+ * string/test-strncasecmp-ifunc.c: Likewise.
+ * string/test-strncat-ifunc.c: Likewise.
+ * string/test-strncmp-ifunc.c: Likewise.
+ * string/test-strncpy-ifunc.c: Likewise.
+ * string/test-strnlen-ifunc.c: Likewise.
+ * string/test-strpbrk-ifunc.c: Likewise.
+ * string/test-strrchr-ifunc.c: Likewise.
+ * string/test-strspn-ifunc.c: Likewise.
+ * string/test-strstr-ifunc.c: Likewise.
+
+ * debug/Makefile (tests-ifunc): New variable.
+ (tests): Add $(tests-ifunc).
+ * debug/test-stpcpy_chk.c (TEST_NAME): New macro.
+ * debug/test-strcpy_chk.c (TEST_NAME): Likewise.
+ * debug/test-stpcpy_chk-ifunc.c: New file.
+ * debug/test-strcpy_chk-ifunc.c: Likewise.
+
+2012-10-20 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #13601]
+ * elf/dl-load.c (open_verify): Retry read if the entire ELF
+ header is not read in.
+
+2012-10-19 Joseph Myers <joseph@codesourcery.com>
+
+ * io/Makefile ($(objpfx)ftwtest.out): Depend on ftwtest-sh. Pass
+ script to $(SHELL) as $<. Pass $(common-objpfx) to script
+ directly. Pass built executable to script as
+ $(built-program-cmd).
+ * io/ftwtest-sh (ldso): Remove variable. Run ftwtest directly as
+ $testprogram without using LD_LIBRARY_PATH and $ldso.
+
+ * grp/Makefile ($(objpfx)tst_fgetgrent.out): Pass
+ $(run-program-prefix) to tst_fgetgrent.sh, not $(elf-objpfx) and
+ $(rtld-installed-name).
+ * grp/tst_fgetgrent.sh (elf_objpfx): Remove variable.
+ (rtld_installed_name): Likewise.
+ (library_path): Likewise.
+ (run_program_prefix): New variable. Use it to run tst_fgetgrent.
+ * iconvdata/Makefile ($(objpfx)tst-tables.out): Pass
+ $(run-program-prefix) to tst-tables.sh.
+ * iconvdata/tst-table.sh (run_program_prefix): New variable. Use
+ it to run tst-table-from and tst-table-to.
+ * iconvdata/tst-tables.sh (run_program_prefix): New variable.
+ Pass it to tst-table.sh.
+ * intl/Makefile ($(objpfx)tst-gettext.out): Pass
+ $(run-program-prefix) to tst-gettext.sh.
+ ($(objpfx)tst-translit.out): Pass $(run-program-prefix) to
+ tst-translit.sh.
+ ($(objpfx)tst-gettext2.out): Pass $(run-program-prefix) to
+ tst-gettext2.sh.
+ * intl/tst-gettext.sh (run_program_prefix): New variable. Use it
+ to run tst-gettext.
+ * intl/tst-gettext2.sh (run_program_prefix): New variable. Use it
+ to run tst-gettext2.
+ * intl/tst-translit.sh (run_program_prefix): New variable. Use it
+ to run tst-translit.
+ * malloc/Makefile ($(objpfx)tst-mtrace.out): Pass
+ $(run-program-prefix) to tst-mtrace.sh.
+ * malloc/tst-mtrace.sh (run_program_prefix): New variable. Use it
+ to run tst-mtrace.
+ * posix/Makefile ($(objpfx)wordexp-tst.out): Pass
+ $(run-program-prefix) to wordexp-tst.sh, not $(elf-objpfx) and
+ $(rtld-installed-name).
+ * posix/wordexp-tst.sh (elf_objpfx): Remove variable.
+ (rtld_installed_name): Likewise.
+ (run_program_prefix): New variable. Use it to run wordexp-test.
+
+ * Makeconfig (ARCH): Remove all definitions.
+ (machine): Likewise.
+ [ARCH]: Remove conditional code.
+ [!objdir]: Give error.
+ [!objdir] (objpfx): Remove.
+ [!objdir] (common-objpfx): Likewise.
+ [!objdir] (common-objdir): Likewise.
+ * configure.in (config_makefile): Remove. Hardcode Makefile in
+ AC_CONFIG_FILES call.
+ * configure: Regenerated.
+
+ [BZ #13888]
+ * io/ftwtest-sh (tmp): Set to use the working directory, not /tmp
+ or TMPDIR.
+ (testout): Likewise.
+
+ * posix/Makefile ($(objpfx)tst-getconf.out): Pass
+ $(built-program-cmd) to tst-getconf.sh, not $(elf-objpfx) and
+ $(rtld-installed-name).
+ * posix/tst-getconf.sh (elf_objpfx): Remove variable.
+ (rtld_installed_name): Likwise.
+ (runit): Remove function.
+ (run_getconf): New variable, Use it for running getconf binary.
+
+2012-10-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14716]
+ * string/test-memmem.c (check_result): New function.
+ (do_one_test): Use it.
+ (check1): New function.
+ (test_main): Use it.
+
+2012-10-18 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ * math/Makefile: Comment on slow compilation of test-tgmath2.c.
+
+2012-10-18 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/generic/_G_config.h (_G_OPEN64): Remove.
+ (_G_LSEEK64): Likewise.
+ (_G_MMAP64): Likewise.
+ (_G_FSTAT64): Likewise.
+ * sysdeps/unix/sysv/linux/_G_config.h (_G_OPEN64): Remove.
+ (_G_LSEEK64): Likewise.
+ (_G_MMAP64): Likewise.
+ (_G_FSTAT64): Likewise.
+ * libio/fileops.c (mmap_remap_check) [_G_MMAP64]: Make code
+ unconditional. Call __mmap64 directly.
+ (mmap_remap_check) [!_G_MMAP64]: Remove conditional code.
+ (mmap_remap_check) [_G_LSEEK64]: Make code unconditional. Call
+ __lseek64 directly.
+ (mmap_remap_check) [!_G_LSEEK64]: Remove conditional code.
+ (decide_maybe_mmap) [_G_MMAP64]: Make code unconditional. Call
+ __mmap64 directly.
+ (decide_maybe_mmap) [!_G_MMAP64]: Remove conditional code.
+ (decide_maybe_mmap) [_G_LSEEK64]: Make code unconditional. Call
+ __lseek64 directly.
+ (decide_maybe_mmap) [!_G_LSEEK64]: Remove conditional code.
+ (_IO_file_sync_mmap) [_G_LSEEK64]: Make code unconditional. Call
+ __lseek64 directly.
+ (_IO_file_sync_mmap) [!_G_LSEEK64]: Remove conditional code.
+ (_IO_file_seek) [_G_LSEEK64]: Make code unconditional. Call
+ __lseek64 directly.
+ (_IO_file_seek) [!_G_LSEEK64]: Remove conditional code.
+ (_IO_file_stat) [_G_FSTAT64]: Make code unconditional. Call
+ __fxstat64 directly.
+ (_IO_file_stat) [!_G_FSTAT64]: Remove conditional code.
+ * libio/freopen64.c (freopen64) [_G_OPEN64]: Make code
+ unconditional.
+ (freopen64) [!_G_OPEN64]: Remove conditional code.
+ * libio/fseeko64.c (fseeko64) [_G_LSEEK64]: Make code
+ unconditional.
+ (fseeko64) [!_G_LSEEK64]: Remove conditional code.
+ * libio/ftello64.c (ftello64) [_G_LSEEK64]: Make code
+ unconditional.
+ (ftello64) [!_G_LSEEK64]: Remove conditional code.
+ * libio/iofgetpos64.c (_IO_new_fgetpos64) [_G_LSEEK64]: Make code
+ unconditional.
+ (_IO_new_fgetpos64) [!_G_LSEEK64]: Remove conditional code.
+ * libio/iofopen64.c (_IO_fopen64) [_G_OPEN64]: Make code
+ unconditional.
+ (_IO_fopen64) [!_G_OPEN64]: Remove conditional code.
+ * libio/iofsetpos64.c (_IO_new_fsetpos64) [_G_LSEEK64]: Make code
+ unconditional.
+ (_IO_new_fsetpos64) [!_G_LSEEK64]: Remove conditional code.
+ * libio/oldiofgetpos64.c (_IO_old_fgetpos64) [_G_LSEEK64]: Make code
+ unconditional.
+ (_IO_old_fgetpos64) [!_G_LSEEK64]: Remove conditional code.
+ * libio/oldiofsetpos64.c (_IO_old_fsetpos64) [_G_LSEEK64]: Make code
+ unconditional.
+ (_IO_old_fsetpos64) [!_G_LSEEK64]: Remove conditional code.
+
+2012-10-18 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #12140]
+ * manual/memory.texi (Malloc Tunable Parameters): Add note
+ about free list pointers overwriting some perturb bytes.
+ Wording suggested by Roland McGrath.
+
+2012-10-17 Joseph Myers <joseph@codesourcery.com>
+
+ * math/libm-test.inc (gamma_test): Do not call feclearexcept.
+ (lgamma_test): Likewise.
+ (tgamma_test): Likewise.
+
+2012-10-16 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #14700]
+ * sysdeps/posix/opendir.c (MAX_DIR_BUFFER_SIZE): New constant.
+ (__alloc_dir): Limit buffer to MAX_DIR_BUFFER_SIZE.
+
+2012-10-16 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * NEWS: Mention BZ #14716.
+ * string/str-two-way.h (two_way_short_needle): Fix thinko introduced
+ when removing AVAILABLE1_USES_J macro.
+
+2012-10-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86/bits/byteswap.h: Include <bits/types.h>.
+ (__bswap_64): __uint64_t for unsigned 64-bit int.
+
+2012-10-12 Andreas Schwab <schwab@linux-m68k.org>
+
+ * include/string.h (memmem): Declare libc hidden alias.
+ * string/memmem.c (memmem): Define libc hidden alias.
+ * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Use __open,
+ __read, __close instead of open, read, close.
+
+2012-10-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86_64/multiarch/ifunc-impl-list.c: New file.
+ * sysdeps/x86_64/multiarch/memcmp.S (__memcmp_sse2): Make it
+ global and hidden.
+ * sysdeps/x86_64/multiarch/memcpy.S (__memcpy_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/rawmemchr.S (__rawmemchr_sse42):
+ Likewise.
+ (__rawmemchr_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/strcat.S (STRCAT_SSE2): Likewise.
+ * sysdeps/x86_64/multiarch/strchr.S (__strchr_sse42): Likewise.
+ (__strchr_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/strcmp-sse42.S (STRCMP_SSE42): Likewise.
+ * sysdeps/x86_64/multiarch/strcmp.S (STRCMP_SSE2): Likewise.
+ (__strcasecmp_sse2): Likewise.
+ (__strncasecmp_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/strcpy.S (STRCPY_SSE2): Likewise.
+ * sysdeps/x86_64/multiarch/strlen.S (__strlen_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/strnlen.S (__strnlen_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/strrchr.S (__strrchr_sse42): Likewise.
+ (__strrchr_sse2): Likewise.
+ * sysdeps/x86_64/multiarch/memcmp.S: Add comments for
+ ifunc-impl-list.c.
+ * sysdeps/x86_64/multiarch/memcpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
+ * sysdeps/x86_64/multiarch/memmove.c: Likewise.
+ * sysdeps/x86_64/multiarch/memmove_chk.c: Likewise.
+ * sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
+ * sysdeps/x86_64/multiarch/memset.S: Likewise.
+ * sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
+ * sysdeps/x86_64/multiarch/rawmemchr.S: Likewise.
+ * sysdeps/x86_64/multiarch/stpcpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/stpncpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcasecmp_l.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcasestr-c.c: Likewise.
+ * sysdeps/x86_64/multiarch/strcat.S: Likewise.
+ * sysdeps/x86_64/multiarch/strchr.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcmp.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcspn.S: Likewise.
+ * sysdeps/x86_64/multiarch/strlen.S: Likewise.
+ * sysdeps/x86_64/multiarch/strncase_l.S: Likewise.
+ * sysdeps/x86_64/multiarch/strncat.S: Likewise.
+ * sysdeps/x86_64/multiarch/strncmp.S: Likewise.
+ * sysdeps/x86_64/multiarch/strncpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/strnlen.S: Likewise.
+ * sysdeps/x86_64/multiarch/strpbrk.S: Likewise.
+ * sysdeps/x86_64/multiarch/strrchr.S: Likewise.
+ * sysdeps/x86_64/multiarch/strspn.S: Likewise.
+ * sysdeps/x86_64/multiarch/strstr-c.c: Likewise.
+ * sysdeps/x86_64/multiarch/wcscpy.S: Likewise.
+ * sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.
+
+ * sysdeps/i386/i686/multiarch/bcopy.S (__bcopy_ia32): Make it
+ global and hidden.
+ * sysdeps/i386/i686/multiarch/bzero.S (__bzero_ia32): Likewise.
+ * sysdeps/i386/i686/multiarch/memcmp.S (__memcmp_ia32): Likewise.
+ * sysdeps/i386/i686/multiarch/memcpy.S (__memcpy_ia32): Likewise.
+ * sysdeps/i386/i686/multiarch/memmove.S (__memmove_ia32):
+ Likewise.
+ * sysdeps/i386/i686/multiarch/mempcpy.S (__mempcpy_ia32):
+ Likewise.
+ * sysdeps/i386/i686/multiarch/strcat.S (STRCAT_IA32): Likewise.
+ * sysdeps/i386/i686/multiarch/strcmp.S (__STRCMP_IA32): Likewise.
+ * sysdeps/i386/i686/multiarch/strcpy.S (STRCPY_IA32): Likewise.
+ * sysdeps/i386/i686/multiarch/bcopy.S: Add comments for
+ ifunc-impl-list.c.
+ * sysdeps/i386/i686/multiarch/bzero.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memcmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memmove.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
+ * sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memrchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memset.S: Likewise.
+ * sysdeps/i386/i686/multiarch/memset_chk.S: Likewise.
+ * sysdeps/i386/i686/multiarch/rawmemchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/stpcpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/stpncpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcasecmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcasecmp_l.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcasestr-c.c: Likewise.
+ * sysdeps/i386/i686/multiarch/strcat.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strcspn.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strlen.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strncase.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strncase_l.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strncat.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strncmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strncpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strnlen.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strpbrk.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strrchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strspn.S: Likewise.
+ * sysdeps/i386/i686/multiarch/strstr-c.c: Likewise.
+ * sysdeps/i386/i686/multiarch/wcschr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/wcscmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/wcscpy.S: Likewise.
+ * sysdeps/i386/i686/multiarch/wcslen.S: Likewise.
+ * sysdeps/i386/i686/multiarch/wcsrchr.S: Likewise.
+ * sysdeps/i386/i686/multiarch/wmemcmp.S: Likewise.
+ * sysdeps/i386/i686/multiarch/ifunc-impl-list.c: New file.
+
+ * Rules [$(multi-arch) = no] (tests): Filter out $(tests-ifunc).
+ [$(multi-arch) = no] (xtests): Filter out $(xtests-ifunc).
+ * include/ifunc-impl-list.h: New file.
+ * misc/ifunc-impl-list.c: Likewise.
+ * misc/Makefile (routines): Add ifunc-impl-list.
+ * misc/Versions (GLIBC_PRIVATE): Add __libc_ifunc_impl_list.
+ * string/test-string.h: Include <ifunc-impl-list.h>.
+ [TEST_IFUNC && TEST_NAME] (func_list, func_count, impl_count,
+ impl_array): New variables.
+ (FOR_EACH_IMPL): Support func_list if TEST_IFUNC and TEST_NAME
+ are defined.
+ (test_init): Call __libc_ifunc_impl_list to initialize
+ func_list if TEST_IFUNC and TEST_NAME are defined.
+
+ * string/Makefile (strop-tests): Add bcopy and bzero.
+ * string/test-bcopy.c: New file.
+ * string/test-bzero.c: Likewise.
+ * string/test-memmove.c: Support bcopy test if TEST_BCOPY is
+ defined.
+ * string/test-memset.c: Support bzero test if TEST_BZERO is
+ defined.
+ * sysdeps/x86_64/multiarch/bcopy.S (bcopy): Jump to
+ __libc_memmove.
+ * sysdeps/x86_64/multiarch/bzero.S (__bzero): Jump to
+ __libc_memset.
+ * sysdeps/x86_64/multiarch/memset.S (__libc_memset): New alias
+ of memset.
+
+2012-10-10 Joseph Myers <joseph@codesourcery.com>
+
+ * configure.in: Run $CXX, not cc1plus, to locate C++ headers.
+ * configure: Regenerated.
+
+ * Makeconfig (+link-static-before-libc): Don't include
+ $(link-static-libc).
+
+ * libio/libio.h (_IO_pos_t): Remove.
+
+2012-10-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * NEWS: Add note about FIPS mode. Wording suggested by Roland
+ McGrath.
+
+2012-10-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * crypt/crypt-entry.c: Include fips-private.h.
+ (__crypt_r, __crypt): Disable MD5 and DES if FIPS is enabled.
+ * crypt/md5c-test.c (main): Tolerate disabled MD5.
+ * sysdeps/unix/sysv/linux/fips-private.h: New file.
+ * sysdeps/generic/fips-private.h: New file, dummy fallback.
+
+2012-10-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * crypt/crypt-private.h: Include stdbool.h.
+ (_ufc_setup_salt_r): Return bool.
+ * crypt/crypt-entry.c: Include errno.h.
+ (__crypt_r): Return NULL with EINVAL for bad salt.
+ * crypt/crypt_util.c (bad_for_salt): New.
+ (_ufc_setup_salt_r): Check that salt is long enough and within
+ the specified alphabet.
+ * crypt/badsalttest.c: New file.
+ * crypt/Makefile (tests): Add it.
+ ($(objpfx)badsalttest): New.
+
+2012-10-09 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * NEWS: Add entry for BZ #14602.
+
2012-10-09 Joseph Myers <joseph@codesourcery.com>
* math/gen-libm-test.pl (parse_args): Handle comparison macros as
diff --git a/libc/Makeconfig b/libc/Makeconfig
index f380bb653..790e9998a 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -33,31 +33,6 @@ ifdef subdir
.. := ../
endif
-# If config.make exists, the source directory was configured,
-# so don't try to be clever and find another directory to build in.
-ifneq (,$(wildcard $(..)config.make))
-ARCH =
-machine =
-else # Not configured.
-ifndef ARCH
-ifdef machine
-ARCH = $(machine)
-endif # machine
-endif # ARCH
-endif # config.make
-
-# Directory for object files and libc.a. If this is not defined, the
-# object files live in the subdirectories where their sources live, and
-# libc.a lives in the parent directory (this probably doesn't work any
-# more).
-ifdef ARCH
-ifeq ($(filter /%,$(ARCH)),)
-objdir := $(..)$(ARCH)
-else
-objdir = $(ARCH)
-endif
-endif
-
# $(common-objdir) is the place to put objects and
# such that are not specific to a single subdir.
ifdef objdir
@@ -65,15 +40,7 @@ objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
common-objpfx = $(objdir)/
common-objdir = $(objdir)
else
-objpfx :=
-ifdef ..
-common-objpfx = $(..)
-common-objdir = ..
-else
-# This is a kludge. make wizards might grok.
-common-objpfx = sysdeps/../
-common-objdir = .
-endif
+objdir must be defined by the build-directory Makefile.
endif
# Root of the sysdeps tree.
@@ -434,7 +401,7 @@ ifndef +link-static
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-static) $(link-libc-static)
+ $(link-extra-libs-static)
+link-static-after-libc = $(+postctorT) $(+postinit)
+link-static = $(+link-static-before-libc) $(link-libc-static) \
$(+link-static-after-libc)
@@ -597,6 +564,27 @@ endif
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
+# A command that, prepended to the name and arguments of a program,
+# and run on the build system, causes that program with those
+# arguments to be run on the host for which the library is built.
+ifndef test-wrapper
+test-wrapper = $(cross-test-wrapper)
+endif
+# Likewise, but the name of the program is preceded by
+# <variable>=<value> assignments for environment variables.
+ifndef test-wrapper-env
+test-wrapper-env = $(test-wrapper) env
+endif
+
+# Whether to run test programs built for the library's host system.
+ifndef run-built-tests
+ifeq (yes|,$(cross-compiling)|$(test-wrapper))
+run-built-tests = no
+else
+run-built-tests = yes
+endif
+endif
+
# How to run a program we just linked with our library.
# The program binary is assumed to be $(word 2,$^).
built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
@@ -606,8 +594,11 @@ sysdep-library-path = \
$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
$(filter -Wl$(comma)-rpath-link=%,\
$(sysdep-LDFLAGS)))))
-# Never use $(run-via-rtld-prefix) for the statically-linked %-bp test
-# programs, or for tests listed in tests-static or xtests-static.
+# $(run-via-rtld-prefix) is a command that, when prepended to the name
+# of a program built with the newly built library, produces a command
+# that, executed on the host for which the library is built, runs that
+# program. For the statically-linked %-bp test programs, and for
+# tests listed in tests-static or xtests-static, it is empty.
run-via-rtld-prefix = \
$(if $(strip $(filter $(notdir $(built-program-file)), \
$(tests-static) $(xtests-static)) \
@@ -617,14 +608,22 @@ run-via-rtld-prefix = \
else
run-via-rtld-prefix =
endif
-run-program-prefix = $(cross-test-wrapper) $($*-WRAPPER) \
- $(run-via-rtld-prefix)
-built-program-cmd = $(cross-test-wrapper) $($*-WRAPPER) \
+# $(run-via-rtld-prefix) is a command that, when prepended to the name
+# of a program built with the newly built library, produces a command
+# that, executed on the build system on which "make" is run, runs that
+# program.
+run-program-prefix = $(test-wrapper) $(run-via-rtld-prefix)
+# $(built-program-cmd) is a command that, executed on the build system
+# on which "make" is run, runs the newly built program that is the
+# second dependency of the makefile target in which
+# $(built-program-cmd) is used.
+built-program-cmd = $(test-wrapper) \
$(run-via-rtld-prefix) $(built-program-file)
-
-# Same as built-program-cmd, but without the cross-test-wrapper. Used
-# to run programs from the test machine, as in nptl/tst-cancel7.
-local-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
+# $(host-built-program-cmd) is a command that, executed on the host
+# for which the library is built, runs the newly built program that is
+# the second dependency of the makefile target in which
+# $(host-built-program-cmd) is used.
+host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
ifndef LD
LD := ld -X
diff --git a/libc/NEWS b/libc/NEWS
index 1b13ac134..a1cc1287f 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -10,13 +10,14 @@ Version 2.17
* The following bugs are resolved with this release:
1349, 3479, 5044, 5298, 5400, 6530, 6778, 6808, 9685, 9914, 10014, 10038,
- 10631, 11438, 11607, 13412, 13542, 13629, 13679, 13696, 13717, 13741,
- 13939, 13966, 14042, 14090, 14150, 14151, 14154, 14157, 14166, 14173,
- 14195, 14237, 14251, 14252, 14283, 14298, 14303, 14307, 14328, 14331,
- 14336, 14337, 14347, 14349, 14376, 14417, 14459, 14476, 14477, 14505,
- 14510, 14516, 14518, 14519, 14530, 14532, 14538, 14543, 14544, 14545,
- 14557, 14562, 14568, 14576, 14579, 14583, 14587, 14621, 14638, 14645,
- 14648, 14660, 14661.
+ 10631, 11438, 11607, 12140, 13412, 13542, 13601, 13629, 13679, 13696,
+ 13717, 13741, 13939, 13966, 14042, 14090, 14150, 14151, 14154, 14157,
+ 14166, 14173, 14195, 14237, 14251, 14252, 14283, 14298, 14303, 14307,
+ 14328, 14331, 14336, 14337, 14347, 14349, 14376, 14417, 14459, 14476,
+ 14477, 14505, 14510, 14516, 14518, 14519, 14530, 14532, 14538, 14543,
+ 14544, 14545, 14557, 14562, 14568, 14576, 14579, 14583, 14587, 14602,
+ 14621, 14638, 14645, 14648, 14652, 14660, 14661, 14683, 14694, 14716,
+ 14743.
* Support for STT_GNU_IFUNC symbols added for s390 and s390x.
Optimized versions of memcpy, memset, and memcmp added for System z10 and
@@ -48,6 +49,19 @@ Version 2.17
the tty file descriptor in /dev/pts or /dev if /proc is not available. This
allows creation of chroots without the procfs mounted on /proc.
+* The `crypt' function now fails if passed salt bytes that violate the
+ specification for those values. On Linux, the `crypt' function will
+ consult /proc/sys/crypto/fips_enabled to determine if "FIPS mode" is
+ enabled, and fail on encrypted strings using the MD5 or DES algorithm
+ when the mode is enabled.
+
+* The `clock_*' suite of functions (declared in <time.h>) is now available
+ directly in the main C library. Previously it was necessary to link with
+ -lrt to use these functions. This change has the effect that a
+ single-threaded program that uses a function such as `clock_gettime' (and
+ is not linked with -lrt) will no longer implicitly load the pthreads
+ library at runtime and so will not suffer the overheads associated with
+ multi-thread support in other code such as the C++ runtime library.
Version 2.16
@@ -75,7 +89,7 @@ Version 2.16
14043, 14044, 14048, 14049, 14050, 14053, 14055, 14059, 14064, 14075,
14080, 14083, 14103, 14104, 14109, 14112, 14117, 14122, 14123, 14134,
14153, 14183, 14188, 14199, 14210, 14218, 14229, 14241, 14273, 14277,
- 14278,
+ 14278.
* Support for the x32 ABI on x86-64 added. The x32 target is selected by
configuring glibc with:
diff --git a/libc/Rules b/libc/Rules
index c7bdddb78..35e6ce0bf 100644
--- a/libc/Rules
+++ b/libc/Rules
@@ -84,22 +84,27 @@ common-generated += dummy.o dummy.c
# This makes all the auxiliary and test programs.
.PHONY: others tests
+ifeq ($(multi-arch),no)
+tests := $(filter-out $(tests-ifunc), $(tests))
+xtests := $(filter-out $(xtests-ifunc), $(xtests))
+endif
+
ifeq ($(build-programs),yes)
others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
else
others: $(addprefix $(objpfx),$(extra-objs))
endif
-# eglibc: ifeq ($(cross-compiling),yes)
-# eglibc: tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
-# eglibc: xtests: tests
-# eglibc: else
+ifeq ($(run-built-tests),no)
+tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
+xtests: tests
+else
ifeq ($(build-bounded),yes)
tests-bp.out = $(tests:%=$(objpfx)%-bp.out)
xtests-bp.out = $(xtests:%=$(objpfx)%-bp.out)
endif
tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out)
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out)
-# eglibc: endif
+endif
ifeq ($(build-programs),yes)
binaries-all-notests = $(others) $(sysdep-others)
@@ -175,8 +180,9 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
# These are the implicit rules for making test outputs
# from the test programs and whatever input files are present.
-make-test-out = GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
- $($*-ENV) $(built-program-cmd) $($*-ARGS)
+make-test-out = $(test-wrapper-env) \
+ GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+ $($*-ENV) $(host-built-program-cmd) $($*-ARGS)
$(objpfx)%-bp.out: %.input $(objpfx)%-bp
$(make-test-out) > $@ < $(word 1,$^)
$(objpfx)%.out: %.input $(objpfx)%
diff --git a/libc/catgets/Makefile b/libc/catgets/Makefile
index 2f3bcb3a9..8f461ef0e 100644
--- a/libc/catgets/Makefile
+++ b/libc/catgets/Makefile
@@ -52,7 +52,7 @@ generated-dirs = de
tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de
-# eglibc: ifneq ($(cross-compiling),yes)
+ifeq ($(run-built-tests),yes)
ifeq (y,$(OPTION_EGLIBC_CATGETS))
tests: $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
$(objpfx)test-gencat.out
@@ -84,4 +84,4 @@ $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
$(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
$(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@
-# eglibc: endif
+endif
diff --git a/libc/config.h.in b/libc/config.h.in
index 7d824eee6..19776a607 100644
--- a/libc/config.h.in
+++ b/libc/config.h.in
@@ -186,6 +186,9 @@
/* Define if the dynamic linker should consult an ld.so.cache file. */
#undef USE_LDCONFIG
+/* Define if STT_GNU_IFUNC support actually works. */
+#undef HAVE_IFUNC
+
/*
*/
diff --git a/libc/configure b/libc/configure
index 09a82e016..f468b1239 100755
--- a/libc/configure
+++ b/libc/configure
@@ -630,7 +630,6 @@ libc_cv_gcc_static_libgcc
CXX_SYSINCLUDES
SYSINCLUDES
AUTOCONF
-READELF
AWK
SED
MAKEINFO
@@ -668,6 +667,7 @@ oldest_abi
use_default_link
sysheaders
with_fp
+READELF
ac_ct_CXX
CXXFLAGS
CXX
@@ -3405,6 +3405,98 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
+set dummy ${ac_tool_prefix}readelf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_READELF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$READELF"; then
+ ac_cv_prog_READELF="$READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_READELF="${ac_tool_prefix}readelf"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+READELF=$ac_cv_prog_READELF
+if test -n "$READELF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
+$as_echo "$READELF" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_READELF"; then
+ ac_ct_READELF=$READELF
+ # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_READELF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_READELF"; then
+ ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_READELF="readelf"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
+if test -n "$ac_ct_READELF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
+$as_echo "$ac_ct_READELF" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_READELF" = x; then
+ READELF="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ READELF=$ac_ct_READELF
+ fi
+else
+ READELF="$ac_cv_prog_READELF"
+fi
+
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
@@ -4119,25 +4211,36 @@ if test "$base_machine" = "i386"; then
fi
-# For the multi-arch option we need support in the assembler.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler gnu_indirect_function symbol type support" >&5
-$as_echo_n "checking for assembler gnu_indirect_function symbol type support... " >&6; }
-if ${libc_cv_asm_gnu_indirect_function+:} false; then :
+# For the multi-arch option we need support in the assembler & linker.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler and linker STT_GNU_IFUNC support" >&5
+$as_echo_n "checking for assembler and linker STT_GNU_IFUNC support... " >&6; }
+if ${libc_cv_ld_gnu_indirect_function+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.s <<EOF
.type foo,%gnu_indirect_function
+foo:
+.globl _start
+_start:
+.globl __start
+__start:
+.data
+.long foo
EOF
-if ${CC-cc} -c $ASFLAGS conftest.s 1>&5 2>&5;
-then
- libc_cv_asm_gnu_indirect_function=yes
-else
- libc_cv_asm_gnu_indirect_function=no
+libc_cv_ld_gnu_indirect_function=no
+if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -nostartfiles -nostdlib \
+ -o conftest conftest.s 1>&5 2>&5; then
+ # Do a link to see if the backend supports IFUNC relocs.
+ $READELF -r conftest 1>&5
+ LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
+ libc_cv_ld_gnu_indirect_function=yes
+ }
fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_gnu_indirect_function" >&5
-$as_echo "$libc_cv_asm_gnu_indirect_function" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_gnu_indirect_function" >&5
+$as_echo "$libc_cv_ld_gnu_indirect_function" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .text pseudo-op must be used" >&5
$as_echo_n "checking whether .text pseudo-op must be used... " >&6; }
@@ -4167,7 +4270,7 @@ else
$as_echo "yes" >&6; }
fi
-if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
+if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
if test x"$multi_arch" = xyes; then
as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5
else
@@ -5157,98 +5260,6 @@ fi
if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
-set dummy ${ac_tool_prefix}readelf; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_READELF+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$READELF"; then
- ac_cv_prog_READELF="$READELF" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_READELF="${ac_tool_prefix}readelf"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-READELF=$ac_cv_prog_READELF
-if test -n "$READELF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
-$as_echo "$READELF" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_READELF"; then
- ac_ct_READELF=$READELF
- # Extract the first word of "readelf", so it can be a program name with args.
-set dummy readelf; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_READELF+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_READELF"; then
- ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_READELF="readelf"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
-if test -n "$ac_ct_READELF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
-$as_echo "$ac_ct_READELF" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_READELF" = x; then
- READELF="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- READELF=$ac_ct_READELF
- fi
-else
- READELF="$ac_cv_prog_READELF"
-fi
-
-if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
set dummy ${ac_tool_prefix}nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5433,10 +5444,9 @@ if test -n "$sysheaders"; then
-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
if test -n "$CXX"; then
CXX_SYSINCLUDES=
- cxxversion=`$CXX -dumpversion 2>&5` &&
cxxmachine=`$CXX -dumpmachine 2>&5` &&
- cxxplus=`$CXX -print-prog-name=cc1plus`
- cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+ cxxheaders=`$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
+ | sed -n -e '1,/#include/d' -e '/^ \//{p;q;}' | sed 's/ //'`
test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
@@ -5476,7 +5486,7 @@ $as_echo_n "checking whether GCC supports -static-libgcc... " >&6; }
if ${libc_cv_gcc_static_libgcc+:} false; then :
$as_echo_n "(cached) " >&6
else
- if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
+ if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
libc_cv_gcc_static_libgcc=
else
libc_cv_gcc_static_libgcc=-static-libgcc
@@ -6235,7 +6245,7 @@ else
int main (void) { return 0; }
EOF
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
- conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
+ conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
libc_cv_cc_with_libunwind=yes
else
libc_cv_cc_with_libunwind=no
@@ -6466,7 +6476,7 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } \
- && grep -q .note.GNU-stack conftest.s \
+ && grep .note.GNU-stack conftest.s >/dev/null \
&& { ac_try='${CC-cc} $ASFLAGS -Wa,--noexecstack
-c -o conftest.o conftest.s 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
@@ -7541,6 +7551,13 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
fi
+# A sysdeps configure fragment can reset this if IFUNC is not actually
+# usable even though the assembler knows how to generate the symbol type.
+if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
+ $as_echo "#define HAVE_IFUNC 1" >>confdefs.h
+
+fi
+
# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
# configure fragment can override the value to prevent this AC_DEFINE.
@@ -7625,18 +7642,12 @@ $as_echo "$libc_cv_pic_default" >&6; }
-if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
- config_makefile=
-else
- config_makefile=Makefile
-fi
-
VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
-ac_config_files="$ac_config_files config.make ${config_makefile}"
+ac_config_files="$ac_config_files config.make Makefile"
ac_config_commands="$ac_config_commands default"
@@ -8355,7 +8366,7 @@ do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"config.make") CONFIG_FILES="$CONFIG_FILES config.make" ;;
- "${config_makefile}") CONFIG_FILES="$CONFIG_FILES ${config_makefile}" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
diff --git a/libc/configure.in b/libc/configure.in
index f9f908ad6..95f562a0e 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -23,6 +23,7 @@ AC_SUBST(cross_compiling)
AC_PROG_CPP
# We need the C++ compiler only for testing.
AC_PROG_CXX
+AC_CHECK_TOOL(READELF, readelf, false)
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
AC_MSG_ERROR([you must configure in a separate build directory])
@@ -571,17 +572,28 @@ if test "$base_machine" = "i386"; then
AC_DEFINE(USE_REGPARMS)
fi
-# For the multi-arch option we need support in the assembler.
-AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
- libc_cv_asm_gnu_indirect_function, [dnl
+# For the multi-arch option we need support in the assembler & linker.
+AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
+ libc_cv_ld_gnu_indirect_function, [dnl
cat > conftest.s <<EOF
.type foo,%gnu_indirect_function
+foo:
+.globl _start
+_start:
+.globl __start
+__start:
+.data
+.long foo
EOF
-if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
-then
- libc_cv_asm_gnu_indirect_function=yes
-else
- libc_cv_asm_gnu_indirect_function=no
+libc_cv_ld_gnu_indirect_function=no
+if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -nostartfiles -nostdlib \
+ -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+ # Do a link to see if the backend supports IFUNC relocs.
+ $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
+ LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
+ libc_cv_ld_gnu_indirect_function=yes
+ }
fi
rm -f conftest*])
@@ -601,7 +613,7 @@ else
AC_MSG_RESULT(yes)
fi
-if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
+if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
if test x"$multi_arch" = xyes; then
AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
else
@@ -958,7 +970,6 @@ AC_CHECK_PROG_VER(AWK, gawk, --version,
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
[[3-9].*], critic_missing="$critic_missing gawk")
-AC_CHECK_TOOL(READELF, readelf, false)
AC_CHECK_TOOL(NM, nm, false)
AC_CHECK_PROGS(AUTOCONF, autoconf, no)
@@ -1001,10 +1012,9 @@ if test -n "$sysheaders"; then
-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
if test -n "$CXX"; then
CXX_SYSINCLUDES=
- cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
- cxxplus=`$CXX -print-prog-name=cc1plus`
- cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+ cxxheaders=`$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
+ | sed -n -e '1,/#include/d' -e '/^ \//{p;q;}' | sed 's/ //'`
test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
@@ -1040,7 +1050,7 @@ AC_MSG_ERROR([
fi
AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
-if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
+if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
libc_cv_gcc_static_libgcc=
else
libc_cv_gcc_static_libgcc=-static-libgcc
@@ -1410,7 +1420,7 @@ AC_CACHE_CHECK(for libunwind-support in compiler,
int main (void) { return 0; }
EOF
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
- conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
+ conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
libc_cv_cc_with_libunwind=yes
else
libc_cv_cc_with_libunwind=no
@@ -1560,7 +1570,7 @@ void foo (void) { }
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
-S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
- && grep -q .note.GNU-stack conftest.s \
+ && grep .note.GNU-stack conftest.s >/dev/null \
&& AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
-c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
then
@@ -2146,6 +2156,12 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
fi
AC_SUBST(libc_cv_gcc_unwind_find_fde)
+# A sysdeps configure fragment can reset this if IFUNC is not actually
+# usable even though the assembler knows how to generate the symbol type.
+if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
+ AC_DEFINE(HAVE_IFUNC)
+fi
+
# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
# configure fragment can override the value to prevent this AC_DEFINE.
AC_SUBST(use_nscd)
@@ -2219,18 +2235,12 @@ AC_SUBST(DEFINES)
dnl See sysdeps/mach/configure.in for this variable.
AC_SUBST(mach_interface_list)
-if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
- config_makefile=
-else
- config_makefile=Makefile
-fi
-
VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
AC_SUBST(VERSION)
AC_SUBST(RELEASE)
-AC_CONFIG_FILES([config.make ${config_makefile}])
+AC_CONFIG_FILES([config.make Makefile])
AC_CONFIG_COMMANDS([default],[[
case $CONFIG_FILES in *config.make*)
echo "$config_vars" >> config.make;;
diff --git a/libc/crypt/Makefile b/libc/crypt/Makefile
index 1da12e5b4..d42e683e4 100644
--- a/libc/crypt/Makefile
+++ b/libc/crypt/Makefile
@@ -31,7 +31,7 @@ libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt
libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt_util crypt
libcrypt-routines += $(libcrypt-routines-y)
-tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test
+tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test badsalttest
tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
include ../Makeconfig
diff --git a/libc/crypt/badsalttest.c b/libc/crypt/badsalttest.c
new file mode 100644
index 000000000..e0e207bac
--- /dev/null
+++ b/libc/crypt/badsalttest.c
@@ -0,0 +1,86 @@
+/* Test program for bad DES salt detection in crypt.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <crypt.h>
+
+static const char *tests[][2] =
+ {
+ { "no salt", "" },
+ { "single char", "/" },
+ { "first char bad", "!x" },
+ { "second char bad", "Z%" },
+ { "both chars bad", ":@" },
+ { "un$upported algorithm", "$2$" },
+ { "unsupported_algorithm", "_1" },
+ { "end of page", NULL }
+ };
+
+static int
+do_test (void)
+{
+ int result = 0;
+ struct crypt_data cd;
+ size_t n = sizeof (tests) / sizeof (*tests);
+ size_t pagesize = (size_t) sysconf (_SC_PAGESIZE);
+ char *page;
+
+ /* Check that crypt won't look at the second character if the first
+ one is invalid. */
+ page = mmap (NULL, pagesize * 2, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (page == MAP_FAILED)
+ {
+ perror ("mmap");
+ n--;
+ }
+ else
+ {
+ if (mmap (page + pagesize, pagesize, 0,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
+ -1, 0) != page + pagesize)
+ perror ("mmap 2");
+ page[pagesize - 1] = '*';
+ tests[n - 1][1] = &page[pagesize - 1];
+ }
+
+ for (size_t i = 0; i < n; i++)
+ {
+ if (crypt (tests[i][0], tests[i][1]))
+ {
+ result++;
+ printf ("%s: crypt returned non-NULL with salt \"%s\"\n",
+ tests[i][0], tests[i][1]);
+ }
+
+ if (crypt_r (tests[i][0], tests[i][1], &cd))
+ {
+ result++;
+ printf ("%s: crypt_r returned non-NULL with salt \"%s\"\n",
+ tests[i][0], tests[i][1]);
+ }
+ }
+
+ return result;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/crypt/crypt-entry.c b/libc/crypt/crypt-entry.c
index b6c446cd6..74a85068d 100644
--- a/libc/crypt/crypt-entry.c
+++ b/libc/crypt/crypt-entry.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <gnu/option-groups.h>
#include <errno.h>
+#include <fips-private.h>
#ifndef STATIC
#define STATIC static
@@ -95,8 +96,16 @@ __crypt_r (key, salt, data)
#ifdef _LIBC
/* Try to find out whether we have to use MD5 encryption replacement. */
if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0)
- return __md5_crypt_r (key, salt, (char *) data,
- sizeof (struct crypt_data));
+ {
+ /* FIPS rules out MD5 password encryption. */
+ if (fips_enabled_p ())
+ {
+ __set_errno (EPERM);
+ return NULL;
+ }
+ return __md5_crypt_r (key, salt, (char *) data,
+ sizeof (struct crypt_data));
+ }
/* Try to find out whether we have to use SHA256 encryption replacement. */
if (strncmp (sha256_salt_prefix, salt, sizeof (sha256_salt_prefix) - 1) == 0)
@@ -113,7 +122,18 @@ __crypt_r (key, salt, data)
/*
* Hack DES tables according to salt
*/
- _ufc_setup_salt_r (salt, data);
+ if (!_ufc_setup_salt_r (salt, data))
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ /* FIPS rules out DES password encryption. */
+ if (fips_enabled_p ())
+ {
+ __set_errno (EPERM);
+ return NULL;
+ }
/*
* Setup key schedule
@@ -152,7 +172,9 @@ crypt (key, salt)
{
#ifdef _LIBC
/* Try to find out whether we have to use MD5 encryption replacement. */
- if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0)
+ if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0
+ /* Let __crypt_r deal with the error code if FIPS is enabled. */
+ && !fips_enabled_p ())
return __md5_crypt (key, salt);
/* Try to find out whether we have to use SHA256 encryption replacement. */
diff --git a/libc/crypt/crypt-private.h b/libc/crypt/crypt-private.h
index b4bfa8b4a..54418fcb5 100644
--- a/libc/crypt/crypt-private.h
+++ b/libc/crypt/crypt-private.h
@@ -26,6 +26,7 @@
#define CRYPT_PRIVATE_H 1
#include <features.h>
+#include <stdbool.h>
/* crypt.c */
extern void _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data,
@@ -36,7 +37,7 @@ extern void _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data,
extern void __init_des_r (struct crypt_data * __restrict __data);
extern void __init_des (void);
-extern void _ufc_setup_salt_r (const char *s,
+extern bool _ufc_setup_salt_r (const char *s,
struct crypt_data * __restrict __data);
extern void _ufc_mk_keytab_r (const char *key,
struct crypt_data * __restrict __data);
diff --git a/libc/crypt/crypt_util.c b/libc/crypt/crypt_util.c
index a1ff88b0d..e08dd8fa9 100644
--- a/libc/crypt/crypt_util.c
+++ b/libc/crypt/crypt_util.c
@@ -596,23 +596,55 @@ shuffle_sb(k, saltbits)
#endif
/*
+ * Return false iff C is in the specified alphabet for crypt salt.
+ */
+
+static bool
+bad_for_salt (char c)
+{
+ switch (c)
+ {
+ case '0' ... '9':
+ case 'A' ... 'Z':
+ case 'a' ... 'z':
+ case '.': case '/':
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+/*
* Setup the unit for a new salt
* Hopefully we'll not see a new salt in each crypt call.
+ * Return false if an unexpected character was found in s[0] or s[1].
*/
-void
+bool
_ufc_setup_salt_r(s, __data)
const char *s;
struct crypt_data * __restrict __data;
{
ufc_long i, j, saltbits;
+ char s0, s1;
if(__data->initialized == 0)
__init_des_r(__data);
- if(s[0] == __data->current_salt[0] && s[1] == __data->current_salt[1])
- return;
- __data->current_salt[0] = s[0]; __data->current_salt[1] = s[1];
+ s0 = s[0];
+ if(bad_for_salt (s0))
+ return false;
+
+ s1 = s[1];
+ if(bad_for_salt (s1))
+ return false;
+
+ if(s0 == __data->current_salt[0] && s1 == __data->current_salt[1])
+ return true;
+
+ __data->current_salt[0] = s0;
+ __data->current_salt[1] = s1;
/*
* This is the only crypt change to DES:
@@ -646,6 +678,8 @@ _ufc_setup_salt_r(s, __data)
shuffle_sb((LONGG)__data->sb3, __data->current_saltbits ^ saltbits);
__data->current_saltbits = saltbits;
+
+ return true;
}
void
diff --git a/libc/crypt/md5c-test.c b/libc/crypt/md5c-test.c
index f56d0eb4a..c80e40202 100644
--- a/libc/crypt/md5c-test.c
+++ b/libc/crypt/md5c-test.c
@@ -9,7 +9,10 @@ main (int argc, char *argv[])
int result = 0;
cp = crypt ("Hello world!", salt);
- result |= strcmp ("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp);
+
+ /* MD5 is disabled in FIPS mode. */
+ if (cp)
+ result |= strcmp ("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp);
return result;
}
diff --git a/libc/debug/Makefile b/libc/debug/Makefile
index 0f86d9b0b..77767e5fc 100644
--- a/libc/debug/Makefile
+++ b/libc/debug/Makefile
@@ -148,6 +148,9 @@ ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_EGLIBC_CXX_TESTS))
tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
endif
+tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
+tests += $(tests-ifunc)
+
extra-libs = libSegFault libpcprofile
extra-libs-others = $(extra-libs)
diff --git a/libc/debug/test-stpcpy_chk-ifunc.c b/libc/debug/test-stpcpy_chk-ifunc.c
new file mode 100644
index 000000000..1b2bad157
--- /dev/null
+++ b/libc/debug/test-stpcpy_chk-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of stpcpy checking function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-stpcpy_chk.c"
diff --git a/libc/debug/test-stpcpy_chk.c b/libc/debug/test-stpcpy_chk.c
index f7f9a5463..8e2d2d9e0 100644
--- a/libc/debug/test-stpcpy_chk.c
+++ b/libc/debug/test-stpcpy_chk.c
@@ -1,5 +1,5 @@
/* Test and measure stpcpy checking functions.
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -19,6 +19,7 @@
#define STRCPY_RESULT(dst, len) ((dst) + (len))
#define TEST_MAIN
+#define TEST_NAME "stpcpy_chk"
#include "../string/test-string.h"
extern void __attribute__ ((noreturn)) __chk_fail (void);
diff --git a/libc/debug/test-strcpy_chk-ifunc.c b/libc/debug/test-strcpy_chk-ifunc.c
new file mode 100644
index 000000000..73ed226d5
--- /dev/null
+++ b/libc/debug/test-strcpy_chk-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcpy checking function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcpy_chk.c"
diff --git a/libc/debug/test-strcpy_chk.c b/libc/debug/test-strcpy_chk.c
index 253636289..fb9bc78d4 100644
--- a/libc/debug/test-strcpy_chk.c
+++ b/libc/debug/test-strcpy_chk.c
@@ -1,5 +1,5 @@
/* Test and measure __strcpy_chk functions.
- Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -20,6 +20,7 @@
#ifndef STRCPY_RESULT
# define STRCPY_RESULT(dst, len) dst
# define TEST_MAIN
+# define TEST_NAME "strcpy_chk"
# include "../string/test-string.h"
extern void __attribute__ ((noreturn)) __chk_fail (void);
diff --git a/libc/dlfcn/Makefile b/libc/dlfcn/Makefile
index 0da477065..ff42c7d9e 100644
--- a/libc/dlfcn/Makefile
+++ b/libc/dlfcn/Makefile
@@ -54,10 +54,8 @@ ifeq (yes,$(build-shared))
tests += tststatic tststatic2
tests-static += tststatic tststatic2
modules-names += modstatic modstatic2
-tststatic-ENV = EGLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
-tststatic-WRAPPER = $(..)scripts/run-with-env.sh
-tststatic2-ENV = EGLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
-tststatic2-WRAPPER = $(..)scripts/run-with-env.sh
+tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
+tststatic2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
endif
extra-test-objs += $(modules-names:=.os)
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index 5e374d571..9e820fde6 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -122,12 +122,12 @@ tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
ifeq (yes,$(have-initfini-array))
tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
endif
-tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
+tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
+ tst-leaks1-static
ifeq (yes,$(build-shared))
tests-static += tst-tls9-static
tst-tls9-static-ENV = \
- EGLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
-tst-tls9-static-WRAPPER = $(..)scripts/run-with-env.sh
+ LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
endif
ifeq (yes,$(have-initfini-array))
tests-static += tst-array1-static tst-array5-static
@@ -164,9 +164,10 @@ tests += tst-audit6 tst-audit7
endif
endif
endif
-# ifeq ($(cross-compiling),no)
-tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
-# endif
+ifeq ($(run-built-tests),yes)
+tests: $(objpfx)tst-leaks1-mem $(objpfx)tst-leaks1-static-mem \
+ $(objpfx)noload-mem
+endif
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
@@ -442,9 +443,9 @@ test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
generated += $(addsuffix .so,$(strip $(modules-names)))
ifeq (yes,$(build-shared))
-# eglibc: ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
-# eglibc: endif
+endif
endif
$(objpfx)testobj1.so: $(libdl)
@@ -610,8 +611,7 @@ $(objpfx)preloadtest: $(objpfx)testobj6.so
LDFLAGS-preloadtest = -rdynamic
$(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
preloadtest-ENV = \
- EGLIBC_TEST_LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
-preloadtest-WRAPPER = $(..)scripts/run-with-env.sh
+ LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
$(objpfx)loadfail: $(libdl)
LDFLAGS-loadfail = -rdynamic
@@ -649,7 +649,7 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
$(objpfx)order.out: $(objpfx)order
- $(cross-test-wrapper) \
+ $(test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order > $@
@@ -657,8 +657,7 @@ $(objpfx)order.out: $(objpfx)order
$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
-vismain-ENV = EGLIBC_TEST_LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
-vismain-WRAPPER = $(..)scripts/run-with-env.sh
+vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
$(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
LDFLAGS-noload = -rdynamic $(no-as-needed)
@@ -717,11 +716,10 @@ $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
$(objpfx)tst-pathopt: $(libdl)
$(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
$(objpfx)pathoptobj.so
- $(SHELL) $< $(common-objpfx) "$(cross-test-wrapper)" \
- $(..)scripts/run-with-env.sh
+ $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)'
$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
- $(SHELL) $^ "$(cross-test-wrapper)" $(..)scripts/run-with-env.sh > $@
+ $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
@@ -1011,38 +1009,31 @@ $(objpfx)tst-dlmopen3: $(libdl)
$(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
$(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
-tst-audit1-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
-tst-audit1-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
-tst-audit2-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
-tst-audit2-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
$(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
$(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
-tst-audit3-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod3b.so
-tst-audit3-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
$(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
$(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
-tst-audit4-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod4b.so
-tst-audit4-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
$(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
$(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
-tst-audit5-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod5b.so
-tst-audit5-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
$(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
$(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
$(objpfx)tst-auditmod6c.so
-tst-audit6-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
-tst-audit6-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
$(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
$(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
-tst-audit7-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod7b.so
-tst-audit7-WRAPPER = $(..)scripts/run-with-env.sh
+tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
@@ -1050,7 +1041,7 @@ $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
$(objpfx)order2: $(libdl)
$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
$(objpfx)order2mod2.so
- $(cross-test-wrapper) \
+ $(test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order2 > $@
@@ -1062,14 +1053,19 @@ order2mod2.so-no-z-defs = yes
LDFLAGS-order2mod1.so = $(no-as-needed)
LDFLAGS-order2mod2.so = $(no-as-needed)
-tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
$(objpfx)tst-leaks1: $(libdl)
$(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
+$(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
+$(objpfx)tst-leaks1-static-mem: $(objpfx)tst-leaks1-static.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@
+
tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
+tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
$(objpfx)tst-addr1: $(libdl)
@@ -1140,7 +1136,7 @@ $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
- $(cross-test-wrapper) \
+ $(test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1162,7 +1158,7 @@ object-suffixes-left := a b c d
include $(o-iterator)
$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
- $(cross-test-wrapper) \
+ $(test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1187,16 +1183,15 @@ $(objpfx)tst-relsort1mod2.so: $(libm)
$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
$(objpfx)tst-relsort1mod2.so
-# ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-unused-dep.out
-# endif
+endif
$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
- EGLIBC_TEST_LD_TRACE_LOADED_OBJECTS=1 \
- EGLIBC_TEST_LD_DEBUG=unused \
- EGLIBC_TEST_LD_PRELOAD= \
- $(cross-test-wrapper) \
- $(..)scripts/run-with-env.sh \
+ $(test-wrapper-env) \
+ LD_TRACE_LOADED_OBJECTS=1 \
+ LD_DEBUG=unused \
+ LD_PRELOAD= \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c
index 524e7369e..28a233d57 100644
--- a/libc/elf/dl-load.c
+++ b/libc/elf/dl-load.c
@@ -1726,10 +1726,20 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
/* We successfully openened the file. Now verify it is a file
we can use. */
__set_errno (0);
- fbp->len = __libc_read (fd, fbp->buf, sizeof (fbp->buf));
+ fbp->len = 0;
+ assert (sizeof (fbp->buf) > sizeof (ElfW(Ehdr)));
+ /* Read in the header. */
+ do
+ {
+ ssize_t retlen = __libc_read (fd, fbp->buf + fbp->len,
+ sizeof (fbp->buf) - fbp->len);
+ if (retlen <= 0)
+ break;
+ fbp->len += retlen;
+ }
+ while (__builtin_expect (fbp->len < sizeof (ElfW(Ehdr)), 0));
/* This is where the ELF header is loaded. */
- assert (sizeof (fbp->buf) > sizeof (ElfW(Ehdr)));
ehdr = (ElfW(Ehdr) *) fbp->buf;
/* Now run the tests. */
diff --git a/libc/elf/dl-open.c b/libc/elf/dl-open.c
index 703218b0c..74957ec2e 100644
--- a/libc/elf/dl-open.c
+++ b/libc/elf/dl-open.c
@@ -189,9 +189,11 @@ dl_open_worker (void *a)
{
const void *caller_dlopen = args->caller_dlopen;
+#ifdef SHARED
/* We have to find out from which object the caller is calling.
By default we assume this is the main application. */
call_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+#endif
struct link_map *l;
for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
diff --git a/libc/elf/tst-leaks1-static.c b/libc/elf/tst-leaks1-static.c
new file mode 100644
index 000000000..b956d6690
--- /dev/null
+++ b/libc/elf/tst-leaks1-static.c
@@ -0,0 +1 @@
+#include "tst-leaks1.c"
diff --git a/libc/elf/tst-pathopt.sh b/libc/elf/tst-pathopt.sh
index 5e1e00d68..2f8bfc689 100755
--- a/libc/elf/tst-pathopt.sh
+++ b/libc/elf/tst-pathopt.sh
@@ -20,8 +20,7 @@
set -e
common_objpfx=$1
-cross_test_wrapper="$2"
-run_with_env="$3"
+test_wrapper_env=$2
test -e ${common_objpfx}elf/will-be-empty &&
rm -fr ${common_objpfx}elf/will-be-empty
@@ -30,10 +29,10 @@ test -d ${common_objpfx}elf/for-renamed ||
cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so
+${test_wrapper_env} \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=C EGLIBC_TEST_LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \
- ${cross_test_wrapper} ${run_with_env} ${common_objpfx}elf/ld.so \
- ${common_objpfx}elf/tst-pathopt \
+LC_ALL=C LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \
+ ${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \
> ${common_objpfx}elf/tst-pathopt.out
exit $?
diff --git a/libc/elf/tst-rtld-load-self.sh b/libc/elf/tst-rtld-load-self.sh
index 38cabea1c..18723a9ba 100755
--- a/libc/elf/tst-rtld-load-self.sh
+++ b/libc/elf/tst-rtld-load-self.sh
@@ -21,27 +21,27 @@
set -e
rtld=$1
-cross_test_wrapper="$2"
-run_with_env="$3"
+test_wrapper=$2
+test_wrapper_env=$3
result=0
echo '# normal mode'
-${cross_test_wrapper} $rtld $rtld 2>&1 && rc=0 || rc=$?
+${test_wrapper} $rtld $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -le 127 || result=1
echo '# list mode'
-${cross_test_wrapper} $rtld --list $rtld 2>&1 && rc=0 || rc=$?
+${test_wrapper} $rtld --list $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 0 || result=1
echo '# verify mode'
-${cross_test_wrapper} $rtld --verify $rtld 2>&1 && rc=0 || rc=$?
+${test_wrapper} $rtld --verify $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 2 || result=1
echo '# trace mode'
-EGLIBC_LD_TRACE_LOADED_OBJECTS=1 ${cross_test_wrapper} ${run_with_env} \
+${test_wrapper_env} LD_TRACE_LOADED_OBJECTS=1 \
$rtld $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 0 || result=1
diff --git a/libc/grp/Makefile b/libc/grp/Makefile
index a37846bf7..491a5c505 100644
--- a/libc/grp/Makefile
+++ b/libc/grp/Makefile
@@ -55,13 +55,12 @@ CFLAGS-getgrgid.c = -fexceptions
endif
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
# tst_fgetgrent currently only works with shared libraries
ifeq (yes,$(build-shared))
tests: $(objpfx)tst_fgetgrent.out
$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name) "$(cross-test-wrapper)"
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
endif
-# eglibc: endif
+endif
diff --git a/libc/grp/tst_fgetgrent.sh b/libc/grp/tst_fgetgrent.sh
index 5d14ab11c..0f21ee8e3 100644
--- a/libc/grp/tst_fgetgrent.sh
+++ b/libc/grp/tst_fgetgrent.sh
@@ -20,29 +20,22 @@
set -e
common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
-cross_test_wrapper="$1"; shift
+run_program_prefix=$1; shift
testout=${common_objpfx}/grp/tst_fgetgrent.out
-library_path=${common_objpfx}
result=0
-${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1
-${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1
-${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1
-${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1
exit $result
diff --git a/libc/iconv/Makefile b/libc/iconv/Makefile
index 3451ba3f2..16cb405cb 100644
--- a/libc/iconv/Makefile
+++ b/libc/iconv/Makefile
@@ -74,9 +74,9 @@ $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
$(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
$(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
-# eglibc: ifneq ($(cross-compiling),yes)
+ifeq ($(run-built-tests),yes)
xtests: test-iconvconfig
-# eglibc: endif
+endif
.PHONY: test-iconvconfig
test-iconvconfig: /dev/null $(objpfx)iconvconfig
diff --git a/libc/iconvdata/Makefile b/libc/iconvdata/Makefile
index 73048a0fd..8fae846d5 100644
--- a/libc/iconvdata/Makefile
+++ b/libc/iconvdata/Makefile
@@ -271,14 +271,14 @@ endif # build-shared = yes
include ../Rules
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
tests: $(objpfx)iconv-test.out $(objpfx)tst-tables.out
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-loading
endif
endif
-# eglibc: endif
+endif
tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace
$(objpfx)mtrace-tst-loading: $(objpfx)tst-loading.out
@@ -303,13 +303,13 @@ $(objpfx)tst-iconv7.out: $(objpfx)gconv-modules \
$(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(common-objdir)/iconv/iconv_prog TESTS
- $(SHELL) $< $(common-objdir) '$(cross-test-wrapper)' > $@
+ $(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@
$(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(objpfx)tst-table-from $(objpfx)tst-table-to
$(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ \
- '$(cross-test-wrapper)' > $@
+ '$(run-program-prefix)' > $@
do-tests-clean common-mostlyclean: tst-tables-clean
diff --git a/libc/iconvdata/run-iconv-test.sh b/libc/iconvdata/run-iconv-test.sh
index 71e635e35..ec8f024cc 100755
--- a/libc/iconvdata/run-iconv-test.sh
+++ b/libc/iconvdata/run-iconv-test.sh
@@ -21,7 +21,7 @@
set -e
codir=$1
-cross_test_wrapper="$2"
+test_wrapper="$2"
# We use always the same temporary file.
temp1=$codir/iconvdata/iconv-test.xxx
@@ -40,7 +40,7 @@ LIBPATH=$codir:$codir/iconvdata
# How the start the iconv(1) program.
ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
$codir/iconv/iconv_prog'
-ICONV="$cross_test_wrapper $ICONV"
+ICONV="$test_wrapper $ICONV"
# Which echo?
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
@@ -51,13 +51,8 @@ fi
# We read the file named TESTS. All non-empty lines not starting with
# `#' are interpreted as commands.
-# Avoid reading from stdin, since the while loop's body inherits that;
-# if cross_test_wrapper is a program like ssh that reads its input
-# even if the program running on the remote side doesn't, it will
-# steal input from the loop.
failed=0
-exec 5< TESTS
-while read from to subset targets <&5; do
+while read from to subset targets; do
# Ignore empty and comment lines.
if test -z "$subset" || test "$from" = '#'; then continue; fi
@@ -68,7 +63,7 @@ while read from to subset targets <&5; do
for t in $targets; do
if test -f testdata/$from; then
echo $ac_n " test data: $from -> $t $ac_c"
- $PROG -f $from -t $t testdata/$from > $temp1 ||
+ $PROG -f $from -t $t testdata/$from < /dev/null > $temp1 ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
echo $ac_n "OK$ac_c"
@@ -78,7 +73,7 @@ while read from to subset targets <&5; do
echo $ac_n "/OK$ac_c"
fi
echo $ac_n " -> $from $ac_c"
- $PROG -f $t -t $to -o $temp2 $temp1 ||
+ $PROG -f $t -t $to -o $temp2 $temp1 < /dev/null ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
echo $ac_n "OK$ac_c"
@@ -94,7 +89,7 @@ while read from to subset targets <&5; do
# set. Otherwise we convert to all the TARGETS.
if test $subset = Y; then
echo $ac_n " suntzu: $from -> $t -> $to $ac_c"
- $PROG -f $from -t $t testdata/suntzus |
+ $PROG -f $from -t $t testdata/suntzus < /dev/null |
$PROG -f $t -t $to > $temp1 ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
@@ -113,7 +108,7 @@ while read from to subset targets <&5; do
! grep '<U....><U....>' ../localedata/charmaps/$from > /dev/null; then
echo $ac_n "test charmap: $from -> $t $ac_c"
$PROG -f ../localedata/charmaps/$from -t ../localedata/charmaps/$tc \
- testdata/$from > $temp1 ||
+ testdata/$from < /dev/null > $temp1 ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
echo $ac_n "OK$ac_c"
@@ -124,7 +119,7 @@ while read from to subset targets <&5; do
fi
echo $ac_n " -> $from $ac_c"
$PROG -t ../localedata/charmaps/$from -f ../localedata/charmaps/$tc \
- -o $temp2 $temp1 ||
+ -o $temp2 $temp1 < /dev/null ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
echo $ac_n "OK$ac_c"
@@ -139,7 +134,7 @@ while read from to subset targets <&5; do
if test "$subset" = N; then
echo $ac_n " suntzu: ASCII -> $to -> ASCII $ac_c"
- $PROG -f ASCII -t $to testdata/suntzus |
+ $PROG -f ASCII -t $to testdata/suntzus < /dev/null |
$PROG -f $to -t ASCII > $temp1 ||
{ if test $? -gt 128; then exit 1; fi
echo "FAILED"; failed=1; continue; }
@@ -148,18 +143,11 @@ while read from to subset targets <&5; do
{ echo "/FAILED"; failed=1; continue; }
echo "/OK"
fi
-done
-# Close TESTS.
-exec 5<&-
+done < TESTS
# We read the file named TESTS2. All non-empty lines not starting with
# `#' are interpreted as commands.
-# Avoid reading from stdin, since the while loop's body inherits that;
-# if cross_test_wrapper is a program like ssh that reads its input
-# even if the program running on the remote side doesn't, it will
-# steal input from the loop.
-exec 5< TESTS2
-while read utf8 from filename <&5; do
+while read utf8 from filename; do
# Ignore empty and comment lines.
if test -z "$filename" || test "$utf8" = '#'; then continue; fi
@@ -198,8 +186,7 @@ while read utf8 from filename <&5; do
{ echo "/FAILED"; failed=1; continue; }
echo "OK"
-done
-exec 5<&-
+done < TESTS2
exit $failed
# Local Variables:
diff --git a/libc/iconvdata/tst-table.sh b/libc/iconvdata/tst-table.sh
index 4fbb8566e..14ab196d8 100755
--- a/libc/iconvdata/tst-table.sh
+++ b/libc/iconvdata/tst-table.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
#
@@ -23,7 +23,7 @@
common_objpfx=$1
objpfx=$2
-cross_test_wrapper="$3"
+run_program_prefix=$3
charset=$4
charmap=$5
@@ -60,12 +60,12 @@ else
fi
# iconv in one direction.
-${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${objpfx}tst-table-from ${charset} \
> ${objpfx}tst-${charset}.table
# iconv in the other direction.
-${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${objpfx}tst-table-to ${charset} | sort \
> ${objpfx}tst-${charset}.inverse.table
diff --git a/libc/iconvdata/tst-tables.sh b/libc/iconvdata/tst-tables.sh
index 9de6723c2..eaf84dc2f 100755
--- a/libc/iconvdata/tst-tables.sh
+++ b/libc/iconvdata/tst-tables.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2000-2004,2007,2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
#
@@ -23,7 +23,7 @@
common_objpfx=$1
objpfx=$2
-cross_test_wrapper="$3"
+run_program_prefix=$3
status=0
@@ -262,10 +262,8 @@ while read charset charmap; do
if test "$charset" = GB18030; then echo "This might take a while" 1>&2; fi
case ${charset} in \#*) continue;; esac
echo -n "Testing ${charset}" 1>&2
- # Redirect input from /dev/null, so that using ssh (which reads its
- # input before the remote program needs it) won't consume the rest of the
- # charset/charmap table, making the while loop terminate early.
- if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} "${cross_test_wrapper}" ${charset} ${charmap} < /dev/null; then
+ if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} "${run_program_prefix}" \
+ ${charset} ${charmap} < /dev/null; then
echo 1>&2
else
echo "failed: ./tst-table.sh ${common_objpfx} ${objpfx} ${charset} ${charmap}"
diff --git a/libc/include/ifunc-impl-list.h b/libc/include/ifunc-impl-list.h
new file mode 100644
index 000000000..36444d376
--- /dev/null
+++ b/libc/include/ifunc-impl-list.h
@@ -0,0 +1,56 @@
+/* Internal header file for __libc_supported_implementations.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _IFUNC_IMPL_LIST_H
+#define _IFUNC_IMPL_LIST_H 1
+
+#include <stdbool.h>
+#include <stddef.h>
+
+struct libc_ifunc_impl
+{
+ /* The name of function to be tested. */
+ const char *name;
+ /* The address of function to be tested. */
+ void (*fn) (void);
+ /* True if this implementation is usable on this machine. */
+ bool usable;
+};
+
+/* Add an IFUNC implementation, IMPL, for function FUNC, to ARRAY with
+ USABLE at index I and advance I by one. */
+#define IFUNC_IMPL_ADD(array, i, func, usable, impl) \
+ extern __typeof (func) impl attribute_hidden; \
+ (array)[i++] = (struct libc_ifunc_impl) { #impl, (void (*) (void)) impl, (usable) };
+
+/* Return the number of IFUNC implementations, N, for function FUNC if
+ string NAME matches FUNC. */
+#define IFUNC_IMPL(n, name, func, ...) \
+ if (strcmp (name, #func) == 0) \
+ { \
+ __VA_ARGS__; \
+ return n; \
+ }
+
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
+ NAME and return the number of valid entries. */
+extern size_t __libc_ifunc_impl_list (const char *name,
+ struct libc_ifunc_impl *array,
+ size_t max);
+
+#endif /* ifunc-impl-list.h */
diff --git a/libc/include/string.h b/libc/include/string.h
index f1077f66e..d6d859491 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -89,6 +89,7 @@ libc_hidden_proto (__strtok_r)
extern char *__strsep_g (char **__stringp, const char *__delim);
libc_hidden_proto (__strsep_g)
libc_hidden_proto (strnlen)
+libc_hidden_proto (memmem)
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
diff --git a/libc/include/time.h b/libc/include/time.h
index f056542a1..9be15b973 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -19,7 +19,11 @@ libc_hidden_proto (localtime)
libc_hidden_proto (strftime)
libc_hidden_proto (strptime)
-librt_hidden_proto (clock_gettime)
+extern __typeof (clock_getres) __clock_getres;
+extern __typeof (clock_gettime) __clock_gettime;
+extern __typeof (clock_settime) __clock_settime;
+extern __typeof (clock_nanosleep) __clock_nanosleep;
+extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
/* Now define the internal interfaces. */
struct tm;
diff --git a/libc/intl/Makefile b/libc/intl/Makefile
index c408120eb..2d4ae1b98 100644
--- a/libc/intl/Makefile
+++ b/libc/intl/Makefile
@@ -49,7 +49,7 @@ $(objpfx)plural.o: plural.c
include ../Rules
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (yyyes,$(OPTION_EGLIBC_LOCALES)$(OPTION_EGLIBC_LOCALE_CODE)$(build-shared))
ifneq ($(strip $(MSGFMT)),:)
tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \
@@ -75,14 +75,14 @@ $(codeset_mo): tstcodeset.po
$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
- $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
- $(objpfx)tst-gettext.mtrace '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace
$(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
- $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
- '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(common-objpfx)intl/
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
- $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
- '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(common-objpfx)intl/
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
@@ -92,7 +92,7 @@ $(objpfx)tst-codeset.out: $(codeset_mo)
$(objpfx)tst-gettext3.out: $(codeset_mo)
$(objpfx)tst-gettext5.out: $(codeset_mo)
endif
-# eglibc: endif
+endif
$(objpfx)msgs.h: po2test.awk ../po/de.po
$(make-target-directory)
diff --git a/libc/intl/tst-gettext.sh b/libc/intl/tst-gettext.sh
index fd36191d3..a3bb0a61d 100755
--- a/libc/intl/tst-gettext.sh
+++ b/libc/intl/tst-gettext.sh
@@ -20,9 +20,9 @@
set -e
common_objpfx=$1
-objpfx=$2
-malloc_trace=$3
-cross_test_wrapper=$4
+run_program_prefix=$2
+objpfx=$3
+malloc_trace=$4
LC_ALL=C
export LC_ALL
@@ -54,8 +54,7 @@ export LOCPATH
# Now run the test.
MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${cross_test_wrapper} \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
exit $?
diff --git a/libc/intl/tst-gettext2.sh b/libc/intl/tst-gettext2.sh
index b6f439daf..833b97986 100644
--- a/libc/intl/tst-gettext2.sh
+++ b/libc/intl/tst-gettext2.sh
@@ -20,8 +20,8 @@
set -e
common_objpfx=$1
-objpfx=$2
-cross_test_wrapper=$3
+run_program_prefix=$2
+objpfx=$3
LC_ALL=C
export LC_ALL
@@ -67,8 +67,7 @@ LOCPATH=${objpfx}domaindir
export LOCPATH
# Now run the test.
-${cross_test_wrapper} \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
cmp ${objpfx}tst-gettext2.out - <<EOF
String1 - Lang1: 1st string
diff --git a/libc/intl/tst-translit.sh b/libc/intl/tst-translit.sh
index ba88928a6..27cd1bf95 100755
--- a/libc/intl/tst-translit.sh
+++ b/libc/intl/tst-translit.sh
@@ -20,8 +20,8 @@
set -e
common_objpfx=$1
-objpfx=$2
-cross_test_wrapper=$3
+run_program_prefix=$2
+objpfx=$3
LC_ALL=C
export LC_ALL
@@ -37,8 +37,7 @@ export GCONV_PATH
LOCPATH=${common_objpfx}localedata
export LOCPATH
-${cross_test_wrapper} \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
exit $?
diff --git a/libc/io/Makefile b/libc/io/Makefile
index 72377016f..b43ae9f5c 100644
--- a/libc/io/Makefile
+++ b/libc/io/Makefile
@@ -104,23 +104,11 @@ test-stat2-ARGS = Makefile . $(objpfx)test-stat2
tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp
-# eglibc: ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
ifeq (y,$(OPTION_EGLIBC_FTRAVERSE))
tests: $(objpfx)ftwtest.out
endif
-ifeq ($(cross-compiling),yes)
-# EGLIBC's cross-testing support does not require the build and host
-# machines to share a /tmp directory, so when cross-testing, construct
-# the sample directory tree for these tests in the build tree.
-ftwtest-tmpdir = TMPDIR=$(common-objpfx)
+$(objpfx)ftwtest.out: ftwtest-sh $(objpfx)ftwtest
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
endif
-
-$(objpfx)ftwtest.out: $(objpfx)ftwtest
- $(ftwtest-tmpdir) \
- $(SHELL) ftwtest-sh $(shell cd $(common-objpfx). && pwd)/ \
- '$(cross-test-wrapper)' \
- $(shell cd $(..)scripts && pwd)/run-with-env.sh \
- $(shell cd $(<D) && pwd)/$(<F) > $@
-
-# eglibc: endif
diff --git a/libc/io/fcntl.h b/libc/io/fcntl.h
index c7d5e6972..cc978f7c7 100644
--- a/libc/io/fcntl.h
+++ b/libc/io/fcntl.h
@@ -27,36 +27,42 @@
/* This must be early so <bits/fcntl.h> can define types winningly. */
__BEGIN_DECLS
+/* Get __mode_t, __dev_t and __off_t .*/
+#include <bits/types.h>
+
/* Get the definitions of O_*, F_*, FD_*: all the
numbers and flag bits for `open', `fcntl', et al. */
#include <bits/fcntl.h>
-#if defined __USE_XOPEN || defined __USE_XOPEN2K
-/* The Single Unix specification says that some more types are
- available here. */
-# ifndef __mode_t_defined
+/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
+ Earlier POSIX standards permitted any type ending in `_t' to be defined
+ by any POSIX header, so we don't conditionalize the definitions here. */
+#ifndef __mode_t_defined
typedef __mode_t mode_t;
-# define __mode_t_defined
-# endif
+# define __mode_t_defined
+#endif
-# ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
-# else
+# else
typedef __off64_t off_t;
-# endif
-# define __off_t_defined
# endif
+# define __off_t_defined
+#endif
+
+#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+# define __off64_t_defined
+#endif
-# ifndef __pid_t_defined
+#ifndef __pid_t_defined
typedef __pid_t pid_t;
-# define __pid_t_defined
-# endif
-#endif /* X/Open */
+# define __pid_t_defined
+#endif
/* For XPG all symbols from <sys/stat.h> should also be available. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# include <bits/types.h> /* For __mode_t and __dev_t. */
# define __need_timespec
# include <time.h>
# include <bits/stat.h>
@@ -200,17 +206,17 @@ extern int openat64 (int __fd, const char *__file, int __oflag, ...)
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
-extern int creat (const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
#else
# ifdef __REDIRECT
-extern int __REDIRECT (creat, (const char *__file, __mode_t __mode),
+extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
creat64) __nonnull ((1));
# else
# define creat creat64
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
#endif
#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
@@ -229,7 +235,7 @@ extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
# define F_TEST 3 /* Test a region for other processes locks. */
# ifndef __USE_FILE_OFFSET64
-extern int lockf (int __fd, int __cmd, __off_t __len);
+extern int lockf (int __fd, int __cmd, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
@@ -238,7 +244,7 @@ extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int lockf64 (int __fd, int __cmd, __off64_t __len);
+extern int lockf64 (int __fd, int __cmd, off64_t __len);
# endif
#endif
@@ -246,7 +252,7 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len);
/* Advice the system about the expected behaviour of the application with
respect to the file associated with FD. */
# ifndef __USE_FILE_OFFSET64
-extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
+extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
int __advise) __THROW;
# else
# ifdef __REDIRECT_NTH
@@ -258,7 +264,7 @@ extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
+extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
int __advise) __THROW;
# endif
@@ -268,7 +274,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
-extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
+extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
@@ -279,7 +285,7 @@ extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
+extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
# endif
#endif
diff --git a/libc/io/ftwtest-sh b/libc/io/ftwtest-sh
index 311c4019f..3bbf3061e 100644
--- a/libc/io/ftwtest-sh
+++ b/libc/io/ftwtest-sh
@@ -22,12 +22,6 @@ set -e
# The common objpfx, used to find libraries and the dynamic loader.
objpfx=$1
-# The cross-testing wrapper.
-cross_test_wrapper="$2"
-
-# The environment-setting wrapper.
-run_with_env="$3"
-
# We expect one parameter which is the test program. This must understand
# a number options:
# --phys use the FTW_PHYS flag
@@ -36,7 +30,7 @@ run_with_env="$3"
# --depth use the FTW_DEPTH flag
# --early-exit print file@2 item only and return non-zero from the
# callback when it is seen
-testprogram=$4
+testprogram=$2
# We cannot test this as root.
if test `id | sed "s/uid=\([0-9]*\).*/\1/"` = 0; then
@@ -50,12 +44,9 @@ LANG=C
export LANG
# First create our scenario:
-tmp=`echo ${TMPDIR:-/tmp} | sed 's|\(.\)/*$|\1|'`
+tmp=${objpfx}io
tmpdir=$tmp/ftwtest.d
-[ -f ${objpfx}elf/ld.so ] && ldso=${objpfx}elf/ld.so
-ldso="${cross_test_wrapper:+$cross_test_wrapper }$run_with_env $ldso"
-
trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15
if test -d $tmpdir; then
@@ -78,9 +69,9 @@ ln -s $tmpdir/foo/lvl1/lvl2/lvl3/lvl4 $tmpdir/foo/lvl1/link@1
echo > $tmpdir/bar/xo
chmod a-x,a+r $tmpdir/bar
-testout=${TMPDIR:-/tmp}/ftwtest.out
+testout=$tmp/ftwtest.out
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram $tmpdir |
+$testprogram $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -99,7 +90,7 @@ base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, leve
EOF
rm $testout
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --depth $tmpdir |
+$testprogram --depth $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -118,7 +109,7 @@ base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, leve
EOF
rm $testout
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --phys $tmpdir |
+$testprogram --phys $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -142,7 +133,7 @@ rm $testout
# For the next test everything must be readable.
chmod -fR a+x $tmpdir
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir $tmpdir |
+$testprogram --chdir $tmpdir |
sort > $testout
# perhaps $tmp involves some symlinks...
@@ -166,7 +157,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d |
+$testprogram --chdir ftwtest.d |
sort > $testout
cd "$curwd"
@@ -188,7 +179,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. |
+$testprogram --chdir ftwtest.d/. |
sort > $testout
cd "$curwd"
@@ -210,7 +201,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
+$testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
sort > $testout
cd "$curwd"
@@ -219,7 +210,7 @@ base = "ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, cwd = $tmpreal/ft
EOF
rm $testout
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --early-exit $tmpdir |
+$testprogram --early-exit $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -233,7 +224,7 @@ echo > $tmpdir/foo/lvl1b/file@1b
echo > $tmpdir/foo/lvl1b/file2@1b
echo > $tmpdir/foo/lvl1b/file3@1b
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-subtree=lvl1 $tmpdir |
+$testprogram --skip-subtree=lvl1 $tmpdir |
sort > $testout
cat <<EOF | diff -u $testout - || exit 1
@@ -250,7 +241,7 @@ base = "$tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3
EOF
rm $testout
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=lvl1 $tmpdir |
+$testprogram --skip-siblings=lvl1 $tmpdir |
sort > $testout
# The filesystem is not required to put lvl1 before lvl1b.
@@ -274,7 +265,7 @@ base = "$tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3
EOF
rm $testout
-EGLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=file@1b $tmpdir |
+$testprogram --skip-siblings=file@1b $tmpdir |
sort > $testout
# The filesystem is not required to put file2@1b and file3@1b after file@1b.
diff --git a/libc/libio/Makefile b/libc/libio/Makefile
index ae1621fbd..f671b4d9c 100644
--- a/libc/libio/Makefile
+++ b/libc/libio/Makefile
@@ -198,21 +198,24 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
include ../Rules
+ifeq ($(run-built-tests),yes)
ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
tests: $(objpfx)test-freopen.out
-$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
- $(common-objpfx)libio/
endif
-
ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
ifeq (yes,$(build-shared))
# Run tst-fopenloc.check only if shared library is enabled since it
# depends on tst-fopenloc.out.
tests: $(objpfx)tst-fopenloc.check
endif
+endif
+endif
+
+$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(common-objpfx)libio/
+
$(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
> $@
$(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@
-endif
diff --git a/libc/libio/fileops.c b/libc/libio/fileops.c
index 7033dd165..3bc95a336 100644
--- a/libc/libio/fileops.c
+++ b/libc/libio/fileops.c
@@ -679,13 +679,8 @@ mmap_remap_check (_IO_FILE *fp)
#else
(void) __munmap (fp->_IO_buf_base,
fp->_IO_buf_end - fp->_IO_buf_base);
-# ifdef _G_MMAP64
- p = _G_MMAP64 (NULL, st.st_size, PROT_READ, MAP_SHARED,
- fp->_fileno, 0);
-# else
- p = __mmap (NULL, st.st_size, PROT_READ, MAP_SHARED,
- fp->_fileno, 0);
-# endif
+ p = __mmap64 (NULL, st.st_size, PROT_READ, MAP_SHARED,
+ fp->_fileno, 0);
if (p == MAP_FAILED)
goto punt;
#endif
@@ -712,13 +707,8 @@ mmap_remap_check (_IO_FILE *fp)
if (fp->_offset < fp->_IO_buf_end - fp->_IO_buf_base)
{
- if (
-# ifdef _G_LSEEK64
- _G_LSEEK64
-# else
- __lseek
-# endif
- (fp->_fileno, fp->_IO_buf_end - fp->_IO_buf_base, SEEK_SET)
+ if (__lseek64 (fp->_fileno, fp->_IO_buf_end - fp->_IO_buf_base,
+ SEEK_SET)
!= fp->_IO_buf_end - fp->_IO_buf_base)
fp->_flags |= _IO_ERR_SEEN;
else
@@ -783,24 +773,14 @@ decide_maybe_mmap (_IO_FILE *fp)
/* Try to map the file. */
void *p;
-# ifdef _G_MMAP64
- p = _G_MMAP64 (NULL, st.st_size, PROT_READ, MAP_SHARED, fp->_fileno, 0);
-# else
- p = __mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fp->_fileno, 0);
-# endif
+ p = __mmap64 (NULL, st.st_size, PROT_READ, MAP_SHARED, fp->_fileno, 0);
if (p != MAP_FAILED)
{
/* OK, we managed to map the file. Set the buffer up and use a
special jump table with simplified underflow functions which
never tries to read anything from the file. */
- if (
-# ifdef _G_LSEEK64
- _G_LSEEK64
-# else
- __lseek
-# endif
- (fp->_fileno, st.st_size, SEEK_SET) != st.st_size)
+ if (__lseek64 (fp->_fileno, st.st_size, SEEK_SET) != st.st_size)
{
(void) __munmap (p, st.st_size);
fp->_offset = _IO_pos_BAD;
@@ -952,13 +932,8 @@ _IO_file_sync_mmap (_IO_FILE *fp)
if (_IO_in_backup (fp))
delta -= eGptr () - Gbase ();
#endif
- if (
-# ifdef _G_LSEEK64
- _G_LSEEK64
-# else
- __lseek
-# endif
- (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base, SEEK_SET)
+ if (__lseek64 (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base,
+ SEEK_SET)
!= fp->_IO_read_ptr - fp->_IO_buf_base)
{
fp->_flags |= _IO_ERR_SEEN;
@@ -1244,11 +1219,7 @@ _IO_file_seek (fp, offset, dir)
_IO_off64_t offset;
int dir;
{
-#ifdef _G_LSEEK64
- return _G_LSEEK64 (fp->_fileno, offset, dir);
-#else
- return lseek (fp->_fileno, offset, dir);
-#endif
+ return __lseek64 (fp->_fileno, offset, dir);
}
libc_hidden_def (_IO_file_seek)
@@ -1257,11 +1228,7 @@ _IO_file_stat (fp, st)
_IO_FILE *fp;
void *st;
{
-#ifdef _G_FSTAT64
- return _G_FSTAT64 (fp->_fileno, (struct stat64 *) st);
-#else
- return fstat (fp->_fileno, (struct stat *) st);
-#endif
+ return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st);
}
libc_hidden_def (_IO_file_stat)
diff --git a/libc/libio/freopen64.c b/libc/libio/freopen64.c
index 135049ff7..e47f965e8 100644
--- a/libc/libio/freopen64.c
+++ b/libc/libio/freopen64.c
@@ -40,7 +40,6 @@ freopen64 (filename, mode, fp)
const char* mode;
FILE *fp;
{
-#ifdef _G_OPEN64
FILE *result;
CHECK_FILE (fp, NULL);
if (!(fp->_flags & _IO_IS_FILEBUF))
@@ -101,8 +100,4 @@ freopen64 (filename, mode, fp)
free ((char *) gfilename);
_IO_release_lock (fp);
return result;
-#else
- __set_errno (ENOSYS);
- return NULL;
-#endif
}
diff --git a/libc/libio/fseeko64.c b/libc/libio/fseeko64.c
index 9fbe308c5..70dc3703c 100644
--- a/libc/libio/fseeko64.c
+++ b/libc/libio/fseeko64.c
@@ -37,17 +37,12 @@ fseeko64 (fp, offset, whence)
__off64_t offset;
int whence;
{
-#ifdef _G_LSEEK64
int result;
CHECK_FILE (fp, -1);
_IO_acquire_lock (fp);
result = _IO_fseek (fp, offset, whence);
_IO_release_lock (fp);
return result;
-#else
- __set_errno (ENOSYS);
- return -1;
-#endif
}
#endif
diff --git a/libc/libio/ftello64.c b/libc/libio/ftello64.c
index 852ef71eb..9502f2518 100644
--- a/libc/libio/ftello64.c
+++ b/libc/libio/ftello64.c
@@ -35,7 +35,6 @@ off64_t
ftello64 (fp)
_IO_FILE *fp;
{
-#ifdef _G_LSEEK64
_IO_off64_t pos;
CHECK_FILE (fp, -1L);
_IO_acquire_lock (fp);
@@ -55,10 +54,6 @@ ftello64 (fp)
return -1L;
}
return pos;
-#else
- __set_errno (ENOSYS);
- return -1;
-#endif
}
#endif
diff --git a/libc/libio/iofgetpos64.c b/libc/libio/iofgetpos64.c
index 9755c3273..0d0a2aa26 100644
--- a/libc/libio/iofgetpos64.c
+++ b/libc/libio/iofgetpos64.c
@@ -35,7 +35,6 @@ _IO_new_fgetpos64 (fp, posp)
_IO_FILE *fp;
_IO_fpos64_t *posp;
{
-#ifdef _G_LSEEK64
_IO_off64_t pos;
int result = 0;
CHECK_FILE (fp, EOF);
@@ -66,10 +65,6 @@ _IO_new_fgetpos64 (fp, posp)
}
_IO_release_lock (fp);
return result;
-#else
- __set_errno (ENOSYS);
- return EOF;
-#endif
}
strong_alias (_IO_new_fgetpos64, __new_fgetpos64)
diff --git a/libc/libio/iofopen64.c b/libc/libio/iofopen64.c
index 25c79c9b3..159d04ee6 100644
--- a/libc/libio/iofopen64.c
+++ b/libc/libio/iofopen64.c
@@ -36,12 +36,7 @@ _IO_fopen64 (filename, mode)
const char *filename;
const char *mode;
{
-#ifdef _G_OPEN64
return __fopen_internal (filename, mode, 0);
-#else
- __set_errno (ENOSYS);
- return NULL;
-#endif
}
#ifdef weak_alias
diff --git a/libc/libio/iofsetpos64.c b/libc/libio/iofsetpos64.c
index 20edd8dd6..f751255a6 100644
--- a/libc/libio/iofsetpos64.c
+++ b/libc/libio/iofsetpos64.c
@@ -35,7 +35,6 @@ _IO_new_fsetpos64 (fp, posp)
_IO_FILE *fp;
const _IO_fpos64_t *posp;
{
-#ifdef _G_LSEEK64
int result;
CHECK_FILE (fp, EOF);
_IO_acquire_lock (fp);
@@ -60,10 +59,6 @@ _IO_new_fsetpos64 (fp, posp)
}
_IO_release_lock (fp);
return result;
-#else
- __set_errno (ENOSYS);
- return EOF;
-#endif
}
strong_alias (_IO_new_fsetpos64, __new_fsetpos64)
diff --git a/libc/libio/libio.h b/libc/libio/libio.h
index 45f4707e6..94e4a0bf7 100644
--- a/libc/libio/libio.h
+++ b/libc/libio/libio.h
@@ -31,7 +31,6 @@
#include <_G_config.h>
/* ALL of these should be defined in _G_config.h */
-#define _IO_pos_t _G_fpos_t /* obsolete */
#define _IO_fpos_t _G_fpos_t
#define _IO_fpos64_t _G_fpos64_t
#define _IO_size_t size_t
diff --git a/libc/libio/oldiofgetpos64.c b/libc/libio/oldiofgetpos64.c
index c5a35e791..bef8bc45e 100644
--- a/libc/libio/oldiofgetpos64.c
+++ b/libc/libio/oldiofgetpos64.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004
- Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +36,6 @@ _IO_old_fgetpos64 (fp, posp)
_IO_FILE *fp;
_IO_fpos64_t *posp;
{
-#ifdef _G_LSEEK64
_IO_off64_t pos;
CHECK_FILE (fp, EOF);
_IO_acquire_lock (fp);
@@ -57,10 +55,6 @@ _IO_old_fgetpos64 (fp, posp)
}
posp->__pos = pos;
return 0;
-#else
- __set_errno (ENOSYS);
- return EOF;
-#endif
}
#ifdef weak_alias
diff --git a/libc/libio/oldiofsetpos64.c b/libc/libio/oldiofsetpos64.c
index 039318aed..23cb693d3 100644
--- a/libc/libio/oldiofsetpos64.c
+++ b/libc/libio/oldiofsetpos64.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004
- Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +36,6 @@ _IO_old_fsetpos64 (fp, posp)
_IO_FILE *fp;
const _IO_fpos64_t *posp;
{
-#ifdef _G_LSEEK64
int result;
CHECK_FILE (fp, EOF);
_IO_acquire_lock (fp);
@@ -56,10 +54,6 @@ _IO_old_fsetpos64 (fp, posp)
result = 0;
_IO_release_lock (fp);
return result;
-#else
- __set_errno (ENOSYS);
- return EOF;
-#endif
}
#ifdef weak_alias
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index cd790c6e8..3e775ed44 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,34 @@
+2012-10-23 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile [$(cross-compiling) = no]: Change condition to
+ [$(run-built-tests) = yes].
+
+2012-10-22 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * tst-fmon.sh: Redirect test program stdin in loop from /dev/null.
+ * tst-numeric.sh: Likewise.
+ * tst-rpmatch.sh: Likewise.
+
+2012-10-19 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * tst-wctype.sh (run_program_prefix): Remove variable.
+ (tst_wctype): New variable. Use it directly to run test program
+ instead of passing test program name as argument.
+
+2012-10-19 Florian Pritz <bluewind@xinu.at>
+
+ [BZ #13758]
+ * locales/de_AT (LC_TIME): Change month name from "FebruAr" to
+ "Februar".
+
+2012-10-19 Pravin Satpute <psatpute@redhat.com>
+
+ [BZ #14694]
+ * locales/mr_IN: Fix Wednesday in DAY and August, September and
+ October in ABMON and MON.
+
2012-09-24 Dmitry V. Levin <ldv@altlinux.org>
* gen-locale.sh: Add "set -e".
diff --git a/libc/localedata/Makefile b/libc/localedata/Makefile
index 96079ce6a..699ff866f 100644
--- a/libc/localedata/Makefile
+++ b/libc/localedata/Makefile
@@ -69,7 +69,7 @@ generated-dirs := $(ld-test-names) tt_TT de_DE.437 \
# Get $(inst_i18ndir) defined.
include ../Makeconfig
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
tst_iswctype tst_iswdigit tst_iswgraph \
tst_iswlower tst_iswprint tst_iswpunct \
@@ -97,7 +97,7 @@ ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
endif
endif
-# eglibc: endif
+endif
# Files to install.
install-others := $(addprefix $(inst_i18ndir)/, \
@@ -127,7 +127,7 @@ CFLAGS-tst-mbswcs5.c = -Wno-format
CFLAGS-tst-trans.c = -Wno-format
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
# We have to generate locales
LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
en_US.ISO-8859-1 en_US.UTF-8 ja_JP.EUC-JP da_DK.ISO-8859-1 \
@@ -209,7 +209,7 @@ $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
$(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
-# eglibc: endif
+endif
include SUPPORTED
diff --git a/libc/localedata/locales/de_AT b/libc/localedata/locales/de_AT
index e566eedf3..c36913bd9 100644
--- a/libc/localedata/locales/de_AT
+++ b/libc/localedata/locales/de_AT
@@ -100,7 +100,7 @@ abmon "<U004A><U00E4><U006E>";"<U0046><U0065><U0062>";/
"<U0053><U0065><U0070>";"<U004F><U006B><U0074>";/
"<U004E><U006F><U0076>";"<U0044><U0065><U007A>"
mon "<U004A><U00E4><U006E><U006E><U0065><U0072>";/
- "<U0046><U0065><U0062><U0072><U0075><U0041><U0072>";/
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072>";/
"<U004D><U00E4><U0072><U007A>";/
"<U0041><U0070><U0072><U0069><U006C>";/
"<U004D><U0061><U0069>";/
diff --git a/libc/localedata/locales/mr_IN b/libc/localedata/locales/mr_IN
index 54fe3118f..dc93845a1 100644
--- a/libc/localedata/locales/mr_IN
+++ b/libc/localedata/locales/mr_IN
@@ -1,8 +1,7 @@
comment_char %
escape_char /
% Marathi language locale for India.
-% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
-% Tetsuji Orita <orita@jp.ibm.com>.
+% Contributed by Kentaroh Noji and Tetsuji Orita <orita@jp.ibm.com>.
LC_IDENTIFICATION
title "Marathi language locale for India"
@@ -109,7 +108,7 @@ abday "<U0930><U0935><U093F>";"<U0938><U094B><U092E>";/
day "<U0930><U0935><U093F><U0935><U093E><U0930>";/
"<U0938><U094B><U092E><U0935><U093E><U0930>";/
"<U092E><U0902><U0917><U0933><U0935><U093E><U0930>";/
- "<U092E><U0902><U0917><U0933><U0935><U093E><U0930>";/
+ "<U092C><U0941><U0927><U0935><U093E><U0930>";/
"<U0917><U0941><U0930><U0941><U0935><U093E><U0930>";/
"<U0936><U0941><U0915><U094D><U0930><U0935><U093E><U0930>";/
"<U0936><U0928><U093F><U0935><U093E><U0930>"
@@ -122,9 +121,9 @@ abmon "<U091C><U093E><U0928><U0947><U0935><U093E><U0930><U0940>";/
"<U092E><U0947>";/
"<U091C><U0942><U0928>";/
"<U091C><U0941><U0932><U0948>";/
- "<U0913><U0917><U0938><U094D><U091F>";/
- "<U0938><U0947><U092A><U094D><U091F><U0947><U0902><U092C><U0930>";/
- "<U0913><U0915><U094D><U091F><U094B><U092C><U0930>";/
+ "<U0911><U0917><U0938><U094D><U091F>";/
+ "<U0938><U092A><U094D><U091F><U0947><U0902><U092C><U0930>";/
+ "<U0911><U0915><U094D><U091F><U094B><U092C><U0930>";/
"<U0928><U094B><U0935><U094D><U0939><U0947><U0902><U092C><U0930>";/
"<U0921><U093F><U0938><U0947><U0902><U092C><U0930>"
%
@@ -136,9 +135,9 @@ mon "<U091C><U093E><U0928><U0947><U0935><U093E><U0930><U0940>";/
"<U092E><U0947>";/
"<U091C><U0942><U0928>";/
"<U091C><U0941><U0932><U0948>";/
- "<U0913><U0917><U0938><U094D><U091F>";/
- "<U0938><U0947><U092A><U094D><U091F><U0947><U0902><U092C><U0930>";/
- "<U0913><U0915><U094D><U091F><U094B><U092C><U0930>";/
+ "<U0911><U0917><U0938><U094D><U091F>";/
+ "<U0938><U092A><U094D><U091F><U0947><U0902><U092C><U0930>";/
+ "<U0911><U0915><U094D><U091F><U094B><U092C><U0930>";/
"<U0928><U094B><U0935><U094D><U0939><U0947><U0902><U092C><U0930>";/
"<U0921><U093F><U0938><U0947><U0902><U092C><U0930>"
%
diff --git a/libc/localedata/tst-fmon.sh b/libc/localedata/tst-fmon.sh
index 7e6d7f1d6..52d32d0a9 100755
--- a/libc/localedata/tst-fmon.sh
+++ b/libc/localedata/tst-fmon.sh
@@ -32,13 +32,10 @@ lang=`sed -e '/^#/d' -e '/^$/d' -e '/^C /d' -e '/^tstfmon/d' -e 's/^\([^ ]*\).*/
for cns in `cd ./tst-fmon-locales && ls tstfmon_*`; do
cn=tst-fmon-locales/$cns
fn=charmaps/ISO-8859-1
- # If run_program_prefix includes a cross-testing wrapper based on a
- # program like ssh, it may steal input from the while loop, so
- # redirect its stdin from /dev/null.
I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
${run_program_prefix} ${common_objpfx}locale/localedef \
- --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns < /dev/null
+ --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns
done
# Run the tests.
@@ -48,9 +45,6 @@ while IFS=" " read locale format value expect; do
case "$locale" in '#'*) continue ;; esac
if [ -n "$format" ]; then
expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'`
- # If run_program_prefix includes a cross-testing wrapper based on a
- # program like ssh, it may steal input from the while loop, so
- # redirect its stdin from /dev/null.
LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
diff --git a/libc/localedata/tst-numeric.sh b/libc/localedata/tst-numeric.sh
index a6758477e..70ddc405d 100644
--- a/libc/localedata/tst-numeric.sh
+++ b/libc/localedata/tst-numeric.sh
@@ -30,9 +30,6 @@ errcode=0
while IFS=" " read locale format value expect; do
case "$locale" in '#'*) continue ;; esac
if [ -n "$format" ]; then
- # If run_program_prefix includes a cross-testing wrapper based
- # on a program like ssh, it may steal input from the while
- # loop, so redirect its stdin from /dev/null.
if LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
${run_program_prefix} ${common_objpfx}localedata/tst-numeric \
diff --git a/libc/localedata/tst-rpmatch.sh b/libc/localedata/tst-rpmatch.sh
index b71416e91..878887927 100755
--- a/libc/localedata/tst-rpmatch.sh
+++ b/libc/localedata/tst-rpmatch.sh
@@ -26,9 +26,6 @@ tst_rpmatch=$2
rc=0
while IFS=\& read locale string result dummy; do
if [ "$locale" != "#" ]; then
- # If tst_rpmatch includes a cross-testing wrapper based on a
- # program like ssh, it may steal input from the while loop, so
- # redirect its stdin from /dev/null.
LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
${tst_rpmatch} $locale $string $result < /dev/null \
diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile
index b1141f732..86d384e70 100644
--- a/libc/malloc/Makefile
+++ b/libc/malloc/Makefile
@@ -112,15 +112,15 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
lib: $(objpfx)libmcheck.a
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
ifneq ($(PERL),no)
tests: $(objpfx)tst-mtrace.out
$(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
- $(SHELL) $< $(common-objpfx) '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+endif
endif
endif
-# eglibc: endif
tst-mcheck-ENV = MALLOC_CHECK_=3
tst-malloc-usable-ENV = MALLOC_CHECK_=3
diff --git a/libc/malloc/tst-mtrace.sh b/libc/malloc/tst-mtrace.sh
index 90e44c5c3..d81e550a2 100755
--- a/libc/malloc/tst-mtrace.sh
+++ b/libc/malloc/tst-mtrace.sh
@@ -20,15 +20,14 @@
set -e
common_objpfx=$1; shift
-cross_test_wrapper="$1"; shift
+run_program_prefix=$1; shift
status=0
trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${cross_test_wrapper} \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
${common_objpfx}malloc/tst-mtrace || status=1
if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff --git a/libc/manual/memory.texi b/libc/manual/memory.texi
index fba3a2cff..5b14aa69b 100644
--- a/libc/manual/memory.texi
+++ b/libc/manual/memory.texi
@@ -706,7 +706,10 @@ to zero disables all use of @code{mmap}.
If non-zero, memory blocks are filled with values depending on some
low order bits of this parameter when they are allocated (except when
allocated by @code{calloc}) and freed. This can be used to debug the
-use of uninitialized or freed heap memory.
+use of uninitialized or freed heap memory. Note that this option does not
+guarantee that the freed block will have any specific values. It only
+guarantees that the content the block had before it was freed will be
+overwritten.
@end table
@end deftypefun
diff --git a/libc/math/Makefile b/libc/math/Makefile
index 5491c5b83..395742cd1 100644
--- a/libc/math/Makefile
+++ b/libc/math/Makefile
@@ -132,6 +132,9 @@ CFLAGS-test-float.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
CFLAGS-test-double.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
CFLAGS-test-ldouble.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
CFLAGS-test-tgmath.c = -fno-builtin
+# The following testcase uses very long lines (>3 million), so it may take a
+# while to compile it. See: http://llvm.org/bugs/show_bug.cgi?id=14106 and
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54402
CFLAGS-test-tgmath2.c = -fno-builtin
CFLAGS-test-tgmath-ret.c = -fno-builtin
CFLAGS-test-powl.c = -fno-builtin
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc
index df860ebe2..48b8af3e5 100644
--- a/libc/math/libm-test.inc
+++ b/libc/math/libm-test.inc
@@ -5028,7 +5028,6 @@ gamma_test (void)
if (errno == ENOSYS)
/* Function not implemented. */
return;
- feclearexcept (FE_ALL_EXCEPT);
START (gamma);
@@ -5544,7 +5543,6 @@ lgamma_test (void)
if (errno == ENOSYS)
/* Function not implemented. */
return;
- feclearexcept (FE_ALL_EXCEPT);
START (lgamma);
@@ -9359,7 +9357,6 @@ tgamma_test (void)
if (errno == ENOSYS)
/* Function not implemented. */
return;
- feclearexcept (FE_ALL_EXCEPT);
START (tgamma);
diff --git a/libc/misc/Makefile b/libc/misc/Makefile
index 40a65a748..827c9003c 100644
--- a/libc/misc/Makefile
+++ b/libc/misc/Makefile
@@ -67,7 +67,7 @@ routines := brk sbrk sstk ioctl \
getloadavg getclktck \
fgetxattr flistxattr fremovexattr fsetxattr getxattr \
listxattr lgetxattr llistxattr lremovexattr lsetxattr \
- removexattr setxattr getauxval
+ removexattr setxattr getauxval ifunc-impl-list
routines-$(OPTION_POSIX_REGEXP) += regexp
routines-$(OPTION_EGLIBC_FSTAB) += fstab
@@ -86,11 +86,11 @@ tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
tst-pselect tst-insremque tst-mntent2 bug-hsearch1
tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
tests-$(OPTION_EGLIBC_FCVT) += tst-efgcvt
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
tests: $(objpfx)tst-error1-mem
endif
-# eglibc: endif
+endif
CFLAGS-tsearch.c = $(uses-callbacks)
CFLAGS-lsearch.c = $(uses-callbacks)
diff --git a/libc/misc/Versions b/libc/misc/Versions
index b2a91473d..64632f0bf 100644
--- a/libc/misc/Versions
+++ b/libc/misc/Versions
@@ -151,5 +151,6 @@ libc {
}
GLIBC_PRIVATE {
__madvise;
+ __libc_ifunc_impl_list;
}
}
diff --git a/libc/misc/ifunc-impl-list.c b/libc/misc/ifunc-impl-list.c
new file mode 100644
index 000000000..c4b460d43
--- /dev/null
+++ b/libc/misc/ifunc-impl-list.c
@@ -0,0 +1,32 @@
+/* Enumerate available IFUNC implementations of a function. Stub version.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <ifunc-impl-list.h>
+
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
+ NAME supported on target machine and return the number of valid
+ entries. */
+
+size_t
+__libc_ifunc_impl_list
+ (const char *name __attribute__ ((unused)),
+ struct libc_ifunc_impl *array __attribute__ ((unused)),
+ size_t max __attribute__ ((unused)))
+{
+ return 0;
+}
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 9eeeeb1bd..040b64c4e 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,92 @@
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+ Jim Blandy <jimb@codesourcery.com>
+
+ * Makefile ($(objpfx)tst-tls6.out): Pass $(test-wrapper-env) to
+ tst-tls6.sh.
+ * tst-tls6.sh (test_wrapper_env): New variable. Use it to run
+ programs with LD_PRELOAD set.
+
+2012-10-24 Roland McGrath <roland@hack.frob.com>
+
+ * Makefile ($(objpfx)tst-cond11, $(objpfx)tst-cond19): Targets removed.
+ ($(objpfx)tst-sem5, $(objpfx)tst-cancel18): Likewise.
+ ((objpfx)tst-cancelx18, $(objpfx)tst-clock2): Likewise.
+ ($(objpfx)tst-rwlock14): Likewise.
+
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile (tests): Remove tst-oddstacklimit.
+ (test-srcs): New variable.
+ (tst-oddstacklimit-ENV): Remove.
+ [$(run-built-tests) = yes] (tests): Depend on
+ $(objpfx)tst-oddstacklimit.out.
+ [$(run-built-tests) = yes] ($(objpfx)tst-oddstacklimit.out): New
+ target.
+ * tst-oddstacklimit.c: Do not include "tst-basic1.c". Use
+ setrlimit before executing tst-basic1 test passed to --command.
+
+2012-10-23 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile [$(cross-compiling) = no]: Change condition to
+ [$(run-built-tests) = yes].
+
+2012-10-23 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile (tst-cancel7-ARGS): Use $(host-built-program-cmd).
+ (tst-exec4-ARGS): Likewise.
+ (tst-stackguard1-ARGS): Likewise.
+
+2012-10-21 Jim Blandy <jimb@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile ($(objpfx)tst-cancel-wrappers.out): Pass $(NM) to
+ tst-cancel-wrappers.sh.
+ * tst-cancel-wrappers.sh: Use nm program given as first argument,
+ not hardcoded "nm".
+
+2012-10-17 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * tst-cond25.c (do_test_wait): Don't check for return value from
+ pthread_cancel.
+
+2012-10-16 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #14652]
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+ (__condvar_tw_cleanup): Adjust the mutex data structure if it
+ was locked by FUTEX_WAIT_REQUEUE_PI.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait
+ (__condvar_w_cleanup): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+ (__condvar_cleanup2): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+ (__condvar_cleanup1): Likewise.
+
+2012-10-10 Carlos O'Donell <carlos@systemhalted.org>
+
+ * sysdeps/pthread/pthread.h [!(defined __GNUC__ &&
+ defined __EXCEPTIONS) && defined __USE_GNU]
+ (pthread_cleanup_push_defer_np): Fix formatting.
+
+2012-10-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #14652]
+ * Makefile (tests): New test case tst-cond25.
+ (LDFLAGS-tst-cond25): Link tst-cond25 against librt.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+ (__condvar_tw_cleanup): Lock mutex only if we don't already
+ own it.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+ (__condvar_w_cleanup): Likewise.
+ * sysdeps/unix/sysv/linux/pthread-pi-defines.sym: Add TID_MASK.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+ (__condvar_cleanup2): Lock mutex only if we don't already
+ own it.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+ (__condvar_cleanup1): Likewise.
+ * tst-cond25.c: New test case.
+
2012-10-09 Roland McGrath <roland@hack.frob.com>
* sysdeps/pthread/configure: Regenerated.
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 47752f090..0126cfb4b 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -210,7 +210,7 @@ tests = tst-typesizes \
tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
- tst-cond20 tst-cond21 tst-cond22 tst-cond23 tst-cond24 \
+ tst-cond20 tst-cond21 tst-cond22 tst-cond23 tst-cond24 tst-cond25 \
tst-cond-except \
tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
@@ -260,12 +260,12 @@ tests = tst-typesizes \
tst-clock1 \
tst-context1 \
tst-sched1 \
- tst-oddstacklimit \
tst-abstime \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
tst-getpid1 tst-getpid2 tst-getpid3 \
tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
+test-srcs = tst-oddstacklimit
# This test uses the posix_spawn functions.
tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
@@ -281,15 +281,12 @@ tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1
# Files which must not be linked with libpthread.
tests-nolibpthread = tst-unload
-# This sets the stack resource limit to 1023kb, which is not a multiple
-# of the page size since every architecture's page size is > 1k.
-tst-oddstacklimit-ENV = ; ulimit -s 1023;
-
gen-as-const-headers = pthread-errnos.sym
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
LDFLAGS-tst-cond24 = -lrt
+LDFLAGS-tst-cond25 = -lrt
include ../Makeconfig
@@ -457,7 +454,7 @@ CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
-tst-cancel7-ARGS = --command "exec $(local-built-program-cmd)"
+tst-cancel7-ARGS = --command "exec $(host-built-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
@@ -466,9 +463,9 @@ LDFLAGS-tst-atfork2 = -rdynamic
tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
-# ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-stack3-mem
-# endif
+endif
tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
$(objpfx)tst-stack3-mem: $(objpfx)tst-stack3.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@
@@ -490,16 +487,15 @@ LDFLAGS-tst-tls5 = $(no-as-needed)
LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
ifeq ($(build-shared),yes)
-# ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-tls6.out
-# endif
+endif
$(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name) '$(cross-test-wrapper)' \
- $(..)scripts/run-with-env.sh
+ $(rtld-installed-name) '$(test-wrapper-env)'
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
@@ -507,31 +503,18 @@ $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
ifeq (yes,$(build-shared))
-$(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
-$(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
-$(objpfx)tst-sem5: $(common-objpfx)rt/librt.so
-$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.so
-$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.so
-$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.so
-$(objpfx)tst-cancelx18: $(common-objpfx)rt/librt.so
-$(objpfx)tst-clock2: $(common-objpfx)rt/librt.so
-$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.so
+librt = $(common-objpfx)rt/librt.so
+else
+librt = $(common-objpfx)rt/librt.a
+endif
+
+$(objpfx)tst-cancel17: $(librt)
+$(objpfx)tst-cancelx17: $(librt)
$(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
$(shared-thread-library)
-else
-$(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
-$(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
-$(objpfx)tst-sem5: $(common-objpfx)rt/librt.a
-$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.a
-$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.a
-$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.a
-$(objpfx)tst-cancelx18: $(common-objpfx)rt/librt.a
-$(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
-$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
-endif
LDLIBS-tst-cancel24 = $(no-as-needed) -lstdc++
LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
@@ -602,7 +585,7 @@ generated += banner.h
LDFLAGS-pthread.so += -e __nptl_main
endif
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
tests: $(objpfx)tst-cancel-wrappers.out
$(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
@@ -612,9 +595,9 @@ $(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
$(objpfx)libpthread_pic.a \
$(objpfx)libpthread.a > $@
endif
-# eglibc: endif
+endif
-tst-exec4-ARGS = $(local-built-program-cmd)
+tst-exec4-ARGS = $(host-built-program-cmd)
$(objpfx)tst-execstack: $(libdl)
$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
@@ -622,9 +605,16 @@ LDFLAGS-tst-execstack = -Wl,-z,noexecstack
$(objpfx)tst-fini1mod.so: $(shared-thread-library)
-tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
+ifeq ($(run-built-tests),yes)
+tests: $(objpfx)tst-oddstacklimit.out
+
+$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
+ $(run-program-prefix) $< --command '$(host-built-program-cmd)' > $@
+endif
+
# The tests here better do not run in parallel
ifneq ($(filter %tests,$(MAKECMDGOALS)),)
.NOTPARALLEL:
diff --git a/libc/nptl/sysdeps/pthread/pthread.h b/libc/nptl/sysdeps/pthread/pthread.h
index 00cc7e854..139be05ba 100644
--- a/libc/nptl/sysdeps/pthread/pthread.h
+++ b/libc/nptl/sysdeps/pthread/pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 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
@@ -694,7 +694,7 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
void *__cancel_arg = (arg); \
int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__glibc_unlikely (__not_first_call)) \
+ if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 6761c136e..6011f69f1 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -649,10 +649,27 @@ __condvar_tw_cleanup:
movl $0x7fffffff, %edx
ENTER_KERNEL
+ /* Lock the mutex only if we don't own it already. This only happens
+ in case of PI mutexes, if we got cancelled after a successful
+ return of the futex syscall and before disabling async
+ cancellation. */
5: movl 24+FRAME_SIZE(%esp), %eax
- call __pthread_mutex_cond_lock
+ movl MUTEX_KIND(%eax), %ebx
+ andl $(ROBUST_BIT|PI_BIT), %ebx
+ cmpl $PI_BIT, %ebx
+ jne 8f
+
+ movl (%eax), %ebx
+ andl $TID_MASK, %ebx
+ cmpl %ebx, %gs:TID
+ jne 8f
+ /* We managed to get the lock. Fix it up before returning. */
+ call __pthread_mutex_cond_lock_adjust
+ jmp 9f
+
+8: call __pthread_mutex_cond_lock
- movl %esi, (%esp)
+9: movl %esi, (%esp)
.LcallUR:
call _Unwind_Resume
hlt
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index 0af06acad..b418be3c4 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -566,10 +566,27 @@ __condvar_w_cleanup:
movl $0x7fffffff, %edx
ENTER_KERNEL
+ /* Lock the mutex only if we don't own it already. This only happens
+ in case of PI mutexes, if we got cancelled after a successful
+ return of the futex syscall and before disabling async
+ cancellation. */
5: movl 24+FRAME_SIZE(%esp), %eax
- call __pthread_mutex_cond_lock
-
- movl %esi, (%esp)
+ movl MUTEX_KIND(%eax), %ebx
+ andl $(ROBUST_BIT|PI_BIT), %ebx
+ cmpl $PI_BIT, %ebx
+ jne 8f
+
+ movl (%eax), %ebx
+ andl $TID_MASK, %ebx
+ cmpl %ebx, %gs:TID
+ jne 8f
+ /* We managed to get the lock. Fix it up before returning. */
+ call __pthread_mutex_cond_lock_adjust
+ jmp 9f
+
+8: call __pthread_mutex_cond_lock
+
+9: movl %esi, (%esp)
.LcallUR:
call _Unwind_Resume
hlt
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym b/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym
index 46fbd0de7..0ac51dba9 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym
+++ b/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym
@@ -6,3 +6,4 @@ MUTEX_KIND offsetof (pthread_mutex_t, __data.__kind)
ROBUST_BIT PTHREAD_MUTEX_ROBUST_NORMAL_NP
PI_BIT PTHREAD_MUTEX_PRIO_INHERIT_NP
PS_BIT PTHREAD_MUTEX_PSHARED_BIT
+TID_MASK FUTEX_TID_MASK
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index b669abb57..15e451a51 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -771,10 +771,27 @@ __condvar_cleanup2:
movl $SYS_futex, %eax
syscall
+ /* Lock the mutex only if we don't own it already. This only happens
+ in case of PI mutexes, if we got cancelled after a successful
+ return of the futex syscall and before disabling async
+ cancellation. */
5: movq 16(%rsp), %rdi
- callq __pthread_mutex_cond_lock
+ movl MUTEX_KIND(%rdi), %eax
+ andl $(ROBUST_BIT|PI_BIT), %eax
+ cmpl $PI_BIT, %eax
+ jne 7f
+
+ movl (%rdi), %eax
+ andl $TID_MASK, %eax
+ cmpl %eax, %fs:TID
+ jne 7f
+ /* We managed to get the lock. Fix it up before returning. */
+ callq __pthread_mutex_cond_lock_adjust
+ jmp 8f
+
+7: callq __pthread_mutex_cond_lock
- movq 24(%rsp), %rdi
+8: movq 24(%rsp), %rdi
movq FRAME_SIZE(%rsp), %r15
movq FRAME_SIZE+8(%rsp), %r14
movq FRAME_SIZE+16(%rsp), %r13
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index ec403cd9b..2c6b515d8 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -495,10 +495,28 @@ __condvar_cleanup1:
movl $SYS_futex, %eax
syscall
+ /* Lock the mutex only if we don't own it already. This only happens
+ in case of PI mutexes, if we got cancelled after a successful
+ return of the futex syscall and before disabling async
+ cancellation. */
5: movq 16(%rsp), %rdi
- callq __pthread_mutex_cond_lock
+ movl MUTEX_KIND(%rdi), %eax
+ andl $(ROBUST_BIT|PI_BIT), %eax
+ cmpl $PI_BIT, %eax
+ jne 7f
+
+ movl (%rdi), %eax
+ andl $TID_MASK, %eax
+ cmpl %eax, %fs:TID
+ jne 7f
+ /* We managed to get the lock. Fix it up before returning. */
+ callq __pthread_mutex_cond_lock_adjust
+ jmp 8f
+
+
+7: callq __pthread_mutex_cond_lock
- movq 24(%rsp), %rdi
+8: movq 24(%rsp), %rdi
.LcallUR:
call _Unwind_Resume@PLT
hlt
diff --git a/libc/nptl/tst-cancel-wrappers.sh b/libc/nptl/tst-cancel-wrappers.sh
index e8a2e5786..b16ab2fe9 100644
--- a/libc/nptl/tst-cancel-wrappers.sh
+++ b/libc/nptl/tst-cancel-wrappers.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Test whether all cancelable functions are cancelable.
-# Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -18,9 +18,9 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
-nm="$1"; shift
+NM="$1"; shift
while [ $# -gt 0 ]; do
- ( $nm -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
+ ( $NM -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
C["accept"]=1
C["close"]=1
C["connect"]=1
diff --git a/libc/nptl/tst-cond25.c b/libc/nptl/tst-cond25.c
new file mode 100644
index 000000000..370cd67d1
--- /dev/null
+++ b/libc/nptl/tst-cond25.c
@@ -0,0 +1,278 @@
+/* Verify that condition variables synchronized by PI mutexes don't hang on
+ on cancellation.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
+
+#define NUM 5
+#define ITERS 10000
+#define COUNT 100
+
+typedef void *(*thr_func) (void *);
+
+pthread_mutex_t mutex;
+pthread_cond_t cond;
+
+void cleanup (void *u)
+{
+ /* pthread_cond_wait should always return with the mutex locked. */
+ if (pthread_mutex_unlock (&mutex))
+ abort ();
+}
+
+void *
+signaller (void *u)
+{
+ int i, ret = 0;
+ void *tret = NULL;
+
+ for (i = 0; i < ITERS; i++)
+ {
+ if ((ret = pthread_mutex_lock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("signaller:mutex_lock failed: %s\n", strerror (ret));
+ goto out;
+ }
+ if ((ret = pthread_cond_signal (&cond)) != 0)
+ {
+ tret = (void *)1;
+ printf ("signaller:signal failed: %s\n", strerror (ret));
+ goto unlock_out;
+ }
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("signaller:mutex_unlock failed: %s\n", strerror (ret));
+ goto out;
+ }
+ pthread_testcancel ();
+ }
+
+out:
+ return tret;
+
+unlock_out:
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ printf ("signaller:mutex_unlock[2] failed: %s\n", strerror (ret));
+ goto out;
+}
+
+void *
+waiter (void *u)
+{
+ int i, ret = 0;
+ void *tret = NULL;
+ int seq = (int)u;
+
+ for (i = 0; i < ITERS / NUM; i++)
+ {
+ if ((ret = pthread_mutex_lock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
+ goto out;
+ }
+ pthread_cleanup_push (cleanup, NULL);
+
+ if ((ret = pthread_cond_wait (&cond, &mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:wait failed: %s\n", seq, strerror (ret));
+ goto unlock_out;
+ }
+
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
+ goto out;
+ }
+ pthread_cleanup_pop (0);
+ }
+
+out:
+ puts ("waiter tests done");
+ return tret;
+
+unlock_out:
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ printf ("waiter:mutex_unlock[2] failed: %s\n", strerror (ret));
+ goto out;
+}
+
+void *
+timed_waiter (void *u)
+{
+ int i, ret;
+ void *tret = NULL;
+ int seq = (int)u;
+
+ for (i = 0; i < ITERS / NUM; i++)
+ {
+ struct timespec ts;
+
+ if ((ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0)
+ {
+ tret = (void *)1;
+ printf ("%u:clock_gettime failed: %s\n", seq, strerror (errno));
+ goto out;
+ }
+ ts.tv_sec += 20;
+
+ if ((ret = pthread_mutex_lock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
+ goto out;
+ }
+ pthread_cleanup_push (cleanup, NULL);
+
+ /* We should not time out either. */
+ if ((ret = pthread_cond_timedwait (&cond, &mutex, &ts)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:timedwait failed: %s\n", seq, strerror (ret));
+ goto unlock_out;
+ }
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ {
+ tret = (void *)1;
+ printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
+ goto out;
+ }
+ pthread_cleanup_pop (0);
+ }
+
+out:
+ puts ("timed_waiter tests done");
+ return tret;
+
+unlock_out:
+ if ((ret = pthread_mutex_unlock (&mutex)) != 0)
+ printf ("waiter[%u]:mutex_unlock[2] failed: %s\n", seq, strerror (ret));
+ goto out;
+}
+
+int
+do_test_wait (thr_func f)
+{
+ pthread_t w[NUM];
+ pthread_t s;
+ pthread_mutexattr_t attr;
+ int i, j, ret = 0;
+ void *thr_ret;
+
+ for (i = 0; i < COUNT; i++)
+ {
+ if ((ret = pthread_mutexattr_init (&attr)) != 0)
+ {
+ printf ("mutexattr_init failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ if ((ret = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT)) != 0)
+ {
+ printf ("mutexattr_setprotocol failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ if ((ret = pthread_cond_init (&cond, NULL)) != 0)
+ {
+ printf ("cond_init failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ if ((ret = pthread_mutex_init (&mutex, &attr)) != 0)
+ {
+ printf ("mutex_init failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ for (j = 0; j < NUM; j++)
+ if ((ret = pthread_create (&w[j], NULL, f, (void *)j)) != 0)
+ {
+ printf ("waiter[%d]: create failed: %s\n", j, strerror (ret));
+ goto out;
+ }
+
+ if ((ret = pthread_create (&s, NULL, signaller, NULL)) != 0)
+ {
+ printf ("signaller: create failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ for (j = 0; j < NUM; j++)
+ {
+ pthread_cancel (w[j]);
+
+ if ((ret = pthread_join (w[j], &thr_ret)) != 0)
+ {
+ printf ("waiter[%d]: join failed: %s\n", j, strerror (ret));
+ goto out;
+ }
+
+ if (thr_ret != NULL && thr_ret != PTHREAD_CANCELED)
+ {
+ ret = 1;
+ goto out;
+ }
+ }
+
+ /* The signalling thread could have ended before it was cancelled. */
+ pthread_cancel (s);
+
+ if ((ret = pthread_join (s, &thr_ret)) != 0)
+ {
+ printf ("signaller: join failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ if (thr_ret != NULL && thr_ret != PTHREAD_CANCELED)
+ {
+ ret = 1;
+ goto out;
+ }
+ }
+
+out:
+ return ret;
+}
+
+int
+do_test (int argc, char **argv)
+{
+ int ret = do_test_wait (waiter);
+
+ if (ret)
+ return ret;
+
+ return do_test_wait (timed_waiter);
+}
+
+#define TIMEOUT 5
+#include "../test-skeleton.c"
diff --git a/libc/nptl/tst-oddstacklimit.c b/libc/nptl/tst-oddstacklimit.c
index 9fbef1889..be25948e5 100644
--- a/libc/nptl/tst-oddstacklimit.c
+++ b/libc/nptl/tst-oddstacklimit.c
@@ -1 +1,72 @@
-#include "tst-basic1.c"
+/* Test NPTL with stack limit that is not a multiple of the page size.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+
+/* This sets the stack resource limit to 1023kb, which is not a multiple
+ of the page size since every architecture's page size is > 1k. */
+#ifndef ODD_STACK_LIMIT
+# define ODD_STACK_LIMIT (1023 * 1024)
+#endif
+
+static const char *command;
+
+static int
+do_test (void)
+{
+ int ret;
+ struct rlimit rlim;
+
+ ret = getrlimit (RLIMIT_STACK, &rlim);
+ if (ret != 0)
+ {
+ printf ("getrlimit failed: %s\n", strerror (errno));
+ return 1;
+ }
+ rlim.rlim_cur = ODD_STACK_LIMIT;
+ ret = setrlimit (RLIMIT_STACK, &rlim);
+ if (ret != 0)
+ {
+ printf ("setrlimit failed: %s\n", strerror (errno));
+ return 1;
+ }
+ ret = system (command);
+ if (ret == -1)
+ {
+ printf ("system failed: %s\n", strerror (errno));
+ return 1;
+ }
+ if (WIFEXITED (ret))
+ return WEXITSTATUS (ret);
+ else
+ return 1;
+}
+
+#define OPT_COMMAND 10000
+#define CMDLINE_OPTIONS \
+ { "command", required_argument, NULL, OPT_COMMAND },
+#define CMDLINE_PROCESS \
+ case OPT_COMMAND: \
+ command = optarg; \
+ break;
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/nptl/tst-tls6.sh b/libc/nptl/tst-tls6.sh
index 89f8244e1..78d70a827 100755
--- a/libc/nptl/tst-tls6.sh
+++ b/libc/nptl/tst-tls6.sh
@@ -22,15 +22,13 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
-cross_test_wrapper=$1; shift
-run_with_env=$1; shift
+test_wrapper_env=$1; shift
logfile=$common_objpfx/nptl/tst-tls6.out
# We have to find libc and nptl
library_path=${common_objpfx}:${common_objpfx}nptl
tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}/nptl/tst-tls5"
-tst_tls5="$cross_test_wrapper $run_with_env $tst_tls5"
LC_ALL=C
export LC_ALL
@@ -51,33 +49,33 @@ preloads () {
for aligned in a e f; do
echo "preload tst-tls5mod{$aligned,b,c,d}.so" >> $logfile
echo "===============" >> $logfile
- EGLIBC_TEST_LD_PRELOAD=`preloads $aligned b c d` \
- ${tst_tls5} >> $logfile || fail=1
+ ${test_wrapper_env} \
+ LD_PRELOAD="`preloads $aligned b c d`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,$aligned,c,d}.so" >> $logfile
echo "===============" >> $logfile
- EGLIBC_TEST_LD_PRELOAD=`preloads b $aligned c d` \
- ${tst_tls5} >> $logfile || fail=1
+ ${test_wrapper_env} \
+ LD_PRELOAD="`preloads b $aligned c d`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,c,d,$aligned}.so" >> $logfile
echo "===============" >> $logfile
- EGLIBC_TEST_LD_PRELOAD=`preloads b c d $aligned` \
- ${tst_tls5} >> $logfile || fail=1
+ ${test_wrapper_env} \
+ LD_PRELOAD="`preloads b c d $aligned`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
done
echo "preload tst-tls5mod{d,a,b,c,e}" >> $logfile
echo "===============" >> $logfile
-EGLIBC_TEST_LD_PRELOAD=`preloads d a b c e` \
- ${tst_tls5} >> $logfile || fail=1
+${test_wrapper_env} \
+LD_PRELOAD="`preloads d a b c e`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{d,a,b,e,f}" >> $logfile
echo "===============" >> $logfile
-EGLIBC_TEST_LD_PRELOAD=`preloads d a b e f` \
- ${tst_tls5} >> $logfile || fail=1
+${test_wrapper_env} \
+LD_PRELOAD="`preloads d a b e f`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
exit $fail
diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile
index e4714ba6d..bf312aee0 100644
--- a/libc/nscd/Makefile
+++ b/libc/nscd/Makefile
@@ -108,9 +108,9 @@ include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
$(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
ifeq ($(build-shared),yes)
-$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library)
+$(objpfx)nscd: $(shared-thread-library)
else
-$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library)
+$(objpfx)nscd: $(static-thread-library)
endif
ifeq (y,$(OPTION_EGLIBC_NIS))
diff --git a/libc/ports/ChangeLog.alpha b/libc/ports/ChangeLog.alpha
index 8cddb777e..8ddde9f25 100644
--- a/libc/ports/ChangeLog.alpha
+++ b/libc/ports/ChangeLog.alpha
@@ -1,3 +1,8 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+
2012-10-09 Roland McGrath <roland@hack.frob.com>
* sysdeps/alpha/configure: Regenerated.
diff --git a/libc/ports/ChangeLog.arm b/libc/ports/ChangeLog.arm
index a45063082..0b76f5ed2 100644
--- a/libc/ports/ChangeLog.arm
+++ b/libc/ports/ChangeLog.arm
@@ -1,3 +1,17 @@
+2012-10-22 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+
+2012-10-22 Andreas Jaeger <aj@suse.de>
+
+ * ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h (__O_LARGEFILE):
+ Define always.
+
+ * sysdeps/unix/sysv/linux/arm/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
2012-10-09 Roland McGrath <roland@hack.frob.com>
* sysdeps/arm/configure: Regenerated.
diff --git a/libc/ports/ChangeLog.hppa b/libc/ports/ChangeLog.hppa
index 5b16146e4..2bfd5d481 100644
--- a/libc/ports/ChangeLog.hppa
+++ b/libc/ports/ChangeLog.hppa
@@ -1,3 +1,16 @@
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/hppa/nptl/Makefile (tst-oddstacklimit-ENV): Remove.
+ * sysdeps/hppa/nptl/tst-oddstacklimit.c: New file.
+
+2012-10-10 Carlos O'Donell <carlos@systemhalted.org>
+
+ * sysdeps/unix/sysv/linux/hppa/nptl/pthread.h: Update.
+
+ * sysdeps/unix/sysv/linux/hppa/nptl/pt-initfini.c: Removed.
+
+ * sysdeps/hppa/nptl/shlib-versions: New file.
+
2012-10-02 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h: Fix clone
diff --git a/libc/ports/ChangeLog.ia64 b/libc/ports/ChangeLog.ia64
index 641033b29..8d8f4dcd7 100644
--- a/libc/ports/ChangeLog.ia64
+++ b/libc/ports/ChangeLog.ia64
@@ -1,3 +1,11 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+
+ * sysdeps/unix/sysv/linux/ia64/get_clockfreq.c (__get_clockfreq):
+ Use __open, __read, __close rather than their public counterparts.
+
2012-10-09 Roland McGrath <roland@hack.frob.com>
* sysdeps/ia64/configure: Regenerated.
diff --git a/libc/ports/ChangeLog.m68k b/libc/ports/ChangeLog.m68k
index e9b4f3689..dda8cf7ee 100644
--- a/libc/ports/ChangeLog.m68k
+++ b/libc/ports/ChangeLog.m68k
@@ -1,3 +1,9 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist:
+ (GLIBC_2.17): Add clock_* symbols.
+ * sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist: Likewise.
+
2012-10-02 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h: Fix clone
diff --git a/libc/ports/ChangeLog.mips b/libc/ports/ChangeLog.mips
index add9c2dd3..a6aecad24 100644
--- a/libc/ports/ChangeLog.mips
+++ b/libc/ports/ChangeLog.mips
@@ -1,3 +1,15 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist: Likewise.
+
+2012-10-24 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
2012-10-03 Steve Ellcey <sellcey@mips.com>
* sysdeps/mips/ieee754.h: Move to...
diff --git a/libc/ports/ChangeLog.powerpc b/libc/ports/ChangeLog.powerpc
index aa5595602..642e7165c 100644
--- a/libc/ports/ChangeLog.powerpc
+++ b/libc/ports/ChangeLog.powerpc
@@ -1,3 +1,8 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+
2012-09-26 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
@@ -180,7 +185,7 @@
* sysdeps/powerpc/nofpu/Makefile
[subdirs-soft-fp] (sysdep_routines): Remove gcc-quad-routines.
[subdirs-math] (CPPFLAGS): Add -I../soft-fp.
- [subdirs-math] (CFLAGS-e_powl.c): Add -fno-builtin-fabsl.
+ [subdirs-math] (CFLAGS-e_powl.c): Add -fno-builtin-fabsl.
[subdirs-math] (CFLAGS-s_ccoshl.c): Likewise.
[subdirs-math] (CFLAGS-s_csinhl.c): Likewise.
[subdirs-math] (CFLAGS-s_clogl.c): Likewise.
diff --git a/libc/ports/ChangeLog.tile b/libc/ports/ChangeLog.tile
index 2d19358e7..93c99ac69 100644
--- a/libc/ports/ChangeLog.tile
+++ b/libc/ports/ChangeLog.tile
@@ -1,3 +1,16 @@
+2012-10-19 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist:
+ (GLIBC_2.17): Add clock_* symbols.
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist:
+ Likewise.
+
+2012-10-11 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/unix/sysv/linux/tile/tilegx/sched_getcpu.c: New file.
+
2012-10-02 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h: Fix clone
diff --git a/libc/ports/sysdeps/hppa/nptl/Makefile b/libc/ports/sysdeps/hppa/nptl/Makefile
index 86be06ade..bc09dd1e7 100644
--- a/libc/ports/sysdeps/hppa/nptl/Makefile
+++ b/libc/ports/sysdeps/hppa/nptl/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005-2012 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
@@ -18,9 +18,3 @@
ifeq ($(subdir),csu)
gen-as-const-headers += tcb-offsets.sym
endif
-
-# This sets the stack resource limit to 8193kb, which is not a multiple
-# of the page size, and therefore an odd sized stack limit. We override
-# this because the default is too small to run with.
-tst-oddstacklimit-ENV = ; ulimit -s 8193;
-
diff --git a/libc/ports/sysdeps/hppa/nptl/shlib-versions b/libc/ports/sysdeps/hppa/nptl/shlib-versions
new file mode 100644
index 000000000..adc26364b
--- /dev/null
+++ b/libc/ports/sysdeps/hppa/nptl/shlib-versions
@@ -0,0 +1 @@
+hppa.*-.*-linux.* libpthread=0 GLIBC_2.2
diff --git a/libc/ports/sysdeps/hppa/nptl/tst-oddstacklimit.c b/libc/ports/sysdeps/hppa/nptl/tst-oddstacklimit.c
new file mode 100644
index 000000000..6fcc9e312
--- /dev/null
+++ b/libc/ports/sysdeps/hppa/nptl/tst-oddstacklimit.c
@@ -0,0 +1,26 @@
+/* Test NPTL with stack limit that is not a multiple of the page size.
+ HPPA version.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This sets the stack resource limit to 8193kb, which is not a multiple
+ of the page size, and therefore an odd sized stack limit. We override
+ this because the default is too small to run with. */
+
+#define ODD_STACK_LIMIT (8193 * 1024)
+
+#include <sysdeps/../nptl/tst-oddstacklimit.c>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
index f8a3295ad..1d0cc7ec3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
@@ -1813,6 +1813,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
index ef49d5fa2..f259490ab 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,133 +20,10 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on an ext2 file system */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 040000 /* Must be a directory. */
-# define O_NOFOLLOW 0100000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 0200000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0400000
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
-#define F_GETLK64 12 /* Get record locking info. */
-#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 14 /* Set record locking info (blocking). */
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
+#define __O_DIRECTORY 040000 /* Must be a directory. */
+#define __O_NOFOLLOW 0100000 /* Do not follow links. */
+#define __O_DIRECT 0200000 /* Direct disk access. */
+#define __O_LARGEFILE 0400000
struct flock
{
@@ -174,148 +50,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
index 5523fdd2a..ceab6b2cd 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
@@ -80,6 +80,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.4
GLIBC_2.4 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-initfini.c b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-initfini.c
deleted file mode 100644
index daf7a0ac3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-initfini.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Special .init and .fini section support for HPPA. NPTL version.
- Copyright (C) 2005 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.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-/* This file is compiled into assembly code which is then munged by a sed
- script into two files: crti.s and crtn.s.
-
- * crti.s puts a function prologue at the beginning of the
- .init and .fini sections and defines global symbols for
- those addresses, so they can be called as functions.
-
- * crtn.s puts the corresponding function epilogues
- in the .init and .fini sections. */
-
-/* If we use the standard C version, the linkage table pointer won't
- be properly preserved due to the splitting up of function prologues
- and epilogues. Therefore we write these in assembly to make sure
- they do the right thing. */
-
-__asm__ (
-"#include \"defs.h\"\n"
-"\n"
-"/*@HEADER_ENDS*/\n"
-"\n"
-"/*@_init_PROLOG_BEGINS*/\n"
-" .section .init\n"
-" .align 4\n"
-" .globl _init\n"
-" .type _init,@function\n"
-"_init:\n"
-" stw %rp,-20(%sp)\n"
-" stwm %r4,64(%sp)\n"
-" stw %r19,-32(%sp)\n"
-" bl __pthread_initialize_minimal_internal,%rp\n"
-" copy %r19,%r4 /* delay slot */\n"
-" copy %r4,%r19\n"
-"/*@_init_PROLOG_ENDS*/\n"
-"\n"
-"/*@_init_EPILOG_BEGINS*/\n"
-"/* Here is the tail end of _init. */\n"
-" .section .init\n"
-" ldw -84(%sp),%rp\n"
-" copy %r4,%r19\n"
-" bv %r0(%rp)\n"
-"_end_init:\n"
-" ldwm -64(%sp),%r4\n"
-"\n"
-"/* Our very own unwind info, because the assembler can't handle\n"
-" functions split into two or more pieces. */\n"
-" .section .PARISC.unwind,\"a\",@progbits\n"
-" .extern _init\n"
-" .word _init, _end_init\n"
-" .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n"
-"\n"
-"/*@_init_EPILOG_ENDS*/\n"
-"\n"
-"/*@_fini_PROLOG_BEGINS*/\n"
-" .section .fini\n"
-" .align 4\n"
-" .globl _fini\n"
-" .type _fini,@function\n"
-"_fini:\n"
-" stw %rp,-20(%sp)\n"
-" stwm %r4,64(%sp)\n"
-" stw %r19,-32(%sp)\n"
-" copy %r19,%r4\n"
-"/*@_fini_PROLOG_ENDS*/\n"
-"\n"
-"/*@_fini_EPILOG_BEGINS*/\n"
-" .section .fini\n"
-" ldw -84(%sp),%rp\n"
-" copy %r4,%r19\n"
-" bv %r0(%rp)\n"
-"_end_fini:\n"
-" ldwm -64(%sp),%r4\n"
-"\n"
-" .section .PARISC.unwind,\"a\",@progbits\n"
-" .extern _fini\n"
-" .word _fini, _end_fini\n"
-" .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n"
-"\n"
-"/*@_fini_EPILOG_ENDS*/\n"
-"\n"
-"/*@TRAILER_BEGINS*/\n"
-);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h
index 6a0d95354..0787902cc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,6 @@
#include <features.h>
#include <endian.h>
#include <sched.h>
-#define __need_timespec
#include <time.h>
#include <bits/pthreadtypes.h>
@@ -84,7 +83,7 @@ enum
/* Mutex initializers. */
-#if __WORDSIZE == 64
+#ifdef __PTHREAD_MUTEX_HAVE_PREV
# define PTHREAD_MUTEX_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0, { 0, 0 } } }
# ifdef __USE_GNU
@@ -119,11 +118,20 @@ enum
PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
};
+/* Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t
+ has the shared field. All 64-bit architectures have the shared field
+ in pthread_rwlock_t. */
+#ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
+# if __WORDSIZE == 64
+# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
+# endif
+#endif
+
/* Read-write lock initializers. */
# define PTHREAD_RWLOCK_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
# ifdef __USE_GNU
-# if __WORDSIZE == 64
+# ifdef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
@@ -651,7 +659,7 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
void *__cancel_arg = (arg); \
int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (__not_first_call, 0)) \
+ if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -686,7 +694,7 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
void *__cancel_arg = (arg); \
int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (__not_first_call, 0)) \
+ if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -723,7 +731,7 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
/* Function used in the macros. */
struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
/* Mutex handling. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
index 4c1777a51..cb8025ebe 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
@@ -1,5 +1,5 @@
/* Get frequency of the system processor. IA-64/Linux version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +37,7 @@ __get_clockfreq (void)
if (result != 0)
return result;
- fd = open ("/proc/cpuinfo", O_RDONLY);
+ fd = __open ("/proc/cpuinfo", O_RDONLY);
if (__builtin_expect (fd != -1, 1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
@@ -45,7 +45,7 @@ __get_clockfreq (void)
char buf[4096];
ssize_t n;
- n = read (fd, buf, sizeof buf);
+ n = __read (fd, buf, sizeof buf);
if (__builtin_expect (n, 1) > 0)
{
char *mhz = memmem (buf, n, "itc MHz", 7);
@@ -81,7 +81,7 @@ __get_clockfreq (void)
}
}
- close (fd);
+ __close (fd);
}
return result;
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
index b73f5ca8f..b3510fe2a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
@@ -80,6 +80,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
index 9a924571e..3c40379aa 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
@@ -81,6 +81,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.4
GLIBC_2.4 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
index fbcd20897..f998b1b27 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
@@ -1769,6 +1769,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 9645b3663..d22501c4d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2006,
- 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,58 +21,26 @@
#endif
#include <sgidefs.h>
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on an ext2 file system */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
#define O_APPEND 0x0008
#define O_SYNC 0x4010
#define O_NONBLOCK 0x0080
-#define O_NDELAY O_NONBLOCK
#define O_CREAT 0x0100 /* not fcntl */
#define O_TRUNC 0x0200 /* not fcntl */
#define O_EXCL 0x0400 /* not fcntl */
#define O_NOCTTY 0x0800 /* not fcntl */
-#define O_FSYNC O_SYNC
#define O_ASYNC 0x1000
-#ifdef __USE_XOPEN2K8
-# define O_NOFOLLOW 0x20000 /* Do not follow links. */
-# define O_DIRECTORY 0x10000 /* Must be a directory. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 0x8000 /* Direct disk access hint. */
-# define O_NOATIME 0x40000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has no synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 0x0010 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
+#define __O_DIRECT 0x8000 /* Direct disk access hint. */
+#define __O_DSYNC 0x0010 /* Synchronize data. */
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0x2000 /* Allow large file opens. */
+#if _MIPS_SIM == _ABI64
+/* Not necessary, files are always with 64bit off_t. */
+# define __O_LARGEFILE 0
+#else
+# define __O_LARGEFILE 0x2000 /* Allow large file opens. */
#endif
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
#ifndef __USE_FILE_OFFSET64
# define F_GETLK 14 /* Get record locking info. */
# define F_SETLK 6 /* Set record locking info (non-blocking). */
@@ -84,72 +51,18 @@
# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
#endif
-#define F_GETLK64 33 /* Get record locking info. */
-#define F_SETLK64 34 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 35 /* Set record locking info (blocking). */
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 24 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 23 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
+#if _MIPS_SIM != _ABI64
+# define F_GETLK64 33 /* Get record locking info. */
+# define F_SETLK64 34 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 35 /* Set record locking info (blocking). */
+#else
+# define F_GETLK64 14 /* Get record locking info. */
+# define F_SETLK64 6 /* Set record locking info (non-blocking).*/
+# define F_SETLKW64 7 /* Set record locking info (blocking). */
#endif
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
+#define __F_SETOWN 24 /* Get owner (process receiving SIGIO). */
+#define __F_GETOWN 23 /* Set owner (process receiving SIGIO). */
struct flock
{
@@ -187,148 +100,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
index 54e8d1a94..737886923 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
@@ -2244,4 +2244,9 @@ _gp_disp
_gp_disp A
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
index 0e21194ac..22b3068d8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
@@ -1390,6 +1390,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index 481162e99..f2682b39c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
@@ -1774,6 +1774,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
__ppc_get_timebase_freq F
GLIBC_2.2
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/sched_getcpu.c b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/sched_getcpu.c
new file mode 100644
index 000000000..e9c5bd282
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/sched_getcpu.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sched.h>
+#include <sysdep.h>
+#include <arch/spr_def.h>
+
+
+/* The count of cores horizontally (X dimension) on the chip. */
+static int chip_width;
+
+/* Read the chip "width" from the /sys filesystem. */
+static int
+initialize_chip_width (void)
+{
+ int w = 0;
+ int fd;
+
+ fd = __open ("/sys/devices/system/cpu/chip_width", O_RDONLY);
+ if (fd >= 0)
+ {
+ char buf[64];
+ ssize_t n;
+ int i;
+
+ n = __read (fd, buf, sizeof (buf));
+ __close (fd);
+
+ for (i = 0; i < n; ++i)
+ {
+ if (buf[i] < '0' || buf[i] > '9')
+ break;
+ w = (w * 10) + (buf[i] - '0');
+ }
+ }
+
+ /* Store a negative value so we don't try again. */
+ if (w == 0)
+ w = -1;
+
+ /* Using an atomic idempotent write here makes this thread-safe. */
+ chip_width = w;
+ return w;
+}
+
+int
+sched_getcpu (void)
+{
+ unsigned int coord;
+ int w = chip_width;
+
+ if (__builtin_expect (w <= 0, 0))
+ {
+ if (w == 0)
+ w = initialize_chip_width ();
+ if (w < 0)
+ {
+ unsigned int cpu;
+ int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
+ return r == -1 ? r : cpu;
+ }
+ }
+
+ /* Assign 64-bit value to a 32-bit variable to ensure 32-bit multiply. */
+ coord = __insn_mfspr (SPR_TILE_COORD);
+
+ /* Extract Y coord from bits 7..10 and X coord from bits 18..21. */
+ return ((coord >> 7) & 0xf) * w + ((coord >> 18) & 0xf);
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
index 48f0c69eb..d79b2df55 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
@@ -2082,4 +2082,9 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
index 3aa70a100..f61740567 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
@@ -2082,4 +2082,9 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
index 48f0c69eb..d79b2df55 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
@@ -2082,4 +2082,9 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index e88f0ce22..a9028ac62 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -138,22 +138,21 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
include ../Rules
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
tests: $(objpfx)globtest.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name) '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-via-rtld-prefix)' \
+ '$(test-wrapper)' '$(test-wrapper-env)'
LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
ifeq (y,$(OPTION_EGLIBC_WORDEXP))
tests: $(objpfx)wordexp-tst.out
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name) '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+endif
endif
endif
-# eglibc: endif
# If we will use the generic uname implementation, we must figure out what
# it will say by examining the system, and write the results in config-name.h.
@@ -201,8 +200,8 @@ CFLAGS-execlp.os = -fomit-frame-pointer
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
-tst-exec-ARGS = -- $(local-built-program-cmd)
-tst-spawn-ARGS = -- $(local-built-program-cmd)
+tst-exec-ARGS = -- $(host-built-program-cmd)
+tst-spawn-ARGS = -- $(host-built-program-cmd)
tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
tst-chmod-ARGS = $(objdir)
tst-vfork3-ARGS = --test-dir=$(objpfx)
@@ -246,7 +245,7 @@ ptestcases.h: PTESTS PTESTS2C.sed
# Run a test on the header files we use.
# XXX Please note that for now we ignore the result of this test.
tests: $(objpfx)annexc.out
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)bug-regex2-mem \
$(objpfx)bug-regex21-mem \
$(objpfx)bug-regex31-mem \
@@ -257,7 +256,7 @@ tests: $(objpfx)bug-regex14-mem $(objpfx)tst-rxspencer-mem \
$(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem
endif
xtests: $(objpfx)bug-ga2-mem
-# eglibc: endif
+endif
$(objpfx)annexc.out: $(objpfx)annexc
-$(dir $<)$(notdir $<) '$(CC)' \
@@ -315,16 +314,7 @@ $(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- '$(cross-test-wrapper)' $(rtld-installed-name)
-
-ifeq (yes,$(build-shared))
-$(objpfx)tst-regex: $(common-objpfx)rt/librt.so
-$(objpfx)tst-regex2: $(common-objpfx)rt/librt.so
-else
-$(objpfx)tst-regex: $(common-objpfx)rt/librt.a
-$(objpfx)tst-regex2: $(common-objpfx)rt/librt.a
-endif
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
$(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@
diff --git a/libc/posix/globtest.sh b/libc/posix/globtest.sh
index 1df0ef720..121be8596 100755
--- a/libc/posix/globtest.sh
+++ b/libc/posix/globtest.sh
@@ -20,9 +20,10 @@
set -e
common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
-cross_test_wrapper=$1; shift
+run_via_rtld_prefix=$1; shift
+test_wrapper=$1; shift
+test_wrapper_env=$1; shift
+run_program_prefix="${test_wrapper} ${run_via_rtld_prefix}"
logfile=$common_objpfx/posix/globtest.out
#CMP=cmp
@@ -37,12 +38,6 @@ case "$common_objpfx" in
;;
esac
-# We have to find the libc and the NSS modules.
-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
-
-run_program_prefix="${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path}"
-
# Since we use `sort' we must make sure to use the same locale everywhere.
LC_ALL=C
export LC_ALL
@@ -50,9 +45,10 @@ LANG=C
export LANG
# Create the arena
-: ${TMPDIR=/tmp}
-testdir=$(mktemp -d $TMPDIR/globtest-dir.XXXXXX)
-testout=$(mktemp $TMPDIR/globtest-out.XXXXXX)
+testdir=${common_objpfx}posix/globtest-dir
+testout=${common_objpfx}posix/globtest-out
+rm -rf $testdir $testout
+mkdir $testdir
trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
@@ -765,9 +761,9 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
`dir6/file1[ab]'
`nondir\/'
EOF
-${cross_test_wrapper} \
-env HOME="$testdir" \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${test_wrapper_env} \
+HOME="$testdir" \
+${run_via_rtld_prefix} \
${common_objpfx}posix/globtest -ct "$testdir" \
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
'~\/dir1/file1_2' |
diff --git a/libc/posix/tst-getconf.sh b/libc/posix/tst-getconf.sh
index a9a222b1e..701164b4a 100644
--- a/libc/posix/tst-getconf.sh
+++ b/libc/posix/tst-getconf.sh
@@ -20,21 +20,7 @@
set -e
common_objpfx=$1; shift
-elf_objpfx=$1; shift
-cross_test_wrapper=$1; shift
-if [ $# -eq 0 ]; then
- # Static case.
- runit() {
- ${cross_test_wrapper} \
- "$@"
- }
-else
- rtld_installed_name=$1; shift
- runit() {
- ${cross_test_wrapper} \
- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
- }
-fi
+run_getconf=$1; shift
logfile=$common_objpfx/posix/tst-getconf.out
@@ -48,10 +34,7 @@ rm -f $logfile
result=0
while read name; do
echo -n "getconf $name: " >> $logfile
- # Redirect input from /dev/null in case runit consumes input when it
- # shouldn't (ssh, say)
- runit ${common_objpfx}posix/getconf "$name" \
- < /dev/null 2>> $logfile >> $logfile
+ ${run_getconf} "$name" < /dev/null 2>> $logfile >> $logfile
if test $? -ne 0; then
echo "*** $name FAILED" >> $logfile
result=1
@@ -229,10 +212,7 @@ EOF
while read name; do
echo -n "getconf $name /: " >> $logfile
- # Redirect input from /dev/null in case runit consumes input when it
- # shouldn't (ssh, say)
- runit ${common_objpfx}posix/getconf "$name" / \
- < /dev/null 2>> $logfile >> $logfile
+ ${run_getconf} "$name" / < /dev/null 2>> $logfile >> $logfile
if test $? -ne 0; then
echo "*** $name FAILED" >> $logfile
result=1
diff --git a/libc/posix/wordexp-tst.sh b/libc/posix/wordexp-tst.sh
index 55116aa4a..f669195cb 100755
--- a/libc/posix/wordexp-tst.sh
+++ b/libc/posix/wordexp-tst.sh
@@ -24,13 +24,7 @@ set -e
# The others are just there to be parameters.
common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
-cross_test_wrapper=$1; shift
-
-run_program_prefix="${cross_test_wrapper} \
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx}"
-
+run_program_prefix=$1; shift
logfile=${common_objpfx}posix/wordexp-tst.out
testout=${common_objpfx}posix/wordexp-test-result
diff --git a/libc/resolv/Makefile b/libc/resolv/Makefile
index 7297408c0..2b2fcd656 100644
--- a/libc/resolv/Makefile
+++ b/libc/resolv/Makefile
@@ -111,17 +111,17 @@ $(objpfx)tst-leaks: $(objpfx)libresolv.so
tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
endif
-# eglibc: endif
+endif
tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
$(objpfx)mtrace-tst-leaks2: $(objpfx)tst-leaks2.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifneq (no,$(PERL))
xtests: $(objpfx)mtrace-tst-leaks2
endif
-# eglibc: endif
+endif
diff --git a/libc/rt/Makefile b/libc/rt/Makefile
index 9b9f59921..4805f8b5b 100644
--- a/libc/rt/Makefile
+++ b/libc/rt/Makefile
@@ -36,9 +36,12 @@ mq-routines := mq_open mq_close mq_unlink mq_getattr mq_setattr \
mq_notify mq_send mq_receive mq_timedsend \
mq_timedreceive
+routines = $(clock-routines)
+
librt-routines = $(aio-routines) \
- $(clock-routines) $(timer-routines) \
- $(shm-routines) $(mq-routines)
+ $(timer-routines) \
+ $(shm-routines) $(mq-routines) \
+ clock-compat
tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
@@ -77,4 +80,4 @@ ifeq (yes,$(build-bounded))
$(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library)
endif
-tst-mqueue7-ARGS = -- $(local-built-program-cmd)
+tst-mqueue7-ARGS = -- $(host-built-program-cmd)
diff --git a/libc/rt/Versions b/libc/rt/Versions
index 2921c9c8a..91e3fd2a2 100644
--- a/libc/rt/Versions
+++ b/libc/rt/Versions
@@ -1,3 +1,15 @@
+libc {
+ GLIBC_2.17 {
+ # c*
+ clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+ clock_nanosleep;
+ }
+ GLIBC_PRIVATE {
+ __clock_getres; __clock_gettime; __clock_settime; __clock_getcpuclockid;
+ __clock_nanosleep;
+ }
+}
+
librt {
GLIBC_2.1 {
# AIO functions.
@@ -6,7 +18,7 @@ librt {
aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
}
GLIBC_2.2 {
- # c*
+ # These have moved to libc and are still here only for compatibility.
clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
clock_nanosleep;
diff --git a/libc/rt/clock-compat.c b/libc/rt/clock-compat.c
new file mode 100644
index 000000000..16e410921
--- /dev/null
+++ b/libc/rt/clock-compat.c
@@ -0,0 +1,65 @@
+/* ABI compatibility redirects for clock_* symbols in librt.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+/* The clock_* symbols were originally defined in librt and so
+ are part of its ABI. As of 2.17, they have moved to libc.
+ So we supply definitions for librt that just redirect to
+ their libc counterparts. */
+
+#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
+
+#include <time.h>
+
+#ifdef HAVE_IFUNC
+# define COMPAT_REDIRECT(name, proto, arglist) \
+ __typeof (name) *name##_ifunc (void) asm (#name); \
+ __typeof (name) *name##_ifunc (void) \
+ { \
+ return &__##name; \
+ } \
+ asm (".type " #name ", %gnu_indirect_function");
+#else
+# define COMPAT_REDIRECT(name, proto, arglist) \
+ int \
+ name proto \
+ { \
+ return __##name arglist; \
+ }
+#endif
+
+COMPAT_REDIRECT (clock_getres,
+ (clockid_t clock_id, struct timespec *res),
+ (clock_id, res))
+COMPAT_REDIRECT (clock_gettime,
+ (clockid_t clock_id, struct timespec *tp),
+ (clock_id, tp))
+COMPAT_REDIRECT (clock_settime,
+ (clockid_t clock_id, const struct timespec *tp),
+ (clock_id, tp))
+COMPAT_REDIRECT (clock_getcpuclockid,
+ (pid_t pid, clockid_t *clock_id),
+ (pid, clock_id))
+COMPAT_REDIRECT (clock_nanosleep,
+ (clockid_t clock_id, int flags,
+ const struct timespec *req,
+ struct timespec *rem),
+ (clock_id, flags, req, rem))
+
+#endif
diff --git a/libc/rt/clock_getcpuclockid.c b/libc/rt/clock_getcpuclockid.c
index 08972f54f..4bead2568 100644
--- a/libc/rt/clock_getcpuclockid.c
+++ b/libc/rt/clock_getcpuclockid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Get a clockid_t for the process CPU clock of a given process. Generic.
+ Copyright (C) 2000-2012 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,3 +37,4 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
return ENOENT;
#endif
}
+strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
diff --git a/libc/rt/clock_getres.c b/libc/rt/clock_getres.c
index 576c9bf73..162c8a569 100644
--- a/libc/rt/clock_getres.c
+++ b/libc/rt/clock_getres.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Get the resolution of a clock. Stub version.
+ Copyright (C) 1999-2012 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,5 +26,6 @@ clock_getres (clockid_t clock_id, struct timespec *res)
__set_errno (ENOSYS);
return -1;
}
+strong_alias (clock_getres, __clock_getres)
stub_warning (clock_getres)
#include <stub-tag.h>
diff --git a/libc/rt/clock_gettime.c b/libc/rt/clock_gettime.c
index 1203f0117..5139e8724 100644
--- a/libc/rt/clock_gettime.c
+++ b/libc/rt/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2005 Free Software Foundation, Inc.
+/* Get the current value of a clock. Stub version.
+ Copyright (C) 1999-2012 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,6 +26,6 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
__set_errno (ENOSYS);
return -1;
}
-librt_hidden_def (clock_gettime)
+strong_alias (clock_gettime, __clock_gettime)
stub_warning (clock_gettime)
#include <stub-tag.h>
diff --git a/libc/rt/clock_nanosleep.c b/libc/rt/clock_nanosleep.c
index 0b16ad2d4..d9a0e92d4 100644
--- a/libc/rt/clock_nanosleep.c
+++ b/libc/rt/clock_nanosleep.c
@@ -33,5 +33,6 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
/* Not implemented. */
return ENOSYS;
}
+strong_alias (clock_nanosleep, __clock_nanosleep)
stub_warning (clock_nanosleep)
#include <stub-tag.h>
diff --git a/libc/rt/clock_settime.c b/libc/rt/clock_settime.c
index 3b3c3c48d..6f7cdd6ed 100644
--- a/libc/rt/clock_settime.c
+++ b/libc/rt/clock_settime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Set a clock to a given value. Stub version.
+ Copyright (C) 1999-2012 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,5 +26,6 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
__set_errno (ENOSYS);
return -1;
}
+strong_alias (clock_settime, __clock_settime)
stub_warning (clock_settime)
#include <stub-tag.h>
diff --git a/libc/scripts/run-with-env.sh b/libc/scripts/run-with-env.sh
deleted file mode 100755
index 0edffb5c3..000000000
--- a/libc/scripts/run-with-env.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-# Usage: run-with-env.sh CMD ...
-# Execute commands with environment variables set at the last minute.
-# For certain environment variable whose names are of the form
-# 'EGLIBC_TEST_foo', if they are set, we set an environment variable
-# 'foo' to their value.
-#
-# This lets us run test programs via wrappers with environment
-# variable settings that would otherwise interfere with the wrapper
-# itself, like LD_PRELOAD or LD_AUDIT.
-
-if [ "${EGLIBC_TEST_LD_PRELOAD+set}" ]; then
- export LD_PRELOAD="${EGLIBC_TEST_LD_PRELOAD}"
-fi
-
-if [ "${EGLIBC_TEST_LD_AUDIT+set}" ]; then
- export LD_AUDIT="${EGLIBC_TEST_LD_AUDIT}"
-fi
-
-if [ "${EGLIBC_TEST_LD_LIBRARY_PATH+set}" ]; then
- export LD_LIBRARY_PATH="${EGLIBC_TEST_LD_LIBRARY_PATH}"
-fi
-
-if [ "${EGLIBC_TEST_LD_TRACE_LOADED_OBJECTS+set}" ]; then
- export LD_TRACE_LOADED_OBJECTS="${EGLIBC_TEST_LD_TRACE_LOADED_OBJECTS}"
-fi
-
-if [ "${EGLIBC_TEST_LD_DEBUG+set}" ]; then
- export LD_DEBUG="${EGLIBC_TEST_LD_DEBUG}"
-fi
-
-exec "$@"
diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile
index 881eb9b2e..132d712dc 100644
--- a/libc/stdio-common/Makefile
+++ b/libc/stdio-common/Makefile
@@ -76,7 +76,7 @@ test-srcs = tst-unbputc tst-printf
include ../Rules
-# eglibc: ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
.PHONY: do-tst-unbputc do-tst-printf
tests: do-tst-unbputc do-tst-printf
@@ -87,7 +87,7 @@ $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
do-tst-printf: $(objpfx)tst-printf.out
$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
-# eglibc: endif
+endif
CFLAGS-vfprintf.c = -Wno-uninitialized
CFLAGS-vfwprintf.c = -Wno-uninitialized
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index a8eb60813..648a71015 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -134,11 +134,11 @@ bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
# Run a test on the header files we use.
tests: $(objpfx)isomac.out
-# eglibc: ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
ifeq (y,$(OPTION_EGLIBC_FMTMSG))
tests: $(objpfx)tst-fmtmsg.out
endif
-# eglibc: endif
+endif
$(objpfx)isomac.out: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' \
diff --git a/libc/string/Makefile b/libc/string/Makefile
index de3ce2734..ed059dcab 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -53,7 +53,7 @@ strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
strlen strncmp strncpy strpbrk strrchr strspn memmem \
strstr strcasestr strnlen strcasecmp strncasecmp \
- strncat rawmemchr strchrnul
+ strncat rawmemchr strchrnul bcopy bzero
tests := tester inl-tester noinl-tester testcopy test-ffs \
tst-strlen stratcliff tst-svc tst-inlcall \
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
@@ -64,6 +64,8 @@ tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-strxfrm bug-strcoll1
+tests-ifunc := $(strop-tests:%=test-%-ifunc)
+tests += $(tests-ifunc)
include ../Rules
@@ -83,10 +85,10 @@ CFLAGS-tst-inlcall.c = -fno-builtin
CFLAGS-bug-strstr1.c = -fno-builtin
CFLAGS-bug-strcasestr1.c = -fno-builtin
-# eglibc: ifeq ($(cross-compiling),no)
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-svc.out
$(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
$(built-program-cmd) < $(word 1,$^) > $@
@cmp tst-svc.expect $(objpfx)tst-svc.out
-# eglibc: endif
+endif
diff --git a/libc/string/memmem.c b/libc/string/memmem.c
index 625c9cffd..06704cbb7 100644
--- a/libc/string/memmem.c
+++ b/libc/string/memmem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2008 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -73,5 +73,6 @@ memmem (const void *haystack_start, size_t haystack_len,
else
return two_way_long_needle (haystack, haystack_len, needle, needle_len);
}
+libc_hidden_def (memmem)
#undef LONG_NEEDLE_THRESHOLD
diff --git a/libc/string/str-two-way.h b/libc/string/str-two-way.h
index d2572da40..d082fe0a0 100644
--- a/libc/string/str-two-way.h
+++ b/libc/string/str-two-way.h
@@ -309,13 +309,13 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
!= (haystack_char = CANON_ELEMENT (*phaystack++)))
{
RET0_IF_0 (haystack_char);
-#if CHECK_EOL
+#if !CHECK_EOL
++j;
#endif
continue;
}
-#if !CHECK_EOL
+#if CHECK_EOL
/* Calculate J if it wasn't kept up-to-date in the first-character
loop. */
j = phaystack - &haystack[suffix] - 1;
diff --git a/libc/string/test-bcopy-ifunc.c b/libc/string/test-bcopy-ifunc.c
new file mode 100644
index 000000000..21be43ccc
--- /dev/null
+++ b/libc/string/test-bcopy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of bcopy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-bcopy.c"
diff --git a/libc/string/test-bcopy.c b/libc/string/test-bcopy.c
new file mode 100644
index 000000000..bf9347bcc
--- /dev/null
+++ b/libc/string/test-bcopy.c
@@ -0,0 +1,20 @@
+/* Test and measure bcopy functions.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_BCOPY
+#include "test-memmove.c"
diff --git a/libc/string/test-bzero-ifunc.c b/libc/string/test-bzero-ifunc.c
new file mode 100644
index 000000000..0b3b45671
--- /dev/null
+++ b/libc/string/test-bzero-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of bzero function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-bzero.c"
diff --git a/libc/string/test-bzero.c b/libc/string/test-bzero.c
new file mode 100644
index 000000000..b59a7e49e
--- /dev/null
+++ b/libc/string/test-bzero.c
@@ -0,0 +1,19 @@
+/* Test and measure bzero functions.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+#define TEST_BZERO
+#include "test-memset.c"
diff --git a/libc/string/test-memccpy-ifunc.c b/libc/string/test-memccpy-ifunc.c
new file mode 100644
index 000000000..3efaeff36
--- /dev/null
+++ b/libc/string/test-memccpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memccpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memccpy.c"
diff --git a/libc/string/test-memccpy.c b/libc/string/test-memccpy.c
index 8fa96bc9b..05940ee2f 100644
--- a/libc/string/test-memccpy.c
+++ b/libc/string/test-memccpy.c
@@ -1,5 +1,5 @@
/* Test and measure memccpy functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "memccpy"
#include "test-string.h"
void *simple_memccpy (void *, const void *, int, size_t);
diff --git a/libc/string/test-memchr-ifunc.c b/libc/string/test-memchr-ifunc.c
new file mode 100644
index 000000000..e1e8b4434
--- /dev/null
+++ b/libc/string/test-memchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memchr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memchr.c"
diff --git a/libc/string/test-memchr.c b/libc/string/test-memchr.c
index 315726dc2..cad639b4a 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, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "memchr"
#include "test-string.h"
typedef char *(*proto_t) (const char *, int, size_t);
diff --git a/libc/string/test-memcmp-ifunc.c b/libc/string/test-memcmp-ifunc.c
new file mode 100644
index 000000000..6a8f41828
--- /dev/null
+++ b/libc/string/test-memcmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memcmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memcmp.c"
diff --git a/libc/string/test-memcmp.c b/libc/string/test-memcmp.c
index 69076d00b..fc9d4d232 100644
--- a/libc/string/test-memcmp.c
+++ b/libc/string/test-memcmp.c
@@ -19,6 +19,11 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifdef WIDE
+# define TEST_NAME "wmemcmp"
+#else
+# define TEST_NAME "memcmp"
+#endif
#include "test-string.h"
#ifdef WIDE
# include <inttypes.h>
diff --git a/libc/string/test-memcpy-ifunc.c b/libc/string/test-memcpy-ifunc.c
new file mode 100644
index 000000000..4195bba62
--- /dev/null
+++ b/libc/string/test-memcpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memcpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memcpy.c"
diff --git a/libc/string/test-memcpy.c b/libc/string/test-memcpy.c
index 311b4b498..1340c75c7 100644
--- a/libc/string/test-memcpy.c
+++ b/libc/string/test-memcpy.c
@@ -1,5 +1,5 @@
/* Test and measure memcpy functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -21,6 +21,7 @@
# define MEMCPY_RESULT(dst, len) dst
# define MIN_PAGE_SIZE 131072
# define TEST_MAIN
+# define TEST_NAME "memcpy"
# include "test-string.h"
char *simple_memcpy (char *, const char *, size_t);
diff --git a/libc/string/test-memmem-ifunc.c b/libc/string/test-memmem-ifunc.c
new file mode 100644
index 000000000..12c32d918
--- /dev/null
+++ b/libc/string/test-memmem-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memmem function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memmem.c"
diff --git a/libc/string/test-memmem.c b/libc/string/test-memmem.c
index 4076029d1..6ca1188e9 100644
--- a/libc/string/test-memmem.c
+++ b/libc/string/test-memmem.c
@@ -1,5 +1,5 @@
/* Test and measure memmem functions.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@redhat.com>, 2008.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "memmem"
#define BUF1PAGES 20
#define ITERATIONS 500
#include "test-string.h"
@@ -56,8 +57,8 @@ simple_memmem (const void *haystack, size_t haystack_len, const void *needle,
return NULL;
}
-static void
-do_one_test (impl_t *impl, const void *haystack, size_t haystack_len,
+static int
+check_result (impl_t *impl, const void *haystack, size_t haystack_len,
const void *needle, size_t needle_len, const void *expected)
{
void *res;
@@ -68,9 +69,20 @@ do_one_test (impl_t *impl, const void *haystack, size_t haystack_len,
error (0, 0, "Wrong result in function %s %p %p", impl->name,
res, expected);
ret = 1;
- return;
+ return -1;
}
+ return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const void *haystack, size_t haystack_len,
+ const void *needle, size_t needle_len, const void *expected)
+{
+ if (check_result (impl, haystack, haystack_len, needle, needle_len,
+ expected) < 0)
+ return;
+
if (HP_TIMING_AVAIL)
{
hp_timing_t start __attribute ((unused));
@@ -145,6 +157,22 @@ do_random_tests (void)
}
}
+static void
+check1 (void)
+{
+
+ const char search_buf_data[5] = { 0x56, 0x34, 0x12, 0x78, 0x78 };
+ const char pattern[2] = { 0x78, 0x56 };
+ void *search_buf = (void *) buf1 + page_size - sizeof search_buf_data;
+ void *exp_result;
+
+ memcpy (search_buf, search_buf_data, sizeof search_buf_data);
+ exp_result = simple_memmem (search_buf, sizeof search_buf_data,
+ pattern, sizeof pattern);
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, search_buf, sizeof search_buf_data,
+ pattern, sizeof pattern, exp_result);
+}
static const char *const strs[] =
{
@@ -161,6 +189,8 @@ test_main (void)
test_init ();
+ check1 ();
+
printf ("%23s", "");
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
diff --git a/libc/string/test-memmove-ifunc.c b/libc/string/test-memmove-ifunc.c
new file mode 100644
index 000000000..377cffd09
--- /dev/null
+++ b/libc/string/test-memmove-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memmove function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memmove.c"
diff --git a/libc/string/test-memmove.c b/libc/string/test-memmove.c
index 7d1071239..13c5aff8a 100644
--- a/libc/string/test-memmove.c
+++ b/libc/string/test-memmove.c
@@ -1,5 +1,5 @@
/* Test and measure memmove functions.
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,13 +18,33 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifdef TEST_BCOPY
+# define TEST_NAME "bcopy"
+#else
+# define TEST_NAME "memmove"
+#endif
#include "test-string.h"
-typedef char *(*proto_t) (char *, const char *, size_t);
char *simple_memmove (char *, const char *, size_t);
+#ifdef TEST_BCOPY
+typedef void (*proto_t) (const char *, char *, size_t);
+void simple_bcopy (const char *, char *, size_t);
+
+IMPL (simple_bcopy, 0)
+IMPL (bcopy, 1)
+
+void
+simple_bcopy (const char *src, char *dst, size_t n)
+{
+ simple_memmove (dst, src, n);
+}
+#else
+typedef char *(*proto_t) (char *, const char *, size_t);
+
IMPL (simple_memmove, 0)
IMPL (memmove, 1)
+#endif
char *
simple_memmove (char *dst, const char *src, size_t n)
@@ -47,9 +67,12 @@ static void
do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
size_t len)
{
+ memcpy (src, orig_src, len);
+#ifdef TEST_BCOPY
+ CALL (impl, src, dst, len);
+#else
char *res;
- memcpy (src, orig_src, len);
res = CALL (impl, dst, src, len);
if (res != dst)
{
@@ -58,6 +81,7 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
ret = 1;
return;
}
+#endif
if (memcmp (dst, orig_src, len) != 0)
{
@@ -77,7 +101,11 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
for (i = 0; i < 32; ++i)
{
HP_TIMING_NOW (start);
+#ifdef TEST_BCOPY
+ CALL (impl, src, dst, len);
+#else
CALL (impl, dst, src, len);
+#endif
HP_TIMING_NOW (stop);
HP_TIMING_BEST (best_time, start, stop);
}
@@ -123,7 +151,9 @@ do_random_tests (void)
size_t srcstart, srcend, dststart, dstend;
int c;
unsigned char *p1, *p2;
+#ifndef TEST_BCOPY
unsigned char *res;
+#endif
for (n = 0; n < ITERATIONS; n++)
{
@@ -178,6 +208,9 @@ do_random_tests (void)
{
memset (p2 + dststart, c, dstend - dststart);
memcpy (p2 + srcstart, p1 + srcstart, srcend - srcstart);
+#ifdef TEST_BCOPY
+ CALL (impl, (char *) (p2 + align1), (char *) (p2 + align2), len);
+#else
res = (unsigned char *) CALL (impl,
(char *) (p2 + align2),
(char *) (p2 + align1), len);
@@ -187,6 +220,7 @@ do_random_tests (void)
n, impl->name, align1, align2, len, res, p2 + align2);
ret = 1;
}
+#endif
if (memcmp (p1 + align1, p2 + align2, len))
{
error (0, 0, "Iteration %zd - different strings, %s (%zd, %zd, %zd)",
diff --git a/libc/string/test-mempcpy-ifunc.c b/libc/string/test-mempcpy-ifunc.c
new file mode 100644
index 000000000..956a23fef
--- /dev/null
+++ b/libc/string/test-mempcpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of mempcpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-mempcpy.c"
diff --git a/libc/string/test-mempcpy.c b/libc/string/test-mempcpy.c
index c021a6630..1679e9d11 100644
--- a/libc/string/test-mempcpy.c
+++ b/libc/string/test-mempcpy.c
@@ -1,5 +1,5 @@
/* Test and measure mempcpy functions.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -19,6 +19,7 @@
#define MEMCPY_RESULT(dst, len) (dst) + (len)
#define TEST_MAIN
+#define TEST_NAME "mempcpy"
#include "test-string.h"
char *simple_mempcpy (char *, const char *, size_t);
diff --git a/libc/string/test-memset-ifunc.c b/libc/string/test-memset-ifunc.c
new file mode 100644
index 000000000..3e26aa395
--- /dev/null
+++ b/libc/string/test-memset-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memset function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memset.c"
diff --git a/libc/string/test-memset.c b/libc/string/test-memset.c
index 839b8a180..af85a2876 100644
--- a/libc/string/test-memset.c
+++ b/libc/string/test-memset.c
@@ -1,5 +1,5 @@
/* Test and measure memset functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,11 +18,38 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifdef TEST_BZERO
+# define TEST_NAME "bzero"
+#else
+# define TEST_NAME "memset"
+#endif
#define MIN_PAGE_SIZE 131072
#include "test-string.h"
-typedef char *(*proto_t) (char *, int, size_t);
char *simple_memset (char *, int, size_t);
+
+#ifdef TEST_BZERO
+typedef void (*proto_t) (char *, size_t);
+void simple_bzero (char *, size_t);
+void builtin_bzero (char *, size_t);
+
+IMPL (simple_bzero, 0)
+IMPL (builtin_bzero, 0)
+IMPL (bzero, 1)
+
+void
+simple_bzero (char *s, size_t n)
+{
+ simple_memset (s, 0, n);
+}
+
+void
+builtin_bzero (char *s, size_t n)
+{
+ __builtin_bzero (s, n);
+}
+#else
+typedef char *(*proto_t) (char *, int, size_t);
char *builtin_memset (char *, int, size_t);
IMPL (simple_memset, 0)
@@ -30,6 +57,13 @@ IMPL (builtin_memset, 0)
IMPL (memset, 1)
char *
+builtin_memset (char *s, int c, size_t n)
+{
+ return __builtin_memset (s, c, n);
+}
+#endif
+
+char *
simple_memset (char *s, int c, size_t n)
{
char *r = s, *end = s + n;
@@ -38,20 +72,20 @@ simple_memset (char *s, int c, size_t n)
return s;
}
-char *
-builtin_memset (char *s, int c, size_t n)
-{
- return __builtin_memset (s, c, n);
-}
-
static void
-do_one_test (impl_t *impl, char *s, int c, size_t n)
+do_one_test (impl_t *impl, char *s, int c __attribute ((unused)), size_t n)
{
- char *res = CALL (impl, s, c, n);
char tstbuf[n];
+#ifdef TEST_BZERO
+ simple_bzero (tstbuf, n);
+ CALL (impl, s, n);
+ if (memcmp (s, tstbuf, n) != 0)
+#else
+ char *res = CALL (impl, s, c, n);
if (res != s
|| simple_memset (tstbuf, c, n) != tstbuf
|| memcmp (s, tstbuf, n) != 0)
+#endif
{
error (0, 0, "Wrong result in function %s", impl->name);
ret = 1;
@@ -68,7 +102,12 @@ do_one_test (impl_t *impl, char *s, int c, size_t n)
for (i = 0; i < 32; ++i)
{
HP_TIMING_NOW (start);
+#ifdef TEST_BZERO
+ CALL (impl, s, n);
+#else
CALL (impl, s, c, n);
+#endif
+
HP_TIMING_NOW (stop);
HP_TIMING_BEST (best_time, start, stop);
}
@@ -94,6 +133,7 @@ do_test (size_t align, int c, size_t len)
putchar ('\n');
}
+#ifndef TEST_BZERO
static void
do_random_tests (void)
{
@@ -178,12 +218,13 @@ do_random_tests (void)
}
}
}
+#endif
int
test_main (void)
{
size_t i;
- int c;
+ int c = 0;
test_init ();
@@ -192,7 +233,9 @@ test_main (void)
printf ("\t%s", impl->name);
putchar ('\n');
+#ifndef TEST_BZERO
for (c = -65; c <= 130; c += 65)
+#endif
{
for (i = 0; i < 18; ++i)
do_test (0, c, 1 << i);
@@ -208,7 +251,10 @@ test_main (void)
do_test (2, c, 25);
}
+#ifndef TEST_BZERO
do_random_tests ();
+#endif
+
return ret;
}
diff --git a/libc/string/test-rawmemchr-ifunc.c b/libc/string/test-rawmemchr-ifunc.c
new file mode 100644
index 000000000..61818173f
--- /dev/null
+++ b/libc/string/test-rawmemchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of rawmemchr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-rawmemchr.c"
diff --git a/libc/string/test-rawmemchr.c b/libc/string/test-rawmemchr.c
index c8000d68c..a3f2c1113 100644
--- a/libc/string/test-rawmemchr.c
+++ b/libc/string/test-rawmemchr.c
@@ -1,5 +1,5 @@
/* Test and measure memchr functions.
- Copyright (C) 1999,2002,2003,2005,2009,2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -20,6 +20,7 @@
#include <assert.h>
#define TEST_MAIN
+#define TEST_NAME "rawmemchr"
#include "test-string.h"
typedef char *(*proto_t) (const char *, int);
diff --git a/libc/string/test-stpcpy-ifunc.c b/libc/string/test-stpcpy-ifunc.c
new file mode 100644
index 000000000..071569990
--- /dev/null
+++ b/libc/string/test-stpcpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of stpcpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-stpcpy.c"
diff --git a/libc/string/test-stpcpy.c b/libc/string/test-stpcpy.c
index accc05c44..6a7af0cdc 100644
--- a/libc/string/test-stpcpy.c
+++ b/libc/string/test-stpcpy.c
@@ -1,5 +1,5 @@
/* Test and measure stpcpy functions.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -19,6 +19,7 @@
#define STRCPY_RESULT(dst, len) ((dst) + (len))
#define TEST_MAIN
+#define TEST_NAME "stpcpy"
#include "test-string.h"
char *simple_stpcpy (char *, const char *);
diff --git a/libc/string/test-stpncpy-ifunc.c b/libc/string/test-stpncpy-ifunc.c
new file mode 100644
index 000000000..f61c367bd
--- /dev/null
+++ b/libc/string/test-stpncpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of stpncpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-stpncpy.c"
diff --git a/libc/string/test-stpncpy.c b/libc/string/test-stpncpy.c
index 8fb6d799b..8647299f3 100644
--- a/libc/string/test-stpncpy.c
+++ b/libc/string/test-stpncpy.c
@@ -1,5 +1,5 @@
/* Test and measure stpncpy functions.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -19,6 +19,7 @@
#define STRNCPY_RESULT(dst, len, n) ((dst) + ((len) > (n) ? (n) : (len)))
#define TEST_MAIN
+#define TEST_NAME "stpncpy"
#include "test-string.h"
char *simple_stpncpy (char *, const char *, size_t);
diff --git a/libc/string/test-strcasecmp-ifunc.c b/libc/string/test-strcasecmp-ifunc.c
new file mode 100644
index 000000000..f260dc8e1
--- /dev/null
+++ b/libc/string/test-strcasecmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcasecmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcasecmp.c"
diff --git a/libc/string/test-strcasecmp.c b/libc/string/test-strcasecmp.c
index 039d9c1e3..202ac60ce 100644
--- a/libc/string/test-strcasecmp.c
+++ b/libc/string/test-strcasecmp.c
@@ -1,5 +1,5 @@
/* Test and measure strcasecmp functions.
- Copyright (C) 1999, 2002, 2003, 2005, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -19,6 +19,7 @@
#include <ctype.h>
#define TEST_MAIN
+#define TEST_NAME "strcasecmp"
#include "test-string.h"
typedef int (*proto_t) (const char *, const char *);
diff --git a/libc/string/test-strcasestr-ifunc.c b/libc/string/test-strcasestr-ifunc.c
new file mode 100644
index 000000000..ae0d1bdb2
--- /dev/null
+++ b/libc/string/test-strcasestr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcasestr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcasestr.c"
diff --git a/libc/string/test-strcasestr.c b/libc/string/test-strcasestr.c
index fc0185863..9a0f30c69 100644
--- a/libc/string/test-strcasestr.c
+++ b/libc/string/test-strcasestr.c
@@ -1,5 +1,5 @@
/* Test and measure strcasestr functions.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@redhat.com>, 2010.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strcasestr"
#include "test-string.h"
diff --git a/libc/string/test-strcat-ifunc.c b/libc/string/test-strcat-ifunc.c
new file mode 100644
index 000000000..cf71c67c5
--- /dev/null
+++ b/libc/string/test-strcat-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcat function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcat.c"
diff --git a/libc/string/test-strcat.c b/libc/string/test-strcat.c
index 7dcd7bc5b..2d90d52ef 100644
--- a/libc/string/test-strcat.c
+++ b/libc/string/test-strcat.c
@@ -1,5 +1,5 @@
/* Test and measure strcat functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strcat"
#include "test-string.h"
typedef char *(*proto_t) (char *, const char *);
diff --git a/libc/string/test-strchr-ifunc.c b/libc/string/test-strchr-ifunc.c
new file mode 100644
index 000000000..b97b29664
--- /dev/null
+++ b/libc/string/test-strchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strchr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strchr.c"
diff --git a/libc/string/test-strchr.c b/libc/string/test-strchr.c
index 161ac458c..1ed696666 100644
--- a/libc/string/test-strchr.c
+++ b/libc/string/test-strchr.c
@@ -1,5 +1,5 @@
/* Test and measure STRCHR functions.
- Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
Added wcschr support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
@@ -19,6 +19,15 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifndef WIDE
+# ifdef USE_FOR_STRCHRNUL
+# define TEST_NAME "strchrnul"
+# else
+# define TEST_NAME "strchr"
+# endif
+#else
+# define TEST_NAME "wcschr"
+#endif
#include "test-string.h"
#ifndef WIDE
diff --git a/libc/string/test-strchrnul-ifunc.c b/libc/string/test-strchrnul-ifunc.c
new file mode 100644
index 000000000..aacedb939
--- /dev/null
+++ b/libc/string/test-strchrnul-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strchrnul function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strchrnul.c"
diff --git a/libc/string/test-strcmp-ifunc.c b/libc/string/test-strcmp-ifunc.c
new file mode 100644
index 000000000..8cc1aad4a
--- /dev/null
+++ b/libc/string/test-strcmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcmp.c"
diff --git a/libc/string/test-strcmp.c b/libc/string/test-strcmp.c
index 000c51091..f186fd6cd 100644
--- a/libc/string/test-strcmp.c
+++ b/libc/string/test-strcmp.c
@@ -19,6 +19,11 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifdef WIDE
+# define TEST_NAME "wcscmp"
+#else
+# define TEST_NAME "strcmp"
+#endif
#include "test-string.h"
#ifdef WIDE
diff --git a/libc/string/test-strcpy-ifunc.c b/libc/string/test-strcpy-ifunc.c
new file mode 100644
index 000000000..b21a98b84
--- /dev/null
+++ b/libc/string/test-strcpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcpy.c"
diff --git a/libc/string/test-strcpy.c b/libc/string/test-strcpy.c
index 3a0b118af..de57c68ae 100644
--- a/libc/string/test-strcpy.c
+++ b/libc/string/test-strcpy.c
@@ -1,5 +1,5 @@
/* Test and measure strcpy functions.
- Copyright (C) 1999, 2002, 2003, 2005, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
Added wcscpy support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
@@ -42,6 +42,11 @@
#ifndef STRCPY_RESULT
# define STRCPY_RESULT(dst, len) dst
# define TEST_MAIN
+# ifndef WIDE
+# define TEST_NAME "strcpy"
+# else
+# define TEST_NAME "wcscpy"
+# endif
# include "test-string.h"
# ifndef WIDE
# define SIMPLE_STRCPY simple_strcpy
diff --git a/libc/string/test-strcspn-ifunc.c b/libc/string/test-strcspn-ifunc.c
new file mode 100644
index 000000000..380a371d6
--- /dev/null
+++ b/libc/string/test-strcspn-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strcspn function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strcspn.c"
diff --git a/libc/string/test-strcspn.c b/libc/string/test-strcspn.c
index d80947a10..e2863c783 100644
--- a/libc/string/test-strcspn.c
+++ b/libc/string/test-strcspn.c
@@ -1,5 +1,5 @@
/* Test and measure strcspn functions.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -20,6 +20,7 @@
#define STRPBRK_RESULT(s, pos) (pos)
#define RES_TYPE size_t
#define TEST_MAIN
+#define TEST_NAME "strcspn"
#include "test-string.h"
typedef size_t (*proto_t) (const char *, const char *);
diff --git a/libc/string/test-string.h b/libc/string/test-string.h
index c94d822b3..102702c5c 100644
--- a/libc/string/test-string.h
+++ b/libc/string/test-string.h
@@ -50,6 +50,7 @@ extern impl_t __start_impls[], __stop_impls[];
#include <error.h>
#include <errno.h>
#include <time.h>
+#include <ifunc-impl-list.h>
#define GL(x) _##x
#define GLRO(x) _##x
#include <hp-timing.h>
@@ -106,9 +107,57 @@ size_t iterations = 100000;
#define CALL(impl, ...) \
(* (proto_t) (impl)->fn) (__VA_ARGS__)
-#define FOR_EACH_IMPL(impl, notall) \
+#if defined TEST_IFUNC && defined TEST_NAME
+/* Increase size of FUNC_LIST if assert is triggered at run-time. */
+static struct libc_ifunc_impl func_list[32];
+static int func_count;
+static int impl_count = -1;
+static impl_t *impl_array;
+
+# define FOR_EACH_IMPL(impl, notall) \
+ impl_t *impl; \
+ int count; \
+ if (impl_count == -1) \
+ { \
+ impl_count = 0; \
+ if (func_count != 0) \
+ { \
+ int f; \
+ impl_t *skip = NULL, *a; \
+ for (impl = __start_impls; impl < __stop_impls; ++impl) \
+ if (strcmp (impl->name, TEST_NAME) == 0) \
+ skip = impl; \
+ else \
+ impl_count++; \
+ a = impl_array = malloc ((impl_count + func_count) * \
+ sizeof (impl_t)); \
+ for (impl = __start_impls; impl < __stop_impls; ++impl) \
+ if (impl != skip) \
+ *a++ = *impl; \
+ for (f = 0; f < func_count; f++) \
+ if (func_list[f].usable) \
+ { \
+ a->name = func_list[f].name; \
+ a->fn = func_list[f].fn; \
+ a->test = 1; \
+ a++; \
+ } \
+ impl_count = a - impl_array; \
+ } \
+ else \
+ { \
+ impl_count = __stop_impls - __start_impls; \
+ impl_array = __start_impls; \
+ } \
+ } \
+ impl = impl_array; \
+ for (count = 0; count < impl_count; ++count, ++impl) \
+ if (!notall || impl->test)
+#else
+# define FOR_EACH_IMPL(impl, notall) \
for (impl_t *impl = __start_impls; impl < __stop_impls; ++impl) \
if (!notall || impl->test)
+#endif
#define HP_TIMING_BEST(best_time, start, end) \
do \
@@ -127,6 +176,12 @@ size_t iterations = 100000;
static void
test_init (void)
{
+#if defined TEST_IFUNC && defined TEST_NAME
+ func_count = __libc_ifunc_impl_list (TEST_NAME, func_list,
+ (sizeof func_list
+ / sizeof func_list[0]));
+#endif
+
page_size = 2 * getpagesize ();
#ifdef MIN_PAGE_SIZE
if (page_size < MIN_PAGE_SIZE)
diff --git a/libc/string/test-strlen-ifunc.c b/libc/string/test-strlen-ifunc.c
new file mode 100644
index 000000000..4d87cc8f5
--- /dev/null
+++ b/libc/string/test-strlen-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strlen function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strlen.c"
diff --git a/libc/string/test-strlen.c b/libc/string/test-strlen.c
index 0ac5184bc..6be7e43d3 100644
--- a/libc/string/test-strlen.c
+++ b/libc/string/test-strlen.c
@@ -1,5 +1,5 @@
/* Test and measure STRLEN functions.
- Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
Added wcslen support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
@@ -19,6 +19,11 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifndef WIDE
+# define TEST_NAME "strlen"
+#else
+# define TEST_NAME "wcslen"
+#endif
#include "test-string.h"
#ifndef WIDE
diff --git a/libc/string/test-strncasecmp-ifunc.c b/libc/string/test-strncasecmp-ifunc.c
new file mode 100644
index 000000000..9bf05d09d
--- /dev/null
+++ b/libc/string/test-strncasecmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strncasecmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strncasecmp.c"
diff --git a/libc/string/test-strncasecmp.c b/libc/string/test-strncasecmp.c
index acfe668ca..95664f3a9 100644
--- a/libc/string/test-strncasecmp.c
+++ b/libc/string/test-strncasecmp.c
@@ -19,6 +19,7 @@
#include <ctype.h>
#define TEST_MAIN
+#define TEST_NAME "strncasecmp"
#include "test-string.h"
typedef int (*proto_t) (const char *, const char *, size_t);
diff --git a/libc/string/test-strncat-ifunc.c b/libc/string/test-strncat-ifunc.c
new file mode 100644
index 000000000..28e832fe0
--- /dev/null
+++ b/libc/string/test-strncat-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strncat function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strncat.c"
diff --git a/libc/string/test-strncat.c b/libc/string/test-strncat.c
index 69c8c0b21..0cdaa4f6a 100644
--- a/libc/string/test-strncat.c
+++ b/libc/string/test-strncat.c
@@ -1,5 +1,5 @@
/* Test and measure strncat functions.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strncat"
#include "test-string.h"
typedef char *(*proto_t) (char *, const char *, size_t);
diff --git a/libc/string/test-strncmp-ifunc.c b/libc/string/test-strncmp-ifunc.c
new file mode 100644
index 000000000..100a06837
--- /dev/null
+++ b/libc/string/test-strncmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strncmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strncmp.c"
diff --git a/libc/string/test-strncmp.c b/libc/string/test-strncmp.c
index 266781bc4..a66a12568 100644
--- a/libc/string/test-strncmp.c
+++ b/libc/string/test-strncmp.c
@@ -1,5 +1,5 @@
/* Test and measure strncmp functions.
- Copyright (C) 1999, 2002, 2003, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strncmp"
#include "test-string.h"
typedef int (*proto_t) (const char *, const char *, size_t);
diff --git a/libc/string/test-strncpy-ifunc.c b/libc/string/test-strncpy-ifunc.c
new file mode 100644
index 000000000..834291b00
--- /dev/null
+++ b/libc/string/test-strncpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strncpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strncpy.c"
diff --git a/libc/string/test-strncpy.c b/libc/string/test-strncpy.c
index f683f7d74..ba1050f34 100644
--- a/libc/string/test-strncpy.c
+++ b/libc/string/test-strncpy.c
@@ -1,5 +1,5 @@
/* Test and measure strncpy functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -20,6 +20,7 @@
#ifndef STRNCPY_RESULT
# define STRNCPY_RESULT(dst, len, n) dst
# define TEST_MAIN
+# define TEST_NAME "strncpy"
# include "test-string.h"
char *simple_strncpy (char *, const char *, size_t);
diff --git a/libc/string/test-strnlen-ifunc.c b/libc/string/test-strnlen-ifunc.c
new file mode 100644
index 000000000..3810de7d3
--- /dev/null
+++ b/libc/string/test-strnlen-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strnlen function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strnlen.c"
diff --git a/libc/string/test-strnlen.c b/libc/string/test-strnlen.c
index 547df45ad..17a2e22db 100644
--- a/libc/string/test-strnlen.c
+++ b/libc/string/test-strnlen.c
@@ -1,5 +1,5 @@
/* Test and measure strlen functions.
- Copyright (C) 1999, 2002, 2003, 2005, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strnlen"
#include "test-string.h"
typedef size_t (*proto_t) (const char *, size_t);
diff --git a/libc/string/test-strpbrk-ifunc.c b/libc/string/test-strpbrk-ifunc.c
new file mode 100644
index 000000000..896510ba6
--- /dev/null
+++ b/libc/string/test-strpbrk-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strpbrk function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strpbrk.c"
diff --git a/libc/string/test-strpbrk.c b/libc/string/test-strpbrk.c
index 263a7fdfb..8a3d2bb2a 100644
--- a/libc/string/test-strpbrk.c
+++ b/libc/string/test-strpbrk.c
@@ -1,5 +1,5 @@
/* Test and measure strpbrk functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -21,6 +21,7 @@
# define STRPBRK_RESULT(s, pos) ((s)[(pos)] ? (s) + (pos) : NULL)
# define RES_TYPE char *
# define TEST_MAIN
+# define TEST_NAME "strpbrk"
# include "test-string.h"
typedef char *(*proto_t) (const char *, const char *);
diff --git a/libc/string/test-strrchr-ifunc.c b/libc/string/test-strrchr-ifunc.c
new file mode 100644
index 000000000..77b1e69df
--- /dev/null
+++ b/libc/string/test-strrchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strrchr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strrchr.c"
diff --git a/libc/string/test-strrchr.c b/libc/string/test-strrchr.c
index c63c8dea6..a58435fd5 100644
--- a/libc/string/test-strrchr.c
+++ b/libc/string/test-strrchr.c
@@ -1,5 +1,5 @@
/* Test and measure STRCHR functions.
- Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
Added wcsrrchr support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>,
@@ -20,6 +20,11 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#ifdef WIDE
+# define TEST_NAME "wcsrchr"
+#else
+# define TEST_NAME "strrchr"
+#endif
#include "test-string.h"
#ifdef WIDE
diff --git a/libc/string/test-strspn-ifunc.c b/libc/string/test-strspn-ifunc.c
new file mode 100644
index 000000000..b836dfb0a
--- /dev/null
+++ b/libc/string/test-strspn-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strspn function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strspn.c"
diff --git a/libc/string/test-strspn.c b/libc/string/test-strspn.c
index 743bc0ae4..557db0af9 100644
--- a/libc/string/test-strspn.c
+++ b/libc/string/test-strspn.c
@@ -1,5 +1,5 @@
/* Test and measure strspn functions.
- Copyright (C) 1999,2002,2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strspn"
#include "test-string.h"
typedef size_t (*proto_t) (const char *, const char *);
diff --git a/libc/string/test-strstr-ifunc.c b/libc/string/test-strstr-ifunc.c
new file mode 100644
index 000000000..4d43dda3e
--- /dev/null
+++ b/libc/string/test-strstr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of strstr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-strstr.c"
diff --git a/libc/string/test-strstr.c b/libc/string/test-strstr.c
index d4c0efc5b..22a00f92b 100644
--- a/libc/string/test-strstr.c
+++ b/libc/string/test-strstr.c
@@ -1,5 +1,5 @@
/* Test and measure strstr functions.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@redhat.com>, 2010.
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
+#define TEST_NAME "strstr"
#include "test-string.h"
diff --git a/libc/sysdeps/generic/_G_config.h b/libc/sysdeps/generic/_G_config.h
index e4f276731..f44a3d4ee 100644
--- a/libc/sysdeps/generic/_G_config.h
+++ b/libc/sysdeps/generic/_G_config.h
@@ -49,11 +49,6 @@ typedef union
#define _G_IO_IO_FILE_VERSION 0x20001
-#define _G_OPEN64 __open64
-#define _G_LSEEK64 __lseek64
-#define _G_MMAP64 __mmap64
-#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
-
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
diff --git a/libc/sysdeps/generic/fips-private.h b/libc/sysdeps/generic/fips-private.h
new file mode 100644
index 000000000..0dff087c1
--- /dev/null
+++ b/libc/sysdeps/generic/fips-private.h
@@ -0,0 +1,36 @@
+/* Dummy implementation of FIPS compliance status test.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _FIPS_PRIVATE_H
+#define _FIPS_PRIVATE_H
+
+#include <stdbool.h>
+
+/* Return true if compliance with the FIPS security standards is
+ enabled.
+
+ This is only relevant within crypt, to tell whether MD5 and DES
+ algorithms should be rejected. */
+
+static inline bool
+fips_enabled_p (void)
+{
+ return false;
+}
+
+#endif /* _FIPS_PRIVATE_H */
diff --git a/libc/sysdeps/i386/i686/multiarch/bcopy.S b/libc/sysdeps/i386/i686/multiarch/bcopy.S
index 9db342468..b0744daf7 100644
--- a/libc/sysdeps/i386/i686/multiarch/bcopy.S
+++ b/libc/sysdeps/i386/i686/multiarch/bcopy.S
@@ -1,4 +1,5 @@
/* Multiple versions of bcopy
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -67,6 +68,8 @@ END(bcopy)
# define ENTRY(name) \
.type __bcopy_ia32, @function; \
.p2align 4; \
+ .globl __bcopy_ia32; \
+ .hidden __bcopy_ia32; \
__bcopy_ia32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/bzero.S b/libc/sysdeps/i386/i686/multiarch/bzero.S
index 86db169a8..150c24c04 100644
--- a/libc/sysdeps/i386/i686/multiarch/bzero.S
+++ b/libc/sysdeps/i386/i686/multiarch/bzero.S
@@ -1,4 +1,5 @@
/* Multiple versions of bzero
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -67,6 +68,8 @@ END(__bzero)
# define ENTRY(name) \
.type __bzero_ia32, @function; \
.p2align 4; \
+ .globl __bzero_ia32; \
+ .hidden __bzero_ia32; \
__bzero_ia32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/ifunc-impl-list.c b/libc/sysdeps/i386/i686/multiarch/ifunc-impl-list.c
new file mode 100644
index 000000000..005c286df
--- /dev/null
+++ b/libc/sysdeps/i386/i686/multiarch/ifunc-impl-list.c
@@ -0,0 +1,326 @@
+/* Enumerate available IFUNC implementations of a function. i686 version.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <string.h>
+#include <wchar.h>
+#include <ifunc-impl-list.h>
+#include "init-arch.h"
+
+/* Maximum number of IFUNC implementations. */
+#define MAX_IFUNC 3
+
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
+ NAME and return the number of valid entries. */
+
+size_t
+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ size_t max)
+{
+ assert (max >= MAX_IFUNC);
+
+ size_t i = 0;
+
+ /* Support sysdeps/i386/i686/multiarch/bcopy.S. */
+ IFUNC_IMPL (i, name, bcopy,
+ IFUNC_IMPL_ADD (array, i, bcopy, HAS_SSSE3,
+ __bcopy_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, bcopy, HAS_SSSE3, __bcopy_ssse3)
+ IFUNC_IMPL_ADD (array, i, bcopy, 1, __bcopy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/bzero.S. */
+ IFUNC_IMPL (i, name, bzero,
+ IFUNC_IMPL_ADD (array, i, bzero, HAS_SSE2, __bzero_sse2_rep)
+ IFUNC_IMPL_ADD (array, i, bzero, HAS_SSE2, __bzero_sse2)
+ IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memchr.S. */
+ IFUNC_IMPL (i, name, memchr,
+ IFUNC_IMPL_ADD (array, i, memchr, HAS_SSE2,
+ __memchr_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, memchr, HAS_SSE2, __memchr_sse2)
+ IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memcmp.S. */
+ IFUNC_IMPL (i, name, memcmp,
+ IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSE4_2,
+ __memcmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSSE3, __memcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memmove_chk.S. */
+ IFUNC_IMPL (i, name, __memmove_chk,
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
+ __memmove_chk_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
+ __memmove_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
+ __memmove_chk_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memmove.S. */
+ IFUNC_IMPL (i, name, memmove,
+ IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
+ __memmove_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
+ __memmove_ssse3)
+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memrchr.S. */
+ IFUNC_IMPL (i, name, memrchr,
+ IFUNC_IMPL_ADD (array, i, memrchr, HAS_SSE2,
+ __memrchr_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, memrchr, HAS_SSE2, __memrchr_sse2)
+ IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memset_chk.S. */
+ IFUNC_IMPL (i, name, __memset_chk,
+ IFUNC_IMPL_ADD (array, i, __memset_chk, HAS_SSE2,
+ __memset_chk_sse2_rep)
+ IFUNC_IMPL_ADD (array, i, __memset_chk, HAS_SSE2,
+ __memset_chk_sse2)
+ IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
+ __memset_chk_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memset.S. */
+ IFUNC_IMPL (i, name, memset,
+ IFUNC_IMPL_ADD (array, i, memset, HAS_SSE2,
+ __memset_sse2_rep)
+ IFUNC_IMPL_ADD (array, i, memset, HAS_SSE2, __memset_sse2)
+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/rawmemchr.S. */
+ IFUNC_IMPL (i, name, rawmemchr,
+ IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_SSE2,
+ __rawmemchr_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_SSE2,
+ __rawmemchr_sse2)
+ IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/stpncpy.S. */
+ IFUNC_IMPL (i, name, stpncpy,
+ IFUNC_IMPL_ADD (array, i, stpncpy, HAS_SSSE3,
+ __stpncpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, stpncpy, HAS_SSE2, __stpncpy_sse2)
+ IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/stpcpy.S. */
+ IFUNC_IMPL (i, name, stpcpy,
+ IFUNC_IMPL_ADD (array, i, stpcpy, HAS_SSSE3, __stpcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, stpcpy, HAS_SSE2, __stpcpy_sse2)
+ IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcasecmp.S. */
+ IFUNC_IMPL (i, name, strcasecmp,
+ IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSE4_2,
+ __strcasecmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSSE3,
+ __strcasecmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcasecmp_l.S. */
+ IFUNC_IMPL (i, name, strcasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSE4_2,
+ __strcasecmp_l_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSSE3,
+ __strcasecmp_l_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
+ __strcasecmp_l_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcasestr.c. */
+ IFUNC_IMPL (i, name, strcasestr,
+ IFUNC_IMPL_ADD (array, i, strcasestr, HAS_SSE4_2,
+ __strcasestr_sse42)
+ IFUNC_IMPL_ADD (array, i, strcasestr, 1, __strcasestr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcat.S. */
+ IFUNC_IMPL (i, name, strcat,
+ IFUNC_IMPL_ADD (array, i, strcat, HAS_SSSE3, __strcat_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcat, HAS_SSE2, __strcat_sse2)
+ IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strchr.S. */
+ IFUNC_IMPL (i, name, strchr,
+ IFUNC_IMPL_ADD (array, i, strchr, HAS_SSE2,
+ __strchr_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, strchr, HAS_SSE2, __strchr_sse2)
+ IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcmp.S. */
+ IFUNC_IMPL (i, name, strcmp,
+ IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSE4_2,
+ __strcmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSSE3, __strcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcpy.S. */
+ IFUNC_IMPL (i, name, strcpy,
+ IFUNC_IMPL_ADD (array, i, strcpy, HAS_SSSE3, __strcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcpy, HAS_SSE2, __strcpy_sse2)
+ IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strcspn.S. */
+ IFUNC_IMPL (i, name, strcspn,
+ IFUNC_IMPL_ADD (array, i, strcspn, HAS_SSE4_2,
+ __strcspn_sse42)
+ IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strncase.S. */
+ IFUNC_IMPL (i, name, strncasecmp,
+ IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSE4_2,
+ __strncasecmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSSE3,
+ __strncasecmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
+ __strncasecmp_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strncase_l.S. */
+ IFUNC_IMPL (i, name, strncasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l,
+ HAS_SSE4_2, __strncasecmp_l_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l,
+ HAS_SSSE3, __strncasecmp_l_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
+ __strncasecmp_l_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strncat.S. */
+ IFUNC_IMPL (i, name, strncat,
+ IFUNC_IMPL_ADD (array, i, strncat, HAS_SSSE3,
+ __strncat_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncat, HAS_SSE2, __strncat_sse2)
+ IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strncpy.S. */
+ IFUNC_IMPL (i, name, strncpy,
+ IFUNC_IMPL_ADD (array, i, strncpy, HAS_SSSE3,
+ __strncpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncpy, HAS_SSE2, __strncpy_sse2)
+ IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strnlen.S. */
+ IFUNC_IMPL (i, name, strnlen,
+ IFUNC_IMPL_ADD (array, i, strnlen, HAS_SSE2, __strnlen_sse2)
+ IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strpbrk.S. */
+ IFUNC_IMPL (i, name, strpbrk,
+ IFUNC_IMPL_ADD (array, i, strpbrk, HAS_SSE4_2,
+ __strpbrk_sse42)
+ IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strrchr.S. */
+ IFUNC_IMPL (i, name, strrchr,
+ IFUNC_IMPL_ADD (array, i, strrchr, HAS_SSE2,
+ __strrchr_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, strrchr, HAS_SSE2, __strrchr_sse2)
+ IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strspn.S. */
+ IFUNC_IMPL (i, name, strspn,
+ IFUNC_IMPL_ADD (array, i, strspn, HAS_SSE4_2, __strspn_sse42)
+ IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strstr-c.c. */
+ IFUNC_IMPL (i, name, strstr,
+ IFUNC_IMPL_ADD (array, i, strstr, HAS_SSE4_2, __strstr_sse42)
+ IFUNC_IMPL_ADD (array, i, strstr, 1, __strstr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wcschr.S. */
+ IFUNC_IMPL (i, name, wcschr,
+ IFUNC_IMPL_ADD (array, i, wcschr, HAS_SSE2, __wcschr_sse2)
+ IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wcscmp.S. */
+ IFUNC_IMPL (i, name, wcscmp,
+ IFUNC_IMPL_ADD (array, i, wcscmp, HAS_SSE2, __wcscmp_sse2)
+ IFUNC_IMPL_ADD (array, i, wcscmp, 1, __wcscmp_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wcscpy.S. */
+ IFUNC_IMPL (i, name, wcscpy,
+ IFUNC_IMPL_ADD (array, i, wcscpy, HAS_SSSE3, __wcscpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wcslen.S. */
+ IFUNC_IMPL (i, name, wcslen,
+ IFUNC_IMPL_ADD (array, i, wcslen, HAS_SSE2, __wcslen_sse2)
+ IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wcsrchr.S. */
+ IFUNC_IMPL (i, name, wcsrchr,
+ IFUNC_IMPL_ADD (array, i, wcsrchr, HAS_SSE2, __wcsrchr_sse2)
+ IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/wmemcmp.S. */
+ IFUNC_IMPL (i, name, wmemcmp,
+ IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSE4_2,
+ __wmemcmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSSE3,
+ __wmemcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32))
+
+#ifdef SHARED
+ /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S. */
+ IFUNC_IMPL (i, name, __memcpy_chk,
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
+ __memcpy_chk_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
+ __memcpy_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
+ __memcpy_chk_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/memcpy.S. */
+ IFUNC_IMPL (i, name, memcpy,
+ IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3,
+ __memcpy_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3, __memcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/mempcpy_chk.S. */
+ IFUNC_IMPL (i, name, __mempcpy_chk,
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
+ __mempcpy_chk_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
+ __mempcpy_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
+ __mempcpy_chk_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/mempcpy.S. */
+ IFUNC_IMPL (i, name, mempcpy,
+ IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
+ __mempcpy_ssse3_rep)
+ IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
+ __mempcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strlen.S. */
+ IFUNC_IMPL (i, name, strlen,
+ IFUNC_IMPL_ADD (array, i, strlen, HAS_SSE2,
+ __strlen_sse2_bsf)
+ IFUNC_IMPL_ADD (array, i, strlen, HAS_SSE2, __strlen_sse2)
+ IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))
+
+ /* Support sysdeps/i386/i686/multiarch/strncmp.S. */
+ IFUNC_IMPL (i, name, strncmp,
+ IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSE4_2,
+ __strncmp_sse4_2)
+ IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSSE3,
+ __strncmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ia32))
+#endif
+
+ return i;
+}
diff --git a/libc/sysdeps/i386/i686/multiarch/memchr.S b/libc/sysdeps/i386/i686/multiarch/memchr.S
index 2cf45426a..8b0344b96 100644
--- a/libc/sysdeps/i386/i686/multiarch/memchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/memchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of memchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/memcmp.S b/libc/sysdeps/i386/i686/multiarch/memcmp.S
index d8076b927..7b9c1c4d1 100644
--- a/libc/sysdeps/i386/i686/multiarch/memcmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/memcmp.S
@@ -1,4 +1,5 @@
/* Multiple versions of memcmp
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -67,6 +68,8 @@ END(memcmp)
# define ENTRY(name) \
.type __memcmp_ia32, @function; \
.p2align 4; \
+ .globl __memcmp_ia32; \
+ .hidden __memcmp_ia32; \
__memcmp_ia32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy.S b/libc/sysdeps/i386/i686/multiarch/memcpy.S
index 558c04ff3..0d4a101b9 100644
--- a/libc/sysdeps/i386/i686/multiarch/memcpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy.S
@@ -1,4 +1,5 @@
/* Multiple versions of memcpy
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -51,6 +52,8 @@ END(memcpy)
# define ENTRY(name) \
.type __memcpy_ia32, @function; \
.p2align 4; \
+ .globl __memcpy_ia32; \
+ .hidden __memcpy_ia32; \
__memcpy_ia32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S b/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S
index 40deada68..d9d7e1f95 100644
--- a/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S
+++ b/libc/sysdeps/i386/i686/multiarch/memcpy_chk.S
@@ -1,4 +1,5 @@
/* Multiple versions of __memcpy_chk
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove.S b/libc/sysdeps/i386/i686/multiarch/memmove.S
index b8892c065..b692f47f7 100644
--- a/libc/sysdeps/i386/i686/multiarch/memmove.S
+++ b/libc/sysdeps/i386/i686/multiarch/memmove.S
@@ -1,4 +1,5 @@
/* Multiple versions of memmove
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -50,6 +51,8 @@ END(memmove)
# define ENTRY(name) \
.type __memmove_ia32, @function; \
.p2align 4; \
+ .globl __memmove_ia32; \
+ .hidden __memmove_ia32; \
__memmove_ia32: cfi_startproc; \
CALL_MCOUNT
# else
diff --git a/libc/sysdeps/i386/i686/multiarch/memmove_chk.S b/libc/sysdeps/i386/i686/multiarch/memmove_chk.S
index 8139cd96b..20dc3e3a8 100644
--- a/libc/sysdeps/i386/i686/multiarch/memmove_chk.S
+++ b/libc/sysdeps/i386/i686/multiarch/memmove_chk.S
@@ -1,4 +1,5 @@
/* Multiple versions of __memmove_chk
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy.S b/libc/sysdeps/i386/i686/multiarch/mempcpy.S
index 95bda4635..500e6e72e 100644
--- a/libc/sysdeps/i386/i686/multiarch/mempcpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy.S
@@ -1,4 +1,5 @@
/* Multiple versions of mempcpy
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -51,6 +52,8 @@ END(__mempcpy)
# define ENTRY(name) \
.type __mempcpy_ia32, @function; \
.p2align 4; \
+ .globl __mempcpy_ia32; \
+ .hidden __mempcpy_ia32; \
__mempcpy_ia32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S b/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S
index e491f9429..12f34532a 100644
--- a/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S
+++ b/libc/sysdeps/i386/i686/multiarch/mempcpy_chk.S
@@ -1,4 +1,5 @@
/* Multiple versions of __mempcpy_chk
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/memrchr.S b/libc/sysdeps/i386/i686/multiarch/memrchr.S
index 762489d77..f94862b3e 100644
--- a/libc/sysdeps/i386/i686/multiarch/memrchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/memrchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of memrchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/memset.S b/libc/sysdeps/i386/i686/multiarch/memset.S
index 887834024..65745d4a2 100644
--- a/libc/sysdeps/i386/i686/multiarch/memset.S
+++ b/libc/sysdeps/i386/i686/multiarch/memset.S
@@ -1,4 +1,5 @@
/* Multiple versions of memset
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/memset_chk.S b/libc/sysdeps/i386/i686/multiarch/memset_chk.S
index 02649df19..d499b8c52 100644
--- a/libc/sysdeps/i386/i686/multiarch/memset_chk.S
+++ b/libc/sysdeps/i386/i686/multiarch/memset_chk.S
@@ -1,4 +1,5 @@
/* Multiple versions of __memset_chk
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/rawmemchr.S b/libc/sysdeps/i386/i686/multiarch/rawmemchr.S
index 5bea20bdc..f2af368f2 100644
--- a/libc/sysdeps/i386/i686/multiarch/rawmemchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/rawmemchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of rawmemchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/stpcpy.S b/libc/sysdeps/i386/i686/multiarch/stpcpy.S
index b63d308ed..ee81ab6ae 100644
--- a/libc/sysdeps/i386/i686/multiarch/stpcpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/stpcpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of stpcpy
+ All versions must be listed in ifunc-impl-list.c. */
#define USE_AS_STPCPY
#define STRCPY __stpcpy
#include "strcpy.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/stpncpy.S b/libc/sysdeps/i386/i686/multiarch/stpncpy.S
index ff89a8949..2698ca6a8 100644
--- a/libc/sysdeps/i386/i686/multiarch/stpncpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/stpncpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of stpncpy
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCPY __stpncpy
#define USE_AS_STPCPY
#define USE_AS_STRNCPY
diff --git a/libc/sysdeps/i386/i686/multiarch/strcasecmp.S b/libc/sysdeps/i386/i686/multiarch/strcasecmp.S
index fbd2de398..cf83e6e97 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcasecmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcasecmp.S
@@ -1,4 +1,5 @@
/* Entry point for multi-version x86 strcasecmp.
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strcasecmp_l.S b/libc/sysdeps/i386/i686/multiarch/strcasecmp_l.S
index 1322bd86d..711c09b0d 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcasecmp_l.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcasecmp_l.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strcasecmp_l
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCMP __strcasecmp_l
#define USE_AS_STRCASECMP_L
#include "strcmp.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strcasestr-c.c b/libc/sysdeps/i386/i686/multiarch/strcasestr-c.c
index 0d52b0e47..c1d6dac1d 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcasestr-c.c
+++ b/libc/sysdeps/i386/i686/multiarch/strcasestr-c.c
@@ -1,2 +1,4 @@
+/* Multiple versions of strcasestr
+ All versions must be listed in ifunc-impl-list.c. */
#define __strcasestr_sse2 __strcasestr_ia32
#include <sysdeps/x86_64/multiarch/strcasestr-c.c>
diff --git a/libc/sysdeps/i386/i686/multiarch/strcat.S b/libc/sysdeps/i386/i686/multiarch/strcat.S
index e68fecafb..a7d322421 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcat.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcat.S
@@ -1,4 +1,5 @@
/* Multiple versions of strcat
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -94,6 +95,8 @@ END(STRCAT)
# define ENTRY(name) \
.type STRCAT_IA32, @function; \
.align 16; \
+ .globl STRCAT_IA32; \
+ .hidden STRCAT_IA32; \
STRCAT_IA32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/strchr.S b/libc/sysdeps/i386/i686/multiarch/strchr.S
index e236d607c..c6205daf5 100644
--- a/libc/sysdeps/i386/i686/multiarch/strchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/strchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of strchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strcmp.S b/libc/sysdeps/i386/i686/multiarch/strcmp.S
index b3b9eb87b..76ac1f8eb 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcmp.S
@@ -1,4 +1,5 @@
/* Multiple versions of strcmp
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -95,6 +96,8 @@ END(STRCMP)
# define ENTRY(name) \
.type __STRCMP_IA32, @function; \
.p2align 4; \
+ .globl __STRCMP_IA32; \
+ .hidden __STRCMP_IA32; \
__STRCMP_IA32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/strcpy.S b/libc/sysdeps/i386/i686/multiarch/strcpy.S
index 71eee768a..44fa6d218 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcpy.S
@@ -1,4 +1,5 @@
/* Multiple versions of strcpy
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -110,6 +111,8 @@ END(STRCPY)
# define ENTRY(name) \
.type STRCPY_IA32, @function; \
.align 16; \
+ .globl STRCPY_IA32; \
+ .hidden STRCPY_IA32; \
STRCPY_IA32: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/i386/i686/multiarch/strcspn.S b/libc/sysdeps/i386/i686/multiarch/strcspn.S
index 8a00a020a..84954306a 100644
--- a/libc/sysdeps/i386/i686/multiarch/strcspn.S
+++ b/libc/sysdeps/i386/i686/multiarch/strcspn.S
@@ -1,4 +1,5 @@
/* Multiple versions of strcspn
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2009, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strlen.S b/libc/sysdeps/i386/i686/multiarch/strlen.S
index 310765cb0..c1d8b6c32 100644
--- a/libc/sysdeps/i386/i686/multiarch/strlen.S
+++ b/libc/sysdeps/i386/i686/multiarch/strlen.S
@@ -1,4 +1,5 @@
/* Multiple versions of strlen
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strncase.S b/libc/sysdeps/i386/i686/multiarch/strncase.S
index 37fccb85e..ca5f86319 100644
--- a/libc/sysdeps/i386/i686/multiarch/strncase.S
+++ b/libc/sysdeps/i386/i686/multiarch/strncase.S
@@ -1,4 +1,5 @@
/* Entry point for multi-version x86 strncasecmp.
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strncase_l.S b/libc/sysdeps/i386/i686/multiarch/strncase_l.S
index a808c8cd7..8a74ee857 100644
--- a/libc/sysdeps/i386/i686/multiarch/strncase_l.S
+++ b/libc/sysdeps/i386/i686/multiarch/strncase_l.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncasecmp_l
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCMP __strncasecmp_l
#define USE_AS_STRNCASECMP_L
#include "strcmp.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strncat.S b/libc/sysdeps/i386/i686/multiarch/strncat.S
index fd569c223..5c1bf4145 100644
--- a/libc/sysdeps/i386/i686/multiarch/strncat.S
+++ b/libc/sysdeps/i386/i686/multiarch/strncat.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncat
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCAT strncat
#define USE_AS_STRNCAT
#include "strcat.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strncmp.S b/libc/sysdeps/i386/i686/multiarch/strncmp.S
index b6814315f..150d4786d 100644
--- a/libc/sysdeps/i386/i686/multiarch/strncmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/strncmp.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncmp
+ All versions must be listed in ifunc-impl-list.c. */
#define USE_AS_STRNCMP
#define STRCMP strncmp
#include "strcmp.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strncpy.S b/libc/sysdeps/i386/i686/multiarch/strncpy.S
index 30a5bd2f9..9c257efc6 100644
--- a/libc/sysdeps/i386/i686/multiarch/strncpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/strncpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncpy
+ All versions must be listed in ifunc-impl-list.c. */
#define USE_AS_STRNCPY
#define STRCPY strncpy
#include "strcpy.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strnlen.S b/libc/sysdeps/i386/i686/multiarch/strnlen.S
index 44ad0b357..b82052e96 100644
--- a/libc/sysdeps/i386/i686/multiarch/strnlen.S
+++ b/libc/sysdeps/i386/i686/multiarch/strnlen.S
@@ -1,4 +1,5 @@
/* Multiple versions of strnlen
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strpbrk.S b/libc/sysdeps/i386/i686/multiarch/strpbrk.S
index ed5bca6a9..7201d6376 100644
--- a/libc/sysdeps/i386/i686/multiarch/strpbrk.S
+++ b/libc/sysdeps/i386/i686/multiarch/strpbrk.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strpbrk
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCSPN strpbrk
#define USE_AS_STRPBRK
#include "strcspn.S"
diff --git a/libc/sysdeps/i386/i686/multiarch/strrchr.S b/libc/sysdeps/i386/i686/multiarch/strrchr.S
index f851b7781..37468f124 100644
--- a/libc/sysdeps/i386/i686/multiarch/strrchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/strrchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of strrchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strspn.S b/libc/sysdeps/i386/i686/multiarch/strspn.S
index 8170f9cb8..f90df63ef 100644
--- a/libc/sysdeps/i386/i686/multiarch/strspn.S
+++ b/libc/sysdeps/i386/i686/multiarch/strspn.S
@@ -1,4 +1,5 @@
/* Multiple versions of strspn
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2009,2010,2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/strstr-c.c b/libc/sysdeps/i386/i686/multiarch/strstr-c.c
index 17c75c5f0..7516c7ffe 100644
--- a/libc/sysdeps/i386/i686/multiarch/strstr-c.c
+++ b/libc/sysdeps/i386/i686/multiarch/strstr-c.c
@@ -1,3 +1,6 @@
+/* Multiple versions of strstr
+ All versions must be listed in ifunc-impl-list.c. */
+
#include "init-arch.h"
#define STRSTR __strstr_ia32
diff --git a/libc/sysdeps/i386/i686/multiarch/wcschr.S b/libc/sysdeps/i386/i686/multiarch/wcschr.S
index 34ea47df6..03fe3ca36 100644
--- a/libc/sysdeps/i386/i686/multiarch/wcschr.S
+++ b/libc/sysdeps/i386/i686/multiarch/wcschr.S
@@ -1,4 +1,5 @@
/* Multiple versions of wcschr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/wcscmp.S b/libc/sysdeps/i386/i686/multiarch/wcscmp.S
index d45847601..e23ba05ac 100644
--- a/libc/sysdeps/i386/i686/multiarch/wcscmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/wcscmp.S
@@ -1,4 +1,5 @@
/* Multiple versions of wcscmp
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/wcscpy.S b/libc/sysdeps/i386/i686/multiarch/wcscpy.S
index 8c3ba1d28..6eea48a66 100644
--- a/libc/sysdeps/i386/i686/multiarch/wcscpy.S
+++ b/libc/sysdeps/i386/i686/multiarch/wcscpy.S
@@ -1,4 +1,5 @@
/* Multiple versions of wcscpy
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/wcslen.S b/libc/sysdeps/i386/i686/multiarch/wcslen.S
index f8b2fab90..cdae51693 100644
--- a/libc/sysdeps/i386/i686/multiarch/wcslen.S
+++ b/libc/sysdeps/i386/i686/multiarch/wcslen.S
@@ -1,4 +1,5 @@
/* Multiple versions of wcslen
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/wcsrchr.S b/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
index ec550b082..f4b0618c2 100644
--- a/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
+++ b/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
@@ -1,4 +1,5 @@
/* Multiple versions of wcsrchr
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/i386/i686/multiarch/wmemcmp.S b/libc/sysdeps/i386/i686/multiarch/wmemcmp.S
index 61d55cd2f..7c485f731 100644
--- a/libc/sysdeps/i386/i686/multiarch/wmemcmp.S
+++ b/libc/sysdeps/i386/i686/multiarch/wmemcmp.S
@@ -1,4 +1,5 @@
/* Multiple versions of wmemcmp
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/posix/clock_getres.c b/libc/sysdeps/posix/clock_getres.c
index 938877e93..678257b3a 100644
--- a/libc/sysdeps/posix/clock_getres.c
+++ b/libc/sysdeps/posix/clock_getres.c
@@ -1,5 +1,5 @@
/* clock_getres -- Get the resolution of a POSIX clockid_t.
- Copyright (C) 1999,2000,2001,2003,2004,2008 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 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
@@ -115,3 +115,4 @@ clock_getres (clockid_t clock_id, struct timespec *res)
return retval;
}
+strong_alias (clock_getres, __clock_getres)
diff --git a/libc/sysdeps/posix/opendir.c b/libc/sysdeps/posix/opendir.c
index e093142f6..f1cc1aeb5 100644
--- a/libc/sysdeps/posix/opendir.c
+++ b/libc/sysdeps/posix/opendir.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991-1996,98,2000-2003,2005,2007,2009,2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +32,11 @@
#include <not-cancel.h>
#include <kernel-features.h>
+/* The st_blksize value of the directory is used as a hint for the
+ size of the buffer which receives struct dirent values from the
+ kernel. st_blksize is limited to MAX_DIR_BUFFER_SIZE, in case the
+ file system provides a bogus value. */
+#define MAX_DIR_BUFFER_SIZE 1048576U
/* opendir() must not accidentally open something other than a directory.
Some OS's have kernel support for that, some don't. In the worst
@@ -192,8 +196,11 @@ __alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
? sizeof (struct dirent64) : BUFSIZ);
size_t allocation = default_allocation;
#ifdef _STATBUF_ST_BLKSIZE
- if (statp != NULL && default_allocation < statp->st_blksize)
- allocation = statp->st_blksize;
+ /* Increase allocation if requested, but not if the value appears to
+ be bogus. */
+ if (statp != NULL)
+ allocation = MIN (MAX ((size_t) statp->st_blksize, default_allocation),
+ MAX_DIR_BUFFER_SIZE);
#endif
DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
diff --git a/libc/sysdeps/unix/clock_gettime.c b/libc/sysdeps/unix/clock_gettime.c
index db6643a1c..c9a91e337 100644
--- a/libc/sysdeps/unix/clock_gettime.c
+++ b/libc/sysdeps/unix/clock_gettime.c
@@ -1,5 +1,5 @@
/* clock_gettime -- Get the current time from a POSIX clockid_t. Unix version.
- Copyright (C) 1999-2004, 2005, 2007, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 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
@@ -132,4 +132,4 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
return retval;
}
-librt_hidden_def (clock_gettime)
+strong_alias (clock_gettime, __clock_gettime)
diff --git a/libc/sysdeps/unix/clock_nanosleep.c b/libc/sysdeps/unix/clock_nanosleep.c
index 1b4399655..c39f6a79c 100644
--- a/libc/sysdeps/unix/clock_nanosleep.c
+++ b/libc/sysdeps/unix/clock_nanosleep.c
@@ -1,5 +1,5 @@
/* High-resolution sleep with the specified clock.
- Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 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
@@ -98,3 +98,4 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
return __builtin_expect (nanosleep (req, rem), 0) ? errno : 0;
}
+strong_alias (clock_nanosleep, __clock_nanosleep)
diff --git a/libc/sysdeps/unix/clock_settime.c b/libc/sysdeps/unix/clock_settime.c
index 97caa0d0f..e09463a56 100644
--- a/libc/sysdeps/unix/clock_settime.c
+++ b/libc/sysdeps/unix/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2012 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
@@ -124,3 +124,4 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
return retval;
}
+strong_alias (clock_settime, __clock_settime)
diff --git a/libc/sysdeps/unix/sysv/linux/Makefile b/libc/sysdeps/unix/sysv/linux/Makefile
index ddae6862b..8e5361c49 100644
--- a/libc/sysdeps/unix/sysv/linux/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/Makefile
@@ -153,6 +153,7 @@ endif
ifeq ($(subdir),io)
sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
sync_file_range open_2 open64_2 fallocate fallocate64
+sysdep_headers += bits/fcntl-linux.h
endif
ifeq ($(subdir),elf)
diff --git a/libc/sysdeps/unix/sysv/linux/_G_config.h b/libc/sysdeps/unix/sysv/linux/_G_config.h
index ec2e33317..abec24560 100644
--- a/libc/sysdeps/unix/sysv/linux/_G_config.h
+++ b/libc/sysdeps/unix/sysv/linux/_G_config.h
@@ -50,11 +50,6 @@ typedef union
#define _G_IO_IO_FILE_VERSION 0x20001
-#define _G_OPEN64 __open64
-#define _G_LSEEK64 __lseek64
-#define _G_MMAP64 __mmap64
-#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
-
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
diff --git a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
new file mode 100644
index 000000000..dbd76ad64
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -0,0 +1,386 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 2001-2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl-linux.h> directly; include <fcntl.h> instead."
+#endif
+
+/* This file contains shared definitions between Linux architectures
+ and is included by <bits/fcntl.h> to declare them. The various
+ #ifndef cases allow the architecture specific file to define those
+ values with different values.
+
+ A minimal <bits/fcntl.h> contains just:
+
+ struct flock {...}
+ #ifdef __USE_LARGEFILE64
+ struct flock64 {...}
+ #endif
+ #include <bits/fcntl-linux.h>
+*/
+
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
+/* open/fcntl. */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#ifndef O_CREAT
+# define O_CREAT 0100 /* Not fcntl. */
+#endif
+#ifndef O_EXCL
+# define O_EXCL 0200 /* Not fcntl. */
+#endif
+#ifndef O_NOCTTY
+# define O_NOCTTY 0400 /* Not fcntl. */
+#endif
+#ifndef O_TRUNC
+# define O_TRUNC 01000 /* Not fcntl. */
+#endif
+#ifndef O_APPEND
+# define O_APPEND 02000
+#endif
+#ifndef O_NONBLOCK
+# define O_NONBLOCK 04000
+#endif
+#ifndef O_NDELAY
+# define O_NDELAY O_NONBLOCK
+#endif
+#ifndef O_SYNC
+# define O_SYNC 04010000
+#endif
+#define O_FSYNC O_SYNC
+#ifndef O_ASYNC
+# define O_ASYNC 020000
+#endif
+#ifndef __O_LARGEFILE
+# define __O_LARGEFILE 0100000
+#endif
+
+#ifndef __O_DIRECTORY
+# define __O_DIRECTORY 0200000
+#endif
+#ifndef __O_NOFOLLOW
+# define __O_NOFOLLOW 0400000
+#endif
+#ifndef __O_CLOEXEC
+# define __O_CLOEXEC 02000000
+#endif
+#ifndef __O_DIRECT
+# define __O_DIRECT 040000
+#endif
+#ifndef __O_NOATIME
+# define __O_NOATIME 01000000
+#endif
+#ifndef __O_PATH
+# define __O_PATH 010000000
+#endif
+#ifndef __O_DSYNC
+# define __O_DSYNC 010000
+#endif
+
+#ifndef F_GETLK
+# ifndef __USE_FILE_OFFSET64
+# define F_GETLK 5 /* Get record locking info. */
+# define F_SETLK 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW 7 /* Set record locking info (blocking). */
+# else
+# define F_GETLK F_GETLK64 /* Get record locking info. */
+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
+# endif
+#endif
+#ifndef F_GETLK64
+# define F_GETLK64 12 /* Get record locking info. */
+# define F_SETLK64 13 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 14 /* Set record locking info (blocking). */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE __O_LARGEFILE
+#endif
+
+#ifdef __USE_XOPEN2K8
+# define O_DIRECTORY __O_DIRECTORY /* Must be a directory. */
+# define O_NOFOLLOW __O_NOFOLLOW /* Do not follow links. */
+# define O_CLOEXEC __O_CLOEXEC /* Set close_on_exec. */
+#endif
+
+#ifdef __USE_GNU
+# define O_DIRECT __O_DIRECT /* Direct disk access. */
+# define O_NOATIME __O_NOATIME /* Do not set atime. */
+# define O_PATH __O_PATH /* Resolve pathname but do not open file. */
+#endif
+
+/* For now, Linux has no separate synchronicitiy options for read
+ operations. We define O_RSYNC therefore as the same as O_SYNC
+ since this is a superset. */
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC __O_DSYNC /* Synchronize data. */
+# if defined __O_RSYNC
+# define O_RSYNC __O_RSYNC /* Synchronize read operations. */
+# else
+# define O_RSYNC O_SYNC /* Synchronize read operations. */
+# endif
+#endif
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+
+#ifndef __F_SETOWN
+# define __F_SETOWN 8
+# define __F_GETOWN 9
+#endif
+
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
+# define F_SETOWN __F_SETOWN /* Get owner (process receiving SIGIO). */
+# define F_GETOWN __F_GETOWN /* Set owner (process receiving SIGIO). */
+#endif
+
+#ifndef __F_SETSIG
+# define __F_SETSIG 10 /* Set number of signal to be sent. */
+# define __F_GETSIG 11 /* Get number of signal to be sent. */
+#endif
+#ifndef __F_SETOWN_EX
+# define __F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define __F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG __F_SETSIG /* Set number of signal to be sent. */
+# define F_GETSIG __F_GETSIG /* Get number of signal to be sent. */
+# define F_SETOWN_EX __F_SETOWN_EX /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX __F_GETOWN_EX /* Set owner (thread receiving SIGIO). */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notifications on a directory. */
+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
+# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
+#endif
+#ifdef __USE_XOPEN2K8
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set. */
+#endif
+
+/* For F_[GET|SET]FD. */
+#define FD_CLOEXEC 1 /* Actually anything with low bit set goes */
+
+#ifndef F_RDLCK
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+# define F_RDLCK 0 /* Read lock. */
+# define F_WRLCK 1 /* Write lock. */
+# define F_UNLCK 2 /* Remove lock. */
+#endif
+
+
+/* For old implementation of BSD flock. */
+#ifndef F_EXLCK
+# define F_EXLCK 4 /* or 3 */
+# define F_SHLCK 8 /* or 4 */
+#endif
+
+#ifdef __USE_BSD
+/* Operations for BSD flock, also used by the kernel implementation. */
+# define LOCK_SH 1 /* Shared lock. */
+# define LOCK_EX 2 /* Exclusive lock. */
+# define LOCK_NB 4 /* Or'd with one of the above to prevent
+ blocking. */
+# define LOCK_UN 8 /* Remove lock. */
+#endif
+
+#ifdef __USE_GNU
+# define LOCK_MAND 32 /* This is a mandatory flock: */
+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY. */
+# define DN_ACCESS 0x00000001 /* File accessed. */
+# define DN_MODIFY 0x00000002 /* File modified. */
+# define DN_CREATE 0x00000004 /* File created. */
+# define DN_DELETE 0x00000008 /* File removed. */
+# define DN_RENAME 0x00000010 /* File renamed. */
+# define DN_ATTRIB 0x00000020 /* File changed attributes. */
+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+#endif
+
+
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_PGRP, /* Process group. */
+ F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+ BSD systems which did not managed to hide these kernel macros. */
+#ifdef __USE_BSD
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
+#endif /* Use BSD. */
+
+#ifndef __POSIX_FADV_DONTNEED
+# define __POSIX_FADV_DONTNEED 4
+# define __POSIX_FADV_NOREUSE 5
+#endif
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED __POSIX_FADV_DONTNEED /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE __POSIX_FADV_NOREUSE /* Data will be accessed once. */
+#endif
+
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+
+
+/* File handle structure. */
+struct file_handle
+{
+ unsigned int handle_bytes;
+ int handle_type;
+ /* File identifier. */
+ unsigned char f_handle[0];
+};
+
+/* Maximum handle size (for now). */
+# define MAX_HANDLE_SZ 128
+#endif
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+/* Selective file content synch'ing.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
+ unsigned int __flags);
+
+
+/* Splice address range into a pipe.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+/* Reserve storage for the data of the file associated with FD.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
+ __off64_t __len),
+ fallocate64);
+# else
+# define fallocate fallocate64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
+ __off64_t __len);
+# endif
+
+
+/* Map file name to file handle. */
+extern int name_to_handle_at (int __dfd, const char *__name,
+ struct file_handle *__handle, int *__mnt_id,
+ int __flags) __THROW;
+
+/* Open file using the file handle.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
+ int __flags);
+
+#endif /* use GNU */
+
+__END_DECLS
diff --git a/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
index 8700354a9..c00f5ea06 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -50,3 +50,4 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
else
return INTERNAL_SYSCALL_ERRNO (r, err);
}
+strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
diff --git a/libc/sysdeps/unix/sysv/linux/clock_nanosleep.c b/libc/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 110296363..b12bd868f 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_nanosleep.c
@@ -52,3 +52,4 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
return (INTERNAL_SYSCALL_ERROR_P (r, err)
? INTERNAL_SYSCALL_ERRNO (r, err) : 0);
}
+strong_alias (clock_nanosleep, __clock_nanosleep)
diff --git a/libc/sysdeps/unix/sysv/linux/fips-private.h b/libc/sysdeps/unix/sysv/linux/fips-private.h
new file mode 100644
index 000000000..81d1b617f
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/fips-private.h
@@ -0,0 +1,74 @@
+/* FIPS compliance status test for GNU/Linux systems.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _FIPS_PRIVATE_H
+#define _FIPS_PRIVATE_H
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <not-cancel.h>
+#include <stdbool.h>
+
+/* Return true if FIPS mode is enabled. See
+ sysdeps/generic/fips-private.h for more information. */
+
+static inline bool
+fips_enabled_p (void)
+{
+ static enum
+ {
+ FIPS_UNTESTED = 0,
+ FIPS_ENABLED = 1,
+ FIPS_DISABLED = -1,
+ FIPS_TEST_FAILED = -2
+ } checked;
+
+ if (checked == FIPS_UNTESTED)
+ {
+ int fd = open_not_cancel_2 ("/proc/sys/crypto/fips_enabled", O_RDONLY);
+
+ if (fd != -1)
+ {
+ /* This is more than enough, the file contains a single integer. */
+ char buf[32];
+ ssize_t n;
+ n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, sizeof (buf) - 1));
+ close_not_cancel_no_status (fd);
+
+ if (n > 0)
+ {
+ /* Terminate the string. */
+ buf[n] = '\0';
+
+ char *endp;
+ long int res = strtol (buf, &endp, 10);
+ if (endp != buf && (*endp == '\0' || *endp == '\n'))
+ checked = (res > 0) ? FIPS_ENABLED : FIPS_DISABLED;
+ }
+ }
+
+ if (checked == FIPS_UNTESTED)
+ checked = FIPS_TEST_FAILED;
+ }
+
+ return checked == FIPS_ENABLED;
+}
+
+#endif /* _FIPS_PRIVATE_H */
diff --git a/libc/sysdeps/unix/sysv/linux/i386/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
index 821e35e4c..920b0d553 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
+++ b/libc/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
@@ -1,5 +1,5 @@
/* Get frequency of the system processor. i386/Linux version.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 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
@@ -39,7 +39,7 @@ __get_clockfreq (void)
if (result != 0)
return result;
- fd = open ("/proc/cpuinfo", O_RDONLY);
+ fd = __open ("/proc/cpuinfo", O_RDONLY);
if (__builtin_expect (fd != -1, 1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
@@ -47,7 +47,7 @@ __get_clockfreq (void)
char buf[4096];
ssize_t n;
- n = read (fd, buf, sizeof buf);
+ n = __read (fd, buf, sizeof buf);
if (__builtin_expect (n, 1) > 0)
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
@@ -83,7 +83,7 @@ __get_clockfreq (void)
}
}
- close (fd);
+ __close (fd);
}
return result;
diff --git a/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
index 0e8576fdd..67d592959 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
@@ -1813,6 +1813,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
index 6bdf4dc7f..4ff7e849c 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -19,6 +19,6 @@ endif
ifeq ($(subdir),misc)
sysdep_headers += bits/ppc.h
-sysdep_routines += get_clockfreq get_timebase_freq
+sysdep_routines += get_timebase_freq
tests += test-gettimebasefreq
endif
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
index d1e65a85e..a863a27b3 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -1,5 +1,5 @@
/* Get frequency of the system processor. powerpc/Linux version.
- Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ __get_clockfreq (void)
&& INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
#endif
{
- int fd = open ("/proc/cpuinfo", O_RDONLY);
+ int fd = __open ("/proc/cpuinfo", O_RDONLY);
if (__builtin_expect (fd != -1, 1))
{
@@ -58,7 +58,7 @@ __get_clockfreq (void)
char buf[1024];
ssize_t n;
- n = read (fd, buf, sizeof (buf));
+ n = __read (fd, buf, sizeof (buf));
if (n == sizeof (buf))
{
/* We are here because the 1st read returned exactly sizeof
@@ -76,7 +76,7 @@ __get_clockfreq (void)
while (n >= half_buf)
{
memcpy (buf, buf + half_buf, half_buf);
- n = read (fd, buf + half_buf, half_buf);
+ n = __read (fd, buf + half_buf, half_buf);
}
if (n >= 0)
n += half_buf;
@@ -108,7 +108,7 @@ __get_clockfreq (void)
}
timebase_freq = result;
}
- close (fd);
+ __close (fd);
}
}
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
index ab96361d4..a3cd89540 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
@@ -1774,6 +1774,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
__ppc_get_timebase_freq F
GLIBC_2.2
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
index a60b72ad1..0a80d0c57 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
@@ -80,6 +80,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
__ppc_get_timebase_freq F
GLIBC_2.3
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index e1479e584..43eee7a37 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000-2002,2004,2006,2007,2009,2010,2011
- Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,148 +20,20 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
#include <bits/wordsize.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0200000 /* Must be a directory. */
-# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# if __WORDSIZE == 64
+#if __WORDSIZE == 64
/* Not necessary, files are always with 64bit off_t. */
-# define O_LARGEFILE 0
-# else
-# define O_LARGEFILE 0100000
-# endif
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
+# define __O_LARGEFILE 0
+#else
+# define __O_LARGEFILE 0100000
#endif
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
#if __WORDSIZE == 64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
/* Not necessary, we always have 64-bit offsets. */
# define F_GETLK64 5 /* Get record locking info. */
# define F_SETLK64 6 /* Set record locking info (non-blocking). */
# define F_SETLKW64 7 /* Set record locking info (blocking). */
-#else
-# ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-# else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-# endif
-# define F_GETLK64 12 /* Get record locking info. */
-# define F_SETLK64 13 /* Set record locking info (non-blocking). */
-# define F_SETLKW64 14 /* Set record locking info (blocking). */
-#endif
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
#endif
struct flock
@@ -190,156 +61,13 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# if __WORDSIZE == 64
-# define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */
-# else
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-# endif
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
+#if __WORDSIZE == 64
+# define __POSIX_FADV_DONTNEED 6 /* Don't need these pages. */
+# define __POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */
+#else
+# define __POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define __POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
index ff0b82f51..d9914ff53 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
@@ -1765,6 +1765,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
index 2fb078694..ef1ead306 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
@@ -86,6 +86,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index a9d8931df..fd9691424 100644
--- a/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/SH.
- Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,134 +20,6 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0200000 /* Must be a directory. */
-# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0100000
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
-#define F_GETLK64 12 /* Get record locking info. */
-#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 14 /* Set record locking info (blocking). */
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
struct flock
{
@@ -175,151 +46,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
index 3fd150e7e..733b550fe 100644
--- a/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
@@ -86,6 +86,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 7ce09da56..22e71fcd7 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/SPARC.
- Copyright (C) 1995-1998, 2000, 2003, 2004, 2006, 2007, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,144 +20,55 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
#include <bits/wordsize.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_RDONLY 0x0000
-#define O_WRONLY 0x0001
-#define O_RDWR 0x0002
-#define O_ACCMODE 0x0003
#define O_APPEND 0x0008
#define O_ASYNC 0x0040
#define O_CREAT 0x0200 /* not fcntl */
#define O_TRUNC 0x0400 /* not fcntl */
#define O_EXCL 0x0800 /* not fcntl */
#define O_SYNC 0x802000
-#define O_FSYNC O_SYNC
#define O_NONBLOCK 0x4000
#define O_NDELAY (0x0004 | O_NONBLOCK)
-#define O_NOCTTY 0x8000 /* not fcntl */
+#define O_NOCTTY 0x8000 /* not fcntl */
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0x10000 /* must be a directory */
-# define O_NOFOLLOW 0x20000 /* don't follow links */
-# define O_CLOEXEC 0x400000 /* Set close_on_exit. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 0x100000 /* direct disk access hint */
-# define O_NOATIME 0x200000 /* Do not set atime. */
-# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
-#endif
+#define __O_DIRECTORY 0x10000 /* must be a directory */
+#define __O_NOFOLLOW 0x20000 /* don't follow links */
+#define __O_CLOEXEC 0x400000 /* Set close_on_exit. */
-#ifdef __USE_LARGEFILE64
-# if __WORDSIZE == 64
-# define O_LARGEFILE 0
-# else
-# define O_LARGEFILE 0x40000
-# endif
-#endif
+#define __O_DIRECT 0x100000 /* direct disk access hint */
+#define __O_NOATIME 0x200000 /* Do not set atime. */
+#define __O_PATH 0x1000000 /* Resolve pathname but do not open file. */
-/* For now Linux has no synchronisity options for data and read
- operations. We define the symbols here but let them do the same as
- O_SYNC since this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 0x2000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
+#if __WORDSIZE == 64
+# define __O_LARGEFILE 0
+#else
+# define __O_LARGEFILE 0x40000
#endif
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_GETOWN 5 /* Get owner (process receiving SIGIO). */
-# define F_SETOWN 6 /* Set owner (process receiving SIGIO). */
-#endif
+#define __O_DSYNC 0x2000 /* Synchronize data. */
+
+
+#define __F_GETOWN 5 /* Get owner (process receiving SIGIO). */
+#define __F_SETOWN 6 /* Set owner (process receiving SIGIO). */
+
#ifndef __USE_FILE_OFFSET64
# define F_GETLK 7 /* Get record locking info. */
# define F_SETLK 8 /* Set record locking info (non-blocking). */
# define F_SETLKW 9 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Set owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Get owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
#endif
#if __WORDSIZE == 64
# define F_GETLK64 7 /* Get record locking info. */
# define F_SETLK64 8 /* Set record locking info (non-blocking). */
# define F_SETLKW64 9 /* Set record locking info (blocking). */
-#else
-# define F_GETLK64 12 /* Get record locking info. */
-# define F_SETLK64 13 /* Set record locking info (non-blocking). */
-# define F_SETLKW64 14 /* Set record locking info (blocking). */
#endif
-/* for F_[GET|SET]FD */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
#define F_RDLCK 1 /* Read lock. */
#define F_WRLCK 2 /* Write lock. */
#define F_UNLCK 3 /* Remove lock. */
-/* for old implementation of bsd flock () */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
-
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
@@ -186,148 +96,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
index 7d5a3429f..3a96ea883 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
@@ -1770,6 +1770,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
index cbb817952..67ff77fa8 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
@@ -34,13 +34,13 @@ __get_clockfreq_via_cpuinfo (void)
result = 0;
- fd = open ("/proc/cpuinfo", O_RDONLY);
+ fd = __open ("/proc/cpuinfo", O_RDONLY);
if (fd != -1)
{
char buf[8192];
ssize_t n;
- n = read (fd, buf, sizeof buf);
+ n = __read (fd, buf, sizeof buf);
if (n > 0)
{
char *mhz = memmem (buf, n, "Cpu0ClkTck", 7);
@@ -72,7 +72,7 @@ __get_clockfreq_via_cpuinfo (void)
}
}
- close (fd);
+ __close (fd);
}
return result;
@@ -86,7 +86,7 @@ __get_clockfreq_via_proc_openprom (void)
result = 0;
- obp_fd = open ("/proc/openprom", O_RDONLY);
+ obp_fd = __open ("/proc/openprom", O_RDONLY);
if (obp_fd != -1)
{
unsigned long int buf[4096 / sizeof (unsigned long int)];
@@ -94,8 +94,8 @@ __get_clockfreq_via_proc_openprom (void)
off_t dbase = (off_t) 0;
ssize_t len;
- while ((len = getdirentries (obp_fd, (char *) dirp,
- sizeof (buf), &dbase)) > 0)
+ while ((len = __getdirentries (obp_fd, (char *) dirp,
+ sizeof (buf), &dbase)) > 0)
{
struct dirent *this_dirp = dirp;
@@ -113,13 +113,13 @@ __get_clockfreq_via_proc_openprom (void)
__stpcpy (prop = __stpcpy (__stpcpy (node, "/proc/openprom/"),
this_dirp->d_name),
"/device_type");
- fd = open (node, O_RDONLY);
+ fd = __open (node, O_RDONLY);
if (fd != -1)
{
char type_string[128];
int ret;
- ret = read (fd, type_string, sizeof (type_string));
+ ret = __read (fd, type_string, sizeof (type_string));
if (ret > 0 && strncmp (type_string, "'cpu'", 5) == 0)
{
int clkfreq_fd;
@@ -135,7 +135,7 @@ __get_clockfreq_via_proc_openprom (void)
close (clkfreq_fd);
}
}
- close (fd);
+ __close (fd);
}
if (result != 0)
@@ -148,7 +148,7 @@ __get_clockfreq_via_proc_openprom (void)
if (result != 0)
break;
}
- close (obp_fd);
+ __close (obp_fd);
}
return result;
@@ -178,7 +178,7 @@ __get_clockfreq_via_dev_openprom (void)
result = 0;
- obp_dev_fd = open ("/dev/openprom", O_RDONLY);
+ obp_dev_fd = __open ("/dev/openprom", O_RDONLY);
if (obp_dev_fd != -1)
{
char obp_buf[8192];
@@ -188,7 +188,7 @@ __get_clockfreq_via_dev_openprom (void)
obp_cmd->oprom_size =
sizeof (obp_buf) - sizeof (unsigned int);
set_obp_int (obp_cmd, 0);
- ret = ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd);
+ ret = __ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd);
if (ret == 0)
{
int cur_node = get_obp_int (obp_cmd);
@@ -197,20 +197,20 @@ __get_clockfreq_via_dev_openprom (void)
{
obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int);
strcpy (obp_cmd->oprom_array, "device_type");
- ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
+ ret = __ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
if (ret == 0
&& strncmp (obp_cmd->oprom_array, "cpu", 3) == 0)
{
obp_cmd->oprom_size = (sizeof (obp_buf)
- sizeof (unsigned int));
strcpy (obp_cmd->oprom_array, "clock-frequency");
- ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
+ ret = __ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
if (ret == 0)
result = (hp_timing_t) get_obp_int (obp_cmd);
}
obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int);
set_obp_int (obp_cmd, cur_node);
- ret = ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd);
+ ret = __ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd);
if (ret < 0)
break;
cur_node = get_obp_int (obp_cmd);
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
index 6d6e57c11..aa892b8b8 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
@@ -91,6 +91,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h
index 9fa5ecb72..9251e750e 100644
--- a/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h
@@ -1,4 +1,4 @@
-/* O_*, F_*, FD_* bit values for Linux/x86-64.
+/* O_*, F_*, FD_* bit values for Linux/x86.
Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -16,151 +16,23 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _FCNTL_H
+#ifndef _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0200000 /* Must be a directory. */
-# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# ifdef __x86_64__
-# define O_LARGEFILE 0
-# else
-# define O_LARGEFILE 0100000
-# endif
+#ifdef __x86_64__
+# define __O_LARGEFILE 0
+#else
+# define __O_LARGEFILE 0100000
#endif
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
#ifdef __x86_64__
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
/* Not necessary, we always have 64-bit offsets. */
# define F_GETLK64 5 /* Get record locking info. */
# define F_SETLK64 6 /* Set record locking info (non-blocking). */
# define F_SETLKW64 7 /* Set record locking info (blocking). */
-#else
-# ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-# else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-# endif
-# define F_GETLK64 12 /* Get record locking info. */
-# define F_SETLK64 13 /* Set record locking info (non-blocking). */
-# define F_SETLKW64 14 /* Set record locking info (blocking). */
#endif
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
struct flock
{
@@ -187,151 +59,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif /* use GNU */
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
index d6ab153e1..a42d424cd 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
@@ -82,6 +82,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2.5
GLIBC_2.2.5 A
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
index 65bcead8b..108b80fb4 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
@@ -2080,4 +2080,9 @@ GLIBC_2.16
xprt_unregister F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
diff --git a/libc/sysdeps/x86/bits/byteswap.h b/libc/sysdeps/x86/bits/byteswap.h
index 417843933..babe56743 100644
--- a/libc/sysdeps/x86/bits/byteswap.h
+++ b/libc/sysdeps/x86/bits/byteswap.h
@@ -24,6 +24,7 @@
#define _BITS_BYTESWAP_H 1
#include <features.h>
+#include <bits/types.h>
#include <bits/wordsize.h>
/* Swap bytes in 16 bit value. */
@@ -104,15 +105,15 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x00000000000000ffull) << 56)))
# if __GNUC_PREREQ (4, 2)
-static __inline unsigned long long int
-__bswap_64 (unsigned long long int __bsx)
+static __inline __uint64_t
+__bswap_64 (__uint64_t __bsx)
{
return __builtin_bswap64 (__bsx);
}
# elif __WORDSIZE == 64
# define __bswap_64(x) \
(__extension__ \
- ({ register unsigned long __v, __x = (x); \
+ ({ register __uint64_t __v, __x = (x); \
if (__builtin_constant_p (__x)) \
__v = __bswap_constant_64 (__x); \
else \
@@ -121,7 +122,7 @@ __bswap_64 (unsigned long long int __bsx)
# else
# define __bswap_64(x) \
(__extension__ \
- ({ union { __extension__ unsigned long long int __ll; \
+ ({ union { __extension__ __uint64_t __ll; \
unsigned int __l[2]; } __w, __r; \
if (__builtin_constant_p (x)) \
__r.__ll = __bswap_constant_64 (x); \
@@ -144,8 +145,8 @@ __bswap_64 (unsigned long long int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
-static __inline unsigned long long int
-__bswap_64 (unsigned long long int __bsx)
+static __inline __uint64_t
+__bswap_64 (__uint64_t __bsx)
{
return __bswap_constant_64 (__bsx);
}
diff --git a/libc/sysdeps/x86_64/multiarch/bcopy.S b/libc/sysdeps/x86_64/multiarch/bcopy.S
index 11e250f1c..639f02bde 100644
--- a/libc/sysdeps/x86_64/multiarch/bcopy.S
+++ b/libc/sysdeps/x86_64/multiarch/bcopy.S
@@ -3,5 +3,5 @@
.text
ENTRY(bcopy)
xchg %rdi, %rsi
- jmp HIDDEN_BUILTIN_JUMPTARGET(memmove)
+ jmp __libc_memmove /* Branch to IFUNC memmove. */
END(bcopy)
diff --git a/libc/sysdeps/x86_64/multiarch/bzero.S b/libc/sysdeps/x86_64/multiarch/bzero.S
index 92e9fcfc7..23beab7a3 100644
--- a/libc/sysdeps/x86_64/multiarch/bzero.S
+++ b/libc/sysdeps/x86_64/multiarch/bzero.S
@@ -1,5 +1,5 @@
-/* Multiple versions of bzero
- Copyright (C) 2010 Free Software Foundation, Inc.
+/* bzero. x86-64 version.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,35 +21,8 @@
.text
ENTRY(__bzero)
- .type __bzero, @gnu_indirect_function
- cmpl $0, __cpu_features+KIND_OFFSET(%rip)
- jne 1f
- call __init_cpu_features
-1: leaq __bzero_x86_64(%rip), %rax
- testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
- jz 2f
- leaq __bzero_sse2(%rip), %rax
-2: ret
-END(__bzero)
-
- .type __bzero_sse2, @function
-__bzero_sse2:
- cfi_startproc
- CALL_MCOUNT
mov %rsi,%rdx /* Adjust parameter. */
xorl %esi,%esi /* Fill with 0s. */
- jmp __memset_sse2
- cfi_endproc
- .size __bzero_sse2, .-__bzero_sse2
-
- .type __bzero_x86_64, @function
-__bzero_x86_64:
- cfi_startproc
- CALL_MCOUNT
- mov %rsi,%rdx /* Adjust parameter. */
- xorl %esi,%esi /* Fill with 0s. */
- jmp __memset_x86_64
- cfi_endproc
- .size __bzero_x86_64, .-__bzero_x86_64
-
+ jmp __libc_memset /* Branch to IFUNC memset. */
+END(__bzero)
weak_alias (__bzero, bzero)
diff --git a/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c
new file mode 100644
index 000000000..332a60d9c
--- /dev/null
+++ b/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c
@@ -0,0 +1,283 @@
+/* Enumerate available IFUNC implementations of a function. x86-64 version.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <string.h>
+#include <wchar.h>
+#include <ifunc-impl-list.h>
+#include "init-arch.h"
+
+/* Maximum number of IFUNC implementations. */
+#define MAX_IFUNC 4
+
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
+ NAME supported on target machine and return the number of valid
+ entries. */
+
+size_t
+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ size_t max)
+{
+ assert (max >= MAX_IFUNC);
+
+ size_t i = 0;
+
+ /* Support sysdeps/x86_64/multiarch/memcmp.S. */
+ IFUNC_IMPL (i, name, memcmp,
+ IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSE4_1,
+ __memcmp_sse4_1)
+ IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSSE3, __memcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/memmove_chk.S. */
+ IFUNC_IMPL (i, name, __memmove_chk,
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
+ __memmove_chk_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
+ __memmove_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
+ __memmove_chk_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/memmove.S. */
+ IFUNC_IMPL (i, name, memmove,
+ IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
+ __memmove_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
+ __memmove_ssse3)
+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/memset_chk.S. */
+ IFUNC_IMPL (i, name, __memset_chk,
+ IFUNC_IMPL_ADD (array, i, __memset_chk, 1, __memset_chk_sse2)
+ IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
+ __memset_chk_x86_64))
+
+ /* Support sysdeps/x86_64/multiarch/memset.S. */
+ IFUNC_IMPL (i, name, memset,
+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_sse2)
+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_x86_64))
+
+ /* Support sysdeps/x86_64/multiarch/rawmemchr.S. */
+ IFUNC_IMPL (i, name, rawmemchr,
+ IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_SSE4_2,
+ __rawmemchr_sse42)
+ IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/stpncpy.S. */
+ IFUNC_IMPL (i, name, stpncpy,
+ IFUNC_IMPL_ADD (array, i, stpncpy, HAS_SSSE3,
+ __stpncpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, stpncpy, 1,
+ __stpncpy_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/stpcpy.S. */
+ IFUNC_IMPL (i, name, stpcpy,
+ IFUNC_IMPL_ADD (array, i, stpcpy, HAS_SSSE3, __stpcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S. */
+ IFUNC_IMPL (i, name, strcasecmp,
+ IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_AVX,
+ __strcasecmp_avx)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSE4_2,
+ __strcasecmp_sse42)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSSE3,
+ __strcasecmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S. */
+ IFUNC_IMPL (i, name, strcasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_AVX,
+ __strcasecmp_l_avx)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSE4_2,
+ __strcasecmp_l_sse42)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSSE3,
+ __strcasecmp_l_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
+ __strcasecmp_l_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcasestr.c. */
+ IFUNC_IMPL (i, name, strcasestr,
+ IFUNC_IMPL_ADD (array, i, strcasestr, HAS_SSE4_2,
+ __strcasestr_sse42)
+ IFUNC_IMPL_ADD (array, i, strcasestr, 1, __strcasestr_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcat.S. */
+ IFUNC_IMPL (i, name, strcat,
+ IFUNC_IMPL_ADD (array, i, strcat, HAS_SSSE3, __strcat_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strchr.S. */
+ IFUNC_IMPL (i, name, strchr,
+ IFUNC_IMPL_ADD (array, i, strchr, HAS_SSE4_2, __strchr_sse42)
+ IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2_no_bsf)
+ IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcmp.S. */
+ IFUNC_IMPL (i, name, strcmp,
+ IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSE4_2, __strcmp_sse42)
+ IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSSE3, __strcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcpy.S. */
+ IFUNC_IMPL (i, name, strcpy,
+ IFUNC_IMPL_ADD (array, i, strcpy, HAS_SSSE3, __strcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strcspn.S. */
+ IFUNC_IMPL (i, name, strcspn,
+ IFUNC_IMPL_ADD (array, i, strcspn, HAS_SSE4_2,
+ __strcspn_sse42)
+ IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strncase_l.S. */
+ IFUNC_IMPL (i, name, strncasecmp,
+ IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_AVX,
+ __strncasecmp_avx)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSE4_2,
+ __strncasecmp_sse42)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSSE3,
+ __strncasecmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
+ __strncasecmp_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strncase_l.S. */
+ IFUNC_IMPL (i, name, strncasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_AVX,
+ __strncasecmp_l_avx)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_SSE4_2,
+ __strncasecmp_l_sse42)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_SSSE3,
+ __strncasecmp_l_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
+ __strncasecmp_l_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strncat.S. */
+ IFUNC_IMPL (i, name, strncat,
+ IFUNC_IMPL_ADD (array, i, strncat, HAS_SSSE3,
+ __strncat_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncat, 1,
+ __strncat_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strncpy.S. */
+ IFUNC_IMPL (i, name, strncpy,
+ IFUNC_IMPL_ADD (array, i, strncpy, HAS_SSSE3,
+ __strncpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncpy, 1,
+ __strncpy_sse2_unaligned)
+ IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strnlen.S. */
+ IFUNC_IMPL (i, name, strnlen,
+ IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_sse2_no_bsf)
+ IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strpbrk.S. */
+ IFUNC_IMPL (i, name, strpbrk,
+ IFUNC_IMPL_ADD (array, i, strpbrk, HAS_SSE4_2,
+ __strpbrk_sse42)
+ IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strrchr.S. */
+ IFUNC_IMPL (i, name, strrchr,
+ IFUNC_IMPL_ADD (array, i, strrchr, HAS_SSE4_2,
+ __strrchr_sse42)
+ IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2_no_bsf)
+ IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strspn.S. */
+ IFUNC_IMPL (i, name, strspn,
+ IFUNC_IMPL_ADD (array, i, strspn, HAS_SSE4_2, __strspn_sse42)
+ IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strstr-c.c. */
+ IFUNC_IMPL (i, name, strstr,
+ IFUNC_IMPL_ADD (array, i, strstr, HAS_SSE4_2, __strstr_sse42)
+ IFUNC_IMPL_ADD (array, i, strstr, 1, __strstr_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/wcscpy.S. */
+ IFUNC_IMPL (i, name, wcscpy,
+ IFUNC_IMPL_ADD (array, i, wcscpy, HAS_SSSE3, __wcscpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/wmemcmp.S. */
+ IFUNC_IMPL (i, name, wmemcmp,
+ IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSE4_1,
+ __wmemcmp_sse4_1)
+ IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSSE3,
+ __wmemcmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_sse2))
+
+#ifdef SHARED
+ /* Support sysdeps/x86_64/multiarch/memcpy_chk.S. */
+ IFUNC_IMPL (i, name, __memcpy_chk,
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
+ __memcpy_chk_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
+ __memcpy_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
+ __memcpy_chk_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/memcpy.S. */
+ IFUNC_IMPL (i, name, memcpy,
+ IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3,
+ __memcpy_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3, __memcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/mempcpy_chk.S. */
+ IFUNC_IMPL (i, name, __mempcpy_chk,
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
+ __mempcpy_chk_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
+ __mempcpy_chk_ssse3)
+ IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
+ __mempcpy_chk_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/mempcpy.S. */
+ IFUNC_IMPL (i, name, mempcpy,
+ IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
+ __mempcpy_ssse3_back)
+ IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
+ __mempcpy_ssse3)
+ IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strlen.S. */
+ IFUNC_IMPL (i, name, strlen,
+ IFUNC_IMPL_ADD (array, i, strlen, HAS_SSE4_2, __strlen_sse42)
+ IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2_pminub)
+ IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2_no_bsf)
+ IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2)
+ IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2))
+
+ /* Support sysdeps/x86_64/multiarch/strncmp.S. */
+ IFUNC_IMPL (i, name, strncmp,
+ IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSE4_2,
+ __strncmp_sse42)
+ IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSSE3,
+ __strncmp_ssse3)
+ IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_sse2))
+#endif
+
+ return i;
+}
diff --git a/libc/sysdeps/x86_64/multiarch/memcmp.S b/libc/sysdeps/x86_64/multiarch/memcmp.S
index b2bc4d797..a3f6a38f6 100644
--- a/libc/sysdeps/x86_64/multiarch/memcmp.S
+++ b/libc/sysdeps/x86_64/multiarch/memcmp.S
@@ -1,5 +1,6 @@
/* Multiple versions of memcmp
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -48,6 +49,8 @@ END(memcmp)
# define ENTRY(name) \
.type __memcmp_sse2, @function; \
.p2align 4; \
+ .globl __memcmp_sse2; \
+ .hidden __memcmp_sse2; \
__memcmp_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/memcpy.S b/libc/sysdeps/x86_64/multiarch/memcpy.S
index a77cdfb65..c7a193f64 100644
--- a/libc/sysdeps/x86_64/multiarch/memcpy.S
+++ b/libc/sysdeps/x86_64/multiarch/memcpy.S
@@ -1,6 +1,6 @@
/* Multiple versions of memcpy
- Copyright (C) 2010, 2011
- Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -45,6 +45,8 @@ END(__new_memcpy)
# undef ENTRY
# define ENTRY(name) \
.type __memcpy_sse2, @function; \
+ .globl __memcpy_sse2; \
+ .hidden __memcpy_sse2; \
.p2align 4; \
__memcpy_sse2: cfi_startproc; \
CALL_MCOUNT
diff --git a/libc/sysdeps/x86_64/multiarch/memcpy_chk.S b/libc/sysdeps/x86_64/multiarch/memcpy_chk.S
index 5d0059e3d..2283cf688 100644
--- a/libc/sysdeps/x86_64/multiarch/memcpy_chk.S
+++ b/libc/sysdeps/x86_64/multiarch/memcpy_chk.S
@@ -1,5 +1,6 @@
/* Multiple versions of __memcpy_chk
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/memmove.c b/libc/sysdeps/x86_64/multiarch/memmove.c
index d6bdab4cc..af870d49b 100644
--- a/libc/sysdeps/x86_64/multiarch/memmove.c
+++ b/libc/sysdeps/x86_64/multiarch/memmove.c
@@ -1,4 +1,5 @@
/* Multiple versions of memmove.
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/memmove_chk.c b/libc/sysdeps/x86_64/multiarch/memmove_chk.c
index f1f99d99c..da8160d4a 100644
--- a/libc/sysdeps/x86_64/multiarch/memmove_chk.c
+++ b/libc/sysdeps/x86_64/multiarch/memmove_chk.c
@@ -1,5 +1,6 @@
/* Multiple versions of __memmove_chk.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 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
diff --git a/libc/sysdeps/x86_64/multiarch/mempcpy.S b/libc/sysdeps/x86_64/multiarch/mempcpy.S
index caa435b74..b5a5d6d68 100644
--- a/libc/sysdeps/x86_64/multiarch/mempcpy.S
+++ b/libc/sysdeps/x86_64/multiarch/mempcpy.S
@@ -1,5 +1,6 @@
/* Multiple versions of mempcpy
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -43,6 +44,8 @@ END(__mempcpy)
# define ENTRY(name) \
.type __mempcpy_sse2, @function; \
.p2align 4; \
+ .globl __mempcpy_sse2; \
+ .hidden __mempcpy_sse2; \
__mempcpy_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/mempcpy_chk.S b/libc/sysdeps/x86_64/multiarch/mempcpy_chk.S
index 604a72108..a3d3a59cb 100644
--- a/libc/sysdeps/x86_64/multiarch/mempcpy_chk.S
+++ b/libc/sysdeps/x86_64/multiarch/mempcpy_chk.S
@@ -1,5 +1,6 @@
/* Multiple versions of __mempcpy_chk
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/memset.S b/libc/sysdeps/x86_64/multiarch/memset.S
index 1a7fa2dc7..f7c6a9f11 100644
--- a/libc/sysdeps/x86_64/multiarch/memset.S
+++ b/libc/sysdeps/x86_64/multiarch/memset.S
@@ -1,5 +1,6 @@
/* Multiple versions of memset
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +34,11 @@ ENTRY(memset)
2: ret
END(memset)
+/* Define internal IFUNC memset for bzero. */
+ .globl __libc_memset
+ .hidden __libc_memset
+ __libc_memset = memset
+
# define USE_SSE2 1
# undef ENTRY
diff --git a/libc/sysdeps/x86_64/multiarch/memset_chk.S b/libc/sysdeps/x86_64/multiarch/memset_chk.S
index 47d884114..5a10f1796 100644
--- a/libc/sysdeps/x86_64/multiarch/memset_chk.S
+++ b/libc/sysdeps/x86_64/multiarch/memset_chk.S
@@ -1,5 +1,6 @@
/* Multiple versions of __memset_chk
- Copyright (C) 2010 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2010-2012 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
diff --git a/libc/sysdeps/x86_64/multiarch/rawmemchr.S b/libc/sysdeps/x86_64/multiarch/rawmemchr.S
index c4157add8..be6ce84c0 100644
--- a/libc/sysdeps/x86_64/multiarch/rawmemchr.S
+++ b/libc/sysdeps/x86_64/multiarch/rawmemchr.S
@@ -1,4 +1,6 @@
-/* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+/* Multiple versions of rawmemchr
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@redhat.com>.
This file is part of the GNU C Library.
@@ -44,6 +46,8 @@ strong_alias (rawmemchr, __rawmemchr)
.section .text.sse4.2,"ax",@progbits
.align 16
.type __rawmemchr_sse42, @function
+ .globl __rawmemchr_sse42
+ .hidden __rawmemchr_sse42
__rawmemchr_sse42:
cfi_startproc
CALL_MCOUNT
@@ -81,6 +85,8 @@ __rawmemchr_sse42:
# define ENTRY(name) \
.type __rawmemchr_sse2, @function; \
.align 16; \
+ .globl __rawmemchr_sse2; \
+ .hidden __rawmemchr_sse2; \
__rawmemchr_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/stpcpy.S b/libc/sysdeps/x86_64/multiarch/stpcpy.S
index b63d308ed..ee81ab6ae 100644
--- a/libc/sysdeps/x86_64/multiarch/stpcpy.S
+++ b/libc/sysdeps/x86_64/multiarch/stpcpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of stpcpy
+ All versions must be listed in ifunc-impl-list.c. */
#define USE_AS_STPCPY
#define STRCPY __stpcpy
#include "strcpy.S"
diff --git a/libc/sysdeps/x86_64/multiarch/stpncpy.S b/libc/sysdeps/x86_64/multiarch/stpncpy.S
index ff89a8949..2698ca6a8 100644
--- a/libc/sysdeps/x86_64/multiarch/stpncpy.S
+++ b/libc/sysdeps/x86_64/multiarch/stpncpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of stpncpy
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCPY __stpncpy
#define USE_AS_STPCPY
#define USE_AS_STRNCPY
diff --git a/libc/sysdeps/x86_64/multiarch/strcasecmp_l.S b/libc/sysdeps/x86_64/multiarch/strcasecmp_l.S
index 5456b3a49..49f5b9fd9 100644
--- a/libc/sysdeps/x86_64/multiarch/strcasecmp_l.S
+++ b/libc/sysdeps/x86_64/multiarch/strcasecmp_l.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strcasecmp and strcasecmp_l
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCMP __strcasecmp_l
#define USE_AS_STRCASECMP_L
#include "strcmp.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strcasestr-c.c b/libc/sysdeps/x86_64/multiarch/strcasestr-c.c
index 551492d8f..c13a4c44f 100644
--- a/libc/sysdeps/x86_64/multiarch/strcasestr-c.c
+++ b/libc/sysdeps/x86_64/multiarch/strcasestr-c.c
@@ -1,3 +1,6 @@
+/* Multiple versions of strcasestr
+ All versions must be listed in ifunc-impl-list.c. */
+
#include "init-arch.h"
#define STRCASESTR __strcasestr_sse2
diff --git a/libc/sysdeps/x86_64/multiarch/strcat.S b/libc/sysdeps/x86_64/multiarch/strcat.S
index 0c256dee3..ec486680e 100644
--- a/libc/sysdeps/x86_64/multiarch/strcat.S
+++ b/libc/sysdeps/x86_64/multiarch/strcat.S
@@ -1,5 +1,6 @@
/* Multiple versions of strcat
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -63,6 +64,8 @@ END(STRCAT)
# define ENTRY(name) \
.type STRCAT_SSE2, @function; \
.align 16; \
+ .globl STRCAT_SSE2; \
+ .hidden STRCAT_SSE2; \
STRCAT_SSE2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strchr.S b/libc/sysdeps/x86_64/multiarch/strchr.S
index b9f88e4bd..5b589bab6 100644
--- a/libc/sysdeps/x86_64/multiarch/strchr.S
+++ b/libc/sysdeps/x86_64/multiarch/strchr.S
@@ -1,5 +1,5 @@
-/* strchr with SSE4.2
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+/* Multiple versions of strchr
+ Copyright (C) 2009-2012 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
@@ -82,6 +82,8 @@ END(strchr)
.section .text.sse4.2,"ax",@progbits
.align 16
.type __strchr_sse42, @function
+ .globl __strchr_sse42
+ .hidden __strchr_sse42
__strchr_sse42:
cfi_startproc
CALL_MCOUNT
@@ -164,6 +166,8 @@ L(loop_exit):
# define ENTRY(name) \
.type __strchr_sse2, @function; \
.align 16; \
+ .globl __strchr_sse2; \
+ .hidden __strchr_sse2; \
__strchr_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strcmp-sse42.S b/libc/sysdeps/x86_64/multiarch/strcmp-sse42.S
index 9d00bbc5a..e13b8adb7 100644
--- a/libc/sysdeps/x86_64/multiarch/strcmp-sse42.S
+++ b/libc/sysdeps/x86_64/multiarch/strcmp-sse42.S
@@ -1,5 +1,5 @@
/* strcmp with SSE4.2
- Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -48,6 +48,8 @@
.section .text.SECTION,"ax",@progbits
.align 16
.type STRCMP_SSE42, @function
+ .globl STRCMP_SSE42
+ .hidden STRCMP_SSE42
#ifdef USE_AS_STRCASECMP_L
ENTRY (GLABEL(__strcasecmp))
movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
diff --git a/libc/sysdeps/x86_64/multiarch/strcmp.S b/libc/sysdeps/x86_64/multiarch/strcmp.S
index d366d0969..f64ff46c7 100644
--- a/libc/sysdeps/x86_64/multiarch/strcmp.S
+++ b/libc/sysdeps/x86_64/multiarch/strcmp.S
@@ -1,4 +1,4 @@
-/* strcmp with SSE4.2
+/* Multiple versions of strcmp
Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -171,6 +171,8 @@ weak_alias (__strncasecmp, strncasecmp)
# define ENTRY(name) \
.type STRCMP_SSE2, @function; \
.align 16; \
+ .globl STRCMP_SSE2; \
+ .hidden STRCMP_SSE2; \
STRCMP_SSE2: cfi_startproc; \
CALL_MCOUNT
# undef END
@@ -181,6 +183,8 @@ weak_alias (__strncasecmp, strncasecmp)
# define ENTRY2(name) \
.type __strcasecmp_sse2, @function; \
.align 16; \
+ .globl __strcasecmp_sse2; \
+ .hidden __strcasecmp_sse2; \
__strcasecmp_sse2: cfi_startproc; \
CALL_MCOUNT
# define END2(name) \
@@ -191,6 +195,8 @@ weak_alias (__strncasecmp, strncasecmp)
# define ENTRY2(name) \
.type __strncasecmp_sse2, @function; \
.align 16; \
+ .globl __strncasecmp_sse2; \
+ .hidden __strncasecmp_sse2; \
__strncasecmp_sse2: cfi_startproc; \
CALL_MCOUNT
# define END2(name) \
diff --git a/libc/sysdeps/x86_64/multiarch/strcpy.S b/libc/sysdeps/x86_64/multiarch/strcpy.S
index 7be1b8be7..082d03e9f 100644
--- a/libc/sysdeps/x86_64/multiarch/strcpy.S
+++ b/libc/sysdeps/x86_64/multiarch/strcpy.S
@@ -1,5 +1,6 @@
/* Multiple versions of strcpy
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -77,6 +78,8 @@ END(STRCPY)
# define ENTRY(name) \
.type STRCPY_SSE2, @function; \
.align 16; \
+ .globl STRCPY_SSE2; \
+ .hidden STRCPY_SSE2; \
STRCPY_SSE2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strcspn.S b/libc/sysdeps/x86_64/multiarch/strcspn.S
index 715a1c45c..2d35ea6f8 100644
--- a/libc/sysdeps/x86_64/multiarch/strcspn.S
+++ b/libc/sysdeps/x86_64/multiarch/strcspn.S
@@ -1,5 +1,6 @@
/* Multiple versions of strcspn
- Copyright (C) 2009 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/strlen.S b/libc/sysdeps/x86_64/multiarch/strlen.S
index 0c46b4f40..f93432e12 100644
--- a/libc/sysdeps/x86_64/multiarch/strlen.S
+++ b/libc/sysdeps/x86_64/multiarch/strlen.S
@@ -1,5 +1,6 @@
-/* strlen(str) -- determine the length of the string STR.
- Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Multiple versions of strlen(str) -- determine the length of the string STR.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@redhat.com>.
This file is part of the GNU C Library.
@@ -49,6 +50,8 @@ END(strlen)
# define ENTRY(name) \
.type __strlen_sse2, @function; \
.align 16; \
+ .globl __strlen_sse2; \
+ .hidden __strlen_sse2; \
__strlen_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strncase_l.S b/libc/sysdeps/x86_64/multiarch/strncase_l.S
index c725cd85b..9c0149788 100644
--- a/libc/sysdeps/x86_64/multiarch/strncase_l.S
+++ b/libc/sysdeps/x86_64/multiarch/strncase_l.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncasecmp and strncasecmp_l
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCMP __strncasecmp_l
#define USE_AS_STRNCASECMP_L
#include "strcmp.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strncat.S b/libc/sysdeps/x86_64/multiarch/strncat.S
index fd569c223..5c1bf4145 100644
--- a/libc/sysdeps/x86_64/multiarch/strncat.S
+++ b/libc/sysdeps/x86_64/multiarch/strncat.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncat
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCAT strncat
#define USE_AS_STRNCAT
#include "strcat.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strncmp.S b/libc/sysdeps/x86_64/multiarch/strncmp.S
index 0af34e7f1..fd5eb1397 100644
--- a/libc/sysdeps/x86_64/multiarch/strncmp.S
+++ b/libc/sysdeps/x86_64/multiarch/strncmp.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncmp
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCMP strncmp
#define USE_AS_STRNCMP
#include "strcmp.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strncpy.S b/libc/sysdeps/x86_64/multiarch/strncpy.S
index 327a4ce44..6d87a0ba3 100644
--- a/libc/sysdeps/x86_64/multiarch/strncpy.S
+++ b/libc/sysdeps/x86_64/multiarch/strncpy.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strncpy
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCPY strncpy
#define USE_AS_STRNCPY
#include "strcpy.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strnlen.S b/libc/sysdeps/x86_64/multiarch/strnlen.S
index 044b910c6..4df05fc7d 100644
--- a/libc/sysdeps/x86_64/multiarch/strnlen.S
+++ b/libc/sysdeps/x86_64/multiarch/strnlen.S
@@ -1,5 +1,6 @@
/* multiple version of strnlen
- Copyright (C) 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -40,6 +41,8 @@ END(__strnlen)
# define ENTRY(name) \
.type __strnlen_sse2, @function; \
.align 16; \
+ .globl __strnlen_sse2; \
+ .hidden __strnlen_sse2; \
__strnlen_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strpbrk.S b/libc/sysdeps/x86_64/multiarch/strpbrk.S
index ed5bca6a9..7201d6376 100644
--- a/libc/sysdeps/x86_64/multiarch/strpbrk.S
+++ b/libc/sysdeps/x86_64/multiarch/strpbrk.S
@@ -1,3 +1,5 @@
+/* Multiple versions of strpbrk
+ All versions must be listed in ifunc-impl-list.c. */
#define STRCSPN strpbrk
#define USE_AS_STRPBRK
#include "strcspn.S"
diff --git a/libc/sysdeps/x86_64/multiarch/strrchr.S b/libc/sysdeps/x86_64/multiarch/strrchr.S
index c87d8fae0..6e548e504 100644
--- a/libc/sysdeps/x86_64/multiarch/strrchr.S
+++ b/libc/sysdeps/x86_64/multiarch/strrchr.S
@@ -1,5 +1,6 @@
-/* strrchr with SSE4.2
- Copyright (C) 2009 Free Software Foundation, Inc.
+/* Multiple versions of strrchr
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 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
@@ -87,6 +88,8 @@ END(strrchr)
.section .text.sse4.2,"ax",@progbits
.align 16
.type __strrchr_sse42, @function
+ .globl __strrchr_sse42
+ .hidden __strrchr_sse42
__strrchr_sse42:
cfi_startproc
CALL_MCOUNT
@@ -265,6 +268,8 @@ L(psrldq_table):
# define ENTRY(name) \
.type __strrchr_sse2, @function; \
.align 16; \
+ .globl __strrchr_sse2; \
+ .hidden __strrchr_sse2; \
__strrchr_sse2: cfi_startproc; \
CALL_MCOUNT
# undef END
diff --git a/libc/sysdeps/x86_64/multiarch/strspn.S b/libc/sysdeps/x86_64/multiarch/strspn.S
index 2d7288809..b4ee900c8 100644
--- a/libc/sysdeps/x86_64/multiarch/strspn.S
+++ b/libc/sysdeps/x86_64/multiarch/strspn.S
@@ -1,5 +1,6 @@
/* Multiple versions of strspn
- Copyright (C) 2009 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/strstr-c.c b/libc/sysdeps/x86_64/multiarch/strstr-c.c
index e05c5f127..bb1f8c915 100644
--- a/libc/sysdeps/x86_64/multiarch/strstr-c.c
+++ b/libc/sysdeps/x86_64/multiarch/strstr-c.c
@@ -1,4 +1,5 @@
/* Multiple versions of strstr.
+ All versions must be listed in ifunc-impl-list.c.
Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/wcscpy.S b/libc/sysdeps/x86_64/multiarch/wcscpy.S
index 194df007c..29261aae6 100644
--- a/libc/sysdeps/x86_64/multiarch/wcscpy.S
+++ b/libc/sysdeps/x86_64/multiarch/wcscpy.S
@@ -1,5 +1,6 @@
/* Multiple versions of wcscpy
- Copyright (C) 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/sysdeps/x86_64/multiarch/wmemcmp.S b/libc/sysdeps/x86_64/multiarch/wmemcmp.S
index 1bb529f04..98a187dc2 100644
--- a/libc/sysdeps/x86_64/multiarch/wmemcmp.S
+++ b/libc/sysdeps/x86_64/multiarch/wmemcmp.S
@@ -1,5 +1,6 @@
/* Multiple versions of wmemcmp
- Copyright (C) 2011 Free Software Foundation, Inc.
+ All versions must be listed in ifunc-impl-list.c.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
diff --git a/libc/wcsmbs/Makefile b/libc/wcsmbs/Makefile
index 3ca9e23ab..ec8937096 100644
--- a/libc/wcsmbs/Makefile
+++ b/libc/wcsmbs/Makefile
@@ -56,6 +56,8 @@ tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
+= tst-wcstof wcsmbs-tst1 tst-wcsnlen \
tst-wcpncpy tst-mbsrtowcs \
wcsatcliff $(addprefix test-,$(strop-tests))
+tests-ifunc := $(strop-tests:%=test-%-ifunc)
+tests += $(tests-ifunc)
include ../Rules
diff --git a/libc/wcsmbs/test-wcschr-ifunc.c b/libc/wcsmbs/test-wcschr-ifunc.c
new file mode 100644
index 000000000..f550d5185
--- /dev/null
+++ b/libc/wcsmbs/test-wcschr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wcschr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wcschr.c"
diff --git a/libc/wcsmbs/test-wcscmp-ifunc.c b/libc/wcsmbs/test-wcscmp-ifunc.c
new file mode 100644
index 000000000..bef97d9a3
--- /dev/null
+++ b/libc/wcsmbs/test-wcscmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wcscmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wcscmp.c"
diff --git a/libc/wcsmbs/test-wcscpy-ifunc.c b/libc/wcsmbs/test-wcscpy-ifunc.c
new file mode 100644
index 000000000..0e38971e3
--- /dev/null
+++ b/libc/wcsmbs/test-wcscpy-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wcscpy function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wcscpy.c"
diff --git a/libc/wcsmbs/test-wcslen-ifunc.c b/libc/wcsmbs/test-wcslen-ifunc.c
new file mode 100644
index 000000000..baac78fa4
--- /dev/null
+++ b/libc/wcsmbs/test-wcslen-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wcslen function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wcslen.c"
diff --git a/libc/wcsmbs/test-wcsrchr-ifunc.c b/libc/wcsmbs/test-wcsrchr-ifunc.c
new file mode 100644
index 000000000..28a5106c4
--- /dev/null
+++ b/libc/wcsmbs/test-wcsrchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wcsrchr function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wcsrchr.c"
diff --git a/libc/wcsmbs/test-wmemcmp-ifunc.c b/libc/wcsmbs/test-wmemcmp-ifunc.c
new file mode 100644
index 000000000..a6110b4f9
--- /dev/null
+++ b/libc/wcsmbs/test-wmemcmp-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of wmemcmp function.
+ Copyright (C) 2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-wmemcmp.c"