]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
WIP no duplicate function definitions in pthread
authorZack Weinberg <zackw@panix.com>
Fri, 23 Mar 2018 20:17:26 +0000 (16:17 -0400)
committerZack Weinberg <zackw@panix.com>
Mon, 26 Mar 2018 12:27:47 +0000 (08:27 -0400)
37 files changed:
debug/pread64_chk.c
include/sys/socket.h
include/unistd.h
io/Versions
io/copy_file_range-compat.c
misc/Versions
misc/fsync.c
misc/msync.c
nptl/Makefile
nptl/pt-fork.c [deleted file]
nptl/pt-longjmp.c [deleted file]
nptl/pt-system.c [deleted file]
posix/Versions
posix/nanosleep.c
posix/waitpid.c
signal/Versions
socket/Versions
socket/accept.c
sysdeps/generic/pt-compat-stubs.S
sysdeps/mach/hurd/accept.c
sysdeps/mach/hurd/fsync.c
sysdeps/mach/hurd/pread.c
sysdeps/mach/hurd/pwrite.c
sysdeps/mach/msync.c
sysdeps/posix/posix_fallocate64.c
sysdeps/unix/bsd/waitpid.c
sysdeps/unix/sysv/linux/fsync.c
sysdeps/unix/sysv/linux/hppa/localplt.data
sysdeps/unix/sysv/linux/msync.c
sysdeps/unix/sysv/linux/nanosleep.c
sysdeps/unix/sysv/linux/not-cancel.h
sysdeps/unix/sysv/linux/open64.c
sysdeps/unix/sysv/linux/powerpc/pt-compat-stubs.S [new file with mode: 0644]
sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c [deleted file]
sysdeps/unix/sysv/linux/s390/pt-compat-stubs.S [moved from sysdeps/unix/sysv/linux/s390/pt-longjmp.c with 62% similarity]
sysdeps/unix/sysv/linux/waitpid.c
termios/Versions

index cc22b51f493fc2a1b3b8e76e462830b81dbdf4fa..654e126c9c252d05bfb6d537d634bd0814696ab8 100644 (file)
@@ -25,5 +25,5 @@ __pread64_chk (int fd, void *buf, size_t nbytes, off64_t offset, size_t buflen)
   if (nbytes > buflen)
     __chk_fail ();
 
-  return __libc_pread64 (fd, buf, nbytes, offset);
+  return __pread64 (fd, buf, nbytes, offset);
 }
index 26db0e0d7731a14ce9f98234d32933d2350243be..6e6420343fdf6b951cf3cec47c81211202bb4ddc 100644 (file)
@@ -139,11 +139,11 @@ extern int __listen (int __fd, int __n) attribute_hidden;
    new socket's descriptor, or -1 for errors.  */
 extern int __libc_accept (int __fd, __SOCKADDR_ARG __addr,
                          socklen_t *__restrict __addr_len)
-     __THROW attribute_hidden;
+     __THROW;
 libc_hidden_proto (accept)
 extern int __libc_accept4 (int __fd, __SOCKADDR_ARG __addr,
                           socklen_t *__restrict __addr_len, int __flags)
-     __THROW attribute_hidden;
+     __THROW;
 
 /* Return the length of a `sockaddr' structure.  */
 #ifdef _HAVE_SA_LEN
index 0f91b8babce5b92f99c7653289efa5b10af7d0dc..09860c63bc3d9e41ff740754d0196228e3a02d19 100644 (file)
@@ -43,7 +43,7 @@ extern ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
                          __off64_t __offset);
 libc_hidden_proto (__pread64);
 extern ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes,
-                              __off64_t __offset) attribute_hidden;
+                              __off64_t __offset);
 extern ssize_t __pwrite (int __fd, const void *__buf, size_t __n,
                         __off_t __offset);
 libc_hidden_proto (__pwrite)
@@ -53,7 +53,7 @@ extern ssize_t __pwrite64 (int __fd, const void *__buf, size_t __n,
                           __off64_t __offset);
 libc_hidden_proto (__pwrite64)
 extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n,
-                               __off64_t __offset) attribute_hidden;
+                               __off64_t __offset);
 extern ssize_t __libc_read (int __fd, void *__buf, size_t __n);
 libc_hidden_proto (__libc_read)
 libc_hidden_proto (read)
index 98898cb9d50aca8b9ffee72275206fd30a5330d3..b168d3eb4c0559595b8c64d41901625c31f14185 100644 (file)
@@ -128,4 +128,14 @@ libc {
   GLIBC_2.27 {
     copy_file_range;
   }
+  GLIBC_PRIVATE {
+    # called from libpthread
+    __libc_close;
+    __libc_fcntl;
+    __libc_lseek; __libc_lseek64;
+    __libc_open; __libc_open64;
+    __libc_read;
+    __libc_write;
+    __write_nocancel;
+  }
 }
index 4ab22cad19146ca91c58a8dfc94c2bdd09d5a907..5d6ce34de9d5c3eb81539327a9c883ce55fd2ccb 100644 (file)
@@ -97,7 +97,7 @@ COPY_FILE_RANGE (int infd, __off64_t *pinoff,
       if (pinoff == NULL)
         read_count = read (infd, buf, to_read);
       else
-        read_count = __libc_pread64 (infd, buf, to_read, *pinoff);
+        read_count = __pread64 (infd, buf, to_read, *pinoff);
       if (read_count == 0)
         /* End of file reached prematurely.  */
         return copied;
@@ -119,7 +119,7 @@ COPY_FILE_RANGE (int infd, __off64_t *pinoff,
           if (poutoff == NULL)
             write_count = write (outfd, p, end - p);
           else
-            write_count = __libc_pwrite64 (outfd, p, end - p, *poutoff);
+            write_count = __pwrite64 (outfd, p, end - p, *poutoff);
           if (write_count < 0)
             {
               /* Adjust the input read position to match what we have
@@ -136,7 +136,7 @@ COPY_FILE_RANGE (int infd, __off64_t *pinoff,
                       /* We are on an error recovery path, so we
                          cannot deal with failure here.  */
                       int save_errno = errno;
-                      (void) __libc_lseek64 (infd, -overread, SEEK_CUR);
+                      (void) __lseek64 (infd, -overread, SEEK_CUR);
                       __set_errno (save_errno);
                     }
                 }
index bfbda505e4dd8743e01c91c25c6851dd054027bd..065a7d9ed0af5b328c55703d7b0e1022e2a7af34 100644 (file)
@@ -162,6 +162,7 @@ libc {
     __madvise;
     __mktemp;
     __libc_ifunc_impl_list;
+    __libc_fsync;  __libc_msync;
     __tdelete; __tfind; __tsearch; __twalk;
     __mmap; __munmap; __mprotect;
     __sched_get_priority_min; __sched_get_priority_max;
index e52be4cc6a01d2f800bf868cba1bde38b7965b86..8eada612ef6d925d68e4b78dadb88262983399e9 100644 (file)
 
 /* Make all changes done to FD actually appear on disk.  */
 int
-fsync (int fd)
+__libc_fsync (int fd)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-
-
+weak_alias (__libc_fsync, fsync)
+libc_hidden_weak (fsync)
 stub_warning (fsync)
index 9785068444d69529238d21ec95f1a4e41f287a4d..72c876b63d2bf9eb4857b08223ba29f4e807a533 100644 (file)
    unpredictable before this is done.  */
 
 int
-msync (void *addr, size_t len, int flags)
+__libc_msync (void *addr, size_t len, int flags)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-
+weak_alias (__libc_msync, msync)
+libc_hidden_weak (msync)
 stub_warning (msync)
index 18fbdfbee7cb6bd647f38895ec107c2e01262a4f..167f2cc24bd46cdb2daaf17388a1eaa4013afb29 100644 (file)
@@ -33,18 +33,6 @@ routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
 shared-only-routines = forward
 static-only-routines = pthread_atfork
 
-# We need to provide certain routines for compatibility with existing
-# binaries.
-pthread-compat-wrappers = \
-                     write read close fcntl accept \
-                     connect recv recvfrom send \
-                     sendto fsync lseek lseek64 \
-                     msync nanosleep open open64 pause \
-                     pread pread64 pwrite pwrite64 \
-                     tcdrain wait waitpid msgrcv msgsnd \
-                     sigwait sigsuspend \
-                     recvmsg sendmsg
-
 libpthread-routines = nptl-init vars events version pt-interp \
                      pthread_create pthread_exit pthread_detach \
                      pthread_join pthread_tryjoin pthread_timedjoin \
@@ -116,13 +104,11 @@ libpthread-routines = nptl-init vars events version pt-interp \
                      sem_wait sem_timedwait sem_post \
                      cleanup cleanup_defer cleanup_compat \
                      cleanup_defer_compat unwind \
-                     pt-longjmp pt-cleanup\
+                     pt-cleanup \
                      cancellation \
                      lowlevellock \
                      lll_timedlock_wait lll_timedwait_tid \
-                     pt-fork \
-                     $(pthread-compat-wrappers) \
-                     pt-raise pt-system \
+                     pt-raise \
                      pt-compat-stubs \
                      flockfile ftrylockfile funlockfile \
                      sigaction \
@@ -190,41 +176,6 @@ CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
 
-# These are the function wrappers we have to duplicate here.
-CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-lockf.c += -fexceptions
-CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-pwrite.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-pwrite64.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-wait.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-waitpid.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-msgrcv.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-msgsnd.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-tcdrain.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-open.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-open64.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-pause.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-recv.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-send.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-accept.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-sendto.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-connect.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-recvfrom.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-recvmsg.c += -fexceptions -fasynchronous-unwind-tables
-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
-CFLAGS-fsync.c += -fexceptions -fasynchronous-unwind-tables
-
-CFLAGS-pt-system.c += -fexceptions
-
 LDLIBS-tst-once5 = -lstdc++
 CFLAGS-tst-thread_local1.o = -std=gnu++11
 LDLIBS-tst-thread_local1 = -lstdc++
diff --git a/nptl/pt-fork.c b/nptl/pt-fork.c
deleted file mode 100644 (file)
index 891befb..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ABI compatibility for 'fork' symbol in libpthread ABI.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <unistd.h>
-#include <shlib-compat.h>
-
-/* libpthread once had its own fork, though there was no apparent reason
-   for it.  There is no use in having a separate symbol in libpthread, but
-   the historical ABI requires it.  For static linking, there is no need to
-   provide anything here--the libc version will be linked in.  For shared
-   library ABI compatibility, there must be __fork and fork symbols in
-   libpthread.so.
-
-   With an IFUNC resolver, it would be possible to avoid the
-   indirection, but the IFUNC resolver might run before the
-   __libc_fork symbol has been relocated, in which case the IFUNC
-   resolver would not be able to provide the correct address.  */
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-static pid_t __attribute__ ((used))
-fork_compat (void)
-{
-  return __libc_fork ();
-}
-
-strong_alias (fork_compat, fork_alias)
-compat_symbol (libpthread, fork_alias, fork, GLIBC_2_0);
-
-strong_alias (fork_compat, __fork_alias)
-compat_symbol (libpthread, __fork_alias, __fork, GLIBC_2_0);
-
-#endif
diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c
deleted file mode 100644 (file)
index 5780887..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ABI compatibility for 'longjmp' and 'siglongjmp' symbols in libpthread ABI.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <setjmp.h>
-#include <shlib-compat.h>
-
-/* libpthread once had its own longjmp (and siglongjmp alias), though there
-   was no apparent reason for it.  There is no use in having a separate
-   symbol in libpthread, but the historical ABI requires it.  For static
-   linking, there is no need to provide anything here--the libc version
-   will be linked in.  For shared library ABI compatibility, there must be
-   longjmp and siglongjmp symbols in libpthread.so.
-
-   With an IFUNC resolver, it would be possible to avoid the indirection,
-   but the IFUNC resolver might run before the __libc_longjmp symbol has
-   been relocated, in which case the IFUNC resolver would not be able to
-   provide the correct address.  */
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-static void __attribute__ ((noreturn, used))
-longjmp_compat (jmp_buf env, int val)
-{
-  __libc_longjmp (env, val);
-}
-
-strong_alias (longjmp_compat, longjmp_alias)
-compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0);
-
-strong_alias (longjmp_alias, siglongjmp_alias)
-compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0);
-
-#endif
diff --git a/nptl/pt-system.c b/nptl/pt-system.c
deleted file mode 100644 (file)
index 3d73b55..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ABI compatibility for 'system' symbol in libpthread ABI.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <stdlib.h>
-#include <shlib-compat.h>
-
-/* libpthread once had its own 'system', though there was no apparent
-   reason for it.  There is no use in having a separate symbol in
-   libpthread, but the historical ABI requires it.  For static linking,
-   there is no need to provide anything here--the libc version will be
-   linked in.  For shared library ABI compatibility, there must be a
-   'system' symbol in libpthread.so.
-
-   With an IFUNC resolver, it would be possible to avoid the indirection,
-   but the IFUNC resolver might run before the __libc_system symbol has
-   been relocated, in which case the IFUNC resolver would not be able to
-   provide the correct address.  */
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-static int __attribute__ ((used))
-system_compat (const char *line)
-{
-  return __libc_system (line);
-}
-strong_alias (system_compat, system_alias)
-compat_symbol (libpthread, system_alias, system, GLIBC_2_0);
-
-#endif
index 65e96870e1d065dd30c4528412b4f5079ac7369a..5b34eba1f62a668e507cacb6bbcadd50ba6b553c 100644 (file)
@@ -138,6 +138,12 @@ libc {
     glob; glob64;
   }
   GLIBC_PRIVATE {
-    __libc_fork; __libc_pread; __libc_pwrite;
+    __libc_fork;
+    __libc_nanosleep;
+    __libc_pause;
+    __libc_pread; __libc_pread64;
+    __libc_pwrite; __libc_pwrite64;
+    __libc_wait; __libc_waitpid;
+    __pause_nocancel; __nanosleep_nocancel;
   }
 }
index 3f13a1db48477f173a96ab88dd836e8967d2afa0..9939aa15078c26c7b86c3b23448c415ef86e10dc 100644 (file)
@@ -30,4 +30,5 @@ __nanosleep (const struct timespec *requested_time,
 stub_warning (nanosleep)
 
 hidden_def (__nanosleep)
+strong_alias (__nanosleep, __libc_nanosleep)
 weak_alias (__nanosleep, nanosleep)
index 9a31175699e2c3e191f8e3399ec94af5f2d01ac3..9cb6d748f315efaaeb760d60e6072a1d24f4dc18 100644 (file)
@@ -45,6 +45,7 @@ __waitpid (pid_t pid, int *stat_loc, int options)
   return (pid_t) -1;
 }
 libc_hidden_def (__waitpid)
+strong_alias (__waitpid, __libc_waitpid)
 weak_alias (__waitpid, waitpid)
 
 stub_warning (waitpid)
index a915ef400f402ad19dda4e48013b8c6289eacfba..9042703c01a0fad40d00c1922015fb9ad8450804 100644 (file)
@@ -51,4 +51,8 @@ libc {
   }
   GLIBC_2.21 {
   }
+  GLIBC_PRIVATE {
+    # called from libpthread
+    __libc_sigwait;
+  }
 }
index 7ce6f43841d26202fa81f0ac5a2e2a27efcb2477..c603dfc68670a32c545c0a61235e9072a68199eb 100644 (file)
@@ -40,5 +40,9 @@ libc {
   GLIBC_PRIVATE {
     __sendmmsg;
     __recv; __socket;
+    __libc_accept;
+    __libc_connect;
+    __libc_recv; __libc_recvfrom; __libc_recvmsg;
+    __libc_send; __libc_sendto; __libc_sendmsg;
   }
 }
index 84894a97d6b5f2428430608420a60dac04489dd0..767bd5c8fd5d7af6aba934a5f6a83d0b6ee81c48 100644 (file)
    peer and *ADDR_LEN to the address's actual length, and return the
    new socket's descriptor, or -1 for errors.  */
 int
-accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len)
+__libc_accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-libc_hidden_def (accept)
-
+weak_alias (__libc_accept, accept)
+libc_hidden_weak (accept)
 
 stub_warning (accept)
index 3055cfe3cacbe665c9a5be7a12222f13a96051fc..426689a18da156d21689bff0ddd7d2ae29ca9eb4 100644 (file)
@@ -1,4 +1,4 @@
-/* Compatibility stubs for functions formerly exposed by libpthread.
+/* ABI compatibility stubs for libpthread.
    Copyright (C) 2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
 #include <shlib-compat.h>
 #include <sysdep.h>
 
+/* We need __OFF_T_MATCHES_OFF64_T, but sys/types.h cannot be included
+   from assembly language.  */
+#define _BITS_TYPES_H 1
+#include <bits/typesizes.h>
+
         compat_text_section
 
 #ifndef SIBCALL_ENTRY
 # define SIBCALL_ENTRY(name) ENTRY(name)
 #endif
+#ifndef LONGJMP_2_0_DEST
+# define LONGJMP_2_0_DEST __libc_longjmp
+#endif
+#ifndef LONGJMP_2_0_UNTIL_VER
+# define LONGJMP_2_0_UNTIL_VER GLIBC_2_22
+#endif
 
 #define define_stub(name)                                                    \
   define_stub_1(__pstub_##name, __libc_##name)
+#define define_stub_with_dest(name, dest)                                    \
+  define_stub_1(__pstub_##name, dest)
 #define define_stub_1(pstub_name, libc_name)                                 \
   SIBCALL_ENTRY(pstub_name)   ASM_LINE_SEP                                   \
   SIBCALL(libc_name)  ASM_LINE_SEP                                           \
 # if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
         compat_stub(vfork, __vfork, GLIBC_2_1_2)
 # endif
+#endif
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
+
+        define_stub(fork)
+        compat_stub(fork, fork, GLIBC_2_0)
+        compat_stub(fork, __fork, GLIBC_2_0)
+
+        define_stub(system)
+        compat_stub(system, system, GLIBC_2_0)
+
+#endif
+
+/* Some architectures need special treatment for longjmp.  */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, LONGJMP_2_0_UNTIL_VER)
+
+        define_stub_with_dest(longjmp, LONGJMP_2_0_DEST)
+        compat_stub(longjmp, longjmp, GLIBC_2_0)
+        compat_stub(longjmp, siglongjmp, GLIBC_2_0)
+
+#endif
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_28)
+
+        define_stub(accept)
+        compat_stub(accept, accept, GLIBC_2_0)
+
+        define_stub(close)
+        compat_stub(close, close, GLIBC_2_0)
+        compat_stub(close, __close, GLIBC_2_0)
+
+        define_stub(connect)
+        compat_stub(connect, connect, GLIBC_2_0)
+        compat_stub(connect, __connect, GLIBC_2_0)
+
+        define_stub(fcntl)
+        compat_stub(fcntl, fcntl, GLIBC_2_0)
+        compat_stub(fcntl, __fcntl, GLIBC_2_0)
+
+        define_stub(fsync)
+        compat_stub(fsync, fsync, GLIBC_2_0)
+
+        define_stub(msync)
+        compat_stub(msync, msync, GLIBC_2_0)
+
+        define_stub(nanosleep)
+        compat_stub(nanosleep, nanosleep, GLIBC_2_0)
+#if SHLIB_COMPAT (libpthread, GLIBC_2_2_6, GLIBC_2_28)
+        compat_stub(nanosleep, __nanosleep, GLIBC_2_2_6)
+#endif
+
+        define_stub(pause)
+        compat_stub(pause, pause, GLIBC_2_0)
+
+        define_stub(read)
+        compat_stub(read, read, GLIBC_2_0)
+        compat_stub(read, __read, GLIBC_2_0)
+
+        define_stub(recv)
+        compat_stub(recv, recv, GLIBC_2_0)
+
+        define_stub(recvfrom)
+        compat_stub(recvfrom, recvfrom, GLIBC_2_0)
+
+        define_stub(recvmsg)
+        compat_stub(recvmsg, recvmsg, GLIBC_2_0)
+
+        define_stub(send)
+        compat_stub(send, send, GLIBC_2_0)
+        compat_stub(send, __send, GLIBC_2_0)
+
+        define_stub(sendmsg)
+        compat_stub(sendmsg, sendmsg, GLIBC_2_0)
+
+        define_stub(sendto)
+        compat_stub(sendto, sendto, GLIBC_2_0)
+
+        define_stub(sigwait)
+        compat_stub(sigwait, sigwait, GLIBC_2_0)
+
+        define_stub(tcdrain)
+        compat_stub(tcdrain, tcdrain, GLIBC_2_0)
+
+        define_stub(wait)
+        compat_stub(wait, wait, GLIBC_2_0)
+        compat_stub(wait, __wait, GLIBC_2_0)
+
+        define_stub(waitpid)
+        compat_stub(waitpid, waitpid, GLIBC_2_0)
+
+        define_stub(write)
+        compat_stub(write, write, GLIBC_2_0)
+        compat_stub(write, __write, GLIBC_2_0)
+
+#endif
+
+/* The off64_t functions were added in glibc 2.2, but some architectures
+   had 64-bit off_t before that.  On those architectures, the unsuffixed
+   lseek, open, etc should be additional aliases for the suffixed ones.  */
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_28)    \
+  || (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_28)  \
+      && defined __OFF_T_MATCHES_OFF64_T)
+
+#ifndef __OFF_T_MATCHES_OFF64_T
+        define_stub(lseek)
+        compat_stub(lseek, lseek, GLIBC_2_0)
+        compat_stub(lseek, __lseek, GLIBC_2_0)
+
+        define_stub(open)
+        compat_stub(open, open, GLIBC_2_0)
+        compat_stub(open, __open, GLIBC_2_0)
+#endif
+
+        define_stub(lseek64)
+        compat_stub(lseek64, lseek64, GLIBC_2_2)
+# ifdef __OFF_T_MATCHES_OFF64_T
+        compat_stub(lseek64, lseek, GLIBC_2_0)
+        compat_stub(lseek64, __lseek, GLIBC_2_0)
+# endif
+
+        define_stub(open64)
+        compat_stub(open64, open64, GLIBC_2_2)
+        compat_stub(open64, __open64, GLIBC_2_2)
+# ifdef __OFF_T_MATCHES_OFF64_T
+        compat_stub(open64, open, GLIBC_2_0)
+        compat_stub(open64, __open, GLIBC_2_0)
+# endif
+
+#endif
+
+/* pread and pwrite were added in the same release as pread64 and pwrite64,
+   and do not have exposed __ variants.  */
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_28)
+
+# ifndef __OFF_T_MATCHES_OFF64_T
+        define_stub(pread)
+        compat_stub(pread, pread, GLIBC_2_2)
+
+        define_stub(pwrite)
+        compat_stub(pwrite, pwrite, GLIBC_2_2)
+# endif
+
+        define_stub(pread64)
+        compat_stub(pread64, pread64, GLIBC_2_2)
+        compat_stub(pread64, __pread64, GLIBC_2_2)
+#ifdef __OFF_T_MATCHES_OFF64_T
+        compat_stub(pread64, pread, GLIBC_2_2)
+#endif
+
+        define_stub(pwrite64)
+        compat_stub(pwrite64, pwrite64, GLIBC_2_2)
+        compat_stub(pwrite64, __pwrite64, GLIBC_2_2)
+#ifdef __OFF_T_MATCHES_OFF64_T
+        compat_stub(pwrite64, pwrite, GLIBC_2_2)
+#endif
 
 #endif
index a6a3a9a0a0b5e87b40ae942087a795935d429dd9..602d2663b6a82a87d5f79832a62949ab363e5862 100644 (file)
@@ -24,8 +24,9 @@
    peer and *ADDR_LEN to the address's actual length, and return the
    new socket's descriptor, or -1 for errors.  */
 int
-accept (int fd, __SOCKADDR_ARG addrarg, socklen_t *addr_len)
+__libc_accept (int fd, __SOCKADDR_ARG addrarg, socklen_t *addr_len)
 {
-  return __libc_accept4 (fd, addrarg, addr_len, 0);
+  return __accept4 (fd, addrarg, addr_len, 0);
 }
-libc_hidden_def (accept)
+weak_alias (__libc_accept, accept)
+libc_hidden_weak (accept)
index d8ae6e0358b556795c5d73e4ded66dbaff310930..c9cf7c2693f935d7e575d4b2e154c8fac1795b44 100644 (file)
@@ -22,7 +22,7 @@
 
 /* Make all changes done to FD actually appear on disk.  */
 int
-fsync (int fd)
+__libc_fsync (int fd)
 {
   error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 0));
   if (err)
@@ -35,3 +35,4 @@ fsync (int fd)
     }
   return 0;
 }
+weak_alias (__libc_fsync, fsync)
index 63a90aa4dff91428989579cd9fdaf960759b27c5..c4e005e46395c193cf69a2496e7d8ac9c9c1f57b 100644 (file)
@@ -23,7 +23,7 @@
 ssize_t
 __libc_pread (int fd, void *buf, size_t nbytes, off_t offset)
 {
-  return __libc_pread64 (fd, buf, nbytes, (off64_t) offset);
+  return __pread64 (fd, buf, nbytes, (off64_t) offset);
 }
 
 #ifndef __libc_pread
index 80be158489f95dfc347f4940e0f44917deb8c9f5..626ec7ef877b48e5e1328d11a7fb51921ed3fc41 100644 (file)
@@ -25,7 +25,7 @@
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
 {
-  return __libc_pwrite64 (fd, buf, nbytes, (off64_t) offset);
+  return __pwrite64 (fd, buf, nbytes, (off64_t) offset);
 }
 
 #ifndef __libc_pwrite
index 92ce15e6397a3c46ee763e6ef1769ab3a0e60c14..02651b6d6ed054f06b8a1227b72749d42533d7e0 100644 (file)
@@ -33,7 +33,7 @@
    unpredictable before this is done.  */
 
 int
-msync (void *addr, size_t len, int flags)
+__libc_msync (void *addr, size_t len, int flags)
 {
   vm_sync_t sync_flags = 0;
   kern_return_t err;
@@ -53,4 +53,5 @@ msync (void *addr, size_t len, int flags)
     }
   return 0;
 }
+weak_alias (__libc_msync, msync)
 #endif
index 2eaeab2a6f20c48dc6cbb442ff78bd966aa25dbb..8f536e3bd478c3b91a89474683ac623e6f846df3 100644 (file)
@@ -104,7 +104,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
       if (offset < st.st_size)
        {
          unsigned char c;
-         ssize_t rsize = __libc_pread64 (fd, &c, 1, offset);
+         ssize_t rsize = __pread64 (fd, &c, 1, offset);
 
          if (rsize < 0)
            return errno;
@@ -114,7 +114,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
            continue;
        }
 
-      if (__libc_pwrite64 (fd, "", 1, offset) != 1)
+      if (__pwrite64 (fd, "", 1, offset) != 1)
        return errno;
     }
 
index 543b94fc9f247978d8573c32b91fe16aed4934c6..85245e64af9310e8425545b09eb90ca7cd60e4b7 100644 (file)
@@ -39,4 +39,5 @@ __waitpid (pid_t pid, int *stat_loc, int options)
 }
 
 libc_hidden_def (__waitpid)
+strong_alias (__waitpid, __libc_waitpid)
 weak_alias (__waitpid, waitpid)
index db101a219dd91401282be923d3cfbcfd94a0fcb1..3c47534679aebd361a6ad6bcf9c3980d6bb7e4f0 100644 (file)
@@ -22,7 +22,8 @@
 
 /* Make all changes done to FD actually appear on disk.  */
 int
-fsync (int fd)
+__libc_fsync (int fd)
 {
   return SYSCALL_CANCEL (fsync, fd);
 }
+weak_alias (__libc_fsync, fsync)
index 5f3475de191778f6816ed472d5af1f8da483fbae..867413f0c54d3d719dc552cf89485d1f7ac8a45f 100644 (file)
@@ -10,7 +10,6 @@ libc.so: __sigsetjmp
 libc.so: _IO_funlockfile
 libc.so: __errno_location
 libm.so: matherr
-libpthread.so: __errno_location
 # The main malloc is interposed into the dynamic linker, for
 # allocations after the initial link (when dlopen is used).
 ld.so: malloc
index fa443e73deb2ab559f5756cfddbca3df354617c5..ea9c9f1274d90ede370ddbdd0c216324fdcf2bf4 100644 (file)
@@ -20,7 +20,8 @@
 #include <sysdep-cancel.h>
 
 int
-msync (void *addr, size_t length, int flags)
+__libc_msync (void *addr, size_t length, int flags)
 {
   return SYSCALL_CANCEL (msync, addr, length, flags);
 }
+weak_alias (__libc_msync, msync)
index 894583740740f298316b6dde015c3c57ba6b150e..cbd9ba4c15c52196209dd151ec0545a5b8231a2f 100644 (file)
@@ -28,6 +28,7 @@ __nanosleep (const struct timespec *requested_time,
   return SYSCALL_CANCEL (nanosleep, requested_time, remaining);
 }
 hidden_def (__nanosleep)
+strong_alias (__nanosleep, __libc_nanosleep)
 weak_alias (__nanosleep, nanosleep)
 
 int
index e6cdd144c2fb5e76b7284e90207f6e5c9211d83a..e532b19042567150d8a6ca3ee93ce1d20a4303f3 100644 (file)
@@ -83,7 +83,7 @@ libc_hidden_proto (__pause_nocancel)
 
 /* Uncancelable nanosleep.  */
 __typeof (__nanosleep) __nanosleep_nocancel;
-hidden_proto (__nanosleep_nocancel)
+libc_hidden_proto (__nanosleep_nocancel)
 
 /* Uncancelable fcntl.  */
 __typeof (__fcntl) __fcntl_nocancel;
index 4af5ee24669f8ed1b679e9c1c7cec69a5f8ccbcc..f79c5e86c90e93d90f38a5a71ae2152b68091889 100644 (file)
@@ -76,6 +76,7 @@ libc_hidden_def (__open64_nocancel)
 
 #ifdef __OFF_T_MATCHES_OFF64_T
 strong_alias (__libc_open64, __libc_open)
+libc_hidden_def (__libc_open)
 strong_alias (__libc_open64, __open)
 libc_hidden_weak (__open)
 weak_alias (__libc_open64, open)
diff --git a/sysdeps/unix/sysv/linux/powerpc/pt-compat-stubs.S b/sysdeps/unix/sysv/linux/powerpc/pt-compat-stubs.S
new file mode 100644 (file)
index 0000000..077c2c5
--- /dev/null
@@ -0,0 +1,32 @@
+/* ABI compatibility stubs for libpthread.  PowerPC/Linux version.
+   Copyright (C) 2018 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/>.  */
+
+/* AltiVec support was added to setjmp/longjmp in 2.3.4,
+   requiring a new symbol version.  */
+#define LONGJMP_2_0_DEST       __novmx__libc_siglongjmp
+#define LONGJMP_2_0_UNTIL_VER  GLIBC_2_3_4
+
+#include <sysdeps/generic/pt-compat-stubs.S>
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_3_4, GLIBC_2_28)
+
+       define_stub_with_dest(vmx_longjmp, __libc_longjmp)
+       compat_stub(vmx_longjmp, longjmp, GLIBC_2_3_4)
+       compat_stub(vmx_longjmp, siglongjmp, GLIBC_2_3_4)
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c b/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
deleted file mode 100644 (file)
index 5b35461..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <setjmp.h>
-#include <stdlib.h>
-#include <bits/wordsize.h>
-#include "pthreadP.h"
-#include  <shlib-compat.h>
-#if defined SHARED && SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3_4)
-
-/* These functions are not declared anywhere since they shouldn't be
-   used at another place but here.  */
-extern void __novmx__libc_siglongjmp (sigjmp_buf env, int val)
-     __attribute__ ((noreturn));
-extern void __novmx__libc_longjmp (sigjmp_buf env, int val)
-     __attribute__ ((noreturn));
-
-
-void __novmx_siglongjmp (sigjmp_buf env, int val)
-{
-  __novmx__libc_siglongjmp (env, val);
-}
-
-void __novmx_longjmp (jmp_buf env, int val)
-{
-  __novmx__libc_longjmp (env, val);
-}
-
-compat_symbol (libpthread, __novmx_longjmp, longjmp, GLIBC_2_0);
-compat_symbol (libpthread, __novmx_siglongjmp, siglongjmp, GLIBC_2_0);
-#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4))  */
-
-void
-__vmx_longjmp (jmp_buf env, int val)
-{
-  __libc_longjmp (env, val);
-}
-
-void
-__vmx_siglongjmp (jmp_buf env, int val)
-{
-  __libc_siglongjmp (env, val);
-}
-
-versioned_symbol (libpthread, __vmx_longjmp, longjmp, GLIBC_2_3_4);
-versioned_symbol (libpthread, __vmx_siglongjmp, siglongjmp, GLIBC_2_3_4);
similarity index 62%
rename from sysdeps/unix/sysv/linux/s390/pt-longjmp.c
rename to sysdeps/unix/sysv/linux/s390/pt-compat-stubs.S
index bd41a84a18039809c9a4bdf94223a7d22694e05b..7204aba0fa0d16bfaf63037a5cdb26d8a0f5430d 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
+/* ABI compatibility stubs for libpthread.  S/390/Linux version.
+   Copyright (C) 2018 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
 
    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/>.
+   <http://www.gnu.org/licenses/>.  */
 
-   Versioned copy of nptl/pt-longjmp.c modified for versioning
-   the reverted jmpbuf extension.  */
-
-#include  <shlib-compat.h>
-
-#include <nptl/pt-longjmp.c>
+#include <sysdeps/generic/pt-compat-stubs.S>
 
 #if SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20)
 /* In glibc release 2.19 new versions of longjmp-functions were introduced,
    but were reverted before 2.20. Thus both versions are the same function.  */
 
-strong_alias (longjmp_alias, __v2longjmp)
-compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19);
-strong_alias (siglongjmp_alias, __v2siglongjmp)
-compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19);
-#endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20))  */
+       compat_stub(longjmp, longjmp, GLIBC_2_19)
+       compat_stub(longjmp, siglongjmp, GLIBC_2_19)
+
+#endif
index d1d30fd4317c194d8f047903e2102807d9e9381b..3b7ddc6059ae6e96ff84af8b97c66596f9109554 100644 (file)
@@ -31,6 +31,7 @@ __waitpid (__pid_t pid, int *stat_loc, int options)
 #endif
 }
 libc_hidden_def (__waitpid)
+strong_alias (__waitpid, __libc_waitpid)
 weak_alias (__waitpid, waitpid)
 
 __pid_t
index 711ed0334b52fe95d20f59c273e7b344d08fc33a..54eaf2f2adbb54bd8a3b6e1ec998d47c00dec14b 100644 (file)
@@ -11,4 +11,8 @@ libc {
     # t*
     tcgetsid;
   }
+  GLIBC_PRIVATE {
+    # called from libpthread
+    __libc_tcdrain;
+  }
 }