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