From cb649fea3e85629aae6be48a40a7ac842c5b9720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 7 Apr 2014 11:14:24 +0300 Subject: main/musl: align with latest git * armv6 patch is there now (including an important fix) * two additional important bug fixes --- main/musl/0003-b9b2db2f-to-1974bffa.patch | 156 +++++++++++++++++++++++++ main/musl/1002-no-kuser_helpers-on-armv6.patch | 64 ---------- main/musl/APKBUILD | 8 +- 3 files changed, 160 insertions(+), 68 deletions(-) create mode 100644 main/musl/0003-b9b2db2f-to-1974bffa.patch delete mode 100644 main/musl/1002-no-kuser_helpers-on-armv6.patch (limited to 'main/musl') diff --git a/main/musl/0003-b9b2db2f-to-1974bffa.patch b/main/musl/0003-b9b2db2f-to-1974bffa.patch new file mode 100644 index 0000000000..b8089875be --- /dev/null +++ b/main/musl/0003-b9b2db2f-to-1974bffa.patch @@ -0,0 +1,156 @@ +diff --git a/arch/arm/atomic.h b/arch/arm/atomic.h +index 734d287..fe88225 100644 +--- a/arch/arm/atomic.h ++++ b/arch/arm/atomic.h +@@ -22,7 +22,28 @@ static inline int a_ctz_64(uint64_t x) + return a_ctz_l(y); + } + ++#if __ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \ ++ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \ ++ || __ARM_ARCH >= 7 ++static inline int __k_cas(int t, int s, volatile int *p) ++{ ++ int ret; ++ __asm__( ++ " mcr p15,0,r0,c7,c10,5\n" ++ "1: ldrex %0,%3\n" ++ " subs %0,%0,%1\n" ++ " strexeq %0,%2,%3\n" ++ " teqeq %0,#1\n" ++ " beq 1b\n" ++ " mcr p15,0,r0,c7,c10,5\n" ++ : "=&r"(ret) ++ : "r"(t), "r"(s), "m"(*p) ++ : "memory", "cc" ); ++ return ret; ++} ++#else + #define __k_cas ((int (*)(int, int, volatile int *))0xffff0fc0) ++#endif + + static inline int a_cas(volatile int *p, int t, int s) + { +diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h +index 43a1c01..ec77a83 100644 +--- a/arch/arm/pthread_arch.h ++++ b/arch/arm/pthread_arch.h +@@ -1,8 +1,22 @@ +-typedef char *(*__ptr_func_t)(void) __attribute__((const)); ++#if __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \ ++ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \ ++ || __ARM_ARCH >= 7 ++ ++static inline __attribute__((const)) pthread_t __pthread_self() ++{ ++ char *p; ++ __asm__( "mrc p15,0,%0,c13,c0,3" : "=r"(p) ); ++ return (void *)(p+8-sizeof(struct pthread)); ++} ++ ++#else + ++typedef char *(*__ptr_func_t)(void) __attribute__((const)); + #define __pthread_self() \ + ((pthread_t)(((__ptr_func_t)0xffff0fe0)()+8-sizeof(struct pthread))) + ++#endif ++ + #define TLS_ABOVE_TP + #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8) + +diff --git a/include/sys/auxv.h b/include/sys/auxv.h +new file mode 100644 +index 0000000..6dcf9ad +--- /dev/null ++++ b/include/sys/auxv.h +@@ -0,0 +1,16 @@ ++#ifndef _SYS_AUXV_H ++#define _SYS_AUXV_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include ++ ++unsigned long getauxval(unsigned long); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c +index 8ac0036..89d081e 100644 +--- a/src/env/__init_tls.c ++++ b/src/env/__init_tls.c +@@ -64,16 +64,6 @@ void *__tls_get_addr(size_t *v) + return (char *)__pthread_self()->dtv[1]+v[1]; + } + +-static void *simple(void *p) +-{ +- *(void **)p = p; +- return __set_thread_area(TP_ADJ(p)) ? 0 : p; +-} +- +-weak_alias(simple, __install_initial_tls); +- +-void *__mmap(void *, size_t, int, int, int, off_t); +- + #if ULONG_MAX == 0xffffffff + typedef Elf32_Phdr Phdr; + #else +diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c +index 73d4932..ac37492 100644 +--- a/src/env/__libc_start_main.c ++++ b/src/env/__libc_start_main.c +@@ -3,7 +3,6 @@ + + void __init_tls(size_t *); + void __init_security(size_t *); +-void __init_ldso_ctors(void); + + #ifndef SHARED + static void dummy() {} +diff --git a/src/misc/getauxval.c b/src/misc/getauxval.c +new file mode 100644 +index 0000000..5ac8b3d +--- /dev/null ++++ b/src/misc/getauxval.c +@@ -0,0 +1,12 @@ ++#include ++#include ++#include "libc.h" ++ ++unsigned long getauxval(unsigned long item) ++{ ++ size_t *auxv = libc.auxv; ++ for (; *auxv; auxv+=2) ++ if (*auxv==item) return auxv[1]; ++ errno = ENOENT; ++ return 0; ++} +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index 31c3d5d..0be7549 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -356,15 +356,15 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + *d = *d + i; + while (*d > 999999999) { + *d--=0; ++ if (d=i; i*=10, e++); + } + } + if (z>d+1) z=d+1; +- for (; !z[-1] && z>a; z--); + } ++ for (; z>a && !z[-1]; z--); + + if ((t|32)=='g') { + if (!p) p++; diff --git a/main/musl/1002-no-kuser_helpers-on-armv6.patch b/main/musl/1002-no-kuser_helpers-on-armv6.patch deleted file mode 100644 index 94379905bc..0000000000 --- a/main/musl/1002-no-kuser_helpers-on-armv6.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Rich Felker - -diff --git a/arch/arm/atomic.h b/arch/arm/atomic.h -index 734d287..ed1f467 100644 ---- a/arch/arm/atomic.h -+++ b/arch/arm/atomic.h -@@ -22,7 +22,28 @@ static inline int a_ctz_64(uint64_t x) - return a_ctz_l(y); - } - -+#if __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \ -+ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \ -+ || __ARM_ARCH >= 6 -+static inline int __k_cas(int t, int s, volatile int *p) -+{ -+ int ret; -+ __asm__( -+ " mcr p15,0,r0,c7,c10,5\n" -+ "1: ldrex %0,[%3]\n" -+ " subs %0,%0,%1\n" -+ " strexeq %0,%2,[%3]\n" -+ " teqeq %0,#1\n" -+ " beq 1b\n" -+ " mcr p15,0,r0,c7,c10,5\n" -+ : "=&r"(ret) -+ : "r"(t), "r"(s), "r"(p) -+ : "memory", "cc" ); -+ return ret; -+} -+#else - #define __k_cas ((int (*)(int, int, volatile int *))0xffff0fc0) -+#endif - - static inline int a_cas(volatile int *p, int t, int s) - { -diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h -index 43a1c01..ae3e80b 100644 ---- a/arch/arm/pthread_arch.h -+++ b/arch/arm/pthread_arch.h -@@ -1,8 +1,22 @@ --typedef char *(*__ptr_func_t)(void) __attribute__((const)); -+#if __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \ -+ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \ -+ || __ARM_ARCH >= 7 -+ -+static inline pthread_t __pthread_self() -+{ -+ char *p; -+ __asm__( "mrc p15,0,%0,c13,c0,3" : "=r"(p) ); -+ return (void *)(p+8-sizeof(struct pthread)); -+} -+ -+#else - -+typedef char *(*__ptr_func_t)(void) __attribute__((const)); - #define __pthread_self() \ - ((pthread_t)(((__ptr_func_t)0xffff0fe0)()+8-sizeof(struct pthread))) - -+#endif -+ - #define TLS_ABOVE_TP - #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8) - - diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index db5bef80dd..2e5329a075 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -16,8 +16,8 @@ subpackages="$pkgname-dev $pkgname-utils" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0001-v1.0.0-to-2b74315d.patch 0002-2b74315d-to-b9b2db2f.patch + 0003-b9b2db2f-to-1974bffa.patch 1001-add-basic-dns-record-parsing-functions.patch - 1002-no-kuser_helpers-on-armv6.patch getopt_long.c __stack_chk_fail_local.c @@ -117,8 +117,8 @@ crosstool() { md5sums="e54664fdf211d27737e328c4462b545e musl-1.0.0.tar.gz d081fc3424229c639e636be2dd00d221 0001-v1.0.0-to-2b74315d.patch 48fa02a48a33bbcb8149edf6540d02f9 0002-2b74315d-to-b9b2db2f.patch +bdf0786d6c0c5f608000a4819f5bf165 0003-b9b2db2f-to-1974bffa.patch a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch -3e275d833412e490f8f75acc76116de3 1002-no-kuser_helpers-on-armv6.patch 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 7b391300396e58fe9073866b5a80cfe8 getconf.c @@ -127,8 +127,8 @@ ef81489a6258501cf45db58dfc6d5211 getent sha256sums="1ad7f45d2972daff19c9e6a92714e6d70f4aad003cd8c3d1e6113432114c1a32 musl-1.0.0.tar.gz aa632b635d472d5a6a49800899ce34cddc89a63a489690faa683d08622b9cd60 0001-v1.0.0-to-2b74315d.patch edc0cebaabd16f894d91c1860bfb70d3f2d9a70cf558c5455689610374447f7d 0002-2b74315d-to-b9b2db2f.patch +fad752a23c837cf3823c4190e932a2a80fa1a20f97d8684c3d5caa143550aa24 0003-b9b2db2f-to-1974bffa.patch 758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch -092cd39fe1f7e6f65b4df1c3de7b0bfb5509b6fb468a467d2580b19db85349f6 1002-no-kuser_helpers-on-armv6.patch d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c 530ea449f93d53fafcb377fa0a23a7564f2961e49c07a8fdef6c960110317301 getconf.c @@ -137,8 +137,8 @@ d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent sha512sums="c76cbfe60cbe9b1ceb1faedddf2dcce0f11c942c8f74e4f217efe63e8e1d7be70fcb6cf1182eeaee90441152c4493d678682cb247a0dbc7537d24f943a7bbdf8 musl-1.0.0.tar.gz e04f0f9de2859d18cb13aa8bfd839cc757aa9d835f133e46b48a760c7e689a92c641abe1e84dcaab6134c22500603e66d9a880f9b80b77e36a063348f5879878 0001-v1.0.0-to-2b74315d.patch 19c09e09d61ba31caeece27ea4241be4f14f73ab958da7f37fc4f0c8391fcaa912a750a2b79c29b3fec24ad22995244c91d1f0372d9b8481c99411e2442c2d4e 0002-2b74315d-to-b9b2db2f.patch +4065011cbd873421d98f82465fc89c47b357fe4013a3cb34346fcd3d800e8c1028c47a41d400f22721116d0a0f9525a0b2bfc3f953a4b2ffa024d1369549d89c 0003-b9b2db2f-to-1974bffa.patch dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch -6a0ba5817b22906fb5503972969f0ba41609121b91427e25ced0cc7f9033f7b80c760d33ce54a815378d4bc77119bf6f2ea25d3da49157fd3d6ac944ea593882 1002-no-kuser_helpers-on-armv6.patch 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c d638cdd02371351190fd0545fb83f44b822fa8c930e9fb47ef93d32a1aaee27641f875e10fa2e9833f1a56dfc2055fb89932a89c88da3e2eb17529bca58f5182 getconf.c -- cgit v1.2.3