summaryrefslogtreecommitdiffstats
path: root/libc/arch-arm64
diff options
context:
space:
mode:
Diffstat (limited to 'libc/arch-arm64')
-rw-r--r--libc/arch-arm64/arm64.mk8
-rw-r--r--libc/arch-arm64/bionic/__bionic_clone.S16
-rw-r--r--libc/arch-arm64/bionic/_setjmp.S111
-rw-r--r--libc/arch-arm64/bionic/crtbegin.c1
-rw-r--r--libc/arch-arm64/bionic/libgcc_compat.c15
-rw-r--r--libc/arch-arm64/bionic/setjmp.S205
-rw-r--r--libc/arch-arm64/bionic/sigsetjmp.S51
-rw-r--r--libc/arch-arm64/include/machine/asm.h10
-rw-r--r--libc/arch-arm64/include/machine/endian.h58
-rw-r--r--libc/arch-arm64/include/machine/exec.h50
-rw-r--r--libc/arch-arm64/include/machine/setjmp.h45
-rw-r--r--libc/arch-arm64/syscalls/___close.S (renamed from libc/arch-arm64/syscalls/close.S)5
-rw-r--r--libc/arch-arm64/syscalls/___faccessat.S (renamed from libc/arch-arm64/syscalls/faccessat.S)5
-rw-r--r--libc/arch-arm64/syscalls/___fchmod.S (renamed from libc/arch-arm64/syscalls/fchmod.S)5
-rw-r--r--libc/arch-arm64/syscalls/___fchmodat.S (renamed from libc/arch-arm64/syscalls/fchmodat.S)5
-rw-r--r--libc/arch-arm64/syscalls/__clock_nanosleep.S (renamed from libc/arch-arm64/syscalls/clock_nanosleep.S)5
-rw-r--r--libc/arch-arm64/syscalls/__fstatfs.S (renamed from libc/arch-arm64/syscalls/fstatfs64.S)8
-rw-r--r--libc/arch-arm64/syscalls/__rt_sigqueueinfo.S15
-rw-r--r--libc/arch-arm64/syscalls/__statfs.S (renamed from libc/arch-arm64/syscalls/statfs64.S)8
-rw-r--r--libc/arch-arm64/syscalls/_exit.S3
-rw-r--r--libc/arch-arm64/syscalls/fallocate.S3
-rw-r--r--libc/arch-arm64/syscalls/fstat64.S3
-rw-r--r--libc/arch-arm64/syscalls/fstatat64.S3
-rw-r--r--libc/arch-arm64/syscalls/ftruncate.S3
-rw-r--r--libc/arch-arm64/syscalls/getrlimit.S3
-rw-r--r--libc/arch-arm64/syscalls/lseek.S3
-rw-r--r--libc/arch-arm64/syscalls/mmap.S3
-rw-r--r--libc/arch-arm64/syscalls/pread64.S3
-rw-r--r--libc/arch-arm64/syscalls/prlimit64.S3
-rw-r--r--libc/arch-arm64/syscalls/pwrite64.S3
-rw-r--r--libc/arch-arm64/syscalls/sendfile.S3
-rw-r--r--libc/arch-arm64/syscalls/sethostname.S14
-rw-r--r--libc/arch-arm64/syscalls/setrlimit.S3
-rw-r--r--libc/arch-arm64/syscalls/truncate.S3
34 files changed, 210 insertions, 472 deletions
diff --git a/libc/arch-arm64/arm64.mk b/libc/arch-arm64/arm64.mk
index bb6ca63..6a2f313 100644
--- a/libc/arch-arm64/arm64.mk
+++ b/libc/arch-arm64/arm64.mk
@@ -8,7 +8,6 @@ libc_bionic_src_files_arm64 += \
bionic/__memset_chk.cpp \
bionic/__strcpy_chk.cpp \
bionic/__strcat_chk.cpp \
- bionic/memrchr.c \
bionic/strrchr.cpp \
libc_freebsd_src_files_arm64 += \
@@ -21,6 +20,7 @@ libc_freebsd_src_files_arm64 += \
upstream-freebsd/lib/libc/string/wmemcmp.c \
libc_openbsd_src_files_arm64 += \
+ upstream-openbsd/lib/libc/string/memrchr.c \
upstream-openbsd/lib/libc/string/stpncpy.c \
upstream-openbsd/lib/libc/string/strcat.c \
upstream-openbsd/lib/libc/string/strlcat.c \
@@ -35,13 +35,13 @@ libc_openbsd_src_files_arm64 += \
libc_bionic_src_files_arm64 += \
arch-arm64/bionic/__bionic_clone.S \
arch-arm64/bionic/_exit_with_stack_teardown.S \
- arch-arm64/bionic/_setjmp.S \
arch-arm64/bionic/setjmp.S \
arch-arm64/bionic/__set_tls.c \
- arch-arm64/bionic/sigsetjmp.S \
arch-arm64/bionic/syscall.S \
arch-arm64/bionic/vfork.S \
+# Work around for http://b/20065774.
+libc_bionic_src_files_arm64 += arch-arm64/bionic/libgcc_compat.c
libc_crt_target_cflags_arm64 := \
-I$(LOCAL_PATH)/arch-arm64/include
@@ -61,6 +61,6 @@ ifeq ($(wildcard $(cpu_variant_mk)),)
$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are generic, denver64. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.")
endif
include $(cpu_variant_mk)
-libc_common_additional_dependencies += $(cpu_variank_mk)
+libc_common_additional_dependencies += $(cpu_variant_mk)
cpu_variant_mk :=
diff --git a/libc/arch-arm64/bionic/__bionic_clone.S b/libc/arch-arm64/bionic/__bionic_clone.S
index 56ac0f6..27e44e7 100644
--- a/libc/arch-arm64/bionic/__bionic_clone.S
+++ b/libc/arch-arm64/bionic/__bionic_clone.S
@@ -31,8 +31,8 @@
// 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)
- # Copy 'fn' and 'arg' onto the child stack.
- stp x5, x6, [x1, #-16]
+ # Push 'fn' and 'arg' onto the child stack.
+ stp x5, x6, [x1, #-16]!
# Make the system call.
mov x8, __NR_clone
@@ -49,12 +49,12 @@ ENTRY(__bionic_clone)
ret
.L_bc_child:
- # We're in the child now. Set the end of the frame record chain...
- mov x29, xzr
- # Setting x30 to 0 will make the unwinder stop at __start_thread
- mov x30, xzr
- # ...and call __start_thread with the 'fn' and 'arg' we stored on the child stack.
- ldp x0, x1, [sp, #-16]
+ # We're in the child now. Set the end of the frame record chain.
+ mov x29, #0
+ # Setting x30 to 0 will make the unwinder stop at __start_thread.
+ mov x30, #0
+ # Call __start_thread with the 'fn' and 'arg' we stored on the child stack.
+ ldp x0, x1, [sp], #16
b __start_thread
END(__bionic_clone)
.hidden __bionic_clone
diff --git a/libc/arch-arm64/bionic/_setjmp.S b/libc/arch-arm64/bionic/_setjmp.S
deleted file mode 100644
index 3836899..0000000
--- a/libc/arch-arm64/bionic/_setjmp.S
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.
- */
-
-#include <private/bionic_asm.h>
-#include <machine/setjmp.h>
-
-/*
- * C library - _setjmp, _longjmp
- *
- * _longjmp(jmp_buf state, int value)
- * will generate a "return(v)" from the last call to _setjmp(state) by restoring
- * registers from the stack. The previous signal state is NOT restored.
- *
- * NOTE: x0 return value
- * x9-x15 temporary registers
- */
-
-ENTRY(_setjmp)
- /* store magic number */
- ldr w9, .L_setjmp_magic
- str w9, [x0, #(_JB_MAGIC * 4)]
-
- /* store core registers */
- mov x10, sp
- stp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)]
- stp x28, x29, [x0, #(_JB_CORE_BASE * 4 + 16 * 1)]
- stp x26, x27, [x0, #(_JB_CORE_BASE * 4 + 16 * 2)]
- stp x24, x25, [x0, #(_JB_CORE_BASE * 4 + 16 * 3)]
- stp x22, x23, [x0, #(_JB_CORE_BASE * 4 + 16 * 4)]
- stp x20, x21, [x0, #(_JB_CORE_BASE * 4 + 16 * 5)]
- str x19, [x0, #(_JB_CORE_BASE * 4 + 16 * 6)]
-
- /* store floating point registers */
- stp d14, d15, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 0)]
- stp d12, d13, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 1)]
- stp d10, d11, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 2)]
- stp d8, d9, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 3)]
-
- mov w0, wzr
- ret
-END(_setjmp)
-
-.L_setjmp_magic:
- .word _JB_MAGIC__SETJMP
-
-ENTRY(_longjmp)
- /* check magic */
- ldr w9, .L_setjmp_magic
- ldr w10, [x0, #(_JB_MAGIC * 4)]
- cmp w9, w10
- b.ne .L_fail
-
- /* restore core registers */
- ldp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)]
- mov sp, x10
- ldp x28, x29, [x0, #(_JB_CORE_BASE * 4 + 16 * 1)]
- ldp x26, x27, [x0, #(_JB_CORE_BASE * 4 + 16 * 2)]
- ldp x24, x25, [x0, #(_JB_CORE_BASE * 4 + 16 * 3)]
- ldp x22, x23, [x0, #(_JB_CORE_BASE * 4 + 16 * 4)]
- ldp x20, x21, [x0, #(_JB_CORE_BASE * 4 + 16 * 5)]
- ldr x19, [x0, #(_JB_CORE_BASE * 4 + 16 * 6)]
-
- /* restore floating point registers */
- ldp d14, d15, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 0)]
- ldp d12, d13, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 1)]
- ldp d10, d11, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 2)]
- ldp d8, d9, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 3)]
-
- /* validate sp (sp mod 16 = 0) and lr (lr mod 4 = 0) */
- tst x30, #3
- b.ne .L_fail
- mov x10, sp
- tst x10, #15
- b.ne .L_fail
-
- /* set return value */
- cmp w1, wzr
- csinc w0, w1, wzr, ne
- ret
-
- /* validation failed, die die die */
-.L_fail:
- bl PIC_SYM(longjmperror, PLT)
- bl PIC_SYM(abort, PLT)
- b . - 8 /* Cannot get here */
-END(_longjmp)
diff --git a/libc/arch-arm64/bionic/crtbegin.c b/libc/arch-arm64/bionic/crtbegin.c
index fec0b11..7e2c5d7 100644
--- a/libc/arch-arm64/bionic/crtbegin.c
+++ b/libc/arch-arm64/bionic/crtbegin.c
@@ -67,3 +67,4 @@ __asm__ (
#include "../../arch-common/bionic/__dso_handle.h"
#include "../../arch-common/bionic/atexit.h"
+#include "../../arch-common/bionic/pthread_atfork.h"
diff --git a/libc/arch-arm64/bionic/libgcc_compat.c b/libc/arch-arm64/bionic/libgcc_compat.c
new file mode 100644
index 0000000..2dae3f5
--- /dev/null
+++ b/libc/arch-arm64/bionic/libgcc_compat.c
@@ -0,0 +1,15 @@
+/* STOPSHIP: remove this once the flounder blobs have been rebuilt (http://b/20065774). */
+
+#if !defined(__clang__)
+
+extern void __clear_cache(char*, char*);
+extern char _Unwind_Backtrace;
+extern char _Unwind_GetIP;
+
+void* __bionic_libgcc_compat_symbols[] = {
+ &__clear_cache,
+ &_Unwind_Backtrace,
+ &_Unwind_GetIP,
+};
+
+#endif
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index f9d2266..ba0a226 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -27,97 +27,124 @@
*/
#include <private/bionic_asm.h>
-#include <machine/setjmp.h>
-/*
- * C library - _setjmp, _longjmp
- *
- * _longjmp(jmp_buf state, int value)
- * will generate a "return(v)" from the last call to _setjmp(state) by restoring
- * registers from the stack. The previous signal state is NOT restored.
- *
- * NOTE: x0 return value
- * x9-x15 temporary registers
- */
+// According to AARCH64 PCS document we need to save the following
+// registers:
+//
+// Core x19 - x30, sp (see section 5.1.1)
+// VFP d8 - d15 (see section 5.1.2)
+//
+// NOTE: All the registers saved here will have 64 bit vales.
+// AAPCS mandates that the higher part of q registers do not need to
+// be saved by the callee.
+
+#define _JB_SIGFLAG 0
+#define _JB_SIGMASK (_JB_SIGFLAG + 1)
+#define _JB_X30_SP (_JB_SIGMASK + 1)
+#define _JB_X28_X29 (_JB_X30_SP + 2)
+#define _JB_X26_X27 (_JB_X28_X29 + 2)
+#define _JB_X24_X25 (_JB_X26_X27 + 2)
+#define _JB_X22_X23 (_JB_X24_X25 + 2)
+#define _JB_X20_X21 (_JB_X22_X23 + 2)
+#define _JB_X19 (_JB_X20_X21 + 2)
+#define _JB_D14_D15 (_JB_X19 + 1)
+#define _JB_D12_D13 (_JB_D14_D15 + 2)
+#define _JB_D10_D11 (_JB_D12_D13 + 2)
+#define _JB_D8_D9 (_JB_D10_D11 + 2)
ENTRY(setjmp)
- /* block all signals an retrieve signal mask */
- stp x0, x30, [sp, #-16]!
-
- mov x0, xzr
- bl PIC_SYM(sigblock, PLT)
- mov w1, w0
-
- ldp x0, x30, [sp], #16
-
- /* store signal mask */
- str w1, [x0, #(_JB_SIGMASK *4)]
-
- /* store magic number */
- ldr w9, .L_setjmp_magic
- str w9, [x0, #(_JB_MAGIC * 4)]
-
- /* store core registers */
- mov x10, sp
- stp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)]
- stp x28, x29, [x0, #(_JB_CORE_BASE * 4 + 16 * 1)]
- stp x26, x27, [x0, #(_JB_CORE_BASE * 4 + 16 * 2)]
- stp x24, x25, [x0, #(_JB_CORE_BASE * 4 + 16 * 3)]
- stp x22, x23, [x0, #(_JB_CORE_BASE * 4 + 16 * 4)]
- stp x20, x21, [x0, #(_JB_CORE_BASE * 4 + 16 * 5)]
- str x19, [x0, #(_JB_CORE_BASE * 4 + 16 * 6)]
-
- /* store floating point registers */
- stp d14, d15, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 0)]
- stp d12, d13, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 1)]
- stp d10, d11, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 2)]
- stp d8, d9, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 3)]
-
- mov w0, wzr
- ret
+ mov w1, #1
+ b sigsetjmp
END(setjmp)
-.L_setjmp_magic:
- .word _JB_MAGIC__SETJMP
-
-ENTRY(longjmp)
- /* check magic */
- ldr w9, .L_setjmp_magic
- ldr w10, [x0, #(_JB_MAGIC * 4)]
- cmp w9, w10
- b.ne .L_fail
-
- /* restore core registers */
- ldp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)]
- mov sp, x10
- ldp x28, x29, [x0, #(_JB_CORE_BASE * 4 + 16 * 1)]
- ldp x26, x27, [x0, #(_JB_CORE_BASE * 4 + 16 * 2)]
- ldp x24, x25, [x0, #(_JB_CORE_BASE * 4 + 16 * 3)]
- ldp x22, x23, [x0, #(_JB_CORE_BASE * 4 + 16 * 4)]
- ldp x20, x21, [x0, #(_JB_CORE_BASE * 4 + 16 * 5)]
- ldr x19, [x0, #(_JB_CORE_BASE * 4 + 16 * 6)]
-
- /* restore floating point registers */
- ldp d14, d15, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 0)]
- ldp d12, d13, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 1)]
- ldp d10, d11, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 2)]
- ldp d8, d9, [x0, #(_JB_FLOAT_BASE * 4 + 16 * 3)]
-
- /* validate sp (sp mod 16 = 0) and lr (lr mod 4 = 0) */
- tst x30, #3
- b.ne .L_fail
- mov x10, sp
- tst x10, #15
- b.ne .L_fail
-
- /* set return value */
- cmp w1, wzr
- csinc w0, w1, wzr, ne
- ret
-
- /* validation failed, die die die */
-.L_fail:
- bl PIC_SYM(longjmperror, PLT)
- bl PIC_SYM(abort, PLT)
- b . - 8 /* Cannot get here */
-END(longjmp)
+ENTRY(_setjmp)
+ mov w1, #0
+ b sigsetjmp
+END(_setjmp)
+
+// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
+ENTRY(sigsetjmp)
+ // Record whether or not we're saving the signal mask.
+ str w1, [x0, #(_JB_SIGFLAG * 8)]
+
+ // Do we need to save the signal mask?
+ cbz w1, 1f
+
+ // Save current signal mask.
+ stp x0, x30, [sp, #-16]!
+ // The 'how' argument is ignored if new_mask is NULL.
+ mov x1, #0 // NULL.
+ add x2, x0, #(_JB_SIGMASK * 8) // old_mask.
+ bl sigprocmask
+ ldp x0, x30, [sp], #16
+
+1:
+ // Save core registers.
+ mov x10, sp
+ stp x30, x10, [x0, #(_JB_X30_SP * 8)]
+ stp x28, x29, [x0, #(_JB_X28_X29 * 8)]
+ stp x26, x27, [x0, #(_JB_X26_X27 * 8)]
+ stp x24, x25, [x0, #(_JB_X24_X25 * 8)]
+ stp x22, x23, [x0, #(_JB_X22_X23 * 8)]
+ stp x20, x21, [x0, #(_JB_X20_X21 * 8)]
+ str x19, [x0, #(_JB_X19 * 8)]
+
+ // Save floating point registers.
+ stp d14, d15, [x0, #(_JB_D14_D15 * 8)]
+ stp d12, d13, [x0, #(_JB_D12_D13 * 8)]
+ stp d10, d11, [x0, #(_JB_D10_D11 * 8)]
+ stp d8, d9, [x0, #(_JB_D8_D9 * 8)]
+
+ mov w0, #0
+ ret
+END(sigsetjmp)
+
+// void siglongjmp(sigjmp_buf env, int value);
+ENTRY(siglongjmp)
+ // Do we need to restore the signal mask?
+ ldr w9, [x0, #(_JB_SIGFLAG * 8)]
+ cbz w9, 1f
+
+ // Restore signal mask.
+ stp x0, x30, [sp, #-16]!
+ mov x19, x1 // Save 'value'.
+ mov x2, x0
+ mov x0, #2 // SIG_SETMASK
+ add x1, x2, #(_JB_SIGMASK * 8) // new_mask.
+ mov x2, #0 // NULL.
+ bl sigprocmask
+ mov x1, x19 // Restore 'value'.
+ ldp x0, x30, [sp], #16
+
+1:
+ // Restore core registers.
+ ldp x30, x10, [x0, #(_JB_X30_SP * 8)]
+ mov sp, x10
+ ldp x28, x29, [x0, #(_JB_X28_X29 * 8)]
+ ldp x26, x27, [x0, #(_JB_X26_X27 * 8)]
+ ldp x24, x25, [x0, #(_JB_X24_X25 * 8)]
+ ldp x22, x23, [x0, #(_JB_X22_X23 * 8)]
+ ldp x20, x21, [x0, #(_JB_X20_X21 * 8)]
+ ldr x19, [x0, #(_JB_X19 * 8)]
+
+ // Restore floating point registers.
+ ldp d14, d15, [x0, #(_JB_D14_D15 * 8)]
+ ldp d12, d13, [x0, #(_JB_D12_D13 * 8)]
+ ldp d10, d11, [x0, #(_JB_D10_D11 * 8)]
+ ldp d8, d9, [x0, #(_JB_D8_D9 * 8)]
+
+ // Validate sp (sp mod 16 = 0) and lr (lr mod 4 = 0).
+ tst x30, #3
+ b.ne longjmperror
+ mov x10, sp
+ tst x10, #15
+ b.ne longjmperror
+
+ // Set return value.
+ cmp w1, wzr
+ csinc w0, w1, wzr, ne
+ ret
+END(siglongjmp)
+
+ALIAS_SYMBOL(longjmp, siglongjmp)
+ALIAS_SYMBOL(_longjmp, siglongjmp)
diff --git a/libc/arch-arm64/bionic/sigsetjmp.S b/libc/arch-arm64/bionic/sigsetjmp.S
deleted file mode 100644
index 4fdb367..0000000
--- a/libc/arch-arm64/bionic/sigsetjmp.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-#include <private/bionic_asm.h>
-#include <machine/setjmp.h>
-
-/*
- * int sigsetjmp(sigjmp_buf env, int savesigs);
- * void siglongjmp(sigjmp_buf env, int val);
- */
-
-ENTRY(sigsetjmp)
- cbz w1, PIC_SYM(_setjmp, PLT)
- b PIC_SYM(setjmp, PLT)
-END(sigsetjmp)
-
-.L_setjmp_magic:
- .word _JB_MAGIC__SETJMP
-
-ENTRY(siglongjmp)
- ldr w2, .L_setjmp_magic
- ldr w3, [x0]
- cmp w2, w3
- b.eq PIC_SYM(_longjmp, PLT)
- b PIC_SYM(longjmp, PLT)
-END(siglongjmp)
diff --git a/libc/arch-arm64/include/machine/asm.h b/libc/arch-arm64/include/machine/asm.h
index 4bfabaf..2bea043 100644
--- a/libc/arch-arm64/include/machine/asm.h
+++ b/libc/arch-arm64/include/machine/asm.h
@@ -38,17 +38,9 @@
#ifndef _AARCH64_ASM_H_
#define _AARCH64_ASM_H_
-#ifndef _ALIGN_TEXT
-# define _ALIGN_TEXT .align 0
-#endif
+#define __bionic_asm_align 0
#undef __bionic_asm_function_type
#define __bionic_asm_function_type %function
-#if defined(__ELF__) && defined(PIC)
-#define PIC_SYM(x,y) x ## ( ## y ## )
-#else
-#define PIC_SYM(x,y) x
-#endif
-
#endif /* _AARCH64_ASM_H_ */
diff --git a/libc/arch-arm64/include/machine/endian.h b/libc/arch-arm64/include/machine/endian.h
deleted file mode 100644
index 87a038d..0000000
--- a/libc/arch-arm64/include/machine/endian.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _AARCH64_ENDIAN_H_
-#define _AARCH64_ENDIAN_H_
-
-#include <sys/types.h>
-#include <sys/endian.h>
-
-#ifdef __GNUC__
-
-#define __swap16md(x) ({ \
- register u_int16_t _x = (x); \
- __asm volatile ("rev16 %0, %0" : "+r" (_x)); \
- _x; \
-})
-
-/* Use GCC builtins */
-#define __swap32md(x) __builtin_bswap32(x)
-#define __swap64md(x) __builtin_bswap64(x)
-
-/* Tell sys/endian.h we have MD variants of the swap macros. */
-#define MD_SWAP
-
-#endif /* __GNUC__ */
-
-#if defined(__AARCH64EB__)
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-
-#endif /* _AARCH64_ENDIAN_H_ */
diff --git a/libc/arch-arm64/include/machine/exec.h b/libc/arch-arm64/include/machine/exec.h
deleted file mode 100644
index 7437626..0000000
--- a/libc/arch-arm64/include/machine/exec.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */
-/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * 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.
- * 3. The name of the author may not 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 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.
- */
-
-#ifndef _AARCH64_EXEC_H_
-#define _AARCH64_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define NATIVE_EXEC_ELF
-
-#define ARCH_ELFSIZE 64
-
-#define ELF_TARG_CLASS ELFCLASS64 /* 64-bit objects */
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_AARCH64
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#define _KERN_DO_ELF64
-
-#endif /* _AARCH64_EXEC_H_ */
diff --git a/libc/arch-arm64/include/machine/setjmp.h b/libc/arch-arm64/include/machine/setjmp.h
index 1c237da..27c2fe5 100644
--- a/libc/arch-arm64/include/machine/setjmp.h
+++ b/libc/arch-arm64/include/machine/setjmp.h
@@ -26,48 +26,5 @@
* SUCH DAMAGE.
*/
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-/* _JBLEN is the size of a jmp_buf in longs(64bit on AArch64) */
+/* _JBLEN is the size of a jmp_buf in longs (64bit on AArch64) */
#define _JBLEN 32
-
-/* According to AARCH64 PCS document we need to save the following
- * registers:
- *
- * Core x19 - x30, sp (see section 5.1.1)
- * VFP d8 - d15 (see section 5.1.2)
- *
- * NOTE: All the registers saved here will have 64bit vales (except FPSR).
- * AAPCS mandates that the higher part of q registers does not need to
- * be saveved by the callee.
- */
-
-/* The structure of jmp_buf for AArch64:
- *
- * NOTE: _JBLEN is the size of jmp_buf in longs(64bit on AArch64)! The table
- * below computes the offsets in words(32bit).
- *
- * word name description
- * 0 magic magic number
- * 1 sigmask signal mask (not used with _setjmp / _longjmp)
- * 2 core_base base of core registers (x19-x30, sp)
- * 28 float_base base of float registers (d8-d15)
- * 44 reserved reserved entries (room to grow)
- * 64
- *
- *
- * NOTE: The instructions that load/store core/vfp registers expect 8-byte
- * alignment. Contrary to the previous setjmp header for ARM we do not
- * need to save status/control registers for VFP (it is not a
- * requirement for setjmp).
- */
-
-#define _JB_MAGIC 0
-#define _JB_SIGMASK (_JB_MAGIC+1)
-#define _JB_CORE_BASE (_JB_SIGMASK+1)
-#define _JB_FLOAT_BASE (_JB_CORE_BASE + (31-19+1)*2)
-
-#define _JB_MAGIC__SETJMP 0x53657200
-#define _JB_MAGIC_SETJMP 0x53657201
diff --git a/libc/arch-arm64/syscalls/close.S b/libc/arch-arm64/syscalls/___close.S
index 3624581..8fb8361 100644
--- a/libc/arch-arm64/syscalls/close.S
+++ b/libc/arch-arm64/syscalls/___close.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(close)
+ENTRY(___close)
mov x8, __NR_close
svc #0
@@ -11,4 +11,5 @@ ENTRY(close)
b.hi __set_errno_internal
ret
-END(close)
+END(___close)
+.hidden ___close
diff --git a/libc/arch-arm64/syscalls/faccessat.S b/libc/arch-arm64/syscalls/___faccessat.S
index 4c96cfa..6a41b69 100644
--- a/libc/arch-arm64/syscalls/faccessat.S
+++ b/libc/arch-arm64/syscalls/___faccessat.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(faccessat)
+ENTRY(___faccessat)
mov x8, __NR_faccessat
svc #0
@@ -11,4 +11,5 @@ ENTRY(faccessat)
b.hi __set_errno_internal
ret
-END(faccessat)
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-arm64/syscalls/fchmod.S b/libc/arch-arm64/syscalls/___fchmod.S
index 83a8060..a143c65 100644
--- a/libc/arch-arm64/syscalls/fchmod.S
+++ b/libc/arch-arm64/syscalls/___fchmod.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(fchmod)
+ENTRY(___fchmod)
mov x8, __NR_fchmod
svc #0
@@ -11,4 +11,5 @@ ENTRY(fchmod)
b.hi __set_errno_internal
ret
-END(fchmod)
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-arm64/syscalls/fchmodat.S b/libc/arch-arm64/syscalls/___fchmodat.S
index 8c5bb0e..1ab3736 100644
--- a/libc/arch-arm64/syscalls/fchmodat.S
+++ b/libc/arch-arm64/syscalls/___fchmodat.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(fchmodat)
+ENTRY(___fchmodat)
mov x8, __NR_fchmodat
svc #0
@@ -11,4 +11,5 @@ ENTRY(fchmodat)
b.hi __set_errno_internal
ret
-END(fchmodat)
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-arm64/syscalls/clock_nanosleep.S b/libc/arch-arm64/syscalls/__clock_nanosleep.S
index 349c5cc..1df15d6 100644
--- a/libc/arch-arm64/syscalls/clock_nanosleep.S
+++ b/libc/arch-arm64/syscalls/__clock_nanosleep.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(clock_nanosleep)
+ENTRY(__clock_nanosleep)
mov x8, __NR_clock_nanosleep
svc #0
@@ -11,4 +11,5 @@ ENTRY(clock_nanosleep)
b.hi __set_errno_internal
ret
-END(clock_nanosleep)
+END(__clock_nanosleep)
+.hidden __clock_nanosleep
diff --git a/libc/arch-arm64/syscalls/fstatfs64.S b/libc/arch-arm64/syscalls/__fstatfs.S
index 2ca2dcd..7e350d6 100644
--- a/libc/arch-arm64/syscalls/fstatfs64.S
+++ b/libc/arch-arm64/syscalls/__fstatfs.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(fstatfs64)
+ENTRY(__fstatfs)
mov x8, __NR_fstatfs
svc #0
@@ -11,7 +11,5 @@ ENTRY(fstatfs64)
b.hi __set_errno_internal
ret
-END(fstatfs64)
-
- .globl fstatfs
- .equ fstatfs, fstatfs64
+END(__fstatfs)
+.hidden __fstatfs
diff --git a/libc/arch-arm64/syscalls/__rt_sigqueueinfo.S b/libc/arch-arm64/syscalls/__rt_sigqueueinfo.S
new file mode 100644
index 0000000..2b23e18
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigqueueinfo.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigqueueinfo)
+ mov x8, __NR_rt_sigqueueinfo
+ svc #0
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno_internal
+
+ ret
+END(__rt_sigqueueinfo)
+.hidden __rt_sigqueueinfo
diff --git a/libc/arch-arm64/syscalls/statfs64.S b/libc/arch-arm64/syscalls/__statfs.S
index ec8c588..962c590 100644
--- a/libc/arch-arm64/syscalls/statfs64.S
+++ b/libc/arch-arm64/syscalls/__statfs.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(statfs64)
+ENTRY(__statfs)
mov x8, __NR_statfs
svc #0
@@ -11,7 +11,5 @@ ENTRY(statfs64)
b.hi __set_errno_internal
ret
-END(statfs64)
-
- .globl statfs
- .equ statfs, statfs64
+END(__statfs)
+.hidden __statfs
diff --git a/libc/arch-arm64/syscalls/_exit.S b/libc/arch-arm64/syscalls/_exit.S
index edf6744..d50f38d 100644
--- a/libc/arch-arm64/syscalls/_exit.S
+++ b/libc/arch-arm64/syscalls/_exit.S
@@ -13,5 +13,4 @@ ENTRY(_exit)
ret
END(_exit)
- .globl _Exit
- .equ _Exit, _exit
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-arm64/syscalls/fallocate.S b/libc/arch-arm64/syscalls/fallocate.S
index ef3d4a4..d42a0ba 100644
--- a/libc/arch-arm64/syscalls/fallocate.S
+++ b/libc/arch-arm64/syscalls/fallocate.S
@@ -13,5 +13,4 @@ ENTRY(fallocate)
ret
END(fallocate)
- .globl fallocate64
- .equ fallocate64, fallocate
+ALIAS_SYMBOL(fallocate64, fallocate)
diff --git a/libc/arch-arm64/syscalls/fstat64.S b/libc/arch-arm64/syscalls/fstat64.S
index 85a07f5..f7c9f54 100644
--- a/libc/arch-arm64/syscalls/fstat64.S
+++ b/libc/arch-arm64/syscalls/fstat64.S
@@ -13,5 +13,4 @@ ENTRY(fstat64)
ret
END(fstat64)
- .globl fstat
- .equ fstat, fstat64
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-arm64/syscalls/fstatat64.S b/libc/arch-arm64/syscalls/fstatat64.S
index dafd982..9f8f2c5 100644
--- a/libc/arch-arm64/syscalls/fstatat64.S
+++ b/libc/arch-arm64/syscalls/fstatat64.S
@@ -13,5 +13,4 @@ ENTRY(fstatat64)
ret
END(fstatat64)
- .globl fstatat
- .equ fstatat, fstatat64
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-arm64/syscalls/ftruncate.S b/libc/arch-arm64/syscalls/ftruncate.S
index c6e99f5..c21e098 100644
--- a/libc/arch-arm64/syscalls/ftruncate.S
+++ b/libc/arch-arm64/syscalls/ftruncate.S
@@ -13,5 +13,4 @@ ENTRY(ftruncate)
ret
END(ftruncate)
- .globl ftruncate64
- .equ ftruncate64, ftruncate
+ALIAS_SYMBOL(ftruncate64, ftruncate)
diff --git a/libc/arch-arm64/syscalls/getrlimit.S b/libc/arch-arm64/syscalls/getrlimit.S
index 518ab73..03ee9a8 100644
--- a/libc/arch-arm64/syscalls/getrlimit.S
+++ b/libc/arch-arm64/syscalls/getrlimit.S
@@ -13,5 +13,4 @@ ENTRY(getrlimit)
ret
END(getrlimit)
- .globl getrlimit64
- .equ getrlimit64, getrlimit
+ALIAS_SYMBOL(getrlimit64, getrlimit)
diff --git a/libc/arch-arm64/syscalls/lseek.S b/libc/arch-arm64/syscalls/lseek.S
index de96df0..93afeb7 100644
--- a/libc/arch-arm64/syscalls/lseek.S
+++ b/libc/arch-arm64/syscalls/lseek.S
@@ -13,5 +13,4 @@ ENTRY(lseek)
ret
END(lseek)
- .globl lseek64
- .equ lseek64, lseek
+ALIAS_SYMBOL(lseek64, lseek)
diff --git a/libc/arch-arm64/syscalls/mmap.S b/libc/arch-arm64/syscalls/mmap.S
index 64b955e..65371bc 100644
--- a/libc/arch-arm64/syscalls/mmap.S
+++ b/libc/arch-arm64/syscalls/mmap.S
@@ -13,5 +13,4 @@ ENTRY(mmap)
ret
END(mmap)
- .globl mmap64
- .equ mmap64, mmap
+ALIAS_SYMBOL(mmap64, mmap)
diff --git a/libc/arch-arm64/syscalls/pread64.S b/libc/arch-arm64/syscalls/pread64.S
index eafc044..6c9f0e9 100644
--- a/libc/arch-arm64/syscalls/pread64.S
+++ b/libc/arch-arm64/syscalls/pread64.S
@@ -13,5 +13,4 @@ ENTRY(pread64)
ret
END(pread64)
- .globl pread
- .equ pread, pread64
+ALIAS_SYMBOL(pread, pread64)
diff --git a/libc/arch-arm64/syscalls/prlimit64.S b/libc/arch-arm64/syscalls/prlimit64.S
index 2bece99..9c018ba 100644
--- a/libc/arch-arm64/syscalls/prlimit64.S
+++ b/libc/arch-arm64/syscalls/prlimit64.S
@@ -13,5 +13,4 @@ ENTRY(prlimit64)
ret
END(prlimit64)
- .globl prlimit
- .equ prlimit, prlimit64
+ALIAS_SYMBOL(prlimit, prlimit64)
diff --git a/libc/arch-arm64/syscalls/pwrite64.S b/libc/arch-arm64/syscalls/pwrite64.S
index 6970954..1599c14 100644
--- a/libc/arch-arm64/syscalls/pwrite64.S
+++ b/libc/arch-arm64/syscalls/pwrite64.S
@@ -13,5 +13,4 @@ ENTRY(pwrite64)
ret
END(pwrite64)
- .globl pwrite
- .equ pwrite, pwrite64
+ALIAS_SYMBOL(pwrite, pwrite64)
diff --git a/libc/arch-arm64/syscalls/sendfile.S b/libc/arch-arm64/syscalls/sendfile.S
index 17a0d46..50ac12d 100644
--- a/libc/arch-arm64/syscalls/sendfile.S
+++ b/libc/arch-arm64/syscalls/sendfile.S
@@ -13,5 +13,4 @@ ENTRY(sendfile)
ret
END(sendfile)
- .globl sendfile64
- .equ sendfile64, sendfile
+ALIAS_SYMBOL(sendfile64, sendfile)
diff --git a/libc/arch-arm64/syscalls/sethostname.S b/libc/arch-arm64/syscalls/sethostname.S
new file mode 100644
index 0000000..2dea457
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sethostname.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+ mov x8, __NR_sethostname
+ svc #0
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno_internal
+
+ ret
+END(sethostname)
diff --git a/libc/arch-arm64/syscalls/setrlimit.S b/libc/arch-arm64/syscalls/setrlimit.S
index 6cb6b98..52c75a1 100644
--- a/libc/arch-arm64/syscalls/setrlimit.S
+++ b/libc/arch-arm64/syscalls/setrlimit.S
@@ -13,5 +13,4 @@ ENTRY(setrlimit)
ret
END(setrlimit)
- .globl setrlimit64
- .equ setrlimit64, setrlimit
+ALIAS_SYMBOL(setrlimit64, setrlimit)
diff --git a/libc/arch-arm64/syscalls/truncate.S b/libc/arch-arm64/syscalls/truncate.S
index 0e5a33e..e01cc7d 100644
--- a/libc/arch-arm64/syscalls/truncate.S
+++ b/libc/arch-arm64/syscalls/truncate.S
@@ -13,5 +13,4 @@ ENTRY(truncate)
ret
END(truncate)
- .globl truncate64
- .equ truncate64, truncate
+ALIAS_SYMBOL(truncate64, truncate)