Merge "Clean up mips references in the headers."
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/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..a411a90 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
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 0e68259..03b08b6 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: