The gcc-4.4 documentation still suggests that the compiler will automatically
do format checking for the standard format function prototypes, but it is now
also barking warnings suggesting that we add them for this lot too. So added.

Signed-off-by: Ron Lee <ron@debian.org>
---
 include/stdio.h |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

Index: uClibc-0.9.30.1/include/stdio.h
===================================================================
--- uClibc-0.9.30.1.orig/include/stdio.h	2008-09-30 14:17:04.000000000 +0200
+++ uClibc-0.9.30.1/include/stdio.h	2009-07-06 21:16:14.000000000 +0200
@@ -325,7 +325,8 @@
 extern int printf (__const char *__restrict __format, ...);
 /* Write formatted output to S.  */
 extern int sprintf (char *__restrict __s,
-		    __const char *__restrict __format, ...) __THROW;
+			__const char *__restrict __format, ...)
+	__THROW __attribute__ ((__format__ (__printf__, 2, 3)));
 
 /* Write formatted output to S from argument list ARG.
 
@@ -340,7 +341,8 @@
 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
 /* Write formatted output to S from argument list ARG.  */
 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
-		     __gnuc_va_list __arg) __THROW;
+		     __gnuc_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
 __END_NAMESPACE_STD
 
 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -391,15 +393,18 @@
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fscanf (FILE *__restrict __stream,
-		   __const char *__restrict __format, ...) __wur;
+		 __const char *__restrict __format, ...)
+	__attribute__ ((__format__ (__scanf__, 2, 3))) __wur;
 /* Read formatted input from stdin.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int scanf (__const char *__restrict __format, ...) __wur;
+extern int scanf (__const char *__restrict __format, ...)
+	__attribute__ ((__format__ (__scanf__, 1, 2))) __wur;
 /* Read formatted input from S.  */
 extern int sscanf (__const char *__restrict __s,
-		   __const char *__restrict __format, ...) __THROW;
+		__const char *__restrict __format, ...)
+	__THROW __attribute__ ((__format__ (__scanf__, 2, 3)));
 __END_NAMESPACE_STD
 
 #ifdef	__USE_ISOC99
gcc-4.4 now barks about this, so appease it.

Signed-off-by: Ron Lee <ron@debian.org>
---
 ldso/ldso/arm/dl-sysdep.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
index 5191dd7..75c58b0 100644
--- a/ldso/ldso/arm/dl-sysdep.h
+++ b/ldso/ldso/arm/dl-sysdep.h
@@ -98,11 +98,12 @@ elf_machine_dynamic (void)
   return dynamic;
 }
 
+extern void __dl_start __asm__ ("_dl_start");
+
 /* Return the run-time load address of the shared object.  */
 static __always_inline Elf32_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
-	extern void __dl_start __asm__ ("_dl_start");
 	Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
 	Elf32_Addr pcrel_addr;
 #if defined __OPTIMIZE__ && !defined __thumb__
usage() is also made static in answer to warnings about no prototype.
In __pthread_manager_event() we also have to drop the return statement,
else gcc will in turn complain about a non-returning function having one.

Signed-off-by: Ron Lee <ron@debian.org>
---
 libpthread/linuxthreads.old/manager.c |    4 ++--
 utils/ldconfig.c                      |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
index 19be92f..0617d7d 100644
--- a/libpthread/linuxthreads.old/manager.c
+++ b/libpthread/linuxthreads.old/manager.c
@@ -248,7 +248,7 @@ int attribute_noreturn __pthread_manager(void *arg)
   }
 }
 
-int __pthread_manager_event(void *arg)
+int attribute_noreturn __pthread_manager_event(void *arg)
 {
   /* If we have special thread_self processing, initialize it.  */
 #ifdef INIT_THREAD_SELF
@@ -260,7 +260,7 @@ int __pthread_manager_event(void *arg)
   /* Free it immediately.  */
   __pthread_unlock (THREAD_GETMEM((&__pthread_manager_thread), p_lock));
 
-  return __pthread_manager(arg);
+  __pthread_manager(arg);
 }
 
 /* Process creation */
diff --git a/utils/ldconfig.c b/utils/ldconfig.c
index c52b170..f6aec5c 100644
--- a/utils/ldconfig.c
+++ b/utils/ldconfig.c
@@ -114,7 +114,7 @@ static void warnx(const char *s, ...)
 	fprintf(stderr, "\n");
 }
 
-static void err(int errnum, const char *s, ...)
+static void attribute_noreturn err(int errnum, const char *s, ...)
 {
 	va_list p;
 
@@ -783,7 +783,7 @@ void cache_print(void)
 }
 #endif
 
-void usage(void)
+static void attribute_noreturn usage(void)
 {
 	fprintf(stderr,
 #ifdef __LDSO_CACHE_SUPPORT__
-- 
This keeps gcc-4.4 from nagging that they have no prototypes.

Signed-off-by: Ron Lee <ron@debian.org>
---
 utils/ldconfig.c    |   16 ++++++++--------
 utils/ldd.c         |   12 ++++++------
 utils/readsoname2.c |    2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/utils/ldconfig.c b/utils/ldconfig.c
index f6aec5c..3bd7cee 100644
--- a/utils/ldconfig.c
+++ b/utils/ldconfig.c
@@ -173,8 +173,8 @@ static char *xstrdup(const char *str)
 #define readsonameXX readsoname64
 #define __ELF_NATIVE_CLASS 64
 #include "readsoname2.c"
-char *readsoname(char *name, FILE *infile, int expected_type,
-		 int *type, int elfclass)
+static char *readsoname(char *name, FILE *infile, int expected_type,
+			int *type, int elfclass)
 {
 	char *res;
 
@@ -206,8 +206,8 @@ char *readsoname(char *name, FILE *infile, int expected_type,
  * If the expected, actual/deduced types missmatch we display a warning
  * and use the actual/deduced type.
  */
-char *is_shlib(const char *dir, const char *name, int *type,
-	       int *islink, int expected_type)
+static char *is_shlib(const char *dir, const char *name, int *type,
+		      int *islink, int expected_type)
 {
 	char *good = NULL;
 	char *cp, *cp2;
@@ -323,7 +323,7 @@ char *is_shlib(const char *dir, const char *name, int *type,
 }
 
 /* update the symlink to new library */
-void link_shlib(const char *dir, const char *file, const char *so)
+static void link_shlib(const char *dir, const char *file, const char *so)
 {
 	int change = 1;
 	char libname[BUFFER_SIZE];
@@ -380,7 +380,7 @@ void link_shlib(const char *dir, const char *file, const char *so)
 }
 
 /* figure out which library is greater */
-int libcmp(char *p1, char *p2)
+static int libcmp(char *p1, char *p2)
 {
 	while (*p1) {
 		if (isdigit(*p1) && isdigit(*p2)) {
@@ -412,7 +412,7 @@ struct lib {
 };
 
 /* update all shared library links in a directory */
-void scan_dir(const char *rawname)
+static void scan_dir(const char *rawname)
 {
 	DIR *dir;
 	const char *name;
@@ -554,7 +554,7 @@ void cache_write(void)
 }
 #else
 /* return the list of system-specific directories */
-char *get_extpath(void)
+static char *get_extpath(void)
 {
 	char *res = NULL, *cp;
 	FILE *file;
diff --git a/utils/ldd.c b/utils/ldd.c
index 1f1dc25..02b37f1 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -214,7 +214,7 @@ static char *elf_find_rpath(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic)
 	return NULL;
 }
 
-int check_elf_header(ElfW(Ehdr) *const ehdr)
+static int check_elf_header(ElfW(Ehdr) *const ehdr)
 {
 	if (!ehdr || *(uint32_t*)ehdr != ELFMAG_U32
 	 || ehdr->e_ident[EI_CLASS] != ELFCLASSM
@@ -249,7 +249,7 @@ int check_elf_header(ElfW(Ehdr) *const ehdr)
 static caddr_t cache_addr = NULL;
 static size_t cache_size = 0;
 
-int map_cache(void)
+static int map_cache(void)
 {
 	int fd;
 	struct stat st;
@@ -306,7 +306,7 @@ fail:
 	return -1;
 }
 
-int unmap_cache(void)
+static int unmap_cache(void)
 {
 	if (cache_addr == NULL || cache_addr == (caddr_t) - 1)
 		return -1;
@@ -372,8 +372,8 @@ static void search_for_named_library(char *name, char *result,
 	*result = '\0';
 }
 
-void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic, int is_suid,
-			 struct library *lib)
+static void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic,
+                                int is_suid, struct library *lib)
 {
 	char *buf;
 	char *path;
@@ -608,7 +608,7 @@ static struct library *find_elf_interpreter(ElfW(Ehdr) *ehdr)
 /*
 #warning "There may be two warnings here about vfork() clobbering, ignore them"
 */
-int find_dependancies(char *filename)
+static int find_dependancies(char *filename)
 {
 	int is_suid = 0;
 	FILE *thefile;
diff --git a/utils/readsoname2.c b/utils/readsoname2.c
index a74b46a..5cda331 100644
--- a/utils/readsoname2.c
+++ b/utils/readsoname2.c
@@ -1,4 +1,4 @@
-char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
+static char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
 {
 	ElfW(Ehdr) *epnt;
 	ElfW(Phdr) *ppnt;
-- 
This cuts down on a lot of noise from gcc-4.4

Signed-off-by: Ron Lee <ron@debian.org>
---
 libc/misc/elf/dl-support.c                         |    5 ++---
 libc/sysdeps/linux/arm/aeabi_assert.c              |    5 ++---
 libc/sysdeps/linux/arm/aeabi_atexit.c              |    4 ++--
 libc/sysdeps/linux/arm/aeabi_errno_addr.c          |    4 ++--
 libc/sysdeps/linux/arm/aeabi_localeconv.c          |    4 ++--
 libc/sysdeps/linux/arm/aeabi_memclr.c              |    4 ++--
 libc/sysdeps/linux/arm/aeabi_memcpy.c              |    4 ++--
 libc/sysdeps/linux/arm/aeabi_memmove.c             |    4 ++--
 libc/sysdeps/linux/arm/aeabi_memset.c              |    4 ++--
 libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c      |   15 ++++++---------
 libc/sysdeps/linux/arm/find_exidx.c                |    4 ++--
 .../linuxthreads.old/sysdeps/arm/pt-machine.h      |    4 ++--
 utils/chroot_realpath.c                            |    3 +++
 13 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c
index 3c1d853..4dd155e 100644
--- a/libc/misc/elf/dl-support.c
+++ b/libc/misc/elf/dl-support.c
@@ -17,9 +17,8 @@
 ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 
-void
-internal_function
-_dl_aux_init (ElfW(auxv_t) *av)
+void internal_function _dl_aux_init (ElfW(auxv_t) *av);
+void internal_function _dl_aux_init (ElfW(auxv_t) *av)
 {
    /* Get the program headers base address from the aux vect */
    _dl_phdr = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val;
diff --git a/libc/sysdeps/linux/arm/aeabi_assert.c b/libc/sysdeps/linux/arm/aeabi_assert.c
index 53943ac..348ca9b 100644
--- a/libc/sysdeps/linux/arm/aeabi_assert.c
+++ b/libc/sysdeps/linux/arm/aeabi_assert.c
@@ -22,9 +22,8 @@
 
 /* libc_hidden_proto(__assert) */
 
-void
-__aeabi_assert (const char *assertion, const char *file,
-		unsigned int line)
+void __aeabi_assert(const char *assertion, const char *file, unsigned int line);
+void __aeabi_assert(const char *assertion, const char *file, unsigned int line)
 {
   __assert (assertion, file, line, NULL);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_atexit.c b/libc/sysdeps/linux/arm/aeabi_atexit.c
index 4a7a6f1..ebb233b 100644
--- a/libc/sysdeps/linux/arm/aeabi_atexit.c
+++ b/libc/sysdeps/linux/arm/aeabi_atexit.c
@@ -24,8 +24,8 @@ libc_hidden_proto(__cxa_atexit)
 /* Register a function to be called by exit or when a shared library
    is unloaded.  This routine is like __cxa_atexit, but uses the
    calling sequence required by the ARM EABI.  */
-int
-__aeabi_atexit (void *arg, void (*func) (void *), void *d)
+int __aeabi_atexit (void *arg, void (*func) (void *), void *d);
+int __aeabi_atexit (void *arg, void (*func) (void *), void *d)
 {
   return __cxa_atexit (func, arg, d);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_errno_addr.c b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
index 09bdc1e..5e262a6 100644
--- a/libc/sysdeps/linux/arm/aeabi_errno_addr.c
+++ b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
@@ -18,8 +18,8 @@
 
 #include <errno.h>
 
-volatile int *
-__aeabi_errno_addr (void)
+volatile int * __aeabi_errno_addr (void);
+volatile int * __aeabi_errno_addr (void)
 {
   return &errno;
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_localeconv.c b/libc/sysdeps/linux/arm/aeabi_localeconv.c
index 6fa29bb..4c34f57 100644
--- a/libc/sysdeps/linux/arm/aeabi_localeconv.c
+++ b/libc/sysdeps/linux/arm/aeabi_localeconv.c
@@ -20,8 +20,8 @@
 
 /* libc_hidden_proto(localeconv) */
 
-struct lconv *
-__aeabi_localeconv (void)
+struct lconv * __aeabi_localeconv (void);
+struct lconv * __aeabi_localeconv (void)
 {
   return localeconv ();
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_memclr.c b/libc/sysdeps/linux/arm/aeabi_memclr.c
index c0f9021..9125bac 100644
--- a/libc/sysdeps/linux/arm/aeabi_memclr.c
+++ b/libc/sysdeps/linux/arm/aeabi_memclr.c
@@ -22,8 +22,8 @@
 
 /* Clear memory.  Can't alias to bzero because it's not defined in the
    same translation unit.  */
-void
-__aeabi_memclr (void *dest, size_t n)
+void __aeabi_memclr (void *dest, size_t n);
+void __aeabi_memclr (void *dest, size_t n)
 {
   memset (dest, 0, n);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_memcpy.c b/libc/sysdeps/linux/arm/aeabi_memcpy.c
index 83eac0b..604c139 100644
--- a/libc/sysdeps/linux/arm/aeabi_memcpy.c
+++ b/libc/sysdeps/linux/arm/aeabi_memcpy.c
@@ -23,8 +23,8 @@
 /* Copy memory like memcpy, but no return value required.  Can't alias
    to memcpy because it's not defined in the same translation
    unit.  */
-void
-__aeabi_memcpy (void *dest, const void *src, size_t n)
+void __aeabi_memcpy (void *dest, const void *src, size_t n);
+void __aeabi_memcpy (void *dest, const void *src, size_t n)
 {
   memcpy (dest, src, n);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_memmove.c b/libc/sysdeps/linux/arm/aeabi_memmove.c
index 164d72b..7ecfbb7 100644
--- a/libc/sysdeps/linux/arm/aeabi_memmove.c
+++ b/libc/sysdeps/linux/arm/aeabi_memmove.c
@@ -23,8 +23,8 @@
 /* Copy memory like memmove, but no return value required.  Can't
    alias to memmove because it's not defined in the same translation
    unit.  */
-void
-__aeabi_memmove (void *dest, const void *src, size_t n)
+void __aeabi_memmove (void *dest, const void *src, size_t n);
+void __aeabi_memmove (void *dest, const void *src, size_t n)
 {
   memmove (dest, src, n);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_memset.c b/libc/sysdeps/linux/arm/aeabi_memset.c
index f1c366f..a37e21f 100644
--- a/libc/sysdeps/linux/arm/aeabi_memset.c
+++ b/libc/sysdeps/linux/arm/aeabi_memset.c
@@ -22,8 +22,8 @@
 
 /* Set memory like memset, but different argument order and no return
    value required.  */
-void
-__aeabi_memset (void *dest, size_t n, int c)
+void __aeabi_memset (void *dest, size_t n, int c);
+void __aeabi_memset (void *dest, size_t n, int c)
 {
   memset (dest, c, n);
 }
diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
index e657d38..4544dc7 100644
--- a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
+++ b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
@@ -24,20 +24,17 @@
 
 #include <stdlib.h>
 
-attribute_hidden
-void
-__aeabi_unwind_cpp_pr0 (void)
+attribute_hidden void __aeabi_unwind_cpp_pr0 (void);
+attribute_hidden void __aeabi_unwind_cpp_pr0 (void)
 {
 }
 
-attribute_hidden
-void
-__aeabi_unwind_cpp_pr1 (void)
+attribute_hidden void __aeabi_unwind_cpp_pr1 (void);
+attribute_hidden void __aeabi_unwind_cpp_pr1 (void)
 {
 }
 
-attribute_hidden
-void
-__aeabi_unwind_cpp_pr2 (void)
+attribute_hidden void __aeabi_unwind_cpp_pr2 (void);
+attribute_hidden void __aeabi_unwind_cpp_pr2 (void)
 {
 }
diff --git a/libc/sysdeps/linux/arm/find_exidx.c b/libc/sysdeps/linux/arm/find_exidx.c
index 9e4f401..a16534b 100644
--- a/libc/sysdeps/linux/arm/find_exidx.c
+++ b/libc/sysdeps/linux/arm/find_exidx.c
@@ -65,8 +65,8 @@ find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr)
 
 /* Find the exception index table containing PC.  */
 
-_Unwind_Ptr
-__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
+_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount);
+_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
 {
   struct unw_eh_callback_data data;
 
diff --git a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
index 14eb6f6..583eb68 100644
--- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
@@ -33,8 +33,8 @@
    time; let's hope nobody tries to use one.  */
 
 /* Spinlock implementation; required.  */
-PT_EI long int
-testandset (int *spinlock)
+PT_EI long int testandset (int *spinlock);
+PT_EI long int testandset (int *spinlock)
 {
   register unsigned int ret;
 
diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
index 82ccbf6..d912a06 100644
--- a/utils/chroot_realpath.c
+++ b/utils/chroot_realpath.c
@@ -25,6 +25,9 @@
 #define MAX_READLINKS 32
 
 char *chroot_realpath(const char *chroot, const char *path,
+		      char resolved_path[]);
+
+char *chroot_realpath(const char *chroot, const char *path,
 		      char resolved_path[])
 {
 	char copy_path[PATH_MAX];
-- 
Once again all of these reduce the noise from gcc-4.4.
Replaces a few more (USE_TLS && HAVE___THREAD) with USE___THREAD while we need
to mess with them for this anyhow.

Signed-off-by: Ron Lee <ron@debian.org>
---
 libc/misc/fnmatch/fnmatch.c                        |    2 +-
 libpthread/linuxthreads.old/cancel.c               |    6 +++---
 libpthread/linuxthreads.old/libc_pthread_init.c    |    4 ++--
 libpthread/linuxthreads.old/pthread.c              |    2 +-
 libpthread/linuxthreads.old/ptlongjmp.c            |    4 ++--
 libpthread/linuxthreads.old/specific.c             |    2 +-
 .../linuxthreads.old_db/td_thr_tls_get_addr.c      |    2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

Index: uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c
===================================================================
--- uClibc-0.9.30.1.orig/libc/misc/fnmatch/fnmatch.c	2008-06-01 22:44:48.000000000 +0200
+++ uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c	2009-07-06 21:16:29.000000000 +0200
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/cancel.c	2008-07-23 13:23:36.000000000 +0200
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c	2009-07-06 21:16:29.000000000 +0200
@@ -31,7 +31,7 @@
 
 #ifdef _STACK_GROWS_DOWN
 # define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
-#elif _STACK_GROWS_UP
+#elif defined _STACK_GROWS_UP
 # define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other)
 #else
 # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
@@ -193,10 +193,10 @@
 
   for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
     {
-#if _STACK_GROWS_DOWN
+#ifdef _STACK_GROWS_DOWN
       if ((char *) c <= currentframe)
 	break;
-#elif _STACK_GROWS_UP
+#elif defined _STACK_GROWS_UP
       if ((char *) c >= currentframe)
 	break;
 #else
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/libc_pthread_init.c	2008-05-20 10:47:51.000000000 +0200
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c	2009-07-06 21:17:10.000000000 +0200
@@ -26,7 +26,7 @@
 
 /* Experimentally off - libc_hidden_proto(memcpy) */
 
-#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
+#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
 libc_hidden_proto(uselocale)
 #endif
 
@@ -42,7 +42,7 @@
 	  sizeof (__libc_pthread_functions));
 #endif
 
-#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
+#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
   /* Initialize thread-locale current locale to point to the global one.
      With __thread support, the variable's initializer takes care of this.  */
   uselocale (LC_GLOBAL_LOCALE);
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/pthread.c	2008-10-03 15:59:52.000000000 +0200
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c	2009-07-06 21:17:53.000000000 +0200
@@ -321,7 +321,7 @@
 
 struct pthread_functions __pthread_functions =
   {
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef USE___THREAD
     .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
     .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
     .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/ptlongjmp.c	2006-11-09 09:11:33.000000000 +0100
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c	2009-07-06 21:16:29.000000000 +0200
@@ -35,13 +35,13 @@
        c != NULL && _JMPBUF_UNWINDS(target, c);
        c = c->__prev)
     {
-#if _STACK_GROWS_DOWN
+#ifdef _STACK_GROWS_DOWN
       if ((char *) c <= currentframe)
 	{
 	  c = NULL;
 	  break;
 	}
-#elif _STACK_GROWS_UP
+#elif defined _STACK_GROWS_UP
       if ((char *) c >= currentframe)
 	{
 	  c = NULL;
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/specific.c	2008-05-20 10:47:51.000000000 +0200
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c	2009-07-06 21:18:28.000000000 +0200
@@ -167,7 +167,7 @@
     __pthread_unlock(THREAD_GETMEM(self, p_lock));
 }
 
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef USE___THREAD
 
 /* Thread-specific data for libc. */
 
Index: uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c
===================================================================
--- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c	2005-11-22 22:32:06.000000000 +0100
+++ uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c	2009-07-06 21:16:29.000000000 +0200
@@ -31,7 +31,7 @@
 		     size_t offset __attribute__ ((unused)),
 		     void **address __attribute__ ((unused)))
 {
-#if USE_TLS
+#ifdef USE_TLS
   size_t modid;
   union dtv pdtv, *dtvp;
 
elf.h needs __BYTE_ORDER, and s_scalbn.c needs {LONG,INT}_MAX.
shm.c complains about no prototypes for shm_{open,unlink} without its header.

Signed-off-by: Ron Lee <ron@debian.org>
---
 include/elf.h   |    1 +
 libm/s_scalbn.c |    1 +
 librt/shm.c     |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/elf.h b/include/elf.h
index 0129f1e..16a6972 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -28,6 +28,7 @@ extern "C" {
 /* Standard ELF types.  */
 
 #include <stdint.h>
+#include <endian.h>
 
 /* Type for a 16-bit quantity.  */
 typedef uint16_t Elf32_Half;
diff --git a/libm/s_scalbn.c b/libm/s_scalbn.c
index c534467..47983b0 100644
--- a/libm/s_scalbn.c
+++ b/libm/s_scalbn.c
@@ -18,6 +18,7 @@
 
 #include "math.h"
 #include "math_private.h"
+#include <limits.h>
 
 static const double
 two54  = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
-- 
gcc-4.4 barks about that.

Signed-off-by: Ron Lee <ron@debian.org>
---
 utils/ldconfig.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/ldconfig.c b/utils/ldconfig.c
index 3bd7cee..505316b 100644
--- a/utils/ldconfig.c
+++ b/utils/ldconfig.c
@@ -127,14 +127,14 @@ static void attribute_noreturn err(int errnum, const char *s, ...)
 
 static void vperror_msg(const char *s, va_list p)
 {
-	int err = errno;
+	int e = errno;
 
 	if (s == 0)
 		s = "";
 	verror_msg(s, p);
 	if (*s)
 		s = ": ";
-	fprintf(stderr, "%s%s\n", s, strerror(err));
+	fprintf(stderr, "%s%s\n", s, strerror(e));
 }
 
 static void warn(const char *s, ...)
-- 
Signed-off-by: Ron Lee <ron@debian.org>
---
 utils/ldconfig.c |   10 +++++-----
 utils/ldd.c      |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/utils/ldconfig.c b/utils/ldconfig.c
index 505316b..139b5f9 100644
--- a/utils/ldconfig.c
+++ b/utils/ldconfig.c
@@ -558,18 +558,18 @@ static char *get_extpath(void)
 {
 	char *res = NULL, *cp;
 	FILE *file;
-	struct stat stat;
+	struct stat st;
 	char realconffile[BUFFER_SIZE];
 
 	if (!chroot_realpath(chroot_dir, conffile, realconffile))
 		return NULL;
 
 	if ((file = fopen(realconffile, "r")) != NULL) {
-		fstat(fileno(file), &stat);
-		res = xmalloc(stat.st_size + 1);
-		fread(res, 1, stat.st_size, file);
+		fstat(fileno(file), &st);
+		res = xmalloc(st.st_size + 1);
+		fread(res, 1, st.st_size, file);
 		fclose(file);
-		res[stat.st_size] = '\0';
+		res[st.st_size] = '\0';
 
 		/* convert comments fo spaces */
 		for (cp = res; *cp; /*nada */ ) {
diff --git a/utils/ldd.c b/utils/ldd.c
index 02b37f1..e7a94cb 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -683,8 +683,8 @@ foo:
 	    && ehdr->e_ident[EI_VERSION] == EV_CURRENT
 	    && MATCH_MACHINE(ehdr->e_machine))
 	{
-		struct stat statbuf;
-		if (stat(interp->path, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) {
+		struct stat st;
+		if (stat(interp->path, &st) == 0 && S_ISREG(st.st_mode)) {
 			pid_t pid;
 			int status;
 			static const char *const environment[] = {
-- 
Signed-off-by: Ron Lee <ron@debian.org>
---
 libpthread/linuxthreads.old/manager.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
index 0617d7d..88c9253 100644
--- a/libpthread/linuxthreads.old/manager.c
+++ b/libpthread/linuxthreads.old/manager.c
@@ -578,9 +578,9 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
       /* See whether the TD_CREATE event bit is set in any of the
          masks.  */
       int idx = __td_eventword (TD_CREATE);
-      uint32_t mask = __td_eventmask (TD_CREATE);
+      uint32_t m = __td_eventmask (TD_CREATE);
 
-      if ((mask & (__pthread_threads_events.event_bits[idx]
+      if ((m & (__pthread_threads_events.event_bits[idx]
 		   | event_maskp->event_bits[idx])) != 0)
 	{
 	  /* Lock the mutex the child will use now so that it will stop.  */
-- 
Signed-off-by: Ron Lee <ron@debian.org>
---
 utils/chroot_realpath.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
index d912a06..0be57bf 100644
--- a/utils/chroot_realpath.c
+++ b/utils/chroot_realpath.c
@@ -24,10 +24,10 @@
 
 #define MAX_READLINKS 32
 
-char *chroot_realpath(const char *chroot, const char *path,
+char *chroot_realpath(const char *root, const char *path,
 		      char resolved_path[]);
 
-char *chroot_realpath(const char *chroot, const char *path,
+char *chroot_realpath(const char *root, const char *path,
 		      char resolved_path[])
 {
 	char copy_path[PATH_MAX];
@@ -41,13 +41,13 @@ char *chroot_realpath(const char *chroot, const char *path,
 	int chroot_len;
 
 	/* Trivial case. */
-	if (chroot == NULL || *chroot == '\0' ||
-	    (*chroot == '/' && chroot[1] == '\0')) {
+	if (root == NULL || *root == '\0' ||
+	    (*root == '/' && root[1] == '\0')) {
 		strcpy(resolved_path, path);
 		return resolved_path;
 	}
 
-	chroot_len = strlen(chroot);
+	chroot_len = strlen(root);
 
 	if (chroot_len + strlen(path) >= PATH_MAX - 3) {
 		errno = ENAMETOOLONG;
@@ -60,7 +60,7 @@ char *chroot_realpath(const char *chroot, const char *path,
 	max_path = copy_path + PATH_MAX - chroot_len - 3;
 
 	/* Start with the chroot path. */
-	strcpy(new_path, chroot);
+	strcpy(new_path, root);
 	new_path += chroot_len;
 	while (*new_path == '/' && new_path > got_path)
 		new_path--;
-- 
Signed-off-by: Ron Lee <ron@debian.org>
---
 ldso/ldso/dl-elf.c      |    4 +++-
 ldso/ldso/dl-startup.c  |    3 ++-
 libc/inet/getaddrinfo.c |    9 ++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

Index: uClibc-0.9.30.1/ldso/ldso/dl-elf.c
===================================================================
--- uClibc-0.9.30.1.orig/ldso/ldso/dl-elf.c	2008-11-18 15:01:35.000000000 +0100
+++ uClibc-0.9.30.1/ldso/ldso/dl-elf.c	2009-07-06 21:20:03.000000000 +0200
@@ -341,6 +341,7 @@
 	ElfW(Addr) relro_addr = 0;
 	size_t relro_size = 0;
 	struct stat st;
+	uint32_t *p32;
 	DL_LOADADDR_TYPE lib_loadaddr;
 	DL_INIT_LOADADDR_EXTRA_DECLS
 
Index: uClibc-0.9.30.1/ldso/ldso/dl-startup.c
===================================================================
--- uClibc-0.9.30.1.orig/ldso/ldso/dl-startup.c	2008-05-30 16:22:26.000000000 +0200
+++ uClibc-0.9.30.1/ldso/ldso/dl-startup.c	2009-07-06 21:20:03.000000000 +0200
@@ -122,6 +122,7 @@
 	struct elf_resolve *tpnt = &tpnt_tmp;
 	ElfW(auxv_t) auxvt[AT_EGID + 1];
 	ElfW(Dyn) *dpnt;
+	uint32_t  *p32;
 
 	/* WARNING! -- we cannot make _any_ funtion calls until we have
 	 * taken care of fixing up our own relocations.  Making static
Index: uClibc-0.9.30.1/libc/inet/getaddrinfo.c
===================================================================
--- uClibc-0.9.30.1.orig/libc/inet/getaddrinfo.c	2009-02-26 13:49:14.000000000 +0100
+++ uClibc-0.9.30.1/libc/inet/getaddrinfo.c	2009-07-06 21:20:03.000000000 +0200
@@ -539,7 +539,8 @@
 
 				if (scope_delim != NULL) {
 					int try_numericscope = 0;
-					if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
+					uint32_t *a32 = (uint32_t*)at->addr;
+					if (IN6_IS_ADDR_LINKLOCAL(a32) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
 						at->scopeid = if_nametoindex(scope_delim + 1);
 						if (at->scopeid == 0)
 							try_numericscope = 1;
@@ -617,8 +618,10 @@
 #endif
 		if (req->ai_family == 0 || req->ai_family == AF_INET) {
 			atr->family = AF_INET;
-			if ((req->ai_flags & AI_PASSIVE) == 0)
-				*(uint32_t*)atr->addr = htonl(INADDR_LOOPBACK);
+			if ((req->ai_flags & AI_PASSIVE) == 0) {
+				uint32_t *a = (uint32_t*)atr->addr;
+				*a = htonl(INADDR_LOOPBACK);
+			}
 		}
 	}
 
From 8ee834680d39677a60e26a0de4ece2f0c1ebbde2 Mon Sep 17 00:00:00 2001
From: Ron <ron@debian.org>
Date: Sat, 27 Jun 2009 04:44:27 +0930
Subject: [PATCH] Avoid warnings about shifting more bits than we have

The test here is a constant expression and will compile out.
For platforms that don't need the shift the code gets slightly smaller
and simpler, for those that do the result is unchanged.

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 libc/sysdeps/linux/arm/posix_fadvise.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

--- a/libc/sysdeps/linux/arm/posix_fadvise.c
+++ b/libc/sysdeps/linux/arm/posix_fadvise.c
@@ -10,6 +10,9 @@
 #include <sys/syscall.h>
 #include <fcntl.h>
 #if defined __NR_arm_fadvise64_64
+
+#define HIGH_BITS(x) (sizeof(x) > 4 ? (x) >> 32 : 0)
+
 /* This is for the ARM version of fadvise64_64 which swaps the params
  *  * about to avoid having ABI compat issues
  *   */
@@ -18,8 +21,8 @@
 {
   INTERNAL_SYSCALL_DECL (err);
   int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
-                              __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
-                              __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
+                              __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset),
+                              __LONG_LONG_PAIR (HIGH_BITS(len), (long)len));
 
     if (INTERNAL_SYSCALL_ERROR_P (ret, err))
       return INTERNAL_SYSCALL_ERRNO (ret, err);
