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