summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-09-11 15:58:46 -0400
committerRich Felker <dalias@aerifal.cx>2018-09-12 14:34:37 -0400
commit0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e (patch)
tree50f0e611bc15084bedb7003913bb6fdf21c2c631
parentced75472d7e3d73d5b057e36ccbc7b7fcba95104 (diff)
downloadmusl-0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e.tar.gz
musl-0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e.tar.bz2
musl-0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e.tar.xz
musl-0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e.zip
use wrapper headers to hide most namespaced/internally-public symbols
not all prefixed symbols can be made hidden. some are part of ABI-compat (e.g. __nl_langinfo_l) and others are ABI as a consequence of the way copy relocations for weak aliases work in ELF shared libraries. most, however, can be made hidden. with this commit, there should be no remaining unintentionally visible symbols exported from libc.so.
-rw-r--r--src/include/arpa/inet.h2
-rw-r--r--src/include/crypt.h14
-rw-r--r--src/include/pthread.h30
-rw-r--r--src/include/resolv.h8
-rw-r--r--src/include/signal.h10
-rw-r--r--src/include/stdlib.h10
-rw-r--r--src/include/string.h8
-rw-r--r--src/include/sys/mman.h20
-rw-r--r--src/include/sys/sysinfo.h3
-rw-r--r--src/include/sys/time.h2
-rw-r--r--src/include/time.h10
-rw-r--r--src/include/unistd.h7
12 files changed, 64 insertions, 60 deletions
diff --git a/src/include/arpa/inet.h b/src/include/arpa/inet.h
index 2da6ddbc..1e6debf4 100644
--- a/src/include/arpa/inet.h
+++ b/src/include/arpa/inet.h
@@ -3,6 +3,6 @@
#include "../../../include/arpa/inet.h"
-int __inet_aton(const char *, struct in_addr *);
+hidden int __inet_aton(const char *, struct in_addr *);
#endif
diff --git a/src/include/crypt.h b/src/include/crypt.h
index 6e5c2d30..f6c63095 100644
--- a/src/include/crypt.h
+++ b/src/include/crypt.h
@@ -3,12 +3,14 @@
#include "../../include/crypt.h"
-char *__crypt_r(const char *, const char *, struct crypt_data *);
+#include <features.h>
-char *__crypt_des(const char *, const char *, char *);
-char *__crypt_md5(const char *, const char *, char *);
-char *__crypt_blowfish(const char *, const char *, char *);
-char *__crypt_sha256(const char *, const char *, char *);
-char *__crypt_sha512(const char *, const char *, char *);
+hidden char *__crypt_r(const char *, const char *, struct crypt_data *);
+
+hidden char *__crypt_des(const char *, const char *, char *);
+hidden char *__crypt_md5(const char *, const char *, char *);
+hidden char *__crypt_blowfish(const char *, const char *, char *);
+hidden char *__crypt_sha256(const char *, const char *, char *);
+hidden char *__crypt_sha512(const char *, const char *, char *);
#endif
diff --git a/src/include/pthread.h b/src/include/pthread.h
index 2beaa444..d93ac3a5 100644
--- a/src/include/pthread.h
+++ b/src/include/pthread.h
@@ -3,20 +3,20 @@
#include "../../include/pthread.h"
-int __pthread_once(pthread_once_t *, void (*)(void));
-void __pthread_testcancel(void);
-int __pthread_setcancelstate(int, int *);
-int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
-_Noreturn void __pthread_exit(void *);
-int __pthread_join(pthread_t, void **);
-int __pthread_mutex_lock(pthread_mutex_t *);
-int __pthread_mutex_trylock(pthread_mutex_t *);
-int __pthread_mutex_trylock_owner(pthread_mutex_t *);
-int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
-int __pthread_mutex_unlock(pthread_mutex_t *);
-int __private_cond_signal(pthread_cond_t *, int);
-int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
-int __pthread_key_create(pthread_key_t *, void (*)(void *));
-int __pthread_key_delete(pthread_key_t);
+hidden int __pthread_once(pthread_once_t *, void (*)(void));
+hidden void __pthread_testcancel(void);
+hidden int __pthread_setcancelstate(int, int *);
+hidden int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
+hidden _Noreturn void __pthread_exit(void *);
+hidden int __pthread_join(pthread_t, void **);
+hidden int __pthread_mutex_lock(pthread_mutex_t *);
+hidden int __pthread_mutex_trylock(pthread_mutex_t *);
+hidden int __pthread_mutex_trylock_owner(pthread_mutex_t *);
+hidden int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
+hidden int __pthread_mutex_unlock(pthread_mutex_t *);
+hidden int __private_cond_signal(pthread_cond_t *, int);
+hidden int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
+hidden int __pthread_key_create(pthread_key_t *, void (*)(void *));
+hidden int __pthread_key_delete(pthread_key_t);
#endif
diff --git a/src/include/resolv.h b/src/include/resolv.h
index a66669b2..945e89e6 100644
--- a/src/include/resolv.h
+++ b/src/include/resolv.h
@@ -3,10 +3,10 @@
#include "../../include/resolv.h"
-int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+hidden int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
-int __res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
-int __res_send(const unsigned char *, int, unsigned char *, int);
-int __res_msend(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int);
+hidden int __res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+hidden int __res_send(const unsigned char *, int, unsigned char *, int);
+hidden int __res_msend(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int);
#endif
diff --git a/src/include/signal.h b/src/include/signal.h
index 116c0ddd..bb566784 100644
--- a/src/include/signal.h
+++ b/src/include/signal.h
@@ -3,12 +3,12 @@
#include "../../include/signal.h"
-int __sigaction(int, const struct sigaction *, struct sigaction *);
+hidden int __sigaction(int, const struct sigaction *, struct sigaction *);
-void __block_all_sigs(void *);
-void __block_app_sigs(void *);
-void __restore_sigs(void *);
+hidden void __block_all_sigs(void *);
+hidden void __block_app_sigs(void *);
+hidden void __restore_sigs(void *);
-void __get_handler_set(sigset_t *);
+hidden void __get_handler_set(sigset_t *);
#endif
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 8b8fe9c8..d38a5417 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -3,10 +3,10 @@
#include "../../include/stdlib.h"
-int __putenv(char *, size_t, char *);
-void __env_rm_add(char *, char *);
-int __mkostemps(char *, int, int);
-int __ptsname_r(int, char *, size_t);
-char *__randname(char *);
+hidden int __putenv(char *, size_t, char *);
+hidden void __env_rm_add(char *, char *);
+hidden int __mkostemps(char *, int, int);
+hidden int __ptsname_r(int, char *, size_t);
+hidden char *__randname(char *);
#endif
diff --git a/src/include/string.h b/src/include/string.h
index 1d10be70..2133b5c1 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -3,9 +3,9 @@
#include "../../include/string.h"
-void *__memrchr(const void *, int, size_t);
-char *__stpcpy(char *, const char *);
-char *__stpncpy(char *, const char *, size_t);
-char *__strchrnul(const char *, int);
+hidden void *__memrchr(const void *, int, size_t);
+hidden char *__stpcpy(char *, const char *);
+hidden char *__stpncpy(char *, const char *, size_t);
+hidden char *__strchrnul(const char *, int);
#endif
diff --git a/src/include/sys/mman.h b/src/include/sys/mman.h
index 28394dd5..57c5bd3d 100644
--- a/src/include/sys/mman.h
+++ b/src/include/sys/mman.h
@@ -3,18 +3,18 @@
#include "../../../include/sys/mman.h"
-void __vm_wait(void);
-void __vm_lock(void);
-void __vm_unlock(void);
+hidden void __vm_wait(void);
+hidden void __vm_lock(void);
+hidden void __vm_unlock(void);
-void *__mmap(void *, size_t, int, int, int, off_t);
-int __munmap(void *, size_t);
-void *__mremap(void *, size_t, size_t, int, ...);
-int __madvise(void *, size_t, int);
-int __mprotect(void *, size_t, int);
+hidden void *__mmap(void *, size_t, int, int, int, off_t);
+hidden int __munmap(void *, size_t);
+hidden void *__mremap(void *, size_t, size_t, int, ...);
+hidden int __madvise(void *, size_t, int);
+hidden int __mprotect(void *, size_t, int);
-const unsigned char *__map_file(const char *, size_t *);
+hidden const unsigned char *__map_file(const char *, size_t *);
-char *__shm_mapname(const char *, char *);
+hidden char *__shm_mapname(const char *, char *);
#endif
diff --git a/src/include/sys/sysinfo.h b/src/include/sys/sysinfo.h
index c3d60bfd..10be8a48 100644
--- a/src/include/sys/sysinfo.h
+++ b/src/include/sys/sysinfo.h
@@ -2,7 +2,8 @@
#define SYS_SYSINFO_H
#include "../../../include/sys/sysinfo.h"
+#include <features.h>
-int __lsysinfo(struct sysinfo *);
+hidden int __lsysinfo(struct sysinfo *);
#endif
diff --git a/src/include/sys/time.h b/src/include/sys/time.h
index 79c5fcbc..fb9622e5 100644
--- a/src/include/sys/time.h
+++ b/src/include/sys/time.h
@@ -3,6 +3,6 @@
#include "../../../include/sys/time.h"
-int __futimesat(int, const char *, const struct timeval [2]);
+hidden int __futimesat(int, const char *, const struct timeval [2]);
#endif
diff --git a/src/include/time.h b/src/include/time.h
index 991f0b4d..24c87973 100644
--- a/src/include/time.h
+++ b/src/include/time.h
@@ -3,12 +3,12 @@
#include "../../include/time.h"
-int __clock_gettime(clockid_t, struct timespec *);
+hidden int __clock_gettime(clockid_t, struct timespec *);
-char *__asctime_r(const struct tm *, char *);
-struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict);
-struct tm *__localtime_r(const time_t *restrict, struct tm *restrict);
+hidden char *__asctime_r(const struct tm *, char *);
+hidden struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict);
+hidden struct tm *__localtime_r(const time_t *restrict, struct tm *restrict);
-size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
+hidden size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
#endif
diff --git a/src/include/unistd.h b/src/include/unistd.h
index 9cdf1d3e..6deb1bcc 100644
--- a/src/include/unistd.h
+++ b/src/include/unistd.h
@@ -5,8 +5,9 @@
extern char **__environ;
-int __dup3(int, int, int);
-int __mkostemps(char *, int, int);
-int __execvpe(const char *, char *const *, char *const *);
+hidden int __dup3(int, int, int);
+hidden int __mkostemps(char *, int, int);
+hidden int __execvpe(const char *, char *const *, char *const *);
+hidden int __aio_close(int);
#endif