public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] hurd: Fix build after __pread64 usage in the dynamic loader
@ 2019-10-24 13:45 Florian Weimer
  2019-10-24 13:50 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2019-10-24 13:45 UTC (permalink / raw)
  To: libc-alpha; +Cc: Carlos O'Donell, Samuel Thibault

Commit 95c1056962a3f2297c94ce47f0eaf0c5b6563231 ("elf: Use nocancel
pread64() instead of lseek()+read()") added calls to __pread64 to
the dynamic loader.  On Hurd, this needs an implementation in the
dynamic loader because the rtld-pread64 rebuild pulls in too many
symbols.

Fixes: 95c1056962a3f2297c94ce47f0eaf0c5b6563231

-----
 sysdeps/mach/hurd/dl-sysdep.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 219475aa7d..719d603f44 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -357,9 +357,9 @@ __close (int fd)
   return 0;
 }
 
-check_no_hidden(__read);
+check_no_hidden(__pread64);
 __ssize_t weak_function
-__read (int fd, void *buf, size_t nbytes)
+__pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
 {
   error_t err;
   char *data;
@@ -367,7 +367,7 @@ __read (int fd, void *buf, size_t nbytes)
 
   data = buf;
   nread = nbytes;
-  err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes);
+  err = __io_read ((mach_port_t) fd, &data, &nread, offset, nbytes);
   if (err)
     return __hurd_fail (err);
 
@@ -379,6 +379,14 @@ __read (int fd, void *buf, size_t nbytes)
 
   return nread;
 }
+libc_hidden_weak (__pread64)
+
+check_no_hidden(__read);
+__ssize_t weak_function
+__read (int fd, void *buf, size_t nbytes)
+{
+  return __pread64 (fd, buf, nbytes, -1);
+}
 libc_hidden_weak (__read)
 
 check_no_hidden(__write);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] hurd: Fix build after __pread64 usage in the dynamic loader
  2019-10-24 13:45 [PATCH] hurd: Fix build after __pread64 usage in the dynamic loader Florian Weimer
@ 2019-10-24 13:50 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2019-10-24 13:50 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, Carlos O'Donell

Florian Weimer, le jeu. 24 oct. 2019 15:45:11 +0200, a ecrit:
> Commit 95c1056962a3f2297c94ce47f0eaf0c5b6563231 ("elf: Use nocancel
> pread64() instead of lseek()+read()") added calls to __pread64 to
> the dynamic loader.  On Hurd, this needs an implementation in the
> dynamic loader because the rtld-pread64 rebuild pulls in too many
> symbols.
> 
> Fixes: 95c1056962a3f2297c94ce47f0eaf0c5b6563231

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> -----
>  sysdeps/mach/hurd/dl-sysdep.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
> index 219475aa7d..719d603f44 100644
> --- a/sysdeps/mach/hurd/dl-sysdep.c
> +++ b/sysdeps/mach/hurd/dl-sysdep.c
> @@ -357,9 +357,9 @@ __close (int fd)
>    return 0;
>  }
>  
> -check_no_hidden(__read);
> +check_no_hidden(__pread64);
>  __ssize_t weak_function
> -__read (int fd, void *buf, size_t nbytes)
> +__pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
>  {
>    error_t err;
>    char *data;
> @@ -367,7 +367,7 @@ __read (int fd, void *buf, size_t nbytes)
>  
>    data = buf;
>    nread = nbytes;
> -  err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes);
> +  err = __io_read ((mach_port_t) fd, &data, &nread, offset, nbytes);
>    if (err)
>      return __hurd_fail (err);
>  
> @@ -379,6 +379,14 @@ __read (int fd, void *buf, size_t nbytes)
>  
>    return nread;
>  }
> +libc_hidden_weak (__pread64)
> +
> +check_no_hidden(__read);
> +__ssize_t weak_function
> +__read (int fd, void *buf, size_t nbytes)
> +{
> +  return __pread64 (fd, buf, nbytes, -1);
> +}
>  libc_hidden_weak (__read)
>  
>  check_no_hidden(__write);
> 

-- 
Samuel
«Tiens, quand j'aurai un peu de temps et une partition libre, je crois
 que je vais essayer de remplacer mes scripts de démarrage par des
 programmes Windows lancés via Wine et binfmt_misc :-)»
-+- AGV in Guide du linuxien pervers - "J'sais pas quoi faire... (air connu)"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-24 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 13:45 [PATCH] hurd: Fix build after __pread64 usage in the dynamic loader Florian Weimer
2019-10-24 13:50 ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).