summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.mailmap1
-rw-r--r--COPYRIGHT4
-rw-r--r--arch/aarch64/bits/syscall.h.in2
-rw-r--r--arch/arm/bits/syscall.h.in2
-rw-r--r--arch/i386/bits/syscall.h.in2
-rw-r--r--arch/m68k/bits/syscall.h.in1
-rw-r--r--arch/microblaze/bits/syscall.h.in2
-rw-r--r--arch/mips/bits/hwcap.h11
-rw-r--r--arch/mips/bits/signal.h8
-rw-r--r--arch/mips/bits/syscall.h.in2
-rw-r--r--arch/mips64/bits/syscall.h.in2
-rw-r--r--arch/mips64/reloc.h2
-rw-r--r--arch/mipsn32/bits/syscall.h.in2
-rw-r--r--arch/or1k/bits/syscall.h.in2
-rw-r--r--arch/powerpc/bits/syscall.h.in2
-rw-r--r--arch/powerpc64/bits/syscall.h.in2
-rw-r--r--arch/riscv64/atomic_arch.h2
-rw-r--r--arch/riscv64/bits/syscall.h.in2
-rw-r--r--arch/s390x/bits/syscall.h.in2
-rw-r--r--arch/sh/bits/syscall.h.in1
-rw-r--r--arch/x32/bits/syscall.h.in3
-rw-r--r--arch/x86_64/bits/syscall.h.in2
-rw-r--r--compat/time32/setitimer_time32.c10
-rwxr-xr-xconfigure9
-rw-r--r--include/alloca.h2
-rw-r--r--include/alltypes.h.in1
-rw-r--r--include/netinet/if_ether.h1
-rw-r--r--include/netinet/ip.h2
-rw-r--r--include/netinet/tcp.h3
-rw-r--r--include/sys/ioctl.h1
-rw-r--r--include/sys/mman.h2
-rw-r--r--include/sys/prctl.h4
-rw-r--r--include/sys/procfs.h7
-rw-r--r--include/sys/ptrace.h29
-rw-r--r--include/sys/resource.h3
-rw-r--r--include/sys/socket.h1
-rw-r--r--include/sys/wait.h3
-rw-r--r--include/utmpx.h7
-rw-r--r--ldso/dynlink.c38
-rw-r--r--src/ctype/wcwidth.c2
-rw-r--r--src/fenv/riscv64/fenv.S5
-rw-r--r--src/internal/dynlink.h1
-rw-r--r--src/internal/syscall.h7
-rw-r--r--src/math/powerpc/fabs.c2
-rw-r--r--src/math/powerpc/fma.c2
-rw-r--r--src/misc/ioctl.c136
-rw-r--r--src/network/getsockopt.c9
-rw-r--r--src/network/recvmmsg.c14
-rw-r--r--src/network/recvmsg.c47
-rw-r--r--src/network/setsockopt.c9
-rw-r--r--src/signal/arm/sigsetjmp.s5
-rw-r--r--src/string/arm/memcpy.c2
-rw-r--r--src/string/arm/memcpy_le.S13
-rw-r--r--tools/add-cfi.i386.awk2
-rw-r--r--tools/add-cfi.x86_64.awk2
55 files changed, 371 insertions, 69 deletions
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 00000000..aede9ec8
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1 @@
+Ada Worcester <oss@ada.pikhq.com> <josiahw@gmail.com>
diff --git a/COPYRIGHT b/COPYRIGHT
index 67802d11..e6472371 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
musl as a whole is licensed under the following standard MIT license:
----------------------------------------------------------------------
-Copyright © 2005-2019 Rich Felker, et al.
+Copyright © 2005-2020 Rich Felker, et al.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -26,6 +26,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Authors/contributors include:
A. Wilcox
+Ada Worcester
Alex Dowad
Alex Suykov
Alexander Monakov
@@ -65,7 +66,6 @@ Jeremy Huntwork
Jo-Philipp Wich
Joakim Sindholt
John Spencer
-Josiah Worcester
Julien Ramseier
Justin Cormack
Kaarle Ritvanen
diff --git a/arch/aarch64/bits/syscall.h.in b/arch/aarch64/bits/syscall.h.in
index 955e2cab..93648afd 100644
--- a/arch/aarch64/bits/syscall.h.in
+++ b/arch/aarch64/bits/syscall.h.in
@@ -287,4 +287,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/arm/bits/syscall.h.in b/arch/arm/bits/syscall.h.in
index a565a4ee..8ab5df1d 100644
--- a/arch/arm/bits/syscall.h.in
+++ b/arch/arm/bits/syscall.h.in
@@ -387,6 +387,8 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
#define __ARM_NR_breakpoint 0x0f0001
#define __ARM_NR_cacheflush 0x0f0002
diff --git a/arch/i386/bits/syscall.h.in b/arch/i386/bits/syscall.h.in
index c95e108e..bb841677 100644
--- a/arch/i386/bits/syscall.h.in
+++ b/arch/i386/bits/syscall.h.in
@@ -424,4 +424,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/m68k/bits/syscall.h.in b/arch/m68k/bits/syscall.h.in
index fb522b48..e7f71a5d 100644
--- a/arch/m68k/bits/syscall.h.in
+++ b/arch/m68k/bits/syscall.h.in
@@ -404,3 +404,4 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
diff --git a/arch/microblaze/bits/syscall.h.in b/arch/microblaze/bits/syscall.h.in
index 59f86236..afefb354 100644
--- a/arch/microblaze/bits/syscall.h.in
+++ b/arch/microblaze/bits/syscall.h.in
@@ -425,4 +425,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/mips/bits/hwcap.h b/arch/mips/bits/hwcap.h
index 13e86fe7..7986deb7 100644
--- a/arch/mips/bits/hwcap.h
+++ b/arch/mips/bits/hwcap.h
@@ -1,3 +1,14 @@
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)
#define HWCAP_MIPS_CRC32 (1 << 2)
+#define HWCAP_MIPS_MIPS16 (1 << 3)
+#define HWCAP_MIPS_MDMX (1 << 4)
+#define HWCAP_MIPS_MIPS3D (1 << 5)
+#define HWCAP_MIPS_SMARTMIPS (1 << 6)
+#define HWCAP_MIPS_DSP (1 << 7)
+#define HWCAP_MIPS_DSP2 (1 << 8)
+#define HWCAP_MIPS_DSP3 (1 << 9)
+#define HWCAP_MIPS_MIPS16E2 (1 << 10)
+#define HWCAP_LOONGSON_MMI (1 << 11)
+#define HWCAP_LOONGSON_EXT (1 << 12)
+#define HWCAP_LOONGSON_EXT2 (1 << 13)
diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h
index 1a84de59..e1d97ac7 100644
--- a/arch/mips/bits/signal.h
+++ b/arch/mips/bits/signal.h
@@ -19,14 +19,18 @@ typedef struct {
} fpregset_t;
struct sigcontext {
unsigned sc_regmask, sc_status;
- unsigned long long sc_pc, sc_regs[32], sc_fpregs[32];
+ unsigned long long sc_pc;
+ gregset_t sc_regs;
+ fpregset_t sc_fpregs;
unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
unsigned long long sc_mdhi, sc_mdlo;
unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
};
typedef struct {
unsigned regmask, status;
- unsigned long long pc, gregs[32], fpregs[32];
+ unsigned long long pc;
+ gregset_t gregs;
+ fpregset_t fpregs;
unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
unsigned long long mdhi, mdlo;
unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
diff --git a/arch/mips/bits/syscall.h.in b/arch/mips/bits/syscall.h.in
index 582fa3b5..7f9afaab 100644
--- a/arch/mips/bits/syscall.h.in
+++ b/arch/mips/bits/syscall.h.in
@@ -406,4 +406,6 @@
#define __NR_fsconfig 4431
#define __NR_fsmount 4432
#define __NR_fspick 4433
+#define __NR_pidfd_open 4434
+#define __NR_clone3 4435
diff --git a/arch/mips64/bits/syscall.h.in b/arch/mips64/bits/syscall.h.in
index 34b9752e..9b406e9a 100644
--- a/arch/mips64/bits/syscall.h.in
+++ b/arch/mips64/bits/syscall.h.in
@@ -336,4 +336,6 @@
#define __NR_fsconfig 5431
#define __NR_fsmount 5432
#define __NR_fspick 5433
+#define __NR_pidfd_open 5434
+#define __NR_clone3 5435
diff --git a/arch/mips64/reloc.h b/arch/mips64/reloc.h
index 7e61e225..fdb5edc9 100644
--- a/arch/mips64/reloc.h
+++ b/arch/mips64/reloc.h
@@ -27,6 +27,8 @@
#define REL_DTPOFF R_MIPS_TLS_DTPREL64
#define REL_TPOFF R_MIPS_TLS_TPREL64
+#include <endian.h>
+
#undef R_TYPE
#undef R_SYM
#undef R_INFO
diff --git a/arch/mipsn32/bits/syscall.h.in b/arch/mipsn32/bits/syscall.h.in
index d80cafa8..134a4f81 100644
--- a/arch/mipsn32/bits/syscall.h.in
+++ b/arch/mipsn32/bits/syscall.h.in
@@ -360,4 +360,6 @@
#define __NR_fsconfig 6431
#define __NR_fsmount 6432
#define __NR_fspick 6433
+#define __NR_pidfd_open 6434
+#define __NR_clone3 6435
diff --git a/arch/or1k/bits/syscall.h.in b/arch/or1k/bits/syscall.h.in
index 8ffcfae8..eaa1a935 100644
--- a/arch/or1k/bits/syscall.h.in
+++ b/arch/or1k/bits/syscall.h.in
@@ -309,4 +309,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/powerpc/bits/syscall.h.in b/arch/powerpc/bits/syscall.h.in
index adcf63db..d8b6a247 100644
--- a/arch/powerpc/bits/syscall.h.in
+++ b/arch/powerpc/bits/syscall.h.in
@@ -413,4 +413,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/powerpc64/bits/syscall.h.in b/arch/powerpc64/bits/syscall.h.in
index 32545b39..b935864c 100644
--- a/arch/powerpc64/bits/syscall.h.in
+++ b/arch/powerpc64/bits/syscall.h.in
@@ -385,4 +385,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/riscv64/atomic_arch.h b/arch/riscv64/atomic_arch.h
index 41ad4d04..0c382588 100644
--- a/arch/riscv64/atomic_arch.h
+++ b/arch/riscv64/atomic_arch.h
@@ -15,7 +15,7 @@ static inline int a_cas(volatile int *p, int t, int s)
" bnez %1, 1b\n"
"1:"
: "=&r"(old), "=&r"(tmp)
- : "r"(p), "r"(t), "r"(s)
+ : "r"(p), "r"((long)t), "r"((long)s)
: "memory");
return old;
}
diff --git a/arch/riscv64/bits/syscall.h.in b/arch/riscv64/bits/syscall.h.in
index 1db70cfb..0043eeba 100644
--- a/arch/riscv64/bits/syscall.h.in
+++ b/arch/riscv64/bits/syscall.h.in
@@ -287,6 +287,8 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
#define __NR_sysriscv __NR_arch_specific_syscall
#define __NR_riscv_flush_icache (__NR_sysriscv + 15)
diff --git a/arch/s390x/bits/syscall.h.in b/arch/s390x/bits/syscall.h.in
index c4c70474..e89f3782 100644
--- a/arch/s390x/bits/syscall.h.in
+++ b/arch/s390x/bits/syscall.h.in
@@ -350,4 +350,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/arch/sh/bits/syscall.h.in b/arch/sh/bits/syscall.h.in
index 4705ef93..4e9ae2e0 100644
--- a/arch/sh/bits/syscall.h.in
+++ b/arch/sh/bits/syscall.h.in
@@ -397,4 +397,5 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
diff --git a/arch/x32/bits/syscall.h.in b/arch/x32/bits/syscall.h.in
index 4d72852e..f47bdee5 100644
--- a/arch/x32/bits/syscall.h.in
+++ b/arch/x32/bits/syscall.h.in
@@ -296,6 +296,9 @@
#define __NR_fsconfig (0x40000000 + 431)
#define __NR_fsmount (0x40000000 + 432)
#define __NR_fspick (0x40000000 + 433)
+#define __NR_pidfd_open (0x40000000 + 434)
+#define __NR_clone3 (0x40000000 + 435)
+
#define __NR_rt_sigaction (0x40000000 + 512)
#define __NR_rt_sigreturn (0x40000000 + 513)
diff --git a/arch/x86_64/bits/syscall.h.in b/arch/x86_64/bits/syscall.h.in
index 2d4634f6..6a646ad3 100644
--- a/arch/x86_64/bits/syscall.h.in
+++ b/arch/x86_64/bits/syscall.h.in
@@ -343,4 +343,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
diff --git a/compat/time32/setitimer_time32.c b/compat/time32/setitimer_time32.c
index 4651dacb..2475fd8c 100644
--- a/compat/time32/setitimer_time32.c
+++ b/compat/time32/setitimer_time32.c
@@ -15,9 +15,11 @@ int __setitimer_time32(int which, const struct itimerval32 *restrict new32, stru
* timer setting, so we can't fail on out-of-range old value.
* Since these are relative times, values large enough to overflow
* don't make sense anyway. */
- old32->it_interval.tv_sec = old.it_interval.tv_sec;
- old32->it_interval.tv_usec = old.it_interval.tv_usec;
- old32->it_value.tv_sec = old.it_value.tv_sec;
- old32->it_value.tv_usec = old.it_value.tv_usec;
+ if (old32) {
+ old32->it_interval.tv_sec = old.it_interval.tv_sec;
+ old32->it_interval.tv_usec = old.it_interval.tv_usec;
+ old32->it_value.tv_sec = old.it_value.tv_sec;
+ old32->it_value.tv_usec = old.it_value.tv_usec;
+ }
return 0;
}
diff --git a/configure b/configure
index 86801281..a2728969 100755
--- a/configure
+++ b/configure
@@ -646,6 +646,15 @@ if test "$ARCH" = "powerpc" ; then
trycppif "__NO_FPRS__ && !_SOFT_FLOAT" "$t" && fail \
"$0: error: compiler's floating point configuration is unsupported"
trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf
+printf "checking whether compiler can use 'd' constraint in asm... "
+echo 'double f(double x) { __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); return x; }' > "$tmpc"
+if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+printf "yes\n"
+else
+printf "no\n"
+CFLAGS_AUTO="$CFLAGS_AUTO -DBROKEN_PPC_D_ASM"
+CFLAGS_AUTO="${CFLAGS_AUTO# }"
+fi
fi
test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
diff --git a/include/alloca.h b/include/alloca.h
index d2e6f1c6..b8d183d1 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -10,9 +10,7 @@ extern "C" {
void *alloca(size_t);
-#ifdef __GNUC__
#define alloca __builtin_alloca
-#endif
#ifdef __cplusplus
}
diff --git a/include/alltypes.h.in b/include/alltypes.h.in
index 94aa2089..d9ff462e 100644
--- a/include/alltypes.h.in
+++ b/include/alltypes.h.in
@@ -1,5 +1,6 @@
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
+#define __USE_TIME_BITS64 1
TYPEDEF unsigned _Addr size_t;
TYPEDEF unsigned _Addr uintptr_t;
diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index 8af47dbe..a08485e7 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -58,6 +58,7 @@
#define ETH_P_ERSPAN 0x88BE
#define ETH_P_PREAUTH 0x88C7
#define ETH_P_TIPC 0x88CA
+#define ETH_P_LLDP 0x88CC
#define ETH_P_MACSEC 0x88E5
#define ETH_P_8021AH 0x88E7
#define ETH_P_MVRP 0x88F5
diff --git a/include/netinet/ip.h b/include/netinet/ip.h
index 8b6d7fef..0ae132a5 100644
--- a/include/netinet/ip.h
+++ b/include/netinet/ip.h
@@ -190,6 +190,8 @@ struct ip_timestamp {
#define IP_MSS 576
+#define __UAPI_DEF_IPHDR 0
+
#ifdef __cplusplus
}
#endif
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index adcd45e7..44a007aa 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -38,6 +38,7 @@
#define TCP_FASTOPEN_NO_COOKIE 34
#define TCP_ZEROCOPY_RECEIVE 35
#define TCP_INQ 36
+#define TCP_TX_DELAY 37
#define TCP_CM_INQ TCP_INQ
@@ -233,6 +234,8 @@ struct tcp_info {
uint64_t tcpi_bytes_retrans;
uint32_t tcpi_dsack_dups;
uint32_t tcpi_reord_seen;
+ uint32_t tcpi_rcv_ooopack;
+ uint32_t tcpi_snd_wnd;
};
#define TCP_MD5SIG_MAXKEYLEN 80
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index 372e3ddc..c2ce3b48 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -4,6 +4,7 @@
extern "C" {
#endif
+#include <bits/alltypes.h>
#include <bits/ioctl.h>
#define N_TTY 0
diff --git a/include/sys/mman.h b/include/sys/mman.h
index d0761b18..3bade727 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -92,6 +92,8 @@ extern "C" {
#define MADV_DODUMP 17
#define MADV_WIPEONFORK 18
#define MADV_KEEPONFORK 19
+#define MADV_COLD 20
+#define MADV_PAGEOUT 21
#define MADV_HWPOISON 100
#define MADV_SOFT_OFFLINE 101
#endif
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index 07f0d73d..d9c846e9 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -154,6 +154,10 @@ struct prctl_mm_map {
#define PR_PAC_APDBKEY (1UL << 3)
#define PR_PAC_APGAKEY (1UL << 4)
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+
int prctl (int, ...);
#ifdef __cplusplus
diff --git a/include/sys/procfs.h b/include/sys/procfs.h
index e23bf1ad..38e58c16 100644
--- a/include/sys/procfs.h
+++ b/include/sys/procfs.h
@@ -23,10 +23,9 @@ struct elf_prstatus {
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
- struct timeval pr_utime;
- struct timeval pr_stime;
- struct timeval pr_cutime;
- struct timeval pr_cstime;
+ struct {
+ long tv_sec, tv_usec;
+ } pr_utime, pr_stime, pr_cutime, pr_cstime;
elf_gregset_t pr_reg;
int pr_fpvalid;
};
diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h
index 229e1f3d..5d62a985 100644
--- a/include/sys/ptrace.h
+++ b/include/sys/ptrace.h
@@ -41,6 +41,7 @@ extern "C" {
#define PTRACE_SETSIGMASK 0x420b
#define PTRACE_SECCOMP_GET_FILTER 0x420c
#define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
#define PT_READ_I PTRACE_PEEKTEXT
#define PT_READ_D PTRACE_PEEKDATA
@@ -88,6 +89,11 @@ extern "C" {
#define PTRACE_PEEKSIGINFO_SHARED 1
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
#include <bits/ptrace.h>
struct __ptrace_peeksiginfo_args {
@@ -101,6 +107,29 @@ struct __ptrace_seccomp_metadata {
uint64_t flags;
};
+struct __ptrace_syscall_info {
+ uint8_t op;
+ uint8_t __pad[3];
+ uint32_t arch;
+ uint64_t instruction_pointer;
+ uint64_t stack_pointer;
+ union {
+ struct {
+ uint64_t nr;
+ uint64_t args[6];
+ } entry;
+ struct {
+ int64_t rval;
+ uint8_t is_error;
+ } exit;
+ struct {
+ uint64_t nr;
+ uint64_t args[6];
+ uint32_t ret_data;
+ } seccomp;
+ };
+};
+
long ptrace(int, ...);
#ifdef __cplusplus
diff --git a/include/sys/resource.h b/include/sys/resource.h
index e0c86ae3..3068328d 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -90,7 +90,8 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
#define RLIMIT_MSGQUEUE 12
#define RLIMIT_NICE 13
#define RLIMIT_RTPRIO 14
-#define RLIMIT_NLIMITS 15
+#define RLIMIT_RTTIME 15
+#define RLIMIT_NLIMITS 16
#define RLIM_NLIMITS RLIMIT_NLIMITS
diff --git a/include/sys/socket.h b/include/sys/socket.h
index a1c0b01c..38f5bb17 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -288,6 +288,7 @@ struct linger {
#define SO_TXTIME 61
#define SCM_TXTIME SO_TXTIME
#define SO_BINDTOIFINDEX 62
+#define SO_DETACH_REUSEPORT_BPF 68
#ifndef SOL_SOCKET
#define SOL_SOCKET 1
diff --git a/include/sys/wait.h b/include/sys/wait.h
index d9adbdec..d4b1f2e1 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -13,7 +13,8 @@ extern "C" {
typedef enum {
P_ALL = 0,
P_PID = 1,
- P_PGID = 2
+ P_PGID = 2,
+ P_PIDFD = 3
} idtype_t;
pid_t wait (int *);
diff --git a/include/utmpx.h b/include/utmpx.h
index 0429014d..b293f427 100644
--- a/include/utmpx.h
+++ b/include/utmpx.h
@@ -16,6 +16,7 @@ extern "C" {
struct utmpx {
short ut_type;
+ short __ut_pad1;
pid_t ut_pid;
char ut_line[32];
char ut_id[4];
@@ -25,7 +26,11 @@ struct utmpx {
short __e_termination;
short __e_exit;
} ut_exit;
- long ut_session;
+#if __BYTE_ORDER == 1234
+ int ut_session, __ut_pad2;
+#else
+ int __ut_pad2, ut_session;
+#endif
struct timeval ut_tv;
unsigned ut_addr_v6[4];
char __unused[20];
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 7810356b..afec985a 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -107,6 +107,8 @@ struct symdef {
struct dso *dso;
};
+typedef void (*stage3_func)(size_t *, size_t *);
+
static struct builtin_tls {
char c;
struct pthread pt;
@@ -183,8 +185,14 @@ static void *laddr_pg(const struct dso *p, size_t v)
}
return (void *)(v - p->loadmap->segs[j].p_vaddr + p->loadmap->segs[j].addr);
}
-#define fpaddr(p, v) ((void (*)())&(struct funcdesc){ \
- laddr(p, v), (p)->got })
+static void (*fdbarrier(void *p))()
+{
+ void (*fd)();
+ __asm__("" : "=r"(fd) : "0"(p));
+ return fd;
+}
+#define fpaddr(p, v) fdbarrier((&(struct funcdesc){ \
+ laddr(p, v), (p)->got }))
#else
#define laddr(p, v) (void *)((p)->base + (v))
#define laddr_pg(p, v) laddr(p, v)
@@ -1594,13 +1602,14 @@ static void install_new_tls(void)
hidden void __dls2(unsigned char *base, size_t *sp)
{
+ size_t *auxv;
+ for (auxv=sp+1+*sp+1; *auxv; auxv++);
+ auxv++;
if (DL_FDPIC) {
void *p1 = (void *)sp[-2];
void *p2 = (void *)sp[-1];
if (!p1) {
- size_t *auxv, aux[AUX_CNT];
- for (auxv=sp+1+*sp+1; *auxv; auxv++);
- auxv++;
+ size_t aux[AUX_CNT];
decode_vec(auxv, aux, AUX_CNT);
if (aux[AT_BASE]) ldso.base = (void *)aux[AT_BASE];
else ldso.base = (void *)(aux[AT_PHDR] & -4096);
@@ -1646,8 +1655,8 @@ hidden void __dls2(unsigned char *base, size_t *sp)
* symbolically as a barrier against moving the address
* load across the above relocation processing. */
struct symdef dls2b_def = find_sym(&ldso, "__dls2b", 0);
- if (DL_FDPIC) ((stage3_func)&ldso.funcdescs[dls2b_def.sym-ldso.syms])(sp);
- else ((stage3_func)laddr(&ldso, dls2b_def.sym->st_value))(sp);
+ if (DL_FDPIC) ((stage3_func)&ldso.funcdescs[dls2b_def.sym-ldso.syms])(sp, auxv);
+ else ((stage3_func)laddr(&ldso, dls2b_def.sym->st_value))(sp, auxv);
}
/* Stage 2b sets up a valid thread pointer, which requires relocations
@@ -1656,11 +1665,13 @@ hidden void __dls2(unsigned char *base, size_t *sp)
* so that loads of the thread pointer and &errno can be pure/const and
* thereby hoistable. */
-void __dls2b(size_t *sp)
+void __dls2b(size_t *sp, size_t *auxv)
{
/* Setup early thread pointer in builtin_tls for ldso/libc itself to
* use during dynamic linking. If possible it will also serve as the
* thread pointer at runtime. */
+ search_vec(auxv, &__hwcap, AT_HWCAP);
+ libc.auxv = auxv;
libc.tls_size = sizeof builtin_tls;
libc.tls_align = tls_align;
if (__init_tp(__copy_tls((void *)builtin_tls)) < 0) {
@@ -1668,8 +1679,8 @@ void __dls2b(size_t *sp)
}
struct symdef dls3_def = find_sym(&ldso, "__dls3", 0);
- if (DL_FDPIC) ((stage3_func)&ldso.funcdescs[dls3_def.sym-ldso.syms])(sp);
- else ((stage3_func)laddr(&ldso, dls3_def.sym->st_value))(sp);
+ if (DL_FDPIC) ((stage3_func)&ldso.funcdescs[dls3_def.sym-ldso.syms])(sp, auxv);
+ else ((stage3_func)laddr(&ldso, dls3_def.sym->st_value))(sp, auxv);
}
/* Stage 3 of the dynamic linker is called with the dynamic linker/libc
@@ -1677,10 +1688,10 @@ void __dls2b(size_t *sp)
* process dependencies and relocations for the main application and
* transfer control to its entry point. */
-void __dls3(size_t *sp)
+void __dls3(size_t *sp, size_t *auxv)
{
static struct dso app, vdso;
- size_t aux[AUX_CNT], *auxv;
+ size_t aux[AUX_CNT];
size_t i;
char *env_preload=0;
char *replace_argv0=0;
@@ -1693,10 +1704,7 @@ void __dls3(size_t *sp)
/* Find aux vector just past environ[] and use it to initialize
* global data that may be needed before we can make syscalls. */
__environ = envp;
- for (i=argc+1; argv[i]; i++);
- libc.auxv = auxv = (void *)(argv+i+1);
decode_vec(auxv, aux, AUX_CNT);
- __hwcap = aux[AT_HWCAP];
search_vec(auxv, &__sysinfo, AT_SYSINFO);
__pthread_self()->sysinfo = __sysinfo;
libc.page_size = aux[AT_PAGESZ];
diff --git a/src/ctype/wcwidth.c b/src/ctype/wcwidth.c
index 49c40eea..36256a53 100644
--- a/src/ctype/wcwidth.c
+++ b/src/ctype/wcwidth.c
@@ -23,7 +23,7 @@ int wcwidth(wchar_t wc)
return -1;
if (wc-0x20000U < 0x20000)
return 2;
- if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100 < 0xef)
+ if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100U < 0xef)
return 0;
return 1;
}
diff --git a/src/fenv/riscv64/fenv.S b/src/fenv/riscv64/fenv.S
index f149003d..0ea78bf9 100644
--- a/src/fenv/riscv64/fenv.S
+++ b/src/fenv/riscv64/fenv.S
@@ -45,8 +45,11 @@ fegetenv:
.global fesetenv
.type fesetenv, %function
fesetenv:
+ li t2, -1
+ li t1, 0
+ beq a0, t2, 1f
lw t1, 0(a0)
- fscsr t0, t1
+1: fscsr t1
li a0, 0
ret
diff --git a/src/internal/dynlink.h b/src/internal/dynlink.h
index ffd06b04..764e3a1a 100644
--- a/src/internal/dynlink.h
+++ b/src/internal/dynlink.h
@@ -96,7 +96,6 @@ struct fdpic_dummy_loadmap {
#define DYN_CNT 32
typedef void (*stage2_func)(unsigned char *, size_t *);
-typedef void (*stage3_func)(size_t *);
hidden void *__dlsym(void *restrict, const char *restrict, void *restrict);
diff --git a/src/internal/syscall.h b/src/internal/syscall.h
index 9f2784db..d768fb64 100644
--- a/src/internal/syscall.h
+++ b/src/internal/syscall.h
@@ -306,6 +306,13 @@ hidden long __syscall_ret(unsigned long),
#define SO_SNDTIMEO_OLD 21
#endif
+#define SO_TIMESTAMP_OLD 29
+#define SO_TIMESTAMPNS_OLD 35
+#define SO_TIMESTAMPING_OLD 37
+#define SCM_TIMESTAMP_OLD SO_TIMESTAMP_OLD
+#define SCM_TIMESTAMPNS_OLD SO_TIMESTAMPNS_OLD
+#define SCM_TIMESTAMPING_OLD SO_TIMESTAMPING_OLD
+
#ifndef SIOCGSTAMP_OLD
#define SIOCGSTAMP_OLD 0x8906
#endif
diff --git a/src/math/powerpc/fabs.c b/src/math/powerpc/fabs.c
index f6ec4433..0efc21ef 100644
--- a/src/math/powerpc/fabs.c
+++ b/src/math/powerpc/fabs.c
@@ -1,6 +1,6 @@
#include <math.h>
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
#include "../fabs.c"
diff --git a/src/math/powerpc/fma.c b/src/math/powerpc/fma.c
index fd268f5f..135c9903 100644
--- a/src/math/powerpc/fma.c
+++ b/src/math/powerpc/fma.c
@@ -1,6 +1,6 @@
#include <math.h>
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
#include "../fma.c"
diff --git a/src/misc/ioctl.c b/src/misc/ioctl.c
index 6f31d4bc..89477511 100644
--- a/src/misc/ioctl.c
+++ b/src/misc/ioctl.c
@@ -3,8 +3,115 @@
#include <errno.h>
#include <time.h>
#include <sys/time.h>
+#include <stddef.h>
+#include <string.h>
#include "syscall.h"
+#define alignof(t) offsetof(struct { char c; t x; }, x)
+
+#define W 1
+#define R 2
+#define WR 3
+
+struct ioctl_compat_map {
+ int new_req, old_req;
+ unsigned char old_size, dir, force_align, noffs;
+ unsigned char offsets[8];
+};
+
+#define NINTH(a,b,c,d,e,f,g,h,i,...) i
+#define COUNT(...) NINTH(__VA_ARGS__,8,7,6,5,4,3,2,1,0)
+#define OFFS(...) COUNT(__VA_ARGS__), { __VA_ARGS__ }
+
+/* yields a type for a struct with original size n, with a misaligned
+ * timeval/timespec expanded from 32- to 64-bit. for use with ioctl
+ * number producing macros; only size of result is meaningful. */
+#define new_misaligned(n) struct { int i; time_t t; char c[(n)-4]; }
+
+static const struct ioctl_compat_map compat_map[] = {
+ { SIOCGSTAMP, SIOCGSTAMP_OLD, 8, R, 0, OFFS(0, 4) },
+ { SIOCGSTAMPNS, SIOCGSTAMPNS_OLD, 8, R, 0, OFFS(0, 4) },
+
+ /* SNDRV_TIMER_IOCTL_STATUS */
+ { _IOR('T', 0x14, char[96]), _IOR('T', 0x14, 88), 88, R, 0, OFFS(0,4) },
+
+ /* SNDRV_PCM_IOCTL_STATUS[_EXT] */
+ { _IOR('A', 0x20, char[128]), _IOR('A', 0x20, char[108]), 108, R, 1, OFFS(4,8,12,16,52,56,60,64) },
+ { _IOWR('A', 0x24, char[128]), _IOWR('A', 0x24, char[108]), 108, WR, 1, OFFS(4,8,12,16,52,56,60,64) },
+
+ /* SNDRV_RAWMIDI_IOCTL_STATUS */
+ { _IOWR('W', 0x20, char[48]), _IOWR('W', 0x20, char[36]), 36, WR, 1, OFFS(4,8) },
+
+ /* SNDRV_PCM_IOCTL_SYNC_PTR - with 3 subtables */
+ { _IOWR('A', 0x23, char[136]), _IOWR('A', 0x23, char[132]), 0, WR, 1, 0 },
+ { 0, 0, 4, WR, 1, 0 }, /* snd_pcm_sync_ptr (flags only) */
+ { 0, 0, 32, WR, 1, OFFS(8,12,16,24,28) }, /* snd_pcm_mmap_status */
+ { 0, 0, 8, WR, 1, OFFS(0,4) }, /* snd_pcm_mmap_control */
+
+ /* VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF */
+ { _IOWR('V', 9, new_misaligned(72)), _IOWR('V', 9, char[72]), 72, WR, 0, OFFS(20) },
+ { _IOWR('V', 15, new_misaligned(72)), _IOWR('V', 15, char[72]), 72, WR, 0, OFFS(20) },
+ { _IOWR('V', 17, new_misaligned(72)), _IOWR('V', 17, char[72]), 72, WR, 0, OFFS(20) },
+ { _IOWR('V', 93, new_misaligned(72)), _IOWR('V', 93, char[72]), 72, WR, 0, OFFS(20) },
+
+ /* VIDIOC_DQEVENT */
+ { _IOR('V', 89, new_misaligned(96)), _IOR('V', 89, char[96]), 96, R, 0, OFFS(76,80) },
+
+ /* VIDIOC_OMAP3ISP_STAT_REQ */
+ { _IOWR('V', 192+6, char[32]), _IOWR('V', 192+6, char[24]), 22, WR, 0, OFFS(0,4) },
+
+ /* PPPIOCGIDLE */
+ { _IOR('t', 63, char[16]), _IOR('t', 63, char[8]), 8, R, 0, OFFS(0,4) },
+
+ /* PPGETTIME, PPSETTIME */
+ { _IOR('p', 0x95, char[16]), _IOR('p', 0x95, char[8]), 8, R, 0, OFFS(0,4) },
+ { _IOW('p', 0x96, char[16]), _IOW('p', 0x96, char[8]), 8, W, 0, OFFS(0,4) },
+
+ /* LPSETTIMEOUT */
+ { _IOW(0x6, 0xf, char[16]), 0x060f, 8, W, 0, OFFS(0,4) },
+};
+
+static void convert_ioctl_struct(const struct ioctl_compat_map *map, char *old, char *new, int dir)
+{
+ int new_offset = 0;
+ int old_offset = 0;
+ int old_size = map->old_size;
+ if (!(dir & map->dir)) return;
+ if (!map->old_size) {
+ /* offsets hard-coded for SNDRV_PCM_IOCTL_SYNC_PTR;
+ * if another exception appears this needs changing. */
+ convert_ioctl_struct(map+1, old, new, dir);
+ convert_ioctl_struct(map+2, old+4, new+8, dir);
+ convert_ioctl_struct(map+3, old+68, new+72, dir);
+ return;
+ }
+ for (int i=0; i < map->noffs; i++) {
+ int ts_offset = map->offsets[i];
+ int len = ts_offset-old_offset;
+ if (dir==W) memcpy(old+old_offset, new+new_offset, len);
+ else memcpy(new+new_offset, old+old_offset, len);
+ new_offset += len;
+ old_offset += len;
+ long long new_ts;
+ long old_ts;
+ int align = map->force_align ? sizeof(time_t) : alignof(time_t);
+ new_offset += (align-1) & -new_offset;
+ if (dir==W) {
+ memcpy(&new_ts, new+new_offset, sizeof new_ts);
+ old_ts = new_ts;
+ memcpy(old+old_offset, &old_ts, sizeof old_ts);
+ } else {
+ memcpy(&old_ts, old+old_offset, sizeof old_ts);
+ new_ts = old_ts;
+ memcpy(new+new_offset, &new_ts, sizeof new_ts);
+ }
+ new_offset += sizeof new_ts;
+ old_offset += sizeof old_ts;
+ }
+ if (dir==W) memcpy(old+old_offset, new+new_offset, old_size-old_offset);
+ else memcpy(new+new_offset, old+old_offset, old_size-old_offset);
+}
+
int ioctl(int fd, int req, ...)
{
void *arg;
@@ -13,23 +120,18 @@ int ioctl(int fd, int req, ...)
arg = va_arg(ap, void *);
va_end(ap);
int r = __syscall(SYS_ioctl, fd, req, arg);
- if (r==-ENOTTY) switch (req) {
- case SIOCGSTAMP:
- case SIOCGSTAMPNS:
- if (SIOCGSTAMP==SIOCGSTAMP_OLD) break;
- if (req==SIOCGSTAMP) req=SIOCGSTAMP_OLD;
- if (req==SIOCGSTAMPNS) req=SIOCGSTAMPNS_OLD;
- long t32[2];
- r = __syscall(SYS_ioctl, fd, req, t32);
- if (r<0) break;
- if (req==SIOCGSTAMP_OLD) {
- struct timeval *tv = arg;
- tv->tv_sec = t32[0];
- tv->tv_usec = t32[1];
- } else {
- struct timespec *ts = arg;
- ts->tv_sec = t32[0];
- ts->tv_nsec = t32[1];
+ if (SIOCGSTAMP != SIOCGSTAMP_OLD && req && r==-ENOTTY) {
+ for (int i=0; i<sizeof compat_map/sizeof *compat_map; i++) {
+ if (compat_map[i].new_req != req) continue;
+ union {
+ long long align;
+ char buf[256];
+ } u;
+ convert_ioctl_struct(&compat_map[i], u.buf, arg, W);
+ r = __syscall(SYS_ioctl, fd, compat_map[i].old_req, u.buf);
+ if (r<0) break;
+ convert_ioctl_struct(&compat_map[i], u.buf, arg, R);
+ break;
}
}
return __syscall_ret(r);
diff --git a/src/network/getsockopt.c b/src/network/getsockopt.c
index e871d624..d3640d9c 100644
--- a/src/network/getsockopt.c
+++ b/src/network/getsockopt.c
@@ -26,6 +26,15 @@ int getsockopt(int fd, int level, int optname, void *restrict optval, socklen_t
tv->tv_sec = tv32[0];
tv->tv_usec = tv32[1];
*optlen = sizeof *tv;
+ break;
+ case SO_TIMESTAMP:
+ case SO_TIMESTAMPNS:
+ if (SO_TIMESTAMP == SO_TIMESTAMP_OLD) break;
+ if (optname==SO_TIMESTAMP) optname=SO_TIMESTAMP_OLD;
+ if (optname==SO_TIMESTAMPNS) optname=SO_TIMESTAMPNS_OLD;
+ r = __socketcall(getsockopt, fd, level,
+ optname, optval, optlen, 0);
+ break;
}
}
return __syscall_ret(r);
diff --git a/src/network/recvmmsg.c b/src/network/recvmmsg.c
index d5dc6b51..2978e2f6 100644
--- a/src/network/recvmmsg.c
+++ b/src/network/recvmmsg.c
@@ -8,6 +8,8 @@
#define IS32BIT(x) !((x)+0x80000000ULL>>32)
#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
+hidden void __convert_scm_timestamps(struct msghdr *, socklen_t);
+
int recvmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags, struct timespec *timeout)
{
#if LONG_MAX > INT_MAX
@@ -19,14 +21,18 @@ int recvmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int fla
#ifdef SYS_recvmmsg_time64
time_t s = timeout ? timeout->tv_sec : 0;
long ns = timeout ? timeout->tv_nsec : 0;
- int r = -ENOSYS;
- if (SYS_recvmmsg == SYS_recvmmsg_time64 || !IS32BIT(s))
- r = __syscall_cp(SYS_recvmmsg_time64, fd, msgvec, vlen, flags,
+ int r = __syscall_cp(SYS_recvmmsg_time64, fd, msgvec, vlen, flags,
timeout ? ((long long[]){s, ns}) : 0);
if (SYS_recvmmsg == SYS_recvmmsg_time64 || r!=-ENOSYS)
return __syscall_ret(r);
- return syscall_cp(SYS_recvmmsg, fd, msgvec, vlen, flags,
+ if (vlen > IOV_MAX) vlen = IOV_MAX;
+ socklen_t csize[vlen];
+ for (int i=0; i<vlen; i++) csize[i] = msgvec[i].msg_hdr.msg_controllen;
+ r = __syscall_cp(SYS_recvmmsg, fd, msgvec, vlen, flags,
timeout ? ((long[]){CLAMP(s), ns}) : 0);
+ for (int i=0; i<r; i++)
+ __convert_scm_timestamps(&msgvec[i].msg_hdr, csize[i]);
+ return __syscall_ret(r);
#else
return syscall_cp(SYS_recvmmsg, fd, msgvec, vlen, flags, timeout);
#endif
diff --git a/src/network/recvmsg.c b/src/network/recvmsg.c
index 4ca7da8b..03641625 100644
--- a/src/network/recvmsg.c
+++ b/src/network/recvmsg.c
@@ -1,10 +1,56 @@
#include <sys/socket.h>
#include <limits.h>
+#include <time.h>
+#include <sys/time.h>
+#include <string.h>
#include "syscall.h"
+hidden void __convert_scm_timestamps(struct msghdr *, socklen_t);
+
+void __convert_scm_timestamps(struct msghdr *msg, socklen_t csize)
+{
+ if (SCM_TIMESTAMP == SCM_TIMESTAMP_OLD) return;
+ if (!msg->msg_control || !msg->msg_controllen) return;
+
+ struct cmsghdr *cmsg, *last=0;
+ long tmp;
+ long long tvts[2];
+ int type = 0;
+
+ for (cmsg=CMSG_FIRSTHDR(msg); cmsg; cmsg=CMSG_NXTHDR(msg, cmsg)) {
+ if (cmsg->cmsg_level==SOL_SOCKET) switch (cmsg->cmsg_type) {
+ case SCM_TIMESTAMP_OLD:
+ if (type) break;
+ type = SCM_TIMESTAMP;
+ goto common;
+ case SCM_TIMESTAMPNS_OLD:
+ type = SCM_TIMESTAMPNS;
+ common:
+ memcpy(&tmp, CMSG_DATA(cmsg), sizeof tmp);
+ tvts[0] = tmp;
+ memcpy(&tmp, CMSG_DATA(cmsg) + sizeof tmp, sizeof tmp);
+ tvts[1] = tmp;
+ break;
+ }
+ last = cmsg;
+ }
+ if (!last || !type) return;
+ if (CMSG_SPACE(sizeof tvts) > csize-msg->msg_controllen) {
+ msg->msg_flags |= MSG_CTRUNC;
+ return;
+ }
+ msg->msg_controllen += CMSG_SPACE(sizeof tvts);
+ cmsg = CMSG_NXTHDR(msg, last);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = type;
+ cmsg->cmsg_len = CMSG_LEN(sizeof tvts);
+ memcpy(CMSG_DATA(cmsg), &tvts, sizeof tvts);
+}
+
ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
{
ssize_t r;
+ socklen_t orig_controllen = msg->msg_controllen;
#if LONG_MAX > INT_MAX
struct msghdr h, *orig = msg;
if (msg) {
@@ -14,6 +60,7 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
}
#endif
r = socketcall_cp(recvmsg, fd, msg, flags, 0, 0, 0);
+ if (r >= 0) __convert_scm_timestamps(msg, orig_controllen);
#if LONG_MAX > INT_MAX
if (orig) *orig = h;
#endif
diff --git a/src/network/setsockopt.c b/src/network/setsockopt.c
index 2c188a96..612a1947 100644
--- a/src/network/setsockopt.c
+++ b/src/network/setsockopt.c
@@ -31,6 +31,15 @@ int setsockopt(int fd, int level, int optname, const void *optval, socklen_t opt
r = __socketcall(setsockopt, fd, level, optname,
((long[]){s, CLAMP(us)}), 2*sizeof(long), 0);
+ break;
+ case SO_TIMESTAMP:
+ case SO_TIMESTAMPNS:
+ if (SO_TIMESTAMP == SO_TIMESTAMP_OLD) break;
+ if (optname==SO_TIMESTAMP) optname=SO_TIMESTAMP_OLD;
+ if (optname==SO_TIMESTAMPNS) optname=SO_TIMESTAMPNS_OLD;
+ r = __socketcall(setsockopt, fd, level,
+ optname, optval, optlen, 0);
+ break;
}
}
return __syscall_ret(r);
diff --git a/src/signal/arm/sigsetjmp.s b/src/signal/arm/sigsetjmp.s
index 318addba..69ebbf49 100644
--- a/src/signal/arm/sigsetjmp.s
+++ b/src/signal/arm/sigsetjmp.s
@@ -6,9 +6,10 @@
sigsetjmp:
__sigsetjmp:
tst r1,r1
- beq setjmp
+ bne 1f
+ b setjmp
- str lr,[r0,#256]
+1: str lr,[r0,#256]
str r4,[r0,#260+8]
mov r4,r0
diff --git a/src/string/arm/memcpy.c b/src/string/arm/memcpy.c
index f703c9bd..041614f4 100644
--- a/src/string/arm/memcpy.c
+++ b/src/string/arm/memcpy.c
@@ -1,3 +1,3 @@
-#if __ARMEB__ || __thumb__
+#if __ARMEB__
#include "../memcpy.c"
#endif
diff --git a/src/string/arm/memcpy_le.S b/src/string/arm/memcpy_le.S
index 9cfbcb2a..7b35d305 100644
--- a/src/string/arm/memcpy_le.S
+++ b/src/string/arm/memcpy_le.S
@@ -1,4 +1,4 @@
-#if !__ARMEB__ && !__thumb__
+#if !__ARMEB__
/*
* Copyright (C) 2008 The Android Open Source Project
@@ -40,8 +40,9 @@
* This file has been modified from the original for use in musl libc.
* The main changes are: addition of .type memcpy,%function to make the
* code safely callable from thumb mode, adjusting the return
- * instructions to be compatible with pre-thumb ARM cpus, and removal
- * of prefetch code that is not compatible with older cpus.
+ * instructions to be compatible with pre-thumb ARM cpus, removal of
+ * prefetch code that is not compatible with older cpus and support for
+ * building as thumb 2.
*/
.syntax unified
@@ -241,7 +242,8 @@ non_congruent:
beq 2f
ldr r5, [r1], #4
sub r2, r2, #4
- orr r4, r3, r5, lsl lr
+ mov r4, r5, lsl lr
+ orr r4, r4, r3
mov r3, r5, lsr r12
str r4, [r0], #4
cmp r2, #4
@@ -348,7 +350,8 @@ less_than_thirtytwo:
1: ldr r5, [r1], #4
sub r2, r2, #4
- orr r4, r3, r5, lsl lr
+ mov r4, r5, lsl lr
+ orr r4, r4, r3
mov r3, r5, lsr r12
str r4, [r0], #4
cmp r2, #4
diff --git a/tools/add-cfi.i386.awk b/tools/add-cfi.i386.awk
index 9162e309..d05037de 100644
--- a/tools/add-cfi.i386.awk
+++ b/tools/add-cfi.i386.awk
@@ -81,7 +81,7 @@ function adjust_sp_offset(delta) {
in_function = 0
}
}
-/^\.type [a-zA-Z0-9_]+,\@function/ {
+/^\.type [a-zA-Z0-9_]+,@function/ {
functions[substr($2, 1, length($2)-10)] = 1
}
# not interested in assembler directives beyond this, just pass them through
diff --git a/tools/add-cfi.x86_64.awk b/tools/add-cfi.x86_64.awk
index bbc90daa..7e1513d6 100644
--- a/tools/add-cfi.x86_64.awk
+++ b/tools/add-cfi.x86_64.awk
@@ -76,7 +76,7 @@ function adjust_sp_offset(delta) {
in_function = 0
}
}
-/^\.type [a-zA-Z0-9_]+,\@function/ {
+/^\.type [a-zA-Z0-9_]+,@function/ {
functions[substr($2, 1, length($2)-10)] = 1
}
# not interested in assembler directives beyond this, just pass them through