diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index c5dc4029c..1277b1a6f 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -57,10 +57,9 @@ int setresuid:setresuid(uid_t, uid_t, uid_t) aarch64,mips,x86_64 int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86 int setresgid:setresgid(gid_t, gid_t, gid_t) aarch64,mips,x86_64 void* __brk:brk(void*) all -# See comments in kill.S to understand why we don't generate ARM stubs for kill/tkill/tgkill. -int kill(pid_t, int) aarch64,mips,x86,x86_64 -int tkill(pid_t tid, int sig) aarch64,mips,x86,x86_64 -int tgkill(pid_t tgid, pid_t tid, int sig) aarch64,mips,x86,x86_64 +int kill(pid_t, int) all +int tkill(pid_t tid, int sig) all +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 diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk index 0717306ce..95c3b610d 100644 --- a/libc/arch-arm/arm.mk +++ b/libc/arch-arm/arm.mk @@ -6,7 +6,6 @@ _LIBC_ARCH_COMMON_SRC_FILES := \ arch-arm/bionic/_exit_with_stack_teardown.S \ arch-arm/bionic/futex_arm.S \ arch-arm/bionic/__get_sp.S \ - arch-arm/bionic/kill.S \ arch-arm/bionic/libgcc_compat.c \ arch-arm/bionic/memcmp16.S \ arch-arm/bionic/memcmp.S \ @@ -14,8 +13,6 @@ _LIBC_ARCH_COMMON_SRC_FILES := \ arch-arm/bionic/setjmp.S \ arch-arm/bionic/sigsetjmp.S \ arch-arm/bionic/syscall.S \ - arch-arm/bionic/tgkill.S \ - arch-arm/bionic/tkill.S \ # These are used by the static and dynamic versions of the libc # respectively. diff --git a/libc/arch-arm/bionic/__bionic_clone.S b/libc/arch-arm/bionic/__bionic_clone.S index 0782abefb..7b76f5e9f 100644 --- a/libc/arch-arm/bionic/__bionic_clone.S +++ b/libc/arch-arm/bionic/__bionic_clone.S @@ -31,10 +31,13 @@ // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg); ENTRY(__bionic_clone) mov ip, sp - .save {r4, r5, r6, r7} - # save registers to parent stack stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 # load extra parameters ldmfd ip, {r4, r5, r6} @@ -51,12 +54,19 @@ ENTRY(__bionic_clone) # In the parent, reload saved registers then either return or set errno. ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 b __set_errno 1: # The child. + # Re-add the unwind directives that were reset from above. + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldr r0, [sp, #-4] ldr r1, [sp, #-8] b __bionic_clone_entry diff --git a/libc/arch-arm/bionic/abort_arm.S b/libc/arch-arm/bionic/abort_arm.S index e1ab86b6e..1aaf21ad8 100644 --- a/libc/arch-arm/bionic/abort_arm.S +++ b/libc/arch-arm/bionic/abort_arm.S @@ -36,7 +36,9 @@ * sequence when the crash happens. */ ENTRY(abort) - .save {r3, r14} stmfd sp!, {r3, r14} + .cfi_def_cfa_offset 8 + .cfi_rel_offset r3, 0 + .cfi_rel_offset r14, 4 bl PIC_SYM(_C_LABEL(__libc_android_abort), PLT) END(abort) diff --git a/libc/arch-arm/bionic/kill.S b/libc/arch-arm/bionic/kill.S deleted file mode 100644 index 0d24a3fb3..000000000 --- a/libc/arch-arm/bionic/kill.S +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - -/* unlike our auto-generated syscall stubs, this code saves lr - on the stack, as well as a few other registers. this makes - our stack unwinder happy, when we generate debug stack - traces after the C library or other parts of the system - abort due to a fatal runtime error (e.g. detection - of a corrupted malloc heap). -*/ - -ENTRY(kill) - stmfd sp!, {r4-r7, ip, lr} - ldr r7, =__NR_kill - swi #0 - ldmfd sp!, {r4-r7, ip, lr} - cmn r0, #(MAX_ERRNO + 1) - bxls lr - neg r0, r0 - b __set_errno -END(kill) diff --git a/libc/arch-arm/bionic/memcmp.S b/libc/arch-arm/bionic/memcmp.S index 7fb428391..0dc3af0ca 100644 --- a/libc/arch-arm/bionic/memcmp.S +++ b/libc/arch-arm/bionic/memcmp.S @@ -107,9 +107,11 @@ ENTRY(memcmp) bmi 10f #endif - .save {r4, lr} /* save registers */ stmfd sp!, {r4, lr} + .cfi_def_cfa_offset 8 + .cfi_rel_offset r4, 0 + .cfi_rel_offset lr, 4 /* since r0 hold the result, move the first source * pointer somewhere else diff --git a/libc/arch-arm/bionic/memcmp16.S b/libc/arch-arm/bionic/memcmp16.S index 99c9b8842..825c94f15 100644 --- a/libc/arch-arm/bionic/memcmp16.S +++ b/libc/arch-arm/bionic/memcmp16.S @@ -74,9 +74,11 @@ ENTRY(__memcmp16) bx lr - .save {r4, lr} /* save registers */ 0: stmfd sp!, {r4, lr} + .cfi_def_cfa_offset 8 + .cfi_rel_offset r4, 0 + .cfi_rel_offset lr, 4 /* align first pointer to word boundary */ tst r3, #2 diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S index 996e55e00..65b93fdec 100644 --- a/libc/arch-arm/bionic/setjmp.S +++ b/libc/arch-arm/bionic/setjmp.S @@ -51,12 +51,16 @@ ENTRY(setjmp) /* Block all signals and retrieve the old signal mask */ stmfd sp!, {r0, r14} + .cfi_def_cfa_offset 8 + .cfi_rel_offset r0, 0 + .cfi_rel_offset r14, 4 mov r0, #0x00000000 bl PIC_SYM(_C_LABEL(sigblock), PLT) mov r1, r0 ldmfd sp!, {r0, r14} + .cfi_def_cfa_offset 0 /* Store signal mask */ str r1, [r0, #(_JB_SIGMASK * 4)] @@ -96,13 +100,20 @@ ENTRY(longjmp) /* Set signal mask */ stmfd sp!, {r0, r1, r14} + .cfi_def_cfa_offset 12 + .cfi_rel_offset r0, 0 + .cfi_rel_offset r1, 4 + .cfi_rel_offset r14, 8 sub sp, sp, #4 /* align the stack */ + .cfi_adjust_cfa_offset 4 mov r0, r2 bl PIC_SYM(_C_LABEL(sigsetmask), PLT) add sp, sp, #4 /* unalign the stack */ + .cfi_adjust_cfa_offset -4 ldmfd sp!, {r0, r1, r14} + .cfi_def_cfa_offset 0 #ifdef __ARM_HAVE_VFP /* Restore floating-point registers */ diff --git a/libc/arch-arm/bionic/syscall.S b/libc/arch-arm/bionic/syscall.S index a622b58b0..864771841 100644 --- a/libc/arch-arm/bionic/syscall.S +++ b/libc/arch-arm/bionic/syscall.S @@ -31,6 +31,11 @@ ENTRY(syscall) mov ip, sp stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 mov r7, r0 mov r0, r1 mov r1, r2 @@ -38,6 +43,7 @@ ENTRY(syscall) ldmfd ip, {r3, r4, r5, r6} swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/bionic/tgkill.S b/libc/arch-arm/bionic/tgkill.S deleted file mode 100644 index 4ef2abc02..000000000 --- a/libc/arch-arm/bionic/tgkill.S +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - -/* unlike our auto-generated syscall stubs, this code saves lr - on the stack, as well as a few other registers. this makes - our stack unwinder happy, when we generate debug stack - traces after the C library or other parts of the system - abort due to a fatal runtime error (e.g. detection - of a corrupted malloc heap). -*/ - -ENTRY(tgkill) - .save {r4-r7, ip, lr} - stmfd sp!, {r4-r7, ip, lr} - ldr r7, =__NR_tgkill - swi #0 - ldmfd sp!, {r4-r7, ip, lr} - cmn r0, #(MAX_ERRNO + 1) - bxls lr - neg r0, r0 - b __set_errno -END(tgkill) diff --git a/libc/arch-arm/bionic/tkill.S b/libc/arch-arm/bionic/tkill.S deleted file mode 100644 index 0a067d635..000000000 --- a/libc/arch-arm/bionic/tkill.S +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - -/* unlike our auto-generated syscall stubs, this code saves lr - on the stack, as well as a few other registers. this makes - our stack unwinder happy, when we generate debug stack - traces after the C library or other parts of the system - abort due to a fatal runtime error (e.g. detection - of a corrupted malloc heap). -*/ - -ENTRY(tkill) - stmfd sp!, {r4-r7, ip, lr} - ldr r7, =__NR_tkill - swi #0 - ldmfd sp!, {r4-r7, ip, lr} - cmn r0, #(MAX_ERRNO + 1) - bxls lr - neg r0, r0 - b __set_errno -END(tkill) diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index c0438b4fa..a1d4689fc 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -100,6 +100,7 @@ syscall_src += arch-arm/syscalls/inotify_init1.S syscall_src += arch-arm/syscalls/inotify_rm_watch.S syscall_src += arch-arm/syscalls/ioprio_get.S syscall_src += arch-arm/syscalls/ioprio_set.S +syscall_src += arch-arm/syscalls/kill.S syscall_src += arch-arm/syscalls/klogctl.S syscall_src += arch-arm/syscalls/lgetxattr.S syscall_src += arch-arm/syscalls/linkat.S @@ -175,10 +176,12 @@ syscall_src += arch-arm/syscalls/swapon.S syscall_src += arch-arm/syscalls/symlinkat.S syscall_src += arch-arm/syscalls/sync.S syscall_src += arch-arm/syscalls/sysinfo.S +syscall_src += arch-arm/syscalls/tgkill.S syscall_src += arch-arm/syscalls/timerfd_create.S syscall_src += arch-arm/syscalls/timerfd_gettime.S syscall_src += arch-arm/syscalls/timerfd_settime.S syscall_src += arch-arm/syscalls/times.S +syscall_src += arch-arm/syscalls/tkill.S syscall_src += arch-arm/syscalls/truncate.S syscall_src += arch-arm/syscalls/truncate64.S syscall_src += arch-arm/syscalls/umask.S diff --git a/libc/arch-arm/syscalls/__epoll_pwait.S b/libc/arch-arm/syscalls/__epoll_pwait.S index f0b144403..b2d8d48f0 100644 --- a/libc/arch-arm/syscalls/__epoll_pwait.S +++ b/libc/arch-arm/syscalls/__epoll_pwait.S @@ -4,12 +4,17 @@ ENTRY(__epoll_pwait) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_epoll_pwait swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/__llseek.S b/libc/arch-arm/syscalls/__llseek.S index 5d215a448..ec307d291 100644 --- a/libc/arch-arm/syscalls/__llseek.S +++ b/libc/arch-arm/syscalls/__llseek.S @@ -4,12 +4,17 @@ ENTRY(__llseek) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR__llseek swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/__mmap2.S b/libc/arch-arm/syscalls/__mmap2.S index c8dec862a..8a179977d 100644 --- a/libc/arch-arm/syscalls/__mmap2.S +++ b/libc/arch-arm/syscalls/__mmap2.S @@ -4,12 +4,17 @@ ENTRY(__mmap2) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_mmap2 swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/__ppoll.S b/libc/arch-arm/syscalls/__ppoll.S index 599217879..d9fb3d9fb 100644 --- a/libc/arch-arm/syscalls/__ppoll.S +++ b/libc/arch-arm/syscalls/__ppoll.S @@ -4,12 +4,17 @@ ENTRY(__ppoll) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_ppoll swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/__pselect6.S b/libc/arch-arm/syscalls/__pselect6.S index d44e7ed58..05fea543e 100644 --- a/libc/arch-arm/syscalls/__pselect6.S +++ b/libc/arch-arm/syscalls/__pselect6.S @@ -4,12 +4,17 @@ ENTRY(__pselect6) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_pselect6 swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/__waitid.S b/libc/arch-arm/syscalls/__waitid.S index 51b64875b..e5e1f54dc 100644 --- a/libc/arch-arm/syscalls/__waitid.S +++ b/libc/arch-arm/syscalls/__waitid.S @@ -4,12 +4,17 @@ ENTRY(__waitid) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_waitid swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/fchownat.S b/libc/arch-arm/syscalls/fchownat.S index 12a771001..ea8193f43 100644 --- a/libc/arch-arm/syscalls/fchownat.S +++ b/libc/arch-arm/syscalls/fchownat.S @@ -4,12 +4,17 @@ ENTRY(fchownat) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_fchownat swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/fsetxattr.S b/libc/arch-arm/syscalls/fsetxattr.S index 7f9572083..64b8d031e 100644 --- a/libc/arch-arm/syscalls/fsetxattr.S +++ b/libc/arch-arm/syscalls/fsetxattr.S @@ -4,12 +4,17 @@ ENTRY(fsetxattr) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_fsetxattr swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/futex.S b/libc/arch-arm/syscalls/futex.S index a553b7ea9..1646ca207 100644 --- a/libc/arch-arm/syscalls/futex.S +++ b/libc/arch-arm/syscalls/futex.S @@ -4,12 +4,17 @@ ENTRY(futex) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_futex swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/getsockopt.S b/libc/arch-arm/syscalls/getsockopt.S index e5cac3080..2ded34fd3 100644 --- a/libc/arch-arm/syscalls/getsockopt.S +++ b/libc/arch-arm/syscalls/getsockopt.S @@ -4,12 +4,17 @@ ENTRY(getsockopt) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_getsockopt swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/kill.S b/libc/arch-arm/syscalls/kill.S new file mode 100644 index 000000000..9a4420842 --- /dev/null +++ b/libc/arch-arm/syscalls/kill.S @@ -0,0 +1,14 @@ +/* Generated by gensyscalls.py. Do not edit. */ + +#include + +ENTRY(kill) + mov ip, r7 + ldr r7, =__NR_kill + swi #0 + mov r7, ip + cmn r0, #(MAX_ERRNO + 1) + bxls lr + neg r0, r0 + b __set_errno +END(kill) diff --git a/libc/arch-arm/syscalls/linkat.S b/libc/arch-arm/syscalls/linkat.S index 5e4d541ba..27f1e0098 100644 --- a/libc/arch-arm/syscalls/linkat.S +++ b/libc/arch-arm/syscalls/linkat.S @@ -4,12 +4,17 @@ ENTRY(linkat) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_linkat swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/lsetxattr.S b/libc/arch-arm/syscalls/lsetxattr.S index c1a26b426..fb3f75fdc 100644 --- a/libc/arch-arm/syscalls/lsetxattr.S +++ b/libc/arch-arm/syscalls/lsetxattr.S @@ -4,12 +4,17 @@ ENTRY(lsetxattr) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_lsetxattr swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/mount.S b/libc/arch-arm/syscalls/mount.S index dae9f3c28..d56682c63 100644 --- a/libc/arch-arm/syscalls/mount.S +++ b/libc/arch-arm/syscalls/mount.S @@ -4,12 +4,17 @@ ENTRY(mount) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_mount swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/perf_event_open.S b/libc/arch-arm/syscalls/perf_event_open.S index 4cd624eff..2821ac5d9 100644 --- a/libc/arch-arm/syscalls/perf_event_open.S +++ b/libc/arch-arm/syscalls/perf_event_open.S @@ -4,12 +4,17 @@ ENTRY(perf_event_open) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_perf_event_open swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/prctl.S b/libc/arch-arm/syscalls/prctl.S index 51b3c97c6..615a2fa2e 100644 --- a/libc/arch-arm/syscalls/prctl.S +++ b/libc/arch-arm/syscalls/prctl.S @@ -4,12 +4,17 @@ ENTRY(prctl) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_prctl swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/pread64.S b/libc/arch-arm/syscalls/pread64.S index 59bd15468..0bfb6d051 100644 --- a/libc/arch-arm/syscalls/pread64.S +++ b/libc/arch-arm/syscalls/pread64.S @@ -4,12 +4,17 @@ ENTRY(pread64) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_pread64 swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/pwrite64.S b/libc/arch-arm/syscalls/pwrite64.S index 18477f4c5..03247b100 100644 --- a/libc/arch-arm/syscalls/pwrite64.S +++ b/libc/arch-arm/syscalls/pwrite64.S @@ -4,12 +4,17 @@ ENTRY(pwrite64) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_pwrite64 swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/readahead.S b/libc/arch-arm/syscalls/readahead.S index acd35bdbb..83d84424f 100644 --- a/libc/arch-arm/syscalls/readahead.S +++ b/libc/arch-arm/syscalls/readahead.S @@ -4,12 +4,17 @@ ENTRY(readahead) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_readahead swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/recvfrom.S b/libc/arch-arm/syscalls/recvfrom.S index 54c785526..cb89f7230 100644 --- a/libc/arch-arm/syscalls/recvfrom.S +++ b/libc/arch-arm/syscalls/recvfrom.S @@ -4,12 +4,17 @@ ENTRY(recvfrom) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_recvfrom swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/sendto.S b/libc/arch-arm/syscalls/sendto.S index b430e0673..bd0ec1d4c 100644 --- a/libc/arch-arm/syscalls/sendto.S +++ b/libc/arch-arm/syscalls/sendto.S @@ -4,12 +4,17 @@ ENTRY(sendto) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_sendto swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/setsockopt.S b/libc/arch-arm/syscalls/setsockopt.S index 9dc7b1ed6..b2d759790 100644 --- a/libc/arch-arm/syscalls/setsockopt.S +++ b/libc/arch-arm/syscalls/setsockopt.S @@ -4,12 +4,17 @@ ENTRY(setsockopt) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_setsockopt swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/setxattr.S b/libc/arch-arm/syscalls/setxattr.S index 536630b63..022195d01 100644 --- a/libc/arch-arm/syscalls/setxattr.S +++ b/libc/arch-arm/syscalls/setxattr.S @@ -4,12 +4,17 @@ ENTRY(setxattr) mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =__NR_setxattr swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 diff --git a/libc/arch-arm/syscalls/tgkill.S b/libc/arch-arm/syscalls/tgkill.S new file mode 100644 index 000000000..4ea04f590 --- /dev/null +++ b/libc/arch-arm/syscalls/tgkill.S @@ -0,0 +1,14 @@ +/* Generated by gensyscalls.py. Do not edit. */ + +#include + +ENTRY(tgkill) + mov ip, r7 + ldr r7, =__NR_tgkill + swi #0 + mov r7, ip + cmn r0, #(MAX_ERRNO + 1) + bxls lr + neg r0, r0 + b __set_errno +END(tgkill) diff --git a/libc/arch-arm/syscalls/tkill.S b/libc/arch-arm/syscalls/tkill.S new file mode 100644 index 000000000..2626ae74f --- /dev/null +++ b/libc/arch-arm/syscalls/tkill.S @@ -0,0 +1,14 @@ +/* Generated by gensyscalls.py. Do not edit. */ + +#include + +ENTRY(tkill) + mov ip, r7 + ldr r7, =__NR_tkill + swi #0 + mov r7, ip + cmn r0, #(MAX_ERRNO + 1) + bxls lr + neg r0, r0 + b __set_errno +END(tkill) diff --git a/libc/include/sys/glibc-syscalls.h b/libc/include/sys/glibc-syscalls.h index 3683533a9..0deb73a42 100644 --- a/libc/include/sys/glibc-syscalls.h +++ b/libc/include/sys/glibc-syscalls.h @@ -721,6 +721,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 @@ -785,6 +786,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 @@ -1077,6 +1079,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 @@ -1146,6 +1149,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 @@ -1164,7 +1168,6 @@ #define SYS_lstat __NR_lstat #define SYS_lstat64 __NR_lstat64 #define SYS_madvise __NR_madvise -#define SYS_madvise1 __NR_madvise1 #define SYS_mbind __NR_mbind #define SYS_migrate_pages __NR_migrate_pages #define SYS_mincore __NR_mincore @@ -1216,6 +1219,8 @@ #define SYS_pread64 __NR_pread64 #define SYS_preadv __NR_preadv #define SYS_prlimit64 __NR_prlimit64 +#define SYS_process_vm_readv __NR_process_vm_readv +#define SYS_process_vm_writev __NR_process_vm_writev #define SYS_prof __NR_prof #define SYS_profil __NR_profil #define SYS_pselect6 __NR_pselect6 @@ -1420,6 +1425,7 @@ #define SYS_fcntl __NR_fcntl #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 @@ -1477,6 +1483,7 @@ #define SYS_iopl __NR_iopl #define SYS_ioprio_get __NR_ioprio_get #define SYS_ioprio_set __NR_ioprio_set +#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/tools/gensyscalls.py b/libc/tools/gensyscalls.py index d0a8f273a..ef201c324 100755 --- a/libc/tools/gensyscalls.py +++ b/libc/tools/gensyscalls.py @@ -94,12 +94,17 @@ END(%(func)s) arm_eabi_call_long = syscall_stub_header + """\ mov ip, sp - .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 16 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 ldmfd ip, {r4, r5, r6} ldr r7, =%(__NR_name)s swi #0 ldmfd sp!, {r4, r5, r6, r7} + .cfi_def_cfa_offset 0 cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 @@ -413,11 +418,11 @@ class State: glibc_fp.write("#elif defined(__arm__)\n") self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-arm/asm/unistd.h") glibc_fp.write("#elif defined(__mips__)\n") - self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-mips/asm/unistd.h") + self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-mips/asm/unistd.h") glibc_fp.write("#elif defined(__i386__)\n") - self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-x86/asm/unistd_32.h") + self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-x86/asm/unistd_32.h") glibc_fp.write("#elif defined(__x86_64__)\n") - self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-x86/asm/unistd_64.h") + self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-x86/asm/unistd_64.h") glibc_fp.write("#endif\n") glibc_fp.write("#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */\n")