Skip to content
Snippets Groups Projects
Commit cb649fea authored by Timo Teräs's avatar Timo Teräs
Browse files

main/musl: align with latest git

* armv6 patch is there now (including an important fix)
* two additional important bug fixes
parent 5a1b449b
No related branches found
No related tags found
No related merge requests found
From: Rich Felker <dalias@aerifal.cx>
diff --git a/arch/arm/atomic.h b/arch/arm/atomic.h
index 734d287..ed1f467 100644
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_6K__ || __ARM_ARCH_6ZK__ \
+#if __ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \
+ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \
+ || __ARM_ARCH >= 6
+ || __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"
+ "1: ldrex %0,%3\n"
+ " subs %0,%0,%1\n"
+ " strexeq %0,%2,[%3]\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)
+ : "r"(t), "r"(s), "m"(*p)
+ : "memory", "cc" );
+ return ret;
+}
......@@ -34,7 +32,7 @@ index 734d287..ed1f467 100644
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
index 43a1c01..ec77a83 100644
--- a/arch/arm/pthread_arch.h
+++ b/arch/arm/pthread_arch.h
@@ -1,8 +1,22 @@
......@@ -43,7 +41,7 @@ index 43a1c01..ae3e80b 100644
+ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \
+ || __ARM_ARCH >= 7
+
+static inline pthread_t __pthread_self()
+static inline __attribute__((const)) pthread_t __pthread_self()
+{
+ char *p;
+ __asm__( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
......@@ -61,4 +59,98 @@ index 43a1c01..ae3e80b 100644
#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 <elf.h>
+
+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 <sys/auxv.h>
+#include <errno.h>
+#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<a) *--a=0;
(*d)++;
}
- if (d<a) a=d;
for (i=10, e=9*(r-a); *a>=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++;
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment