aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2017-09-24 17:54:02 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-09-24 17:54:02 +0200
commit5e6f32531eab502afb094ad62aad333c63a58cfd (patch)
tree3e50baffd6a141306de3e01d1e31bcc9a18753af
parent2f49ce7d6263588c0b4c60a42e95ff954cf3c7d2 (diff)
downloadglibc-5e6f32531eab502afb094ad62aad333c63a58cfd.tar
glibc-5e6f32531eab502afb094ad62aad333c63a58cfd.tar.gz
glibc-5e6f32531eab502afb094ad62aad333c63a58cfd.tar.bz2
glibc-5e6f32531eab502afb094ad62aad333c63a58cfd.zip
hurd: Make sure dl-sysdep.c defines proper symbol names
* sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro. (__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64, __mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid, __getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden to make sure that these symbols are defined.
-rw-r--r--ChangeLog8
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c32
2 files changed, 33 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e986689ade..7336c52c1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro.
+ (__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64,
+ __mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid,
+ __getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden
+ to make sure that these symbols are defined.
+
2017-09-22 Joseph Myers <joseph@codesourcery.com>
* sysdeps/ieee754/flt-32/s_asinhf.c: Include <libm-alias-float.h>.
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 8a8ac76efa..2cc342ec8e 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -292,6 +292,11 @@ _dl_sysdep_start_cleanup (void)
dynamic linker re-relocates itself to be user-visible (for -ldl),
it will get the user's definition (i.e. usually libc's). */
+/* This macro checks that the function does not get renamed to be hidden: we do
+ need these to be overridable by libc's. */
+#define check_no_hidden(name) \
+static void __check_##name##_no_hidden(void) __attribute__((alias(#name)));
+
/* Open FILE_NAME and return a Hurd I/O for it in *PORT, or return an
error. If STAT is non-zero, stat the file into that stat buffer. */
static error_t
@@ -347,6 +352,7 @@ open_file (const char *file_name, int flags,
return err;
}
+check_no_hidden(__open);
int weak_function
__open (const char *file_name, int mode, ...)
{
@@ -358,6 +364,7 @@ __open (const char *file_name, int mode, ...)
return (int)port;
}
+check_no_hidden(__close);
int weak_function
__close (int fd)
{
@@ -366,6 +373,7 @@ __close (int fd)
return 0;
}
+check_no_hidden(__libc_read);
__ssize_t weak_function
__libc_read (int fd, void *buf, size_t nbytes)
{
@@ -389,6 +397,7 @@ __libc_read (int fd, void *buf, size_t nbytes)
}
libc_hidden_weak (__libc_read)
+check_no_hidden(__libc_write);
__ssize_t weak_function
__libc_write (int fd, const void *buf, size_t nbytes)
{
@@ -406,6 +415,7 @@ __libc_write (int fd, const void *buf, size_t nbytes)
libc_hidden_weak (__libc_write)
/* This is only used for printing messages (see dl-misc.c). */
+check_no_hidden(__writev);
__ssize_t weak_function
__writev (int fd, const struct iovec *iov, int niov)
{
@@ -439,7 +449,7 @@ __writev (int fd, const struct iovec *iov, int niov)
return 0;
}
-
+check_no_hidden(__libc_lseek64);
off64_t weak_function
__libc_lseek64 (int fd, off64_t offset, int whence)
{
@@ -452,6 +462,7 @@ __libc_lseek64 (int fd, off64_t offset, int whence)
return offset;
}
+check_no_hidden(__mmap);
void *weak_function
__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
@@ -514,6 +525,7 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
return (void *) mapaddr;
}
+check_no_hidden(__fxstat64);
int weak_function
__fxstat64 (int vers, int fd, struct stat64 *buf)
{
@@ -529,6 +541,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
}
libc_hidden_def (__fxstat64)
+check_no_hidden(__xstat64);
int weak_function
__xstat64 (int vers, const char *file, struct stat64 *buf)
{
@@ -551,12 +564,14 @@ libc_hidden_def (__xstat64)
whether debugging malloc is allowed even for SUID binaries. This
stub will always fail, which means that malloc-debugging is always
disabled for SUID binaries. */
+check_no_hidden(__access);
int weak_function
__access (const char *file, int type)
{
errno = ENOSYS;
return -1;
}
+check_no_hidden(__access_noerrno);
int weak_function
__access_noerrno (const char *file, int type)
{
@@ -564,6 +579,7 @@ __access_noerrno (const char *file, int type)
return -1;
}
+check_no_hidden(__getpid);
pid_t weak_function
__getpid (void)
{
@@ -587,8 +603,8 @@ strong_alias (__getpid, __GI___getpid)
the functionality here. (We could, it just requires duplicating or
reusing getcwd.c's code but using our special lookup function as in
`open', above.) */
-char *
-weak_function
+check_no_hidden(__getcwd);
+char *weak_function
__getcwd (char *buf, size_t size)
{
errno = ENOSYS;
@@ -597,8 +613,8 @@ __getcwd (char *buf, size_t size)
/* This is used by dl-tunables.c to strdup strings. We can just make this a
mere allocation. */
-void *
-weak_function
+check_no_hidden(__sbrk);
+void *weak_function
__sbrk (intptr_t increment)
{
vm_address_t addr;
@@ -606,8 +622,8 @@ __sbrk (intptr_t increment)
return (void *) addr;
}
-unsigned long int
-weak_function
+check_no_hidden(__strtoul_internal);
+unsigned long int weak_function
__strtoul_internal (const char *nptr, char **endptr, int base, int group)
{
assert (base == 0 || base == 10);
@@ -620,6 +636,7 @@ __strtoul_internal (const char *nptr, char **endptr, int base, int group)
strong_alias (__strtoul_internal, __GI___strtoul_internal)
strong_alias (__strtoul_internal, __GI_____strtoul_internal)
+check_no_hidden(_exit);
void weak_function attribute_hidden
_exit (int status)
{
@@ -640,6 +657,7 @@ strong_alias (_exit, __GI__exit)
# define ABORT_INSTRUCTION
#endif
+check_no_hidden(abort);
void weak_function
abort (void)
{