From af0172162f7c653cad6a11ed1c1a5459bc154465 Mon Sep 17 00:00:00 2001
From: "Peter S. Mazinger" <ps.m@gmx.net>
Date: Sat, 14 Jan 2006 00:58:03 +0000
Subject: hidden_def/hidden_proto: convert all users (I hope) termios split,
 add some missing headers, other jump relocs removed

---
 libc/stdio/_READ.c          |   5 +-
 libc/stdio/__fsetlocking.c  |   5 +-
 libc/stdio/_cs_funcs.c      |  23 ++++++---
 libc/stdio/_flushlbf.c      |   2 +
 libc/stdio/_fopen.c         |  10 ++--
 libc/stdio/_fpmaxtostr.c    |   4 +-
 libc/stdio/_fwrite.c        |  11 +++--
 libc/stdio/_stdio.c         |   7 +--
 libc/stdio/_stdio.h         |  70 +--------------------------
 libc/stdio/_trans2w.c       |   4 +-
 libc/stdio/_uintmaxtostr.c  |  10 ++--
 libc/stdio/_wfwrite.c       |  10 ++--
 libc/stdio/asprintf.c       |   9 ++--
 libc/stdio/clearerr.c       |   7 +--
 libc/stdio/ctermid.c        |   4 +-
 libc/stdio/dprintf.c        |   4 +-
 libc/stdio/fclose.c         |  11 +++--
 libc/stdio/fcloseall.c      |   2 +
 libc/stdio/fdopen.c         |   9 ++--
 libc/stdio/feof.c           |   7 +--
 libc/stdio/ferror.c         |   7 +--
 libc/stdio/fflush.c         |  20 ++++----
 libc/stdio/fgetc.c          |  41 +++++++++++-----
 libc/stdio/fgetpos.c        |   4 +-
 libc/stdio/fgetpos64.c      |   2 +-
 libc/stdio/fgets.c          |  23 +++++----
 libc/stdio/fgetwc.c         |  28 ++++++-----
 libc/stdio/fgetws.c         |  15 +++---
 libc/stdio/fileno.c         |  19 +++++---
 libc/stdio/fmemopen.c       |   9 ++--
 libc/stdio/fopen.c          |   7 ++-
 libc/stdio/fopen64.c        |   1 -
 libc/stdio/fopencookie.c    |   5 +-
 libc/stdio/fprintf.c        |  10 ++--
 libc/stdio/fputc.c          |  34 ++++++++-----
 libc/stdio/fputs.c          |  25 ++++++----
 libc/stdio/fputwc.c         |  16 ++++---
 libc/stdio/fputws.c         |  25 +++++-----
 libc/stdio/fread.c          |  23 +++++----
 libc/stdio/freopen.c        |   2 +
 libc/stdio/fseeko.c         |  18 ++++---
 libc/stdio/fseeko64.c       |   2 +-
 libc/stdio/fsetpos.c        |   4 +-
 libc/stdio/fsetpos64.c      |   2 +-
 libc/stdio/ftello.c         |  18 ++++---
 libc/stdio/ftello64.c       |   2 +-
 libc/stdio/fwprintf.c       |   4 +-
 libc/stdio/fwrite.c         |  18 ++++---
 libc/stdio/getchar.c        |  10 ++--
 libc/stdio/getdelim.c       |   8 ++--
 libc/stdio/getline.c        |   9 ++--
 libc/stdio/gets.c           |   5 +-
 libc/stdio/getw.c           |   4 +-
 libc/stdio/getwchar.c       |  13 ++---
 libc/stdio/old_vfprintf.c   |  23 +++++----
 libc/stdio/open_memstream.c |  17 ++++---
 libc/stdio/perror.c         |  10 ++--
 libc/stdio/popen.c          |  36 +++++++-------
 libc/stdio/printf.c         |   9 ++--
 libc/stdio/putchar.c        |  10 ++--
 libc/stdio/puts.c           |   7 ++-
 libc/stdio/putw.c           |   6 ++-
 libc/stdio/putwchar.c       |  14 +++---
 libc/stdio/remove.c         |  11 +++--
 libc/stdio/rewind.c         |   9 ++--
 libc/stdio/scanf.c          | 114 +++++++++++++++++++++++++-------------------
 libc/stdio/setbuf.c         |   4 +-
 libc/stdio/setbuffer.c      |   4 +-
 libc/stdio/setlinebuf.c     |   4 +-
 libc/stdio/setvbuf.c        |   5 +-
 libc/stdio/snprintf.c       |   9 ++--
 libc/stdio/sprintf.c        |   9 ++--
 libc/stdio/swprintf.c       |   4 +-
 libc/stdio/tempnam.c        |   4 +-
 libc/stdio/tmpfile.c        |  11 +++--
 libc/stdio/tmpnam.c         |   4 +-
 libc/stdio/ungetc.c         |   5 +-
 libc/stdio/ungetwc.c        |   5 +-
 libc/stdio/vasprintf.c      |  22 ++++++---
 libc/stdio/vdprintf.c       |  12 +++--
 libc/stdio/vfprintf.c       |  51 ++++++++++++--------
 libc/stdio/vprintf.c        |   4 +-
 libc/stdio/vsnprintf.c      |  23 +++++----
 libc/stdio/vsprintf.c       |   4 +-
 libc/stdio/vswprintf.c      |   9 ++--
 libc/stdio/vwprintf.c       |   4 +-
 libc/stdio/wprintf.c        |   4 +-
 87 files changed, 640 insertions(+), 474 deletions(-)

(limited to 'libc/stdio')

diff --git a/libc/stdio/_READ.c b/libc/stdio/_READ.c
index e27309c11..0c7febb3c 100644
--- a/libc/stdio/_READ.c
+++ b/libc/stdio/_READ.c
@@ -5,10 +5,11 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define read __read
-
 #include "_stdio.h"
 
+libc_hidden_proto(read)
+libc_hidden_proto(abort)
+
 /* Given a reading stream without its end-of-file indicator set and
  * with no buffered input or ungots, read at most 'bufsize' bytes
  * into 'buf' (which may be the stream's __bufstart).
diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c
index 5b6070cc3..74f253626 100644
--- a/libc/stdio/__fsetlocking.c
+++ b/libc/stdio/__fsetlocking.c
@@ -15,7 +15,7 @@
  *   glibc treats invalid locking_mode args as FSETLOCKING_INTERNAL.
  */
 
-int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode)
+int __fsetlocking(FILE *stream, int locking_mode)
 {
 #ifdef __UCLIBC_HAS_THREADS__
 	int current = 1 + (stream->__user_locking & 1);
@@ -44,4 +44,5 @@ int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode)
 #endif
 }
 
-strong_alias(__fsetlocking_internal,__fsetlocking)
+libc_hidden_proto(__fsetlocking)
+libc_hidden_def(__fsetlocking)
diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c
index ef92048c0..38a8351e5 100644
--- a/libc/stdio/_cs_funcs.c
+++ b/libc/stdio/_cs_funcs.c
@@ -7,20 +7,29 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(read)
+libc_hidden_proto(write)
+libc_hidden_proto(close)
+#ifdef __UCLIBC_HAS_LFS__
+libc_hidden_proto(lseek64)
+#else
+libc_hidden_proto(lseek)
+#endif
+
 /**********************************************************************/
 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
 /**********************************************************************/
 
 ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize)
 {
-	return __read(*((int *) cookie), buf, bufsize);
+	return read(*((int *) cookie), buf, bufsize);
 }
 
 /**********************************************************************/
 
 ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize)
 {
-	return __write(*((int *) cookie), (char *) buf, bufsize);
+	return write(*((int *) cookie), (char *) buf, bufsize);
 }
 
 /**********************************************************************/
@@ -30,9 +39,9 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence
 	__offmax_t res;
 
 #ifdef __UCLIBC_HAS_LFS__
-	res = __lseek64(*((int *) cookie), *pos, whence);
+	res = lseek64(*((int *) cookie), *pos, whence);
 #else
-	res = __lseek(*((int *) cookie), *pos, whence);
+	res = lseek(*((int *) cookie), *pos, whence);
 #endif
 
 	return (res >= 0) ? ((*pos = res), 0) : ((int) res);
@@ -42,7 +51,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence
 
 int attribute_hidden _cs_close(void *cookie)
 {
-	return __close(*((int *) cookie));
+	return close(*((int *) cookie));
 }
 
 /**********************************************************************/
@@ -54,9 +63,9 @@ int attribute_hidden __stdio_seek(FILE *stream, register __offmax_t *pos, int wh
 	__offmax_t res;
 
 #ifdef __UCLIBC_HAS_LFS__
-	res = __lseek64(stream->__filedes, *pos, whence);
+	res = lseek64(stream->__filedes, *pos, whence);
 #else
-	res = __lseek(stream->__filedes, *pos, whence);
+	res = lseek(stream->__filedes, *pos, whence);
 #endif
 
 	return (res >= 0) ? ((*pos = res), 0) : ((int) res);
diff --git a/libc/stdio/_flushlbf.c b/libc/stdio/_flushlbf.c
index 31ed2fc55..8a551a746 100644
--- a/libc/stdio/_flushlbf.c
+++ b/libc/stdio/_flushlbf.c
@@ -8,6 +8,8 @@
 #include "_stdio.h"
 #include <stdio_ext.h>
 
+libc_hidden_proto(fflush_unlocked)
+
 /* Solaris function --
  * Flush all line buffered (writing) streams.
  */
diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c
index b4f4d46c7..02051eff9 100644
--- a/libc/stdio/_fopen.c
+++ b/libc/stdio/_fopen.c
@@ -5,10 +5,12 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define isatty __isatty
-
 #include "_stdio.h"
 
+libc_hidden_proto(isatty)
+libc_hidden_proto(open)
+libc_hidden_proto(fcntl)
+
 /*
  * Cases:
  *  fopen64  : filename != NULL, stream == NULL, filedes == -2
@@ -121,7 +123,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode,
 		/* NOTE: fopencookie needs changing if the basic check changes! */
 		if (((i & (((int) fname_or_mode) + 1)) != i) /* Basic agreement? */
 			|| (((open_mode & ~((__mode_t) fname_or_mode)) & O_APPEND)
-				&& __fcntl(filedes, F_SETFL, O_APPEND))	/* Need O_APPEND. */
+				&& fcntl(filedes, F_SETFL, O_APPEND))	/* Need O_APPEND. */
 			) {
 			goto DO_EINVAL;
 		}
@@ -130,7 +132,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode,
 										& O_LARGEFILE) );
 	} else {
 		__STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE );
-		if ((stream->__filedes = __open(((const char *) fname_or_mode),
+		if ((stream->__filedes = open(((const char *) fname_or_mode),
 									  open_mode, 0666)) < 0) {
 			goto FREE_STREAM;
 		}
diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c
index 99fc9a9dd..03fe6b1db 100644
--- a/libc/stdio/_fpmaxtostr.c
+++ b/libc/stdio/_fpmaxtostr.c
@@ -11,6 +11,8 @@
 #include <locale.h>
 #include <bits/uClibc_fpmax.h>
 
+libc_hidden_proto(memset)
+
 typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len,
 								intptr_t buf);
 
@@ -417,7 +419,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info
 	if (mode == 'f') {
 		round += exp;
 		if (round < -1) {
-			__memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */
+			memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */
 		    exp = -1;
 		    round = -1;
 		}
diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c
index 600b15e6d..1e0f7ceee 100644
--- a/libc/stdio/_fwrite.c
+++ b/libc/stdio/_fwrite.c
@@ -5,11 +5,12 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define memrchr __memrchr
-#define memchr __memchr
-
 #include "_stdio.h"
 
+libc_hidden_proto(memchr)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memrchr)
+
 #ifdef __STDIO_BUFFERS
 
 /* Either buffer data or (commit buffer if necessary and) write. */
@@ -35,7 +36,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer,
 			if (pending > bytes) {
 				pending = bytes;
 			}
-			__memcpy(stream->__bufpos, buffer, pending);
+			memcpy(stream->__bufpos, buffer, pending);
 			stream->__bufpos += pending;
 			__STDIO_STREAM_VALIDATE(stream);
 			return bytes;
@@ -43,7 +44,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer,
 
 /* 	RETRY: */
 		if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) {
-			__memcpy(stream->__bufpos, buffer, bytes);
+			memcpy(stream->__bufpos, buffer, bytes);
 			stream->__bufpos += bytes;
 			if (__STDIO_STREAM_IS_LBF(stream)
 				&& memrchr(buffer, '\n', bytes)	/* Search backwards. */
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c
index 54319118f..6454b3f3b 100644
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -5,10 +5,11 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define isatty __isatty
-
 #include "_stdio.h"
 
+libc_hidden_proto(memcpy)
+libc_hidden_proto(isatty)
+
 /* This is pretty much straight from uClibc, but with one important
  * difference.
  *
@@ -169,7 +170,7 @@ void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m)
 	static const pthread_mutex_t __stdio_mutex_initializer
 		= PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 
-	__memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer));
+	memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer));
 }
 
 #endif
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index 0badc9fd1..d6b68b3bb 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -18,36 +18,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-
-extern int __vfprintf (FILE *__restrict __s, __const char *__restrict __format,
-		     __gnuc_va_list __arg) attribute_hidden;
-
-extern int __vsnprintf (char *__restrict __s, size_t __maxlen,
-		      __const char *__restrict __format, __gnuc_va_list __arg)
-     __THROW __attribute__ ((__format__ (__printf__, 3, 0))) attribute_hidden;
-
-extern int __vfscanf (FILE *__restrict __s, __const char *__restrict __format,
-		    __gnuc_va_list __arg)
-     __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden;
-
-extern int __vsscanf (__const char *__restrict __s,
-		    __const char *__restrict __format, __gnuc_va_list __arg)
-     __THROW __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden;
-
 #ifdef __UCLIBC_HAS_WCHAR__
 #include <wchar.h>
-
-extern int __vfwprintf (__FILE *__restrict __s,
-		      __const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg) attribute_hidden;
-
-extern int __vfwscanf (__FILE *__restrict __s,
-		     __const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg) attribute_hidden;
-
-extern int __vswscanf (__const wchar_t *__restrict __s,
-		     __const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg) __THROW attribute_hidden;
 #endif
 
 #ifdef __UCLIBC_HAS_THREADS__
@@ -287,8 +259,6 @@ extern int __stdio_trans2w(FILE *__restrict stream) attribute_hidden;
 extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag) attribute_hidden;
 extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidden;
 
-extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf,
-		    int __modes, size_t __n) __THROW attribute_hidden;
 /**********************************************************************/
 #ifdef __STDIO_BUFFERS
 
@@ -376,46 +346,11 @@ extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf,
 #endif /* __STDIO_BUFFERS */
 /**********************************************************************/
 
-extern int __fputs_unlocked(const char *__restrict s, FILE *__restrict stream) attribute_hidden;
-
-extern int __putchar_unlocked(int c);
-
-
-extern size_t __fwrite_unlocked(const void *__restrict ptr, size_t size,
-						size_t nmemb, FILE *__restrict stream) attribute_hidden;
-
-extern size_t __fread_unlocked(void *__restrict ptr, size_t size,
-						size_t nmemb, FILE *__restrict stream) attribute_hidden;
-
-extern int __fputc_unlocked_internal(int c, FILE *stream) attribute_hidden;
-
-extern int __fflush_unlocked(FILE *stream) attribute_hidden;
-
 extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden;
 
-extern void __clearerr_unlocked(FILE *stream);
-extern int __feof_unlocked(FILE *stream);
-extern int __ferror_unlocked(FILE *stream);
-
-extern int __fgetc_unlocked_internal(FILE *stream) attribute_hidden;
-extern int __getc_unlocked(FILE *stream) attribute_hidden;
-extern char *__fgets_unlocked(char *__restrict s, int n,
-					FILE * __restrict stream) attribute_hidden;
-
-extern int __fileno_unlocked(FILE *stream) attribute_hidden;
-
-extern int __getchar_unlocked(void) attribute_hidden;
-
-extern int __fseek(FILE *stream, long int offset, int whence) attribute_hidden;
-extern long int __ftell(FILE *stream) attribute_hidden;
-#ifdef __UCLIBC_HAS_LFS__
-extern int __fseeko64(FILE *stream, __off64_t offset, int whence) attribute_hidden;
-extern __off64_t __ftello64(FILE *stream) attribute_hidden;
-#endif
-
 #ifdef __STDIO_HAS_OPENLIST
 	/* Uses an implementation hack!!! */
-#define __STDIO_FLUSH_LBF_STREAMS  __fflush_unlocked((FILE *) &_stdio_openlist)
+#define __STDIO_FLUSH_LBF_STREAMS  fflush_unlocked((FILE *) &_stdio_openlist)
 #else
 #define __STDIO_FLUSH_LBF_STREAMS		((void)0)
 #endif
@@ -453,9 +388,6 @@ extern FILE *_stdio_fopen(intptr_t fname_or_mode,
 #ifdef __UCLIBC_HAS_WCHAR__
 extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
 						 FILE *__restrict stream) attribute_hidden;
-
-extern wint_t __fgetwc_unlocked(register FILE *stream) attribute_hidden;
-extern wint_t __fputwc_unlocked(wchar_t wc, FILE *stream) attribute_hidden;
 #endif
 
 /**********************************************************************/
diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c
index 650a5e1a0..ed1a583fc 100644
--- a/libc/stdio/_trans2w.c
+++ b/libc/stdio/_trans2w.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fseek)
+
 /* Function to handle transition to writing.
  *   Initialize or verify the stream's orientation (even if readonly).
  *   Check that the stream is writable.
@@ -64,7 +66,7 @@ int attribute_hidden __stdio_trans2w(FILE * __restrict stream)
 			 *   the end even if not reading.*/
 			if (((__STDIO_STREAM_BUFFER_RAVAIL(stream))
 				 || (stream->__modeflags & __FLAG_UNGOT))
-				&& __fseek(stream, 0L,
+				&& fseek(stream, 0L,
 						 ((stream->__modeflags & __FLAG_APPEND)
 						  ? SEEK_END : SEEK_CUR))
 				) {
diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c
index bf92506d5..4310d6458 100644
--- a/libc/stdio/_uintmaxtostr.c
+++ b/libc/stdio/_uintmaxtostr.c
@@ -11,6 +11,8 @@
 #include <locale.h>
 #include <bits/uClibc_uintmaxtostr.h>
 
+libc_hidden_proto(memcpy)
+
 /* Avoid using long long / and % operations to cut down dependencies on
  * libgcc.a.  Definitely helps on i386 at least. */
 #if (INTMAX_MAX > INT_MAX) && (((INTMAX_MAX/INT_MAX)/2) - 2 <= INT_MAX)
@@ -61,7 +63,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
 #ifndef __LOCALE_C_ONLY
 		if (!grouping) {		/* Finished a group. */
 			bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len;
-			__memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
+			memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
 				   __UCLIBC_CURLOCALE_DATA.thousands_sep_len);
 			if (g[1] != 0) { 	/* g[1] == 0 means repeat last grouping. */
 				/* Note: g[1] == -1 means no further grouping.  But since
@@ -79,7 +81,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
 #ifndef __LOCALE_C_ONLY
 		if (unlikely(outdigit)) {
 			bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit];
-			__memcpy(bufend,
+			memcpy(bufend,
 				   (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit],
 				   __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]);
 		} else
@@ -104,7 +106,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
 #ifndef __LOCALE_C_ONLY
 		if (!grouping) {		/* Finished a group. */
 			bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len;
-			__memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
+			memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
 				   __UCLIBC_CURLOCALE_DATA.thousands_sep_len);
 			if (g[1] != 0) { 	/* g[1] == 0 means repeat last grouping. */
 				/* Note: g[1] == -1 means no further grouping.  But since
@@ -131,7 +133,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
 #ifndef __LOCALE_C_ONLY
 		if (unlikely(outdigit)) {
 			bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit];
-			__memcpy(bufend,
+			memcpy(bufend,
 				   (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit],
 				   __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]);
 		} else
diff --git a/libc/stdio/_wfwrite.c b/libc/stdio/_wfwrite.c
index 792cff604..fb5c6b3ee 100644
--- a/libc/stdio/_wfwrite.c
+++ b/libc/stdio/_wfwrite.c
@@ -5,8 +5,6 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define wmemcpy __wmemcpy
-
 #include "_stdio.h"
 #include <wchar.h>
 
@@ -17,9 +15,9 @@
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning TODO: Fix prototype.
 #endif
-extern size_t __wcsnrtombs(char *__restrict dst,
-			   const wchar_t **__restrict src,
-			   size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden;
+
+libc_hidden_proto(wmemcpy)
+libc_hidden_proto(wcsnrtombs)
 
 size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
 					  register FILE *__restrict stream)
@@ -55,7 +53,7 @@ size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
 
 		pw = ws;
 		while (n > count) {
-			r = __wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state);
+			r = wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state);
 			if (r != ((size_t) -1)) { /* No encoding errors */
 				if (!r) {
 					++r;		  /* 0 is returned when nul is reached. */
diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c
index 207b35a3c..98865545e 100644
--- a/libc/stdio/asprintf.c
+++ b/libc/stdio/asprintf.c
@@ -5,16 +5,16 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define vasprintf __vasprintf
-
 #include "_stdio.h"
 #include <stdarg.h>
 
+libc_hidden_proto(vasprintf)
+
 #ifndef __STDIO_HAS_VSNPRINTF
 #warning Skipping asprintf and __asprintf since no vsnprintf!
 #else
 
-int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict format, ...)
+int asprintf(char **__restrict buf, const char * __restrict format, ...)
 {
 	va_list arg;
 	int rv;
@@ -26,6 +26,7 @@ int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict f
 	return rv;
 }
 
-strong_alias(__asprintf,asprintf)
+libc_hidden_proto(asprintf)
+libc_hidden_def(asprintf)
 
 #endif
diff --git a/libc/stdio/clearerr.c b/libc/stdio/clearerr.c
index cf1e623c7..a96ecaa89 100644
--- a/libc/stdio/clearerr.c
+++ b/libc/stdio/clearerr.c
@@ -7,18 +7,19 @@
 
 #include "_stdio.h"
 
+#undef clearerr
 #ifdef __DO_UNLOCKED
 
-void __clearerr_unlocked(register FILE *stream)
+#undef clearerr_unlocked
+void clearerr_unlocked(register FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
 	__CLEARERR_UNLOCKED(stream);
 }
 
-weak_alias(__clearerr_unlocked,clearerr_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__clearerr_unlocked,clearerr)
+strong_alias(clearerr_unlocked,clearerr)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c
index 11e43f336..1cb8a0845 100644
--- a/libc/stdio/ctermid.c
+++ b/libc/stdio/ctermid.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(strcpy)
+
 char *ctermid(register char *s)
 {
 	static char sbuf[L_ctermid];
@@ -21,6 +23,6 @@ char *ctermid(register char *s)
 	return s;
 #else
 	/* glibc always returns /dev/tty for linux. */
-	return __strcpy((s ? s : sbuf), "/dev/tty");
+	return strcpy((s ? s : sbuf), "/dev/tty");
 #endif
 }
diff --git a/libc/stdio/dprintf.c b/libc/stdio/dprintf.c
index 1fc46c722..6e24374cd 100644
--- a/libc/stdio/dprintf.c
+++ b/libc/stdio/dprintf.c
@@ -5,11 +5,11 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define vdprintf __vdprintf
-
 #include "_stdio.h"
 #include <stdarg.h>
 
+libc_hidden_proto(vdprintf)
+
 int dprintf(int filedes, const char * __restrict format, ...)
 {
 	va_list arg;
diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c
index e019ad53e..fc770dce8 100644
--- a/libc/stdio/fclose.c
+++ b/libc/stdio/fclose.c
@@ -9,8 +9,10 @@
 
 #include "_stdio.h"
 
-#undef fclose
-int attribute_hidden __fclose(register FILE *stream)
+libc_hidden_proto(close)
+libc_hidden_proto(fflush_unlocked)
+
+int fclose(register FILE *stream)
 {
 	int rv = 0;
 	__STDIO_AUTO_THREADLOCK_VAR;
@@ -47,7 +49,7 @@ int attribute_hidden __fclose(register FILE *stream)
 #ifdef __STDIO_BUFFERS
 	/* Write any pending buffered chars. */
 	if (__STDIO_STREAM_IS_WRITING(stream)) {
-		rv = __fflush_unlocked(stream);
+		rv = fflush_unlocked(stream);
 	}
 #endif
 
@@ -87,4 +89,5 @@ int attribute_hidden __fclose(register FILE *stream)
 
 	return rv;
 }
-strong_alias(__fclose,fclose)
+libc_hidden_proto(fclose)
+libc_hidden_def(fclose)
diff --git a/libc/stdio/fcloseall.c b/libc/stdio/fcloseall.c
index dbb600067..5be9b553e 100644
--- a/libc/stdio/fcloseall.c
+++ b/libc/stdio/fcloseall.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fclose)
+
 /* NOTE: GLIBC difference!!! -- fcloseall
  * According to the info pages, glibc actually fclose()s all open files.
  * Apparently, glibc's new version only fflush()s and unbuffers all
diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c
index bca7f23fb..acf6231b2 100644
--- a/libc/stdio/fdopen.c
+++ b/libc/stdio/fdopen.c
@@ -7,12 +7,15 @@
 
 #include "_stdio.h"
 
-FILE attribute_hidden *__fdopen(int filedes, const char *mode)
+libc_hidden_proto(fdopen)
+libc_hidden_proto(fcntl)
+
+FILE *fdopen(int filedes, const char *mode)
 {
 	intptr_t cur_mode;
 
-	return (((cur_mode = __fcntl(filedes, F_GETFL))) != -1)
+	return (((cur_mode = fcntl(filedes, F_GETFL))) != -1)
 		? _stdio_fopen(cur_mode, mode, NULL, filedes) 
 		: NULL;
 }
-strong_alias(__fdopen,fdopen)
+libc_hidden_def(fdopen)
diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c
index b0528d5ae..e5f03b720 100644
--- a/libc/stdio/feof.c
+++ b/libc/stdio/feof.c
@@ -7,18 +7,19 @@
 
 #include "_stdio.h"
 
+#undef feof
 #ifdef __DO_UNLOCKED
 
-int __feof_unlocked(register FILE *stream)
+#undef feof_unlocked
+int feof_unlocked(register FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
 	return __FEOF_UNLOCKED(stream);
 }
 
-weak_alias(__feof_unlocked,feof_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__feof_unlocked,feof)
+strong_alias(feof_unlocked,feof)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/ferror.c b/libc/stdio/ferror.c
index e8d19bfa4..947b89ed1 100644
--- a/libc/stdio/ferror.c
+++ b/libc/stdio/ferror.c
@@ -7,18 +7,19 @@
 
 #include "_stdio.h"
 
+#undef ferror
 #ifdef __DO_UNLOCKED
 
-int __ferror_unlocked(register FILE *stream)
+#undef ferror_unlocked
+int ferror_unlocked(register FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
 	return __FERROR_UNLOCKED(stream);
 }
 
-weak_alias(__ferror_unlocked,ferror_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__ferror_unlocked,ferror)
+strong_alias(ferror_unlocked,ferror)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c
index 0a74afe3f..e33a0065a 100644
--- a/libc/stdio/fflush.c
+++ b/libc/stdio/fflush.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fflush_unlocked)
+
 #ifdef __DO_UNLOCKED
 
 #ifdef __UCLIBC_MJN3_ONLY__
@@ -31,7 +33,7 @@
 #endif
 
 
-int attribute_hidden __fflush_unlocked(register FILE *stream)
+int fflush_unlocked(register FILE *stream)
 {
 #ifdef __STDIO_BUFFERS
 
@@ -125,16 +127,17 @@ int attribute_hidden __fflush_unlocked(register FILE *stream)
 	return 0;
 #endif /* __STDIO_BUFFERS */
 }
+libc_hidden_def(fflush_unlocked)
 
-weak_alias(__fflush_unlocked,fflush_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fflush_unlocked,__fflush)
-weak_alias(__fflush_unlocked,fflush)
+strong_alias(fflush_unlocked,fflush)
+libc_hidden_proto(fflush)
+libc_hidden_def(fflush)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-int attribute_hidden __fflush(register FILE *stream)
+int fflush(register FILE *stream)
 {
 	int retval;
 	__STDIO_AUTO_THREADLOCK_VAR;
@@ -147,15 +150,16 @@ int attribute_hidden __fflush(register FILE *stream)
 
 		__STDIO_AUTO_THREADLOCK(stream);
 
-		retval = __fflush_unlocked(stream);
+		retval = fflush_unlocked(stream);
 
 		__STDIO_AUTO_THREADUNLOCK(stream);
 	} else {
-		retval = __fflush_unlocked(stream);
+		retval = fflush_unlocked(stream);
 	}
 
 	return retval;
 }
-strong_alias(__fflush,fflush)
+libc_hidden_proto(fflush)
+libc_hidden_def(fflush)
 
 #endif
diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c
index d83b6c92a..599d12b30 100644
--- a/libc/stdio/fgetc.c
+++ b/libc/stdio/fgetc.c
@@ -1,6 +1,7 @@
 /* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  *
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  *
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
@@ -14,7 +15,9 @@
 
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __fgetc_unlocked_internal(FILE *stream)
+libc_hidden_proto(fflush_unlocked)
+
+int __fgetc_unlocked(FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
@@ -68,20 +71,32 @@ int attribute_hidden __fgetc_unlocked_internal(FILE *stream)
 
 	return EOF;
 }
+libc_hidden_proto(__fgetc_unlocked)
+libc_hidden_def(__fgetc_unlocked)
+
+strong_alias(__fgetc_unlocked,fgetc_unlocked)
+libc_hidden_proto(fgetc_unlocked)
+libc_hidden_def(fgetc_unlocked)
+
+//strong_alias(__fgetc_unlocked,__getc_unlocked)
+//libc_hidden_proto(__getc_unlocked)
+//libc_hidden_def(__getc_unlocked)
+strong_alias(__fgetc_unlocked,getc_unlocked)
+libc_hidden_proto(getc_unlocked)
+libc_hidden_def(getc_unlocked)
 
-strong_alias(__fgetc_unlocked_internal,__fgetc_unlocked)
-weak_alias(__fgetc_unlocked_internal,fgetc_unlocked)
-hidden_strong_alias(__fgetc_unlocked_internal,__getc_unlocked)
-weak_alias(__fgetc_unlocked_internal,getc_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgetc_unlocked_internal,__fgetc)
-weak_alias(__fgetc_unlocked_internal,fgetc)
-weak_alias(__fgetc_unlocked_internal,getc)
+strong_alias(__fgetc_unlocked,fgetc)
+libc_hidden_proto(fgetc)
+libc_hidden_def(fgetc)
+strong_alias(__fgetc_unlocked,getc)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-int attribute_hidden __fgetc(register FILE *stream)
+libc_hidden_proto(__fgetc_unlocked)
+
+int fgetc(register FILE *stream)
 {
 	if (stream->__user_locking != 0) {
 		return __GETC_UNLOCKED_MACRO(stream);
@@ -93,7 +108,9 @@ int attribute_hidden __fgetc(register FILE *stream)
 		return retval;
 	}
 }
-strong_alias(__fgetc,fgetc)
-weak_alias(__fgetc,getc)
+libc_hidden_proto(fgetc)
+libc_hidden_def(fgetc)
+
+strong_alias(fgetc,getc)
 
 #endif
diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c
index 03c18ab93..610737d36 100644
--- a/libc/stdio/fgetpos.c
+++ b/libc/stdio/fgetpos.c
@@ -8,9 +8,11 @@
 #include "_stdio.h"
 
 #ifndef __DO_LARGEFILE
-#define FTELL __ftell
+#define FTELL ftell
 #endif
 
+libc_hidden_proto(FTELL)
+
 int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos)
 {
 #ifdef __STDIO_MBSTATE
diff --git a/libc/stdio/fgetpos64.c b/libc/stdio/fgetpos64.c
index 6f46746b1..32b7120aa 100644
--- a/libc/stdio/fgetpos64.c
+++ b/libc/stdio/fgetpos64.c
@@ -10,5 +10,5 @@
 #define __DO_LARGEFILE
 #define fgetpos	fgetpos64
 #define fpos_t        fpos64_t
-#define FTELL         __ftello64
+#define FTELL         ftello64
 #include "fgetpos.c"
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 5baf63a58..031eadaaf 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -7,9 +7,13 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fgets_unlocked)
+
 #ifdef __DO_UNLOCKED
 
-char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
+libc_hidden_proto(__fgetc_unlocked)
+
+char *fgets_unlocked(char *__restrict s, int n,
 					   register FILE * __restrict stream)
 {
 	register char *p;
@@ -34,7 +38,7 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
 				break;
 			}
 		} else {
-			if ((c = __fgetc_unlocked_internal(stream)) == EOF) {
+			if ((c = __fgetc_unlocked(stream)) == EOF) {
 				if (__FERROR_UNLOCKED(stream)) {
 					goto ERROR;
 				}
@@ -57,17 +61,17 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
  ERROR:
 	return NULL;
 }
-
-weak_alias(__fgets_unlocked,fgets_unlocked)
+libc_hidden_def(fgets_unlocked)
 
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgets_unlocked,__fgets)
-weak_alias(__fgets_unlocked,fgets)
+strong_alias(fgets_unlocked,fgets)
+libc_hidden_proto(fgets)
+libc_hidden_def(fgets)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-char attribute_hidden *__fgets(char *__restrict s, int n,
+char *fgets(char *__restrict s, int n,
 			register FILE * __restrict stream)
 {
 	char *retval;
@@ -75,12 +79,13 @@ char attribute_hidden *__fgets(char *__restrict s, int n,
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fgets_unlocked(s, n, stream);
+	retval = fgets_unlocked(s, n, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fgets,fgets)
+libc_hidden_proto(fgets)
+libc_hidden_def(fgets)
 
 #endif
diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c
index 45ff86b80..dbcf6bec6 100644
--- a/libc/stdio/fgetwc.c
+++ b/libc/stdio/fgetwc.c
@@ -5,10 +5,12 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define mbrtowc __mbrtowc
-
 #include "_stdio.h"
 
+libc_hidden_proto(fgetwc_unlocked)
+
+libc_hidden_proto(mbrtowc)
+
 #ifdef __DO_UNLOCKED
 
 static void munge_stream(register FILE *stream, unsigned char *buf)
@@ -19,7 +21,7 @@ static void munge_stream(register FILE *stream, unsigned char *buf)
 	__STDIO_STREAM_DISABLE_PUTC(stream);
 }
 
-wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream)
+wint_t fgetwc_unlocked(register FILE *stream)
 {
 	wint_t wi;
 	wchar_t wc[1];
@@ -107,31 +109,33 @@ wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream)
 
 	return wi;
 }
+libc_hidden_def(fgetwc_unlocked)
 
-weak_alias(__fgetwc_unlocked,fgetwc_unlocked)
-weak_alias(__fgetwc_unlocked,getwc_unlocked)
+strong_alias(fgetwc_unlocked,getwc_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgetwc_unlocked,__fgetwc)
-weak_alias(__fgetwc_unlocked,fgetwc)
-weak_alias(__fgetwc_unlocked,getwc)
+strong_alias(fgetwc_unlocked,fgetwc)
+libc_hidden_proto(fgetwc)
+libc_hidden_def(fgetwc)
+strong_alias(fgetwc_unlocked,getwc)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-wint_t attribute_hidden __fgetwc(register FILE *stream)
+wint_t fgetwc(register FILE *stream)
 {
 	wint_t retval;
 	__STDIO_AUTO_THREADLOCK_VAR;
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fgetwc_unlocked(stream);
+	retval = fgetwc_unlocked(stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fgetwc,fgetwc)
-weak_alias(__fgetwc,getwc)
+libc_hidden_proto(fgetwc)
+libc_hidden_def(fgetwc)
+strong_alias(fgetwc,getwc)
 
 #endif
diff --git a/libc/stdio/fgetws.c b/libc/stdio/fgetws.c
index fe8da002d..c7dcc7d2b 100644
--- a/libc/stdio/fgetws.c
+++ b/libc/stdio/fgetws.c
@@ -7,12 +7,13 @@
 
 #include "_stdio.h"
 
-extern wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n,
-						FILE *__restrict stream) attribute_hidden;
+libc_hidden_proto(fgetws_unlocked)
+
+libc_hidden_proto(fgetwc_unlocked)
 
 #ifdef __DO_UNLOCKED
 
-wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
+wchar_t *fgetws_unlocked(wchar_t *__restrict ws, int n,
 						   FILE *__restrict stream)
 {
 	register wchar_t *p = ws;
@@ -21,7 +22,7 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
 	__STDIO_STREAM_VALIDATE(stream);
 
 	while ((n > 1)
-		   && ((wi = __fgetwc_unlocked(stream)) != WEOF)
+		   && ((wi = fgetwc_unlocked(stream)) != WEOF)
 		   && ((*p++ = wi) != '\n')
 		   ) {
 		--n;
@@ -36,10 +37,10 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
 	*p = 0;
 	return ws;
 }
+libc_hidden_def(fgetws_unlocked)
 
-weak_alias(__fgetws_unlocked,fgetws_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetws_unlocked,fgetws)
+strong_alias(fgetws_unlocked,fgetws)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
@@ -51,7 +52,7 @@ wchar_t *fgetws(wchar_t *__restrict ws, int n, FILE *__restrict stream)
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fgetws_unlocked(ws, n, stream);
+	retval = fgetws_unlocked(ws, n, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c
index bc1ade952..fb895b8a0 100644
--- a/libc/stdio/fileno.c
+++ b/libc/stdio/fileno.c
@@ -7,9 +7,11 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fileno_unlocked)
+
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __fileno_unlocked(register FILE *stream)
+int fileno_unlocked(register FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
@@ -20,27 +22,30 @@ int attribute_hidden __fileno_unlocked(register FILE *stream)
 	__set_errno(EBADF);
 	return -1;
 }
+libc_hidden_def(fileno_unlocked)
 
-weak_alias(__fileno_unlocked,fileno_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_weak_alias(__fileno_unlocked,__fileno)
-weak_alias(__fileno_unlocked,fileno)
+strong_alias(fileno_unlocked,fileno)
+libc_hidden_proto(fileno)
+libc_hidden_def(fileno)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-int attribute_hidden __fileno(register FILE *stream)
+int fileno(register FILE *stream)
 {
 	int retval;
 	__STDIO_AUTO_THREADLOCK_VAR;
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fileno_unlocked(stream);
+	retval = fileno_unlocked(stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fileno,fileno)
+libc_hidden_proto(fileno)
+libc_hidden_def(fileno)
+
 #endif
diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c
index fc7870258..7f6021ca4 100644
--- a/libc/stdio/fmemopen.c
+++ b/libc/stdio/fmemopen.c
@@ -5,10 +5,11 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define fopencookie __fopencookie
-
 #include "_stdio.h"
 
+libc_hidden_proto(memcpy)
+libc_hidden_proto(fopencookie)
+
 #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
 #error no custom streams!
 #endif
@@ -37,7 +38,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize)
 		bufsize = count;
 	}
 
-	__memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize);
+	memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize);
 	COOKIE->pos += bufsize;
 
 	return bufsize;
@@ -64,7 +65,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize)
 		}
 	}
 
-	__memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
+	memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
 	COOKIE->pos += bufsize;
 
 	if (COOKIE->pos > COOKIE->eof) {
diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index ad5d1aa92..d73ce711a 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -9,15 +9,14 @@
 
 #ifndef __DO_LARGEFILE
 # define FILEDES_ARG    (-1)
-#undef __fopen
 #undef fopen
 #else
-#undef __fopen64
 #undef fopen64
 #endif
 
-FILE attribute_hidden *__fopen(const char * __restrict filename, const char * __restrict mode)
+FILE *fopen(const char * __restrict filename, const char * __restrict mode)
 {
 	return _stdio_fopen(((intptr_t) filename), mode, NULL, FILEDES_ARG);
 }
-strong_alias(__fopen,fopen)
+libc_hidden_proto(fopen)
+libc_hidden_def(fopen)
diff --git a/libc/stdio/fopen64.c b/libc/stdio/fopen64.c
index c65e9a4e9..cbdb03d68 100644
--- a/libc/stdio/fopen64.c
+++ b/libc/stdio/fopen64.c
@@ -8,7 +8,6 @@
 #include "_stdio.h"
 
 #define __DO_LARGEFILE
-#define __fopen       __fopen64
 #undef fopen
 #define fopen         fopen64
 #define FILEDES_ARG   (-2)
diff --git a/libc/stdio/fopencookie.c b/libc/stdio/fopencookie.c
index a70e17b80..af51f44c9 100644
--- a/libc/stdio/fopencookie.c
+++ b/libc/stdio/fopencookie.c
@@ -28,7 +28,7 @@
 /* Currently no real reentrancy issues other than a possible double close(). */
 
 #ifndef __BCC__
-FILE attribute_hidden *__fopencookie(void * __restrict cookie, const char * __restrict mode,
+FILE *fopencookie(void * __restrict cookie, const char * __restrict mode,
 				  cookie_io_functions_t io_functions)
 #else
 FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode,
@@ -58,5 +58,6 @@ FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode,
 	return stream;
 }
 #ifndef __BCC__
-strong_alias(__fopencookie,fopencookie)
+libc_hidden_proto(fopencookie)
+libc_hidden_def(fopencookie)
 #endif
diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c
index ee19c85a5..092a64981 100644
--- a/libc/stdio/fprintf.c
+++ b/libc/stdio/fprintf.c
@@ -8,16 +8,18 @@
 #include "_stdio.h"
 #include <stdarg.h>
 
-#undef fprintf
-int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...)
+libc_hidden_proto(vfprintf)
+
+int fprintf(FILE * __restrict stream, const char * __restrict format, ...)
 {
 	va_list arg;
 	int rv;
 
 	va_start(arg, format);
-	rv = __vfprintf(stream, format, arg);
+	rv = vfprintf(stream, format, arg);
 	va_end(arg);
 
 	return rv;
 }
-strong_alias(__fprintf,fprintf)
+libc_hidden_proto(fprintf)
+libc_hidden_def(fprintf)
diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c
index 4cc396e08..c30c0a12a 100644
--- a/libc/stdio/fputc.c
+++ b/libc/stdio/fputc.c
@@ -14,7 +14,7 @@
 
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream)
+int __fputc_unlocked(int c, register FILE *stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
 
@@ -68,20 +68,27 @@ int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream)
  BAD:
 	return EOF;
 }
+libc_hidden_proto(__fputc_unlocked)
+libc_hidden_def(__fputc_unlocked)
 
-strong_alias(__fputc_unlocked_internal,__fputc_unlocked)
-weak_alias(__fputc_unlocked_internal,fputc_unlocked)
-weak_alias(__fputc_unlocked_internal,putc_unlocked)
+strong_alias(__fputc_unlocked,fputc_unlocked)
+
+strong_alias(__fputc_unlocked,putc_unlocked)
+libc_hidden_proto(putc_unlocked)
+libc_hidden_def(putc_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputc_unlocked_internal,__fputc)
-weak_alias(__fputc_unlocked_internal,fputc)
-hidden_strong_alias(__fputc_unlocked_internal,__putc)
-weak_alias(__fputc_unlocked_internal,putc)
+strong_alias(__fputc_unlocked,fputc)
+
+strong_alias(__fputc_unlocked,putc)
+libc_hidden_proto(putc)
+libc_hidden_def(putc)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-int attribute_hidden __fputc(int c, register FILE *stream)
+libc_hidden_proto(__fputc_unlocked)
+
+int fputc(int c, register FILE *stream)
 {
 	if (stream->__user_locking != 0) {
 		return __PUTC_UNLOCKED_MACRO(c, stream);
@@ -93,8 +100,11 @@ int attribute_hidden __fputc(int c, register FILE *stream)
 		return retval;
 	}
 }
-strong_alias(__fputc,fputc)
-hidden_strong_alias(__fputc,__putc)
-weak_alias(__fputc,putc)
+libc_hidden_proto(fputc)
+libc_hidden_def(fputc)
+
+strong_alias(fputc,putc)
+libc_hidden_proto(putc)
+libc_hidden_def(putc)
 
 #endif
diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c
index 64e7fd57f..b9dabee30 100644
--- a/libc/stdio/fputs.c
+++ b/libc/stdio/fputs.c
@@ -7,6 +7,11 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fputs_unlocked)
+
+libc_hidden_proto(strlen)
+libc_hidden_proto(fwrite_unlocked)
+
 /* Note: The standard says fputs returns a nonnegative number on
  * success.  In this implementation, we return the length of the
  * string written on success.
@@ -14,35 +19,37 @@
 
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __fputs_unlocked(register const char * __restrict s,
+int fputs_unlocked(register const char * __restrict s,
 					 FILE * __restrict stream)
 {
-	size_t n = __strlen(s);
+	size_t n = strlen(s);
 
-	return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
+	return ((fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
 }
+libc_hidden_def(fputs_unlocked)
 
-weak_alias(__fputs_unlocked,fputs_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputs_unlocked,__fputs)
-weak_alias(__fputs_unlocked,fputs)
+strong_alias(fputs_unlocked,fputs)
+libc_hidden_proto(fputs)
+libc_hidden_def(fputs)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-int attribute_hidden __fputs(const char * __restrict s, register FILE * __restrict stream)
+int fputs(const char * __restrict s, register FILE * __restrict stream)
 {
 	int retval;
 	__STDIO_AUTO_THREADLOCK_VAR;
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fputs_unlocked(s, stream);
+	retval = fputs_unlocked(s, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fputs,fputs)
+libc_hidden_proto(fputs)
+libc_hidden_def(fputs)
 
 #endif
diff --git a/libc/stdio/fputwc.c b/libc/stdio/fputwc.c
index 8f1178710..240c1e9c4 100644
--- a/libc/stdio/fputwc.c
+++ b/libc/stdio/fputwc.c
@@ -7,18 +7,20 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fputwc_unlocked)
+
 #ifdef __DO_UNLOCKED
 
-wint_t attribute_hidden __fputwc_unlocked(wchar_t wc, FILE *stream)
+wint_t fputwc_unlocked(wchar_t wc, FILE *stream)
 {
 	return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
 }
+libc_hidden_def(fputwc_unlocked)
 
-weak_alias(__fputwc_unlocked,fputwc_unlocked)
-weak_alias(__fputwc_unlocked,putwc_unlocked)
+strong_alias(fputwc_unlocked,putwc_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputwc_unlocked,fputwc)
-weak_alias(__fputwc_unlocked,putwc)
+strong_alias(fputwc_unlocked,fputwc)
+strong_alias(fputwc_unlocked,putwc)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
@@ -30,13 +32,13 @@ wint_t fputwc(wchar_t wc, register FILE *stream)
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fputwc_unlocked(wc, stream);
+	retval = fputwc_unlocked(wc, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
 
-weak_alias(fputwc,putwc)
+strong_alias(fputwc,putwc)
 
 #endif
diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c
index 74919d6ea..d00c95797 100644
--- a/libc/stdio/fputws.c
+++ b/libc/stdio/fputws.c
@@ -5,44 +5,45 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define wcslen __wcslen
-
 #include "_stdio.h"
 
+libc_hidden_proto(fputws_unlocked)
+
+libc_hidden_proto(wcslen)
+
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws,
+int fputws_unlocked(const wchar_t *__restrict ws,
 					  register FILE *__restrict stream)
 {
 	size_t n = wcslen(ws);
 
 	return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1;
 }
+libc_hidden_def(fputws_unlocked)
 
-weak_alias(__fputws_unlocked,fputws_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputws_unlocked,__fputws)
-weak_alias(__fputws_unlocked,fputws)
+strong_alias(fputws_unlocked,fputws)
+libc_hidden_proto(fputws)
+libc_hidden_def(fputws)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-extern int __fputws_unlocked(const wchar_t *__restrict ws,
-					FILE *__restrict stream) attribute_hidden;
-
-int attribute_hidden __fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
+int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
 {
 	int retval;
 	__STDIO_AUTO_THREADLOCK_VAR;
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fputws_unlocked(ws, stream);
+	retval = fputws_unlocked(ws, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fputws,fputws)
+libc_hidden_proto(fputws)
+libc_hidden_def(fputws)
 
 #endif
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index 0defb36a0..417ab2c8d 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -7,9 +7,14 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fread_unlocked)
+
 #ifdef __DO_UNLOCKED
 
-size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
+libc_hidden_proto(memcpy)
+libc_hidden_proto(fflush_unlocked)
+
+size_t fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
 						FILE * __restrict stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
@@ -44,7 +49,7 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz
 				if (avail > todo) {
 					avail = todo;
 				}
-				__memcpy(buffer, stream->__bufpos, avail);
+				memcpy(buffer, stream->__bufpos, avail);
 				buffer += avail;
 				stream->__bufpos += avail;
 				if (!(todo -= avail)) {
@@ -82,16 +87,17 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz
 	__STDIO_STREAM_VALIDATE(stream);
 	return 0;
 }
+libc_hidden_def(fread_unlocked)
 
-weak_alias(__fread_unlocked,fread_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fread_unlocked,__fread)
-weak_alias(__fread_unlocked,fread)
+strong_alias(fread_unlocked,fread)
+libc_hidden_proto(fread)
+libc_hidden_def(fread)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb,
+size_t fread(void * __restrict ptr, size_t size, size_t nmemb,
 			 register FILE * __restrict stream)
 {
 	size_t retval;
@@ -99,12 +105,13 @@ size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fread_unlocked(ptr, size, nmemb, stream);
+	retval = fread_unlocked(ptr, size, nmemb, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fread,fread)
+libc_hidden_proto(fread)
+libc_hidden_def(fread)
 
 #endif
diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c
index 7df035d48..7314807d3 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fclose)
+
 #ifndef __DO_LARGEFILE
 # define FILEDES_ARG    (-1)
 #endif
diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c
index 190485775..0ce4acfb7 100644
--- a/libc/stdio/fseeko.c
+++ b/libc/stdio/fseeko.c
@@ -12,15 +12,19 @@
 #endif
 
 #ifndef __DO_LARGEFILE
-# define FSEEK         __fseek
+# define FSEEK         fseek
 # define OFFSET_TYPE   long int
 #endif
 
-int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
+#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
+libc_hidden_proto(fseeko64)
+#endif
+
+int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
 {
 #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
 
-	return __fseeko64(stream, offset, whence);
+	return fseeko64(stream, offset, whence);
 
 #else
 
@@ -74,8 +78,10 @@ int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence
 }
 
 #ifdef __DO_LARGEFILE
-strong_alias(__fseeko64,fseeko64)
+libc_hidden_proto(fseeko64)
+libc_hidden_def(fseeko64)
 #else
-strong_alias(__fseek,fseek)
-weak_alias(__fseek,fseeko)
+libc_hidden_proto(fseek)
+libc_hidden_def(fseek)
+strong_alias(fseek,fseeko)
 #endif
diff --git a/libc/stdio/fseeko64.c b/libc/stdio/fseeko64.c
index 5bc4ae34e..78cab1b5c 100644
--- a/libc/stdio/fseeko64.c
+++ b/libc/stdio/fseeko64.c
@@ -8,6 +8,6 @@
 #include "_stdio.h"
 
 #define __DO_LARGEFILE
-#define FSEEK         __fseeko64
+#define FSEEK         fseeko64
 #define OFFSET_TYPE   __off64_t
 #include "fseeko.c"
diff --git a/libc/stdio/fsetpos.c b/libc/stdio/fsetpos.c
index f33043f3b..d63adc024 100644
--- a/libc/stdio/fsetpos.c
+++ b/libc/stdio/fsetpos.c
@@ -8,9 +8,11 @@
 #include "_stdio.h"
 
 #ifndef __DO_LARGEFILE
-#define FSEEK __fseek
+#define FSEEK fseek
 #endif
 
+libc_hidden_proto(FSEEK)
+
 int fsetpos(FILE *stream, register const fpos_t *pos)
 {
 #ifdef __STDIO_MBSTATE
diff --git a/libc/stdio/fsetpos64.c b/libc/stdio/fsetpos64.c
index bf7d574cb..82819a4fe 100644
--- a/libc/stdio/fsetpos64.c
+++ b/libc/stdio/fsetpos64.c
@@ -10,5 +10,5 @@
 #define __DO_LARGEFILE
 #define fsetpos	fsetpos64
 #define fpos_t        fpos64_t
-#define FSEEK       __fseeko64
+#define FSEEK         fseeko64
 #include "fsetpos.c"
diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c
index 7f5c53126..0a3a53856 100644
--- a/libc/stdio/ftello.c
+++ b/libc/stdio/ftello.c
@@ -7,16 +7,20 @@
 
 #include "_stdio.h"
 
+#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
+libc_hidden_proto(ftello64)
+#endif
+
 #ifndef __DO_LARGEFILE
-# define FTELL         __ftell
+# define FTELL         ftell
 # define OFFSET_TYPE   long int
 #endif
 
-OFFSET_TYPE attribute_hidden FTELL(register FILE *stream)
+OFFSET_TYPE FTELL(register FILE *stream)
 {
 #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
 
-	__offmax_t pos = __ftello64(stream);
+	__offmax_t pos = ftello64(stream);
 
 	if ((sizeof(long) >= sizeof(__offmax_t)) || (((long) pos) == pos)) {
 		return ((long) pos);
@@ -47,8 +51,10 @@ OFFSET_TYPE attribute_hidden FTELL(register FILE *stream)
 }
 
 #ifdef __DO_LARGEFILE
-weak_alias(__ftello64,ftello64)
+libc_hidden_proto(ftello64)
+libc_hidden_def(ftello64)
 #else
-weak_alias(__ftell,ftell)
-weak_alias(ftell,ftello)
+libc_hidden_proto(ftell)
+libc_hidden_def(ftell)
+strong_alias(ftell,ftello)
 #endif
diff --git a/libc/stdio/ftello64.c b/libc/stdio/ftello64.c
index 32a37d368..905834f39 100644
--- a/libc/stdio/ftello64.c
+++ b/libc/stdio/ftello64.c
@@ -8,6 +8,6 @@
 #include "_stdio.h"
 
 #define __DO_LARGEFILE
-#define FTELL         __ftello64
+#define FTELL         ftello64
 #define OFFSET_TYPE   __off64_t
 #include "ftello.c"
diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c
index c81d40482..f2a1afbec 100644
--- a/libc/stdio/fwprintf.c
+++ b/libc/stdio/fwprintf.c
@@ -9,13 +9,15 @@
 #include <stdarg.h>
 #include <wchar.h>
 
+libc_hidden_proto(vfwprintf)
+
 int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...)
 {
 	va_list arg;
 	int rv;
 
 	va_start(arg, format);
-	rv = __vfwprintf(stream, format, arg);
+	rv = vfwprintf(stream, format, arg);
 	va_end(arg);
 
 	return rv;
diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c
index abe24fbb7..106ee5db6 100644
--- a/libc/stdio/fwrite.c
+++ b/libc/stdio/fwrite.c
@@ -7,9 +7,11 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fwrite_unlocked)
+
 #ifdef __DO_UNLOCKED
 
-size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t size,
+size_t fwrite_unlocked(const void * __restrict ptr, size_t size,
 						 size_t nmemb, register FILE * __restrict stream)
 {
 	__STDIO_STREAM_VALIDATE(stream);
@@ -33,16 +35,17 @@ size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t si
 
 	return 0;
 }
+libc_hidden_def(fwrite_unlocked)
 
-weak_alias(__fwrite_unlocked,fwrite_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fwrite_unlocked,__fwrite)
-weak_alias(__fwrite_unlocked,fwrite)
+strong_alias(fwrite_unlocked,fwrite)
+libc_hidden_proto(fwrite)
+libc_hidden_def(fwrite)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size,
+size_t fwrite(const void * __restrict ptr, size_t size,
 			  size_t nmemb, register FILE * __restrict stream)
 {
 	size_t retval;
@@ -50,12 +53,13 @@ size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size,
 
 	__STDIO_AUTO_THREADLOCK(stream);
 
-	retval = __fwrite_unlocked(ptr, size, nmemb, stream);
+	retval = fwrite_unlocked(ptr, size, nmemb, stream);
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 
 	return retval;
 }
-strong_alias(__fwrite,fwrite)
+libc_hidden_proto(fwrite)
+libc_hidden_def(fwrite)
 
 #endif
diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c
index d17704056..6da8307b6 100644
--- a/libc/stdio/getchar.c
+++ b/libc/stdio/getchar.c
@@ -7,21 +7,21 @@
 
 #include "_stdio.h"
 
-#undef getchar_unlocked
-#undef getchar
+libc_hidden_proto(__fgetc_unlocked)
 
+#undef getchar
 #ifdef __DO_UNLOCKED
 
-int attribute_hidden __getchar_unlocked(void)
+#undef getchar_unlocked
+int getchar_unlocked(void)
 {
 	register FILE *stream = stdin;
 
 	return __GETC_UNLOCKED_MACRO(stream);
 }
 
-weak_alias(__getchar_unlocked,getchar_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getchar_unlocked,getchar)
+strong_alias(getchar_unlocked,getchar)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c
index e1b808340..7c769dd63 100644
--- a/libc/stdio/getdelim.c
+++ b/libc/stdio/getdelim.c
@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(__fgetc_unlocked)
+
 /* Note: There is a defect in this function.  (size_t vs ssize_t). */
 
 /* glibc function --
@@ -20,7 +22,7 @@
 
 #define GETDELIM_GROWBY		64
 
-ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restrict n,
+ssize_t getdelim(char **__restrict lineptr, size_t *__restrict n,
 				   int delimiter, register FILE *__restrict stream)
 {
 	register char *buf;
@@ -73,5 +75,5 @@ ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restric
 
 	return pos;
 }
-
-strong_alias(__getdelim,getdelim)
+libc_hidden_proto(getdelim)
+libc_hidden_def(getdelim)
diff --git a/libc/stdio/getline.c b/libc/stdio/getline.c
index 943526abe..0426d37f5 100644
--- a/libc/stdio/getline.c
+++ b/libc/stdio/getline.c
@@ -5,13 +5,14 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define getdelim __getdelim
-
 #include "_stdio.h"
 
-ssize_t attribute_hidden __getline(char **__restrict lineptr, size_t *__restrict n,
+libc_hidden_proto(getdelim)
+
+ssize_t getline(char **__restrict lineptr, size_t *__restrict n,
 				FILE *__restrict stream)
 {
 	return getdelim(lineptr, n, '\n', stream);
 }
-strong_alias(__getline,getline)
+libc_hidden_proto(getline)
+libc_hidden_def(getline)
diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c
index 1badd8152..1c908399c 100644
--- a/libc/stdio/gets.c
+++ b/libc/stdio/gets.c
@@ -11,6 +11,9 @@ link_warning(gets, "the 'gets' function is dangerous and should not be used.")
 
 /* UNSAFE FUNCTION -- do not bother optimizing */
 
+libc_hidden_proto(getchar_unlocked)
+libc_hidden_proto(__fgetc_unlocked)
+
 char *gets(char *s)
 {
 	register char *p = s;
@@ -21,7 +24,7 @@ char *gets(char *s)
 
 	/* Note: don't worry about performance here... this shouldn't be used!
 	 * Therefore, force actual function call. */
-	while (((c = __getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
+	while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
 		++p;
 	}
 	if ((c == EOF) || (s == p)) {
diff --git a/libc/stdio/getw.c b/libc/stdio/getw.c
index 6b3b9e5e7..e3aeda92c 100644
--- a/libc/stdio/getw.c
+++ b/libc/stdio/getw.c
@@ -7,12 +7,14 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fread_unlocked)
+
 /* SUSv2 Legacy function -- need not be reentrant. */
 
 int getw(FILE *stream)
 {
 	int aw;
 
-	return (__fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0)
+	return (fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0)
 		? aw : EOF;
 }
diff --git a/libc/stdio/getwchar.c b/libc/stdio/getwchar.c
index 90e5a032e..9c480b564 100644
--- a/libc/stdio/getwchar.c
+++ b/libc/stdio/getwchar.c
@@ -9,23 +9,24 @@
 
 #ifdef __DO_UNLOCKED
 
-wint_t __getwchar_unlocked(void)
+libc_hidden_proto(fgetwc_unlocked)
+
+wint_t getwchar_unlocked(void)
 {
-	return __fgetwc_unlocked(stdin);
+	return fgetwc_unlocked(stdin);
 }
 
-weak_alias(__getwchar_unlocked,getwchar_unlocked)
 #ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getwchar_unlocked,getwchar)
+strong_alias(getwchar_unlocked,getwchar)
 #endif
 
 #elif defined __UCLIBC_HAS_THREADS__
 
-extern wint_t __fgetwc (__FILE *__stream) attribute_hidden;
+libc_hidden_proto(fgetwc)
 
 wint_t getwchar(void)
 {
-	return __fgetwc(stdin);
+	return fgetwc(stdin);
 }
 
 #endif
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index ce6bde1a4..9aed79934 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -127,8 +127,6 @@
 
 /**************************************************************************/
 
-#define strnlen __strnlen
-
 #define _ISOC99_SOURCE			/* for ULLONG primarily... */
 #define _GNU_SOURCE				/* for strnlen */
 #include "_stdio.h"
@@ -148,6 +146,12 @@
 #include <pthread.h>
 #endif /* __UCLIBC_HAS_THREADS__ */
 
+libc_hidden_proto(strlen)
+libc_hidden_proto(strnlen)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(putc_unlocked)
+libc_hidden_proto(__glibc_strerror_r)
+
 /*  #undef __UCLIBC_HAS_FLOATS__ */
 /*  #undef WANT_FLOAT_ERROR */
 /*  #define WANT_FLOAT_ERROR      1 */
@@ -166,7 +170,7 @@
 
 #ifdef __STDIO_BUFFERS
 
-#define PUTC(C,F)      __putc_unlocked((C),(F))
+#define PUTC(C,F)      putc_unlocked((C),(F))
 #define OUTNSTR        _outnstr
 #define _outnstr(stream, string, len)	__stdio_fwrite(string, len, stream)
 
@@ -190,7 +194,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n)
 		if (r > n) {
 			r = n;
 		}
-		__memcpy(f->bufpos, s, r);
+		memcpy(f->bufpos, s, r);
 		f->bufpos += r;
 	}
 }
@@ -199,7 +203,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n)
 static void putc_unlocked_sprintf(int c, __FILE_vsnprintf *f)
 {
 	if (!__STDIO_STREAM_IS_FAKE_VSNPRINTF_NB(&f->f)) {
-		__putc_unlocked(c, &f->f);
+		putc_unlocked(c, &f->f);
 	} else if (f->bufpos < f->bufend) {
 		*f->bufpos++ = c;
 	}
@@ -236,7 +240,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad)
 static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf)
 {
 	if (type & 0x80) {			/* Some type of padding needed. */
-		int buflen = __strlen((const char *) buf);
+		int buflen = strlen((const char *) buf);
 		if ((len -= buflen) > 0) {
 			_charpad(fp, (type & 0x7f), len);
 		}
@@ -341,7 +345,7 @@ static const char u_spec[] = "%nbopxXudics";
 /* u_radix[i] <-> u_spec[i+2] for unsigned entries only */
 static const char u_radix[] = "\x02\x08\x10\x10\x10\x0a";
 
-int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt,
+int vfprintf(FILE * __restrict op, register const char * __restrict fmt,
 			 va_list ap)
 {
 	union {
@@ -450,7 +454,7 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re
 			if (*fmt == 'm') {
 				flag[FLAG_PLUS] = '\0';
 				flag[FLAG_0_PAD] = ' ';
-				p = __glibc_strerror_r_internal(errno, tmp, sizeof(tmp));
+				p = __glibc_strerror_r(errno, tmp, sizeof(tmp));
 				goto print;
 			}
 #endif
@@ -711,4 +715,5 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re
 
 	return i;
 }
-strong_alias(__vfprintf,vfprintf)
+libc_hidden_proto(vfprintf)
+libc_hidden_def(vfprintf)
diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c
index f750cd11c..fd0c74c48 100644
--- a/libc/stdio/open_memstream.c
+++ b/libc/stdio/open_memstream.c
@@ -5,10 +5,12 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
-#define fopencookie __fopencookie
-
 #include "_stdio.h"
 
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memset)
+libc_hidden_proto(fopencookie)
+
 #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
 #error no custom streams!
 #endif
@@ -53,7 +55,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize)
 		}
 	}
 
-	__memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
+	memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
 	COOKIE->pos += bufsize;
 
 	if (COOKIE->pos > COOKIE->eof) {
@@ -92,7 +94,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
 		if (buf) {
 			*COOKIE->bufloc = COOKIE->buf = buf;
 			COOKIE->len = leastlen;
-			__memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */
+			memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */
 		} else {
 			/* TODO: check glibc errno setting... */
 			return -1;
@@ -102,7 +104,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
 	*pos = COOKIE->pos = --leastlen;
 
 	if (leastlen > COOKIE->eof) {
-		__memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
+		memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
 		*COOKIE->sizeloc = COOKIE->eof;
 	}
 
@@ -126,7 +128,7 @@ static const cookie_io_functions_t _oms_io_funcs = {
  * (ie replace the FILE buffer with the cookie buffer and update FILE bufstart,
  * etc. whenever we seek). */
 
-FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc)
+FILE *open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc)
 {
 	register __oms_cookie *cookie;
 	register FILE *fp;
@@ -162,4 +164,5 @@ FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__rest
 
 	return NULL;
 }
-strong_alias(__open_memstream,open_memstream)
+libc_hidden_proto(open_memstream)
+libc_hidden_def(open_memstream)
diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c
index 9edcf4efb..f10667cbf 100644
--- a/libc/stdio/perror.c
+++ b/libc/stdio/perror.c
@@ -7,11 +7,14 @@
 
 #include "_stdio.h"
 
+libc_hidden_proto(fprintf)
+libc_hidden_proto(__glibc_strerror_r)
+
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning CONSIDER: Increase buffer size for error message (non-%m case)?
 #endif
 
-void attribute_hidden __perror(register const char *s)
+void perror(register const char *s)
 {
 	/* If the program is calling perror, it's a safe bet that printf and
 	 * friends are used as well.  It is also possible that the calling
@@ -30,8 +33,9 @@ void attribute_hidden __perror(register const char *s)
 	{
 		char buf[64];
 		fprintf(stderr, "%s%s%s\n", s, sep,
-				__glibc_strerror_r_internal(errno, buf, sizeof(buf)));
+				__glibc_strerror_r(errno, buf, sizeof(buf)));
 	}
 #endif
 }
-strong_alias(__perror,perror)
+libc_hidden_proto(perror)
+libc_hidden_def(perror)
diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c
index f84a27a3c..501cd415c 100644
--- a/libc/stdio/popen.c
+++ b/libc/stdio/popen.c
@@ -1,6 +1,7 @@
 /* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  *
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  *
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
@@ -14,20 +15,23 @@
  *   Fix failure exit code for failed execve().
  */
 
-#define waitpid __waitpid
-#define execl __execl
-#define dup2 __dup2
-#define fdopen __fdopen
-#define pipe __pipe
-#define vfork __vfork
-#define fork __fork
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sys/wait.h>
 
+libc_hidden_proto(close)
+libc_hidden_proto(_exit)
+libc_hidden_proto(waitpid)
+libc_hidden_proto(execl)
+libc_hidden_proto(dup2)
+libc_hidden_proto(fdopen)
+libc_hidden_proto(pipe)
+libc_hidden_proto(vfork)
+libc_hidden_proto(fork)
+libc_hid