summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-24 14:50:46 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-24 14:50:46 -0700
commit6e6249d0b461b952d0f544792372663feb6d792a (patch)
tree555d1ac3a5e2ca9030d15f2e1760aea1a2e69ba7
parent0cae3f4b033e441d820f4521fa5736e4e6e4d713 (diff)
downloadglibc-6e6249d0b461b952d0f544792372663feb6d792a.tar.gz
glibc-6e6249d0b461b952d0f544792372663feb6d792a.tar.xz
glibc-6e6249d0b461b952d0f544792372663feb6d792a.zip
BZ#14743: Move clock_* symbols from librt to libc.
-rw-r--r--ChangeLog58
-rw-r--r--NEWS12
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure7
-rw-r--r--configure.in6
-rw-r--r--include/time.h6
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/Makefile27
-rw-r--r--nscd/Makefile6
-rw-r--r--ports/ChangeLog.alpha5
-rw-r--r--ports/ChangeLog.arm5
-rw-r--r--ports/ChangeLog.ia648
-rw-r--r--ports/ChangeLog.m68k6
-rw-r--r--ports/ChangeLog.mips6
-rw-r--r--ports/ChangeLog.powerpc7
-rw-r--r--ports/ChangeLog.tile9
-rw-r--r--ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c8
-rw-r--r--ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist5
-rw-r--r--ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist5
-rw-r--r--posix/Makefile8
-rw-r--r--rt/Makefile7
-rw-r--r--rt/Versions14
-rw-r--r--rt/clock-compat.c65
-rw-r--r--rt/clock_getcpuclockid.c4
-rw-r--r--rt/clock_getres.c4
-rw-r--r--rt/clock_gettime.c5
-rw-r--r--rt/clock_nanosleep.c1
-rw-r--r--rt/clock_settime.c4
-rw-r--r--sysdeps/posix/clock_getres.c3
-rw-r--r--sysdeps/unix/clock_gettime.c4
-rw-r--r--sysdeps/unix/clock_nanosleep.c3
-rw-r--r--sysdeps/unix/clock_settime.c3
-rw-r--r--sysdeps/unix/sysv/linux/clock_getcpuclockid.c1
-rw-r--r--sysdeps/unix/sysv/linux/clock_nanosleep.c1
-rw-r--r--sysdeps/unix/sysv/linux/i386/get_clockfreq.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/sh/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c30
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist5
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist5
56 files changed, 385 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c9a31e2eb..28f485a06a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+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.
diff --git a/NEWS b/NEWS
index 0e10112a35..a1cc1287fd 100644
--- a/NEWS
+++ b/NEWS
@@ -16,7 +16,8 @@ Version 2.17
   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.
+  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
@@ -54,6 +55,13 @@ Version 2.17
   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
 
@@ -81,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/config.h.in b/config.h.in
index 5f9f3c39d5..653df54e56 100644
--- a/config.h.in
+++ b/config.h.in
@@ -180,6 +180,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/configure b/configure
index 8cd403bf4e..35b06c1473 100755
--- a/configure
+++ b/configure
@@ -7456,6 +7456,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.
 
diff --git a/configure.in b/configure.in
index 4f7bc09842..928b7b62a9 100644
--- a/configure.in
+++ b/configure.in
@@ -2123,6 +2123,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)
diff --git a/include/time.h b/include/time.h
index f056542a10..9be15b9739 100644
--- a/include/time.h
+++ b/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/nptl/ChangeLog b/nptl/ChangeLog
index 5a3ab06604..d0b5d6c7b8 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+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.
diff --git a/nptl/Makefile b/nptl/Makefile
index 21a876652e..7387a640b9 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -484,31 +484,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)
diff --git a/nscd/Makefile b/nscd/Makefile
index de754d2a43..0f8efcfb7c 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -101,9 +101,7 @@ 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) \
-	       $(common-objpfx)nis/libnsl.so
+$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
 else
-$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \
-	       $(common-objpfx)nis/libnsl.a
+$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
 endif
diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha
index 8cddb777eb..8ddde9f25f 100644
--- a/ports/ChangeLog.alpha
+++ b/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/ports/ChangeLog.arm b/ports/ChangeLog.arm
index 6fcfc7ada8..0b76f5ed22 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,8 @@
+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):
diff --git a/ports/ChangeLog.ia64 b/ports/ChangeLog.ia64
index 641033b298..8d8f4dcd7c 100644
--- a/ports/ChangeLog.ia64
+++ b/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/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
index e9b4f36890..dda8cf7ee8 100644
--- a/ports/ChangeLog.m68k
+++ b/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/ports/ChangeLog.mips b/ports/ChangeLog.mips
index 12af7965bb..a6aecad24e 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,3 +1,9 @@
+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
diff --git a/ports/ChangeLog.powerpc b/ports/ChangeLog.powerpc
index aa55956021..642e7165c6 100644
--- a/ports/ChangeLog.powerpc
+++ b/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/ports/ChangeLog.tile b/ports/ChangeLog.tile
index dfe5e9c60f..93c99ac695 100644
--- a/ports/ChangeLog.tile
+++ b/ports/ChangeLog.tile
@@ -1,3 +1,12 @@
+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.
diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
index f8a3295add..1d0cc7ec31 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
index 5523fdd2a3..ceab6b2cd9 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c b/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
index 4c1777a516..cb8025ebe0 100644
--- a/ports/sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
+++ b/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/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
index b73f5ca8f7..b3510fe2a2 100644
--- a/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
index 9a924571e8..3c40379aac 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
index fbcd20897b..f998b1b276 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
index 54e8d1a94e..7378869236 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
index 0e21194ac1..22b3068d8f 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index 481162e99f..f2682b39c0 100644
--- a/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
index 48f0c69eb8..d79b2df55d 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
index 3aa70a1004..f617405675 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
+++ b/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/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
index 48f0c69eb8..d79b2df55d 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
+++ b/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/posix/Makefile b/posix/Makefile
index 86e6c6bede..add2ca5be6 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -277,14 +277,6 @@ $(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
 $(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
 	$(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
 
-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
-
 $(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@
 
diff --git a/rt/Makefile b/rt/Makefile
index 26d4ffaaf6..4805f8b5b7 100644
--- a/rt/Makefile
+++ b/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 \
diff --git a/rt/Versions b/rt/Versions
index 2921c9c8ab..91e3fd2a20 100644
--- a/rt/Versions
+++ b/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/rt/clock-compat.c b/rt/clock-compat.c
new file mode 100644
index 0000000000..16e4109210
--- /dev/null
+++ b/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/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c
index 08972f54fd..4bead25685 100644
--- a/rt/clock_getcpuclockid.c
+++ b/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/rt/clock_getres.c b/rt/clock_getres.c
index 576c9bf738..162c8a5697 100644
--- a/rt/clock_getres.c
+++ b/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/rt/clock_gettime.c b/rt/clock_gettime.c
index 1203f01179..5139e8724c 100644
--- a/rt/clock_gettime.c
+++ b/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/rt/clock_nanosleep.c b/rt/clock_nanosleep.c
index 0b16ad2d4f..d9a0e92d4b 100644
--- a/rt/clock_nanosleep.c
+++ b/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/rt/clock_settime.c b/rt/clock_settime.c
index 3b3c3c48d5..6f7cdd6edc 100644
--- a/rt/clock_settime.c
+++ b/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/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 938877e937..678257b3aa 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/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/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index db6643a1c4..c9a91e3376 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/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/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
index 1b43996551..c39f6a79ca 100644
--- a/sysdeps/unix/clock_nanosleep.c
+++ b/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/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index 97caa0d0fd..e09463a561 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/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/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
index 8700354a92..c00f5ea064 100644
--- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+++ b/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/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 110296363a..b12bd868f2 100644
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/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/sysdeps/unix/sysv/linux/i386/get_clockfreq.c b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
index 821e35e4c2..920b0d553e 100644
--- a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
+++ b/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/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist b/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
index 0e8576fdd5..67d592959b 100644
--- a/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 6bdf4dc7f5..4ff7e849c3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/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/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
index ab96361d40..a3cd89540d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
index a60b72ad1a..0a80d0c57d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
index ff0b82f51f..d9914ff53f 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
index 2fb0786942..ef1ead3069 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
index 3fd150e7e5..733b550fee 100644
--- a/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
index 7d5a3429fd..3a96ea883b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
index cbb817952e..67ff77fa8c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
+++ b/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/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
index 6d6e57c114..aa892b8b8b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
index d6ab153e19..a42d424cde 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
+++ b/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/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
index 65bcead8bc..108b80fb43 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
+++ b/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