Port uClibc patches to 0.9.30.2
authorJoachim Nilsson <jocke@vmlinux.org>
Thu Jan 14 23:06:48 2010 +0100 (2010-01-14)
changeset 1737e034c377c89d
parent 1736 344735b31b02
child 1738 4baa6a9f6415
Port uClibc patches to 0.9.30.2

Some patches from 0.9.30.1 now applied upstream. The reminder have
been only slightly modified to apply cleanly to the new base.

Signed-off-by: Joachim Nilsson <jocke@vmlinux.org>
patches/uClibc/0.9.30.2/100-fix-gethostent_r-failure-retval.patch
patches/uClibc/0.9.30.2/110-arm_fix_alignment.patch
patches/uClibc/0.9.30.2/120-rm-whitespace.patch
patches/uClibc/0.9.30.2/140-gnu89-inline.patch
patches/uClibc/0.9.30.2/200-pack-netinet-structs.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.30.2/100-fix-gethostent_r-failure-retval.patch	Thu Jan 14 23:06:48 2010 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +Original patch from Gentoo.
     1.5 +
     1.6 +-= BEGIN original header =-
     1.7 +-= END original header =-
     1.8 +
     1.9 +diff -durN uClibc-0.9.30.orig/libc/inet/resolv.c uClibc-0.9.30/libc/inet/resolv.c
    1.10 +--- uClibc-0.9.30.orig/libc/inet/resolv.c	2008-11-02 01:25:33.000000000 +0100
    1.11 ++++ uClibc-0.9.30/libc/inet/resolv.c	2009-02-07 09:57:59.000000000 +0100
    1.12 +@@ -1788,7 +1788,7 @@
    1.13 + int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen,
    1.14 + 	struct hostent **result, int *h_errnop)
    1.15 + {
    1.16 +-	int ret;
    1.17 ++	int ret = HOST_NOT_FOUND;
    1.18 + 
    1.19 + 	__UCLIBC_MUTEX_LOCK(mylock);
    1.20 + 	if (__gethostent_fp == NULL) {
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/uClibc/0.9.30.2/110-arm_fix_alignment.patch	Thu Jan 14 23:06:48 2010 +0100
     2.3 @@ -0,0 +1,25 @@
     2.4 +Original patch from Gentoo.
     2.5 +
     2.6 +-= BEGIN original header =-
     2.7 +ARMV5 can use STRD and LDRD access instructions but these accesses need to be 
     2.8 +8 byte aligned. The dynamic linker's malloc needs to match this so structures
     2.9 +become 8 byte aligned to void unaligned accesses.
    2.10 +
    2.11 +RP - 14/02/2008
    2.12 +
    2.13 +-= END original header =-
    2.14 +
    2.15 +Modified slightly for uClibc-0.9.30.2 by Joachim Nilsson <jocke@vmlinux.org>
    2.16 +
    2.17 +diff -durN uClibc-0.9.30.orig/ldso/ldso/arm/dl-sysdep.h uClibc-0.9.30/ldso/ldso/arm/dl-sysdep.h
    2.18 +--- uClibc-0.9.30.orig/ldso/ldso/arm/dl-sysdep.h	2008-09-25 10:35:20.000000000 +0200
    2.19 ++++ uClibc-0.9.30/ldso/ldso/arm/dl-sysdep.h	2009-02-07 09:57:59.000000000 +0100
    2.20 +@@ -15,6 +15,8 @@
    2.21 +   GOT_BASE[1] = (unsigned long) MODULE; \
    2.22 + }
    2.23 + 
    2.24 ++#define DL_MALLOC_ALIGN 8  /* EABI needs 8 byte alignment for STRD LDRD*/
    2.25 ++
    2.26 + static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p)
    2.27 + {
    2.28 + 	unsigned long i,t,inc;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/uClibc/0.9.30.2/120-rm-whitespace.patch	Thu Jan 14 23:06:48 2010 +0100
     3.3 @@ -0,0 +1,88 @@
     3.4 +Original patch from Gentoo.
     3.5 +
     3.6 +-= BEGIN original header =-
     3.7 +-= END original header =-
     3.8 +
     3.9 +diff -durN uClibc-0.9.30.orig/include/assert.h uClibc-0.9.30/include/assert.h
    3.10 +--- uClibc-0.9.30.orig/include/assert.h	2008-07-23 13:23:36.000000000 +0200
    3.11 ++++ uClibc-0.9.30/include/assert.h	2009-02-07 09:57:59.000000000 +0100
    3.12 +@@ -31,7 +31,7 @@
    3.13 + #define	_ASSERT_H	1
    3.14 + #include <features.h>
    3.15 + 
    3.16 +-#if defined __cplusplus && __GNUC_PREREQ (2,95)
    3.17 ++#if defined __cplusplus && __GNUC_PREREQ(2,95)
    3.18 + # define __ASSERT_VOID_CAST static_cast<void>
    3.19 + #else
    3.20 + # define __ASSERT_VOID_CAST (void)
    3.21 +@@ -60,12 +60,15 @@
    3.22 + 		       (__assert (__STRING(expr), __FILE__, __LINE__,    \
    3.23 + 				       __ASSERT_FUNCTION), 0)))
    3.24 + 
    3.25 ++/* Define some temporaries to workaround tinyx makedepend bug */
    3.26 ++#define	__GNUC_PREREQ_2_6	__GNUC_PREREQ(2, 6)
    3.27 ++#define	__GNUC_PREREQ_2_4	__GNUC_PREREQ(2, 4)
    3.28 + /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
    3.29 +    which contains the name of the function currently being defined.
    3.30 +    This is broken in G++ before version 2.6.
    3.31 +    C9x has a similar variable called __func__, but prefer the GCC one since
    3.32 +    it demangles C++ function names.  */
    3.33 +-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
    3.34 ++# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4
    3.35 + #   define __ASSERT_FUNCTION	__PRETTY_FUNCTION__
    3.36 + # else
    3.37 + #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
    3.38 +diff -durN uClibc-0.9.30.orig/include/complex.h uClibc-0.9.30/include/complex.h
    3.39 +--- uClibc-0.9.30.orig/include/complex.h	2008-10-03 16:24:28.000000000 +0200
    3.40 ++++ uClibc-0.9.30/include/complex.h	2009-02-07 09:57:59.000000000 +0100
    3.41 +@@ -33,7 +33,7 @@
    3.42 + /* We might need to add support for more compilers here.  But since ISO
    3.43 +    C99 is out hopefully all maintained compilers will soon provide the data
    3.44 +    types `float complex' and `double complex'.  */
    3.45 +-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
    3.46 ++#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97)
    3.47 + # define _Complex __complex__
    3.48 + #endif
    3.49 + 
    3.50 +diff -durN uClibc-0.9.30.orig/include/features.h uClibc-0.9.30/include/features.h
    3.51 +--- uClibc-0.9.30.orig/include/features.h	2008-09-06 18:45:07.000000000 +0200
    3.52 ++++ uClibc-0.9.30/include/features.h	2009-02-07 09:57:59.000000000 +0100
    3.53 +@@ -143,7 +143,7 @@
    3.54 + 
    3.55 + /* Convenience macros to test the versions of glibc and gcc.
    3.56 +    Use them like this:
    3.57 +-   #if __GNUC_PREREQ (2,8)
    3.58 ++   #if __GNUC_PREREQ(2,8)
    3.59 +    ... code requiring gcc 2.8 or later ...
    3.60 +    #endif
    3.61 +    Note - they won't work for gcc1 or glibc1, since the _MINOR macros
    3.62 +@@ -297,7 +297,7 @@
    3.63 + /* uClibc does not support _FORTIFY_SOURCE */
    3.64 + #undef _FORTIFY_SOURCE
    3.65 + #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
    3.66 +-    && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
    3.67 ++    && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
    3.68 + # if _FORTIFY_SOURCE > 1
    3.69 + #  define __USE_FORTIFY_LEVEL 2
    3.70 + # else
    3.71 +@@ -366,7 +366,7 @@
    3.72 +  * uclibc itself is usually built without __USE_EXTERN_INLINES,
    3.73 +  * remove "&& !defined __OPTIMIZE_SIZE__" part to do otherwise.
    3.74 +  */
    3.75 +-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
    3.76 ++#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \
    3.77 +     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
    3.78 +     && (defined __extern_inline || defined __GNUC_GNU_INLINE__)
    3.79 + # define __USE_EXTERN_INLINES	1
    3.80 +diff -durN uClibc-0.9.30.orig/include/tgmath.h uClibc-0.9.30/include/tgmath.h
    3.81 +--- uClibc-0.9.30.orig/include/tgmath.h	2008-10-03 16:24:28.000000000 +0200
    3.82 ++++ uClibc-0.9.30/include/tgmath.h	2009-02-07 09:57:59.000000000 +0100
    3.83 +@@ -34,7 +34,7 @@
    3.84 +    do not try this for now and instead concentrate only on GNU CC.  Once
    3.85 +    we have more information support for other compilers might follow.  */
    3.86 + 
    3.87 +-#if __GNUC_PREREQ (2, 7)
    3.88 ++#if __GNUC_PREREQ(2, 7)
    3.89 + 
    3.90 + # ifdef __NO_LONG_DOUBLE_MATH
    3.91 + #  define __tgml(fct) fct
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/uClibc/0.9.30.2/140-gnu89-inline.patch	Thu Jan 14 23:06:48 2010 +0100
     4.3 @@ -0,0 +1,16 @@
     4.4 +Original patch from Gentoo.
     4.5 +
     4.6 +-= BEGIN original header =-
     4.7 +-= END original header =-
     4.8 +
     4.9 +diff -durN uClibc-0.9.30.orig/Rules.mak uClibc-0.9.30/Rules.mak
    4.10 +--- uClibc-0.9.30.orig/Rules.mak	2008-11-12 13:24:16.000000000 +0100
    4.11 ++++ uClibc-0.9.30/Rules.mak	2009-02-07 09:57:59.000000000 +0100
    4.12 +@@ -519,6 +519,7 @@
    4.13 + endif
    4.14 + 
    4.15 + CFLAGS += $(call check_gcc,-std=gnu99,)
    4.16 ++CFLAGS += $(call check_gcc,-fgnu89-inline,)
    4.17 + 
    4.18 + LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared \
    4.19 + 	-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/uClibc/0.9.30.2/200-pack-netinet-structs.patch	Thu Jan 14 23:06:48 2010 +0100
     5.3 @@ -0,0 +1,224 @@
     5.4 +diff -urN uClibc-0.9.30.1.orig/include/netinet/igmp.h uClibc-0.9.30.1/include/netinet/igmp.h
     5.5 +--- uClibc-0.9.30.1.orig/include/netinet/igmp.h	2009-04-08 09:00:10.926545132 +0200
     5.6 ++++ uClibc-0.9.30.1/include/netinet/igmp.h	2009-04-08 09:00:26.242514273 +0200
     5.7 +@@ -69,7 +69,7 @@
     5.8 +   u_int8_t igmp_code;             /* routing code */
     5.9 +   u_int16_t igmp_cksum;           /* checksum */
    5.10 +   struct in_addr igmp_group;      /* group address */
    5.11 +-};
    5.12 ++} __attribute__ ((__packed__));
    5.13 + 
    5.14 + #define IGMP_MINLEN			8
    5.15 + 
    5.16 +diff -urN uClibc-0.9.30.1.orig/include/netinet/in.h uClibc-0.9.30.1/include/netinet/in.h
    5.17 +--- uClibc-0.9.30.1.orig/include/netinet/in.h	2009-04-08 09:00:10.926545132 +0200
    5.18 ++++ uClibc-0.9.30.1/include/netinet/in.h	2009-04-08 09:00:26.242514273 +0200
    5.19 +@@ -202,7 +202,7 @@
    5.20 + #define s6_addr			in6_u.u6_addr8
    5.21 + #define s6_addr16		in6_u.u6_addr16
    5.22 + #define s6_addr32		in6_u.u6_addr32
    5.23 +-  };
    5.24 ++  } __attribute__ ((__packed__));
    5.25 + 
    5.26 + extern const struct in6_addr in6addr_any;        /* :: */
    5.27 + extern const struct in6_addr in6addr_loopback;   /* ::1 */
    5.28 +@@ -229,7 +229,7 @@
    5.29 + 			   __SOCKADDR_COMMON_SIZE -
    5.30 + 			   sizeof (in_port_t) -
    5.31 + 			   sizeof (struct in_addr)];
    5.32 +-  };
    5.33 ++  } __attribute__ ((__packed__));
    5.34 + #endif
    5.35 + 
    5.36 + /* Ditto, for IPv6.  */
    5.37 +@@ -240,7 +240,7 @@
    5.38 +     uint32_t sin6_flowinfo;	/* IPv6 flow information */
    5.39 +     struct in6_addr sin6_addr;	/* IPv6 address */
    5.40 +     uint32_t sin6_scope_id;	/* IPv6 scope-id */
    5.41 +-  };
    5.42 ++  } __attribute__ ((__packed__));
    5.43 + 
    5.44 + 
    5.45 + /* IPv4 multicast request.  */
    5.46 +@@ -251,7 +251,7 @@
    5.47 + 
    5.48 +     /* Local IP address of interface.  */
    5.49 +     struct in_addr imr_interface;
    5.50 +-  };
    5.51 ++  } __attribute__ ((__packed__));
    5.52 + 
    5.53 + struct ip_mreq_source
    5.54 +   {
    5.55 +@@ -263,7 +263,7 @@
    5.56 + 
    5.57 +     /* IP address of interface.  */
    5.58 +     struct in_addr imr_sourceaddr;
    5.59 +-  };
    5.60 ++  } __attribute__ ((__packed__));
    5.61 + 
    5.62 + /* Likewise, for IPv6.  */
    5.63 + struct ipv6_mreq
    5.64 +@@ -273,7 +273,7 @@
    5.65 + 
    5.66 +     /* local interface */
    5.67 +     unsigned int ipv6mr_interface;
    5.68 +-  };
    5.69 ++  } __attribute__ ((__packed__));
    5.70 + 
    5.71 + 
    5.72 + /* Multicast group request.  */
    5.73 +@@ -284,7 +284,7 @@
    5.74 + 
    5.75 +     /* Group address.  */
    5.76 +     struct sockaddr_storage gr_group;
    5.77 +-  };
    5.78 ++  } __attribute__ ((__packed__));
    5.79 + 
    5.80 + struct group_source_req
    5.81 +   {
    5.82 +@@ -296,7 +296,7 @@
    5.83 + 
    5.84 +     /* Source address.  */
    5.85 +     struct sockaddr_storage gsr_source;
    5.86 +-  };
    5.87 ++  } __attribute__ ((__packed__));
    5.88 + 
    5.89 + 
    5.90 + /* Full-state filter operations.  */
    5.91 +@@ -315,7 +315,7 @@
    5.92 +     uint32_t imsf_numsrc;
    5.93 +     /* Source addresses.  */
    5.94 +     struct in_addr imsf_slist[1];
    5.95 +-  };
    5.96 ++  } __attribute__ ((__packed__));
    5.97 + 
    5.98 + #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
    5.99 + 				  - sizeof (struct in_addr)		      \
   5.100 +@@ -336,7 +336,7 @@
   5.101 +     uint32_t gf_numsrc;
   5.102 +     /* Source addresses.  */
   5.103 +     struct sockaddr_storage gf_slist[1];
   5.104 +-};
   5.105 ++} __attribute__ ((__packed__));
   5.106 + 
   5.107 + #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
   5.108 + 				   - sizeof (struct sockaddr_storage)	      \
   5.109 +@@ -460,14 +460,14 @@
   5.110 +   {
   5.111 +     struct in6_addr ipi6_addr;	/* src/dst IPv6 address */
   5.112 +     unsigned int ipi6_ifindex;	/* send/recv interface index */
   5.113 +-  };
   5.114 ++  } __attribute__ ((__packed__));
   5.115 + 
   5.116 + /* IPv6 MTU information.  */
   5.117 + struct ip6_mtuinfo
   5.118 +   {
   5.119 +     struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
   5.120 +     uint32_t ip6m_mtu;		   /* path MTU in host byte order */
   5.121 +-  };
   5.122 ++  } __attribute__ ((__packed__));
   5.123 + 
   5.124 + 
   5.125 + #if 0 /*def __USE_GNU*/
   5.126 +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip.h uClibc-0.9.30.1/include/netinet/ip.h
   5.127 +--- uClibc-0.9.30.1.orig/include/netinet/ip.h	2009-04-08 09:00:10.926545132 +0200
   5.128 ++++ uClibc-0.9.30.1/include/netinet/ip.h	2009-04-08 09:00:26.242514273 +0200
   5.129 +@@ -63,7 +63,7 @@
   5.130 +     u_int32_t saddr;
   5.131 +     u_int32_t daddr;
   5.132 +     /*The options start here. */
   5.133 +-  };
   5.134 ++  } __attribute__ ((__packed__));
   5.135 + 
   5.136 + #ifdef __USE_BSD
   5.137 + /*
   5.138 +@@ -127,7 +127,7 @@
   5.139 +     u_int8_t ip_p;			/* protocol */
   5.140 +     u_short ip_sum;			/* checksum */
   5.141 +     struct in_addr ip_src, ip_dst;	/* source and dest address */
   5.142 +-  };
   5.143 ++  } __attribute__ ((__packed__));
   5.144 + 
   5.145 + /*
   5.146 +  * Time stamp option structure.
   5.147 +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h uClibc-0.9.30.1/include/netinet/ip_icmp.h
   5.148 +--- uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h	2009-04-08 09:00:10.926545132 +0200
   5.149 ++++ uClibc-0.9.30.1/include/netinet/ip_icmp.h	2009-04-08 09:00:26.242514273 +0200
   5.150 +@@ -43,7 +43,7 @@
   5.151 +       u_int16_t	mtu;
   5.152 +     } frag;			/* path mtu discovery */
   5.153 +   } un;
   5.154 +-};
   5.155 ++} __attribute__ ((__packed__));
   5.156 + 
   5.157 + #define ICMP_ECHOREPLY		0	/* Echo Reply			*/
   5.158 + #define ICMP_DEST_UNREACH	3	/* Destination Unreachable	*/
   5.159 +@@ -199,7 +199,7 @@
   5.160 + #define	icmp_radv	icmp_dun.id_radv
   5.161 + #define	icmp_mask	icmp_dun.id_mask
   5.162 + #define	icmp_data	icmp_dun.id_data
   5.163 +-};
   5.164 ++} __attribute__ ((__packed__));
   5.165 + 
   5.166 + /*
   5.167 +  * Lower bounds on packet lengths for various types.
   5.168 +diff -urN uClibc-0.9.30.1.orig/include/netinet/tcp.h uClibc-0.9.30.1/include/netinet/tcp.h
   5.169 +--- uClibc-0.9.30.1.orig/include/netinet/tcp.h	2009-04-08 09:00:10.926545132 +0200
   5.170 ++++ uClibc-0.9.30.1/include/netinet/tcp.h	2009-04-08 09:00:26.242514273 +0200
   5.171 +@@ -86,7 +86,7 @@
   5.172 +     u_int16_t th_win;		/* window */
   5.173 +     u_int16_t th_sum;		/* checksum */
   5.174 +     u_int16_t th_urp;		/* urgent pointer */
   5.175 +-};
   5.176 ++} __attribute__ ((__packed__));
   5.177 + 
   5.178 + # else /* !__FAVOR_BSD */
   5.179 + struct tcphdr
   5.180 +@@ -121,7 +121,7 @@
   5.181 +     u_int16_t window;
   5.182 +     u_int16_t check;
   5.183 +     u_int16_t urg_ptr;
   5.184 +-};
   5.185 ++} __attribute__ ((__packed__));
   5.186 + # endif /* __FAVOR_BSD */
   5.187 + 
   5.188 + enum
   5.189 +@@ -226,7 +226,7 @@
   5.190 +   u_int32_t	tcpi_rcv_space;
   5.191 + 
   5.192 +   u_int32_t	tcpi_total_retrans;
   5.193 +-};
   5.194 ++} __attribute__ ((__packed__));
   5.195 + 
   5.196 + 
   5.197 + /* For TCP_MD5SIG socket option.  */
   5.198 +@@ -239,7 +239,7 @@
   5.199 +   u_int16_t	tcpm_keylen;			/* Key length.  */
   5.200 +   u_int32_t	__tcpm_pad2;			/* Zero.  */
   5.201 +   u_int8_t	tcpm_key[TCP_MD5SIG_MAXKEYLEN];	/* Key (binary).  */
   5.202 +-};
   5.203 ++} __attribute__ ((__packed__));
   5.204 + 
   5.205 + #endif /* Misc.  */
   5.206 + 
   5.207 +diff -urN uClibc-0.9.30.1.orig/include/netinet/udp.h uClibc-0.9.30.1/include/netinet/udp.h
   5.208 +--- uClibc-0.9.30.1.orig/include/netinet/udp.h	2009-04-08 09:00:10.926545132 +0200
   5.209 ++++ uClibc-0.9.30.1/include/netinet/udp.h	2009-04-08 09:00:26.242514273 +0200
   5.210 +@@ -61,7 +61,7 @@
   5.211 +   u_int16_t uh_dport;		/* destination port */
   5.212 +   u_int16_t uh_ulen;		/* udp length */
   5.213 +   u_int16_t uh_sum;		/* udp checksum */
   5.214 +-};
   5.215 ++} __attribute__ ((__packed__));
   5.216 + 
   5.217 + #else
   5.218 + 
   5.219 +@@ -71,7 +71,7 @@
   5.220 +   u_int16_t dest;
   5.221 +   u_int16_t len;
   5.222 +   u_int16_t check;
   5.223 +-};
   5.224 ++} __attribute__ ((__packed__));
   5.225 + #endif
   5.226 + 
   5.227 + #define SOL_UDP            17      /* sockopt level for UDP */