musl: update to the latest git version, fixes TLS issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48574
This commit is contained in:
parent
b046040bd6
commit
ed95e47f07
7 changed files with 17878 additions and 7745 deletions
File diff suppressed because it is too large
Load diff
17861
toolchain/musl/patches/000-update-to-git-2016-01-30.patch
Normal file
17861
toolchain/musl/patches/000-update-to-git-2016-01-30.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
||||||
|
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -595,6 +595,10 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE
|
@@ -604,6 +604,10 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE
|
||||||
trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
|
trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
From 93332ebdcd54b0e0c0e86bced537cc96247bc1f1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
|
||||||
Date: Sat, 23 Jan 2016 16:23:09 +0100
|
|
||||||
Subject: [PATCH 2/2] mips: add vdso support
|
|
||||||
|
|
||||||
vdso support is available on mips starting with kernel 4.4, see kernel
|
|
||||||
commit a7f4df4e21 "MIPS: VDSO: Add implementations of gettimeofday()
|
|
||||||
and clock_gettime()" for details.
|
|
||||||
|
|
||||||
In Linux kernel 4.4.0 the mips code returns -ENOSYS in case it can not
|
|
||||||
handle the vdso call and assumes the libc will call the original
|
|
||||||
syscall in this case. Handle this case in musl. Currently Linux kernel
|
|
||||||
4.4.0 handles the following types: CLOCK_REALTIME_COARSE,
|
|
||||||
CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME and CLOCK_MONOTONIC.
|
|
||||||
|
|
||||||
These are some measurements of calling clock_gettime(CLOCK_MONOTONIC,
|
|
||||||
&tp); 1.000.000 times.
|
|
||||||
|
|
||||||
without vdso:
|
|
||||||
root@OpenWrt:/# time ./vdso-test
|
|
||||||
real 0m 0.95s
|
|
||||||
user 0m 0.24s
|
|
||||||
sys 0m 0.70s
|
|
||||||
|
|
||||||
with vdso:
|
|
||||||
root@OpenWrt:/# time /usr/bin/vdso-test
|
|
||||||
real 0m 0.35s
|
|
||||||
user 0m 0.34s
|
|
||||||
sys 0m 0.00s
|
|
||||||
|
|
||||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
||||||
---
|
|
||||||
arch/mips/syscall_arch.h | 4 ++++
|
|
||||||
src/time/clock_gettime.c | 12 +++++++++++-
|
|
||||||
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h
|
|
||||||
index e74e0ad..39c0ea3 100644
|
|
||||||
--- a/arch/mips/syscall_arch.h
|
|
||||||
+++ b/arch/mips/syscall_arch.h
|
|
||||||
@@ -161,3 +161,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
|
|
||||||
if (n == SYS_fstatat) __stat_fix(c);
|
|
||||||
return r2;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+#define VDSO_USEFUL
|
|
||||||
+#define VDSO_CGT_SYM "__vdso_clock_gettime"
|
|
||||||
+#define VDSO_CGT_VER "LINUX_2.6"
|
|
||||||
diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c
|
|
||||||
index 1572de0..dba99ff 100644
|
|
||||||
--- a/src/time/clock_gettime.c
|
|
||||||
+++ b/src/time/clock_gettime.c
|
|
||||||
@@ -26,13 +26,23 @@ void *__vdsosym(const char *, const char *);
|
|
||||||
int __clock_gettime(clockid_t clk, struct timespec *ts)
|
|
||||||
{
|
|
||||||
#ifdef VDSO_CGT_SYM
|
|
||||||
+ int ret;
|
|
||||||
static int (*volatile cgt)(clockid_t, struct timespec *);
|
|
||||||
if (!cgt) {
|
|
||||||
void *f = __vdsosym(VDSO_CGT_VER, VDSO_CGT_SYM);
|
|
||||||
if (!f) f = (void *)sc_clock_gettime;
|
|
||||||
a_cas_p(&cgt, 0, f);
|
|
||||||
}
|
|
||||||
- return cgt(clk, ts);
|
|
||||||
+ ret = cgt(clk, ts);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * mips in linux kernel 4.4.0 returns -ENOSYS if it can not
|
|
||||||
+ * handle the syscall in vdso, the original syscall should be
|
|
||||||
+ * called by the libc in such a case.
|
|
||||||
+ */
|
|
||||||
+ if (ret == -ENOSYS)
|
|
||||||
+ return sc_clock_gettime(clk, ts);
|
|
||||||
+ return ret;
|
|
||||||
#else
|
|
||||||
return sc_clock_gettime(clk, ts);
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
2.7.0.rc3
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||||
include/syslog.h | 12 ++++++++++--
|
include/syslog.h | 12 ++++++++++--
|
||||||
4 files changed, 57 insertions(+), 22 deletions(-)
|
4 files changed, 57 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
diff --git a/include/err.h b/include/err.h
|
|
||||||
index 9f5cb6b..a5e3cde 100644
|
|
||||||
--- a/include/err.h
|
--- a/include/err.h
|
||||||
+++ b/include/err.h
|
+++ b/include/err.h
|
||||||
@@ -8,15 +8,23 @@
|
@@ -8,15 +8,23 @@
|
||||||
|
@ -42,17 +40,16 @@ index 9f5cb6b..a5e3cde 100644
|
||||||
-void vwarn(const char *, va_list);
|
-void vwarn(const char *, va_list);
|
||||||
-void warnx(const char *, ...);
|
-void warnx(const char *, ...);
|
||||||
-void vwarnx(const char *, va_list);
|
-void vwarnx(const char *, va_list);
|
||||||
-
|
|
||||||
-_Noreturn void err(int, const char *, ...);
|
|
||||||
-_Noreturn void verr(int, const char *, va_list);
|
|
||||||
-_Noreturn void errx(int, const char *, ...);
|
|
||||||
-_Noreturn void verrx(int, const char *, va_list);
|
|
||||||
+#if __GNUC__ >= 3
|
+#if __GNUC__ >= 3
|
||||||
+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
|
+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
|
||||||
+#else
|
+#else
|
||||||
+#define __fp(x, y)
|
+#define __fp(x, y)
|
||||||
+#endif
|
+#endif
|
||||||
+
|
|
||||||
|
-_Noreturn void err(int, const char *, ...);
|
||||||
|
-_Noreturn void verr(int, const char *, va_list);
|
||||||
|
-_Noreturn void errx(int, const char *, ...);
|
||||||
|
-_Noreturn void verrx(int, const char *, va_list);
|
||||||
+void warn(const char *, ...) __fp(1, 2);
|
+void warn(const char *, ...) __fp(1, 2);
|
||||||
+void vwarn(const char *, va_list) __fp(1, 0);
|
+void vwarn(const char *, va_list) __fp(1, 0);
|
||||||
+void warnx(const char *, ...) __fp(1, 2);
|
+void warnx(const char *, ...) __fp(1, 2);
|
||||||
|
@ -67,8 +64,6 @@ index 9f5cb6b..a5e3cde 100644
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
diff --git a/include/monetary.h b/include/monetary.h
|
|
||||||
index a91fa56..85c4d23 100644
|
|
||||||
--- a/include/monetary.h
|
--- a/include/monetary.h
|
||||||
+++ b/include/monetary.h
|
+++ b/include/monetary.h
|
||||||
@@ -13,8 +13,16 @@ extern "C" {
|
@@ -13,8 +13,16 @@ extern "C" {
|
||||||
|
@ -90,8 +85,6 @@ index a91fa56..85c4d23 100644
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
diff --git a/include/stdio.h b/include/stdio.h
|
|
||||||
index 884d2e6..17ca68e 100644
|
|
||||||
--- a/include/stdio.h
|
--- a/include/stdio.h
|
||||||
+++ b/include/stdio.h
|
+++ b/include/stdio.h
|
||||||
@@ -21,6 +21,14 @@ extern "C" {
|
@@ -21,6 +21,14 @@ extern "C" {
|
||||||
|
@ -156,7 +149,7 @@ index 884d2e6..17ca68e 100644
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _GNU_SOURCE
|
#ifdef _GNU_SOURCE
|
||||||
@@ -184,6 +192,9 @@ char *fgets_unlocked(char *, int, FILE *);
|
@@ -184,6 +192,9 @@ char *fgets_unlocked(char *, int, FILE *
|
||||||
int fputs_unlocked(const char *, FILE *);
|
int fputs_unlocked(const char *, FILE *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -166,8 +159,6 @@ index 884d2e6..17ca68e 100644
|
||||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||||
#define tmpfile64 tmpfile
|
#define tmpfile64 tmpfile
|
||||||
#define fopen64 fopen
|
#define fopen64 fopen
|
||||||
diff --git a/include/syslog.h b/include/syslog.h
|
|
||||||
index 5b4d296..33b549d 100644
|
|
||||||
--- a/include/syslog.h
|
--- a/include/syslog.h
|
||||||
+++ b/include/syslog.h
|
+++ b/include/syslog.h
|
||||||
@@ -56,16 +56,22 @@ extern "C" {
|
@@ -56,16 +56,22 @@ extern "C" {
|
||||||
|
@ -204,6 +195,3 @@ index 5b4d296..33b549d 100644
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
--
|
|
||||||
2.7.0.rc3
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ Signed-off-by: Steven Barth <steven@midlink.org>
|
||||||
|
|
||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -56,7 +56,7 @@ CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rc
|
@@ -60,7 +60,7 @@ CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rc
|
||||||
STATIC_LIBS = lib/libc.a
|
STATIC_LIBS = lib/libc.a
|
||||||
SHARED_LIBS = lib/libc.so
|
SHARED_LIBS = lib/libc.so
|
||||||
TOOL_LIBS = lib/musl-gcc.specs
|
TOOL_LIBS = lib/musl-gcc.specs
|
||||||
|
@ -21,18 +21,18 @@ Signed-off-by: Steven Barth <steven@midlink.org>
|
||||||
ALL_TOOLS = obj/musl-gcc
|
ALL_TOOLS = obj/musl-gcc
|
||||||
|
|
||||||
WRAPCC_GCC = gcc
|
WRAPCC_GCC = gcc
|
||||||
@@ -117,7 +117,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
|
@@ -123,7 +123,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
|
||||||
src/env/__libc_start_main.c src/env/__init_tls.c \
|
src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
|
||||||
src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \
|
src/string/memset.c src/string/$(ARCH)/memset.c \
|
||||||
src/string/memset.c src/string/memcpy.c \
|
src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
|
||||||
- src/ldso/dlstart.c src/ldso/dynlink.c
|
- ldso/dlstart.c ldso/dynlink.c
|
||||||
+ src/ldso/dlstart.c src/ldso/dynlink.c \
|
+ ldso/dlstart.c ldso/dynlink.c \
|
||||||
+ src/libssp_nonshared/__stack_chk_fail_local.c
|
+ src/libssp_nonshared/__stack_chk_fail_local.c
|
||||||
$(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
|
$(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
|
||||||
|
|
||||||
$(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT
|
$(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT
|
||||||
@@ -161,6 +162,11 @@ lib/libc.a: $(OBJS)
|
@@ -167,6 +168,11 @@ lib/libc.a: $(AOBJS)
|
||||||
$(AR) rc $@ $(OBJS)
|
$(AR) rc $@ $(AOBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
+lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
|
+lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
|
@@ -219,7 +219,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
|
||||||
$(INSTALL) -D -m 644 $< $@
|
$(INSTALL) -D -m 644 $< $@
|
||||||
|
|
||||||
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
|
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
|
||||||
|
|
Loading…
Reference in a new issue