diff mbox series

[v2,02/10] Finish move of clock_* functions to libc.

Message ID 20190828153236.18229-3-zackw@panix.com
State New
Headers show
Series Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions. | expand

Commit Message

Zack Weinberg Aug. 28, 2019, 3:32 p.m. UTC
In glibc 2.17, the functions clock_getcpuclockid, clock_getres,
clock_gettime, clock_nanosleep, and clock_settime were moved from
librt.so to libc.so, leaving compatibility stubs behind.  Now that the
dynamic linker no longer insists on finding versioned symbols in the
same library that originally defined them, we do not need the stubs
anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases
for most of the functions anymore either.  (clock_gettime still needs
one.)  For ports added before 2.17, libc.so needs to provide two
symbol versions for each, the default at GLIBC_2.17 plus a compat
version matching what librt had.

While I'm at it, move the clock_*.c files and their tests from rt/ to
time/.

	* rt/clock_getcpuclockid.c: Move to time/clock_getcpuclockid.c.
	* rt/clock_getres.c: Move to time/clock_getres.c.
	* rt/clock_gettime.c: Move to time/clock_gettime.c.
	* rt/clock_nanosleep.c: Move to time/clock_nanosleep.c.
	* rt/clock_settime.c: Move to time/clock_settime.c.
	* rt/tst-clock.c: Move to time/tst-clock.c.
	* rt/tst-clock2.c: Move to time/tst-clock2.c.
	* rt/tst-clock_nanosleep.c: Move to time/tst-clock_nanosleep.c.
	* rt/tst-cpuclock1.c: Move to time/tst-cpuclock1.c.
	* rt/clock-compat.c: Delete file.

	* time/clock_getcpuclockid.c
	* time/clock_getres.c
	* time/clock_gettime.c
	* time/clock_nanosleep.c
	* time/clock_settime.c
	* sysdeps/posix/clock_getres.c
	* sysdeps/unix/clock_gettime.c
	* sysdeps/unix/clock_nanosleep.c
	* sysdeps/unix/clock_settime.c
	* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
	* sysdeps/unix/sysv/linux/clock_getres.c
	* sysdeps/unix/sysv/linux/clock_gettime.c
	* sysdeps/unix/sysv/linux/clock_nanosleep.c
	* sysdeps/unix/sysv/linux/clock_settime.c: Define the function
	defined by this file with default symbol version GLIBC_2_17,
	and optionally a compatibility alias at symbol version GLIBC_2_2.
	* include/time.h: Remove internal prototypes for clock_getres,
	clock_nanosleep, and clock_getcpuclockid.

	* sysdeps/unix/sysv/linux/clock_gettime.c: Prune includes.
	Remove unused function realtime_gettime.

	* rt/Makefile (clock-routines, routines): Remove variable.
	(librt-routines): Remove clock-compat.
	(tests): Remove tst-clock, tst-clock2, tst-clock_nanosleep,
	and tst-cpuclock1.
	* time/Makefile (routines): Add clock_getres, clock_gettime,
	clock_settime, clock_getcpuclockid, and clock_nanosleep.
	(tests): Add tst-clock, tst-clock2, tst-clock_nanosleep,
	and tst-cpuclock1.

	* rt/Versions (libc): Remove entire stanza.
	(librt GLIBC_2.2): Remove all clock_* functions.
	* time/Versions (libc GLIBC_2.2, libc GLIBC_2.17):
	Add clock_getres, clock_gettime, clock_settime,
	clock_getcpuclockid, and clock_nanosleep.
	(libc GLIBC_PRIVATE): Add __clock_gettime.

	* sysdeps/mach/hurd/i386/librt.abilist
	* sysdeps/unix/sysv/linux/alpha/librt.abilist
	* sysdeps/unix/sysv/linux/arm/librt.abilist
	* sysdeps/unix/sysv/linux/hppa/librt.abilist
	* sysdeps/unix/sysv/linux/i386/librt.abilist
	* sysdeps/unix/sysv/linux/ia64/librt.abilist
	* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
	* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
	* sysdeps/unix/sysv/linux/microblaze/librt.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
	* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
	* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
	* sysdeps/unix/sysv/linux/sh/librt.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
	* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
	* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist:
	Remove entries for clock_getres, clock_gettime, clock_settime,
	clock_getcpuclockid, and clock_nanosleep.

	* sysdeps/mach/hurd/i386/libc.abilist
	* sysdeps/unix/sysv/linux/alpha/libc.abilist
	* sysdeps/unix/sysv/linux/arm/libc.abilist
	* sysdeps/unix/sysv/linux/hppa/libc.abilist
	* sysdeps/unix/sysv/linux/i386/libc.abilist
	* sysdeps/unix/sysv/linux/ia64/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
	* sysdeps/unix/sysv/linux/sh/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
	Add another set of entries for clock_getres, clock_gettime,
	clock_settime, clock_getcpuclockid, and clock_nanosleep at
	whatever version GLIBC_2.2 maps to.
---
 include/time.h                                |  4 +-
 rt/Makefile                                   | 15 ++---
 rt/Versions                                   | 16 -----
 rt/clock-compat.c                             | 63 -------------------
 sysdeps/mach/hurd/i386/libc.abilist           |  5 ++
 sysdeps/mach/hurd/i386/librt.abilist          |  5 --
 sysdeps/posix/clock_getres.c                  | 11 +++-
 sysdeps/unix/clock_gettime.c                  | 26 +++-----
 sysdeps/unix/clock_nanosleep.c                | 10 ++-
 sysdeps/unix/clock_settime.c                  | 13 +++-
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |  5 ++
 sysdeps/unix/sysv/linux/alpha/librt.abilist   |  5 --
 sysdeps/unix/sysv/linux/arm/libc.abilist      |  5 ++
 sysdeps/unix/sysv/linux/arm/librt.abilist     |  5 --
 sysdeps/unix/sysv/linux/clock_getcpuclockid.c | 10 ++-
 sysdeps/unix/sysv/linux/clock_getres.c        | 11 +++-
 sysdeps/unix/sysv/linux/clock_gettime.c       | 11 +++-
 sysdeps/unix/sysv/linux/clock_nanosleep.c     | 10 ++-
 sysdeps/unix/sysv/linux/clock_settime.c       | 11 +++-
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/hppa/librt.abilist    |  5 --
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/i386/librt.abilist    |  5 --
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/ia64/librt.abilist    |  5 --
 .../sysv/linux/m68k/coldfire/libc.abilist     |  5 ++
 .../sysv/linux/m68k/coldfire/librt.abilist    |  5 --
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  5 ++
 .../unix/sysv/linux/m68k/m680x0/librt.abilist |  5 --
 .../unix/sysv/linux/microblaze/librt.abilist  |  5 --
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  5 ++
 .../unix/sysv/linux/mips/mips32/librt.abilist |  5 --
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  5 ++
 .../unix/sysv/linux/mips/mips64/librt.abilist |  5 --
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  5 ++
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  5 ++
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  5 ++
 .../linux/powerpc/powerpc32/librt.abilist     |  5 --
 .../powerpc/powerpc32/nofpu/libc.abilist      |  5 ++
 .../linux/powerpc/powerpc64/be/libc.abilist   |  5 ++
 .../linux/powerpc/powerpc64/be/librt.abilist  |  5 --
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  5 ++
 .../sysv/linux/s390/s390-32/librt.abilist     |  5 --
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  5 ++
 .../sysv/linux/s390/s390-64/librt.abilist     |  5 --
 sysdeps/unix/sysv/linux/sh/libc.abilist       |  5 ++
 sysdeps/unix/sysv/linux/sh/librt.abilist      |  5 --
 .../sysv/linux/sparc/sparc32/libc.abilist     |  5 ++
 .../sysv/linux/sparc/sparc32/librt.abilist    |  5 --
 .../sysv/linux/sparc/sparc64/libc.abilist     |  5 ++
 .../sysv/linux/sparc/sparc64/librt.abilist    |  5 --
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  5 ++
 .../unix/sysv/linux/x86_64/64/librt.abilist   |  5 --
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  5 ++
 .../unix/sysv/linux/x86_64/x32/librt.abilist  |  5 --
 time/Makefile                                 |  8 ++-
 time/Versions                                 | 13 ++++
 {rt => time}/clock_getcpuclockid.c            |  9 ++-
 {rt => time}/clock_getres.c                   | 11 +++-
 {rt => time}/clock_gettime.c                  | 11 +++-
 {rt => time}/clock_nanosleep.c                | 11 +++-
 {rt => time}/clock_settime.c                  | 12 +++-
 {rt => time}/tst-clock.c                      |  0
 {rt => time}/tst-clock2.c                     |  0
 {rt => time}/tst-clock_nanosleep.c            |  0
 {rt => time}/tst-cpuclock1.c                  |  0
 66 files changed, 268 insertions(+), 228 deletions(-)
 delete mode 100644 rt/clock-compat.c
 rename {rt => time}/clock_getcpuclockid.c (75%)
 rename {rt => time}/clock_getres.c (73%)
 rename {rt => time}/clock_gettime.c (74%)
 rename {rt => time}/clock_nanosleep.c (76%)
 rename {rt => time}/clock_settime.c (71%)
 rename {rt => time}/tst-clock.c (100%)
 rename {rt => time}/tst-clock2.c (100%)
 rename {rt => time}/tst-clock_nanosleep.c (100%)
 rename {rt => time}/tst-cpuclock1.c (100%)

Comments

Adhemerval Zanella Aug. 30, 2019, 5:40 p.m. UTC | #1
On 28/08/2019 12:32, Zack Weinberg wrote:
> In glibc 2.17, the functions clock_getcpuclockid, clock_getres,
> clock_gettime, clock_nanosleep, and clock_settime were moved from
> librt.so to libc.so, leaving compatibility stubs behind.  Now that the
> dynamic linker no longer insists on finding versioned symbols in the
> same library that originally defined them, we do not need the stubs
> anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases
> for most of the functions anymore either.  (clock_gettime still needs
> one.)  For ports added before 2.17, libc.so needs to provide two
> symbol versions for each, the default at GLIBC_2.17 plus a compat
> version matching what librt had.
> 
> While I'm at it, move the clock_*.c files and their tests from rt/ to
> time/.
> 
> 	* rt/clock_getcpuclockid.c: Move to time/clock_getcpuclockid.c.
> 	* rt/clock_getres.c: Move to time/clock_getres.c.
> 	* rt/clock_gettime.c: Move to time/clock_gettime.c.
> 	* rt/clock_nanosleep.c: Move to time/clock_nanosleep.c.
> 	* rt/clock_settime.c: Move to time/clock_settime.c.
> 	* rt/tst-clock.c: Move to time/tst-clock.c.
> 	* rt/tst-clock2.c: Move to time/tst-clock2.c.
> 	* rt/tst-clock_nanosleep.c: Move to time/tst-clock_nanosleep.c.
> 	* rt/tst-cpuclock1.c: Move to time/tst-cpuclock1.c.
> 	* rt/clock-compat.c: Delete file.
> 
> 	* time/clock_getcpuclockid.c
> 	* time/clock_getres.c
> 	* time/clock_gettime.c
> 	* time/clock_nanosleep.c
> 	* time/clock_settime.c
> 	* sysdeps/posix/clock_getres.c
> 	* sysdeps/unix/clock_gettime.c
> 	* sysdeps/unix/clock_nanosleep.c
> 	* sysdeps/unix/clock_settime.c
> 	* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> 	* sysdeps/unix/sysv/linux/clock_getres.c
> 	* sysdeps/unix/sysv/linux/clock_gettime.c
> 	* sysdeps/unix/sysv/linux/clock_nanosleep.c
> 	* sysdeps/unix/sysv/linux/clock_settime.c: Define the function
> 	defined by this file with default symbol version GLIBC_2_17,
> 	and optionally a compatibility alias at symbol version GLIBC_2_2.
> 	* include/time.h: Remove internal prototypes for clock_getres,
> 	clock_nanosleep, and clock_getcpuclockid.
> 
> 	* sysdeps/unix/sysv/linux/clock_gettime.c: Prune includes.
> 	Remove unused function realtime_gettime.
> 
> 	* rt/Makefile (clock-routines, routines): Remove variable.
> 	(librt-routines): Remove clock-compat.
> 	(tests): Remove tst-clock, tst-clock2, tst-clock_nanosleep,
> 	and tst-cpuclock1.
> 	* time/Makefile (routines): Add clock_getres, clock_gettime,
> 	clock_settime, clock_getcpuclockid, and clock_nanosleep.
> 	(tests): Add tst-clock, tst-clock2, tst-clock_nanosleep,
> 	and tst-cpuclock1.
> 
> 	* rt/Versions (libc): Remove entire stanza.
> 	(librt GLIBC_2.2): Remove all clock_* functions.
> 	* time/Versions (libc GLIBC_2.2, libc GLIBC_2.17):
> 	Add clock_getres, clock_gettime, clock_settime,
> 	clock_getcpuclockid, and clock_nanosleep.
> 	(libc GLIBC_PRIVATE): Add __clock_gettime.
> 
> 	* sysdeps/mach/hurd/i386/librt.abilist
> 	* sysdeps/unix/sysv/linux/alpha/librt.abilist
> 	* sysdeps/unix/sysv/linux/arm/librt.abilist
> 	* sysdeps/unix/sysv/linux/hppa/librt.abilist
> 	* sysdeps/unix/sysv/linux/i386/librt.abilist
> 	* sysdeps/unix/sysv/linux/ia64/librt.abilist
> 	* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
> 	* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
> 	* sysdeps/unix/sysv/linux/microblaze/librt.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
> 	* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
> 	* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
> 	* sysdeps/unix/sysv/linux/sh/librt.abilist
> 	* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
> 	* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
> 	* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
> 	* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist:
> 	Remove entries for clock_getres, clock_gettime, clock_settime,
> 	clock_getcpuclockid, and clock_nanosleep.
> 
> 	* sysdeps/mach/hurd/i386/libc.abilist
> 	* sysdeps/unix/sysv/linux/alpha/libc.abilist
> 	* sysdeps/unix/sysv/linux/arm/libc.abilist
> 	* sysdeps/unix/sysv/linux/hppa/libc.abilist
> 	* sysdeps/unix/sysv/linux/i386/libc.abilist
> 	* sysdeps/unix/sysv/linux/ia64/libc.abilist
> 	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> 	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> 	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> 	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> 	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> 	* sysdeps/unix/sysv/linux/sh/libc.abilist
> 	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> 	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> 	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> 	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
> 	Add another set of entries for clock_getres, clock_gettime,
> 	clock_settime, clock_getcpuclockid, and clock_nanosleep at
> 	whatever version GLIBC_2.2 maps to.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>


> ---
>  include/time.h                                |  4 +-
>  rt/Makefile                                   | 15 ++---
>  rt/Versions                                   | 16 -----
>  rt/clock-compat.c                             | 63 -------------------
>  sysdeps/mach/hurd/i386/libc.abilist           |  5 ++
>  sysdeps/mach/hurd/i386/librt.abilist          |  5 --
>  sysdeps/posix/clock_getres.c                  | 11 +++-
>  sysdeps/unix/clock_gettime.c                  | 26 +++-----
>  sysdeps/unix/clock_nanosleep.c                | 10 ++-
>  sysdeps/unix/clock_settime.c                  | 13 +++-
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |  5 ++
>  sysdeps/unix/sysv/linux/alpha/librt.abilist   |  5 --
>  sysdeps/unix/sysv/linux/arm/libc.abilist      |  5 ++
>  sysdeps/unix/sysv/linux/arm/librt.abilist     |  5 --
>  sysdeps/unix/sysv/linux/clock_getcpuclockid.c | 10 ++-
>  sysdeps/unix/sysv/linux/clock_getres.c        | 11 +++-
>  sysdeps/unix/sysv/linux/clock_gettime.c       | 11 +++-
>  sysdeps/unix/sysv/linux/clock_nanosleep.c     | 10 ++-
>  sysdeps/unix/sysv/linux/clock_settime.c       | 11 +++-
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |  5 ++
>  sysdeps/unix/sysv/linux/hppa/librt.abilist    |  5 --
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |  5 ++
>  sysdeps/unix/sysv/linux/i386/librt.abilist    |  5 --
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |  5 ++
>  sysdeps/unix/sysv/linux/ia64/librt.abilist    |  5 --
>  .../sysv/linux/m68k/coldfire/libc.abilist     |  5 ++
>  .../sysv/linux/m68k/coldfire/librt.abilist    |  5 --
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  5 ++
>  .../unix/sysv/linux/m68k/m680x0/librt.abilist |  5 --
>  .../unix/sysv/linux/microblaze/librt.abilist  |  5 --
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  5 ++
>  .../unix/sysv/linux/mips/mips32/librt.abilist |  5 --
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  5 ++
>  .../unix/sysv/linux/mips/mips64/librt.abilist |  5 --
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  5 ++
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |  5 ++
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  5 ++
>  .../linux/powerpc/powerpc32/librt.abilist     |  5 --
>  .../powerpc/powerpc32/nofpu/libc.abilist      |  5 ++
>  .../linux/powerpc/powerpc64/be/libc.abilist   |  5 ++
>  .../linux/powerpc/powerpc64/be/librt.abilist  |  5 --
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  5 ++
>  .../sysv/linux/s390/s390-32/librt.abilist     |  5 --
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |  5 ++
>  .../sysv/linux/s390/s390-64/librt.abilist     |  5 --
>  sysdeps/unix/sysv/linux/sh/libc.abilist       |  5 ++
>  sysdeps/unix/sysv/linux/sh/librt.abilist      |  5 --
>  .../sysv/linux/sparc/sparc32/libc.abilist     |  5 ++
>  .../sysv/linux/sparc/sparc32/librt.abilist    |  5 --
>  .../sysv/linux/sparc/sparc64/libc.abilist     |  5 ++
>  .../sysv/linux/sparc/sparc64/librt.abilist    |  5 --
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |  5 ++
>  .../unix/sysv/linux/x86_64/64/librt.abilist   |  5 --
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |  5 ++
>  .../unix/sysv/linux/x86_64/x32/librt.abilist  |  5 --
>  time/Makefile                                 |  8 ++-
>  time/Versions                                 | 13 ++++
>  {rt => time}/clock_getcpuclockid.c            |  9 ++-
>  {rt => time}/clock_getres.c                   | 11 +++-
>  {rt => time}/clock_gettime.c                  | 11 +++-
>  {rt => time}/clock_nanosleep.c                | 11 +++-
>  {rt => time}/clock_settime.c                  | 12 +++-
>  {rt => time}/tst-clock.c                      |  0
>  {rt => time}/tst-clock2.c                     |  0
>  {rt => time}/tst-clock_nanosleep.c            |  0
>  {rt => time}/tst-cpuclock1.c                  |  0
>  66 files changed, 268 insertions(+), 228 deletions(-)
>  delete mode 100644 rt/clock-compat.c
>  rename {rt => time}/clock_getcpuclockid.c (75%)
>  rename {rt => time}/clock_getres.c (73%)
>  rename {rt => time}/clock_gettime.c (74%)
>  rename {rt => time}/clock_nanosleep.c (76%)
>  rename {rt => time}/clock_settime.c (71%)
>  rename {rt => time}/tst-clock.c (100%)
>  rename {rt => time}/tst-clock2.c (100%)
>  rename {rt => time}/tst-clock_nanosleep.c (100%)
>  rename {rt => time}/tst-cpuclock1.c (100%)
> 
> diff --git a/include/time.h b/include/time.h
> index ac3163c2a5..dcf91855ad 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -18,12 +18,10 @@ libc_hidden_proto (localtime)
>  libc_hidden_proto (strftime)
>  libc_hidden_proto (strptime)
>  
> -extern __typeof (clock_getres) __clock_getres;
>  extern __typeof (clock_gettime) __clock_gettime;
>  libc_hidden_proto (__clock_gettime)
>  extern __typeof (clock_settime) __clock_settime;
> -extern __typeof (clock_nanosleep) __clock_nanosleep;
> -extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
> +libc_hidden_proto (__clock_settime)
>  
>  /* Now define the internal interfaces.  */
>  struct tm;

Ok.

> diff --git a/rt/Makefile b/rt/Makefile
> index 9ea8394565..e6fbc32438 100644
> --- a/rt/Makefile
> +++ b/rt/Makefile
> @@ -28,9 +28,6 @@ aio-routines   := aio_cancel aio_error aio_fsync aio_misc aio_read	\
>  		  aio_read64 aio_return aio_suspend aio_write		\
>  		  aio_write64 lio_listio lio_listio64 aio_sigqueue	\
>  		  aio_notify
> -clock-routines := clock_getcpuclockid					\
> -		  clock_getres clock_gettime clock_settime		\
> -		  clock_nanosleep
>  timer-routines := timer_create timer_delete timer_getoverr		\
>  		  timer_gettime timer_settime
>  shm-routines   := shm_open shm_unlink

Ok.

> @@ -38,22 +35,18 @@ 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) \
>  		 $(timer-routines) \
> -		 $(shm-routines) $(mq-routines) \
> -		 clock-compat
> +		 $(shm-routines) $(mq-routines)
>  
> -tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
> +tests := tst-shm tst-timer tst-timer2 \
>  	 tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
>  	 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
>  	 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
>  	 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
>  	 tst-timer3 tst-timer4 tst-timer5 \
> -	 tst-cpuclock1 tst-cpuclock2 \
> -	 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
> -	 tst-clock2 tst-shm-cancel
> +	 tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
> +	 tst-shm-cancel
>  
>  extra-libs := librt
>  extra-libs-others := $(extra-libs)

Ok.

> diff --git a/rt/Versions b/rt/Versions
> index 91e3fd2a20..84d1345420 100644
> --- a/rt/Versions
> +++ b/rt/Versions
> @@ -1,15 +1,3 @@
> -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.
> @@ -18,10 +6,6 @@ librt {
>      aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
>    }
>    GLIBC_2.2 {
> -    # These have moved to libc and are still here only for compatibility.
> -    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
> -    clock_nanosleep;
> -
>      # s*
>      shm_open; shm_unlink;
>  

Ok.

> diff --git a/rt/clock-compat.c b/rt/clock-compat.c
> deleted file mode 100644
> index d8ced3cdc1..0000000000
> --- a/rt/clock-compat.c
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -/* ABI compatibility redirects for clock_* symbols in librt.
> -   Copyright (C) 2012-2019 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>
> -
> -#if HAVE_IFUNC
> -# undef INIT_ARCH
> -# define INIT_ARCH()
> -# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
> -    compat_symbol (librt, name, name, GLIBC_2_2);
> -#else
> -# define COMPAT_REDIRECT(name, proto, arglist)				      \
> -  int									      \
> -  name proto								      \
> -  {									      \
> -    return __##name arglist;						      \
> -  }									      \
> -  compat_symbol (librt, name, name, GLIBC_2_2);
> -#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

Ok.

> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 1fc7ab2433..7c2cb2b05a 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -711,6 +711,11 @@ GLIBC_2.2.6 clntudp_bufcreate F
>  GLIBC_2.2.6 clntudp_create F
>  GLIBC_2.2.6 clntunix_create F
>  GLIBC_2.2.6 clock F
> +GLIBC_2.2.6 clock_getcpuclockid F
> +GLIBC_2.2.6 clock_getres F
> +GLIBC_2.2.6 clock_gettime F
> +GLIBC_2.2.6 clock_nanosleep F
> +GLIBC_2.2.6 clock_settime F
>  GLIBC_2.2.6 close F
>  GLIBC_2.2.6 closedir F
>  GLIBC_2.2.6 closelog F

Ok.

> diff --git a/sysdeps/mach/hurd/i386/librt.abilist b/sysdeps/mach/hurd/i386/librt.abilist
> index d5fe32b3a9..3726e41f06 100644
> --- a/sysdeps/mach/hurd/i386/librt.abilist
> +++ b/sysdeps/mach/hurd/i386/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.2.6 aio_suspend F
>  GLIBC_2.2.6 aio_suspend64 F
>  GLIBC_2.2.6 aio_write F
>  GLIBC_2.2.6 aio_write64 F
> -GLIBC_2.2.6 clock_getcpuclockid F
> -GLIBC_2.2.6 clock_getres F
> -GLIBC_2.2.6 clock_gettime F
> -GLIBC_2.2.6 clock_nanosleep F
> -GLIBC_2.2.6 clock_settime F
>  GLIBC_2.2.6 lio_listio F
>  GLIBC_2.2.6 lio_listio64 F
>  GLIBC_2.2.6 shm_open F

Ok.

> diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
> index 01024a3f55..e529cadb1f 100644
> --- a/sysdeps/posix/clock_getres.c
> +++ b/sysdeps/posix/clock_getres.c
> @@ -22,7 +22,7 @@
>  #include <unistd.h>
>  #include <sys/param.h>
>  #include <libc-internal.h>
> -
> +#include <shlib-compat.h>
>  
>  static inline int
>  realtime_getres (struct timespec *res)
> @@ -62,4 +62,11 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
>  
>    return retval;
>  }
> -weak_alias (__clock_getres, clock_getres)
> +
> +versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
> +/* clock_getres moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_getres, __clock_getres_2);
> +compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
> index 10a6c96d9d..2a82fc1066 100644
> --- a/sysdeps/unix/clock_gettime.c
> +++ b/sysdeps/unix/clock_gettime.c
> @@ -17,24 +17,9 @@
>     <http://www.gnu.org/licenses/>.  */
>  
>  #include <errno.h>
> -#include <stdint.h>
>  #include <time.h>
>  #include <sys/time.h>
> -#include <libc-internal.h>
> -#include <ldsodefs.h>
> -
> -
> -static inline int
> -realtime_gettime (struct timespec *tp)
> -{
> -  struct timeval tv;
> -  int retval = __gettimeofday (&tv, NULL);
> -  if (retval == 0)
> -    /* Convert into `timespec'.  */
> -    TIMEVAL_TO_TIMESPEC (&tv, tp);
> -  return retval;
> -}
> -
> +#include <shlib-compat.h>
>  
>  /* Get current value of CLOCK and store it in TP.  */
>  int
> @@ -60,5 +45,12 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
>  
>    return retval;
>  }
> -weak_alias (__clock_gettime, clock_gettime)
>  libc_hidden_def (__clock_gettime)
> +
> +versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
> +/* clock_gettime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_gettime, __clock_gettime_2);
> +compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
> index b27608570c..6a477520d1 100644
> --- a/sysdeps/unix/clock_nanosleep.c
> +++ b/sysdeps/unix/clock_nanosleep.c
> @@ -20,6 +20,7 @@
>  #include <errno.h>
>  #include <time.h>
>  #include <sysdep-cancel.h>
> +#include <shlib-compat.h>
>  
>  /* This implementation assumes that these is only a `nanosleep' system
>     call.  So we have to remap all other activities.  */
> @@ -76,4 +77,11 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
>  
>    return __nanosleep (req, rem), 0 ? errno : 0;
>  }
> -weak_alias (__clock_nanosleep, clock_nanosleep)
> +
> +versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
> +/* clock_nanosleep moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_nanosleep, __clock_nanosleep_2);
> +compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
> index 109a1ad872..5b398491ab 100644
> --- a/sysdeps/unix/clock_settime.c
> +++ b/sysdeps/unix/clock_settime.c
> @@ -18,8 +18,7 @@
>  #include <errno.h>
>  #include <time.h>
>  #include <sys/time.h>
> -#include <ldsodefs.h>
> -
> +#include <shlib-compat.h>
>  
>  /* Set CLOCK to value TP.  */
>  int
> @@ -51,4 +50,12 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
>  
>    return retval;
>  }
> -weak_alias (__clock_settime, clock_settime)
> +libc_hidden_def (__clock_settime)
> +
> +versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
> +/* clock_settime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_settime, __clock_settime_2);
> +compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index fe85a35620..e7f2174ac2 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -1863,6 +1863,11 @@ GLIBC_2.2 __xpg_sigpause F
>  GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x48
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/alpha/librt.abilist b/sysdeps/unix/sysv/linux/alpha/librt.abilist
> index d7a049cf60..71f86e03ce 100644
> --- a/sysdeps/unix/sysv/linux/alpha/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
> index bc3df8dcea..9371927927 100644
> --- a/sysdeps/unix/sysv/linux/arm/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
> @@ -766,6 +766,11 @@ GLIBC_2.4 clntudp_bufcreate F
>  GLIBC_2.4 clntudp_create F
>  GLIBC_2.4 clntunix_create F
>  GLIBC_2.4 clock F
> +GLIBC_2.4 clock_getcpuclockid F
> +GLIBC_2.4 clock_getres F
> +GLIBC_2.4 clock_gettime F
> +GLIBC_2.4 clock_nanosleep F
> +GLIBC_2.4 clock_settime F
>  GLIBC_2.4 clone F
>  GLIBC_2.4 close F
>  GLIBC_2.4 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/arm/librt.abilist b/sysdeps/unix/sysv/linux/arm/librt.abilist
> index cfbbd27557..3c0647b251 100644
> --- a/sysdeps/unix/sysv/linux/arm/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.4 aio_suspend F
>  GLIBC_2.4 aio_suspend64 F
>  GLIBC_2.4 aio_write F
>  GLIBC_2.4 aio_write64 F
> -GLIBC_2.4 clock_getcpuclockid F
> -GLIBC_2.4 clock_getres F
> -GLIBC_2.4 clock_gettime F
> -GLIBC_2.4 clock_nanosleep F
> -GLIBC_2.4 clock_settime F
>  GLIBC_2.4 lio_listio F
>  GLIBC_2.4 lio_listio64 F
>  GLIBC_2.4 mq_close F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> index f4a652966f..f2d8b916cb 100644
> --- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> +++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> @@ -20,6 +20,7 @@
>  #include <time.h>
>  #include <unistd.h>
>  #include "kernel-posix-cpu-timers.h"
> +#include <shlib-compat.h>
>  
>  int
>  __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> @@ -45,4 +46,11 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
>    else
>      return INTERNAL_SYSCALL_ERRNO (r, err);
>  }
> -weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
> +
> +versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
> +/* clock_getcpuclockid moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
> +compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
> index 24b2299938..18a7ce53c0 100644
> --- a/sysdeps/unix/sysv/linux/clock_getres.c
> +++ b/sysdeps/unix/sysv/linux/clock_getres.c
> @@ -26,10 +26,19 @@
>  #endif
>  #include <sysdep-vdso.h>
>  
> +#include <shlib-compat.h>
> +
>  /* Get resolution of clock.  */
>  int
>  __clock_getres (clockid_t clock_id, struct timespec *res)
>  {
>    return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
>  }
> -weak_alias (__clock_getres, clock_getres)
> +
> +versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
> +/* clock_getres moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_getres, __clock_getres_2);
> +compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
> index 5fc47fb7dc..7ad1c91be6 100644
> --- a/sysdeps/unix/sysv/linux/clock_gettime.c
> +++ b/sysdeps/unix/sysv/linux/clock_gettime.c
> @@ -26,11 +26,20 @@
>  #endif
>  #include <sysdep-vdso.h>
>  
> +#include <shlib-compat.h>
> +
>  /* Get current value of CLOCK and store it in TP.  */
>  int
>  __clock_gettime (clockid_t clock_id, struct timespec *tp)
>  {
>    return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
>  }
> -weak_alias (__clock_gettime, clock_gettime)
>  libc_hidden_def (__clock_gettime)
> +
> +versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
> +/* clock_gettime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_gettime, __clock_gettime_2);
> +compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
> index 0cb6614dc9..e19e09d197 100644
> --- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
> +++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
> @@ -21,6 +21,7 @@
>  #include <sysdep-cancel.h>
>  #include "kernel-posix-cpu-timers.h"
>  
> +#include <shlib-compat.h>
>  
>  /* We can simply use the syscall.  The CPU clocks are not supported
>     with this function.  */
> @@ -41,4 +42,11 @@ __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);
>  }
> -weak_alias (__clock_nanosleep, clock_nanosleep)
> +
> +versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
> +/* clock_nanosleep moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_nanosleep, __clock_nanosleep_2);
> +compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
> +#endif
Ok.

> diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
> index d837e3019c..0586d15722 100644
> --- a/sysdeps/unix/sysv/linux/clock_settime.c
> +++ b/sysdeps/unix/sysv/linux/clock_settime.c
> @@ -18,6 +18,7 @@
>  #include <errno.h>
>  #include <sysdep.h>
>  #include <time.h>
> +#include <shlib-compat.h>
>  
>  #include "kernel-posix-cpu-timers.h"
>  
> @@ -34,4 +35,12 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
>  
>    return INLINE_SYSCALL_CALL (clock_settime, clock_id, tp);
>  }
> -weak_alias (__clock_settime, clock_settime)
> +libc_hidden_def (__clock_settime)
> +
> +versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
> +/* clock_settime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_settime, __clock_settime_2);
> +compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 75edece94a..df6d96fbae 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -615,6 +615,11 @@ GLIBC_2.2 clntudp_bufcreate F
>  GLIBC_2.2 clntudp_create F
>  GLIBC_2.2 clntunix_create F
>  GLIBC_2.2 clock F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 clone F
>  GLIBC_2.2 close F
>  GLIBC_2.2 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/hppa/librt.abilist b/sysdeps/unix/sysv/linux/hppa/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/hppa/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index edeaf8e722..fcb625b6bf 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -1869,6 +1869,11 @@ GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 alphasort64 F
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/i386/librt.abilist b/sysdeps/unix/sysv/linux/i386/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/i386/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index b5d460eeb2..cb556c5998 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -627,6 +627,11 @@ GLIBC_2.2 clntudp_bufcreate F
>  GLIBC_2.2 clntudp_create F
>  GLIBC_2.2 clntunix_create F
>  GLIBC_2.2 clock F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 close F
>  GLIBC_2.2 closedir F
>  GLIBC_2.2 closelog F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/ia64/librt.abilist b/sysdeps/unix/sysv/linux/ia64/librt.abilist
> index 804622a14a..08384c9065 100644
> --- a/sysdeps/unix/sysv/linux/ia64/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 05633b3cb8..f3aa47d090 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -755,6 +755,11 @@ GLIBC_2.4 clntudp_bufcreate F
>  GLIBC_2.4 clntudp_create F
>  GLIBC_2.4 clntunix_create F
>  GLIBC_2.4 clock F
> +GLIBC_2.4 clock_getcpuclockid F
> +GLIBC_2.4 clock_getres F
> +GLIBC_2.4 clock_gettime F
> +GLIBC_2.4 clock_nanosleep F
> +GLIBC_2.4 clock_settime F
>  GLIBC_2.4 clone F
>  GLIBC_2.4 close F
>  GLIBC_2.4 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
> index cfbbd27557..3c0647b251 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.4 aio_suspend F
>  GLIBC_2.4 aio_suspend64 F
>  GLIBC_2.4 aio_write F
>  GLIBC_2.4 aio_write64 F
> -GLIBC_2.4 clock_getcpuclockid F
> -GLIBC_2.4 clock_getres F
> -GLIBC_2.4 clock_gettime F
> -GLIBC_2.4 clock_nanosleep F
> -GLIBC_2.4 clock_settime F
>  GLIBC_2.4 lio_listio F
>  GLIBC_2.4 lio_listio64 F
>  GLIBC_2.4 mq_close F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 47eb7b4608..64d4623b6b 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -1825,6 +1825,11 @@ GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 alphasort64 F
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/microblaze/librt.abilist b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
> index fb85d8729e..889dfbc0ee 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
> @@ -14,11 +14,6 @@ GLIBC_2.18 aio_suspend F
>  GLIBC_2.18 aio_suspend64 F
>  GLIBC_2.18 aio_write F
>  GLIBC_2.18 aio_write64 F
> -GLIBC_2.18 clock_getcpuclockid F
> -GLIBC_2.18 clock_getres F
> -GLIBC_2.18 clock_gettime F
> -GLIBC_2.18 clock_nanosleep F
> -GLIBC_2.18 clock_settime F
>  GLIBC_2.18 lio_listio F
>  GLIBC_2.18 lio_listio64 F
>  GLIBC_2.18 mq_close F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index e49dc4272e..06c2e64edd 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -1612,6 +1612,11 @@ GLIBC_2.2 capget F
>  GLIBC_2.2 capset F
>  GLIBC_2.2 cbc_crypt F
>  GLIBC_2.2 clntunix_create F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 creat64 F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 des_setparity F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
> index 84837c8a2e..1539c1cef9 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
>  GLIBC_2.2 aio_suspend64 F
>  GLIBC_2.2 aio_write F
>  GLIBC_2.2 aio_write64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 lio_listio F
>  GLIBC_2.2 lio_listio64 F
>  GLIBC_2.2 shm_open F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index daa3b60c5b..bdfd073b86 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -1610,6 +1610,11 @@ GLIBC_2.2 capget F
>  GLIBC_2.2 capset F
>  GLIBC_2.2 cbc_crypt F
>  GLIBC_2.2 clntunix_create F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 creat64 F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 des_setparity F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
> index 84837c8a2e..1539c1cef9 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
>  GLIBC_2.2 aio_suspend64 F
>  GLIBC_2.2 aio_write F
>  GLIBC_2.2 aio_write64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 lio_listio F
>  GLIBC_2.2 lio_listio64 F
>  GLIBC_2.2 shm_open F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index 457ce0b6f2..3d61d4974a 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -1611,6 +1611,11 @@ GLIBC_2.2 capget F
>  GLIBC_2.2 capset F
>  GLIBC_2.2 cbc_crypt F
>  GLIBC_2.2 clntunix_create F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 creat64 F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 des_setparity F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 63d5c03bfb..675acca5db 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -1607,6 +1607,11 @@ GLIBC_2.2 capget F
>  GLIBC_2.2 capset F
>  GLIBC_2.2 cbc_crypt F
>  GLIBC_2.2 clntunix_create F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 creat64 F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 des_setparity F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 9200a54309..1e8ff6f83e 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -1830,6 +1830,11 @@ GLIBC_2.2 __xstat64 F
>  GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index ef7779905f..b5a0751d90 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -1834,6 +1834,11 @@ GLIBC_2.2 __xstat64 F
>  GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index 2860df8ebc..0c86217fc6 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -673,6 +673,11 @@ GLIBC_2.3 clntudp_bufcreate F
>  GLIBC_2.3 clntudp_create F
>  GLIBC_2.3 clntunix_create F
>  GLIBC_2.3 clock F
> +GLIBC_2.3 clock_getcpuclockid F
> +GLIBC_2.3 clock_getres F
> +GLIBC_2.3 clock_gettime F
> +GLIBC_2.3 clock_nanosleep F
> +GLIBC_2.3 clock_settime F
>  GLIBC_2.3 clone F
>  GLIBC_2.3 close F
>  GLIBC_2.3 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
> index e76b7eb495..6a5bd96963 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.3 aio_suspend F
>  GLIBC_2.3 aio_suspend64 F
>  GLIBC_2.3 aio_write F
>  GLIBC_2.3 aio_write64 F
> -GLIBC_2.3 clock_getcpuclockid F
> -GLIBC_2.3 clock_getres F
> -GLIBC_2.3 clock_gettime F
> -GLIBC_2.3 clock_nanosleep F
> -GLIBC_2.3 clock_settime F
>  GLIBC_2.3 lio_listio F
>  GLIBC_2.3 lio_listio64 F
>  GLIBC_2.3 shm_open F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index 576295deff..122d0fb65a 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -1829,6 +1829,11 @@ GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 alphasort64 F
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index abf0473683..efe588a072 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -632,6 +632,11 @@ GLIBC_2.2 clntudp_bufcreate F
>  GLIBC_2.2 clntudp_create F
>  GLIBC_2.2 clntunix_create F
>  GLIBC_2.2 clock F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 clone F
>  GLIBC_2.2 close F
>  GLIBC_2.2 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
> index 41be3bb84b..5905498a48 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
>  GLIBC_2.2 aio_suspend64 F
>  GLIBC_2.2 aio_write F
>  GLIBC_2.2 aio_write64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 lio_listio F
>  GLIBC_2.2 lio_listio64 F
>  GLIBC_2.2 shm_open F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
> index 41977f6e9c..4b057bf4a2 100644
> --- a/sysdeps/unix/sysv/linux/sh/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
> @@ -618,6 +618,11 @@ GLIBC_2.2 clntudp_bufcreate F
>  GLIBC_2.2 clntudp_create F
>  GLIBC_2.2 clntunix_create F
>  GLIBC_2.2 clock F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 clone F
>  GLIBC_2.2 close F
>  GLIBC_2.2 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sh/librt.abilist b/sysdeps/unix/sysv/linux/sh/librt.abilist
> index 595f1b712a..bb03781dcc 100644
> --- a/sysdeps/unix/sysv/linux/sh/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 3d2f00ca52..49cd597fd6 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -1826,6 +1826,11 @@ GLIBC_2.2 __xstat64 F
>  GLIBC_2.2 _flushlbf F
>  GLIBC_2.2 _res_hconf D 0x30
>  GLIBC_2.2 bind_textdomain_codeset F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 dcngettext F
>  GLIBC_2.2 dngettext F
>  GLIBC_2.2 fgetpos F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
> index cb874f4147..38f0aad791 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 2f20643e8e..95e68e0ba1 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -660,6 +660,11 @@ GLIBC_2.2 clntudp_bufcreate F
>  GLIBC_2.2 clntudp_create F
>  GLIBC_2.2 clntunix_create F
>  GLIBC_2.2 clock F
> +GLIBC_2.2 clock_getcpuclockid F
> +GLIBC_2.2 clock_getres F
> +GLIBC_2.2 clock_gettime F
> +GLIBC_2.2 clock_nanosleep F
> +GLIBC_2.2 clock_settime F
>  GLIBC_2.2 clone F
>  GLIBC_2.2 close F
>  GLIBC_2.2 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
> index d7a049cf60..71f86e03ce 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
> @@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
>  GLIBC_2.1 aio_write64 F
>  GLIBC_2.1 lio_listio F
>  GLIBC_2.1 lio_listio64 F
> -GLIBC_2.2 clock_getcpuclockid F
> -GLIBC_2.2 clock_getres F
> -GLIBC_2.2 clock_gettime F
> -GLIBC_2.2 clock_nanosleep F
> -GLIBC_2.2 clock_settime F
>  GLIBC_2.2 shm_open F
>  GLIBC_2.2 shm_unlink F
>  GLIBC_2.2 timer_create F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 59f85d9373..1f2dbd1451 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -621,6 +621,11 @@ GLIBC_2.2.5 clntudp_bufcreate F
>  GLIBC_2.2.5 clntudp_create F
>  GLIBC_2.2.5 clntunix_create F
>  GLIBC_2.2.5 clock F
> +GLIBC_2.2.5 clock_getcpuclockid F
> +GLIBC_2.2.5 clock_getres F
> +GLIBC_2.2.5 clock_gettime F
> +GLIBC_2.2.5 clock_nanosleep F
> +GLIBC_2.2.5 clock_settime F
>  GLIBC_2.2.5 clone F
>  GLIBC_2.2.5 close F
>  GLIBC_2.2.5 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
> index e2e8b60bf8..95e3f22daa 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
> @@ -13,11 +13,6 @@ GLIBC_2.2.5 aio_suspend F
>  GLIBC_2.2.5 aio_suspend64 F
>  GLIBC_2.2.5 aio_write F
>  GLIBC_2.2.5 aio_write64 F
> -GLIBC_2.2.5 clock_getcpuclockid F
> -GLIBC_2.2.5 clock_getres F
> -GLIBC_2.2.5 clock_gettime F
> -GLIBC_2.2.5 clock_nanosleep F
> -GLIBC_2.2.5 clock_settime F
>  GLIBC_2.2.5 lio_listio F
>  GLIBC_2.2.5 lio_listio64 F
>  GLIBC_2.2.5 shm_open F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 67a4e238d6..59da85a5d8 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -660,6 +660,11 @@ GLIBC_2.16 clntudp_create F
>  GLIBC_2.16 clntunix_create F
>  GLIBC_2.16 clock F
>  GLIBC_2.16 clock_adjtime F
> +GLIBC_2.16 clock_getcpuclockid F
> +GLIBC_2.16 clock_getres F
> +GLIBC_2.16 clock_gettime F
> +GLIBC_2.16 clock_nanosleep F
> +GLIBC_2.16 clock_settime F
>  GLIBC_2.16 clone F
>  GLIBC_2.16 close F
>  GLIBC_2.16 closedir F

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
> index 94e84e4dcf..66969fb9ab 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
> @@ -14,11 +14,6 @@ GLIBC_2.16 aio_suspend F
>  GLIBC_2.16 aio_suspend64 F
>  GLIBC_2.16 aio_write F
>  GLIBC_2.16 aio_write64 F
> -GLIBC_2.16 clock_getcpuclockid F
> -GLIBC_2.16 clock_getres F
> -GLIBC_2.16 clock_gettime F
> -GLIBC_2.16 clock_nanosleep F
> -GLIBC_2.16 clock_settime F
>  GLIBC_2.16 lio_listio F
>  GLIBC_2.16 lio_listio64 F
>  GLIBC_2.16 mq_close F

Ok.

> diff --git a/time/Makefile b/time/Makefile
> index a428f55245..85a62c0376 100644
> --- a/time/Makefile
> +++ b/time/Makefile
> @@ -36,14 +36,18 @@ routines := offtime asctime clock ctime ctime_r difftime \
>  	    stime dysize timegm ftime			 \
>  	    getdate strptime strptime_l			 \
>  	    strftime wcsftime strftime_l wcsftime_l	 \
> -	    timespec_get
> +	    timespec_get 	 			 \
> +	    clock_getcpuclockid clock_getres 		 \
> +	    clock_gettime clock_settime clock_nanosleep
> +
>  aux :=	    era alt_digit lc-time-cleanup
>  
>  tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
>  	   tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
>  	   tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
>  	   tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
> -	   tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3
> +	   tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3 \
> +	   tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
>  
>  include ../Rules
>  

Ok.

> diff --git a/time/Versions b/time/Versions
> index fd838181e4..8788e192ce 100644
> --- a/time/Versions
> +++ b/time/Versions
> @@ -49,6 +49,10 @@ libc {
>    GLIBC_2.2 {
>      # w*
>      wcsftime;
> +
> +    # c*; actually in librt in version 2.2, moved to libc in 2.17
> +    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
> +    clock_nanosleep;
>    }
>    GLIBC_2.3 {
>      # these internal names are used by libstdc++

Ok.

> @@ -65,4 +69,13 @@ libc {
>    GLIBC_2.16 {
>      timespec_get;
>    }
> +  GLIBC_2.17 {
> +    # c*
> +    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
> +    clock_nanosleep;
> +  }
> +  GLIBC_PRIVATE {
> +    # same as clock_gettime; used in other libraries
> +    __clock_gettime;
> +  }
>  }

Ok.

> diff --git a/rt/clock_getcpuclockid.c b/time/clock_getcpuclockid.c
> similarity index 75%
> rename from rt/clock_getcpuclockid.c
> rename to time/clock_getcpuclockid.c
> index 22b9f1383c..8d205abfa9 100644
> --- a/rt/clock_getcpuclockid.c
> +++ b/time/clock_getcpuclockid.c
> @@ -19,6 +19,7 @@
>  #include <errno.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <shlib-compat.h>
>  
>  int
>  __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> @@ -37,4 +38,10 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
>    return ENOENT;
>  #endif
>  }
> -weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
> +versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
> +/* clock_getcpuclockid moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
> +compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
> +#endif

Ok.

> diff --git a/rt/clock_getres.c b/time/clock_getres.c
> similarity index 73%
> rename from rt/clock_getres.c
> rename to time/clock_getres.c
> index b990bf0af0..412f80fbec 100644
> --- a/rt/clock_getres.c
> +++ b/time/clock_getres.c
> @@ -18,6 +18,7 @@
>  
>  #include <errno.h>
>  #include <time.h>
> +#include <shlib-compat.h>
>  
>  /* Get resolution of clock.  */
>  int
> @@ -26,5 +27,13 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
>    __set_errno (ENOSYS);
>    return -1;
>  }
> -weak_alias (__clock_getres, clock_getres)
> +
> +versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
> +/* clock_getres moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_getres, __clock_getres_2);
> +compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
> +#endif
> +
>  stub_warning (clock_getres)

Ok.

> diff --git a/rt/clock_gettime.c b/time/clock_gettime.c
> similarity index 74%
> rename from rt/clock_gettime.c
> rename to time/clock_gettime.c
> index 0426dd2c76..92c6081dcb 100644
> --- a/rt/clock_gettime.c
> +++ b/time/clock_gettime.c
> @@ -18,6 +18,7 @@
>  
>  #include <errno.h>
>  #include <time.h>
> +#include <shlib-compat.h>
>  
>  /* Get current value of CLOCK and store it in TP.  */
>  int
> @@ -26,6 +27,14 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
>    __set_errno (ENOSYS);
>    return -1;
>  }
> -weak_alias (__clock_gettime, clock_gettime)
>  libc_hidden_def (__clock_gettime)
> +
> +versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
> +/* clock_gettime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_gettime, __clock_gettime_2);
> +compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
> +#endif
> +
>  stub_warning (clock_gettime)

Ok.

> diff --git a/rt/clock_nanosleep.c b/time/clock_nanosleep.c
> similarity index 76%
> rename from rt/clock_nanosleep.c
> rename to time/clock_nanosleep.c
> index 5b724e593b..c53c820880 100644
> --- a/rt/clock_nanosleep.c
> +++ b/time/clock_nanosleep.c
> @@ -18,6 +18,7 @@
>  
>  #include <errno.h>
>  #include <time.h>
> +#include <shlib-compat.h>
>  
>  int
>  __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> @@ -33,5 +34,13 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
>    /* Not implemented.  */
>    return ENOSYS;
>  }
> -weak_alias (__clock_nanosleep, clock_nanosleep)
> +
> +versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
> +/* clock_nanosleep moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_nanosleep, __clock_nanosleep_2);
> +compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
> +#endif
> +
>  stub_warning (clock_nanosleep)

Ok.

> diff --git a/rt/clock_settime.c b/time/clock_settime.c
> similarity index 71%
> rename from rt/clock_settime.c
> rename to time/clock_settime.c
> index 891925ab2c..dd86a1c189 100644
> --- a/rt/clock_settime.c
> +++ b/time/clock_settime.c
> @@ -18,6 +18,7 @@
>  
>  #include <errno.h>
>  #include <time.h>
> +#include <shlib-compat.h>
>  
>  /* Set CLOCK to value TP.  */
>  int
> @@ -26,5 +27,14 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
>    __set_errno (ENOSYS);
>    return -1;
>  }
> -weak_alias (__clock_settime, clock_settime)
> +libc_hidden_def (__clock_settime)
> +
> +versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
> +/* clock_settime moved to libc in version 2.17;
> +   old binaries may expect the symbol version it had in librt.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (__clock_settime, __clock_settime_2);
> +compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
> +#endif
> +
>  stub_warning (clock_settime)

Ok.

> diff --git a/rt/tst-clock.c b/time/tst-clock.c
> similarity index 100%
> rename from rt/tst-clock.c
> rename to time/tst-clock.c

Ok.

> diff --git a/rt/tst-clock2.c b/time/tst-clock2.c
> similarity index 100%
> rename from rt/tst-clock2.c
> rename to time/tst-clock2.c

Ok.

> diff --git a/rt/tst-clock_nanosleep.c b/time/tst-clock_nanosleep.c
> similarity index 100%
> rename from rt/tst-clock_nanosleep.c
> rename to time/tst-clock_nanosleep.c

Ok.

> diff --git a/rt/tst-cpuclock1.c b/time/tst-cpuclock1.c
> similarity index 100%
> rename from rt/tst-cpuclock1.c
> rename to time/tst-cpuclock1.c
> 

Ok.
Florian Weimer Sept. 3, 2019, 7:29 a.m. UTC | #2
* Zack Weinberg:

> diff --git a/rt/Versions b/rt/Versions
> index 91e3fd2a20..84d1345420 100644
> --- a/rt/Versions
> +++ b/rt/Versions
> @@ -1,15 +1,3 @@
> -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;
> -  }
> -}

Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
otherwise old binaries will fail to load.  You need to leave behind a
dummy function definition.  See __libpthread_version_placeholder for how
I handled this in the libpthread/vfork case.

I think we need to bring back the file version information in the ABI
lists because it is part of the ABI, after all.

We have received a bug report that the librt IFUNC resolvers actually
cause programs not to start:

  <https://sourceware.org/bugzilla/show_bug.cgi?id=24959>

I would appreciate if you could mention this bug number in your fix.

Thanks,
Florian
Adhemerval Zanella Sept. 3, 2019, 1:25 p.m. UTC | #3
On 03/09/2019 04:29, Florian Weimer wrote:
> * Zack Weinberg:
> 
>> diff --git a/rt/Versions b/rt/Versions
>> index 91e3fd2a20..84d1345420 100644
>> --- a/rt/Versions
>> +++ b/rt/Versions
>> @@ -1,15 +1,3 @@
>> -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;
>> -  }
>> -}
> 
> Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
> otherwise old binaries will fail to load.  You need to leave behind a
> dummy function definition.  See __libpthread_version_placeholder for how
> I handled this in the libpthread/vfork case.

Are you sure about it? on x86_64 I am trying to force this issue:

--
$ cat test.c
include <time.h>

#define symbol_version_reference(real, name, version) \
  __asm__ (".symver " #real "," #name "@" #version)

symbol_version_reference (clock_gettime, clock_gettime, GLIBC_2.2.5);

int main ()
{
  struct timespec ts;
  clock_gettime (CLOCK_REALTIME, &ts);
  return ts.tv_sec;
}
$ gcc -Wall test.c -o test -lrt
# Check if this indeed links against old librt version
$ readelf -s test | grep clock_gettime
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime@GLIBC_2.2.5 (4)
    56: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime@@GLIBC_2.2.

# Check if master branch does not fail to load the binary
$ ./x86_64-linux-gnu-master/testrun.sh ./test
# Chec

# librt.so does not have the clock_gettime symbols
$ readelf -s x86_64-linux-gnu-patched/rt/librt.so | grep clock_gettime@
    37: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __clock_gettime@GLIBC_PRIVATE (7)
   232: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __clock_gettime@@GLIBC_PR
# There are now provided solely by libc.so
$ readelf -s x86_64-linux-gnu-patched/libc.so | grep clock_gettime@
   837: 00000000000c0be0   109 FUNC    GLOBAL DEFAULT   12 __clock_gettime@@GLIBC_PRIVATE
  1744: 00000000000c0be0   109 FUNC    GLOBAL DEFAULT   12 clock_gettime@GLIBC_2.2.5
  1747: 00000000000c0be0   109 FUNC    GLOBAL DEFAULT   12 clock_gettime@@GLIBC_2.17
  7580: 00000000000c0be0   109 FUNC    GLOBAL DEFAULT   12 clock_gettime@GLIBC_2.2.5
  8291: 00000000000c0be0   109 FUNC    GLOBAL DEFAULT   12 clock_gettime@@GLIBC_2.17
# And it does not fail
$ ./x86_64-linux-gnu-patched/testrun.sh ./test
--

LD_DEBUG=all indeed shows us the symbol resolution is done as expected:

      9832:     symbol=clock_gettime;  lookup in file=./test [0]
      9832:     symbol=clock_gettime;  lookup in file=./x86_64-linux-gnu-patched/rt/librt.so.1 [0]
      9832:     symbol=clock_gettime;  lookup in file=./x86_64-linux-gnu-patched/libc.so.6 [0]
      9832:     binding file ./test [0] to ./x86_64-linux-gnu-patched/libc.so.6 [0]: normal symbol `clock_gettime' [GLIBC_2.2.5]
      9832:     

Do you know how exactly this issue might happen?

> 
> I think we need to bring back the file version information in the ABI
> lists because it is part of the ABI, after all.
> 
> We have received a bug report that the librt IFUNC resolvers actually
> cause programs not to start:
> 
>   <https://sourceware.org/bugzilla/show_bug.cgi?id=24959>
> 
> I would appreciate if you could mention this bug number in your fix.

Yeah, we need to remove these ifunc redirection hacks.

> 
> Thanks,
> Florian
>
Florian Weimer Sept. 3, 2019, 1:31 p.m. UTC | #4
* Adhemerval Zanella:

> On 03/09/2019 04:29, Florian Weimer wrote:
>> * Zack Weinberg:
>> 
>>> diff --git a/rt/Versions b/rt/Versions
>>> index 91e3fd2a20..84d1345420 100644
>>> --- a/rt/Versions
>>> +++ b/rt/Versions
>>> @@ -1,15 +1,3 @@
>>> -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;
>>> -  }
>>> -}
>> 
>> Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
>> otherwise old binaries will fail to load.  You need to leave behind a
>> dummy function definition.  See __libpthread_version_placeholder for how
>> I handled this in the libpthread/vfork case.
>
> Are you sure about it?

Yes. 8-)  But I missed that this block was just moved to time/Versions.
Either place will work and generate the same symbol versions.

For librt proper, the problem does not arise because sem_open is still
present at the same symbol version, keeping the version present and
alive.

Zack, please disregard my comment about rt/Versions.

Thanks,
Florian
Adhemerval Zanella Sept. 3, 2019, 1:44 p.m. UTC | #5
On 03/09/2019 10:31, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> On 03/09/2019 04:29, Florian Weimer wrote:
>>> * Zack Weinberg:
>>>
>>>> diff --git a/rt/Versions b/rt/Versions
>>>> index 91e3fd2a20..84d1345420 100644
>>>> --- a/rt/Versions
>>>> +++ b/rt/Versions
>>>> @@ -1,15 +1,3 @@
>>>> -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;
>>>> -  }
>>>> -}
>>>
>>> Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
>>> otherwise old binaries will fail to load.  You need to leave behind a
>>> dummy function definition.  See __libpthread_version_placeholder for how
>>> I handled this in the libpthread/vfork case.
>>
>> Are you sure about it?
> 
> Yes. 8-)  But I missed that this block was just moved to time/Versions.
> Either place will work and generate the same symbol versions.

Right, because that was my understanding (the symbol versions will still
be generated correctly on libc).

> 
> For librt proper, the problem does not arise because sem_open is still
> present at the same symbol version, keeping the version present and
> alive.
> 
> Zack, please disregard my comment about rt/Versions.
> 
> Thanks,
> Florian
>
Zack Weinberg Sept. 3, 2019, 2:34 p.m. UTC | #6
On Tue, Sep 3, 2019 at 9:44 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 03/09/2019 10:31, Florian Weimer wrote:
> > * Adhemerval Zanella:
> >> On 03/09/2019 04:29, Florian Weimer wrote:
> >>> * Zack Weinberg:
> >>>> diff --git a/rt/Versions b/rt/Versions
> >>>> index 91e3fd2a20..84d1345420 100644
> >>>> --- a/rt/Versions
> >>>> +++ b/rt/Versions
> >>>> @@ -1,15 +1,3 @@
> >>>> -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;
> >>>> -  }
> >>>> -}
> >>>
> >>> Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
> >>> otherwise old binaries will fail to load.  You need to leave behind a
> >>> dummy function definition.  See __libpthread_version_placeholder for how
> >>> I handled this in the libpthread/vfork case.
> >>
> >> Are you sure about it?
> >
> > Yes. 8-)  But I missed that this block was just moved to time/Versions.
> > Either place will work and generate the same symbol versions.
>
> Right, because that was my understanding (the symbol versions will still
> be generated correctly on libc).

Yes, I moved the GLIBC_2.17 versions from rt/Versions to time/Versions
to keep them together with their .c files.

Adhemerval, Florian, I suspect I won't have very much time to work on
glibc for the next two weeks.  If either or both of you would like to
take over the branch for these patches (zack/y2038-preliminaries) and
keep working on it, please feel free.

Incidentally, regarding the cost of converting from a struct timespec
to a struct timeval on systems where 'long' is 64 bits, I'm getting
what looks like decent code generation out of this definition of
TIMESPEC_TO_TIMEVAL:

#define TIMESPEC_TO_TIMEVAL(tv, ts) do {        \
    uint32_t __nsec = (ts)->tv_nsec;            \
    (tv)->tv_sec = (ts)->tv_sec;                \
    (tv)->tv_usec = __nsec / 1000;              \
} while (0)

e.g.

    movq    8(%rsi), %rax
    movq    (%rsi), %rdx
    movl    %eax, %eax
    movq    %rdx, (%rdi)
    imulq    $274877907, %rax, %rax
    shrq    $38, %rax
    movl    %eax, %eax
    movq    %rax, 8(%rdi)
    ret

(Not sure why the 'movl %eax, %eax', though - clearing the upper 32
bits maybe?  I might throw this at a superoptimizer and see what it
comes up with.)

zw
Adhemerval Zanella Sept. 3, 2019, 6:50 p.m. UTC | #7
On 03/09/2019 11:34, Zack Weinberg wrote:
> On Tue, Sep 3, 2019 at 9:44 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> On 03/09/2019 10:31, Florian Weimer wrote:
>>> * Adhemerval Zanella:
>>>> On 03/09/2019 04:29, Florian Weimer wrote:
>>>>> * Zack Weinberg:
>>>>>> diff --git a/rt/Versions b/rt/Versions
>>>>>> index 91e3fd2a20..84d1345420 100644
>>>>>> --- a/rt/Versions
>>>>>> +++ b/rt/Versions
>>>>>> @@ -1,15 +1,3 @@
>>>>>> -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;
>>>>>> -  }
>>>>>> -}
>>>>>
>>>>> Sorry, you cannot remove the GLIBC_2.17 symbol version in this way,
>>>>> otherwise old binaries will fail to load.  You need to leave behind a
>>>>> dummy function definition.  See __libpthread_version_placeholder for how
>>>>> I handled this in the libpthread/vfork case.
>>>>
>>>> Are you sure about it?
>>>
>>> Yes. 8-)  But I missed that this block was just moved to time/Versions.
>>> Either place will work and generate the same symbol versions.
>>
>> Right, because that was my understanding (the symbol versions will still
>> be generated correctly on libc).
> 
> Yes, I moved the GLIBC_2.17 versions from rt/Versions to time/Versions
> to keep them together with their .c files.
> 
> Adhemerval, Florian, I suspect I won't have very much time to work on
> glibc for the next two weeks.  If either or both of you would like to
> take over the branch for these patches (zack/y2038-preliminaries) and
> keep working on it, please feel free.

I will try to spare some time to create a personal branch based on yours
with my reviewed remarks fixed.

> 
> Incidentally, regarding the cost of converting from a struct timespec
> to a struct timeval on systems where 'long' is 64 bits, I'm getting
> what looks like decent code generation out of this definition of
> TIMESPEC_TO_TIMEVAL:
> 
> #define TIMESPEC_TO_TIMEVAL(tv, ts) do {        \
>     uint32_t __nsec = (ts)->tv_nsec;            \
>     (tv)->tv_sec = (ts)->tv_sec;                \
>     (tv)->tv_usec = __nsec / 1000;              \
> } while (0)
> 
> e.g.
> 
>     movq    8(%rsi), %rax
>     movq    (%rsi), %rdx
>     movl    %eax, %eax
>     movq    %rdx, (%rdi)
>     imulq    $274877907, %rax, %rax
>     shrq    $38, %rax
>     movl    %eax, %eax
>     movq    %rax, 8(%rdi)
>     ret
> 
> (Not sure why the 'movl %eax, %eax', though - clearing the upper 32
> bits maybe?  I might throw this at a superoptimizer and see what it
> comes up with.)
> 
> zw
>
diff mbox series

Patch

diff --git a/include/time.h b/include/time.h
index ac3163c2a5..dcf91855ad 100644
--- a/include/time.h
+++ b/include/time.h
@@ -18,12 +18,10 @@  libc_hidden_proto (localtime)
 libc_hidden_proto (strftime)
 libc_hidden_proto (strptime)
 
-extern __typeof (clock_getres) __clock_getres;
 extern __typeof (clock_gettime) __clock_gettime;
 libc_hidden_proto (__clock_gettime)
 extern __typeof (clock_settime) __clock_settime;
-extern __typeof (clock_nanosleep) __clock_nanosleep;
-extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
+libc_hidden_proto (__clock_settime)
 
 /* Now define the internal interfaces.  */
 struct tm;
diff --git a/rt/Makefile b/rt/Makefile
index 9ea8394565..e6fbc32438 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -28,9 +28,6 @@  aio-routines   := aio_cancel aio_error aio_fsync aio_misc aio_read	\
 		  aio_read64 aio_return aio_suspend aio_write		\
 		  aio_write64 lio_listio lio_listio64 aio_sigqueue	\
 		  aio_notify
-clock-routines := clock_getcpuclockid					\
-		  clock_getres clock_gettime clock_settime		\
-		  clock_nanosleep
 timer-routines := timer_create timer_delete timer_getoverr		\
 		  timer_gettime timer_settime
 shm-routines   := shm_open shm_unlink
@@ -38,22 +35,18 @@  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) \
 		 $(timer-routines) \
-		 $(shm-routines) $(mq-routines) \
-		 clock-compat
+		 $(shm-routines) $(mq-routines)
 
-tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
+tests := tst-shm tst-timer tst-timer2 \
 	 tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
 	 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
 	 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
 	 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
 	 tst-timer3 tst-timer4 tst-timer5 \
-	 tst-cpuclock1 tst-cpuclock2 \
-	 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
-	 tst-clock2 tst-shm-cancel
+	 tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
+	 tst-shm-cancel
 
 extra-libs := librt
 extra-libs-others := $(extra-libs)
diff --git a/rt/Versions b/rt/Versions
index 91e3fd2a20..84d1345420 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -1,15 +1,3 @@ 
-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.
@@ -18,10 +6,6 @@  librt {
     aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
   }
   GLIBC_2.2 {
-    # These have moved to libc and are still here only for compatibility.
-    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
-    clock_nanosleep;
-
     # s*
     shm_open; shm_unlink;
 
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
deleted file mode 100644
index d8ced3cdc1..0000000000
--- a/rt/clock-compat.c
+++ /dev/null
@@ -1,63 +0,0 @@ 
-/* ABI compatibility redirects for clock_* symbols in librt.
-   Copyright (C) 2012-2019 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>
-
-#if HAVE_IFUNC
-# undef INIT_ARCH
-# define INIT_ARCH()
-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
-    compat_symbol (librt, name, name, GLIBC_2_2);
-#else
-# define COMPAT_REDIRECT(name, proto, arglist)				      \
-  int									      \
-  name proto								      \
-  {									      \
-    return __##name arglist;						      \
-  }									      \
-  compat_symbol (librt, name, name, GLIBC_2_2);
-#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/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 1fc7ab2433..7c2cb2b05a 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -711,6 +711,11 @@  GLIBC_2.2.6 clntudp_bufcreate F
 GLIBC_2.2.6 clntudp_create F
 GLIBC_2.2.6 clntunix_create F
 GLIBC_2.2.6 clock F
+GLIBC_2.2.6 clock_getcpuclockid F
+GLIBC_2.2.6 clock_getres F
+GLIBC_2.2.6 clock_gettime F
+GLIBC_2.2.6 clock_nanosleep F
+GLIBC_2.2.6 clock_settime F
 GLIBC_2.2.6 close F
 GLIBC_2.2.6 closedir F
 GLIBC_2.2.6 closelog F
diff --git a/sysdeps/mach/hurd/i386/librt.abilist b/sysdeps/mach/hurd/i386/librt.abilist
index d5fe32b3a9..3726e41f06 100644
--- a/sysdeps/mach/hurd/i386/librt.abilist
+++ b/sysdeps/mach/hurd/i386/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.2.6 aio_suspend F
 GLIBC_2.2.6 aio_suspend64 F
 GLIBC_2.2.6 aio_write F
 GLIBC_2.2.6 aio_write64 F
-GLIBC_2.2.6 clock_getcpuclockid F
-GLIBC_2.2.6 clock_getres F
-GLIBC_2.2.6 clock_gettime F
-GLIBC_2.2.6 clock_nanosleep F
-GLIBC_2.2.6 clock_settime F
 GLIBC_2.2.6 lio_listio F
 GLIBC_2.2.6 lio_listio64 F
 GLIBC_2.2.6 shm_open F
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 01024a3f55..e529cadb1f 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -22,7 +22,7 @@ 
 #include <unistd.h>
 #include <sys/param.h>
 #include <libc-internal.h>
-
+#include <shlib-compat.h>
 
 static inline int
 realtime_getres (struct timespec *res)
@@ -62,4 +62,11 @@  __clock_getres (clockid_t clock_id, struct timespec *res)
 
   return retval;
 }
-weak_alias (__clock_getres, clock_getres)
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 10a6c96d9d..2a82fc1066 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -17,24 +17,9 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
-#include <stdint.h>
 #include <time.h>
 #include <sys/time.h>
-#include <libc-internal.h>
-#include <ldsodefs.h>
-
-
-static inline int
-realtime_gettime (struct timespec *tp)
-{
-  struct timeval tv;
-  int retval = __gettimeofday (&tv, NULL);
-  if (retval == 0)
-    /* Convert into `timespec'.  */
-    TIMEVAL_TO_TIMESPEC (&tv, tp);
-  return retval;
-}
-
+#include <shlib-compat.h>
 
 /* Get current value of CLOCK and store it in TP.  */
 int
@@ -60,5 +45,12 @@  __clock_gettime (clockid_t clock_id, struct timespec *tp)
 
   return retval;
 }
-weak_alias (__clock_gettime, clock_gettime)
 libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
index b27608570c..6a477520d1 100644
--- a/sysdeps/unix/clock_nanosleep.c
+++ b/sysdeps/unix/clock_nanosleep.c
@@ -20,6 +20,7 @@ 
 #include <errno.h>
 #include <time.h>
 #include <sysdep-cancel.h>
+#include <shlib-compat.h>
 
 /* This implementation assumes that these is only a `nanosleep' system
    call.  So we have to remap all other activities.  */
@@ -76,4 +77,11 @@  __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
 
   return __nanosleep (req, rem), 0 ? errno : 0;
 }
-weak_alias (__clock_nanosleep, clock_nanosleep)
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index 109a1ad872..5b398491ab 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -18,8 +18,7 @@ 
 #include <errno.h>
 #include <time.h>
 #include <sys/time.h>
-#include <ldsodefs.h>
-
+#include <shlib-compat.h>
 
 /* Set CLOCK to value TP.  */
 int
@@ -51,4 +50,12 @@  __clock_settime (clockid_t clock_id, const struct timespec *tp)
 
   return retval;
 }
-weak_alias (__clock_settime, clock_settime)
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index fe85a35620..e7f2174ac2 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -1863,6 +1863,11 @@  GLIBC_2.2 __xpg_sigpause F
 GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x48
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/alpha/librt.abilist b/sysdeps/unix/sysv/linux/alpha/librt.abilist
index d7a049cf60..71f86e03ce 100644
--- a/sysdeps/unix/sysv/linux/alpha/librt.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index bc3df8dcea..9371927927 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -766,6 +766,11 @@  GLIBC_2.4 clntudp_bufcreate F
 GLIBC_2.4 clntudp_create F
 GLIBC_2.4 clntunix_create F
 GLIBC_2.4 clock F
+GLIBC_2.4 clock_getcpuclockid F
+GLIBC_2.4 clock_getres F
+GLIBC_2.4 clock_gettime F
+GLIBC_2.4 clock_nanosleep F
+GLIBC_2.4 clock_settime F
 GLIBC_2.4 clone F
 GLIBC_2.4 close F
 GLIBC_2.4 closedir F
diff --git a/sysdeps/unix/sysv/linux/arm/librt.abilist b/sysdeps/unix/sysv/linux/arm/librt.abilist
index cfbbd27557..3c0647b251 100644
--- a/sysdeps/unix/sysv/linux/arm/librt.abilist
+++ b/sysdeps/unix/sysv/linux/arm/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.4 aio_suspend F
 GLIBC_2.4 aio_suspend64 F
 GLIBC_2.4 aio_write F
 GLIBC_2.4 aio_write64 F
-GLIBC_2.4 clock_getcpuclockid F
-GLIBC_2.4 clock_getres F
-GLIBC_2.4 clock_gettime F
-GLIBC_2.4 clock_nanosleep F
-GLIBC_2.4 clock_settime F
 GLIBC_2.4 lio_listio F
 GLIBC_2.4 lio_listio64 F
 GLIBC_2.4 mq_close F
diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
index f4a652966f..f2d8b916cb 100644
--- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -20,6 +20,7 @@ 
 #include <time.h>
 #include <unistd.h>
 #include "kernel-posix-cpu-timers.h"
+#include <shlib-compat.h>
 
 int
 __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
@@ -45,4 +46,11 @@  __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
   else
     return INTERNAL_SYSCALL_ERRNO (r, err);
 }
-weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
+
+versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
+/* clock_getcpuclockid moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
+compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 24b2299938..18a7ce53c0 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -26,10 +26,19 @@ 
 #endif
 #include <sysdep-vdso.h>
 
+#include <shlib-compat.h>
+
 /* Get resolution of clock.  */
 int
 __clock_getres (clockid_t clock_id, struct timespec *res)
 {
   return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
 }
-weak_alias (__clock_getres, clock_getres)
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 5fc47fb7dc..7ad1c91be6 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -26,11 +26,20 @@ 
 #endif
 #include <sysdep-vdso.h>
 
+#include <shlib-compat.h>
+
 /* Get current value of CLOCK and store it in TP.  */
 int
 __clock_gettime (clockid_t clock_id, struct timespec *tp)
 {
   return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
 }
-weak_alias (__clock_gettime, clock_gettime)
 libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 0cb6614dc9..e19e09d197 100644
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
@@ -21,6 +21,7 @@ 
 #include <sysdep-cancel.h>
 #include "kernel-posix-cpu-timers.h"
 
+#include <shlib-compat.h>
 
 /* We can simply use the syscall.  The CPU clocks are not supported
    with this function.  */
@@ -41,4 +42,11 @@  __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);
 }
-weak_alias (__clock_nanosleep, clock_nanosleep)
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index d837e3019c..0586d15722 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -18,6 +18,7 @@ 
 #include <errno.h>
 #include <sysdep.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 #include "kernel-posix-cpu-timers.h"
 
@@ -34,4 +35,12 @@  __clock_settime (clockid_t clock_id, const struct timespec *tp)
 
   return INLINE_SYSCALL_CALL (clock_settime, clock_id, tp);
 }
-weak_alias (__clock_settime, clock_settime)
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 75edece94a..df6d96fbae 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -615,6 +615,11 @@  GLIBC_2.2 clntudp_bufcreate F
 GLIBC_2.2 clntudp_create F
 GLIBC_2.2 clntunix_create F
 GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 clone F
 GLIBC_2.2 close F
 GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/hppa/librt.abilist b/sysdeps/unix/sysv/linux/hppa/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/hppa/librt.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index edeaf8e722..fcb625b6bf 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -1869,6 +1869,11 @@  GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 alphasort64 F
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/i386/librt.abilist b/sysdeps/unix/sysv/linux/i386/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/i386/librt.abilist
+++ b/sysdeps/unix/sysv/linux/i386/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b5d460eeb2..cb556c5998 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -627,6 +627,11 @@  GLIBC_2.2 clntudp_bufcreate F
 GLIBC_2.2 clntudp_create F
 GLIBC_2.2 clntunix_create F
 GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 close F
 GLIBC_2.2 closedir F
 GLIBC_2.2 closelog F
diff --git a/sysdeps/unix/sysv/linux/ia64/librt.abilist b/sysdeps/unix/sysv/linux/ia64/librt.abilist
index 804622a14a..08384c9065 100644
--- a/sysdeps/unix/sysv/linux/ia64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 05633b3cb8..f3aa47d090 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -755,6 +755,11 @@  GLIBC_2.4 clntudp_bufcreate F
 GLIBC_2.4 clntudp_create F
 GLIBC_2.4 clntunix_create F
 GLIBC_2.4 clock F
+GLIBC_2.4 clock_getcpuclockid F
+GLIBC_2.4 clock_getres F
+GLIBC_2.4 clock_gettime F
+GLIBC_2.4 clock_nanosleep F
+GLIBC_2.4 clock_settime F
 GLIBC_2.4 clone F
 GLIBC_2.4 close F
 GLIBC_2.4 closedir F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
index cfbbd27557..3c0647b251 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.4 aio_suspend F
 GLIBC_2.4 aio_suspend64 F
 GLIBC_2.4 aio_write F
 GLIBC_2.4 aio_write64 F
-GLIBC_2.4 clock_getcpuclockid F
-GLIBC_2.4 clock_getres F
-GLIBC_2.4 clock_gettime F
-GLIBC_2.4 clock_nanosleep F
-GLIBC_2.4 clock_settime F
 GLIBC_2.4 lio_listio F
 GLIBC_2.4 lio_listio64 F
 GLIBC_2.4 mq_close F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 47eb7b4608..64d4623b6b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -1825,6 +1825,11 @@  GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 alphasort64 F
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/microblaze/librt.abilist b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
index fb85d8729e..889dfbc0ee 100644
--- a/sysdeps/unix/sysv/linux/microblaze/librt.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
@@ -14,11 +14,6 @@  GLIBC_2.18 aio_suspend F
 GLIBC_2.18 aio_suspend64 F
 GLIBC_2.18 aio_write F
 GLIBC_2.18 aio_write64 F
-GLIBC_2.18 clock_getcpuclockid F
-GLIBC_2.18 clock_getres F
-GLIBC_2.18 clock_gettime F
-GLIBC_2.18 clock_nanosleep F
-GLIBC_2.18 clock_settime F
 GLIBC_2.18 lio_listio F
 GLIBC_2.18 lio_listio64 F
 GLIBC_2.18 mq_close F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index e49dc4272e..06c2e64edd 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -1612,6 +1612,11 @@  GLIBC_2.2 capget F
 GLIBC_2.2 capset F
 GLIBC_2.2 cbc_crypt F
 GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 creat64 F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
index 84837c8a2e..1539c1cef9 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.2 aio_suspend F
 GLIBC_2.2 aio_suspend64 F
 GLIBC_2.2 aio_write F
 GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 lio_listio F
 GLIBC_2.2 lio_listio64 F
 GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index daa3b60c5b..bdfd073b86 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -1610,6 +1610,11 @@  GLIBC_2.2 capget F
 GLIBC_2.2 capset F
 GLIBC_2.2 cbc_crypt F
 GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 creat64 F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
index 84837c8a2e..1539c1cef9 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.2 aio_suspend F
 GLIBC_2.2 aio_suspend64 F
 GLIBC_2.2 aio_write F
 GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 lio_listio F
 GLIBC_2.2 lio_listio64 F
 GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 457ce0b6f2..3d61d4974a 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -1611,6 +1611,11 @@  GLIBC_2.2 capget F
 GLIBC_2.2 capset F
 GLIBC_2.2 cbc_crypt F
 GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 creat64 F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 63d5c03bfb..675acca5db 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -1607,6 +1607,11 @@  GLIBC_2.2 capget F
 GLIBC_2.2 capset F
 GLIBC_2.2 cbc_crypt F
 GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 creat64 F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 9200a54309..1e8ff6f83e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1830,6 +1830,11 @@  GLIBC_2.2 __xstat64 F
 GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index ef7779905f..b5a0751d90 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1834,6 +1834,11 @@  GLIBC_2.2 __xstat64 F
 GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 2860df8ebc..0c86217fc6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -673,6 +673,11 @@  GLIBC_2.3 clntudp_bufcreate F
 GLIBC_2.3 clntudp_create F
 GLIBC_2.3 clntunix_create F
 GLIBC_2.3 clock F
+GLIBC_2.3 clock_getcpuclockid F
+GLIBC_2.3 clock_getres F
+GLIBC_2.3 clock_gettime F
+GLIBC_2.3 clock_nanosleep F
+GLIBC_2.3 clock_settime F
 GLIBC_2.3 clone F
 GLIBC_2.3 close F
 GLIBC_2.3 closedir F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
index e76b7eb495..6a5bd96963 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.3 aio_suspend F
 GLIBC_2.3 aio_suspend64 F
 GLIBC_2.3 aio_write F
 GLIBC_2.3 aio_write64 F
-GLIBC_2.3 clock_getcpuclockid F
-GLIBC_2.3 clock_getres F
-GLIBC_2.3 clock_gettime F
-GLIBC_2.3 clock_nanosleep F
-GLIBC_2.3 clock_settime F
 GLIBC_2.3 lio_listio F
 GLIBC_2.3 lio_listio64 F
 GLIBC_2.3 shm_open F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 576295deff..122d0fb65a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -1829,6 +1829,11 @@  GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 alphasort64 F
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index abf0473683..efe588a072 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -632,6 +632,11 @@  GLIBC_2.2 clntudp_bufcreate F
 GLIBC_2.2 clntudp_create F
 GLIBC_2.2 clntunix_create F
 GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 clone F
 GLIBC_2.2 close F
 GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
index 41be3bb84b..5905498a48 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.2 aio_suspend F
 GLIBC_2.2 aio_suspend64 F
 GLIBC_2.2 aio_write F
 GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 lio_listio F
 GLIBC_2.2 lio_listio64 F
 GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index 41977f6e9c..4b057bf4a2 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -618,6 +618,11 @@  GLIBC_2.2 clntudp_bufcreate F
 GLIBC_2.2 clntudp_create F
 GLIBC_2.2 clntunix_create F
 GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 clone F
 GLIBC_2.2 close F
 GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/sh/librt.abilist b/sysdeps/unix/sysv/linux/sh/librt.abilist
index 595f1b712a..bb03781dcc 100644
--- a/sysdeps/unix/sysv/linux/sh/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sh/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 3d2f00ca52..49cd597fd6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1826,6 +1826,11 @@  GLIBC_2.2 __xstat64 F
 GLIBC_2.2 _flushlbf F
 GLIBC_2.2 _res_hconf D 0x30
 GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 dcngettext F
 GLIBC_2.2 dngettext F
 GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
index cb874f4147..38f0aad791 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 2f20643e8e..95e68e0ba1 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -660,6 +660,11 @@  GLIBC_2.2 clntudp_bufcreate F
 GLIBC_2.2 clntudp_create F
 GLIBC_2.2 clntunix_create F
 GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
 GLIBC_2.2 clone F
 GLIBC_2.2 close F
 GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
index d7a049cf60..71f86e03ce 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
@@ -15,11 +15,6 @@  GLIBC_2.1 aio_write F
 GLIBC_2.1 aio_write64 F
 GLIBC_2.1 lio_listio F
 GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
 GLIBC_2.2 shm_open F
 GLIBC_2.2 shm_unlink F
 GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 59f85d9373..1f2dbd1451 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -621,6 +621,11 @@  GLIBC_2.2.5 clntudp_bufcreate F
 GLIBC_2.2.5 clntudp_create F
 GLIBC_2.2.5 clntunix_create F
 GLIBC_2.2.5 clock F
+GLIBC_2.2.5 clock_getcpuclockid F
+GLIBC_2.2.5 clock_getres F
+GLIBC_2.2.5 clock_gettime F
+GLIBC_2.2.5 clock_nanosleep F
+GLIBC_2.2.5 clock_settime F
 GLIBC_2.2.5 clone F
 GLIBC_2.2.5 close F
 GLIBC_2.2.5 closedir F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
index e2e8b60bf8..95e3f22daa 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
@@ -13,11 +13,6 @@  GLIBC_2.2.5 aio_suspend F
 GLIBC_2.2.5 aio_suspend64 F
 GLIBC_2.2.5 aio_write F
 GLIBC_2.2.5 aio_write64 F
-GLIBC_2.2.5 clock_getcpuclockid F
-GLIBC_2.2.5 clock_getres F
-GLIBC_2.2.5 clock_gettime F
-GLIBC_2.2.5 clock_nanosleep F
-GLIBC_2.2.5 clock_settime F
 GLIBC_2.2.5 lio_listio F
 GLIBC_2.2.5 lio_listio64 F
 GLIBC_2.2.5 shm_open F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 67a4e238d6..59da85a5d8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -660,6 +660,11 @@  GLIBC_2.16 clntudp_create F
 GLIBC_2.16 clntunix_create F
 GLIBC_2.16 clock F
 GLIBC_2.16 clock_adjtime F
+GLIBC_2.16 clock_getcpuclockid F
+GLIBC_2.16 clock_getres F
+GLIBC_2.16 clock_gettime F
+GLIBC_2.16 clock_nanosleep F
+GLIBC_2.16 clock_settime F
 GLIBC_2.16 clone F
 GLIBC_2.16 close F
 GLIBC_2.16 closedir F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
index 94e84e4dcf..66969fb9ab 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
@@ -14,11 +14,6 @@  GLIBC_2.16 aio_suspend F
 GLIBC_2.16 aio_suspend64 F
 GLIBC_2.16 aio_write F
 GLIBC_2.16 aio_write64 F
-GLIBC_2.16 clock_getcpuclockid F
-GLIBC_2.16 clock_getres F
-GLIBC_2.16 clock_gettime F
-GLIBC_2.16 clock_nanosleep F
-GLIBC_2.16 clock_settime F
 GLIBC_2.16 lio_listio F
 GLIBC_2.16 lio_listio64 F
 GLIBC_2.16 mq_close F
diff --git a/time/Makefile b/time/Makefile
index a428f55245..85a62c0376 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -36,14 +36,18 @@  routines := offtime asctime clock ctime ctime_r difftime \
 	    stime dysize timegm ftime			 \
 	    getdate strptime strptime_l			 \
 	    strftime wcsftime strftime_l wcsftime_l	 \
-	    timespec_get
+	    timespec_get 	 			 \
+	    clock_getcpuclockid clock_getres 		 \
+	    clock_gettime clock_settime clock_nanosleep
+
 aux :=	    era alt_digit lc-time-cleanup
 
 tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
 	   tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
 	   tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
 	   tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
-	   tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3
+	   tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3 \
+	   tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
 
 include ../Rules
 
diff --git a/time/Versions b/time/Versions
index fd838181e4..8788e192ce 100644
--- a/time/Versions
+++ b/time/Versions
@@ -49,6 +49,10 @@  libc {
   GLIBC_2.2 {
     # w*
     wcsftime;
+
+    # c*; actually in librt in version 2.2, moved to libc in 2.17
+    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+    clock_nanosleep;
   }
   GLIBC_2.3 {
     # these internal names are used by libstdc++
@@ -65,4 +69,13 @@  libc {
   GLIBC_2.16 {
     timespec_get;
   }
+  GLIBC_2.17 {
+    # c*
+    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+    clock_nanosleep;
+  }
+  GLIBC_PRIVATE {
+    # same as clock_gettime; used in other libraries
+    __clock_gettime;
+  }
 }
diff --git a/rt/clock_getcpuclockid.c b/time/clock_getcpuclockid.c
similarity index 75%
rename from rt/clock_getcpuclockid.c
rename to time/clock_getcpuclockid.c
index 22b9f1383c..8d205abfa9 100644
--- a/rt/clock_getcpuclockid.c
+++ b/time/clock_getcpuclockid.c
@@ -19,6 +19,7 @@ 
 #include <errno.h>
 #include <time.h>
 #include <unistd.h>
+#include <shlib-compat.h>
 
 int
 __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
@@ -37,4 +38,10 @@  __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
   return ENOENT;
 #endif
 }
-weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
+versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
+/* clock_getcpuclockid moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
+compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
+#endif
diff --git a/rt/clock_getres.c b/time/clock_getres.c
similarity index 73%
rename from rt/clock_getres.c
rename to time/clock_getres.c
index b990bf0af0..412f80fbec 100644
--- a/rt/clock_getres.c
+++ b/time/clock_getres.c
@@ -18,6 +18,7 @@ 
 
 #include <errno.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 /* Get resolution of clock.  */
 int
@@ -26,5 +27,13 @@  __clock_getres (clockid_t clock_id, struct timespec *res)
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (__clock_getres, clock_getres)
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
+
 stub_warning (clock_getres)
diff --git a/rt/clock_gettime.c b/time/clock_gettime.c
similarity index 74%
rename from rt/clock_gettime.c
rename to time/clock_gettime.c
index 0426dd2c76..92c6081dcb 100644
--- a/rt/clock_gettime.c
+++ b/time/clock_gettime.c
@@ -18,6 +18,7 @@ 
 
 #include <errno.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 /* Get current value of CLOCK and store it in TP.  */
 int
@@ -26,6 +27,14 @@  __clock_gettime (clockid_t clock_id, struct timespec *tp)
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (__clock_gettime, clock_gettime)
 libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
+
 stub_warning (clock_gettime)
diff --git a/rt/clock_nanosleep.c b/time/clock_nanosleep.c
similarity index 76%
rename from rt/clock_nanosleep.c
rename to time/clock_nanosleep.c
index 5b724e593b..c53c820880 100644
--- a/rt/clock_nanosleep.c
+++ b/time/clock_nanosleep.c
@@ -18,6 +18,7 @@ 
 
 #include <errno.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 int
 __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
@@ -33,5 +34,13 @@  __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
   /* Not implemented.  */
   return ENOSYS;
 }
-weak_alias (__clock_nanosleep, clock_nanosleep)
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
+
 stub_warning (clock_nanosleep)
diff --git a/rt/clock_settime.c b/time/clock_settime.c
similarity index 71%
rename from rt/clock_settime.c
rename to time/clock_settime.c
index 891925ab2c..dd86a1c189 100644
--- a/rt/clock_settime.c
+++ b/time/clock_settime.c
@@ -18,6 +18,7 @@ 
 
 #include <errno.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 /* Set CLOCK to value TP.  */
 int
@@ -26,5 +27,14 @@  __clock_settime (clockid_t clock_id, const struct timespec *tp)
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (__clock_settime, clock_settime)
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
+
 stub_warning (clock_settime)
diff --git a/rt/tst-clock.c b/time/tst-clock.c
similarity index 100%
rename from rt/tst-clock.c
rename to time/tst-clock.c
diff --git a/rt/tst-clock2.c b/time/tst-clock2.c
similarity index 100%
rename from rt/tst-clock2.c
rename to time/tst-clock2.c
diff --git a/rt/tst-clock_nanosleep.c b/time/tst-clock_nanosleep.c
similarity index 100%
rename from rt/tst-clock_nanosleep.c
rename to time/tst-clock_nanosleep.c
diff --git a/rt/tst-cpuclock1.c b/time/tst-cpuclock1.c
similarity index 100%
rename from rt/tst-cpuclock1.c
rename to time/tst-cpuclock1.c