Merge tag 'LA.UM.5.8.r1-01600-8x98.0' into n-mr1
"LA.UM.5.8.r1-01600-8x98.0"
diff --git a/libc/Android.mk b/libc/Android.mk
index a7cec12..58ee7f3 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -196,8 +196,6 @@
bionic/sched_getcpu.cpp \
bionic/semaphore.cpp \
bionic/send.cpp \
- bionic/sendmsg.cpp \
- bionic/sendto.cpp \
bionic/setegid.cpp \
bionic/__set_errno.cpp \
bionic/seteuid.cpp \
@@ -243,11 +241,6 @@
bionic/wchar.cpp \
bionic/wctype.cpp \
bionic/wmempcpy.cpp \
- bionic/writev.cpp \
-
-libc_bionic_ndk_src_files += \
- codeaurora/PropClientDispatch.cpp \
- codeaurora/PropClientDispatchWrite.cpp
libc_bionic_src_files :=
@@ -628,6 +621,10 @@
use_clang := false
endif
+ifeq ($(TARGET_NEEDS_GCC_LIBC),true)
+ use_clang := false
+endif
+
ifeq ($(use_clang),)
use_clang := true
endif
@@ -1496,6 +1493,9 @@
LOCAL_SANITIZE := never
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
+# Allow devices to provide additional symbols
+LOCAL_WHOLE_STATIC_LIBRARIES += $(BOARD_PROVIDES_ADDITIONAL_BIONIC_STATIC_LIBS)
+
include $(BUILD_SHARED_LIBRARY)
# ========================================================
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 08bee63..d5dd206 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -118,7 +118,7 @@
int mincore(void* start, size_t length, unsigned char* vec) all
int __ioctl:ioctl(int, int, void*) all
int readv(int, const struct iovec*, int) all
-int __writev:writev(int, const struct iovec*, int) all
+int writev(int, const struct iovec*, int) all
int __fcntl64:fcntl64(int, int, void*) arm,mips,x86
int fcntl(int, int, void*) arm64,mips64,x86_64
int flock(int, int) all
@@ -245,12 +245,12 @@
int __accept4:accept4(int, struct sockaddr*, socklen_t*, int) arm,arm64,mips,mips64,x86_64
int getsockname(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
int getpeername(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
-int __sendto:sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
+int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
int recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
int shutdown(int, int) arm,arm64,mips,mips64,x86_64
int setsockopt(int, int, int, const void*, socklen_t) arm,arm64,mips,mips64,x86_64
int getsockopt(int, int, int, void*, socklen_t*) arm,arm64,mips,mips64,x86_64
-int __sendmsg:sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64
+int sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64
int recvmsg(int, struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64
int recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*) arm,arm64,mips,mips64,x86_64
int sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,arm64,mips,mips64,x86_64
@@ -263,12 +263,12 @@
int getsockname:socketcall:6(int, struct sockaddr*, socklen_t*) x86
int getpeername:socketcall:7(int, struct sockaddr*, socklen_t*) x86
int socketpair:socketcall:8(int, int, int, int*) x86
-int __sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t) x86
+int sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t) x86
int recvfrom:socketcall:12(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) x86
int shutdown:socketcall:13(int, int) x86
int setsockopt:socketcall:14(int, int, int, const void*, socklen_t) x86
int getsockopt:socketcall:15(int, int, int, void*, socklen_t*) x86
-int __sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86
+int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86
int recvmsg:socketcall:17(int, struct msghdr*, unsigned int) x86
int __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int) x86
int recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*) x86
diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk
index 76f465e..3a12558 100644
--- a/libc/arch-arm/arm.mk
+++ b/libc/arch-arm/arm.mk
@@ -1,6 +1,7 @@
# 32-bit arm.
libc_bionic_src_files_arm += \
+ arch-arm/generic/bionic/memchr.S \
arch-arm/generic/bionic/memcmp.S \
arch-arm/generic/bionic/memcpy.S \
arch-arm/generic/bionic/memset.S \
@@ -13,7 +14,8 @@
bionic/__memset_chk.cpp \
libc_openbsd_src_files_exclude_arm += \
- upstream-openbsd/lib/libc/string/strcpy.c \
+ upstream-openbsd/lib/libc/string/memchr.c \
+ upstream-openbsd/lib/libc/string/strcpy.c
#
# Inherently architecture-specific code.
@@ -41,7 +43,7 @@
ifneq ($(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT),generic)
cpu_variant_mk := $(LOCAL_PATH)/arch-arm/$(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT)/$(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT).mk
ifeq ($(wildcard $(cpu_variant_mk)),)
-$(error "TARGET_$(my_2nd_arch_prefix)CPU_VARIANT not set or set to an unknown value. Possible values are cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, denver. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.")
+$(error "TARGET_$(my_2nd_arch_prefix)CPU_VARIANT not set or set to an unknown value. Possible values are cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, scorpion, denver. 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_variant_mk)
diff --git a/libc/arch-arm/cortex-a15/bionic/strcmp.S b/libc/arch-arm/cortex-a15/bionic/strcmp.S
index acedf0e..d7b05c7 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcmp.S
@@ -1,376 +1,127 @@
/*
- * Copyright (c) 2013 ARM Ltd
- * All rights reserved.
+ * Copyright (c) 2011 Apple, Inc. 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 company may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
+ * @APPLE_LICENSE_HEADER_START@
*
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
*/
#include <machine/cpu-features.h>
#include <private/bionic_asm.h>
-#ifdef __ARMEB__
-#define S2LOMEM lsl
-#define S2LOMEMEQ lsleq
-#define S2HIMEM lsr
-#define MSB 0x000000ff
-#define LSB 0xff000000
-#define BYTE0_OFFSET 24
-#define BYTE1_OFFSET 16
-#define BYTE2_OFFSET 8
-#define BYTE3_OFFSET 0
-#else /* not __ARMEB__ */
-#define S2LOMEM lsr
-#define S2LOMEMEQ lsreq
-#define S2HIMEM lsl
-#define BYTE0_OFFSET 0
-#define BYTE1_OFFSET 8
-#define BYTE2_OFFSET 16
-#define BYTE3_OFFSET 24
-#define MSB 0xff000000
-#define LSB 0x000000ff
-#endif /* not __ARMEB__ */
+.text
+.syntax unified
+.code 32
-.syntax unified
+#define ESTABLISH_FRAME \
+ push {r4-r7,lr} ;\
+ add r7, sp, #12 ;\
+ push {r8}
+#define CLEAR_FRAME \
+ pop {r8} ;\
+ pop {r4-r7,lr}
-#if defined (__thumb__)
- .thumb
- .thumb_func
-#endif
+.align 3
+.long 0, 0x01010101
ENTRY(strcmp)
- /* Use LDRD whenever possible. */
+// Load a character from each string and advance the pointers. If the loaded
+// characters are unequal or NUL, return their difference.
+0: ldrb r2, [r0],#1
+ ldrb ip, [r1],#1
+ cmp r2, #1
+ cmphs r2, ip
+ bne L_earlyReturn
+// If the address of the next character from s1 does not have word alignment,
+// continue with the character-by-character comparison. Otherwise, fall
+// through into the word-by-word comparison path.
+ tst r0, #3
+ bne 0b
-/* The main thing to look out for when comparing large blocks is that
- the loads do not cross a page boundary when loading past the index
- of the byte with the first difference or the first string-terminator.
+// We have not encountered a NUL or a mismatch, and s1 has word alignment.
+// Establish a frame, since we're going to need additional registers anyway.
+ ESTABLISH_FRAME
+ ldr lr, (strcmp-4)
- For example, if the strings are identical and the string-terminator
- is at index k, byte by byte comparison will not load beyond address
- s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
- k; double word - up to 7 bytes. If the load of these bytes crosses
- a page boundary, it might cause a memory fault (if the page is not mapped)
- that would not have happened in byte by byte comparison.
+// Word align s2, and place the remainder in r8. Compute the right- and
+// left-shifts to extract each word that we will compare to the other source
+// from the aligned words that we load:
+//
+// aligned s2 to be loaded on next iteration
+// | "true" s2 |
+// v v v
+// +---+---+---+---+ +---+---+---+---+
+// | 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 |
+// +---+---+---+---+ +---+---+---+---+
+// ^-----------------^
+// to be compared on next iteration
+ and r8, r1, #3
+ bic r1, r1, #3
+ mov r8, r8, lsl #3
+ rsb r5, r8, #32
- If an address is (double) word aligned, then a load of a (double) word
- from that address will not cross a page boundary.
- Therefore, the algorithm below considers word and double-word alignment
- of strings separately. */
+// Load the first aligned word of s2. OR 0x01 into any bytes that preceed the
+// "true s2", to prevent our check for NUL from generating a false positive.
+// Then check for NUL, and jump to the byte-by-byte comparison loop after
+// unwinding the pointers if we enounter one.
+ ldr r6, [r1],#4
+ orr r6, r6, lr, lsr r5
+ sub r2, r6, lr
+ bic r2, r2, r6
+ tst r2, lr, lsl #7
+ mov r4, r6, lsr r8
+ bne L_unwindLoopPreload
-/* High-level description of the algorithm.
+.align 3
+L_wordCompareLoop:
+ // Load the next aligned word of s2 and check if it contains any NUL bytes.
+ // Load the next aligned word of s1, and extract the corresponding bytes from
+ // the two words of s2 loaded in this and the previous iteration of the loop.
+ // Compare these two words.
+ // If no NUL or mismatched words have been encountered, continue the loop.
+ ldr r6, [r1],#4
+ uqsub8 r2, lr, r6
+ tst r2, r2
+ ldr ip, [r0],#4
+ orr r3, r4, r6, lsl r5
+ cmpeq ip, r3
+ mov r4, r6, lsr r8
+ beq L_wordCompareLoop
- * The fast path: if both strings are double-word aligned,
- use LDRD to load two words from each string in every loop iteration.
- * If the strings have the same offset from a word boundary,
- use LDRB to load and compare byte by byte until
- the first string is aligned to a word boundary (at most 3 bytes).
- This is optimized for quick return on short unaligned strings.
- * If the strings have the same offset from a double-word boundary,
- use LDRD to load two words from each string in every loop iteration, as in the fast path.
- * If the strings do not have the same offset from a double-word boundary,
- load a word from the second string before the loop to initialize the queue.
- Use LDRD to load two words from every string in every loop iteration.
- Inside the loop, load the second word from the second string only after comparing
- the first word, using the queued value, to guarantee safety across page boundaries.
- * If the strings do not have the same offset from a word boundary,
- use LDR and a shift queue. Order of loads and comparisons matters,
- similarly to the previous case.
+// Either we have encountered a NUL, or we have found a mismatch between s1
+// and s2. Unwind the pointers and use a byte-by-byte comparison loop.
+ sub r0, r0, #4
+ sub r1, r1, #4
+L_unwindLoopPreload:
+ sub r1, r1, r5, lsr #3
+ CLEAR_FRAME
- * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
- * The only difference between ARM and Thumb modes is the use of CBZ instruction.
- * The only difference between big and little endian is the use of REV in little endian
- to compute the return value, instead of MOV.
-*/
+L_byteCompareLoop:
+// Load a character from each string and advance the pointers. If the loaded
+// characters are unequal or NUL, return their difference.
+ ldrb r2, [r0],#1
+ ldrb ip, [r1],#1
+ cmp r2, #1
+ cmpcs r2, ip
+ beq L_byteCompareLoop
- .macro m_cbz reg label
-#ifdef __thumb2__
- cbz \reg, \label
-#else /* not defined __thumb2__ */
- cmp \reg, #0
- beq \label
-#endif /* not defined __thumb2__ */
- .endm /* m_cbz */
-
- .macro m_cbnz reg label
-#ifdef __thumb2__
- cbnz \reg, \label
-#else /* not defined __thumb2__ */
- cmp \reg, #0
- bne \label
-#endif /* not defined __thumb2__ */
- .endm /* m_cbnz */
-
- .macro init
- /* Macro to save temporary registers and prepare magic values. */
- subs sp, sp, #16
- .cfi_def_cfa_offset 16
- strd r4, r5, [sp, #8]
- .cfi_rel_offset r4, 0
- .cfi_rel_offset r5, 4
- strd r6, r7, [sp]
- .cfi_rel_offset r6, 8
- .cfi_rel_offset r7, 12
- mvn r6, #0 /* all F */
- mov r7, #0 /* all 0 */
- .endm /* init */
-
- .macro magic_compare_and_branch w1 w2 label
- /* Macro to compare registers w1 and w2 and conditionally branch to label. */
- cmp \w1, \w2 /* Are w1 and w2 the same? */
- magic_find_zero_bytes \w1
- it eq
- cmpeq ip, #0 /* Is there a zero byte in w1? */
- bne \label
- .endm /* magic_compare_and_branch */
-
- .macro magic_find_zero_bytes w1
- /* Macro to find all-zero bytes in w1, result is in ip. */
- uadd8 ip, \w1, r6
- sel ip, r7, r6
- .endm /* magic_find_zero_bytes */
-
- .macro setup_return w1 w2
-#ifdef __ARMEB__
- mov r1, \w1
- mov r2, \w2
-#else /* not __ARMEB__ */
- rev r1, \w1
- rev r2, \w2
-#endif /* not __ARMEB__ */
- .endm /* setup_return */
-
- pld [r0, #0]
- pld [r1, #0]
-
- /* Are both strings double-word aligned? */
- orr ip, r0, r1
- tst ip, #7
- bne .L_do_align
-
- /* Fast path. */
- init
-
-.L_doubleword_aligned:
-
- /* Get here when the strings to compare are double-word aligned. */
- /* Compare two words in every iteration. */
- .p2align 2
-2:
- pld [r0, #16]
- pld [r1, #16]
-
- /* Load the next double-word from each string. */
- ldrd r2, r3, [r0], #8
- ldrd r4, r5, [r1], #8
-
- magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
- magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
- b 2b
-
-.L_do_align:
- /* Is the first string word-aligned? */
- ands ip, r0, #3
- beq .L_word_aligned_r0
-
- /* Fast compare byte by byte until the first string is word-aligned. */
- /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
- to read until the next word boundary is 4-ip. */
- bic r0, r0, #3
- ldr r2, [r0], #4
- lsls ip, ip, #31
- beq .L_byte2
- bcs .L_byte3
-
-.L_byte1:
- ldrb ip, [r1], #1
- uxtb r3, r2, ror #BYTE1_OFFSET
- subs ip, r3, ip
- bne .L_fast_return
- m_cbz reg=r3, label=.L_fast_return
-
-.L_byte2:
- ldrb ip, [r1], #1
- uxtb r3, r2, ror #BYTE2_OFFSET
- subs ip, r3, ip
- bne .L_fast_return
- m_cbz reg=r3, label=.L_fast_return
-
-.L_byte3:
- ldrb ip, [r1], #1
- uxtb r3, r2, ror #BYTE3_OFFSET
- subs ip, r3, ip
- bne .L_fast_return
- m_cbnz reg=r3, label=.L_word_aligned_r0
-
-.L_fast_return:
- mov r0, ip
- bx lr
-
-.L_word_aligned_r0:
- init
- /* The first string is word-aligned. */
- /* Is the second string word-aligned? */
- ands ip, r1, #3
- bne .L_strcmp_unaligned
-
-.L_word_aligned:
- /* The strings are word-aligned. */
- /* Is the first string double-word aligned? */
- tst r0, #4
- beq .L_doubleword_aligned_r0
-
- /* If r0 is not double-word aligned yet, align it by loading
- and comparing the next word from each string. */
- ldr r2, [r0], #4
- ldr r4, [r1], #4
- magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
-
-.L_doubleword_aligned_r0:
- /* Get here when r0 is double-word aligned. */
- /* Is r1 doubleword_aligned? */
- tst r1, #4
- beq .L_doubleword_aligned
-
- /* Get here when the strings to compare are word-aligned,
- r0 is double-word aligned, but r1 is not double-word aligned. */
-
- /* Initialize the queue. */
- ldr r5, [r1], #4
-
- /* Compare two words in every iteration. */
- .p2align 2
-3:
- pld [r0, #16]
- pld [r1, #16]
-
- /* Load the next double-word from each string and compare. */
- ldrd r2, r3, [r0], #8
- magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
- ldrd r4, r5, [r1], #8
- magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
- b 3b
-
- .macro miscmp_word offsetlo offsethi
- /* Macro to compare misaligned strings. */
- /* r0, r1 are word-aligned, and at least one of the strings
- is not double-word aligned. */
- /* Compare one word in every loop iteration. */
- /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
- OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word). */
-
- /* Initialize the shift queue. */
- ldr r5, [r1], #4
-
- /* Compare one word from each string in every loop iteration. */
- .p2align 2
-7:
- ldr r3, [r0], #4
- S2LOMEM r5, r5, #\offsetlo
- magic_find_zero_bytes w1=r3
- cmp r7, ip, S2HIMEM #\offsetlo
- and r2, r3, r6, S2LOMEM #\offsetlo
- it eq
- cmpeq r2, r5
- bne .L_return_25
- ldr r5, [r1], #4
- cmp ip, #0
- eor r3, r2, r3
- S2HIMEM r2, r5, #\offsethi
- it eq
- cmpeq r3, r2
- bne .L_return_32
- b 7b
- .endm /* miscmp_word */
-
-.L_strcmp_unaligned:
- /* r0 is word-aligned, r1 is at offset ip from a word. */
- /* Align r1 to the (previous) word-boundary. */
- bic r1, r1, #3
-
- /* Unaligned comparison word by word using LDRs. */
- cmp ip, #2
- beq .L_miscmp_word_16 /* If ip == 2. */
- bge .L_miscmp_word_24 /* If ip == 3. */
- miscmp_word offsetlo=8 offsethi=24 /* If ip == 1. */
-.L_miscmp_word_16: miscmp_word offsetlo=16 offsethi=16
-.L_miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
-
-
-.L_return_32:
- setup_return w1=r3, w2=r2
- b .L_do_return
-.L_return_34:
- setup_return w1=r3, w2=r4
- b .L_do_return
-.L_return_25:
- setup_return w1=r2, w2=r5
- b .L_do_return
-.L_return_35:
- setup_return w1=r3, w2=r5
- b .L_do_return
-.L_return_24:
- setup_return w1=r2, w2=r4
-
-.L_do_return:
-
-#ifdef __ARMEB__
- mov r0, ip
-#else /* not __ARMEB__ */
- rev r0, ip
-#endif /* not __ARMEB__ */
-
- /* Restore temporaries early, before computing the return value. */
- ldrd r6, r7, [sp]
- ldrd r4, r5, [sp, #8]
- adds sp, sp, #16
- .cfi_def_cfa_offset 0
- .cfi_restore r4
- .cfi_restore r5
- .cfi_restore r6
- .cfi_restore r7
-
- /* There is a zero or a different byte between r1 and r2. */
- /* r0 contains a mask of all-zero bytes in r1. */
- /* Using r0 and not ip here because cbz requires low register. */
- m_cbz reg=r0, label=.L_compute_return_value
- clz r0, r0
- /* r0 contains the number of bits on the left of the first all-zero byte in r1. */
- rsb r0, r0, #24
- /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1. */
- lsr r1, r1, r0
- lsr r2, r2, r0
-
-.L_compute_return_value:
- movs r0, #1
- cmp r1, r2
- /* The return value is computed as follows.
- If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
- If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
- which means r0:=r0-r0-1 and r0 is #-1 at return.
- If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
- which means r0:=r0-r0 and r0 is #0 at return.
- (C==0 and Z==1) cannot happen because the carry bit is "not borrow". */
- it ls
- sbcls r0, r0, r0
- bx lr
+L_earlyReturn:
+// Return the difference between the last two characters loaded.
+ sub r0, r2, ip
+ bx lr
END(strcmp)
diff --git a/libc/arch-arm/cortex-a15/bionic/strlen.S b/libc/arch-arm/cortex-a15/bionic/strlen.S
index 4fd6284..121d9ac 100644
--- a/libc/arch-arm/cortex-a15/bionic/strlen.S
+++ b/libc/arch-arm/cortex-a15/bionic/strlen.S
@@ -1,165 +1,91 @@
/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
+ * Copyright (c) 2011 Apple, Inc. 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.
+ * @APPLE_LICENSE_HEADER_START@
*
- * 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.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
- * 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 company may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
+ * @APPLE_LICENSE_HEADER_END@
*/
#include <private/bionic_asm.h>
- .syntax unified
+.syntax unified
+.code 32
- .thumb
- .thumb_func
+#define addr r0
+#define word r1
+#define temp r2
+#define mask r3
+#define save ip
+#define indx r0
+.macro IfWordDoesntContainNUL_SetZ
+// In each word of the string, we check for NUL bytes via a saturating
+// unsigned subtraction of each byte from 0x1. The result of this is
+// non-zero if and only if the corresponding byte in the string is NUL.
+// Simply using a TST instruction checks all four bytes for NULs in one
+// go.
+ uqsub8 temp, mask, word
+ tst temp, temp
+.endm
+
+.text
+.align 4
+.long 0x0 // padding
+.long 0x01010101 // mask for use in finding NULs
ENTRY(strlen)
- pld [r0, #0]
- mov r1, r0
+// Establish stack frame, load mask that we will use to find NUL bytes,
+// and set aside a copy of the pointer to the string.
+ push {r7,lr}
+ mov r7, sp
+ ldr mask, (strlen-4)
+ add save, addr, #4
- ands r3, r0, #7
- beq .L_mainloop
+// Load the aligned word that contains the start of the string, then OR
+// 0x01 into any bytes that preceed the start of the string to prevent
+// false positives when we check for NUL bytes.
+ and temp, addr, #3
+ bic addr, addr, #3
+ lsl temp, temp, #3
+ ldr word, [addr], #4
+ rsb temp, temp, #32
+ orr word, word, mask, lsr temp
- // Align to a double word (64 bits).
- rsb r3, r3, #8
- lsls ip, r3, #31
- beq .L_align_to_32
+// Check if the string ends in the first word. If so, don't load any
+// more of the string; instead jump directly to the cleanup code.
+ IfWordDoesntContainNUL_SetZ
+ bne 1f
- ldrb r2, [r1], #1
- cbz r2, .L_update_count_and_return
+.align 4
+// Load one word of the string on each iteration, and check it for NUL
+// bytes. If a NUL is found, fall through into the cleanup code.
+0: ldr word, [addr], #4
+ IfWordDoesntContainNUL_SetZ
+ beq 0b
-.L_align_to_32:
- bcc .L_align_to_64
- ands ip, r3, #2
- beq .L_align_to_64
+// The last word that we loaded contained a NUL. Subtracting the saved
+// pointer from the current pointer gives us the number of bytes from
+// the start of the string to the word containing the NUL.
+1: sub indx, addr, save
+// To that we add the index of the first NUL byte in the word, computed
+// using REV and CLZ followed by a shift.
+ rev temp, temp
+ clz temp, temp
+ add indx, indx, temp, lsr #3
+ pop {r7,pc}
- ldrb r2, [r1], #1
- cbz r2, .L_update_count_and_return
- ldrb r2, [r1], #1
- cbz r2, .L_update_count_and_return
-
-.L_align_to_64:
- tst r3, #4
- beq .L_mainloop
- ldr r3, [r1], #4
-
- sub ip, r3, #0x01010101
- bic ip, ip, r3
- ands ip, ip, #0x80808080
- bne .L_zero_in_second_register
-
- .p2align 2
-.L_mainloop:
- ldrd r2, r3, [r1], #8
-
- pld [r1, #64]
-
- sub ip, r2, #0x01010101
- bic ip, ip, r2
- ands ip, ip, #0x80808080
- bne .L_zero_in_first_register
-
- sub ip, r3, #0x01010101
- bic ip, ip, r3
- ands ip, ip, #0x80808080
- bne .L_zero_in_second_register
- b .L_mainloop
-
-.L_update_count_and_return:
- sub r0, r1, r0
- sub r0, r0, #1
- bx lr
-
-.L_zero_in_first_register:
- sub r0, r1, r0
- lsls r3, ip, #17
- bne .L_sub8_and_return
- bcs .L_sub7_and_return
- lsls ip, ip, #1
- bne .L_sub6_and_return
-
- sub r0, r0, #5
- bx lr
-
-.L_sub8_and_return:
- sub r0, r0, #8
- bx lr
-
-.L_sub7_and_return:
- sub r0, r0, #7
- bx lr
-
-.L_sub6_and_return:
- sub r0, r0, #6
- bx lr
-
-.L_zero_in_second_register:
- sub r0, r1, r0
- lsls r3, ip, #17
- bne .L_sub4_and_return
- bcs .L_sub3_and_return
- lsls ip, ip, #1
- bne .L_sub2_and_return
-
- sub r0, r0, #1
- bx lr
-
-.L_sub4_and_return:
- sub r0, r0, #4
- bx lr
-
-.L_sub3_and_return:
- sub r0, r0, #3
- bx lr
-
-.L_sub2_and_return:
- sub r0, r0, #2
- bx lr
END(strlen)
diff --git a/libc/arch-arm/generic/bionic/memchr.S b/libc/arch-arm/generic/bionic/memchr.S
new file mode 100644
index 0000000..cb00d82
--- /dev/null
+++ b/libc/arch-arm/generic/bionic/memchr.S
@@ -0,0 +1,155 @@
+/* Copyright (c) 2010-2015, Linaro Limited
+ 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 Linaro Limited 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
+ HOLDER 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.
+ */
+
+/*
+ Written by Dave Gilbert <david.gilbert@linaro.org>
+
+ This memchr routine is optimised on a Cortex-A9 and should work on
+ all ARMv7 processors. It has a fast past for short sizes, and has
+ an optimised path for large data sets; the worst case is finding the
+ match early in a large data set.
+
+ */
+
+#include <private/bionic_asm.h>
+
+@ 2011-02-07 david.gilbert@linaro.org
+@ Extracted from local git a5b438d861
+@ 2011-07-14 david.gilbert@linaro.org
+@ Import endianness fix from local git ea786f1b
+@ 2011-12-07 david.gilbert@linaro.org
+@ Removed unneeded cbz from align loop
+
+ .syntax unified
+ .arch armv7-a
+
+@ this lets us check a flag in a 00/ff byte easily in either endianness
+#ifdef __ARMEB__
+#define CHARTSTMASK(c) 1<<(31-(c*8))
+#else
+#define CHARTSTMASK(c) 1<<(c*8)
+#endif
+ .text
+ .thumb
+
+@ ---------------------------------------------------------------------------
+ .thumb_func
+ENTRY(memchr)
+ .p2align 4,,15
+ @ r0 = start of memory to scan
+ @ r1 = character to look for
+ @ r2 = length
+ @ returns r0 = pointer to character or NULL if not found
+ and r1,r1,#0xff @ Don't think we can trust the caller to actually pass a char
+
+ cmp r2,#16 @ If it's short don't bother with anything clever
+ blt 20f
+
+ tst r0, #7 @ If it's already aligned skip the next bit
+ beq 10f
+
+ @ Work up to an aligned point
+5:
+ ldrb r3, [r0],#1
+ subs r2, r2, #1
+ cmp r3, r1
+ beq 50f @ If it matches exit found
+ tst r0, #7
+ bne 5b @ If not aligned yet then do next byte
+
+10:
+ @ At this point, we are aligned, we know we have at least 8 bytes to work with
+ push {r4,r5,r6,r7}
+ orr r1, r1, r1, lsl #8 @ expand the match word across to all bytes
+ orr r1, r1, r1, lsl #16
+ bic r4, r2, #7 @ Number of double words to work with
+ mvns r7, #0 @ all F's
+ movs r3, #0
+
+15:
+ ldrd r5,r6,[r0],#8
+ subs r4, r4, #8
+ eor r5,r5, r1 @ Get it so that r5,r6 have 00's where the bytes match the target
+ eor r6,r6, r1
+ uadd8 r5, r5, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0
+ sel r5, r3, r7 @ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
+ uadd8 r6, r6, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0
+ sel r6, r5, r7 @ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
+ cbnz r6, 60f
+ bne 15b @ (Flags from the subs above) If not run out of bytes then go around again
+
+ pop {r4,r5,r6,r7}
+ and r1,r1,#0xff @ Get r1 back to a single character from the expansion above
+ and r2,r2,#7 @ Leave the count remaining as the number after the double words have been done
+
+20:
+ cbz r2, 40f @ 0 length or hit the end already then not found
+
+21: @ Post aligned section, or just a short call
+ ldrb r3,[r0],#1
+ subs r2,r2,#1
+ eor r3,r3,r1 @ r3 = 0 if match - doesn't break flags from sub
+ cbz r3, 50f
+ bne 21b @ on r2 flags
+
+40:
+ movs r0,#0 @ not found
+ bx lr
+
+50:
+ subs r0,r0,#1 @ found
+ bx lr
+
+60: @ We're here because the fast path found a hit - now we have to track down exactly which word it was
+ @ r0 points to the start of the double word after the one that was tested
+ @ r5 has the 00/ff pattern for the first word, r6 has the chained value
+ cmp r5, #0
+ itte eq
+ moveq r5, r6 @ the end is in the 2nd word
+ subeq r0,r0,#3 @ Points to 2nd byte of 2nd word
+ subne r0,r0,#7 @ or 2nd byte of 1st word
+
+ @ r0 currently points to the 3rd byte of the word containing the hit
+ tst r5, # CHARTSTMASK(0) @ 1st character
+ bne 61f
+ adds r0,r0,#1
+ tst r5, # CHARTSTMASK(1) @ 2nd character
+ ittt eq
+ addeq r0,r0,#1
+ tsteq r5, # (3<<15) @ 2nd & 3rd character
+ @ If not the 3rd must be the last one
+ addeq r0,r0,#1
+
+61:
+ pop {r4,r5,r6,r7}
+ subs r0,r0,#1
+ bx lr
+END(memchr)
diff --git a/libc/arch-arm/generic/bionic/memcmp.S b/libc/arch-arm/generic/bionic/memcmp.S
index 6643d55..886d899 100644
--- a/libc/arch-arm/generic/bionic/memcmp.S
+++ b/libc/arch-arm/generic/bionic/memcmp.S
@@ -63,7 +63,7 @@
* Neon optimization
* Comparing 32 bytes at a time
*/
-#if defined(__ARM_NEON__) && defined(NEON_UNALIGNED_ACCESS)
+#if defined(__ARM_NEON__) && defined(__ARM_FEATURE_UNALIGNED)
subs r2, r2, #32
blo 3f
diff --git a/libc/arch-arm/kryo/bionic/memcpy.S b/libc/arch-arm/kryo/bionic/memcpy.S
new file mode 100644
index 0000000..a1243d4
--- /dev/null
+++ b/libc/arch-arm/kryo/bionic/memcpy.S
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Copyright (c) 2009-2011, Code Aurora Forum. 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 <private/libc_events.h>
+
+#define PLDOFFS (16)
+#define PLDSIZE (128) /* L2 cache line size */
+
+ .code 32
+ENTRY(__memcpy_chk)
+ cmp r2, r3
+ bhi __memcpy_chk_fail
+
+ // Fall through to memcpy...
+END(__memcpy_chk)
+
+ENTRY(memcpy)
+ push {r0}
+ cmp r2, #4
+ blt .Lneon_lt4
+ cmp r2, #16
+ blt .Lneon_lt16
+ cmp r2, #32
+ blt .Lneon_16
+ cmp r2, #128
+ blt .Lneon_copy_32_a
+ /* Copy blocks of 128-bytes (word-aligned) at a time*/
+ /* Code below is optimized for PLDSIZE=128 only */
+ mov r12, r2, lsr #7
+ cmp r12, #PLDOFFS
+ ble .Lneon_copy_128_loop_nopld
+ sub r12, #PLDOFFS
+ pld [r1, #(PLDOFFS-1)*PLDSIZE]
+.Lneon_copy_128_loop_outer:
+ pld [r1, #(PLDOFFS*PLDSIZE)]
+ vld1.32 {q0, q1}, [r1]!
+ vld1.32 {q2, q3}, [r1]!
+ vld1.32 {q8, q9}, [r1]!
+ vld1.32 {q10, q11}, [r1]!
+ subs r12, r12, #1
+ vst1.32 {q0, q1}, [r0]!
+ vst1.32 {q2, q3}, [r0]!
+ vst1.32 {q8, q9}, [r0]!
+ vst1.32 {q10, q11}, [r0]!
+ bne .Lneon_copy_128_loop_outer
+ mov r12, #PLDOFFS
+.Lneon_copy_128_loop_nopld:
+ vld1.32 {q0, q1}, [r1]!
+ vld1.32 {q2, q3}, [r1]!
+ vld1.32 {q8, q9}, [r1]!
+ vld1.32 {q10, q11}, [r1]!
+ subs r12, r12, #1
+ vst1.32 {q0, q1}, [r0]!
+ vst1.32 {q2, q3}, [r0]!
+ vst1.32 {q8, q9}, [r0]!
+ vst1.32 {q10, q11}, [r0]!
+ bne .Lneon_copy_128_loop_nopld
+ ands r2, r2, #0x7f
+ beq .Lneon_exit
+ cmp r2, #32
+ blt .Lneon_16
+ nop
+ /* Copy blocks of 32-bytes (word aligned) at a time*/
+.Lneon_copy_32_a:
+ mov r12, r2, lsr #5
+.Lneon_copy_32_loop_a:
+ vld1.32 {q0,q1}, [r1]!
+ subs r12, r12, #1
+ vst1.32 {q0,q1}, [r0]!
+ bne .Lneon_copy_32_loop_a
+ ands r2, r2, #0x1f
+ beq .Lneon_exit
+.Lneon_16:
+ subs r2, r2, #16
+ blt .Lneon_lt16
+ vld1.32 {q8}, [r1]!
+ vst1.32 {q8}, [r0]!
+ beq .Lneon_exit
+.Lneon_lt16:
+ movs r12, r2, lsl #29
+ bcc .Lneon_skip8
+ ldr r3, [r1], #4
+ ldr r12, [r1], #4
+ str r3, [r0], #4
+ str r12, [r0], #4
+.Lneon_skip8:
+ bpl .Lneon_lt4
+ ldr r3, [r1], #4
+ str r3, [r0], #4
+.Lneon_lt4:
+ movs r2, r2, lsl #31
+ bcc .Lneon_lt2
+ ldrh r3, [r1], #2
+ strh r3, [r0], #2
+.Lneon_lt2:
+ bpl .Lneon_exit
+ ldrb r12, [r1]
+ strb r12, [r0]
+.Lneon_exit:
+ pop {r0}
+ bx lr
+
+END(memcpy)
+
+ // Only reached when the __memcpy_chk check fails.
+ENTRY_PRIVATE(__memcpy_chk_fail)
+ // Preserve lr for backtrace.
+ push {lr}
+ .cfi_def_cfa_offset 4
+ .cfi_rel_offset lr, 0
+
+ ldr r0, error_message
+ ldr r1, error_code
+1:
+ add r0, pc
+ bl __fortify_chk_fail
+error_code:
+ .word BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
+error_message:
+ .word error_string-(1b+8)
+END(__memcpy_chk_fail)
+
+ .data
+error_string:
+ .string "memcpy: prevented write past end of buffer"
diff --git a/libc/arch-arm/kryo/bionic/memmove.S b/libc/arch-arm/kryo/bionic/memmove.S
new file mode 100644
index 0000000..8685d51
--- /dev/null
+++ b/libc/arch-arm/kryo/bionic/memmove.S
@@ -0,0 +1,281 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ * Copyright (c) 2013-2014 NVIDIA 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.
+ *
+ * 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 <private/libc_events.h>
+
+ .text
+ .syntax unified
+ .fpu neon
+
+#define CACHE_LINE_SIZE (128)
+#define MEMCPY_BLOCK_SIZE_SMALL (32768)
+#define MEMCPY_BLOCK_SIZE_MID (1048576)
+#define PREFETCH_DISTANCE_NEAR (CACHE_LINE_SIZE*4)
+#define PREFETCH_DISTANCE_MID (CACHE_LINE_SIZE*4)
+#define PREFETCH_DISTANCE_FAR (CACHE_LINE_SIZE*16)
+
+ENTRY(memmove)
+ cmp r2, #0
+ cmpne r0, r1
+ bxeq lr
+ subs r3, r0, r1
+ bls .L_jump_to_memcpy
+ cmp r2, r3
+ bhi .L_reversed_memcpy
+
+.L_jump_to_memcpy:
+ b memcpy
+
+.L_reversed_memcpy:
+ push {r0, lr}
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset r0, 0
+ .cfi_rel_offset lr, 4
+
+ add r0, r0, r2
+ add r1, r1, r2
+
+ /* preload next cache line */
+ pld [r1, #-CACHE_LINE_SIZE]
+ pld [r1, #-CACHE_LINE_SIZE*2]
+
+.L_reversed_memcpy_align_dest:
+ /* Deal with very small blocks (< 32bytes) asap */
+ cmp r2, #32
+ blo .L_reversed_memcpy_lt_32bytes
+ /* no need to align if len < 128 bytes */
+ cmp r2, #128
+ blo .L_reversed_memcpy_lt_128bytes
+ /* align destination to 64 bytes (1 cache line) */
+ ands r3, r0, #0x3f
+ beq .L_reversed_memcpy_dispatch
+ sub r2, r2, r3
+0: /* copy 1 byte */
+ movs ip, r3, lsl #31
+ ldrbmi ip, [r1, #-1]!
+ strbmi ip, [r0, #-1]!
+1: /* copy 2 bytes */
+ ldrbcs ip, [r1, #-1]!
+ strbcs ip, [r0, #-1]!
+ ldrbcs ip, [r1, #-1]!
+ strbcs ip, [r0, #-1]!
+2: /* copy 4 bytes */
+ movs ip, r3, lsl #29
+ bpl 3f
+ sub r1, r1, #4
+ sub r0, r0, #4
+ vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]
+ vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]
+3: /* copy 8 bytes */
+ bcc 4f
+ sub r1, r1, #8
+ sub r0, r0, #8
+ vld1.8 {d0}, [r1]
+ vst1.8 {d0}, [r0, :64]
+4: /* copy 16 bytes */
+ movs ip, r3, lsl #27
+ bpl 5f
+ sub r1, r1, #16
+ sub r0, r0, #16
+ vld1.8 {q0}, [r1]
+ vst1.8 {q0}, [r0, :128]
+5: /* copy 32 bytes */
+ bcc .L_reversed_memcpy_dispatch
+ sub r1, r1, #32
+ sub r0, r0, #32
+ vld1.8 {q0, q1}, [r1]
+ vst1.8 {q0, q1}, [r0, :256]
+
+.L_reversed_memcpy_dispatch:
+ /* preload more cache lines */
+ pld [r1, #-CACHE_LINE_SIZE*3]
+ pld [r1, #-CACHE_LINE_SIZE*4]
+
+ cmp r2, #MEMCPY_BLOCK_SIZE_SMALL
+ blo .L_reversed_memcpy_neon_pld_near
+ cmp r2, #MEMCPY_BLOCK_SIZE_MID
+ blo .L_reversed_memcpy_neon_pld_mid
+ b .L_reversed_memcpy_neon_pld_far
+
+.L_reversed_memcpy_neon_pld_near:
+ /* less than 128 bytes? */
+ subs r2, r2, #128
+ blo 1f
+ sub r1, r1, #32
+ sub r0, r0, #32
+ mov r3, #-32
+ .align 4
+0:
+ /* copy 128 bytes in each loop */
+ subs r2, r2, #128
+
+ /* preload to cache */
+ pld [r1, #-(PREFETCH_DISTANCE_NEAR+CACHE_LINE_SIZE*2)+32]
+ /* copy a cache line */
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+
+ /* preload to cache */
+ pld [r1, #-(PREFETCH_DISTANCE_NEAR+CACHE_LINE_SIZE*2)+32]
+ /* copy a cache line */
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+
+ bhs 0b
+ add r1, r1, #32
+ add r0, r0, #32
+1:
+ adds r2, r2, #128
+ bne .L_reversed_memcpy_lt_128bytes
+ pop {r0, pc}
+
+.L_reversed_memcpy_neon_pld_mid:
+ subs r2, r2, #128
+ sub r1, r1, #32
+ sub r0, r0, #32
+ mov r3, #-32
+ .align 4
+0:
+ /* copy 128 bytes in each loop */
+ subs r2, r2, #128
+
+ /* preload to cache */
+ pld [r1, #-(PREFETCH_DISTANCE_MID+CACHE_LINE_SIZE)+32]
+ /* copy a cache line */
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+
+ /* preload to cache */
+ pld [r1, #-(PREFETCH_DISTANCE_MID+CACHE_LINE_SIZE)+32]
+ /* copy a cache line */
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+ vld1.8 {q0, q1}, [r1], r3
+ vst1.8 {q0, q1}, [r0, :256], r3
+
+ bhs 0b
+ add r1, r1, #32
+ add r0, r0, #32
+1:
+ adds r2, r2, #128
+ bne .L_reversed_memcpy_lt_128bytes
+ pop {r0, pc}
+
+.L_reversed_memcpy_neon_pld_far:
+ sub r2, r2, #128
+ sub r0, r0, #128
+ sub r1, r1, #128
+ .align 4
+0:
+ /* copy 128 bytes in each loop */
+ subs r2, r2, #128
+
+ /* preload to cache */
+ pld [r1, #-(PREFETCH_DISTANCE_FAR+CACHE_LINE_SIZE*2)+128]
+ pld [r1, #-(PREFETCH_DISTANCE_FAR+CACHE_LINE_SIZE)+128]
+ /* read */
+ vld1.8 {q0, q1}, [r1]!
+ vld1.8 {q2, q3}, [r1]!
+ vld1.8 {q8, q9}, [r1]!
+ vld1.8 {q10, q11}, [r1]!
+ /* write */
+ vst1.8 {q0, q1}, [r0, :256]!
+ vst1.8 {q2, q3}, [r0, :256]!
+ vst1.8 {q8, q9}, [r0, :256]!
+ vst1.8 {q10, q11}, [r0, :256]!
+
+ sub r0, r0, #256
+ sub r1, r1, #256
+ bhs 0b
+ add r0, r0, #128
+ add r1, r1, #128
+1:
+ adds r2, r2, #128
+ bne .L_reversed_memcpy_lt_128bytes
+ pop {r0, pc}
+
+.L_reversed_memcpy_lt_128bytes:
+6: /* copy 64 bytes */
+ movs ip, r2, lsl #26
+ bcc 5f
+ sub r1, r1, #32
+ sub r0, r0, #32
+ vld1.8 {q0, q1}, [r1]
+ vst1.8 {q0, q1}, [r0]
+ sub r1, r1, #32
+ sub r0, r0, #32
+ vld1.8 {q0, q1}, [r1]
+ vst1.8 {q0, q1}, [r0]
+5: /* copy 32 bytes */
+ bpl 4f
+ sub r1, r1, #32
+ sub r0, r0, #32
+ vld1.8 {q0, q1}, [r1]
+ vst1.8 {q0, q1}, [r0]
+.L_reversed_memcpy_lt_32bytes:
+4: /* copy 16 bytes */
+ movs ip, r2, lsl #28
+ bcc 3f
+ sub r1, r1, #16
+ sub r0, r0, #16
+ vld1.8 {q0}, [r1]
+ vst1.8 {q0}, [r0]
+3: /* copy 8 bytes */
+ bpl 2f
+ sub r1, r1, #8
+ sub r0, r0, #8
+ vld1.8 {d0}, [r1]
+ vst1.8 {d0}, [r0]
+2: /* copy 4 bytes */
+ ands ip, r2, #0x4
+ beq 1f
+ sub r1, r1, #4
+ sub r0, r0, #4
+ vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]
+ vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]
+1: /* copy 2 bytes */
+ movs ip, r2, lsl #31
+ ldrbcs ip, [r1, #-1]!
+ strbcs ip, [r0, #-1]!
+ ldrbcs ip, [r1, #-1]!
+ strbcs ip, [r0, #-1]!
+0: /* copy 1 byte */
+ ldrbmi ip, [r1, #-1]!
+ strbmi ip, [r0, #-1]!
+
+ pop {r0, pc}
+
+END(memmove)
diff --git a/libc/arch-arm/kryo/kryo.mk b/libc/arch-arm/kryo/kryo.mk
new file mode 100644
index 0000000..be7ae25
--- /dev/null
+++ b/libc/arch-arm/kryo/kryo.mk
@@ -0,0 +1,27 @@
+libc_openbsd_src_files_exclude_arm += \
+ upstream-openbsd/lib/libc/string/memmove.c \
+ upstream-openbsd/lib/libc/string/stpcpy.c \
+ upstream-openbsd/lib/libc/string/strcat.c \
+
+libc_bionic_src_files_exclude_arm += \
+ arch-arm/generic/bionic/memcpy.S \
+ arch-arm/generic/bionic/memset.S \
+ arch-arm/generic/bionic/strcmp.S \
+ arch-arm/generic/bionic/strcpy.S \
+ arch-arm/generic/bionic/strlen.c \
+
+libc_bionic_src_files_arm += \
+ arch-arm/kryo/bionic/memcpy.S \
+ arch-arm/kryo/bionic/memmove.S \
+ arch-arm/krait/bionic/strcmp.S
+
+# Use cortex-a15 versions of strcat/strcpy/strlen and standard memmove
+libc_bionic_src_files_arm += \
+ arch-arm/cortex-a15/bionic/stpcpy.S \
+ arch-arm/cortex-a15/bionic/strcat.S \
+ arch-arm/cortex-a15/bionic/strcpy.S \
+ arch-arm/cortex-a15/bionic/strlen.S \
+
+# Use cortex-a53 memset
+libc_bionic_src_files_arm += \
+ arch-arm/cortex-a7/bionic/memset.S \
diff --git a/libc/arch-arm/scorpion/scorpion.mk b/libc/arch-arm/scorpion/scorpion.mk
new file mode 100644
index 0000000..3046b68
--- /dev/null
+++ b/libc/arch-arm/scorpion/scorpion.mk
@@ -0,0 +1,28 @@
+libc_openbsd_src_files_exclude_arm += \
+ upstream-openbsd/lib/libc/string/memmove.c \
+ upstream-openbsd/lib/libc/string/stpcpy.c \
+ upstream-openbsd/lib/libc/string/strcat.c \
+
+libc_bionic_src_files_exclude_arm += \
+ arch-arm/generic/bionic/memcpy.S \
+ arch-arm/generic/bionic/memset.S \
+ arch-arm/generic/bionic/strcmp.S \
+ arch-arm/generic/bionic/strcpy.S \
+ arch-arm/generic/bionic/strlen.c \
+ bionic/__strcat_chk.cpp \
+ bionic/__strcpy_chk.cpp \
+
+libc_bionic_src_files_arm += \
+ arch-arm/cortex-a15/bionic/memcpy.S \
+ arch-arm/cortex-a15/bionic/stpcpy.S \
+ arch-arm/cortex-a15/bionic/strcat.S \
+ arch-arm/cortex-a15/bionic/__strcat_chk.S \
+ arch-arm/cortex-a15/bionic/strcpy.S \
+ arch-arm/cortex-a15/bionic/__strcpy_chk.S \
+ arch-arm/cortex-a15/bionic/strlen.S \
+
+# Use krait versions of memset/strcmp/memmove
+libc_bionic_src_files_arm += \
+ arch-arm/krait/bionic/memset.S \
+ arch-arm/krait/bionic/strcmp.S \
+ arch-arm/krait/bionic/memmove.S
diff --git a/libc/arch-arm/syscalls/__sendmsg.S b/libc/arch-arm/syscalls/sendmsg.S
similarity index 90%
rename from libc/arch-arm/syscalls/__sendmsg.S
rename to libc/arch-arm/syscalls/sendmsg.S
index 6c63a6c..215219a 100644
--- a/libc/arch-arm/syscalls/__sendmsg.S
+++ b/libc/arch-arm/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
mov ip, r7
.cfi_register r7, ip
ldr r7, =__NR_sendmsg
@@ -13,4 +13,4 @@
bxls lr
neg r0, r0
b __set_errno_internal
-END(__sendmsg)
+END(sendmsg)
diff --git a/libc/arch-arm/syscalls/__sendto.S b/libc/arch-arm/syscalls/sendto.S
similarity index 94%
rename from libc/arch-arm/syscalls/__sendto.S
rename to libc/arch-arm/syscalls/sendto.S
index b8cc406..29b7b0b 100644
--- a/libc/arch-arm/syscalls/__sendto.S
+++ b/libc/arch-arm/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
.cfi_def_cfa_offset 16
@@ -19,4 +19,4 @@
bxls lr
neg r0, r0
b __set_errno_internal
-END(__sendto)
+END(sendto)
diff --git a/libc/arch-arm/syscalls/__writev.S b/libc/arch-arm/syscalls/writev.S
similarity index 91%
rename from libc/arch-arm/syscalls/__writev.S
rename to libc/arch-arm/syscalls/writev.S
index aa3d9bc..3103237 100644
--- a/libc/arch-arm/syscalls/__writev.S
+++ b/libc/arch-arm/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
mov ip, r7
.cfi_register r7, ip
ldr r7, =__NR_writev
@@ -13,4 +13,4 @@
bxls lr
neg r0, r0
b __set_errno_internal
-END(__writev)
+END(writev)
diff --git a/libc/arch-arm64/arm64.mk b/libc/arch-arm64/arm64.mk
index 589fc3b..2da806c 100644
--- a/libc/arch-arm64/arm64.mk
+++ b/libc/arch-arm64/arm64.mk
@@ -3,7 +3,6 @@
#
# Generic arm64 optimizations, may be overriden by CPU variants.
#
-ifeq ($(TARGET_CPU_VARIANT),generic)
libc_bionic_src_files_arm64 += \
arch-arm64/generic/bionic/memchr.S \
arch-arm64/generic/bionic/memcmp.S \
@@ -17,14 +16,14 @@
arch-arm64/generic/bionic/strlen.S \
arch-arm64/generic/bionic/strncmp.S \
arch-arm64/generic/bionic/strnlen.S \
+ arch-arm64/generic/bionic/strrchr.S \
arch-arm64/generic/bionic/wmemmove.S \
-endif
-
libc_bionic_src_files_exclude_arm64 += \
bionic/__memcpy_chk.cpp \
bionic/strchr.cpp \
bionic/strnlen.c \
+ bionic/strrchr.cpp \
libc_freebsd_src_files_exclude_arm64 += \
upstream-freebsd/lib/libc/string/wmemmove.c \
@@ -36,6 +35,7 @@
upstream-openbsd/lib/libc/string/strcpy.c \
upstream-openbsd/lib/libc/string/strncmp.c \
+
#
# Inherently architecture-specific code.
#
diff --git a/libc/arch-arm64/generic/bionic/memcpy_base.S b/libc/arch-arm64/generic/bionic/memcpy_base.S
index c5d42ce..f850624 100644
--- a/libc/arch-arm64/generic/bionic/memcpy_base.S
+++ b/libc/arch-arm64/generic/bionic/memcpy_base.S
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, Linaro Limited
+/* Copyright (c) 2012-2013, Linaro Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -22,158 +22,196 @@
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.
-*/
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/*
+ * Copyright (c) 2015 ARM Ltd
+ * 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 company may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
+ */
/* Assumptions:
*
- * ARMv8-a, AArch64
- * Unaligned accesses
+ * ARMv8-a, AArch64, unaligned accesses.
*
*/
+#include <private/bionic_asm.h>
+
#define dstin x0
#define src x1
#define count x2
-#define tmp1 x3
-#define tmp1w w3
-#define tmp2 x4
-#define tmp2w w4
-#define tmp3 x5
-#define tmp3w w5
-#define dst x6
+#define dst x3
+#define srcend x4
+#define dstend x5
+#define A_l x6
+#define A_lw w6
+#define A_h x7
+#define A_hw w7
+#define B_l x8
+#define B_lw w8
+#define B_h x9
+#define C_l x10
+#define C_h x11
+#define D_l x12
+#define D_h x13
+#define E_l src
+#define E_h count
+#define F_l srcend
+#define F_h dst
+#define tmp1 x9
-#define A_l x7
-#define A_h x8
-#define B_l x9
-#define B_h x10
-#define C_l x11
-#define C_h x12
-#define D_l x13
-#define D_h x14
+#define L(l) .L ## l
- mov dst, dstin
- cmp count, #64
- b.ge .Lcpy_not_short
- cmp count, #15
- b.le .Ltail15tiny
+/* Copies are split into 3 main cases: small copies of up to 16 bytes,
+ medium copies of 17..96 bytes which are fully unrolled. Large copies
+ of more than 96 bytes align the destination and use an unrolled loop
+ processing 64 bytes per iteration.
+ Small and medium copies read all data before writing, allowing any
+ kind of overlap, and memmove tailcalls memcpy for these cases as
+ well as non-overlapping copies.
+*/
- /* Deal with small copies quickly by dropping straight into the
- * exit block. */
-.Ltail63:
- /* Copy up to 48 bytes of data. At this point we only need the
- * bottom 6 bits of count to be accurate. */
- ands tmp1, count, #0x30
- b.eq .Ltail15
- add dst, dst, tmp1
- add src, src, tmp1
- cmp tmp1w, #0x20
- b.eq 1f
- b.lt 2f
- ldp A_l, A_h, [src, #-48]
- stp A_l, A_h, [dst, #-48]
-1:
- ldp A_l, A_h, [src, #-32]
- stp A_l, A_h, [dst, #-32]
-2:
- ldp A_l, A_h, [src, #-16]
- stp A_l, A_h, [dst, #-16]
+ prfm PLDL1KEEP, [src]
+ add srcend, src, count
+ add dstend, dstin, count
+ cmp count, 16
+ b.ls L(copy16)
+ cmp count, 96
+ b.hi L(copy_long)
-.Ltail15:
- ands count, count, #15
- beq 1f
- add src, src, count
- ldp A_l, A_h, [src, #-16]
- add dst, dst, count
- stp A_l, A_h, [dst, #-16]
-1:
- ret
-
-.Ltail15tiny:
- /* Copy up to 15 bytes of data. Does not assume additional data
- being copied. */
- tbz count, #3, 1f
- ldr tmp1, [src], #8
- str tmp1, [dst], #8
-1:
- tbz count, #2, 1f
- ldr tmp1w, [src], #4
- str tmp1w, [dst], #4
-1:
- tbz count, #1, 1f
- ldrh tmp1w, [src], #2
- strh tmp1w, [dst], #2
-1:
- tbz count, #0, 1f
- ldrb tmp1w, [src]
- strb tmp1w, [dst]
-1:
- ret
-
-.Lcpy_not_short:
- /* We don't much care about the alignment of DST, but we want SRC
- * to be 128-bit (16 byte) aligned so that we don't cross cache line
- * boundaries on both loads and stores. */
- neg tmp2, src
- ands tmp2, tmp2, #15 /* Bytes to reach alignment. */
- b.eq 2f
- sub count, count, tmp2
- /* Copy more data than needed; it's faster than jumping
- * around copying sub-Quadword quantities. We know that
- * it can't overrun. */
+ /* Medium copies: 17..96 bytes. */
+ sub tmp1, count, 1
ldp A_l, A_h, [src]
- add src, src, tmp2
- stp A_l, A_h, [dst]
- add dst, dst, tmp2
- /* There may be less than 63 bytes to go now. */
- cmp count, #63
- b.le .Ltail63
-2:
- subs count, count, #128
- b.ge .Lcpy_body_large
- /* Less than 128 bytes to copy, so handle 64 here and then jump
- * to the tail. */
- ldp A_l, A_h, [src]
- ldp B_l, B_h, [src, #16]
- ldp C_l, C_h, [src, #32]
- ldp D_l, D_h, [src, #48]
- stp A_l, A_h, [dst]
- stp B_l, B_h, [dst, #16]
- stp C_l, C_h, [dst, #32]
- stp D_l, D_h, [dst, #48]
- tst count, #0x3f
- add src, src, #64
- add dst, dst, #64
- b.ne .Ltail63
+ tbnz tmp1, 6, L(copy96)
+ ldp D_l, D_h, [srcend, -16]
+ tbz tmp1, 5, 1f
+ ldp B_l, B_h, [src, 16]
+ ldp C_l, C_h, [srcend, -32]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstend, -32]
+1:
+ stp A_l, A_h, [dstin]
+ stp D_l, D_h, [dstend, -16]
ret
- /* Critical loop. Start at a new cache line boundary. Assuming
- * 64 bytes per line this ensures the entire loop is in one line. */
- .p2align 6
-.Lcpy_body_large:
- /* There are at least 128 bytes to copy. */
- ldp A_l, A_h, [src, #0]
- sub dst, dst, #16 /* Pre-bias. */
- ldp B_l, B_h, [src, #16]
- ldp C_l, C_h, [src, #32]
- ldp D_l, D_h, [src, #48]! /* src += 64 - Pre-bias. */
+ .p2align 4
+
+ /* Small copies: 0..16 bytes. */
+L(copy16):
+ cmp count, 8
+ b.lo 1f
+ ldr A_l, [src]
+ ldr A_h, [srcend, -8]
+ str A_l, [dstin]
+ str A_h, [dstend, -8]
+ ret
+ .p2align 4
1:
- stp A_l, A_h, [dst, #16]
- ldp A_l, A_h, [src, #16]
- stp B_l, B_h, [dst, #32]
- ldp B_l, B_h, [src, #32]
- stp C_l, C_h, [dst, #48]
- ldp C_l, C_h, [src, #48]
- stp D_l, D_h, [dst, #64]!
- ldp D_l, D_h, [src, #64]!
- subs count, count, #64
- b.ge 1b
- stp A_l, A_h, [dst, #16]
- stp B_l, B_h, [dst, #32]
- stp C_l, C_h, [dst, #48]
- stp D_l, D_h, [dst, #64]
- add src, src, #16
- add dst, dst, #64 + 16
- tst count, #0x3f
- b.ne .Ltail63
+ tbz count, 2, 1f
+ ldr A_lw, [src]
+ ldr A_hw, [srcend, -4]
+ str A_lw, [dstin]
+ str A_hw, [dstend, -4]
+ ret
+
+ /* Copy 0..3 bytes. Use a branchless sequence that copies the same
+ byte 3 times if count==1, or the 2nd byte twice if count==2. */
+1:
+ cbz count, 2f
+ lsr tmp1, count, 1
+ ldrb A_lw, [src]
+ ldrb A_hw, [srcend, -1]
+ ldrb B_lw, [src, tmp1]
+ strb A_lw, [dstin]
+ strb B_lw, [dstin, tmp1]
+ strb A_hw, [dstend, -1]
+2: ret
+
+ .p2align 4
+ /* Copy 64..96 bytes. Copy 64 bytes from the start and
+ 32 bytes from the end. */
+L(copy96):
+ ldp B_l, B_h, [src, 16]
+ ldp C_l, C_h, [src, 32]
+ ldp D_l, D_h, [src, 48]
+ ldp E_l, E_h, [srcend, -32]
+ ldp F_l, F_h, [srcend, -16]
+ stp A_l, A_h, [dstin]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstin, 32]
+ stp D_l, D_h, [dstin, 48]
+ stp E_l, E_h, [dstend, -32]
+ stp F_l, F_h, [dstend, -16]
+ ret
+
+ /* Align DST to 16 byte alignment so that we don't cross cache line
+ boundaries on both loads and stores. There are at least 96 bytes
+ to copy, so copy 16 bytes unaligned and then align. The loop
+ copies 64 bytes per iteration and prefetches one iteration ahead. */
+
+ .p2align 4
+L(copy_long):
+ and tmp1, dstin, 15
+ bic dst, dstin, 15
+ ldp D_l, D_h, [src]
+ sub src, src, tmp1
+ add count, count, tmp1 /* Count is now 16 too large. */
+ ldp A_l, A_h, [src, 16]
+ stp D_l, D_h, [dstin]
+ ldp B_l, B_h, [src, 32]
+ ldp C_l, C_h, [src, 48]
+ ldp D_l, D_h, [src, 64]!
+ subs count, count, 128 + 16 /* Test and readjust count. */
+ b.ls 2f
+1:
+ stp A_l, A_h, [dst, 16]
+ ldp A_l, A_h, [src, 16]
+ stp B_l, B_h, [dst, 32]
+ ldp B_l, B_h, [src, 32]
+ stp C_l, C_h, [dst, 48]
+ ldp C_l, C_h, [src, 48]
+ stp D_l, D_h, [dst, 64]!
+ ldp D_l, D_h, [src, 64]!
+ subs count, count, 64
+ b.hi 1b
+
+ /* Write the last full set of 64 bytes. The remainder is at most 64
+ bytes, so it is safe to always copy 64 bytes from the end even if
+ there is just 1 byte left. */
+2:
+ ldp E_l, E_h, [srcend, -64]
+ stp A_l, A_h, [dst, 16]
+ ldp A_l, A_h, [srcend, -48]
+ stp B_l, B_h, [dst, 32]
+ ldp B_l, B_h, [srcend, -32]
+ stp C_l, C_h, [dst, 48]
+ ldp C_l, C_h, [srcend, -16]
+ stp D_l, D_h, [dst, 64]
+ stp E_l, E_h, [dstend, -64]
+ stp A_l, A_h, [dstend, -48]
+ stp B_l, B_h, [dstend, -32]
+ stp C_l, C_h, [dstend, -16]
ret
diff --git a/libc/arch-arm64/generic/bionic/memset.S b/libc/arch-arm64/generic/bionic/memset.S
index 7c204b4..4b3b17b 100644
--- a/libc/arch-arm64/generic/bionic/memset.S
+++ b/libc/arch-arm64/generic/bionic/memset.S
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, Linaro Limited
+/* Copyright (c) 2012-2013, Linaro Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -22,226 +22,207 @@
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.
-*/
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/*
+ * Copyright (c) 2015 ARM Ltd
+ * 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 company may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
+ */
/* Assumptions:
*
- * ARMv8-a, AArch64
- * Unaligned accesses
+ * ARMv8-a, AArch64, unaligned accesses
*
*/
#include <private/bionic_asm.h>
-/* By default we assume that the DC instruction can be used to zero
- data blocks more efficiently. In some circumstances this might be
- unsafe, for example in an asymmetric multiprocessor environment with
- different DC clear lengths (neither the upper nor lower lengths are
- safe to use).
+#define dstin x0
+#define val x1
+#define valw w1
+#define count x2
+#define dst x3
+#define dstend x4
+#define tmp1 x5
+#define tmp1w w5
+#define tmp2 x6
+#define tmp2w w6
+#define zva_len x7
+#define zva_lenw w7
- If code may be run in a virtualized environment, then define
- MAYBE_VIRT. This will cause the code to cache the system register
- values rather than re-reading them each call. */
+#define L(l) .L ## l
-#define dstin x0
-#ifdef BZERO
-#define count x1
-#else
-#define count x2
-#endif
-#define val w1
-#define tmp1 x3
-#define tmp1w w3
-#define tmp2 x4
-#define tmp2w w4
-#define zva_len_x x5
-#define zva_len w5
-#define zva_bits_x x6
-
-#define A_l x7
-#define A_lw w7
-#define dst x8
-#define tmp3w w9
-
-#ifdef BZERO
-ENTRY(bzero)
-#else
ENTRY(memset)
-#endif
- mov dst, dstin /* Preserve return value. */
-#ifdef BZERO
- b .Lzero_mem
-#endif
- ands A_lw, val, #255
- b.eq .Lzero_mem
- orr A_lw, A_lw, A_lw, lsl #8
- orr A_lw, A_lw, A_lw, lsl #16
- orr A_l, A_l, A_l, lsl #32
-.Ltail_maybe_long:
- cmp count, #64
- b.ge .Lnot_short
-.Ltail_maybe_tiny:
- cmp count, #15
- b.le .Ltail15tiny
-.Ltail63:
- ands tmp1, count, #0x30
- b.eq .Ltail15
- add dst, dst, tmp1
- cmp tmp1w, #0x20
- b.eq 1f
- b.lt 2f
- stp A_l, A_l, [dst, #-48]
-1:
- stp A_l, A_l, [dst, #-32]
-2:
- stp A_l, A_l, [dst, #-16]
+ dup v0.16B, valw
+ add dstend, dstin, count
-.Ltail15:
- and count, count, #15
- add dst, dst, count
- stp A_l, A_l, [dst, #-16] /* Repeat some/all of last store. */
+ cmp count, 96
+ b.hi L(set_long)
+ cmp count, 16
+ b.hs L(set_medium)
+ mov val, v0.D[0]
+
+ /* Set 0..15 bytes. */
+ tbz count, 3, 1f
+ str val, [dstin]
+ str val, [dstend, -8]
+ ret
+ nop
+1: tbz count, 2, 2f
+ str valw, [dstin]
+ str valw, [dstend, -4]
+ ret
+2: cbz count, 3f
+ strb valw, [dstin]
+ tbz count, 1, 3f
+ strh valw, [dstend, -2]
+3: ret
+
+ /* Set 17..96 bytes. */
+L(set_medium):
+ str q0, [dstin]
+ tbnz count, 6, L(set96)
+ str q0, [dstend, -16]
+ tbz count, 5, 1f
+ str q0, [dstin, 16]
+ str q0, [dstend, -32]
+1: ret
+
+ .p2align 4
+ /* Set 64..96 bytes. Write 64 bytes from the start and
+ 32 bytes from the end. */
+L(set96):
+ str q0, [dstin, 16]
+ stp q0, q0, [dstin, 32]
+ stp q0, q0, [dstend, -32]
ret
-.Ltail15tiny:
- /* Set up to 15 bytes. Does not assume earlier memory
- being set. */
- tbz count, #3, 1f
- str A_l, [dst], #8
-1:
- tbz count, #2, 1f
- str A_lw, [dst], #4
-1:
- tbz count, #1, 1f
- strh A_lw, [dst], #2
-1:
- tbz count, #0, 1f
- strb A_lw, [dst]
-1:
+ .p2align 3
+ nop
+L(set_long):
+ and valw, valw, 255
+ bic dst, dstin, 15
+ str q0, [dstin]
+ cmp count, 256
+ ccmp valw, 0, 0, cs
+ b.eq L(try_zva)
+L(no_zva):
+ sub count, dstend, dst /* Count is 16 too large. */
+ add dst, dst, 16
+ sub count, count, 64 + 16 /* Adjust count and bias for loop. */
+1: stp q0, q0, [dst], 64
+ stp q0, q0, [dst, -32]
+L(tail64):
+ subs count, count, 64
+ b.hi 1b
+2: stp q0, q0, [dstend, -64]
+ stp q0, q0, [dstend, -32]
ret
- /* Critical loop. Start at a new cache line boundary. Assuming
- * 64 bytes per line, this ensures the entire loop is in one line. */
- .p2align 6
-.Lnot_short:
- neg tmp2, dst
- ands tmp2, tmp2, #15
- b.eq 2f
- /* Bring DST to 128-bit (16-byte) alignment. We know that there's
- * more than that to set, so we simply store 16 bytes and advance by
- * the amount required to reach alignment. */
- sub count, count, tmp2
- stp A_l, A_l, [dst]
- add dst, dst, tmp2
- /* There may be less than 63 bytes to go now. */
- cmp count, #63
- b.le .Ltail63
-2:
- sub dst, dst, #16 /* Pre-bias. */
- sub count, count, #64
-1:
- stp A_l, A_l, [dst, #16]
- stp A_l, A_l, [dst, #32]
- stp A_l, A_l, [dst, #48]
- stp A_l, A_l, [dst, #64]!
- subs count, count, #64
- b.ge 1b
- tst count, #0x3f
- add dst, dst, #16
- b.ne .Ltail63
- ret
-
- /* For zeroing memory, check to see if we can use the ZVA feature to
- * zero entire 'cache' lines. */
-.Lzero_mem:
- mov A_l, #0
- cmp count, #63
- b.le .Ltail_maybe_tiny
- neg tmp2, dst
- ands tmp2, tmp2, #15
- b.eq 1f
- sub count, count, tmp2
- stp A_l, A_l, [dst]
- add dst, dst, tmp2
- cmp count, #63
- b.le .Ltail63
-1:
- /* For zeroing small amounts of memory, it's not worth setting up
- * the line-clear code. */
- cmp count, #128
- b.lt .Lnot_short
-#ifdef MAYBE_VIRT
- /* For efficiency when virtualized, we cache the ZVA capability. */
- adrp tmp2, .Lcache_clear
- ldr zva_len, [tmp2, #:lo12:.Lcache_clear]
- tbnz zva_len, #31, .Lnot_short
- cbnz zva_len, .Lzero_by_line
+ .p2align 3
+L(try_zva):
mrs tmp1, dczid_el0
- tbz tmp1, #4, 1f
- /* ZVA not available. Remember this for next time. */
- mov zva_len, #~0
- str zva_len, [tmp2, #:lo12:.Lcache_clear]
- b .Lnot_short
-1:
- mov tmp3w, #4
- and zva_len, tmp1w, #15 /* Safety: other bits reserved. */
- lsl zva_len, tmp3w, zva_len
- str zva_len, [tmp2, #:lo12:.Lcache_clear]
-#else
- mrs tmp1, dczid_el0
- tbnz tmp1, #4, .Lnot_short
- mov tmp3w, #4
- and zva_len, tmp1w, #15 /* Safety: other bits reserved. */
- lsl zva_len, tmp3w, zva_len
-#endif
+ tbnz tmp1w, 4, L(no_zva)
+ and tmp1w, tmp1w, 15
+ cmp tmp1w, 4 /* ZVA size is 64 bytes. */
+ b.ne L(zva_128)
-.Lzero_by_line:
- /* Compute how far we need to go to become suitably aligned. We're
- * already at quad-word alignment. */
- cmp count, zva_len_x
- b.lt .Lnot_short /* Not enough to reach alignment. */
- sub zva_bits_x, zva_len_x, #1
- neg tmp2, dst
- ands tmp2, tmp2, zva_bits_x
- b.eq 1f /* Already aligned. */
- /* Not aligned, check that there's enough to copy after alignment. */
- sub tmp1, count, tmp2
- cmp tmp1, #64
- ccmp tmp1, zva_len_x, #8, ge /* NZCV=0b1000 */
- b.lt .Lnot_short
- /* We know that there's at least 64 bytes to zero and that it's safe
- * to overrun by 64 bytes. */
- mov count, tmp1
-2:
- stp A_l, A_l, [dst]
- stp A_l, A_l, [dst, #16]
- stp A_l, A_l, [dst, #32]
- subs tmp2, tmp2, #64
- stp A_l, A_l, [dst, #48]
- add dst, dst, #64
- b.ge 2b
- /* We've overrun a bit, so adjust dst downwards. */
- add dst, dst, tmp2
-1:
- sub count, count, zva_len_x
-3:
- dc zva, dst
- add dst, dst, zva_len_x
- subs count, count, zva_len_x
- b.ge 3b
- ands count, count, zva_bits_x
- b.ne .Ltail_maybe_long
+ /* Write the first and last 64 byte aligned block using stp rather
+ than using DC ZVA. This is faster on some cores.
+ */
+L(zva_64):
+ str q0, [dst, 16]
+ stp q0, q0, [dst, 32]
+ bic dst, dst, 63
+ stp q0, q0, [dst, 64]
+ stp q0, q0, [dst, 96]
+ sub count, dstend, dst /* Count is now 128 too large. */
+ sub count, count, 128+64+64 /* Adjust count and bias for loop. */
+ add dst, dst, 128
+ nop
+1: dc zva, dst
+ add dst, dst, 64
+ subs count, count, 64
+ b.hi 1b
+ stp q0, q0, [dst, 0]
+ stp q0, q0, [dst, 32]
+ stp q0, q0, [dstend, -64]
+ stp q0, q0, [dstend, -32]
ret
-#ifdef BZERO
-END(bzero)
-#else
+
+ .p2align 3
+L(zva_128):
+ cmp tmp1w, 5 /* ZVA size is 128 bytes. */
+ b.ne L(zva_other)
+
+ str q0, [dst, 16]
+ stp q0, q0, [dst, 32]
+ stp q0, q0, [dst, 64]
+ stp q0, q0, [dst, 96]
+ bic dst, dst, 127
+ sub count, dstend, dst /* Count is now 128 too large. */
+ sub count, count, 128+128 /* Adjust count and bias for loop. */
+ add dst, dst, 128
+1: dc zva, dst
+ add dst, dst, 128
+ subs count, count, 128
+ b.hi 1b
+ stp q0, q0, [dstend, -128]
+ stp q0, q0, [dstend, -96]
+ stp q0, q0, [dstend, -64]
+ stp q0, q0, [dstend, -32]
+ ret
+
+L(zva_other):
+ mov tmp2w, 4
+ lsl zva_lenw, tmp2w, tmp1w
+ add tmp1, zva_len, 64 /* Max alignment bytes written. */
+ cmp count, tmp1
+ blo L(no_zva)
+
+ sub tmp2, zva_len, 1
+ add tmp1, dst, zva_len
+ add dst, dst, 16
+ subs count, tmp1, dst /* Actual alignment bytes to write. */
+ bic tmp1, tmp1, tmp2 /* Aligned dc zva start address. */
+ beq 2f
+1: stp q0, q0, [dst], 64
+ stp q0, q0, [dst, -32]
+ subs count, count, 64
+ b.hi 1b
+2: mov dst, tmp1
+ sub count, dstend, tmp1 /* Remaining bytes to write. */
+ subs count, count, zva_len
+ b.lo 4f
+3: dc zva, dst
+ add dst, dst, zva_len
+ subs count, count, zva_len
+ b.hs 3b
+4: add count, count, zva_len
+ b L(tail64)
+
END(memset)
-#endif
-
-#ifdef MAYBE_VIRT
- .bss
- .p2align 2
-.Lcache_clear:
- .space 4
-#endif
diff --git a/libc/arch-arm64/generic/bionic/strcmp.S b/libc/arch-arm64/generic/bionic/strcmp.S
index 3cce478..8b2b134 100644
--- a/libc/arch-arm64/generic/bionic/strcmp.S
+++ b/libc/arch-arm64/generic/bionic/strcmp.S
@@ -55,8 +55,13 @@
#define zeroones x10
#define pos x11
- /* Start of performance-critical section -- one 64B cache line. */
ENTRY(strcmp)
+ prfm pldl1strm, [src1]
+ prfm pldl1strm, [src2]
+ b .Lperf_critical
+.align 6
+.Lperf_critical:
+ /* Start of performance-critical section -- one 64B cache line. */
eor tmp1, src1, src2
mov zeroones, #REP8_01
tst tmp1, #7
@@ -70,6 +75,8 @@
ldr data1, [src1], #8
ldr data2, [src2], #8
.Lstart_realigned:
+ prfm pldl1strm, [src1]
+ prfm pldl1strm, [src2]
sub tmp1, data1, zeroones
orr tmp2, data1, #REP8_7f
eor diff, data1, data2 /* Non-zero if differences found. */
diff --git a/libc/arch-arm64/generic/bionic/strlen.S b/libc/arch-arm64/generic/bionic/strlen.S
index 3bd9809..6e540fc 100644
--- a/libc/arch-arm64/generic/bionic/strlen.S
+++ b/libc/arch-arm64/generic/bionic/strlen.S
@@ -1,16 +1,16 @@
-/* Copyright (c) 2014, Linaro Limited
+/* Copyright (c) 2013-2015, Linaro Limited
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.
+ 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.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
* Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
+ 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
@@ -22,16 +22,19 @@
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.
-*/
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* Assumptions:
*
- * ARMv8-a, AArch64
+ * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
*/
#include <private/bionic_asm.h>
+/* To test the page crossing code path more thoroughly, compile with
+ -DTEST_PAGE_CROSS - this will force all calls through the slower
+ entry path. This option is not intended for production use. */
+
/* Arguments and results. */
#define srcin x0
#define len x0
@@ -40,87 +43,185 @@
#define src x1
#define data1 x2
#define data2 x3
-#define data2a x4
-#define has_nul1 x5
-#define has_nul2 x6
-#define tmp1 x7
-#define tmp2 x8
-#define tmp3 x9
-#define tmp4 x10
-#define zeroones x11
-#define pos x12
+#define has_nul1 x4
+#define has_nul2 x5
+#define tmp1 x4
+#define tmp2 x5
+#define tmp3 x6
+#define tmp4 x7
+#define zeroones x8
+
+#define L(l) .L ## l
+
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. A faster check
+ (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
+ false hits for characters 129..255. */
#define REP8_01 0x0101010101010101
#define REP8_7f 0x7f7f7f7f7f7f7f7f
#define REP8_80 0x8080808080808080
- /* Start of critial section -- keep to one 64Byte cache line. */
-ENTRY(strlen)
- mov zeroones, #REP8_01
- bic src, srcin, #15
- ands tmp1, srcin, #15
- b.ne .Lmisaligned
- /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
- (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
- can be done in parallel across the entire word. */
- /* The inner loop deals with two Dwords at a time. This has a
- slightly higher start-up cost, but we should win quite quickly,
- especially on cores with a high number of issue slots per
- cycle, as we get much better parallelism out of the operations. */
-.Lloop:
- ldp data1, data2, [src], #16
-.Lrealigned:
- sub tmp1, data1, zeroones
- orr tmp2, data1, #REP8_7f
- sub tmp3, data2, zeroones
- orr tmp4, data2, #REP8_7f
- bic has_nul1, tmp1, tmp2
- bics has_nul2, tmp3, tmp4
- ccmp has_nul1, #0, #0, eq /* NZCV = 0000 */
- b.eq .Lloop
- /* End of critical section -- keep to one 64Byte cache line. */
-
- sub len, src, srcin
- cbz has_nul1, .Lnul_in_data2
-#ifdef __AARCH64EB__
- mov data2, data1
+#ifdef TEST_PAGE_CROSS
+# define MIN_PAGE_SIZE 15
+#else
+# define MIN_PAGE_SIZE 4096
#endif
- sub len, len, #8
- mov has_nul2, has_nul1
-.Lnul_in_data2:
+
+ /* Since strings are short on average, we check the first 16 bytes
+ of the string for a NUL character. In order to do an unaligned ldp
+ safely we have to do a page cross check first. If there is a NUL
+ byte we calculate the length from the 2 8-byte words using
+ conditional select to reduce branch mispredictions (it is unlikely
+ strlen will be repeatedly called on strings with the same length).
+
+ If the string is longer than 16 bytes, we align src so don't need
+ further page cross checks, and process 32 bytes per iteration
+ using the fast NUL check. If we encounter non-ASCII characters,
+ fallback to a second loop using the full NUL check.
+
+ If the page cross check fails, we read 16 bytes from an aligned
+ address, remove any characters before the string, and continue
+ in the main loop using aligned loads. Since strings crossing a
+ page in the first 16 bytes are rare (probability of
+ 16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
+
+ AArch64 systems have a minimum page size of 4k. We don't bother
+ checking for larger page sizes - the cost of setting up the correct
+ page size is just not worth the extra gain from a small reduction in
+ the cases taking the slow path. Note that we only care about
+ whether the first fetch, which may be misaligned, crosses a page
+ boundary. */
+
+ENTRY(strlen)
+ and tmp1, srcin, MIN_PAGE_SIZE - 1
+ mov zeroones, REP8_01
+ cmp tmp1, MIN_PAGE_SIZE - 16
+ b.gt L(page_cross)
+ ldp data1, data2, [srcin]
#ifdef __AARCH64EB__
/* For big-endian, carry propagation (if the final byte in the
- string is 0x01) means we cannot use has_nul directly. The
- easiest way to get the correct byte is to byte-swap the data
- and calculate the syndrome a second time. */
+ string is 0x01) means we cannot use has_nul1/2 directly.
+ Since we expect strings to be small and early-exit,
+ byte-swap the data now so has_null1/2 will be correct. */
+ rev data1, data1
rev data2, data2
- sub tmp1, data2, zeroones
- orr tmp2, data2, #REP8_7f
- bic has_nul2, tmp1, tmp2
#endif
- sub len, len, #8
- rev has_nul2, has_nul2
- clz pos, has_nul2
- add len, len, pos, lsr #3 /* Bits to bytes. */
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(main_loop_entry)
+
+ /* Enter with C = has_nul1 == 0. */
+ csel has_nul1, has_nul1, has_nul2, cc
+ mov len, 8
+ rev has_nul1, has_nul1
+ clz tmp1, has_nul1
+ csel len, xzr, len, cc
+ add len, len, tmp1, lsr 3
ret
-.Lmisaligned:
- cmp tmp1, #8
- neg tmp1, tmp1
- ldp data1, data2, [src], #16
- lsl tmp1, tmp1, #3 /* Bytes beyond alignment -> bits. */
- mov tmp2, #~0
+ /* The inner loop processes 32 bytes per iteration and uses the fast
+ NUL check. If we encounter non-ASCII characters, use a second
+ loop with the accurate NUL check. */
+ .p2align 4
+L(main_loop_entry):
+ bic src, srcin, 15
+ sub src, src, 16
+L(main_loop):
+ ldp data1, data2, [src, 32]!
+.Lpage_cross_entry:
+ sub tmp1, data1, zeroones
+ sub tmp3, data2, zeroones
+ orr tmp2, tmp1, tmp3
+ tst tmp2, zeroones, lsl 7
+ bne 1f
+ ldp data1, data2, [src, 16]
+ sub tmp1, data1, zeroones
+ sub tmp3, data2, zeroones
+ orr tmp2, tmp1, tmp3
+ tst tmp2, zeroones, lsl 7
+ beq L(main_loop)
+ add src, src, 16
+1:
+ /* The fast check failed, so do the slower, accurate NUL check. */
+ orr tmp2, data1, REP8_7f
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(nonascii_loop)
+
+ /* Enter with C = has_nul1 == 0. */
+L(tail):
#ifdef __AARCH64EB__
- /* Big-endian. Early bytes are at MSB. */
- lsl tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+ /* For big-endian, carry propagation (if the final byte in the
+ string is 0x01) means we cannot use has_nul1/2 directly. The
+ easiest way to get the correct byte is to byte-swap the data
+ and calculate the syndrome a second time. */
+ csel data1, data1, data2, cc
+ rev data1, data1
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ bic has_nul1, tmp1, tmp2
+#else
+ csel has_nul1, has_nul1, has_nul2, cc
+#endif
+ sub len, src, srcin
+ rev has_nul1, has_nul1
+ add tmp2, len, 8
+ clz tmp1, has_nul1
+ csel len, len, tmp2, cc
+ add len, len, tmp1, lsr 3
+ ret
+
+L(nonascii_loop):
+ ldp data1, data2, [src, 16]!
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ bne L(tail)
+ ldp data1, data2, [src, 16]!
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(nonascii_loop)
+ b L(tail)
+
+ /* Load 16 bytes from [srcin & ~15] and force the bytes that precede
+ srcin to 0x7f, so we ignore any NUL bytes before the string.
+ Then continue in the aligned loop. */
+L(page_cross):
+ bic src, srcin, 15
+ ldp data1, data2, [src]
+ lsl tmp1, srcin, 3
+ mov tmp4, -1
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsr tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */
#else
/* Little-endian. Early bytes are at LSB. */
- lsr tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+ lsl tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */
#endif
- orr data1, data1, tmp2
- orr data2a, data2, tmp2
- csinv data1, data1, xzr, le
- csel data2, data2, data2a, le
- b .Lrealigned
+ orr tmp1, tmp1, REP8_80
+ orn data1, data1, tmp1
+ orn tmp2, data2, tmp1
+ tst srcin, 8
+ csel data1, data1, tmp4, eq
+ csel data2, data2, tmp2, eq
+ b L(page_cross_entry)
END(strlen)
diff --git a/libc/arch-arm64/generic/bionic/strrchr.S b/libc/arch-arm64/generic/bionic/strrchr.S
new file mode 100644
index 0000000..409bc71
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strrchr.S
@@ -0,0 +1,54 @@
+/*
+ strrchr - find last instance of a character in a string
+
+ Copyright (c) 2014, ARM Limited
+ 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 the company 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
+ HOLDER 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>
+
+/*
+ * Find the last occurrence of a character in a string.
+ *
+ * Parameters:
+ * x0 - str
+ * x1 - c
+ * Returns:
+ * x0 - address of last occurrence of 'c' or 0
+ */
+ENTRY(strrchr)
+ mov x3, #0
+ and w1, w1, #0xff
+1: ldrb w2, [x0], #1
+ cbz w2, 2f
+ cmp w2, w1
+ b.ne 1b
+ sub x3, x0, #1
+ b 1b
+2: mov x0, x3
+ ret
+END(strrchr)
diff --git a/libc/arch-arm64/kryo/kryo.mk b/libc/arch-arm64/kryo/kryo.mk
index b5b714e..7f3fe8c 100644
--- a/libc/arch-arm64/kryo/kryo.mk
+++ b/libc/arch-arm64/kryo/kryo.mk
@@ -1,14 +1,5 @@
libc_bionic_src_files_arm64 += \
- arch-arm64/generic/bionic/memchr.S \
- arch-arm64/generic/bionic/memcmp.S \
arch-arm64/kryo/bionic/memcpy.S \
- arch-arm64/generic/bionic/memmove.S \
- arch-arm64/generic/bionic/memset.S \
- arch-arm64/generic/bionic/stpcpy.S \
- arch-arm64/generic/bionic/strchr.S \
- arch-arm64/generic/bionic/strcmp.S \
- arch-arm64/generic/bionic/strcpy.S \
- arch-arm64/generic/bionic/strlen.S \
- arch-arm64/generic/bionic/strncmp.S \
- arch-arm64/generic/bionic/strnlen.S \
- arch-arm64/generic/bionic/wmemmove.S
+
+libc_bionic_src_files_exclude_arm64 += \
+ arch-arm64/generic/bionic/memcpy.S \
diff --git a/libc/arch-arm64/syscalls/__sendmsg.S b/libc/arch-arm64/syscalls/sendmsg.S
similarity index 81%
rename from libc/arch-arm64/syscalls/__sendmsg.S
rename to libc/arch-arm64/syscalls/sendmsg.S
index 50934c5..a343543 100644
--- a/libc/arch-arm64/syscalls/__sendmsg.S
+++ b/libc/arch-arm64/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
mov x8, __NR_sendmsg
svc #0
@@ -11,5 +11,4 @@
b.hi __set_errno_internal
ret
-END(__sendmsg)
-.hidden __sendmsg
+END(sendmsg)
diff --git a/libc/arch-arm64/syscalls/__sendto.S b/libc/arch-arm64/syscalls/sendto.S
similarity index 82%
rename from libc/arch-arm64/syscalls/__sendto.S
rename to libc/arch-arm64/syscalls/sendto.S
index f745546..6a6813e 100644
--- a/libc/arch-arm64/syscalls/__sendto.S
+++ b/libc/arch-arm64/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
mov x8, __NR_sendto
svc #0
@@ -11,5 +11,4 @@
b.hi __set_errno_internal
ret
-END(__sendto)
-.hidden __sendto
+END(sendto)
diff --git a/libc/arch-arm64/syscalls/__writev.S b/libc/arch-arm64/syscalls/writev.S
similarity index 82%
rename from libc/arch-arm64/syscalls/__writev.S
rename to libc/arch-arm64/syscalls/writev.S
index fcce9f0..baaffda 100644
--- a/libc/arch-arm64/syscalls/__writev.S
+++ b/libc/arch-arm64/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
mov x8, __NR_writev
svc #0
@@ -11,5 +11,4 @@
b.hi __set_errno_internal
ret
-END(__writev)
-.hidden __writev
+END(writev)
diff --git a/libc/arch-mips/syscalls/__sendmsg.S b/libc/arch-mips/syscalls/sendmsg.S
similarity index 89%
rename from libc/arch-mips/syscalls/__sendmsg.S
rename to libc/arch-mips/syscalls/sendmsg.S
index 8bc7800..88c653e 100644
--- a/libc/arch-mips/syscalls/__sendmsg.S
+++ b/libc/arch-mips/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
.set noreorder
.cpload t9
li v0, __NR_sendmsg
@@ -16,4 +16,4 @@
j t9
nop
.set reorder
-END(__sendmsg)
+END(sendmsg)
diff --git a/libc/arch-mips/syscalls/__sendto.S b/libc/arch-mips/syscalls/sendto.S
similarity index 89%
rename from libc/arch-mips/syscalls/__sendto.S
rename to libc/arch-mips/syscalls/sendto.S
index b0d60ab..ef3fa9f 100644
--- a/libc/arch-mips/syscalls/__sendto.S
+++ b/libc/arch-mips/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
.set noreorder
.cpload t9
li v0, __NR_sendto
@@ -16,4 +16,4 @@
j t9
nop
.set reorder
-END(__sendto)
+END(sendto)
diff --git a/libc/arch-mips/syscalls/__writev.S b/libc/arch-mips/syscalls/writev.S
similarity index 89%
rename from libc/arch-mips/syscalls/__writev.S
rename to libc/arch-mips/syscalls/writev.S
index 582dd1e..d8d6616 100644
--- a/libc/arch-mips/syscalls/__writev.S
+++ b/libc/arch-mips/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
.set noreorder
.cpload t9
li v0, __NR_writev
@@ -16,4 +16,4 @@
j t9
nop
.set reorder
-END(__writev)
+END(writev)
diff --git a/libc/arch-mips64/syscalls/__sendmsg.S b/libc/arch-mips64/syscalls/sendmsg.S
similarity index 87%
rename from libc/arch-mips64/syscalls/__sendmsg.S
rename to libc/arch-mips64/syscalls/sendmsg.S
index df2078d..519dce4 100644
--- a/libc/arch-mips64/syscalls/__sendmsg.S
+++ b/libc/arch-mips64/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
.set push
.set noreorder
li v0, __NR_sendmsg
@@ -22,5 +22,4 @@
j t9
move ra, t0
.set pop
-END(__sendmsg)
-.hidden __sendmsg
+END(sendmsg)
diff --git a/libc/arch-mips64/syscalls/__sendto.S b/libc/arch-mips64/syscalls/sendto.S
similarity index 88%
rename from libc/arch-mips64/syscalls/__sendto.S
rename to libc/arch-mips64/syscalls/sendto.S
index 7253d21..84efc09 100644
--- a/libc/arch-mips64/syscalls/__sendto.S
+++ b/libc/arch-mips64/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
.set push
.set noreorder
li v0, __NR_sendto
@@ -22,5 +22,4 @@
j t9
move ra, t0
.set pop
-END(__sendto)
-.hidden __sendto
+END(sendto)
diff --git a/libc/arch-mips64/syscalls/__writev.S b/libc/arch-mips64/syscalls/writev.S
similarity index 88%
rename from libc/arch-mips64/syscalls/__writev.S
rename to libc/arch-mips64/syscalls/writev.S
index fd3dddc..d103d71 100644
--- a/libc/arch-mips64/syscalls/__writev.S
+++ b/libc/arch-mips64/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
.set push
.set noreorder
li v0, __NR_writev
@@ -22,5 +22,4 @@
j t9
move ra, t0
.set pop
-END(__writev)
-.hidden __writev
+END(writev)
diff --git a/libc/arch-x86/syscalls/__sendmsg.S b/libc/arch-x86/syscalls/sendmsg.S
similarity index 95%
rename from libc/arch-x86/syscalls/__sendmsg.S
rename to libc/arch-x86/syscalls/sendmsg.S
index 9c518c4..775ebee 100644
--- a/libc/arch-x86/syscalls/__sendmsg.S
+++ b/libc/arch-x86/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_rel_offset ebx, 0
@@ -32,4 +32,4 @@
popl %ecx
popl %ebx
ret
-END(__sendmsg)
+END(sendmsg)
diff --git a/libc/arch-x86/syscalls/__sendto.S b/libc/arch-x86/syscalls/sendto.S
similarity index 95%
rename from libc/arch-x86/syscalls/__sendto.S
rename to libc/arch-x86/syscalls/sendto.S
index aae8fa4..2df5e4f 100644
--- a/libc/arch-x86/syscalls/__sendto.S
+++ b/libc/arch-x86/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_rel_offset ebx, 0
@@ -32,4 +32,4 @@
popl %ecx
popl %ebx
ret
-END(__sendto)
+END(sendto)
diff --git a/libc/arch-x86/syscalls/__writev.S b/libc/arch-x86/syscalls/writev.S
similarity index 96%
rename from libc/arch-x86/syscalls/__writev.S
rename to libc/arch-x86/syscalls/writev.S
index d252fca..6649905 100644
--- a/libc/arch-x86/syscalls/__writev.S
+++ b/libc/arch-x86/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_rel_offset ebx, 0
@@ -36,4 +36,4 @@
popl %ecx
popl %ebx
ret
-END(__writev)
+END(writev)
diff --git a/libc/arch-x86_64/syscalls/__sendmsg.S b/libc/arch-x86_64/syscalls/sendmsg.S
similarity index 83%
rename from libc/arch-x86_64/syscalls/__sendmsg.S
rename to libc/arch-x86_64/syscalls/sendmsg.S
index a6ff087..84566b5 100644
--- a/libc/arch-x86_64/syscalls/__sendmsg.S
+++ b/libc/arch-x86_64/syscalls/sendmsg.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendmsg)
+ENTRY(sendmsg)
movl $__NR_sendmsg, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@@ -12,5 +12,4 @@
call __set_errno_internal
1:
ret
-END(__sendmsg)
-.hidden __sendmsg
+END(sendmsg)
diff --git a/libc/arch-x86_64/syscalls/__sendto.S b/libc/arch-x86_64/syscalls/sendto.S
similarity index 85%
rename from libc/arch-x86_64/syscalls/__sendto.S
rename to libc/arch-x86_64/syscalls/sendto.S
index 9974485..be3bace 100644
--- a/libc/arch-x86_64/syscalls/__sendto.S
+++ b/libc/arch-x86_64/syscalls/sendto.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__sendto)
+ENTRY(sendto)
movq %rcx, %r10
movl $__NR_sendto, %eax
syscall
@@ -13,5 +13,4 @@
call __set_errno_internal
1:
ret
-END(__sendto)
-.hidden __sendto
+END(sendto)
diff --git a/libc/arch-x86_64/syscalls/__writev.S b/libc/arch-x86_64/syscalls/writev.S
similarity index 84%
rename from libc/arch-x86_64/syscalls/__writev.S
rename to libc/arch-x86_64/syscalls/writev.S
index ed2dd61..8f8956f 100644
--- a/libc/arch-x86_64/syscalls/__writev.S
+++ b/libc/arch-x86_64/syscalls/writev.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(__writev)
+ENTRY(writev)
movl $__NR_writev, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@@ -12,5 +12,4 @@
call __set_errno_internal
1:
ret
-END(__writev)
-.hidden __writev
+END(writev)
diff --git a/libc/bionic/__write_chk.cpp b/libc/bionic/__write_chk.cpp
index 459efdc..cbd247a 100644
--- a/libc/bionic/__write_chk.cpp
+++ b/libc/bionic/__write_chk.cpp
@@ -30,16 +30,7 @@
#include <unistd.h>
#include "private/libc_logging.h"
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatchWrite.h"
-#endif
extern "C" ssize_t __write_chk(int fd, const void* buf, size_t count, size_t buf_size) {
-
-#ifdef USE_WRAPPER
- if( __propClientDispatchWrite.propWrite ) {
- __propClientDispatchWrite.propWrite(fd);
- }
-#endif
if (__predict_false(count > buf_size)) {
__fortify_chk_fail("write: prevented read past end of buffer", 0);
}
diff --git a/libc/bionic/close.cpp b/libc/bionic/close.cpp
index 2d01965..18225f0 100644
--- a/libc/bionic/close.cpp
+++ b/libc/bionic/close.cpp
@@ -31,21 +31,8 @@
extern "C" int ___close(int);
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatch.h"
-#endif
-
int close(int fd) {
- int rc;
-#ifndef USE_WRAPPER
- rc = ___close(fd);
-#else
- if ( __propClientDispatch.propClose ) {
- rc = __propClientDispatch.propClose(fd);
- } else {
- rc = ___close(fd);
- }
-#endif
+ int rc = ___close(fd);
if (rc == -1 && errno == EINTR) {
// POSIX says that if close returns with EINTR, the fd must not be closed.
// Linus disagrees: http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 4f1226d..71c0b5f 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -243,6 +243,7 @@
"LD_ORIGIN_PATH",
"LD_PRELOAD",
"LD_PROFILE",
+ "LD_SHIM_LIBS",
"LD_SHOW_AUXV",
"LD_USE_LOAD_BIAS",
"LOCALDOMAIN",
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index e919d61..ab48fb8 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -57,11 +57,6 @@
extern "C" {
extern void netdClientInit(void);
-
-#ifdef USE_WRAPPER
- extern void propClientInit(void);
-#endif
-
extern int __cxa_atexit(void (*)(void *), void *, void *);
};
@@ -84,11 +79,6 @@
// Hooks for various libraries to let them know that we're starting up.
__libc_globals.mutate(__libc_init_malloc);
-
-#ifdef USE_WRAPPER
- propClientInit();
-#endif
-
netdClientInit();
}
diff --git a/libc/bionic/sendmsg.cpp b/libc/bionic/sendmsg.cpp
deleted file mode 100644
index d8a636b..0000000
--- a/libc/bionic/sendmsg.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 <unistd.h>
-#ifdef __i386__
-#define __socketcall __attribute__((__cdecl__))
-#else
-#define __socketcall
-#endif
-
-
-extern "C" __socketcall int __sendmsg(int fd, const struct msghdr* msg, unsigned int flags);
-
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatchWrite.h"
-#endif
-
-
-extern "C" int sendmsg(int fd, const struct msghdr* msg, unsigned int flags) {
-#ifndef USE_WRAPPER
- return __sendmsg(fd, msg, flags);
-#else
- if( __propClientDispatchWrite.propSendmsg ) {
- return __propClientDispatchWrite.propSendmsg(fd, msg, flags);
- } else {
- return __sendmsg(fd, msg, flags);
- }
-#endif
-}
diff --git a/libc/bionic/sendto.cpp b/libc/bionic/sendto.cpp
deleted file mode 100644
index 50ffc49..0000000
--- a/libc/bionic/sendto.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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.
- */
-
-#ifdef __i386__
-#define __socketcall __attribute__((__cdecl__))
-#else
-#define __socketcall
-#endif
-
-#include <unistd.h>
-extern "C" __socketcall int __sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
-
-#ifdef USE_WRAPPER
- #include "codeaurora/PropClientDispatchWrite.h"
-#endif
-
-extern "C" int sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) {
-#ifndef USE_WRAPPER
- return __sendto(fd, buf, len, flags, dest_addr,addrlen);
-#else
- if( __propClientDispatchWrite.propSendto ) {
- return __propClientDispatchWrite.propSendto(fd, buf, len, flags, dest_addr,addrlen);
- } else {
- return __sendto(fd, buf, len, flags, dest_addr,addrlen);
- }
-#endif
-}
diff --git a/libc/bionic/writev.cpp b/libc/bionic/writev.cpp
deleted file mode 100644
index 9e1c174..0000000
--- a/libc/bionic/writev.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 <unistd.h>
-extern "C" int __writev(int, const struct iovec*, int);
-#ifdef USE_WRAPPER
- #include "codeaurora/PropClientDispatchWrite.h"
-#endif
-
-extern "C" int writev(int fd, const struct iovec* iov, int iovcnt) {
-
-#ifdef USE_WRAPPER
- if( __propClientDispatchWrite.propWritev ) {
- __propClientDispatchWrite.propWritev(fd);
- }
-#endif
- return __writev(fd, iov, iovcnt);
-
-}
diff --git a/libc/codeaurora/PropClient.cpp b/libc/codeaurora/PropClient.cpp
deleted file mode 100644
index a9b0621..0000000
--- a/libc/codeaurora/PropClient.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 _PROPCLIENT_H_
-#define _PROPCLIENT_H_
-
-#ifdef LIBC_STATIC
-#error PropClient.cpp should NOT be included in static libc builds.
-#endif
-
-#include "private/libc_logging.h"
-#include <dlfcn.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include "codeaurora/PropClientDispatch.h"
-#include "codeaurora/PropClientDispatchWrite.h"
-
-static pthread_once_t propClientInitOnce = PTHREAD_ONCE_INIT;
-
-template <typename FunctionType>
-static void propClientInitFunction(void* handle, const char* symbol, FunctionType* function) {
- typedef void (*InitFunctionType)(FunctionType*);
- InitFunctionType initFunction = reinterpret_cast<InitFunctionType>(dlsym(handle, symbol));
- if (initFunction != NULL) {
- initFunction(function);
- }
-}
-
-static void propClientInitImpl() {
-
- void *propClientHandle = 0;
- typedef bool (*VendorExtFunctionType)();
- bool vendorExtFlag = false;
- propClientHandle = dlopen("libvendorconn.so", RTLD_NOW);
-
- if (propClientHandle != NULL) {
- VendorExtFunctionType vendorExtFunction = reinterpret_cast<VendorExtFunctionType>(dlsym(propClientHandle, "isVendorExtAvailable"));
- if( vendorExtFunction ) {
- vendorExtFlag = vendorExtFunction();
- }
- if( !vendorExtFlag || !vendorExtFunction ) {
- dlclose(propClientHandle);
- propClientHandle = NULL;
- return;
- }
- } else {
- // If the library is not available, it's not an error. We'll just use
- // default implementations of functions that it would've overridden.
- return;
- }
-
- propClientInitFunction(propClientHandle, "propClientInitSocket", &__propClientDispatch.propSocket);
-
- propClientInitFunction(propClientHandle, "propClientInitConnect", &__propClientDispatch.propConnect);
-
- propClientInitFunction(propClientHandle, "propClientInitWrite", &__propClientDispatchWrite.propWrite);
-
- propClientInitFunction(propClientHandle, "propClientInitWritev", &__propClientDispatchWrite.propWritev);
-
- propClientInitFunction(propClientHandle, "propClientInitSendmsg", &__propClientDispatchWrite.propSendmsg);
-
- propClientInitFunction(propClientHandle, "propClientInitSendto", &__propClientDispatchWrite.propSendto);
-
- propClientInitFunction(propClientHandle, "propClientInitGetHostByNameForNet", &__propClientDispatch.propGetHostByNameForNet);
-
- propClientInitFunction(propClientHandle, "propClientInitGetHostByAddrForNet", &__propClientDispatch.propGetHostByAddrForNet);
-
- propClientInitFunction(propClientHandle, "propClientInitGetAddrInfoForNet", &__propClientDispatch.propGetAddrInfoForNet);
-
- propClientInitFunction(propClientHandle, "propClientInitSendDnsReport", &__propClientDispatch.propSendDnsReport);
-
- propClientInitFunction(propClientHandle, "propClientInitClose", &__propClientDispatch.propClose);
-}
-
-extern "C" __LIBC_HIDDEN__ void propClientInit() {
- if (pthread_once(&propClientInitOnce, propClientInitImpl)) {
- __libc_format_log(ANDROID_LOG_ERROR, "propClient", "Failed to initialize prop_client");
- }
-}
-
-#endif /* !_PROPCLIENT_H_ */
diff --git a/libc/codeaurora/PropClientDispatch.cpp b/libc/codeaurora/PropClientDispatch.cpp
deleted file mode 100755
index 2891167..0000000
--- a/libc/codeaurora/PropClientDispatch.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 "codeaurora/PropClientDispatch.h"
-
-#ifdef __i386__
-#define __socketcall __attribute__((__cdecl__))
-#else
-#define __socketcall
-#endif
-
-int fallBackPropGetHostByNameForNet(const pid_t, const uid_t, const gid_t, const char*) {
- return -1;
-}
-
-int fallBackPropGetHostByAddrForNet(const pid_t, const uid_t, const gid_t, const void*) {
- return -1;
-}
-
-void fallBackPropSendDnsReport(const int) {
- return;
-}
-
-int fallBackPropGetAddrInfoForNet(const pid_t , const uid_t, const gid_t, const char*, const struct addrinfo *) {
- return -1;
-}
-
-extern "C" __socketcall int __socket(int, int, int);
-extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
-extern "C" int ___close(int);
-
-// This structure is modified only at startup (when libc.so is loaded) and never
-// afterwards, so it's okay that it's read later at runtime without a lock.
-PropClientDispatch __propClientDispatch __attribute__((aligned(32))) = {
- __socket,
- __connect,
- fallBackPropGetHostByNameForNet,
- fallBackPropGetHostByAddrForNet,
- fallBackPropGetAddrInfoForNet,
- fallBackPropSendDnsReport,
- ___close,
-};
diff --git a/libc/codeaurora/PropClientDispatchWrite.cpp b/libc/codeaurora/PropClientDispatchWrite.cpp
deleted file mode 100755
index 13e17bd..0000000
--- a/libc/codeaurora/PropClientDispatchWrite.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 "codeaurora/PropClientDispatchWrite.h"
-
-#ifdef __i386__
-#define __socketcall __attribute__((__cdecl__))
-#else
-#define __socketcall
-#endif
-
-void fallBackPropWrite(const int /*fd*/) {
-}
-
-void fallBackPropWritev(const int /*fd*/) {
-}
-
-extern "C" __socketcall int __sendmsg(int fd, const struct msghdr* msg, unsigned int flags);
-extern "C" __socketcall int __sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
-
-// This structure is modified only at startup (when libc.so is loaded) and never
-// afterwards, so it's okay that it's read later at runtime without a lock.
-PropClientDispatchWrite __propClientDispatchWrite __attribute__((aligned(32))) = {
- fallBackPropWrite,
- fallBackPropWritev,
- __sendmsg,
- __sendto,
-};
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
index fd6c004..0ac46c0 100644
--- a/libc/dns/net/getaddrinfo.c
+++ b/libc/dns/net/getaddrinfo.c
@@ -1805,10 +1805,14 @@
return -1;
}
}
- if (mark != MARK_UNSET && setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0)
+ if (mark != MARK_UNSET && setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0) {
+ close(sock);
return 0;
- if (uid > 0 && uid != NET_CONTEXT_INVALID_UID && fchown(sock, uid, (gid_t)-1) < 0)
+ }
+ if (uid > 0 && uid != NET_CONTEXT_INVALID_UID && fchown(sock, uid, (gid_t)-1) < 0) {
+ close(sock);
return 0;
+ }
do {
ret = __connect(sock, addr, len);
} while (ret == -1 && errno == EINTR);
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
new file mode 100644
index 0000000..48e20a2
--- /dev/null
+++ b/libc/include/bits/glibc-syscalls.h
@@ -0,0 +1,1225 @@
+/* Generated by gensyscalls.py. Do not edit. */
+#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_
+#define _BIONIC_BITS_GLIBC_SYSCALLS_H_
+#if defined(__NR_accept)
+ #define SYS_accept __NR_accept
+#endif
+#if defined(__NR_accept4)
+ #define SYS_accept4 __NR_accept4
+#endif
+#if defined(__NR_access)
+ #define SYS_access __NR_access
+#endif
+#if defined(__NR_acct)
+ #define SYS_acct __NR_acct
+#endif
+#if defined(__NR_add_key)
+ #define SYS_add_key __NR_add_key
+#endif
+#if defined(__NR_adjtimex)
+ #define SYS_adjtimex __NR_adjtimex
+#endif
+#if defined(__NR_afs_syscall)
+ #define SYS_afs_syscall __NR_afs_syscall
+#endif
+#if defined(__NR_alarm)
+ #define SYS_alarm __NR_alarm
+#endif
+#if defined(__NR_arch_prctl)
+ #define SYS_arch_prctl __NR_arch_prctl
+#endif
+#if defined(__NR_arch_specific_syscall)
+ #define SYS_arch_specific_syscall __NR_arch_specific_syscall
+#endif
+#if defined(__NR_arm_fadvise64_64)
+ #define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64
+#endif
+#if defined(__NR_arm_sync_file_range)
+ #define SYS_arm_sync_file_range __NR_arm_sync_file_range
+#endif
+#if defined(__NR_bdflush)
+ #define SYS_bdflush __NR_bdflush
+#endif
+#if defined(__NR_bind)
+ #define SYS_bind __NR_bind
+#endif
+#if defined(__NR_bpf)
+ #define SYS_bpf __NR_bpf
+#endif
+#if defined(__NR_break)
+ #define SYS_break __NR_break
+#endif
+#if defined(__NR_brk)
+ #define SYS_brk __NR_brk
+#endif
+#if defined(__NR_cachectl)
+ #define SYS_cachectl __NR_cachectl
+#endif
+#if defined(__NR_cacheflush)
+ #define SYS_cacheflush __NR_cacheflush
+#endif
+#if defined(__NR_capget)
+ #define SYS_capget __NR_capget
+#endif
+#if defined(__NR_capset)
+ #define SYS_capset __NR_capset
+#endif
+#if defined(__NR_chdir)
+ #define SYS_chdir __NR_chdir
+#endif
+#if defined(__NR_chmod)
+ #define SYS_chmod __NR_chmod
+#endif
+#if defined(__NR_chown)
+ #define SYS_chown __NR_chown
+#endif
+#if defined(__NR_chown32)
+ #define SYS_chown32 __NR_chown32
+#endif
+#if defined(__NR_chroot)
+ #define SYS_chroot __NR_chroot
+#endif
+#if defined(__NR_clock_adjtime)
+ #define SYS_clock_adjtime __NR_clock_adjtime
+#endif
+#if defined(__NR_clock_getres)
+ #define SYS_clock_getres __NR_clock_getres
+#endif
+#if defined(__NR_clock_gettime)
+ #define SYS_clock_gettime __NR_clock_gettime
+#endif
+#if defined(__NR_clock_nanosleep)
+ #define SYS_clock_nanosleep __NR_clock_nanosleep
+#endif
+#if defined(__NR_clock_settime)
+ #define SYS_clock_settime __NR_clock_settime
+#endif
+#if defined(__NR_clone)
+ #define SYS_clone __NR_clone
+#endif
+#if defined(__NR_close)
+ #define SYS_close __NR_close
+#endif
+#if defined(__NR_connect)
+ #define SYS_connect __NR_connect
+#endif
+#if defined(__NR_creat)
+ #define SYS_creat __NR_creat
+#endif
+#if defined(__NR_create_module)
+ #define SYS_create_module __NR_create_module
+#endif
+#if defined(__NR_delete_module)
+ #define SYS_delete_module __NR_delete_module
+#endif
+#if defined(__NR_dup)
+ #define SYS_dup __NR_dup
+#endif
+#if defined(__NR_dup2)
+ #define SYS_dup2 __NR_dup2
+#endif
+#if defined(__NR_dup3)
+ #define SYS_dup3 __NR_dup3
+#endif
+#if defined(__NR_epoll_create)
+ #define SYS_epoll_create __NR_epoll_create
+#endif
+#if defined(__NR_epoll_create1)
+ #define SYS_epoll_create1 __NR_epoll_create1
+#endif
+#if defined(__NR_epoll_ctl)
+ #define SYS_epoll_ctl __NR_epoll_ctl
+#endif
+#if defined(__NR_epoll_ctl_old)
+ #define SYS_epoll_ctl_old __NR_epoll_ctl_old
+#endif
+#if defined(__NR_epoll_pwait)
+ #define SYS_epoll_pwait __NR_epoll_pwait
+#endif
+#if defined(__NR_epoll_wait)
+ #define SYS_epoll_wait __NR_epoll_wait
+#endif
+#if defined(__NR_epoll_wait_old)
+ #define SYS_epoll_wait_old __NR_epoll_wait_old
+#endif
+#if defined(__NR_eventfd)
+ #define SYS_eventfd __NR_eventfd
+#endif
+#if defined(__NR_eventfd2)
+ #define SYS_eventfd2 __NR_eventfd2
+#endif
+#if defined(__NR_execve)
+ #define SYS_execve __NR_execve
+#endif
+#if defined(__NR_execveat)
+ #define SYS_execveat __NR_execveat
+#endif
+#if defined(__NR_exit)
+ #define SYS_exit __NR_exit
+#endif
+#if defined(__NR_exit_group)
+ #define SYS_exit_group __NR_exit_group
+#endif
+#if defined(__NR_faccessat)
+ #define SYS_faccessat __NR_faccessat
+#endif
+#if defined(__NR_fadvise64)
+ #define SYS_fadvise64 __NR_fadvise64
+#endif
+#if defined(__NR_fadvise64_64)
+ #define SYS_fadvise64_64 __NR_fadvise64_64
+#endif
+#if defined(__NR_fallocate)
+ #define SYS_fallocate __NR_fallocate
+#endif
+#if defined(__NR_fanotify_init)
+ #define SYS_fanotify_init __NR_fanotify_init
+#endif
+#if defined(__NR_fanotify_mark)
+ #define SYS_fanotify_mark __NR_fanotify_mark
+#endif
+#if defined(__NR_fchdir)
+ #define SYS_fchdir __NR_fchdir
+#endif
+#if defined(__NR_fchmod)
+ #define SYS_fchmod __NR_fchmod
+#endif
+#if defined(__NR_fchmodat)
+ #define SYS_fchmodat __NR_fchmodat
+#endif
+#if defined(__NR_fchown)
+ #define SYS_fchown __NR_fchown
+#endif
+#if defined(__NR_fchown32)
+ #define SYS_fchown32 __NR_fchown32
+#endif
+#if defined(__NR_fchownat)
+ #define SYS_fchownat __NR_fchownat
+#endif
+#if defined(__NR_fcntl)
+ #define SYS_fcntl __NR_fcntl
+#endif
+#if defined(__NR_fcntl64)
+ #define SYS_fcntl64 __NR_fcntl64
+#endif
+#if defined(__NR_fdatasync)
+ #define SYS_fdatasync __NR_fdatasync
+#endif
+#if defined(__NR_fgetxattr)
+ #define SYS_fgetxattr __NR_fgetxattr
+#endif
+#if defined(__NR_finit_module)
+ #define SYS_finit_module __NR_finit_module
+#endif
+#if defined(__NR_flistxattr)
+ #define SYS_flistxattr __NR_flistxattr
+#endif
+#if defined(__NR_flock)
+ #define SYS_flock __NR_flock
+#endif
+#if defined(__NR_fork)
+ #define SYS_fork __NR_fork
+#endif
+#if defined(__NR_fremovexattr)
+ #define SYS_fremovexattr __NR_fremovexattr
+#endif
+#if defined(__NR_fsetxattr)
+ #define SYS_fsetxattr __NR_fsetxattr
+#endif
+#if defined(__NR_fstat)
+ #define SYS_fstat __NR_fstat
+#endif
+#if defined(__NR_fstat64)
+ #define SYS_fstat64 __NR_fstat64
+#endif
+#if defined(__NR_fstatat64)
+ #define SYS_fstatat64 __NR_fstatat64
+#endif
+#if defined(__NR_fstatfs)
+ #define SYS_fstatfs __NR_fstatfs
+#endif
+#if defined(__NR_fstatfs64)
+ #define SYS_fstatfs64 __NR_fstatfs64
+#endif
+#if defined(__NR_fsync)
+ #define SYS_fsync __NR_fsync
+#endif
+#if defined(__NR_ftime)
+ #define SYS_ftime __NR_ftime
+#endif
+#if defined(__NR_ftruncate)
+ #define SYS_ftruncate __NR_ftruncate
+#endif
+#if defined(__NR_ftruncate64)
+ #define SYS_ftruncate64 __NR_ftruncate64
+#endif
+#if defined(__NR_futex)
+ #define SYS_futex __NR_futex
+#endif
+#if defined(__NR_futimesat)
+ #define SYS_futimesat __NR_futimesat
+#endif
+#if defined(__NR_get_kernel_syms)
+ #define SYS_get_kernel_syms __NR_get_kernel_syms
+#endif
+#if defined(__NR_get_mempolicy)
+ #define SYS_get_mempolicy __NR_get_mempolicy
+#endif
+#if defined(__NR_get_robust_list)
+ #define SYS_get_robust_list __NR_get_robust_list
+#endif
+#if defined(__NR_get_thread_area)
+ #define SYS_get_thread_area __NR_get_thread_area
+#endif
+#if defined(__NR_getcpu)
+ #define SYS_getcpu __NR_getcpu
+#endif
+#if defined(__NR_getcwd)
+ #define SYS_getcwd __NR_getcwd
+#endif
+#if defined(__NR_getdents)
+ #define SYS_getdents __NR_getdents
+#endif
+#if defined(__NR_getdents64)
+ #define SYS_getdents64 __NR_getdents64
+#endif
+#if defined(__NR_getegid)
+ #define SYS_getegid __NR_getegid
+#endif
+#if defined(__NR_getegid32)
+ #define SYS_getegid32 __NR_getegid32
+#endif
+#if defined(__NR_geteuid)
+ #define SYS_geteuid __NR_geteuid
+#endif
+#if defined(__NR_geteuid32)
+ #define SYS_geteuid32 __NR_geteuid32
+#endif
+#if defined(__NR_getgid)
+ #define SYS_getgid __NR_getgid
+#endif
+#if defined(__NR_getgid32)
+ #define SYS_getgid32 __NR_getgid32
+#endif
+#if defined(__NR_getgroups)
+ #define SYS_getgroups __NR_getgroups
+#endif
+#if defined(__NR_getgroups32)
+ #define SYS_getgroups32 __NR_getgroups32
+#endif
+#if defined(__NR_getitimer)
+ #define SYS_getitimer __NR_getitimer
+#endif
+#if defined(__NR_getpeername)
+ #define SYS_getpeername __NR_getpeername
+#endif
+#if defined(__NR_getpgid)
+ #define SYS_getpgid __NR_getpgid
+#endif
+#if defined(__NR_getpgrp)
+ #define SYS_getpgrp __NR_getpgrp
+#endif
+#if defined(__NR_getpid)
+ #define SYS_getpid __NR_getpid
+#endif
+#if defined(__NR_getpmsg)
+ #define SYS_getpmsg __NR_getpmsg
+#endif
+#if defined(__NR_getppid)
+ #define SYS_getppid __NR_getppid
+#endif
+#if defined(__NR_getpriority)
+ #define SYS_getpriority __NR_getpriority
+#endif
+#if defined(__NR_getrandom)
+ #define SYS_getrandom __NR_getrandom
+#endif
+#if defined(__NR_getresgid)
+ #define SYS_getresgid __NR_getresgid
+#endif
+#if defined(__NR_getresgid32)
+ #define SYS_getresgid32 __NR_getresgid32
+#endif
+#if defined(__NR_getresuid)
+ #define SYS_getresuid __NR_getresuid
+#endif
+#if defined(__NR_getresuid32)
+ #define SYS_getresuid32 __NR_getresuid32
+#endif
+#if defined(__NR_getrlimit)
+ #define SYS_getrlimit __NR_getrlimit
+#endif
+#if defined(__NR_getrusage)
+ #define SYS_getrusage __NR_getrusage
+#endif
+#if defined(__NR_getsid)
+ #define SYS_getsid __NR_getsid
+#endif
+#if defined(__NR_getsockname)
+ #define SYS_getsockname __NR_getsockname
+#endif
+#if defined(__NR_getsockopt)
+ #define SYS_getsockopt __NR_getsockopt
+#endif
+#if defined(__NR_gettid)
+ #define SYS_gettid __NR_gettid
+#endif
+#if defined(__NR_gettimeofday)
+ #define SYS_gettimeofday __NR_gettimeofday
+#endif
+#if defined(__NR_getuid)
+ #define SYS_getuid __NR_getuid
+#endif
+#if defined(__NR_getuid32)
+ #define SYS_getuid32 __NR_getuid32
+#endif
+#if defined(__NR_getxattr)
+ #define SYS_getxattr __NR_getxattr
+#endif
+#if defined(__NR_gtty)
+ #define SYS_gtty __NR_gtty
+#endif
+#if defined(__NR_idle)
+ #define SYS_idle __NR_idle
+#endif
+#if defined(__NR_init_module)
+ #define SYS_init_module __NR_init_module
+#endif
+#if defined(__NR_inotify_add_watch)
+ #define SYS_inotify_add_watch __NR_inotify_add_watch
+#endif
+#if defined(__NR_inotify_init)
+ #define SYS_inotify_init __NR_inotify_init
+#endif
+#if defined(__NR_inotify_init1)
+ #define SYS_inotify_init1 __NR_inotify_init1
+#endif
+#if defined(__NR_inotify_rm_watch)
+ #define SYS_inotify_rm_watch __NR_inotify_rm_watch
+#endif
+#if defined(__NR_io_cancel)
+ #define SYS_io_cancel __NR_io_cancel
+#endif
+#if defined(__NR_io_destroy)
+ #define SYS_io_destroy __NR_io_destroy
+#endif
+#if defined(__NR_io_getevents)
+ #define SYS_io_getevents __NR_io_getevents
+#endif
+#if defined(__NR_io_setup)
+ #define SYS_io_setup __NR_io_setup
+#endif
+#if defined(__NR_io_submit)
+ #define SYS_io_submit __NR_io_submit
+#endif
+#if defined(__NR_ioctl)
+ #define SYS_ioctl __NR_ioctl
+#endif
+#if defined(__NR_ioperm)
+ #define SYS_ioperm __NR_ioperm
+#endif
+#if defined(__NR_iopl)
+ #define SYS_iopl __NR_iopl
+#endif
+#if defined(__NR_ioprio_get)
+ #define SYS_ioprio_get __NR_ioprio_get
+#endif
+#if defined(__NR_ioprio_set)
+ #define SYS_ioprio_set __NR_ioprio_set
+#endif
+#if defined(__NR_ipc)
+ #define SYS_ipc __NR_ipc
+#endif
+#if defined(__NR_kcmp)
+ #define SYS_kcmp __NR_kcmp
+#endif
+#if defined(__NR_kexec_file_load)
+ #define SYS_kexec_file_load __NR_kexec_file_load
+#endif
+#if defined(__NR_kexec_load)
+ #define SYS_kexec_load __NR_kexec_load
+#endif
+#if defined(__NR_keyctl)
+ #define SYS_keyctl __NR_keyctl
+#endif
+#if defined(__NR_kill)
+ #define SYS_kill __NR_kill
+#endif
+#if defined(__NR_lchown)
+ #define SYS_lchown __NR_lchown
+#endif
+#if defined(__NR_lchown32)
+ #define SYS_lchown32 __NR_lchown32
+#endif
+#if defined(__NR_lgetxattr)
+ #define SYS_lgetxattr __NR_lgetxattr
+#endif
+#if defined(__NR_link)
+ #define SYS_link __NR_link
+#endif
+#if defined(__NR_linkat)
+ #define SYS_linkat __NR_linkat
+#endif
+#if defined(__NR_listen)
+ #define SYS_listen __NR_listen
+#endif
+#if defined(__NR_listxattr)
+ #define SYS_listxattr __NR_listxattr
+#endif
+#if defined(__NR_llistxattr)
+ #define SYS_llistxattr __NR_llistxattr
+#endif
+#if defined(__NR_llseek)
+ #define SYS_llseek __NR_llseek
+#endif
+#if defined(__NR_lock)
+ #define SYS_lock __NR_lock
+#endif
+#if defined(__NR_lookup_dcookie)
+ #define SYS_lookup_dcookie __NR_lookup_dcookie
+#endif
+#if defined(__NR_lremovexattr)
+ #define SYS_lremovexattr __NR_lremovexattr
+#endif
+#if defined(__NR_lseek)
+ #define SYS_lseek __NR_lseek
+#endif
+#if defined(__NR_lsetxattr)
+ #define SYS_lsetxattr __NR_lsetxattr
+#endif
+#if defined(__NR_lstat)
+ #define SYS_lstat __NR_lstat
+#endif
+#if defined(__NR_lstat64)
+ #define SYS_lstat64 __NR_lstat64
+#endif
+#if defined(__NR_madvise)
+ #define SYS_madvise __NR_madvise
+#endif
+#if defined(__NR_mbind)
+ #define SYS_mbind __NR_mbind
+#endif
+#if defined(__NR_membarrier)
+ #define SYS_membarrier __NR_membarrier
+#endif
+#if defined(__NR_memfd_create)
+ #define SYS_memfd_create __NR_memfd_create
+#endif
+#if defined(__NR_migrate_pages)
+ #define SYS_migrate_pages __NR_migrate_pages
+#endif
+#if defined(__NR_mincore)
+ #define SYS_mincore __NR_mincore
+#endif
+#if defined(__NR_mkdir)
+ #define SYS_mkdir __NR_mkdir
+#endif
+#if defined(__NR_mkdirat)
+ #define SYS_mkdirat __NR_mkdirat
+#endif
+#if defined(__NR_mknod)
+ #define SYS_mknod __NR_mknod
+#endif
+#if defined(__NR_mknodat)
+ #define SYS_mknodat __NR_mknodat
+#endif
+#if defined(__NR_mlock)
+ #define SYS_mlock __NR_mlock
+#endif
+#if defined(__NR_mlock2)
+ #define SYS_mlock2 __NR_mlock2
+#endif
+#if defined(__NR_mlockall)
+ #define SYS_mlockall __NR_mlockall
+#endif
+#if defined(__NR_mmap)
+ #define SYS_mmap __NR_mmap
+#endif
+#if defined(__NR_mmap2)
+ #define SYS_mmap2 __NR_mmap2
+#endif
+#if defined(__NR_modify_ldt)
+ #define SYS_modify_ldt __NR_modify_ldt
+#endif
+#if defined(__NR_mount)
+ #define SYS_mount __NR_mount
+#endif
+#if defined(__NR_move_pages)
+ #define SYS_move_pages __NR_move_pages
+#endif
+#if defined(__NR_mprotect)
+ #define SYS_mprotect __NR_mprotect
+#endif
+#if defined(__NR_mpx)
+ #define SYS_mpx __NR_mpx
+#endif
+#if defined(__NR_mq_getsetattr)
+ #define SYS_mq_getsetattr __NR_mq_getsetattr
+#endif
+#if defined(__NR_mq_notify)
+ #define SYS_mq_notify __NR_mq_notify
+#endif
+#if defined(__NR_mq_open)
+ #define SYS_mq_open __NR_mq_open
+#endif
+#if defined(__NR_mq_timedreceive)
+ #define SYS_mq_timedreceive __NR_mq_timedreceive
+#endif
+#if defined(__NR_mq_timedsend)
+ #define SYS_mq_timedsend __NR_mq_timedsend
+#endif
+#if defined(__NR_mq_unlink)
+ #define SYS_mq_unlink __NR_mq_unlink
+#endif
+#if defined(__NR_mremap)
+ #define SYS_mremap __NR_mremap
+#endif
+#if defined(__NR_msgctl)
+ #define SYS_msgctl __NR_msgctl
+#endif
+#if defined(__NR_msgget)
+ #define SYS_msgget __NR_msgget
+#endif
+#if defined(__NR_msgrcv)
+ #define SYS_msgrcv __NR_msgrcv
+#endif
+#if defined(__NR_msgsnd)
+ #define SYS_msgsnd __NR_msgsnd
+#endif
+#if defined(__NR_msync)
+ #define SYS_msync __NR_msync
+#endif
+#if defined(__NR_munlock)
+ #define SYS_munlock __NR_munlock
+#endif
+#if defined(__NR_munlockall)
+ #define SYS_munlockall __NR_munlockall
+#endif
+#if defined(__NR_munmap)
+ #define SYS_munmap __NR_munmap
+#endif
+#if defined(__NR_name_to_handle_at)
+ #define SYS_name_to_handle_at __NR_name_to_handle_at
+#endif
+#if defined(__NR_nanosleep)
+ #define SYS_nanosleep __NR_nanosleep
+#endif
+#if defined(__NR_newfstatat)
+ #define SYS_newfstatat __NR_newfstatat
+#endif
+#if defined(__NR_nfsservctl)
+ #define SYS_nfsservctl __NR_nfsservctl
+#endif
+#if defined(__NR_nice)
+ #define SYS_nice __NR_nice
+#endif
+#if defined(__NR_oldfstat)
+ #define SYS_oldfstat __NR_oldfstat
+#endif
+#if defined(__NR_oldlstat)
+ #define SYS_oldlstat __NR_oldlstat
+#endif
+#if defined(__NR_oldolduname)
+ #define SYS_oldolduname __NR_oldolduname
+#endif
+#if defined(__NR_oldstat)
+ #define SYS_oldstat __NR_oldstat
+#endif
+#if defined(__NR_olduname)
+ #define SYS_olduname __NR_olduname
+#endif
+#if defined(__NR_oldwait4)
+ #define SYS_oldwait4 __NR_oldwait4
+#endif
+#if defined(__NR_open)
+ #define SYS_open __NR_open
+#endif
+#if defined(__NR_open_by_handle_at)
+ #define SYS_open_by_handle_at __NR_open_by_handle_at
+#endif
+#if defined(__NR_openat)
+ #define SYS_openat __NR_openat
+#endif
+#if defined(__NR_pause)
+ #define SYS_pause __NR_pause
+#endif
+#if defined(__NR_pciconfig_iobase)
+ #define SYS_pciconfig_iobase __NR_pciconfig_iobase
+#endif
+#if defined(__NR_pciconfig_read)
+ #define SYS_pciconfig_read __NR_pciconfig_read
+#endif
+#if defined(__NR_pciconfig_write)
+ #define SYS_pciconfig_write __NR_pciconfig_write
+#endif
+#if defined(__NR_perf_event_open)
+ #define SYS_perf_event_open __NR_perf_event_open
+#endif
+#if defined(__NR_personality)
+ #define SYS_personality __NR_personality
+#endif
+#if defined(__NR_pipe)
+ #define SYS_pipe __NR_pipe
+#endif
+#if defined(__NR_pipe2)
+ #define SYS_pipe2 __NR_pipe2
+#endif
+#if defined(__NR_pivot_root)
+ #define SYS_pivot_root __NR_pivot_root
+#endif
+#if defined(__NR_poll)
+ #define SYS_poll __NR_poll
+#endif
+#if defined(__NR_ppoll)
+ #define SYS_ppoll __NR_ppoll
+#endif
+#if defined(__NR_prctl)
+ #define SYS_prctl __NR_prctl
+#endif
+#if defined(__NR_pread64)
+ #define SYS_pread64 __NR_pread64
+#endif
+#if defined(__NR_preadv)
+ #define SYS_preadv __NR_preadv
+#endif
+#if defined(__NR_prlimit64)
+ #define SYS_prlimit64 __NR_prlimit64
+#endif
+#if defined(__NR_process_vm_readv)
+ #define SYS_process_vm_readv __NR_process_vm_readv
+#endif
+#if defined(__NR_process_vm_writev)
+ #define SYS_process_vm_writev __NR_process_vm_writev
+#endif
+#if defined(__NR_prof)
+ #define SYS_prof __NR_prof
+#endif
+#if defined(__NR_profil)
+ #define SYS_profil __NR_profil
+#endif
+#if defined(__NR_pselect6)
+ #define SYS_pselect6 __NR_pselect6
+#endif
+#if defined(__NR_ptrace)
+ #define SYS_ptrace __NR_ptrace
+#endif
+#if defined(__NR_putpmsg)
+ #define SYS_putpmsg __NR_putpmsg
+#endif
+#if defined(__NR_pwrite64)
+ #define SYS_pwrite64 __NR_pwrite64
+#endif
+#if defined(__NR_pwritev)
+ #define SYS_pwritev __NR_pwritev
+#endif
+#if defined(__NR_query_module)
+ #define SYS_query_module __NR_query_module
+#endif
+#if defined(__NR_quotactl)
+ #define SYS_quotactl __NR_quotactl
+#endif
+#if defined(__NR_read)
+ #define SYS_read __NR_read
+#endif
+#if defined(__NR_readahead)
+ #define SYS_readahead __NR_readahead
+#endif
+#if defined(__NR_readdir)
+ #define SYS_readdir __NR_readdir
+#endif
+#if defined(__NR_readlink)
+ #define SYS_readlink __NR_readlink
+#endif
+#if defined(__NR_readlinkat)
+ #define SYS_readlinkat __NR_readlinkat
+#endif
+#if defined(__NR_readv)
+ #define SYS_readv __NR_readv
+#endif
+#if defined(__NR_reboot)
+ #define SYS_reboot __NR_reboot
+#endif
+#if defined(__NR_recv)
+ #define SYS_recv __NR_recv
+#endif
+#if defined(__NR_recvfrom)
+ #define SYS_recvfrom __NR_recvfrom
+#endif
+#if defined(__NR_recvmmsg)
+ #define SYS_recvmmsg __NR_recvmmsg
+#endif
+#if defined(__NR_recvmsg)
+ #define SYS_recvmsg __NR_recvmsg
+#endif
+#if defined(__NR_remap_file_pages)
+ #define SYS_remap_file_pages __NR_remap_file_pages
+#endif
+#if defined(__NR_removexattr)
+ #define SYS_removexattr __NR_removexattr
+#endif
+#if defined(__NR_rename)
+ #define SYS_rename __NR_rename
+#endif
+#if defined(__NR_renameat)
+ #define SYS_renameat __NR_renameat
+#endif
+#if defined(__NR_renameat2)
+ #define SYS_renameat2 __NR_renameat2
+#endif
+#if defined(__NR_request_key)
+ #define SYS_request_key __NR_request_key
+#endif
+#if defined(__NR_restart_syscall)
+ #define SYS_restart_syscall __NR_restart_syscall
+#endif
+#if defined(__NR_rmdir)
+ #define SYS_rmdir __NR_rmdir
+#endif
+#if defined(__NR_rt_sigaction)
+ #define SYS_rt_sigaction __NR_rt_sigaction
+#endif
+#if defined(__NR_rt_sigpending)
+ #define SYS_rt_sigpending __NR_rt_sigpending
+#endif
+#if defined(__NR_rt_sigprocmask)
+ #define SYS_rt_sigprocmask __NR_rt_sigprocmask
+#endif
+#if defined(__NR_rt_sigqueueinfo)
+ #define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#endif
+#if defined(__NR_rt_sigreturn)
+ #define SYS_rt_sigreturn __NR_rt_sigreturn
+#endif
+#if defined(__NR_rt_sigsuspend)
+ #define SYS_rt_sigsuspend __NR_rt_sigsuspend
+#endif
+#if defined(__NR_rt_sigtimedwait)
+ #define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
+#endif
+#if defined(__NR_rt_tgsigqueueinfo)
+ #define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
+#endif
+#if defined(__NR_sched_get_priority_max)
+ #define SYS_sched_get_priority_max __NR_sched_get_priority_max
+#endif
+#if defined(__NR_sched_get_priority_min)
+ #define SYS_sched_get_priority_min __NR_sched_get_priority_min
+#endif
+#if defined(__NR_sched_getaffinity)
+ #define SYS_sched_getaffinity __NR_sched_getaffinity
+#endif
+#if defined(__NR_sched_getattr)
+ #define SYS_sched_getattr __NR_sched_getattr
+#endif
+#if defined(__NR_sched_getparam)
+ #define SYS_sched_getparam __NR_sched_getparam
+#endif
+#if defined(__NR_sched_getscheduler)
+ #define SYS_sched_getscheduler __NR_sched_getscheduler
+#endif
+#if defined(__NR_sched_rr_get_interval)
+ #define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
+#endif
+#if defined(__NR_sched_setaffinity)
+ #define SYS_sched_setaffinity __NR_sched_setaffinity
+#endif
+#if defined(__NR_sched_setattr)
+ #define SYS_sched_setattr __NR_sched_setattr
+#endif
+#if defined(__NR_sched_setparam)
+ #define SYS_sched_setparam __NR_sched_setparam
+#endif
+#if defined(__NR_sched_setscheduler)
+ #define SYS_sched_setscheduler __NR_sched_setscheduler
+#endif
+#if defined(__NR_sched_yield)
+ #define SYS_sched_yield __NR_sched_yield
+#endif
+#if defined(__NR_seccomp)
+ #define SYS_seccomp __NR_seccomp
+#endif
+#if defined(__NR_security)
+ #define SYS_security __NR_security
+#endif
+#if defined(__NR_select)
+ #define SYS_select __NR_select
+#endif
+#if defined(__NR_semctl)
+ #define SYS_semctl __NR_semctl
+#endif
+#if defined(__NR_semget)
+ #define SYS_semget __NR_semget
+#endif
+#if defined(__NR_semop)
+ #define SYS_semop __NR_semop
+#endif
+#if defined(__NR_semtimedop)
+ #define SYS_semtimedop __NR_semtimedop
+#endif
+#if defined(__NR_send)
+ #define SYS_send __NR_send
+#endif
+#if defined(__NR_sendfile)
+ #define SYS_sendfile __NR_sendfile
+#endif
+#if defined(__NR_sendfile64)
+ #define SYS_sendfile64 __NR_sendfile64
+#endif
+#if defined(__NR_sendmmsg)
+ #define SYS_sendmmsg __NR_sendmmsg
+#endif
+#if defined(__NR_sendmsg)
+ #define SYS_sendmsg __NR_sendmsg
+#endif
+#if defined(__NR_sendto)
+ #define SYS_sendto __NR_sendto
+#endif
+#if defined(__NR_set_mempolicy)
+ #define SYS_set_mempolicy __NR_set_mempolicy
+#endif
+#if defined(__NR_set_robust_list)
+ #define SYS_set_robust_list __NR_set_robust_list
+#endif
+#if defined(__NR_set_thread_area)
+ #define SYS_set_thread_area __NR_set_thread_area
+#endif
+#if defined(__NR_set_tid_address)
+ #define SYS_set_tid_address __NR_set_tid_address
+#endif
+#if defined(__NR_setdomainname)
+ #define SYS_setdomainname __NR_setdomainname
+#endif
+#if defined(__NR_setfsgid)
+ #define SYS_setfsgid __NR_setfsgid
+#endif
+#if defined(__NR_setfsgid32)
+ #define SYS_setfsgid32 __NR_setfsgid32
+#endif
+#if defined(__NR_setfsuid)
+ #define SYS_setfsuid __NR_setfsuid
+#endif
+#if defined(__NR_setfsuid32)
+ #define SYS_setfsuid32 __NR_setfsuid32
+#endif
+#if defined(__NR_setgid)
+ #define SYS_setgid __NR_setgid
+#endif
+#if defined(__NR_setgid32)
+ #define SYS_setgid32 __NR_setgid32
+#endif
+#if defined(__NR_setgroups)
+ #define SYS_setgroups __NR_setgroups
+#endif
+#if defined(__NR_setgroups32)
+ #define SYS_setgroups32 __NR_setgroups32
+#endif
+#if defined(__NR_sethostname)
+ #define SYS_sethostname __NR_sethostname
+#endif
+#if defined(__NR_setitimer)
+ #define SYS_setitimer __NR_setitimer
+#endif
+#if defined(__NR_setns)
+ #define SYS_setns __NR_setns
+#endif
+#if defined(__NR_setpgid)
+ #define SYS_setpgid __NR_setpgid
+#endif
+#if defined(__NR_setpriority)
+ #define SYS_setpriority __NR_setpriority
+#endif
+#if defined(__NR_setregid)
+ #define SYS_setregid __NR_setregid
+#endif
+#if defined(__NR_setregid32)
+ #define SYS_setregid32 __NR_setregid32
+#endif
+#if defined(__NR_setresgid)
+ #define SYS_setresgid __NR_setresgid
+#endif
+#if defined(__NR_setresgid32)
+ #define SYS_setresgid32 __NR_setresgid32
+#endif
+#if defined(__NR_setresuid)
+ #define SYS_setresuid __NR_setresuid
+#endif
+#if defined(__NR_setresuid32)
+ #define SYS_setresuid32 __NR_setresuid32
+#endif
+#if defined(__NR_setreuid)
+ #define SYS_setreuid __NR_setreuid
+#endif
+#if defined(__NR_setreuid32)
+ #define SYS_setreuid32 __NR_setreuid32
+#endif
+#if defined(__NR_setrlimit)
+ #define SYS_setrlimit __NR_setrlimit
+#endif
+#if defined(__NR_setsid)
+ #define SYS_setsid __NR_setsid
+#endif
+#if defined(__NR_setsockopt)
+ #define SYS_setsockopt __NR_setsockopt
+#endif
+#if defined(__NR_settimeofday)
+ #define SYS_settimeofday __NR_settimeofday
+#endif
+#if defined(__NR_setuid)
+ #define SYS_setuid __NR_setuid
+#endif
+#if defined(__NR_setuid32)
+ #define SYS_setuid32 __NR_setuid32
+#endif
+#if defined(__NR_setxattr)
+ #define SYS_setxattr __NR_setxattr
+#endif
+#if defined(__NR_sgetmask)
+ #define SYS_sgetmask __NR_sgetmask
+#endif
+#if defined(__NR_shmat)
+ #define SYS_shmat __NR_shmat
+#endif
+#if defined(__NR_shmctl)
+ #define SYS_shmctl __NR_shmctl
+#endif
+#if defined(__NR_shmdt)
+ #define SYS_shmdt __NR_shmdt
+#endif
+#if defined(__NR_shmget)
+ #define SYS_shmget __NR_shmget
+#endif
+#if defined(__NR_shutdown)
+ #define SYS_shutdown __NR_shutdown
+#endif
+#if defined(__NR_sigaction)
+ #define SYS_sigaction __NR_sigaction
+#endif
+#if defined(__NR_sigaltstack)
+ #define SYS_sigaltstack __NR_sigaltstack
+#endif
+#if defined(__NR_signal)
+ #define SYS_signal __NR_signal
+#endif
+#if defined(__NR_signalfd)
+ #define SYS_signalfd __NR_signalfd
+#endif
+#if defined(__NR_signalfd4)
+ #define SYS_signalfd4 __NR_signalfd4
+#endif
+#if defined(__NR_sigpending)
+ #define SYS_sigpending __NR_sigpending
+#endif
+#if defined(__NR_sigprocmask)
+ #define SYS_sigprocmask __NR_sigprocmask
+#endif
+#if defined(__NR_sigreturn)
+ #define SYS_sigreturn __NR_sigreturn
+#endif
+#if defined(__NR_sigsuspend)
+ #define SYS_sigsuspend __NR_sigsuspend
+#endif
+#if defined(__NR_socket)
+ #define SYS_socket __NR_socket
+#endif
+#if defined(__NR_socketcall)
+ #define SYS_socketcall __NR_socketcall
+#endif
+#if defined(__NR_socketpair)
+ #define SYS_socketpair __NR_socketpair
+#endif
+#if defined(__NR_splice)
+ #define SYS_splice __NR_splice
+#endif
+#if defined(__NR_ssetmask)
+ #define SYS_ssetmask __NR_ssetmask
+#endif
+#if defined(__NR_stat)
+ #define SYS_stat __NR_stat
+#endif
+#if defined(__NR_stat64)
+ #define SYS_stat64 __NR_stat64
+#endif
+#if defined(__NR_statfs)
+ #define SYS_statfs __NR_statfs
+#endif
+#if defined(__NR_statfs64)
+ #define SYS_statfs64 __NR_statfs64
+#endif
+#if defined(__NR_stime)
+ #define SYS_stime __NR_stime
+#endif
+#if defined(__NR_stty)
+ #define SYS_stty __NR_stty
+#endif
+#if defined(__NR_swapoff)
+ #define SYS_swapoff __NR_swapoff
+#endif
+#if defined(__NR_swapon)
+ #define SYS_swapon __NR_swapon
+#endif
+#if defined(__NR_symlink)
+ #define SYS_symlink __NR_symlink
+#endif
+#if defined(__NR_symlinkat)
+ #define SYS_symlinkat __NR_symlinkat
+#endif
+#if defined(__NR_sync)
+ #define SYS_sync __NR_sync
+#endif
+#if defined(__NR_sync_file_range)
+ #define SYS_sync_file_range __NR_sync_file_range
+#endif
+#if defined(__NR_sync_file_range2)
+ #define SYS_sync_file_range2 __NR_sync_file_range2
+#endif
+#if defined(__NR_syncfs)
+ #define SYS_syncfs __NR_syncfs
+#endif
+#if defined(__NR_syscall)
+ #define SYS_syscall __NR_syscall
+#endif
+#if defined(__NR_syscalls)
+ #define SYS_syscalls __NR_syscalls
+#endif
+#if defined(__NR_sysfs)
+ #define SYS_sysfs __NR_sysfs
+#endif
+#if defined(__NR_sysinfo)
+ #define SYS_sysinfo __NR_sysinfo
+#endif
+#if defined(__NR_syslog)
+ #define SYS_syslog __NR_syslog
+#endif
+#if defined(__NR_sysmips)
+ #define SYS_sysmips __NR_sysmips
+#endif
+#if defined(__NR_tee)
+ #define SYS_tee __NR_tee
+#endif
+#if defined(__NR_tgkill)
+ #define SYS_tgkill __NR_tgkill
+#endif
+#if defined(__NR_time)
+ #define SYS_time __NR_time
+#endif
+#if defined(__NR_timer_create)
+ #define SYS_timer_create __NR_timer_create
+#endif
+#if defined(__NR_timer_delete)
+ #define SYS_timer_delete __NR_timer_delete
+#endif
+#if defined(__NR_timer_getoverrun)
+ #define SYS_timer_getoverrun __NR_timer_getoverrun
+#endif
+#if defined(__NR_timer_gettime)
+ #define SYS_timer_gettime __NR_timer_gettime
+#endif
+#if defined(__NR_timer_settime)
+ #define SYS_timer_settime __NR_timer_settime
+#endif
+#if defined(__NR_timerfd)
+ #define SYS_timerfd __NR_timerfd
+#endif
+#if defined(__NR_timerfd_create)
+ #define SYS_timerfd_create __NR_timerfd_create
+#endif
+#if defined(__NR_timerfd_gettime)
+ #define SYS_timerfd_gettime __NR_timerfd_gettime
+#endif
+#if defined(__NR_timerfd_settime)
+ #define SYS_timerfd_settime __NR_timerfd_settime
+#endif
+#if defined(__NR_times)
+ #define SYS_times __NR_times
+#endif
+#if defined(__NR_tkill)
+ #define SYS_tkill __NR_tkill
+#endif
+#if defined(__NR_truncate)
+ #define SYS_truncate __NR_truncate
+#endif
+#if defined(__NR_truncate64)
+ #define SYS_truncate64 __NR_truncate64
+#endif
+#if defined(__NR_tuxcall)
+ #define SYS_tuxcall __NR_tuxcall
+#endif
+#if defined(__NR_ugetrlimit)
+ #define SYS_ugetrlimit __NR_ugetrlimit
+#endif
+#if defined(__NR_ulimit)
+ #define SYS_ulimit __NR_ulimit
+#endif
+#if defined(__NR_umask)
+ #define SYS_umask __NR_umask
+#endif
+#if defined(__NR_umount)
+ #define SYS_umount __NR_umount
+#endif
+#if defined(__NR_umount2)
+ #define SYS_umount2 __NR_umount2
+#endif
+#if defined(__NR_uname)
+ #define SYS_uname __NR_uname
+#endif
+#if defined(__NR_unlink)
+ #define SYS_unlink __NR_unlink
+#endif
+#if defined(__NR_unlinkat)
+ #define SYS_unlinkat __NR_unlinkat
+#endif
+#if defined(__NR_unshare)
+ #define SYS_unshare __NR_unshare
+#endif
+#if defined(__NR_uselib)
+ #define SYS_uselib __NR_uselib
+#endif
+#if defined(__NR_userfaultfd)
+ #define SYS_userfaultfd __NR_userfaultfd
+#endif
+#if defined(__NR_ustat)
+ #define SYS_ustat __NR_ustat
+#endif
+#if defined(__NR_utime)
+ #define SYS_utime __NR_utime
+#endif
+#if defined(__NR_utimensat)
+ #define SYS_utimensat __NR_utimensat
+#endif
+#if defined(__NR_utimes)
+ #define SYS_utimes __NR_utimes
+#endif
+#if defined(__NR_vfork)
+ #define SYS_vfork __NR_vfork
+#endif
+#if defined(__NR_vhangup)
+ #define SYS_vhangup __NR_vhangup
+#endif
+#if defined(__NR_vm86)
+ #define SYS_vm86 __NR_vm86
+#endif
+#if defined(__NR_vm86old)
+ #define SYS_vm86old __NR_vm86old
+#endif
+#if defined(__NR_vmsplice)
+ #define SYS_vmsplice __NR_vmsplice
+#endif
+#if defined(__NR_vserver)
+ #define SYS_vserver __NR_vserver
+#endif
+#if defined(__NR_wait4)
+ #define SYS_wait4 __NR_wait4
+#endif
+#if defined(__NR_waitid)
+ #define SYS_waitid __NR_waitid
+#endif
+#if defined(__NR_waitpid)
+ #define SYS_waitpid __NR_waitpid
+#endif
+#if defined(__NR_write)
+ #define SYS_write __NR_write
+#endif
+#if defined(__NR_writev)
+ #define SYS_writev __NR_writev
+#endif
+#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */
diff --git a/libc/include/codeaurora/PropClientDispatch.h b/libc/include/codeaurora/PropClientDispatch.h
deleted file mode 100755
index 512cd6b..0000000
--- a/libc/include/codeaurora/PropClientDispatch.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 PROP_CLIENT_DISPATCH_H
-#define PROP_CLIENT_DISPATCH_H
-
-#include <sys/cdefs.h>
-#include <sys/socket.h>
-
-__BEGIN_DECLS
-
-struct PropClientDispatch {
- int (*propSocket)(int, int, int);
- int (*propConnect)(int sockfd, const struct sockaddr* addr, socklen_t addrlen);
- int (*propGetHostByNameForNet)(const pid_t pid, const uid_t, const gid_t, const char*);
- int (*propGetHostByAddrForNet)(const pid_t pid, const uid_t, const gid_t, const void*);
- int (*propGetAddrInfoForNet)(const pid_t pid, const uid_t, const gid_t, const char*, const struct addrinfo*);
- void (*propSendDnsReport)(const int);
- int (*propClose)(int);
-};
-
-extern struct PropClientDispatch __propClientDispatch;
-
-__END_DECLS
-
-#endif // PROP_CLIENT_DISPATCH_H
diff --git a/libc/include/codeaurora/PropClientDispatchWrite.h b/libc/include/codeaurora/PropClientDispatchWrite.h
deleted file mode 100644
index 58097a3..0000000
--- a/libc/include/codeaurora/PropClientDispatchWrite.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. 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 The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * 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 PROP_CLIENT_DISPATCH_WRITE_H
-#define PROP_CLIENT_DISPATCH_WRITE_H
-
-#include <stdlib.h>
-#include <sys/cdefs.h>
-__BEGIN_DECLS
-struct PropClientDispatchWrite {
-
- void (*propWrite)(const int fd);
- void (*propWritev)(const int fd);
- int (*propSendmsg)(int fd, const struct msghdr *msg, unsigned int flags);
- int (*propSendto)(int fd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
-};
-
-extern struct PropClientDispatchWrite __propClientDispatchWrite;
-
-__END_DECLS
-
-#endif // PROP_CLIENT_DISPATCH_WRITE_H
diff --git a/libc/include/sys/glibc-syscalls.h b/libc/include/sys/glibc-syscalls.h
deleted file mode 100644
index 26887b1..0000000
--- a/libc/include/sys/glibc-syscalls.h
+++ /dev/null
@@ -1,1759 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-#ifndef _BIONIC_GLIBC_SYSCALLS_H_
-#define _BIONIC_GLIBC_SYSCALLS_H_
-#if defined(__aarch64__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_alarm __NR_alarm
-#define SYS_arch_specific_syscall __NR_arch_specific_syscall
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fadvise64_64 __NR_fadvise64_64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#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
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#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
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_llseek __NR_llseek
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_oldwait4 __NR_oldwait4
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#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_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_socket __NR_socket
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_sync_file_range2 __NR_sync_file_range2
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscalls __NR_syscalls
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__arm__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_alarm __NR_alarm
-#define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64
-#define SYS_arm_sync_file_range __NR_arm_sync_file_range
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chown32 __NR_chown32
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchown32 __NR_fchown32
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#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
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_getegid32 __NR_getegid32
-#define SYS_geteuid __NR_geteuid
-#define SYS_geteuid32 __NR_geteuid32
-#define SYS_getgid __NR_getgid
-#define SYS_getgid32 __NR_getgid32
-#define SYS_getgroups __NR_getgroups
-#define SYS_getgroups32 __NR_getgroups32
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresgid32 __NR_getresgid32
-#define SYS_getresuid __NR_getresuid
-#define SYS_getresuid32 __NR_getresuid32
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getuid32 __NR_getuid32
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#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
-#define SYS_lchown __NR_lchown
-#define SYS_lchown32 __NR_lchown32
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_pciconfig_iobase __NR_pciconfig_iobase
-#define SYS_pciconfig_read __NR_pciconfig_read
-#define SYS_pciconfig_write __NR_pciconfig_write
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#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_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsgid32 __NR_setfsgid32
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setfsuid32 __NR_setfsuid32
-#define SYS_setgid __NR_setgid
-#define SYS_setgid32 __NR_setgid32
-#define SYS_setgroups __NR_setgroups
-#define SYS_setgroups32 __NR_setgroups32
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setregid32 __NR_setregid32
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresgid32 __NR_setresgid32
-#define SYS_setresuid __NR_setresuid
-#define SYS_setresuid32 __NR_setresuid32
-#define SYS_setreuid __NR_setreuid
-#define SYS_setreuid32 __NR_setreuid32
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setuid32 __NR_setuid32
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range2 __NR_sync_file_range2
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscall __NR_syscall
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ugetrlimit __NR_ugetrlimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__mips__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_break __NR_break
-#define SYS_brk __NR_brk
-#define SYS_cachectl __NR_cachectl
-#define SYS_cacheflush __NR_cacheflush
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#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
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftime __NR_ftime
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_gtty __NR_gtty
-#define SYS_idle __NR_idle
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#define SYS_iopl __NR_iopl
-#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
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lock __NR_lock
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mpx __NR_mpx
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#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
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_reserved177 __NR_reserved177
-#define SYS_reserved193 __NR_reserved193
-#define SYS_reserved221 __NR_reserved221
-#define SYS_reserved82 __NR_reserved82
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_sgetmask __NR_sgetmask
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signal __NR_signal
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_ssetmask __NR_ssetmask
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_stty __NR_stty
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscall __NR_syscall
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_sysmips __NR_sysmips
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd __NR_timerfd
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ulimit __NR_ulimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_unused109 __NR_unused109
-#define SYS_unused150 __NR_unused150
-#define SYS_unused18 __NR_unused18
-#define SYS_unused28 __NR_unused28
-#define SYS_unused59 __NR_unused59
-#define SYS_unused84 __NR_unused84
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vhangup __NR_vhangup
-#define SYS_vm86 __NR_vm86
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_waitpid __NR_waitpid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__i386__)
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_break __NR_break
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chown32 __NR_chown32
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fadvise64_64 __NR_fadvise64_64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchown32 __NR_fchown32
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#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
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftime __NR_ftime
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_get_thread_area __NR_get_thread_area
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_getegid32 __NR_getegid32
-#define SYS_geteuid __NR_geteuid
-#define SYS_geteuid32 __NR_geteuid32
-#define SYS_getgid __NR_getgid
-#define SYS_getgid32 __NR_getgid32
-#define SYS_getgroups __NR_getgroups
-#define SYS_getgroups32 __NR_getgroups32
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresgid32 __NR_getresgid32
-#define SYS_getresuid __NR_getresuid
-#define SYS_getresuid32 __NR_getresuid32
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getuid32 __NR_getuid32
-#define SYS_getxattr __NR_getxattr
-#define SYS_gtty __NR_gtty
-#define SYS_idle __NR_idle
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#define SYS_iopl __NR_iopl
-#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
-#define SYS_lchown __NR_lchown
-#define SYS_lchown32 __NR_lchown32
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lock __NR_lock
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mpx __NR_mpx
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_oldfstat __NR_oldfstat
-#define SYS_oldlstat __NR_oldlstat
-#define SYS_oldolduname __NR_oldolduname
-#define SYS_oldstat __NR_oldstat
-#define SYS_olduname __NR_olduname
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#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
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsgid32 __NR_setfsgid32
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setfsuid32 __NR_setfsuid32
-#define SYS_setgid __NR_setgid
-#define SYS_setgid32 __NR_setgid32
-#define SYS_setgroups __NR_setgroups
-#define SYS_setgroups32 __NR_setgroups32
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setregid32 __NR_setregid32
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresgid32 __NR_setresgid32
-#define SYS_setresuid __NR_setresuid
-#define SYS_setresuid32 __NR_setresuid32
-#define SYS_setreuid __NR_setreuid
-#define SYS_setreuid32 __NR_setreuid32
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setuid32 __NR_setuid32
-#define SYS_setxattr __NR_setxattr
-#define SYS_sgetmask __NR_sgetmask
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signal __NR_signal
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_ssetmask __NR_ssetmask
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_stty __NR_stty
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ugetrlimit __NR_ugetrlimit
-#define SYS_ulimit __NR_ulimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vm86 __NR_vm86
-#define SYS_vm86old __NR_vm86old
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_waitpid __NR_waitpid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__x86_64__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_arch_prctl __NR_arch_prctl
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_ctl_old __NR_epoll_ctl_old
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_epoll_wait_old __NR_epoll_wait_old
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#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
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_get_thread_area __NR_get_thread_area
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#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_file_load __NR_kexec_file_load
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#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_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_security __NR_security
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_socket __NR_socket
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_statfs __NR_statfs
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_tuxcall __NR_tuxcall
-#define SYS_umask __NR_umask
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#endif
-#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */
diff --git a/libc/include/sys/syscall.h b/libc/include/sys/syscall.h
index 21eaf33..87cddc9 100644
--- a/libc/include/sys/syscall.h
+++ b/libc/include/sys/syscall.h
@@ -30,7 +30,7 @@
#define _SYS_SYSCALL_H_
#include <asm/unistd.h> /* Linux kernel __NR_* names. */
-#include <sys/glibc-syscalls.h> /* glibc-compatible SYS_* aliases. */
+#include <bits/glibc-syscalls.h> /* glibc-compatible SYS_* aliases. */
/* The syscall function itself is declared in <unistd.h>, not here. */
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index b1938c3..5045267 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -38,10 +38,6 @@
#include <bits/lockf.h>
#include <bits/posix_limits.h>
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatchWrite.h"
-#endif
-
__BEGIN_DECLS
#define STDIN_FILENO 0
@@ -81,6 +77,7 @@
extern char** environ;
extern __noreturn void _exit(int __status);
+
extern pid_t fork(void);
extern pid_t vfork(void);
extern pid_t getpid(void);
@@ -477,11 +474,6 @@
#endif
if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
-#ifdef USE_WRAPPER
- if( __propClientDispatchWrite.propWrite ) {
- __propClientDispatchWrite.propWrite(fd);
- }
-#endif
return __write_real(fd, buf, count);
}
@@ -490,11 +482,6 @@
}
if (__builtin_constant_p(count) && (count <= bos)) {
-#ifdef USE_WRAPPER
- if( __propClientDispatchWrite.propWrite ) {
- __propClientDispatchWrite.propWrite(fd);
- }
-#endif
return __write_real(fd, buf, count);
}
#endif
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index b7daff0..38f8437 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -119,8 +119,6 @@
__pread64_chk;
__pread_chk;
__progname;
- __propClientDispatch; #arm arm64 nobrillo
- __propClientDispatchWrite; #arm arm64 nobrillo
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index a07f4fe..afbd0ee 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -77,8 +77,6 @@
__pread64_chk;
__pread_chk;
__progname;
- __propClientDispatch; #arm arm64 nobrillo
- __propClientDispatchWrite; #arm arm64 nobrillo
__pthread_cleanup_pop;
__pthread_cleanup_push;
__putlong;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index fd9c2c6..0e41f6c 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -119,8 +119,6 @@
__pread64_chk;
__pread_chk;
__progname;
- __propClientDispatch; #arm arm64 nobrillo
- __propClientDispatchWrite; #arm arm64 nobrillo
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 04ccf39..b4aa06c 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -555,41 +555,43 @@
if syscall.has_key("x86_64"):
syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
- # Scan a Linux kernel asm/unistd.h file containing __NR_* constants
+
+ # Scan Linux kernel asm/unistd.h files containing __NR_* constants
# and write out equivalent SYS_* constants for glibc source compatibility.
- def scan_linux_unistd_h(self, fp, path):
- pattern = re.compile(r'^#define __NR_([a-z]\S+) .*')
- syscalls = set() # MIPS defines everything three times; work around that.
- for line in open(path):
- m = re.search(pattern, line)
- if m:
- syscalls.add(m.group(1))
- for syscall in sorted(syscalls):
- fp.write("#define SYS_%s %s\n" % (syscall, make__NR_name(syscall)))
-
-
def gen_glibc_syscalls_h(self):
- # TODO: generate a separate file for each architecture, like glibc's bits/syscall.h.
- glibc_syscalls_h_path = "include/sys/glibc-syscalls.h"
+ glibc_syscalls_h_path = "include/bits/glibc-syscalls.h"
logging.info("generating " + glibc_syscalls_h_path)
glibc_fp = create_file(glibc_syscalls_h_path)
glibc_fp.write("/* %s */\n" % warning)
- glibc_fp.write("#ifndef _BIONIC_GLIBC_SYSCALLS_H_\n")
- glibc_fp.write("#define _BIONIC_GLIBC_SYSCALLS_H_\n")
+ glibc_fp.write("#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
+ glibc_fp.write("#define _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
- glibc_fp.write("#if defined(__aarch64__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-generic/unistd.h"))
- glibc_fp.write("#elif defined(__arm__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-arm/asm/unistd.h"))
- glibc_fp.write("#elif defined(__mips__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-mips/asm/unistd.h"))
- glibc_fp.write("#elif defined(__i386__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(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, os.path.join(bionic_libc_root, "kernel/uapi/asm-x86/asm/unistd_64.h"))
- glibc_fp.write("#endif\n")
+ # Collect the set of all syscalls for all architectures.
+ syscalls = set()
+ pattern = re.compile(r'^\s*#\s*define\s*__NR_([a-z]\S+)')
+ for unistd_h in ["kernel/uapi/asm-generic/unistd.h",
+ "kernel/uapi/asm-arm/asm/unistd.h",
+ "kernel/uapi/asm-mips/asm/unistd.h",
+ "kernel/uapi/asm-x86/asm/unistd_32.h",
+ "kernel/uapi/asm-x86/asm/unistd_64.h"]:
+ for line in open(os.path.join(bionic_libc_root, unistd_h)):
+ m = re.search(pattern, line)
+ if m:
+ nr_name = m.group(1)
+ if 'reserved' not in nr_name and 'unused' not in nr_name:
+ syscalls.add(nr_name)
- glibc_fp.write("#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */\n")
+ # Write out a single file listing them all. Note that the input
+ # files include #if trickery, so even for a single architecture
+ # we don't know exactly which ones are available.
+ # https://code.google.com/p/android/issues/detail?id=215853
+ for syscall in sorted(syscalls):
+ nr_name = make__NR_name(syscall)
+ glibc_fp.write("#if defined(%s)\n" % nr_name)
+ glibc_fp.write(" #define SYS_%s %s\n" % (syscall, nr_name))
+ glibc_fp.write("#endif\n")
+
+ glibc_fp.write("#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */\n")
glibc_fp.close()
self.other_files.append(glibc_syscalls_h_path)
diff --git a/libm/Android.mk b/libm/Android.mk
index 6575e1e..8ea9d37 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -297,10 +297,15 @@
LOCAL_SRC_FILES_arm64 += \
arm64/ceil.S \
arm64/fenv.c \
- arm64/fma.S \
arm64/floor.S \
+ arm64/fma.S \
+ arm64/fmax.S \
+ arm64/fmin.S \
arm64/lrint.S \
+ arm64/lround.S \
+ arm64/nearbyint.S \
arm64/rint.S \
+ arm64/round.S \
arm64/sqrt.S \
arm64/trunc.S \
@@ -311,14 +316,24 @@
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
+ upstream-freebsd/lib/msun/src/s_fmax.c \
+ upstream-freebsd/lib/msun/src/s_fmaxf.c \
+ upstream-freebsd/lib/msun/src/s_fmin.c \
+ upstream-freebsd/lib/msun/src/s_fminf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
+ upstream-freebsd/lib/msun/src/s_llround.c \
+ upstream-freebsd/lib/msun/src/s_llroundf.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
+ upstream-freebsd/lib/msun/src/s_lround.c \
+ upstream-freebsd/lib/msun/src/s_lroundf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
+ upstream-freebsd/lib/msun/src/s_round.c \
+ upstream-freebsd/lib/msun/src/s_roundf.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
diff --git a/libm/arm64/fmax.S b/libm/arm64/fmax.S
new file mode 100644
index 0000000..92ef109
--- /dev/null
+++ b/libm/arm64/fmax.S
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016, Paranoid Android
+ *
+ * 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 <private/bionic_asm.h>
+
+ENTRY(fmax)
+ fmaxnm d0, d0, d1
+ ret
+END(fmax)
+
+ENTRY(fmaxf)
+ fmaxnm s0, s0, s1
+ ret
+END(fmaxf)
diff --git a/libm/arm64/fmin.S b/libm/arm64/fmin.S
new file mode 100644
index 0000000..a23d5f9
--- /dev/null
+++ b/libm/arm64/fmin.S
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016, Paranoid Android
+ *
+ * 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 <private/bionic_asm.h>
+
+ENTRY(fmin)
+ fminnm d0, d0, d1
+ ret
+END(fmin)
+
+ENTRY(fminf)
+ fminnm s0, s0, s1
+ ret
+END(fminf)
diff --git a/libm/arm64/lround.S b/libm/arm64/lround.S
new file mode 100644
index 0000000..a8dd286
--- /dev/null
+++ b/libm/arm64/lround.S
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016, Paranoid Android
+ *
+ * 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 <private/bionic_asm.h>
+
+ENTRY(lround)
+ fcvtas x0, d0
+ ret
+END(lround)
+
+ENTRY(lroundf)
+ fcvtas x0, s0
+ ret
+END(lroundf)
+
+// sizeof(long) and sizeof(long long) are the same for aarch64
+ALIAS_SYMBOL(llround, lround);
+
+ALIAS_SYMBOL(llroundf, lroundf);
diff --git a/libm/arm64/nearbyint.S b/libm/arm64/nearbyint.S
new file mode 100644
index 0000000..db90ccd
--- /dev/null
+++ b/libm/arm64/nearbyint.S
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016, Paranoid Android
+ *
+ * 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 <private/bionic_asm.h>
+
+ENTRY(nearbyint)
+ frinti d0, d0
+ ret
+END(nearbyint)
+
+ENTRY(nearbyintf)
+ frinti s0, s0
+ ret
+END(nearbyintf)
diff --git a/libm/arm64/round.S b/libm/arm64/round.S
new file mode 100644
index 0000000..95b3941
--- /dev/null
+++ b/libm/arm64/round.S
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016, Paranoid Android
+ *
+ * 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 <private/bionic_asm.h>
+
+ENTRY(round)
+ frinta d0, d0
+ ret
+END(round)
+
+ENTRY(roundf)
+ frinta s0, s0
+ ret
+END(roundf)
diff --git a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
index 063f8d7..760abd1 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
@@ -54,6 +54,8 @@
return (ret); \
}
+#ifndef __aarch64__
DECL(double, nearbyint, rint)
DECL(float, nearbyintf, rintf)
+#endif
DECL(long double, nearbyintl, rintl)
diff --git a/linker/Android.mk b/linker/Android.mk
index 4a4ca5c..d77ea3d 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -54,9 +54,17 @@
LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
endif
+ifeq ($(TARGET_NEEDS_PLATFORM_TEXT_RELOCATIONS),true)
+LOCAL_CPPFLAGS += -DTARGET_NEEDS_PLATFORM_TEXT_RELOCATIONS
+endif
+
# We need to access Bionic private headers in the linker.
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
+ifneq ($(LINKER_FORCED_SHIM_LIBS),)
+ LOCAL_CFLAGS += -DFORCED_SHIM_LIBS="\"$(LINKER_FORCED_SHIM_LIBS)\""
+endif
+
# we don't want crtbegin.o (because we have begin.o), so unset it
# just for this module
LOCAL_NO_CRT := true
diff --git a/linker/arch/arm/begin.S b/linker/arch/arm/begin.S
index 8cb599b..480047a 100644
--- a/linker/arch/arm/begin.S
+++ b/linker/arch/arm/begin.S
@@ -33,5 +33,5 @@
bl __linker_init
/* linker init returns the _entry address in the main image */
- mov pc, r0
+ bx r0
END(_start)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 9dc928e..940b63b 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1138,6 +1138,7 @@
}
void set_fd(int fd, bool assume_ownership) {
+ clean_fd();
fd_ = fd;
close_fd_ = assume_ownership;
}
@@ -1201,6 +1202,10 @@
is_dt_needed_(false) {}
~LoadTask() {
+ clean_fd();
+ }
+
+ void clean_fd() {
if (fd_ != -1 && close_fd_) {
close(fd_);
}
@@ -1229,7 +1234,76 @@
typedef linked_list_t<soinfo> SoinfoLinkedList;
typedef linked_list_t<const char> StringLinkedList;
typedef std::vector<LoadTask*> LoadTaskList;
+typedef std::vector<std::string> LoadErrorList;
+static soinfo* find_library(android_namespace_t* ns,
+ const char* name, int rtld_flags,
+ const android_dlextinfo* extinfo,
+ soinfo* needed_by);
+
+// g_ld_all_shim_libs maintains the references to memory as it used
+// in the soinfo structures and in the g_active_shim_libs list.
+
+typedef std::pair<std::string, std::string> ShimDescriptor;
+static std::vector<ShimDescriptor> g_ld_all_shim_libs;
+
+// g_active_shim_libs are all shim libs that are still eligible
+// to be loaded. We must remove a shim lib from the list before
+// we load the library to avoid recursive loops (load shim libA
+// for libB where libA also links against libB).
+
+static linked_list_t<const ShimDescriptor> g_active_shim_libs;
+
+static void reset_g_active_shim_libs(void) {
+ g_active_shim_libs.clear();
+ for (const auto& pair : g_ld_all_shim_libs) {
+ g_active_shim_libs.push_back(&pair);
+ }
+}
+
+static void parse_shim_libs(const char* path) {
+ if (path != nullptr) {
+ // We have historically supported ':' as well as ' ' in LD_SHIM_LIBS.
+ for (const auto& pair : android::base::Split(path, " :")) {
+ size_t pos = pair.find('|');
+ if (pos > 0 && pos < pair.length() - 1) {
+ auto desc = std::pair<std::string, std::string>(pair.substr(0, pos), pair.substr(pos + 1));
+ g_ld_all_shim_libs.push_back(desc);
+ }
+ }
+ }
+ reset_g_active_shim_libs();
+}
+
+static void parse_LD_SHIM_LIBS(const char* path) {
+ g_ld_all_shim_libs.clear();
+#ifdef FORCED_SHIM_LIBS
+ parse_shim_libs(FORCED_SHIM_LIBS);
+#endif
+ parse_shim_libs(path);
+}
+
+template<typename F>
+static void for_each_matching_shim(const char *const path, F action) {
+ if (path == nullptr) return;
+ INFO("Finding shim libs for \"%s\"\n", path);
+ std::vector<const ShimDescriptor *> matched;
+
+ g_active_shim_libs.for_each([&](const ShimDescriptor *a_pair) {
+ if (a_pair->first == path) {
+ matched.push_back(a_pair);
+ }
+ });
+
+ g_active_shim_libs.remove_if([&](const ShimDescriptor *a_pair) {
+ return a_pair->first == path;
+ });
+
+ for (const auto& one_pair : matched) {
+ INFO("Injecting shim lib \"%s\" as needed for %s", one_pair->second.c_str(), path);
+ action(one_pair->second.c_str());
+ }
+}
// This function walks down the tree of soinfo dependencies
// in breadth-first order and
@@ -1563,91 +1637,111 @@
return true;
}
-static int open_library_on_paths(ZipArchiveCache* zip_archive_cache,
- const char* name, off64_t* file_offset,
- const std::vector<std::string>& paths,
- std::string* realpath) {
- for (const auto& path : paths) {
- char buf[512];
- if (!format_path(buf, sizeof(buf), path.c_str(), name)) {
- continue;
- }
+static bool do_load_library(android_namespace_t* ns,
+ LoadTask* task,
+ LoadTaskList* load_tasks,
+ int rtld_flags,
+ const std::string& realpath);
- int fd = -1;
- if (strstr(buf, kZipFileSeparator) != nullptr) {
- fd = open_library_in_zipfile(zip_archive_cache, buf, file_offset, realpath);
- }
+static bool open_load_library_at_path(ZipArchiveCache* zip_archive_cache,
+ const char* path,
+ android_namespace_t* ns,
+ LoadTask* task,
+ LoadTaskList* load_tasks,
+ int rtld_flags,
+ LoadErrorList* failed_attempts) {
+ int fd = -1;
+ off64_t file_offset;
+ std::string realpath;
+ bool success = false;
- if (fd == -1) {
- fd = TEMP_FAILURE_RETRY(open(buf, O_RDONLY | O_CLOEXEC));
- if (fd != -1) {
- *file_offset = 0;
- if (!realpath_fd(fd, realpath)) {
- PRINT("warning: unable to get realpath for the library \"%s\". Will use given path.", buf);
- *realpath = buf;
- }
- }
- }
+ if (strstr(path, kZipFileSeparator) != nullptr) {
+ fd = open_library_in_zipfile(zip_archive_cache, path, &file_offset, &realpath);
+ }
+ if (fd == -1) {
+ fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC));
if (fd != -1) {
- return fd;
+ file_offset = 0;
+ if (!realpath_fd(fd, &realpath)) {
+ PRINT("warning: unable to get realpath for the library \"%s\". Will use given path.", path);
+ realpath = path;
+ }
}
}
- return -1;
+ if (fd != -1) {
+ task->set_fd(fd, true);
+ task->set_file_offset(file_offset);
+ success = do_load_library(ns, task, load_tasks, rtld_flags, realpath);
+ if (!success) {
+ failed_attempts->emplace_back(linker_get_error_buffer());
+ }
+ }
+
+ return success;
}
-static int open_library(android_namespace_t* ns,
- ZipArchiveCache* zip_archive_cache,
- const char* name, soinfo *needed_by,
- off64_t* file_offset, std::string* realpath) {
+static bool open_load_library_in_paths(ZipArchiveCache* zip_archive_cache,
+ const std::vector<std::string>& paths,
+ android_namespace_t* ns,
+ LoadTask* task,
+ LoadTaskList* load_tasks,
+ int rtld_flags,
+ LoadErrorList* failed_attempts) {
+ for (const auto& path : paths) {
+ char buf[512];
+ if (!format_path(buf, sizeof(buf), path.c_str(), task->get_name())) {
+ continue;
+ }
+
+ if (open_load_library_at_path(zip_archive_cache, buf, ns, task, load_tasks, rtld_flags,
+ failed_attempts)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool open_load_library(android_namespace_t* ns,
+ LoadTask* task,
+ ZipArchiveCache* zip_archive_cache,
+ LoadTaskList* load_tasks,
+ int rtld_flags,
+ LoadErrorList* failed_attempts) {
+ const char* name = task->get_name();
TRACE("[ opening %s ]", name);
// If the name contains a slash, we should attempt to open it directly and not search the paths.
if (strchr(name, '/') != nullptr) {
- int fd = -1;
-
- if (strstr(name, kZipFileSeparator) != nullptr) {
- fd = open_library_in_zipfile(zip_archive_cache, name, file_offset, realpath);
- }
-
- if (fd == -1) {
- fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CLOEXEC));
- if (fd != -1) {
- *file_offset = 0;
- if (!realpath_fd(fd, realpath)) {
- PRINT("warning: unable to get realpath for the library \"%s\". Will use given path.", name);
- *realpath = name;
- }
- }
- }
-
- return fd;
+ return open_load_library_at_path(zip_archive_cache, name, ns, task, load_tasks, rtld_flags,
+ failed_attempts);
}
// Otherwise we try LD_LIBRARY_PATH first, and fall back to the default library path
- int fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_ld_library_paths(), realpath);
- if (fd == -1 && needed_by != nullptr) {
- fd = open_library_on_paths(zip_archive_cache, name, file_offset, needed_by->get_dt_runpath(), realpath);
- // Check if the library is accessible
- if (fd != -1 && !ns->is_accessible(*realpath)) {
- fd = -1;
- }
+ soinfo* needed_by = task->get_needed_by();
+ bool success = open_load_library_in_paths(zip_archive_cache, ns->get_ld_library_paths(), ns,
+ task, load_tasks, rtld_flags, failed_attempts);
+ if (!success && needed_by != nullptr) {
+ success = open_load_library_in_paths(zip_archive_cache, needed_by->get_dt_runpath(), ns,
+ task, load_tasks, rtld_flags, failed_attempts);
}
-
- if (fd == -1) {
- fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_default_library_paths(), realpath);
+ if (!success) {
+ success = open_load_library_in_paths(zip_archive_cache, ns->get_default_library_paths(), ns,
+ task, load_tasks, rtld_flags, failed_attempts);
}
// TODO(dimitry): workaround for http://b/26394120 (the grey-list)
- if (fd == -1 && ns != &g_default_namespace && is_greylisted(name, needed_by)) {
+ if (!success && ns != &g_default_namespace && is_greylisted(name, needed_by)) {
// try searching for it on default_namespace default_library_path
- fd = open_library_on_paths(zip_archive_cache, name, file_offset,
- g_default_namespace.get_default_library_paths(), realpath);
+ success = open_load_library_in_paths(zip_archive_cache,
+ g_default_namespace.get_default_library_paths(), ns,
+ task, load_tasks, rtld_flags, failed_attempts);
}
// END OF WORKAROUND
- return fd;
+ return success;
}
static const char* fix_dt_needed(const char* dt_needed, const char* sopath __unused) {
@@ -1668,6 +1762,7 @@
template<typename F>
static void for_each_dt_needed(const soinfo* si, F action) {
+ for_each_matching_shim(si->get_realpath(), action);
for (const ElfW(Dyn)* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
if (d->d_tag == DT_NEEDED) {
action(fix_dt_needed(si->get_string(d->d_un.d_val), si->get_realpath()));
@@ -1677,6 +1772,7 @@
template<typename F>
static void for_each_dt_needed(const ElfReader& elf_reader, F action) {
+ for_each_matching_shim(elf_reader.name(), action);
for (const ElfW(Dyn)* d = elf_reader.dynamic(); d->d_tag != DT_NULL; ++d) {
if (d->d_tag == DT_NEEDED) {
action(fix_dt_needed(elf_reader.get_string(d->d_un.d_val), elf_reader.name()));
@@ -1684,13 +1780,13 @@
}
}
-static bool load_library(android_namespace_t* ns,
- LoadTask* task,
- LoadTaskList* load_tasks,
- int rtld_flags,
- const std::string& realpath) {
+static bool do_load_library(android_namespace_t* ns,
+ LoadTask* task,
+ LoadTaskList* load_tasks,
+ int rtld_flags,
+ const std::string& realpath) {
off64_t file_offset = task->get_file_offset();
- const char* name = task->get_name();
+ const char* name = realpath.c_str();
const android_dlextinfo* extinfo = task->get_extinfo();
if ((file_offset % PAGE_SIZE) != 0) {
@@ -1784,7 +1880,7 @@
}
}
- soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);
+ soinfo* si = soinfo_alloc(ns, name, &file_stat, file_offset, rtld_flags);
if (si == nullptr) {
return false;
}
@@ -1792,7 +1888,7 @@
task->set_soinfo(si);
// Read the ELF header and some of the segments.
- if (!task->read(realpath.c_str(), file_stat.st_size)) {
+ if (!task->read(name, file_stat.st_size)) {
soinfo_free(si);
task->set_soinfo(nullptr);
return false;
@@ -1825,13 +1921,11 @@
LoadTaskList* load_tasks,
int rtld_flags) {
const char* name = task->get_name();
- soinfo* needed_by = task->get_needed_by();
const android_dlextinfo* extinfo = task->get_extinfo();
- off64_t file_offset;
- std::string realpath;
if (extinfo != nullptr && (extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD) != 0) {
- file_offset = 0;
+ off64_t file_offset = 0;
+ std::string realpath;
if ((extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET) != 0) {
file_offset = extinfo->library_fd_offset;
}
@@ -1844,20 +1938,27 @@
task->set_fd(extinfo->library_fd, false);
task->set_file_offset(file_offset);
- return load_library(ns, task, load_tasks, rtld_flags, realpath);
+ return do_load_library(ns, task, load_tasks, rtld_flags, realpath);
}
- // Open the file.
- int fd = open_library(ns, zip_archive_cache, name, needed_by, &file_offset, &realpath);
- if (fd == -1) {
- DL_ERR("library \"%s\" not found", name);
- return false;
+ // List of failed attempts (error message).
+ LoadErrorList failed_attempts;
+ bool success = open_load_library(ns, task, zip_archive_cache, load_tasks,
+ rtld_flags, &failed_attempts);
+ if (!success) {
+ if (failed_attempts.empty()) {
+ DL_ERR("library \"%s\" not found", name);
+ } else {
+ // Print every failed attempt.
+ std::ostringstream str;
+ for (const auto& message : failed_attempts) {
+ str << '\n' << message;
+ }
+ DL_ERR("could not load \"%s\". Errors encountered:%s", name, str.str().c_str());
+ }
}
- task->set_fd(fd, true);
- task->set_file_offset(file_offset);
-
- return load_library(ns, task, load_tasks, rtld_flags, realpath);
+ return success;
}
// Returns true if library was found and false in 2 cases
@@ -2397,6 +2498,7 @@
}
ProtectedDataGuard guard;
+ reset_g_active_shim_libs();
soinfo* si = find_library(ns, translated_name, flags, extinfo, caller);
if (si != nullptr) {
si->call_constructors();
@@ -3950,11 +4052,18 @@
#if !defined(__LP64__)
if (has_text_relocations) {
// Fail if app is targeting sdk version > 22
+#if !defined(__i386__) // ffmpeg says that they require text relocations on x86
+#if defined(TARGET_NEEDS_PLATFORM_TEXT_RELOCATIONS)
+ if (get_application_target_sdk_version() != __ANDROID_API__
+ && get_application_target_sdk_version() > 22) {
+#else
if (get_application_target_sdk_version() > 22) {
+#endif
PRINT("%s: has text relocations", get_realpath());
DL_ERR("%s: has text relocations", get_realpath());
return false;
}
+#endif
// Make segments writable to allow text relocations to work properly. We will later call
// phdr_table_protect_segments() after all of them are applied.
DL_WARN("%s has text relocations. This is wasting memory and prevents "
@@ -4217,6 +4326,7 @@
// doesn't cost us anything.
const char* ldpath_env = nullptr;
const char* ldpreload_env = nullptr;
+ const char* ldshim_libs_env = nullptr;
if (!getauxval(AT_SECURE)) {
ldpath_env = getenv("LD_LIBRARY_PATH");
if (ldpath_env != nullptr) {
@@ -4226,6 +4336,7 @@
if (ldpreload_env != nullptr) {
INFO("[ LD_PRELOAD set to \"%s\" ]", ldpreload_env);
}
+ ldshim_libs_env = getenv("LD_SHIM_LIBS");
}
struct stat file_stat;
@@ -4284,6 +4395,7 @@
// Use LD_LIBRARY_PATH and LD_PRELOAD (but only if we aren't setuid/setgid).
parse_LD_LIBRARY_PATH(ldpath_env);
parse_LD_PRELOAD(ldpreload_env);
+ parse_LD_SHIM_LIBS(ldshim_libs_env);
somain = si;
diff --git a/tests/sys_syscall_test.cpp b/tests/sys_syscall_test.cpp
index 9c5e350..68a7167 100644
--- a/tests/sys_syscall_test.cpp
+++ b/tests/sys_syscall_test.cpp
@@ -21,3 +21,10 @@
TEST(unistd, syscall) {
ASSERT_EQ(getpid(), syscall(SYS_getpid));
}
+
+// https://code.google.com/p/android/issues/detail?id=215853
+#if defined(__LP64__)
+ #if defined(SYS_mmap2)
+ #error SYS_mmap2 should not be defined for LP64
+ #endif
+#endif