Vampirise three new patches for uClibc, coming from buildroot.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed May 14 17:40:28 2008 +0000 (2008-05-14)
changeset 498fc7db1806873
parent 497 075fe8e4cd18
child 499 b9bdd6088f87
Vampirise three new patches for uClibc, coming from buildroot.

/trunk/patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch | 12 12 0 0 +
/trunk/patches/uClibc/0.9.29/800-rm-whitespace.patch | 86 86 0 0 ++++++
/trunk/patches/uClibc/0.9.29/700-linuxthreads.patch | 145 145 0 0 ++++++++++
3 files changed, 243 insertions(+)
patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch
patches/uClibc/0.9.29/700-linuxthreads.patch
patches/uClibc/0.9.29/800-rm-whitespace.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch	Wed May 14 17:40:28 2008 +0000
     1.3 @@ -0,0 +1,12 @@
     1.4 +diff -ur uClibc-0.9.29/Makerules uClibc-0.9.29-patched/Makerules
     1.5 +--- uClibc-0.9.29/Makerules	2006-12-10 18:25:23.000000000 -0600
     1.6 ++++ uClibc-0.9.29-patched/Makerules	2008-01-26 17:04:50.965699518 -0600
     1.7 +@@ -96,7 +96,7 @@
     1.8 + disp_ld        = $($(DISP)_disp_ld)
     1.9 + 
    1.10 + cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@))
    1.11 +-cmd_compile.S = $(cmd_compile.c) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
    1.12 ++cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
    1.13 + cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
    1.14 + cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@))
    1.15 + cmd_strip     = $(STRIPTOOL) $(STRIP_FLAGS) $^
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/uClibc/0.9.29/700-linuxthreads.patch	Wed May 14 17:40:28 2008 +0000
     2.3 @@ -0,0 +1,145 @@
     2.4 +--- a/libpthread/linuxthreads.old/attr.c	2006-01-24 12:41:01.000000000 -0500
     2.5 ++++ b/libpthread/linuxthreads.old/attr.c	2008-02-10 11:35:32.000000000 -0500
     2.6 +@@ -25,6 +25,14 @@
     2.7 + #include "pthread.h"
     2.8 + #include "internals.h"
     2.9 + 
    2.10 ++#include <sys/resource.h>
    2.11 ++#include <inttypes.h>
    2.12 ++#include <stdio.h>
    2.13 ++#include <stdio_ext.h>
    2.14 ++#include <stdlib.h>
    2.15 ++#include <sys/resource.h>
    2.16 ++
    2.17 ++
    2.18 + /* NOTE: With uClibc I don't think we need this versioning stuff.
    2.19 +  * Therefore, define the function pthread_attr_init() here using
    2.20 +  * a strong symbol. */
    2.21 +@@ -209,4 +217,94 @@ int __pthread_attr_getstacksize(const pt
    2.22 +   *stacksize = attr->__stacksize;
    2.23 +   return 0;
    2.24 + }
    2.25 ++
    2.26 ++
    2.27 ++extern int *__libc_stack_end;
    2.28 ++
    2.29 + weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize)
    2.30 ++void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr)
    2.31 ++{
    2.32 ++    static void *stackBase = 0;
    2.33 ++    static size_t stackSize = 0;
    2.34 ++    int ret = 0;
    2.35 ++    /* Stack size limit.  */
    2.36 ++    struct rlimit rl;
    2.37 ++
    2.38 ++    /* The safest way to get the top of the stack is to read
    2.39 ++    /proc/self/maps and locate the line into which
    2.40 ++    __libc_stack_end falls.  */
    2.41 ++    FILE *fp = fopen("/proc/self/maps", "rc");
    2.42 ++    if (fp == NULL)
    2.43 ++        ret = errno;
    2.44 ++    /* We need the limit of the stack in any case.  */
    2.45 ++    else if (getrlimit (RLIMIT_STACK, &rl) != 0)
    2.46 ++        ret = errno;
    2.47 ++    else {
    2.48 ++        /* We need no locking.  */
    2.49 ++        __fsetlocking (fp, FSETLOCKING_BYCALLER);
    2.50 ++
    2.51 ++        /* Until we found an entry (which should always be the case)
    2.52 ++        mark the result as a failure.  */
    2.53 ++        ret = ENOENT;
    2.54 ++
    2.55 ++        char *line = NULL;
    2.56 ++        size_t linelen = 0;
    2.57 ++        uintptr_t last_to = 0;
    2.58 ++
    2.59 ++        while (! feof_unlocked (fp)) {
    2.60 ++            if (getdelim (&line, &linelen, '\n', fp) <= 0)
    2.61 ++                break;
    2.62 ++
    2.63 ++            uintptr_t from;
    2.64 ++            uintptr_t to;
    2.65 ++            if (sscanf (line, "%x-%x", &from, &to) != 2)
    2.66 ++                continue;
    2.67 ++            if (from <= (uintptr_t) __libc_stack_end
    2.68 ++            && (uintptr_t) __libc_stack_end < to) {
    2.69 ++                /* Found the entry.  Now we have the info we need.  */
    2.70 ++                attr->__stacksize = rl.rlim_cur;
    2.71 ++#ifdef _STACK_GROWS_UP
    2.72 ++                /* Don't check to enforce a limit on the __stacksize */
    2.73 ++                attr->__stackaddr = (void *) from;
    2.74 ++#else
    2.75 ++                attr->__stackaddr = (void *) to;
    2.76 ++
    2.77 ++                /* The limit might be too high.  */
    2.78 ++                if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr - last_to)
    2.79 ++                    attr->__stacksize = (size_t) attr->__stackaddr - last_to;
    2.80 ++#endif
    2.81 ++
    2.82 ++                /* We succeed and no need to look further.  */
    2.83 ++                ret = 0;
    2.84 ++                break;
    2.85 ++            }
    2.86 ++            last_to = to;
    2.87 ++        }
    2.88 ++
    2.89 ++        fclose (fp);
    2.90 ++        free (line);
    2.91 ++    }
    2.92 ++#ifndef _STACK_GROWS_UP
    2.93 ++    stackBase = (char *) attr->__stackaddr - attr->__stacksize;
    2.94 ++#else
    2.95 ++    stackBase = attr->__stackaddr;
    2.96 ++#endif
    2.97 ++    stackSize = attr->__stacksize;
    2.98 ++    return (void*)(stackBase + stackSize);
    2.99 ++}
   2.100 ++
   2.101 ++int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr,
   2.102 ++			     size_t *stacksize)
   2.103 ++{
   2.104 ++  /* XXX This function has a stupid definition.  The standard specifies
   2.105 ++     no error value but what is if no stack address was set?  We simply
   2.106 ++     return the value we have in the member.  */
   2.107 ++#ifndef _STACK_GROWS_UP
   2.108 ++  *stackaddr = (char *) attr->__stackaddr - attr->__stacksize;
   2.109 ++#else
   2.110 ++  *stackaddr = attr->__stackaddr;
   2.111 ++#endif
   2.112 ++  *stacksize = attr->__stacksize;
   2.113 ++  return 0;
   2.114 ++}
   2.115 ++weak_alias (__pthread_attr_getstack, pthread_attr_getstack)
   2.116 +
   2.117 +--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h	2006-12-07 22:19:36.000000000 -0500
   2.118 ++++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h	2008-02-10 11:42:35.000000000 -0500
   2.119 +@@ -288,15 +288,11 @@ extern int pthread_attr_getstacksize (__
   2.120 + 				      __attr, size_t *__restrict __stacksize)
   2.121 +      __THROW;
   2.122 + 
   2.123 +-#if 0
   2.124 +-/* Not yet implemented in uClibc! */
   2.125 +-
   2.126 + #ifdef __USE_GNU
   2.127 + /* Initialize thread attribute *ATTR with attributes corresponding to the
   2.128 +    already running thread TH.  It shall be called on unitialized ATTR
   2.129 +    and destroyed with pthread_attr_destroy when no longer needed.  */
   2.130 +-extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW;
   2.131 +-#endif
   2.132 ++extern void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr);
   2.133 + #endif
   2.134 + 
   2.135 + /* Functions for scheduling control.  */
   2.136 +@@ -599,6 +595,11 @@ extern int pthread_cancel (pthread_t __c
   2.137 +    cancelled.  */
   2.138 + extern void pthread_testcancel (void);
   2.139 + 
   2.140 ++/* Return the previously set address for the stack.  */
   2.141 ++extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
   2.142 ++				  void **__restrict __stackaddr,
   2.143 ++				  size_t *__restrict __stacksize) __THROW;
   2.144 ++
   2.145 + 
   2.146 + /* Install a cleanup handler: ROUTINE will be called with arguments ARG
   2.147 +    when the thread is cancelled or calls pthread_exit.  ROUTINE will also
   2.148 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/uClibc/0.9.29/800-rm-whitespace.patch	Wed May 14 17:40:28 2008 +0000
     3.3 @@ -0,0 +1,86 @@
     3.4 +diff -urN uClibc-0.9.29-0rig/include/assert.h uClibc-0.9.29/include/assert.h
     3.5 +--- uClibc-0.9.29-0rig/include/assert.h	2005-11-03 23:42:46.000000000 +0100
     3.6 ++++ uClibc-0.9.29/include/assert.h	2007-08-13 19:10:57.000000000 +0200
     3.7 +@@ -31,7 +31,7 @@
     3.8 + #define	_ASSERT_H	1
     3.9 + #include <features.h>
    3.10 + 
    3.11 +-#if defined __cplusplus && __GNUC_PREREQ (2,95)
    3.12 ++#if defined __cplusplus && __GNUC_PREREQ(2,95)
    3.13 + # define __ASSERT_VOID_CAST static_cast<void>
    3.14 + #else
    3.15 + # define __ASSERT_VOID_CAST (void)
    3.16 +@@ -59,13 +59,17 @@
    3.17 +   (__ASSERT_VOID_CAST ((expr) ? 0 :					      \
    3.18 + 		       (__assert (__STRING(expr), __FILE__, __LINE__,    \
    3.19 + 				       __ASSERT_FUNCTION), 0)))
    3.20 +-  
    3.21 ++
    3.22 ++/* Define some temporaries to workaround tinyx makedepend bug */
    3.23 ++#define	__GNUC_PREREQ_2_6	__GNUC_PREREQ(2, 6)
    3.24 ++#define	__GNUC_PREREQ_2_4	__GNUC_PREREQ(2, 4)
    3.25 + /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
    3.26 +    which contains the name of the function currently being defined.
    3.27 +    This is broken in G++ before version 2.6.
    3.28 +    C9x has a similar variable called __func__, but prefer the GCC one since
    3.29 +    it demangles C++ function names.  */
    3.30 +-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
    3.31 ++
    3.32 ++# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4
    3.33 + #   define __ASSERT_FUNCTION	__PRETTY_FUNCTION__
    3.34 + # else
    3.35 + #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
    3.36 +diff -urN uClibc-0.9.29-0rig/include/complex.h uClibc-0.9.29/include/complex.h
    3.37 +--- uClibc-0.9.29-0rig/include/complex.h	2002-05-09 10:15:21.000000000 +0200
    3.38 ++++ uClibc-0.9.29/include/complex.h	2007-08-13 17:55:29.000000000 +0200
    3.39 +@@ -33,7 +33,7 @@
    3.40 + /* We might need to add support for more compilers here.  But since ISO
    3.41 +    C99 is out hopefully all maintained compilers will soon provide the data
    3.42 +    types `float complex' and `double complex'.  */
    3.43 +-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
    3.44 ++#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97)
    3.45 + # define _Complex __complex__
    3.46 + #endif
    3.47 + 
    3.48 +diff -urN uClibc-0.9.29-0rig/include/features.h uClibc-0.9.29/include/features.h
    3.49 +--- uClibc-0.9.29-0rig/include/features.h	2006-11-29 22:10:04.000000000 +0100
    3.50 ++++ uClibc-0.9.29/include/features.h	2007-08-13 17:55:51.000000000 +0200
    3.51 +@@ -143,7 +143,7 @@
    3.52 + 
    3.53 + /* Convenience macros to test the versions of glibc and gcc.
    3.54 +    Use them like this:
    3.55 +-   #if __GNUC_PREREQ (2,8)
    3.56 ++   #if __GNUC_PREREQ(2,8)
    3.57 +    ... code requiring gcc 2.8 or later ...
    3.58 +    #endif
    3.59 +    Note - they won't work for gcc1 or glibc1, since the _MINOR macros
    3.60 +@@ -297,7 +297,7 @@
    3.61 + /* uClibc does not support _FORTIFY_SOURCE */
    3.62 + #undef _FORTIFY_SOURCE
    3.63 + #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
    3.64 +-    && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
    3.65 ++    && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
    3.66 + # if _FORTIFY_SOURCE > 1
    3.67 + #  define __USE_FORTIFY_LEVEL 2
    3.68 + # else
    3.69 +@@ -366,7 +366,7 @@
    3.70 + #endif	/* !ASSEMBLER */
    3.71 + 
    3.72 + /* Decide whether we can define 'extern inline' functions in headers.  */
    3.73 +-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
    3.74 ++#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \
    3.75 +     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
    3.76 + # define __USE_EXTERN_INLINES	1
    3.77 + #endif
    3.78 +diff -urN uClibc-0.9.29-0rig/include/tgmath.h uClibc-0.9.29/include/tgmath.h
    3.79 +--- uClibc-0.9.29-0rig/include/tgmath.h	2002-05-09 10:15:21.000000000 +0200
    3.80 ++++ uClibc-0.9.29/include/tgmath.h	2007-08-13 17:56:17.000000000 +0200
    3.81 +@@ -34,7 +34,7 @@
    3.82 +    do not try this for now and instead concentrate only on GNU CC.  Once
    3.83 +    we have more information support for other compilers might follow.  */
    3.84 + 
    3.85 +-#if __GNUC_PREREQ (2, 7)
    3.86 ++#if __GNUC_PREREQ(2, 7)
    3.87 + 
    3.88 + # ifdef __NO_LONG_DOUBLE_MATH
    3.89 + #  define __tgml(fct) fct