[1/3] nptl: Move nanosleep implementation to libc

Message ID 20191106125245.28102-1-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • [1/3] nptl: Move nanosleep implementation to libc
Related show

Commit Message

Adhemerval Zanella Nov. 6, 2019, 12:52 p.m.
Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.  I also
did a smoke check with check-abi on affected ABIs.
---
 nptl/Makefile                                              | 3 +--
 nptl/Versions                                              | 7 +------
 sysdeps/unix/sysv/linux/aarch64/libpthread.abilist         | 2 --
 sysdeps/unix/sysv/linux/alpha/libpthread.abilist           | 2 --
 sysdeps/unix/sysv/linux/arm/be/libpthread.abilist          | 2 --
 sysdeps/unix/sysv/linux/arm/le/libpthread.abilist          | 2 --
 sysdeps/unix/sysv/linux/csky/libpthread.abilist            | 2 --
 sysdeps/unix/sysv/linux/hppa/libpthread.abilist            | 2 --
 sysdeps/unix/sysv/linux/i386/libpthread.abilist            | 2 --
 sysdeps/unix/sysv/linux/ia64/libpthread.abilist            | 2 --
 sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist   | 2 --
 sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist     | 2 --
 sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist   | 2 --
 sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist   | 2 --
 sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist     | 2 --
 sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist     | 2 --
 sysdeps/unix/sysv/linux/nios2/libpthread.abilist           | 2 --
 .../unix/sysv/linux/powerpc/powerpc32/libpthread.abilist   | 2 --
 .../sysv/linux/powerpc/powerpc64/be/libpthread.abilist     | 2 --
 .../sysv/linux/powerpc/powerpc64/le/libpthread.abilist     | 2 --
 sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist      | 2 --
 sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist    | 2 --
 sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist    | 2 --
 sysdeps/unix/sysv/linux/sh/be/libpthread.abilist           | 2 --
 sysdeps/unix/sysv/linux/sh/le/libpthread.abilist           | 2 --
 sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist   | 2 --
 sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist   | 2 --
 sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist       | 2 --
 sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist      | 2 --
 time/Makefile                                              | 1 +
 30 files changed, 3 insertions(+), 62 deletions(-)

-- 
2.17.1

Comments

Florian Weimer Nov. 6, 2019, 1:04 p.m. | #1
* Adhemerval Zanella:

> diff --git a/nptl/Versions b/nptl/Versions

> index adbd4fa589..92291bf49e 100644

> --- a/nptl/Versions

> +++ b/nptl/Versions


> -  GLIBC_2.2.6 {

> -    # Cancellation wrapper

> -    __nanosleep;

> -  }


Sorry, this change is not correct because it removes the GLIBC_2.2.6
symbol version.  Old programs will fail to load as a result, not due to
the missing __nanosleep@@GLIBC_2.2.6 (we removed that check, and the
symbol in libc is sufficient), but due to the overall GLIBC_2.2.6 check
for libpthread.  You can use __libpthread_version_placeholder as a stub
symbol to keep that version alive.

Thanks,
Florian
Adhemerval Zanella Nov. 6, 2019, 1:16 p.m. | #2
On 06/11/2019 10:04, Florian Weimer wrote:
> * Adhemerval Zanella:

> 

>> diff --git a/nptl/Versions b/nptl/Versions

>> index adbd4fa589..92291bf49e 100644

>> --- a/nptl/Versions

>> +++ b/nptl/Versions

> 

>> -  GLIBC_2.2.6 {

>> -    # Cancellation wrapper

>> -    __nanosleep;

>> -  }

> 

> Sorry, this change is not correct because it removes the GLIBC_2.2.6

> symbol version.  Old programs will fail to load as a result, not due to

> the missing __nanosleep@@GLIBC_2.2.6 (we removed that check, and the

> symbol in libc is sufficient), but due to the overall GLIBC_2.2.6 check

> for libpthread.  You can use __libpthread_version_placeholder as a stub

> symbol to keep that version alive.

> 

> Thanks,

> Florian

> 


Indeed, I forgot about the absolute GLIBC_2.2.6 mark. I changed it to use

GLIBC_2.2.6 {
  __libpthread_version_placeholder;
}

And added a commit message comment.
Florian Weimer Nov. 6, 2019, 1:24 p.m. | #3
* Adhemerval Zanella:

> On 06/11/2019 10:04, Florian Weimer wrote:

>> * Adhemerval Zanella:

>> 

>>> diff --git a/nptl/Versions b/nptl/Versions

>>> index adbd4fa589..92291bf49e 100644

>>> --- a/nptl/Versions

>>> +++ b/nptl/Versions

>> 

>>> -  GLIBC_2.2.6 {

>>> -    # Cancellation wrapper

>>> -    __nanosleep;

>>> -  }

>> 

>> Sorry, this change is not correct because it removes the GLIBC_2.2.6

>> symbol version.  Old programs will fail to load as a result, not due to

>> the missing __nanosleep@@GLIBC_2.2.6 (we removed that check, and the

>> symbol in libc is sufficient), but due to the overall GLIBC_2.2.6 check

>> for libpthread.  You can use __libpthread_version_placeholder as a stub

>> symbol to keep that version alive.

>> 

>> Thanks,

>> Florian

>> 

>

> Indeed, I forgot about the absolute GLIBC_2.2.6 mark. I changed it to use

>

> GLIBC_2.2.6 {

>   __libpthread_version_placeholder;

> }

>

> And added a commit message comment.


I think you also need to update nptl/libpthread-compat.c, so that there
is actually a symbol at that version.

Thanks,
Florian
Adhemerval Zanella Nov. 6, 2019, 2:10 p.m. | #4
On 06/11/2019 10:24, Florian Weimer wrote:
> * Adhemerval Zanella:

> 

>> On 06/11/2019 10:04, Florian Weimer wrote:

>>> * Adhemerval Zanella:

>>>

>>>> diff --git a/nptl/Versions b/nptl/Versions

>>>> index adbd4fa589..92291bf49e 100644

>>>> --- a/nptl/Versions

>>>> +++ b/nptl/Versions

>>>

>>>> -  GLIBC_2.2.6 {

>>>> -    # Cancellation wrapper

>>>> -    __nanosleep;

>>>> -  }

>>>

>>> Sorry, this change is not correct because it removes the GLIBC_2.2.6

>>> symbol version.  Old programs will fail to load as a result, not due to

>>> the missing __nanosleep@@GLIBC_2.2.6 (we removed that check, and the

>>> symbol in libc is sufficient), but due to the overall GLIBC_2.2.6 check

>>> for libpthread.  You can use __libpthread_version_placeholder as a stub

>>> symbol to keep that version alive.

>>>

>>> Thanks,

>>> Florian

>>>

>>

>> Indeed, I forgot about the absolute GLIBC_2.2.6 mark. I changed it to use

>>

>> GLIBC_2.2.6 {

>>   __libpthread_version_placeholder;

>> }

>>

>> And added a commit message comment.

> 

> I think you also need to update nptl/libpthread-compat.c, so that there

> is actually a symbol at that version.


I will check for all affected ABI, but I think there is no need.  In fact
I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6
is currently true, we now need at least one absolute ABI symbol in at least
one library.
Florian Weimer Nov. 6, 2019, 2:13 p.m. | #5
* Adhemerval Zanella:

> I will check for all affected ABI, but I think there is no need.  In fact

> I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6

> is currently true, we now need at least one absolute ABI symbol in at least

> one library.


Hah, I thought I had broken the ABI test.

I don't think the symbol matters, so that part is actually true, but we
do need to check the presence of the .gnu.version_d entry in a test
because that's what the loader expects (and as discussed, we do not want
to change that, at least not for lazy binding).

Thanks,
Florian
Adhemerval Zanella Nov. 6, 2019, 5:14 p.m. | #6
On 06/11/2019 11:13, Florian Weimer wrote:
> * Adhemerval Zanella:

> 

>> I will check for all affected ABI, but I think there is no need.  In fact

>> I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6

>> is currently true, we now need at least one absolute ABI symbol in at least

>> one library.

> 

> Hah, I thought I had broken the ABI test.

> 

> I don't think the symbol matters, so that part is actually true, but we

> do need to check the presence of the .gnu.version_d entry in a test

> because that's what the loader expects (and as discussed, we do not want

> to change that, at least not for lazy binding).

> 

> Thanks,

> Florian

> 


Right, I checked the libpthread.so .gnu.version_d entries for every ABI
affected and all of them contains the required versions (including for
architectures which exports __nanosleep with a different version).
Florian Weimer Nov. 6, 2019, 5:17 p.m. | #7
* Adhemerval Zanella:

> On 06/11/2019 11:13, Florian Weimer wrote:

>> * Adhemerval Zanella:

>> 

>>> I will check for all affected ABI, but I think there is no need.  In fact

>>> I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6

>>> is currently true, we now need at least one absolute ABI symbol in at least

>>> one library.

>> 

>> Hah, I thought I had broken the ABI test.

>> 

>> I don't think the symbol matters, so that part is actually true, but we

>> do need to check the presence of the .gnu.version_d entry in a test

>> because that's what the loader expects (and as discussed, we do not want

>> to change that, at least not for lazy binding).

>> 

>> Thanks,

>> Florian

>> 

>

> Right, I checked the libpthread.so .gnu.version_d entries for every ABI

> affected and all of them contains the required versions (including for

> architectures which exports __nanosleep with a different version).


Good to know, thanks.

Florian
Adhemerval Zanella Nov. 6, 2019, 5:23 p.m. | #8
On 06/11/2019 14:17, Florian Weimer wrote:
> * Adhemerval Zanella:

> 

>> On 06/11/2019 11:13, Florian Weimer wrote:

>>> * Adhemerval Zanella:

>>>

>>>> I will check for all affected ABI, but I think there is no need.  In fact

>>>> I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6

>>>> is currently true, we now need at least one absolute ABI symbol in at least

>>>> one library.

>>>

>>> Hah, I thought I had broken the ABI test.

>>>

>>> I don't think the symbol matters, so that part is actually true, but we

>>> do need to check the presence of the .gnu.version_d entry in a test

>>> because that's what the loader expects (and as discussed, we do not want

>>> to change that, at least not for lazy binding).

>>>

>>> Thanks,

>>> Florian

>>>

>>

>> Right, I checked the libpthread.so .gnu.version_d entries for every ABI

>> affected and all of them contains the required versions (including for

>> architectures which exports __nanosleep with a different version).

> 

> Good to know, thanks.

> 

> Florian

> 


Ok with the __libpthread_version_placeholder change? As a side note I will
try to see if there is way to improve the .gnu.version_d entry with an
automated test.
Florian Weimer Nov. 6, 2019, 5:31 p.m. | #9
* Adhemerval Zanella:

> On 06/11/2019 14:17, Florian Weimer wrote:

>> * Adhemerval Zanella:

>> 

>>> On 06/11/2019 11:13, Florian Weimer wrote:

>>>> * Adhemerval Zanella:

>>>>

>>>>> I will check for all affected ABI, but I think there is no need.  In fact

>>>>> I am not sure if Joseph rationale at b289cd9db8286fa6c670104dd5dfcfc68d5d00d6

>>>>> is currently true, we now need at least one absolute ABI symbol in at least

>>>>> one library.

>>>>

>>>> Hah, I thought I had broken the ABI test.

>>>>

>>>> I don't think the symbol matters, so that part is actually true, but we

>>>> do need to check the presence of the .gnu.version_d entry in a test

>>>> because that's what the loader expects (and as discussed, we do not want

>>>> to change that, at least not for lazy binding).

>>>>

>>>> Thanks,

>>>> Florian

>>>>

>>>

>>> Right, I checked the libpthread.so .gnu.version_d entries for every ABI

>>> affected and all of them contains the required versions (including for

>>> architectures which exports __nanosleep with a different version).

>> 

>> Good to know, thanks.

>> 

>> Florian

>> 

>

> Ok with the __libpthread_version_placeholder change?


Yes, I think this is okay of the generated DSO looks reasonable.

> As a side note I will try to see if there is way to improve the

> .gnu.version_d entry with an automated test.


That would be nice!

Florian
Joseph Myers Nov. 7, 2019, 1:07 a.m. | #10
On Wed, 6 Nov 2019, Adhemerval Zanella wrote:

> Ok with the __libpthread_version_placeholder change? As a side note I will

> try to see if there is way to improve the .gnu.version_d entry with an

> automated test.


I'm seeing nptl/check-abi-libpthread test failures on many architectures, 
of the form:

+GLIBC_2.2.5 __libpthread_version_placeholder F

(i.e. missing baseline updates for the new symbol).

https://sourceware.org/ml/libc-testresults/2019-q4/msg00185.html

-- 
Joseph S. Myers
joseph@codesourcery.com
Adhemerval Zanella Nov. 7, 2019, 2:26 p.m. | #11
On 06/11/2019 22:07, Joseph Myers wrote:
> On Wed, 6 Nov 2019, Adhemerval Zanella wrote:

> 

>> Ok with the __libpthread_version_placeholder change? As a side note I will

>> try to see if there is way to improve the .gnu.version_d entry with an

>> automated test.

> 

> I'm seeing nptl/check-abi-libpthread test failures on many architectures, 

> of the form:

> 

> +GLIBC_2.2.5 __libpthread_version_placeholder F

> 

> (i.e. missing baseline updates for the new symbol).

> 

> https://sourceware.org/ml/libc-testresults/2019-q4/msg00185.html

> 


Right, I will sort this out.

Patch

diff --git a/nptl/Makefile b/nptl/Makefile
index 73b20718ed..f9aadfd644 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -44,7 +44,7 @@  pthread-compat-wrappers = \
 		      write read close accept \
 		      connect recv recvfrom send \
 		      sendto fsync lseek lseek64 \
-		      msync nanosleep open open64 pause \
+		      msync open open64 pause \
 		      pread pread64 pwrite pwrite64 \
 		      tcdrain wait waitpid msgrcv msgsnd \
 		      sigwait sigsuspend \
@@ -225,7 +225,6 @@  CFLAGS-sendmsg.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-close.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-read.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-write.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigsuspend.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-msync.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-fdatasync.c += -fexceptions -fasynchronous-unwind-tables
diff --git a/nptl/Versions b/nptl/Versions
index adbd4fa589..92291bf49e 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -98,7 +98,7 @@  libpthread {
     # Cancellation points.
     close; __close; fcntl; __fcntl; read; __read; write; __write; accept;
     connect; __connect; recv; recvfrom; recvmsg; send; __send; sendmsg; sendto;
-    fsync; lseek; __lseek; msync; nanosleep; open; __open; pause; tcdrain;
+    fsync; lseek; __lseek; msync; open; __open; pause; tcdrain;
     system; wait; __wait; waitpid;
 
     # Hidden entry point (through macros).
@@ -192,11 +192,6 @@  libpthread {
     pthread_getattr_np;
   }
 
-  GLIBC_2.2.6 {
-    # Cancellation wrapper
-    __nanosleep;
-  }
-
   GLIBC_2.3.2 {
     # Changed pthread_cond_t.
     pthread_cond_init; pthread_cond_destroy;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index e6e6489b02..98a8473fcd 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.17 __libc_allocate_rtsig F
 GLIBC_2.17 __libc_current_sigrtmax F
 GLIBC_2.17 __libc_current_sigrtmin F
 GLIBC_2.17 __lseek F
-GLIBC_2.17 __nanosleep F
 GLIBC_2.17 __open F
 GLIBC_2.17 __open64 F
 GLIBC_2.17 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.17 longjmp F
 GLIBC_2.17 lseek F
 GLIBC_2.17 lseek64 F
 GLIBC_2.17 msync F
-GLIBC_2.17 nanosleep F
 GLIBC_2.17 open F
 GLIBC_2.17 open64 F
 GLIBC_2.17 pause F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index 89e129aa1e..f42bcffd1e 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -193,7 +192,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index 1961bd0da0..c5b7aeb7c4 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -46,7 +46,6 @@  GLIBC_2.4 __libc_allocate_rtsig F
 GLIBC_2.4 __libc_current_sigrtmax F
 GLIBC_2.4 __libc_current_sigrtmin F
 GLIBC_2.4 __lseek F
-GLIBC_2.4 __nanosleep F
 GLIBC_2.4 __open F
 GLIBC_2.4 __open64 F
 GLIBC_2.4 __pread64 F
@@ -99,7 +98,6 @@  GLIBC_2.4 longjmp F
 GLIBC_2.4 lseek F
 GLIBC_2.4 lseek64 F
 GLIBC_2.4 msync F
-GLIBC_2.4 nanosleep F
 GLIBC_2.4 open F
 GLIBC_2.4 open64 F
 GLIBC_2.4 pause F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index 1961bd0da0..c5b7aeb7c4 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -46,7 +46,6 @@  GLIBC_2.4 __libc_allocate_rtsig F
 GLIBC_2.4 __libc_current_sigrtmax F
 GLIBC_2.4 __libc_current_sigrtmin F
 GLIBC_2.4 __lseek F
-GLIBC_2.4 __nanosleep F
 GLIBC_2.4 __open F
 GLIBC_2.4 __open64 F
 GLIBC_2.4 __pread64 F
@@ -99,7 +98,6 @@  GLIBC_2.4 longjmp F
 GLIBC_2.4 lseek F
 GLIBC_2.4 lseek64 F
 GLIBC_2.4 msync F
-GLIBC_2.4 nanosleep F
 GLIBC_2.4 open F
 GLIBC_2.4 open64 F
 GLIBC_2.4 pause F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index 259f6a8ff3..edbdea39cf 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -9,7 +9,6 @@  GLIBC_2.29 __libc_allocate_rtsig F
 GLIBC_2.29 __libc_current_sigrtmax F
 GLIBC_2.29 __libc_current_sigrtmin F
 GLIBC_2.29 __lseek F
-GLIBC_2.29 __nanosleep F
 GLIBC_2.29 __open F
 GLIBC_2.29 __open64 F
 GLIBC_2.29 __pread64 F
@@ -72,7 +71,6 @@  GLIBC_2.29 mtx_lock F
 GLIBC_2.29 mtx_timedlock F
 GLIBC_2.29 mtx_trylock F
 GLIBC_2.29 mtx_unlock F
-GLIBC_2.29 nanosleep F
 GLIBC_2.29 open F
 GLIBC_2.29 open64 F
 GLIBC_2.29 pause F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index c03a4a6731..a8ddccac98 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index 831cdecca4..5d1bf0f5ab 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -193,7 +192,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index 7609d56186..db3da66c35 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index 1961bd0da0..c5b7aeb7c4 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -46,7 +46,6 @@  GLIBC_2.4 __libc_allocate_rtsig F
 GLIBC_2.4 __libc_current_sigrtmax F
 GLIBC_2.4 __libc_current_sigrtmin F
 GLIBC_2.4 __lseek F
-GLIBC_2.4 __nanosleep F
 GLIBC_2.4 __open F
 GLIBC_2.4 __open64 F
 GLIBC_2.4 __pread64 F
@@ -99,7 +98,6 @@  GLIBC_2.4 longjmp F
 GLIBC_2.4 lseek F
 GLIBC_2.4 lseek64 F
 GLIBC_2.4 msync F
-GLIBC_2.4 nanosleep F
 GLIBC_2.4 open F
 GLIBC_2.4 open64 F
 GLIBC_2.4 pause F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index 831cdecca4..5d1bf0f5ab 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -193,7 +192,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index 269cd0994f..bf777df285 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.18 __libc_allocate_rtsig F
 GLIBC_2.18 __libc_current_sigrtmax F
 GLIBC_2.18 __libc_current_sigrtmin F
 GLIBC_2.18 __lseek F
-GLIBC_2.18 __nanosleep F
 GLIBC_2.18 __open F
 GLIBC_2.18 __open64 F
 GLIBC_2.18 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.18 longjmp F
 GLIBC_2.18 lseek F
 GLIBC_2.18 lseek64 F
 GLIBC_2.18 msync F
-GLIBC_2.18 nanosleep F
 GLIBC_2.18 open F
 GLIBC_2.18 open64 F
 GLIBC_2.18 pause F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index 269cd0994f..bf777df285 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.18 __libc_allocate_rtsig F
 GLIBC_2.18 __libc_current_sigrtmax F
 GLIBC_2.18 __libc_current_sigrtmin F
 GLIBC_2.18 __lseek F
-GLIBC_2.18 __nanosleep F
 GLIBC_2.18 __open F
 GLIBC_2.18 __open64 F
 GLIBC_2.18 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.18 longjmp F
 GLIBC_2.18 lseek F
 GLIBC_2.18 lseek64 F
 GLIBC_2.18 msync F
-GLIBC_2.18 nanosleep F
 GLIBC_2.18 open F
 GLIBC_2.18 open64 F
 GLIBC_2.18 pause F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index d3288b4ab3..6229568a0c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -192,7 +191,6 @@  GLIBC_2.2 sem_trywait F
 GLIBC_2.2 sem_unlink F
 GLIBC_2.2 sem_wait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index d3288b4ab3..6229568a0c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -192,7 +191,6 @@  GLIBC_2.2 sem_trywait F
 GLIBC_2.2 sem_unlink F
 GLIBC_2.2 sem_wait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index 961cd4a60c..03a462ef91 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.21 __libc_allocate_rtsig F
 GLIBC_2.21 __libc_current_sigrtmax F
 GLIBC_2.21 __libc_current_sigrtmin F
 GLIBC_2.21 __lseek F
-GLIBC_2.21 __nanosleep F
 GLIBC_2.21 __open F
 GLIBC_2.21 __open64 F
 GLIBC_2.21 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.21 longjmp F
 GLIBC_2.21 lseek F
 GLIBC_2.21 lseek64 F
 GLIBC_2.21 msync F
-GLIBC_2.21 nanosleep F
 GLIBC_2.21 open F
 GLIBC_2.21 open64 F
 GLIBC_2.21 pause F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index 66845c2e1e..0245103a0b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -193,7 +192,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index 143ed2dc7b..618004a931 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -40,7 +40,6 @@  GLIBC_2.3 __libc_allocate_rtsig F
 GLIBC_2.3 __libc_current_sigrtmax F
 GLIBC_2.3 __libc_current_sigrtmin F
 GLIBC_2.3 __lseek F
-GLIBC_2.3 __nanosleep F
 GLIBC_2.3 __open F
 GLIBC_2.3 __open64 F
 GLIBC_2.3 __pread64 F
@@ -87,7 +86,6 @@  GLIBC_2.3 longjmp F
 GLIBC_2.3 lseek F
 GLIBC_2.3 lseek64 F
 GLIBC_2.3 msync F
-GLIBC_2.3 nanosleep F
 GLIBC_2.3 open F
 GLIBC_2.3 open64 F
 GLIBC_2.3 pause F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index e6e6489b02..98a8473fcd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.17 __libc_allocate_rtsig F
 GLIBC_2.17 __libc_current_sigrtmax F
 GLIBC_2.17 __libc_current_sigrtmin F
 GLIBC_2.17 __lseek F
-GLIBC_2.17 __nanosleep F
 GLIBC_2.17 __open F
 GLIBC_2.17 __open64 F
 GLIBC_2.17 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.17 longjmp F
 GLIBC_2.17 lseek F
 GLIBC_2.17 lseek64 F
 GLIBC_2.17 msync F
-GLIBC_2.17 nanosleep F
 GLIBC_2.17 open F
 GLIBC_2.17 open64 F
 GLIBC_2.17 pause F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index b52721ca6f..d44217ac85 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -10,7 +10,6 @@  GLIBC_2.27 __libc_allocate_rtsig F
 GLIBC_2.27 __libc_current_sigrtmax F
 GLIBC_2.27 __libc_current_sigrtmin F
 GLIBC_2.27 __lseek F
-GLIBC_2.27 __nanosleep F
 GLIBC_2.27 __open F
 GLIBC_2.27 __open64 F
 GLIBC_2.27 __pread64 F
@@ -61,7 +60,6 @@  GLIBC_2.27 funlockfile F
 GLIBC_2.27 lseek F
 GLIBC_2.27 lseek64 F
 GLIBC_2.27 msync F
-GLIBC_2.27 nanosleep F
 GLIBC_2.27 open F
 GLIBC_2.27 open64 F
 GLIBC_2.27 pause F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index caf7f79355..429d8b6224 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -195,7 +194,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index 9e12e9b3a9..4a9bffeaa0 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -67,7 +67,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -187,7 +186,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index c03a4a6731..a8ddccac98 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index c03a4a6731..a8ddccac98 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index 89e129aa1e..f42bcffd1e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -42,7 +42,6 @@  GLIBC_2.0 funlockfile F
 GLIBC_2.0 longjmp F
 GLIBC_2.0 lseek F
 GLIBC_2.0 msync F
-GLIBC_2.0 nanosleep F
 GLIBC_2.0 open F
 GLIBC_2.0 pause F
 GLIBC_2.0 pthread_atfork F
@@ -193,7 +192,6 @@  GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
 GLIBC_2.2 sem_timedwait F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index 7609d56186..db3da66c35 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2 longjmp F
 GLIBC_2.2 lseek F
 GLIBC_2.2 lseek64 F
 GLIBC_2.2 msync F
-GLIBC_2.2 nanosleep F
 GLIBC_2.2 open F
 GLIBC_2.2 open64 F
 GLIBC_2.2 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index 39f807bb5f..e13f81e21c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -65,7 +65,6 @@  GLIBC_2.2.5 longjmp F
 GLIBC_2.2.5 lseek F
 GLIBC_2.2.5 lseek64 F
 GLIBC_2.2.5 msync F
-GLIBC_2.2.5 nanosleep F
 GLIBC_2.2.5 open F
 GLIBC_2.2.5 open64 F
 GLIBC_2.2.5 pause F
@@ -185,7 +184,6 @@  GLIBC_2.2.5 tcdrain F
 GLIBC_2.2.5 wait F
 GLIBC_2.2.5 waitpid F
 GLIBC_2.2.5 write F
-GLIBC_2.2.6 __nanosleep F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
 GLIBC_2.28 cnd_destroy F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index 21191a7aa0..aadd9eb0fa 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -11,7 +11,6 @@  GLIBC_2.16 __libc_allocate_rtsig F
 GLIBC_2.16 __libc_current_sigrtmax F
 GLIBC_2.16 __libc_current_sigrtmin F
 GLIBC_2.16 __lseek F
-GLIBC_2.16 __nanosleep F
 GLIBC_2.16 __open F
 GLIBC_2.16 __open64 F
 GLIBC_2.16 __pread64 F
@@ -64,7 +63,6 @@  GLIBC_2.16 longjmp F
 GLIBC_2.16 lseek F
 GLIBC_2.16 lseek64 F
 GLIBC_2.16 msync F
-GLIBC_2.16 nanosleep F
 GLIBC_2.16 open F
 GLIBC_2.16 open64 F
 GLIBC_2.16 pause F
diff --git a/time/Makefile b/time/Makefile
index 6de4e418d9..23630ae3fe 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -73,6 +73,7 @@  CFLAGS-tzfile.c += $(tz-cflags)
 CFLAGS-tzset.c += $(tz-cflags)
 CFLAGS-getdate.c += -fexceptions
 CFLAGS-clock_nanosleep.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables
 
 # Don't warn about Y2k problem in strftime format string.
 CFLAGS-test_time.c += -Wno-format