Skip to content

Commit

Permalink
update musl sources to 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Nov 6, 2020
1 parent dba94f4 commit e5fab3b
Show file tree
Hide file tree
Showing 157 changed files with 2,371 additions and 1,380 deletions.
6 changes: 0 additions & 6 deletions lib/libc/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 lib/libc/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 lib/libc/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 lib/libc/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
70 changes: 35 additions & 35 deletions lib/libc/musl/arch/mips64/syscall_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,41 @@
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)
:
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2)
: SYSCALL_CLOBBERLIST);
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)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4)
: SYSCALL_CLOBBERLIST);
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)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

static inline long __syscall3(long n, long a, long b, long c)
Expand All @@ -59,14 +59,14 @@ 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)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
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,14 +75,14 @@ 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)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "+r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
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 @@ -92,14 +92,14 @@ 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__ (
"syscall"
: "+&r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "+r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8)
: SYSCALL_CLOBBERLIST);
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,14 +110,14 @@ 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__ (
"syscall"
: "+&r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "+r"(r7)
: "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
return r7 && r2>0 ? -r2 : r2;
}

#define VDSO_USEFUL
Expand Down
1 change: 0 additions & 1 deletion lib/libc/musl/arch/powerpc/bits/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define MAP_NORESERVE 0x40
#undef MAP_LOCKED
#define MAP_LOCKED 0x80
#undef MAP_SYNC

#undef MCL_CURRENT
#define MCL_CURRENT 0x2000
Expand Down
1 change: 0 additions & 1 deletion lib/libc/musl/arch/powerpc64/bits/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define MAP_NORESERVE 0x40
#undef MAP_LOCKED
#define MAP_LOCKED 0x80
#undef MAP_SYNC

#undef MCL_CURRENT
#define MCL_CURRENT 0x2000
Expand Down
5 changes: 0 additions & 5 deletions lib/libc/musl/include/arpa/inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
in_addr_t inet_lnaof(struct in_addr);
in_addr_t inet_netof(struct in_addr);

#undef INET_ADDRSTRLEN
#undef INET6_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 0 additions & 2 deletions lib/libc/musl/include/netinet/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ struct ipv6_mreq {

extern const struct in6_addr in6addr_any, in6addr_loopback;

#undef INET_ADDRSTRLEN
#undef INET6_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46

Expand Down
3 changes: 3 additions & 0 deletions lib/libc/musl/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ extern "C" {
#define PTHREAD_BARRIER_SERIAL_THREAD (-1)


#define PTHREAD_NULL ((pthread_t)0)


int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
int pthread_detach(pthread_t);
_Noreturn void pthread_exit(void *);
Expand Down
13 changes: 6 additions & 7 deletions lib/libc/musl/src/errno/__strerror.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* This file is sorted such that 'errors' which represent exceptional
* conditions under which a correct program may fail come first, followed
* by messages that indicate an incorrect program or system failure. The
* macro E() along with double-inclusion is used to ensure that ordering
* of the strings remains synchronized. */
/* The first entry is a catch-all for codes not enumerated here.
* This file is included multiple times to declare and define a structure
* with these messages, and then to define a lookup table translating
* error codes to offsets of corresponding fields in the structure. */

E(0, "No error information")

E(EILSEQ, "Illegal byte sequence")
E(EDOM, "Domain error")
Expand Down Expand Up @@ -101,5 +102,3 @@ E(EDQUOT, "Quota exceeded")
E(ENOMEDIUM, "No medium found")
E(EMEDIUMTYPE, "Wrong medium type")
E(EMULTIHOP, "Multihop attempted")

E(0, "No error information")
Loading

0 comments on commit e5fab3b

Please sign in to comment.