b2a9b0
commit 8eaf34eda256ba3647ed6e7ed5c7c9aa19955d17
b2a9b0
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
b2a9b0
Date:   Fri Dec 13 10:10:59 2019 +0100
b2a9b0
b2a9b0
    hurd: Fix local PLT
b2a9b0
b2a9b0
    * include/sys/random.h (__getrandom): Add hidden prototype.
b2a9b0
    * stdlib/getrandom.c (getrandom): Rename to hidden definition __getrandom.
b2a9b0
    Add weak alias.
b2a9b0
    * sysdeps/mach/hurd/getrandom.c (getrandom): Likewise.
b2a9b0
    * sysdeps/unix/sysv/linux/getrandom.c (getrandom): Likewise.
b2a9b0
    * sysdeps/mach/hurd/getentropy.c (getentropy): Use __getrandom instead of
b2a9b0
    getrandom.
b2a9b0
b2a9b0
Conflicts:
b2a9b0
	include/sys/random.h
b2a9b0
	  (Missing backport of include/ consistency patch,
b2a9b0
	  commit ebd32784ce2029d0461a90a79bc4e37f8d051765 upstream.)
b2a9b0
	sysdeps/mach/hurd/getentropy.c
b2a9b0
	  (Hurd change has been dropped.)
b2a9b0
	sysdeps/unix/sysv/linux/dl-write.c
b2a9b0
	  (Mismerge of sysdeps/mach/hurd/getrandom.c.)
b2a9b0
b2a9b0
diff --git a/include/sys/random.h b/include/sys/random.h
b2a9b0
new file mode 100644
b2a9b0
index 0000000000000000..6aa313d35dbdce8a
b2a9b0
--- /dev/null
b2a9b0
+++ b/include/sys/random.h
b2a9b0
@@ -0,0 +1,11 @@
b2a9b0
+#ifndef _SYS_RANDOM_H
b2a9b0
+#include <stdlib/sys/random.h>
b2a9b0
+
b2a9b0
+# ifndef _ISOMAC
b2a9b0
+
b2a9b0
+extern ssize_t __getrandom (void *__buffer, size_t __length,
b2a9b0
+                            unsigned int __flags) __wur;
b2a9b0
+libc_hidden_proto (__getrandom)
b2a9b0
+
b2a9b0
+# endif /* !_ISOMAC */
b2a9b0
+#endif
b2a9b0
diff --git a/stdlib/getrandom.c b/stdlib/getrandom.c
b2a9b0
index 45234bea17c5c86c..f8056688e40a0215 100644
b2a9b0
--- a/stdlib/getrandom.c
b2a9b0
+++ b/stdlib/getrandom.c
b2a9b0
@@ -22,10 +22,12 @@
b2a9b0
 /* Write up to LENGTH bytes of randomness starting at BUFFER.
b2a9b0
    Return the number of bytes written, or -1 on error.  */
b2a9b0
 ssize_t
b2a9b0
-getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
+__getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
 {
b2a9b0
   __set_errno (ENOSYS);
b2a9b0
   return -1;
b2a9b0
 }
b2a9b0
-
b2a9b0
 stub_warning (getrandom)
b2a9b0
+
b2a9b0
+libc_hidden_def (__getrandom)
b2a9b0
+weak_alias (__getrandom, getrandom)
b2a9b0
diff --git a/sysdeps/unix/sysv/linux/getrandom.c b/sysdeps/unix/sysv/linux/getrandom.c
b2a9b0
index 435b037399665654..e34d7fdcd89d9b06 100644
b2a9b0
--- a/sysdeps/unix/sysv/linux/getrandom.c
b2a9b0
+++ b/sysdeps/unix/sysv/linux/getrandom.c
b2a9b0
@@ -25,7 +25,7 @@
b2a9b0
 /* Write up to LENGTH bytes of randomness starting at BUFFER.
b2a9b0
    Return the number of bytes written, or -1 on error.  */
b2a9b0
 ssize_t
b2a9b0
-getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
+__getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
 {
b2a9b0
   return SYSCALL_CANCEL (getrandom, buffer, length, flags);
b2a9b0
 }
b2a9b0
@@ -33,7 +33,7 @@ getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
 /* Always provide a definition, even if the kernel headers lack the
b2a9b0
    system call number. */
b2a9b0
 ssize_t
b2a9b0
-getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
+__getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
 {
b2a9b0
   /* Ideally, we would add a cancellation point here, but we currently
b2a9b0
      cannot do so inside libc.  */
b2a9b0
@@ -41,3 +41,5 @@ getrandom (void *buffer, size_t length, unsigned int flags)
b2a9b0
   return -1;
b2a9b0
 }
b2a9b0
 #endif
b2a9b0
+libc_hidden_def (__getrandom)
b2a9b0
+weak_alias (__getrandom, getrandom)