Skip to content

Commit

Permalink
Update to musl 1.2.1. (#222)
Browse files Browse the repository at this point in the history
See the WHATSNEW file for details. WASI libc currently uses a separate
malloc, so the new mallocng is not currently used.

This includes a few new custom changes to disable code for handling
directed rounding modes. Wasm doesn't have directed rounding modes,
so disabling this code size saves code size, something the WASI libc
project cares about!
  • Loading branch information
sunfishcode authored Nov 30, 2020
1 parent 5b148b6 commit 5879558
Show file tree
Hide file tree
Showing 165 changed files with 2,693 additions and 972 deletions.
1 change: 0 additions & 1 deletion expected/wasm32-wasi/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ __strcoll_l
__strerror_l
__strftime_fmt_1
__strftime_l
__string_read
__strncasecmp_l
__strtoimax_internal
__strtol_internal
Expand Down
5 changes: 4 additions & 1 deletion libc-top-half/musl/COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ Copyright © 2017-2018 Arm Limited
and labelled as such in comments in the individual source files. All
have been licensed under extremely permissive terms.

The ARM memcpy code (src/string/arm/memcpy_el.S) is Copyright © 2008
The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
The Android Open Source Project and is licensed under a two-clause BSD
license. It was taken from Bionic libc, used on Android.

The AArch64 memcpy and memset code (src/string/aarch64/*) are
Copyright © 1999-2019, Arm Limited.

The implementation of DES for crypt (src/crypt/crypt_des.c) is
Copyright © 1994 David Burren. It is licensed under a BSD license.

Expand Down
3 changes: 2 additions & 1 deletion libc-top-half/musl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ includedir = $(prefix)/include
libdir = $(prefix)/lib
syslibdir = /lib

SRC_DIRS = $(addprefix $(srcdir)/,src/* crt ldso $(COMPAT_SRC_DIRS))
MALLOC_DIR = mallocng
SRC_DIRS = $(addprefix $(srcdir)/,src/* src/malloc/$(MALLOC_DIR) crt ldso $(COMPAT_SRC_DIRS))
BASE_GLOBS = $(addsuffix /*.c,$(SRC_DIRS))
ARCH_GLOBS = $(addsuffix /$(ARCH)/*.[csS],$(SRC_DIRS))
BASE_SRCS = $(sort $(wildcard $(BASE_GLOBS)))
Expand Down
2 changes: 1 addition & 1 deletion libc-top-half/musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
36 changes: 36 additions & 0 deletions libc-top-half/musl/WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -2200,3 +2200,39 @@ arch-specific bugs fixed:
- arm dynamic linker chose wrong tls/atomic variants since 1.1.21
- some math library functions returned excess precision on i386
- unconfirmed regression in fchmodat AT_SYMLINK_NOFOLLOW on mips*



1.2.1 release notes

major changes:
- new malloc implementation (mallocng & overhauled bump allocator)

new features:
- DNS queries via res_* now set AD flag, report zone signedness (DNSSEC)
- PTHREAD_NULL macro (POSIX-future)

performance:
- optimized memcpy and memset for aarch64
- optimized memcpy for arm now supports big endian
- optimized x86_64 remquol
- improved strerror without linear search

bugs fixed:
- lock-skipping for processes that returned to single-threaded was wrong
- AF_UNSPEC dns lookups mishandled single failure in paired A+AAAA
- res_send and res_query returned wrong value on errors from nameserver
- corrupted sysvipc timestamps on 32-bit archs with old kernels
- incorrect parsing of timezone offsets after overly-long zone name
- clock_adjtime was broken on 32-bit archs (time64)
- pthread_kill as not async-signal-safe
- pthread_cancel was not async-cancel-safe
- large-ulp errors in various math functions in non-default rounding modes

arch-specific bugs fixed:
- arm clock_gettime was broken on some hw due to bad time64 vdso
- m68k sqrtl lacked long double precision
- mips* syscall mechanism regressions on older kernels
- mips* had negated error codes for some syscalls (kernel bug)
- mips* SIGEMT was wrongly called SIGSTKFLT
- sh fesetround didn't work correctly on sh
6 changes: 0 additions & 6 deletions libc-top-half/musl/arch/arm/syscall_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
}

#define VDSO_USEFUL
#define VDSO_CGT32_SYM "__vdso_clock_gettime"
#define VDSO_CGT32_VER "LINUX_2.6"
#define VDSO_CGT_SYM "__vdso_clock_gettime64"
#define VDSO_CGT_VER "LINUX_2.6"

#define SYSCALL_FADVISE_6_ARG

#define SYSCALL_IPC_BROKEN_MODE
2 changes: 1 addition & 1 deletion libc-top-half/musl/arch/mips/bits/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
#define SIGSTKFLT 7
#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
Expand Down
80 changes: 40 additions & 40 deletions libc-top-half/musl/arch/mips/syscall_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@
static inline long __syscall0(long n)
{
register long r7 __asm__("$7");
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"syscall"
: "+r"(r2), "=r"(r7)
:
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall1(long n, long a)
{
register long r4 __asm__("$4") = a;
register long r7 __asm__("$7");
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4)
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall2(long n, long a, long b)
{
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r7 __asm__("$7");
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4), "r"(r5)
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall3(long n, long a, long b, long c)
Expand All @@ -60,13 +60,13 @@ static inline long __syscall3(long n, long a, long b, long c)
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7");
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall4(long n, long a, long b, long c, long d)
Expand All @@ -75,13 +75,13 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"syscall"
: "+r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "+r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall5(long n, long a, long b, long c, long d, long e)
Expand All @@ -91,15 +91,15 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; "
"syscall ;"
"addu $2,$0,%3 ; syscall ;"
"addu $sp,$sp,32"
: "+r"(r2), "+r"(r7), "+r"(r8)
: "r"(r4), "r"(r5), "r"(r6)
: "=&r"(r2), "+r"(r7), "+r"(r8)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$9", "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
Expand All @@ -110,15 +110,15 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r9 __asm__("$9") = f;
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; "
"syscall ;"
"addu $2,$0,%4 ; syscall ;"
"addu $sp,$sp,32"
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
: "r"(r4), "r"(r5), "r"(r6)
: "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$10");
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
Expand All @@ -130,15 +130,15 @@ static inline long __syscall7(long n, long a, long b, long c, long d, long e, lo
register long r8 __asm__("$8") = e;
register long r9 __asm__("$9") = f;
register long r10 __asm__("$10") = g;
register long r2 __asm__("$2") = n;
register long r2 __asm__("$2");
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; "
"syscall ;"
"addu $2,$0,%5 ; syscall ;"
"addu $sp,$sp,32"
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
: "r"(r4), "r"(r5), "r"(r6)
: "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

#define VDSO_USEFUL
Expand Down
2 changes: 1 addition & 1 deletion libc-top-half/musl/arch/mips64/bits/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
#define SIGSTKFLT 7
#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
Expand Down
Loading

0 comments on commit 5879558

Please sign in to comment.