Merge "Remove unused mips/mips64 code from the linker."
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("""\