diff options
Diffstat (limited to 'sysdeps/mach/hurd/dl-sysdep.c')
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 32 |
1 files changed, 25 insertions, 7 deletions
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) { |