aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0003-b9b2db2f-to-1974bffa.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/musl/0003-b9b2db2f-to-1974bffa.patch')
-rw-r--r--main/musl/0003-b9b2db2f-to-1974bffa.patch156
1 files changed, 156 insertions, 0 deletions
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 <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++;