hurd: Fix ld.so __getcwd override from libc

ld.so symbols to be overriden by libc need to be extern to really get
overriden. __getcwd happens to have never been exposed, putting it to
GLIBC_PRIVATE.
This commit is contained in:
Samuel Thibault 2019-12-01 20:48:46 +00:00
parent 892badc9bb
commit db25266c92
7 changed files with 11 additions and 6 deletions

View File

@ -75,7 +75,8 @@ extern int __lchown (const char *__file, __uid_t __owner,
__gid_t __group); __gid_t __group);
extern int __chdir (const char *__path) attribute_hidden; extern int __chdir (const char *__path) attribute_hidden;
extern int __fchdir (int __fd) 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 __rmdir (const char *__path) attribute_hidden;
extern int __execvpe (const char *file, char *const argv[], extern int __execvpe (const char *file, char *const argv[],
char *const envp[]) attribute_hidden; char *const envp[]) attribute_hidden;

View File

@ -32,6 +32,7 @@ __getcwd (char *buf, size_t size)
__set_errno (ENOSYS); __set_errno (ENOSYS);
return NULL; return NULL;
} }
libc_hidden_def (__getcwd)
weak_alias (__getcwd, getcwd) weak_alias (__getcwd, getcwd)
stub_warning (__getcwd) stub_warning (__getcwd)

View File

@ -1,7 +1,7 @@
libc { libc {
GLIBC_2.0 { GLIBC_2.0 {
# functions with a weak definition in the dynamic linker # functions with a weak definition in the dynamic linker
__access; __getcwd; __mmap; __access; __mmap;
} }
GLIBC_2.2.6 { GLIBC_2.2.6 {
# functions with a weak definition in the dynamic linker # functions with a weak definition in the dynamic linker
@ -10,7 +10,7 @@ libc {
GLIBC_PRIVATE { GLIBC_PRIVATE {
# Functions shared with the dynamic linker # Functions shared with the dynamic linker
__access_noerrno; __libc_read; __libc_write; __libc_lseek64; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
__libc_lock_self0; __sigprocmask; __libc_lock_self0; __sigprocmask; __getcwd;
_dl_init_first; _dl_init_first;
} }
@ -22,7 +22,7 @@ ld {
__hurd_threadvar_stack_mask; __hurd_threadvar_stack_offset; __hurd_threadvar_stack_mask; __hurd_threadvar_stack_offset;
# functions that must be shared with libc # functions that must be shared with libc
__access; __close; __getcwd; __getpid; __access; __close; __getpid;
__mmap; __open; __read; __sbrk; __strtoul_internal; __mmap; __open; __read; __sbrk; __strtoul_internal;
__write; __writev; __xstat64; __fxstat64; __write; __writev; __xstat64; __fxstat64;
_exit; _hurd_intr_rpc_mach_msg; _exit; _hurd_intr_rpc_mach_msg;
@ -41,6 +41,6 @@ ld {
# functions that must be shared with libc # functions that must be shared with libc
__access_noerrno; __libc_read; __libc_write; __libc_lseek64; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
__libc_lock_self0; __sigprocmask; __libc_lock_self0; __sigprocmask; __getcwd;
} }
} }

View File

@ -306,4 +306,5 @@ __getcwd (char *buf, size_t size)
buf, size)); buf, size));
return cwd; return cwd;
} }
libc_hidden_def (__getcwd)
weak_alias (__getcwd, getcwd) weak_alias (__getcwd, getcwd)

View File

@ -35,7 +35,7 @@ ld.so: __xstat64
#ld.so: __access #ld.so: __access
ld.so: __access_noerrno ld.so: __access_noerrno
ld.so: __getpid ld.so: __getpid
#ld.so: __getcwd ld.so: __getcwd
ld.so: __sbrk ld.so: __sbrk
ld.so: __strtoul_internal ld.so: __strtoul_internal
#ld.so: _exit #ld.so: _exit

View File

@ -531,5 +531,6 @@ __getcwd (char *buf, size_t size)
} }
#if defined _LIBC && !defined __getcwd #if defined _LIBC && !defined __getcwd
libc_hidden_def (__getcwd)
weak_alias (__getcwd, getcwd) weak_alias (__getcwd, getcwd)
#endif #endif

View File

@ -127,6 +127,7 @@ __getcwd (char *buf, size_t size)
return NULL; return NULL;
} }
libc_hidden_def (__getcwd)
weak_alias (__getcwd, getcwd) weak_alias (__getcwd, getcwd)
/* Get the code for the generic version. */ /* Get the code for the generic version. */