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>
This commit is contained in:
Joachim Nilsson 2010-01-14 23:06:48 +01:00
parent 68058e12b8
commit 9bfbd1e3d8
5 changed files with 370 additions and 0 deletions

View File

@ -0,0 +1,17 @@
Original patch from Gentoo.
-= BEGIN original header =-
-= END original header =-
diff -durN uClibc-0.9.30.orig/libc/inet/resolv.c uClibc-0.9.30/libc/inet/resolv.c
--- uClibc-0.9.30.orig/libc/inet/resolv.c 2008-11-02 01:25:33.000000000 +0100
+++ uClibc-0.9.30/libc/inet/resolv.c 2009-02-07 09:57:59.000000000 +0100
@@ -1788,7 +1788,7 @@
int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen,
struct hostent **result, int *h_errnop)
{
- int ret;
+ int ret = HOST_NOT_FOUND;
__UCLIBC_MUTEX_LOCK(mylock);
if (__gethostent_fp == NULL) {

View File

@ -0,0 +1,25 @@
Original patch from Gentoo.
-= BEGIN original header =-
ARMV5 can use STRD and LDRD access instructions but these accesses need to be
8 byte aligned. The dynamic linker's malloc needs to match this so structures
become 8 byte aligned to void unaligned accesses.
RP - 14/02/2008
-= END original header =-
Modified slightly for uClibc-0.9.30.2 by Joachim Nilsson <jocke@vmlinux.org>
diff -durN uClibc-0.9.30.orig/ldso/ldso/arm/dl-sysdep.h uClibc-0.9.30/ldso/ldso/arm/dl-sysdep.h
--- uClibc-0.9.30.orig/ldso/ldso/arm/dl-sysdep.h 2008-09-25 10:35:20.000000000 +0200
+++ uClibc-0.9.30/ldso/ldso/arm/dl-sysdep.h 2009-02-07 09:57:59.000000000 +0100
@@ -15,6 +15,8 @@
GOT_BASE[1] = (unsigned long) MODULE; \
}
+#define DL_MALLOC_ALIGN 8 /* EABI needs 8 byte alignment for STRD LDRD*/
+
static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p)
{
unsigned long i,t,inc;

View File

@ -0,0 +1,88 @@
Original patch from Gentoo.
-= BEGIN original header =-
-= END original header =-
diff -durN uClibc-0.9.30.orig/include/assert.h uClibc-0.9.30/include/assert.h
--- uClibc-0.9.30.orig/include/assert.h 2008-07-23 13:23:36.000000000 +0200
+++ uClibc-0.9.30/include/assert.h 2009-02-07 09:57:59.000000000 +0100
@@ -31,7 +31,7 @@
#define _ASSERT_H 1
#include <features.h>
-#if defined __cplusplus && __GNUC_PREREQ (2,95)
+#if defined __cplusplus && __GNUC_PREREQ(2,95)
# define __ASSERT_VOID_CAST static_cast<void>
#else
# define __ASSERT_VOID_CAST (void)
@@ -60,12 +60,15 @@
(__assert (__STRING(expr), __FILE__, __LINE__, \
__ASSERT_FUNCTION), 0)))
+/* Define some temporaries to workaround tinyx makedepend bug */
+#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6)
+#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4)
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
which contains the name of the function currently being defined.
This is broken in G++ before version 2.6.
C9x has a similar variable called __func__, but prefer the GCC one since
it demangles C++ function names. */
-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
+# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4
# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
# else
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
diff -durN uClibc-0.9.30.orig/include/complex.h uClibc-0.9.30/include/complex.h
--- uClibc-0.9.30.orig/include/complex.h 2008-10-03 16:24:28.000000000 +0200
+++ uClibc-0.9.30/include/complex.h 2009-02-07 09:57:59.000000000 +0100
@@ -33,7 +33,7 @@
/* We might need to add support for more compilers here. But since ISO
C99 is out hopefully all maintained compilers will soon provide the data
types `float complex' and `double complex'. */
-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
+#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97)
# define _Complex __complex__
#endif
diff -durN uClibc-0.9.30.orig/include/features.h uClibc-0.9.30/include/features.h
--- uClibc-0.9.30.orig/include/features.h 2008-09-06 18:45:07.000000000 +0200
+++ uClibc-0.9.30/include/features.h 2009-02-07 09:57:59.000000000 +0100
@@ -143,7 +143,7 @@
/* Convenience macros to test the versions of glibc and gcc.
Use them like this:
- #if __GNUC_PREREQ (2,8)
+ #if __GNUC_PREREQ(2,8)
... code requiring gcc 2.8 or later ...
#endif
Note - they won't work for gcc1 or glibc1, since the _MINOR macros
@@ -297,7 +297,7 @@
/* uClibc does not support _FORTIFY_SOURCE */
#undef _FORTIFY_SOURCE
#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+ && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
# if _FORTIFY_SOURCE > 1
# define __USE_FORTIFY_LEVEL 2
# else
@@ -366,7 +366,7 @@
* uclibc itself is usually built without __USE_EXTERN_INLINES,
* remove "&& !defined __OPTIMIZE_SIZE__" part to do otherwise.
*/
-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
&& (defined __extern_inline || defined __GNUC_GNU_INLINE__)
# define __USE_EXTERN_INLINES 1
diff -durN uClibc-0.9.30.orig/include/tgmath.h uClibc-0.9.30/include/tgmath.h
--- uClibc-0.9.30.orig/include/tgmath.h 2008-10-03 16:24:28.000000000 +0200
+++ uClibc-0.9.30/include/tgmath.h 2009-02-07 09:57:59.000000000 +0100
@@ -34,7 +34,7 @@
do not try this for now and instead concentrate only on GNU CC. Once
we have more information support for other compilers might follow. */
-#if __GNUC_PREREQ (2, 7)
+#if __GNUC_PREREQ(2, 7)
# ifdef __NO_LONG_DOUBLE_MATH
# define __tgml(fct) fct

View File

@ -0,0 +1,16 @@
Original patch from Gentoo.
-= BEGIN original header =-
-= END original header =-
diff -durN uClibc-0.9.30.orig/Rules.mak uClibc-0.9.30/Rules.mak
--- uClibc-0.9.30.orig/Rules.mak 2008-11-12 13:24:16.000000000 +0100
+++ uClibc-0.9.30/Rules.mak 2009-02-07 09:57:59.000000000 +0100
@@ -519,6 +519,7 @@
endif
CFLAGS += $(call check_gcc,-std=gnu99,)
+CFLAGS += $(call check_gcc,-fgnu89-inline,)
LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared \
-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc

View File

@ -0,0 +1,224 @@
diff -urN uClibc-0.9.30.1.orig/include/netinet/igmp.h uClibc-0.9.30.1/include/netinet/igmp.h
--- uClibc-0.9.30.1.orig/include/netinet/igmp.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/igmp.h 2009-04-08 09:00:26.242514273 +0200
@@ -69,7 +69,7 @@
u_int8_t igmp_code; /* routing code */
u_int16_t igmp_cksum; /* checksum */
struct in_addr igmp_group; /* group address */
-};
+} __attribute__ ((__packed__));
#define IGMP_MINLEN 8
diff -urN uClibc-0.9.30.1.orig/include/netinet/in.h uClibc-0.9.30.1/include/netinet/in.h
--- uClibc-0.9.30.1.orig/include/netinet/in.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/in.h 2009-04-08 09:00:26.242514273 +0200
@@ -202,7 +202,7 @@
#define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32
- };
+ } __attribute__ ((__packed__));
extern const struct in6_addr in6addr_any; /* :: */
extern const struct in6_addr in6addr_loopback; /* ::1 */
@@ -229,7 +229,7 @@
__SOCKADDR_COMMON_SIZE -
sizeof (in_port_t) -
sizeof (struct in_addr)];
- };
+ } __attribute__ ((__packed__));
#endif
/* Ditto, for IPv6. */
@@ -240,7 +240,7 @@
uint32_t sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* IPv6 scope-id */
- };
+ } __attribute__ ((__packed__));
/* IPv4 multicast request. */
@@ -251,7 +251,7 @@
/* Local IP address of interface. */
struct in_addr imr_interface;
- };
+ } __attribute__ ((__packed__));
struct ip_mreq_source
{
@@ -263,7 +263,7 @@
/* IP address of interface. */
struct in_addr imr_sourceaddr;
- };
+ } __attribute__ ((__packed__));
/* Likewise, for IPv6. */
struct ipv6_mreq
@@ -273,7 +273,7 @@
/* local interface */
unsigned int ipv6mr_interface;
- };
+ } __attribute__ ((__packed__));
/* Multicast group request. */
@@ -284,7 +284,7 @@
/* Group address. */
struct sockaddr_storage gr_group;
- };
+ } __attribute__ ((__packed__));
struct group_source_req
{
@@ -296,7 +296,7 @@
/* Source address. */
struct sockaddr_storage gsr_source;
- };
+ } __attribute__ ((__packed__));
/* Full-state filter operations. */
@@ -315,7 +315,7 @@
uint32_t imsf_numsrc;
/* Source addresses. */
struct in_addr imsf_slist[1];
- };
+ } __attribute__ ((__packed__));
#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
- sizeof (struct in_addr) \
@@ -336,7 +336,7 @@
uint32_t gf_numsrc;
/* Source addresses. */
struct sockaddr_storage gf_slist[1];
-};
+} __attribute__ ((__packed__));
#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
- sizeof (struct sockaddr_storage) \
@@ -460,14 +460,14 @@
{
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
unsigned int ipi6_ifindex; /* send/recv interface index */
- };
+ } __attribute__ ((__packed__));
/* IPv6 MTU information. */
struct ip6_mtuinfo
{
struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
uint32_t ip6m_mtu; /* path MTU in host byte order */
- };
+ } __attribute__ ((__packed__));
#if 0 /*def __USE_GNU*/
diff -urN uClibc-0.9.30.1.orig/include/netinet/ip.h uClibc-0.9.30.1/include/netinet/ip.h
--- uClibc-0.9.30.1.orig/include/netinet/ip.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/ip.h 2009-04-08 09:00:26.242514273 +0200
@@ -63,7 +63,7 @@
u_int32_t saddr;
u_int32_t daddr;
/*The options start here. */
- };
+ } __attribute__ ((__packed__));
#ifdef __USE_BSD
/*
@@ -127,7 +127,7 @@
u_int8_t ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
- };
+ } __attribute__ ((__packed__));
/*
* Time stamp option structure.
diff -urN uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h uClibc-0.9.30.1/include/netinet/ip_icmp.h
--- uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/ip_icmp.h 2009-04-08 09:00:26.242514273 +0200
@@ -43,7 +43,7 @@
u_int16_t mtu;
} frag; /* path mtu discovery */
} un;
-};
+} __attribute__ ((__packed__));
#define ICMP_ECHOREPLY 0 /* Echo Reply */
#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
@@ -199,7 +199,7 @@
#define icmp_radv icmp_dun.id_radv
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
-};
+} __attribute__ ((__packed__));
/*
* Lower bounds on packet lengths for various types.
diff -urN uClibc-0.9.30.1.orig/include/netinet/tcp.h uClibc-0.9.30.1/include/netinet/tcp.h
--- uClibc-0.9.30.1.orig/include/netinet/tcp.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/tcp.h 2009-04-08 09:00:26.242514273 +0200
@@ -86,7 +86,7 @@
u_int16_t th_win; /* window */
u_int16_t th_sum; /* checksum */
u_int16_t th_urp; /* urgent pointer */
-};
+} __attribute__ ((__packed__));
# else /* !__FAVOR_BSD */
struct tcphdr
@@ -121,7 +121,7 @@
u_int16_t window;
u_int16_t check;
u_int16_t urg_ptr;
-};
+} __attribute__ ((__packed__));
# endif /* __FAVOR_BSD */
enum
@@ -226,7 +226,7 @@
u_int32_t tcpi_rcv_space;
u_int32_t tcpi_total_retrans;
-};
+} __attribute__ ((__packed__));
/* For TCP_MD5SIG socket option. */
@@ -239,7 +239,7 @@
u_int16_t tcpm_keylen; /* Key length. */
u_int32_t __tcpm_pad2; /* Zero. */
u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */
-};
+} __attribute__ ((__packed__));
#endif /* Misc. */
diff -urN uClibc-0.9.30.1.orig/include/netinet/udp.h uClibc-0.9.30.1/include/netinet/udp.h
--- uClibc-0.9.30.1.orig/include/netinet/udp.h 2009-04-08 09:00:10.926545132 +0200
+++ uClibc-0.9.30.1/include/netinet/udp.h 2009-04-08 09:00:26.242514273 +0200
@@ -61,7 +61,7 @@
u_int16_t uh_dport; /* destination port */
u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
-};
+} __attribute__ ((__packed__));
#else
@@ -71,7 +71,7 @@
u_int16_t dest;
u_int16_t len;
u_int16_t check;
-};
+} __attribute__ ((__packed__));
#endif
#define SOL_UDP 17 /* sockopt level for UDP */