Merge "AArch64: Use LDXR/STXR instead of LDAXR/STLXR for bionic_atomic_cmpxchg()"
diff --git a/libc/Android.mk b/libc/Android.mk
index 7c098a8..1164bd6 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -112,7 +112,6 @@
bionic/recv.c \
bionic/sched_cpualloc.c \
bionic/sched_cpucount.c \
- bionic/sched_getcpu.c \
bionic/semaphore.c \
bionic/send.c \
bionic/setpgrp.c \
@@ -261,6 +260,7 @@
bionic/sbrk.cpp \
bionic/scandir.cpp \
bionic/sched_getaffinity.cpp \
+ bionic/sched_getcpu.cpp \
bionic/setegid.cpp \
bionic/__set_errno.cpp \
bionic/seteuid.cpp \
diff --git a/libc/NOTICE b/libc/NOTICE
index 8ed455c..a737001 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -2980,6 +2980,35 @@
-------------------------------------------------------------------
+Copyright (c) 1999 The NetBSD Foundation, Inc.
+All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation
+by Michael Graff.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2000 Ben Harris.
Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
All rights reserved.
@@ -3075,7 +3104,7 @@
-------------------------------------------------------------------
-Copyright (c) 2001 Christopher Gilbert
+Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -3086,17 +3115,14 @@
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-3. The name of the company nor the name of the author may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
@@ -3104,6 +3130,41 @@
-------------------------------------------------------------------
+Copyright (c) 2001 Wasabi Systems, Inc.
+All rights reserved.
+
+Written by Frank van der Linden for Wasabi Systems, Inc.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed for the NetBSD Project by
+ Wasabi Systems, Inc.
+4. The name of Wasabi Systems, Inc. may not be used to endorse
+ or promote products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
Redistribution and use in source and binary forms, with or without
@@ -3321,31 +3382,6 @@
-------------------------------------------------------------------
-Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru>
Redistribution and use in source and binary forms, with or without
@@ -3877,7 +3913,7 @@
-------------------------------------------------------------------
-Copyright (c) 2010, 2011 Intel Corporation
+Copyright (c) 2010, 2011, 2012, 2013 Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -3996,6 +4032,36 @@
-------------------------------------------------------------------
+Copyright (c) 2011, 2012, 2013 Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2011, Intel Corporation
All rights reserved.
@@ -4053,34 +4119,6 @@
-------------------------------------------------------------------
-Copyright (c) 2012 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2013 ARM Ltd
All rights reserved.
@@ -4109,6 +4147,66 @@
-------------------------------------------------------------------
+Copyright (c) 2013 Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2013, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2013, Linaro Limited
All rights reserved.
@@ -4281,32 +4379,6 @@
-------------------------------------------------------------------
-Copyright 2006-2008, The Android Open Source Project
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- Neither the name of Google Inc. nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright 2008 Android Open Source Project (source port randomization)
Copyright (c) 1985, 1989, 1993
The Regents of the University of California. All rights reserved.
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 19b4d22..6e10daa 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -62,12 +62,21 @@
int tgkill(pid_t tgid, pid_t tid, int sig) all
int __ptrace:ptrace(int request, int pid, void* addr, void* data) all
int __set_thread_area:set_thread_area(void* user_desc) mips,x86
-int __getpriority:getpriority(int, int) all
-int setpriority(int, int, int) all
-int setrlimit(int resource, const struct rlimit* rlp) all
-int getrlimit:ugetrlimit(int resource, struct rlimit* rlp) arm,x86
-int getrlimit:getrlimit(int resource, struct rlimit* rlp) aarch64,mips,x86_64
-int getrusage(int who, struct rusage* r_usage) all
+
+# <sys/resource.h>
+int getrusage(int, struct rusage*) all
+int __getpriority:getpriority(int, int) all
+int setpriority(int, int, int) all
+# On LP64, rlimit and rlimit64 are the same.
+# On 32-bit systems we use prlimit64 to implement the rlimit64 functions.
+int getrlimit:ugetrlimit(int, struct rlimit*) arm,x86
+int getrlimit(int, struct rlimit*) mips
+int getrlimit|getrlimit64(int, struct rlimit*) aarch64,x86_64
+int setrlimit(int, const struct rlimit*) arm,mips,x86
+int setrlimit|setrlimit64(int, const struct rlimit*) aarch64,x86_64
+int prlimit64|prlimit(pid_t, int, struct rlimit64*, const struct rlimit64*) aarch64,x86_64
+int prlimit64(pid_t, int, struct rlimit64*, const struct rlimit64*) arm,mips,x86
+
int setgroups:setgroups32(int, const gid_t*) arm,x86
int setgroups:setgroups(int, const gid_t*) aarch64,mips,x86_64
int setpgid(pid_t, pid_t) all
@@ -179,7 +188,6 @@
int lremovexattr(const char*, const char*) all
int __statfs64:statfs64(const char*, size_t, struct statfs*) arm,mips,x86
int statfs(const char*, struct statfs*) aarch64,x86_64
-long unshare(unsigned long) all
int swapon(const char*, int) all
int swapoff(const char*) all
@@ -256,8 +264,10 @@
int sched_get_priority_min(int policy) all
int sched_rr_get_interval(pid_t pid, struct timespec* interval) all
int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) all
+int setns(int, int) all
+int unshare(int) all
int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) all
-int __getcpu:getcpu(unsigned* cpu, unsigned* node, void* unused) all
+int __getcpu:getcpu(unsigned*, unsigned*, void*) all
# io priorities
int ioprio_set(int which, int who, int ioprio) all
diff --git a/libc/arch-aarch64/bionic/__bionic_clone.S b/libc/arch-aarch64/bionic/__bionic_clone.S
index 3f160f5..9790291 100644
--- a/libc/arch-aarch64/bionic/__bionic_clone.S
+++ b/libc/arch-aarch64/bionic/__bionic_clone.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/__get_sp.S b/libc/arch-aarch64/bionic/__get_sp.S
index 66a0ff1..3cd4ceb 100644
--- a/libc/arch-aarch64/bionic/__get_sp.S
+++ b/libc/arch-aarch64/bionic/__get_sp.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/__rt_sigreturn.S b/libc/arch-aarch64/bionic/__rt_sigreturn.S
index be5d1fa..d176ea3 100644
--- a/libc/arch-aarch64/bionic/__rt_sigreturn.S
+++ b/libc/arch-aarch64/bionic/__rt_sigreturn.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/__set_tls.c b/libc/arch-aarch64/bionic/__set_tls.c
index 16d2357..4eb3ade 100644
--- a/libc/arch-aarch64/bionic/__set_tls.c
+++ b/libc/arch-aarch64/bionic/__set_tls.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/_exit_with_stack_teardown.S b/libc/arch-aarch64/bionic/_exit_with_stack_teardown.S
index 083bcb6..075e388 100644
--- a/libc/arch-aarch64/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-aarch64/bionic/_exit_with_stack_teardown.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,18 +26,16 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
ENTRY(_exit_with_stack_teardown)
- mov w28, w2
- mov w8, __NR_munmap
- svc #0
+ mov w8, __NR_munmap
+ svc #0
// If munmap failed, we ignore the failure and exit anyway.
- sxtw x0, w28
- mov w8, __NR_exit
- svc #0
+ mov x0, #0
+ mov w8, __NR_exit
+ svc #0
// The exit syscall does not return.
END(_exit_with_stack_teardown)
diff --git a/libc/arch-aarch64/bionic/_setjmp.S b/libc/arch-aarch64/bionic/_setjmp.S
index ba08940..ea70a52 100644
--- a/libc/arch-aarch64/bionic/_setjmp.S
+++ b/libc/arch-aarch64/bionic/_setjmp.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/bzero_aarch64.c b/libc/arch-aarch64/bionic/bzero_aarch64.c
index d403d0c..1ef920c 100644
--- a/libc/arch-aarch64/bionic/bzero_aarch64.c
+++ b/libc/arch-aarch64/bionic/bzero_aarch64.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/cacheflush_aarch64.c b/libc/arch-aarch64/bionic/cacheflush_aarch64.c
index fbbd788..1354fee 100644
--- a/libc/arch-aarch64/bionic/cacheflush_aarch64.c
+++ b/libc/arch-aarch64/bionic/cacheflush_aarch64.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/futex_aarch64.S b/libc/arch-aarch64/bionic/futex_aarch64.S
index c25d2dd..d452771 100644
--- a/libc/arch-aarch64/bionic/futex_aarch64.S
+++ b/libc/arch-aarch64/bionic/futex_aarch64.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,104 +26,61 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * Syscall interface for fast userspace locks
- *
- * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
- * int __futex_wake(volatile void *ftx, int count);
- * int __futex_syscall3(volatile void *ftx, int op, int val);
- * int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout);
- */
-
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* store x8 */
- str x8, [sp, #-16]!
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- /* syscall No. in x8 */
- mov x8, __NR_futex
- svc #0
-
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
-
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
-
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_syscall4)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
- /* __futex_syscall4 but with fewer arguments */
- b __futex_syscall4
+ b __futex_syscall4
END(__futex_syscall3)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* store x8 */
- str x8, [sp, #-16]!
+ mov x3, x2
+ mov x2, x1
+ mov x1, #FUTEX_WAIT
- /* arange arguments as expected in the kernel side */
- mov x3, x2
- mov w2, w1
- mov w1, #FUTEX_WAIT
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- /* syscall No. in X8 */
- mov x8, __NR_futex
- svc #0
-
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
-
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
-
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_wait)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* store x8 */
- str x8, [sp, #-16]!
+ mov x2, x1
+ mov x1, #FUTEX_WAKE
- /* arange arguments as expected in the kernel side */
- mov w2, w1
- mov w1, #FUTEX_WAIT
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- /* syscall No. in X8 */
- mov x8, __NR_futex
- svc #0
-
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
-
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
-
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_wake)
diff --git a/libc/arch-aarch64/bionic/setjmp.S b/libc/arch-aarch64/bionic/setjmp.S
index faa854f..b1ec0a8 100644
--- a/libc/arch-aarch64/bionic/setjmp.S
+++ b/libc/arch-aarch64/bionic/setjmp.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/sigsetjmp.S b/libc/arch-aarch64/bionic/sigsetjmp.S
index ffc8984..3afceab 100644
--- a/libc/arch-aarch64/bionic/sigsetjmp.S
+++ b/libc/arch-aarch64/bionic/sigsetjmp.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libc/arch-aarch64/bionic/syscall.S b/libc/arch-aarch64/bionic/syscall.S
index f7ce010..e5be1d5 100644
--- a/libc/arch-aarch64/bionic/syscall.S
+++ b/libc/arch-aarch64/bionic/syscall.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#include <linux/err.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
ENTRY(syscall)
/* create AAPCS frame pointer */
diff --git a/libc/arch-aarch64/bionic/vfork.S b/libc/arch-aarch64/bionic/vfork.S
index 964f38d..52009e2 100644
--- a/libc/arch-aarch64/bionic/vfork.S
+++ b/libc/arch-aarch64/bionic/vfork.S
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * All rights reserved
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,12 +26,12 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
+#include <asm/signal.h>
+#include <linux/sched.h>
ENTRY(vfork)
- mov x0, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
+ mov x0, #(CLONE_VM | CLONE_VFORK | SIGCHLD)
mov x1, xzr
mov x2, xzr
mov x3, xzr
@@ -39,11 +39,9 @@
str x8, [sp, #-16]!
mov x8, __NR_clone
-
svc #0
ldr x8, [sp], #16
- /* check if syscall returned successfully */
cmn x0, #(MAX_ERRNO + 1)
cneg x0, x0, hi
b.hi __set_errno
diff --git a/libc/arch-aarch64/syscalls.mk b/libc/arch-aarch64/syscalls.mk
index ab9c839..653ef70 100644
--- a/libc/arch-aarch64/syscalls.mk
+++ b/libc/arch-aarch64/syscalls.mk
@@ -123,6 +123,7 @@
syscall_src += arch-aarch64/syscalls/pipe2.S
syscall_src += arch-aarch64/syscalls/prctl.S
syscall_src += arch-aarch64/syscalls/pread64.S
+syscall_src += arch-aarch64/syscalls/prlimit64.S
syscall_src += arch-aarch64/syscalls/pwrite64.S
syscall_src += arch-aarch64/syscalls/read.S
syscall_src += arch-aarch64/syscalls/readahead.S
@@ -147,6 +148,7 @@
syscall_src += arch-aarch64/syscalls/setgid.S
syscall_src += arch-aarch64/syscalls/setgroups.S
syscall_src += arch-aarch64/syscalls/setitimer.S
+syscall_src += arch-aarch64/syscalls/setns.S
syscall_src += arch-aarch64/syscalls/setpgid.S
syscall_src += arch-aarch64/syscalls/setpriority.S
syscall_src += arch-aarch64/syscalls/setregid.S
diff --git a/libc/arch-aarch64/syscalls/getrlimit.S b/libc/arch-aarch64/syscalls/getrlimit.S
index 8b6548f..21b471e 100644
--- a/libc/arch-aarch64/syscalls/getrlimit.S
+++ b/libc/arch-aarch64/syscalls/getrlimit.S
@@ -19,3 +19,6 @@
ret
END(getrlimit)
+
+ .globl _C_LABEL(getrlimit64)
+ .equ _C_LABEL(getrlimit64), _C_LABEL(getrlimit)
diff --git a/libc/arch-aarch64/syscalls/prlimit64.S b/libc/arch-aarch64/syscalls/prlimit64.S
new file mode 100644
index 0000000..439e355
--- /dev/null
+++ b/libc/arch-aarch64/syscalls/prlimit64.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
+ str x8, [sp, #-16]!
+
+ mov x8, __NR_prlimit64
+ svc #0
+
+ ldr x8, [sp], #16
+ ldp x29, x30, [sp], #16
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno
+
+ ret
+END(prlimit64)
+
+ .globl _C_LABEL(prlimit)
+ .equ _C_LABEL(prlimit), _C_LABEL(prlimit64)
diff --git a/libc/arch-aarch64/syscalls/setns.S b/libc/arch-aarch64/syscalls/setns.S
new file mode 100644
index 0000000..2ce2a75
--- /dev/null
+++ b/libc/arch-aarch64/syscalls/setns.S
@@ -0,0 +1,21 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
+ str x8, [sp, #-16]!
+
+ mov x8, __NR_setns
+ svc #0
+
+ ldr x8, [sp], #16
+ ldp x29, x30, [sp], #16
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno
+
+ ret
+END(setns)
diff --git a/libc/arch-aarch64/syscalls/setrlimit.S b/libc/arch-aarch64/syscalls/setrlimit.S
index 3591a84..e723806 100644
--- a/libc/arch-aarch64/syscalls/setrlimit.S
+++ b/libc/arch-aarch64/syscalls/setrlimit.S
@@ -19,3 +19,6 @@
ret
END(setrlimit)
+
+ .globl _C_LABEL(setrlimit64)
+ .equ _C_LABEL(setrlimit64), _C_LABEL(setrlimit)
diff --git a/libc/arch-arm/bionic/_exit_with_stack_teardown.S b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
index 0d97f06..6fa950e 100644
--- a/libc/arch-arm/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
@@ -26,18 +26,16 @@
* SUCH DAMAGE.
*/
-#include <machine/asm.h>
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
ENTRY(_exit_with_stack_teardown)
- mov lr, r2
- ldr r7, =__NR_munmap
- swi #0
- // If munmap failed, we ignore the failure and exit anyway.
+ ldr r7, =__NR_munmap
+ swi #0
+ // If munmap failed, we ignore the failure and exit anyway.
- mov r0, lr
- ldr r7, =__NR_exit
- swi #0
- // The exit syscall does not return.
+ mov r0, #0
+ ldr r7, =__NR_exit
+ swi #0
+ // The exit syscall does not return.
END(_exit_with_stack_teardown)
diff --git a/libc/arch-arm/bionic/atexit_legacy.c b/libc/arch-arm/bionic/atexit_legacy.c
index 2162c37..c0d704d 100644
--- a/libc/arch-arm/bionic/atexit_legacy.c
+++ b/libc/arch-arm/bionic/atexit_legacy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libc/arch-arm/bionic/futex_arm.S b/libc/arch-arm/bionic/futex_arm.S
index 4131cdb..0aba278 100644
--- a/libc/arch-arm/bionic/futex_arm.S
+++ b/libc/arch-arm/bionic/futex_arm.S
@@ -26,13 +26,12 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-// __futex_syscall3(*ftx, op, val)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
mov ip, r7
ldr r7, =__NR_futex
@@ -41,12 +40,12 @@
bx lr
END(__futex_syscall3)
-// __futex_syscall4(*ftx, op, val, *timespec)
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
b __futex_syscall3
END(__futex_syscall4)
-// __futex_wait(*ftx, val, *timespec)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
mov ip, r7
mov r3, r2
@@ -58,7 +57,7 @@
bx lr
END(__futex_wait)
-// __futex_wake(*ftx, counter)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
mov ip, r7
mov r2, r1
diff --git a/libc/arch-arm/bionic/libgcc_compat.c b/libc/arch-arm/bionic/libgcc_compat.c
index f57dfb0..0c91e97 100644
--- a/libc/arch-arm/bionic/libgcc_compat.c
+++ b/libc/arch-arm/bionic/libgcc_compat.c
@@ -152,6 +152,7 @@
XX(__muldi3) \
XX(__mulsf3) \
XX(__nedf2) \
+ XX(__popcountsi2) \
XX(__subdf3) \
XX(__subsf3) \
XX(__truncdfsf2) \
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index a1d4689..83e6a97 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -129,6 +129,7 @@
syscall_src += arch-arm/syscalls/pipe2.S
syscall_src += arch-arm/syscalls/prctl.S
syscall_src += arch-arm/syscalls/pread64.S
+syscall_src += arch-arm/syscalls/prlimit64.S
syscall_src += arch-arm/syscalls/pwrite64.S
syscall_src += arch-arm/syscalls/read.S
syscall_src += arch-arm/syscalls/readahead.S
@@ -154,6 +155,7 @@
syscall_src += arch-arm/syscalls/setgid.S
syscall_src += arch-arm/syscalls/setgroups.S
syscall_src += arch-arm/syscalls/setitimer.S
+syscall_src += arch-arm/syscalls/setns.S
syscall_src += arch-arm/syscalls/setpgid.S
syscall_src += arch-arm/syscalls/setpriority.S
syscall_src += arch-arm/syscalls/setregid.S
diff --git a/libc/arch-arm/syscalls/prlimit64.S b/libc/arch-arm/syscalls/prlimit64.S
new file mode 100644
index 0000000..8d9c4ff
--- /dev/null
+++ b/libc/arch-arm/syscalls/prlimit64.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+ mov ip, r7
+ ldr r7, =__NR_prlimit64
+ swi #0
+ mov r7, ip
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno
+END(prlimit64)
diff --git a/libc/arch-arm/syscalls/setns.S b/libc/arch-arm/syscalls/setns.S
new file mode 100644
index 0000000..7afbff0
--- /dev/null
+++ b/libc/arch-arm/syscalls/setns.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ mov ip, r7
+ ldr r7, =__NR_setns
+ swi #0
+ mov r7, ip
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno
+END(setns)
diff --git a/libc/arch-mips/bionic/_exit_with_stack_teardown.S b/libc/arch-mips/bionic/_exit_with_stack_teardown.S
index 9cab52b..8f624c3 100644
--- a/libc/arch-mips/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-mips/bionic/_exit_with_stack_teardown.S
@@ -30,21 +30,19 @@
.text
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
.type _exit_with_stack_teardown, @function
.global _exit_with_stack_teardown
.align 4
.ent _exit_with_stack_teardown
_exit_with_stack_teardown:
- move $s0,$a2 /* preserve status for exit() call */
-
- li $v0,__NR_munmap
+ li $v0, __NR_munmap
syscall
// If munmap failed, we ignore the failure and exit anyway.
- move $a0,$s0
- li $v0,__NR_exit
+ li $a0, 0
+ li $v0, __NR_exit
syscall
// The exit syscall does not return.
.end _exit_with_stack_teardown
diff --git a/libc/arch-mips/bionic/futex_mips.S b/libc/arch-mips/bionic/futex_mips.S
index 2a953ca..5247b79 100644
--- a/libc/arch-mips/bionic/futex_mips.S
+++ b/libc/arch-mips/bionic/futex_mips.S
@@ -26,15 +26,12 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * __futex_wait(*ftx, val, *timespec)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
.type __futex_wait, @function
.global __futex_wait
.align 4
@@ -59,10 +56,7 @@
j $ra
.end __futex_wait
-/*
- * int __futex_wake(volatile void *ftx, int count)
- * int futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_wake(volatile void* ftx, int count)
.type __futex_wake, @function
.globl __futex_wake
.align 4
@@ -87,9 +81,7 @@
j $ra
.end __futex_wake
-/* __futex_syscall3(*ftx, op, val)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_syscall3(volatile void* ftx, int op, int count)
.type __futex_syscall3, @function
.global __futex_syscall3
.align 4
@@ -114,9 +106,7 @@
j $ra
.end __futex_syscall3
-/* __futex_syscall4(*ftx, op, val)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
.type __futex_syscall4, @function
.global __futex_syscall4
.align 4
diff --git a/libc/arch-mips/bionic/syscall.S b/libc/arch-mips/bionic/syscall.S
index 60754e8..af5bcc9 100644
--- a/libc/arch-mips/bionic/syscall.S
+++ b/libc/arch-mips/bionic/syscall.S
@@ -32,6 +32,12 @@
.align 4
.ent syscall
+/*
+ * The caller is only required to allocate 16 bytes of stack for a0-a3.
+ * syscall has up to 6 arguments, so we need space for the extra two arguments.
+ */
+#define STACKSIZE 2*4
+
syscall:
.set noreorder
.cpload $t9
@@ -42,9 +48,11 @@
lw $a3, 16($sp)
lw $t0, 20($sp)
lw $t1, 24($sp)
+ subu $sp, STACKSIZE
sw $t0, 16($sp)
sw $t1, 20($sp)
syscall
+ addu $sp, STACKSIZE
bnez $a3, 1f
move $a0, $v0
j $ra
diff --git a/libc/arch-mips/bionic/vfork.S b/libc/arch-mips/bionic/vfork.S
index 2e2e4ff..414caaf 100644
--- a/libc/arch-mips/bionic/vfork.S
+++ b/libc/arch-mips/bionic/vfork.S
@@ -27,11 +27,14 @@
*/
#include <asm/unistd.h>
+#include <linux/sched.h>
+
+// TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
+// #include <asm/signal.h>
+#define SIGCHLD 18
.text
-/* int vfork() implemented using clone() */
-
.type vfork, @function
.global vfork
.align 4
@@ -40,17 +43,22 @@
.set noreorder
.cpload $t9
- li $a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
- move $a1, $sp
+ li $a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
+ li $a1, 0
+ li $a2, 0
+ li $a3, 0
+ subu $sp, 8
+ sw $0, 16($sp)
li $v0, __NR_clone
syscall
- bnez $a3,1f
- nop
+ addu $sp, 8
+ bnez $a3, 1f
+ move $a0, $v0
j $ra
nop
1:
- la $t9,__set_errno
+ la $t9, __set_errno
j $t9
- move $a0,$v0
+ nop
.end vfork
diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk
index 40932b7..8d87b29 100644
--- a/libc/arch-mips/syscalls.mk
+++ b/libc/arch-mips/syscalls.mk
@@ -129,6 +129,7 @@
syscall_src += arch-mips/syscalls/pipe2.S
syscall_src += arch-mips/syscalls/prctl.S
syscall_src += arch-mips/syscalls/pread64.S
+syscall_src += arch-mips/syscalls/prlimit64.S
syscall_src += arch-mips/syscalls/pwrite64.S
syscall_src += arch-mips/syscalls/read.S
syscall_src += arch-mips/syscalls/readahead.S
@@ -154,6 +155,7 @@
syscall_src += arch-mips/syscalls/setgid.S
syscall_src += arch-mips/syscalls/setgroups.S
syscall_src += arch-mips/syscalls/setitimer.S
+syscall_src += arch-mips/syscalls/setns.S
syscall_src += arch-mips/syscalls/setpgid.S
syscall_src += arch-mips/syscalls/setpriority.S
syscall_src += arch-mips/syscalls/setregid.S
diff --git a/libc/arch-mips/syscalls/prlimit64.S b/libc/arch-mips/syscalls/prlimit64.S
new file mode 100644
index 0000000..17e9157
--- /dev/null
+++ b/libc/arch-mips/syscalls/prlimit64.S
@@ -0,0 +1,23 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <asm/unistd.h>
+ .text
+ .globl prlimit64
+ .align 4
+ .ent prlimit64
+
+prlimit64:
+ .set noreorder
+ .cpload $t9
+ li $v0, __NR_prlimit64
+ syscall
+ bnez $a3, 1f
+ move $a0, $v0
+ j $ra
+ nop
+1:
+ la $t9,__set_errno
+ j $t9
+ nop
+ .set reorder
+ .end prlimit64
diff --git a/libc/arch-mips/syscalls/setns.S b/libc/arch-mips/syscalls/setns.S
new file mode 100644
index 0000000..fd4529e
--- /dev/null
+++ b/libc/arch-mips/syscalls/setns.S
@@ -0,0 +1,23 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <asm/unistd.h>
+ .text
+ .globl setns
+ .align 4
+ .ent setns
+
+setns:
+ .set noreorder
+ .cpload $t9
+ li $v0, __NR_setns
+ syscall
+ bnez $a3, 1f
+ move $a0, $v0
+ j $ra
+ nop
+1:
+ la $t9,__set_errno
+ j $t9
+ nop
+ .set reorder
+ .end setns
diff --git a/libc/arch-x86/bionic/_exit_with_stack_teardown.S b/libc/arch-x86/bionic/_exit_with_stack_teardown.S
index 03a4be0..e94ae90 100644
--- a/libc/arch-x86/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-x86/bionic/_exit_with_stack_teardown.S
@@ -1,21 +1,16 @@
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
ENTRY(_exit_with_stack_teardown)
- // We can trash registers because this function never returns.
- // We can also take advantage of the fact that the linux syscall trap
- // handler saves all the registers, so we don't need a stack to keep
- // the status argument for exit while doing the munmap.
- mov 4(%esp), %ebx // stackBase
- mov 8(%esp), %ecx // stackSize
- mov 12(%esp), %edx // Also copy 'status' off the stack we're about to unmap.
- mov $__NR_munmap, %eax
- int $0x80
- // If munmap failed, we ignore the failure and exit anyway.
+ // We can trash registers because this function never returns.
+ mov 4(%esp), %ebx // stackBase
+ mov 8(%esp), %ecx // stackSize
+ mov $__NR_munmap, %eax
+ int $0x80
+ // If munmap failed, we ignore the failure and exit anyway.
- mov %edx, %ebx // status
- movl $__NR_exit, %eax
- int $0x80
- // The exit syscall does not return.
+ mov $0, %ebx // status
+ movl $__NR_exit, %eax
+ int $0x80
+ // The exit syscall does not return.
END(_exit_with_stack_teardown)
diff --git a/libc/arch-x86/bionic/futex_x86.S b/libc/arch-x86/bionic/futex_x86.S
index fa33758..8dd2ad0 100644
--- a/libc/arch-x86/bionic/futex_x86.S
+++ b/libc/arch-x86/bionic/futex_x86.S
@@ -1,10 +1,9 @@
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-// int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
pushl %ebx
pushl %esi
@@ -19,7 +18,7 @@
ret
END(__futex_wait)
-// int __futex_wake(volatile void *ftx, int count)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
pushl %ebx
mov 8(%esp), %ebx /* ftx */
@@ -31,7 +30,7 @@
ret
END(__futex_wake)
-// int __futex_syscall3(volatile void *ftx, int op, int count)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
pushl %ebx
movl 8(%esp), %ebx /* ftx */
@@ -43,7 +42,7 @@
ret
END(__futex_syscall3)
-// int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout)
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
pushl %ebx
pushl %esi
diff --git a/libc/arch-x86/bionic/syscall.S b/libc/arch-x86/bionic/syscall.S
index 4452da4..0178f41 100644
--- a/libc/arch-x86/bionic/syscall.S
+++ b/libc/arch-x86/bionic/syscall.S
@@ -10,8 +10,7 @@
* %ebp: arg5 - callee save
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
ENTRY(syscall)
# Push the callee save registers.
@@ -34,7 +33,7 @@
int $0x80
# Error?
- cmpl $-4095, %eax
+ cmpl $-MAX_ERRNO, %eax
jb 1f
# Yes, so set errno.
negl %eax
diff --git a/libc/arch-x86/bionic/vfork.S b/libc/arch-x86/bionic/vfork.S
index 7b62449..ec6f6ca 100644
--- a/libc/arch-x86/bionic/vfork.S
+++ b/libc/arch-x86/bionic/vfork.S
@@ -1,22 +1,45 @@
-#include <machine/asm.h>
-#include <asm/unistd.h>
-
-/* Get rid of the stack modifications (popl/ret) after vfork() success.
- * vfork is VERY sneaky. One has to be very careful about what can be done
- * between a successful vfork and a a subsequent execve()
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
+#include <private/bionic_asm.h>
+
+// This custom code preserves the return address across the system call.
+
ENTRY(vfork)
- /* grab the return address */
- popl %ecx
- movl $__NR_vfork, %eax
- int $0x80
- cmpl $-129, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- orl $-1, %eax
+ popl %ecx // Grab the return address.
+ movl $__NR_vfork, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ orl $-1, %eax
1:
- jmp *%ecx
+ jmp *%ecx // Jump to the stored return address.
END(vfork)
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index 780972f..b7d1e08 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -128,6 +128,7 @@
syscall_src += arch-x86/syscalls/pipe2.S
syscall_src += arch-x86/syscalls/prctl.S
syscall_src += arch-x86/syscalls/pread64.S
+syscall_src += arch-x86/syscalls/prlimit64.S
syscall_src += arch-x86/syscalls/pwrite64.S
syscall_src += arch-x86/syscalls/read.S
syscall_src += arch-x86/syscalls/readahead.S
@@ -153,6 +154,7 @@
syscall_src += arch-x86/syscalls/setgid.S
syscall_src += arch-x86/syscalls/setgroups.S
syscall_src += arch-x86/syscalls/setitimer.S
+syscall_src += arch-x86/syscalls/setns.S
syscall_src += arch-x86/syscalls/setpgid.S
syscall_src += arch-x86/syscalls/setpriority.S
syscall_src += arch-x86/syscalls/setregid.S
diff --git a/libc/arch-x86/syscalls/__brk.S b/libc/arch-x86/syscalls/__brk.S
index ebde7ba..728bf81 100644
--- a/libc/arch-x86/syscalls/__brk.S
+++ b/libc/arch-x86/syscalls/__brk.S
@@ -4,6 +4,8 @@
ENTRY(__brk)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_brk, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__epoll_pwait.S b/libc/arch-x86/syscalls/__epoll_pwait.S
index 2d424c6..9bcc142 100644
--- a/libc/arch-x86/syscalls/__epoll_pwait.S
+++ b/libc/arch-x86/syscalls/__epoll_pwait.S
@@ -9,6 +9,13 @@
pushl %esi
pushl %edi
pushl %ebp
+ .cfi_def_cfa_offset 24
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
+ .cfi_rel_offset ebp, 20
mov 28(%esp), %ebx
mov 32(%esp), %ecx
mov 36(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__exit.S b/libc/arch-x86/syscalls/__exit.S
index 83f04a5..eaddc5e 100644
--- a/libc/arch-x86/syscalls/__exit.S
+++ b/libc/arch-x86/syscalls/__exit.S
@@ -4,6 +4,8 @@
ENTRY(__exit)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_exit, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__fcntl64.S b/libc/arch-x86/syscalls/__fcntl64.S
index dda2b17..faefa65 100644
--- a/libc/arch-x86/syscalls/__fcntl64.S
+++ b/libc/arch-x86/syscalls/__fcntl64.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__fstatfs64.S b/libc/arch-x86/syscalls/__fstatfs64.S
index 1f0cc80..dfd04af 100644
--- a/libc/arch-x86/syscalls/__fstatfs64.S
+++ b/libc/arch-x86/syscalls/__fstatfs64.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__getcpu.S b/libc/arch-x86/syscalls/__getcpu.S
index cef5f18..d1da871 100644
--- a/libc/arch-x86/syscalls/__getcpu.S
+++ b/libc/arch-x86/syscalls/__getcpu.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__getcwd.S b/libc/arch-x86/syscalls/__getcwd.S
index 5a0dae2..a9834e2 100644
--- a/libc/arch-x86/syscalls/__getcwd.S
+++ b/libc/arch-x86/syscalls/__getcwd.S
@@ -5,6 +5,9 @@
ENTRY(__getcwd)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_getcwd, %eax
diff --git a/libc/arch-x86/syscalls/__getpriority.S b/libc/arch-x86/syscalls/__getpriority.S
index 72fd8a5..99d33bb 100644
--- a/libc/arch-x86/syscalls/__getpriority.S
+++ b/libc/arch-x86/syscalls/__getpriority.S
@@ -5,6 +5,9 @@
ENTRY(__getpriority)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_getpriority, %eax
diff --git a/libc/arch-x86/syscalls/__ioctl.S b/libc/arch-x86/syscalls/__ioctl.S
index 6caf918..ad617f0 100644
--- a/libc/arch-x86/syscalls/__ioctl.S
+++ b/libc/arch-x86/syscalls/__ioctl.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__llseek.S b/libc/arch-x86/syscalls/__llseek.S
index a24b021..2dab8a9 100644
--- a/libc/arch-x86/syscalls/__llseek.S
+++ b/libc/arch-x86/syscalls/__llseek.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__mmap2.S b/libc/arch-x86/syscalls/__mmap2.S
index 6308c9b..963abf3 100644
--- a/libc/arch-x86/syscalls/__mmap2.S
+++ b/libc/arch-x86/syscalls/__mmap2.S
@@ -9,6 +9,13 @@
pushl %esi
pushl %edi
pushl %ebp
+ .cfi_def_cfa_offset 24
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
+ .cfi_rel_offset ebp, 20
mov 28(%esp), %ebx
mov 32(%esp), %ecx
mov 36(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__openat.S b/libc/arch-x86/syscalls/__openat.S
index 7bb833c..6b05bec 100644
--- a/libc/arch-x86/syscalls/__openat.S
+++ b/libc/arch-x86/syscalls/__openat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__ppoll.S b/libc/arch-x86/syscalls/__ppoll.S
index 553fad1..e5af93c 100644
--- a/libc/arch-x86/syscalls/__ppoll.S
+++ b/libc/arch-x86/syscalls/__ppoll.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__pselect6.S b/libc/arch-x86/syscalls/__pselect6.S
index a464c9a..984a67e 100644
--- a/libc/arch-x86/syscalls/__pselect6.S
+++ b/libc/arch-x86/syscalls/__pselect6.S
@@ -9,6 +9,13 @@
pushl %esi
pushl %edi
pushl %ebp
+ .cfi_def_cfa_offset 24
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
+ .cfi_rel_offset ebp, 20
mov 28(%esp), %ebx
mov 32(%esp), %ecx
mov 36(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__ptrace.S b/libc/arch-x86/syscalls/__ptrace.S
index 7dc46d9..d3b8031 100644
--- a/libc/arch-x86/syscalls/__ptrace.S
+++ b/libc/arch-x86/syscalls/__ptrace.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__reboot.S b/libc/arch-x86/syscalls/__reboot.S
index bde2c60..b644906 100644
--- a/libc/arch-x86/syscalls/__reboot.S
+++ b/libc/arch-x86/syscalls/__reboot.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__rt_sigaction.S b/libc/arch-x86/syscalls/__rt_sigaction.S
index 47c33be..1c5fdcc 100644
--- a/libc/arch-x86/syscalls/__rt_sigaction.S
+++ b/libc/arch-x86/syscalls/__rt_sigaction.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__rt_sigpending.S b/libc/arch-x86/syscalls/__rt_sigpending.S
index e4a0981..5522195 100644
--- a/libc/arch-x86/syscalls/__rt_sigpending.S
+++ b/libc/arch-x86/syscalls/__rt_sigpending.S
@@ -5,6 +5,9 @@
ENTRY(__rt_sigpending)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_rt_sigpending, %eax
diff --git a/libc/arch-x86/syscalls/__rt_sigprocmask.S b/libc/arch-x86/syscalls/__rt_sigprocmask.S
index 0fa1106..0df7301 100644
--- a/libc/arch-x86/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-x86/syscalls/__rt_sigprocmask.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__rt_sigsuspend.S b/libc/arch-x86/syscalls/__rt_sigsuspend.S
index aa4eae6..0e7dbdf 100644
--- a/libc/arch-x86/syscalls/__rt_sigsuspend.S
+++ b/libc/arch-x86/syscalls/__rt_sigsuspend.S
@@ -5,6 +5,9 @@
ENTRY(__rt_sigsuspend)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_rt_sigsuspend, %eax
diff --git a/libc/arch-x86/syscalls/__rt_sigtimedwait.S b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
index a97ef77..cfbc7a6 100644
--- a/libc/arch-x86/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__sched_getaffinity.S b/libc/arch-x86/syscalls/__sched_getaffinity.S
index c9de997..a9b9f79 100644
--- a/libc/arch-x86/syscalls/__sched_getaffinity.S
+++ b/libc/arch-x86/syscalls/__sched_getaffinity.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__set_thread_area.S b/libc/arch-x86/syscalls/__set_thread_area.S
index 0dc0e33..ce06233 100644
--- a/libc/arch-x86/syscalls/__set_thread_area.S
+++ b/libc/arch-x86/syscalls/__set_thread_area.S
@@ -4,6 +4,8 @@
ENTRY(__set_thread_area)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_set_thread_area, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__set_tid_address.S b/libc/arch-x86/syscalls/__set_tid_address.S
index 0c66d47..6a3943d 100644
--- a/libc/arch-x86/syscalls/__set_tid_address.S
+++ b/libc/arch-x86/syscalls/__set_tid_address.S
@@ -4,6 +4,8 @@
ENTRY(__set_tid_address)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_set_tid_address, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__sigaction.S b/libc/arch-x86/syscalls/__sigaction.S
index 45274df..8824a85 100644
--- a/libc/arch-x86/syscalls/__sigaction.S
+++ b/libc/arch-x86/syscalls/__sigaction.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__statfs64.S b/libc/arch-x86/syscalls/__statfs64.S
index 1db5f69..7a91f1d 100644
--- a/libc/arch-x86/syscalls/__statfs64.S
+++ b/libc/arch-x86/syscalls/__statfs64.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__syslog.S b/libc/arch-x86/syscalls/__syslog.S
index dec69e8..1da01be 100644
--- a/libc/arch-x86/syscalls/__syslog.S
+++ b/libc/arch-x86/syscalls/__syslog.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__timer_create.S b/libc/arch-x86/syscalls/__timer_create.S
index 6a30721..68480d1 100644
--- a/libc/arch-x86/syscalls/__timer_create.S
+++ b/libc/arch-x86/syscalls/__timer_create.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__timer_delete.S b/libc/arch-x86/syscalls/__timer_delete.S
index 5119cae..a2732e1 100644
--- a/libc/arch-x86/syscalls/__timer_delete.S
+++ b/libc/arch-x86/syscalls/__timer_delete.S
@@ -4,6 +4,8 @@
ENTRY(__timer_delete)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_timer_delete, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__timer_getoverrun.S b/libc/arch-x86/syscalls/__timer_getoverrun.S
index fbe7e42..a340bfe 100644
--- a/libc/arch-x86/syscalls/__timer_getoverrun.S
+++ b/libc/arch-x86/syscalls/__timer_getoverrun.S
@@ -4,6 +4,8 @@
ENTRY(__timer_getoverrun)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_timer_getoverrun, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/__timer_gettime.S b/libc/arch-x86/syscalls/__timer_gettime.S
index ec4a5e9..4aeb8eb 100644
--- a/libc/arch-x86/syscalls/__timer_gettime.S
+++ b/libc/arch-x86/syscalls/__timer_gettime.S
@@ -5,6 +5,9 @@
ENTRY(__timer_gettime)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_timer_gettime, %eax
diff --git a/libc/arch-x86/syscalls/__timer_settime.S b/libc/arch-x86/syscalls/__timer_settime.S
index abd2754..f93bca4 100644
--- a/libc/arch-x86/syscalls/__timer_settime.S
+++ b/libc/arch-x86/syscalls/__timer_settime.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/__waitid.S b/libc/arch-x86/syscalls/__waitid.S
index c22a9c5..cda5238 100644
--- a/libc/arch-x86/syscalls/__waitid.S
+++ b/libc/arch-x86/syscalls/__waitid.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/_exit.S b/libc/arch-x86/syscalls/_exit.S
index 04dc16b..2ff5faf 100644
--- a/libc/arch-x86/syscalls/_exit.S
+++ b/libc/arch-x86/syscalls/_exit.S
@@ -4,6 +4,8 @@
ENTRY(_exit)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_exit_group, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/accept.S b/libc/arch-x86/syscalls/accept.S
index f2912c8..f7e8a58 100644
--- a/libc/arch-x86/syscalls/accept.S
+++ b/libc/arch-x86/syscalls/accept.S
@@ -5,6 +5,9 @@
ENTRY(accept)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $5, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/acct.S b/libc/arch-x86/syscalls/acct.S
index 02416ba..6abaffc 100644
--- a/libc/arch-x86/syscalls/acct.S
+++ b/libc/arch-x86/syscalls/acct.S
@@ -4,6 +4,8 @@
ENTRY(acct)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_acct, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/bind.S b/libc/arch-x86/syscalls/bind.S
index 0628ddb..7c2acb5 100644
--- a/libc/arch-x86/syscalls/bind.S
+++ b/libc/arch-x86/syscalls/bind.S
@@ -5,6 +5,9 @@
ENTRY(bind)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $2, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/capget.S b/libc/arch-x86/syscalls/capget.S
index 1c55147..aa7b432 100644
--- a/libc/arch-x86/syscalls/capget.S
+++ b/libc/arch-x86/syscalls/capget.S
@@ -5,6 +5,9 @@
ENTRY(capget)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_capget, %eax
diff --git a/libc/arch-x86/syscalls/capset.S b/libc/arch-x86/syscalls/capset.S
index 485d2b0..6c31083 100644
--- a/libc/arch-x86/syscalls/capset.S
+++ b/libc/arch-x86/syscalls/capset.S
@@ -5,6 +5,9 @@
ENTRY(capset)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_capset, %eax
diff --git a/libc/arch-x86/syscalls/chdir.S b/libc/arch-x86/syscalls/chdir.S
index b944bf8..a51ac6e 100644
--- a/libc/arch-x86/syscalls/chdir.S
+++ b/libc/arch-x86/syscalls/chdir.S
@@ -4,6 +4,8 @@
ENTRY(chdir)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_chdir, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/chroot.S b/libc/arch-x86/syscalls/chroot.S
index 5ea29ae..be8f686 100644
--- a/libc/arch-x86/syscalls/chroot.S
+++ b/libc/arch-x86/syscalls/chroot.S
@@ -4,6 +4,8 @@
ENTRY(chroot)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_chroot, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/clock_getres.S b/libc/arch-x86/syscalls/clock_getres.S
index 9af9278..ce7e6f7 100644
--- a/libc/arch-x86/syscalls/clock_getres.S
+++ b/libc/arch-x86/syscalls/clock_getres.S
@@ -5,6 +5,9 @@
ENTRY(clock_getres)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_clock_getres, %eax
diff --git a/libc/arch-x86/syscalls/clock_gettime.S b/libc/arch-x86/syscalls/clock_gettime.S
index 0aff332..b1cdb1a 100644
--- a/libc/arch-x86/syscalls/clock_gettime.S
+++ b/libc/arch-x86/syscalls/clock_gettime.S
@@ -5,6 +5,9 @@
ENTRY(clock_gettime)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_clock_gettime, %eax
diff --git a/libc/arch-x86/syscalls/clock_nanosleep.S b/libc/arch-x86/syscalls/clock_nanosleep.S
index 572d4a0..6c025e3 100644
--- a/libc/arch-x86/syscalls/clock_nanosleep.S
+++ b/libc/arch-x86/syscalls/clock_nanosleep.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/clock_settime.S b/libc/arch-x86/syscalls/clock_settime.S
index 8aaf9d8..7c863e1 100644
--- a/libc/arch-x86/syscalls/clock_settime.S
+++ b/libc/arch-x86/syscalls/clock_settime.S
@@ -5,6 +5,9 @@
ENTRY(clock_settime)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_clock_settime, %eax
diff --git a/libc/arch-x86/syscalls/close.S b/libc/arch-x86/syscalls/close.S
index 2ceb2e1..3eb3be1 100644
--- a/libc/arch-x86/syscalls/close.S
+++ b/libc/arch-x86/syscalls/close.S
@@ -4,6 +4,8 @@
ENTRY(close)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_close, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/connect.S b/libc/arch-x86/syscalls/connect.S
index 37336ee..c0d73ca 100644
--- a/libc/arch-x86/syscalls/connect.S
+++ b/libc/arch-x86/syscalls/connect.S
@@ -5,6 +5,9 @@
ENTRY(connect)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $3, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/delete_module.S b/libc/arch-x86/syscalls/delete_module.S
index 197a23a..11ff762 100644
--- a/libc/arch-x86/syscalls/delete_module.S
+++ b/libc/arch-x86/syscalls/delete_module.S
@@ -5,6 +5,9 @@
ENTRY(delete_module)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_delete_module, %eax
diff --git a/libc/arch-x86/syscalls/dup.S b/libc/arch-x86/syscalls/dup.S
index 5854471..98070e2 100644
--- a/libc/arch-x86/syscalls/dup.S
+++ b/libc/arch-x86/syscalls/dup.S
@@ -4,6 +4,8 @@
ENTRY(dup)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_dup, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/dup3.S b/libc/arch-x86/syscalls/dup3.S
index bb7c92f..4380e6a 100644
--- a/libc/arch-x86/syscalls/dup3.S
+++ b/libc/arch-x86/syscalls/dup3.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/epoll_create1.S b/libc/arch-x86/syscalls/epoll_create1.S
index e2e1e41..ca5d4d1 100644
--- a/libc/arch-x86/syscalls/epoll_create1.S
+++ b/libc/arch-x86/syscalls/epoll_create1.S
@@ -4,6 +4,8 @@
ENTRY(epoll_create1)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_epoll_create1, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/epoll_ctl.S b/libc/arch-x86/syscalls/epoll_ctl.S
index c71119d..df345cd 100644
--- a/libc/arch-x86/syscalls/epoll_ctl.S
+++ b/libc/arch-x86/syscalls/epoll_ctl.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/eventfd.S b/libc/arch-x86/syscalls/eventfd.S
index 376a4f6..333bca4 100644
--- a/libc/arch-x86/syscalls/eventfd.S
+++ b/libc/arch-x86/syscalls/eventfd.S
@@ -5,6 +5,9 @@
ENTRY(eventfd)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_eventfd2, %eax
diff --git a/libc/arch-x86/syscalls/execve.S b/libc/arch-x86/syscalls/execve.S
index 8e6c432..95523bc 100644
--- a/libc/arch-x86/syscalls/execve.S
+++ b/libc/arch-x86/syscalls/execve.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/faccessat.S b/libc/arch-x86/syscalls/faccessat.S
index be95a0e..0ad6224 100644
--- a/libc/arch-x86/syscalls/faccessat.S
+++ b/libc/arch-x86/syscalls/faccessat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fchdir.S b/libc/arch-x86/syscalls/fchdir.S
index a798322..4298c2a 100644
--- a/libc/arch-x86/syscalls/fchdir.S
+++ b/libc/arch-x86/syscalls/fchdir.S
@@ -4,6 +4,8 @@
ENTRY(fchdir)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_fchdir, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/fchmod.S b/libc/arch-x86/syscalls/fchmod.S
index 3dcf5dc..d4ef36f 100644
--- a/libc/arch-x86/syscalls/fchmod.S
+++ b/libc/arch-x86/syscalls/fchmod.S
@@ -5,6 +5,9 @@
ENTRY(fchmod)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_fchmod, %eax
diff --git a/libc/arch-x86/syscalls/fchmodat.S b/libc/arch-x86/syscalls/fchmodat.S
index 254fcb8..4fb6995 100644
--- a/libc/arch-x86/syscalls/fchmodat.S
+++ b/libc/arch-x86/syscalls/fchmodat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fchown.S b/libc/arch-x86/syscalls/fchown.S
index 76298c4..326fe16 100644
--- a/libc/arch-x86/syscalls/fchown.S
+++ b/libc/arch-x86/syscalls/fchown.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fchownat.S b/libc/arch-x86/syscalls/fchownat.S
index fb295c4..802dc44 100644
--- a/libc/arch-x86/syscalls/fchownat.S
+++ b/libc/arch-x86/syscalls/fchownat.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fdatasync.S b/libc/arch-x86/syscalls/fdatasync.S
index 9ddf03b..02e09be 100644
--- a/libc/arch-x86/syscalls/fdatasync.S
+++ b/libc/arch-x86/syscalls/fdatasync.S
@@ -4,6 +4,8 @@
ENTRY(fdatasync)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_fdatasync, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/fgetxattr.S b/libc/arch-x86/syscalls/fgetxattr.S
index 2250c93..99a920d 100644
--- a/libc/arch-x86/syscalls/fgetxattr.S
+++ b/libc/arch-x86/syscalls/fgetxattr.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/flistxattr.S b/libc/arch-x86/syscalls/flistxattr.S
index 1ebd9bd..a1691fc 100644
--- a/libc/arch-x86/syscalls/flistxattr.S
+++ b/libc/arch-x86/syscalls/flistxattr.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/flock.S b/libc/arch-x86/syscalls/flock.S
index c19edc7..a4388e9 100644
--- a/libc/arch-x86/syscalls/flock.S
+++ b/libc/arch-x86/syscalls/flock.S
@@ -5,6 +5,9 @@
ENTRY(flock)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_flock, %eax
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
index 52b1288..6377974 100644
--- a/libc/arch-x86/syscalls/fremovexattr.S
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -5,6 +5,9 @@
ENTRY(fremovexattr)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_fremovexattr, %eax
diff --git a/libc/arch-x86/syscalls/fsetxattr.S b/libc/arch-x86/syscalls/fsetxattr.S
index f0e75e2..2f926a5 100644
--- a/libc/arch-x86/syscalls/fsetxattr.S
+++ b/libc/arch-x86/syscalls/fsetxattr.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fstat.S b/libc/arch-x86/syscalls/fstat.S
index b37fc3f..daa4d7f 100644
--- a/libc/arch-x86/syscalls/fstat.S
+++ b/libc/arch-x86/syscalls/fstat.S
@@ -5,6 +5,9 @@
ENTRY(fstat)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_fstat64, %eax
diff --git a/libc/arch-x86/syscalls/fstatat.S b/libc/arch-x86/syscalls/fstatat.S
index ec517c5..7be868c 100644
--- a/libc/arch-x86/syscalls/fstatat.S
+++ b/libc/arch-x86/syscalls/fstatat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/fsync.S b/libc/arch-x86/syscalls/fsync.S
index 4f589f4..71183cb 100644
--- a/libc/arch-x86/syscalls/fsync.S
+++ b/libc/arch-x86/syscalls/fsync.S
@@ -4,6 +4,8 @@
ENTRY(fsync)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_fsync, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/ftruncate.S b/libc/arch-x86/syscalls/ftruncate.S
index e64ead4..1003077 100644
--- a/libc/arch-x86/syscalls/ftruncate.S
+++ b/libc/arch-x86/syscalls/ftruncate.S
@@ -5,6 +5,9 @@
ENTRY(ftruncate)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_ftruncate, %eax
diff --git a/libc/arch-x86/syscalls/ftruncate64.S b/libc/arch-x86/syscalls/ftruncate64.S
index 9d34c4f..586086d 100644
--- a/libc/arch-x86/syscalls/ftruncate64.S
+++ b/libc/arch-x86/syscalls/ftruncate64.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/futex.S b/libc/arch-x86/syscalls/futex.S
index 7328785..7a52913 100644
--- a/libc/arch-x86/syscalls/futex.S
+++ b/libc/arch-x86/syscalls/futex.S
@@ -9,6 +9,13 @@
pushl %esi
pushl %edi
pushl %ebp
+ .cfi_def_cfa_offset 24
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
+ .cfi_rel_offset ebp, 20
mov 28(%esp), %ebx
mov 32(%esp), %ecx
mov 36(%esp), %edx
diff --git a/libc/arch-x86/syscalls/getdents.S b/libc/arch-x86/syscalls/getdents.S
index 1d681ee..9823feb 100644
--- a/libc/arch-x86/syscalls/getdents.S
+++ b/libc/arch-x86/syscalls/getdents.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/getgroups.S b/libc/arch-x86/syscalls/getgroups.S
index 7c563fd..e4247e7 100644
--- a/libc/arch-x86/syscalls/getgroups.S
+++ b/libc/arch-x86/syscalls/getgroups.S
@@ -5,6 +5,9 @@
ENTRY(getgroups)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_getgroups32, %eax
diff --git a/libc/arch-x86/syscalls/getitimer.S b/libc/arch-x86/syscalls/getitimer.S
index 491cc8d..2deebc9 100644
--- a/libc/arch-x86/syscalls/getitimer.S
+++ b/libc/arch-x86/syscalls/getitimer.S
@@ -5,6 +5,9 @@
ENTRY(getitimer)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_getitimer, %eax
diff --git a/libc/arch-x86/syscalls/getpeername.S b/libc/arch-x86/syscalls/getpeername.S
index 4328320..e894093 100644
--- a/libc/arch-x86/syscalls/getpeername.S
+++ b/libc/arch-x86/syscalls/getpeername.S
@@ -5,6 +5,9 @@
ENTRY(getpeername)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $7, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/getpgid.S b/libc/arch-x86/syscalls/getpgid.S
index ff69cbc..c50a09f 100644
--- a/libc/arch-x86/syscalls/getpgid.S
+++ b/libc/arch-x86/syscalls/getpgid.S
@@ -4,6 +4,8 @@
ENTRY(getpgid)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_getpgid, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/getresgid.S b/libc/arch-x86/syscalls/getresgid.S
index 3bfa9b9..ad74e56 100644
--- a/libc/arch-x86/syscalls/getresgid.S
+++ b/libc/arch-x86/syscalls/getresgid.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/getresuid.S b/libc/arch-x86/syscalls/getresuid.S
index c296ba8..6cf60b3 100644
--- a/libc/arch-x86/syscalls/getresuid.S
+++ b/libc/arch-x86/syscalls/getresuid.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/getrlimit.S b/libc/arch-x86/syscalls/getrlimit.S
index 1bf19d0..5e75b6b 100644
--- a/libc/arch-x86/syscalls/getrlimit.S
+++ b/libc/arch-x86/syscalls/getrlimit.S
@@ -5,6 +5,9 @@
ENTRY(getrlimit)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_ugetrlimit, %eax
diff --git a/libc/arch-x86/syscalls/getrusage.S b/libc/arch-x86/syscalls/getrusage.S
index b86d48d..2dfd005 100644
--- a/libc/arch-x86/syscalls/getrusage.S
+++ b/libc/arch-x86/syscalls/getrusage.S
@@ -5,6 +5,9 @@
ENTRY(getrusage)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_getrusage, %eax
diff --git a/libc/arch-x86/syscalls/getsid.S b/libc/arch-x86/syscalls/getsid.S
index 3e3997c..1f60309 100644
--- a/libc/arch-x86/syscalls/getsid.S
+++ b/libc/arch-x86/syscalls/getsid.S
@@ -4,6 +4,8 @@
ENTRY(getsid)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_getsid, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/getsockname.S b/libc/arch-x86/syscalls/getsockname.S
index bd4fa1b..5c22bdf 100644
--- a/libc/arch-x86/syscalls/getsockname.S
+++ b/libc/arch-x86/syscalls/getsockname.S
@@ -5,6 +5,9 @@
ENTRY(getsockname)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $6, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/getsockopt.S b/libc/arch-x86/syscalls/getsockopt.S
index 4f2c19a..9c02d23 100644
--- a/libc/arch-x86/syscalls/getsockopt.S
+++ b/libc/arch-x86/syscalls/getsockopt.S
@@ -5,6 +5,9 @@
ENTRY(getsockopt)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $15, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/gettimeofday.S b/libc/arch-x86/syscalls/gettimeofday.S
index f711b16..10c5de9 100644
--- a/libc/arch-x86/syscalls/gettimeofday.S
+++ b/libc/arch-x86/syscalls/gettimeofday.S
@@ -5,6 +5,9 @@
ENTRY(gettimeofday)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_gettimeofday, %eax
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
index 93a1c41..f491a0c 100644
--- a/libc/arch-x86/syscalls/getxattr.S
+++ b/libc/arch-x86/syscalls/getxattr.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/init_module.S b/libc/arch-x86/syscalls/init_module.S
index 4ed64f5..1a159d3 100644
--- a/libc/arch-x86/syscalls/init_module.S
+++ b/libc/arch-x86/syscalls/init_module.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/inotify_add_watch.S b/libc/arch-x86/syscalls/inotify_add_watch.S
index 9222e62..424698d 100644
--- a/libc/arch-x86/syscalls/inotify_add_watch.S
+++ b/libc/arch-x86/syscalls/inotify_add_watch.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/inotify_init1.S b/libc/arch-x86/syscalls/inotify_init1.S
index 11496a5..1b437c6 100644
--- a/libc/arch-x86/syscalls/inotify_init1.S
+++ b/libc/arch-x86/syscalls/inotify_init1.S
@@ -4,6 +4,8 @@
ENTRY(inotify_init1)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_inotify_init1, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/inotify_rm_watch.S b/libc/arch-x86/syscalls/inotify_rm_watch.S
index 83f5ccd..18ec3ca 100644
--- a/libc/arch-x86/syscalls/inotify_rm_watch.S
+++ b/libc/arch-x86/syscalls/inotify_rm_watch.S
@@ -5,6 +5,9 @@
ENTRY(inotify_rm_watch)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_inotify_rm_watch, %eax
diff --git a/libc/arch-x86/syscalls/ioprio_get.S b/libc/arch-x86/syscalls/ioprio_get.S
index 46bf8b5..6dfc767 100644
--- a/libc/arch-x86/syscalls/ioprio_get.S
+++ b/libc/arch-x86/syscalls/ioprio_get.S
@@ -5,6 +5,9 @@
ENTRY(ioprio_get)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_ioprio_get, %eax
diff --git a/libc/arch-x86/syscalls/ioprio_set.S b/libc/arch-x86/syscalls/ioprio_set.S
index ba292eb..bcefacb 100644
--- a/libc/arch-x86/syscalls/ioprio_set.S
+++ b/libc/arch-x86/syscalls/ioprio_set.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/kill.S b/libc/arch-x86/syscalls/kill.S
index 250e991..499158b 100644
--- a/libc/arch-x86/syscalls/kill.S
+++ b/libc/arch-x86/syscalls/kill.S
@@ -5,6 +5,9 @@
ENTRY(kill)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_kill, %eax
diff --git a/libc/arch-x86/syscalls/klogctl.S b/libc/arch-x86/syscalls/klogctl.S
index 22a4b3a..f422ac8 100644
--- a/libc/arch-x86/syscalls/klogctl.S
+++ b/libc/arch-x86/syscalls/klogctl.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
index 1100a01..def7c66 100644
--- a/libc/arch-x86/syscalls/lgetxattr.S
+++ b/libc/arch-x86/syscalls/lgetxattr.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/linkat.S b/libc/arch-x86/syscalls/linkat.S
index 6aae8f5..ffb1b5d 100644
--- a/libc/arch-x86/syscalls/linkat.S
+++ b/libc/arch-x86/syscalls/linkat.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/listen.S b/libc/arch-x86/syscalls/listen.S
index 7fe8a5a..7e4d2f3 100644
--- a/libc/arch-x86/syscalls/listen.S
+++ b/libc/arch-x86/syscalls/listen.S
@@ -5,6 +5,9 @@
ENTRY(listen)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $4, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
index a1c3888..5b94a72 100644
--- a/libc/arch-x86/syscalls/listxattr.S
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
index 66b25cd..1c64591 100644
--- a/libc/arch-x86/syscalls/llistxattr.S
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
index 2d5009f..d67b221 100644
--- a/libc/arch-x86/syscalls/lremovexattr.S
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -5,6 +5,9 @@
ENTRY(lremovexattr)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_lremovexattr, %eax
diff --git a/libc/arch-x86/syscalls/lseek.S b/libc/arch-x86/syscalls/lseek.S
index 1ed5310..5a58b81 100644
--- a/libc/arch-x86/syscalls/lseek.S
+++ b/libc/arch-x86/syscalls/lseek.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
index adaffcb..f2dba39 100644
--- a/libc/arch-x86/syscalls/lsetxattr.S
+++ b/libc/arch-x86/syscalls/lsetxattr.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/madvise.S b/libc/arch-x86/syscalls/madvise.S
index 52d62a7..edd37b5 100644
--- a/libc/arch-x86/syscalls/madvise.S
+++ b/libc/arch-x86/syscalls/madvise.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mincore.S b/libc/arch-x86/syscalls/mincore.S
index 9e0bbef..44ea364 100644
--- a/libc/arch-x86/syscalls/mincore.S
+++ b/libc/arch-x86/syscalls/mincore.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mkdirat.S b/libc/arch-x86/syscalls/mkdirat.S
index 602208e..d80e3fb 100644
--- a/libc/arch-x86/syscalls/mkdirat.S
+++ b/libc/arch-x86/syscalls/mkdirat.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mknodat.S b/libc/arch-x86/syscalls/mknodat.S
index 643d310..20560df 100644
--- a/libc/arch-x86/syscalls/mknodat.S
+++ b/libc/arch-x86/syscalls/mknodat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mlock.S b/libc/arch-x86/syscalls/mlock.S
index 4a663ee..78cfa58 100644
--- a/libc/arch-x86/syscalls/mlock.S
+++ b/libc/arch-x86/syscalls/mlock.S
@@ -5,6 +5,9 @@
ENTRY(mlock)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_mlock, %eax
diff --git a/libc/arch-x86/syscalls/mlockall.S b/libc/arch-x86/syscalls/mlockall.S
index ac3d606..4e78fef 100644
--- a/libc/arch-x86/syscalls/mlockall.S
+++ b/libc/arch-x86/syscalls/mlockall.S
@@ -4,6 +4,8 @@
ENTRY(mlockall)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_mlockall, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/mount.S b/libc/arch-x86/syscalls/mount.S
index a7b4c12..cc1a518 100644
--- a/libc/arch-x86/syscalls/mount.S
+++ b/libc/arch-x86/syscalls/mount.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mprotect.S b/libc/arch-x86/syscalls/mprotect.S
index 75340ba..9c30af4 100644
--- a/libc/arch-x86/syscalls/mprotect.S
+++ b/libc/arch-x86/syscalls/mprotect.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/mremap.S b/libc/arch-x86/syscalls/mremap.S
index 3e77ebe..1439ef5 100644
--- a/libc/arch-x86/syscalls/mremap.S
+++ b/libc/arch-x86/syscalls/mremap.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/msync.S b/libc/arch-x86/syscalls/msync.S
index 8a7c68d..d330967 100644
--- a/libc/arch-x86/syscalls/msync.S
+++ b/libc/arch-x86/syscalls/msync.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/munlock.S b/libc/arch-x86/syscalls/munlock.S
index 868d00b..ce6197d 100644
--- a/libc/arch-x86/syscalls/munlock.S
+++ b/libc/arch-x86/syscalls/munlock.S
@@ -5,6 +5,9 @@
ENTRY(munlock)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_munlock, %eax
diff --git a/libc/arch-x86/syscalls/munmap.S b/libc/arch-x86/syscalls/munmap.S
index b0b524d..be7eec6 100644
--- a/libc/arch-x86/syscalls/munmap.S
+++ b/libc/arch-x86/syscalls/munmap.S
@@ -5,6 +5,9 @@
ENTRY(munmap)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_munmap, %eax
diff --git a/libc/arch-x86/syscalls/nanosleep.S b/libc/arch-x86/syscalls/nanosleep.S
index 632baf5..9faa06b 100644
--- a/libc/arch-x86/syscalls/nanosleep.S
+++ b/libc/arch-x86/syscalls/nanosleep.S
@@ -5,6 +5,9 @@
ENTRY(nanosleep)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_nanosleep, %eax
diff --git a/libc/arch-x86/syscalls/perf_event_open.S b/libc/arch-x86/syscalls/perf_event_open.S
index 931282a..ebbe1f0 100644
--- a/libc/arch-x86/syscalls/perf_event_open.S
+++ b/libc/arch-x86/syscalls/perf_event_open.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/personality.S b/libc/arch-x86/syscalls/personality.S
index 1d89a7c..8116e2d 100644
--- a/libc/arch-x86/syscalls/personality.S
+++ b/libc/arch-x86/syscalls/personality.S
@@ -4,6 +4,8 @@
ENTRY(personality)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_personality, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/pipe2.S b/libc/arch-x86/syscalls/pipe2.S
index 66c4bf1..c2e11a2 100644
--- a/libc/arch-x86/syscalls/pipe2.S
+++ b/libc/arch-x86/syscalls/pipe2.S
@@ -5,6 +5,9 @@
ENTRY(pipe2)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_pipe2, %eax
diff --git a/libc/arch-x86/syscalls/prctl.S b/libc/arch-x86/syscalls/prctl.S
index cd09df7..1a5daca 100644
--- a/libc/arch-x86/syscalls/prctl.S
+++ b/libc/arch-x86/syscalls/prctl.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/pread64.S b/libc/arch-x86/syscalls/pread64.S
index 0a6ae2d..32a76c5 100644
--- a/libc/arch-x86/syscalls/pread64.S
+++ b/libc/arch-x86/syscalls/pread64.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/prlimit64.S b/libc/arch-x86/syscalls/prlimit64.S
new file mode 100644
index 0000000..2256425
--- /dev/null
+++ b/libc/arch-x86/syscalls/prlimit64.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ mov 20(%esp), %ebx
+ mov 24(%esp), %ecx
+ mov 28(%esp), %edx
+ mov 32(%esp), %esi
+ movl $__NR_prlimit64, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
+END(prlimit64)
diff --git a/libc/arch-x86/syscalls/pwrite64.S b/libc/arch-x86/syscalls/pwrite64.S
index 7ad8ccf..b003435 100644
--- a/libc/arch-x86/syscalls/pwrite64.S
+++ b/libc/arch-x86/syscalls/pwrite64.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/read.S b/libc/arch-x86/syscalls/read.S
index a02435e..ad1c19a 100644
--- a/libc/arch-x86/syscalls/read.S
+++ b/libc/arch-x86/syscalls/read.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/readahead.S b/libc/arch-x86/syscalls/readahead.S
index 02d32ba..a4d634f 100644
--- a/libc/arch-x86/syscalls/readahead.S
+++ b/libc/arch-x86/syscalls/readahead.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/readlinkat.S b/libc/arch-x86/syscalls/readlinkat.S
index 8548deb..37df8d8 100644
--- a/libc/arch-x86/syscalls/readlinkat.S
+++ b/libc/arch-x86/syscalls/readlinkat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/readv.S b/libc/arch-x86/syscalls/readv.S
index ebd9caf..05445c0 100644
--- a/libc/arch-x86/syscalls/readv.S
+++ b/libc/arch-x86/syscalls/readv.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/recvfrom.S b/libc/arch-x86/syscalls/recvfrom.S
index c266e93..df489c8 100644
--- a/libc/arch-x86/syscalls/recvfrom.S
+++ b/libc/arch-x86/syscalls/recvfrom.S
@@ -5,6 +5,9 @@
ENTRY(recvfrom)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $12, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/recvmsg.S b/libc/arch-x86/syscalls/recvmsg.S
index df29059..a587b00 100644
--- a/libc/arch-x86/syscalls/recvmsg.S
+++ b/libc/arch-x86/syscalls/recvmsg.S
@@ -5,6 +5,9 @@
ENTRY(recvmsg)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $17, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
index 1a974be..99192f0 100644
--- a/libc/arch-x86/syscalls/removexattr.S
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -5,6 +5,9 @@
ENTRY(removexattr)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_removexattr, %eax
diff --git a/libc/arch-x86/syscalls/renameat.S b/libc/arch-x86/syscalls/renameat.S
index 8d2a0ed..831b24c 100644
--- a/libc/arch-x86/syscalls/renameat.S
+++ b/libc/arch-x86/syscalls/renameat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sched_get_priority_max.S b/libc/arch-x86/syscalls/sched_get_priority_max.S
index 089b576..0b7c269 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_max.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_max.S
@@ -4,6 +4,8 @@
ENTRY(sched_get_priority_max)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sched_get_priority_max, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/sched_get_priority_min.S b/libc/arch-x86/syscalls/sched_get_priority_min.S
index 9e52f30..ce28f8c 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_min.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_min.S
@@ -4,6 +4,8 @@
ENTRY(sched_get_priority_min)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sched_get_priority_min, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/sched_getparam.S b/libc/arch-x86/syscalls/sched_getparam.S
index 2221eca..2c3b7b9 100644
--- a/libc/arch-x86/syscalls/sched_getparam.S
+++ b/libc/arch-x86/syscalls/sched_getparam.S
@@ -5,6 +5,9 @@
ENTRY(sched_getparam)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_sched_getparam, %eax
diff --git a/libc/arch-x86/syscalls/sched_getscheduler.S b/libc/arch-x86/syscalls/sched_getscheduler.S
index 167a5d5..6a3842a 100644
--- a/libc/arch-x86/syscalls/sched_getscheduler.S
+++ b/libc/arch-x86/syscalls/sched_getscheduler.S
@@ -4,6 +4,8 @@
ENTRY(sched_getscheduler)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sched_getscheduler, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/sched_rr_get_interval.S b/libc/arch-x86/syscalls/sched_rr_get_interval.S
index ee2ef0e..c1055da 100644
--- a/libc/arch-x86/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-x86/syscalls/sched_rr_get_interval.S
@@ -5,6 +5,9 @@
ENTRY(sched_rr_get_interval)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_sched_rr_get_interval, %eax
diff --git a/libc/arch-x86/syscalls/sched_setaffinity.S b/libc/arch-x86/syscalls/sched_setaffinity.S
index 5ef78ee..bd3d0ab 100644
--- a/libc/arch-x86/syscalls/sched_setaffinity.S
+++ b/libc/arch-x86/syscalls/sched_setaffinity.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sched_setparam.S b/libc/arch-x86/syscalls/sched_setparam.S
index d993759..2329268 100644
--- a/libc/arch-x86/syscalls/sched_setparam.S
+++ b/libc/arch-x86/syscalls/sched_setparam.S
@@ -5,6 +5,9 @@
ENTRY(sched_setparam)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_sched_setparam, %eax
diff --git a/libc/arch-x86/syscalls/sched_setscheduler.S b/libc/arch-x86/syscalls/sched_setscheduler.S
index aa73874..a3ce8ab 100644
--- a/libc/arch-x86/syscalls/sched_setscheduler.S
+++ b/libc/arch-x86/syscalls/sched_setscheduler.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sched_yield.S b/libc/arch-x86/syscalls/sched_yield.S
index 41642f1..fb563c4 100644
--- a/libc/arch-x86/syscalls/sched_yield.S
+++ b/libc/arch-x86/syscalls/sched_yield.S
@@ -4,6 +4,8 @@
ENTRY(sched_yield)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sched_yield, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/sendfile.S b/libc/arch-x86/syscalls/sendfile.S
index 9bebc99..280a4ae 100644
--- a/libc/arch-x86/syscalls/sendfile.S
+++ b/libc/arch-x86/syscalls/sendfile.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sendfile64.S b/libc/arch-x86/syscalls/sendfile64.S
index 7032e8a..383c8c6 100644
--- a/libc/arch-x86/syscalls/sendfile64.S
+++ b/libc/arch-x86/syscalls/sendfile64.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sendmsg.S b/libc/arch-x86/syscalls/sendmsg.S
index 410731f..70bad29 100644
--- a/libc/arch-x86/syscalls/sendmsg.S
+++ b/libc/arch-x86/syscalls/sendmsg.S
@@ -5,6 +5,9 @@
ENTRY(sendmsg)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $16, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/sendto.S b/libc/arch-x86/syscalls/sendto.S
index c63bf08..dbe520d 100644
--- a/libc/arch-x86/syscalls/sendto.S
+++ b/libc/arch-x86/syscalls/sendto.S
@@ -5,6 +5,9 @@
ENTRY(sendto)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $11, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/setgid.S b/libc/arch-x86/syscalls/setgid.S
index a15eab1..69ac15b 100644
--- a/libc/arch-x86/syscalls/setgid.S
+++ b/libc/arch-x86/syscalls/setgid.S
@@ -4,6 +4,8 @@
ENTRY(setgid)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_setgid32, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/setgroups.S b/libc/arch-x86/syscalls/setgroups.S
index 9c2879a..f704c46 100644
--- a/libc/arch-x86/syscalls/setgroups.S
+++ b/libc/arch-x86/syscalls/setgroups.S
@@ -5,6 +5,9 @@
ENTRY(setgroups)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_setgroups32, %eax
diff --git a/libc/arch-x86/syscalls/setitimer.S b/libc/arch-x86/syscalls/setitimer.S
index 0a2328d..1573816 100644
--- a/libc/arch-x86/syscalls/setitimer.S
+++ b/libc/arch-x86/syscalls/setitimer.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/setns.S b/libc/arch-x86/syscalls/setns.S
new file mode 100644
index 0000000..2c39a21
--- /dev/null
+++ b/libc/arch-x86/syscalls/setns.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ pushl %ebx
+ pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_setns, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
+END(setns)
diff --git a/libc/arch-x86/syscalls/setpgid.S b/libc/arch-x86/syscalls/setpgid.S
index 8923239..ae69633 100644
--- a/libc/arch-x86/syscalls/setpgid.S
+++ b/libc/arch-x86/syscalls/setpgid.S
@@ -5,6 +5,9 @@
ENTRY(setpgid)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_setpgid, %eax
diff --git a/libc/arch-x86/syscalls/setpriority.S b/libc/arch-x86/syscalls/setpriority.S
index 6a887f6..b58cd13 100644
--- a/libc/arch-x86/syscalls/setpriority.S
+++ b/libc/arch-x86/syscalls/setpriority.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/setregid.S b/libc/arch-x86/syscalls/setregid.S
index 8748c10..561a658 100644
--- a/libc/arch-x86/syscalls/setregid.S
+++ b/libc/arch-x86/syscalls/setregid.S
@@ -5,6 +5,9 @@
ENTRY(setregid)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_setregid32, %eax
diff --git a/libc/arch-x86/syscalls/setresgid.S b/libc/arch-x86/syscalls/setresgid.S
index 22eb02d..a210975 100644
--- a/libc/arch-x86/syscalls/setresgid.S
+++ b/libc/arch-x86/syscalls/setresgid.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/setresuid.S b/libc/arch-x86/syscalls/setresuid.S
index 3a66ea6..920e68b 100644
--- a/libc/arch-x86/syscalls/setresuid.S
+++ b/libc/arch-x86/syscalls/setresuid.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/setreuid.S b/libc/arch-x86/syscalls/setreuid.S
index 16dd64e..7f911ad 100644
--- a/libc/arch-x86/syscalls/setreuid.S
+++ b/libc/arch-x86/syscalls/setreuid.S
@@ -5,6 +5,9 @@
ENTRY(setreuid)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_setreuid32, %eax
diff --git a/libc/arch-x86/syscalls/setrlimit.S b/libc/arch-x86/syscalls/setrlimit.S
index cc69245..e103ecf 100644
--- a/libc/arch-x86/syscalls/setrlimit.S
+++ b/libc/arch-x86/syscalls/setrlimit.S
@@ -5,6 +5,9 @@
ENTRY(setrlimit)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_setrlimit, %eax
diff --git a/libc/arch-x86/syscalls/setsockopt.S b/libc/arch-x86/syscalls/setsockopt.S
index e927c23..f56f812 100644
--- a/libc/arch-x86/syscalls/setsockopt.S
+++ b/libc/arch-x86/syscalls/setsockopt.S
@@ -5,6 +5,9 @@
ENTRY(setsockopt)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $14, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/settimeofday.S b/libc/arch-x86/syscalls/settimeofday.S
index 6c3b00b..1ae4d58 100644
--- a/libc/arch-x86/syscalls/settimeofday.S
+++ b/libc/arch-x86/syscalls/settimeofday.S
@@ -5,6 +5,9 @@
ENTRY(settimeofday)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_settimeofday, %eax
diff --git a/libc/arch-x86/syscalls/setuid.S b/libc/arch-x86/syscalls/setuid.S
index e7db8da..6549fd4 100644
--- a/libc/arch-x86/syscalls/setuid.S
+++ b/libc/arch-x86/syscalls/setuid.S
@@ -4,6 +4,8 @@
ENTRY(setuid)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_setuid32, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
index 98cafb4..fae04df 100644
--- a/libc/arch-x86/syscalls/setxattr.S
+++ b/libc/arch-x86/syscalls/setxattr.S
@@ -8,6 +8,12 @@
pushl %edx
pushl %esi
pushl %edi
+ .cfi_def_cfa_offset 20
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
+ .cfi_rel_offset edi, 16
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
diff --git a/libc/arch-x86/syscalls/shutdown.S b/libc/arch-x86/syscalls/shutdown.S
index d1ea589..13e8fd9 100644
--- a/libc/arch-x86/syscalls/shutdown.S
+++ b/libc/arch-x86/syscalls/shutdown.S
@@ -5,6 +5,9 @@
ENTRY(shutdown)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $13, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/sigaltstack.S b/libc/arch-x86/syscalls/sigaltstack.S
index 58a2997..71fdb12 100644
--- a/libc/arch-x86/syscalls/sigaltstack.S
+++ b/libc/arch-x86/syscalls/sigaltstack.S
@@ -5,6 +5,9 @@
ENTRY(sigaltstack)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_sigaltstack, %eax
diff --git a/libc/arch-x86/syscalls/signalfd4.S b/libc/arch-x86/syscalls/signalfd4.S
index 6e0c20b..1fe6c68 100644
--- a/libc/arch-x86/syscalls/signalfd4.S
+++ b/libc/arch-x86/syscalls/signalfd4.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/socket.S b/libc/arch-x86/syscalls/socket.S
index 1bc6bd7..282681e 100644
--- a/libc/arch-x86/syscalls/socket.S
+++ b/libc/arch-x86/syscalls/socket.S
@@ -5,6 +5,9 @@
ENTRY(socket)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $1, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/socketpair.S b/libc/arch-x86/syscalls/socketpair.S
index e2a98d3..3681c4f 100644
--- a/libc/arch-x86/syscalls/socketpair.S
+++ b/libc/arch-x86/syscalls/socketpair.S
@@ -5,6 +5,9 @@
ENTRY(socketpair)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov $8, %ebx
mov %esp, %ecx
addl $12, %ecx
diff --git a/libc/arch-x86/syscalls/swapoff.S b/libc/arch-x86/syscalls/swapoff.S
index 1d08319..31f8be1 100644
--- a/libc/arch-x86/syscalls/swapoff.S
+++ b/libc/arch-x86/syscalls/swapoff.S
@@ -4,6 +4,8 @@
ENTRY(swapoff)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_swapoff, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/swapon.S b/libc/arch-x86/syscalls/swapon.S
index f6f47c6..687c492 100644
--- a/libc/arch-x86/syscalls/swapon.S
+++ b/libc/arch-x86/syscalls/swapon.S
@@ -5,6 +5,9 @@
ENTRY(swapon)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_swapon, %eax
diff --git a/libc/arch-x86/syscalls/symlinkat.S b/libc/arch-x86/syscalls/symlinkat.S
index 6011560..1f33f7b 100644
--- a/libc/arch-x86/syscalls/symlinkat.S
+++ b/libc/arch-x86/syscalls/symlinkat.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/sync.S b/libc/arch-x86/syscalls/sync.S
index 518b39e..f80296f 100644
--- a/libc/arch-x86/syscalls/sync.S
+++ b/libc/arch-x86/syscalls/sync.S
@@ -4,6 +4,8 @@
ENTRY(sync)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sync, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/sysinfo.S b/libc/arch-x86/syscalls/sysinfo.S
index 8fde6e4..8b9a23e 100644
--- a/libc/arch-x86/syscalls/sysinfo.S
+++ b/libc/arch-x86/syscalls/sysinfo.S
@@ -4,6 +4,8 @@
ENTRY(sysinfo)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_sysinfo, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/tgkill.S b/libc/arch-x86/syscalls/tgkill.S
index 9bd0b6f..e57645c 100644
--- a/libc/arch-x86/syscalls/tgkill.S
+++ b/libc/arch-x86/syscalls/tgkill.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/timerfd_create.S b/libc/arch-x86/syscalls/timerfd_create.S
index 8546c34..33b2980 100644
--- a/libc/arch-x86/syscalls/timerfd_create.S
+++ b/libc/arch-x86/syscalls/timerfd_create.S
@@ -5,6 +5,9 @@
ENTRY(timerfd_create)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_timerfd_create, %eax
diff --git a/libc/arch-x86/syscalls/timerfd_gettime.S b/libc/arch-x86/syscalls/timerfd_gettime.S
index 5f39080..66b004b 100644
--- a/libc/arch-x86/syscalls/timerfd_gettime.S
+++ b/libc/arch-x86/syscalls/timerfd_gettime.S
@@ -5,6 +5,9 @@
ENTRY(timerfd_gettime)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_timerfd_gettime, %eax
diff --git a/libc/arch-x86/syscalls/timerfd_settime.S b/libc/arch-x86/syscalls/timerfd_settime.S
index c017ca8..3f4035e 100644
--- a/libc/arch-x86/syscalls/timerfd_settime.S
+++ b/libc/arch-x86/syscalls/timerfd_settime.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/times.S b/libc/arch-x86/syscalls/times.S
index 7ada376..b9e2845 100644
--- a/libc/arch-x86/syscalls/times.S
+++ b/libc/arch-x86/syscalls/times.S
@@ -4,6 +4,8 @@
ENTRY(times)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_times, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/tkill.S b/libc/arch-x86/syscalls/tkill.S
index 326efa3..f8da369 100644
--- a/libc/arch-x86/syscalls/tkill.S
+++ b/libc/arch-x86/syscalls/tkill.S
@@ -5,6 +5,9 @@
ENTRY(tkill)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_tkill, %eax
diff --git a/libc/arch-x86/syscalls/truncate.S b/libc/arch-x86/syscalls/truncate.S
index 0625621..019894c 100644
--- a/libc/arch-x86/syscalls/truncate.S
+++ b/libc/arch-x86/syscalls/truncate.S
@@ -5,6 +5,9 @@
ENTRY(truncate)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_truncate, %eax
diff --git a/libc/arch-x86/syscalls/truncate64.S b/libc/arch-x86/syscalls/truncate64.S
index 0a45f8a..99b71b0 100644
--- a/libc/arch-x86/syscalls/truncate64.S
+++ b/libc/arch-x86/syscalls/truncate64.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/umask.S b/libc/arch-x86/syscalls/umask.S
index 3534340..485b326 100644
--- a/libc/arch-x86/syscalls/umask.S
+++ b/libc/arch-x86/syscalls/umask.S
@@ -4,6 +4,8 @@
ENTRY(umask)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_umask, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/umount2.S b/libc/arch-x86/syscalls/umount2.S
index f5f9c66..100d38c 100644
--- a/libc/arch-x86/syscalls/umount2.S
+++ b/libc/arch-x86/syscalls/umount2.S
@@ -5,6 +5,9 @@
ENTRY(umount2)
pushl %ebx
pushl %ecx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
mov 12(%esp), %ebx
mov 16(%esp), %ecx
movl $__NR_umount2, %eax
diff --git a/libc/arch-x86/syscalls/uname.S b/libc/arch-x86/syscalls/uname.S
index 6203567..f1ba3b9 100644
--- a/libc/arch-x86/syscalls/uname.S
+++ b/libc/arch-x86/syscalls/uname.S
@@ -4,6 +4,8 @@
ENTRY(uname)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_uname, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/unlinkat.S b/libc/arch-x86/syscalls/unlinkat.S
index 8527c0b..1a573d4 100644
--- a/libc/arch-x86/syscalls/unlinkat.S
+++ b/libc/arch-x86/syscalls/unlinkat.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/unshare.S b/libc/arch-x86/syscalls/unshare.S
index 00214bd..95fdbf6 100644
--- a/libc/arch-x86/syscalls/unshare.S
+++ b/libc/arch-x86/syscalls/unshare.S
@@ -4,6 +4,8 @@
ENTRY(unshare)
pushl %ebx
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset ebx, 0
mov 8(%esp), %ebx
movl $__NR_unshare, %eax
int $0x80
diff --git a/libc/arch-x86/syscalls/utimensat.S b/libc/arch-x86/syscalls/utimensat.S
index 7869ebc..099f551 100644
--- a/libc/arch-x86/syscalls/utimensat.S
+++ b/libc/arch-x86/syscalls/utimensat.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/wait4.S b/libc/arch-x86/syscalls/wait4.S
index c887b6c..b6196f8 100644
--- a/libc/arch-x86/syscalls/wait4.S
+++ b/libc/arch-x86/syscalls/wait4.S
@@ -7,6 +7,11 @@
pushl %ecx
pushl %edx
pushl %esi
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
+ .cfi_rel_offset esi, 12
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
diff --git a/libc/arch-x86/syscalls/write.S b/libc/arch-x86/syscalls/write.S
index 60989af..971cb30 100644
--- a/libc/arch-x86/syscalls/write.S
+++ b/libc/arch-x86/syscalls/write.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86/syscalls/writev.S b/libc/arch-x86/syscalls/writev.S
index f7e8a93..ab8e705 100644
--- a/libc/arch-x86/syscalls/writev.S
+++ b/libc/arch-x86/syscalls/writev.S
@@ -6,6 +6,10 @@
pushl %ebx
pushl %ecx
pushl %edx
+ .cfi_def_cfa_offset 12
+ .cfi_rel_offset ebx, 0
+ .cfi_rel_offset ecx, 4
+ .cfi_rel_offset edx, 8
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
diff --git a/libc/arch-x86_64/bionic/_exit_with_stack_teardown.S b/libc/arch-x86_64/bionic/_exit_with_stack_teardown.S
index eca3b68..f7bc962 100644
--- a/libc/arch-x86_64/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-x86_64/bionic/_exit_with_stack_teardown.S
@@ -26,20 +26,16 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
ENTRY(_exit_with_stack_teardown)
- // We take advantage of the fact that the linux syscall trap
- // handler saves all the registers, so we don't need to save
- // the status argument for exit(2) while doing the munmap(2).
- mov $__NR_munmap, %eax
- syscall
- // If munmap failed, we ignore the failure and exit anyway.
+ mov $__NR_munmap, %eax
+ syscall
+ // If munmap failed, we ignore the failure and exit anyway.
- mov %rdx, %rdi // status
- mov $__NR_exit, %eax
- syscall
- // The exit syscall does not return.
+ mov $0, %rdi
+ mov $__NR_exit, %eax
+ syscall
+ // The exit syscall does not return.
END(_exit_with_stack_teardown)
diff --git a/libc/arch-x86_64/bionic/futex_x86_64.S b/libc/arch-x86_64/bionic/futex_x86_64.S
index 48a437e..f85d583 100644
--- a/libc/arch-x86_64/bionic/futex_x86_64.S
+++ b/libc/arch-x86_64/bionic/futex_x86_64.S
@@ -26,15 +26,12 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
- */
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
mov %rdx, %r10 /* timeout */
mov %esi, %edx /* val */
@@ -44,8 +41,7 @@
ret
END(__futex_wait)
-/* int __futex_wake(volatile void *ftx, int count) */
-
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
mov %esi, %edx
mov $FUTEX_WAKE, %esi
@@ -54,14 +50,14 @@
ret
END(__futex_wake)
-/* int __futex_syscall3(volatile void *ftx, int op, int count) */
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
mov $__NR_futex, %eax
syscall
ret
END(__futex_syscall3)
-/* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
mov %rcx, %r10 /* timeout */
mov $__NR_futex, %eax
diff --git a/libc/arch-x86_64/syscalls.mk b/libc/arch-x86_64/syscalls.mk
index 9e2bfcc..ec09e77 100644
--- a/libc/arch-x86_64/syscalls.mk
+++ b/libc/arch-x86_64/syscalls.mk
@@ -124,6 +124,7 @@
syscall_src += arch-x86_64/syscalls/pipe2.S
syscall_src += arch-x86_64/syscalls/prctl.S
syscall_src += arch-x86_64/syscalls/pread64.S
+syscall_src += arch-x86_64/syscalls/prlimit64.S
syscall_src += arch-x86_64/syscalls/pwrite64.S
syscall_src += arch-x86_64/syscalls/read.S
syscall_src += arch-x86_64/syscalls/readahead.S
@@ -148,6 +149,7 @@
syscall_src += arch-x86_64/syscalls/setgid.S
syscall_src += arch-x86_64/syscalls/setgroups.S
syscall_src += arch-x86_64/syscalls/setitimer.S
+syscall_src += arch-x86_64/syscalls/setns.S
syscall_src += arch-x86_64/syscalls/setpgid.S
syscall_src += arch-x86_64/syscalls/setpriority.S
syscall_src += arch-x86_64/syscalls/setregid.S
diff --git a/libc/arch-x86_64/syscalls/getrlimit.S b/libc/arch-x86_64/syscalls/getrlimit.S
index 1417b28..0b3536c 100644
--- a/libc/arch-x86_64/syscalls/getrlimit.S
+++ b/libc/arch-x86_64/syscalls/getrlimit.S
@@ -14,3 +14,6 @@
1:
ret
END(getrlimit)
+
+ .globl _C_LABEL(getrlimit64)
+ .equ _C_LABEL(getrlimit64), _C_LABEL(getrlimit)
diff --git a/libc/arch-x86_64/syscalls/prlimit64.S b/libc/arch-x86_64/syscalls/prlimit64.S
new file mode 100644
index 0000000..b451e8f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/prlimit64.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+ movq %rcx, %r10
+ movl $__NR_prlimit64, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(prlimit64)
+
+ .globl _C_LABEL(prlimit)
+ .equ _C_LABEL(prlimit), _C_LABEL(prlimit64)
diff --git a/libc/arch-x86_64/syscalls/setns.S b/libc/arch-x86_64/syscalls/setns.S
new file mode 100644
index 0000000..bab147b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setns.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ movl $__NR_setns, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setns)
diff --git a/libc/arch-x86_64/syscalls/setrlimit.S b/libc/arch-x86_64/syscalls/setrlimit.S
index de5b3b7..e445ec0 100644
--- a/libc/arch-x86_64/syscalls/setrlimit.S
+++ b/libc/arch-x86_64/syscalls/setrlimit.S
@@ -14,3 +14,6 @@
1:
ret
END(setrlimit)
+
+ .globl _C_LABEL(setrlimit64)
+ .equ _C_LABEL(setrlimit64), _C_LABEL(setrlimit)
diff --git a/libc/bionic/legacy_32_bit_support.cpp b/libc/bionic/legacy_32_bit_support.cpp
index 884dd8b..d7ccdb9 100644
--- a/libc/bionic/legacy_32_bit_support.cpp
+++ b/libc/bionic/legacy_32_bit_support.cpp
@@ -28,10 +28,9 @@
#include <errno.h>
#include <stdarg.h>
+#include <sys/resource.h>
#include <sys/types.h>
#include <sys/vfs.h>
-#include <sys/vfs.h>
-#include <unistd.h>
#include <unistd.h>
#if __LP64__
@@ -86,3 +85,13 @@
ssize_t pwrite(int fd, const void* buf, size_t byte_count, off_t offset) {
return pwrite64(fd, buf, byte_count, static_cast<off64_t>(offset));
}
+
+// There is no getrlimit64 system call, so we need to use prlimit64.
+int getrlimit64(int resource, rlimit64* limits64) {
+ return prlimit64(0, resource, NULL, limits64);
+}
+
+// There is no setrlimit64 system call, so we need to use prlimit64.
+int setrlimit64(int resource, const rlimit64* limits64) {
+ return prlimit64(0, resource, limits64, NULL);
+}
diff --git a/libc/bionic/mmap.cpp b/libc/bionic/mmap.cpp
index 75bea58..84a0f76 100644
--- a/libc/bionic/mmap.cpp
+++ b/libc/bionic/mmap.cpp
@@ -55,5 +55,5 @@
}
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) {
- return mmap64(addr, size, prot, flags, fd, static_cast<off64_t>(offset));
+ return mmap64(addr, size, prot, flags, fd, static_cast<off64_t>(offset) & 0xffffffff);
}
diff --git a/libc/bionic/open.cpp b/libc/bionic/open.cpp
index e0dd181..986ed1c 100644
--- a/libc/bionic/open.cpp
+++ b/libc/bionic/open.cpp
@@ -35,52 +35,52 @@
extern "C" int __openat(int, const char*, int, int);
+static inline int force_O_LARGEFILE(int flags) {
+#if __LP64__
+ return flags; // No need, and aarch64's strace gets confused.
+#else
+ return flags | O_LARGEFILE;
+#endif
+}
+
int open(const char* pathname, int flags, ...) {
mode_t mode = 0;
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
+ if ((flags & O_CREAT) != 0) {
va_list args;
va_start(args, flags);
mode = (mode_t) va_arg(args, int);
va_end(args);
}
- return __openat(AT_FDCWD, pathname, flags, mode);
+ return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), mode);
}
int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
+ if (__predict_false((flags & O_CREAT) != 0)) {
__fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
}
- flags |= O_LARGEFILE;
-
- return __openat(AT_FDCWD, pathname, flags, 0);
+ return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0);
}
int openat(int fd, const char *pathname, int flags, ...) {
mode_t mode = 0;
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
+ if ((flags & O_CREAT) != 0) {
va_list args;
va_start(args, flags);
mode = (mode_t) va_arg(args, int);
va_end(args);
}
- return __openat(fd, pathname, flags, mode);
+ return __openat(fd, pathname, force_O_LARGEFILE(flags), mode);
}
int __openat_2(int fd, const char* pathname, int flags) {
- if (flags & O_CREAT) {
+ if ((flags & O_CREAT) != 0) {
__fortify_chk_fail("openat(O_CREAT): called without specifying a mode", 0);
}
- flags |= O_LARGEFILE;
-
- return __openat(fd, pathname, flags, 0);
+ return __openat(fd, pathname, force_O_LARGEFILE(flags), 0);
}
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index e6e636f..2692762 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -34,7 +34,7 @@
#include "pthread_internal.h"
-extern "C" void _exit_with_stack_teardown(void*, size_t, int);
+extern "C" void _exit_with_stack_teardown(void*, size_t);
extern "C" void __exit(int);
extern "C" int __set_tid_address(int*);
@@ -125,7 +125,7 @@
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
- _exit_with_stack_teardown(stack_base, stack_size, 0);
+ _exit_with_stack_teardown(stack_base, stack_size);
}
// NOTREACHED, but we told the compiler this function is noreturn, and it doesn't believe us.
diff --git a/libc/bionic/sched_getcpu.c b/libc/bionic/sched_getcpu.cpp
similarity index 87%
rename from libc/bionic/sched_getcpu.c
rename to libc/bionic/sched_getcpu.cpp
index 954df37..1f92e54 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/bionic/sched_getcpu.cpp
@@ -25,16 +25,17 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#define _GNU_SOURCE 1
#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+extern "C" int __getcpu(unsigned*, unsigned*, void*);
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
-
- return (int)cpu;
+int sched_getcpu() {
+ unsigned cpu;
+ int rc = __getcpu(&cpu, NULL, NULL);
+ if (rc == -1) {
+ return -1; // errno is already set.
+ }
+ return cpu;
}
diff --git a/libc/bionic/stubs.cpp b/libc/bionic/stubs.cpp
index 6edaa19..707036a 100644
--- a/libc/bionic/stubs.cpp
+++ b/libc/bionic/stubs.cpp
@@ -447,6 +447,16 @@
return NULL;
}
+FILE* setmntent(const char*, const char*) {
+ UNIMPLEMENTED;
+ return NULL;
+}
+
+int endmntent(FILE*) {
+ UNIMPLEMENTED;
+ return 1; /* Allways returns 1 according to man */
+}
+
char* ttyname(int /*fd*/) { // NOLINT: implementing bad function.
UNIMPLEMENTED;
return NULL;
diff --git a/libc/bionic/system_properties.c b/libc/bionic/system_properties.c
index 9fdb6f5..825894f 100644
--- a/libc/bionic/system_properties.c
+++ b/libc/bionic/system_properties.c
@@ -454,7 +454,7 @@
for(;;) {
serial = pi->serial;
while(SERIAL_DIRTY(serial)) {
- __futex_wait((volatile void *)&pi->serial, serial, 0);
+ __futex_wait((volatile void *)&pi->serial, serial, NULL);
serial = pi->serial;
}
len = SERIAL_VALUE_LEN(serial);
@@ -572,12 +572,12 @@
prop_area *pa = __system_property_area__;
n = pa->serial;
do {
- __futex_wait(&pa->serial, n, 0);
+ __futex_wait(&pa->serial, n, NULL);
} while(n == pa->serial);
} else {
n = pi->serial;
do {
- __futex_wait((volatile void *)&pi->serial, n, 0);
+ __futex_wait((volatile void *)&pi->serial, n, NULL);
} while(n == pi->serial);
}
return 0;
@@ -635,7 +635,7 @@
prop_area *pa = __system_property_area__;
do {
- __futex_wait(&pa->serial, serial, 0);
+ __futex_wait(&pa->serial, serial, NULL);
} while(pa->serial == serial);
return pa->serial;
diff --git a/libc/bionic/system_properties_compat.c b/libc/bionic/system_properties_compat.c
index 6dbc4cc..b4c2494 100644
--- a/libc/bionic/system_properties_compat.c
+++ b/libc/bionic/system_properties_compat.c
@@ -48,6 +48,7 @@
unsigned volatile serial;
unsigned magic;
unsigned version;
+ unsigned reserved[4];
unsigned toc[1];
};
@@ -100,7 +101,7 @@
for(;;) {
serial = pi->serial;
while(SERIAL_DIRTY(serial)) {
- __futex_wait((volatile void *)&pi->serial, serial, 0);
+ __futex_wait((volatile void *)&pi->serial, serial, NULL);
serial = pi->serial;
}
len = SERIAL_VALUE_LEN(serial);
diff --git a/libc/include/dirent.h b/libc/include/dirent.h
index 3bd7a0f..129cdfa 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _DIRENT_H_
#define _DIRENT_H_
@@ -34,15 +35,15 @@
__BEGIN_DECLS
#ifndef DT_UNKNOWN
-#define DT_UNKNOWN 0
-#define DT_FIFO 1
-#define DT_CHR 2
-#define DT_DIR 4
-#define DT_BLK 6
-#define DT_REG 8
-#define DT_LNK 10
-#define DT_SOCK 12
-#define DT_WHT 14
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
#endif
struct dirent {
@@ -52,23 +53,21 @@
unsigned char d_type;
char d_name[256];
};
+#define d_fileno d_ino
+#define dirent64 dirent
typedef struct DIR DIR;
-extern DIR* opendir(const char* dirpath);
-extern DIR* fdopendir(int fd);
-extern struct dirent* readdir(DIR* dirp);
-extern int readdir_r(DIR* dirp, struct dirent* entry, struct dirent** result);
-extern int closedir(DIR* dirp);
-extern void rewinddir(DIR* dirp);
-extern int dirfd(DIR* dirp);
-extern int alphasort(const struct dirent** a, const struct dirent** b);
-extern int scandir(const char* dir, struct dirent*** namelist,
- int(*filter)(const struct dirent*),
- int(*compar)(const struct dirent**,
- const struct dirent**));
-
-extern int getdents(unsigned int, struct dirent*, unsigned int);
+extern DIR* opendir(const char*);
+extern DIR* fdopendir(int);
+extern struct dirent* readdir(DIR*);
+extern int readdir_r(DIR*, struct dirent*, struct dirent**);
+extern int closedir(DIR*);
+extern void rewinddir(DIR*);
+extern int dirfd(DIR*);
+extern int alphasort(const struct dirent**, const struct dirent**);
+extern int scandir(const char*, struct dirent***, int (*)(const struct dirent*), int (*)(const struct dirent**, const struct dirent**));
+extern int getdents(unsigned int, struct dirent*, unsigned int);
__END_DECLS
diff --git a/libc/include/elf.h b/libc/include/elf.h
index 285eb7d..3f2e4f2 100644
--- a/libc/include/elf.h
+++ b/libc/include/elf.h
@@ -30,6 +30,8 @@
#include <stdint.h>
#include <linux/auxvec.h>
+
+/* TODO: can we switch to <linux/elf.h> instead? http://b/12476126. */
#include <sys/exec_elf.h>
typedef struct {
@@ -52,4 +54,7 @@
# define Elf_auxv_t Elf32_auxv_t
#endif
+/* <sys/exec_elf.h> doesn't contain any NT_ constants. aarch64 strace needs this one. */
+#define NT_PRSTATUS 1
+
#endif /* _ELF_H */
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index f41cbcc..f6a89ef 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <linux/fadvise.h>
#include <linux/fcntl.h>
#include <unistd.h> /* this is not required, but makes client code much happier */
@@ -46,15 +47,19 @@
extern int fcntl(int fd, int command, ...);
extern int creat(const char* path, mode_t mode);
-#if defined(__BIONIC_FORTIFY) && !defined(__clang__)
+#if defined(__BIONIC_FORTIFY)
+
+extern int __open_2(const char*, int);
+extern int __open_real(const char*, int, ...) __asm__(__USER_LABEL_PREFIX__ "open");
+extern int __openat_2(int, const char*, int);
+extern int __openat_real(int, const char*, int, ...) __asm__(__USER_LABEL_PREFIX__ "openat");
__errordecl(__creat_missing_mode, "called with O_CREAT, but missing mode");
__errordecl(__creat_too_many_args, "too many arguments");
-extern int __open_real(const char *pathname, int flags, ...)
- __asm__(__USER_LABEL_PREFIX__ "open");
-extern int __open_2(const char *, int);
+
+#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
-int open(const char *pathname, int flags, ...) {
+int open(const char* pathname, int flags, ...) {
if (__builtin_constant_p(flags)) {
if ((flags & O_CREAT) && __builtin_va_arg_pack_len() == 0) {
__creat_missing_mode(); // compile time error
@@ -72,12 +77,8 @@
return __open_real(pathname, flags, __builtin_va_arg_pack());
}
-extern int __openat_2(int, const char *, int);
-extern int __openat_real(int dirfd, const char *pathname, int flags, ...)
- __asm__(__USER_LABEL_PREFIX__ "openat");
-
__BIONIC_FORTIFY_INLINE
-int openat(int dirfd, const char *pathname, int flags, ...) {
+int openat(int dirfd, const char* pathname, int flags, ...) {
if (__builtin_constant_p(flags)) {
if ((flags & O_CREAT) && __builtin_va_arg_pack_len() == 0) {
__creat_missing_mode(); // compile time error
@@ -95,7 +96,9 @@
return __openat_real(dirfd, pathname, flags, __builtin_va_arg_pack());
}
-#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */
+#endif /* !defined(__clang__) */
+
+#endif /* defined(__BIONIC_FORTIFY) */
__END_DECLS
diff --git a/libc/include/mntent.h b/libc/include/mntent.h
index 8b87f71..6cc0b18 100644
--- a/libc/include/mntent.h
+++ b/libc/include/mntent.h
@@ -30,7 +30,9 @@
#include <stdio.h>
#include <sys/cdefs.h>
+#include <paths.h> /* for _PATH_MOUNTED */
+#define MOUNTED _PATH_MOUNTED
#define MNTTYPE_IGNORE "ignore"
struct mntent
@@ -48,6 +50,8 @@
struct mntent* getmntent(FILE*);
+FILE* setmntent(const char*, const char*);
+int endmntent(FILE*);
__END_DECLS
diff --git a/libc/include/netinet/tcp.h b/libc/include/netinet/tcp.h
index bc52249..5601645 100644
--- a/libc/include/netinet/tcp.h
+++ b/libc/include/netinet/tcp.h
@@ -25,10 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _NETINET_TCP_H
#define _NETINET_TCP_H
-#include <endian.h> /* Include *before* linux/tcp.h */
#include <linux/tcp.h>
__BEGIN_DECLS
@@ -47,6 +47,21 @@
TCP_CLOSING
};
+#define TCPOPT_EOL 0
+#define TCPOPT_NOP 1
+#define TCPOPT_MAXSEG 2
+#define TCPOLEN_MAXSEG 4
+#define TCPOPT_WINDOW 3
+#define TCPOLEN_WINDOW 3
+#define TCPOPT_SACK_PERMITTED 4
+#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOPT_SACK 5
+#define TCPOPT_TIMESTAMP 8
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2)
+
+#define TCPOPT_TSTAMP_HDR (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
__END_DECLS
#endif /* _NETINET_TCP_H */
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 4d7d8c6..7649e83 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -31,54 +31,33 @@
#include <sys/cdefs.h>
#include <sys/time.h>
+#include <linux/sched.h>
+
__BEGIN_DECLS
-#define SCHED_NORMAL 0
-#define SCHED_OTHER 0
-#define SCHED_FIFO 1
-#define SCHED_RR 2
+/* This name is used by glibc, but not by the kernel. */
+#define SCHED_OTHER SCHED_NORMAL
struct sched_param {
- int sched_priority;
+ int __sched_priority;
};
+#define sched_priority __sched_priority
-extern int sched_setscheduler(pid_t, int, const struct sched_param *);
+extern int sched_setscheduler(pid_t, int, const struct sched_param*);
extern int sched_getscheduler(pid_t);
extern int sched_yield(void);
-extern int sched_get_priority_max(int policy);
-extern int sched_get_priority_min(int policy);
-extern int sched_setparam(pid_t, const struct sched_param *);
-extern int sched_getparam(pid_t, struct sched_param *);
-extern int sched_rr_get_interval(pid_t pid, struct timespec *tp);
-
-#define CLONE_VM 0x00000100
-#define CLONE_FS 0x00000200
-#define CLONE_FILES 0x00000400
-#define CLONE_SIGHAND 0x00000800
-#define CLONE_PTRACE 0x00002000
-#define CLONE_VFORK 0x00004000
-#define CLONE_PARENT 0x00008000
-#define CLONE_THREAD 0x00010000
-#define CLONE_NEWNS 0x00020000
-#define CLONE_SYSVSEM 0x00040000
-#define CLONE_SETTLS 0x00080000
-#define CLONE_PARENT_SETTID 0x00100000
-#define CLONE_CHILD_CLEARTID 0x00200000
-#define CLONE_DETACHED 0x00400000
-#define CLONE_UNTRACED 0x00800000
-#define CLONE_CHILD_SETTID 0x01000000
-#define CLONE_STOPPED 0x02000000
+extern int sched_get_priority_max(int);
+extern int sched_get_priority_min(int);
+extern int sched_setparam(pid_t, const struct sched_param*);
+extern int sched_getparam(pid_t, struct sched_param*);
+extern int sched_rr_get_interval(pid_t, struct timespec*);
#ifdef _GNU_SOURCE
-extern int clone(int (*fn)(void *), void *child_stack, int flags, void* arg, ...);
+
+extern int clone(int (*)(void*), void*, int, void*, ...);
extern int unshare(int);
-#endif
-
-/* Support for cpu thread affinity */
-#ifdef _GNU_SOURCE
-
extern int sched_getcpu(void);
-
+extern int setns(int, int);
/* Our implementation supports up to 32 independent CPUs, which is also
* the maximum supported by the kernel at the moment. GLibc uses 1024 by
diff --git a/libc/bionic/sched_getcpu.c b/libc/include/sgidefs.h
similarity index 81%
copy from libc/bionic/sched_getcpu.c
copy to libc/include/sgidefs.h
index 954df37..8b37bf0 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/include/sgidefs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE 1
-#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+#ifndef _SGIDEFS_H_
+#define _SGIDEFS_H_
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+#include <asm/sgidefs.h>
- return (int)cpu;
-}
+#endif /* _SGIDEFS_H_ */
diff --git a/libc/include/signal.h b/libc/include/signal.h
index e326ddb..0159bf2 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -44,9 +44,7 @@
#else
/* For 32-bit, we're stuck with the definitions we already shipped,
* even though they contain a sigset_t that's too small. */
-# define __ARCH_SI_UID_T __kernel_uid32_t /* TODO: 64-bit: remove this when we've switch 32-bit to uapi too. */
# include <linux/signal.h>
-# undef __ARCH_SI_UID_T
#endif
__BEGIN_DECLS
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 260a4e7..c241d94 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -495,16 +495,15 @@
}
#endif
-#if !defined(__clang__)
-extern char *__fgets_real(char *, int, FILE *)
- __asm__(__USER_LABEL_PREFIX__ "fgets");
+extern char* __fgets_chk(char*, int, FILE*, size_t);
+extern char* __fgets_real(char*, int, FILE*) __asm__(__USER_LABEL_PREFIX__ "fgets");
__errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
__errordecl(__fgets_too_small_error, "fgets called with size less than zero");
-extern char *__fgets_chk(char *, int, FILE *, size_t);
+
+#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
-char *fgets(char *dest, int size, FILE *stream)
-{
+char *fgets(char* dest, int size, FILE* stream) {
size_t bos = __bos(dest);
// Compiler can prove, at compile time, that the passed in size
diff --git a/libc/include/sys/_types.h b/libc/include/sys/_types.h
index 9a992ae..9d313d1 100644
--- a/libc/include/sys/_types.h
+++ b/libc/include/sys/_types.h
@@ -37,7 +37,6 @@
#include <machine/_types.h>
typedef unsigned long __cpuid_t; /* CPU id */
-typedef __int32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __id_t; /* may contain pid, uid or gid */
diff --git a/libc/include/sys/glibc-syscalls.h b/libc/include/sys/glibc-syscalls.h
index 0deb73a..3131b6b 100644
--- a/libc/include/sys/glibc-syscalls.h
+++ b/libc/include/sys/glibc-syscalls.h
@@ -375,6 +375,7 @@
#define SYS_fcntl64 __NR_fcntl64
#define SYS_fdatasync __NR_fdatasync
#define SYS_fgetxattr __NR_fgetxattr
+#define SYS_finit_module __NR_finit_module
#define SYS_flistxattr __NR_flistxattr
#define SYS_flock __NR_flock
#define SYS_fork __NR_fork
@@ -439,6 +440,7 @@
#define SYS_ioprio_get __NR_ioprio_get
#define SYS_ioprio_set __NR_ioprio_set
#define SYS_ipc __NR_ipc
+#define SYS_kcmp __NR_kcmp
#define SYS_kexec_load __NR_kexec_load
#define SYS_keyctl __NR_keyctl
#define SYS_kill __NR_kill
diff --git a/libc/bionic/sched_getcpu.c b/libc/include/sys/msg.h
similarity index 81%
copy from libc/bionic/sched_getcpu.c
copy to libc/include/sys/msg.h
index 954df37..1a6d30d 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/include/sys/msg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE 1
-#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+#ifndef _SYS_MSG_H_
+#define _SYS_MSG_H_
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+#include <linux/msg.h>
- return (int)cpu;
-}
+#endif /* _SYS_MSG_H_ */
diff --git a/libc/include/sys/dirent.h b/libc/include/sys/reg.h
similarity index 62%
rename from libc/include/sys/dirent.h
rename to libc/include/sys/reg.h
index da96f5e..b3d2aac 100644
--- a/libc/include/sys/dirent.h
+++ b/libc/include/sys/reg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,25 +25,60 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#ifndef _SYS_DIRENT_H_
-#define _SYS_DIRENT_H_
-#include <stdint.h>
-#include <sys/cdefs.h>
+#ifndef _SYS_REG_H_
+#define _SYS_REG_H_
-__BEGIN_DECLS
+#if defined(__i386__)
-/* this corresponds to the kernel dirent64 */
-struct dirent {
- uint64_t d_ino;
- int64_t d_off;
- unsigned short d_reclen;
- unsigned char d_type;
- char d_name[256];
-};
+#define EBX 0
+#define ECX 1
+#define EDX 2
+#define ESI 3
+#define EDI 4
+#define EBP 5
+#define EAX 6
+#define DS 7
+#define ES 8
+#define FS 9
+#define GS 10
+#define ORIG_EAX 11
+#define EIP 12
+#define CS 13
+#define EFL 14
+#define UESP 15
+#define SS 16
-extern int getdents(unsigned int, struct dirent *, unsigned int);
+#elif defined(__x86_64__)
-__END_DECLS
+#define R15 0
+#define R14 1
+#define R13 2
+#define R12 3
+#define RBP 4
+#define RBX 5
+#define R11 6
+#define R10 7
+#define R9 8
+#define R8 9
+#define RAX 10
+#define RCX 11
+#define RDX 12
+#define RSI 13
+#define RDI 14
+#define ORIG_RAX 15
+#define RIP 16
+#define CS 17
+#define EFLAGS 18
+#define RSP 19
+#define SS 20
+#define FS_BASE 21
+#define GS_BASE 22
+#define DS 23
+#define ES 24
+#define FS 25
+#define GS 26
-#endif /* _SYS_DIRENT_H_ */
+#endif
+
+#endif /* _SYS_REG_H_ */
diff --git a/libc/include/sys/resource.h b/libc/include/sys/resource.h
index ef325c7..a91fa53 100644
--- a/libc/include/sys/resource.h
+++ b/libc/include/sys/resource.h
@@ -25,30 +25,35 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _SYS_RESOURCE_H_
#define _SYS_RESOURCE_H_
#include <sys/cdefs.h>
-#include <sys/types.h> /* MUST be included before linux/resource.h */
+#include <sys/types.h>
-/* TRICK AHEAD: <linux/resource.h> defines a getrusage function with
- * a non-standard signature. this is surprising because the
- * syscall seems to use the standard one instead.
- * once again, creative macro usage saves the days
- */
-#define getrusage __kernel_getrusage
#include <linux/resource.h>
-#undef getrusage
-
-typedef unsigned long rlim_t;
__BEGIN_DECLS
+typedef unsigned long rlim_t;
+
+extern int getrlimit(int, struct rlimit*);
+extern int setrlimit(int, const struct rlimit*);
+
+extern int getrlimit64(int, struct rlimit64*);
+extern int setrlimit64(int, const struct rlimit64*);
+
extern int getpriority(int, int);
extern int setpriority(int, int, int);
-extern int getrlimit(int resource, struct rlimit *rlp);
-extern int setrlimit(int resource, const struct rlimit *rlp);
-extern int getrusage(int who, struct rusage* r_usage);
+
+extern int getrusage(int, struct rusage*);
+
+#if __LP64__
+/* Implementing prlimit for 32-bit isn't worth the effort. */
+extern int prlimit(pid_t, int, const struct rlimit*, struct rlimit*);
+#endif
+extern int prlimit64(pid_t, int, const struct rlimit64*, struct rlimit64*);
__END_DECLS
diff --git a/libc/bionic/sched_getcpu.c b/libc/include/sys/sem.h
similarity index 81%
copy from libc/bionic/sched_getcpu.c
copy to libc/include/sys/sem.h
index 954df37..a1ecd1f 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/include/sys/sem.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE 1
-#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+#ifndef _SYS_SEM_H_
+#define _SYS_SEM_H_
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+#include <linux/sem.h>
- return (int)cpu;
-}
+#endif /* _SYS_SEM_H_ */
diff --git a/libc/bionic/sched_getcpu.c b/libc/include/sys/shm.h
similarity index 81%
copy from libc/bionic/sched_getcpu.c
copy to libc/include/sys/shm.h
index 954df37..c691c29 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/include/sys/shm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE 1
-#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+#ifndef _SYS_SHM_H_
+#define _SYS_SHM_H_
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+#include <linux/shm.h>
- return (int)cpu;
-}
+#endif /* _SYS_SHM_H_ */
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index ece44c6..3d754c0 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -37,94 +37,93 @@
__BEGIN_DECLS
-/* really matches stat64 in the kernel, hence the padding
- * Note: The kernel zero's the padded region because glibc might read them
- * in the hope that the kernel has stretched to using larger sizes.
- */
-#ifdef __mips__
+#if defined(__aarch64__)
struct stat {
- unsigned long st_dev;
- unsigned long __pad0[3];
-
- unsigned long long st_ino;
-
- unsigned int st_mode;
- unsigned int st_nlink;
-
- unsigned long st_uid;
- unsigned long st_gid;
-
- unsigned long st_rdev;
- unsigned long __pad1[3];
-
- long long st_size;
-
- unsigned long st_atime;
- unsigned long st_atime_nsec;
-
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
-
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
-
- unsigned long st_blksize;
- unsigned long __pad2;
-
- unsigned long long st_blocks;
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned long st_rdev;
+ unsigned long __pad1;
+ long st_size;
+ int st_blksize;
+ int __pad2;
+ long st_blocks;
+ long st_atime;
+ unsigned long st_atime_nsec;
+ long st_mtime;
+ unsigned long st_mtime_nsec;
+ long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned int __unused4;
+ unsigned int __unused5;
};
-
-#elif __x86_64__
+#elif defined(__mips__)
struct stat {
- unsigned long st_dev;
- unsigned long st_ino;
- unsigned long st_nlink;
- unsigned int st_mode;
- unsigned int st_uid;
- unsigned int st_gid;
- unsigned int __pad0;
- unsigned long st_rdev;
- long st_size;
- long st_blksize;
- long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
- long __pad3[3];
+ unsigned long st_dev;
+ unsigned long __pad0[3];
+ unsigned long long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned long st_uid;
+ unsigned long st_gid;
+ unsigned long st_rdev;
+ unsigned long __pad1[3];
+ long long st_size;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned long st_blksize;
+ unsigned long __pad2;
+ unsigned long long st_blocks;
};
-
+#elif defined(__x86_64__)
+struct stat {
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned long st_nlink;
+ unsigned int st_mode;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int __pad0;
+ unsigned long st_rdev;
+ long st_size;
+ long st_blksize;
+ long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ long __pad3[3];
+};
#else
struct stat {
- unsigned long long st_dev;
- unsigned char __pad0[4];
-
- unsigned long __st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
-
- unsigned long st_uid;
- unsigned long st_gid;
-
- unsigned long long st_rdev;
- unsigned char __pad3[4];
-
- long long st_size;
- unsigned long st_blksize;
- unsigned long long st_blocks;
-
- unsigned long st_atime;
- unsigned long st_atime_nsec;
-
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
-
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
-
- unsigned long long st_ino;
+ unsigned long long st_dev;
+ unsigned char __pad0[4];
+ unsigned long __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned long st_uid;
+ unsigned long st_gid;
+ unsigned long long st_rdev;
+ unsigned char __pad3[4];
+ long long st_size;
+ unsigned long st_blksize;
+ unsigned long long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned long long st_ino;
};
#endif
diff --git a/libc/include/sys/swap.h b/libc/include/sys/swap.h
index 97a6f36..e4c1819 100644
--- a/libc/include/sys/swap.h
+++ b/libc/include/sys/swap.h
@@ -33,6 +33,11 @@
__BEGIN_DECLS
+#define SWAP_FLAG_DISCARD 0x10000
+#define SWAP_FLAG_PREFER 0x8000
+#define SWAP_FLAG_PRIO_MASK 0x7fff
+#define SWAP_FLAG_PRIO_SHIFT 0
+
extern int swapon(const char*, int) __nonnull((1));
extern int swapoff(const char*) __nonnull((1));
diff --git a/libc/bionic/sched_getcpu.c b/libc/include/sys/timex.h
similarity index 81%
copy from libc/bionic/sched_getcpu.c
copy to libc/include/sys/timex.h
index 954df37..4096e7d 100644
--- a/libc/bionic/sched_getcpu.c
+++ b/libc/include/sys/timex.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE 1
-#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
+#ifndef _SYS_TIMEX_H_
+#define _SYS_TIMEX_H_
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+#include <linux/timex.h>
- return (int)cpu;
-}
+#endif /* _SYS_TIMEX_H_ */
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index e0b6550..f8ae813 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -47,10 +47,8 @@
typedef __kernel_clock_t clock_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_daddr_t daddr_t;
-typedef uint32_t dev_t;
typedef unsigned long fsblkcnt_t;
typedef unsigned long fsfilcnt_t;
-typedef uint32_t id_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_key_t key_t;
typedef __kernel_mode_t mode_t;
@@ -60,6 +58,13 @@
typedef __kernel_timer_t timer_t;
typedef unsigned int useconds_t;
+#if !defined(__LP64__)
+/* This historical accident means that we had a 32-bit dev_t on 32-bit architectures. */
+typedef uint32_t dev_t;
+#else
+typedef uint64_t dev_t;
+#endif
+
/* This historical accident means that we had a 32-bit time_t on 32-bit architectures. */
typedef __kernel_time_t time_t;
@@ -71,6 +76,9 @@
typedef __kernel_loff_t loff_t;
typedef loff_t off64_t;
+/* This one really is meant to be just 32 bits! */
+typedef uint32_t id_t;
+
/* while POSIX wants these in <sys/types.h>, we
* declare then in <pthread.h> instead */
#if 0
diff --git a/libc/include/sys/user.h b/libc/include/sys/user.h
index 1a25ac1..9f11a83 100644
--- a/libc/include/sys/user.h
+++ b/libc/include/sys/user.h
@@ -61,23 +61,23 @@
long padding[56];
};
struct user_regs_struct {
- unsigned long bx;
- unsigned long cx;
- unsigned long dx;
- unsigned long si;
- unsigned long di;
- unsigned long bp;
- unsigned long ax;
- unsigned long ds;
- unsigned long es;
- unsigned long fs;
- unsigned long gs;
- unsigned long orig_ax;
- unsigned long ip;
- unsigned long cs;
- unsigned long flags;
- unsigned long sp;
- unsigned long ss;
+ long ebx;
+ long ecx;
+ long edx;
+ long esi;
+ long edi;
+ long ebp;
+ long eax;
+ long xds;
+ long xes;
+ long xfs;
+ long xgs;
+ long orig_eax;
+ long eip;
+ long xcs;
+ long eflags;
+ long esp;
+ long xss;
};
struct user {
struct user_regs_struct regs;
@@ -117,22 +117,22 @@
unsigned long r14;
unsigned long r13;
unsigned long r12;
- unsigned long bp;
- unsigned long bx;
+ unsigned long rbp;
+ unsigned long rbx;
unsigned long r11;
unsigned long r10;
unsigned long r9;
unsigned long r8;
- unsigned long ax;
- unsigned long cx;
- unsigned long dx;
- unsigned long si;
- unsigned long di;
- unsigned long orig_ax;
- unsigned long ip;
+ unsigned long rax;
+ unsigned long rcx;
+ unsigned long rdx;
+ unsigned long rsi;
+ unsigned long rdi;
+ unsigned long orig_rax;
+ unsigned long rip;
unsigned long cs;
- unsigned long flags;
- unsigned long sp;
+ unsigned long eflags;
+ unsigned long rsp;
unsigned long ss;
unsigned long fs_base;
unsigned long gs_base;
diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h
index 79995bb..10fe502 100644
--- a/libc/include/sys/vfs.h
+++ b/libc/include/sys/vfs.h
@@ -36,6 +36,7 @@
/* The kernel's __kernel_fsid_t has a 'val' member but glibc uses '__val'. */
typedef struct { int __val[2]; } __fsid_t;
+typedef __fsid_t fsid_t;
#if defined(__LP64__)
struct statfs {
@@ -46,7 +47,7 @@
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
- __fsid_t f_fsid;
+ fsid_t f_fsid;
uint64_t f_namelen;
uint64_t f_frsize;
uint64_t f_flags;
@@ -64,7 +65,7 @@
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_bavail;
- __fsid_t f_fsid;
+ fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_flags;
uint32_t f_spare[5];
@@ -79,7 +80,7 @@
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
- __fsid_t f_fsid;
+ fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_frsize;
uint32_t f_flags;
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index e6ce65c..803ff29 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -29,7 +29,10 @@
#ifndef _PRIVATE_BIONIC_ASM_H_
#define _PRIVATE_BIONIC_ASM_H_
+#if !defined(__mips__)
+/* <machine/asm.h> causes trouble on mips by including regdefs.h. */
#include <machine/asm.h>
+#endif
#include <asm/unistd.h> /* For system call numbers. */
#define MAX_ERRNO 4095 /* For recognizing system call error returns. */
diff --git a/libc/private/bionic_atomic_aarch64.h b/libc/private/bionic_atomic_aarch64.h
index 6ed1700..c3a34e1 100644
--- a/libc/private/bionic_atomic_aarch64.h
+++ b/libc/private/bionic_atomic_aarch64.h
@@ -17,7 +17,7 @@
#define BIONIC_ATOMIC_AARCH64_H
/* For ARMv8, we can use the 'dmb' instruction directly */
-__ATOMIC_INLINE__ void __bionic_memory_barrier(void) {
+__ATOMIC_INLINE__ void __bionic_memory_barrier() {
__asm__ __volatile__ ( "dmb ish" : : : "memory" );
}
diff --git a/libc/private/bionic_atomic_arm.h b/libc/private/bionic_atomic_arm.h
index 023d662..2156e6a 100644
--- a/libc/private/bionic_atomic_arm.h
+++ b/libc/private/bionic_atomic_arm.h
@@ -16,9 +16,9 @@
#ifndef BIONIC_ATOMIC_ARM_H
#define BIONIC_ATOMIC_ARM_H
-__ATOMIC_INLINE__ void __bionic_memory_barrier(void) {
+__ATOMIC_INLINE__ void __bionic_memory_barrier() {
#if defined(ANDROID_SMP) && ANDROID_SMP == 1
- __asm__ __volatile__ ( "dmb" : : : "memory" );
+ __asm__ __volatile__ ( "dmb ish" : : : "memory" );
#else
/* A simple compiler barrier. */
__asm__ __volatile__ ( "" : : : "memory" );
diff --git a/libc/private/bionic_atomic_gcc_builtin.h b/libc/private/bionic_atomic_gcc_builtin.h
index 9e5e5aa..70eb861 100644
--- a/libc/private/bionic_atomic_gcc_builtin.h
+++ b/libc/private/bionic_atomic_gcc_builtin.h
@@ -25,7 +25,7 @@
* the architecture-specific assembler versions.
*/
-__ATOMIC_INLINE__ void __bionic_memory_barrier(void) {
+__ATOMIC_INLINE__ void __bionic_memory_barrier() {
__sync_synchronize();
}
diff --git a/libc/private/bionic_atomic_inline.h b/libc/private/bionic_atomic_inline.h
index 2bb1128..c887e5a 100644
--- a/libc/private/bionic_atomic_inline.h
+++ b/libc/private/bionic_atomic_inline.h
@@ -25,7 +25,7 @@
*
* Macros defined in this header:
*
- * void ANDROID_MEMBAR_FULL(void)
+ * void ANDROID_MEMBAR_FULL()
* Full memory barrier. Provides a compiler reordering barrier, and
* on SMP systems emits an appropriate instruction.
*/
diff --git a/libc/private/bionic_futex.h b/libc/private/bionic_futex.h
index 5602af7..bfc3520 100644
--- a/libc/private/bionic_futex.h
+++ b/libc/private/bionic_futex.h
@@ -28,7 +28,6 @@
#ifndef _BIONIC_FUTEX_H
#define _BIONIC_FUTEX_H
-#include <linux/compiler.h> /* needed for __user in non-uapi futex.h */
#include <linux/futex.h>
#include <sys/cdefs.h>
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index ef201c3..7b1afbb 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -147,7 +147,7 @@
# x86 assembler templates for each syscall stub
#
-x86_registers = [ "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" ]
+x86_registers = [ "ebx", "ecx", "edx", "esi", "edi", "ebp" ]
x86_call = """\
movl $%(__NR_name)s, %%eax
@@ -289,20 +289,26 @@
def x86_genstub(syscall):
result = syscall_stub_header % syscall
- stack_bias = 4
numparams = count_generic_param_registers(syscall["params"])
- for r in range(numparams):
- result += " pushl " + x86_registers[r] + "\n"
- stack_bias += 4
+ stack_bias = numparams*4 + 4
+ offset = 0
+ mov_result = ""
+ cfi_result = " .cfi_def_cfa_offset %d\n" % (numparams*4)
+ for register in x86_registers[:numparams]:
+ result += " pushl %%%s\n" % register
+ mov_result += " mov %d(%%esp), %%%s\n" % (stack_bias+offset, register)
+ cfi_result += " .cfi_rel_offset %s, %d\n" % (register, offset)
+ offset += 4
- for r in range(numparams):
- result += " mov %d(%%esp), %s" % (stack_bias+r*4, x86_registers[r]) + "\n"
+ if numparams:
+ result += cfi_result
+ result += mov_result
result += x86_call % syscall
- for r in range(numparams):
- result += " popl " + x86_registers[numparams-r-1] + "\n"
+ for register in reversed(x86_registers[:numparams]):
+ result += " popl %%%s\n" % register
result += x86_return % syscall
return result
@@ -315,27 +321,28 @@
# from the original function called (socket())
result = syscall_stub_header % syscall
- stack_bias = 4
# save the regs we need
- result += " pushl %ebx" + "\n"
- stack_bias += 4
- result += " pushl %ecx" + "\n"
- stack_bias += 4
+ result += " pushl %ebx\n"
+ result += " pushl %ecx\n"
+ result += " .cfi_def_cfa_offset 8\n"
+ result += " .cfi_rel_offset ebx, 0\n"
+ result += " .cfi_rel_offset ecx, 4\n"
+ stack_bias = 12
# set the call id (%ebx)
- result += " mov $%d, %%ebx" % syscall["socketcall_id"] + "\n"
+ result += " mov $%d, %%ebx\n" % syscall["socketcall_id"]
# set the pointer to the rest of the args into %ecx
- result += " mov %esp, %ecx" + "\n"
- result += " addl $%d, %%ecx" % (stack_bias) + "\n"
+ result += " mov %esp, %ecx\n"
+ result += " addl $%d, %%ecx\n" % (stack_bias)
# now do the syscall code itself
result += x86_call % syscall
# now restore the saved regs
- result += " popl %ecx" + "\n"
- result += " popl %ebx" + "\n"
+ result += " popl %ecx\n"
+ result += " popl %ebx\n"
# epilog
result += x86_return % syscall
@@ -416,7 +423,7 @@
glibc_fp.write("#if defined(__aarch64__)\n")
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-generic/unistd.h")
glibc_fp.write("#elif defined(__arm__)\n")
- self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-arm/asm/unistd.h")
+ self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-arm/asm/unistd.h")
glibc_fp.write("#elif defined(__mips__)\n")
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-mips/asm/unistd.h")
glibc_fp.write("#elif defined(__i386__)\n")
diff --git a/libc/zoneinfo/tzdata b/libc/zoneinfo/tzdata
index 8f32236..6acddb7 100644
--- a/libc/zoneinfo/tzdata
+++ b/libc/zoneinfo/tzdata
Binary files differ
diff --git a/libm/Android.mk b/libm/Android.mk
index abe0722..1c3d393 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -177,7 +177,9 @@
upstream-freebsd/lib/msun/src/w_drem.c \
upstream-freebsd/lib/msun/src/w_dremf.c \
-libm_common_src_files += fake_long_double.c
+libm_common_src_files += \
+ fake_long_double.c \
+ upstream-freebsd/lib/msun/src/s_modfl.c \
# TODO: on Android, "long double" is "double".
# upstream-freebsd/lib/msun/src/e_acosl.c \
@@ -204,7 +206,6 @@
# upstream-freebsd/lib/msun/src/s_logbl.c \
# upstream-freebsd/lib/msun/src/s_lrintl.c \
# upstream-freebsd/lib/msun/src/s_lroundl.c \
-# upstream-freebsd/lib/msun/src/s_modfl.c \
# upstream-freebsd/lib/msun/src/s_nextafterl.c \
# upstream-freebsd/lib/msun/src/s_nexttoward.c \
# upstream-freebsd/lib/msun/src/s_remquol.c \
diff --git a/libm/NOTICE b/libm/NOTICE
index d6d0ad9..709563c 100644
--- a/libm/NOTICE
+++ b/libm/NOTICE
@@ -78,6 +78,32 @@
-------------------------------------------------------------------
+Copyright (C) 2010 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -463,6 +489,32 @@
-------------------------------------------------------------------
+Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
All rights reserved.
@@ -784,32 +836,6 @@
-------------------------------------------------------------------
-Copyright (c) 2010 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2011 David Schultz
All rights reserved.
diff --git a/libm/fake_long_double.c b/libm/fake_long_double.c
index 2a3e420..756e35b 100644
--- a/libm/fake_long_double.c
+++ b/libm/fake_long_double.c
@@ -31,7 +31,7 @@
int __fpclassifyl(long double a1) { return __fpclassifyd(a1); }
int __isfinitel(long double a1) { return __isfinite(a1); }
int __isinfl(long double a1) { return __isinf(a1); }
-int __isnanl(long double a1) { return isnan(a1); }
+int __isnanl(long double a1) { return (isnan)(a1); }
int __isnormall(long double a1) { return __isnormal(a1); }
int __signbitl(long double a1) { return __signbit(a1); }
@@ -72,7 +72,6 @@
long lrintl(long double a1) { return lrint(a1); }
long long llroundl(long double a1) { return llround(a1); }
long lroundl(long double a1) { return lround(a1); }
-long double modfl(long double a1, long double* a2) { return modf(a1, (double*) a2); }
long double nanl(const char* a1) { return nan(a1); }
long double nextafterl(long double a1, long double a2) { return nextafter(a1, a2); }
long double powl(long double a1, long double a2) { return pow(a1, a2); }
diff --git a/libm/sincos.c b/libm/sincos.c
index 891aa31..ad75549 100644
--- a/libm/sincos.c
+++ b/libm/sincos.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/linker/Android.mk b/linker/Android.mk
index 1bf3e9d..bdc54de 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -16,7 +16,10 @@
linker_phdr.cpp \
rt.cpp \
-LOCAL_LDFLAGS := -shared -Wl,--exclude-libs,ALL
+LOCAL_LDFLAGS := \
+ -shared \
+ -Wl,-Bsymbolic \
+ -Wl,--exclude-libs,ALL \
LOCAL_CFLAGS += \
-fno-stack-protector \
diff --git a/linker/NOTICE b/linker/NOTICE
index 6ab34a1..c3d6cf6 100644
--- a/linker/NOTICE
+++ b/linker/NOTICE
@@ -154,3 +154,31 @@
-------------------------------------------------------------------
+Copyright (C) 2013 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 81ca2f5..f4e426d 100755
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2212,6 +2212,7 @@
soinfo linker_so;
memset(&linker_so, 0, sizeof(soinfo));
+ strcpy(linker_so.name, "[dynamic linker]");
linker_so.base = linker_addr;
linker_so.size = phdr_table_get_load_size(phdr, elf_hdr->e_phnum);
linker_so.load_bias = get_elf_exec_load_bias(elf_hdr);
@@ -2223,11 +2224,13 @@
if (!soinfo_link_image(&linker_so)) {
// It would be nice to print an error message, but if the linker
// can't link itself, there's no guarantee that we'll be able to
- // call write() (because it involves a GOT reference).
- //
- // This situation should never occur unless the linker itself
- // is corrupt.
- exit(EXIT_FAILURE);
+ // call write() (because it involves a GOT reference). We may as
+ // well try though...
+ const char* msg = "CANNOT LINK EXECUTABLE: ";
+ write(2, msg, strlen(msg));
+ write(2, __linker_dl_err_buf, strlen(__linker_dl_err_buf));
+ write(2, "\n", 1);
+ _exit(EXIT_FAILURE);
}
// We have successfully fixed our own relocations. It's safe to run
diff --git a/linker/linker.h b/linker/linker.h
index 647c36a..9afd9e1 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -29,12 +29,9 @@
#ifndef _LINKER_H_
#define _LINKER_H_
-#include <unistd.h>
-#include <sys/types.h>
#include <elf.h>
-#include <sys/exec_elf.h>
-
#include <link.h>
+#include <unistd.h>
#include "private/libc_logging.h"
diff --git a/tests/Android.mk b/tests/Android.mk
index 0a4db91..0540400 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -61,11 +61,13 @@
strings_test.cpp \
stubs_test.cpp \
sys_epoll_test.cpp \
+ sys_resource_test.cpp \
sys_select_test.cpp \
sys_sendfile_test.cpp \
sys_stat_test.cpp \
sys_syscall_test.cpp \
sys_time_test.cpp \
+ sys_types_test.cpp \
system_properties_test.cpp \
time_test.cpp \
unistd_test.cpp \
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index e7a952a..bcef566 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -251,7 +251,7 @@
// Check that our hand-written clone assembler sets errno correctly on failure.
uintptr_t fake_child_stack[16];
errno = 0;
- ASSERT_EQ(-1, __bionic_clone(CLONE_THREAD, &fake_child_stack[0], NULL, NULL, NULL, NULL, NULL));
+ ASSERT_EQ(-1, __bionic_clone(CLONE_THREAD, &fake_child_stack[16], NULL, NULL, NULL, NULL, NULL));
ASSERT_EQ(EINVAL, errno);
}
#endif
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 2002928..bd3c548 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -85,6 +85,7 @@
TEST(stdio, getdelim_invalid) {
FILE* fp = tmpfile();
+ ASSERT_TRUE(fp != NULL);
char* buffer = NULL;
size_t buffer_length = 0;
@@ -153,6 +154,7 @@
TEST(stdio, getline_invalid) {
FILE* fp = tmpfile();
+ ASSERT_TRUE(fp != NULL);
char* buffer = NULL;
size_t buffer_length = 0;
diff --git a/tests/sys_resource_test.cpp b/tests/sys_resource_test.cpp
new file mode 100644
index 0000000..bd974cb
--- /dev/null
+++ b/tests/sys_resource_test.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <sys/resource.h>
+
+#if __GLIBC__
+/* The host glibc we're currently building with doesn't have prlimit64 yet. */
+static int prlimit64(pid_t, int resource, const struct rlimit64* new_limit, struct rlimit64* old_limit) {
+ if (new_limit != NULL) {
+ return setrlimit64(resource, new_limit);
+ } else {
+ return getrlimit64(resource, old_limit);
+ }
+}
+#endif
+
+TEST(sys_resource, smoke) {
+#if __LP64__ || __GLIBC__
+ ASSERT_EQ(sizeof(rlimit), sizeof(rlimit64));
+ ASSERT_EQ(8U, sizeof(rlim_t));
+#else
+ ASSERT_NE(sizeof(rlimit), sizeof(rlimit64));
+ ASSERT_EQ(4U, sizeof(rlim_t));
+#endif
+
+ // Read with getrlimit, getrlimit64, and prlimit64.
+ // (prlimit is prlimit64 on LP64 and unimplemented on 32-bit.)
+ rlimit l32;
+ rlimit64 l64;
+ rlimit64 pr_l64;
+ ASSERT_EQ(0, getrlimit(RLIMIT_CORE, &l32));
+ ASSERT_EQ(0, getrlimit64(RLIMIT_CORE, &l64));
+ ASSERT_EQ(0, prlimit64(0, RLIMIT_CORE, NULL, &pr_l64));
+ ASSERT_EQ(l64.rlim_cur, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, pr_l64.rlim_cur);
+ ASSERT_EQ(l64.rlim_max, pr_l64.rlim_max);
+ if (l64.rlim_max == RLIM64_INFINITY) {
+ ASSERT_EQ(RLIM_INFINITY, l32.rlim_max);
+ } else {
+ ASSERT_EQ(l64.rlim_max, l32.rlim_max);
+ }
+
+ // Write with setrlimit and read back with everything.
+ l32.rlim_cur = 123;
+ ASSERT_EQ(0, setrlimit(RLIMIT_CORE, &l32));
+ ASSERT_EQ(0, getrlimit(RLIMIT_CORE, &l32));
+ ASSERT_EQ(0, getrlimit64(RLIMIT_CORE, &l64));
+ ASSERT_EQ(0, prlimit64(0, RLIMIT_CORE, NULL, &pr_l64));
+ ASSERT_EQ(123U, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, pr_l64.rlim_cur);
+
+ // Write with setrlimit64 and read back with everything.
+ l64.rlim_cur = 456;
+ ASSERT_EQ(0, setrlimit64(RLIMIT_CORE, &l64));
+ ASSERT_EQ(0, getrlimit(RLIMIT_CORE, &l32));
+ ASSERT_EQ(0, getrlimit64(RLIMIT_CORE, &l64));
+ ASSERT_EQ(0, prlimit64(0, RLIMIT_CORE, NULL, &pr_l64));
+ ASSERT_EQ(456U, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, pr_l64.rlim_cur);
+
+ // Write with prlimit64 and read back with everything.
+ l64.rlim_cur = 789;
+ ASSERT_EQ(0, prlimit64(0, RLIMIT_CORE, &l64, NULL));
+ ASSERT_EQ(0, getrlimit(RLIMIT_CORE, &l32));
+ ASSERT_EQ(0, getrlimit64(RLIMIT_CORE, &l64));
+ ASSERT_EQ(0, prlimit64(0, RLIMIT_CORE, NULL, &pr_l64));
+ ASSERT_EQ(789U, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, l32.rlim_cur);
+ ASSERT_EQ(l64.rlim_cur, pr_l64.rlim_cur);
+}
diff --git a/tests/sys_types_test.cpp b/tests/sys_types_test.cpp
new file mode 100644
index 0000000..0793be2
--- /dev/null
+++ b/tests/sys_types_test.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <sys/types.h>
+
+TEST(sys_types, type_sizes) {
+ // gids, pids, and uids should be 32-bit on all systems.
+ ASSERT_EQ(4U, sizeof(gid_t));
+ ASSERT_EQ(4U, sizeof(pid_t));
+ ASSERT_EQ(4U, sizeof(uid_t));
+ // id_t is the 'generic'.
+ ASSERT_EQ(4U, sizeof(id_t));
+
+ // Some types were too small on 32-bit Android by mistake,
+ // but are correct on 64-bit Android.
+#if defined(__LP64__)
+ ASSERT_EQ(8U, sizeof(dev_t));
+ ASSERT_EQ(8U, sizeof(off_t));
+ ASSERT_EQ(8U, sizeof(time_t));
+#else
+ ASSERT_EQ(4U, sizeof(dev_t));
+ ASSERT_EQ(4U, sizeof(off_t));
+ ASSERT_EQ(4U, sizeof(time_t));
+#endif
+ // These were right even on 32-bit Android.
+ ASSERT_EQ(8U, sizeof(loff_t));
+ ASSERT_EQ(8U, sizeof(off64_t));
+}