diff mbox series

[2/2] hurd: Fix some ld.so symbol override from libc

Message ID 20180728142758.32338-3-samuel.thibault@ens-lyon.org
State New
Headers show
Series hurd: Fix some ld.so symbol override from libc | expand

Commit Message

Samuel Thibault July 28, 2018, 2:27 p.m. UTC
ld.so symbols to be overriden by libc need to be extern to really get
overriden.

	* include/unistd.h (__getcwd): Set libc_hidden_proto instead
	of attribute_hidden.
	* io/getcwd.c (__getcwd): Set libc_hidden_def.
	* sysdeps/mach/hurd/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Likewise.
	* sysdeps/mach/hurd/i386/libc.abilist: Update accordingly.
	* sysdeps/mach/hurd/i386/ld.abilist: Update accordingly.
	* sysdeps/mach/hurd/i386/localplt.data: Update accordingly.
---
 ChangeLog                            | 8 ++++++--
 include/unistd.h                     | 3 ++-
 io/getcwd.c                          | 1 +
 sysdeps/mach/hurd/getcwd.c           | 1 +
 sysdeps/mach/hurd/i386/ld.abilist    | 1 +
 sysdeps/mach/hurd/i386/libc.abilist  | 1 +
 sysdeps/mach/hurd/i386/localplt.data | 2 +-
 sysdeps/posix/getcwd.c               | 1 +
 sysdeps/unix/sysv/linux/getcwd.c     | 1 +
 9 files changed, 15 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/ChangeLog b/ChangeLog
index dfe30c416c..1e3e319501 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,15 @@ 
 	* sysdeps/mach/hurd/dl-unistd.h (__access, __brk, __lseek, __read,
 	__sbrk): Do not set attribute_hidden.
 	* sysdeps/mach/hurd/not-errno.h: New file.
-	* include/unistd.h (__access): Set libc_hidden_proto instead of
-	attribute_hidden.
+	* include/unistd.h (__access, __getcwd): Set libc_hidden_proto instead
+	of attribute_hidden.
 	* io/access.c (__access): Set libc_hidden_def.
+	* io/getcwd.c (__getcwd): Set libc_hidden_def.
 	* sysdeps/mach/hurd/access.c (__access): Likewise.
+	* sysdeps/mach/hurd/getcwd.c (__getcwd): Likewise.
+	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
 	* sysdeps/unix/sysv/linux/access.c (__access): Likewise.
+	* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Likewise.
 	* sysdeps/mach/hurd/i386/libc.abilist: Update accordingly.
 	* sysdeps/mach/hurd/i386/ld.abilist: Update accordingly.
 	* sysdeps/mach/hurd/i386/localplt.data: Update accordingly.
diff --git a/include/unistd.h b/include/unistd.h
index f1bdabebb2..42426a17b2 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -74,7 +74,8 @@  extern int __lchown (const char *__file, __uid_t __owner,
 		     __gid_t __group);
 extern int __chdir (const char *__path) attribute_hidden;
 extern int __fchdir (int __fd) attribute_hidden;
-extern char *__getcwd (char *__buf, size_t __size) attribute_hidden;
+extern char *__getcwd (char *__buf, size_t __size);
+libc_hidden_proto (__getcwd)
 extern int __rmdir (const char *__path) attribute_hidden;
 extern int __execvpe (const char *file, char *const argv[],
 		      char *const envp[]) attribute_hidden;
diff --git a/io/getcwd.c b/io/getcwd.c
index e6b8b6e6e5..4e5572059c 100644
--- a/io/getcwd.c
+++ b/io/getcwd.c
@@ -32,6 +32,7 @@  __getcwd (char *buf, size_t size)
   __set_errno (ENOSYS);
   return NULL;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 
 stub_warning (__getcwd)
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index c30b7c507b..9a1b7efaf4 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -318,4 +318,5 @@  __getcwd (char *buf, size_t size)
     }
   return cwd;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist
index 8b7be44dde..f5d8eebe6b 100644
--- a/sysdeps/mach/hurd/i386/ld.abilist
+++ b/sysdeps/mach/hurd/i386/ld.abilist
@@ -2,6 +2,7 @@  GLIBC_2.2.6 __access F
 GLIBC_2.2.6 __close F
 GLIBC_2.2.6 __errno_location F
 GLIBC_2.2.6 __fxstat64 F
+GLIBC_2.2.6 __getcwd F
 GLIBC_2.2.6 __getpid F
 GLIBC_2.2.6 __libc_stack_end D 0x4
 GLIBC_2.2.6 __mmap F
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 6e26654d85..9f5bb2734f 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -269,6 +269,7 @@  GLIBC_2.2.6 __fwritable F
 GLIBC_2.2.6 __fwriting F
 GLIBC_2.2.6 __fxstat F
 GLIBC_2.2.6 __fxstat64 F
+GLIBC_2.2.6 __getcwd F
 GLIBC_2.2.6 __getdelim F
 GLIBC_2.2.6 __getpagesize F
 GLIBC_2.2.6 __getpgid F
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data
index 1c54993ac7..c1725d140f 100644
--- a/sysdeps/mach/hurd/i386/localplt.data
+++ b/sysdeps/mach/hurd/i386/localplt.data
@@ -35,7 +35,7 @@  ld.so: __xstat64
 ld.so: __access
 ld.so: __access_noerrno
 ld.so: __getpid
-#ld.so: __getcwd
+ld.so: __getcwd
 ld.so: __sbrk
 ld.so: __strtoul_internal
 #ld.so: _exit
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index b53433a2dc..16da60efb8 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -531,5 +531,6 @@  __getcwd (char *buf, size_t size)
 }
 
 #if defined _LIBC && !defined __getcwd
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 #endif
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index 866b9d26d5..c642c70a32 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -127,6 +127,7 @@  __getcwd (char *buf, size_t size)
 
   return NULL;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 
 /* Get the code for the generic version.  */