Merge "Deprecate sys.linker.use_generated_config property"
diff --git a/README.md b/README.md
index 6bece25..388a139 100644
--- a/README.md
+++ b/README.md
@@ -62,8 +62,6 @@
arch-arm/
arch-arm64/
arch-common/
- arch-mips/
- arch-mips64/
arch-x86/
arch-x86_64/
# Each architecture has its own subdirectory for stuff that isn't shared
diff --git a/docs/32-bit-abi.md b/docs/32-bit-abi.md
index 0ea94d4..81afd14 100644
--- a/docs/32-bit-abi.md
+++ b/docs/32-bit-abi.md
@@ -65,11 +65,11 @@
## `sigset_t` is too small for real-time signals
-On 32-bit Android, `sigset_t` is too small for ARM and x86 (but correct for
-MIPS). This means that there is no support for real-time signals in 32-bit
-code. Android P (API level 28) adds `sigset64_t` and a corresponding function
-for every function that takes a `sigset_t` (so `sigprocmask64` takes a
-`sigset64_t` where `sigprocmask` takes a `sigset_t`).
+On 32-bit Android, `sigset_t` is too small for ARM and x86. This means that
+there is no support for real-time signals in 32-bit code. Android P (API
+level 28) adds `sigset64_t` and a corresponding function for every function
+that takes a `sigset_t` (so `sigprocmask64` takes a `sigset64_t` where
+`sigprocmask` takes a `sigset_t`).
On 32-bit Android, `struct sigaction` is also too small because it contains
a `sigset_t`. We also offer a `struct sigaction64` and `sigaction64` function
diff --git a/libc/Android.bp b/libc/Android.bp
index 92951f7..80b157a 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -613,20 +613,6 @@
"upstream-openbsd/lib/libc/string/strncmp.c",
],
},
- mips: {
- exclude_srcs: [
- "upstream-openbsd/lib/libc/string/memchr.c",
- "upstream-openbsd/lib/libc/string/strcpy.c",
- "upstream-openbsd/lib/libc/string/strncmp.c",
- ],
- },
- mips64: {
- exclude_srcs: [
- "upstream-openbsd/lib/libc/string/memchr.c",
- "upstream-openbsd/lib/libc/string/strcpy.c",
- "upstream-openbsd/lib/libc/string/strncmp.c",
- ],
- },
x86: {
exclude_srcs: [
"upstream-openbsd/lib/libc/string/memchr.c",
@@ -886,60 +872,6 @@
],
},
- mips: {
- srcs: [
- "arch-mips/string/memcmp.c",
- "arch-mips/string/memcpy.c",
- "arch-mips/string/memset.S",
- "arch-mips/string/strcmp.S",
- "arch-mips/string/strncmp.S",
- "arch-mips/string/strlen.c",
- "arch-mips/string/strnlen.c",
- "arch-mips/string/strchr.c",
- "arch-mips/string/strcpy.c",
- "arch-mips/string/memchr.c",
- "arch-mips/string/memmove.c",
-
- "arch-mips/bionic/__bionic_clone.S",
- "arch-mips/bionic/cacheflush.cpp",
- "arch-mips/bionic/_exit_with_stack_teardown.S",
- "arch-mips/bionic/libcrt_compat.c",
- "arch-mips/bionic/setjmp.S",
- "arch-mips/bionic/syscall.S",
- "arch-mips/bionic/vfork.S",
- ],
- exclude_srcs: [
- "bionic/strchr.cpp",
- "bionic/strnlen.c",
- ],
- },
- mips64: {
- srcs: [
- "arch-mips/string/memcmp.c",
- "arch-mips/string/memcpy.c",
- "arch-mips/string/memset.S",
- "arch-mips/string/strcmp.S",
- "arch-mips/string/strncmp.S",
- "arch-mips/string/strlen.c",
- "arch-mips/string/strnlen.c",
- "arch-mips/string/strchr.c",
- "arch-mips/string/strcpy.c",
- "arch-mips/string/memchr.c",
- "arch-mips/string/memmove.c",
-
- "arch-mips64/bionic/__bionic_clone.S",
- "arch-mips64/bionic/_exit_with_stack_teardown.S",
- "arch-mips64/bionic/setjmp.S",
- "arch-mips64/bionic/syscall.S",
- "arch-mips64/bionic/vfork.S",
- "arch-mips64/bionic/stat.cpp",
- ],
- exclude_srcs: [
- "bionic/strchr.cpp",
- "bionic/strnlen.c",
- ],
- },
-
x86: {
srcs: [
"arch-x86/generic/string/memcmp.S",
@@ -1990,12 +1922,6 @@
defaults: ["crt_defaults"],
arch: {
- mips: {
- cflags: ["-fPIC"],
- },
- mips64: {
- cflags: ["-fPIC"],
- },
x86: {
cflags: ["-fPIC"],
},
@@ -2050,26 +1976,6 @@
name: "crtbegin_static1",
local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin.c"],
-
- arch: {
- mips: {
- srcs: [
- "arch-mips/bionic/crtbegin.c",
- ],
- exclude_srcs: [
- "arch-common/bionic/crtbegin.c",
- ],
- },
- mips64: {
- srcs: [
- "arch-mips64/bionic/crtbegin.c",
- ],
- exclude_srcs: [
- "arch-common/bionic/crtbegin.c",
- ],
- },
- },
-
defaults: ["crt_defaults"],
}
@@ -2087,25 +1993,6 @@
name: "crtbegin_dynamic1",
local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin.c"],
-
- arch: {
- mips: {
- srcs: [
- "arch-mips/bionic/crtbegin.c",
- ],
- exclude_srcs: [
- "arch-common/bionic/crtbegin.c",
- ],
- },
- mips64: {
- srcs: [
- "arch-mips64/bionic/crtbegin.c",
- ],
- exclude_srcs: [
- "arch-common/bionic/crtbegin.c",
- ],
- },
- },
defaults: ["crt_defaults"],
}
diff --git a/libc/NOTICE b/libc/NOTICE
index 87d39c9..8245ff8 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -2568,38 +2568,6 @@
-------------------------------------------------------------------
-Copyright (c) 1991, 1993, 1995,
- The Regents of the University of California. All rights reserved.
-
-This code is derived from software contributed to Berkeley by
-Havard Eidnes.
-
-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. Neither the name of the University 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 REGENTS 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 REGENTS 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) 1992 Henry Spencer.
Copyright (c) 1992, 1993
The Regents of the University of California. All rights reserved.
@@ -2727,38 +2695,6 @@
Copyright (c) 1992, 1993
The Regents of the University of California. All rights reserved.
-This code is derived from software contributed to Berkeley by
-Ralph Campbell.
-
-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. Neither the name of the University 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 REGENTS 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 REGENTS 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) 1992, 1993
- The Regents of the University of California. All rights reserved.
-
This software was developed by the Computer Systems Engineering group
at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
contributed to Berkeley.
@@ -3522,59 +3458,6 @@
-------------------------------------------------------------------
-Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. Neither the name of Opsycon AB 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 AUTHOR ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2001-2011 The FreeBSD Project.
All rights reserved.
@@ -5425,35 +5308,6 @@
-------------------------------------------------------------------
-Copyright (c) 2013
- MIPS Technologies, Inc., California.
-
-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. Neither the name of the MIPS Technologies, Inc., nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2013 ARM Ltd
All rights reserved.
@@ -5806,38 +5660,6 @@
-------------------------------------------------------------------
-Copyright (c) 2017 Imagination Technologies.
-
-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 Imagination Technologies nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c)1999 Citrus Project,
All rights reserved.
diff --git a/libc/SECCOMP_BLACKLIST_APP.TXT b/libc/SECCOMP_BLACKLIST_APP.TXT
index b7a05c4..40ca222 100644
--- a/libc/SECCOMP_BLACKLIST_APP.TXT
+++ b/libc/SECCOMP_BLACKLIST_APP.TXT
@@ -4,28 +4,6 @@
# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
#
-# Each non-blank, non-comment line has the following format:
-#
-# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
-#
-# where:
-# arch_list ::= "all" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
-#
-# Note:
-# - syscall_name corresponds to the name of the syscall, which may differ from
-# the exported function name (example: the exit syscall is implemented by the _exit()
-# function, which is not the same as the standard C exit() function which calls it)
-
-# - alias_list is optional comma separated list of function aliases
-#
-# - The call_id parameter, given that func_name and syscall_name have
-# been provided, allows the user to specify dispatch style syscalls.
-# For example, socket() syscall on i386 actually becomes:
-# socketcall(__NR_socket, 1, *(rest of args on stack)).
-#
-# - Each parameter type is assumed to be stored in 32 bits.
-#
# This file is processed by a python script named genseccomp.py.
# Note: Some privileged syscalls are still needed in app process after fork before uid change,
@@ -33,21 +11,21 @@
# the process still has CAP_SYS_ADMIN; changing the uid would remove that capability.
# syscalls to modify IDs
-int setgid:setgid32(gid_t) arm,x86
-int setgid:setgid(gid_t) arm64,mips,mips64,x86_64
-int setuid:setuid32(uid_t) arm,x86
-int setuid:setuid(uid_t) arm64,mips,mips64,x86_64
-int setregid:setregid32(gid_t, gid_t) arm,x86
-int setregid:setregid(gid_t, gid_t) arm64,mips,mips64,x86_64
-int setreuid:setreuid32(uid_t, uid_t) arm,x86
-int setreuid:setreuid(uid_t, uid_t) arm64,mips,mips64,x86_64
-int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86
-int setresgid:setresgid(gid_t, gid_t, gid_t) arm64,mips,mips64,x86_64
+int setgid:setgid32(gid_t) lp32
+int setgid:setgid(gid_t) lp64
+int setuid:setuid32(uid_t) lp32
+int setuid:setuid(uid_t) lp64
+int setregid:setregid32(gid_t, gid_t) lp32
+int setregid:setregid(gid_t, gid_t) lp64
+int setreuid:setreuid32(uid_t, uid_t) lp32
+int setreuid:setreuid(uid_t, uid_t) lp64
+int setresgid:setresgid32(gid_t, gid_t, gid_t) lp32
+int setresgid:setresgid(gid_t, gid_t, gid_t) lp64
# setresuid is explicitly allowed, see above.
int setfsgid(gid_t) all
int setfsuid(uid_t) all
-int setgroups:setgroups32(int, const gid_t*) arm,x86
-int setgroups:setgroups(int, const gid_t*) arm64,mips,mips64,x86_64
+int setgroups:setgroups32(int, const gid_t*) lp32
+int setgroups:setgroups(int, const gid_t*) lp64
# syscalls to modify times
int adjtimex(struct timex*) all
diff --git a/libc/SECCOMP_BLACKLIST_COMMON.TXT b/libc/SECCOMP_BLACKLIST_COMMON.TXT
index f279002..8ae21c1 100644
--- a/libc/SECCOMP_BLACKLIST_COMMON.TXT
+++ b/libc/SECCOMP_BLACKLIST_COMMON.TXT
@@ -4,28 +4,6 @@
# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
#
-# Each non-blank, non-comment line has the following format:
-#
-# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
-#
-# where:
-# arch_list ::= "all" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
-#
-# Note:
-# - syscall_name corresponds to the name of the syscall, which may differ from
-# the exported function name (example: the exit syscall is implemented by the _exit()
-# function, which is not the same as the standard C exit() function which calls it)
-
-# - alias_list is optional comma separated list of function aliases
-#
-# - The call_id parameter, given that func_name and syscall_name have
-# been provided, allows the user to specify dispatch style syscalls.
-# For example, socket() syscall on i386 actually becomes:
-# socketcall(__NR_socket, 1, *(rest of args on stack)).
-#
-# - Each parameter type is assumed to be stored in 32 bits.
-#
# This file is processed by a python script named genseccomp.py.
int swapon(const char*, int) all
diff --git a/libc/SECCOMP_WHITELIST_APP.TXT b/libc/SECCOMP_WHITELIST_APP.TXT
index faa2d63..dc48715 100644
--- a/libc/SECCOMP_WHITELIST_APP.TXT
+++ b/libc/SECCOMP_WHITELIST_APP.TXT
@@ -1,80 +1,58 @@
# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
-# Each non-blank, non-comment line has the following format:
-#
-# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
-#
-# where:
-# arch_list ::= "all" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
-#
-# Note:
-# - syscall_name corresponds to the name of the syscall, which may differ from
-# the exported function name (example: the exit syscall is implemented by the _exit()
-# function, which is not the same as the standard C exit() function which calls it)
-
-# - alias_list is optional comma separated list of function aliases
-#
-# - The call_id parameter, given that func_name and syscall_name have
-# been provided, allows the user to specify dispatch style syscalls.
-# For example, socket() syscall on i386 actually becomes:
-# socketcall(__NR_socket, 1, *(rest of args on stack)).
-#
-# - Each parameter type is assumed to be stored in 32 bits.
-#
# This file is processed by a python script named genseccomp.py.
# Needed for debugging 32-bit Chrome
-int pipe:pipe(int pipefd[2]) arm,x86,mips
+int pipe:pipe(int pipefd[2]) lp32
# b/34651972
-int access:access(const char *pathname, int mode) arm,x86,mips
-int stat64:stat64(const char*, struct stat64*) arm,x86,mips
+int access:access(const char *pathname, int mode) lp32
+int stat64:stat64(const char*, struct stat64*) lp32
# b/34813887
-int open:open(const char *path, int oflag, ... ) arm,x86,x86_64,mips
-int getdents:getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count) arm,x86,x86_64,mips
+int open:open(const char *path, int oflag, ... ) lp32,x86_64
+int getdents:getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count) lp32,x86_64
# b/34719286
-int eventfd:eventfd(unsigned int initval, int flags) arm,x86,mips
+int eventfd:eventfd(unsigned int initval, int flags) lp32
# b/34817266
-int epoll_wait:epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) arm,x86,mips
+int epoll_wait:epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) lp32
# b/34908783
-int epoll_create:epoll_create(int size) arm,x86,mips
+int epoll_create:epoll_create(int size) lp32
# b/34979910
-int creat:creat(const char *pathname, mode_t mode) arm,x86,mips
-int unlink:unlink(const char *pathname) arm,x86,mips
+int creat:creat(const char *pathname, mode_t mode) lp32
+int unlink:unlink(const char *pathname) lp32
# b/35059702
-int lstat64:lstat64(const char*, struct stat64*) arm,x86,mips
+int lstat64:lstat64(const char*, struct stat64*) lp32
# b/35217603
-int fcntl:fcntl(int fd, int cmd, ... /* arg */ ) arm,x86,mips
-pid_t fork:fork() arm,x86,mips
-int poll:poll(struct pollfd *fds, nfds_t nfds, int timeout) arm,x86,mips
+int fcntl:fcntl(int fd, int cmd, ... /* arg */ ) lp32
+pid_t fork:fork() lp32
+int poll:poll(struct pollfd *fds, nfds_t nfds, int timeout) lp32
-# b/35906875. Note mips already has getuid from SYSCALLS.TXT
-int inotify_init() arm,x86,mips
-uid_t getuid() arm,x86
+# b/35906875
+int inotify_init() lp32
+uid_t getuid() lp32
# b/36435222
-int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags) arm,x86,mips
+int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags) lp32
# b/36449658
-int rename(const char *oldpath, const char *newpath) arm,x86,mips
+int rename(const char *oldpath, const char *newpath) lp32
# b/36726183. Note arm does not support mmap
-void* mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) x86,mips
+void* mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) x86
# b/37769298
-int dup2(int oldfd, int newfd) arm,x86,mips
+int dup2(int oldfd, int newfd) lp32
# b/62779795
-int compat_select:_newselect(int n, unsigned long* inp, unsigned long* outp, unsigned long* exp, struct timeval* timeout) arm,x86,mips
+int compat_select:_newselect(int n, unsigned long* inp, unsigned long* outp, unsigned long* exp, struct timeval* timeout) lp32
# b/62090571
-int mkdir(const char *pathname, mode_t mode) arm,x86,mips
+int mkdir(const char *pathname, mode_t mode) lp32
diff --git a/libc/SECCOMP_WHITELIST_COMMON.TXT b/libc/SECCOMP_WHITELIST_COMMON.TXT
index c55d875..72ced4f 100644
--- a/libc/SECCOMP_WHITELIST_COMMON.TXT
+++ b/libc/SECCOMP_WHITELIST_COMMON.TXT
@@ -1,44 +1,19 @@
# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
-# Each non-blank, non-comment line has the following format:
-#
-# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
-#
-# where:
-# arch_list ::= "all" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
-#
-# Note:
-# - syscall_name corresponds to the name of the syscall, which may differ from
-# the exported function name (example: the exit syscall is implemented by the _exit()
-# function, which is not the same as the standard C exit() function which calls it)
-
-# - alias_list is optional comma separated list of function aliases
-#
-# - The call_id parameter, given that func_name and syscall_name have
-# been provided, allows the user to specify dispatch style syscalls.
-# For example, socket() syscall on i386 actually becomes:
-# socketcall(__NR_socket, 1, *(rest of args on stack)).
-#
-# - Each parameter type is assumed to be stored in 32 bits.
-#
# This file is processed by a python script named genseccomp.py.
# syscalls needed to boot android
-int pivot_root:pivot_root(const char *new_root, const char *put_old) arm64,x86_64,mips64
-int ioprio_get:ioprio_get(int which, int who) arm64,x86_64,mips64
-int ioprio_set:ioprio_set(int which, int who, int ioprio) arm64,x86_64,mips64
+int pivot_root:pivot_root(const char *new_root, const char *put_old) lp64
+int ioprio_get:ioprio_get(int which, int who) lp64
+int ioprio_set:ioprio_set(int which, int who, int ioprio) lp64
pid_t gettid:gettid() all
int futex:futex(int *uaddr, int futex_op, int val, const struct timespec *timeout, int *uaddr2, int val3) all
int clone:clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ..) all
-int sigreturn:sigreturn(unsigned long __unused) arm,x86,mips
+int sigreturn:sigreturn(unsigned long __unused) lp32
int rt_sigreturn:rt_sigreturn(unsigned long __unused) all
int rt_tgsigqueueinfo:int rt_tgsigqueueinfo(pid_t tgid, pid_t tid, int sig, siginfo_t *uinfo) all
int restart_syscall:int restart_syscall() all
-int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int) mips64
-int fstat64|fstat:fstat(int, struct stat*) mips64
-int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips64
# vfork is used by java.lang.ProcessBuilder
pid_t vfork:vfork() arm,x86,x86_64
diff --git a/libc/SECCOMP_WHITELIST_SYSTEM.TXT b/libc/SECCOMP_WHITELIST_SYSTEM.TXT
index 155867f..266fe30 100644
--- a/libc/SECCOMP_WHITELIST_SYSTEM.TXT
+++ b/libc/SECCOMP_WHITELIST_SYSTEM.TXT
@@ -1,28 +1,6 @@
# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
-# Each non-blank, non-comment line has the following format:
-#
-# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
-#
-# where:
-# arch_list ::= "all" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
-#
-# Note:
-# - syscall_name corresponds to the name of the syscall, which may differ from
-# the exported function name (example: the exit syscall is implemented by the _exit()
-# function, which is not the same as the standard C exit() function which calls it)
-
-# - alias_list is optional comma separated list of function aliases
-#
-# - The call_id parameter, given that func_name and syscall_name have
-# been provided, allows the user to specify dispatch style syscalls.
-# For example, socket() syscall on i386 actually becomes:
-# socketcall(__NR_socket, 1, *(rest of args on stack)).
-#
-# - Each parameter type is assumed to be stored in 32 bits.
-#
# This file is processed by a python script named genseccomp.py.
int bpf(int cmd, union bpf_attr *attr, unsigned int size) all
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 1343e4e..571df22 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -5,8 +5,9 @@
# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list
#
# where:
-# arch_list ::= "all" | "lp32" | "lp64" | arch+
-# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64"
+# arch_list ::= "all" | arches
+# arches ::= arch | arch "," arches
+# arch ::= "arm" | "arm64" | "x86" | "x86_64" | "lp32" | "lp64"
#
# Note:
# - syscall_name corresponds to the name of the syscall, which may differ from
@@ -27,35 +28,35 @@
int execve(const char*, char* const*, char* const*) all
-uid_t getuid:getuid32() arm,x86
-uid_t getuid:getuid() arm64,mips,mips64,x86_64
-gid_t getgid:getgid32() arm,x86
-gid_t getgid:getgid() arm64,mips,mips64,x86_64
-uid_t geteuid:geteuid32() arm,x86
-uid_t geteuid:geteuid() arm64,mips,mips64,x86_64
-gid_t getegid:getegid32() arm,x86
-gid_t getegid:getegid() arm64,mips,mips64,x86_64
-uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) arm,x86
-uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) arm64,mips,mips64,x86_64
-gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) arm,x86
-gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) arm64,mips,mips64,x86_64
+uid_t getuid:getuid32() lp32
+uid_t getuid:getuid() lp64
+gid_t getgid:getgid32() lp32
+gid_t getgid:getgid() lp64
+uid_t geteuid:geteuid32() lp32
+uid_t geteuid:geteuid() lp64
+gid_t getegid:getegid32() lp32
+gid_t getegid:getegid() lp64
+uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) lp32
+uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) lp64
+gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) lp32
+gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) lp64
ssize_t readahead(int, off64_t, size_t) all
-int getgroups:getgroups32(int, gid_t*) arm,x86
-int getgroups:getgroups(int, gid_t*) arm64,mips,mips64,x86_64
+int getgroups:getgroups32(int, gid_t*) lp32
+int getgroups:getgroups(int, gid_t*) lp64
pid_t getpgid(pid_t) all
pid_t getppid() all
pid_t getsid(pid_t) all
pid_t setsid() all
-int setgid:setgid32(gid_t) arm,x86
-int setgid:setgid(gid_t) arm64,mips,mips64,x86_64
-int setuid:setuid32(uid_t) arm,x86
-int setuid:setuid(uid_t) arm64,mips,mips64,x86_64
-int setreuid:setreuid32(uid_t, uid_t) arm,x86
-int setreuid:setreuid(uid_t, uid_t) arm64,mips,mips64,x86_64
-int setresuid:setresuid32(uid_t, uid_t, uid_t) arm,x86
-int setresuid:setresuid(uid_t, uid_t, uid_t) arm64,mips,mips64,x86_64
-int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86
-int setresgid:setresgid(gid_t, gid_t, gid_t) arm64,mips,mips64,x86_64
+int setgid:setgid32(gid_t) lp32
+int setgid:setgid(gid_t) lp64
+int setuid:setuid32(uid_t) lp32
+int setuid:setuid(uid_t) lp64
+int setreuid:setreuid32(uid_t, uid_t) lp32
+int setreuid:setreuid(uid_t, uid_t) lp64
+int setresuid:setresuid32(uid_t, uid_t, uid_t) lp32
+int setresuid:setresuid(uid_t, uid_t, uid_t) lp64
+int setresgid:setresgid32(gid_t, gid_t, gid_t) lp32
+int setresgid:setresgid(gid_t, gid_t, gid_t) lp64
void* __brk:brk(void*) all
int kill(pid_t, int) all
int tgkill(pid_t tgid, pid_t tid, int sig) all
@@ -67,19 +68,18 @@
int setpriority(int, id_t, int) all
# On LP64, rlimit and rlimit64 are the same.
# On 32-bit systems we use prlimit64 to implement the rlimit64 functions.
-int getrlimit:ugetrlimit(int, struct rlimit*) arm,x86
-int getrlimit(int, struct rlimit*) mips
+int getrlimit:ugetrlimit(int, struct rlimit*) lp32
int getrlimit|getrlimit64(int, struct rlimit*) lp64
int setrlimit(int, const struct rlimit*) lp32
int setrlimit|setrlimit64(int, const struct rlimit*) lp64
int prlimit64|prlimit(pid_t, int, struct rlimit64*, const struct rlimit64*) lp64
int prlimit64(pid_t, int, struct rlimit64*, const struct rlimit64*) lp32
-int setgroups:setgroups32(int, const gid_t*) arm,x86
-int setgroups:setgroups(int, const gid_t*) arm64,mips,mips64,x86_64
+int setgroups:setgroups32(int, const gid_t*) lp32
+int setgroups:setgroups(int, const gid_t*) lp64
int setpgid(pid_t, pid_t) all
-int setregid:setregid32(gid_t, gid_t) arm,x86
-int setregid:setregid(gid_t, gid_t) arm64,mips,mips64,x86_64
+int setregid:setregid32(gid_t, gid_t) lp32
+int setregid:setregid(gid_t, gid_t) lp64
int chroot(const char*) all
int prctl(int, unsigned long, unsigned long, unsigned long, unsigned long) all
long __arch_prctl:arch_prctl(int, unsigned long) x86_64
@@ -131,8 +131,8 @@
int __dup3:dup3(int, int, int) all
int fsync(int) all
int fdatasync(int) all
-int fchown:fchown32(int, uid_t, gid_t) arm,x86
-int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+int fchown:fchown32(int, uid_t, gid_t) lp32
+int fchown:fchown(int, uid_t, gid_t) lp64
void sync(void) all
int syncfs(int) all
int __fsetxattr:fsetxattr(int, const char*, const void*, size_t, int) all
@@ -140,7 +140,7 @@
ssize_t __flistxattr:flistxattr(int, char*, size_t) all
int fremovexattr(int, const char*) all
-int __getdents64:getdents64(unsigned int, struct dirent*, unsigned int) arm,arm64,mips,mips64,x86,x86_64
+int __getdents64:getdents64(unsigned int, struct dirent*, unsigned int) all
int __openat:openat(int, const char*, int, mode_t) all
int __faccessat:faccessat(int, const char*, int) all
@@ -184,7 +184,7 @@
# the POSIX functions don't set errno, and no architecture has posix_fadvise.
int __arm_fadvise64_64:arm_fadvise64_64(int, int, off64_t, off64_t) arm
int __fadvise64:fadvise64_64(int, off64_t, off64_t, int) x86
-int __fadvise64:fadvise64(int, off64_t, off64_t, int) arm64,mips,mips64,x86_64
+int __fadvise64:fadvise64(int, off64_t, off64_t, int) lp64
int __fstatfs64:fstatfs64(int, size_t, struct statfs*) lp32
int __fstatfs:fstatfs(int, struct statfs*) lp64
@@ -241,23 +241,23 @@
int __signalfd4:signalfd4(int, const sigset64_t*, size_t, int) all
# sockets
-int __socket:socket(int, int, int) arm,arm64,mips,mips64,x86_64
-int socketpair(int, int, int, int*) arm,arm64,mips,mips64,x86_64
-int bind(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
-int __connect:connect(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
-int listen(int, int) arm,arm64,mips,mips64,x86_64
-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
-ssize_t __sendto:sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
-ssize_t 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
-ssize_t __recvmsg:recvmsg(int, struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64
-ssize_t __sendmsg:sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64
-int __recvmmsg:recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*) arm,arm64,mips,mips64,x86_64
-int __sendmmsg:sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,arm64,mips,mips64,x86_64
+int __socket:socket(int, int, int) arm,lp64
+int socketpair(int, int, int, int*) arm,lp64
+int bind(int, struct sockaddr*, socklen_t) arm,lp64
+int __connect:connect(int, struct sockaddr*, socklen_t) arm,lp64
+int listen(int, int) arm,lp64
+int __accept4:accept4(int, struct sockaddr*, socklen_t*, int) arm,lp64
+int getsockname(int, struct sockaddr*, socklen_t*) arm,lp64
+int getpeername(int, struct sockaddr*, socklen_t*) arm,lp64
+ssize_t __sendto:sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,lp64
+ssize_t recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) arm,lp64
+int shutdown(int, int) arm,lp64
+int setsockopt(int, int, int, const void*, socklen_t) arm,lp64
+int getsockopt(int, int, int, void*, socklen_t*) arm,lp64
+ssize_t __recvmsg:recvmsg(int, struct msghdr*, unsigned int) arm,lp64
+ssize_t __sendmsg:sendmsg(int, const struct msghdr*, unsigned int) arm,lp64
+int __recvmmsg:recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*) arm,lp64
+int __sendmmsg:sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,lp64
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
int __socket:socketcall:1(int, int, int) x86
@@ -336,7 +336,7 @@
int setdomainname(const char*, size_t) all
int sethostname(const char*, size_t) all
-int __sync_file_range:sync_file_range(int, off64_t, off64_t, unsigned int) arm64,mips,mips64,x86,x86_64
+int __sync_file_range:sync_file_range(int, off64_t, off64_t, unsigned int) arm64,x86,x86_64
int __sync_file_range2:sync_file_range2(int, unsigned int, off64_t, off64_t) arm
pid_t wait4(pid_t, int*, int, struct rusage*) all
@@ -346,10 +346,6 @@
int __set_tls:__ARM_NR_set_tls(void*) arm
int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) arm
-# MIPS-specific
-int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips
-int __set_tls:set_thread_area(void*) mips,mips64
-
# x86-specific
int __set_thread_area:set_thread_area(void*) x86
diff --git a/libc/arch-mips/bionic/__bionic_clone.S b/libc/arch-mips/bionic/__bionic_clone.S
deleted file mode 100644
index b6056f2..0000000
--- a/libc/arch-mips/bionic/__bionic_clone.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-
-// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
-ENTRY_PRIVATE(__bionic_clone)
- .set noreorder
- .cpload $t9
- .set reorder
-
- # set up child stack
- subu $a1,16
- lw $t0,20($sp) # fn
- lw $t1,24($sp) # arg
- sw $t0,0($a1) # fn
- sw $t1,4($a1) # arg
-
- # remainder of arguments are correct for clone system call
- li $v0,__NR_clone
- syscall
-
- bnez $a3,.L__error_bc
-
- beqz $v0,.L__thread_start_bc
-
- j $ra
-
-.L__thread_start_bc:
- # Clear return address in child so we don't unwind further.
- li $ra,0
-
- lw $a0,0($sp) # fn
- lw $a1,4($sp) # arg
-
- # void __start_thread(int (*func)(void*), void *arg)
- la $t9,__start_thread
- j $t9
-
-.L__error_bc:
- move $a0,$v0
- la $t9,__set_errno_internal
- j $t9
-END(__bionic_clone)
diff --git a/libc/arch-mips/bionic/_exit_with_stack_teardown.S b/libc/arch-mips/bionic/_exit_with_stack_teardown.S
deleted file mode 100644
index 566b1c8..0000000
--- a/libc/arch-mips/bionic/_exit_with_stack_teardown.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
-ENTRY_PRIVATE(_exit_with_stack_teardown)
- li $v0, __NR_munmap
- syscall
- // If munmap failed, we ignore the failure and exit anyway.
-
- li $a0, 0
- li $v0, __NR_exit
- syscall
- // The exit syscall does not return.
-END(_exit_with_stack_teardown)
diff --git a/libc/arch-mips/bionic/cacheflush.cpp b/libc/arch-mips/bionic/cacheflush.cpp
deleted file mode 100644
index 380ad90..0000000
--- a/libc/arch-mips/bionic/cacheflush.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <unistd.h>
-#include <sys/cachectl.h>
-
-#include <async_safe/log.h>
-
-// Linux historically defines a cacheflush(3) routine for MIPS
-// with this signature:
-
-// int cacheflush(char *addr, int nbytes, int cache);
-
-// Android defines an alternate cacheflush routine which exposes the
-// ARM system call interface:
-
-// int cacheflush (long start, long end, long flags)
-
-// This is an attempt to maintain compatibility between the historical MIPS
-// usage for software previously ported to MIPS and Android specific
-// uses of cacheflush().
-
-int cacheflush(long start, long end, long /*flags*/) {
- if (end < start) {
- // It looks like this is really a MIPS-style cacheflush call.
- static bool warned = false;
- if (!warned) {
- async_safe_format_log(ANDROID_LOG_WARN, "libc",
- "cacheflush called with (start,len) instead of (start,end)");
- warned = true;
- }
- end += start;
- }
-
- // Use the GCC builtin. This will generate inline synci instructions if available,
- // or call _flush_cache(start, len, BCACHE) directly.
- __builtin___clear_cache(reinterpret_cast<char*>(start), reinterpret_cast<char*>(end));
- return 0;
-}
diff --git a/libc/arch-mips/bionic/crtbegin.c b/libc/arch-mips/bionic/crtbegin.c
deleted file mode 100644
index d72ec7b..0000000
--- a/libc/arch-mips/bionic/crtbegin.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "../../bionic/libc_init_common.h"
-#include <stddef.h>
-#include <stdint.h>
-
-__attribute__ ((section (".preinit_array")))
-void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
-
-__attribute__ ((section (".init_array")))
-void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
-
-__attribute__ ((section (".fini_array")))
-void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
-
-
-__LIBC_HIDDEN__ void do_mips_start(void *raw_args) {
- structors_array_t array;
- array.preinit_array = &__PREINIT_ARRAY__;
- array.init_array = &__INIT_ARRAY__;
- array.fini_array = &__FINI_ARRAY__;
-
- __libc_init(raw_args, NULL, &main, &array);
-}
-
-/*
- * This function prepares the return address with a branch-and-link
- * instruction (bal) and then uses a .cpload to compute the Global
- * Offset Table (GOT) pointer ($gp). The $gp is then used to load
- * the address of _do_start() into $t9 just before calling it.
- * Terminating the stack with a NULL return address.
- */
-__asm__ (
-" .set push \n"
-" \n"
-" .text \n"
-" .align 4 \n"
-" .type __start,@function \n"
-" .globl __start \n"
-" .globl _start \n"
-" \n"
-" .ent __start \n"
-"__start: \n"
-" _start: \n"
-" .frame $sp,32,$ra \n"
-" .mask 0x80000000,-4 \n"
-" \n"
-" .set noreorder \n"
-" bal 1f \n"
-" nop \n"
-"1: \n"
-" .cpload $ra \n"
-" .set reorder \n"
-" \n"
-" move $a0, $sp \n"
-" addiu $sp, $sp, (-32) \n"
-" sw $0, 28($sp) \n"
-" la $t9, do_mips_start \n"
-" jalr $t9 \n"
-" \n"
-"2: b 2b \n"
-" .end __start \n"
-" \n"
-" .set pop \n"
-);
-
-#include "../../arch-common/bionic/__dso_handle.h"
-#include "../../arch-common/bionic/atexit.h"
-#include "../../arch-common/bionic/pthread_atfork.h"
diff --git a/libc/arch-mips/bionic/libcrt_compat.c b/libc/arch-mips/bionic/libcrt_compat.c
deleted file mode 100644
index cfa41f2..0000000
--- a/libc/arch-mips/bionic/libcrt_compat.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-extern char __divdi3;
-extern char __moddi3;
-extern char __popcountsi2;
-extern char __udivdi3;
-extern char __umoddi3;
-
-void* __bionic_libcrt_compat_symbols[] = {
- &__divdi3,
- &__moddi3,
- &__popcountsi2,
- &__udivdi3,
- &__umoddi3,
-};
diff --git a/libc/arch-mips/bionic/setjmp.S b/libc/arch-mips/bionic/setjmp.S
deleted file mode 100644
index ffe3665..0000000
--- a/libc/arch-mips/bionic/setjmp.S
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/*
- * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Opsycon AB 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 AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-/*-
- * Copyright (c) 1991, 1993, 1995,
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Havard Eidnes.
- *
- * 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. Neither the name of the University 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 REGENTS 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 REGENTS 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) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
- * @(#)signal.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <private/bionic_asm.h>
-
-/* jmpbuf is declared to users as an array of longs, which is only
- * 4-byte aligned in 32-bit builds. The Mips jmpbuf begins with a
- * dynamically-sized 0- or 4-byte unused filler so that double-prec FP regs
- * are saved to 8-byte-aligned mem cells.
- * All the following jmpbuf offsets are from the rounded-DOWN base addr.
- */
-
-/* Fields of same size on all MIPS abis: */
-/* field: byte offset: size: */
-/* dynam filler (0*4) 0-4 bytes of rounddown filler, DON'T TOUCH!!
- often overlays user storage!! */
-#define SC_FPSR_OFFSET (1*4) /* 4 bytes, floating point control/status reg */
-/* following fields are 8-byte aligned */
-#define SC_FLAG_OFFSET (2*4) /* 8 bytes, cookie and savesigs flag, first actual field */
-#define SC_MASK_OFFSET (4*4) /* 16 bytes, mips32/mips64 version of sigset_t */
-#define SC_CKSUM_OFFSET (8*4) /* 8 bytes, used for checksum */
-
-/* Registers that are 4-byte on mips32 o32, and 8-byte on mips64 n64 abi */
-#define SC_REGS_OFFSET (10*4) /* SC_REGS_BYTES */
-#define SC_REGS_SAVED 12 /*regs*/ /* ra,s0-s8,gp,sp */
-#define SC_REGS_BYTES (SC_REGS_SAVED*REGSZ)
-#define SC_REGS SC_REGS_OFFSET
-
-/* Double floating pt registers are 8-bytes on all abis,
- * but the number of saved fp regs varies for o32/n32 versus n64 abis:
- */
-
-#ifdef __LP64__
-#define SC_FPREGS_SAVED 8 /* all fp regs f24,f25,f26,f27,f28,f29,f30,f31 */
-#else
-#define SC_FPREGS_SAVED 6 /* even fp regs f20,f22,f24,f26,f28,f30 */
-#endif
-
-#define SC_FPREGS_OFFSET (SC_REGS_OFFSET + SC_REGS_BYTES) /* SC_FPREGS_BYTES */
-#define SC_FPREGS_BYTES (SC_FPREGS_SAVED*REGSZ_FP)
-#define SC_FPREGS SC_FPREGS_OFFSET
-
-#define SC_TOTAL_BYTES (SC_FPREGS_OFFSET + SC_FPREGS_BYTES)
-#define SC_TOTAL_LONGS (SC_TOTAL_BYTES/REGSZ)
-
-#define USE_CHECKSUM 1
-
-.macro m_mangle_reg_and_store reg, cookie, temp, offset
- xor \temp, \reg, \cookie
- REG_S \temp, \offset
-.endm
-
-.macro m_unmangle_reg_and_load reg, cookie, temp, offset
- REG_L \temp, \offset
- xor \reg, \temp, \cookie
-.endm
-
-.macro m_calculate_checksum dst, src, scratch
- REG_L \dst, REGSZ(\src)
-#ifdef __LP64__
- /* 64 bit: checksum offset is 4 (actual _JBLEN is 25) */
- .irp i,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
-#else
- /* 32 bit: checksum offset is 8 (actual _JBLEN is 34) */
- .irp i,2,3,4,5,6,7,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33
-#endif
- REG_L \scratch, \i*REGSZ(\src)
- xor \dst, \dst, \scratch
- .endr
-.endm
-
-/*
- *
- * GPOFF and FRAMESIZE must be the same for all setjmp/longjmp routines
- *
- */
-
-FRAMESZ= MKFSIZ(2,6)
-A1OFF= FRAMESZ-4*REGSZ
-A0OFF= FRAMESZ-3*REGSZ
-GPOFF= FRAMESZ-2*REGSZ
-RAOFF= FRAMESZ-1*REGSZ
-
-NON_LEAF(sigsetjmp, FRAMESZ, $ra)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
- .mask 0x80000000, RAOFF
- PTR_SUBU $sp, FRAMESZ # allocate stack frame
- SETUP_GP64(GPOFF, sigsetjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-setjmp_common:
-#ifndef __LP64__
- li $t0, ~7
- and $a0, $t0 # round jmpbuf addr DOWN to 8-byte boundary
-#endif
- REG_S $ra, RAOFF($sp) # spill state
- REG_S $a0, A0OFF($sp)
-
- # get the cookie and store it along with the signal flag.
- move $a0, $a1
- jal __bionic_setjmp_cookie_get
- REG_L $a0, A0OFF($sp)
-
- REG_S $v0, SC_FLAG_OFFSET($a0) # save cookie and savesigs flag
- andi $t0, $v0, 1 # extract savesigs flag
-
- beqz $t0, 1f # do saving of signal mask?
-
- # call sigprocmask(int how ignored, sigset_t* null, sigset_t* SC_MASK(a0)):
- LA $a2, SC_MASK_OFFSET($a0) # gets current signal mask
- li $a0, 0 # how; ignored when new mask is null
- li $a1, 0 # null new mask
- jal sigprocmask # get current signal mask
- REG_L $a0, A0OFF($sp)
-1:
- REG_L $gp, GPOFF($sp) # restore spills
- REG_L $ra, RAOFF($sp)
- REG_L $t0, SC_FLAG_OFFSET($a0) # move cookie to temp reg
-
- # callee-saved long-sized regs:
- PTR_ADDU $v1, $sp, FRAMESZ # save orig sp
-
- # m_mangle_reg_and_store reg, cookie, temp, offset
- m_mangle_reg_and_store $ra, $t0, $t1, SC_REGS+0*REGSZ($a0)
- m_mangle_reg_and_store $s0, $t0, $t2, SC_REGS+1*REGSZ($a0)
- m_mangle_reg_and_store $s1, $t0, $t3, SC_REGS+2*REGSZ($a0)
- m_mangle_reg_and_store $s2, $t0, $t1, SC_REGS+3*REGSZ($a0)
- m_mangle_reg_and_store $s3, $t0, $t2, SC_REGS+4*REGSZ($a0)
- m_mangle_reg_and_store $s4, $t0, $t3, SC_REGS+5*REGSZ($a0)
- m_mangle_reg_and_store $s5, $t0, $t1, SC_REGS+6*REGSZ($a0)
- m_mangle_reg_and_store $s6, $t0, $t2, SC_REGS+7*REGSZ($a0)
- m_mangle_reg_and_store $s7, $t0, $t3, SC_REGS+8*REGSZ($a0)
- m_mangle_reg_and_store $s8, $t0, $t1, SC_REGS+9*REGSZ($a0)
- m_mangle_reg_and_store $gp, $t0, $t2, SC_REGS+10*REGSZ($a0)
- m_mangle_reg_and_store $v1, $t0, $t3, SC_REGS+11*REGSZ($a0)
-
- cfc1 $v0, $31
-
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- s.d $f24, SC_FPREGS+0*REGSZ_FP($a0)
- s.d $f25, SC_FPREGS+1*REGSZ_FP($a0)
- s.d $f26, SC_FPREGS+2*REGSZ_FP($a0)
- s.d $f27, SC_FPREGS+3*REGSZ_FP($a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP($a0)
- s.d $f29, SC_FPREGS+5*REGSZ_FP($a0)
- s.d $f30, SC_FPREGS+6*REGSZ_FP($a0)
- s.d $f31, SC_FPREGS+7*REGSZ_FP($a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered double fp regs $f20,$f22,...$f30
- s.d $f20, SC_FPREGS+0*REGSZ_FP($a0)
- s.d $f22, SC_FPREGS+1*REGSZ_FP($a0)
- s.d $f24, SC_FPREGS+2*REGSZ_FP($a0)
- s.d $f26, SC_FPREGS+3*REGSZ_FP($a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP($a0)
- s.d $f30, SC_FPREGS+5*REGSZ_FP($a0)
-#endif
- sw $v0, SC_FPSR_OFFSET($a0)
-#if USE_CHECKSUM
- m_calculate_checksum $t0, $a0, $t1
- REG_S $t0, SC_CKSUM_OFFSET($a0)
-#endif
- move $v0, $zero
- RESTORE_GP64
- PTR_ADDU $sp, FRAMESZ
- j $ra
-END(sigsetjmp)
-
-
-# Alternate entry points:
-
-NON_LEAF(setjmp, FRAMESZ, $ra)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
- .mask 0x80000000, RAOFF
- PTR_SUBU $sp, FRAMESZ
- SETUP_GP64(GPOFF, setjmp) # can't share sigsetjmp's gp code
- SAVE_GP(GPOFF)
- .set reorder
-
- li $a1, 1 # save/restore signals state
- b setjmp_common # tail call
-END(setjmp)
-
-
-NON_LEAF(_setjmp, FRAMESZ, $ra)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
- .mask 0x80000000, RAOFF
- PTR_SUBU $sp, FRAMESZ
- SETUP_GP64(GPOFF, _setjmp) # can't share sigsetjmp's gp code
- SAVE_GP(GPOFF)
- .set reorder
-
- li $a1, 0 # don't save/restore signals
- b setjmp_common # tail call
-END(_setjmp)
-
-
-NON_LEAF(siglongjmp, FRAMESZ, $ra)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
- .mask 0x80000000, RAOFF
- PTR_SUBU $sp, FRAMESZ
- SETUP_GP64(GPOFF, siglongjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-#ifndef __LP64__
- li $t0, ~7
- and $a0, $t0 # round jmpbuf addr DOWN to 8-byte boundary
-#endif
-
- move $s1, $a1 # temp spill
- move $s0, $a0
-
-#if USE_CHECKSUM
- m_calculate_checksum $t0, $s0, $s2
- REG_L $s2, SC_CKSUM_OFFSET($s0)
- beq $t0, $s2, 0f
- nop
- jal __bionic_setjmp_checksum_mismatch
- nop
-0:
-#endif
-
- # extract savesigs flag
- REG_L $s2, SC_FLAG_OFFSET($s0)
- andi $t0, $s2, 1
- beqz $t0, 1f # restore signal mask?
-
- # call sigprocmask(int how SIG_SETMASK, sigset_t* SC_MASK(a0), sigset_t* null):
- LA $a1, SC_MASK_OFFSET($s0) # signals being restored
- li $a0, 3 # mips SIG_SETMASK
- li $a2, 0 # null
- jal sigprocmask # restore signal mask
-1:
- move $t0, $s2 # get cookie to temp reg
- move $a1, $s1
- move $a0, $s0
-
- # callee-saved long-sized regs:
-
- # m_unmangle_reg_and_load reg, cookie, temp, offset
- # don't restore gp yet, old value is needed for cookie_check call
- m_unmangle_reg_and_load $ra, $t0, $t1, SC_REGS+0*REGSZ($a0)
- m_unmangle_reg_and_load $s0, $t0, $t2, SC_REGS+1*REGSZ($a0)
- m_unmangle_reg_and_load $s1, $t0, $t3, SC_REGS+2*REGSZ($a0)
- m_unmangle_reg_and_load $s2, $t0, $t1, SC_REGS+3*REGSZ($a0)
- m_unmangle_reg_and_load $s3, $t0, $t2, SC_REGS+4*REGSZ($a0)
- m_unmangle_reg_and_load $s4, $t0, $t3, SC_REGS+5*REGSZ($a0)
- m_unmangle_reg_and_load $s5, $t0, $t1, SC_REGS+6*REGSZ($a0)
- m_unmangle_reg_and_load $s6, $t0, $t2, SC_REGS+7*REGSZ($a0)
- m_unmangle_reg_and_load $s7, $t0, $t3, SC_REGS+8*REGSZ($a0)
- m_unmangle_reg_and_load $s8, $t0, $t1, SC_REGS+9*REGSZ($a0)
- m_unmangle_reg_and_load $v1, $t0, $t2, SC_REGS+10*REGSZ($a0)
- m_unmangle_reg_and_load $sp, $t0, $t3, SC_REGS+11*REGSZ($a0)
-
- lw $v0, SC_FPSR_OFFSET($a0)
- ctc1 $v0, $31 # restore old fr mode before fp values
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- l.d $f24, SC_FPREGS+0*REGSZ_FP($a0)
- l.d $f25, SC_FPREGS+1*REGSZ_FP($a0)
- l.d $f26, SC_FPREGS+2*REGSZ_FP($a0)
- l.d $f27, SC_FPREGS+3*REGSZ_FP($a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP($a0)
- l.d $f29, SC_FPREGS+5*REGSZ_FP($a0)
- l.d $f30, SC_FPREGS+6*REGSZ_FP($a0)
- l.d $f31, SC_FPREGS+7*REGSZ_FP($a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered double fp regs $f20,$f22,...$f30
- l.d $f20, SC_FPREGS+0*REGSZ_FP($a0)
- l.d $f22, SC_FPREGS+1*REGSZ_FP($a0)
- l.d $f24, SC_FPREGS+2*REGSZ_FP($a0)
- l.d $f26, SC_FPREGS+3*REGSZ_FP($a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP($a0)
- l.d $f30, SC_FPREGS+5*REGSZ_FP($a0)
-#endif
-
- # check cookie
- PTR_SUBU $sp, FRAMESZ
- REG_S $v1, GPOFF($sp)
- REG_S $ra, RAOFF($sp)
- REG_S $a1, A1OFF($sp)
- move $a0, $t0
- jal __bionic_setjmp_cookie_check
- REG_L $gp, GPOFF($sp)
- REG_L $ra, RAOFF($sp)
- REG_L $a1, A1OFF($sp)
- PTR_ADDU $sp, FRAMESZ
-
- sltiu $t0, $a1, 1 # never return 0!
- xor $v0, $a1, $t0
- j $ra # return to setjmp call site
-END(siglongjmp)
-
-ALIAS_SYMBOL(longjmp, siglongjmp)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
-ALIAS_SYMBOL(_longjmp, siglongjmp)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
diff --git a/libc/arch-mips/bionic/syscall.S b/libc/arch-mips/bionic/syscall.S
deleted file mode 100644
index 857bbab..0000000
--- a/libc/arch-mips/bionic/syscall.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-/*
- * The caller is only required to allocate 16 bytes of stack for a0-a3.
- * syscall has up to 6 arguments, so we need space for the extra two arguments.
- */
-#define STACKSIZE 2*4
-
-ENTRY(syscall)
- .set noreorder
- .cpload $t9
- move $v0, $a0
- move $a0, $a1
- move $a1, $a2
- move $a2, $a3
- lw $a3, 16($sp)
- lw $t0, 20($sp)
- lw $t1, 24($sp)
- subu $sp, STACKSIZE
- sw $t0, 16($sp)
- sw $t1, 20($sp)
- syscall
- addu $sp, STACKSIZE
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9, __set_errno_internal
- j $t9
- nop
- .set reorder
-END(syscall)
diff --git a/libc/arch-mips/bionic/vfork.S b/libc/arch-mips/bionic/vfork.S
deleted file mode 100644
index c4f67c6..0000000
--- a/libc/arch-mips/bionic/vfork.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <linux/sched.h>
-
-// TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
-// #include <asm/signal.h>
-#define SIGCHLD 18
-
-ENTRY(vfork)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
- .set noreorder
- .cpload $t9
-
- // __get_tls()[TLS_SLOT_THREAD_ID]->cached_pid_ = 0
- .set push
- .set mips32r2
- rdhwr $v0, $29 // v0 = tls; kernel trap on mips32r1
- .set pop
- lw $v0, REGSZ*1($v0) // v0 = v0[TLS_SLOT_THREAD_ID ie 1]
- sw $0, REGSZ*2+4($v0) // v0->cached_pid_ = 0
-
- li $a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
- li $a1, 0
- li $a2, 0
- li $a3, 0
- subu $sp, 8
- sw $0, 16($sp)
- li $v0, __NR_clone
- syscall
- addu $sp, 8
- bnez $a3, 1f
- move $a0, $v0
-
- j $ra
- nop
-1:
- la $t9, __set_errno_internal
- j $t9
- nop
-END(vfork)
diff --git a/libc/arch-mips/string/memchr.c b/libc/arch-mips/string/memchr.c
deleted file mode 100644
index bc24f79..0000000
--- a/libc/arch-mips/string/memchr.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <string.h>
-
-#define ENABLE_PREFETCH 1
-#define op_t unsigned long int
-#define op_size sizeof (op_t)
-
-#if ENABLE_PREFETCH
-#define PREFETCH(addr) __builtin_prefetch (addr, 0, 1);
-#else
-#define PREFETCH(addr)
-#endif
-
-#if __mips64 || __mips_isa_rev >= 2
-static inline void * __attribute__ ((always_inline))
-do_bytes (const op_t* w, op_t inval)
-{
- const unsigned char *p = (const unsigned char *) w;
- op_t outval = 0;
-#if __mips64
- __asm__ volatile (
- "dsbh %1, %0 \n\t"
- "dshd %0, %1 \n\t"
- "dclz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#else
- __asm__ volatile (
- "wsbh %1, %0 \n\t"
- "rotr %0, %1, 16 \n\t"
- "clz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#endif
- p += (outval >> 3);
- return (void *) p;
-}
-
-#define DO_WORD(in, val) { \
- op_t tmp = ((val - mask_1) & ~val) & mask_128; \
- if (tmp != 0) \
- return do_bytes(in, tmp); \
-}
-#else
-static inline void * __attribute__ ((always_inline))
-do_bytes (const op_t* w, unsigned char ch)
-{
- const unsigned char *p = (const unsigned char *) w;
- for (; *p != ch; ++p);
- return (void *) p;
-}
-
-#define DO_WORD(in, val) { \
- op_t tmp = ((val - mask_1) & ~val) & mask_128; \
- if (tmp != 0) \
- return do_bytes(in, ch); \
-}
-#endif
-
-#define DO_WORDS(w) { \
- op_t* w1 = (op_t*) w; \
- op_t val0 = w1[0] ^ mask_c; \
- op_t val1 = w1[1] ^ mask_c; \
- op_t val2 = w1[2] ^ mask_c; \
- op_t val3 = w1[3] ^ mask_c; \
- DO_WORD(w1, val0) \
- DO_WORD(w1 + 1, val1) \
- DO_WORD(w1 + 2, val2) \
- DO_WORD(w1 + 3, val3) \
-}
-
-void *
-memchr (void const *s, int c_in, size_t n)
-{
- if (n != 0) {
- const unsigned char *p = (const unsigned char *) s;
- const op_t *w;
- op_t mask_1, mask_128, mask_c;
- unsigned char ch = (unsigned char) c_in;
-
- /*
- * Check bytewize till initial alignment
- */
- for (; n > 0 && ((size_t) p % op_size) != 0; --n, ++p) {
- if (*p == ch)
- return (void *) p;
- }
-
- w = (const op_t *) p;
-
- mask_c = ch | (ch << 8);
- mask_c |= mask_c << 16;
- __asm__ volatile (
- "li %0, 0x01010101 \n\t"
- : "=r" (mask_1)
- );
-#if __mips64
- mask_1 |= mask_1 << 32;
- mask_c |= mask_c << 32;
-#endif
- mask_128 = mask_1 << 7;
-
- /*
- * Check op_size byteswize after initial alignment
- */
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- PREFETCH (w);
- PREFETCH (w + 8);
- while (n >= 24 * op_size) {
- PREFETCH(w + 16);
- DO_WORDS(w);
- DO_WORDS(w + 4);
- w += 8;
- n -= 8 * op_size;
- }
- while (n >= 8 * op_size) {
- DO_WORDS(w);
- DO_WORDS(w + 4);
- w += 8;
- n -= 8 * op_size;
- }
-#else
- PREFETCH (w);
- PREFETCH (w + 4);
- while (n >= 12 * op_size) {
- PREFETCH(w + 8);
- DO_WORDS(w);
- w += 4;
- n -= 4 * op_size;
- }
- while (n >= 4 * op_size) {
- DO_WORDS(w);
- w += 4;
- n -= 4 * op_size;
- }
-#endif
-
- while (n >= op_size) {
- op_t val = *w ^ mask_c;
- DO_WORD(w, val);
- w++;
- n -= op_size;
- }
-
- /*
- * Check bytewize for remaining bytes
- */
- p = (const unsigned char *) w;
- for (; n > 0; --n, ++p) {
- if (*p == ch)
- return (void *) p;
- }
- }
- return NULL;
-}
diff --git a/libc/arch-mips/string/memcmp.c b/libc/arch-mips/string/memcmp.c
deleted file mode 100644
index eb4ad07..0000000
--- a/libc/arch-mips/string/memcmp.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <stdint.h>
-
-#define ENABLE_PREFETCH 1
-
-#define STRNG(X) #X
-#define PREFETCH(src_ptr, offset) \
- asm("pref 0, " STRNG(offset) "(%[src]) \n\t" : : [src] "r" (src_ptr));
-
-#if !defined(UNALIGNED_INSTR_SUPPORT)
-/* does target have unaligned lw/ld/ualw/uald instructions? */
-#define UNALIGNED_INSTR_SUPPORT 0
-#if __mips_isa_rev < 6 && !__mips1
-#undef UNALIGNED_INSTR_SUPPORT
-#define UNALIGNED_INSTR_SUPPORT 1
-#endif
-#endif
-
-#if !defined(HW_UNALIGNED_SUPPORT)
-/* Does target have hardware support for unaligned accesses? */
-#define HW_UNALIGNED_SUPPORT 0
-#if __mips_isa_rev >= 6
-#undef HW_UNALIGNED_SUPPORT
-#define HW_UNALIGNED_SUPPORT 1
-#endif
-#endif
-
-#define SIZEOF_reg_t 4
-#if _MIPS_SIM == _ABIO32
-typedef unsigned long reg_t;
-typedef struct bits
-{
- reg_t B0:8, B1:8, B2:8, B3:8;
-} bits_t;
-#else
-#undef SIZEOF_reg_t
-#define SIZEOF_reg_t 8
-typedef unsigned long long reg_t;
-typedef struct bits
-{
- reg_t B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
-} bits_t;
-#endif
-
-/* This union assumes that small structures can be in registers. If
- not, then memory accesses will be done - not optimal, but ok. */
-typedef union
-{
- reg_t v;
- bits_t b;
-} bitfields_t;
-
-#define do_bitfield(__i) \
- if (x.b.B##__i != y.b.B##__i) return x.b.B##__i - y.b.B##__i;
-
-/* pull apart the words to find the first differing unsigned byte. */
-static int __attribute__ ((noinline)) do_by_bitfields (reg_t a, reg_t b)
-{
- bitfields_t x, y;
- x.v = a;
- y.v = b;
- do_bitfield (0);
- do_bitfield (1);
- do_bitfield (2);
-#if SIZEOF_reg_t == 4
- return x.b.B3 - y.b.B3;
-#else
- do_bitfield (3);
- do_bitfield (4);
- do_bitfield (5);
- do_bitfield (6);
- return x.b.B7 - y.b.B7;
-#endif
-}
-
-/* This code is called when aligning a pointer, there are remaining bytes
- after doing word compares, or architecture does not have some form
- of unaligned support. */
-static inline int __attribute__ ((always_inline))
-do_bytes (const void *a, const void *b, unsigned long len)
-{
- unsigned char *x = (unsigned char *) a;
- unsigned char *y = (unsigned char *) b;
- unsigned long i;
-
- /* 'len' might be zero here, so preloading the first two values
- before the loop may access unallocated memory. */
- for (i = 0; i < len; i++) {
- if (*x != *y)
- return *x - *y;
- x++;
- y++;
- }
- return 0;
-}
-
-#if !HW_UNALIGNED_SUPPORT
-#if UNALIGNED_INSTR_SUPPORT
-/* for MIPS GCC, there are no unaligned builtins - so this struct forces
- the compiler to treat the pointer access as unaligned. */
-struct ulw
-{
- reg_t uli;
-} __attribute__ ((packed));
-
-/* first pointer is not aligned while second pointer is. */
-static int unaligned_words (const struct ulw *a, const reg_t *b,
- unsigned long words, unsigned long bytes)
-{
-#if ENABLE_PREFETCH
- /* prefetch pointer aligned to 32 byte boundary */
- const reg_t *pref_ptr = (const reg_t *) (((uintptr_t) b + 31) & ~31);
- const reg_t *pref_ptr_a = (const reg_t *) (((uintptr_t) a + 31) & ~31);
-#endif
- for (; words >= 16; words -= 8) {
-#if ENABLE_PREFETCH
- pref_ptr += 8;
- PREFETCH(pref_ptr, 0);
- PREFETCH(pref_ptr, 32);
-
- pref_ptr_a += 8;
- PREFETCH(pref_ptr_a, 0);
- PREFETCH(pref_ptr_a, 32);
-#endif
- reg_t x0 = a[0].uli, x1 = a[1].uli;
- reg_t x2 = a[2].uli, x3 = a[3].uli;
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
-
- x0 = a[4].uli; x1 = a[5].uli;
- x2 = a[6].uli; x3 = a[7].uli;
- y0 = b[4]; y1 = b[5]; y2 = b[6]; y3 = b[7];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
-
- a += 8;
- b += 8;
- }
-
- for (; words >= 4; words -= 4) {
- reg_t x0 = a[0].uli, x1 = a[1].uli;
- reg_t x2 = a[2].uli, x3 = a[3].uli;
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
- a += 4;
- b += 4;
- }
-
- /* do remaining words. */
- while (words--) {
- reg_t x0 = a->uli;
- reg_t y0 = *b;
- a += 1;
- b += 1;
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- }
-
- /* mop up any remaining bytes. */
- return do_bytes (a, b, bytes);
-}
-#else
-/* no HW support or unaligned lw/ld/ualw/uald instructions. */
-static int unaligned_words (const reg_t *a, const reg_t *b,
- unsigned long words, unsigned long bytes)
-{
- return do_bytes (a, b, (sizeof (reg_t) * words) + bytes);
-}
-#endif /* UNALIGNED_INSTR_SUPPORT */
-#endif /* HW_UNALIGNED_SUPPORT */
-
-/* both pointers are aligned, or first isn't and HW support for unaligned. */
-static int aligned_words (const reg_t *a, const reg_t *b,
- unsigned long words, unsigned long bytes)
-{
-#if ENABLE_PREFETCH
- /* prefetch pointer aligned to 32 byte boundary */
- const reg_t *pref_ptr = (const reg_t *) (((uintptr_t) b + 31) & ~31);
- const reg_t *pref_ptr_a = (const reg_t *) (((uintptr_t) a + 31) & ~31);
-#endif
-
- for (; words >= 24; words -= 12) {
-#if ENABLE_PREFETCH
- pref_ptr += 12;
- PREFETCH(pref_ptr, 0);
- PREFETCH(pref_ptr, 32);
- PREFETCH(pref_ptr, 64);
-
- pref_ptr_a += 12;
- PREFETCH(pref_ptr_a, 0);
- PREFETCH(pref_ptr_a, 32);
- PREFETCH(pref_ptr_a, 64);
-#endif
- reg_t x0 = a[0], x1 = a[1], x2 = a[2], x3 = a[3];
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
-
- x0 = a[4]; x1 = a[5]; x2 = a[6]; x3 = a[7];
- y0 = b[4]; y1 = b[5]; y2 = b[6]; y3 = b[7];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
-
- x0 = a[8]; x1 = a[9]; x2 = a[10]; x3 = a[11];
- y0 = b[8]; y1 = b[9]; y2 = b[10]; y3 = b[11];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
-
- a += 12;
- b += 12;
- }
-
- for (; words >= 4; words -= 4) {
- reg_t x0 = a[0], x1 = a[1], x2 = a[2], x3 = a[3];
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- if (x1 != y1)
- return do_by_bitfields (x1, y1);
- if (x2 != y2)
- return do_by_bitfields (x2, y2);
- if (x3 != y3)
- return do_by_bitfields (x3, y3);
- a += 4;
- b += 4;
- }
-
- /* do remaining words. */
- while (words--) {
- reg_t x0 = *a;
- reg_t y0 = *b;
- a += 1;
- b += 1;
- if (x0 != y0)
- return do_by_bitfields (x0, y0);
- }
-
- /* mop up any remaining bytes. */
- return do_bytes (a, b, bytes);
-}
-
-int memcmp (const void *a, const void *b, size_t len)
-{
- unsigned long bytes, words;
-
- /* shouldn't hit that often. */
- if (len < sizeof (reg_t) * 4) {
- return do_bytes (a, b, len);
- }
-
- /* Align the second pointer to word/dword alignment.
- Note that the pointer is only 32-bits for o32/n32 ABIs. For
- n32, loads are done as 64-bit while address remains 32-bit. */
- bytes = ((unsigned long) b) % sizeof (reg_t);
- if (bytes) {
- int res;
- bytes = sizeof (reg_t) - bytes;
- if (bytes > len)
- bytes = len;
- res = do_bytes (a, b, bytes);
- if (res || len == bytes)
- return res;
- len -= bytes;
- a = (const void *) (((unsigned char *) a) + bytes);
- b = (const void *) (((unsigned char *) b) + bytes);
- }
-
- /* Second pointer now aligned. */
- words = len / sizeof (reg_t);
- bytes = len % sizeof (reg_t);
-
-#if HW_UNALIGNED_SUPPORT
- /* treat possible unaligned first pointer as aligned. */
- return aligned_words (a, b, words, bytes);
-#else
- if (((unsigned long) a) % sizeof (reg_t) == 0) {
- return aligned_words (a, b, words, bytes);
- }
- /* need to use unaligned instructions on first pointer. */
- return unaligned_words (a, b, words, bytes);
-#endif
-}
diff --git a/libc/arch-mips/string/memcpy.c b/libc/arch-mips/string/memcpy.c
deleted file mode 100644
index bb0d179..0000000
--- a/libc/arch-mips/string/memcpy.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#if !defined(UNALIGNED_INSTR_SUPPORT)
-/* does target have unaligned lw/ld/ualw/uald instructions? */
-#define UNALIGNED_INSTR_SUPPORT 0
-#if __mips_isa_rev < 6 && !__mips1
-#undef UNALIGNED_INSTR_SUPPORT
-#define UNALIGNED_INSTR_SUPPORT 1
-#endif
-#endif
-
-#if !defined(HW_UNALIGNED_SUPPORT)
-/* Does target have hardware support for unaligned accesses? */
-#define HW_UNALIGNED_SUPPORT 0
-#if __mips_isa_rev >= 6
-#undef HW_UNALIGNED_SUPPORT
-#define HW_UNALIGNED_SUPPORT 1
-#endif
-#endif
-
-#define ENABLE_PREFETCH 1
-
-#if ENABLE_PREFETCH
-#define PREFETCH(addr) __builtin_prefetch (addr, 0, 1);
-#else
-#define PREFETCH(addr)
-#endif
-
-#if _MIPS_SIM == _ABIO32
-typedef unsigned long reg_t;
-typedef struct
-{
- reg_t B0:8, B1:8, B2:8, B3:8;
-} bits_t;
-#else
-typedef unsigned long long reg_t;
-typedef struct
-{
- reg_t B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
-} bits_t;
-#endif
-
-typedef union
-{
- reg_t v;
- bits_t b;
-} bitfields_t;
-
-#define DO_BYTE(a, i) \
- a[i] = bw.b.B##i; \
- len--; \
- if(!len) return ret; \
-
-/* This code is called when aligning a pointer, there are remaining bytes
- after doing word compares, or architecture does not have some form
- of unaligned support. */
-static inline void * __attribute__ ((always_inline))
-do_bytes (void *a, const void *b, unsigned long len, void *ret)
-{
- unsigned char *x = (unsigned char *) a;
- unsigned char *y = (unsigned char *) b;
- unsigned long i;
-
- /* 'len' might be zero here, so preloading the first two values
- before the loop may access unallocated memory. */
- for (i = 0; i < len; i++) {
- *x = *y;
- x++;
- y++;
- }
- return ret;
-}
-
-/* This code is called to copy only remaining bytes within word or doubleword */
-static inline void * __attribute__ ((always_inline))
-do_bytes_remaining (void *a, const void *b, unsigned long len, void *ret)
-{
- unsigned char *x = (unsigned char *) a;
-
- if(len > 0) {
- bitfields_t bw;
- bw.v = *((reg_t*) b);
-
-#if __mips64
- DO_BYTE(x, 0);
- DO_BYTE(x, 1);
- DO_BYTE(x, 2);
- DO_BYTE(x, 3);
- DO_BYTE(x, 4);
- DO_BYTE(x, 5);
- DO_BYTE(x, 6);
- DO_BYTE(x, 7);
-#else
- DO_BYTE(x, 0);
- DO_BYTE(x, 1);
- DO_BYTE(x, 2);
- DO_BYTE(x, 3);
-#endif
- }
-
- return ret;
-}
-
-#if !HW_UNALIGNED_SUPPORT
-#if UNALIGNED_INSTR_SUPPORT
-/* for MIPS GCC, there are no unaligned builtins - so this struct forces
- the compiler to treat the pointer access as unaligned. */
-struct ulw
-{
- reg_t uli;
-} __attribute__ ((packed));
-
-/* first pointer is not aligned while second pointer is. */
-static void *
-unaligned_words (struct ulw *a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b + 8);
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- reg_t y4 = b[4], y5 = b[5], y6 = b[6], y7 = b[7];
- a[0].uli = y0;
- a[1].uli = y1;
- a[2].uli = y2;
- a[3].uli = y3;
- a[4].uli = y4;
- a[5].uli = y5;
- a[6].uli = y6;
- a[7].uli = y7;
- a += 8;
- b += 8;
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b + 4);
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3];
- a[0].uli = y0;
- a[1].uli = y1;
- a[2].uli = y2;
- a[3].uli = y3;
- a += 4;
- b += 4;
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- a->uli = *b;
- a += 1;
- b += 1;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_remaining (a, b, bytes, ret);
-}
-#else
-/* no HW support or unaligned lw/ld/ualw/uald instructions. */
-static void *
-unaligned_words (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
- unsigned long i;
- unsigned char *x = (unsigned char *) a;
-
- for (i = 0; i < words; i++) {
- bitfields_t bw;
- bw.v = *((reg_t*) b);
- x = (unsigned char *) a;
-#if __mips64
- x[0] = bw.b.B0;
- x[1] = bw.b.B1;
- x[2] = bw.b.B2;
- x[3] = bw.b.B3;
- x[4] = bw.b.B4;
- x[5] = bw.b.B5;
- x[6] = bw.b.B6;
- x[7] = bw.b.B7;
-#else
- x[0] = bw.b.B0;
- x[1] = bw.b.B1;
- x[2] = bw.b.B2;
- x[3] = bw.b.B3;
-#endif
- a += 1;
- b += 1;
- }
-
- /* mop up any remaining bytes */
- return do_bytes_remaining (a, b, bytes, ret);
-}
-#endif /* UNALIGNED_INSTR_SUPPORT */
-#endif /* HW_UNALIGNED_SUPPORT */
-
-/* both pointers are aligned, or first isn't and HW support for unaligned. */
-static void *
-aligned_words (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b + 8);
- reg_t x0 = b[0], x1 = b[1], x2 = b[2], x3 = b[3];
- reg_t x4 = b[4], x5 = b[5], x6 = b[6], x7 = b[7];
- a[0] = x0;
- a[1] = x1;
- a[2] = x2;
- a[3] = x3;
- a[4] = x4;
- a[5] = x5;
- a[6] = x6;
- a[7] = x7;
- a += 8;
- b += 8;
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b + 4);
- reg_t x0 = b[0], x1 = b[1], x2 = b[2], x3 = b[3];
- a[0] = x0;
- a[1] = x1;
- a[2] = x2;
- a[3] = x3;
- a += 4;
- b += 4;
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- *a = *b;
- a += 1;
- b += 1;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_remaining (a, b, bytes, ret);
-}
-
-void *
-memcpy (void *a, const void *b, size_t len)
-{
- unsigned long bytes, words;
- void *ret = a;
-
- /* shouldn't hit that often. */
- if (len < sizeof (reg_t) * 4) {
- return do_bytes (a, b, len, a);
- }
-
- /* Align the second pointer to word/dword alignment.
- Note that the pointer is only 32-bits for o32/n32 ABIs. For
- n32, loads are done as 64-bit while address remains 32-bit. */
- bytes = ((unsigned long) b) % sizeof (reg_t);
- if (bytes) {
- bytes = sizeof (reg_t) - bytes;
- if (bytes > len)
- bytes = len;
- do_bytes (a, b, bytes, ret);
- if (len == bytes)
- return ret;
- len -= bytes;
- a = (void *) (((unsigned char *) a) + bytes);
- b = (const void *) (((unsigned char *) b) + bytes);
- }
-
- /* Second pointer now aligned. */
- words = len / sizeof (reg_t);
- bytes = len % sizeof (reg_t);
-#if HW_UNALIGNED_SUPPORT
- /* treat possible unaligned first pointer as aligned. */
- return aligned_words (a, b, words, bytes, ret);
-#else
- if (((unsigned long) a) % sizeof (reg_t) == 0) {
- return aligned_words (a, b, words, bytes, ret);
- }
- /* need to use unaligned instructions on first pointer. */
- return unaligned_words (a, b, words, bytes, ret);
-#endif
-}
diff --git a/libc/arch-mips/string/memmove.c b/libc/arch-mips/string/memmove.c
deleted file mode 100644
index 74d4cd0..0000000
--- a/libc/arch-mips/string/memmove.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#if !defined(UNALIGNED_INSTR_SUPPORT)
-/* does target have unaligned lw/ld/ualw/uald instructions? */
-#define UNALIGNED_INSTR_SUPPORT 0
-#if __mips_isa_rev < 6 && !__mips1
-#undef UNALIGNED_INSTR_SUPPORT
-#define UNALIGNED_INSTR_SUPPORT 1
-#endif
-#endif
-
-#if !defined(HW_UNALIGNED_SUPPORT)
-/* Does target have hardware support for unaligned accesses? */
-#define HW_UNALIGNED_SUPPORT 0
-#if __mips_isa_rev >= 6
-#undef HW_UNALIGNED_SUPPORT
-#define HW_UNALIGNED_SUPPORT 1
-#endif
-#endif
-
-#define ENABLE_PREFETCH 1
-
-#if ENABLE_PREFETCH
-#define PREFETCH(addr) __builtin_prefetch (addr, 0, 1);
-#else
-#define PREFETCH(addr)
-#endif
-
-#if _MIPS_SIM == _ABIO32
-typedef unsigned long reg_t;
-typedef struct
-{
- reg_t B0:8, B1:8, B2:8, B3:8;
-} bits_t;
-#else
-typedef unsigned long long reg_t;
-typedef struct
-{
- reg_t B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
-} bits_t;
-#endif
-
-typedef union
-{
- reg_t v;
- bits_t b;
-} bitfields_t;
-
-#define DO_BYTE(a, i) \
- a[i] = bw.b.B##i; \
- len--; \
- if(!len) return ret; \
-
-/* This code is called when aligning a pointer, there are remaining bytes
- after doing word compares, or architecture does not have some form
- of unaligned support. */
-static inline void * __attribute__ ((always_inline))
-do_bytes (void *a, const void *b, unsigned long len, void *ret)
-{
- unsigned char *x = (unsigned char *) a;
- unsigned char *y = (unsigned char *) b;
- unsigned long i;
-
- /* 'len' might be zero here, so preloading the first two values
- before the loop may access unallocated memory. */
- for (i = 0; i < len; i++)
- {
- *x = *y;
- x++;
- y++;
- }
- return ret;
-}
-
-static inline void * __attribute__ ((always_inline))
-do_bytes_backward (void *a, const void *b, unsigned long len, void *ret)
-{
- unsigned char *x = (unsigned char *) a;
- unsigned char *y = (unsigned char *) b;
- unsigned long i;
-
- /* 'len' might be zero here, so preloading the first two values
- before the loop may access unallocated memory. */
- for (i = 0; i < len; i++) {
- *--x = *--y;
- }
- return ret;
-}
-
-static inline void * __attribute__ ((always_inline))
-do_bytes_aligned (void *a, const void *b, unsigned long len, void *ret)
-{
- unsigned char *x = (unsigned char *) a;
-
- if(len > 0) {
- bitfields_t bw;
- bw.v = *((reg_t*) b);
-
-#if __mips64
- DO_BYTE(x, 0);
- DO_BYTE(x, 1);
- DO_BYTE(x, 2);
- DO_BYTE(x, 3);
- DO_BYTE(x, 4);
- DO_BYTE(x, 5);
- DO_BYTE(x, 6);
- DO_BYTE(x, 7);
-#else
- DO_BYTE(x, 0);
- DO_BYTE(x, 1);
- DO_BYTE(x, 2);
- DO_BYTE(x, 3);
-#endif
- }
-
- return ret;
-}
-
-#if !HW_UNALIGNED_SUPPORT
-#if UNALIGNED_INSTR_SUPPORT
-/* for MIPS GCC, there are no unaligned builtins - so this struct forces
- the compiler to treat the pointer access as unaligned. */
-struct ulw
-{
- reg_t uli;
-} __attribute__ ((packed));
-
-#define STORE_UNALIGNED_8(a, b) \
-{ \
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3]; \
- reg_t y4 = b[4], y5 = b[5], y6 = b[6], y7 = b[7]; \
- a[0].uli = y0; \
- a[1].uli = y1; \
- a[2].uli = y2; \
- a[3].uli = y3; \
- a[4].uli = y4; \
- a[5].uli = y5; \
- a[6].uli = y6; \
- a[7].uli = y7; \
-}
-
-#define STORE_UNALIGNED_4(a, b) \
-{ \
- reg_t y0 = b[0], y1 = b[1], y2 = b[2], y3 = b[3]; \
- a[0].uli = y0; \
- a[1].uli = y1; \
- a[2].uli = y2; \
- a[3].uli = y3; \
-}
-
-/* first pointer is not aligned while second pointer is. */
-static void *
-unaligned_words_forward (struct ulw *a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b + 8);
- STORE_UNALIGNED_8(a, b);
- a += 8;
- b += 8;
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b + 4);
- STORE_UNALIGNED_4(a, b);
- a += 4;
- b += 4;
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- a->uli = *b;
- a += 1;
- b += 1;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_aligned (a, b, bytes, ret);
-}
-
-static void *
-unaligned_words_backward (struct ulw *a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b - 16);
- a -= 8;
- b -= 8;
- STORE_UNALIGNED_8(a, b);
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b - 8);
- a -= 4;
- b -= 4;
- STORE_UNALIGNED_4(a, b);
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- a -= 1;
- b -= 1;
- a->uli = *b;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_backward (a, b, bytes, ret);
-}
-
-#else
-/* no HW support or unaligned lw/ld/ualw/uald instructions. */
-static void *
-unaligned_words_forward (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
- return do_bytes_aligned (a, b, (sizeof (reg_t) * words) + bytes, ret);
-}
-
-static void *
-unaligned_words_backward (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
- return do_bytes_backward (a, b, (sizeof (reg_t) * words) + bytes, ret);
-}
-
-#endif /* UNALIGNED_INSTR_SUPPORT */
-#endif /* HW_UNALIGNED_SUPPORT */
-
-/* both pointers are aligned, or first isn't and HW support for unaligned. */
-
-#define STORE_ALIGNED_8(a, b) \
-{ \
- reg_t x0 = b[0], x1 = b[1], x2 = b[2], x3 = b[3]; \
- reg_t x4 = b[4], x5 = b[5], x6 = b[6], x7 = b[7]; \
- a[0] = x0; \
- a[1] = x1; \
- a[2] = x2; \
- a[3] = x3; \
- a[4] = x4; \
- a[5] = x5; \
- a[6] = x6; \
- a[7] = x7; \
-}
-
-#define STORE_ALIGNED_4(a, b) \
-{ \
- reg_t x0 = b[0], x1 = b[1], x2 = b[2], x3 = b[3]; \
- a[0] = x0; \
- a[1] = x1; \
- a[2] = x2; \
- a[3] = x3; \
-}
-
-static void *
-aligned_words_forward (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b + 8);
- STORE_ALIGNED_8(a, b);
- a += 8;
- b += 8;
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b + 4);
- STORE_ALIGNED_4(a, b);
- a += 4;
- b += 4;
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- *a = *b;
- a += 1;
- b += 1;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_aligned (a, b, bytes, ret);
-}
-
-
-static void *
-aligned_words_backward (reg_t * a, const reg_t * b,
- unsigned long words, unsigned long bytes, void *ret)
-{
-#if ((_MIPS_SIM == _ABIO32) || _MIPS_TUNE_I6400)
- unsigned long i, words_by_8, words_by_1;
- words_by_1 = words % 8;
- words_by_8 = words >> 3;
- for (; words_by_8 > 0; words_by_8--) {
- if(words_by_8 != 1)
- PREFETCH (b - 16);
- a -= 8;
- b -= 8;
- STORE_ALIGNED_8(a, b);
- }
-#else
- unsigned long i, words_by_4, words_by_1;
- words_by_1 = words % 4;
- words_by_4 = words >> 2;
- for (; words_by_4 > 0; words_by_4--) {
- if(words_by_4 != 1)
- PREFETCH (b - 8);
- a -= 4;
- b -= 4;
- STORE_ALIGNED_4(a, b);
- }
-#endif
-
- /* do remaining words. */
- for (i = 0; i < words_by_1; i++) {
- a -= 1;
- b -= 1;
- *a = *b;
- }
-
- /* mop up any remaining bytes. */
- return do_bytes_backward (a, b, bytes, ret);
-}
-
-void *
-memmove (void *dst0, const void *src0, size_t length)
-{
- unsigned long bytes, words;
- void *ret = dst0;
-
- if (length == 0 || dst0 == src0) /* nothing to do */
- return dst0;
-
- if ((unsigned long)dst0 < (unsigned long)src0) {
- /* Copy forwards. */
- /* This shouldn't hit that often. */
- if (length < sizeof (reg_t) * 4) {
- return do_bytes (dst0, src0, length, ret);
- }
-
- /* Align the second pointer to word/dword alignment.
- Note that the pointer is only 32-bits for o32/n32 ABIs. For
- n32, loads are done as 64-bit while address remains 32-bit. */
- bytes = ((unsigned long) src0) % sizeof (reg_t);
- if (bytes) {
- bytes = sizeof (reg_t) - bytes;
- if (bytes > length)
- bytes = length;
- do_bytes (dst0, src0, bytes, ret);
- if (length == bytes)
- return ret;
- length -= bytes;
- dst0 = (void *) (((unsigned char *) dst0) + bytes);
- src0 = (const void *) (((unsigned char *) src0) + bytes);
- }
-
- /* Second pointer now aligned. */
- words = length / sizeof (reg_t);
- bytes = length % sizeof (reg_t);
-#if HW_UNALIGNED_SUPPORT
- /* treat possible unaligned first pointer as aligned. */
- return aligned_words_forward (dst0, src0, words, bytes, ret);
-#else
- if (((unsigned long) dst0) % sizeof (reg_t) == 0) {
- return aligned_words_forward (dst0, src0, words, bytes, ret);
- }
- /* need to use unaligned instructions on first pointer. */
- return unaligned_words_forward (dst0, src0, words, bytes, ret);
-#endif
- } else {
- /* Copy backwards. */
- dst0 = (void *) (((unsigned char *) dst0) + length);
- src0 = (const void *) (((unsigned char *) src0) + length);
-
- /* This shouldn't hit that often. */
- if (length < sizeof (reg_t) * 4) {
- return do_bytes_backward (dst0, src0, length, ret);
- }
-
- /* Align the second pointer to word/dword alignment.
- Note that the pointer is only 32-bits for o32/n32 ABIs. For
- n32, loads are done as 64-bit while address remains 32-bit. */
- bytes = ((unsigned long) src0) % sizeof (reg_t);
- if (bytes) {
- if (bytes > length)
- bytes = length;
- do_bytes_backward (dst0, src0, bytes, ret);
- if (length == bytes)
- return ret;
- length -= bytes;
- dst0 = (void *) (((unsigned char *) dst0) - bytes);
- src0 = (const void *) (((unsigned char *) src0) - bytes);
- }
-
- words = length / sizeof (reg_t);
- bytes = length % sizeof (reg_t);
-#if HW_UNALIGNED_SUPPORT
- /* treat possible unaligned first pointer as aligned. */
- return aligned_words_backward ((void *)dst0, (void *)src0, words, bytes, ret);
-#else
- if (((unsigned long) dst0) % sizeof (reg_t) == 0) {
- return aligned_words_backward (dst0, src0, words, bytes, ret);
- }
- /* need to use unaligned instructions on first pointer. */
- return unaligned_words_backward (dst0, src0, words, bytes, ret);
-#endif
- }
-}
diff --git a/libc/arch-mips/string/memset.S b/libc/arch-mips/string/memset.S
deleted file mode 100644
index 85ba2e9..0000000
--- a/libc/arch-mips/string/memset.S
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright (c) 2013
- * MIPS Technologies, Inc., California.
- *
- * 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. Neither the name of the MIPS Technologies, Inc., nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef __ANDROID__
-# include <private/bionic_asm.h>
-# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
-#elif _LIBC
-# include <sysdep.h>
-# include <regdef.h>
-# include <sys/asm.h>
-# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
-#elif _COMPILING_NEWLIB
-# include "machine/asm.h"
-# include "machine/regdef.h"
-# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
-#else
-# include <regdef.h>
-# include <sys/asm.h>
-#endif
-
-/* Check to see if the MIPS architecture we are compiling for supports
- prefetching. */
-
-#if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)
-# ifndef DISABLE_PREFETCH
-# define USE_PREFETCH
-# endif
-#endif
-
-#if defined(_MIPS_SIM) && ((_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32))
-# ifndef DISABLE_DOUBLE
-# define USE_DOUBLE
-# endif
-#endif
-
-#ifndef USE_DOUBLE
-# ifndef DISABLE_DOUBLE_ALIGN
-# define DOUBLE_ALIGN
-# endif
-#endif
-
-/* Some asm.h files do not have the L macro definition. */
-#ifndef L
-# if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-# else
-# define L(label) .L ## label
-# endif
-#endif
-
-/* Some asm.h files do not have the PTR_ADDIU macro definition. */
-#ifndef PTR_ADDIU
-# if _MIPS_SIM == _ABIO32
-# define PTR_ADDIU addiu
-# else
-# define PTR_ADDIU daddiu
-# endif
-#endif
-
-/* New R6 instructions that may not be in asm.h. */
-#ifndef PTR_LSA
-# if _MIPS_SIM == _ABIO32
-# define PTR_LSA lsa
-# else
-# define PTR_LSA dlsa
-# endif
-#endif
-
-/* Using PREFETCH_HINT_PREPAREFORSTORE instead of PREFETCH_STORE
- or PREFETCH_STORE_STREAMED offers a large performance advantage
- but PREPAREFORSTORE has some special restrictions to consider.
-
- Prefetch with the 'prepare for store' hint does not copy a memory
- location into the cache, it just allocates a cache line and zeros
- it out. This means that if you do not write to the entire cache
- line before writing it out to memory some data will get zero'ed out
- when the cache line is written back to memory and data will be lost.
-
- There are ifdef'ed sections of this memcpy to make sure that it does not
- do prefetches on cache lines that are not going to be completely written.
- This code is only needed and only used when PREFETCH_STORE_HINT is set to
- PREFETCH_HINT_PREPAREFORSTORE. This code assumes that cache lines are
- less than MAX_PREFETCH_SIZE bytes and if the cache line is larger it will
- not work correctly. */
-
-#ifdef USE_PREFETCH
-# define PREFETCH_HINT_STORE 1
-# define PREFETCH_HINT_STORE_STREAMED 5
-# define PREFETCH_HINT_STORE_RETAINED 7
-# define PREFETCH_HINT_PREPAREFORSTORE 30
-
-/* If we have not picked out what hints to use at this point use the
- standard load and store prefetch hints. */
-# ifndef PREFETCH_STORE_HINT
-# define PREFETCH_STORE_HINT PREFETCH_HINT_STORE
-# endif
-
-/* We double everything when USE_DOUBLE is true so we do 2 prefetches to
- get 64 bytes in that case. The assumption is that each individual
- prefetch brings in 32 bytes. */
-# ifdef USE_DOUBLE
-# define PREFETCH_CHUNK 64
-# define PREFETCH_FOR_STORE(chunk, reg) \
- pref PREFETCH_STORE_HINT, (chunk)*64(reg); \
- pref PREFETCH_STORE_HINT, ((chunk)*64)+32(reg)
-# else
-# define PREFETCH_CHUNK 32
-# define PREFETCH_FOR_STORE(chunk, reg) \
- pref PREFETCH_STORE_HINT, (chunk)*32(reg)
-# endif
-
-/* MAX_PREFETCH_SIZE is the maximum size of a prefetch, it must not be less
- than PREFETCH_CHUNK, the assumed size of each prefetch. If the real size
- of a prefetch is greater than MAX_PREFETCH_SIZE and the PREPAREFORSTORE
- hint is used, the code will not work correctly. If PREPAREFORSTORE is not
- used than MAX_PREFETCH_SIZE does not matter. */
-# define MAX_PREFETCH_SIZE 128
-/* PREFETCH_LIMIT is set based on the fact that we never use an offset greater
- than 5 on a STORE prefetch and that a single prefetch can never be larger
- than MAX_PREFETCH_SIZE. We add the extra 32 when USE_DOUBLE is set because
- we actually do two prefetches in that case, one 32 bytes after the other. */
-# ifdef USE_DOUBLE
-# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + 32 + MAX_PREFETCH_SIZE
-# else
-# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + MAX_PREFETCH_SIZE
-# endif
-
-# if (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE) \
- && ((PREFETCH_CHUNK * 4) < MAX_PREFETCH_SIZE)
-/* We cannot handle this because the initial prefetches may fetch bytes that
- are before the buffer being copied. We start copies with an offset
- of 4 so avoid this situation when using PREPAREFORSTORE. */
-# error "PREFETCH_CHUNK is too large and/or MAX_PREFETCH_SIZE is too small."
-# endif
-#else /* USE_PREFETCH not defined */
-# define PREFETCH_FOR_STORE(offset, reg)
-#endif
-
-#if __mips_isa_rev > 5
-# if (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
-# undef PREFETCH_STORE_HINT
-# define PREFETCH_STORE_HINT PREFETCH_HINT_STORE_STREAMED
-# endif
-# define R6_CODE
-#endif
-
-/* We load/store 64 bits at a time when USE_DOUBLE is true.
- The C_ prefix stands for CHUNK and is used to avoid macro name
- conflicts with system header files. */
-
-#ifdef USE_DOUBLE
-# define C_ST sd
-# if __MIPSEB
-# define C_STHI sdl /* high part is left in big-endian */
-# else
-# define C_STHI sdr /* high part is right in little-endian */
-# endif
-#else
-# define C_ST sw
-# if __MIPSEB
-# define C_STHI swl /* high part is left in big-endian */
-# else
-# define C_STHI swr /* high part is right in little-endian */
-# endif
-#endif
-
-/* Bookkeeping values for 32 vs. 64 bit mode. */
-#ifdef USE_DOUBLE
-# define NSIZE 8
-# define NSIZEMASK 0x3f
-# define NSIZEDMASK 0x7f
-#else
-# define NSIZE 4
-# define NSIZEMASK 0x1f
-# define NSIZEDMASK 0x3f
-#endif
-#define UNIT(unit) ((unit)*NSIZE)
-#define UNITM1(unit) (((unit)*NSIZE)-1)
-
-#ifdef __ANDROID__
-LEAF(__memset_chk,0)
-#else
-LEAF(__memset_chk)
-#endif
- .set noreorder
- sltu $t2, $a3, $a2
- beq $t2, $zero, memset
- nop
- .cpsetup $t9, $t8, __memset_chk
- LA $t9, __memset_chk_fail
- jr $t9
- nop
- .set reorder
-END(__memset_chk)
-
-#ifdef __ANDROID__
-LEAF(memset,0)
-#else
-LEAF(memset)
-#endif
-
- .set nomips16
- .set noreorder
-/* If the size is less than 2*NSIZE (8 or 16), go to L(lastb). Regardless of
- size, copy dst pointer to v0 for the return value. */
- slti $t2,$a2,(2 * NSIZE)
- bne $t2,$zero,L(lastb)
- move $v0,$a0
-
-/* If memset value is not zero, we copy it to all the bytes in a 32 or 64
- bit word. */
- beq $a1,$zero,L(set0) /* If memset value is zero no smear */
- PTR_SUBU $a3,$zero,$a0
- nop
-
- /* smear byte into 32 or 64 bit word */
-#if ((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2)
-# ifdef USE_DOUBLE
- dins $a1, $a1, 8, 8 /* Replicate fill byte into half-word. */
- dins $a1, $a1, 16, 16 /* Replicate fill byte into word. */
- dins $a1, $a1, 32, 32 /* Replicate fill byte into dbl word. */
-# else
- ins $a1, $a1, 8, 8 /* Replicate fill byte into half-word. */
- ins $a1, $a1, 16, 16 /* Replicate fill byte into word. */
-# endif
-#else
-# ifdef USE_DOUBLE
- and $a1,0xff
- dsll $t2,$a1,8
- or $a1,$t2
- dsll $t2,$a1,16
- or $a1,$t2
- dsll $t2,$a1,32
- or $a1,$t2
-# else
- and $a1,0xff
- sll $t2,$a1,8
- or $a1,$t2
- sll $t2,$a1,16
- or $a1,$t2
-# endif
-#endif
-
-/* If the destination address is not aligned do a partial store to get it
- aligned. If it is already aligned just jump to L(aligned). */
-L(set0):
-#ifndef R6_CODE
- andi $t2,$a3,(NSIZE-1) /* word-unaligned address? */
- beq $t2,$zero,L(aligned) /* t2 is the unalignment count */
- PTR_SUBU $a2,$a2,$t2
- C_STHI $a1,0($a0)
- PTR_ADDU $a0,$a0,$t2
-#else /* R6_CODE */
- andi $t2,$a0,(NSIZE-1)
- lapc $t9,L(atable)
- PTR_LSA $t9,$t2,$t9,2
- jrc $t9
-L(atable):
- bc L(aligned)
-# ifdef USE_DOUBLE
- bc L(lb7)
- bc L(lb6)
- bc L(lb5)
- bc L(lb4)
-# endif
- bc L(lb3)
- bc L(lb2)
- bc L(lb1)
-L(lb7):
- sb $a1,6($a0)
-L(lb6):
- sb $a1,5($a0)
-L(lb5):
- sb $a1,4($a0)
-L(lb4):
- sb $a1,3($a0)
-L(lb3):
- sb $a1,2($a0)
-L(lb2):
- sb $a1,1($a0)
-L(lb1):
- sb $a1,0($a0)
-
- li $t9,NSIZE
- subu $t2,$t9,$t2
- PTR_SUBU $a2,$a2,$t2
- PTR_ADDU $a0,$a0,$t2
-#endif /* R6_CODE */
-
-L(aligned):
-/* If USE_DOUBLE is not set we may still want to align the data on a 16
- byte boundry instead of an 8 byte boundry to maximize the opportunity
- of proAptiv chips to do memory bonding (combining two sequential 4
- byte stores into one 8 byte store). We know there are at least 4 bytes
- left to store or we would have jumped to L(lastb) earlier in the code. */
-#ifdef DOUBLE_ALIGN
- andi $t2,$a3,4
- beq $t2,$zero,L(double_aligned)
- PTR_SUBU $a2,$a2,$t2
- sw $a1,0($a0)
- PTR_ADDU $a0,$a0,$t2
-L(double_aligned):
-#endif
-
-/* Now the destination is aligned to (word or double word) aligned address
- Set a2 to count how many bytes we have to copy after all the 64/128 byte
- chunks are copied and a3 to the dest pointer after all the 64/128 byte
- chunks have been copied. We will loop, incrementing a0 until it equals
- a3. */
- andi $t8,$a2,NSIZEDMASK /* any whole 64-byte/128-byte chunks? */
- beq $a2,$t8,L(chkw) /* if a2==t8, no 64-byte/128-byte chunks */
- PTR_SUBU $a3,$a2,$t8 /* subtract from a2 the reminder */
- PTR_ADDU $a3,$a0,$a3 /* Now a3 is the final dst after loop */
-
-/* When in the loop we may prefetch with the 'prepare to store' hint,
- in this case the a0+x should not be past the "t0-32" address. This
- means: for x=128 the last "safe" a0 address is "t0-160". Alternatively,
- for x=64 the last "safe" a0 address is "t0-96" In the current version we
- will use "prefetch hint,128(a0)", so "t0-160" is the limit. */
-#if defined(USE_PREFETCH) \
- && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
- PTR_ADDU $t0,$a0,$a2 /* t0 is the "past the end" address */
- PTR_SUBU $t9,$t0,PREFETCH_LIMIT /* t9 is the "last safe pref" address */
-#endif
-#if defined(USE_PREFETCH) \
- && (PREFETCH_STORE_HINT != PREFETCH_HINT_PREPAREFORSTORE)
- PREFETCH_FOR_STORE (1, $a0)
- PREFETCH_FOR_STORE (2, $a0)
- PREFETCH_FOR_STORE (3, $a0)
-#endif
-
-L(loop16w):
-#if defined(USE_PREFETCH) \
- && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
- sltu $v1,$t9,$a0 /* If a0 > t9 don't use next prefetch */
- bgtz $v1,L(skip_pref)
- nop
-#endif
-#ifndef R6_CODE
- PREFETCH_FOR_STORE (4, $a0)
- PREFETCH_FOR_STORE (5, $a0)
-#else
- PREFETCH_FOR_STORE (2, $a0)
-#endif
-L(skip_pref):
- C_ST $a1,UNIT(0)($a0)
- C_ST $a1,UNIT(1)($a0)
- C_ST $a1,UNIT(2)($a0)
- C_ST $a1,UNIT(3)($a0)
- C_ST $a1,UNIT(4)($a0)
- C_ST $a1,UNIT(5)($a0)
- C_ST $a1,UNIT(6)($a0)
- C_ST $a1,UNIT(7)($a0)
- C_ST $a1,UNIT(8)($a0)
- C_ST $a1,UNIT(9)($a0)
- C_ST $a1,UNIT(10)($a0)
- C_ST $a1,UNIT(11)($a0)
- C_ST $a1,UNIT(12)($a0)
- C_ST $a1,UNIT(13)($a0)
- C_ST $a1,UNIT(14)($a0)
- C_ST $a1,UNIT(15)($a0)
- PTR_ADDIU $a0,$a0,UNIT(16) /* adding 64/128 to dest */
- bne $a0,$a3,L(loop16w)
- nop
- move $a2,$t8
-
-/* Here we have dest word-aligned but less than 64-bytes or 128 bytes to go.
- Check for a 32(64) byte chunk and copy if if there is one. Otherwise
- jump down to L(chk1w) to handle the tail end of the copy. */
-L(chkw):
- andi $t8,$a2,NSIZEMASK /* is there a 32-byte/64-byte chunk. */
- /* the t8 is the reminder count past 32-bytes */
- beq $a2,$t8,L(chk1w)/* when a2==t8, no 32-byte chunk */
- nop
- C_ST $a1,UNIT(0)($a0)
- C_ST $a1,UNIT(1)($a0)
- C_ST $a1,UNIT(2)($a0)
- C_ST $a1,UNIT(3)($a0)
- C_ST $a1,UNIT(4)($a0)
- C_ST $a1,UNIT(5)($a0)
- C_ST $a1,UNIT(6)($a0)
- C_ST $a1,UNIT(7)($a0)
- PTR_ADDIU $a0,$a0,UNIT(8)
-
-/* Here we have less than 32(64) bytes to set. Set up for a loop to
- copy one word (or double word) at a time. Set a2 to count how many
- bytes we have to copy after all the word (or double word) chunks are
- copied and a3 to the dest pointer after all the (d)word chunks have
- been copied. We will loop, incrementing a0 until a0 equals a3. */
-L(chk1w):
- andi $a2,$t8,(NSIZE-1) /* a2 is the reminder past one (d)word chunks */
- beq $a2,$t8,L(lastb)
- PTR_SUBU $a3,$t8,$a2 /* a3 is count of bytes in one (d)word chunks */
- PTR_ADDU $a3,$a0,$a3 /* a3 is the dst address after loop */
-
-/* copying in words (4-byte or 8 byte chunks) */
-L(wordCopy_loop):
- PTR_ADDIU $a0,$a0,UNIT(1)
- bne $a0,$a3,L(wordCopy_loop)
- C_ST $a1,UNIT(-1)($a0)
-
-/* Copy the last 8 (or 16) bytes */
-L(lastb):
- blez $a2,L(leave)
- PTR_ADDU $a3,$a0,$a2 /* a3 is the last dst address */
-L(lastbloop):
- PTR_ADDIU $a0,$a0,1
- bne $a0,$a3,L(lastbloop)
- sb $a1,-1($a0)
-L(leave):
- j $ra
- nop
-
- .set at
- .set reorder
-END(memset)
-#ifndef __ANDROID__
-# ifdef _LIBC
-libc_hidden_builtin_def (memset)
-libc_hidden_builtin_def (__memset_chk)
-# endif
-#endif
diff --git a/libc/arch-mips/string/strchr.c b/libc/arch-mips/string/strchr.c
deleted file mode 100644
index 3458f66..0000000
--- a/libc/arch-mips/string/strchr.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#define op_t unsigned long int
-#define op_size sizeof (op_t)
-
-#if __mips64
-typedef struct
-{
- op_t B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
-} bits_t;
-#else
-typedef struct
-{
- op_t B0:8, B1:8, B2:8, B3:8;
-} bits_t;
-#endif
-
-typedef union
-{
- op_t v;
- bits_t b;
-} bitfields_t;
-
-#define DO_BYTE(i) \
- if (a.b.B##i != ch) { \
- if(a.b.B##i == '\0') return 0; \
- p++; \
- } else \
- return (char *)p;
-
-#define DO_WORD(w, cnt) { \
- op_t val = w[cnt] ^ mask_c; \
- if ((((w[cnt] - mask_1) & ~w[cnt]) & mask_128) || \
- (((val - mask_1) & ~val) & mask_128)) { \
- return do_bytes(w + cnt, ch); \
- } \
-}
-
-static inline char * __attribute__ ((always_inline))
-do_bytes (const op_t* w, unsigned char ch)
-{
- bitfields_t a;
- unsigned char* p = (unsigned char *) w;
- a.v = *w;
-#if __mips64
- DO_BYTE(0)
- DO_BYTE(1)
- DO_BYTE(2)
- DO_BYTE(3)
- DO_BYTE(4)
- DO_BYTE(5)
- DO_BYTE(6)
- DO_BYTE(7)
-#else
- DO_BYTE(0)
- DO_BYTE(1)
- DO_BYTE(2)
- DO_BYTE(3)
-#endif
- return (char *)p;
-}
-
-char* strchr(const char* s, int c)
-{
- const op_t *w;
- op_t mask_1, mask_128, mask_c;
- const unsigned char ch = c;
- unsigned char* p = (unsigned char *) s;
-
- /*
- * Check byte by byte till initial alignment
- */
- for ( ; *p != ch && ((size_t) p % op_size) != 0; p++)
- if (*p == '\0')
- return 0;
-
- if (*p != ch) {
- w = (const op_t *) p;
-
- mask_c = ch | (ch << 8);
- mask_c |= mask_c << 16;
- __asm__ volatile (
- "li %0, 0x01010101 \n\t"
- : "=r" (mask_1)
- );
-#if __mips64
- mask_1 |= mask_1 << 32;
- mask_c |= mask_c << 32;
-#endif
- mask_128 = mask_1 << 7;
-
- /*
- * Check word/dword wize after initial alignment till character match
- * or end of string
- */
- while (1) {
- DO_WORD(w, 0)
- DO_WORD(w, 1)
- DO_WORD(w, 2)
- DO_WORD(w, 3)
- w += 4;
- }
- }
-
- return (char *)p;
-}
diff --git a/libc/arch-mips/string/strcmp.S b/libc/arch-mips/string/strcmp.S
deleted file mode 100644
index 4791a0d..0000000
--- a/libc/arch-mips/string/strcmp.S
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef __ANDROID__
-# include <private/bionic_asm.h>
-#elif _LIBC
-# include <sysdep.h>
-# include <regdef.h>
-# include <sys/asm.h>
-#elif _COMPILING_NEWLIB
-# include "machine/asm.h"
-# include "machine/regdef.h"
-#else
-# include <regdef.h>
-# include <sys/asm.h>
-#endif
-
-#if __mips64
-# define NSIZE 8
-# define LW ld
-# define EXT dext
-# define SRL dsrl
-# define SLL dsll
-# define SUBU dsubu
-#else
-# define NSIZE 4
-# define LW lw
-# define EXT ext
-# define SRL srl
-# define SLL sll
-# define SUBU subu
-#endif
-
-/* Technically strcmp should not read past the end of the strings being
- compared. We will read a full word that may contain excess bits beyond
- the NULL string terminator but unless ENABLE_READAHEAD is set, we will not
- read the next word after the end of string. Setting ENABLE_READAHEAD will
- improve performance but is technically illegal based on the definition of
- strcmp. */
-#ifdef ENABLE_READAHEAD
-# define DELAY_READ
-#else
-# define DELAY_READ nop
-#endif
-
-/* Testing on a little endian machine showed using CLZ was a
- performance loss, so we are not turning it on by default. */
-#if defined(ENABLE_CLZ) && (__mips_isa_rev > 1)
-# define USE_CLZ
-#endif
-
-/* Some asm.h files do not have the L macro definition. */
-#ifndef L
-# if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-# else
-# define L(label) .L ## label
-# endif
-#endif
-
-/* Some asm.h files do not have the PTR_ADDIU macro definition. */
-#ifndef PTR_ADDIU
-# if _MIPS_SIM == _ABIO32
-# define PTR_ADDIU addiu
-# else
-# define PTR_ADDIU daddiu
-# endif
-#endif
-
-/* It might seem better to do the 'beq' instruction between the two 'lbu'
- instructions so that the nop is not needed but testing showed that this
- code is actually faster (based on glibc strcmp test). */
-#define BYTECMP01(OFFSET) \
- lbu $v0, OFFSET($a0); \
- lbu $v1, OFFSET($a1); \
- beq $v0, $zero, L(bexit01); \
- nop; \
- bne $v0, $v1, L(bexit01)
-
-#define BYTECMP89(OFFSET) \
- lbu $t8, OFFSET($a0); \
- lbu $t9, OFFSET($a1); \
- beq $t8, $zero, L(bexit89); \
- nop; \
- bne $t8, $t9, L(bexit89)
-
-/* Allow the routine to be named something else if desired. */
-#ifndef STRCMP_NAME
-# define STRCMP_NAME strcmp
-#endif
-
-#ifdef __ANDROID__
-LEAF(STRCMP_NAME, 0)
-#else
-LEAF(STRCMP_NAME)
-#endif
- .set nomips16
- .set noreorder
-
- andi $t1, $a1, (NSIZE - 1)
- beqz $t1, L(exitalign)
- or $t0, $zero, NSIZE
- SUBU $t1, $t0, $t1 #process (NSIZE - 1) bytes at max
-
-L(alignloop): #do by bytes until a1 aligned
- BYTECMP01(0)
- SUBU $t1, $t1, 0x1
- PTR_ADDIU $a0, $a0, 0x1
- bnez $t1, L(alignloop)
- PTR_ADDIU $a1, $a1, 0x1
-
-L(exitalign):
-
-/* string a1 is NSIZE byte aligned at this point. */
-
- lui $t8, 0x0101
- ori $t8, 0x0101
- lui $t9, 0x7f7f
- ori $t9, 0x7f7f
-#if __mips64
- dsll $t1, $t8, 32
- or $t8, $t1
- dsll $t1, $t9, 32
- or $t9, $t1
-#endif
-
- andi $t2, $a0, (NSIZE - 1) #check if a0 aligned
- SUBU $t3, $t0, $t2 #t3 will be used as shifter
- bnez $t2, L(uloopenter)
- SUBU $a2, $a0, $t2 #bring back a0 to aligned position
-
-#define STRCMPW(OFFSET) \
- LW $v0, OFFSET($a0); \
- LW $v1, OFFSET($a1); \
- SUBU $t0, $v0, $t8; \
- bne $v0, $v1, L(worddiff); \
- nor $t1, $v0, $t9; \
- and $t0, $t0, $t1; \
- bne $t0, $zero, L(returnzero);\
-
-L(wordloop):
- STRCMPW(0 * NSIZE)
- DELAY_READ
- STRCMPW(1 * NSIZE)
- DELAY_READ
- STRCMPW(2 * NSIZE)
- DELAY_READ
- STRCMPW(3 * NSIZE)
- DELAY_READ
- STRCMPW(4 * NSIZE)
- DELAY_READ
- STRCMPW(5 * NSIZE)
- DELAY_READ
- STRCMPW(6 * NSIZE)
- DELAY_READ
- STRCMPW(7 * NSIZE)
- PTR_ADDIU $a0, $a0, (8 * NSIZE)
- b L(wordloop)
- PTR_ADDIU $a1, $a1, (8 * NSIZE)
-
-#define USTRCMPW(OFFSET) \
- LW $v1, OFFSET($a1); \
- SUBU $t0, $v0, $t8; \
- nor $t1, $v0, $t9; \
- and $t0, $t0, $t1; \
- bne $t0, $zero, L(worddiff); \
- SRL $v0, $t2; \
- LW $a3, (OFFSET + NSIZE)($a2); \
- SUBU $t0, $v1, $t8; \
- SLL $t1, $a3, $t3; \
- or $v0, $v0, $t1; \
- bne $v0, $v1, L(worddiff); \
- nor $t1, $v1, $t9; \
- and $t0, $t0, $t1; \
- bne $t0, $zero, L(returnzero); \
- move $v0, $a3;\
-
-L(uloopenter):
- LW $v0, 0($a2)
- SLL $t2, 3 #multiply by 8
- SLL $t3, 3 #multiply by 8
- li $a3, -1 #all 1s
- SRL $a3, $t3
- or $v0, $a3 #replace with all 1s if zeros in unintented read
-
-L(uwordloop):
- USTRCMPW(0 * NSIZE)
- USTRCMPW(1 * NSIZE)
- USTRCMPW(2 * NSIZE)
- USTRCMPW(3 * NSIZE)
- USTRCMPW(4 * NSIZE)
- USTRCMPW(5 * NSIZE)
- USTRCMPW(6 * NSIZE)
- USTRCMPW(7 * NSIZE)
- PTR_ADDIU $a2, $a2, (8 * NSIZE)
- b L(uwordloop)
- PTR_ADDIU $a1, $a1, (8 * NSIZE)
-
-L(returnzero):
- j $ra
- move $v0, $zero
-
-#if __mips_isa_rev > 1
-#define EXT_COMPARE01(POS) \
- EXT $t0, $v0, POS, 8; \
- beq $t0, $zero, L(wexit01); \
- EXT $t1, $v1, POS, 8; \
- bne $t0, $t1, L(wexit01)
-#define EXT_COMPARE89(POS) \
- EXT $t8, $v0, POS, 8; \
- beq $t8, $zero, L(wexit89); \
- EXT $t9, $v1, POS, 8; \
- bne $t8, $t9, L(wexit89)
-#else
-#define EXT_COMPARE01(POS) \
- SRL $t0, $v0, POS; \
- SRL $t1, $v1, POS; \
- andi $t0, $t0, 0xff; \
- beq $t0, $zero, L(wexit01); \
- andi $t1, $t1, 0xff; \
- bne $t0, $t1, L(wexit01)
-#define EXT_COMPARE89(POS) \
- SRL $t8, $v0, POS; \
- SRL $t9, $v1, POS; \
- andi $t8, $t8, 0xff; \
- beq $t8, $zero, L(wexit89); \
- andi $t9, $t9, 0xff; \
- bne $t8, $t9, L(wexit89)
-#endif
-
-L(worddiff):
-#ifdef USE_CLZ
- SUBU $t0, $v0, $t8
- nor $t1, $v0, $t9
- and $t1, $t0, $t1
- xor $t0, $v0, $v1
- or $t0, $t0, $t1
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- wsbh $t0, $t0
- rotr $t0, $t0, 16
-# endif
- clz $t1, $t0
- and $t1, 0xf8
-# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- neg $t1
- addu $t1, 24
-# endif
- rotrv $v0, $v0, $t1
- rotrv $v1, $v1, $t1
- and $v0, $v0, 0xff
- and $v1, $v1, 0xff
- j $ra
- SUBU $v0, $v0, $v1
-#else /* USE_CLZ */
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- andi $t0, $v0, 0xff
- beq $t0, $zero, L(wexit01)
- andi $t1, $v1, 0xff
- bne $t0, $t1, L(wexit01)
- EXT_COMPARE89(8)
- EXT_COMPARE01(16)
-#ifndef __mips64
- SRL $t8, $v0, 24
- SRL $t9, $v1, 24
-#else
- EXT_COMPARE89(24)
- EXT_COMPARE01(32)
- EXT_COMPARE89(40)
- EXT_COMPARE01(48)
- SRL $t8, $v0, 56
- SRL $t9, $v1, 56
-#endif
-
-# else /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */
-#ifdef __mips64
- SRL $t0, $v0, 56
- beq $t0, $zero, L(wexit01)
- SRL $t1, $v1, 56
- bne $t0, $t1, L(wexit01)
- EXT_COMPARE89(48)
- EXT_COMPARE01(40)
- EXT_COMPARE89(32)
- EXT_COMPARE01(24)
-#else
- SRL $t0, $v0, 24
- beq $t0, $zero, L(wexit01)
- SRL $t1, $v1, 24
- bne $t0, $t1, L(wexit01)
-#endif
- EXT_COMPARE89(16)
- EXT_COMPARE01(8)
-
- andi $t8, $v0, 0xff
- andi $t9, $v1, 0xff
-# endif /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */
-
-L(wexit89):
- j $ra
- SUBU $v0, $t8, $t9
-L(wexit01):
- j $ra
- SUBU $v0, $t0, $t1
-#endif /* USE_CLZ */
-
-L(byteloop):
- BYTECMP01(0)
- BYTECMP89(1)
- BYTECMP01(2)
- BYTECMP89(3)
- BYTECMP01(4)
- BYTECMP89(5)
- BYTECMP01(6)
- BYTECMP89(7)
- PTR_ADDIU $a0, $a0, 8
- b L(byteloop)
- PTR_ADDIU $a1, $a1, 8
-
-L(bexit01):
- j $ra
- SUBU $v0, $v0, $v1
-L(bexit89):
- j $ra
- SUBU $v0, $t8, $t9
-
- .set at
- .set reorder
-
-END(STRCMP_NAME)
-#ifndef __ANDROID__
-# ifdef _LIBC
-libc_hidden_builtin_def (STRCMP_NAME)
-# endif
-#endif
diff --git a/libc/arch-mips/string/strcpy.c b/libc/arch-mips/string/strcpy.c
deleted file mode 100644
index b77105e..0000000
--- a/libc/arch-mips/string/strcpy.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#define op_t unsigned long int
-
-#if !defined(UNALIGNED_INSTR_SUPPORT)
-/* does target have unaligned lw/ld/ualw/uald instructions? */
-#define UNALIGNED_INSTR_SUPPORT 0
-#if __mips_isa_rev < 6 && !__mips1
-#undef UNALIGNED_INSTR_SUPPORT
-#define UNALIGNED_INSTR_SUPPORT 1
-#endif
-#endif
-
-#if !defined(HW_UNALIGNED_SUPPORT)
-/* Does target have hardware support for unaligned accesses? */
-#define HW_UNALIGNED_SUPPORT 0
-#if __mips_isa_rev >= 6
-#undef HW_UNALIGNED_SUPPORT
-#define HW_UNALIGNED_SUPPORT 1
-#endif
-#endif
-
-#if __mips64
-typedef struct
-{
- op_t B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
-} bits_t;
-#else
-typedef struct
-{
- op_t B0:8, B1:8, B2:8, B3:8;
-} bits_t;
-#endif
-
-typedef union
-{
- op_t v;
- bits_t b;
-} bitfields_t;
-
-#if !HW_UNALIGNED_SUPPORT && UNALIGNED_INSTR_SUPPORT
-/* for MIPS GCC, there are no unaligned builtins - so this struct forces
- the compiler to treat the pointer access as unaligned. */
-struct ulw
-{
- op_t uli;
-} __attribute__ ((packed));
-#endif /* !HW_UNALIGNED_SUPPORT && UNALIGNED_INSTR_SUPPORT */
-
-#define DO_BYTE(i, ptdst) { \
- *(ptdst+i) = a.b.B##i; \
- if(a.b.B##i == '\0') \
- return ret; \
-}
-
-#if __mips64
-#define DO_BYTES(val, dst) { \
- bitfields_t a; \
- char *tdst = (char *)(dst); \
- a.v = val; \
- DO_BYTE(0, tdst) \
- DO_BYTE(1, tdst) \
- DO_BYTE(2, tdst) \
- DO_BYTE(3, tdst) \
- DO_BYTE(4, tdst) \
- DO_BYTE(5, tdst) \
- DO_BYTE(6, tdst) \
- DO_BYTE(7, tdst) \
-}
-#else
-#define DO_BYTES(val, dst) { \
- bitfields_t a; \
- char *tdst = (char *)(dst); \
- a.v = val; \
- DO_BYTE(0, tdst) \
- DO_BYTE(1, tdst) \
- DO_BYTE(2, tdst) \
- DO_BYTE(3, tdst) \
-}
-#endif
-
-#define DO_WORD_ALIGNED(dst, src) { \
- op_t val = *(src); \
- if ((((val - mask_1) & ~val) & mask_128) != 0) { \
- DO_BYTES(val, dst); \
- } else *(dst) = val; \
-}
-
-#if !HW_UNALIGNED_SUPPORT
-#if UNALIGNED_INSTR_SUPPORT
-#define DO_WORD_UNALIGNED(dst, src) { \
- op_t val = *(src); \
- if ((((val - mask_1) & ~val) & mask_128) != 0) { \
- DO_BYTES(val, dst); \
- } else { \
- struct ulw *a = (struct ulw *)(dst); \
- a->uli = val; \
- } \
-}
-#else
-#define DO_WORD_UNALIGNED(dst, src) { \
- op_t val = *(src); \
- if ((((val - mask_1) & ~val) & mask_128) != 0) { \
- DO_BYTES(val, dst); \
- } else { \
- char *pdst = (char *) dst; \
- const char *psrc = (const char *) src; \
- for (; (*pdst = *psrc) != '\0'; ++psrc, ++pdst); \
- return ret; \
- } \
-}
-#endif /* UNALIGNED_INSTR_SUPPORT */
-
-#define PROCESS_UNALIGNED_WORDS(a, b) { \
- while (1) { \
- DO_WORD_UNALIGNED(a, b); \
- DO_WORD_UNALIGNED(a + 1, b + 1); \
- DO_WORD_UNALIGNED(a + 2, b + 2); \
- DO_WORD_UNALIGNED(a + 3, b + 3); \
- a += 4; \
- b += 4; \
- } \
-}
-#endif /* HW_UNALIGNED_SUPPORT */
-
-#define PROCESS_ALIGNED_WORDS(a, b) { \
- while (1) { \
- DO_WORD_ALIGNED(a, b); \
- DO_WORD_ALIGNED(a + 1, b + 1); \
- DO_WORD_ALIGNED(a + 2, b + 2); \
- DO_WORD_ALIGNED(a + 3, b + 3); \
- a += 4; \
- b += 4; \
- } \
-}
-
-char *
-strcpy (char *to, const char *from)
-{
- char *ret = to;
- op_t mask_1, mask_128;
- const op_t *src;
- op_t *dst;
-
- for (; (*to = *from) != '\0' && ((size_t) from % sizeof (op_t)) != 0; ++from, ++to);
-
- if(*to != '\0') {
- __asm__ volatile (
- "li %0, 0x01010101 \n\t"
- : "=r" (mask_1)
- );
-#if __mips64
- mask_1 |= mask_1 << 32;
-#endif
- mask_128 = mask_1 << 7;
-
- src = (const op_t *) from;
- dst = (op_t *) to;
-
-#if HW_UNALIGNED_SUPPORT
- PROCESS_ALIGNED_WORDS(dst, src);
-#else
- if (((unsigned long) dst) % sizeof (op_t) == 0) {
- PROCESS_ALIGNED_WORDS(dst, src);
- } else {
- PROCESS_UNALIGNED_WORDS(dst, src);
- }
-#endif
- }
-
- return ret;
-}
diff --git a/libc/arch-mips/string/strlen.c b/libc/arch-mips/string/strlen.c
deleted file mode 100644
index 28463f6..0000000
--- a/libc/arch-mips/string/strlen.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#define op_t unsigned long int
-#define op_size sizeof (op_t)
-
-#if __mips64 || __mips_isa_rev >= 2
-static inline size_t __attribute__ ((always_inline))
-do_bytes (const char *base, const char *p, op_t inval)
-{
- op_t outval = 0;
-#if __mips64
- __asm__ volatile (
- "dsbh %1, %0 \n\t"
- "dshd %0, %1 \n\t"
- "dclz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#else
- __asm__ volatile (
- "wsbh %1, %0 \n\t"
- "rotr %0, %1, 16 \n\t"
- "clz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#endif
- p += (outval >> 3);
- return (size_t) (p - base);
-}
-
-#define DO_WORD(w, cnt) { \
- op_t val = ((w[cnt] - mask_1) & ~w[cnt]) & mask_128; \
- if (val) \
- return do_bytes(str, (const char *)(w + cnt), val); \
-}
-#else
-static inline size_t __attribute__ ((always_inline))
-do_bytes (const char *base, const char *p)
-{
- for (; *p; ++p);
- return (size_t) (p - base);
-}
-
-#define DO_WORD(w, cnt) { \
- if (((w[cnt] - mask_1) & ~w[cnt]) & mask_128) \
- return do_bytes(str, (const char *)(w + cnt)); \
-}
-#endif
-
-size_t
-strlen (const char *str)
-{
- if (*str) {
- const char *p = (const char *) str;
- const op_t *w;
- op_t mask_1, mask_128;
-
- while ((size_t) p % sizeof (op_t)) {
- if (!(*p))
- return (p - str);
- p++;
- }
-
- __asm__ volatile (
- "li %0, 0x01010101 \n\t"
- : "=r" (mask_1)
- );
-#if __mips64
- mask_1 |= mask_1 << 32;
-#endif
- mask_128 = mask_1 << 7;
-
- w = (const op_t *) p;
-
- while (1) {
- DO_WORD(w, 0);
- DO_WORD(w, 1);
- DO_WORD(w, 2);
- DO_WORD(w, 3);
- w += 4;
- }
- }
- return 0;
-}
diff --git a/libc/arch-mips/string/strncmp.S b/libc/arch-mips/string/strncmp.S
deleted file mode 100644
index 49250a0..0000000
--- a/libc/arch-mips/string/strncmp.S
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef __ANDROID__
-# include <private/bionic_asm.h>
-#elif _LIBC
-# include <sysdep.h>
-# include <regdef.h>
-# include <sys/asm.h>
-#elif _COMPILING_NEWLIB
-# include "machine/asm.h"
-# include "machine/regdef.h"
-#else
-# include <regdef.h>
-# include <sys/asm.h>
-#endif
-
-#if __mips64
-# define NSIZE 8
-# define LW ld
-# define LWR ldr
-# define LWL ldl
-# define EXT dext
-# define SRL dsrl
-# define SUBU dsubu
-#else
-# define NSIZE 4
-# define LW lw
-# define LWR lwr
-# define LWL lwl
-# define EXT ext
-# define SRL srl
-# define SUBU subu
-#endif
-
-/* Technically strcmp should not read past the end of the strings being
- compared. We will read a full word that may contain excess bits beyond
- the NULL string terminator but unless ENABLE_READAHEAD is set, we will not
- read the next word after the end of string. Setting ENABLE_READAHEAD will
- improve performance but is technically illegal based on the definition of
- strcmp. */
-#ifdef ENABLE_READAHEAD
-# define DELAY_READ
-#else
-# define DELAY_READ nop
-#endif
-
-/* Testing on a little endian machine showed using CLZ was a
- performance loss, so we are not turning it on by default. */
-#if defined(ENABLE_CLZ) && (__mips_isa_rev > 1) && (!__mips64)
-# define USE_CLZ
-#endif
-
-/* Some asm.h files do not have the L macro definition. */
-#ifndef L
-# if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-# else
-# define L(label) .L ## label
-# endif
-#endif
-
-/* Some asm.h files do not have the PTR_ADDIU macro definition. */
-#ifndef PTR_ADDIU
-# if _MIPS_SIM == _ABIO32
-# define PTR_ADDIU addiu
-# else
-# define PTR_ADDIU daddiu
-# endif
-#endif
-
-/* It might seem better to do the 'beq' instruction between the two 'lbu'
- instructions so that the nop is not needed but testing showed that this
- code is actually faster (based on glibc strcmp test). */
-#define BYTECMP01(OFFSET) \
- lbu $v0, OFFSET($a0); \
- lbu $v1, OFFSET($a1); \
- beq $v0, $zero, L(bexit01); \
- nop; \
- bne $v0, $v1, L(bexit01)
-
-#define BYTECMP89(OFFSET) \
- lbu $t8, OFFSET($a0); \
- lbu $t9, OFFSET($a1); \
- beq $t8, $zero, L(bexit89); \
- nop; \
- bne $t8, $t9, L(bexit89)
-
-/* Allow the routine to be named something else if desired. */
-#ifndef STRNCMP_NAME
-# define STRNCMP_NAME strncmp
-#endif
-
-#ifdef __ANDROID__
-LEAF(STRNCMP_NAME, 0)
-#else
-LEAF(STRNCMP_NAME)
-#endif
- .set nomips16
- .set noreorder
-
- srl $t0, $a2, (2 + NSIZE / 4)
- beqz $t0, L(byteloop) #process by bytes if less than (2 * NSIZE)
- andi $t1, $a1, (NSIZE - 1)
- beqz $t1, L(exitalign)
- or $t0, $zero, NSIZE
- SUBU $t1, $t0, $t1 #process (NSIZE - 1) bytes at max
- SUBU $a2, $a2, $t1 #dec count by t1
-
-L(alignloop): #do by bytes until a1 aligned
- BYTECMP01(0)
- SUBU $t1, $t1, 0x1
- PTR_ADDIU $a0, $a0, 0x1
- bne $t1, $zero, L(alignloop)
- PTR_ADDIU $a1, $a1, 0x1
-
-L(exitalign):
-
-/* string a1 is NSIZE byte aligned at this point. */
-#ifndef __mips1
- lui $t8, 0x0101
- ori $t8, 0x0101
- lui $t9, 0x7f7f
- ori $t9, 0x7f7f
-#if __mips64
- dsll $t0, $t8, 32
- or $t8, $t0
- dsll $t1, $t9, 32
- or $t9, $t1
-#endif
-#endif
-
-/* hardware or software alignment not supported for mips1
- rev6 archs have h/w unaligned support
- remainings archs need to implemented with unaligned instructions */
-
-#if __mips1
- andi $t0, $a0, (NSIZE - 1)
- bne $t0, $zero, L(byteloop)
-#elif __mips_isa_rev < 6
- andi $t0, $a0, (NSIZE - 1)
- bne $t0, $zero, L(uwordloop)
-#endif
-
-#define STRCMPW(OFFSET) \
- LW $v0, (OFFSET)($a0); \
- LW $v1, (OFFSET)($a1); \
- SUBU $t0, $v0, $t8; \
- bne $v0, $v1, L(worddiff); \
- nor $t1, $v0, $t9; \
- and $t0, $t0, $t1; \
- bne $t0, $zero, L(returnzero);\
-
-L(wordloop):
- SUBU $t1, $a2, (8 * NSIZE)
- bltz $t1, L(onewords)
- STRCMPW(0 * NSIZE)
- DELAY_READ
- STRCMPW(1 * NSIZE)
- DELAY_READ
- STRCMPW(2 * NSIZE)
- DELAY_READ
- STRCMPW(3 * NSIZE)
- DELAY_READ
- STRCMPW(4 * NSIZE)
- DELAY_READ
- STRCMPW(5 * NSIZE)
- DELAY_READ
- STRCMPW(6 * NSIZE)
- DELAY_READ
- STRCMPW(7 * NSIZE)
- SUBU $a2, $a2, (8 * NSIZE)
- PTR_ADDIU $a0, $a0, (8 * NSIZE)
- b L(wordloop)
- PTR_ADDIU $a1, $a1, (8 * NSIZE)
-
-L(onewords):
- SUBU $t1, $a2, NSIZE
- bltz $t1, L(byteloop)
- STRCMPW(0)
- SUBU $a2, $a2, NSIZE
- PTR_ADDIU $a0, $a0, NSIZE
- b L(onewords)
- PTR_ADDIU $a1, $a1, NSIZE
-
-#if __mips_isa_rev < 6 && !__mips1
-#define USTRCMPW(OFFSET) \
- LWR $v0, (OFFSET)($a0); \
- LWL $v0, (OFFSET + NSIZE - 1)($a0); \
- LW $v1, (OFFSET)($a1); \
- SUBU $t0, $v0, $t8; \
- bne $v0, $v1, L(worddiff); \
- nor $t1, $v0, $t9; \
- and $t0, $t0, $t1; \
- bne $t0, $zero, L(returnzero);\
-
-L(uwordloop):
- SUBU $t1, $a2, (8 * NSIZE)
- bltz $t1, L(uonewords)
- USTRCMPW(0 * NSIZE)
- DELAY_READ
- USTRCMPW(1 * NSIZE)
- DELAY_READ
- USTRCMPW(2 * NSIZE)
- DELAY_READ
- USTRCMPW(3 * NSIZE)
- DELAY_READ
- USTRCMPW(4 * NSIZE)
- DELAY_READ
- USTRCMPW(5 * NSIZE)
- DELAY_READ
- USTRCMPW(6 * NSIZE)
- DELAY_READ
- USTRCMPW(7 * NSIZE)
- SUBU $a2, $a2, (8 * NSIZE)
- PTR_ADDIU $a0, $a0, (8 * NSIZE)
- b L(uwordloop)
- PTR_ADDIU $a1, $a1, (8 * NSIZE)
-
-L(uonewords):
- SUBU $t1, $a2, NSIZE
- bltz $t1, L(byteloop)
- USTRCMPW(0)
- SUBU $a2, $a2, NSIZE
- PTR_ADDIU $a0, $a0, NSIZE
- b L(uonewords)
- PTR_ADDIU $a1, $a1, NSIZE
-
-#endif
-
-L(returnzero):
- j $ra
- move $v0, $zero
-
-#if __mips_isa_rev > 1
-#define EXT_COMPARE01(POS) \
- EXT $t0, $v0, POS, 8; \
- beq $t0, $zero, L(wexit01); \
- EXT $t1, $v1, POS, 8; \
- bne $t0, $t1, L(wexit01)
-#define EXT_COMPARE89(POS) \
- EXT $t8, $v0, POS, 8; \
- beq $t8, $zero, L(wexit89); \
- EXT $t9, $v1, POS, 8; \
- bne $t8, $t9, L(wexit89)
-#else
-#define EXT_COMPARE01(POS) \
- SRL $t0, $v0, POS; \
- SRL $t1, $v1, POS; \
- andi $t0, $t0, 0xff; \
- beq $t0, $zero, L(wexit01); \
- andi $t1, $t1, 0xff; \
- bne $t0, $t1, L(wexit01)
-#define EXT_COMPARE89(POS) \
- SRL $t8, $v0, POS; \
- SRL $t9, $v1, POS; \
- andi $t8, $t8, 0xff; \
- beq $t8, $zero, L(wexit89); \
- andi $t9, $t9, 0xff; \
- bne $t8, $t9, L(wexit89)
-#endif
-
-L(worddiff):
-#ifdef USE_CLZ
- SUBU $t0, $v0, $t8
- nor $t1, $v0, $t9
- and $t1, $t0, $t1
- xor $t0, $v0, $v1
- or $t0, $t0, $t1
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- wsbh $t0, $t0
- rotr $t0, $t0, 16
-# endif
- clz $t1, $t0
- and $t1, 0xf8
-# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- neg $t1
- addu $t1, 24
-# endif
- rotrv $v0, $v0, $t1
- rotrv $v1, $v1, $t1
- and $v0, $v0, 0xff
- and $v1, $v1, 0xff
- j $ra
- SUBU $v0, $v0, $v1
-#else /* USE_CLZ */
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- andi $t0, $v0, 0xff
- beq $t0, $zero, L(wexit01)
- andi $t1, $v1, 0xff
- bne $t0, $t1, L(wexit01)
- EXT_COMPARE89(8)
- EXT_COMPARE01(16)
-#ifndef __mips64
- SRL $t8, $v0, 24
- SRL $t9, $v1, 24
-#else
- EXT_COMPARE89(24)
- EXT_COMPARE01(32)
- EXT_COMPARE89(40)
- EXT_COMPARE01(48)
- SRL $t8, $v0, 56
- SRL $t9, $v1, 56
-#endif
-
-# else /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */
-#ifdef __mips64
- SRL $t0, $v0, 56
- beq $t0, $zero, L(wexit01)
- SRL $t1, $v1, 56
- bne $t0, $t1, L(wexit01)
- EXT_COMPARE89(48)
- EXT_COMPARE01(40)
- EXT_COMPARE89(32)
- EXT_COMPARE01(24)
-#else
- SRL $t0, $v0, 24
- beq $t0, $zero, L(wexit01)
- SRL $t1, $v1, 24
- bne $t0, $t1, L(wexit01)
-#endif
- EXT_COMPARE89(16)
- EXT_COMPARE01(8)
-
- andi $t8, $v0, 0xff
- andi $t9, $v1, 0xff
-# endif /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */
-
-L(wexit89):
- j $ra
- SUBU $v0, $t8, $t9
-L(wexit01):
- j $ra
- SUBU $v0, $t0, $t1
-#endif /* USE_CLZ */
-
-L(byteloop):
- beq $a2, $zero, L(returnzero)
- SUBU $a2, $a2, 1
- BYTECMP01(0)
- nop
- beq $a2, $zero, L(returnzero)
- SUBU $a2, $a2, 1
- BYTECMP89(1)
- nop
- beq $a2, $zero, L(returnzero)
- SUBU $a2, $a2, 1
- BYTECMP01(2)
- nop
- beq $a2, $zero, L(returnzero)
- SUBU $a2, $a2, 1
- BYTECMP89(3)
- PTR_ADDIU $a0, $a0, 4
- b L(byteloop)
- PTR_ADDIU $a1, $a1, 4
-
-L(bexit01):
- j $ra
- SUBU $v0, $v0, $v1
-L(bexit89):
- j $ra
- SUBU $v0, $t8, $t9
-
- .set at
- .set reorder
-
-END(STRNCMP_NAME)
-#ifndef __ANDROID__
-# ifdef _LIBC
-libc_hidden_builtin_def (STRNCMP_NAME)
-# endif
-#endif
diff --git a/libc/arch-mips/string/strnlen.c b/libc/arch-mips/string/strnlen.c
deleted file mode 100644
index 2011deb..0000000
--- a/libc/arch-mips/string/strnlen.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2017 Imagination Technologies.
- *
- * 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 Imagination Technologies nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-
-#define op_t unsigned long int
-#define op_size sizeof (op_t)
-
-#if __mips64 || __mips_isa_rev >= 2
-static inline size_t __attribute__ ((always_inline))
-do_bytes (const char *base, const char *p, op_t inval)
-{
- op_t outval = 0;
-#if __mips64
- __asm__ volatile (
- "dsbh %1, %0 \n\t"
- "dshd %0, %1 \n\t"
- "dclz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#else
- __asm__ volatile (
- "wsbh %1, %0 \n\t"
- "rotr %0, %1, 16 \n\t"
- "clz %1, %0 \n\t"
- : "+r" (inval), "+r" (outval)
- );
-#endif
- p += (outval >> 3);
- return (size_t) (p - base);
-}
-
-#define DO_WORD(in, val) { \
- op_t tmp = ((val - mask_1) & ~val) & mask_128; \
- if (tmp) \
- return do_bytes(str, (const char *)(in), tmp); \
-}
-#else
-static inline size_t __attribute__ ((always_inline))
-do_bytes (const char *base, const char *p)
-{
- for (; *p; ++p);
- return (size_t) (p - base);
-}
-
-#define DO_WORD(in, val) { \
- if (((val - mask_1) & ~val) & mask_128) { \
- return do_bytes(str, (const char *)(in)); \
- } \
-}
-#endif
-
-size_t strnlen (const char *str, size_t n) {
- if (n != 0) {
- const char *p = (const char *) str;
- const op_t *w;
- op_t mask_1, mask_128;
-
- for (; n > 0 && ((size_t) p % op_size) != 0; --n, ++p) {
- if (!(*p))
- return (p - str);
- }
-
- w = (const op_t *) p;
-
- __asm__ volatile (
- "li %0, 0x01010101 \n\t"
- : "=r" (mask_1)
- );
-#if __mips64
- mask_1 |= mask_1 << 32;
-#endif
- mask_128 = mask_1 << 7;
-
- /*
- * Check op_size byteswize after initial alignment
- */
- while (n >= 4 * op_size) {
- const op_t w0 = w[0];
- const op_t w1 = w[1];
- const op_t w2 = w[2];
- const op_t w3 = w[3];
- DO_WORD(w + 0, w0)
- DO_WORD(w + 1, w1)
- DO_WORD(w + 2, w2)
- DO_WORD(w + 3, w3)
- w += 4;
- n -= 4 * op_size;
- }
-
- while (n >= op_size) {
- DO_WORD(w, w[0]);
- w++;
- n -= op_size;
- }
-
- /*
- * Check bytewize for remaining bytes
- */
- p = (const char *) w;
- for (; n > 0; --n, ++p) {
- if (!(*p))
- return (p - str);
- }
-
- return (p - str);
- }
-
- return 0;
-}
diff --git a/libc/arch-mips64/bionic/__bionic_clone.S b/libc/arch-mips64/bionic/__bionic_clone.S
deleted file mode 100644
index d725efc..0000000
--- a/libc/arch-mips64/bionic/__bionic_clone.S
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-FRAMESZ = MKFSIZ(NARGSAVE,0)
-FRAME_ARG = 0*REGSZ
-FRAME_FN = 1*REGSZ
-#else
-FRAMESZ = MKFSIZ(0,3)
-FRAME_GP = FRAMESZ-1*REGSZ
-FRAME_ARG = FRAMESZ-2*REGSZ
-FRAME_FN = FRAMESZ-3*REGSZ
-#endif
-
-// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
-LEAF(__bionic_clone, FRAMESZ)
- PTR_SUBU $sp, FRAMESZ # allocate stack frame
- SETUP_GP64(FRAME_GP,__bionic_clone)
- SAVE_GP(FRAME_GP)
-
- # set up child stack
- PTR_SUBU $a1,FRAMESZ
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- PTR_L $t0,FRAMESZ+5*REGSZ($sp) # fn
- PRL_L $t1,FRAMESZ+6*REGSZ($sp) # arg
- PTR_S $t0,FRAME_FN($a1) # fn
- PTR_S $t1,FRAME_ARG($a1) # arg
-#else
- PTR_L $t0,FRAME_GP($sp) # copy gp to child stack
- PTR_S $t0,FRAME_GP($a1)
- PTR_S $a5,FRAME_FN($a1) # fn
- PTR_S $a6,FRAME_ARG($a1) # arg
-# endif
-
- # remainder of arguments are correct for clone system call
- LI $v0,__NR_clone
- syscall
-
- move $a0,$v0
- bnez $a3,.L__error_bc
-
- beqz $v0,.L__thread_start_bc
-
- RESTORE_GP64
- PTR_ADDU $sp,FRAMESZ
- j $ra
-
-.L__thread_start_bc:
- # Clear return address in child so we don't unwind further.
- li $ra,0
-
- # void __start_thread(int (*func)(void*), void *arg)
- PTR_L $a0,FRAME_FN($sp) # fn
- PTR_L $a1,FRAME_ARG($sp) # arg
- LA $t9,__start_thread
- RESTORE_GP64
- /*
- * For O32 etc the child stack must have space for a0..a3 to be stored
- * For N64 etc, the child stack can be restored to the original value
- */
-#if !((_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32))
- PTR_ADDU $sp,FRAMESZ
-#endif
- j $t9
-
-.L__error_bc:
- LA $t9,__set_errno_internal
- RESTORE_GP64
- PTR_ADDU $sp,FRAMESZ
- j $t9
- END(__bionic_clone)
-.hidden __bionic_clone
diff --git a/libc/arch-mips64/bionic/_exit_with_stack_teardown.S b/libc/arch-mips64/bionic/_exit_with_stack_teardown.S
deleted file mode 100644
index 4f80801..0000000
--- a/libc/arch-mips64/bionic/_exit_with_stack_teardown.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
-ENTRY_PRIVATE(_exit_with_stack_teardown)
- li $v0, __NR_munmap
- syscall
- // If munmap failed, we ignore the failure and exit anyway.
-
- li $a0, 0
- li $v0, __NR_exit
- syscall
- // The exit syscall does not return.
-END(_exit_with_stack_teardown)
diff --git a/libc/arch-mips64/bionic/crtbegin.c b/libc/arch-mips64/bionic/crtbegin.c
deleted file mode 100644
index bdd423b..0000000
--- a/libc/arch-mips64/bionic/crtbegin.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "../../bionic/libc_init_common.h"
-#include <stddef.h>
-#include <stdint.h>
-
-__attribute__ ((section (".preinit_array")))
-void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
-
-__attribute__ ((section (".init_array")))
-void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
-
-__attribute__ ((section (".fini_array")))
-void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
-
-
-__LIBC_HIDDEN__ void do_mips_start(void *raw_args) {
- structors_array_t array;
- array.preinit_array = &__PREINIT_ARRAY__;
- array.init_array = &__INIT_ARRAY__;
- array.fini_array = &__FINI_ARRAY__;
-
- __libc_init(raw_args, NULL, &main, &array);
-}
-
-/*
- * This function prepares the return address with a branch-and-link
- * instruction (bal) and then uses a .cpsetup to compute the Global
- * Offset Table (GOT) pointer ($gp). The $gp is then used to load
- * the address of _do_mips_start() into $t9 just before calling it.
- * Terminating the stack with a NULL return address.
- */
-__asm__ (
-" .set push \n"
-" \n"
-" .text \n"
-" .align 4 \n"
-" .type __start,@function \n"
-" .globl __start \n"
-" .globl _start \n"
-" \n"
-" .ent __start \n"
-"__start: \n"
-" _start: \n"
-" .frame $sp,32,$0 \n"
-" .mask 0x80000000,-8 \n"
-" \n"
-" move $a0, $sp \n"
-" daddiu $sp, $sp, -32 \n"
-" \n"
-" .set noreorder \n"
-" bal 1f \n"
-" nop \n"
-"1: \n"
-" .cpsetup $ra,16,1b \n"
-" .set reorder \n"
-" \n"
-" sd $0, 24($sp) \n"
-" jal do_mips_start \n"
-" \n"
-"2: b 2b \n"
-" .end __start \n"
-" \n"
-" .set pop \n"
-);
-
-#include "../../arch-common/bionic/__dso_handle.h"
-#include "../../arch-common/bionic/atexit.h"
-#include "../../arch-common/bionic/pthread_atfork.h"
diff --git a/libc/arch-mips64/bionic/setjmp.S b/libc/arch-mips64/bionic/setjmp.S
deleted file mode 120000
index b117bb6..0000000
--- a/libc/arch-mips64/bionic/setjmp.S
+++ /dev/null
@@ -1 +0,0 @@
-../../arch-mips/bionic/setjmp.S
\ No newline at end of file
diff --git a/libc/arch-mips64/bionic/stat.cpp b/libc/arch-mips64/bionic/stat.cpp
deleted file mode 100644
index 63b6cd1..0000000
--- a/libc/arch-mips64/bionic/stat.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-struct kernel_stat {
- unsigned int st_dev;
- unsigned int st_pad0[3];
- unsigned long st_ino;
- mode_t st_mode;
- __u32 st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- unsigned int st_rdev;
- unsigned int st_pad1[3];
- __kernel_off_t st_size;
- unsigned int _st_atime;
- unsigned int _st_atime_nsec;
- unsigned int _st_mtime;
- unsigned int _st_mtime_nsec;
- unsigned int _st_ctime;
- unsigned int _st_ctime_nsec;
- unsigned int st_blksize;
- unsigned int st_pad2;
- unsigned long st_blocks;
-};
-
-static void copy_stat(struct stat* st, struct kernel_stat* s) {
- st->st_dev = static_cast<dev_t>(s->st_dev);
- st->st_ino = static_cast<ino_t>(s->st_ino);
- st->st_mode = static_cast<mode_t>(s->st_mode);
- st->st_nlink = static_cast<nlink_t>(s->st_nlink);
- st->st_uid = static_cast<uid_t>(s->st_uid);
- st->st_gid = static_cast<gid_t>(s->st_gid);
- st->st_rdev = static_cast<dev_t>(s->st_rdev);
- st->st_size = static_cast<off_t>(s->st_size);
- st->st_blksize = static_cast<int>(s->st_blksize);
- st->st_blocks = static_cast<long>(s->st_blocks);
- st->st_atim.tv_sec = static_cast<time_t>(s->_st_atime);
- st->st_atim.tv_nsec = static_cast<long>(s->_st_atime_nsec);
- st->st_mtim.tv_sec = static_cast<time_t>(s->_st_mtime);
- st->st_mtim.tv_nsec = static_cast<long>(s->_st_mtime_nsec);
- st->st_ctim.tv_sec = static_cast<time_t>(s->_st_ctime);
- st->st_ctim.tv_nsec = static_cast<long>(s->_st_ctime_nsec);
-}
-
-int fstat(int fp, struct stat* st) {
- kernel_stat s;
- int ret = syscall(__NR_fstat, fp, &s);
- copy_stat(st, &s);
- return ret;
-}
-__strong_alias(fstat64, fstat);
-
-int fstatat(int dirfd, const char* pathname, struct stat* buf, int flags) {
- kernel_stat s;
- int ret = syscall(__NR_newfstatat, dirfd, pathname, &s, flags);
- copy_stat(buf, &s);
- return ret;
-}
-__strong_alias(fstatat64, fstatat);
diff --git a/libc/arch-mips64/bionic/syscall.S b/libc/arch-mips64/bionic/syscall.S
deleted file mode 100644
index ce5dfd3..0000000
--- a/libc/arch-mips64/bionic/syscall.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-FRAMESZ = MKFSIZ(6,0)
-#else
-FRAMESZ = MKFSIZ(0,1)
-FRAME_GP = FRAMESZ-1*REGSZ
-#endif
-
-LEAF(syscall,FRAMESZ)
- PTR_SUBU $sp, FRAMESZ # allocate stack frame
- SETUP_GP64(FRAME_GP,syscall)
- SAVE_GP(FRAME_GP)
- move $v0, $a0 # syscall number to v0
- move $a0, $a1 # shift args down
- move $a1, $a2
- move $a2, $a3
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- REG_L $a3, FRAMESZ+4*REGSZ($sp)
- REG_L $t0, FRAMESZ+5*REGSZ($sp)
- REG_L $t1, FRAMESZ+6*REGSZ($sp)
- REG_S $t0, 4*REGSZ($sp)
- REG_S $t1, 5*REGSZ($sp)
-#else
- move $a3, $a4
- move $a4, $a5
- move $a5, $a6
-#endif
- syscall
- move $a0, $v0
- bnez $a3, 1f
- RESTORE_GP64
- PTR_ADDU $sp, FRAMESZ
- j $ra
-1:
- LA $t9,__set_errno_internal
- RESTORE_GP64
- PTR_ADDU $sp, FRAMESZ
- j $t9
- END(syscall)
diff --git a/libc/arch-mips64/bionic/vfork.S b/libc/arch-mips64/bionic/vfork.S
deleted file mode 100644
index b5ff5d4..0000000
--- a/libc/arch-mips64/bionic/vfork.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <linux/sched.h>
-
-// TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
-// #include <asm/signal.h>
-#define SIGCHLD 18
-
- .text
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-FRAMESZ = MKFSIZ(5,0)
-#else
-FRAMESZ = MKFSIZ(0,0)
-#endif
-
-LEAF(vfork,FRAMESZ)
-__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
-#if FRAMESZ!=0
- PTR_SUBU $sp, FRAMESZ
-#endif
- SETUP_GP64($a5, vfork)
-
- // __get_tls()[TLS_SLOT_THREAD_ID]->cached_pid_ = 0
- rdhwr $v0, $29 // v0 = tls
- REG_L $v0, REGSZ*1($v0) // v0 = v0[TLS_SLOT_THREAD_ID ie 1]
- sw $0, REGSZ*2+4($v0) // v0->cached_pid_ = 0
-
- LI $a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
- move $a1, $0
- move $a2, $0
- move $a3, $0
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- REG_S $0, 4*REGSZ(sp)
-#else
- move $a4, $0
-#endif
- LI $v0, __NR_clone
- syscall
-#if FRAMESZ!=0
- PTR_ADDU $sp,FRAMESZ
-#endif
- move $a0, $v0
- bnez $a3, 1f
- RESTORE_GP64
- j $ra
-1:
- LA $t9,__set_errno_internal
- RESTORE_GP64
- j $t9
- END(vfork)
diff --git a/libc/bionic/sys_msg.cpp b/libc/bionic/sys_msg.cpp
index 4880356..462c83b 100644
--- a/libc/bionic/sys_msg.cpp
+++ b/libc/bionic/sys_msg.cpp
@@ -32,9 +32,8 @@
#include <unistd.h>
int msgctl(int id, int cmd, msqid_ds* buf) {
-#if !defined(__LP64__) || defined(__mips__)
+#if !defined(__LP64__)
// Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit.
- // Mips64 is an exception to this, it requires the flag.
cmd |= IPC_64;
#endif
#if defined(SYS_msgctl)
diff --git a/libc/bionic/sys_sem.cpp b/libc/bionic/sys_sem.cpp
index 5e2a05c..058cfef 100644
--- a/libc/bionic/sys_sem.cpp
+++ b/libc/bionic/sys_sem.cpp
@@ -33,9 +33,8 @@
#include <unistd.h>
int semctl(int id, int num, int cmd, ...) {
-#if !defined(__LP64__) || defined(__mips__)
+#if !defined(__LP64__)
// Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit.
- // Mips64 is an exception to this, it requires the flag.
cmd |= IPC_64;
#endif
va_list ap;
diff --git a/libc/bionic/sys_shm.cpp b/libc/bionic/sys_shm.cpp
index f3b26e7..f780e04 100644
--- a/libc/bionic/sys_shm.cpp
+++ b/libc/bionic/sys_shm.cpp
@@ -45,9 +45,8 @@
}
int shmctl(int id, int cmd, struct shmid_ds* buf) {
-#if !defined(__LP64__) || defined(__mips__)
+#if !defined(__LP64__)
// Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit.
- // Mips64 is an exception to this, it requires the flag.
cmd |= IPC_64;
#endif
#if defined(SYS_shmctl)
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index c7e844a..3ea414a 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -27,7 +27,6 @@
#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
#define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
#define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
-#define __INTRODUCED_IN_MIPS(api_level)
#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
#define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
@@ -41,7 +40,6 @@
#define __INTRODUCED_IN_64(api_level)
#define __INTRODUCED_IN_ARM(api_level)
#define __INTRODUCED_IN_X86(api_level)
-#define __INTRODUCED_IN_MIPS(api_level)
#define __VERSIONER_NO_GUARD
#define __VERSIONER_FORTIFY_INLINE
diff --git a/libc/include/bits/signal_types.h b/libc/include/bits/signal_types.h
index 881ac58..e1a155f 100644
--- a/libc/include/bits/signal_types.h
+++ b/libc/include/bits/signal_types.h
@@ -26,15 +26,14 @@
* SUCH DAMAGE.
*/
-#ifndef _BITS_SIGNAL_TYPES_H_
-#define _BITS_SIGNAL_TYPES_H_
+#pragma once
#include <limits.h>
#include <sys/cdefs.h>
#include <sys/types.h>
-/* For 64-bit (and mips), the kernel's struct sigaction doesn't match the
- * POSIX one, so we need to expose our own and translate behind the scenes.
+/* For 64-bit, the kernel's struct sigaction doesn't match the POSIX one,
+ * so we need to expose our own and translate behind the scenes.
* For 32-bit, we're stuck with the definitions we already shipped,
* even though they contain a sigset_t that's too small. See sigaction64.
*/
@@ -56,10 +55,10 @@
typedef __sighandler_t sig_t; /* BSD compatibility. */
typedef __sighandler_t sighandler_t; /* glibc compatibility. */
-/* sigset_t is already large enough on LP64 and mips, but other LP32's sigset_t
+/* sigset_t is already large enough on LP64, but LP32's sigset_t
* is just `unsigned long`.
*/
-#if defined(__LP64__) || defined(__mips__)
+#if defined(__LP64__)
typedef sigset_t sigset64_t;
#else
typedef struct { unsigned long __bits[_KERNEL__NSIG/LONG_BIT]; } sigset64_t;
@@ -81,21 +80,6 @@
#undef __SIGACTION_BODY
-#elif defined(__mips__)
-
-#define __SIGACTION_BODY \
- int sa_flags; \
- union { \
- sighandler_t sa_handler; \
- void (*sa_sigaction)(int, struct siginfo*, void*); \
- }; \
- sigset_t sa_mask; \
-
-struct sigaction { __SIGACTION_BODY };
-struct sigaction64 { __SIGACTION_BODY };
-
-#undef __SIGACTION_BODY
-
#else
#undef sa_handler
@@ -123,5 +107,3 @@
};
#endif
-
-#endif
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 52a8ca6..3260231 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -53,8 +53,7 @@
#if defined(__USE_GNU)
-int clone(int (*__fn)(void*), void* __child_stack, int __flags, void* __arg, ...)
- __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(17);
+int clone(int (*__fn)(void*), void* __child_stack, int __flags, void* __arg, ...) __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_X86(17);
int unshare(int __flags) __INTRODUCED_IN(17);
int sched_getcpu(void);
int setns(int __fd, int __ns_type) __INTRODUCED_IN(21);
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index b22071f..3a64b33 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -48,12 +48,6 @@
#define _JBLEN 64
#elif defined(__i386__)
#define _JBLEN 10
-#elif defined(__mips__)
- #if defined(__LP64__)
- #define _JBLEN 25
- #else
- #define _JBLEN 157
- #endif
#elif defined(__x86_64__)
#define _JBLEN 11
#endif
diff --git a/libc/include/sys/cachectl.h b/libc/include/sys/cachectl.h
index 9235327..5ec295d 100644
--- a/libc/include/sys/cachectl.h
+++ b/libc/include/sys/cachectl.h
@@ -26,12 +26,8 @@
* SUCH DAMAGE.
*/
-#ifndef _SYS_CACHECTL_H
-#define _SYS_CACHECTL_H 1
+#pragma once
#include <sys/cdefs.h>
-#ifdef __mips__
-#include <asm/cachectl.h>
-#endif
-#endif
+/* This header file is obsolete. */
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index e2acab7..3ecbcce 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -46,13 +46,8 @@
struct timespec;
-#ifdef __mips__
-#define SOCK_DGRAM 1
-#define SOCK_STREAM 2
-#else
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
-#endif
#define SOCK_RAW 3
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index d8e92d9..a6c73b7 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -36,7 +36,7 @@
__BEGIN_DECLS
-#if defined(__aarch64__) || (defined(__mips__) && defined(__LP64__))
+#if defined(__aarch64__)
#define __STAT64_BODY \
dev_t st_dev; \
ino_t st_ino; \
@@ -56,25 +56,6 @@
unsigned int __unused4; \
unsigned int __unused5; \
-#elif defined(__mips__) && !defined(__LP64__)
-#define __STAT64_BODY \
- unsigned int st_dev; \
- unsigned int __pad0[3]; \
- unsigned long long st_ino; \
- mode_t st_mode; \
- nlink_t st_nlink; \
- uid_t st_uid; \
- gid_t st_gid; \
- unsigned int st_rdev; \
- unsigned int __pad1[3]; \
- long long st_size; \
- struct timespec st_atim; \
- struct timespec st_mtim; \
- struct timespec st_ctim; \
- unsigned int st_blksize; \
- unsigned int __pad2; \
- unsigned long long st_blocks; \
-
#elif defined(__x86_64__)
#define __STAT64_BODY \
dev_t st_dev; \
diff --git a/libc/include/sys/ucontext.h b/libc/include/sys/ucontext.h
index 730ac69..9c5801f 100644
--- a/libc/include/sys/ucontext.h
+++ b/libc/include/sys/ucontext.h
@@ -213,78 +213,6 @@
struct _libc_fpstate __fpregs_mem;
} ucontext_t;
-#elif defined(__mips__)
-
-/* glibc doesn't have names for MIPS registers. */
-
-#define NGREG 32
-#define NFPREG 32
-
-typedef unsigned long long greg_t;
-typedef greg_t gregset_t[NGREG];
-
-typedef struct fpregset {
- union {
- double fp_dregs[NFPREG];
- struct {
- float _fp_fregs;
- unsigned _fp_pad;
- } fp_fregs[NFPREG];
- } fp_r;
-} fpregset_t;
-
-#ifdef __LP64__
-typedef struct {
- gregset_t gregs;
- fpregset_t fpregs;
- greg_t mdhi;
- greg_t hi1;
- greg_t hi2;
- greg_t hi3;
- greg_t mdlo;
- greg_t lo1;
- greg_t lo2;
- greg_t lo3;
- greg_t pc;
- uint32_t fpc_csr;
- uint32_t used_math;
- uint32_t dsp;
- uint32_t reserved;
-} mcontext_t;
-#else
-typedef struct {
- unsigned regmask;
- unsigned status;
- greg_t pc;
- gregset_t gregs;
- fpregset_t fpregs;
- unsigned fp_owned;
- unsigned fpc_csr;
- unsigned fpc_eir;
- unsigned used_math;
- unsigned dsp;
- greg_t mdhi;
- greg_t mdlo;
- unsigned long hi1;
- unsigned long lo1;
- unsigned long hi2;
- unsigned long lo2;
- unsigned long hi3;
- unsigned long lo3;
-} mcontext_t;
-#endif
-
-typedef struct ucontext {
- unsigned long uc_flags;
- struct ucontext* uc_link;
- stack_t uc_stack;
- mcontext_t uc_mcontext;
- union {
- sigset_t uc_sigmask;
- sigset64_t uc_sigmask64;
- };
-} ucontext_t;
-
#elif defined(__x86_64__)
enum {
diff --git a/libc/include/sys/user.h b/libc/include/sys/user.h
index ed3e10a..2392edd 100644
--- a/libc/include/sys/user.h
+++ b/libc/include/sys/user.h
@@ -172,22 +172,6 @@
unsigned long fault_address;
};
-#elif defined(__mips__)
-
-struct user {
- unsigned long regs[180 / sizeof(unsigned long) + 64];
- size_t u_tsize;
- size_t u_dsize;
- size_t u_ssize;
- unsigned long start_code;
- unsigned long start_data;
- unsigned long start_stack;
- long int signal;
- void* u_ar0;
- unsigned long magic;
- char u_comm[32];
-};
-
#elif defined(__arm__)
struct user_fpregs {
diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h
index 9237ee6..ad859f0 100644
--- a/libc/include/sys/vfs.h
+++ b/libc/include/sys/vfs.h
@@ -39,7 +39,7 @@
typedef struct { int __val[2]; } __fsid_t;
typedef __fsid_t fsid_t;
-#if defined(__aarch64__) || defined(__x86_64__)
+#if defined(__LP64__)
#define __STATFS64_BODY \
uint64_t f_type; \
uint64_t f_bsize; \
@@ -54,39 +54,6 @@
uint64_t f_flags; \
uint64_t f_spare[4]; \
-#elif defined(__mips__) && defined(__LP64__)
-/* 64-bit MIPS. */
-#define __STATFS64_BODY \
- uint64_t f_type; \
- uint64_t f_bsize; \
- uint64_t f_frsize; /* Fragment size - unsupported. */ \
- uint64_t f_blocks; \
- uint64_t f_bfree; \
- uint64_t f_files; \
- uint64_t f_ffree; \
- uint64_t f_bavail; \
- fsid_t f_fsid; \
- uint64_t f_namelen; \
- uint64_t f_flags; \
- uint64_t f_spare[5]; \
-
-#elif defined(__mips__)
-/* 32-bit MIPS (corresponds to the kernel's statfs64 type). */
-#define __STATFS64_BODY \
- uint32_t f_type; \
- uint32_t f_bsize; \
- uint32_t f_frsize; \
- uint32_t __pad; \
- uint64_t f_blocks; \
- uint64_t f_bfree; \
- uint64_t f_files; \
- uint64_t f_ffree; \
- uint64_t f_bavail; \
- fsid_t f_fsid; \
- uint32_t f_namelen; \
- uint32_t f_flags; \
- uint32_t f_spare[5]; \
-
#else
/* 32-bit ARM or x86 (corresponds to the kernel's statfs64 type). */
#define __STATFS64_BODY \
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index e4afd8e..aaa8f22 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -294,7 +294,7 @@
int daemon(int __no_chdir, int __no_close);
-#if defined(__arm__) || (defined(__mips__) && !defined(__LP64__))
+#if defined(__arm__)
int cacheflush(long __addr, long __nbytes, long __cache);
/* __attribute__((deprecated("use __builtin___clear_cache instead"))); */
#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 54da02e..37807be 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -9,7 +9,7 @@
__b64_ntop;
__b64_pton;
__cmsg_nxthdr; # introduced=21
- __connect; # arm x86 mips introduced=21
+ __connect; # arm x86 introduced=21
__ctype_get_mb_cur_max; # introduced=21
__cxa_atexit;
__cxa_finalize;
@@ -17,16 +17,16 @@
__dn_comp;
__dn_count_labels;
__dn_skipname;
- __epoll_pwait; # arm x86 mips introduced=21
+ __epoll_pwait; # arm x86 introduced=21
__errno;
- __exit; # arm x86 mips introduced=21
- __fadvise64; # x86 mips introduced=21
+ __exit; # arm x86 introduced=21
+ __fadvise64; # x86 introduced=21
__fbufsize; # introduced=23
- __fcntl64; # arm x86 mips
+ __fcntl64; # arm x86
__FD_CLR_chk; # introduced=21
__FD_ISSET_chk; # introduced=21
__FD_SET_chk; # introduced=21
- __fgets_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ __fgets_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
__flbf; # introduced=23
__fp_nquery;
__fp_query;
@@ -38,17 +38,17 @@
__fpurge; # introduced=23
__freadable; # introduced=23
__fsetlocking; # introduced=23
- __fstatfs64; # arm x86 mips
+ __fstatfs64; # arm x86
__fwritable; # introduced=23
__get_h_errno;
- __getcpu; # arm x86 mips introduced-arm=12 introduced-mips=16 introduced-x86=12
- __getcwd; # arm x86 mips
- __getpid; # arm x86 mips introduced=21
- __getpriority; # arm x86 mips
+ __getcpu; # arm x86 introduced-arm=12 introduced-x86=12
+ __getcwd; # arm x86
+ __getpid; # arm x86 introduced=21
+ __getpriority; # arm x86
__gnu_basename; # introduced=23
__gnu_strerror_r; # introduced=23
__hostalias;
- __ioctl; # arm x86 mips
+ __ioctl; # arm x86
__isfinite;
__isfinitef;
__isfinitel;
@@ -61,44 +61,44 @@
__isnormal;
__isnormalf;
__isnormall;
- __isthreaded; # arm x86 mips var
+ __isthreaded; # arm x86 var
__libc_current_sigrtmax; # introduced=21
__libc_current_sigrtmin; # introduced=21
__libc_init;
- __llseek; # arm x86 mips
+ __llseek; # arm x86
__loc_aton;
__loc_ntoa;
__memchr_chk; # introduced=23
- __memcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __memmove_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ __memcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __memmove_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
__memrchr_chk; # introduced=23
- __memset_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __mmap2; # arm x86 mips
- __ns_format_ttl; # arm x86 mips
- __ns_get16; # arm x86 mips
- __ns_get32; # arm x86 mips
- __ns_initparse; # arm x86 mips
- __ns_makecanon; # arm x86 mips
- __ns_msg_getflag; # arm x86 mips
- __ns_name_compress; # arm x86 mips
- __ns_name_ntol; # arm x86 mips
- __ns_name_ntop; # arm x86 mips
- __ns_name_pack; # arm x86 mips
- __ns_name_pton; # arm x86 mips
- __ns_name_rollback; # arm x86 mips
- __ns_name_skip; # arm x86 mips
- __ns_name_uncompress; # arm x86 mips
- __ns_name_unpack; # arm x86 mips
- __ns_parserr; # arm x86 mips
- __ns_put16; # arm x86 mips
- __ns_put32; # arm x86 mips
- __ns_samename; # arm x86 mips
- __ns_skiprr; # arm x86 mips
- __ns_sprintrr; # arm x86 mips
- __ns_sprintrrf; # arm x86 mips
- __open_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __openat; # arm x86 mips
- __openat_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ __memset_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __mmap2; # arm x86
+ __ns_format_ttl; # arm x86
+ __ns_get16; # arm x86
+ __ns_get32; # arm x86
+ __ns_initparse; # arm x86
+ __ns_makecanon; # arm x86
+ __ns_msg_getflag; # arm x86
+ __ns_name_compress; # arm x86
+ __ns_name_ntol; # arm x86
+ __ns_name_ntop; # arm x86
+ __ns_name_pack; # arm x86
+ __ns_name_pton; # arm x86
+ __ns_name_rollback; # arm x86
+ __ns_name_skip; # arm x86
+ __ns_name_uncompress; # arm x86
+ __ns_name_unpack; # arm x86
+ __ns_parserr; # arm x86
+ __ns_put16; # arm x86
+ __ns_put32; # arm x86
+ __ns_samename; # arm x86
+ __ns_skiprr; # arm x86
+ __ns_sprintrr; # arm x86
+ __ns_sprintrrf; # arm x86
+ __open_2; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __openat; # arm x86
+ __openat_2; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
__p_cdname;
__p_cdnname;
__p_class;
@@ -113,22 +113,22 @@
__p_type;
__p_type_syms; # var
__poll_chk; # introduced=23
- __ppoll; # arm x86 mips introduced=21
+ __ppoll; # arm x86 introduced=21
__ppoll_chk; # introduced=23
__ppoll64_chk; # introduced=28
__pread64_chk; # introduced=23
__pread_chk; # introduced=23
__progname; # var
- __pselect6; # arm x86 mips introduced=21
+ __pselect6; # arm x86 introduced=21
__pthread_cleanup_pop;
__pthread_cleanup_push;
- __ptrace; # arm x86 mips
+ __ptrace; # arm x86
__putlong;
__putshort;
__read_chk; # introduced=21
__readlink_chk; # introduced=23
__readlinkat_chk; # introduced=23
- __reboot; # arm x86 mips
+ __reboot; # arm x86
__recvfrom_chk; # introduced=21
__register_atfork; # introduced=23
__res_close;
@@ -151,59 +151,59 @@
__res_send;
__res_send_setqhook;
__res_send_setrhook;
- __rt_sigaction; # arm x86 mips
- __rt_sigpending; # arm x86 mips introduced=21
- __rt_sigprocmask; # arm x86 mips
- __rt_sigsuspend; # arm x86 mips introduced=21
- __rt_sigtimedwait; # arm x86 mips
- __sched_cpualloc; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- __sched_cpucount; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- __sched_cpufree; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- __sched_getaffinity; # arm x86 mips introduced=12
+ __rt_sigaction; # arm x86
+ __rt_sigpending; # arm x86 introduced=21
+ __rt_sigprocmask; # arm x86
+ __rt_sigsuspend; # arm x86 introduced=21
+ __rt_sigtimedwait; # arm x86
+ __sched_cpualloc; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ __sched_cpucount; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ __sched_cpufree; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ __sched_getaffinity; # arm x86 introduced=12
__set_thread_area; # x86
- __set_tid_address; # arm x86 mips introduced=21
- __set_tls; # arm mips
+ __set_tid_address; # arm x86 introduced=21
+ __set_tls; # arm
__sF; # var
- __sigaction; # arm x86 mips introduced=21
- __snprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __socket; # arm x86 mips introduced=21
- __sprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ __sigaction; # arm x86 introduced=21
+ __snprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __socket; # arm x86 introduced=21
+ __sprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
__stack_chk_fail;
__stack_chk_guard; # var
- __statfs64; # arm x86 mips
+ __statfs64; # arm x86
__stpcpy_chk; # introduced=21
__stpncpy_chk; # introduced=21
__stpncpy_chk2; # introduced=21
- __strcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
- __strcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strlcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strlcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strlen_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strncat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __strncpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ __strcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
+ __strcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strlcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strlcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strlen_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strncat_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __strncpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
__strncpy_chk2; # introduced=21
- __strrchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ __strrchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_property_area_serial; # introduced=23
__system_property_find;
__system_property_find_nth;
- __system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ __system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
- __system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- __timer_create; # arm x86 mips
- __timer_delete; # arm x86 mips
- __timer_getoverrun; # arm x86 mips
- __timer_gettime; # arm x86 mips
- __timer_settime; # arm x86 mips
- __umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
- __vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __vsprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- __waitid; # arm x86 mips
+ __system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
+ __system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ __timer_create; # arm x86
+ __timer_delete; # arm x86
+ __timer_getoverrun; # arm x86
+ __timer_gettime; # arm x86
+ __timer_settime; # arm x86
+ __umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
+ __vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __vsprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ __waitid; # arm x86
_ctype_; # var
_Exit; # introduced=21
_exit;
@@ -216,11 +216,11 @@
_resolv_set_nameservers_for_net; # introduced=21
_setjmp;
_tolower; # introduced=21
- _tolower_tab_; # arm x86 mips var
+ _tolower_tab_; # arm x86 var
_toupper; # introduced=21
- _toupper_tab_; # arm x86 mips var
+ _toupper_tab_; # arm x86 var
abort;
- abs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ abs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
accept;
accept4; # introduced=21
access;
@@ -233,8 +233,8 @@
arc4random_buf;
arc4random_uniform;
asctime;
- asctime64; # arm x86 mips
- asctime64_r; # arm x86 mips
+ asctime64; # arm x86
+ asctime64_r; # arm x86
asctime_r;
asprintf;
at_quick_exit; # introduced=21
@@ -243,7 +243,7 @@
atol;
atoll;
basename;
- basename_r; # arm x86 mips
+ basename_r; # arm x86
bind;
bindresvport;
brk;
@@ -251,7 +251,7 @@
btowc;
c16rtomb; # introduced=21
c32rtomb; # introduced=21
- cacheflush; # arm mips
+ cacheflush; # arm
calloc;
capget;
capset;
@@ -274,7 +274,7 @@
clock_gettime;
clock_nanosleep;
clock_settime;
- clone; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ clone; # introduced-arm=9 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
close;
closedir;
closelog;
@@ -282,8 +282,8 @@
creat;
creat64; # introduced=21
ctime;
- ctime64; # arm x86 mips
- ctime64_r; # arm x86 mips
+ ctime64; # arm x86
+ ctime64_r; # arm x86
ctime_r;
daemon;
daylight; # var
@@ -291,7 +291,7 @@
difftime;
dirfd;
dirname;
- dirname_r; # arm x86 mips
+ dirname_r; # arm x86
div;
dn_expand;
dprintf; # introduced=21
@@ -317,10 +317,10 @@
error_one_per_line; # var introduced=23
error_print_progname; # var introduced=23
errx;
- ether_aton; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- ether_aton_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- ether_ntoa; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- ether_ntoa_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ ether_aton; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ ether_aton_r; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ ether_ntoa; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ ether_ntoa_r; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
eventfd;
eventfd_read;
eventfd_write;
@@ -345,13 +345,13 @@
fdatasync;
fdopen;
fdopendir;
- fdprintf; # arm x86 mips versioned=28
+ fdprintf; # arm x86 versioned=28
feof;
feof_unlocked; # introduced=23
ferror;
ferror_unlocked; # introduced=23
fflush;
- ffs; # introduced-arm=9 introduced-arm64=21 introduced-mips=9 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ ffs; # introduced-arm=9 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
fgetc;
fgetln;
fgetpos;
@@ -392,25 +392,25 @@
fstatat64; # introduced=21
fstatfs;
fstatfs64; # introduced=21
- fstatvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ fstatvfs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
fstatvfs64; # introduced=21
fsync;
ftell;
ftello;
ftok;
ftruncate;
- ftruncate64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ ftruncate64; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
ftrylockfile;
fts_children; # introduced=21
fts_close; # introduced=21
fts_open; # introduced=21
fts_read; # introduced=21
fts_set; # introduced=21
- ftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ ftw; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
ftw64; # introduced=21
funlockfile;
funopen;
- futimens; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ futimens; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
fwide;
fwprintf;
fwrite;
@@ -421,13 +421,13 @@
get_nprocs_conf; # introduced=23
get_phys_pages; # introduced=23
getaddrinfo;
- getauxval; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ getauxval; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
getc;
getc_unlocked;
getchar;
getchar_unlocked;
getcwd;
- getdelim; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ getdelim; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
getegid;
getenv;
geteuid;
@@ -445,7 +445,7 @@
gethostent;
gethostname;
getitimer;
- getline; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ getline; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
getlogin;
getmntent;
getmntent_r; # introduced=21
@@ -467,9 +467,9 @@
getprotobynumber;
getpt;
getpwnam;
- getpwnam_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ getpwnam_r; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
getpwuid;
- getpwuid_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ getpwuid_r; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
getresgid;
getresuid;
getrlimit;
@@ -479,7 +479,7 @@
getservbyname;
getservbyport;
getservent;
- getsid; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ getsid; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
getsockname;
getsockopt;
gettid;
@@ -490,8 +490,8 @@
getwchar;
getxattr;
gmtime;
- gmtime64; # arm x86 mips
- gmtime64_r; # arm x86 mips
+ gmtime64; # arm x86
+ gmtime64_r; # arm x86
gmtime_r;
grantpt; # introduced=21
herror;
@@ -500,8 +500,8 @@
htons; # introduced=21
if_indextoname;
if_nametoindex;
- imaxabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- imaxdiv; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ imaxabs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
+ imaxdiv; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
inet_addr;
inet_aton;
inet_lnaof; # introduced=21
@@ -590,7 +590,7 @@
kill;
killpg;
klogctl;
- labs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ labs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
lchown;
lcong48; # introduced=23
ldexp;
@@ -601,13 +601,13 @@
linkat; # introduced=21
listen;
listxattr;
- llabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ llabs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
lldiv;
llistxattr;
localeconv; # introduced=21
localtime;
- localtime64; # arm x86 mips
- localtime64_r; # arm x86 mips
+ localtime64; # arm x86
+ localtime64_r; # arm x86
localtime_r;
login_tty; # introduced=23
longjmp;
@@ -623,7 +623,7 @@
mallinfo;
malloc;
malloc_info; # introduced=23
- malloc_usable_size; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ malloc_usable_size; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
mbrlen;
mbrtoc16; # introduced=21
mbrtoc32; # introduced=21
@@ -661,9 +661,9 @@
mkstemps64; # introduced=23
mktemp;
mktime;
- mktime64; # arm x86 mips
+ mktime64; # arm x86
mlock;
- mlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ mlockall; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
mmap;
mmap64; # introduced=21
mount;
@@ -672,36 +672,36 @@
mremap;
msync;
munlock;
- munlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ munlockall; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
munmap;
nanosleep;
newlocale; # introduced=21
- nftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ nftw; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
nftw64; # introduced=21
nice;
nrand48;
- ns_format_ttl; # arm64 x86_64 mips64 introduced=22
- ns_get16; # arm64 x86_64 mips64 introduced=22
- ns_get32; # arm64 x86_64 mips64 introduced=22
- ns_initparse; # arm64 x86_64 mips64 introduced=22
- ns_makecanon; # arm64 x86_64 mips64 introduced=22
- ns_msg_getflag; # arm64 x86_64 mips64 introduced=22
- ns_name_compress; # arm64 x86_64 mips64 introduced=22
- ns_name_ntol; # arm64 x86_64 mips64 introduced=22
- ns_name_ntop; # arm64 x86_64 mips64 introduced=22
- ns_name_pack; # arm64 x86_64 mips64 introduced=22
- ns_name_pton; # arm64 x86_64 mips64 introduced=22
- ns_name_rollback; # arm64 x86_64 mips64 introduced=22
- ns_name_skip; # arm64 x86_64 mips64 introduced=22
- ns_name_uncompress; # arm64 x86_64 mips64 introduced=22
- ns_name_unpack; # arm64 x86_64 mips64 introduced=22
- ns_parserr; # arm64 x86_64 mips64 introduced=22
- ns_put16; # arm64 x86_64 mips64 introduced=22
- ns_put32; # arm64 x86_64 mips64 introduced=22
- ns_samename; # arm64 x86_64 mips64 introduced=22
- ns_skiprr; # arm64 x86_64 mips64 introduced=22
- ns_sprintrr; # arm64 x86_64 mips64 introduced=22
- ns_sprintrrf; # arm64 x86_64 mips64 introduced=22
+ ns_format_ttl; # arm64 x86_64 introduced=22
+ ns_get16; # arm64 x86_64 introduced=22
+ ns_get32; # arm64 x86_64 introduced=22
+ ns_initparse; # arm64 x86_64 introduced=22
+ ns_makecanon; # arm64 x86_64 introduced=22
+ ns_msg_getflag; # arm64 x86_64 introduced=22
+ ns_name_compress; # arm64 x86_64 introduced=22
+ ns_name_ntol; # arm64 x86_64 introduced=22
+ ns_name_ntop; # arm64 x86_64 introduced=22
+ ns_name_pack; # arm64 x86_64 introduced=22
+ ns_name_pton; # arm64 x86_64 introduced=22
+ ns_name_rollback; # arm64 x86_64 introduced=22
+ ns_name_skip; # arm64 x86_64 introduced=22
+ ns_name_uncompress; # arm64 x86_64 introduced=22
+ ns_name_unpack; # arm64 x86_64 introduced=22
+ ns_parserr; # arm64 x86_64 introduced=22
+ ns_put16; # arm64 x86_64 introduced=22
+ ns_put32; # arm64 x86_64 introduced=22
+ ns_samename; # arm64 x86_64 introduced=22
+ ns_skiprr; # arm64 x86_64 introduced=22
+ ns_sprintrr; # arm64 x86_64 introduced=22
+ ns_sprintrrf; # arm64 x86_64 introduced=22
nsdispatch;
ntohl; # introduced=21
ntohs; # introduced=21
@@ -738,16 +738,16 @@
ppoll; # introduced=21
prctl;
pread;
- pread64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ pread64; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
printf;
- prlimit; # arm64 x86_64 mips64
+ prlimit; # arm64 x86_64
prlimit64; # introduced=21
process_vm_readv; # introduced=23
process_vm_writev; # introduced=23
pselect;
- psiginfo; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- psignal; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
- pthread_atfork; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ psiginfo; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ psignal; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
+ pthread_atfork; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
pthread_attr_destroy;
pthread_attr_getdetachstate;
pthread_attr_getguardsize;
@@ -769,10 +769,10 @@
pthread_cond_init;
pthread_cond_signal;
pthread_cond_timedwait;
- pthread_cond_timedwait_monotonic; # arm x86 mips
- pthread_cond_timedwait_monotonic_np; # introduced-arm=9 introduced-x86=9 introduced-mips=9 introduced-arm64=28 introduced-x64_64=28 introduced-mips64=28
- pthread_cond_timedwait_relative_np; # arm x86 mips
- pthread_cond_timeout_np; # arm x86 mips
+ pthread_cond_timedwait_monotonic; # arm x86
+ pthread_cond_timedwait_monotonic_np; # introduced-arm=9 introduced-x86=9 introduced-arm64=28 introduced-x64_64=28
+ pthread_cond_timedwait_relative_np; # arm x86
+ pthread_cond_timeout_np; # arm x86
pthread_cond_wait;
pthread_condattr_destroy;
pthread_condattr_getclock; # introduced=21
@@ -796,7 +796,7 @@
pthread_mutex_destroy;
pthread_mutex_init;
pthread_mutex_lock;
- pthread_mutex_lock_timeout_np; # arm x86 mips
+ pthread_mutex_lock_timeout_np; # arm x86
pthread_mutex_timedlock; # introduced=21
pthread_mutex_trylock;
pthread_mutex_unlock;
@@ -837,12 +837,12 @@
putenv;
puts;
pututline;
- putw; # arm x86 mips
+ putw; # arm x86
putwc;
putwchar;
- pvalloc; # arm x86 mips introduced=17
+ pvalloc; # arm x86 introduced=17
pwrite;
- pwrite64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ pwrite64; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
qsort;
quick_exit; # introduced=21
raise;
@@ -887,12 +887,12 @@
scanf;
sched_get_priority_max;
sched_get_priority_min;
- sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- sched_getcpu; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ sched_getcpu; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
sched_getparam;
sched_getscheduler;
sched_rr_get_interval;
- sched_setaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ sched_setaffinity; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
sched_setparam;
sched_setscheduler;
sched_yield;
@@ -961,13 +961,13 @@
sigfillset; # introduced=21
siginterrupt;
sigismember; # introduced=21
- siglongjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ siglongjmp; # introduced-arm=9 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
signal; # introduced=21
- signalfd; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ signalfd; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
sigpending;
sigprocmask;
sigqueue; # introduced=23
- sigsetjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ sigsetjmp; # introduced-arm=9 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
sigsetmask;
sigsuspend;
sigtimedwait; # introduced=23
@@ -987,7 +987,7 @@
stat64; # introduced=21
statfs;
statfs64; # introduced=21
- statvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ statvfs; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
statvfs64; # introduced=21
stderr; # var introduced=23
stdin; # var introduced=23
@@ -1045,8 +1045,8 @@
strtouq; # introduced=21
strxfrm;
strxfrm_l; # introduced=21
- swapoff; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- swapon; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ swapoff; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
+ swapon; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
swprintf;
swscanf;
symlink;
@@ -1076,18 +1076,18 @@
tfind;
tgkill;
time;
- timegm; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- timegm64; # arm x86 mips
- timelocal; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
- timelocal64; # arm x86 mips
+ timegm; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ timegm64; # arm x86
+ timelocal; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
+ timelocal64; # arm x86
timer_create;
timer_delete;
timer_getoverrun;
timer_gettime;
timer_settime;
- timerfd_create; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- timerfd_gettime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- timerfd_settime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
+ timerfd_create; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
+ timerfd_gettime; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
+ timerfd_settime; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
times;
timezone; # var
tmpfile;
@@ -1119,19 +1119,19 @@
unlinkat;
unlockpt;
unsetenv;
- unshare; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
+ unshare; # introduced-arm=17 introduced-arm64=21 introduced-x86=17 introduced-x86_64=21
uselocale; # introduced=21
usleep;
utime;
- utimensat; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
+ utimensat; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
utimes;
utmpname;
- valloc; # arm x86 mips
+ valloc; # arm x86
vasprintf;
vdprintf; # introduced=21
verr;
verrx;
- vfdprintf; # arm x86 mips versioned=28
+ vfdprintf; # arm x86 versioned=28
vfork;
vfprintf;
vfscanf;
@@ -1151,7 +1151,7 @@
vwprintf;
vwscanf; # introduced=21
wait;
- wait4; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ wait4; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
waitid;
waitpid;
warn;
@@ -1221,7 +1221,7 @@
*;
};
-LIBC_N { # introduced-arm64=24 introduced-mips=24 introduced-mips64=24 introduced-x86=24 introduced-x86_64=24
+LIBC_N { # introduced-arm64=24 introduced-x86=24 introduced-x86_64=24
global:
__aeabi_atexit; # arm versioned=24
__aeabi_memclr; # arm versioned=24
@@ -1265,7 +1265,7 @@
lockf64; # introduced=24
preadv; # introduced=24
preadv64; # introduced=24
- prlimit; # arm mips x86 introduced=24
+ prlimit; # arm x86 introduced=24
pthread_barrierattr_destroy; # introduced=24
pthread_barrierattr_getpshared; # introduced=24
pthread_barrierattr_init; # introduced=24
@@ -1291,7 +1291,7 @@
__sendto_chk; # introduced=26
__system_property_read_callback; # introduced=26
__system_property_wait; # introduced=26
- bsd_signal; # arm x86 mips versioned=26
+ bsd_signal; # arm x86 versioned=26
catclose; # introduced=26
catgets; # introduced=26
catopen; # introduced=26
@@ -1551,7 +1551,7 @@
LIBC_PRIVATE {
global:
- __accept4; # arm x86 mips
+ __accept4; # arm x86
__adddf3; # arm
__addsf3; # arm
__aeabi_atexit; # arm
@@ -1624,12 +1624,12 @@
__arm_fadvise64_64; # arm
__ashldi3; # arm
__ashrdi3; # arm
- __bionic_brk; # arm x86 mips
+ __bionic_brk; # arm x86
__bionic_libcrt_compat_symbols; # arm x86
__cmpdf2; # arm
__cmpsf2; # arm
__divdf3; # arm
- __divdi3; # arm x86 mips
+ __divdi3; # arm x86
__divsf3; # arm
__divsi3; # arm
__dso_handle; # arm
@@ -1648,13 +1648,13 @@
__floatundisf; # arm
__floatunsidf; # arm
__floatunsisf; # arm
- __futex_wait; # arm x86 mips
- __futex_wake; # arm x86 mips
+ __futex_wait; # arm x86
+ __futex_wake; # arm x86
__gedf2; # arm
__gesf2; # arm
- __get_thread; # arm x86 mips
- __get_tls; # arm x86 mips
- __getdents64; # arm x86 mips
+ __get_thread; # arm x86
+ __get_tls; # arm x86
+ __getdents64; # arm x86
__gnu_ldivmod_helper; # arm
__gnu_uldivmod_helper; # arm
__gnu_Unwind_Find_exidx; # arm
@@ -1670,72 +1670,72 @@
__mulsf3; # arm
__nedf2; # arm
__nesf2; # arm
- __open; # arm x86 mips
- __page_shift; # arm x86 mips
- __page_size; # arm x86 mips
+ __open; # arm x86
+ __page_shift; # arm x86
+ __page_size; # arm x86
__popcount_tab; # arm
- __popcountsi2; # arm x86 mips
- __pthread_gettid; # arm x86 mips
- __sclose; # arm x86 mips
- __sdidinit; # arm x86 mips
- __set_errno; # arm x86 mips
- __sflags; # arm x86 mips
- __sflush; # arm x86 mips
- __sfp; # arm x86 mips
- __sglue; # arm x86 mips
- __sinit; # arm x86 mips
- __smakebuf; # arm x86 mips
- __sread; # arm x86 mips
- __srefill; # arm x86 mips
- __srget; # arm x86 mips
- __sseek; # arm x86 mips
+ __popcountsi2; # arm x86
+ __pthread_gettid; # arm x86
+ __sclose; # arm x86
+ __sdidinit; # arm x86
+ __set_errno; # arm x86
+ __sflags; # arm x86
+ __sflush; # arm x86
+ __sfp; # arm x86
+ __sglue; # arm x86
+ __sinit; # arm x86
+ __smakebuf; # arm x86
+ __sread; # arm x86
+ __srefill; # arm x86
+ __srget; # arm x86
+ __sseek; # arm x86
__subdf3; # arm
__subsf3; # arm
- __swbuf; # arm x86 mips
- __swrite; # arm x86 mips
- __swsetup; # arm x86 mips
+ __swbuf; # arm x86
+ __swrite; # arm x86
+ __swsetup; # arm x86
__truncdfsf2; # arm
- __udivdi3; # arm x86 mips
+ __udivdi3; # arm x86
__udivsi3; # arm
- __umoddi3; # x86 mips
+ __umoddi3; # x86
__unorddf2; # arm
__unordsf2; # arm
- __wait4; # arm x86 mips
- _fwalk; # arm x86 mips
+ __wait4; # arm x86
+ _fwalk; # arm x86
android_getaddrinfofornetcontext;
android_gethostbyaddrfornet;
android_gethostbyaddrfornetcontext;
android_gethostbynamefornet;
android_gethostbynamefornetcontext;
android_unsafe_frame_pointer_chase;
- arc4random_addrandom; # arm x86 mips
- arc4random_stir; # arm x86 mips
+ arc4random_addrandom; # arm x86
+ arc4random_stir; # arm x86
atexit; # arm
- bcopy; # arm x86 mips
- bzero; # arm x86 mips
- dlmalloc; # arm x86 mips
- dlmalloc_inspect_all; # arm x86 mips
- dlmalloc_trim; # arm x86 mips
- dlmalloc_usable_size; # arm x86 mips
- ftime; # arm x86 mips
- getdents; # arm x86 mips
- getdtablesize; # arm x86 mips
- index; # arm x86 mips
- issetugid; # arm x86 mips
- memswap; # arm x86 mips
- pthread_attr_getstackaddr; # arm x86 mips
- pthread_attr_setstackaddr; # arm x86 mips
- SHA1Final; # arm x86 mips
- SHA1Init; # arm x86 mips
- SHA1Transform; # arm x86 mips
- SHA1Update; # arm x86 mips
- strntoimax; # arm x86 mips
- strntoumax; # arm x86 mips
- strtotimeval; # arm x86 mips
- sysv_signal; # arm x86 mips
- tkill; # arm x86 mips
- wait3; # arm x86 mips
- wcswcs; # arm x86 mips
+ bcopy; # arm x86
+ bzero; # arm x86
+ dlmalloc; # arm x86
+ dlmalloc_inspect_all; # arm x86
+ dlmalloc_trim; # arm x86
+ dlmalloc_usable_size; # arm x86
+ ftime; # arm x86
+ getdents; # arm x86
+ getdtablesize; # arm x86
+ index; # arm x86
+ issetugid; # arm x86
+ memswap; # arm x86
+ pthread_attr_getstackaddr; # arm x86
+ pthread_attr_setstackaddr; # arm x86
+ SHA1Final; # arm x86
+ SHA1Init; # arm x86
+ SHA1Transform; # arm x86
+ SHA1Update; # arm x86
+ strntoimax; # arm x86
+ strntoumax; # arm x86
+ strtotimeval; # arm x86
+ sysv_signal; # arm x86
+ tkill; # arm x86
+ wait3; # arm x86
+ wcswcs; # arm x86
} LIBC_Q;
LIBC_DEPRECATED {
diff --git a/libc/libstdc++.map.txt b/libc/libstdc++.map.txt
index 0a242d5..bb7040f 100644
--- a/libc/libstdc++.map.txt
+++ b/libc/libstdc++.map.txt
@@ -5,14 +5,14 @@
_ZdaPvRKSt9nothrow_t; # weak
_ZdlPv; # weak
_ZdlPvRKSt9nothrow_t; # weak
- _Znaj; # arm x86 mips weak
- _ZnajRKSt9nothrow_t; # arm x86 mips weak
- _Znam; # arm64 x86_64 mips64 weak
- _ZnamRKSt9nothrow_t; # arm64 x86_64 mips64 weak
- _Znwj; # arm x86 mips weak
- _ZnwjRKSt9nothrow_t; # arm x86 mips weak
- _Znwm; # arm64 x86_64 mips64 weak
- _ZnwmRKSt9nothrow_t; # arm64 x86_64 mips64 weak
+ _Znaj; # arm x86 weak
+ _ZnajRKSt9nothrow_t; # arm x86 weak
+ _Znam; # arm64 x86_64 weak
+ _ZnamRKSt9nothrow_t; # arm64 x86_64 weak
+ _Znwj; # arm x86 weak
+ _ZnwjRKSt9nothrow_t; # arm x86 weak
+ _Znwm; # arm64 x86_64 weak
+ _ZnwmRKSt9nothrow_t; # arm64 x86_64 weak
__cxa_guard_abort;
__cxa_guard_acquire;
__cxa_guard_release;
diff --git a/libc/platform/bionic/macros.h b/libc/platform/bionic/macros.h
index 54903f5..28a69e6 100644
--- a/libc/platform/bionic/macros.h
+++ b/libc/platform/bionic/macros.h
@@ -57,8 +57,6 @@
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%eip")
#elif defined(__x86_64__)
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%rip")
-#elif defined (__mips__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined $ra")
#endif
// The arraysize(arr) macro returns the # of elements in an array arr.
diff --git a/libc/platform/bionic/tls.h b/libc/platform/bionic/tls.h
index ca39020..bf9e65b 100644
--- a/libc/platform/bionic/tls.h
+++ b/libc/platform/bionic/tls.h
@@ -32,15 +32,6 @@
# define __get_tls() ({ void** __val; __asm__("mrs %0, tpidr_el0" : "=r"(__val)); __val; })
#elif defined(__arm__)
# define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; })
-#elif defined(__mips__)
-# define __get_tls() \
- /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \
- ({ register void** __val asm("v1"); \
- __asm__(".set push\n" \
- ".set mips32r2\n" \
- "rdhwr %0,$29\n" \
- ".set pop\n" : "=r"(__val)); \
- __val; })
#elif defined(__i386__)
# define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; })
#elif defined(__x86_64__)
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index 30842f4..6409563 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -42,8 +42,6 @@
#include <private/bionic_asm_arm.h>
#elif defined(__i386__)
#include <private/bionic_asm_x86.h>
-#elif defined(__mips__)
-#include <private/bionic_asm_mips.h>
#elif defined(__x86_64__)
#include <private/bionic_asm_x86_64.h>
#endif
diff --git a/libc/private/bionic_asm_mips.h b/libc/private/bionic_asm_mips.h
deleted file mode 100644
index 99dcfb1..0000000
--- a/libc/private/bionic_asm_mips.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $OpenBSD: asm.h,v 1.7 2004/10/20 12:49:15 pefo Exp $ */
-
-/*
- * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#pragma once
-
-#define __bionic_asm_align 16
-
-#undef __bionic_asm_custom_entry
-#undef __bionic_asm_custom_end
-#define __bionic_asm_custom_entry(f) .ent f
-#define __bionic_asm_custom_end(f) .end f
-
-#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
-#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
-#define _MIPS_ISA_MIPS3 3 /* R4000 */
-#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
-#define _MIPS_ISA_MIPS5 5
-#define _MIPS_ISA_MIPS32 6
-#define _MIPS_ISA_MIPS64 7
-
-#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
-#define ABICALLS .abicalls
-#endif
-
-#if defined(ABICALLS) && !defined(_KERNEL)
- ABICALLS
-#endif
-
-/*
- * Define how to access unaligned data word
- */
-#define LWLO lwl
-#define LWHI lwr
-#define SWLO swl
-#define SWHI swr
-#define LDLO ldl
-#define LDHI ldr
-#define SDLO sdl
-#define SDHI sdr
-
-/*
- * Define programming environment for ABI.
- */
-#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-#define NARGSAVE 4
-
-#define SETUP_GP \
- .set noreorder; \
- .cpload $t9; \
- .set reorder;
-
-#define SAVE_GP(x) \
- .cprestore x
-
-#define SETUP_GP64(gpoff, name)
-#define RESTORE_GP64
-#endif
-
-#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
-#define NARGSAVE 0
-
-#define SETUP_GP
-#define SAVE_GP(x)
-#define SETUP_GP64(gpoff, name) \
- .cpsetup $t9, gpoff, name
-#define RESTORE_GP64 \
- .cpreturn
-#endif
-
-#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31))
-
-#else /* defined(ABICALLS) && !defined(_KERNEL) */
-
-#define NARGSAVE 4
-#define SETUP_GP
-#define SAVE_GP(x)
-
-#define ALIGNSZ 16 /* Stack layout alignment */
-#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
-
-#endif
-
-/*
- * Basic register operations based on selected ISA
- */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || _MIPS_ISA == _MIPS_ISA_MIPS32)
-#define REGSZ 4 /* 32 bit mode register size */
-#define LOGREGSZ 2 /* log rsize */
-#define REG_S sw
-#define REG_L lw
-#define CF_SZ 24 /* Call frame size */
-#define CF_ARGSZ 16 /* Call frame arg size */
-#define CF_RA_OFFS 20 /* Call ra save offset */
-#endif
-
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || _MIPS_ISA == _MIPS_ISA_MIPS64)
-#define REGSZ 8 /* 64 bit mode register size */
-#define LOGREGSZ 3 /* log rsize */
-#define REG_S sd
-#define REG_L ld
-#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */
-#define CF_ARGSZ 32 /* Call frame arg size */
-#define CF_RA_OFFS 40 /* Call ra save offset */
-#endif
-
-#define REGSZ_FP 8 /* 64 bit FP register size */
-
-#ifndef __LP64__
-#define PTR_L lw
-#define PTR_S sw
-#define PTR_SUB sub
-#define PTR_ADD add
-#define PTR_SUBU subu
-#define PTR_ADDU addu
-#define LI li
-#define LA la
-#define PTR_SLL sll
-#define PTR_SRL srl
-#define PTR_VAL .word
-#else
-#define PTR_L ld
-#define PTR_S sd
-#define PTR_ADD dadd
-#define PTR_SUB dsub
-#define PTR_SUBU dsubu
-#define PTR_ADDU daddu
-#define LI dli
-#define LA dla
-#define PTR_SLL dsll
-#define PTR_SRL dsrl
-#define PTR_VAL .dword
-#endif
-
-/*
- * LEAF(x, fsize)
- *
- * Declare a leaf routine.
- */
-#define LEAF(x, fsize) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .cfi_startproc; \
- .frame $sp, fsize, $ra; \
- SETUP_GP \
-
-/*
- * NON_LEAF(x)
- *
- * Declare a non-leaf routine (a routine that makes other C calls).
- */
-#define NON_LEAF(x, fsize, retpc) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .cfi_startproc; \
- .frame $sp, fsize, retpc; \
- SETUP_GP \
diff --git a/libc/private/bionic_ssp.h b/libc/private/bionic_ssp.h
index 9883d72..ea62cb9 100644
--- a/libc/private/bionic_ssp.h
+++ b/libc/private/bionic_ssp.h
@@ -26,20 +26,18 @@
* SUCH DAMAGE.
*/
-#ifndef _PRIVATE_SSP_H
-#define _PRIVATE_SSP_H
+#pragma once
#include <stdint.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
-/* GCC uses this on ARM and MIPS; we use it on x86 to set the guard in TLS. */
+// The compiler uses this if it's not using TLS.
+// Currently that's on arm32 and on x86 before API 17.
extern uintptr_t __stack_chk_guard;
-/* GCC calls this if a stack guard check fails. */
+// The compiler calls this if a stack guard check fails.
extern void __stack_chk_fail();
__END_DECLS
-
-#endif
diff --git a/libc/seccomp/seccomp_bpfs.h b/libc/seccomp/seccomp_bpfs.h
index 8245429..3bdffa9 100644
--- a/libc/seccomp/seccomp_bpfs.h
+++ b/libc/seccomp/seccomp_bpfs.h
@@ -46,17 +46,3 @@
extern const size_t x86_64_app_zygote_filter_size;
extern const struct sock_filter x86_64_system_filter[];
extern const size_t x86_64_system_filter_size;
-
-extern const struct sock_filter mips_app_filter[];
-extern const size_t mips_app_filter_size;
-extern const struct sock_filter mips_app_zygote_filter[];
-extern const size_t mips_app_zygote_filter_size;
-extern const struct sock_filter mips_system_filter[];
-extern const size_t mips_system_filter_size;
-
-extern const struct sock_filter mips64_app_filter[];
-extern const size_t mips64_app_filter_size;
-extern const struct sock_filter mips64_app_zygote_filter[];
-extern const size_t mips64_app_zygote_filter_size;
-extern const struct sock_filter mips64_system_filter[];
-extern const size_t mips64_system_filter_size;
diff --git a/libc/seccomp/seccomp_policy.cpp b/libc/seccomp/seccomp_policy.cpp
index bce7b14..65357fc 100644
--- a/libc/seccomp/seccomp_policy.cpp
+++ b/libc/seccomp/seccomp_policy.cpp
@@ -75,29 +75,6 @@
static const long secondary_setresgid = __x86_setresgid;
static const long secondary_setresuid = __x86_setresuid;
-#elif defined __mips__ || defined __mips64__
-
-#define DUAL_ARCH
-#define PRIMARY_ARCH AUDIT_ARCH_MIPSEL64
-static const struct sock_filter* primary_app_filter = mips64_app_filter;
-static const size_t primary_app_filter_size = mips64_app_filter_size;
-static const struct sock_filter* primary_app_zygote_filter = mips64_app_zygote_filter;
-static const size_t primary_app_zygote_filter_size = mips64_app_zygote_filter_size;
-static const struct sock_filter* primary_system_filter = mips64_system_filter;
-static const size_t primary_system_filter_size = mips64_system_filter_size;
-
-static const long primary_setresgid = __mips64_setresgid;
-static const long primary_setresuid = __mips64_setresuid;
-#define SECONDARY_ARCH AUDIT_ARCH_MIPSEL
-static const struct sock_filter* secondary_app_filter = mips_app_filter;
-static const size_t secondary_app_filter_size = mips_app_filter_size;
-static const struct sock_filter* secondary_app_zygote_filter = mips_app_zygote_filter;
-static const size_t secondary_app_zygote_filter_size = mips_app_zygote_filter_size;
-static const struct sock_filter* secondary_system_filter = mips_system_filter;
-static const size_t secondary_system_filter_size = mips_system_filter_size;
-
-static const long secondary_setresgid = __mips_setresgid;
-static const long secondary_setresuid = __mips_setresuid;
#else
#error No architecture was defined!
#endif
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index fa5420b..0271a04 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -81,56 +81,6 @@
#
-# MIPS assembler template for each syscall stub
-#
-
-mips_call = syscall_stub_header + """\
- .set noreorder
- .cpload $t9
- li $v0, %(__NR_name)s
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno_internal
- j $t9
- nop
- .set reorder
-END(%(func)s)
-"""
-
-
-#
-# MIPS64 assembler template for each syscall stub
-#
-
-mips64_call = syscall_stub_header + """\
- .set push
- .set noreorder
- li $v0, %(__NR_name)s
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- move $t0, $ra
- bal 2f
- nop
-2:
- .cpsetup $ra, $t1, 2b
- LA $t9, __set_errno_internal
- .cpreturn
- j $t9
- move $ra, $t0
- .set pop
-END(%(func)s)
-"""
-
-
-#
# x86 assembler templates for each syscall stub
#
@@ -279,14 +229,6 @@
return arm64_call % syscall
-def mips_genstub(syscall):
- return mips_call % syscall
-
-
-def mips64_genstub(syscall):
- return mips64_call % syscall
-
-
def x86_genstub(syscall):
result = syscall_stub_header % syscall
@@ -455,21 +397,18 @@
if arch_list == "all":
for arch in SupportedArchitectures:
t[arch] = True
- elif arch_list == "lp32":
- for arch in SupportedArchitectures:
- if "64" not in arch:
- t[arch] = True
- elif arch_list == "lp64":
- for arch in SupportedArchitectures:
- if "64" in arch:
- t[arch] = True
else:
for arch in string.split(arch_list, ','):
- if arch in SupportedArchitectures:
+ if arch == "lp32":
+ for arch in SupportedArchitectures:
+ if "64" not in arch:
+ t[arch] = True
+ elif arch == "lp64":
+ for arch in SupportedArchitectures:
+ if "64" in arch:
+ t[arch] = True
+ elif arch in SupportedArchitectures:
t[arch] = True
- elif arch in ['mips', 'mips64']:
- # Unused.
- pass
else:
E("invalid syscall architecture '%s' in '%s'" % (arch, line))
return
@@ -511,12 +450,6 @@
E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
return
- if syscall.has_key("mips"):
- syscall["asm-mips"] = add_footer(32, mips_genstub(syscall), syscall)
-
- if syscall.has_key("mips64"):
- syscall["asm-mips64"] = add_footer(64, mips64_genstub(syscall), syscall)
-
if syscall.has_key("x86_64"):
syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
diff --git a/libc/tools/test_genseccomp.py b/libc/tools/test_genseccomp.py
index 71a78d1..0c2699a 100755
--- a/libc/tools/test_genseccomp.py
+++ b/libc/tools/test_genseccomp.py
@@ -25,8 +25,8 @@
def test_get_names(self):
bionic = cStringIO.StringIO(textwrap.dedent("""\
-int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86
-int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
"""))
whitelist = cStringIO.StringIO(textwrap.dedent("""\
@@ -54,7 +54,7 @@
# Blacklist item must be in bionic
blacklist = cStringIO.StringIO(textwrap.dedent("""\
-int fchown2:fchown2(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+int fchown2:fchown2(int, uid_t, gid_t) arm64,x86_64
"""))
with self.assertRaises(RuntimeError):
genseccomp.get_names([bionic, whitelist, blacklist], "arm")
@@ -64,7 +64,7 @@
# Test blacklist item is removed
blacklist = cStringIO.StringIO(textwrap.dedent("""\
-int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
"""))
names = genseccomp.get_names([bionic, whitelist, blacklist], "arm64")
bionic.seek(0)
@@ -75,7 +75,7 @@
# Blacklist item must not be in whitelist
whitelist = cStringIO.StringIO(textwrap.dedent("""\
-int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
"""))
with self.assertRaises(RuntimeError):
genseccomp.get_names([empty, whitelist, blacklist], "arm")
@@ -85,7 +85,7 @@
# No dups in bionic and whitelist
whitelist = cStringIO.StringIO(textwrap.dedent("""\
-int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
"""))
with self.assertRaises(RuntimeError):
genseccomp.get_names([bionic, whitelist, empty], "arm")
@@ -119,16 +119,6 @@
self.get_switches("x86_64")),
[("openat", 257)])
- self.assertEquals(genseccomp.convert_names_to_NRs(["openat"],
- self.get_headers("mips"),
- self.get_switches("mips")),
- [("openat", 4288)])
-
- self.assertEquals(genseccomp.convert_names_to_NRs(["openat"],
- self.get_headers("mips64"),
- self.get_switches("mips64")),
- [("openat", 5247)])
-
def test_convert_NRs_to_ranges(self):
ranges = genseccomp.convert_NRs_to_ranges([("b", 2), ("a", 1)])
@@ -192,8 +182,8 @@
def test_construct_bpf(self):
syscalls = cStringIO.StringIO(textwrap.dedent("""\
- int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86
- int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64
+ int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
+ int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
"""))
whitelist = cStringIO.StringIO(textwrap.dedent("""\
diff --git a/linker/Android.bp b/linker/Android.bp
index e21ee60..4be080b 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -205,22 +205,6 @@
],
}
-filegroup {
- name: "linker_sources_mips",
- srcs: [
- "arch/mips/begin.S",
- "linker_mips.cpp",
- ],
-}
-
-filegroup {
- name: "linker_sources_mips64",
- srcs: [
- "arch/mips64/begin.S",
- "linker_mips.cpp",
- ],
-}
-
cc_defaults {
name: "linker_version_script_overlay",
arch: {
@@ -228,8 +212,6 @@
arm64: { version_script: "linker.generic.map" },
x86: { version_script: "linker.generic.map" },
x86_64: { version_script: "linker.generic.map" },
- mips: { version_script: "linker.generic.map" },
- mips64: { version_script: "linker.generic.map" },
},
}
@@ -257,14 +239,6 @@
srcs: [":linker_sources_x86_64"],
static_libs: ["libgcc_stripped"],
},
- mips: {
- srcs: [":linker_sources_mips"],
- static_libs: ["libgcc_stripped"],
- },
- mips64: {
- srcs: [":linker_sources_mips64"],
- static_libs: ["libgcc_stripped"],
- },
},
// -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
@@ -350,7 +324,6 @@
},
compile_multilib: "both",
- xom: false,
recovery_available: true,
apex_available: [
diff --git a/linker/arch/mips/begin.S b/linker/arch/mips/begin.S
deleted file mode 100644
index 1bdd358..0000000
--- a/linker/arch/mips/begin.S
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
- .text
- .balign 16
- .type __start,@function
-
- .ent __start
- .globl __start
- .globl _start
-__start:
-_start:
- .set noreorder
- bal 1f
- nop
-1: .cpload $31
- .set reorder
-
- /* Discover the load address */
- la $t0, 1f
- bal 1f
-1: subu $t0, $ra, $t0
-
-#define DT_PLTGOT 3
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a
-
- /* Search dynamic table for DT_MIPS_LOCAL_GOTNO and DT_PLTGOT values */
- la $t1, _DYNAMIC
- addu $t1, $t0
- li $t3, DT_PLTGOT
- li $t4, DT_MIPS_LOCAL_GOTNO
-0:
- lw $t2, 0($t1)
- beqz $t2, .Lrelocate_local_got
-
- bne $t2, $t3, 1f /* DT_PLTGOT? */
- lw $s0, 4($t1)
- addu $s0, $t0
- b 2f
-
-1: bne $t2, $t4, 1f /* DT_MIPS_LOCAL_GOTNO? */
- lw $s1, 4($t1)
- b 2f
-
-1:
-2: addu $t1, 8
- b 0b
-
-.Lrelocate_local_got:
- /*
- * Relocate the local GOT entries
- * got[0] is address of lazy resolver function
- * got[1] may be used for a GNU extension
- */
-
- addu $s0, 4
- subu $s1, 1
- lw $t1, ($s0)
- bgez $t1, 9f
- addu $s0, 4
- subu $s1, 1
- b 9f
-
-1: lw $t1, ($s0)
- addu $t1, $t0
- sw $t1, ($s0)
- addu $s0, 4
-9: subu $s1, 1
- bgez $s1, 1b
-
- /* call linker_init */
- move $a0, $sp
- addiu $sp, -4*4 /* space for arg saves in linker_init */
- la $t9, __linker_init
- jalr $t9
- move $t9, $v0
- addu $sp, 4*4 /* restore sp */
- j $t9
- .end __start
diff --git a/linker/arch/mips64/begin.S b/linker/arch/mips64/begin.S
deleted file mode 100644
index 60169b4..0000000
--- a/linker/arch/mips64/begin.S
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-#define ELF_DYNSZ 8
-#define ELF_DYN_TAG 0
-#define ELF_DYN_VAL 4
-#define GOTENT_SZ 4
-#else
-#define ELF_DYNSZ 16
-#define ELF_DYN_TAG 0
-#define ELF_DYN_VAL 8
-#define GOTENT_SZ 8
-#endif
-
- .text
- .balign 16
- .type __start,@function
-
- .ent __start
- .globl __start
- .globl _start
-__start:
-_start:
- .set noreorder
- bal 1f
- nop
-1:
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- .cpload $ra
-#else
- .cpsetup $ra, $0, 1b
-#endif
- .set reorder
-
- /* Discover the load address */
- LA $t0, 1b
- PTR_SUBU $t0, $ra, $t0
-
-#define DT_PLTGOT 3
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a
-
- /* Search dynamic table for DT_MIPS_LOCAL_GOTNO and DT_PLTGOT values */
- LA $t1, _DYNAMIC
- PTR_ADDU $t1, $t0
- LI $t3, DT_PLTGOT
- LI $ta0, DT_MIPS_LOCAL_GOTNO
-0:
- REG_L $t2, ELF_DYN_TAG($t1)
- beqz $t2, .Lrelocate_local_got
-
- bne $t2, $t3, 1f /* DT_PLTGOT? */
- REG_L $s0, ELF_DYN_VAL($t1)
- PTR_ADDU $s0, $t0
- b 2f
-
-1:
- bne $t2, $ta0, 2f /* DT_MIPS_LOCAL_GOTNO? */
- REG_L $s1, ELF_DYN_VAL($t1)
-
-2: PTR_ADDU $t1, ELF_DYNSZ
- b 0b
-
-.Lrelocate_local_got:
- /*
- * Relocate the local GOT entries
- * got[0] is address of lazy resolver function
- * got[1] may be used for a GNU extension
- */
-
- PTR_ADDU $s0, GOTENT_SZ
- SUBU $s1, 1
- PTR_L $t1, ($s0)
- bgez $t1, 9f
- PTR_ADDU $s0, GOTENT_SZ
- SUBU $s1, 1
- b 9f
-
-1: PTR_L $t1, ($s0)
- PTR_ADDU $t1, $t0
- PTR_S $t1, ($s0)
- PTR_ADDU $s0, GOTENT_SZ
-9: SUBU $s1, 1
- bgez $s1, 1b
-
- /* call linker_init */
- move $a0, $sp
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- PTR_SUBU $sp, 4*REGSZ /* space for arg saves in linker_init */
-#endif
- jal __linker_init
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
- PTR_ADDU $sp, 4*REGSZ /* restore sp */
-#endif
- move $t9, $v0
- j $t9
- .end __start
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 3eb064c..15b6a40 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2949,25 +2949,15 @@
break;
case DT_PLTGOT:
-#if defined(__mips__)
- // Used by mips and mips64.
- plt_got_ = reinterpret_cast<ElfW(Addr)**>(load_bias + d->d_un.d_ptr);
-#endif
- // Ignore for other platforms... (because RTLD_LAZY is not supported)
+ // Ignored (because RTLD_LAZY is not supported).
break;
case DT_DEBUG:
// Set the DT_DEBUG entry to the address of _r_debug for GDB
// if the dynamic table is writable
-// FIXME: not working currently for N64
-// The flags for the LOAD and DYNAMIC program headers do not agree.
-// The LOAD section containing the dynamic table has been mapped as
-// read-only, but the DYNAMIC header claims it is writable.
-#if !(defined(__mips__) && defined(__LP64__))
if ((dynamic_flags & PF_W) != 0) {
d->d_un.d_val = reinterpret_cast<uintptr_t>(&_r_debug);
}
-#endif
break;
#if defined(USE_RELA)
case DT_RELA:
@@ -3162,41 +3152,7 @@
get_realpath(), reinterpret_cast<void*>(d->d_un.d_val));
}
break;
-#if defined(__mips__)
- case DT_MIPS_RLD_MAP:
- // Set the DT_MIPS_RLD_MAP entry to the address of _r_debug for GDB.
- {
- r_debug** dp = reinterpret_cast<r_debug**>(load_bias + d->d_un.d_ptr);
- *dp = &_r_debug;
- }
- break;
- case DT_MIPS_RLD_MAP_REL:
- // Set the DT_MIPS_RLD_MAP_REL entry to the address of _r_debug for GDB.
- {
- r_debug** dp = reinterpret_cast<r_debug**>(
- reinterpret_cast<ElfW(Addr)>(d) + d->d_un.d_val);
- *dp = &_r_debug;
- }
- break;
- case DT_MIPS_RLD_VERSION:
- case DT_MIPS_FLAGS:
- case DT_MIPS_BASE_ADDRESS:
- case DT_MIPS_UNREFEXTNO:
- break;
-
- case DT_MIPS_SYMTABNO:
- mips_symtabno_ = d->d_un.d_val;
- break;
-
- case DT_MIPS_LOCAL_GOTNO:
- mips_local_gotno_ = d->d_un.d_val;
- break;
-
- case DT_MIPS_GOTSYM:
- mips_gotsym_ = d->d_un.d_val;
- break;
-#endif
// Ignored: "Its use has been superseded by the DF_BIND_NOW flag"
case DT_BIND_NOW:
break;
@@ -3254,12 +3210,6 @@
}
}
-#if defined(__mips__) && !defined(__LP64__)
- if (!mips_check_and_adjust_fp_modes()) {
- return false;
- }
-#endif
-
DEBUG("si->base = %p, si->strtab = %p, si->symtab = %p",
reinterpret_cast<void*>(base), strtab_, symtab_);
diff --git a/linker/linker.h b/linker/linker.h
index 80c11d0..2da1404 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -51,20 +51,6 @@
#define ELFW(what) ELF32_ ## what
#endif
-// mips64 interprets Elf64_Rel structures' r_info field differently.
-// bionic (like other C libraries) has macros that assume regular ELF files,
-// but the dynamic linker needs to be able to load mips64 ELF files.
-#if defined(__mips__) && defined(__LP64__)
-#undef ELF64_R_SYM
-#undef ELF64_R_TYPE
-#undef ELF64_R_INFO
-#define ELF64_R_SYM(info) (((info) >> 0) & 0xffffffff)
-#define ELF64_R_SSYM(info) (((info) >> 32) & 0xff)
-#define ELF64_R_TYPE3(info) (((info) >> 40) & 0xff)
-#define ELF64_R_TYPE2(info) (((info) >> 48) & 0xff)
-#define ELF64_R_TYPE(info) (((info) >> 56) & 0xff)
-#endif
-
#define SUPPORTED_DT_FLAGS_1 (DF_1_NOW | DF_1_GLOBAL | DF_1_NODELETE | DF_1_PIE)
// Class used construct version dependency graph.
diff --git a/linker/linker_common_types.h b/linker/linker_common_types.h
index ae78aa9..276fd66 100644
--- a/linker/linker_common_types.h
+++ b/linker/linker_common_types.h
@@ -33,11 +33,8 @@
#include <android-base/macros.h>
-// TODO(dimitry): move this to linker_defines.h? Unless it is removed by
-// consequent refactoring steps.
-
-// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
-#if defined(__aarch64__) || defined(__x86_64__)
+// Android uses RELA for LP64.
+#if defined(__LP64__)
#define USE_RELA 1
#endif
diff --git a/linker/linker_mips.cpp b/linker/linker_mips.cpp
deleted file mode 100644
index 71a96e6..0000000
--- a/linker/linker_mips.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(__LP64__) && __mips_isa_rev >= 5
-#include <sys/prctl.h>
-#endif
-
-#include "linker.h"
-#include "linker_debug.h"
-#include "linker_globals.h"
-#include "linker_phdr.h"
-#include "linker_relocs.h"
-#include "linker_reloc_iterators.h"
-#include "linker_sleb128.h"
-#include "linker_soinfo.h"
-
-template bool soinfo::relocate<plain_reloc_iterator>(const VersionTracker& version_tracker,
- plain_reloc_iterator&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-
-template bool soinfo::relocate<packed_reloc_iterator<sleb128_decoder>>(
- const VersionTracker& version_tracker,
- packed_reloc_iterator<sleb128_decoder>&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-
-template <typename ElfRelIteratorT>
-bool soinfo::relocate(const VersionTracker& version_tracker,
- ElfRelIteratorT&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group) {
- for (size_t idx = 0; rel_iterator.has_next(); ++idx) {
- const auto rel = rel_iterator.next();
-
- if (rel == nullptr) {
- return false;
- }
-
- ElfW(Word) type = ELFW(R_TYPE)(rel->r_info);
- ElfW(Word) sym = ELFW(R_SYM)(rel->r_info);
-
- ElfW(Addr) reloc = static_cast<ElfW(Addr)>(rel->r_offset + load_bias);
- ElfW(Addr) sym_addr = 0;
- const char* sym_name = nullptr;
-
- DEBUG("Processing \"%s\" relocation at index %zd", get_realpath(), idx);
- if (type == R_GENERIC_NONE) {
- continue;
- }
-
- const ElfW(Sym)* s = nullptr;
- soinfo* lsi = nullptr;
-
- if (sym != 0) {
- sym_name = get_string(symtab_[sym].st_name);
- const version_info* vi = nullptr;
-
- if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
-
- if (s == nullptr) {
- // mips does not support relocation with weak-undefined symbols
- DL_ERR("cannot locate symbol \"%s\" referenced by \"%s\"...",
- sym_name, get_realpath());
- return false;
- } else {
- // We got a definition.
- sym_addr = lsi->resolve_symbol_address(s);
- }
- count_relocation(kRelocSymbol);
- }
-
- switch (type) {
- case R_MIPS_REL32:
-#if defined(__LP64__)
- // MIPS Elf64_Rel entries contain compound relocations
- // We only handle the R_MIPS_NONE|R_MIPS_64|R_MIPS_REL32 case
- if (ELF64_R_TYPE2(rel->r_info) != R_MIPS_64 ||
- ELF64_R_TYPE3(rel->r_info) != R_MIPS_NONE) {
- DL_ERR("Unexpected compound relocation type:%d type2:%d type3:%d @ %p (%zu)",
- type, static_cast<unsigned>(ELF64_R_TYPE2(rel->r_info)),
- static_cast<unsigned>(ELF64_R_TYPE3(rel->r_info)), rel, idx);
- return false;
- }
-#endif
- count_relocation(s == nullptr ? kRelocAbsolute : kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL32 %08zx <- %08zx %s", static_cast<size_t>(reloc),
- static_cast<size_t>(sym_addr), sym_name ? sym_name : "*SECTIONHDR*");
- if (s != nullptr) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
- } else {
- *reinterpret_cast<ElfW(Addr)*>(reloc) += load_bias;
- }
- break;
- default:
- DL_ERR("unknown reloc type %d @ %p (%zu)", type, rel, idx);
- return false;
- }
- }
- return true;
-}
-
-bool soinfo::mips_relocate_got(const VersionTracker& version_tracker,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group) {
- ElfW(Addr)** got = plt_got_;
- if (got == nullptr) {
- return true;
- }
-
- // got[0] is the address of the lazy resolver function.
- // got[1] may be used for a GNU extension.
- // FIXME: maybe this should be in a separate routine?
- if ((flags_ & FLAG_LINKER) == 0) {
- size_t g = 1;
- // Check for the high bit to determine whether to skip got[1]
- if (reinterpret_cast<intptr_t>(got[g]) < 0) {
- g++;
- }
- // Relocate the local GOT entries.
- for (; g < mips_local_gotno_; g++) {
- got[g] = reinterpret_cast<ElfW(Addr)*>(reinterpret_cast<uintptr_t>(got[g]) + load_bias);
- }
- }
-
- // Now for the global GOT entries...
- got = plt_got_ + mips_local_gotno_;
- for (ElfW(Word) sym = mips_gotsym_; sym < mips_symtabno_; sym++, got++) {
- // This is an undefined reference... try to locate it.
- const ElfW(Sym)* local_sym = symtab_ + sym;
- const char* sym_name = get_string(local_sym->st_name);
- soinfo* lsi = nullptr;
- const ElfW(Sym)* s = nullptr;
-
- ElfW(Word) st_visibility = (local_sym->st_other & 0x3);
-
- if (st_visibility == STV_DEFAULT) {
- const version_info* vi = nullptr;
-
- if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
- } else if (st_visibility == STV_PROTECTED) {
- if (local_sym->st_value == 0) {
- DL_ERR("%s: invalid symbol \"%s\" (PROTECTED/UNDEFINED) ",
- get_realpath(), sym_name);
- return false;
- }
- s = local_sym;
- lsi = this;
- } else {
- DL_ERR("%s: invalid symbol \"%s\" visibility: 0x%x",
- get_realpath(), sym_name, st_visibility);
- return false;
- }
-
- if (s == nullptr) {
- // We only allow an undefined symbol if this is a weak reference.
- if (ELF_ST_BIND(local_sym->st_info) != STB_WEAK) {
- DL_ERR("%s: cannot locate \"%s\"...", get_realpath(), sym_name);
- return false;
- }
- *got = 0;
- } else {
- // FIXME: is this sufficient?
- // For reference see NetBSD link loader
- // http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/ld.elf_so/arch/mips/mips_reloc.c?rev=1.53&content-type=text/x-cvsweb-markup
- *got = reinterpret_cast<ElfW(Addr)*>(lsi->resolve_symbol_address(s));
- }
- }
- return true;
-}
-
-#if !defined(__LP64__)
-
-// Checks for mips32's various floating point abis.
-// (Mips64 Android has a single floating point abi and doesn't need any checks)
-
-// Linux kernel has declarations similar to the following
-// in <linux>/arch/mips/include/asm/elf.h,
-// but that non-uapi internal header file will never be imported
-// into bionic's kernel headers.
-
-#define PT_MIPS_ABIFLAGS 0x70000003 // is .MIPS.abiflags segment
-
-struct mips_elf_abiflags_v0 {
- uint16_t version; // version of this structure
- uint8_t isa_level, isa_rev, gpr_size, cpr1_size, cpr2_size;
- uint8_t fp_abi; // mips32 ABI variants for floating point
- uint32_t isa_ext, ases, flags1, flags2;
-};
-
-// Bits of flags1:
-#define MIPS_AFL_FLAGS1_ODDSPREG 1 // Uses odd-numbered single-prec fp regs
-
-// Some values of fp_abi: via compiler flag:
-#define MIPS_ABI_FP_ANY 0 // Not tagged or not using any ABIs affected by the differences.
-#define MIPS_ABI_FP_DOUBLE 1 // -mdouble-float
-#define MIPS_ABI_FP_XX 5 // -mfpxx
-#define MIPS_ABI_FP_64A 7 // -mips32r* -mfp64 -mno-odd-spreg
-
-#if __mips_isa_rev >= 5
-static bool mips_fre_mode_on = false; // have set FRE=1 mode for process
-#endif
-
-bool soinfo::mips_check_and_adjust_fp_modes() {
- mips_elf_abiflags_v0* abiflags = nullptr;
- int mips_fpabi;
-
- // Find soinfo's optional .MIPS.abiflags segment
- for (size_t i = 0; i<phnum; ++i) {
- const ElfW(Phdr)& ph = phdr[i];
- if (ph.p_type == PT_MIPS_ABIFLAGS) {
- if (ph.p_filesz < sizeof (mips_elf_abiflags_v0)) {
- DL_ERR("Corrupt PT_MIPS_ABIFLAGS header found \"%s\"", get_realpath());
- return false;
- }
- abiflags = reinterpret_cast<mips_elf_abiflags_v0*>(ph.p_vaddr + load_bias);
- break;
- }
- }
-
- // FP ABI-variant compatibility checks for MIPS o32 ABI
- if (abiflags == nullptr) {
- // Old compilers lack the new abiflags section.
- // These compilers used -mfp32 -mdouble-float -modd-spreg defaults,
- // ie FP32 aka DOUBLE, using odd-numbered single-prec regs
- mips_fpabi = MIPS_ABI_FP_DOUBLE;
- } else {
- mips_fpabi = abiflags->fp_abi;
- if ( (abiflags->flags1 & MIPS_AFL_FLAGS1_ODDSPREG)
- && (mips_fpabi == MIPS_ABI_FP_XX ||
- mips_fpabi == MIPS_ABI_FP_64A ) ) {
- // Android supports fewer cases than Linux
- DL_ERR("Unsupported odd-single-prec FloatPt reg uses in \"%s\"",
- get_realpath());
- return false;
- }
- }
- if (!(mips_fpabi == MIPS_ABI_FP_DOUBLE ||
-#if __mips_isa_rev >= 5
- mips_fpabi == MIPS_ABI_FP_64A ||
-#endif
- mips_fpabi == MIPS_ABI_FP_ANY ||
- mips_fpabi == MIPS_ABI_FP_XX )) {
- DL_ERR("Unsupported MIPS32 FloatPt ABI %d found in \"%s\"",
- mips_fpabi, get_realpath());
- return false;
- }
-
-#if __mips_isa_rev >= 5
- // Adjust process's FR Emulation mode, if needed
- //
- // On Mips R5 & R6, Android runs continuously in FR=1 64bit-fpreg mode.
- // NDK mips32 apps compiled with old compilers generate FP32 code
- // which expects FR=0 32-bit fp registers.
- // NDK mips32 apps compiled with newer compilers generate modeless
- // FPXX code which runs on both FR=0 and FR=1 modes.
- // Android itself is compiled in FP64A which requires FR=1 mode.
- // FP32, FPXX, and FP64A all interlink okay, without dynamic FR mode
- // changes during calls. For details, see
- // http://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
- // Processes containing FR32 FR=0 code are run via kernel software assist,
- // which maps all odd-numbered single-precision reg refs onto the
- // upper half of the paired even-numbered double-precision reg.
- // FRE=1 triggers traps to the kernel's emulator on every single-precision
- // fp op (for both odd and even-numbered registers).
- // Turning on FRE=1 traps is done at most once per process, simultanously
- // for all threads of that process, when dlopen discovers FP32 code.
- // The kernel repacks threads' registers when FRE mode is turn on or off.
- // These asynchronous adjustments are wrong if any thread was executing
- // FPXX code using odd-numbered single-precision regs.
- // Current Android compilers default to the -mno-oddspreg option,
- // and this requirement is checked by Android's dlopen.
- // So FRE can always be safely turned on for FP32, anytime.
- // Deferred enhancement: Allow loading of odd-spreg FPXX modules.
-
- if (mips_fpabi == MIPS_ABI_FP_DOUBLE && !mips_fre_mode_on) {
- // Turn on FRE mode, which emulates mode-sensitive FR=0 code on FR=1
- // register files, by trapping to kernel on refs to single-precision regs
- if (prctl(PR_SET_FP_MODE, PR_FP_MODE_FR|PR_FP_MODE_FRE)) {
- DL_ERR("Kernel or cpu failed to set FRE mode required for running \"%s\"",
- get_realpath());
- return false;
- }
- DL_WARN("Using FRE=1 mode to run \"%s\"", get_realpath());
- mips_fre_mode_on = true; // Avoid future redundant mode-switch calls
- // FRE mode is never turned back off.
- // Deferred enhancement:
- // Reset FRE mode when dlclose() removes all FP32 modules
- }
-#else
- // Android runs continuously in FR=0 32bit-fpreg mode.
-#endif // __mips_isa_rev
- return true;
-}
-
-#endif // __LP64___
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index da2d03c..9b7a461 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -51,8 +51,6 @@
return EM_AARCH64;
#elif defined(__i386__)
return EM_386;
-#elif defined(__mips__)
- return EM_MIPS;
#elif defined(__x86_64__)
return EM_X86_64;
#endif
@@ -204,7 +202,6 @@
if (em == EM_386) return "EM_386";
if (em == EM_AARCH64) return "EM_AARCH64";
if (em == EM_ARM) return "EM_ARM";
- if (em == EM_MIPS) return "EM_MIPS";
if (em == EM_X86_64) return "EM_X86_64";
return "EM_???";
}
diff --git a/linker/linker_relocate.cpp b/linker/linker_relocate.cpp
index 17516e9..72be5f7 100644
--- a/linker/linker_relocate.cpp
+++ b/linker/linker_relocate.cpp
@@ -643,12 +643,6 @@
}
#endif
-#if defined(__mips__)
- if (!mips_relocate_got(version_tracker, global_group, local_group)) {
- return false;
- }
-#endif
-
// Once the tlsdesc_args_ vector's size is finalized, we can write the addresses of its elements
// into the TLSDESC relocations.
#if defined(__aarch64__)
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 3a33949..e1a3c30 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -191,10 +191,8 @@
uint32_t* bucket_;
uint32_t* chain_;
-#if defined(__mips__) || !defined(__LP64__)
- // This is only used by mips and mips64, but needs to be here for
- // all 32-bit architectures to preserve binary compatibility.
- ElfW(Addr)** plt_got_;
+#if !defined(__LP64__)
+ ElfW(Addr)** unused4; // DO NOT USE, maintained for compatibility
#endif
#if defined(USE_RELA)
@@ -228,16 +226,6 @@
uint32_t* ARM_exidx;
size_t ARM_exidx_count;
private:
-#elif defined(__mips__)
- uint32_t mips_symtabno_;
- uint32_t mips_local_gotno_;
- uint32_t mips_gotsym_;
- bool mips_relocate_got(const VersionTracker& version_tracker,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-#if !defined(__LP64__)
- bool mips_check_and_adjust_fp_modes();
-#endif
#endif
size_t ref_count_;
public:
diff --git a/tests/Android.build.prebuilt.mk b/tests/Android.build.prebuilt.mk
index 3b34846..de8f5e6 100644
--- a/tests/Android.build.prebuilt.mk
+++ b/tests/Android.build.prebuilt.mk
@@ -25,8 +25,6 @@
LOCAL_SRC_FILES_arm64 := prebuilt-elf-files/arm64/$(bionic_tests_module)
LOCAL_SRC_FILES_x86 := prebuilt-elf-files/x86/$(bionic_tests_module)
LOCAL_SRC_FILES_x86_64 := prebuilt-elf-files/x86_64/$(bionic_tests_module)
-LOCAL_SRC_FILES_mips := prebuilt-elf-files/mips/$(bionic_tests_module)
-LOCAL_SRC_FILES_mips64 := prebuilt-elf-files/mips64/$(bionic_tests_module)
include $(BUILD_PREBUILT)
bionic-loader-test-libs-target: $(LOCAL_MODULE)
.PHONY: bionic-loader-test-libs-target
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index ed60e8e..6adba19 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -95,12 +95,6 @@
static constexpr const char* kAlternatePathToLinker = "/system/bin/x86_64/linker64";
#elif defined (__i386__)
static constexpr const char* kAlternatePathToLinker = "/system/bin/x86/linker";
-#elif defined (__mips__)
-#if defined(__LP64__)
- static constexpr const char* kAlternatePathToLinker = "/system/bin/mips64/linker64";
-#else
- static constexpr const char* kAlternatePathToLinker = "/system/bin/mips/linker";
-#endif
#else
#error "Unknown architecture"
#endif
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index d815dba..d7b9bae 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -273,8 +273,6 @@
dlclose(handle);
}
-// mips doesn't support ifuncs
-#if !defined(__mips__)
TEST(dlfcn, ifunc_variable) {
typedef const char* (*fn_ptr)();
@@ -367,7 +365,6 @@
ASSERT_STREQ("true", is_ctor_called());
dlclose(handle);
}
-#endif
TEST(dlfcn, dlopen_check_relocation_dt_needed_order) {
// This is the structure of the test library and
@@ -989,12 +986,6 @@
#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/x86/"
#elif defined (__x86_64__)
#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/x86_64/"
-#elif defined (__mips__)
-#if defined(__LP64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/mips64/"
-#else
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/mips/"
-#endif
#else
#error "Unknown architecture"
#endif
@@ -1047,10 +1038,7 @@
ASSERT_TRUE(dlerror() == nullptr); // dladdr(3) doesn't set dlerror(3).
}
-// GNU-style ELF hash tables are incompatible with the MIPS ABI.
-// MIPS requires .dynsym to be sorted to match the GOT but GNU-style requires sorting by hash code.
TEST(dlfcn, dlopen_library_with_only_gnu_hash) {
-#if !defined(__mips__)
dlerror(); // Clear any pending errors.
void* handle = dlopen("libgnu-hash-table-library.so", RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
@@ -1067,9 +1055,6 @@
ASSERT_TRUE(fn == dlinfo.dli_saddr);
ASSERT_STREQ("getRandomNumber", dlinfo.dli_sname);
ASSERT_SUBSTR("libgnu-hash-table-library.so", dlinfo.dli_fname);
-#else
- GTEST_SKIP() << "mips toolchain does not support '--hash-style=gnu'";
-#endif
}
TEST(dlfcn, dlopen_library_with_only_sysv_hash) {
diff --git a/tests/headers/posix/sys_stat_h.c b/tests/headers/posix/sys_stat_h.c
index 5764dfb..b22e34f 100644
--- a/tests/headers/posix/sys_stat_h.c
+++ b/tests/headers/posix/sys_stat_h.c
@@ -69,10 +69,8 @@
STRUCT_MEMBER(struct stat, struct timespec, st_mtim);
STRUCT_MEMBER(struct stat, struct timespec, st_ctim);
#if defined(__BIONIC__)
-#if defined(__aarch64__) || (defined(__mips__) && defined(__LP64__))
+#if defined(__aarch64__)
STRUCT_MEMBER(struct stat, int, st_blksize);
-#elif defined(__mips__) && !defined(__LP64__)
- STRUCT_MEMBER(struct stat, unsigned int, st_blksize);
#elif defined(__x86_64__)
STRUCT_MEMBER(struct stat, long, st_blksize);
#else
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index fdf2cca..c427282 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -117,14 +117,6 @@
defaults: ["bionic_testlib_defaults"],
srcs: ["dlext_test_library.cpp"],
ldflags: ["-Wl,--hash-style=gnu"],
- arch: {
- mips: {
- enabled: false,
- },
- mips64: {
- enabled: false,
- },
- },
}
// -----------------------------------------------------------------------------
@@ -341,10 +333,6 @@
"libnstest_public",
"libnstest_private",
],
- // The dlext.ns_anonymous test copies the loaded segments of this shared
- // object into a new mapping, so every segment must be readable. Turn off
- // eXecute-Only-Memory. See http://b/123034666.
- xom: false,
}
cc_test_library {
@@ -1120,15 +1108,6 @@
name: "libtest_ifunc",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_ifunc.cpp"],
-
- arch: {
- mips: {
- enabled: false,
- },
- mips64: {
- enabled: false,
- },
- },
}
cc_test_library {
@@ -1136,30 +1115,12 @@
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_ifunc_variable.cpp"],
shared_libs: ["libtest_ifunc_variable_impl"],
-
- arch: {
- mips: {
- enabled: false,
- },
- mips64: {
- enabled: false,
- },
- },
}
cc_test_library {
name: "libtest_ifunc_variable_impl",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
-
- arch: {
- mips: {
- enabled: false,
- },
- mips64: {
- enabled: false,
- },
- },
}
// -----------------------------------------------------------------------------
diff --git a/tests/prebuilt-elf-files/mips/libtest_empty.so b/tests/prebuilt-elf-files/mips/libtest_empty.so
deleted file mode 100755
index 417a98b..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_empty.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-empty_shdr_table.so b/tests/prebuilt-elf-files/mips/libtest_invalid-empty_shdr_table.so
deleted file mode 100755
index 94b67b0..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-empty_shdr_table.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/mips/libtest_invalid-rw_load_segment.so
deleted file mode 100755
index b6bfaca..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-rw_load_segment.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-textrels.so b/tests/prebuilt-elf-files/mips/libtest_invalid-textrels.so
deleted file mode 100755
index 7ff0753..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-textrels.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-textrels2.so b/tests/prebuilt-elf-files/mips/libtest_invalid-textrels2.so
deleted file mode 100755
index bfbadec..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-textrels2.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-unaligned_shdr_offset.so b/tests/prebuilt-elf-files/mips/libtest_invalid-unaligned_shdr_offset.so
deleted file mode 100755
index f6fcad2..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-unaligned_shdr_offset.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_content.so b/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_content.so
deleted file mode 100755
index 500d4d7..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_content.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_offset.so b/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_offset.so
deleted file mode 100755
index e4166d1..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shdr_table_offset.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shentsize.so b/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shentsize.so
deleted file mode 100755
index ace8fdd..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shentsize.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shstrndx.so b/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shstrndx.so
deleted file mode 100755
index 9141875..0000000
--- a/tests/prebuilt-elf-files/mips/libtest_invalid-zero_shstrndx.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_empty.so b/tests/prebuilt-elf-files/mips64/libtest_empty.so
deleted file mode 100755
index ad3a568..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_empty.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-empty_shdr_table.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-empty_shdr_table.so
deleted file mode 100755
index 9420211..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-empty_shdr_table.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-rw_load_segment.so
deleted file mode 100755
index 3fcfc38..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-rw_load_segment.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels.so
deleted file mode 100755
index ec43ace..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels2.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels2.so
deleted file mode 100755
index cb6661e..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-textrels2.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-unaligned_shdr_offset.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-unaligned_shdr_offset.so
deleted file mode 100755
index c61efaf..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-unaligned_shdr_offset.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_content.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_content.so
deleted file mode 100755
index ffabdc3..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_content.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_offset.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_offset.so
deleted file mode 100755
index 43b44f0..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shdr_table_offset.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shentsize.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shentsize.so
deleted file mode 100755
index cf55d06..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shentsize.so
+++ /dev/null
Binary files differ
diff --git a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shstrndx.so b/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shstrndx.so
deleted file mode 100755
index 8155949..0000000
--- a/tests/prebuilt-elf-files/mips64/libtest_invalid-zero_shstrndx.so
+++ /dev/null
Binary files differ
diff --git a/tests/setjmp_test.cpp b/tests/setjmp_test.cpp
index 44d8af1..2476704 100644
--- a/tests/setjmp_test.cpp
+++ b/tests/setjmp_test.cpp
@@ -224,10 +224,6 @@
#define __JB_SIGFLAG 8
#elif defined(__x86_64)
#define __JB_SIGFLAG 8
-#elif defined(__mips__) && defined(__LP64__)
-#define __JB_SIGFLAG 1
-#elif defined(__mips__)
-#define __JB_SIGFLAG 2
#endif
TEST(setjmp, setjmp_cookie) {
@@ -235,13 +231,7 @@
int value = setjmp(jb);
ASSERT_EQ(0, value);
-#if defined(__mips__) && !defined(__LP64__)
- // round address to 8-byte boundry
- uintptr_t jb_aligned = reinterpret_cast<uintptr_t>(jb) & ~7L;
- long* sigflag = reinterpret_cast<long*>(jb_aligned) + __JB_SIGFLAG;
-#else
long* sigflag = reinterpret_cast<long*>(jb) + __JB_SIGFLAG;
-#endif
// Make sure there's actually a cookie.
EXPECT_NE(0, *sigflag & ~1);
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index eec56dc..3c66034 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -282,8 +282,7 @@
int sig) {
// Both bionic and glibc set SA_RESTORER when talking to the kernel on arm,
// arm64, x86, and x86-64. The version of glibc we're using also doesn't
- // define SA_RESTORER, but luckily it's the same value everywhere, and mips
- // doesn't use the bit for anything.
+ // define SA_RESTORER, but luckily it's the same value everywhere.
static const unsigned sa_restorer = 0x4000000;
// See what's currently set for this signal.
@@ -598,19 +597,13 @@
}
TEST(signal, limits) {
- // This comes from the kernel.
+ // These come from the kernel.
ASSERT_EQ(32, __SIGRTMIN);
+ ASSERT_EQ(64, __SIGRTMAX);
// We reserve a non-zero number at the bottom for ourselves.
ASSERT_GT(SIGRTMIN, __SIGRTMIN);
- // MIPS has more signals than everyone else.
-#if defined(__mips__)
- ASSERT_EQ(128, __SIGRTMAX);
-#else
- ASSERT_EQ(64, __SIGRTMAX);
-#endif
-
// We don't currently reserve any at the top.
ASSERT_EQ(SIGRTMAX, __SIGRTMAX);
}
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 9911d64..8a6b267 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -69,12 +69,7 @@
atomic_char small;
ASSERT_TRUE(atomic_is_lock_free(&small));
atomic_intmax_t big;
- // atomic_intmax_t(size = 64) is not lock free on mips32.
-#if defined(__mips__) && !defined(__LP64__)
- ASSERT_FALSE(atomic_is_lock_free(&big));
-#else
ASSERT_TRUE(atomic_is_lock_free(&big));
-#endif
}
TEST(stdatomic, atomic_flag) {
diff --git a/tests/sys_personality_test.cpp b/tests/sys_personality_test.cpp
index 6bd00ef..2dfaa65 100644
--- a/tests/sys_personality_test.cpp
+++ b/tests/sys_personality_test.cpp
@@ -21,9 +21,7 @@
TEST(sys_personality, current_persona) {
int persona = personality(0xffffffff) & PER_MASK;
#if defined(__BIONIC__)
-// When personality syscall is executed on mips64, for a 32bit process
-// sys_32_personality() is called, which converts PER_LINUX32 -> PER_LINUX
-#if defined(__LP64__) || (__mips==32 && __mips_isa_rev>2)
+#if defined(__LP64__)
ASSERT_EQ(PER_LINUX, persona);
#else
ASSERT_EQ(PER_LINUX32, persona);
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index f17f80c..a079ead 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -257,9 +257,6 @@
asm volatile("stm %0, { r0, r1, r2, r3 }" : : "r"(&data));
#elif defined(__aarch64__)
asm volatile("stp x0, x1, %0" : : "m"(data));
-#elif defined(__mips__)
-// TODO
- UNUSED(data);
#endif
}
diff --git a/tools/versioner/platforms/crtbegin.map.txt b/tools/versioner/platforms/crtbegin.map.txt
index 2c08da6..b844c1e 100644
--- a/tools/versioner/platforms/crtbegin.map.txt
+++ b/tools/versioner/platforms/crtbegin.map.txt
@@ -3,5 +3,5 @@
CRTBEGIN {
global:
- atexit; # arm64 x86 x86_64 mips mips64
+ atexit; # arm64 x86 x86_64
};
diff --git a/tools/versioner/tests/preprocessor/expected/foo.h b/tools/versioner/tests/preprocessor/expected/foo.h
index 61e6056..769c37e 100644
--- a/tools/versioner/tests/preprocessor/expected/foo.h
+++ b/tools/versioner/tests/preprocessor/expected/foo.h
@@ -54,26 +54,23 @@
// __INTRODUCED_IN_64(21) should be ignored.
-#if (defined(__LP64__)) || (defined(__arm__) && __ANDROID_API__ >= 13) || (defined(__mips__) && !defined(__LP64__) && __ANDROID_API__ >= 14) || (defined(__i386__) && __ANDROID_API__ >= 13)
-int multiple_introduced_1() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(14) __INTRODUCED_IN_X86(13)
- __INTRODUCED_IN_64(21);
-#endif /* (defined(__LP64__)) || (defined(__arm__) && __ANDROID_API__ >= 13) || (defined(__mips__) && !defined(__LP64__) && __ANDROID_API__ >= 14) || (defined(__i386__) && __ANDROID_API__ >= 13) */
+#if (!defined(__LP64__) && __ANDROID_API__ >= 13) || (defined(__LP64__))
+int multiple_introduced_1() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_X86(13) __INTRODUCED_IN_64(21);
+#endif /* (!defined(__LP64__) && __ANDROID_API__ >= 13) || (defined(__LP64__)) */
-#if (defined(__LP64__) && __ANDROID_API__ >= 22) || (defined(__arm__) && __ANDROID_API__ >= 13) || (defined(__mips__) && !defined(__LP64__) && __ANDROID_API__ >= 14) || (defined(__i386__) && __ANDROID_API__ >= 13)
-int multiple_introduced_2() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(14) __INTRODUCED_IN_X86(13)
- __INTRODUCED_IN_64(22);
-#endif /* (defined(__LP64__) && __ANDROID_API__ >= 22) || (defined(__arm__) && __ANDROID_API__ >= 13) || (defined(__mips__) && !defined(__LP64__) && __ANDROID_API__ >= 14) || (defined(__i386__) && __ANDROID_API__ >= 13) */
+#if (!defined(__LP64__) && __ANDROID_API__ >= 13) || (defined(__LP64__) && __ANDROID_API__ >= 22)
+int multiple_introduced_2() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_X86(13) __INTRODUCED_IN_64(22);
+#endif /* (!defined(__LP64__) && __ANDROID_API__ >= 13) || (defined(__LP64__) && __ANDROID_API__ >= 22) */
#if (!defined(__LP64__) && __ANDROID_API__ >= 12) || (defined(__LP64__))
-int group_lp32() __INTRODUCED_IN_ARM(12) __INTRODUCED_IN_X86(12) __INTRODUCED_IN_MIPS(12);
+int group_lp32() __INTRODUCED_IN_ARM(12) __INTRODUCED_IN_X86(12);
#endif /* (!defined(__LP64__) && __ANDROID_API__ >= 12) || (defined(__LP64__)) */
-
#if defined(__cplusplus)
}
#endif
diff --git a/tools/versioner/tests/preprocessor/headers/foo.h b/tools/versioner/tests/preprocessor/headers/foo.h
index 349e5e6..782b44a 100644
--- a/tools/versioner/tests/preprocessor/headers/foo.h
+++ b/tools/versioner/tests/preprocessor/headers/foo.h
@@ -37,13 +37,11 @@
#endif
// __INTRODUCED_IN_64(21) should be ignored.
-int multiple_introduced_1() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(14) __INTRODUCED_IN_X86(13)
- __INTRODUCED_IN_64(21);
+int multiple_introduced_1() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_X86(13) __INTRODUCED_IN_64(21);
-int multiple_introduced_2() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(14) __INTRODUCED_IN_X86(13)
- __INTRODUCED_IN_64(22);
+int multiple_introduced_2() __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_X86(13) __INTRODUCED_IN_64(22);
-int group_lp32() __INTRODUCED_IN_ARM(12) __INTRODUCED_IN_X86(12) __INTRODUCED_IN_MIPS(12);
+int group_lp32() __INTRODUCED_IN_ARM(12) __INTRODUCED_IN_X86(12);
#if defined(__cplusplus)
}