about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-03-18 17:01:06 -0400
committerZack Weinberg <zackw@panix.com>2018-03-26 09:05:19 -0400
commitf66704a937db50bbd78acc5c29f569b4c8e35d19 (patch)
tree92d261f99ff3346bffb3a61f6e788fe0daf6093e
parent9ea49e16c79bd2acd0d0648ca0163f26dd1c3dae (diff)
downloadglibc-zack/wip-check-localplt-2.tar.gz
glibc-zack/wip-check-localplt-2.tar.xz
glibc-zack/wip-check-localplt-2.zip
WIP finer-grained, more aggressive local PLT call check zack/wip-check-localplt-2
-rw-r--r--crypt/crypt-entry.c18
-rw-r--r--crypt/crypt-private.h33
-rw-r--r--crypt/md5-crypt.c6
-rw-r--r--crypt/md5.h26
-rw-r--r--crypt/sha256-crypt.c6
-rw-r--r--crypt/sha256.c3
-rw-r--r--crypt/sha256.h12
-rw-r--r--crypt/sha512-crypt.c6
-rw-r--r--crypt/sha512.c3
-rw-r--r--crypt/sha512.h12
-rw-r--r--dirent/dirfd.c2
-rw-r--r--elf/Makefile19
-rw-r--r--elf/localplt-common.data37
-rw-r--r--include/complex.h24
-rw-r--r--include/dirent.h1
-rw-r--r--include/glob.h13
-rw-r--r--include/libm-symbols.h84
-rw-r--r--include/math.h84
-rw-r--r--include/mqueue.h1
-rw-r--r--include/resolv.h2
-rw-r--r--include/setjmp.h3
-rw-r--r--include/stdio.h5
-rw-r--r--include/stdlib.h3
-rw-r--r--include/string.h3
-rw-r--r--include/wchar.h6
-rw-r--r--include/wctype.h2
-rw-r--r--intl/loadinfo.h12
-rw-r--r--libio/fileops.c2
-rw-r--r--libio/genops.c3
-rw-r--r--libio/iofclose.c1
-rw-r--r--libio/iofdopen.c1
-rw-r--r--libio/iofgetpos.c2
-rw-r--r--libio/iofgetpos64.c2
-rw-r--r--libio/iofopen.c2
-rw-r--r--libio/iofopncook.c4
-rw-r--r--libio/iofsetpos.c2
-rw-r--r--libio/iofsetpos64.c2
-rw-r--r--libio/iolibio.h8
-rw-r--r--libio/iopopen.c1
-rw-r--r--libio/iosetvbuf.c3
-rw-r--r--libio/libio.h15
-rw-r--r--libio/libioP.h70
-rw-r--r--malloc/malloc.c2
-rw-r--r--malloc/mtrace.c5
-rw-r--r--math/math-svid-compat.h7
-rw-r--r--math/s_casin_template.c2
-rw-r--r--math/s_casinh_template.c2
-rw-r--r--math/s_ccosh_template.c2
-rw-r--r--math/s_cexp_template.c1
-rw-r--r--math/s_clog_template.c2
-rw-r--r--math/s_csqrt_template.c1
-rw-r--r--math/s_ldexp_template.c2
-rw-r--r--math/w_atan2_compat.c1
-rw-r--r--math/w_atan2_template.c1
-rw-r--r--math/w_atan2f_compat.c1
-rw-r--r--math/w_atan2l_compat.c1
-rw-r--r--math/w_hypot_compat.c1
-rw-r--r--math/w_hypot_template.c1
-rw-r--r--math/w_hypotf_compat.c1
-rw-r--r--math/w_hypotl_compat.c1
-rw-r--r--math/w_ilogb_template.c1
-rw-r--r--math/w_log_compat.c1
-rw-r--r--math/w_log_template.c1
-rw-r--r--math/w_logl_compat.c1
-rw-r--r--math/w_sqrt_compat.c1
-rw-r--r--math/w_sqrt_template.c1
-rw-r--r--math/w_sqrtf_compat.c1
-rw-r--r--math/w_sqrtl_compat.c1
-rw-r--r--posix/getopt_int.h15
-rw-r--r--posix/glob-lstat-compat.c1
-rw-r--r--posix/glob.c1
-rw-r--r--posix/glob64-lstat-compat.c2
-rw-r--r--posix/glob64.c8
-rw-r--r--posix/glob_pattern_p.c1
-rw-r--r--resolv/compat-gethnamaddr.c4
-rw-r--r--resolv/res_hconf.h6
-rw-r--r--resolv/res_send.c2
-rwxr-xr-xscripts/check-localplt-2.sh171
-rw-r--r--stdio-common/psiginfo.c4
-rw-r--r--stdio-common/vfscanf.c2
-rw-r--r--string/memrchr.c3
-rw-r--r--string/strchrnul.c2
-rw-r--r--string/strncase.c1
-rw-r--r--sunrpc/clnt_tcp.c2
-rw-r--r--sunrpc/clnt_udp.c2
-rw-r--r--sunrpc/clnt_unix.c2
-rw-r--r--sunrpc/create_xid.c2
-rw-r--r--sunrpc/des_crypt.c2
-rw-r--r--sunrpc/des_impl.c2
-rw-r--r--sunrpc/pmap_rmt.c2
-rw-r--r--sysdeps/aarch64/strchrnul.S1
-rw-r--r--sysdeps/generic/math_private.h33
-rw-r--r--sysdeps/generic/math_private_calls.h105
-rw-r--r--sysdeps/gnu/glob-lstat-compat.c4
-rw-r--r--sysdeps/i386/fpu/s_rintl.c5
-rw-r--r--sysdeps/i386/i686/multiarch/memrchr.c9
-rw-r--r--sysdeps/i386/i686/multiarch/strncase.c2
-rw-r--r--sysdeps/i386/i686/multiarch/wcslen.c10
-rw-r--r--sysdeps/i386/strchrnul.S2
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.h41
-rw-r--r--sysdeps/ieee754/dbl-64/s_erf.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_expm1.c1
-rw-r--r--sysdeps/ieee754/dbl-64/s_nextup.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_sincos.c1
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c1
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c1
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_round.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_atanf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_ceilf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_erff.c2
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_floorf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_frexpf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_nearbyintf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_nextupf.c2
-rw-r--r--sysdeps/ieee754/flt-32/s_rintf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_roundevenf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_roundf.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_truncf.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_atanl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_ceill.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_cosl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_erfl.c5
-rw-r--r--sysdeps/ieee754/ldbl-128/s_floorl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_frexpl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nearbyintl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nextupl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_rintl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_roundevenl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_roundl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_sincosl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_sinl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/s_truncl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_cosl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_erfl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/s_frexpl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nextupl.c2
-rw-r--r--sysdeps/ieee754/ldbl-96/s_roundevenl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_roundl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_signbitl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_sincosl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/s_sinl.c1
-rw-r--r--sysdeps/m68k/strchrnul.S2
-rw-r--r--sysdeps/mach/hurd/dirfd.c1
-rw-r--r--sysdeps/posix/dirfd.c2
-rw-r--r--sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c2
-rw-r--r--sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c2
-rw-r--r--sysdeps/powerpc/powerpc32/power7/memrchr.S1
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/memrchr.c2
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/strchrnul.c2
-rw-r--r--sysdeps/powerpc/powerpc64/power7/memrchr.S1
-rw-r--r--sysdeps/powerpc/powerpc64/power8/memrchr.S1
-rw-r--r--sysdeps/powerpc/powerpc64/power8/strchr.S6
-rw-r--r--sysdeps/s390/multiarch/memrchr.c1
-rw-r--r--sysdeps/s390/multiarch/strchrnul.c1
-rw-r--r--sysdeps/s390/multiarch/wcslen.c1
-rw-r--r--sysdeps/s390/multiarch/wcsnlen.c1
-rw-r--r--sysdeps/tile/strchrnul.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/umount.c2
-rw-r--r--sysdeps/unix/sysv/linux/generic/umount.c2
-rw-r--r--sysdeps/unix/sysv/linux/glob-lstat-compat.c21
-rw-r--r--sysdeps/unix/sysv/linux/glob64-lstat-compat.c10
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/umount.c2
-rw-r--r--sysdeps/unix/sysv/linux/umount2.S1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/compat-timer.h10
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/timer_create.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/timer_delete.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/timer_gettime.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/timer_settime.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/umount.c4
-rw-r--r--sysdeps/unix/sysv/mount-internal.h26
-rw-r--r--sysdeps/x86/fpu/include/bits/fenv.h16
-rw-r--r--sysdeps/x86_64/fpu/multiarch/e_log-avx.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/e_log-fma.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/e_log-fma4.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/e_logf-fma.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/e_powf.c6
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_atan-avx.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_atan-fma.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_atan.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_ceil-c.c1
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_ceil.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_ceilf.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_cosf.c5
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_floor-c.c1
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_floor.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_floorf.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c5
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_nearbyint.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_rint-c.c1
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_rint.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_rintf.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sin-avx.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sin-fma.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c2
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sin.c3
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sincosf.c5
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_sinf.c5
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_trunc-c.c1
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_trunc.c8
-rw-r--r--sysdeps/x86_64/fpu/multiarch/s_truncf.c8
-rw-r--r--sysdeps/x86_64/fpu/s_ceill.S1
-rw-r--r--sysdeps/x86_64/fpu/s_floorl.S1
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S1
-rw-r--r--sysdeps/x86_64/fpu/s_scalbnl.S3
-rw-r--r--sysdeps/x86_64/fpu/s_sincosf.S1
-rw-r--r--sysdeps/x86_64/fpu/s_truncl.S1
-rw-r--r--sysdeps/x86_64/memrchr.S1
-rw-r--r--sysdeps/x86_64/multiarch/memrchr.c8
-rw-r--r--sysdeps/x86_64/multiarch/strchrnul.c10
-rw-r--r--sysdeps/x86_64/multiarch/strncase.c12
-rw-r--r--sysdeps/x86_64/multiarch/wcslen.c11
-rw-r--r--sysdeps/x86_64/multiarch/wcsnlen.c10
-rw-r--r--sysdeps/x86_64/strchrnul.S1
-rw-r--r--sysdeps/x86_64/wcslen.S2
-rw-r--r--wcsmbs/wcpncpy.c1
-rw-r--r--wcsmbs/wcscat.c1
-rw-r--r--wcsmbs/wcschrnul.c1
-rw-r--r--wcsmbs/wcslen.c1
-rw-r--r--wcsmbs/wcsncpy.c1
-rw-r--r--wcsmbs/wcsnlen.c1
-rw-r--r--wctype/wctrans.c1
-rw-r--r--wctype/wctype.c1
227 files changed, 1031 insertions, 397 deletions
diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c
index 58691fb384..36ec54ca09 100644
--- a/crypt/crypt-entry.c
+++ b/crypt/crypt-entry.c
@@ -43,14 +43,20 @@ void _ufc_clearmem (char *start, int cnt);
 #define _ufc_clearmem(start, cnt)   memset(start, 0, cnt)
 #endif
 extern char *__md5_crypt_r (const char *key, const char *salt, char *buffer,
-			    int buflen);
-extern char *__md5_crypt (const char *key, const char *salt);
+			    int buflen)
+  attribute_hidden;
+extern char *__md5_crypt (const char *key, const char *salt)
+  attribute_hidden;
 extern char *__sha256_crypt_r (const char *key, const char *salt,
-			       char *buffer, int buflen);
-extern char *__sha256_crypt (const char *key, const char *salt);
+			       char *buffer, int buflen)
+  attribute_hidden;
+extern char *__sha256_crypt (const char *key, const char *salt)
+  attribute_hidden;
 extern char *__sha512_crypt_r (const char *key, const char *salt,
-			       char *buffer, int buflen);
-extern char *__sha512_crypt (const char *key, const char *salt);
+			       char *buffer, int buflen)
+  attribute_hidden;
+extern char *__sha512_crypt (const char *key, const char *salt)
+  attribute_hidden;
 
 /* Define our magic string to mark salt for MD5 encryption
    replacement.  This is meant to be the same as for other MD5 based
diff --git a/crypt/crypt-private.h b/crypt/crypt-private.h
index 6a54002f03..ea44afa9b4 100644
--- a/crypt/crypt-private.h
+++ b/crypt/crypt-private.h
@@ -42,35 +42,46 @@
 
 /* crypt.c */
 extern void _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data,
-			 ufc_long *res);
+			 ufc_long *res)
+  attribute_hidden;
 
 
 /* crypt_util.c */
-extern void __init_des_r (struct crypt_data * __restrict __data);
-extern void __init_des (void);
+extern void __init_des_r (struct crypt_data * __restrict __data)
+  attribute_hidden;
+extern void __init_des (void)
+  attribute_hidden;
 
 extern bool _ufc_setup_salt_r (const char *s,
-			       struct crypt_data * __restrict __data);
+			       struct crypt_data * __restrict __data)
+  attribute_hidden;
 extern void _ufc_mk_keytab_r (const char *key,
-			      struct crypt_data * __restrict __data);
+			      struct crypt_data * __restrict __data)
+  attribute_hidden;
 extern void _ufc_dofinalperm_r (ufc_long *res,
-				struct crypt_data * __restrict __data);
+				struct crypt_data * __restrict __data)
+  attribute_hidden;
 extern void _ufc_output_conversion_r (ufc_long v1, ufc_long v2,
 				      const char *salt,
-				      struct crypt_data * __restrict __data);
+				      struct crypt_data * __restrict __data)
+  attribute_hidden;
 
 extern void __setkey_r (const char *__key,
-			     struct crypt_data * __restrict __data);
+			     struct crypt_data * __restrict __data)
+  attribute_hidden;
 extern void __encrypt_r (char * __restrict __block, int __edflag,
-			      struct crypt_data * __restrict __data);
+			      struct crypt_data * __restrict __data)
+  attribute_hidden;
 
 /* crypt-entry.c */
 extern char *__crypt_r (const char *__key, const char *__salt,
-			     struct crypt_data * __restrict __data);
+			     struct crypt_data * __restrict __data)
+  attribute_hidden;
 extern char *fcrypt (const char *key, const char *salt);
 
 extern void __b64_from_24bit (char **cp, int *buflen,
 			      unsigned int b2, unsigned int b1, unsigned int b0,
-			      int n);
+			      int n)
+  attribute_hidden;
 
 #endif  /* crypt-private.h */
diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c
index 3cf02ff74c..bf532b167e 100644
--- a/crypt/md5-crypt.c
+++ b/crypt/md5-crypt.c
@@ -82,8 +82,10 @@ static const char md5_salt_prefix[] = "$1$";
 
 /* Prototypes for local functions.  */
 extern char *__md5_crypt_r (const char *key, const char *salt,
-			    char *buffer, int buflen);
-extern char *__md5_crypt (const char *key, const char *salt);
+			    char *buffer, int buflen)
+  attribute_hidden;
+extern char *__md5_crypt (const char *key, const char *salt)
+  attribute_hidden;
 
 
 /* This entry point is equivalent to the `crypt' function in Unix
diff --git a/crypt/md5.h b/crypt/md5.h
index 57959bef03..fe395b9fad 100644
--- a/crypt/md5.h
+++ b/crypt/md5.h
@@ -72,6 +72,10 @@ typedef uintptr_t md5_uintptr;
 typedef unsigned long int md5_uintptr;
 #endif
 
+#ifdef _ISOMAC
+#define attribute_hidden /* nothing */
+#endif
+
 /* Structure to save state of computation between the single steps.  */
 struct md5_ctx
 {
@@ -96,21 +100,24 @@ struct md5_ctx
 
 /* Initialize structure containing state of computation.
    (RFC 1321, 3.3: Step 3)  */
-extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
+extern void __md5_init_ctx (struct md5_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void __md5_process_block (const void *buffer, size_t len,
-				 struct md5_ctx *ctx) __THROW;
+				 struct md5_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void __md5_process_bytes (const void *buffer, size_t len,
-				 struct md5_ctx *ctx) __THROW;
+				 struct md5_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
@@ -119,7 +126,8 @@ extern void __md5_process_bytes (const void *buffer, size_t len,
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
-extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
+extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
+  __THROW attribute_hidden;
 
 
 /* Put result from CTX in first 16 bytes following RESBUF.  The result is
@@ -128,19 +136,21 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
-extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
+extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
+  __THROW attribute_hidden;
 
 
 /* Compute MD5 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
-extern int __md5_stream (FILE *stream, void *resblock) __THROW;
+extern int __md5_stream (FILE *stream, void *resblock)
+  __THROW attribute_hidden;
 
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
    result is always in little endian byte order, so that a byte-wise
    output yields to the wanted ASCII representation of the message
    digest.  */
-extern void *__md5_buffer (const char *buffer, size_t len,
-			   void *resblock) __THROW;
+extern void *__md5_buffer (const char *buffer, size_t len, void *resblock)
+  __THROW attribute_hidden;
 
 #endif /* md5.h */
diff --git a/crypt/sha256-crypt.c b/crypt/sha256-crypt.c
index d1fed1d6a6..65ee6a87e0 100644
--- a/crypt/sha256-crypt.c
+++ b/crypt/sha256-crypt.c
@@ -94,8 +94,10 @@ static const char sha256_rounds_prefix[] = "rounds=";
 
 /* Prototypes for local functions.  */
 extern char *__sha256_crypt_r (const char *key, const char *salt,
-			       char *buffer, int buflen);
-extern char *__sha256_crypt (const char *key, const char *salt);
+			       char *buffer, int buflen)
+  attribute_hidden;
+extern char *__sha256_crypt (const char *key, const char *salt)
+  attribute_hidden;
 
 
 char *
diff --git a/crypt/sha256.c b/crypt/sha256.c
index 15b04086cb..3efac712d1 100644
--- a/crypt/sha256.c
+++ b/crypt/sha256.c
@@ -81,7 +81,8 @@ static const uint32_t K[64] =
     0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
   };
 
-void __sha256_process_block (const void *, size_t, struct sha256_ctx *);
+extern void __sha256_process_block (const void *, size_t, struct sha256_ctx *)
+  attribute_hidden;
 
 /* Initialize structure containing state of computation.
    (FIPS 180-2:5.3.2)  */
diff --git a/crypt/sha256.h b/crypt/sha256.h
index bf81870b6d..b92ddb068f 100644
--- a/crypt/sha256.h
+++ b/crypt/sha256.h
@@ -47,16 +47,22 @@ struct sha256_ctx
   };
 };
 
+#ifdef _ISOMAC
+#define attribute_hidden /* nothing */
+#endif
+
 /* Initialize structure containing state of computation.
    (FIPS 180-2: 5.3.2)  */
-extern void __sha256_init_ctx (struct sha256_ctx *ctx) __THROW;
+extern void __sha256_init_ctx (struct sha256_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void __sha256_process_bytes (const void *buffer, size_t len,
-				    struct sha256_ctx *ctx) __THROW;
+				    struct sha256_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 32 bytes following RESBUF.
@@ -64,6 +70,6 @@ extern void __sha256_process_bytes (const void *buffer, size_t len,
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 extern void *__sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
-  __THROW;
+  __THROW attribute_hidden;
 
 #endif /* sha256.h */
diff --git a/crypt/sha512-crypt.c b/crypt/sha512-crypt.c
index bd099cd0e0..f86e15b241 100644
--- a/crypt/sha512-crypt.c
+++ b/crypt/sha512-crypt.c
@@ -94,8 +94,10 @@ static const char sha512_rounds_prefix[] = "rounds=";
 
 /* Prototypes for local functions.  */
 extern char *__sha512_crypt_r (const char *key, const char *salt,
-			       char *buffer, int buflen);
-extern char *__sha512_crypt (const char *key, const char *salt);
+			       char *buffer, int buflen)
+  attribute_hidden;
+extern char *__sha512_crypt (const char *key, const char *salt)
+  attribute_hidden;
 
 
 char *
diff --git a/crypt/sha512.c b/crypt/sha512.c
index ab2c7f1fbb..a35ff1a0a0 100644
--- a/crypt/sha512.c
+++ b/crypt/sha512.c
@@ -102,7 +102,8 @@ static const uint64_t K[80] =
   };
 
 void __sha512_process_block (const void *buffer, size_t len,
-			     struct sha512_ctx *ctx);
+			     struct sha512_ctx *ctx)
+  attribute_hidden;
 
 /* Initialize structure containing state of computation.
    (FIPS 180-2:5.3.3)  */
diff --git a/crypt/sha512.h b/crypt/sha512.h
index 7b27aad2d2..4f8f9e9ea0 100644
--- a/crypt/sha512.h
+++ b/crypt/sha512.h
@@ -50,16 +50,22 @@ struct sha512_ctx
   };
 };
 
+#ifdef _ISOMAC
+#define attribute_hidden /* nothing */
+#endif
+
 /* Initialize structure containing state of computation.
    (FIPS 180-2: 5.3.3)  */
-extern void __sha512_init_ctx (struct sha512_ctx *ctx) __THROW;
+extern void __sha512_init_ctx (struct sha512_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 128.  */
 extern void __sha512_process_bytes (const void *buffer, size_t len,
-				    struct sha512_ctx *ctx) __THROW;
+				    struct sha512_ctx *ctx)
+  __THROW attribute_hidden;
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 64 bytes following RESBUF.
@@ -67,6 +73,6 @@ extern void __sha512_process_bytes (const void *buffer, size_t len,
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 64 bits value.  */
 extern void *__sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
-  __THROW;
+  __THROW attribute_hidden;
 
 #endif /* sha512.h */
diff --git a/dirent/dirfd.c b/dirent/dirfd.c
index b45bf83f5a..20fcc4ddd5 100644
--- a/dirent/dirfd.c
+++ b/dirent/dirfd.c
@@ -26,6 +26,6 @@ __dirfd (DIR *dirp)
   __set_errno (ENOSYS);
   return -1;
 }
-
+libc_hidden_def (__dirfd)
 weak_alias (__dirfd, dirfd)
 stub_warning (dirfd)
diff --git a/elf/Makefile b/elf/Makefile
index 59bcca5046..92c49dce2d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -346,7 +346,7 @@ ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
 endif
 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
-		 $(objpfx)check-localplt.out
+		 $(objpfx)check-localplt.out $(objpfx)check-localplt-2.out
 endif
 
 ifeq ($(run-built-tests),yes)
@@ -1132,6 +1132,23 @@ $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
 	  LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
 	  > $@; \
 	$(evaluate-test)
+
+$(objpfx)check-localplt-2.out: $(..)scripts/check-localplt-2.sh \
+			       localplt-common.data localplt.data \
+			       $(localplt-built-dso:.so=_pic.a)
+	AWK="$(AWK)" $(SHELL) $(..)scripts/check-localplt-2.sh \
+	  $(filter %.data, $^) -- $(filter %.a, $^) > $@; \
+	$(evaluate-test)
+
+# check-localplt-2 needs _pic.a libraries for every entry in
+# $(localplt-built-dso).
+$(objpfx)ld_pic.a: $(objpfx)rtld-libc.a $(all-rtld-routines:%=$(objpfx)%.os)
+	-rm -f $@.new
+	cp $< $@.new
+	$(AR) cq$(verbose) $@.new $(filter-out %rtld-libc.a, $^)
+	mv -f $@.new $@
+
+generated += $(objpfx)ld_pic.a
 endif
 
 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
diff --git a/elf/localplt-common.data b/elf/localplt-common.data
new file mode 100644
index 0000000000..1885059f2b
--- /dev/null
+++ b/elf/localplt-common.data
@@ -0,0 +1,37 @@
+# This file is used by check-localplt-2.sh.
+# Blank lines and lines beginning with '#' are ignored.
+# All other lines should be in the form
+# LIBRARY: SYMBOL
+# Calls from LIBRARY to SYMBOL via the PLT, or equivalent,
+# are allowed.  LIBRARY may be '*' to indicate that calls
+# to SYMBOL are allowed from any library.
+
+# To allow for interposition, all calls to malloc and related
+# functions should go through the PLT.
+*: malloc
+*: calloc
+*: realloc
+*: free
+
+# Similarly for matherr.
+libm.so: matherr
+
+# __pthread_unwind has stub definitions in ld.so and libc.so, but both
+# libraries should call the definition in libpthread.so if it's loaded.
+libc.so: __pthread_unwind
+ld.so: __pthread_unwind
+
+# FIXME: These symbols _should_ be getting called directly, but
+# aren't, due to nasty interactions between GCC's builtin function
+# optimizations and our symbol hacks.
+*: __GI_memcmp
+*: __GI_memcpy
+*: __GI_mempcpy
+*: __GI_memset
+*: __GI_stpcpy
+*: __GI_strchr
+*: __GI_strcpy
+*: __GI_strlen
+*: __GI_fwrite
+*: __GI_fwrite_unlocked
+*: _Unwind_Resume
diff --git a/include/complex.h b/include/complex.h
index 2c86709ced..cdcca89db0 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -2,15 +2,29 @@
 # include <math/complex.h>
 
 # ifndef _ISOMAC
+#  include <libm-symbols.h>
+
+libm_hidden_mathcall (casin)
+libm_hidden_mathcall (casinh)
+libm_hidden_mathcall (ccosh)
+libm_hidden_mathcall (cexp)
+libm_hidden_mathcall (clog)
+libm_hidden_mathcall (csqrt)
+
 /* Return the complex inverse hyperbolic sine of finite nonzero Z,
    with the imaginary part of the result subtracted from pi/2 if ADJ
    is nonzero.  */
-extern complex float __kernel_casinhf (complex float z, int adj);
-extern complex double __kernel_casinh (complex double z, int adj);
-extern complex long double __kernel_casinhl (complex long double z, int adj);
+extern complex float __kernel_casinhf (complex float z, int adj)
+  attribute_hidden;
+extern complex double __kernel_casinh (complex double z, int adj)
+  attribute_hidden;
+extern complex long double __kernel_casinhl (complex long double z, int adj)
+  attribute_hidden;
 #  if __HAVE_DISTINCT_FLOAT128
-extern __CFLOAT128 __kernel_casinhf128 (__CFLOAT128 z, int adj);
+extern __CFLOAT128 __kernel_casinhf128 (__CFLOAT128 z, int adj)
+  attribute_hidden;
 #  endif
-# endif
 
+
+# endif
 #endif
diff --git a/include/dirent.h b/include/dirent.h
index cc8f1895df..faccbfbb7a 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -49,6 +49,7 @@ extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
 extern __typeof (rewinddir) __rewinddir;
 extern __typeof (seekdir) __seekdir;
 extern __typeof (dirfd) __dirfd;
+libc_hidden_proto (__dirfd)
 
 extern void __scandir_cancel_handler (void *arg) attribute_hidden;
 extern int __scandir_tail (DIR *dp,
diff --git a/include/glob.h b/include/glob.h
index 1d2f78793e..1866bc8fcf 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -8,11 +8,16 @@ libc_hidden_proto (globfree)
 libc_hidden_proto (globfree64)
 
 /* Now define the internal interfaces.  */
-extern int __glob_pattern_p (const char *__pattern, int __quote);
-extern int __glob64 (const char *__pattern, int __flags,
-		     int (*__errfunc) (const char *, int),
-		     glob64_t *__pglob);
+extern typeof (glob_pattern_p) __glob_pattern_p;
+libc_hidden_proto (__glob_pattern_p)
+extern typeof (glob) __glob;
+libc_hidden_proto (__glob)
+extern typeof (glob) __glob_lstat_compat;
+libc_hidden_proto (__glob_lstat_compat)
+extern typeof (glob64) __glob64;
 libc_hidden_proto (__glob64)
+extern typeof (glob64) __glob64_lstat_compat;
+libc_hidden_proto (__glob64_lstat_compat)
 #endif
 
 #endif
diff --git a/include/libm-symbols.h b/include/libm-symbols.h
new file mode 100644
index 0000000000..8fb6e6b083
--- /dev/null
+++ b/include/libm-symbols.h
@@ -0,0 +1,84 @@
+/* Additional support macros for symbol management, used for libm.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBM_SYMBOLS_H
+#define _LIBM_SYMBOLS_H 1
+
+#if IS_IN (libc) || IS_IN (libm)
+
+# if defined __NO_LONG_DOUBLE_MATH && !__HAVE_DISTINCT_FLOAT128
+
+#  define libm_hidden_mathcall(sym)		\
+  libm_hidden_proto (__##sym)			\
+  libm_hidden_proto (__##sym##f)
+
+#  define libc_libm_hidden_mathcall(sym)	\
+  hidden_proto (__##sym)			\
+  hidden_proto (__##sym##f)
+
+# elif !defined __NO_LONG_DOUBLE_MATH && !__HAVE_DISTINCT_FLOAT128
+
+#  define libm_hidden_mathcall(sym)		\
+  libm_hidden_proto (__##sym)			\
+  libm_hidden_proto (__##sym##f)		\
+  libm_hidden_proto (__##sym##l)
+
+#  define libc_libm_hidden_mathcall(sym)	\
+  hidden_proto (__##sym)			\
+  hidden_proto (__##sym##f)			\
+  hidden_proto (__##sym##l)
+
+# elif defined __NO_LONG_DOUBLE_MATH && __HAVE_DISTINCT_FLOAT128
+
+#  define libm_hidden_mathcall(sym)		\
+  libm_hidden_proto (__##sym)			\
+  libm_hidden_proto (__##sym##f)		\
+  libm_hidden_proto (__##sym##f128)
+
+#  define libm_hidden_mathcall(sym)		\
+  hidden_proto (__##sym)			\
+  hidden_proto (__##sym##f)			\
+  hidden_proto (__##sym##f128)
+
+# else /* !defined __NO_LONG_DOUBLE_MATH && __HAVE_DISTINCT_FLOAT128 */
+
+#  define libm_hidden_mathcall(sym)		\
+  libm_hidden_proto (__##sym)			\
+  libm_hidden_proto (__##sym##f)		\
+  libm_hidden_proto (__##sym##l)		\
+  libm_hidden_proto (__##sym##f128)
+
+#  define libc_libm_hidden_mathcall(sym)	\
+  hidden_proto (__##sym)			\
+  hidden_proto (__##sym##f)			\
+  hidden_proto (__##sym##l)			\
+  hidden_proto (__##sym##f128)
+
+# endif
+#else
+# define libm_hidden_mathcall(sym)
+# define libc_libm_hidden_mathcall(sym)
+#endif
+
+#if IS_IN (libm)
+# define libm_attr_hidden attribute_hidden
+#else
+# define libm_attr_hidden /* nothing */
+#endif
+
+#endif /* libm-symbols.h */
diff --git a/include/math.h b/include/math.h
index e21d34b868..3e4e020915 100644
--- a/include/math.h
+++ b/include/math.h
@@ -7,64 +7,56 @@
 #include <math/math.h>
 
 #ifndef _ISOMAC
+# include <libm-symbols.h>
+
 /* Now define the internal interfaces.  */
 extern int __signgam;
 
-# if IS_IN (libc) || IS_IN (libm)
-hidden_proto (__finite)
-hidden_proto (__isinf)
-hidden_proto (__isnan)
-hidden_proto (__finitef)
-hidden_proto (__isinff)
-hidden_proto (__isnanf)
-
-#  ifndef __NO_LONG_DOUBLE_MATH
-hidden_proto (__finitel)
-hidden_proto (__isinfl)
-hidden_proto (__isnanl)
-#  endif
-
-#  if __HAVE_DISTINCT_FLOAT128
-hidden_proto (__finitef128)
-hidden_proto (__isinff128)
-hidden_proto (__isnanf128)
-hidden_proto (__signbitf128)
-#  endif
-# endif
-
-libm_hidden_proto (__fpclassify)
-libm_hidden_proto (__fpclassifyf)
-libm_hidden_proto (__issignaling)
-libm_hidden_proto (__issignalingf)
-libm_hidden_proto (__exp)
-libm_hidden_proto (__expf)
-libm_hidden_proto (__roundeven)
+libc_libm_hidden_mathcall (finite)
+libc_libm_hidden_mathcall (isinf)
+libc_libm_hidden_mathcall (isnan)
+libc_libm_hidden_mathcall (scalbn)
+libc_libm_hidden_mathcall (signbit)
 
-# ifndef __NO_LONG_DOUBLE_MATH
-libm_hidden_proto (__fpclassifyl)
-libm_hidden_proto (__issignalingl)
-libm_hidden_proto (__expl)
-libm_hidden_proto (__expm1l)
-# endif
-
-# if __HAVE_DISTINCT_FLOAT128
-libm_hidden_proto (__fpclassifyf128)
-libm_hidden_proto (__issignalingf128)
-libm_hidden_proto (__expf128)
-libm_hidden_proto (__expm1f128)
-# endif
+libm_hidden_mathcall (atan)
+libm_hidden_mathcall (atan2)
+libm_hidden_mathcall (ceil)
+libm_hidden_mathcall (cos)
+libm_hidden_mathcall (erf)
+libm_hidden_mathcall (erfc)
+libm_hidden_mathcall (exp)
+libm_hidden_mathcall (expm1)
+libm_hidden_mathcall (floor)
+libm_hidden_mathcall (fpclassify)
+libm_hidden_mathcall (frexp)
+libm_hidden_mathcall (hypot)
+libm_hidden_mathcall (ilogb)
+libm_hidden_mathcall (issignaling)
+libm_hidden_mathcall (ldexp)
+libm_hidden_mathcall (log)
+libm_hidden_mathcall (log1p)
+libm_hidden_mathcall (nearbyint)
+libm_hidden_mathcall (nextup)
+libm_hidden_mathcall (rint)
+libm_hidden_mathcall (round)
+libm_hidden_mathcall (roundeven)
+libm_hidden_mathcall (scalbln)
+libm_hidden_mathcall (sin)
+libm_hidden_mathcall (sincos)
+libm_hidden_mathcall (sqrt)
+libm_hidden_mathcall (trunc)
 
 # if !(defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
 #  ifndef NO_MATH_REDIRECT
 /* Declare sqrt for use within GLIBC.  Compilers typically inline sqrt as a
    single instruction.  Use an asm to avoid use of PLTs if it doesn't.  */
-float (sqrtf) (float) asm ("__ieee754_sqrtf");
-double (sqrt) (double) asm ("__ieee754_sqrt");
+float (sqrtf) (float) asm ("__ieee754_sqrtf") libm_attr_hidden;
+double (sqrt) (double) asm ("__ieee754_sqrt") libm_attr_hidden;
 #   ifndef __NO_LONG_DOUBLE_MATH
-long double (sqrtl) (long double) asm ("__ieee754_sqrtl");
+long double (sqrtl) (long double) asm ("__ieee754_sqrtl") libm_attr_hidden;
 #   endif
 #   if __HAVE_DISTINCT_FLOAT128 > 0
-_Float128 (sqrtf128) (_Float128) asm ("__ieee754_sqrtf128");
+_Float128 (sqrtf128) (_Float128) asm ("__ieee754_sqrtf128") libm_attr_hidden;
 #   endif
 #  endif
 # endif
diff --git a/include/mqueue.h b/include/mqueue.h
index 3c66f1711e..58af372971 100644
--- a/include/mqueue.h
+++ b/include/mqueue.h
@@ -2,6 +2,7 @@
 
 #ifndef _ISOMAC
 # if IS_IN (librt)
+extern __typeof (mq_open) __mq_open __THROW __nonnull ((1)) attribute_hidden;
 hidden_proto (mq_timedsend)
 extern __typeof (mq_timedsend) __mq_timedsend __nonnull ((2, 5));
 hidden_proto (__mq_timedsend)
diff --git a/include/resolv.h b/include/resolv.h
index daf4a74777..524ee902ac 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -31,8 +31,6 @@ extern struct hostent *_gethtbyname2 (const char *__name, int __af);
 struct hostent *_gethtbyaddr (const char *addr, size_t __len, int __af);
 extern uint32_t _getlong (const unsigned char *__src);
 extern uint16_t _getshort (const unsigned char *__src);
-extern int res_ourserver_p (const res_state __statp,
-			    const struct sockaddr_in6 *__inp);
 extern void __res_iclose (res_state statp, bool free_addr);
 libc_hidden_proto (__res_ninit)
 libc_hidden_proto (__res_nclose)
diff --git a/include/setjmp.h b/include/setjmp.h
index 263bc64b3d..49f7fe8dfb 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -17,7 +17,8 @@ extern void ____longjmp_chk (__jmp_buf __env, int __val)
    Always returns zero, for convenience.  */
 extern int __sigjmp_save (jmp_buf __env, int __savemask);
 
-extern void _longjmp_unwind (jmp_buf env, int val);
+extern void _longjmp_unwind (jmp_buf env, int val)
+  attribute_hidden;
 
 extern void __libc_siglongjmp (sigjmp_buf env, int val)
 	  __attribute__ ((noreturn));
diff --git a/include/stdio.h b/include/stdio.h
index f140813ad6..01c324703d 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -133,10 +133,13 @@ extern int _sys_nerr_internal attribute_hidden;
 libc_hidden_proto (__asprintf)
 #  if IS_IN (libc)
 extern FILE *_IO_new_fopen (const char*, const char*);
+libc_hidden_proto (_IO_new_fopen)
 #   define fopen(fname, mode) _IO_new_fopen (fname, mode)
 extern FILE *_IO_new_fdopen (int, const char*);
+libc_hidden_proto (_IO_new_fdopen)
 #   define fdopen(fd, mode) _IO_new_fdopen (fd, mode)
 extern int _IO_new_fclose (FILE*);
+libc_hidden_proto (_IO_new_fclose)
 #   define fclose(fp) _IO_new_fclose (fp)
 extern int _IO_fputs (const char*, FILE*);
 libc_hidden_proto (_IO_fputs)
@@ -146,8 +149,10 @@ libc_hidden_proto (_IO_fputs)
 libc_hidden_proto (fputs)
 #   define fputs(str, fp) _IO_fputs (str, fp)
 extern int _IO_new_fsetpos (FILE *, const __fpos_t *);
+libc_hidden_proto (_IO_new_fsetpos)
 #   define fsetpos(fp, posp) _IO_new_fsetpos (fp, posp)
 extern int _IO_new_fgetpos (FILE *, __fpos_t *);
+libc_hidden_proto (_IO_new_fgetpos)
 #   define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
 #  endif
 
diff --git a/include/stdlib.h b/include/stdlib.h
index 114e12d255..13ef64f6ba 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -96,7 +96,8 @@ extern int __add_to_environ (const char *name, const char *value,
 			     const char *combines, int replace)
      attribute_hidden;
 extern void _quicksort (void *const pbase, size_t total_elems,
-			size_t size, __compar_d_fn_t cmp, void *arg);
+			size_t size, __compar_d_fn_t cmp, void *arg)
+     attribute_hidden;
 
 extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
 
diff --git a/include/string.h b/include/string.h
index bb4922cbbe..63639e2e8c 100644
--- a/include/string.h
+++ b/include/string.h
@@ -88,6 +88,7 @@ libc_hidden_proto (__stpncpy)
 libc_hidden_proto (__rawmemchr)
 libc_hidden_proto (__strcasecmp)
 libc_hidden_proto (__strcasecmp_l)
+libc_hidden_proto (__strncasecmp)
 libc_hidden_proto (__strncasecmp_l)
 extern __typeof (strncat) __strncat;
 libc_hidden_proto (__strncat)
@@ -95,6 +96,7 @@ libc_hidden_proto (__strdup)
 libc_hidden_proto (__strndup)
 libc_hidden_proto (__strerror_r)
 libc_hidden_proto (__strverscmp)
+libc_hidden_proto (__strchrnul)
 libc_hidden_proto (basename)
 extern char *__basename (const char *__filename) __THROW __nonnull ((1));
 libc_hidden_proto (__basename)
@@ -109,6 +111,7 @@ libc_hidden_proto (__strnlen)
 libc_hidden_proto (memmem)
 extern __typeof (memmem) __memmem;
 libc_hidden_proto (__memmem)
+libc_hidden_proto (__memrchr)
 libc_hidden_proto (__ffs)
 
 #if IS_IN (libc)
diff --git a/include/wchar.h b/include/wchar.h
index 1db0ac8278..0f5187650f 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -151,9 +151,12 @@ extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
 			  size_t __n)
      __attribute_pure__;
 extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
+libc_hidden_proto (__wcslen)
 extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
      __attribute_pure__;
+libc_hidden_proto (__wcsnlen)
 extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
+libc_hidden_proto (__wcscat)
 extern wint_t __btowc (int __c) attribute_hidden;
 extern int __mbsinit (const __mbstate_t *__ps);
 extern size_t __mbrtowc (wchar_t *__restrict __pwc,
@@ -182,9 +185,11 @@ extern size_t __wcsnrtombs (char *__restrict __dst,
      attribute_hidden;
 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
 			   const wchar_t *__restrict __src, size_t __n);
+libc_hidden_proto (__wcsncpy)
 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
 extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
 			   size_t __n);
+libc_hidden_proto (__wcpncpy)
 extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
 			   size_t __n) attribute_hidden;
 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
@@ -194,6 +199,7 @@ extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
 			    size_t __n) attribute_hidden;
 extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
      __attribute_pure__;
+libc_hidden_proto (__wcschrnul)
 
 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
 			       size_t __ns) __THROW;
diff --git a/include/wctype.h b/include/wctype.h
index 5fd3f863ae..5a05899107 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -16,7 +16,9 @@ libc_hidden_proto (towupper)
 extern int __iswspace (wint_t __wc);
 extern int __iswctype (wint_t __wc, wctype_t __desc);
 extern wctype_t __wctype (const char *__property);
+libc_hidden_proto (__wctype)
 extern wctrans_t __wctrans (const char *__property);
+libc_hidden_proto (__wctrans)
 extern wint_t __towctrans (wint_t __wc, wctrans_t __desc);
 
 extern __typeof (iswalnum) __iswalnum __THROW __attribute_pure__;
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
index b559a32e77..4a09260ff5 100644
--- a/intl/loadinfo.h
+++ b/intl/loadinfo.h
@@ -73,7 +73,8 @@ struct loaded_l10nfile
    names.  The return value is dynamically allocated and has to be
    freed by the caller.  */
 extern const char *_nl_normalize_codeset (const char *codeset,
-					  size_t name_len);
+					  size_t name_len)
+  attribute_hidden;
 
 /* Lookup a locale dependent file.
    *L10NFILE_LIST denotes a pool of lookup results of locale dependent
@@ -95,13 +96,15 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
 		    const char *language, const char *territory,
 		    const char *codeset, const char *normalized_codeset,
 		    const char *modifier,
-		    const char *filename, int do_allocate);
+		    const char *filename, int do_allocate)
+  attribute_hidden;
 
 /* Lookup the real locale name for a locale alias NAME, or NULL if
    NAME is not a locale alias (but possibly a real locale name).
    The return value is statically allocated and must not be freed.  */
 /* Part of the libintl ABI only for the sake of the gettext.m4 macro.  */
-extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
+extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name)
+  attribute_hidden;
 
 /* Split a locale name NAME into its pieces: language, modifier,
    territory, codeset.
@@ -121,6 +124,7 @@ extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
 extern int _nl_explode_name (char *name, const char **language,
 			     const char **modifier, const char **territory,
 			     const char **codeset,
-			     const char **normalized_codeset);
+			     const char **normalized_codeset)
+  attribute_hidden;
 
 #endif	/* loadinfo.h */
diff --git a/libio/fileops.c b/libio/fileops.c
index c9c5cbcc3c..f281104bc0 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -396,6 +396,7 @@ _IO_new_file_setbuf (FILE *fp, char *p, ssize_t len)
 
   return fp;
 }
+libc_hidden_def (_IO_new_file_setbuf)
 libc_hidden_ver (_IO_new_file_setbuf, _IO_file_setbuf)
 
 
@@ -432,6 +433,7 @@ _IO_new_do_write (FILE *fp, const char *data, size_t to_do)
   return (to_do == 0
 	  || (size_t) new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
 }
+libc_hidden_def (_IO_new_do_write)
 libc_hidden_ver (_IO_new_do_write, _IO_do_write)
 
 static size_t
diff --git a/libio/genops.c b/libio/genops.c
index 2fec221b99..6a48ed7f0e 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -108,9 +108,8 @@ libc_hidden_def (_IO_link_in)
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
-ssize_t _IO_least_marker (FILE *fp, char *end_p);
 
-ssize_t
+static ssize_t
 _IO_least_marker (FILE *fp, char *end_p)
 {
   ssize_t least_so_far = end_p - fp->_IO_read_base;
diff --git a/libio/iofclose.c b/libio/iofclose.c
index 7a8b89f9f5..259e318c8c 100644
--- a/libio/iofclose.c
+++ b/libio/iofclose.c
@@ -79,6 +79,7 @@ _IO_new_fclose (FILE *fp)
 
   return status;
 }
+libc_hidden_def (_IO_new_fclose)
 
 versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
 strong_alias (_IO_new_fclose, __new_fclose)
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index 1f20eacb25..75d6c072af 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -160,6 +160,7 @@ _IO_new_fdopen (int fd, const char *mode)
     }
   return &new_f->fp.file;
 }
+libc_hidden_def (_IO_new_fdopen)
 libc_hidden_ver (_IO_new_fdopen, _IO_fdopen)
 
 strong_alias (_IO_new_fdopen, __new_fdopen)
diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c
index 8177326c9c..fc7a3c48a5 100644
--- a/libio/iofgetpos.c
+++ b/libio/iofgetpos.c
@@ -79,7 +79,7 @@ _IO_new_fgetpos (FILE *fp, __fpos_t *posp)
   _IO_release_lock (fp);
   return result;
 }
-
+libc_hidden_def (_IO_new_fgetpos)
 strong_alias (_IO_new_fgetpos, __new_fgetpos)
 versioned_symbol (libc, _IO_new_fgetpos, _IO_fgetpos, GLIBC_2_2);
 versioned_symbol (libc, __new_fgetpos, fgetpos, GLIBC_2_2);
diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c
index 0ec5413197..a552f2d6af 100644
--- a/libio/iofgetpos64.c
+++ b/libio/iofgetpos64.c
@@ -62,7 +62,7 @@ _IO_new_fgetpos64 (FILE *fp, __fpos64_t *posp)
   _IO_release_lock (fp);
   return result;
 }
-
+libc_hidden_def (_IO_new_fgetpos64)
 strong_alias (_IO_new_fgetpos64, __new_fgetpos64)
 versioned_symbol (libc, _IO_new_fgetpos64, _IO_fgetpos64, GLIBC_2_2);
 versioned_symbol (libc, __new_fgetpos64, fgetpos64, GLIBC_2_2);
diff --git a/libio/iofopen.c b/libio/iofopen.c
index ed3e8b853c..d10849b8e1 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -85,7 +85,7 @@ _IO_new_fopen (const char *filename, const char *mode)
 {
   return __fopen_internal (filename, mode, 1);
 }
-
+libc_hidden_def (_IO_new_fopen)
 strong_alias (_IO_new_fopen, __new_fopen)
 versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
 versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 43a87fe4be..7411737585 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -147,7 +147,7 @@ set_callbacks (cookie_io_functions_t *target,
   *target = source;
 }
 
-void
+static void
 _IO_cookie_init (struct _IO_cookie_file *cfile, int read_write,
 		 void *cookie, cookie_io_functions_t io_functions)
 {
@@ -213,7 +213,7 @@ _IO_fopencookie (void *cookie, const char *mode,
 
   return (FILE *) &new_f->cfile.__fp;
 }
-
+libc_hidden_def (_IO_fopencookie)
 versioned_symbol (libc, _IO_fopencookie, fopencookie, GLIBC_2_2);
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c
index da48b27c3b..23b04e4a55 100644
--- a/libio/iofsetpos.c
+++ b/libio/iofsetpos.c
@@ -66,7 +66,7 @@ _IO_new_fsetpos (FILE *fp, const __fpos_t *posp)
   _IO_release_lock (fp);
   return result;
 }
-
+libc_hidden_def (_IO_new_fsetpos)
 strong_alias (_IO_new_fsetpos, __new_fsetpos)
 versioned_symbol (libc, _IO_new_fsetpos, _IO_fsetpos, GLIBC_2_2);
 versioned_symbol (libc, __new_fsetpos, fsetpos, GLIBC_2_2);
diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c
index 29da981488..94b0bd73df 100644
--- a/libio/iofsetpos64.c
+++ b/libio/iofsetpos64.c
@@ -56,7 +56,7 @@ _IO_new_fsetpos64 (FILE *fp, const fpos64_t *posp)
   _IO_release_lock (fp);
   return result;
 }
-
+libc_hidden_def (_IO_new_fsetpos64)
 strong_alias (_IO_new_fsetpos64, __new_fsetpos64)
 versioned_symbol (libc, __new_fsetpos64, fsetpos64, GLIBC_2_2);
 versioned_symbol (libc, _IO_new_fsetpos64, _IO_fsetpos64, GLIBC_2_2);
diff --git a/libio/iolibio.h b/libio/iolibio.h
index 69e1c0e699..6b5b8cf5d0 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -9,11 +9,13 @@
 
 extern int _IO_fclose (FILE*);
 extern int _IO_new_fclose (FILE*);
+libc_hidden_proto (_IO_new_fclose)
 extern int _IO_old_fclose (FILE*);
 extern FILE *_IO_fdopen (int, const char*) __THROW;
 libc_hidden_proto (_IO_fdopen)
 extern FILE *_IO_old_fdopen (int, const char*) __THROW;
 extern FILE *_IO_new_fdopen (int, const char*) __THROW;
+libc_hidden_proto (_IO_new_fdopen)
 extern int _IO_fflush (FILE*);
 libc_hidden_proto (_IO_fflush)
 extern int _IO_fgetpos (FILE*, __fpos_t*);
@@ -22,6 +24,7 @@ extern char* _IO_fgets (char*, int, FILE*);
 extern FILE *_IO_fopen (const char*, const char*);
 extern FILE *_IO_old_fopen (const char*, const char*);
 extern FILE *_IO_new_fopen (const char*, const char*);
+libc_hidden_proto (_IO_new_fopen)
 extern FILE *_IO_fopen64 (const char*, const char*);
 extern FILE *__fopen_internal (const char*, const char*, int)
 	attribute_hidden;
@@ -49,7 +52,8 @@ libc_hidden_proto (_IO_setvbuf)
 extern int _IO_sscanf (const char*, const char*, ...) __THROW;
 extern int _IO_sprintf (char *, const char*, ...) __THROW;
 extern int _IO_ungetc (int, FILE*) __THROW;
-extern int _IO_vsscanf (const char *, const char *, __gnuc_va_list) __THROW;
+extern int _IO_vsscanf (const char *, const char *, __gnuc_va_list)
+  __THROW attribute_hidden;
 extern int _IO_vsprintf (char*, const char*, __gnuc_va_list) __THROW;
 libc_hidden_proto (_IO_vsprintf)
 extern int _IO_vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
@@ -57,7 +61,7 @@ extern int _IO_vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
 
 struct obstack;
 extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list)
-       __THROW;
+       __THROW attribute_hidden;
 extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
 #define _IO_fseek(__fp, __offset, __whence) \
diff --git a/libio/iopopen.c b/libio/iopopen.c
index 2eff45b4c8..82c1036000 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -177,6 +177,7 @@ _IO_new_proc_open (FILE *fp, const char *command, const char *mode)
   _IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
   return fp;
 }
+libc_hidden_def (_IO_new_proc_open)
 
 FILE *
 _IO_new_popen (const char *command, const char *mode)
diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c
index a35d866d82..a92a24b505 100644
--- a/libio/iosetvbuf.c
+++ b/libio/iosetvbuf.c
@@ -49,8 +49,7 @@ _IO_setvbuf (FILE *fp, char *buf, int mode, size_t size)
 		 buffering has not been explicitly set".  In both
 		 cases, _IO_LINE_BUF is off.  If this is a tty, and
 		 _IO_filedoalloc later gets called, it cannot know if
-		 it should set the _IO_LINE_BUF flag (because that is
-		 the default), or not (because we have explicitly asked
+		 it should set the _IO_LINE_BUF flag (because that is		 the default), or not (because we have explicitly asked
 		 for fully buffered mode).  So we make sure a buffer
 		 gets allocated now, and explicitly turn off line
 		 buffering.
diff --git a/libio/libio.h b/libio/libio.h
index 00f9169613..ffd692e403 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -193,10 +193,6 @@ extern FILE *_IO_stderr attribute_hidden;
 
 struct _IO_cookie_file;
 
-/* Initialize one of those.  */
-extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
-			     void *__cookie, cookie_io_functions_t __fns);
-
 extern int __underflow (FILE *);
 extern wint_t __wunderflow (FILE *);
 extern wint_t __wuflow (FILE *);
@@ -269,7 +265,7 @@ extern void _IO_free_backup_area (FILE *) __THROW;
 
 extern wint_t _IO_getwc (FILE *__fp);
 extern wint_t _IO_putwc (wchar_t __wc, FILE *__fp);
-extern int _IO_fwide (FILE *__fp, int __mode) __THROW;
+extern int _IO_fwide (FILE *__fp, int __mode) __THROW attribute_hidden;
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 #  define _IO_fwide_maybe_incompatible \
@@ -298,10 +294,13 @@ weak_extern (_IO_stdin_used);
      __result; })
 
 extern int _IO_vfwscanf (FILE * __restrict, const wchar_t * __restrict,
-			 __gnuc_va_list, int *__restrict);
+			 __gnuc_va_list, int *__restrict)
+  attribute_hidden;
 extern int _IO_vfwprintf (FILE *__restrict, const wchar_t *__restrict,
-			  __gnuc_va_list);
-extern __ssize_t _IO_wpadn (FILE *, wint_t, __ssize_t);
+			  __gnuc_va_list)
+  attribute_hidden;
+extern __ssize_t _IO_wpadn (FILE *, wint_t, __ssize_t)
+  attribute_hidden;
 extern void _IO_free_wbackup_area (FILE *) __THROW;
 
 #ifdef __LDBL_COMPAT
diff --git a/libio/libioP.h b/libio/libioP.h
index 8afe7032e3..9175b3c8b8 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -343,6 +343,7 @@ struct _IO_cookie_file
 
 FILE *_IO_fopencookie (void *cookie, const char *mode,
                        cookie_io_functions_t io_functions);
+libc_hidden_proto (_IO_fopencookie)
 
 
 /* Iterator type for walking global linked list of _IO_FILE objects. */
@@ -351,8 +352,8 @@ typedef FILE *_IO_ITER;
 
 /* Generic functions */
 
-extern void _IO_switch_to_main_get_area (FILE *) __THROW;
-extern void _IO_switch_to_backup_area (FILE *) __THROW;
+extern void _IO_switch_to_main_get_area (FILE *) __THROW attribute_hidden;
+extern void _IO_switch_to_backup_area (FILE *) __THROW attribute_hidden;
 extern int _IO_switch_to_get_mode (FILE *);
 libc_hidden_proto (_IO_switch_to_get_mode)
 extern void _IO_init_internal (FILE *, int) attribute_hidden;
@@ -442,7 +443,7 @@ extern int _IO_default_pbackfail (FILE *, int) __THROW;
 libc_hidden_proto (_IO_default_pbackfail)
 extern wint_t _IO_wdefault_pbackfail (FILE *, wint_t) __THROW;
 libc_hidden_proto (_IO_wdefault_pbackfail)
-extern FILE* _IO_default_setbuf (FILE *, char *, ssize_t);
+extern FILE* _IO_default_setbuf (FILE *, char *, ssize_t) attribute_hidden;
 extern size_t _IO_default_xsputn (FILE *, const void *, size_t);
 libc_hidden_proto (_IO_default_xsputn)
 extern size_t _IO_wdefault_xsputn (FILE *, const void *, size_t);
@@ -480,24 +481,29 @@ extern const struct _IO_codecvt __libio_codecvt attribute_hidden;
 extern int _IO_do_write (FILE *, const char *, size_t);
 libc_hidden_proto (_IO_do_write)
 extern int _IO_new_do_write (FILE *, const char *, size_t);
+libc_hidden_proto (_IO_new_do_write)
 extern int _IO_old_do_write (FILE *, const char *, size_t);
 extern int _IO_wdo_write (FILE *, const wchar_t *, size_t);
 libc_hidden_proto (_IO_wdo_write)
-extern int _IO_flush_all_lockp (int);
+extern int _IO_flush_all_lockp (int) attribute_hidden;
 extern int _IO_flush_all (void);
 libc_hidden_proto (_IO_flush_all)
-extern int _IO_cleanup (void);
+extern int _IO_cleanup (void) attribute_hidden;
 extern void _IO_flush_all_linebuffered (void);
 libc_hidden_proto (_IO_flush_all_linebuffered)
 extern int _IO_new_fgetpos (FILE *, __fpos_t *);
+libc_hidden_proto (_IO_new_fgetpos)
 extern int _IO_old_fgetpos (FILE *, __fpos_t *);
 extern int _IO_new_fsetpos (FILE *, const __fpos_t *);
+libc_hidden_proto (_IO_new_fsetpos)
 extern int _IO_old_fsetpos (FILE *, const __fpos_t *);
 extern int _IO_new_fgetpos64 (FILE *, __fpos64_t *);
+libc_hidden_proto (_IO_new_fgetpos64)
 extern int _IO_old_fgetpos64 (FILE *, __fpos64_t *);
 extern int _IO_new_fsetpos64 (FILE *, const __fpos64_t *);
+libc_hidden_proto (_IO_new_fsetpos64)
 extern int _IO_old_fsetpos64 (FILE *, const __fpos64_t *);
-extern void _IO_old_init (FILE *fp, int flags) __THROW;
+extern void _IO_old_init (FILE *fp, int flags) __THROW attribute_hidden;
 
 
 #define _IO_do_flush(_f) \
@@ -554,8 +560,8 @@ libc_hidden_proto (_IO_file_close)
 extern int _IO_file_close_mmap (FILE *) __THROW;
 extern int _IO_file_underflow (FILE *);
 libc_hidden_proto (_IO_file_underflow)
-extern int _IO_file_underflow_mmap (FILE *);
-extern int _IO_file_underflow_maybe_mmap (FILE *);
+extern int _IO_file_underflow_mmap (FILE *) attribute_hidden;
+extern int _IO_file_underflow_maybe_mmap (FILE *) attribute_hidden;
 extern int _IO_file_overflow (FILE *, int);
 libc_hidden_proto (_IO_file_overflow)
 #define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
@@ -583,10 +589,12 @@ extern void _IO_new_file_finish (FILE *, int);
 extern FILE* _IO_new_file_fopen (FILE *, const char *, const char *,
 				     int);
 extern void _IO_no_init (FILE *, int, int, struct _IO_wide_data *,
-			 const struct _IO_jump_t *) __THROW;
+			 const struct _IO_jump_t *)
+  __THROW attribute_hidden;
 extern void _IO_new_file_init_internal (struct _IO_FILE_plus *)
   __THROW attribute_hidden;
 extern FILE* _IO_new_file_setbuf (FILE *, char *, ssize_t);
+libc_hidden_proto (_IO_new_file_setbuf)
 extern FILE* _IO_file_setbuf_mmap (FILE *, char *, ssize_t);
 extern int _IO_new_file_sync (FILE *);
 extern int _IO_new_file_underflow (FILE *);
@@ -623,10 +631,10 @@ extern off64_t _IO_wfile_seekoff (FILE *, off64_t, int, int);
 libc_hidden_proto (_IO_wfile_seekoff)
 
 /* Jumptable functions for proc_files. */
-extern FILE* _IO_proc_open (FILE *, const char *, const char *)
-     __THROW;
-extern FILE* _IO_new_proc_open (FILE *, const char *, const char *)
-     __THROW;
+extern FILE* _IO_proc_open (FILE *, const char *, const char *) __THROW;
+libc_hidden_proto (_IO_proc_open)
+extern FILE* _IO_new_proc_open (FILE *, const char *, const char *);
+libc_hidden_proto (_IO_new_proc_open)
 extern FILE* _IO_old_proc_open (FILE *, const char *, const char *);
 extern int _IO_proc_close (FILE *) __THROW;
 extern int _IO_new_proc_close (FILE *) __THROW;
@@ -641,28 +649,30 @@ extern int _IO_str_pbackfail (FILE *, int) __THROW;
 libc_hidden_proto (_IO_str_pbackfail)
 extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW;
 libc_hidden_proto (_IO_str_seekoff)
-extern void _IO_str_finish (FILE *, int) __THROW;
+extern void _IO_str_finish (FILE *, int) __THROW attribute_hidden;
 
 /* Other strfile functions */
 struct _IO_strfile_;
-extern ssize_t _IO_str_count (FILE *) __THROW;
+extern ssize_t _IO_str_count (FILE *) __THROW attribute_hidden;
 
 /* And the wide character versions.  */
 extern void _IO_wstr_init_static (FILE *, wchar_t *, size_t, wchar_t *)
-     __THROW;
-extern ssize_t _IO_wstr_count (FILE *) __THROW;
-extern wint_t _IO_wstr_overflow (FILE *, wint_t) __THROW;
+     __THROW attribute_hidden;
+extern ssize_t _IO_wstr_count (FILE *) __THROW attribute_hidden;
+extern wint_t _IO_wstr_overflow (FILE *, wint_t) __THROW attribute_hidden;
 extern wint_t _IO_wstr_underflow (FILE *) __THROW;
 extern off64_t _IO_wstr_seekoff (FILE *, off64_t, int, int)
      __THROW;
 extern wint_t _IO_wstr_pbackfail (FILE *, wint_t) __THROW;
-extern void _IO_wstr_finish (FILE *, int) __THROW;
+extern void _IO_wstr_finish (FILE *, int) __THROW attribute_hidden;
 
-extern int _IO_vasprintf (char **result_ptr, const char *format,
-			  va_list args) __THROW;
-extern int _IO_vdprintf (int d, const char *format, va_list arg);
+extern int _IO_vasprintf (char **result_ptr, const char *format, va_list ap)
+  __THROW attribute_hidden;
+extern int _IO_vdprintf (int d, const char *format, va_list ap)
+  attribute_hidden;
 extern int _IO_vsnprintf (char *string, size_t maxlen,
-			  const char *format, va_list args) __THROW;
+			  const char *format, va_list ap)
+  __THROW attribute_hidden;
 
 
 extern size_t _IO_getline (FILE *,char *, size_t, int, int);
@@ -670,17 +680,21 @@ libc_hidden_proto (_IO_getline)
 extern size_t _IO_getline_info (FILE *,char *, size_t,
 				    int, int, int *);
 libc_hidden_proto (_IO_getline_info)
-extern ssize_t _IO_getdelim (char **, size_t *, int, FILE *);
-extern size_t _IO_getwline (FILE *,wchar_t *, size_t, wint_t, int);
-extern size_t _IO_getwline_info (FILE *,wchar_t *, size_t,
-				     wint_t, int, wint_t *);
+extern ssize_t _IO_getdelim (char **, size_t *, int, FILE *)
+     attribute_hidden;
+extern size_t _IO_getwline (FILE *, wchar_t *, size_t, wint_t, int)
+     attribute_hidden;
+extern size_t _IO_getwline_info (FILE *, wchar_t *, size_t,
+                                 wint_t, int, wint_t *)
+     attribute_hidden;
 
 extern struct _IO_FILE_plus *_IO_list_all;
 libc_hidden_proto (_IO_list_all)
 extern void (*_IO_cleanup_registration_needed) (void);
 
 extern void _IO_str_init_static_internal (struct _IO_strfile_ *, char *,
-					  size_t, char *) __THROW;
+					  size_t, char *)
+     __THROW attribute_hidden;
 extern off64_t _IO_seekoff_unlocked (FILE *, off64_t, int, int)
      attribute_hidden;
 extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 9614954975..b57232148f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5005,7 +5005,7 @@ __malloc_stats (void)
       if (ar_ptr == &main_arena)
         break;
     }
-  fprintf (stderr, "Total (incl. mmap):\n");
+  fputs ("Total (incl. mmap):\n", stderr);
   fprintf (stderr, "system bytes     = %10u\n", system_b);
   fprintf (stderr, "in use bytes     = %10u\n", in_use_b);
   fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 9064f209ec..aa2ec4b7cb 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -38,7 +38,6 @@
 
 #include <libio/iolibio.h>
 #define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
-#define fwrite(buf, size, count, fp) _IO_fwrite (buf, size, count, fp)
 
 #include <kernel-features.h>
 
@@ -304,7 +303,7 @@ mtrace (void)
           /* Be sure it doesn't malloc its buffer!  */
           malloc_trace_buffer = mtb;
           setvbuf (mallstream, malloc_trace_buffer, _IOFBF, TRACE_BUFFER_SIZE);
-          fprintf (mallstream, "= Start\n");
+          fputs ("= Start\n", mallstream);
           tr_old_free_hook = __free_hook;
           __free_hook = tr_freehook;
           tr_old_malloc_hook = __malloc_hook;
@@ -343,6 +342,6 @@ muntrace (void)
   __realloc_hook = tr_old_realloc_hook;
   __memalign_hook = tr_old_memalign_hook;
 
-  fprintf (f, "= End\n");
+  fputs ("= End\n", f);
   fclose (f);
 }
diff --git a/math/math-svid-compat.h b/math/math-svid-compat.h
index 2afadd7b1f..aea90d27a7 100644
--- a/math/math-svid-compat.h
+++ b/math/math-svid-compat.h
@@ -66,9 +66,10 @@ extern int __matherr (struct exception *__exc);
 
 #ifdef _LIBC
 /* fdlibm kernel function */
-extern double __kernel_standard (double, double, int);
-extern float __kernel_standard_f (float, float, int);
-extern long double __kernel_standard_l (long double, long double, int);
+extern double __kernel_standard (double, double, int) attribute_hidden;
+extern float __kernel_standard_f (float, float, int) attribute_hidden;
+extern long double __kernel_standard_l (long double, long double, int)
+  attribute_hidden;
 
 # include <shlib-compat.h>
 # define LIBM_SVID_COMPAT SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_27)
diff --git a/math/s_casin_template.c b/math/s_casin_template.c
index 24eb7abce5..9c6c94ddb3 100644
--- a/math/s_casin_template.c
+++ b/math/s_casin_template.c
@@ -59,5 +59,5 @@ M_DECL_FUNC (__casin) (CFLOAT x)
 
   return res;
 }
-
+libm_hidden_def (M_SUF (__casin))
 declare_mgen_alias (__casin, casin)
diff --git a/math/s_casinh_template.c b/math/s_casinh_template.c
index 8433ce134d..bf42a82069 100644
--- a/math/s_casinh_template.c
+++ b/math/s_casinh_template.c
@@ -67,5 +67,5 @@ M_DECL_FUNC (__casinh) (CFLOAT x)
 
   return res;
 }
-
+libm_hidden_def (M_SUF (__casinh))
 declare_mgen_alias (__casinh, casinh)
diff --git a/math/s_ccosh_template.c b/math/s_ccosh_template.c
index 6840c4819e..f55324593a 100644
--- a/math/s_ccosh_template.c
+++ b/math/s_ccosh_template.c
@@ -133,5 +133,5 @@ M_DECL_FUNC (__ccosh) (CFLOAT x)
 
   return retval;
 }
-
+libm_hidden_def (M_SUF (__ccosh))
 declare_mgen_alias (__ccosh, ccosh);
diff --git a/math/s_cexp_template.c b/math/s_cexp_template.c
index e099e42a4c..586b991a17 100644
--- a/math/s_cexp_template.c
+++ b/math/s_cexp_template.c
@@ -147,4 +147,5 @@ M_DECL_FUNC (__cexp) (CFLOAT x)
 
   return retval;
 }
+libm_hidden_def (M_SUF (__cexp))
 declare_mgen_alias (__cexp, cexp)
diff --git a/math/s_clog_template.c b/math/s_clog_template.c
index 8aa1f74c8b..3e7537fd81 100644
--- a/math/s_clog_template.c
+++ b/math/s_clog_template.c
@@ -111,5 +111,5 @@ M_DECL_FUNC (__clog) (CFLOAT x)
 
   return result;
 }
-
+libm_hidden_def (M_SUF (__clog))
 declare_mgen_alias (__clog, clog)
diff --git a/math/s_csqrt_template.c b/math/s_csqrt_template.c
index dcf14c7537..e3ac17e72b 100644
--- a/math/s_csqrt_template.c
+++ b/math/s_csqrt_template.c
@@ -157,4 +157,5 @@ M_DECL_FUNC (__csqrt) (CFLOAT x)
 
   return res;
 }
+libm_hidden_def (M_SUF (__csqrt))
 declare_mgen_alias (__csqrt, csqrt)
diff --git a/math/s_ldexp_template.c b/math/s_ldexp_template.c
index 3aa56f9f89..7dff66ac1c 100644
--- a/math/s_ldexp_template.c
+++ b/math/s_ldexp_template.c
@@ -26,7 +26,7 @@ M_SUF (__ldexp) (FLOAT value, int exp)
 	if(!isfinite(value)||value==0) __set_errno (ERANGE);
 	return value;
 }
-
+libm_hidden_def (M_SUF (__ldexp))
 declare_mgen_alias (__ldexp, ldexp)
 strong_alias (M_SUF (__ldexp), M_SUF (__wrap_scalbn))
 declare_mgen_alias (__wrap_scalbn, scalbn)
diff --git a/math/w_atan2_compat.c b/math/w_atan2_compat.c
index 056590cf56..f2b5b69fc6 100644
--- a/math/w_atan2_compat.c
+++ b/math/w_atan2_compat.c
@@ -41,5 +41,6 @@ __atan2 (double y, double x)
     __set_errno (ERANGE);
   return z;
 }
+libm_hidden_def (__atan2)
 libm_alias_double (__atan2, atan2)
 #endif
diff --git a/math/w_atan2_template.c b/math/w_atan2_template.c
index bca55e363a..3e55e561f4 100644
--- a/math/w_atan2_template.c
+++ b/math/w_atan2_template.c
@@ -34,6 +34,7 @@ M_DECL_FUNC (__atan2) (FLOAT y, FLOAT x)
     __set_errno (ERANGE);
   return z;
 }
+libm_hidden_def (M_SUF (__atan2))
 declare_mgen_alias (__atan2, atan2)
 
 #endif /* __USE_WRAPPER_TEMPLATE.  */
diff --git a/math/w_atan2f_compat.c b/math/w_atan2f_compat.c
index e8aa377879..aac9d95039 100644
--- a/math/w_atan2f_compat.c
+++ b/math/w_atan2f_compat.c
@@ -41,5 +41,6 @@ __atan2f (float y, float x)
     __set_errno (ERANGE);
   return z;
 }
+libm_hidden_def (__atan2f)
 libm_alias_float (__atan2, atan2)
 #endif
diff --git a/math/w_atan2l_compat.c b/math/w_atan2l_compat.c
index 94a3b48437..f0f93939c9 100644
--- a/math/w_atan2l_compat.c
+++ b/math/w_atan2l_compat.c
@@ -41,5 +41,6 @@ __atan2l (long double y, long double x)
     __set_errno (ERANGE);
   return z;
 }
+libm_hidden_def (__atan2l)
 libm_alias_ldouble (__atan2, atan2)
 #endif
diff --git a/math/w_hypot_compat.c b/math/w_hypot_compat.c
index f07039cc51..80aad58efa 100644
--- a/math/w_hypot_compat.c
+++ b/math/w_hypot_compat.c
@@ -31,5 +31,6 @@ __hypot (double x, double y)
 
 	return z;
 }
+libm_hidden_def (__hypot)
 libm_alias_double (__hypot, hypot)
 #endif
diff --git a/math/w_hypot_template.c b/math/w_hypot_template.c
index 549e49aa0d..3ed0c76002 100644
--- a/math/w_hypot_template.c
+++ b/math/w_hypot_template.c
@@ -35,6 +35,7 @@ M_DECL_FUNC (__hypot) (FLOAT x, FLOAT y)
     __set_errno (ERANGE);
   return z;
 }
+libm_hidden_def (M_SUF (__hypot))
 declare_mgen_alias (__hypot, hypot)
 
 #endif /* __USE_WRAPPER_TEMPLATE.  */
diff --git a/math/w_hypotf_compat.c b/math/w_hypotf_compat.c
index 82870ce551..0e6f5bedad 100644
--- a/math/w_hypotf_compat.c
+++ b/math/w_hypotf_compat.c
@@ -35,5 +35,6 @@ __hypotf(float x, float y)
 
 	return z;
 }
+libm_hidden_def (__hypotf)
 libm_alias_float (__hypot, hypot)
 #endif
diff --git a/math/w_hypotl_compat.c b/math/w_hypotl_compat.c
index db5495103d..89f11448bf 100644
--- a/math/w_hypotl_compat.c
+++ b/math/w_hypotl_compat.c
@@ -36,5 +36,6 @@ __hypotl(long double x, long double y)
 
 	return z;
 }
+libm_hidden_def (__hypotl)
 libm_alias_ldouble (__hypot, hypot)
 #endif
diff --git a/math/w_ilogb_template.c b/math/w_ilogb_template.c
index 3e45f33b9c..7d98b2589d 100644
--- a/math/w_ilogb_template.c
+++ b/math/w_ilogb_template.c
@@ -35,4 +35,5 @@ M_DECL_FUNC (__ilogb) (FLOAT x)
     }
   return r;
 }
+libm_hidden_def (M_SUF (__ilogb))
 declare_mgen_alias (__ilogb, ilogb)
diff --git a/math/w_log_compat.c b/math/w_log_compat.c
index 5413b8e8df..6c4f4d2e40 100644
--- a/math/w_log_compat.c
+++ b/math/w_log_compat.c
@@ -44,5 +44,6 @@ __log (double x)
 
   return  __ieee754_log (x);
 }
+libm_hidden_def (__log)
 libm_alias_double (__log, log)
 #endif
diff --git a/math/w_log_template.c b/math/w_log_template.c
index 0515fee629..26eef7b2c0 100644
--- a/math/w_log_template.c
+++ b/math/w_log_template.c
@@ -40,6 +40,7 @@ M_DECL_FUNC (__log) (FLOAT x)
     }
   return M_SUF (__ieee754_log) (x);
 }
+libm_hidden_def (M_SUF (__log))
 declare_mgen_alias (__log, log)
 
 #endif /* __USE_WRAPPER_TEMPLATE.  */
diff --git a/math/w_logl_compat.c b/math/w_logl_compat.c
index 991251a7c5..ea64aca483 100644
--- a/math/w_logl_compat.c
+++ b/math/w_logl_compat.c
@@ -44,5 +44,6 @@ __logl (long double x)
 
   return  __ieee754_logl (x);
 }
+libm_hidden_def (__logl)
 libm_alias_ldouble (__log, log)
 #endif
diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c
index e76a8079aa..fe3d95b640 100644
--- a/math/w_sqrt_compat.c
+++ b/math/w_sqrt_compat.c
@@ -33,5 +33,6 @@ __sqrt (double x)
 
   return __ieee754_sqrt (x);
 }
+libm_hidden_def (__sqrt)
 libm_alias_double (__sqrt, sqrt)
 #endif
diff --git a/math/w_sqrt_template.c b/math/w_sqrt_template.c
index 9c6ac75956..f660de6e76 100644
--- a/math/w_sqrt_template.c
+++ b/math/w_sqrt_template.c
@@ -35,6 +35,7 @@ M_DECL_FUNC (__sqrt) (FLOAT x)
     __set_errno (EDOM);
   return M_SUF (__ieee754_sqrt) (x);
 }
+libm_hidden_def (M_SUF (__sqrt))
 declare_mgen_alias (__sqrt, sqrt)
 
 #endif /* __USE_WRAPPER_TEMPLATE.  */
diff --git a/math/w_sqrtf_compat.c b/math/w_sqrtf_compat.c
index cad9b4ad77..78b1f60745 100644
--- a/math/w_sqrtf_compat.c
+++ b/math/w_sqrtf_compat.c
@@ -33,5 +33,6 @@ __sqrtf (float x)
 
   return __ieee754_sqrtf (x);
 }
+libm_hidden_def (__sqrtf)
 libm_alias_float (__sqrt, sqrt)
 #endif
diff --git a/math/w_sqrtl_compat.c b/math/w_sqrtl_compat.c
index 16dda403b7..a3dd418d5e 100644
--- a/math/w_sqrtl_compat.c
+++ b/math/w_sqrtl_compat.c
@@ -33,5 +33,6 @@ __sqrtl (long double x)
 
   return __ieee754_sqrtl (x);
 }
+libm_hidden_def (__sqrtl)
 libm_alias_ldouble (__sqrt, sqrt)
 #endif
diff --git a/posix/getopt_int.h b/posix/getopt_int.h
index 502250388d..d05de32971 100644
--- a/posix/getopt_int.h
+++ b/posix/getopt_int.h
@@ -21,11 +21,15 @@
 #define _GETOPT_INT_H	1
 
 #include <getopt.h>
+#ifndef attribute_hidden
+# define attribute_hidden /* nothing */
+#endif
 
 extern int _getopt_internal (int ___argc, char **___argv,
 			     const char *__shortopts,
 			     const struct option *__longopts, int *__longind,
-			     int __long_only, int __posixly_correct);
+			     int __long_only, int __posixly_correct)
+  attribute_hidden;
 
 
 /* Reentrant versions which can handle parsing multiple argument
@@ -102,17 +106,20 @@ extern int _getopt_internal_r (int ___argc, char **___argv,
 			       const char *__shortopts,
 			       const struct option *__longopts, int *__longind,
 			       int __long_only, struct _getopt_data *__data,
-			       int __posixly_correct);
+			       int __posixly_correct)
+  attribute_hidden;
 
 extern int _getopt_long_r (int ___argc, char **___argv,
 			   const char *__shortopts,
 			   const struct option *__longopts, int *__longind,
-			   struct _getopt_data *__data);
+			   struct _getopt_data *__data)
+  attribute_hidden;
 
 extern int _getopt_long_only_r (int ___argc, char **___argv,
 				const char *__shortopts,
 				const struct option *__longopts,
 				int *__longind,
-				struct _getopt_data *__data);
+				struct _getopt_data *__data)
+  attribute_hidden;
 
 #endif /* getopt_int.h */
diff --git a/posix/glob-lstat-compat.c b/posix/glob-lstat-compat.c
index f78b02f909..368a5f798e 100644
--- a/posix/glob-lstat-compat.c
+++ b/posix/glob-lstat-compat.c
@@ -32,5 +32,6 @@
 
 # include <posix/glob.c>
 
+libc_hidden_def (__glob_lstat_compat)
 compat_symbol (libc, __glob_lstat_compat, glob, GLIBC_2_0);
 #endif
diff --git a/posix/glob.c b/posix/glob.c
index 8444b2f79e..ffcb8d81d6 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -1162,6 +1162,7 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 }
 #if defined _LIBC && !defined __glob
 versioned_symbol (libc, __glob, glob, GLIBC_2_27);
+libc_hidden_def (__glob)
 libc_hidden_ver (__glob, glob)
 #endif
 
diff --git a/posix/glob64-lstat-compat.c b/posix/glob64-lstat-compat.c
index fe7b3e0bdc..8036d03564 100644
--- a/posix/glob64-lstat-compat.c
+++ b/posix/glob64-lstat-compat.c
@@ -31,6 +31,6 @@
 # define GLOB_NO_LSTAT
 
 # include <posix/glob64.c>
-
+libc_hidden_def (__glob64_lstat_compat)
 compat_symbol (libc, __glob64_lstat_compat, glob64, GLIBC_2_0);
 #endif
diff --git a/posix/glob64.c b/posix/glob64.c
index 6285a22fa8..d3f2afe90c 100644
--- a/posix/glob64.c
+++ b/posix/glob64.c
@@ -34,8 +34,8 @@
    Otherwise, `glob' returns zero.  */
 int
 GLOB_ATTRIBUTE
-glob64 (const char *pattern, int flags,
-	int (*errfunc) (const char *, int), glob64_t *pglob)
+__glob64 (const char *pattern, int flags,
+          int (*errfunc) (const char *, int), glob64_t *pglob)
 {
   if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
     {
@@ -46,6 +46,8 @@ glob64 (const char *pattern, int flags,
   __set_errno (ENOSYS);
   return GLOB_NOSYS;
 }
-libc_hidden_def (glob64)
+libc_hidden_def (__glob64)
+weak_alias (__glob64, glob64)
+libc_hidden_weak (glob64)
 
 stub_warning (glob64)
diff --git a/posix/glob_pattern_p.c b/posix/glob_pattern_p.c
index 0f72d186c8..c9f03fb21d 100644
--- a/posix/glob_pattern_p.c
+++ b/posix/glob_pattern_p.c
@@ -30,4 +30,5 @@ __glob_pattern_p (const char *pattern, int quote)
 {
   return __glob_pattern_type (pattern, quote) == GLOBPAT_SPECIAL;
 }
+libc_hidden_def (__glob_pattern_p)
 weak_alias (__glob_pattern_p, glob_pattern_p)
diff --git a/resolv/compat-gethnamaddr.c b/resolv/compat-gethnamaddr.c
index 259378b2be..55b73255c1 100644
--- a/resolv/compat-gethnamaddr.c
+++ b/resolv/compat-gethnamaddr.c
@@ -91,7 +91,7 @@ static struct hostent *res_gethostbyname2_context (struct resolv_context *,
 static void map_v4v6_address (const char *src, char *dst) __THROW;
 static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW;
 
-extern void addrsort (char **, int) __THROW;
+static void addrsort (char **, int) __THROW;
 
 # if PACKETSZ > 65536
 #  define	MAXPACKET	PACKETSZ
@@ -894,7 +894,7 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
 	}
 }
 
-extern void
+static void
 addrsort (char **ap, int num)
 {
 	int i, j;
diff --git a/resolv/res_hconf.h b/resolv/res_hconf.h
index 49096b1f90..c2e1d75473 100644
--- a/resolv/res_hconf.h
+++ b/resolv/res_hconf.h
@@ -47,8 +47,8 @@ struct hconf
 extern struct hconf _res_hconf;
 
 extern void _res_hconf_init (void) attribute_hidden;
-extern void _res_hconf_trim_domain (char *domain);
-extern void _res_hconf_trim_domains (struct hostent *hp);
-extern void _res_hconf_reorder_addrs (struct hostent *hp);
+extern void _res_hconf_trim_domain (char *domain) attribute_hidden;
+extern void _res_hconf_trim_domains (struct hostent *hp) attribute_hidden;
+extern void _res_hconf_reorder_addrs (struct hostent *hp) attribute_hidden;
 
 #endif /* _RES_HCONF_H_ */
diff --git a/resolv/res_send.c b/resolv/res_send.c
index dde0425a33..32f9c54335 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -208,7 +208,7 @@ static int		sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
  * author:
  *	paul vixie, 29may94
  */
-int
+static int
 res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
 {
 	int ns;
diff --git a/scripts/check-localplt-2.sh b/scripts/check-localplt-2.sh
new file mode 100755
index 0000000000..d51b7e7387
--- /dev/null
+++ b/scripts/check-localplt-2.sh
@@ -0,0 +1,171 @@
+#! /bin/sh
+
+# This shell script performs a fine-grained test for unwanted calls
+# through the PLT.  It expects its first command line argument to
+# be a specification of expected results, in the same format that
+# check-localplt.awk uses, and the rest of the arguments to be _pic.a
+# archives which should be checked.  AWK should be set in the
+# environment.
+
+set -e
+if [ -n "$BASH_VERSION" ]; then
+    set -o pipefail
+fi
+
+LC_ALL=C
+export LC_ALL
+
+all_expectations="$(mktemp)"
+unsorted_output="$(mktemp)"
+trap "rm -f '$all_expectations' '$unsorted_output'" 0
+
+# Preprocess the expected PLT calls.
+while [ x"$1" != x-- ]; do
+    grep -Ev '^($|#)' "$1" >> "$all_expectations"
+    shift
+done
+shift
+
+for lib in "$@"; do
+    readelf -WSrs "$lib" | tr -s ' 	' ' ' | "${AWK-awk}" '
+BEGIN {
+  # Whitelist of relocation types that are allowed to appear in a text
+  # section, regardless of the name of the symbol.  Since the ELF R_*
+  # constants already contain an architecture label, we can use just
+  # one big whitelist and each architecture will only notice the
+  # values that are relevant to it.
+  #
+  # For most architectures, the relocation types that are OK are those
+  # used for a reference, from within a shared object, to a symbol
+  # that was visible as external, but hidden, when the object file was
+  # compiled.  There are usually at least three, one for functions,
+  # one for ordinary data, and one for thread-local data.
+  #
+  # Please keep this list in alphabetical order.
+
+  ok_relocs["R_X86_64_GOTPC32"] = 1;
+  ok_relocs["R_X86_64_GOTPCREL"] = 1;
+  ok_relocs["R_X86_64_GOTPCRELX"] = 1;
+  ok_relocs["R_X86_64_GOTTPOFF"] = 1;
+  ok_relocs["R_X86_64_PC32"] = 1;
+  ok_relocs["R_X86_64_REX_GOTPCRELX"] = 1;
+
+  # The state machine is reset every time we see a "File:" line, but
+  # set it up here anyway as a backstop.
+  in_section_headers = 0;
+  in_text_relocs = 0;
+  in_symbol_table = 0;
+  delete text_sections;
+}
+$1 == "File:" {
+   fname = $0;
+   sub(/^File: */, "", fname);
+   sub(/\(/, " ", fname);
+   sub(/\)/, "", fname);
+
+   in_section_headers = 0;
+   in_text_relocs = 0;
+   in_symbol_table = 0;
+   delete text_sections;
+   next;
+}
+$0 == "" {
+  in_text_relocs = 0;
+  in_section_headers = 0;
+  in_symbol_table = 0;
+  next;
+}
+
+# We only care about relocations against code, but there may be a lot of
+# code sections with weird names, so we parse the section headers to
+# find them all.  This is trickier than it ought to be because readelf -S
+# output is not precisely space-separated columns.
+# We rely on "readelf -WSrs" to print the section headers first and the
+# relocation entries second.
+$0 == "Section Headers:" { in_section_headers = 1; delete text_sections; next; }
+$0 == "Key to Flags:"    { in_section_headers = 0; next; }
+in_section_headers {
+  if (/ PROGBITS / && / AX / && !/\[Nr\]/) {
+    sub(/^ *\[[ 0-9]*\] */, "");
+    text_sections[$1] = 1;
+  }
+  next;
+}
+
+/^Relocation section '\''/ {
+  section = $3
+  gsub(/'\''/, "", section)
+  sub(/^\.rela?/, "", section)
+  in_text_relocs = (section in text_sections);
+  next;
+}
+
+# Relocation section dumps _are_ space-separated columns, or close enough
+# for what we need.  Print the relocation type and the symbol name for
+# each relocation that addresses a symbol.
+in_text_relocs && $1 ~ /^[0-9a-f]/ && $5 !~ /^\./ && !($3 in ok_relocs) {
+  print fname " " $3 " " $5
+}
+
+# Also print out all of the symbols that are defined by this library.
+# Cross-library references have to go through the PLT regardless.
+/^Symbol table '\''/ {
+  in_symbol_table = 1;
+  next;
+}
+in_symbol_table && $7 != "UND" \
+  && ($5 == "GLOBAL" || $5 == "WEAK") \
+  && ($4 != "NOTYPE" && $4 != "FILE" && $4 != "SECTION") \
+{
+  print fname " _DEFINITION_ " $8
+}
+'
+done | ${AWK-awk} '
+FILENAME != "-" {
+  # Note: unlike check-localplt.awk, this program ignores +/? and relocation
+  # type annotations in the whitelist file.
+  # Comments were already stripped above.
+  library = $1;
+  symbol = $2;
+  sub(/:$/, "", library);
+  sub(/\.so$/, "", library);
+  ok_symbols[library,symbol] = 1;
+}
+FILENAME == "-" {
+  library = $1;
+  symbol = $4;
+  sub(/^.*\//, "", library);
+  sub(/\.so$/, "", library);
+  sub(/\.a$/,  "", library);
+  sub(/_pic$/, "", library);
+  sub(/@.*$/,  "", symbol);
+
+  if ($3 == "_DEFINITION_") {
+    defined_syms[library,symbol] = 1;
+  } else {
+    if (!((library,symbol) in ok_symbols) && !(("*",symbol) in ok_symbols)) {
+      if ((library,symbol) in maybe_bad_syms) {
+        maybe_bad_syms[library,symbol] = maybe_bad_syms[library,symbol] "\n" $0;
+      } else {
+        maybe_bad_syms[library,symbol] = $0;
+      }
+    }
+  }
+}
+END {
+  for (libsym in maybe_bad_syms) {
+    if (libsym in defined_syms) {
+      print maybe_bad_syms[libsym];
+      result = 1;
+    }
+  }
+}
+' "$all_expectations" - > "$unsorted_output"
+
+if [ -s "$unsorted_output" ]; then
+    echo "*** Undesirable relocations:"
+    sed -e 's:^[^ ]*/::' < "$unsorted_output" | sort -u
+    exit 1
+else
+    exit 0
+fi
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index 8f6c53aeb4..fc5a67453e 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -92,14 +92,14 @@ psiginfo (const siginfo_t *pinfo, const char *s)
 	  if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
 	    {
 	      if (pinfo->si_signo == SIGRTMIN)
-		fprintf (fp, "SIGRTMIN (");
+		fputs ("SIGRTMIN (", fp);
 	      else
 		fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
 	    }
 	  else
 	    {
 	      if (pinfo->si_signo == SIGRTMAX)
-		fprintf (fp, "SIGRTMAX (");
+		fputs ("SIGRTMAX (", fp);
 	      else
 		fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
 	    }
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 3263268c7e..2407354ae4 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -3056,7 +3056,7 @@ ldbl_weak_alias (__vfwscanf, vfwscanf)
 int
 ___vfscanf (FILE *s, const char *format, va_list argptr)
 {
-  return _IO_vfscanf_internal (s, format, argptr, NULL);
+  return _IO_vfscanf (s, format, argptr, NULL);
 }
 ldbl_strong_alias (_IO_vfscanf_internal, _IO_vfscanf)
 ldbl_hidden_def (_IO_vfscanf_internal, _IO_vfscanf)
diff --git a/string/memrchr.c b/string/memrchr.c
index 191b89a229..23a74ef1eb 100644
--- a/string/memrchr.c
+++ b/string/memrchr.c
@@ -191,7 +191,6 @@ MEMRCHR
   return 0;
 }
 #ifndef MEMRCHR
-# ifdef weak_alias
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
-# endif
 #endif
diff --git a/string/strchrnul.c b/string/strchrnul.c
index 5a17602edd..dab53aaeee 100644
--- a/string/strchrnul.c
+++ b/string/strchrnul.c
@@ -162,5 +162,5 @@ STRCHRNUL (const char *s, int c_in)
   /* This should never happen.  */
   return NULL;
 }
-
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/string/strncase.c b/string/strncase.c
index 2558d2969f..9f0ee3c6c7 100644
--- a/string/strncase.c
+++ b/string/strncase.c
@@ -65,5 +65,6 @@ __strncasecmp (const char *s1, const char *s2, size_t n LOCALE_PARAM)
   return result;
 }
 #ifndef __strncasecmp
+libc_hidden_def (__strncasecmp)
 weak_alias (__strncasecmp, strncasecmp)
 #endif
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 249e9c3584..ae0d2b33ba 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -56,7 +56,7 @@
 #include <wchar.h>
 #include <shlib-compat.h>
 
-extern u_long _create_xid (void);
+extern u_long _create_xid (void) attribute_hidden;
 
 #define MCALL_MSG_SIZE 24
 
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index c2436e3ebc..cc38f2d7c8 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -58,7 +58,7 @@
 #include <inet/net-internal.h>
 #include <shlib-compat.h>
 
-extern u_long _create_xid (void);
+extern u_long _create_xid (void) attribute_hidden;
 
 /*
  * UDP bases client side rpc operations
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 33a02cc8af..57b2b79c57 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -57,7 +57,7 @@
 #include <wchar.h>
 #include <shlib-compat.h>
 
-extern u_long _create_xid (void);
+extern u_long _create_xid (void) attribute_hidden;
 
 #define MCALL_MSG_SIZE 24
 
diff --git a/sunrpc/create_xid.c b/sunrpc/create_xid.c
index 63e586f504..ae48cd2bc5 100644
--- a/sunrpc/create_xid.c
+++ b/sunrpc/create_xid.c
@@ -22,6 +22,8 @@
 #include <libc-lock.h>
 #include <rpc/rpc.h>
 
+extern unsigned long _create_xid (void) attribute_hidden;
+
 /* The RPC code is not threadsafe, but new code should be threadsafe. */
 
 __libc_lock_define_initialized (static, createxid_lock)
diff --git a/sunrpc/des_crypt.c b/sunrpc/des_crypt.c
index a4d8b2936b..76db3980a3 100644
--- a/sunrpc/des_crypt.c
+++ b/sunrpc/des_crypt.c
@@ -35,7 +35,7 @@
 #include <shlib-compat.h>
 #include "des.h"
 
-extern int _des_crypt (char *, unsigned, struct desparams *);
+extern int _des_crypt (char *, unsigned, struct desparams *) attribute_hidden;
 
 /*
  * Copy 8 bytes
diff --git a/sunrpc/des_impl.c b/sunrpc/des_impl.c
index d1d2edfbc8..3b53b2249f 100644
--- a/sunrpc/des_impl.c
+++ b/sunrpc/des_impl.c
@@ -372,7 +372,7 @@ static const char shifts2[16] =
 
 static void des_set_key (unsigned char *, unsigned long *);
 static void des_encrypt (unsigned long *, unsigned long *, int);
-int _des_crypt (char *, unsigned, struct desparams *);
+int _des_crypt (char *, unsigned, struct desparams *) attribute_hidden;
 
 static void
 des_set_key (unsigned char *key, unsigned long *schedule)
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 6b142e5441..c9739285e3 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -53,7 +53,7 @@
 
 #define MAX_BROADCAST_SIZE 1400
 
-extern u_long _create_xid (void);
+extern u_long _create_xid (void) attribute_hidden;
 
 static const struct timeval timeout = {3, 0};
 
diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S
index e13ace5b7e..51b50db3a2 100644
--- a/sysdeps/aarch64/strchrnul.S
+++ b/sysdeps/aarch64/strchrnul.S
@@ -128,4 +128,5 @@ L(tail):
 	ret
 
 END(__strchrnul)
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index ecb37394fb..70550dcfca 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -250,18 +250,27 @@ fabsf128 (_Float128 x)
 
 
 /* Prototypes for functions of the IBM Accurate Mathematical Library.  */
-extern double __exp1 (double __x, double __xx);
-extern double __sin (double __x);
-extern double __cos (double __x);
-extern int __branred (double __x, double *__a, double *__aa);
-extern void __doasin (double __x, double __dx, double __v[]);
-extern void __dubsin (double __x, double __dx, double __v[]);
-extern void __dubcos (double __x, double __dx, double __v[]);
-extern double __sin32 (double __x, double __res, double __res1);
-extern double __cos32 (double __x, double __res, double __res1);
-extern double __mpsin (double __x, double __dx, bool __range_reduce);
-extern double __mpcos (double __x, double __dx, bool __range_reduce);
-extern void __docos (double __x, double __dx, double __v[]);
+extern double __exp1 (double __x, double __xx) attribute_hidden;
+extern double __sin (double __x) attribute_hidden;
+extern double __cos (double __x) attribute_hidden;
+extern int __branred (double __x, double *__a, double *__aa)
+  attribute_hidden;
+extern void __doasin (double __x, double __dx, double __v[])
+  attribute_hidden;
+extern void __dubsin (double __x, double __dx, double __v[])
+  attribute_hidden;
+extern void __dubcos (double __x, double __dx, double __v[])
+  attribute_hidden;
+extern double __sin32 (double __x, double __res, double __res1)
+  attribute_hidden;
+extern double __cos32 (double __x, double __res, double __res1)
+  attribute_hidden;
+extern double __mpsin (double __x, double __dx, bool __range_reduce)
+  attribute_hidden;
+extern double __mpcos (double __x, double __dx, bool __range_reduce)
+  attribute_hidden;
+extern void __docos (double __x, double __dx, double __v[])
+  attribute_hidden;
 
 #ifndef math_opt_barrier
 # define math_opt_barrier(x) \
diff --git a/sysdeps/generic/math_private_calls.h b/sysdeps/generic/math_private_calls.h
index 16b4ea3736..72f4e3bbf7 100644
--- a/sysdeps/generic/math_private_calls.h
+++ b/sysdeps/generic/math_private_calls.h
@@ -25,58 +25,73 @@
 #define __MSUF_R(x) __MSUF_R_S (x, _MSUF_)
 
 /* IEEE style elementary functions.  */
-extern _Mdouble_ __MSUF (__ieee754_acos) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_acosh) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_asin) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_atan2) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_atanh) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_cosh) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_exp) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_exp10) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_exp2) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_fmod) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_gamma) (_Mdouble_);
-extern _Mdouble_ __MSUF_R (__ieee754_gamma) (_Mdouble_, int *);
-extern _Mdouble_ __MSUF (__ieee754_hypot) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_j0) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_j1) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_jn) (int, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_lgamma) (_Mdouble_);
-extern _Mdouble_ __MSUF_R (__ieee754_lgamma) (_Mdouble_, int *);
-extern _Mdouble_ __MSUF (__ieee754_log) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_log10) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_log2) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_pow) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_remainder) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_sinh) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_sqrt) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_y0) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_y1) (_Mdouble_);
-extern _Mdouble_ __MSUF (__ieee754_yn) (int, _Mdouble_);
-
-extern _Mdouble_ __MSUF (__ieee754_scalb) (_Mdouble_, _Mdouble_);
-extern int __MSUF (__ieee754_ilogb) (_Mdouble_);
-
-extern int32_t __MSUF (__ieee754_rem_pio2) (_Mdouble_, _Mdouble_ *);
+extern _Mdouble_ __MSUF (__ieee754_acos) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_acosh) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_asin) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_atan2) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_atanh) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_cosh) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_exp) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_exp10) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_exp2) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_fmod) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_gamma) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF_R (__ieee754_gamma) (_Mdouble_, int *)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_hypot) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_j0) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_j1) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_jn) (int, _Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_lgamma) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF_R (__ieee754_lgamma) (_Mdouble_, int *)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_log) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_log10) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_log2) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_pow) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_remainder) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_sinh) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_sqrt) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_y0) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_y1) (_Mdouble_) attribute_hidden;
+extern _Mdouble_ __MSUF (__ieee754_yn) (int, _Mdouble_) attribute_hidden;
+
+extern _Mdouble_ __MSUF (__ieee754_scalb) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern int __MSUF (__ieee754_ilogb) (_Mdouble_) attribute_hidden;
+
+extern int32_t __MSUF (__ieee754_rem_pio2) (_Mdouble_, _Mdouble_ *)
+  attribute_hidden;
 
 /* fdlibm kernel functions.  */
-extern _Mdouble_ __MSUF (__kernel_sin) (_Mdouble_, _Mdouble_, int);
-extern _Mdouble_ __MSUF (__kernel_cos) (_Mdouble_, _Mdouble_);
-extern _Mdouble_ __MSUF (__kernel_tan) (_Mdouble_, _Mdouble_, int);
+extern _Mdouble_ __MSUF (__kernel_sin) (_Mdouble_, _Mdouble_, int)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__kernel_cos) (_Mdouble_, _Mdouble_)
+  attribute_hidden;
+extern _Mdouble_ __MSUF (__kernel_tan) (_Mdouble_, _Mdouble_, int)
+  attribute_hidden;
 
 #if defined __MATH_DECLARING_LONG_DOUBLE || defined __MATH_DECLARING_FLOATN
 extern void __MSUF (__kernel_sincos) (_Mdouble_, _Mdouble_,
-				      _Mdouble_ *, _Mdouble_ *, int);
+				      _Mdouble_ *, _Mdouble_ *, int)
+  attribute_hidden;
 #endif
 
 #if !defined __MATH_DECLARING_LONG_DOUBLE || defined __MATH_DECLARING_FLOATN
 extern int __MSUF (__kernel_rem_pio2) (_Mdouble_ *, _Mdouble_ *, int,
-				       int, int, const int32_t *);
+				       int, int, const int32_t *)
+  attribute_hidden;
 #endif
 
 /* Internal functions.  */
 #if !defined __MATH_DECLARING_LONG_DOUBLE || !defined NO_LONG_DOUBLE
-extern _Mdouble_ __MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y);
+extern _Mdouble_ __MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y)
+  attribute_hidden;
 
 extern inline _Mdouble_
 __MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y)
@@ -88,7 +103,8 @@ __MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y)
 /* Return X^2 + Y^2 - 1, computed without large cancellation error.
    It is given that 1 > X >= Y >= epsilon / 2, and that X^2 + Y^2 >=
    0.5.  */
-extern _Mdouble_ __MSUF (__x2y2m1) (_Mdouble_ x, _Mdouble_ y);
+extern _Mdouble_ __MSUF (__x2y2m1) (_Mdouble_ x, _Mdouble_ y)
+  attribute_hidden;
 
 /* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
    - 1, in the form R * (1 + *EPS) where the return value R is an
@@ -98,12 +114,14 @@ extern _Mdouble_ __MSUF (__x2y2m1) (_Mdouble_ x, _Mdouble_ y);
    X is small enough that factors quadratic in it can be
    neglected.  */
 extern _Mdouble_ __MSUF (__gamma_product) (_Mdouble_ x, _Mdouble_ x_eps,
-					   int n, _Mdouble_ *eps);
+					   int n, _Mdouble_ *eps)
+  attribute_hidden;
 
 /* Compute lgamma of a negative argument X, if it is in a range
    (depending on the floating-point format) for which expansion around
    zeros is used, setting *SIGNGAMP accordingly.  */
-extern _Mdouble_ __MSUF (__lgamma_neg) (_Mdouble_ x, int *signgamp);
+extern _Mdouble_ __MSUF (__lgamma_neg) (_Mdouble_ x, int *signgamp)
+  attribute_hidden;
 
 /* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS +
    1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1.  X is such that
@@ -112,7 +130,8 @@ extern _Mdouble_ __MSUF (__lgamma_neg) (_Mdouble_ x, int *signgamp);
    neglected.  */
 #if !defined __MATH_DECLARING_FLOAT
 extern _Mdouble_ __MSUF (__lgamma_product) (_Mdouble_ t, _Mdouble_ x,
-					    _Mdouble_ x_eps, int n);
+					    _Mdouble_ x_eps, int n)
+  attribute_hidden;
 #endif
 
 #undef __MSUF_X
diff --git a/sysdeps/gnu/glob-lstat-compat.c b/sysdeps/gnu/glob-lstat-compat.c
index 7cb52d4fee..8f7d775e6a 100644
--- a/sysdeps/gnu/glob-lstat-compat.c
+++ b/sysdeps/gnu/glob-lstat-compat.c
@@ -20,6 +20,8 @@
 #include <sys/stat.h>
 #include <shlib-compat.h>
 
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_27)
+
 #define glob64 __no_glob64_decl
 #include <glob.h>
 #undef glob64
@@ -33,6 +35,6 @@
 
 #include <posix/glob.c>
 
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_27)
+libc_hidden_def (__glob_lstat_compat)
 compat_symbol (libc, __glob_lstat_compat, glob, GLIBC_2_0);
 #endif
diff --git a/sysdeps/i386/fpu/s_rintl.c b/sysdeps/i386/fpu/s_rintl.c
index 5900435af9..0d96296902 100644
--- a/sysdeps/i386/fpu/s_rintl.c
+++ b/sysdeps/i386/fpu/s_rintl.c
@@ -4,8 +4,9 @@
  * Public domain.
  */
 
-#include <libm-alias-ldouble.h>
+#include <math.h>
 #include <math_private.h>
+#include <libm-alias-ldouble.h>
 
 long double
 __rintl (long double x)
@@ -15,5 +16,5 @@ __rintl (long double x)
   asm ("frndint" : "=t" (res) : "0" (x));
   return res;
 }
-
+libm_hidden_def (__rintl)
 libm_alias_ldouble (__rint, rint)
diff --git a/sysdeps/i386/i686/multiarch/memrchr.c b/sysdeps/i386/i686/multiarch/memrchr.c
index 1c0d9caf55..9e839ed39e 100644
--- a/sysdeps/i386/i686/multiarch/memrchr.c
+++ b/sysdeps/i386/i686/multiarch/memrchr.c
@@ -17,16 +17,17 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <string.h>
+
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define memrchr __redirect_memrchr
-# include <string.h>
-# undef memrchr
+
+extern typeof (__memrchr) __redirect_memrchr;
 
 # define SYMBOL_NAME memrchr
 # include "ifunc-sse2-bsf.h"
 
 libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ());
-
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
 #endif
diff --git a/sysdeps/i386/i686/multiarch/strncase.c b/sysdeps/i386/i686/multiarch/strncase.c
index 12c3b82e12..0f50506805 100644
--- a/sysdeps/i386/i686/multiarch/strncase.c
+++ b/sysdeps/i386/i686/multiarch/strncase.c
@@ -30,6 +30,6 @@
 
 libc_ifunc_redirected (__redirect_strncasecmp, __strncasecmp,
 		       IFUNC_SELECTOR ());
-
+libc_hidden_def (__strncasecmp)
 weak_alias (__strncasecmp, strncasecmp)
 #endif
diff --git a/sysdeps/i386/i686/multiarch/wcslen.c b/sysdeps/i386/i686/multiarch/wcslen.c
index 9f1b238a44..bc2a6e5047 100644
--- a/sysdeps/i386/i686/multiarch/wcslen.c
+++ b/sysdeps/i386/i686/multiarch/wcslen.c
@@ -17,15 +17,17 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <wchar.h>
+
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define __wcslen __redirect_wcslen
-# include <wchar.h>
-# undef __wcslen
+
+extern typeof (__wcslen) __redirect_wcslen;
 
 # define SYMBOL_NAME wcslen
 # include "ifunc-sse2.h"
 
 libc_ifunc_redirected (__redirect_wcslen, __wcslen, IFUNC_SELECTOR ());
-weak_alias (__wcslen, wcslen);
+libc_hidden_def (__wcslen)
+weak_alias (__wcslen, wcslen)
 #endif
diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S
index 80a4d2a9ab..3afe4833c5 100644
--- a/sysdeps/i386/strchrnul.S
+++ b/sysdeps/i386/strchrnul.S
@@ -274,5 +274,5 @@ L(6):	popl %edi		/* restore saved register content */
 
 	ret
 END (__strchrnul)
-
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index 1e188de4d1..ce503d22fa 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -35,6 +35,9 @@
 /* Common types and definition                                          */
 /************************************************************************/
 
+#ifndef _MPA_H
+#define _MPA_H 1
+
 #include <mpa-arch.h>
 
 /* The mp_no structure holds the details of a multi-precision floating point
@@ -106,18 +109,26 @@ extern const mp_no __mptwo;
 #define  HALF      0x1.0p-1		/* 1/2 */
 #define  MHALF     -0x1.0p-1		/* -1/2 */
 
-int __acr (const mp_no *, const mp_no *, int);
-void __cpy (const mp_no *, mp_no *, int);
-void __mp_dbl (const mp_no *, double *, int);
-void __dbl_mp (double, mp_no *, int);
-void __add (const mp_no *, const mp_no *, mp_no *, int);
-void __sub (const mp_no *, const mp_no *, mp_no *, int);
-void __mul (const mp_no *, const mp_no *, mp_no *, int);
-void __sqr (const mp_no *, mp_no *, int);
-void __dvd (const mp_no *, const mp_no *, mp_no *, int);
-
-extern void __mpatan (mp_no *, mp_no *, int);
-extern void __mpatan2 (mp_no *, mp_no *, mp_no *, int);
-extern void __mpsqrt (mp_no *, mp_no *, int);
-extern void __c32 (mp_no *, mp_no *, mp_no *, int);
-extern int __mpranred (double, mp_no *, int);
+int __acr (const mp_no *, const mp_no *, int) attribute_hidden;
+void __cpy (const mp_no *, mp_no *, int) attribute_hidden;
+void __mp_dbl (const mp_no *, double *, int) attribute_hidden;
+void __dbl_mp (double, mp_no *, int) attribute_hidden;
+void __add (const mp_no *, const mp_no *, mp_no *, int)
+  attribute_hidden;
+void __sub (const mp_no *, const mp_no *, mp_no *, int)
+  attribute_hidden;
+void __mul (const mp_no *, const mp_no *, mp_no *, int)
+  attribute_hidden;
+void __sqr (const mp_no *, mp_no *, int)
+  attribute_hidden;
+void __dvd (const mp_no *, const mp_no *, mp_no *, int)
+  attribute_hidden;
+
+extern void __mpatan (mp_no *, mp_no *, int) attribute_hidden;
+extern void __mpatan2 (mp_no *, mp_no *, mp_no *, int) attribute_hidden;
+extern void __mpsqrt (mp_no *, mp_no *, int) attribute_hidden;
+extern void __mptan (double, mp_no *, int) attribute_hidden;
+extern void __c32 (mp_no *, mp_no *, mp_no *, int) attribute_hidden;
+extern int __mpranred (double, mp_no *, int) attribute_hidden;
+
+#endif
diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c
index 78287fd1cb..7c8e4e15f8 100644
--- a/sysdeps/ieee754/dbl-64/s_erf.c
+++ b/sysdeps/ieee754/dbl-64/s_erf.c
@@ -295,6 +295,7 @@ __erf (double x)
   else
     return r / x - one;
 }
+libm_hidden_def (__erf)
 libm_alias_double (__erf, erf)
 
 double
@@ -418,4 +419,5 @@ __erfc (double x)
 	return two - tiny;
     }
 }
+libm_hidden_def (__erfc)
 libm_alias_double (__erfc, erfc)
diff --git a/sysdeps/ieee754/dbl-64/s_expm1.c b/sysdeps/ieee754/dbl-64/s_expm1.c
index 3e136e7ee0..e0e05bad55 100644
--- a/sysdeps/ieee754/dbl-64/s_expm1.c
+++ b/sysdeps/ieee754/dbl-64/s_expm1.c
@@ -256,4 +256,5 @@ __expm1 (double x)
     }
   return y;
 }
+libm_hidden_def (__expm1)
 libm_alias_double (__expm1, expm1)
diff --git a/sysdeps/ieee754/dbl-64/s_nextup.c b/sysdeps/ieee754/dbl-64/s_nextup.c
index db13a5793b..3f5783eddb 100644
--- a/sysdeps/ieee754/dbl-64/s_nextup.c
+++ b/sysdeps/ieee754/dbl-64/s_nextup.c
@@ -51,5 +51,5 @@ __nextup (double x)
   INSERT_WORDS (x, hx, lx);
   return x;
 }
-
+libm_hidden_def (__nextup)
 libm_alias_double (__nextup, nextup)
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index e1977ea7e9..6bcb8de8a5 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -107,4 +107,5 @@ __sincos (double x, double *sinx, double *cosx)
 
   *sinx = *cosx = x / x;
 }
+libm_hidden_def (__sincos)
 libm_alias_double (__sincos, sincos)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
index c73434f5f3..5a60efc853 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
@@ -63,4 +63,5 @@ __frexp (double x, int *eptr)
   *eptr = e;
   return x;
 }
+libm_hidden_def (__frexp)
 libm_alias_double (__frexp, frexp)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
index 5d1f98e471..1f9e179981 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
@@ -60,4 +60,5 @@ __nearbyint(double x)
 	libc_fesetenv (&env);
 	return t;
 }
+libm_hidden_def (__nearbyint)
 libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
index 3323621ce3..7d6b3ac122 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
@@ -62,4 +62,5 @@ __round (double x)
   INSERT_WORDS64 (x, i0);
   return x;
 }
+libm_hidden_def (__round)
 libm_alias_double (__round, round)
diff --git a/sysdeps/ieee754/flt-32/s_atanf.c b/sysdeps/ieee754/flt-32/s_atanf.c
index 03a4cfd6a5..b095b85438 100644
--- a/sysdeps/ieee754/flt-32/s_atanf.c
+++ b/sysdeps/ieee754/flt-32/s_atanf.c
@@ -99,4 +99,5 @@ float __atanf(float x)
 	    return (hx<0)? -z:z;
 	}
 }
+libm_hidden_def (__atanf)
 libm_alias_float (__atan, atan)
diff --git a/sysdeps/ieee754/flt-32/s_ceilf.c b/sysdeps/ieee754/flt-32/s_ceilf.c
index f289ec2341..08005572e2 100644
--- a/sysdeps/ieee754/flt-32/s_ceilf.c
+++ b/sysdeps/ieee754/flt-32/s_ceilf.c
@@ -44,6 +44,7 @@ __ceilf(float x)
 	SET_FLOAT_WORD(x,i0);
 	return x;
 }
+libm_hidden_def (__ceilf)
 #ifndef __ceilf
 libm_alias_float (__ceil, ceil)
 #endif
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
index 6eacf0f5fc..60ff3a0a3c 100644
--- a/sysdeps/ieee754/flt-32/s_erff.c
+++ b/sysdeps/ieee754/flt-32/s_erff.c
@@ -153,6 +153,7 @@ float __erff(float x)
 	r  =  __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S);
 	if(hx>=0) return one-r/x; else return  r/x-one;
 }
+libm_hidden_def (__erff)
 libm_alias_float (__erf, erf)
 
 float __erfcf(float x)
@@ -228,4 +229,5 @@ float __erfcf(float x)
 		return two-tiny;
 	}
 }
+libm_hidden_def (__erfcf)
 libm_alias_float (__erfc, erfc)
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 0358970778..a63be37aef 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -128,4 +128,5 @@ __expm1f(float x)
 	}
 	return y;
 }
+libm_hidden_def (__expm1f)
 libm_alias_float (__expm1, expm1)
diff --git a/sysdeps/ieee754/flt-32/s_floorf.c b/sysdeps/ieee754/flt-32/s_floorf.c
index 12aed343a0..c7e583e1f9 100644
--- a/sysdeps/ieee754/flt-32/s_floorf.c
+++ b/sysdeps/ieee754/flt-32/s_floorf.c
@@ -50,6 +50,7 @@ __floorf(float x)
 	SET_FLOAT_WORD(x,i0);
 	return x;
 }
+libm_hidden_def (__floorf)
 #ifndef __floorf
 libm_alias_float (__floor, floor)
 #endif
diff --git a/sysdeps/ieee754/flt-32/s_frexpf.c b/sysdeps/ieee754/flt-32/s_frexpf.c
index b7403bf0d8..d39e980949 100644
--- a/sysdeps/ieee754/flt-32/s_frexpf.c
+++ b/sysdeps/ieee754/flt-32/s_frexpf.c
@@ -42,4 +42,5 @@ float __frexpf(float x, int *eptr)
 	SET_FLOAT_WORD(x,hx);
 	return x;
 }
+libm_hidden_def (__frexpf)
 libm_alias_float (__frexp, frexp)
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index a8af8948ec..6a7f5feae3 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -57,4 +57,5 @@ __nearbyintf(float x)
 	libc_fesetenvf (&env);
 	return t;
 }
+libm_hidden_def (__nearbyintf)
 libm_alias_float (__nearbyint, nearbyint)
diff --git a/sysdeps/ieee754/flt-32/s_nextupf.c b/sysdeps/ieee754/flt-32/s_nextupf.c
index 7ba8c0b79d..8fab441e56 100644
--- a/sysdeps/ieee754/flt-32/s_nextupf.c
+++ b/sysdeps/ieee754/flt-32/s_nextupf.c
@@ -43,5 +43,5 @@ __nextupf (float x)
   SET_FLOAT_WORD (x, hx);
   return x;
 }
-
+libm_hidden_def (__nextupf)
 libm_alias_float (__nextup, nextup)
diff --git a/sysdeps/ieee754/flt-32/s_rintf.c b/sysdeps/ieee754/flt-32/s_rintf.c
index db6f260a0b..71f747a47d 100644
--- a/sysdeps/ieee754/flt-32/s_rintf.c
+++ b/sysdeps/ieee754/flt-32/s_rintf.c
@@ -46,6 +46,7 @@ __rintf(float x)
 	w = TWO23[sx]+x;
 	return w-TWO23[sx];
 }
+libm_hidden_def (__rintf)
 #ifndef __rintf
 libm_alias_float (__rint, rint)
 #endif
diff --git a/sysdeps/ieee754/flt-32/s_roundevenf.c b/sysdeps/ieee754/flt-32/s_roundevenf.c
index 90f991d5c4..fa8d0bab49 100644
--- a/sysdeps/ieee754/flt-32/s_roundevenf.c
+++ b/sysdeps/ieee754/flt-32/s_roundevenf.c
@@ -67,4 +67,5 @@ __roundevenf (float x)
   SET_FLOAT_WORD (x, ix);
   return x;
 }
+libm_hidden_def (__roundevenf)
 libm_alias_float (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/flt-32/s_roundf.c b/sysdeps/ieee754/flt-32/s_roundf.c
index 7c95125d9c..3c925c08f1 100644
--- a/sysdeps/ieee754/flt-32/s_roundf.c
+++ b/sysdeps/ieee754/flt-32/s_roundf.c
@@ -61,4 +61,5 @@ __roundf (float x)
   SET_FLOAT_WORD (x, i0);
   return x;
 }
+libm_hidden_def (__roundf)
 libm_alias_float (__round, round)
diff --git a/sysdeps/ieee754/flt-32/s_truncf.c b/sysdeps/ieee754/flt-32/s_truncf.c
index 2e1464aeac..8d4605f3eb 100644
--- a/sysdeps/ieee754/flt-32/s_truncf.c
+++ b/sysdeps/ieee754/flt-32/s_truncf.c
@@ -49,6 +49,7 @@ __truncf (float x)
 
   return x;
 }
+libm_hidden_def (__truncf)
 #ifndef __truncf
 libm_alias_float (__trunc, trunc)
 #endif
diff --git a/sysdeps/ieee754/ldbl-128/s_atanl.c b/sysdeps/ieee754/ldbl-128/s_atanl.c
index e05368df53..6de128201d 100644
--- a/sysdeps/ieee754/ldbl-128/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128/s_atanl.c
@@ -250,5 +250,5 @@ __atanl (_Float128 x)
   else
     return u;
 }
-
+libm_hidden_def (__atanl)
 libm_alias_ldouble (__atan, atan)
diff --git a/sysdeps/ieee754/ldbl-128/s_ceill.c b/sysdeps/ieee754/ldbl-128/s_ceill.c
index e6aba5f2af..3e68a6cde7 100644
--- a/sysdeps/ieee754/ldbl-128/s_ceill.c
+++ b/sysdeps/ieee754/ldbl-128/s_ceill.c
@@ -64,4 +64,5 @@ _Float128 __ceill(_Float128 x)
 	SET_LDOUBLE_WORDS64(x,i0,i1);
 	return x;
 }
+libm_hidden_def (__ceill)
 libm_alias_ldouble (__ceil, ceil)
diff --git a/sysdeps/ieee754/ldbl-128/s_cosl.c b/sysdeps/ieee754/ldbl-128/s_cosl.c
index b315abccc5..6424f6d1f2 100644
--- a/sysdeps/ieee754/ldbl-128/s_cosl.c
+++ b/sysdeps/ieee754/ldbl-128/s_cosl.c
@@ -84,4 +84,5 @@ _Float128 __cosl(_Float128 x)
 	    }
 	}
 }
+libm_hidden_def (__cosl)
 libm_alias_ldouble (__cos, cos)
diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
index 88e91c702d..39c0b45934 100644
--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
@@ -803,8 +803,9 @@ __erfl (_Float128 x)
     y = -y;
   return( y );
 }
-
+libm_hidden_def (__erfl)
 libm_alias_ldouble (__erf, erf)
+
 _Float128
 __erfcl (_Float128 x)
 {
@@ -945,5 +946,5 @@ __erfcl (_Float128 x)
 	return two - tiny;
     }
 }
-
+libm_hidden_def (__erfcl)
 libm_alias_ldouble (__erfc, erfc)
diff --git a/sysdeps/ieee754/ldbl-128/s_floorl.c b/sysdeps/ieee754/ldbl-128/s_floorl.c
index f9c5e014f9..6f881618ff 100644
--- a/sysdeps/ieee754/ldbl-128/s_floorl.c
+++ b/sysdeps/ieee754/ldbl-128/s_floorl.c
@@ -65,4 +65,5 @@ _Float128 __floorl(_Float128 x)
 	SET_LDOUBLE_WORDS64(x,i0,i1);
 	return x;
 }
+libm_hidden_def (__floorl)
 libm_alias_ldouble (__floor, floor)
diff --git a/sysdeps/ieee754/ldbl-128/s_frexpl.c b/sysdeps/ieee754/ldbl-128/s_frexpl.c
index bab0779e23..d9fca42bb8 100644
--- a/sysdeps/ieee754/ldbl-128/s_frexpl.c
+++ b/sysdeps/ieee754/ldbl-128/s_frexpl.c
@@ -52,4 +52,5 @@ _Float128 __frexpl(_Float128 x, int *eptr)
 	SET_LDOUBLE_MSW64(x,hx);
 	return x;
 }
+libm_hidden_def (__frexpl)
 libm_alias_ldouble (__frexp, frexp)
diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index 04b657d451..e7f617175d 100644
--- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -65,4 +65,5 @@ _Float128 __nearbyintl(_Float128 x)
 	fesetenv (&env);
 	return t;
 }
+libm_hidden_def (__nearbyintl)
 libm_alias_ldouble (__nearbyint, nearbyint)
diff --git a/sysdeps/ieee754/ldbl-128/s_nextupl.c b/sysdeps/ieee754/ldbl-128/s_nextupl.c
index 5628c17680..5b40e6e91d 100644
--- a/sysdeps/ieee754/ldbl-128/s_nextupl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nextupl.c
@@ -53,5 +53,5 @@ __nextupl (_Float128 x)
   SET_LDOUBLE_WORDS64 (x, hx, lx);
   return x;
 }
-
+libm_hidden_def (__nextupl)
 libm_alias_ldouble (__nextup, nextup)
diff --git a/sysdeps/ieee754/ldbl-128/s_rintl.c b/sysdeps/ieee754/ldbl-128/s_rintl.c
index 9e6637a225..4632adfeee 100644
--- a/sysdeps/ieee754/ldbl-128/s_rintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_rintl.c
@@ -60,4 +60,5 @@ _Float128 __rintl(_Float128 x)
 	w = TWO112[sx]+x;
 	return w-TWO112[sx];
 }
+libm_hidden_def (__rintl)
 libm_alias_ldouble (__rint, rint)
diff --git a/sysdeps/ieee754/ldbl-128/s_roundevenl.c b/sysdeps/ieee754/ldbl-128/s_roundevenl.c
index 5fc59af4ee..12f4694b3f 100644
--- a/sysdeps/ieee754/ldbl-128/s_roundevenl.c
+++ b/sysdeps/ieee754/ldbl-128/s_roundevenl.c
@@ -101,4 +101,5 @@ __roundevenl (_Float128 x)
   SET_LDOUBLE_WORDS64 (x, hx, lx);
   return x;
 }
+libm_hidden_def (__roundevenl)
 libm_alias_ldouble (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/ldbl-128/s_roundl.c b/sysdeps/ieee754/ldbl-128/s_roundl.c
index 22789cedf3..8d3e0b8713 100644
--- a/sysdeps/ieee754/ldbl-128/s_roundl.c
+++ b/sysdeps/ieee754/ldbl-128/s_roundl.c
@@ -78,4 +78,5 @@ __roundl (_Float128 x)
   SET_LDOUBLE_WORDS64 (x, i0, i1);
   return x;
 }
+libm_hidden_def (__roundl)
 libm_alias_ldouble (__round, round)
diff --git a/sysdeps/ieee754/ldbl-128/s_sincosl.c b/sysdeps/ieee754/ldbl-128/s_sincosl.c
index dfcb0be301..12718d6a62 100644
--- a/sysdeps/ieee754/ldbl-128/s_sincosl.c
+++ b/sysdeps/ieee754/ldbl-128/s_sincosl.c
@@ -71,4 +71,5 @@ __sincosl (_Float128 x, _Float128 *sinx, _Float128 *cosx)
 	}
     }
 }
+libm_hidden_def (__sincosl)
 libm_alias_ldouble (__sincos, sincos)
diff --git a/sysdeps/ieee754/ldbl-128/s_sinl.c b/sysdeps/ieee754/ldbl-128/s_sinl.c
index 773b2fa7ee..9736a09ad1 100644
--- a/sysdeps/ieee754/ldbl-128/s_sinl.c
+++ b/sysdeps/ieee754/ldbl-128/s_sinl.c
@@ -84,4 +84,5 @@ _Float128 __sinl(_Float128 x)
 	    }
 	}
 }
+libm_hidden_def (__sinl)
 libm_alias_ldouble (__sin, sin)
diff --git a/sysdeps/ieee754/ldbl-128/s_truncl.c b/sysdeps/ieee754/ldbl-128/s_truncl.c
index f858ede3d2..28d3c45876 100644
--- a/sysdeps/ieee754/ldbl-128/s_truncl.c
+++ b/sysdeps/ieee754/ldbl-128/s_truncl.c
@@ -54,4 +54,5 @@ __truncl (_Float128 x)
 
   return x;
 }
+libm_hidden_def (__truncl)
 libm_alias_ldouble (__trunc, trunc)
diff --git a/sysdeps/ieee754/ldbl-96/s_cosl.c b/sysdeps/ieee754/ldbl-96/s_cosl.c
index 324e5b9663..e56000e8ef 100644
--- a/sysdeps/ieee754/ldbl-96/s_cosl.c
+++ b/sysdeps/ieee754/ldbl-96/s_cosl.c
@@ -86,4 +86,5 @@ long double __cosl(long double x)
 	    }
 	}
 }
+libm_hidden_def (__cosl)
 libm_alias_ldouble (__cos, cos)
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index 0f8974085b..7ecadccae8 100644
--- a/sysdeps/ieee754/ldbl-96/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-96/s_erfl.c
@@ -335,8 +335,9 @@ __erfl (long double x)
   else
     return r / x - one;
 }
-
+libm_hidden_def (__erfl)
 libm_alias_ldouble (__erf, erf)
+
 long double
 __erfcl (long double x)
 {
@@ -448,5 +449,5 @@ __erfcl (long double x)
 	return two - tiny;
     }
 }
-
+libm_hidden_def (__erfcl)
 libm_alias_ldouble (__erfc, erfc)
diff --git a/sysdeps/ieee754/ldbl-96/s_frexpl.c b/sysdeps/ieee754/ldbl-96/s_frexpl.c
index 7c31ed9936..98757f169b 100644
--- a/sysdeps/ieee754/ldbl-96/s_frexpl.c
+++ b/sysdeps/ieee754/ldbl-96/s_frexpl.c
@@ -59,4 +59,5 @@ long double __frexpl(long double x, int *eptr)
 	SET_LDOUBLE_EXP(x,se);
 	return x;
 }
+libm_hidden_def (__frexpl)
 libm_alias_ldouble (__frexp, frexp)
diff --git a/sysdeps/ieee754/ldbl-96/s_nextupl.c b/sysdeps/ieee754/ldbl-96/s_nextupl.c
index a1ca1fecee..13ade2d6a5 100644
--- a/sysdeps/ieee754/ldbl-96/s_nextupl.c
+++ b/sysdeps/ieee754/ldbl-96/s_nextupl.c
@@ -81,5 +81,5 @@ __nextupl (long double x)
   SET_LDOUBLE_WORDS (x, esx, hx, lx);
   return x;
 }
-
+libm_hidden_def (__nextupl)
 libm_alias_ldouble (__nextup, nextup)
diff --git a/sysdeps/ieee754/ldbl-96/s_roundevenl.c b/sysdeps/ieee754/ldbl-96/s_roundevenl.c
index be2e4fa49e..f00600c981 100644
--- a/sysdeps/ieee754/ldbl-96/s_roundevenl.c
+++ b/sysdeps/ieee754/ldbl-96/s_roundevenl.c
@@ -123,4 +123,5 @@ __roundevenl (long double x)
   SET_LDOUBLE_WORDS (x, se, hx, lx);
   return x;
 }
+libm_hidden_def (__roundevenl)
 libm_alias_ldouble (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/ldbl-96/s_roundl.c b/sysdeps/ieee754/ldbl-96/s_roundl.c
index c5c304cb2e..4924b44b14 100644
--- a/sysdeps/ieee754/ldbl-96/s_roundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_roundl.c
@@ -90,4 +90,5 @@ __roundl (long double x)
   SET_LDOUBLE_WORDS (x, se, i0, i1);
   return x;
 }
+libm_hidden_def (__roundl)
 libm_alias_ldouble (__round, round)
diff --git a/sysdeps/ieee754/ldbl-96/s_signbitl.c b/sysdeps/ieee754/ldbl-96/s_signbitl.c
index 19953c180a..e86d3dc61b 100644
--- a/sysdeps/ieee754/ldbl-96/s_signbitl.c
+++ b/sysdeps/ieee754/ldbl-96/s_signbitl.c
@@ -24,3 +24,6 @@ __signbitl (long double x)
 {
   return __builtin_signbitl (x);
 }
+#if IS_IN (libc) || IS_IN (libm)
+hidden_def (__signbitl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_sincosl.c b/sysdeps/ieee754/ldbl-96/s_sincosl.c
index 355c25dba9..0648b2f31b 100644
--- a/sysdeps/ieee754/ldbl-96/s_sincosl.c
+++ b/sysdeps/ieee754/ldbl-96/s_sincosl.c
@@ -74,4 +74,5 @@ __sincosl (long double x, long double *sinx, long double *cosx)
 	}
     }
 }
+libm_hidden_def (__sincosl)
 libm_alias_ldouble (__sincos, sincos)
diff --git a/sysdeps/ieee754/ldbl-96/s_sinl.c b/sysdeps/ieee754/ldbl-96/s_sinl.c
index cfbe9bf153..01cdd0e3b5 100644
--- a/sysdeps/ieee754/ldbl-96/s_sinl.c
+++ b/sysdeps/ieee754/ldbl-96/s_sinl.c
@@ -86,4 +86,5 @@ long double __sinl(long double x)
 	    }
 	}
 }
+libm_hidden_def (__sinl)
 libm_alias_ldouble (__sin, sin)
diff --git a/sysdeps/m68k/strchrnul.S b/sysdeps/m68k/strchrnul.S
index ea157555c1..8dc25e7e13 100644
--- a/sysdeps/m68k/strchrnul.S
+++ b/sysdeps/m68k/strchrnul.S
@@ -263,5 +263,5 @@ L(L9:)
 	cfi_restore (R(d2))
 	rts
 END(__strchrnul)
-
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c
index a184b72586..2dd3857054 100644
--- a/sysdeps/mach/hurd/dirfd.c
+++ b/sysdeps/mach/hurd/dirfd.c
@@ -42,4 +42,5 @@ __dirfd (DIR *dirp)
   return fd;
 }
 
+libc_hidden_def (__dirfd)
 weak_alias (__dirfd, dirfd)
diff --git a/sysdeps/posix/dirfd.c b/sysdeps/posix/dirfd.c
index e09a45d717..c140da28ec 100644
--- a/sysdeps/posix/dirfd.c
+++ b/sysdeps/posix/dirfd.c
@@ -26,5 +26,5 @@ __dirfd (DIR *dirp)
 {
   return dirp->fd;
 }
-
+libc_hidden_def (__dirfd)
 weak_alias (__dirfd, dirfd)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c
index 46e20df350..b1d493852a 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c
@@ -30,7 +30,7 @@ libc_ifunc (__memrchr,
 	    (hwcap & PPC_FEATURE_HAS_VSX)
             ? __memrchr_power7
             : __memrchr_ppc);
-
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
 #else
 #include <string/memrchr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c
index 527160f7eb..83635e8e8c 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c
@@ -30,7 +30,7 @@ libc_ifunc (__strchrnul,
 	    (hwcap & PPC_FEATURE_HAS_VSX)
             ? __strchrnul_power7
             : __strchrnul_ppc);
-
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
 #else
 #include <string/strchrnul.c>
diff --git a/sysdeps/powerpc/powerpc32/power7/memrchr.S b/sysdeps/powerpc/powerpc32/power7/memrchr.S
index aedae95914..31d6c51c48 100644
--- a/sysdeps/powerpc/powerpc32/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc32/power7/memrchr.S
@@ -194,3 +194,4 @@ L(loop_small):
 END (__memrchr)
 weak_alias (__memrchr, memrchr)
 libc_hidden_builtin_def (memrchr)
+libc_hidden_builtin_def (__memrchr)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
index 48be9515e4..973c800981 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
@@ -33,7 +33,7 @@ libc_ifunc (__memrchr,
 	      (hwcap & PPC_FEATURE_HAS_VSX)
 	      ? __memrchr_power7
 	    : __memrchr_ppc);
-
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
 #else
 #include <string/memrchr.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
index ead31f791c..fe6aeb4a8b 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
@@ -33,7 +33,7 @@ libc_ifunc (__strchrnul,
 	    (hwcap & PPC_FEATURE_HAS_VSX)
             ? __strchrnul_power7
             : __strchrnul_ppc);
-
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
 #else
 #include <string/strchrnul.c>
diff --git a/sysdeps/powerpc/powerpc64/power7/memrchr.S b/sysdeps/powerpc/powerpc64/power7/memrchr.S
index 583d513c4c..ea88825d07 100644
--- a/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -199,3 +199,4 @@ L(loop_small):
 END (MEMRCHR)
 weak_alias (__memrchr, memrchr)
 libc_hidden_builtin_def (memrchr)
+libc_hidden_builtin_def (__memrchr)
diff --git a/sysdeps/powerpc/powerpc64/power8/memrchr.S b/sysdeps/powerpc/powerpc64/power8/memrchr.S
index 54de6566bd..21a6a70cef 100644
--- a/sysdeps/powerpc/powerpc64/power8/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/memrchr.S
@@ -343,3 +343,4 @@ L(loop_small):
 END (MEMRCHR)
 weak_alias (__memrchr, memrchr)
 libc_hidden_builtin_def (memrchr)
+libc_hidden_builtin_def (__memrchr)
diff --git a/sysdeps/powerpc/powerpc64/power8/strchr.S b/sysdeps/powerpc/powerpc64/power8/strchr.S
index c5e28d9c9e..df7fa88a27 100644
--- a/sysdeps/powerpc/powerpc64/power8/strchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strchr.S
@@ -371,7 +371,11 @@ L(end1):
 	blr
 END (FUNC_NAME)
 
-#ifndef USE_AS_STRCHRNUL
+#ifdef USE_AS_STRCHRNUL
+#ifndef STRCHRNUL
+libc_hidden_builtin_def (__strchrnul)
+#endif
+#else
 weak_alias (strchr, index)
 libc_hidden_builtin_def (strchr)
 #endif
diff --git a/sysdeps/s390/multiarch/memrchr.c b/sysdeps/s390/multiarch/memrchr.c
index 43a44abcf6..4307a1ad32 100644
--- a/sysdeps/s390/multiarch/memrchr.c
+++ b/sysdeps/s390/multiarch/memrchr.c
@@ -21,6 +21,7 @@
 # include <ifunc-resolve.h>
 
 s390_vx_libc_ifunc (__memrchr)
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
 
 #else
diff --git a/sysdeps/s390/multiarch/strchrnul.c b/sysdeps/s390/multiarch/strchrnul.c
index 62dfc6bd90..35e9c5d6d0 100644
--- a/sysdeps/s390/multiarch/strchrnul.c
+++ b/sysdeps/s390/multiarch/strchrnul.c
@@ -21,6 +21,7 @@
 # include <ifunc-resolve.h>
 
 s390_vx_libc_ifunc (__strchrnul)
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
 
 #else
diff --git a/sysdeps/s390/multiarch/wcslen.c b/sysdeps/s390/multiarch/wcslen.c
index 3a1d1a32c9..ad767728e5 100644
--- a/sysdeps/s390/multiarch/wcslen.c
+++ b/sysdeps/s390/multiarch/wcslen.c
@@ -21,6 +21,7 @@
 # include <ifunc-resolve.h>
 
 s390_vx_libc_ifunc (__wcslen)
+libc_hidden_def (__wcslen)
 weak_alias (__wcslen, wcslen)
 
 #else
diff --git a/sysdeps/s390/multiarch/wcsnlen.c b/sysdeps/s390/multiarch/wcsnlen.c
index 5234074b1f..025e8d537d 100644
--- a/sysdeps/s390/multiarch/wcsnlen.c
+++ b/sysdeps/s390/multiarch/wcsnlen.c
@@ -21,6 +21,7 @@
 # include <ifunc-resolve.h>
 
 s390_vx_libc_ifunc (__wcsnlen)
+libc_hidden_def (__wcsnlen)
 weak_alias (__wcsnlen, wcsnlen)
 
 #else
diff --git a/sysdeps/tile/strchrnul.c b/sysdeps/tile/strchrnul.c
index 2f425a2ff3..6c76ecb89b 100644
--- a/sysdeps/tile/strchrnul.c
+++ b/sysdeps/tile/strchrnul.c
@@ -61,4 +61,5 @@ __strchrnul (const char *s, int c)
     g = z;
   return ((char *) p) + (g >> 3);
 }
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/unix/sysv/linux/arm/umount.c b/sysdeps/unix/sysv/linux/arm/umount.c
index 87997e029f..fcf3a51fc1 100644
--- a/sysdeps/unix/sysv/linux/arm/umount.c
+++ b/sysdeps/unix/sysv/linux/arm/umount.c
@@ -19,7 +19,7 @@
 /* Since we don't have an oldumount system call, do what the kernel
    does down here.  */
 
-extern long int __umount2 (const char *name, int flags);
+#include <mount-internal.h>
 
 long int
 __umount (const char *name)
diff --git a/sysdeps/unix/sysv/linux/generic/umount.c b/sysdeps/unix/sysv/linux/generic/umount.c
index 1c8bea55e0..d64272c6bb 100644
--- a/sysdeps/unix/sysv/linux/generic/umount.c
+++ b/sysdeps/unix/sysv/linux/generic/umount.c
@@ -19,7 +19,7 @@
 /* Since the generic Linux syscall ABI doesn't have an oldumount system call,
    do what the kernel does down here.  */
 
-extern long int __umount2 (const char *name, int flags);
+#include <mount-internal.h>
 
 long int
 __umount (const char *name)
diff --git a/sysdeps/unix/sysv/linux/glob-lstat-compat.c b/sysdeps/unix/sysv/linux/glob-lstat-compat.c
index 64dab9af52..e5a534027f 100644
--- a/sysdeps/unix/sysv/linux/glob-lstat-compat.c
+++ b/sysdeps/unix/sysv/linux/glob-lstat-compat.c
@@ -21,9 +21,23 @@
 #include <kernel_stat.h>
 #include <shlib-compat.h>
 
+#ifndef GLOB_LSTAT_VERSION
+# define GLOB_LSTAT_VERSION GLIBC_2_0
+#endif
+
+#if SHLIB_COMPAT(libc, GLOB_LSTAT_VERSION, GLIBC_2_27)
+
+#if XSTAT_IS_XSTAT64
 #define glob64 __no_glob64_decl
+#define __glob64 __no___glob64_decl
+#define __glob64_lstat_compat __no_glob64_lstat_compat_decl
+#endif
+
 #include <glob.h>
+
 #undef glob64
+#undef __glob64
+#undef __glob64_lstat_compat
 
 #define __glob __glob_lstat_compat
 
@@ -33,12 +47,7 @@
 #define GLOB_NO_LSTAT
 
 #include <posix/glob.c>
-
-#ifndef GLOB_LSTAT_VERSION
-# define GLOB_LSTAT_VERSION GLIBC_2_0
-#endif
-
-#if SHLIB_COMPAT(libc, GLOB_LSTAT_VERSION, GLIBC_2_27)
+libc_hidden_def (__glob_lstat_compat)
 compat_symbol (libc, __glob_lstat_compat, glob, GLOB_LSTAT_VERSION);
 # if XSTAT_IS_XSTAT64
 strong_alias (__glob_lstat_compat, __glob64_lstat_compat)
diff --git a/sysdeps/unix/sysv/linux/glob64-lstat-compat.c b/sysdeps/unix/sysv/linux/glob64-lstat-compat.c
index 4475e0091c..66334e7009 100644
--- a/sysdeps/unix/sysv/linux/glob64-lstat-compat.c
+++ b/sysdeps/unix/sysv/linux/glob64-lstat-compat.c
@@ -21,6 +21,8 @@
 #include <kernel_stat.h>
 
 #if !XSTAT_IS_XSTAT64
+# if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_27)
+
 # include <glob.h>
 # include <dirent.h>
 # include <sys/stat.h>
@@ -45,12 +47,14 @@
 
 # include <posix/glob.c>
 
-# if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_27)
+libc_hidden_def (__glob64_lstat_compat)
+
 #  ifndef GLOB_NO_OLD_VERSION
 #   define GLOB_LSTAT_START_VER GLIBC_2_2
 #  else
 #   define GLOB_LSTAT_START_VER GLIBC_2_1
 #  endif
 compat_symbol (libc, __glob64_lstat_compat, glob64, GLOB_LSTAT_START_VER);
-# endif
-#endif /* XSTAT_IS_XSTAT64  */
+
+# endif /* SHLIB_COMPAT */
+#endif /* XSTAT_IS_XSTAT64 */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 56f4138c43..bd39441d3c 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -1,7 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-umount2		-	umount		2	__umount2	umount2
-
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/umount.c b/sysdeps/unix/sysv/linux/mips/mips64/umount.c
index 87997e029f..fcf3a51fc1 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/umount.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/umount.c
@@ -19,7 +19,7 @@
 /* Since we don't have an oldumount system call, do what the kernel
    does down here.  */
 
-extern long int __umount2 (const char *name, int flags);
+#include <mount-internal.h>
 
 long int
 __umount (const char *name)
diff --git a/sysdeps/unix/sysv/linux/umount2.S b/sysdeps/unix/sysv/linux/umount2.S
index 92241bbf97..2f14095a17 100644
--- a/sysdeps/unix/sysv/linux/umount2.S
+++ b/sysdeps/unix/sysv/linux/umount2.S
@@ -9,5 +9,6 @@ PSEUDO (__umount2, umount2, 2)
 #endif
 	ret
 PSEUDO_END(__umount2)
+libc_hidden_def (__umount2)
 weak_alias (__umount2, umount2)
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/compat-timer.h b/sysdeps/unix/sysv/linux/x86_64/compat-timer.h
index ba4f0b39da..21dc48de24 100644
--- a/sysdeps/unix/sysv/linux/x86_64/compat-timer.h
+++ b/sysdeps/unix/sysv/linux/x86_64/compat-timer.h
@@ -16,6 +16,9 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _COMPAT_TIMER_H
+#define _COMPAT_TIMER_H 1
+
 #include <signal.h>
 #include <time.h>
 #include <sys/types.h>
@@ -27,12 +30,17 @@ extern timer_t __compat_timer_list[OLD_TIMER_MAX] attribute_hidden;
 
 extern int __timer_create_new (clockid_t clock_id, struct sigevent *evp,
 			       timer_t *timerid);
+librt_hidden_proto (__timer_create_new)
 extern int __timer_delete_new (timer_t timerid);
+librt_hidden_proto (__timer_delete_new)
 extern int __timer_getoverrun_new (timer_t timerid);
+librt_hidden_proto (__timer_getoverrun_new)
 extern int __timer_gettime_new (timer_t timerid, struct itimerspec *value);
+librt_hidden_proto (__timer_gettime_new)
 extern int __timer_settime_new (timer_t timerid, int flags,
 				const struct itimerspec *value,
 				struct itimerspec *ovalue);
+librt_hidden_proto (__timer_settime_new)
 
 
 extern int __timer_create_old (clockid_t clock_id, struct sigevent *evp,
@@ -43,3 +51,5 @@ extern int __timer_gettime_old (int timerid, struct itimerspec *value);
 extern int __timer_settime_old (int timerid, int flags,
 				const struct itimerspec *value,
 				struct itimerspec *ovalue);
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_create.c b/sysdeps/unix/sysv/linux/x86_64/timer_create.c
index b96b2b49d3..2676b22fe7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_create.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_create.c
@@ -25,6 +25,7 @@
 #include <sysdeps/unix/sysv/linux/timer_create.c>
 
 #undef timer_create
+librt_hidden_def (__timer_create_new)
 versioned_symbol (librt, __timer_create_new, timer_create, GLIBC_2_3_3);
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_delete.c b/sysdeps/unix/sysv/linux/x86_64/timer_delete.c
index f0fc3a4a78..1c291ff22f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_delete.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_delete.c
@@ -24,6 +24,7 @@
 #include <sysdeps/unix/sysv/linux/timer_delete.c>
 
 #undef timer_delete
+librt_hidden_def (__timer_delete_new)
 versioned_symbol (librt, __timer_delete_new, timer_delete, GLIBC_2_3_3);
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c b/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c
index b027f56df3..46b8f6eb35 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c
@@ -24,6 +24,7 @@
 #include <sysdeps/unix/sysv/linux/timer_getoverr.c>
 
 #undef timer_getoverrun
+librt_hidden_def (__timer_getoverrun_new)
 versioned_symbol (librt, __timer_getoverrun_new, timer_getoverrun,
 		  GLIBC_2_3_3);
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
index 7730bc9447..7e8ec053e9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
@@ -24,6 +24,7 @@
 #include <sysdeps/unix/sysv/linux/timer_gettime.c>
 
 #undef timer_gettime
+librt_hidden_def (__timer_gettime_new)
 versioned_symbol (librt, __timer_gettime_new, timer_gettime, GLIBC_2_3_3);
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
index 26178a8020..489580e318 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
@@ -24,6 +24,7 @@
 #include <sysdeps/unix/sysv/linux/timer_settime.c>
 
 #undef timer_settime
+librt_hidden_def (__timer_settime_new)
 versioned_symbol (librt, __timer_settime_new, timer_settime, GLIBC_2_3_3);
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/umount.c b/sysdeps/unix/sysv/linux/x86_64/umount.c
index 9030774776..235fe1c105 100644
--- a/sysdeps/unix/sysv/linux/x86_64/umount.c
+++ b/sysdeps/unix/sysv/linux/x86_64/umount.c
@@ -19,9 +19,9 @@
 /* Since we don't have an oldumount system call, do what the kernel
    does down here.  */
 
-extern long int __umount2 (const char *name, int flags);
+#include <mount-internal.h>
 
-long int
+int
 __umount (const char *name)
 {
   return __umount2 (name, 0);
diff --git a/sysdeps/unix/sysv/mount-internal.h b/sysdeps/unix/sysv/mount-internal.h
new file mode 100644
index 0000000000..7f8e42a337
--- /dev/null
+++ b/sysdeps/unix/sysv/mount-internal.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _MOUNT_INTERNAL_H
+#define _MOUNT_INTERNAL_H 1
+
+#include <sys/mount.h>
+
+extern typeof (umount2) __umount2;
+libc_hidden_proto (__umount2);
+
+#endif
diff --git a/sysdeps/x86/fpu/include/bits/fenv.h b/sysdeps/x86/fpu/include/bits/fenv.h
index 3d2483b0bf..355e592f0f 100644
--- a/sysdeps/x86/fpu/include/bits/fenv.h
+++ b/sysdeps/x86/fpu/include/bits/fenv.h
@@ -18,9 +18,12 @@
 
 #ifndef _BITS_FENV_H
 
-#if defined _LIBC && defined __USE_EXTERN_INLINES
+/* The installed version of bits/fenv.h only declares
+   __feraiseexcept_renamed when _LIBC is not defined.  */
+#if defined __USE_EXTERN_INLINES && defined _LIBC
 # if defined SHARED && !defined NO_HIDDEN && IS_IN (libm)
-extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), __GI_feraiseexcept);
+extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int),
+                           __GI_feraiseexcept) attribute_hidden;
 # else
 extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
 # endif
@@ -28,15 +31,13 @@ extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
 
 #include_next <bits/fenv.h>
 
-# ifndef _ISOMAC
+#if defined __USE_EXTERN_INLINES && !defined _ISOMAC
 
 /* Ensure __feraiseexcept calls in glibc are optimized the same as
    feraiseexcept calls.  */
 
-#ifdef __USE_EXTERN_INLINES
 __BEGIN_DECLS
 
-extern int __REDIRECT_NTH (____feraiseexcept_renamed, (int), __feraiseexcept);
 __extern_inline int
 __NTH (__feraiseexcept (int __excepts))
 {
@@ -47,11 +48,10 @@ __NTH (__feraiseexcept (int __excepts))
       return 0;
     }
 
-  return ____feraiseexcept_renamed (__excepts);
+  return __feraiseexcept_renamed (__excepts);
 }
 
 __END_DECLS
-#endif
 
-# endif /* _ISOMAC */
+#endif /* __USE_EXTERN_INLINES && !_ISOMAC */
 #endif /* bits/fenv.h */
diff --git a/sysdeps/x86_64/fpu/multiarch/e_log-avx.c b/sysdeps/x86_64/fpu/multiarch/e_log-avx.c
index b22a5767be..bbd019b528 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_log-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_log-avx.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __ieee754_log __ieee754_log_avx
 #define SECTION __attribute__ ((section (".text.avx")))
 
diff --git a/sysdeps/x86_64/fpu/multiarch/e_log-fma.c b/sysdeps/x86_64/fpu/multiarch/e_log-fma.c
index bce0ee03c2..4e9fbb8990 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_log-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_log-fma.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __ieee754_log __ieee754_log_fma
 #define SECTION __attribute__ ((section (".text.fma")))
 
diff --git a/sysdeps/x86_64/fpu/multiarch/e_log-fma4.c b/sysdeps/x86_64/fpu/multiarch/e_log-fma4.c
index f458f9c23c..18fb2403a0 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_log-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_log-fma4.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __ieee754_log __ieee754_log_fma4
 #define SECTION __attribute__ ((section (".text.fma4")))
 
diff --git a/sysdeps/x86_64/fpu/multiarch/e_logf-fma.c b/sysdeps/x86_64/fpu/multiarch/e_logf-fma.c
index a47fd8195f..445c0e851e 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_logf-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_logf-fma.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __logf __logf_fma
 
 #include <sysdeps/ieee754/flt-32/e_logf.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/e_powf.c b/sysdeps/x86_64/fpu/multiarch/e_powf.c
index a185006f40..4caad1a50d 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_powf.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_powf.c
@@ -16,12 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-#define powf __redirect_powf
-#define __DECL_SIMD___redirect_powf
-#include <math.h>
-#undef powf
+extern typeof (__powf) __redirect_powf;
 
 #define SYMBOL_NAME powf
 #include "ifunc-fma.h"
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan-avx.c b/sysdeps/x86_64/fpu/multiarch/s_atan-avx.c
index 41816bfe6c..b8a4e0877a 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan-avx.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __atan __atan_avx
 #define __add __add_avx
 #define __dbl_mp __dbl_mp_avx
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan-fma.c b/sysdeps/x86_64/fpu/multiarch/s_atan-fma.c
index 363e32bcbd..63d2728bed 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan-fma.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __atan __atan_fma
 #define __add __add_fma
 #define __dbl_mp __dbl_mp_fma
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c
index ad8d3af579..ebf49e3333 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __atan __atan_fma4
 #define __add __add_fma4
 #define __dbl_mp __dbl_mp_fma4
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c
index f9ce8549ab..20a95da859 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
 extern double __redirect_atan (double);
@@ -24,6 +25,7 @@ extern double __redirect_atan (double);
 #include "ifunc-avx-fma4.h"
 
 libc_ifunc_redirected (__redirect_atan, __atan, IFUNC_SELECTOR ());
+libm_hidden_def (__atan)
 libm_alias_double (__atan, atan)
 
 #define __atan __atan_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c b/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
index 6a5ea3ff27..094f946d41 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
@@ -1,2 +1,3 @@
+#include <math.h>
 #define __ceil __ceil_c
 #include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil.c b/sysdeps/x86_64/fpu/multiarch/s_ceil.c
index 070fcdddea..99bf8cc301 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceil.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
-#define ceil __redirect_ceil
-#define __ceil __redirect___ceil
-#include <math.h>
-#undef ceil
-#undef __ceil
+extern typeof (__ceil) __redirect_ceil;
 
 #define SYMBOL_NAME ceil
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_ceil, __ceil, IFUNC_SELECTOR ());
+libm_hidden_def (__ceil)
 libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceilf.c b/sysdeps/x86_64/fpu/multiarch/s_ceilf.c
index db0c6c4bc3..b35af7bf0b 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_ceilf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceilf.c
@@ -17,15 +17,13 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <libm-alias-float.h>
-
-#define ceilf __redirect_ceilf
-#define __ceilf __redirect___ceilf
 #include <math.h>
-#undef ceilf
-#undef __ceilf
+
+extern typeof (__ceilf) __redirect_ceilf;
 
 #define SYMBOL_NAME ceilf
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_ceilf, __ceilf, IFUNC_SELECTOR ());
+libm_hidden_def (__ceilf)
 libm_alias_float (__ceil, ceil)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_cosf.c b/sysdeps/x86_64/fpu/multiarch/s_cosf.c
index 33959d3d01..ef93242b75 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_cosf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_cosf.c
@@ -16,13 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-extern float __redirect_cosf (float);
+extern typeof (__cosf) __redirect_cosf;
 
 #define SYMBOL_NAME cosf
 #include "ifunc-fma.h"
 
 libc_ifunc_redirected (__redirect_cosf, __cosf, IFUNC_SELECTOR ());
-
+libm_hidden_def (__cosf)
 libm_alias_float (__cos, cos)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor-c.c b/sysdeps/x86_64/fpu/multiarch/s_floor-c.c
index 68733b69ef..8a1b5eb7a2 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_floor-c.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_floor-c.c
@@ -1,3 +1,4 @@
+#include <math.h>
 #undef __floor
 #define __floor __floor_c
 #include <sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor.c b/sysdeps/x86_64/fpu/multiarch/s_floor.c
index 58f8ed8eaf..cbcab2d419 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_floor.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_floor.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
-#define floor __redirect_floor
-#define __floor __redirect___floor
-#include <math.h>
-#undef floor
-#undef __floor
+extern typeof (__floor) __redirect_floor;
 
 #define SYMBOL_NAME floor
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_floor, __floor, IFUNC_SELECTOR ());
+libm_hidden_def (__floor)
 libm_alias_double (__floor, floor)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floorf.c b/sysdeps/x86_64/fpu/multiarch/s_floorf.c
index 5ef2fec2e3..c73a3c0fc6 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_floorf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_floorf.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-#define floorf __redirect_floorf
-#define __floorf __redirect___floorf
-#include <math.h>
-#undef floorf
-#undef __floorf
+extern typeof (__floorf) __redirect_floorf;
 
 #define SYMBOL_NAME floorf
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_floorf, __floorf, IFUNC_SELECTOR ());
+libm_hidden_def (__floorf)
 libm_alias_float (__floor, floor)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c b/sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c
index f897a2a6a6..35b36ef102 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c
@@ -1,3 +1,8 @@
+#include <math.h>
+
+extern typeof (__nearbyint) __nearbyint_c;
+libm_hidden_proto (__nearbyint_c)
+
 #undef __nearbyint
 #define __nearbyint __nearbyint_c
 #include <sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c b/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c
index d92945fd14..d55bd0ec29 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c
@@ -16,17 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
-#define nearbyint __redirect_nearbyint
-#define __nearbyint __redirect___nearbyint
-#include <math.h>
-#undef nearbyint
-#undef __nearbyint
+extern typeof (__nearbyint) __redirect_nearbyint;
 
 #define SYMBOL_NAME nearbyint
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_nearbyint, __nearbyint,
 		       IFUNC_SELECTOR ());
+libm_hidden_def (__nearbyint)
 libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c
index ba7be27956..1524633ac2 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c
@@ -16,17 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-#define nearbyintf __redirect_nearbyintf
-#define __nearbyintf __redirect___nearbyintf
-#include <math.h>
-#undef nearbyintf
-#undef __nearbyintf
+extern typeof (__nearbyintf) __redirect_nearbyintf;
 
 #define SYMBOL_NAME nearbyintf
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_nearbyintf, __nearbyintf,
 		       IFUNC_SELECTOR ());
+libm_hidden_def (__nearbyintf)
 libm_alias_float (__nearbyint, nearbyint)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint-c.c b/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
index 162a630ff9..7a0757ae7a 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
@@ -1,3 +1,4 @@
+#include <math.h>
 #undef __rint
 #define __rint __rint_c
 #include <sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint.c b/sysdeps/x86_64/fpu/multiarch/s_rint.c
index f1cb2fed0c..2e96907aff 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_rint.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_rint.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
-#define rint __redirect_rint
-#define __rint __redirect___rint
-#include <math.h>
-#undef rint
-#undef __rint
+extern typeof (__rint) __redirect_rint;
 
 #define SYMBOL_NAME rint
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_rint, __rint, IFUNC_SELECTOR ());
+libm_hidden_def (__rint)
 libm_alias_double (__rint, rint)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_rintf.c b/sysdeps/x86_64/fpu/multiarch/s_rintf.c
index 41323b3b5b..011c7effa0 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_rintf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_rintf.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-#define rintf __redirect_rintf
-#define __rintf __redirect___rintf
-#include <math.h>
-#undef rintf
-#undef __rintf
+extern typeof (__rintf) __redirect_rintf;
 
 #define SYMBOL_NAME rintf
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_rintf, __rintf, IFUNC_SELECTOR ());
+libm_hidden_def (__rintf)
 libm_alias_float (__rint, rint)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c b/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
index e1c6de0259..1ad90c0878 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __cos __cos_avx
 #define __sin __sin_avx
 #define SECTION __attribute__ ((section (".text.avx")))
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c b/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
index 15f3c394d5..5768f95ac0 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __cos __cos_fma
 #define __sin __sin_fma
 #define __docos __docos_fma
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
index 4c35739dc9..dc131ef11d 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
 #define __cos __cos_fma4
 #define __sin __sin_fma4
 #define __docos __docos_fma4
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c
index b289269240..09209b209a 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
 extern double __redirect_sin (double);
@@ -25,6 +26,7 @@ extern double __redirect_cos (double);
 #include "ifunc-avx-fma4.h"
 
 libc_ifunc_redirected (__redirect_sin, __sin, IFUNC_SELECTOR ());
+libm_hidden_def (__sin)
 libm_alias_double (__sin, sin)
 
 #undef SYMBOL_NAME
@@ -32,6 +34,7 @@ libm_alias_double (__sin, sin)
 #include "ifunc-avx-fma4.h"
 
 libc_ifunc_redirected (__redirect_cos, __cos, IFUNC_SELECTOR ());
+libm_hidden_def (__cos)
 libm_alias_double (__cos, cos)
 
 #define __cos __cos_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sincosf.c b/sysdeps/x86_64/fpu/multiarch/s_sincosf.c
index 6cb4295558..ab4b1503f7 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sincosf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sincosf.c
@@ -16,13 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-extern void __redirect_sincosf (float, float *, float *);
+extern typeof (__sincosf) __redirect_sincosf;
 
 #define SYMBOL_NAME sincosf
 #include "ifunc-fma.h"
 
 libc_ifunc_redirected (__redirect_sincosf, __sincosf, IFUNC_SELECTOR ());
-
+libm_hidden_def (__sincosf)
 libm_alias_float (__sincos, sincos)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sinf.c b/sysdeps/x86_64/fpu/multiarch/s_sinf.c
index 4fdfbd8d3e..705a6a68f4 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sinf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sinf.c
@@ -16,13 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-extern float __redirect_sinf (float);
+extern typeof (__sinf) __redirect_sinf;
 
 #define SYMBOL_NAME sinf
 #include "ifunc-fma.h"
 
 libc_ifunc_redirected (__redirect_sinf, __sinf, IFUNC_SELECTOR ());
-
+libm_hidden_def (__sinf)
 libm_alias_float (__sin, sin)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_trunc-c.c b/sysdeps/x86_64/fpu/multiarch/s_trunc-c.c
index 6204ae3c77..e28a328df7 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_trunc-c.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_trunc-c.c
@@ -1,2 +1,3 @@
+#include <math.h>
 #define __trunc __trunc_c
 #include <sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_trunc.c b/sysdeps/x86_64/fpu/multiarch/s_trunc.c
index a1b0c60630..7cb576a1a4 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_trunc.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_trunc.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-double.h>
 
-#define trunc __redirect_trunc
-#define __trunc __redirect___trunc
-#include <math.h>
-#undef trunc
-#undef __trunc
+extern typeof (__trunc) __redirect_trunc;
 
 #define SYMBOL_NAME trunc
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_trunc, __trunc, IFUNC_SELECTOR ());
+libm_hidden_def (__trunc)
 libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_truncf.c b/sysdeps/x86_64/fpu/multiarch/s_truncf.c
index a7e220bd0c..0bd7e6ce06 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_truncf.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_truncf.c
@@ -16,16 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <math.h>
 #include <libm-alias-float.h>
 
-#define truncf __redirect_truncf
-#define __truncf __redirect___truncf
-#include <math.h>
-#undef truncf
-#undef __truncf
+extern typeof (__truncf) __redirect_truncf;
 
 #define SYMBOL_NAME truncf
 #include "ifunc-sse4_1.h"
 
 libc_ifunc_redirected (__redirect_truncf, __truncf, IFUNC_SELECTOR ());
+libm_hidden_def (__truncf)
 libm_alias_float (__trunc, trunc)
diff --git a/sysdeps/x86_64/fpu/s_ceill.S b/sysdeps/x86_64/fpu/s_ceill.S
index 8f2bd351f6..981190ea4c 100644
--- a/sysdeps/x86_64/fpu/s_ceill.S
+++ b/sysdeps/x86_64/fpu/s_ceill.S
@@ -34,4 +34,5 @@ ENTRY(__ceill)
 
 	ret
 END (__ceill)
+libm_hidden_def (__ceill)
 libm_alias_ldouble (__ceil, ceil)
diff --git a/sysdeps/x86_64/fpu/s_floorl.S b/sysdeps/x86_64/fpu/s_floorl.S
index 75f8255648..6fd367dd82 100644
--- a/sysdeps/x86_64/fpu/s_floorl.S
+++ b/sysdeps/x86_64/fpu/s_floorl.S
@@ -33,4 +33,5 @@ ENTRY(__floorl)
 
 	ret
 END (__floorl)
+libm_hidden_def (__floorl)
 libm_alias_ldouble (__floor, floor)
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
index 947e5e4552..e263afb02d 100644
--- a/sysdeps/x86_64/fpu/s_log1pl.S
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -72,3 +72,4 @@ ENTRY(__log1pl)
 	ret
 
 END (__log1pl)
+libm_hidden_def (__log1pl)
diff --git a/sysdeps/x86_64/fpu/s_scalbnl.S b/sysdeps/x86_64/fpu/s_scalbnl.S
index 6c7683c32b..fb40ce54dd 100644
--- a/sysdeps/x86_64/fpu/s_scalbnl.S
+++ b/sysdeps/x86_64/fpu/s_scalbnl.S
@@ -15,3 +15,6 @@ ENTRY(__scalbnl)
 	fstp	%st(1)
 	ret
 END (__scalbnl)
+#if IS_IN (libc) || IS_IN (libm)
+hidden_def (__scalbnl)
+#endif
diff --git a/sysdeps/x86_64/fpu/s_sincosf.S b/sysdeps/x86_64/fpu/s_sincosf.S
index 2086e8ca5c..6a6ecb7177 100644
--- a/sysdeps/x86_64/fpu/s_sincosf.S
+++ b/sysdeps/x86_64/fpu/s_sincosf.S
@@ -562,5 +562,6 @@ L(SP_ONE):
 	ASM_SIZE_DIRECTIVE(L(SP_ONE))
 
 #ifndef __sincosf
+libm_hidden_def (__sincosf)
 libm_alias_float (__sincos, sincos)
 #endif
diff --git a/sysdeps/x86_64/fpu/s_truncl.S b/sysdeps/x86_64/fpu/s_truncl.S
index 22427ece00..89c036318d 100644
--- a/sysdeps/x86_64/fpu/s_truncl.S
+++ b/sysdeps/x86_64/fpu/s_truncl.S
@@ -34,4 +34,5 @@ ENTRY(__truncl)
 	fldenv	-28(%rsp)
 	ret
 END(__truncl)
+libm_hidden_def (__truncl)
 libm_alias_ldouble (__trunc, trunc)
diff --git a/sysdeps/x86_64/memrchr.S b/sysdeps/x86_64/memrchr.S
index b8e3fa1d87..bde2e4f7ab 100644
--- a/sysdeps/x86_64/memrchr.S
+++ b/sysdeps/x86_64/memrchr.S
@@ -377,4 +377,5 @@ L(length_less16_part2_return):
 	ret
 
 END (__memrchr)
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
diff --git a/sysdeps/x86_64/multiarch/memrchr.c b/sysdeps/x86_64/multiarch/memrchr.c
index d227fe7819..82d585218f 100644
--- a/sysdeps/x86_64/multiarch/memrchr.c
+++ b/sysdeps/x86_64/multiarch/memrchr.c
@@ -17,15 +17,17 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+# include <string.h>
+
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define memrchr __redirect_memrchr
-# include <string.h>
-# undef memrchr
+
+extern typeof (__memrchr) __redirect_memrchr;
 
 # define SYMBOL_NAME memrchr
 # include "ifunc-avx2.h"
 
 libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ());
+libc_hidden_def (__memrchr)
 weak_alias (__memrchr, memrchr)
 #endif
diff --git a/sysdeps/x86_64/multiarch/strchrnul.c b/sysdeps/x86_64/multiarch/strchrnul.c
index 7514999341..a2c4155c64 100644
--- a/sysdeps/x86_64/multiarch/strchrnul.c
+++ b/sysdeps/x86_64/multiarch/strchrnul.c
@@ -17,18 +17,18 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <string.h>
+
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define strchrnul __redirect_strchrnul
-# define __strchrnul __redirect___strchrnul
-# include <string.h>
-# undef __strchrnul
-# undef strchrnul
+
+extern typeof (__strchrnul) __redirect_strchrnul;
 
 # define SYMBOL_NAME strchrnul
 # include "ifunc-avx2.h"
 
 libc_ifunc_redirected (__redirect_strchrnul, __strchrnul,
 		       IFUNC_SELECTOR ());
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
 #endif
diff --git a/sysdeps/x86_64/multiarch/strncase.c b/sysdeps/x86_64/multiarch/strncase.c
index 798966cf3e..fb31961267 100644
--- a/sysdeps/x86_64/multiarch/strncase.c
+++ b/sysdeps/x86_64/multiarch/strncase.c
@@ -17,19 +17,19 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <string.h>
+
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define strncasecmp __redirect_strncasecmp
-# define __strncasecmp __redirect___strncasecmp
-# include <string.h>
-# undef strncasecmp
-# undef __strncasecmp
+
+extern typeof (__strncasecmp) __redirect_strncasecmp;
 
 # define SYMBOL_NAME strncasecmp
 # include "ifunc-strcasecmp.h"
 
 libc_ifunc_redirected (__redirect_strncasecmp, __strncasecmp,
 		       IFUNC_SELECTOR ());
-
+libc_hidden_def (__strncasecmp)
 weak_alias (__strncasecmp, strncasecmp)
+
 #endif
diff --git a/sysdeps/x86_64/multiarch/wcslen.c b/sysdeps/x86_64/multiarch/wcslen.c
index 6d06e47cbd..cdf9aecf0f 100644
--- a/sysdeps/x86_64/multiarch/wcslen.c
+++ b/sysdeps/x86_64/multiarch/wcslen.c
@@ -18,14 +18,17 @@
    <http://www.gnu.org/licenses/>.  */
 
 /* Define multiple versions only for the definition in libc.  */
+
+#include <wchar.h>
+
 #if IS_IN (libc)
-# define __wcslen __redirect_wcslen
-# include <wchar.h>
-# undef __wcslen
+
+extern typeof (__wcslen) __redirect_wcslen;
 
 # define SYMBOL_NAME wcslen
 # include "ifunc-avx2.h"
 
 libc_ifunc_redirected (__redirect_wcslen, __wcslen, IFUNC_SELECTOR ());
-weak_alias (__wcslen, wcslen);
+libc_hidden_def (__wcslen)
+weak_alias (__wcslen, wcslen)
 #endif
diff --git a/sysdeps/x86_64/multiarch/wcsnlen.c b/sysdeps/x86_64/multiarch/wcsnlen.c
index bd376057e3..efe16e3c74 100644
--- a/sysdeps/x86_64/multiarch/wcsnlen.c
+++ b/sysdeps/x86_64/multiarch/wcsnlen.c
@@ -18,10 +18,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 /* Define multiple versions only for the definition in libc.  */
+#include <wchar.h>
+
 #if IS_IN (libc)
-# define __wcsnlen __redirect_wcsnlen
-# include <wchar.h>
-# undef __wcsnlen
+
+extern typeof (__wcsnlen) __redirect_wcsnlen;
 
 # define SYMBOL_NAME wcsnlen
 # include <init-arch.h>
@@ -47,5 +48,6 @@ IFUNC_SELECTOR (void)
 }
 
 libc_ifunc_redirected (__redirect_wcsnlen, __wcsnlen, IFUNC_SELECTOR ());
-weak_alias (__wcsnlen, wcsnlen);
+libc_hidden_def (__wcsnlen)
+weak_alias (__wcsnlen, wcsnlen)
 #endif
diff --git a/sysdeps/x86_64/strchrnul.S b/sysdeps/x86_64/strchrnul.S
index 149f3a9ced..5f11f592a7 100644
--- a/sysdeps/x86_64/strchrnul.S
+++ b/sysdeps/x86_64/strchrnul.S
@@ -24,4 +24,5 @@
 #define AS_STRCHRNUL
 #include "strchr.S"
 
+libc_hidden_def (__strchrnul)
 weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/x86_64/wcslen.S b/sysdeps/x86_64/wcslen.S
index 9f5f723227..f84cbed198 100644
--- a/sysdeps/x86_64/wcslen.S
+++ b/sysdeps/x86_64/wcslen.S
@@ -234,5 +234,5 @@ L(exit_tail7):
 	ret
 
 END (__wcslen)
-
+libc_hidden_def (__wcslen)
 weak_alias(__wcslen, wcslen)
diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c
index e633faf797..35143ee537 100644
--- a/wcsmbs/wcpncpy.c
+++ b/wcsmbs/wcpncpy.c
@@ -83,5 +83,6 @@ __wcpncpy (wchar_t *dest, const wchar_t *src, size_t n)
 }
 
 #ifndef WCPNCPY
+libc_hidden_def (__wcpncpy)
 weak_alias (__wcpncpy, wcpncpy)
 #endif
diff --git a/wcsmbs/wcscat.c b/wcsmbs/wcscat.c
index 5fe4e02adc..31f5a7915e 100644
--- a/wcsmbs/wcscat.c
+++ b/wcsmbs/wcscat.c
@@ -49,5 +49,6 @@ __wcscat (wchar_t *dest, const wchar_t *src)
   return dest;
 }
 #ifndef WCSCAT
+libc_hidden_def (__wcscat)
 weak_alias (__wcscat, wcscat)
 #endif
diff --git a/wcsmbs/wcschrnul.c b/wcsmbs/wcschrnul.c
index af35da8ae3..90fe54d24d 100644
--- a/wcsmbs/wcschrnul.c
+++ b/wcsmbs/wcschrnul.c
@@ -34,5 +34,6 @@ __wcschrnul (const wchar_t *wcs, const wchar_t wc)
   return (wchar_t *) wcs;
 }
 #ifndef WCSCHRNUL
+libc_hidden_def (__wcschrnul)
 weak_alias (__wcschrnul, wcschrnul)
 #endif
diff --git a/wcsmbs/wcslen.c b/wcsmbs/wcslen.c
index cfb076e469..1a2a99da0d 100644
--- a/wcsmbs/wcslen.c
+++ b/wcsmbs/wcslen.c
@@ -42,5 +42,6 @@ __wcslen (const wchar_t *s)
   return len;
 }
 #ifndef WCSLEN
+libc_hidden_def (__wcslen)
 weak_alias (__wcslen, wcslen)
 #endif
diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c
index e9735854d2..c723dbb390 100644
--- a/wcsmbs/wcsncpy.c
+++ b/wcsmbs/wcsncpy.c
@@ -84,5 +84,6 @@ __wcsncpy (wchar_t *dest, const wchar_t *src, size_t n)
   return s;
 }
 #ifndef WCSNCPY
+libc_hidden_def (__wcsncpy)
 weak_alias (__wcsncpy, wcsncpy)
 #endif
diff --git a/wcsmbs/wcsnlen.c b/wcsmbs/wcsnlen.c
index d8f60a3b5a..2af8460a52 100644
--- a/wcsmbs/wcsnlen.c
+++ b/wcsmbs/wcsnlen.c
@@ -46,5 +46,6 @@ __wcsnlen (const wchar_t *s, size_t maxlen)
   return len;
 }
 #ifndef WCSNLEN
+libc_hidden_def (__wcsnlen)
 weak_alias (__wcsnlen, wcsnlen)
 #endif
diff --git a/wctype/wctrans.c b/wctype/wctrans.c
index 8396655a52..67a8592cb5 100644
--- a/wctype/wctrans.c
+++ b/wctype/wctrans.c
@@ -45,4 +45,5 @@ __wctrans (const char *property)
   i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
   return (wctrans_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
 }
+libc_hidden_def (__wctrans)
 weak_alias (__wctrans, wctrans)
diff --git a/wctype/wctype.c b/wctype/wctype.c
index 8db169a932..83fcbc6f83 100644
--- a/wctype/wctype.c
+++ b/wctype/wctype.c
@@ -45,4 +45,5 @@ __wctype (const char *property)
   i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + result;
   return (wctype_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
 }
+libc_hidden_def (__wctype)
 weak_alias (__wctype, wctype)