This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Avoid local PLT for dirfd


On Tuesday, February 28, 2012 13:55:22 Jakub Jelinek wrote:
> On Tue, Feb 28, 2012 at 01:19:16PM +0100, Andreas Jaeger wrote:
> > Running make check I noticed a local PLT failure:
> > 
> > cat elf/check-localplt.out
> > --- ../scripts/data/localplt-generic.data       2009-06-03
> > 09:17:46.000000000 +0200 +++ -   2012-02-28 12:16:38.670783466 +0100
> > @@ -1,4 +1,5 @@
> > 
> >  libc.so: calloc
> > 
> > +libc.so: dirfd
> > 
> >  libc.so: free
> >  libc.so: malloc
> >  libc.so: memalign
> > 
> > I'm appending a patch to fix this. Tested on Linux/x86-64.
> 
> I'd say you should not introduce __dirfd, but instead just
> add libc_hidden_proto (dirfd) (in include/dirent.h) and
> libc_hidden_def (dirfd) (in the dirfd.c).
> Then you don't need to adjust any users of that function.

Here's a patch as proposed. Tested on Linux/x86-64, ok to commit?

Andreas

2012-02-28  Andreas Jaeger  <aj@suse.de>

        * sysdeps/mach/hurd/dirfd.c: Add libc_hidden_def for dirfd to
        avoid local PLT
        * dirent/dirfd.c: Likewise.
        * sysdeps/unix/dirfd.c: Likwise.
        * include/dirent.h: Add hidden_proto for dirfd.

diff --git a/dirent/dirfd.c b/dirent/dirfd.c
index 026421f..f1939f2 100644
--- a/dirent/dirfd.c
+++ b/dirent/dirfd.c
@@ -1,5 +1,5 @@
 /* Return the file descriptor used by a DIR stream.  Stub version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2012 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
@@ -27,6 +27,7 @@ dirfd (dirp)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (dirfd)
 
 stub_warning (dirfd)
 #include <stub-tag.h>
diff --git a/include/dirent.h b/include/dirent.h
index 2e88005..4c412f1 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -42,6 +42,7 @@ extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
      internal_function;
 extern void __scandir_cancel_handler (void *arg);
 
+libc_hidden_proto (dirfd)
 libc_hidden_proto (rewinddir)
 libc_hidden_proto (scandirat)
 libc_hidden_proto (scandirat64)

diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c
index 587ae7b..fb16c48 100644
--- a/sysdeps/mach/hurd/dirfd.c
+++ b/sysdeps/mach/hurd/dirfd.c
@@ -1,5 +1,5 @@
 /* dirfd -- Return the file descriptor used by a DIR stream.  Hurd version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2012 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
@@ -38,3 +38,4 @@ dirfd (DIR *dirp)
 
   return fd;
 }
+libc_hidden_def (dirfd)
diff --git a/sysdeps/unix/dirfd.c b/sysdeps/unix/dirfd.c
index 536c44e..ce5076b 100644
--- a/sysdeps/unix/dirfd.c
+++ b/sysdeps/unix/dirfd.c
@@ -1,5 +1,5 @@
 /* Return the file descriptor used by a DIR stream.  Unix version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2012 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
@@ -27,3 +27,4 @@ dirfd (dirp)
 {
   return dirp->fd;
 }
+libc_hidden_def (dirfd)

-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]