Snap for 6439596 from 358c8c95725380eafe9f2aed0a4e2542592e85ff to qt-aml-tzdata-release

Change-Id: I4ada3f93d22c9ad0b5fd2d689427129f72ff41b3
diff --git a/.clang-format b/.clang-format
index 7630d16..b8c6428 100644
--- a/.clang-format
+++ b/.clang-format
@@ -12,4 +12,3 @@
 PenaltyExcessCharacter: 32
 
 Cpp11BracedListStyle: false
-IncludeBlocks: Preserve
\ No newline at end of file
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 7b533a4..98bede5 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,2 +1,4 @@
 [Hook Scripts]
 notice = tools/update_notice.sh
+seccomp = tools/update_seccomp.sh
+syscalls = tools/update_syscalls.sh
diff --git a/README.md b/README.md
index 6bece25..12c5235 100644
--- a/README.md
+++ b/README.md
@@ -162,15 +162,17 @@
 
   1. Add entries to SYSCALLS.TXT.
      See SYSCALLS.TXT itself for documentation on the format.
-  2. Add constants (and perhaps types) to the appropriate header file.
+  2. Run the gensyscalls.py script.
+  3. Add constants (and perhaps types) to the appropriate header file.
      Note that you should check to see whether the constants are already in
      kernel uapi header files, in which case you just need to make sure that
      the appropriate POSIX header file in libc/include/ includes the
      relevant file or files.
-  3. Add function declarations to the appropriate header file. Don't forget
+  4. Add function declarations to the appropriate header file. Don't forget
      to include the appropriate `__INTRODUCED_IN()`.
-  4. Add the function name to the correct section in libc/libc.map.txt.
-  5. Add at least basic tests. Even a test that deliberately supplies
+  5. Add the function name to the correct section in libc/libc.map.txt and
+     run `./libc/tools/genversion-scripts.py`.
+  6. Add at least basic tests. Even a test that deliberately supplies
      an invalid argument helps check that we're generating the right symbol
      and have the right declaration in the header file, and that you correctly
      updated the maps in step 5. (You can use strace(1) to confirm that the
@@ -192,9 +194,10 @@
 
 ## Updating tzdata
 
-This is handled by the libcore team, because they own icu, and that needs to be
-updated in sync with bionic). See
-[system/timezone/README.android](https://android.googlesource.com/platform/system/timezone/+/master/README.android).
+This is fully automated (and these days handled by the libcore team, because
+they own icu, and that needs to be updated in sync with bionic):
+
+  1. Run update-tzdata.py in external/icu/tools/.
 
 
 ## Verifying changes
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index 84456f9..4c13bec 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -1,11 +1,8 @@
-# Android linker changes for NDK developers
+# Android changes for NDK developers
 
 This document details important changes related to native code
 loading in various Android releases.
 
-See also [bionic status](docs/status.md) for general libc/libm/libdl
-behavior changes.
-
 Required tools: the NDK has an _arch_-linux-android-readelf binary
 (e.g. arm-linux-androideabi-readelf or i686-linux-android-readelf)
 for each architecture (under toolchains/), but you can use readelf for
@@ -49,10 +46,6 @@
 [ReLinker](https://github.com/KeepSafe/ReLinker) which claims to solve
 these problems automatically.
 
-Alternatively, if you don't have too many dependencies, it can be easiest to
-simply link all of your code into one big library and sidestep the details of
-library and symbol lookup changes on all past (and future) Android versions.
-
 ## Changes to library search order
 
 We have made various fixes to library search order when resolving symbols.
@@ -73,14 +66,6 @@
 intercept any symbol.
 
 
-## LD_PRELOAD and 32/64 bit
-
-LD_PRELOAD applies to both 32- and 64-bit processes. This means that you
-should avoid saying something like `/system/lib/libfoo.so` and just say
-`libfoo.so` instead, letting the dynamic linker find the correct library
-on its search path.
-
-
 ## RTLD_LOCAL (Available in API level >= 23)
 
 The dlopen(3) RTLD_LOCAL flag used to be ignored but is implemented
@@ -345,16 +330,6 @@
 configured your build system to generate incorrect SONAME entries (using
 the -soname linker option).
 
-## `__register_atfork` (Available in API level >= 23)
-
-To allow `atfork` and `pthread_atfork` handlers to be unregistered on
-`dlclose`, the implementation changed in API level 23. Unfortunately this
-requires a new libc function `__register_atfork`. Code using these functions
-that is built with a target API level >= 23 therefore will not load on earlier
-versions of Android, with an error referencing `__register_atfork`.
-
-*Resolution*: build your code with an NDK target API level that matches your
-app's minimum API level, or avoid using `atfork`/`pthread_atfork`.
 
 ## DT_RUNPATH support (Available in API level >= 24)
 
diff --git a/apex/Android.bp b/apex/Android.bp
deleted file mode 100644
index 276541e..0000000
--- a/apex/Android.bp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Runtime (Bionic) APEX module
-//
-// In Q this contained Bionic, ART and Libcore.
-// It keeps the name /apex/com.android.runtime for app compat reasons.
-
-android_app_certificate {
-    name: "com.android.runtime.certificate",
-    certificate: "com.android.runtime",
-}
-
-apex_key {
-    name: "com.android.runtime.key",
-    public_key: "com.android.runtime.avbpubkey",
-    private_key: "com.android.runtime.pem",
-}
-
-prebuilt_etc {
-    name: "com.android.runtime.ld.config.txt",
-    src: "ld.config.txt",
-    filename: "ld.config.txt",
-    installable: false,
-}
-
-apex {
-    name: "com.android.runtime",
-    compile_multilib: "both",
-    manifest: "manifest.json",
-    native_shared_libs: [
-        "libc",
-        "libm",
-        "libdl",
-        "libc_malloc_debug",
-        "libc_malloc_hooks",
-    ],
-    multilib: {
-        both: {
-            binaries: ["linker"],
-        },
-    },
-    prebuilts: ["com.android.runtime.ld.config.txt"],
-    key: "com.android.runtime.key",
-    certificate: ":com.android.runtime.certificate",
-}
diff --git a/apex/com.android.runtime.avbpubkey b/apex/com.android.runtime.avbpubkey
deleted file mode 100644
index b0ffc9b..0000000
--- a/apex/com.android.runtime.avbpubkey
+++ /dev/null
Binary files differ
diff --git a/apex/com.android.runtime.pem b/apex/com.android.runtime.pem
deleted file mode 100644
index 4c7ce4b..0000000
--- a/apex/com.android.runtime.pem
+++ /dev/null
@@ -1,51 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIJKgIBAAKCAgEAx/VRn+TOZ4Hah9tHkb2Jvw7aQcqurnNamGa1Ta3x09HEV45s
-KTAqeTIPpbagx7aj6LNimiqoJaClV8pFhYfC6y7GLnXBk6PRGb2kPmrWy2aQFRkh
-Z2LBQwu15Rqr3SVbzMPbC5qoXOpUopzZnjRwniR32fnpJedUwpSMxaJwXDxfgBku
-Wm3EHBuTQ33L/z3VGwbVp1Rh/QhI/RfcwT1u6o9XUl0LqiQu/8DLTLNmsjAsQkbA
-8O1ToIBu2l71HaMqXOKRKtVuAYPyAMml5hXSH0dva2ebKkUM8E7FhcsK71QJ5iCs
-L2uC+OmG9f4aSqiIJld7/nDU7nrkiUxjs5bGp2PIxHmuv725XdBMJ+IuqnZGGkA8
-4tF14bY1YX4Tq6ojzATBnbFcZEAU4epJvX13Wu11ktYndMbppUtnVCdhO2vnA/tP
-MpBSOCHMk2Y2Q96LcIN9ANJrcrkrSIGBTQdvCRJ9LtofXlk/ytGIUceCzRtFhmwL
-zWFwJVT7cQX04Pw/EX/zrZyOq7SUYCGDsBwZsUtlZ30Cx92dergtKlZyJFqKnwMv
-hajr55mqRCv4M1dumCgiQaml29ftXWE6wQxqI0jQN8seSVz/HUazjSb3QFXgX16z
-w4VkxqSKu4subqesMcxiyev5McGXUUthkRGDSSFbJwX0L5jNEPyYPUu2nJ0CAwEA
-AQKCAgEAxGKuDin8hjBE3tWAjyTmWp1Nwvw7X96vhaqqOmayceU9vviERlel/24p
-bAnYEw3QIcW8+8kVaA9FFNn2OdVCnRVNU2gX/NcRkQRugVcRKqfKrs4FvrKBOUYR
-Gbh+Py5n4M4jHlyBKvCCu0rteLHsQYVzqMQINk/jMVAQijKlxBEPgpI4slvIFgsH
-MWwlpMOnv2mRAUyhCJDQjrKW/7tEal7p1lzIDgyHlGxXvzcbj7o8XcN7z6RnU+WP
-+iz09GzCOIPVK4p/BkH+tsNVioq32jygs44IGRXERWg4GtV2IeQZ7Mj+E3y2H53M
-DWHJlLW9MlsNzrImjypntmkuKr3Uz+ipg/oXD1tv/XJkBkJUsWSQHzGw4DfxRfq7
-eJ9LlIMzrQn8ZJAJTSsckmGuakSyD9amSbtn1kl+fEZge9SvAoZVZelwB1qfGgyS
-qQVAN9x1SP0DCeX33syxT2rxZVOUZgRT8yt01jVcIU3dD66McYRjiUY6uG1aZ3Xb
-p8TD3xKMqPPc7dIN3xcN58S+sIejydmm636LE1ykA0dYPczqxDfIfhbqE/42B5LZ
-grjZdXN1pd97IeEFQLd+DfP8iq80D6k6ojmXxANXCz1ilJXyr2defWUwSSiwsD5v
-HacFeOQ6+KQyYrkdhbpa5XlO6luDIZmxN3B6rx7kqg6UZW9EzYkCggEBAPDNOZ6X
-TIKBIdV5zkr2rvjor/WvPnoWUOBCmxh8zaAZhReE3RitNjtEVz/ns/x8vyyMRdPA
-JDszBrawYlMjoEW9NQe6BYKfwKRl+QzsWEIsdBfYB70vmguwS/VdMbVaU/jWFbS+
-IFB9F88iEJiI8IeH+IomGXinCDxAkXqJztFZRzonaX5+QHC4s8geRyYn9gs6SxHy
-MqOOzifnebZg4dXLCL7jMDGsEa/Fu188FFae407BsOEt4bday37n91xysdilkPg3
-b3mIB3EFrsbnqXypayM/QUfQ/d48Xfa/l+74i1Qpd1MIeHYNndLDxtRes9Oc7Rnv
-oCdI9Lkc+KuR8AcCggEBANSUKb2jz0VfSZSZsgL5gj34Kcfoe5peQvP+pUuJmZhy
-8QkGUUNtq2l86PMJSfJknbUhVLPe0wzT8NG08HTMkVHlw7lve//avugfpnrR7hsZ
-BTWDjW44x+Y8Q8dwTUl3nYtEYn81ycUzmFBmYDEVXjlvyMlXe0HLEz90v2wwtZlp
-IxEXgEgMnLj36JH5iKh7YuLf9c8laok7Jed6u+h5nlXUcbfaSVN6U3K+6UdQKUrr
-TaSQLw2pEsZ6CEt0yGJDkoID7mfTfc1/olNWWGUz0RE9G5eqQYjgEoAiTBZZeSlm
-3Kaun8gydN7wwJ6AjPCPFOwtgV7dUoN4YbWgfsAgnTsCggEBALHOWCWKgqw6vcjr
-0C/6Ruj0qDk51WBA6icuB2flf9AgB+595OQ7wjexFtvRM03UrzUtvsHEtvwfiW2M
-gI3zWH0mYOn7qeXyIEVEJsosGl+Cg5a3pb9ETvMiknPzBKlssWSkcBKt8R59v/7q
-oGaBd1ocRKF90IEOlT4oT0O0Tkq3Kaj/QR5uCxcwy0+RS+gYyc0wlg4CUPIEmKVO
-fsj0cM10xlhtWUDUVZr83oZLzpjHagDVdM5RGsJRAMIMdtKEvl3Co3ElPeL3VsdV
-8uBcXwH1925nXsSwxUQ8PwXcI0wJqpfSppFhR9Gj7E2c0kwuQYqX7VuhXRik/k9R
-3SyS7jECggEBAL7q7m4GL8IjKSdPvgNT6TgUqBmFX3UtkT4nhnbH9u1m1bmANf20
-Ak20RFb6EbKj0Mv7SmJdDfkoY9FDiu2rSBxgmZ7yVFBeOjSpMFCAODOYDgiYxK2o
-S0go+cqlvpPr3M9WNIwBV9xHUVVsDJookb5N+etyKR3W78t+4+ib+oz0Uu0nySts
-QFkTNYncrXJ7lj0iXVaUSRFE0O8LWLYafCyjpxoy7sYNR+L3OPW2Nc+2cr4ITGod
-XeJpeQejs9Ak1fD07OnMlOC576SfGLaTigHMevqEi2UNsS/pHaK46stXOXZtwM0B
-G9uaJ7RyyaHHL0hKOjVj2pZ+yGph4VRWNj8CggEAQlp/QytXhKZtM9OqRy/th+XO
-ctoVEl8codUydwwxMCsKqGYiCXazeyDZQimOjaxSNFXo8hWuf694WGsQJ6TyXCEs
-0JAJbCooI+DI9Z4LbqHtLDg1/S6a1558Nyrc6j6amevvbB5xKS2mKhGl5JgzBsJO
-H3yE0DD1DHaSM3V1rTfdyGoaxNESw45bnpxkAooMrw62OIO/9f502FLUx+sq+koT
-aajw4qQ6rBll3/+PKCORKzncHDMkIbeD6c6sX+ONUz7vxg3pV4eZG7NClWvA24Td
-1sANz3m6EmqG41lBzeUGConWxWRwkEXJgbxmPwMariRKR8aNVOlDVVbDp9Hhxg==
------END RSA PRIVATE KEY-----
diff --git a/apex/com.android.runtime.pk8 b/apex/com.android.runtime.pk8
deleted file mode 100644
index de96219..0000000
--- a/apex/com.android.runtime.pk8
+++ /dev/null
Binary files differ
diff --git a/apex/com.android.runtime.x509.pem b/apex/com.android.runtime.x509.pem
deleted file mode 100644
index 890ae9f..0000000
--- a/apex/com.android.runtime.x509.pem
+++ /dev/null
@@ -1,34 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIF2zCCA8OgAwIBAgIUIVa9I/DpCnStxMqP/g9wS+dwNcowDQYJKoZIhvcNAQEL
-BQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
-DU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB0FuZHJvaWQxEDAOBgNVBAsMB0FuZHJv
-aWQxHDAaBgNVBAMME2NvbS5hbmRyb2lkLnJ1bnRpbWUwIBcNMTkwODEzMTIwNTU3
-WhgPNDc1NzA3MDkxMjA1NTdaMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxp
-Zm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lk
-MRAwDgYDVQQLDAdBbmRyb2lkMRwwGgYDVQQDDBNjb20uYW5kcm9pZC5ydW50aW1l
-MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0B6dmGfJk68K7Sj0hOnE
-uTobEz+lMWQKK+K1qOC13Nv9pkSvZqUbNFL9Qrkv46GVi3rFRgB1MOchCJ/f4Ost
-BsEbN3aCtRkvD2qrDNBzwvUPrxNxJ+WZnHUgvJyAS7tu8riRV+5N27lLLfpZon++
-8mYnxOll/050+qW+LC6FZTaTdrVWSlItPX4ZvKArlA6wXn88GJjiUgfcGxquwHbZ
-AhaUsdXIJ9DTJxf3NgsuPLjBepGXdPO3XK+qGFU/XyhEzmUHPXf2+OfgWs3cIAAf
-i5r2GL1Zw3S0ax+s5rujHn0TJFEOJ0UwMHWAZrZjp51qNu7Sza2KPFG6W9r3r6wj
-Ie8/som8YYy2Q1sXX2cbBrOxMU3yq/vaGTKWjpZ1wfzT24aVRRhxa6qdULNdj8fq
-RO7MTIY76KjV3ehGVi21501Kv3UfY9TqyPowVIttZ7m3ZAUYv+cObZZYc92VCON1
-irLJC9GtvvZYUKY+fr3quv9Fhf9fIevvSM1Nnn6MBUDiHmoyaNPymWaiCqzwUvig
-8sJW70Mh8mtANVJ1M3GSWHLenKVFe/kKoHaZttaHo+NAEpzcm4sGVNB3SqB3S+Pw
-d4BU1Tt/2GWqSZx7ALmSyjVdYGJZgAGusWPsdP1FPdyHBwhsBTW/bMhBLNU9NfjP
-uRjJyNroouQvpdPnW9NDfDECAwEAAaNTMFEwHQYDVR0OBBYEFKmGUpGYLLwLU/R+
-QIVxyI4UsDlNMB8GA1UdIwQYMBaAFKmGUpGYLLwLU/R+QIVxyI4UsDlNMA8GA1Ud
-EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAHzVs6gp+fnXbvhGP2aKFFJF
-xMIi4ahsoS5RneEEG/dQVKd/5NfrHY6lHIAV1kEk9TrvcemIo4n7SETd4Hj4O0xZ
-tnPC3y9v/kSbjryYouOEa4hBILKxVzIZw6MiM5arGo4ZYc1Rfck+F/92xj7o/kWo
-9+Dn58zNAHAMC13F1wM61e+tdHZJHgmLfUUYKvZ3sAgxmsQM8BfwobH2/Ww0IOCY
-PRYZwcIpdEu9D1dCM9kON/1Ss0jo6+6MuW1CMoER9alEVpKWv4o1Phrd9z7v7JDh
-ZW5jJC9n4HzwDDy679OrH512Dhv7HwT8dnRfylo+2pdOW7iby7MJzd/hql6MC9+h
-/5EwfuiNMaifo94SEFElNjhqJZwoqaFIyOT2fYt9hlvdBqWp/L5p+si0JOYbEnB2
-hIOIqfw7qdO8gZsCt7ps9JSxnPCVF1mAcrDuQcgVdGs2D3/HE+R3R504iOoAc0XF
-m9nw06M1O6bmdygQedIZ54wTINjhkJXtQluu74O2kl9wKNd2FSJWh0ZvudulohCM
-p7mS8lAlFbDPOCavlovIijXDYialcFNZnUSJAxE/k0rBBnnVxDTsJeR8ipOkaww4
-3POEm22OM57Tl60w4Jn8VZoPRl0G+R+uUaZdmPw6Gs/PgTDlwK+t1HQN0pFA0VMw
-Z4b+m+R+iUba0dbeVf/4
------END CERTIFICATE-----
diff --git a/apex/ld.config.txt b/apex/ld.config.txt
deleted file mode 100644
index dae883d..0000000
--- a/apex/ld.config.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Bionic loader config file for the Runtime APEX. This is a minimal config to
-# make the linker able to load itself as an executable (it just needs to exist).
-
-dir.runtime = /apex/com.android.runtime/bin/
-
-[runtime]
diff --git a/apex/manifest.json b/apex/manifest.json
deleted file mode 100644
index 20a8314..0000000
--- a/apex/manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "name": "com.android.runtime",
-  "version": 1
-}
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
index a7be965..06c0ba3 100644
--- a/benchmarks/Android.bp
+++ b/benchmarks/Android.bp
@@ -28,8 +28,6 @@
     srcs: [
         "bionic_benchmarks.cpp",
         "atomic_benchmark.cpp",
-        "ctype_benchmark.cpp",
-        "dlfcn_benchmark.cpp",
         "get_heap_size_benchmark.cpp",
         "inttypes_benchmark.cpp",
         "malloc_benchmark.cpp",
@@ -42,7 +40,6 @@
         "string_benchmark.cpp",
         "time_benchmark.cpp",
         "unistd_benchmark.cpp",
-        "wctype_benchmark.cpp",
     ],
     shared_libs: ["liblog"],
     static_libs: [
@@ -64,8 +61,8 @@
 }
 
 // Build benchmarks for the device (with bionic's .so). Run with:
-//   adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks
-//   adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks
+//   adb shell bionic-benchmarks32
+//   adb shell bionic-benchmarks64
 cc_benchmark {
     name: "bionic-benchmarks",
     defaults: ["bionic-benchmarks-defaults"],
diff --git a/benchmarks/README.md b/benchmarks/README.md
index fe447d1..2616a51 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -1,44 +1,48 @@
-# Bionic Benchmarks
+Bionic Benchmarks
+=================
 
-[TOC]
-
-## libc benchmarks (bionic-benchmarks)
-
-`bionic-benchmarks` is a command line tool for measuring the runtimes of libc functions. It is built
-on top of [Google Benchmark](https://github.com/google/benchmark) with some additions to organize
+Bionic benchmarks is a command line tool for measuring the runtimes of libc functions. It is built
+on top of [Google benchmarks](https://github.com/google/benchmark) with some additions to organize
 tests into suites.
 
+Running the benchmarks
+----------------------
+
 ### Device benchmarks
 
-    $ mmma bionic/benchmarks
-    $ adb root
-    $ adb sync data
+    $ mma
+    $ adb remount
+    $ adb sync
     $ adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks
     $ adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks
 
-By default, `bionic-benchmarks` runs all of the benchmarks in alphabetical order. Pass
-`--benchmark_filter=getpid` to run just the benchmarks with "getpid" in their name.
+When operated without specifying an xml file, the default is to run all
+of the benchmarks in alphabetical order.
+
+You can use `--benchmark_filter=getpid` to just run benchmarks with "getpid"
+in their name.
 
 ### Host benchmarks
 
-See the `benchmarks/run-on-host.sh` script. The host benchmarks can be run with 32-bit or 64-bit
-Bionic, or the host glibc.
+See the benchmarks/run-on-host.sh script. The host benchmarks can be run
+with 32 bit or 64 bit bionic, or the host glibc.
 
-### XML suites
+## Suites
 
 Suites are stored in the `suites/` directory and can be chosen with the command line flag
-`--bionic_xml`.
+'--bionic_xml'.
 
-To choose a specific XML file, use the `--bionic_xml=FILE.XML` option. By default, this option
-searches for the XML file in the `suites/` directory. If it doesn't exist in that directory, then
-the file will be found as relative to the current directory. If the option specifies the full path
-to an XML file such as `/data/nativetest/suites/example.xml`, it will be used as-is.
+To choose a specific xml file, use the `--bionic_xml=FILE.XML` option. By default, this
+option searches for the xml file in the `suites/` directory. If it doesn't exist
+in that directory then the file will be found as relative to the current
+directory. If the option specifies the full path to an xml file such as
+`/data/nativetest/suites/example.xml`, it will be used as is.
 
-If no XML file is specified through the command-line option, the default is to use `suites/full.xml`.
-However, for the host bionic benchmarks (`bionic-benchmarks-glibc`), the default is to use
-`suites/host.xml`.
+If no xml file is specified through the command-line option, the default is to use `suites/full.xml`.
+However, for the host bionic benchmarks (bionic-benchmarks-glibc), the default
+is to use `suites/host.xml`.
 
-### XML suite format
+### Format
 
 The format for a benchmark is:
 
@@ -51,19 +55,19 @@
 </fn>
 ```
 
-XML-specified values for iterations and cpu take precedence over those specified via command line
-(via `--bionic_iterations` and `--bionic_cpu`, respectively.)
+xml-specified values for iterations and cpu take precedence over those specified via command line
+(via '--bionic_iterations' and '--bionic_cpu', respectively.)
 
 To make small changes in runs, you can also schedule benchmarks by passing in their name and a
-space-separated list of arguments via the `--bionic_extra` command line flag, e.g.
-`--bionic_extra="BM_string_memcpy AT_COMMON_SIZES"` or `--bionic_extra="BM_string_memcmp 32 8 8"`
+space-separated list of arguments via the 'bionic_extra' command line flag, e.g.
+'--bionic_extra="BM_string_memcpy AT_COMMON_SIZES"' or '--bionic_extra="BM_string_memcmp 32 8 8"'
 
 Note that benchmarks will run normally if extra arguments are passed in, and it will fail
 with a segfault if too few are passed in.
 
 ### Shorthand
 
-For the sake of brevity, multiple runs can be scheduled in one XML element by putting one of the
+For the sake of brevity, multiple runs can be scheduled in one xml element by putting one of the
 following in the args field:
 
     NUM_PROPS
@@ -77,112 +81,5 @@
 
 ### Unit Tests
 
-`bionic-benchmarks` also has its own set of unit tests, which can be run from the binary in
+Bionic benchmarks also has its own set of unit tests, which can be run from the binary in
 `/data/nativetest[64]/bionic-benchmarks-tests`
-
-## Process startup time (bionic-spawn-benchmarks)
-
-The `spawn/` subdirectory has a few benchmarks measuring the time used to start simple programs
-(e.g. Toybox's `true` and `sh -c true`). Run it on a device like so:
-
-    m bionic-spawn-benchmarks
-    adb root
-    adb sync data
-    adb shell /data/benchmarktest/bionic-spawn-benchmarks/bionic-spawn-benchmarks
-    adb shell /data/benchmarktest64/bionic-spawn-benchmarks/bionic-spawn-benchmarks
-
-Google Benchmark reports both a real-time figure ("Time") and a CPU usage figure. For these
-benchmarks, the CPU measurement only counts time spent in the thread calling `posix_spawn`, not that
-spent in the spawned process. The real-time is probably more useful, and it is the figure used to
-determine the iteration count.
-
-Locking the CPU frequency seems to improve the results of these benchmarks significantly, and it
-reduces variability.
-
-## Google Benchmark notes
-
-### Repetitions
-
-Google Benchmark uses two settings to control how many times to run each benchmark, "iterations" and
-"repetitions". By default, the repetition count is one. Google Benchmark runs the benchmark a few
-times to determine a sufficiently-large iteration count.
-
-Google Benchmark can optionally run a benchmark run repeatedly and report statistics (median, mean,
-standard deviation) for the runs. To do so, pass the `--benchmark_repetitions` option, e.g.:
-
-    # ./bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll --benchmark_repetitions=4
-    ...
-    -------------------------------------------------------------------
-    Benchmark                         Time             CPU   Iterations
-    -------------------------------------------------------------------
-    BM_stdlib_strtoll              27.7 ns         27.7 ns     25290525
-    BM_stdlib_strtoll              27.7 ns         27.7 ns     25290525
-    BM_stdlib_strtoll              27.7 ns         27.7 ns     25290525
-    BM_stdlib_strtoll              27.8 ns         27.7 ns     25290525
-    BM_stdlib_strtoll_mean         27.7 ns         27.7 ns            4
-    BM_stdlib_strtoll_median       27.7 ns         27.7 ns            4
-    BM_stdlib_strtoll_stddev      0.023 ns        0.023 ns            4
-
-There are 4 runs, each with 25290525 iterations. Measurements for the individual runs can be
-suppressed if they aren't needed:
-
-    # ./bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll --benchmark_repetitions=4 --benchmark_report_aggregates_only
-    ...
-    -------------------------------------------------------------------
-    Benchmark                         Time             CPU   Iterations
-    -------------------------------------------------------------------
-    BM_stdlib_strtoll_mean         27.8 ns         27.7 ns            4
-    BM_stdlib_strtoll_median       27.7 ns         27.7 ns            4
-    BM_stdlib_strtoll_stddev      0.043 ns        0.043 ns            4
-
-### CPU frequencies
-
-To get consistent results between runs, it can sometimes be helpful to restrict a benchmark to
-specific cores, or to lock cores at specific frequencies. Some phones have a big.LITTLE core setup,
-or at least allow some cores to run at higher frequencies than others.
-
-A core can be selected for `bionic-benchmarks` using the `--bionic_cpu` option or using the
-`taskset` utility. e.g. A Pixel 3 device has 4 Kryo 385 Silver cores followed by 4 Gold cores:
-
-    blueline:/ # /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll --bionic_cpu=0
-    ...
-    ------------------------------------------------------------
-    Benchmark                  Time             CPU   Iterations
-    ------------------------------------------------------------
-    BM_stdlib_strtoll       64.2 ns         63.6 ns     11017493
-
-    blueline:/ # /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll --bionic_cpu=4
-    ...
-    ------------------------------------------------------------
-    Benchmark                  Time             CPU   Iterations
-    ------------------------------------------------------------
-    BM_stdlib_strtoll       21.8 ns         21.7 ns     33167103
-
-A similar result can be achieved using `taskset`. The first parameter is a bitmask of core numbers
-to pass to `sched_setaffinity`:
-
-    blueline:/ # taskset f /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll
-    ...
-    ------------------------------------------------------------
-    Benchmark                  Time             CPU   Iterations
-    ------------------------------------------------------------
-    BM_stdlib_strtoll       64.3 ns         63.6 ns     10998697
-
-    blueline:/ # taskset f0 /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=BM_stdlib_strtoll
-    ...
-    ------------------------------------------------------------
-    Benchmark                  Time             CPU   Iterations
-    ------------------------------------------------------------
-    BM_stdlib_strtoll       21.3 ns         21.2 ns     33094801
-
-To lock the CPU frequency, use the sysfs interface at `/sys/devices/system/cpu/cpu*/cpufreq/`.
-Changing the scaling governor to `performance` suppresses the warning that Google Benchmark
-otherwise prints:
-
-    ***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-
-Some devices have a `perf-setup.sh` script that locks CPU and GPU frequencies. Some TradeFed
-benchmarks appear to be using the script. For more information:
- * run `get_build_var BOARD_PERFSETUP_SCRIPT`
- * run `m perf-setup.sh` to install the script into `${OUT}/data/local/tmp/perf-setup.sh`
- * see: https://android.googlesource.com/platform/platform_testing/+/refs/heads/master/scripts/perf-setup/
diff --git a/benchmarks/ctype_benchmark.cpp b/benchmarks/ctype_benchmark.cpp
deleted file mode 100644
index eab0133..0000000
--- a/benchmarks/ctype_benchmark.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <ctype.h>
-
-#include <benchmark/benchmark.h>
-#include "util.h"
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y1, isalnum('A'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y2, isalnum('a'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y3, isalnum('0'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_n, isalnum('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_y1, isalpha('A'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_y2, isalpha('a'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_n, isalpha('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isascii_y, isascii('x'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isascii_n, isascii(0x88));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_y1, isblank(' '));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_y2, isblank('\t'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_n, isblank('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_y1, iscntrl('\b'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_y2, iscntrl('\x7f'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_n, iscntrl('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isdigit_y, iscntrl('0'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isdigit_n, iscntrl('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y1, isgraph('A'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y2, isgraph('a'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y3, isgraph('0'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y4, isgraph('_'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_n, isgraph(' '));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_islower_y, islower('x'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_islower_n, islower('X'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y1, isprint('A'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y2, isprint('a'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y3, isprint('0'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y4, isprint('_'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y5, isprint(' '));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_n, isprint('\b'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_ispunct_y, ispunct('_'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_ispunct_n, ispunct('A'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_y1, isspace(' '));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_y2, isspace('\t'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_n, isspace('A'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isupper_y, isupper('X'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isupper_n, isupper('x'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y1, isxdigit('0'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y2, isxdigit('a'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y3, isxdigit('A'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_n, isxdigit('_'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toascii_y, isascii('x'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toascii_n, isascii(0x88));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_tolower_y, tolower('X'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_tolower_n, tolower('x'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toupper_y, toupper('x'));
-BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toupper_n, toupper('X'));
diff --git a/benchmarks/dlfcn_benchmark.cpp b/benchmarks/dlfcn_benchmark.cpp
deleted file mode 100644
index 6a2bb57..0000000
--- a/benchmarks/dlfcn_benchmark.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <android-base/strings.h>
-#include <benchmark/benchmark.h>
-#include <dlfcn.h>
-
-#include "util.h"
-
-void local_function() {}
-
-template<typename F>
-int bm_dladdr(F fun) {
-    const void* addr = reinterpret_cast<void*>(fun);
-    Dl_info info;
-    int res = dladdr(addr, &info);
-    if (res == 0) abort();
-    if (info.dli_fname == nullptr) abort();
-
-    // needed for DoNotOptimize
-    return res;
-}
-BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libc_printf, bm_dladdr(printf));
-BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libdl_dladdr, bm_dladdr(dladdr));
-BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_local_function, bm_dladdr(local_function));
-BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libbase_split, bm_dladdr(android::base::Split));
diff --git a/benchmarks/inttypes_benchmark.cpp b/benchmarks/inttypes_benchmark.cpp
index b96384e..f123eb8 100644
--- a/benchmarks/inttypes_benchmark.cpp
+++ b/benchmarks/inttypes_benchmark.cpp
@@ -19,5 +19,16 @@
 #include <benchmark/benchmark.h>
 #include "util.h"
 
-BIONIC_TRIVIAL_BENCHMARK(BM_inttypes_strtoimax, strtoimax(" -123", nullptr, 0));
-BIONIC_TRIVIAL_BENCHMARK(BM_inttypes_strtoumax, strtoumax(" -123", nullptr, 0));
+void BM_inttypes_strtoimax(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    strtoimax(" -123", nullptr, 0);
+  }
+}
+BIONIC_BENCHMARK(BM_inttypes_strtoimax);
+
+void BM_inttypes_strtoumax(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    strtoumax(" -123", nullptr, 0);
+  }
+}
+BIONIC_BENCHMARK(BM_inttypes_strtoumax);
diff --git a/benchmarks/run-on-host.sh b/benchmarks/run-on-host.sh
index 89112ae..af96b27 100755
--- a/benchmarks/run-on-host.sh
+++ b/benchmarks/run-on-host.sh
@@ -8,7 +8,7 @@
         cd ${ANDROID_BUILD_TOP}
         export ANDROID_DATA=${TARGET_OUT_DATA}
         export ANDROID_ROOT=${TARGET_OUT}
-        ${HOST_OUT}/benchmarktest64/bionic-benchmarks-glibc/bionic-benchmarks-glibc "$@"
+        ${HOST_OUT}/nativetest64/bionic-benchmarks-glibc/bionic-benchmarks-glibc $@
     )
     exit 0
 elif [ "$1" != 32 -a "$1" != 64 ]; then
@@ -25,7 +25,7 @@
             cd ${ANDROID_BUILD_TOP}
             export ANDROID_DATA=${TARGET_OUT_DATA}
             export ANDROID_ROOT=${TARGET_OUT}
-            ${BENCHMARKS}/bionic-benchmarks/bionic-benchmarks "$@"
+            ${NATIVETEST}/bionic-benchmarks/bionic-benchmarks $@
         )
     else
         echo "$0 not supported on TARGET_ARCH=$TARGET_ARCH"
diff --git a/benchmarks/spawn/Android.bp b/benchmarks/spawn/Android.bp
deleted file mode 100644
index ecce8e8..0000000
--- a/benchmarks/spawn/Android.bp
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Copyright (C) 2019 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.
-//
-
-cc_benchmark {
-    name: "bionic-spawn-benchmarks",
-    srcs: ["spawn_benchmarks.cpp"],
-    static_libs: ["libbase"],
-
-    // Install these binaries in the same directory as the main benchmark binary.
-    data: [
-        ":bench_noop",
-        ":bench_noop_nostl",
-        ":bench_noop_static",
-    ],
-
-    host_supported: true,
-    target: {
-        darwin: { enabled: false },
-        windows: { enabled: false },
-        linux_glibc_x86: { enabled: false },
-    },
-}
-
-cc_defaults {
-    name: "noop_binary_defaults",
-
-    compile_multilib: "both",
-    multilib: {
-        lib32: { suffix: "32" },
-        lib64: { suffix: "64" },
-    },
-
-    host_supported: true,
-    target: {
-        darwin: { enabled: false },
-        windows: { enabled: false },
-        linux_glibc_x86: { enabled: false },
-    },
-}
-
-cc_binary {
-    defaults: ["noop_binary_defaults"],
-    name: "bench_noop",
-    srcs: ["noop.cpp"],
-
-    // When this binary is installed to host/linux-x86/bin, its runpath is ${ORIGIN}/../lib64, which
-    // is fine for finding host/linux-x86/lib64/libc++.so. When it's installed to
-    // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..".
-    target: {
-        linux_glibc_x86_64: {
-            ldflags: [
-                "-Wl,--rpath,${ORIGIN}/../../lib64",
-            ],
-        },
-    }
-}
-
-cc_binary {
-    defaults: ["noop_binary_defaults"],
-    name: "bench_noop_nostl",
-    srcs: ["noop.cpp"],
-    stl: "none",
-}
-
-cc_binary {
-    defaults: ["noop_binary_defaults"],
-    name: "bench_noop_static",
-    srcs: ["noop.cpp"],
-    static_executable: true,
-    stl: "libc++_static",
-}
diff --git a/benchmarks/spawn/AndroidTest.xml b/benchmarks/spawn/AndroidTest.xml
deleted file mode 100644
index 9331675..0000000
--- a/benchmarks/spawn/AndroidTest.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Runs bionic-spawn-benchmarks.">
-    <option name="test-suite-tag" value="apct" />
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-        <option name="cleanup" value="true" />
-        <option name="push" value="bionic-spawn-benchmarks->/data/local/tmp/bionic-spawn-benchmarks" />
-    </target_preparer>
-
-    <!-- TODO(b/120549168): This seems necessary for consistent results on a walleye, but it's not working with atest
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-        <option name="push" value="perf-setup.sh->/data/local/tmp/perf-setup.sh" />
-        <option name="post-push" value="chmod 755 /data/local/tmp/perf-setup.sh;/data/local/tmp/perf-setup.sh" />
-    </target_preparer>
-    -->
-
-    <test class="com.android.tradefed.testtype.GoogleBenchmarkTest" >
-        <option name="native-benchmark-device-path" value="/data/local/tmp" />
-        <option name="benchmark-module-name" value="bionic-spawn-benchmarks" />
-
-        <!-- The GoogleBenchmarkTest class ordinarily expects every file in the benchmark's
-             directory (recursively) to be a google-benchmark binary, so we need this setting to
-             avoid failing on the bench_* noop programs, which don't output benchmark results. -->
-        <option name="file-exclusion-filter-regex" value=".*/bench_[^/]*$"  />
-    </test>
-
-</configuration>
diff --git a/benchmarks/spawn/noop.cpp b/benchmarks/spawn/noop.cpp
deleted file mode 100644
index 1f1cac0..0000000
--- a/benchmarks/spawn/noop.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-int main() {
-  return 0;
-}
diff --git a/benchmarks/spawn/spawn_benchmarks.cpp b/benchmarks/spawn/spawn_benchmarks.cpp
deleted file mode 100644
index e8f7c17..0000000
--- a/benchmarks/spawn/spawn_benchmarks.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2019 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 <errno.h>
-#include <spawn.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <benchmark/benchmark.h>
-
-static std::string test_program(const char* name) {
-#if defined(__LP64__)
-  return android::base::GetExecutableDirectory() + "/" + name + "64";
-#else
-  return android::base::GetExecutableDirectory() + "/" + name + "32";
-#endif
-}
-
-extern char** environ;
-
-static void BM_spawn_test(benchmark::State& state, const char* const* argv) {
-  for (auto _ : state) {
-    pid_t child = 0;
-    if (int spawn_err = posix_spawn(&child, argv[0], nullptr, nullptr, const_cast<char**>(argv),
-                                    environ)) {
-      state.SkipWithError(android::base::StringPrintf(
-          "posix_spawn of %s failed: %s", argv[0], strerror(spawn_err)).c_str());
-      break;
-    }
-
-    int wstatus = 0;
-    const pid_t wait_result = TEMP_FAILURE_RETRY(waitpid(child, &wstatus, 0));
-    if (wait_result != child) {
-      state.SkipWithError(android::base::StringPrintf(
-          "waitpid on pid %d for %s failed: %s",
-          static_cast<int>(child), argv[0], strerror(errno)).c_str());
-      break;
-    }
-    if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 127) {
-      state.SkipWithError(android::base::StringPrintf("could not exec %s", argv[0]).c_str());
-      break;
-    }
-  }
-}
-
-#define SPAWN_BENCHMARK(name, ...)                                                    \
-    BENCHMARK_CAPTURE(BM_spawn_test, name, (const char*[]) { __VA_ARGS__, nullptr })  \
-        ->UseRealTime()                                                               \
-        ->Unit(benchmark::kMicrosecond)                                               \
-
-SPAWN_BENCHMARK(noop, test_program("bench_noop").c_str());
-SPAWN_BENCHMARK(noop_nostl, test_program("bench_noop_nostl").c_str());
-SPAWN_BENCHMARK(noop_static, test_program("bench_noop_static").c_str());
-
-// Android has a /bin -> /system/bin symlink, but use /system/bin explicitly so we can more easily
-// compare Bionic-vs-glibc on a Linux desktop machine.
-#if defined(__GLIBC__)
-
-SPAWN_BENCHMARK(bin_true, "/bin/true");
-SPAWN_BENCHMARK(sh_true, "/bin/sh", "-c", "true");
-
-#elif defined(__ANDROID__)
-
-SPAWN_BENCHMARK(system_bin_true, "/system/bin/true");
-SPAWN_BENCHMARK(vendor_bin_true, "/vendor/bin/true");
-SPAWN_BENCHMARK(system_sh_true, "/system/bin/sh", "-c", "true");
-SPAWN_BENCHMARK(vendor_sh_true, "/vendor/bin/sh", "-c", "true");
-
-#endif
-
-BENCHMARK_MAIN();
diff --git a/benchmarks/stdlib_benchmark.cpp b/benchmarks/stdlib_benchmark.cpp
index ec3f6f2..6afe7aa 100644
--- a/benchmarks/stdlib_benchmark.cpp
+++ b/benchmarks/stdlib_benchmark.cpp
@@ -216,9 +216,45 @@
 }
 BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc, "0");
 
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_atoi, atoi(" -123"));
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_atol, atol(" -123"));
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_strtol, strtol(" -123", nullptr, 0));
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_strtoll, strtoll(" -123", nullptr, 0));
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_strtoul, strtoul(" -123", nullptr, 0));
-BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_strtoull, strtoull(" -123", nullptr, 0));
+void BM_stdlib_atoi(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(atoi(" -123"));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_atoi);
+
+void BM_stdlib_atol(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(atol(" -123"));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_atol);
+
+void BM_stdlib_strtol(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(strtol(" -123", nullptr, 0));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_strtol);
+
+void BM_stdlib_strtoll(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(strtoll(" -123", nullptr, 0));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_strtoll);
+
+void BM_stdlib_strtoul(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(strtoul(" -123", nullptr, 0));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_strtoul);
+
+void BM_stdlib_strtoull(benchmark::State& state) {
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(strtoull(" -123", nullptr, 0));
+  }
+}
+BIONIC_BENCHMARK(BM_stdlib_strtoull);
+
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp
index d697dfd..98e8858 100644
--- a/benchmarks/unistd_benchmark.cpp
+++ b/benchmarks/unistd_benchmark.cpp
@@ -20,11 +20,37 @@
 #include <benchmark/benchmark.h>
 #include "util.h"
 
-BIONIC_TRIVIAL_BENCHMARK(BM_unistd_getpid, getpid());
-BIONIC_TRIVIAL_BENCHMARK(BM_unistd_getpid_syscall, syscall(__NR_getpid));
+static void BM_unistd_getpid(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    getpid();
+  }
+}
+BIONIC_BENCHMARK(BM_unistd_getpid);
 
-// TODO: glibc 2.30 added gettid() too.
+static void BM_unistd_getpid_syscall(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    syscall(__NR_getpid);
+  }
+}
+BIONIC_BENCHMARK(BM_unistd_getpid_syscall);
+
 #if defined(__BIONIC__)
-BIONIC_TRIVIAL_BENCHMARK(BM_unistd_gettid, gettid());
+
+// Stop GCC optimizing out our pure function.
+/* Must not be static! */ pid_t (*gettid_fp)() = gettid;
+
+static void BM_unistd_gettid(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    gettid_fp();
+  }
+}
+BIONIC_BENCHMARK(BM_unistd_gettid);
+
 #endif
-BIONIC_TRIVIAL_BENCHMARK(BM_unistd_gettid_syscall, syscall(__NR_gettid));
+
+void BM_unistd_gettid_syscall(benchmark::State& state) {
+  while (state.KeepRunning()) {
+    syscall(__NR_gettid);
+  }
+}
+BIONIC_BENCHMARK(BM_unistd_gettid_syscall);
diff --git a/benchmarks/util.h b/benchmarks/util.h
index ef4892d..0813acc 100644
--- a/benchmarks/util.h
+++ b/benchmarks/util.h
@@ -41,13 +41,6 @@
 #define BIONIC_BENCHMARK_WITH_ARG(n, arg) \
   int _bionic_benchmark_##n __attribute__((unused)) = EmplaceBenchmark(std::string(#n), reinterpret_cast<benchmark_func_t>(n), arg)
 
-#define BIONIC_TRIVIAL_BENCHMARK(__name, __expression) \
-  static void __name(benchmark::State& state) { \
-    for (auto _ : state) { \
-      benchmark::DoNotOptimize(__expression); \
-    } \
-  } \
-  BIONIC_BENCHMARK(__name)
 
 constexpr auto KB = 1024;
 
diff --git a/benchmarks/wctype_benchmark.cpp b/benchmarks/wctype_benchmark.cpp
deleted file mode 100644
index cdf5568..0000000
--- a/benchmarks/wctype_benchmark.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <wctype.h>
-
-#include <benchmark/benchmark.h>
-#include "util.h"
-
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towlower_ascii_y, towlower('X'));
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towlower_ascii_n, towlower('x'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towlower_unicode_y, towlower(0x0391));
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towlower_unicode_n, towlower(0x03b1));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towupper_ascii_y, towupper('x'));
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towupper_ascii_n, towupper('X'));
-
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towupper_unicode_y, towupper(0x03b1));
-BIONIC_TRIVIAL_BENCHMARK(BM_wctype_towupper_unicode_n, towupper(0x0391));
diff --git a/build/run-on-host.sh b/build/run-on-host.sh
index 0ca3b1e..c3a2751 100644
--- a/build/run-on-host.sh
+++ b/build/run-on-host.sh
@@ -1,62 +1,47 @@
-# source this script in bash
+#!/bin/bash -e
 
 source ${ANDROID_BUILD_TOP}/build/envsetup.sh
 
-# See envsetup.sh for an example of using --dumpvars-mode to set shell variables.
-eval "$(cd ${ANDROID_BUILD_TOP}; build/soong/soong_ui.bash --dumpvars-mode --vars="\
-    TARGET_ARCH \
-    TARGET_OUT \
-    TARGET_OUT_EXECUTABLES \
-    TARGET_OUT_DATA \
-    HOST_OS \
-    HOST_ARCH \
-    HOST_OUT \
-    ")"
+TARGET_ARCH=$(get_build_var TARGET_ARCH)
+TARGET_OUT=$(get_build_var TARGET_OUT)
+TARGET_OUT_EXECUTABLES=$(get_build_var TARGET_OUT_EXECUTABLES)
+TARGET_OUT_DATA=$(get_build_var TARGET_OUT_DATA)
+HOST_OS=$(get_build_var HOST_OS)
+HOST_ARCH=$(get_build_var HOST_ARCH)
+HOST_OUT=$(get_build_var HOST_OUT)
 
 function prepare()
 {
-    local BITS=$1
+    BITS=$1
     shift
 
-    BENCHMARKS=${TARGET_OUT_DATA}/benchmarktest
     NATIVETEST=${TARGET_OUT_DATA}/nativetest
     if [ "${BITS}" = 64 ]; then
-        BENCHMARKS=${BENCHMARKS}64
         NATIVETEST=${NATIVETEST}64
     fi
 
+    if [ ${TARGET_ARCH} = arm -o ${TARGET_ARCH} = mips -o ${TARGET_ARCH} = x86 ]; then
+        LINKER=${TARGET_OUT_EXECUTABLES}/linker
+    else
+        LINKER="${TARGET_OUT_EXECUTABLES}/linker64 ${TARGET_OUT_EXECUTABLES}/linker"
+    fi
+
     if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
-        m -j MODULES-IN-bionic MODULES-IN-external-icu MODULES-IN-external-mksh ${TARGET_OUT}/etc/hosts "$@"
+        m -j ${LINKER} ${TARGET_OUT}/etc/hosts ${TARGET_OUT_EXECUTABLES}/sh $@
 
         if [ ! -d /system ]; then
-            echo "Attempting to create /system"
-            sudo mkdir -p -m 0777 /system
-            mkdir -p -m 0777 /system/bin
-            mkdir -p -m 0777 /system/lib
-            mkdir -p -m 0777 /system/lib64
+            echo "Attempting to create /system";
+            sudo mkdir -p -m 0777 /system;
         fi
         (
-            function make_link() {
-                dir=$1
-                tgt=$2
-                name=`basename ${tgt}`
-                src=$dir/$name
-                if [ -e $tgt ]; then
-                    ln -sfT `realpath ${tgt}` $src
-                fi
-            }
             cd ${ANDROID_BUILD_TOP}
             mkdir -p ${TARGET_OUT_DATA}/local/tmp
-            for i in ${TARGET_OUT}/bin/bootstrap/* ${TARGET_OUT}/bin/*; do
-                make_link /system/bin ${i}
-            done
+            ln -fs `realpath ${TARGET_OUT}/bin` /system/
             ln -fs `realpath ${TARGET_OUT}/etc` /system/
-            for i in ${TARGET_OUT}/lib/bootstrap/* ${TARGET_OUT}/lib/*; do
-                make_link /system/lib ${i}
-            done
-            for i in ${TARGET_OUT}/lib64/bootstrap/* ${TARGET_OUT}/lib64/*; do
-                make_link /system/lib64 ${i}
-            done
+            ln -fs `realpath ${TARGET_OUT}/lib` /system/
+            if [ -d "${TARGET_OUT}/lib64" ]; then
+                ln -fs `realpath ${TARGET_OUT}/lib64` /system/;
+            fi
         )
     fi
 }
diff --git a/docs/defines.md b/docs/defines.md
deleted file mode 100644
index 4775cd2..0000000
--- a/docs/defines.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# When to use which `#define`
-
-Using `#ifdef` or equivalents is common when writing portable code. Which to use
-when can be quite tricky. This document describes the most common choices
-related to Android.
-
-## `__BIONIC__`
-
-If your code is specific to Android's C library, bionic, use `__BIONIC__`. This
-is typically a good choice when you use libc API that's only in bionic, such as
-the system property functions. Common alternatives on this dimension are
-`__GLIBC__`, `__APPLE__`, or `_WIN32`. Note that although bionic is most often
-seen on Android devices, it is possible to use bionic on the host too.
-
-## `__ANDROID__`
-
-If your code is specific to Android devices, use `__ANDROID__`. This isn't
-useful as you might think, and one of the other choices on this page is usually
-more appropriate. This is typically a good choice if you have code that's part
-of the OS and needs to behave differently on the host than on the device.
-Genuine cases are quite rare, and `__BIONIC__` is often more specific (but
-remember that it is possible -- if unusual -- to use bionic on the host).
-
-## `__ANDROID_API__`
-
-If your code can be built targeting a variety of different OS versions, use
-`__ANDROID_API__` to test which version you're building against. This is
-typically useful if you can use new NDK APIs when available, but don't require
-them if not.
-
-One thing to note (if your code may also be built as part of the OS itself) is
-that for most of the year, the OS builds with this set to 10,000 rather than the
-obvious "next" API level such as 19. Once the API level has been decided, the
-value of `__ANDROID_API__` drops to that number.
-
-## `__linux__`
-
-If your code requires a Linux kernel, use `__linux__`. This is typically a good
-choice when you use Linux-specific API, such as a Linux-specific system call or
-a file in `/proc`, but aren't restricted to just Android and would work equally
-well on a desktop Linux distro, say. Common alternatives on this dimension
-are `__APPLE__` or `_WIN32`.
-
-## `__ANDROID_NDK__`
-
-If your code can be built either as part of an app _or_ as part of the OS
-itself, use `__ANDROID_NDK__` to differentiate between those two circumstances.
-This is typically a good choice when your code uses non-NDK API if it's built as
-part of the OS, but sticks to just the NDK APIs otherwise.
-
-## `__NDK_MAJOR__`, `__NDK_MINOR__`, `__NDK_BETA__`, `__NDK_BUILD__`, `__NDK_CANARY__`
-
-If your code can be built with a variety of different NDK versions, and needs to
-work around issues with some of them, use these macros to detect the versinon of
-the NDK you're being built with. Usually only `__NDK_MAJOR__` will be necessary.
-
-## `__arm__`, `__aarch64__`, `__i386__`, `__x86_64__`
-
-If your code is specific to a particular processor architecture, use these
-macros to conditionally compile. Note that the ABI usually called `arm64` uses
-the macro `__aarch64__` and the ABI usually called `x86` uses `__i386__`.
-
-## `__LP32__` and `__LP64__`
-
-If your code depends on "bitness" -- whether `long` and pointers are 32- or
-64-bit -- use these macros to conditionally compile.
diff --git a/docs/native_allocator.md b/docs/native_allocator.md
deleted file mode 100644
index adfa6ef..0000000
--- a/docs/native_allocator.md
+++ /dev/null
@@ -1,362 +0,0 @@
-# Native Memory Allocator Verification
-This document describes how to verify the native memory allocator on Android.
-This procedure should be followed when upgrading or moving to a new allocator.
-A small minor upgrade might not need to run all of the benchmarks, however,
-at least the
-[SQL Allocation Trace Benchmark](#sql-allocation-trace-benchmark),
-[Memory Replay Benchmarks](#memory-replay-benchmarks) and
-[Performance Trace Benchmarks](#performance-trace-benchmarks) should be run.
-
-It is important to note that there are two modes for a native allocator
-to run in on Android. The first is the normal allocator, the second is
-called the svelte config, which is designed to run on memory constrained
-systems and be a bit slower, but take less RSS. To enable the svelte config,
-add this line to the `BoardConfig.mk` for the given target:
-
-    MALLOC_SVELTE := true
-
-The `BoardConfig.mk` file is usually found in the directory
-`device/<DEVICE_NAME>/` or in a sub directory.
-
-When evaluating a native allocator, make sure that you benchmark both
-versions.
-
-## Android Extensions
-Android supports a few non-standard functions and mallopt controls that
-a native allocator needs to implement.
-
-### Iterator Functions
-These are functions that are used to implement a memory leak detector
-called `libmemunreachable`.
-
-#### malloc\_disable
-This function, when called, should pause all threads that are making a
-call to an allocation function (malloc/free/etc). When a call
-is made to `malloc_enable`, the paused threads should start running again.
-
-#### malloc\_enable
-This function, when called, does nothing unless there was a previous call
-to `malloc_disable`. This call will unpause any thread which is making
-a call to an allocation function (malloc/free/etc) when `malloc_disable`
-was called previously.
-
-#### malloc\_iterate
-This function enumerates all of the allocations currently live in the
-system. It is meant to be called after a call to `malloc_disable` to
-prevent further allocations while this call is being executed. To
-see what is expected for this function, the best description is the
-tests for this funcion in `bionic/tests/malloc_itearte_test.cpp`.
-
-### Mallopt Extensions
-These are mallopt options that Android requires for a native allocator
-to work efficiently.
-
-#### M\_DECAY\_TIME
-When set to zero, `mallopt(M_DECAY_TIME, 0)`, it is expected that an
-allocator will attempt to purge and release any unused memory back to the
-kernel on free calls. This is important in Android to avoid consuming extra
-RSS.
-
-When set to non-zero, `mallopt(M_DECAY_TIME, 1)`, an allocator can delay the
-purge and release action. The amount of delay is up to the allocator
-implementation, but it should be a reasonable amount of time. The jemalloc
-allocator was implemented to have a one second delay.
-
-The drawback to this option is that most allocators do not have a separate
-thread to handle the purge, so the decay is only handled when an
-allocation operation occurs. For server processes, this can mean that
-RSS is slightly higher when the server is waiting for the next connection
-and no other allocation calls are made. The `M_PURGE` option is used to
-force a purge in this case.
-
-For all applications on Android, the call `mallopt(M_DECAY_TIME, 1)` is
-made by default. The idea is that it allows application frees to run a
-bit faster, while only increasing RSS a bit.
-
-#### M\_PURGE
-When called, `mallopt(M_PURGE, 0)`, an allocator should purge and release
-any unused memory immediately. The argument for this call is ignored. If
-possible, this call should clear thread cached memory if it exists. The
-idea is that this can be called to purge memory that has not been
-purged when `M_DECAY_TIME` is set to one. This is useful if you have a
-server application that does a lot of native allocations and the
-application wants to purge that memory before waiting for the next connection.
-
-## Correctness Tests
-These are the tests that should be run to verify an allocator is
-working properly according to Android.
-
-### Bionic Unit Tests
-The bionic unit tests contain a small number of allocator tests. These
-tests are primarily verifying Android extensions and non-standard behavior
-of allocation routines such as what happens when a non-power of two alignment
-is passed to memalign.
-
-To run all of the compliance tests:
-
-    adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter="malloc*"
-    adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter="malloc*"
-
-The allocation tests are not meant to be complete, so it is expected
-that a native allocator will have its own set of tests that can be run.
-
-### Libmemunreachable Tests
-The libmemunreachable tests verify that the iterator functions are working
-properly.
-
-To run all of the tests:
-
-    adb shell /data/nativetest64/memunreachable_binder_test/memunreachable_binder_test
-    adb shell /data/nativetest/memunreachable_binder_test/memunreachable_binder_test
-    adb shell /data/nativetest64/memunreachable_test/memunreachable_test
-    adb shell /data/nativetest/memunreachable_test/memunreachable_test
-    adb shell /data/nativetest64/memunreachable_unit_test/memunreachable_unit_test
-    adb shell /data/nativetest/memunreachable_unit_test/memunreachable_unit_test
-
-### CTS Entropy Test
-In addition to the bionic tests, there is also a CTS test that is designed
-to verify that the addresses returned by malloc are sufficiently randomized
-to help defeat potential security bugs.
-
-Run this test thusly:
-
-    atest AslrMallocTest
-
-If there are multiple devices connected to the system, use `-s <SERIAL>`
-to specify a device.
-
-## Performance
-There are multiple different ways to evaluate the performance of a native
-allocator on Android. One is allocation speed in various different scenarios,
-another is total RSS taken by the allocator.
-
-The last is virtual address space consumed in 32 bit applications. There is
-a limited amount of address space available in 32 bit apps, and there have
-been allocator bugs that cause memory failures when too much virtual
-address space is consumed. For 64 bit executables, this can be ignored.
-
-### Bionic Benchmarks
-These are the microbenchmarks that are part of the bionic benchmarks suite of
-benchmarks. These benchmarks can be built using this command:
-
-    mmma -j bionic/benchmarks
-
-These benchmarks are only used to verify the speed of the allocator and
-ignore anything related to RSS and virtual address space consumed.
-
-#### Allocate/Free Benchmarks
-These are the benchmarks to verify the allocation speed of a loop doing a
-single allocation, touching every page in the allocation to make it resident
-and then freeing the allocation.
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 0)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_free_default
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_free_default
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 1)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_free_decay1
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_free_decay1
-
-The last value in the output is the size of the allocation in bytes. It is
-useful to look at these kinds of benchmarks to make sure that there are
-no outliers, but these numbers should not be used to make a final decision.
-If these numbers are slightly worse than the current allocator, the
-single thread numbers from trace data is a better representative of
-real world situations.
-
-#### Multiple Allocations Retained Benchmarks
-These are the benchmarks that examine how the allocator handles multiple
-allocations of the same size at the same time.
-
-The first set of these benchmarks does a set number of 8192 byte allocations
-in one loop, and then frees all of the allocations at the end of the loop.
-Only the time it takes to do the allocations is recorded, the frees are not
-counted. The value of 8192 was chosen since the jemalloc native allocator
-had issues with this size. It is possible other sizes might show different
-results, but, as mentioned before, these microbenchmark numbers should
-not be used as absolutes for determining if an allocator is worth using.
-
-This benchmark is designed to verify that there is no performance issue
-related to having multiple allocations alive at the same time.
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 0)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_multiple_8192_allocs_default
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_multiple_8192_allocs_default
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 1)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_multiple_8192_allocs_decay1
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_multiple_8192_allocs_decay1
-
-For these benchmarks, the last parameter is the total number of allocations to
-do in each loop.
-
-The other variation of this benchmark is to always do forty allocations in
-each loop, but vary the size of the forty allocations. As with the other
-benchmark, only the time it takes to do the allocations is tracked, the
-frees are not counted. Forty allocations is an arbitrary number that could
-be modified in the future. It was chosen because a version of the native
-allocator, jemalloc, showed a problem at forty allocations.
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 0)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_forty_default
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_forty_default
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 1)`, use these command:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_forty_decay1
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=stdlib_malloc_forty_decay1
-
-For these benchmarks, the last parameter in the output is the size of the
-allocation in bytes.
-
-As with the other microbenchmarks, an allocator with numbers in the same
-proximity of the current values is usually sufficient to consider making
-a switch. The trace benchmarks are more important than these benchmarks
-since they simulate real world allocation profiles.
-
-#### SQL Allocation Trace Benchmark
-This benchmark is a trace of the allocations performed when running
-the SQLite BenchMark app.
-
-This benchmark is designed to verify that the allocator will be performant
-in a real world allocation scenario. SQL operations were chosen as a
-benchmark because these operations tend to do lots of malloc/realloc/free
-calls, and they tend to be on the critical path of applications.
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 0)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_sql_trace_default
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_sql_trace_default
-
-To run the benchmarks with `mallopt(M_DECAY_TIME, 1)`, use these commands:
-
-    adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_sql_trace_decay1
-    adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=malloc_sql_trace_decay1
-
-These numbers should be as performant as the current allocator.
-
-### Memory Trace Benchmarks
-These benchmarks measure all three axes of a native allocator, RSS, virtual
-address space consumed, speed of allocation. They are designed to
-run on a trace of the allocations from a real world application or system
-process.
-
-To build this benchmark:
-
-    mmma -j system/extras/memory_replay
-
-This will build two executables:
-
-    /system/bin/memory_replay32
-    /system/bin/memory_replay64
-
-And these two benchmark executables:
-
-    /data/benchmarktest64/trace_benchmark/trace_benchmark
-    /data/benchmarktest/trace_benchmark/trace_benchmark
-
-#### Memory Replay Benchmarks
-These benchmarks display RSS, virtual memory consumed (VA space), and do a
-bit of performance testing on actual traces taken from running applications.
-
-The trace data includes what thread does each operation, so the replay
-mechanism will simulate this by creating threads and replaying the operations
-on a thread as if it was rerunning the real trace. The only issue is that
-this is a worst case scenario for allocations happening at the same time
-in all threads since it collapses all of the allocation operations to occur
-one after another. This will cause a lot of threads allocating at the same
-time. The trace data does not include timestamps,
-so it is not possible to create a completely accurate replay.
-
-To generate these traces, see the [Malloc Debug documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md),
-the option [record\_allocs](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md#record_allocs_total_entries).
-
-To run these benchmarks, first copy the trace files to the target using
-these commands:
-
-    adb shell push system/extras/traces /data/local/tmp
-
-Since all of the traces come from applications, the `memory_replay` program
-will always call `mallopt(M_DECAY_TIME, 1)' before running the trace.
-
-Run the benchmark thusly:
-
-    adb shell memory_replay64 /data/local/tmp/traces/XXX.zip
-    adb shell memory_replay32 /data/local/tmp/traces/XXX.zip
-
-Where XXX.zip is the name of a zipped trace file. The `memory_replay`
-program also can process text files, but all trace files are currently
-checked in as zip files.
-
-Every 100000 allocation operations, a dump of the RSS and VA space will be
-performed. At the end, a final RSS and VA space number will be printed.
-For the most part, the intermediate data can be ignored, but it is always
-a good idea to look over the data to verify that no strange spikes are
-occurring.
-
-The performance number is a measure of the time it takes to perform all of
-the allocation calls (malloc/memalign/posix_memalign/realloc/free/etc).
-For any call that allocates a pointer, the time for the call and the time
-it takes to make the pointer completely resident in memory is included.
-
-The performance numbers for these runs tend to have a wide variability so
-they should not be used as absolute value for comparison against the
-current allocator. But, they should be in the same range as the current
-values.
-
-When evaluating an allocator, one of the most important traces is the
-camera.txt trace. The camera application does very large allocations,
-and some allocators might leave large virtual address maps around
-rather than delete them. When that happens, it can lead to allocation
-failures and would cause the camera app to abort/crash. It is
-important to verify that when running this trace using the 32 bit replay
-executable, the virtual address space consumed is not much larger than the
-current allocator. A small increase (on the order of a few MBs) would be okay.
-
-There is no specific benchmark for memory fragmentation, instead, the RSS
-when running the memory traces acts as a proxy for this. An allocator that
-is fragmenting badly will show an increase in RSS. The best trace for
-tracking fragmentation is system\_server.txt which is an extremely long
-trace (~13 million operations). The total number of live allocations goes
-up and down a bit, but stays mostly the same so an allocator that fragments
-badly would likely show an abnormal increase in RSS on this trace.
-
-NOTE: When a native allocator calls mmap, it is expected that the allocator
-will name the map using the call:
-
-    prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, <PTR>, <SIZE>, "libc_malloc");
-
-If the native allocator creates a different name, then it necessary to
-modify the file:
-
-    system/extras/memory_replay/NativeInfo.cpp
-
-The `GetNativeInfo` function needs to be modified to include the name
-of the maps that this allocator includes.
-
-In addition, in order for the frameworks code to keep track of the memory
-of a process, any named maps must be added to the file:
-
-    frameworks/base/core/jni/android_os_Debug.cpp
-
-Modify the `load_maps` function and add a check of the new expected name.
-
-#### Performance Trace Benchmarks
-This is a benchmark that treats the trace data as if all allocations
-occurred in a single thread. This is the scenario that could
-happen if all of the allocations are spaced out in time so no thread
-every does an allocation at the same time as another thread.
-
-Run these benchmarks thusly:
-
-    adb shell /data/benchmarktest64/trace_benchmark/trace_benchmark
-    adb shell /data/benchmarktest/trace_benchmark/trace_benchmark
-
-When run without any arguments, the benchmark will run over all of the
-traces and display data. It takes many minutes to complete these runs in
-order to get as accurate a number as possible.
diff --git a/docs/status.md b/docs/status.md
index 6968a18..d6a2f4c 100644
--- a/docs/status.md
+++ b/docs/status.md
@@ -1,11 +1,5 @@
 # Android bionic status
 
-This document details libc/libm/libdl additions and behavior changes.
-
-See also
-[Android linker changes for NDK developers](../android-changes-for-ndk-developers.md)
-for changes related to native code loading in various Android releases.
-
 ## Bionic function availability
 
 ### POSIX
@@ -43,12 +37,6 @@
 
 Current libc symbols: https://android.googlesource.com/platform/bionic/+/master/libc/libc.map.txt
 
-New libc functions in R (API level 30):
-  * Full C11 `<threads.h>` (available as inlines for older API levels).
-  * `memfd_create` and `mlock2` (GNU extensions).
-  * `renameat2` (GNU extension).
-  * `pthread_cond_clockwait`/`pthread_mutex_clocklock`/`pthread_rwlock_clockrdlock`/`pthread_rwlock_clockwrlock`/`sem_clockwait`
-
 New libc functions in Q (API level 29):
   * `timespec_get` (C11 `<time.h>` addition)
   * `reallocarray` (BSD/GNU extension in `<malloc.h>` and `<stdlib.h>`)
@@ -310,7 +298,7 @@
 The `_FORTIFY_SOURCE` macro can be used to enable extra
 automatic bounds checking for common libc functions. If a buffer
 overrun is detected, the program is safely aborted as in this
-[example](https://source.android.com/devices/tech/debug/native-crash#fortify).
+(example)[https://source.android.com/devices/tech/debug/native-crash#fortify].
 
 Note that in recent releases Android's FORTIFY has been extended to
 cover other issues. It can now detect, for example, passing `O_CREAT`
@@ -322,7 +310,7 @@
 all result in FORTIFY failures even for code not built with FORTIFY.
 
 More background information is available in our
-[FORTIFY in Android](https://android-developers.googleblog.com/2017/04/fortify-in-android.html)
+(FORTIFY in Android)[https://android-developers.googleblog.com/2017/04/fortify-in-android.html]
 blog post.
 
 The Android platform is built with `-D_FORTIFY_SOURCE=2`, but NDK users
diff --git a/libc/Android.bp b/libc/Android.bp
index c5ea4c5..a599028 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -24,7 +24,6 @@
 // ========================================================
 libc_common_src_files += [
     "bionic/ndk_cruft.cpp",
-    "bionic/ndk_cruft_data.cpp",
 ]
 
 libc_common_src_files_32 = [
@@ -66,6 +65,7 @@
     cppflags: [],
     include_dirs: [
         "bionic/libc/async_safe/include",
+        "external/jemalloc_new/include",
     ],
 
     stl: "none",
@@ -73,90 +73,29 @@
     sanitize: {
         address: false,
         integer_overflow: false,
-        // TODO(b/132640749): Fix broken fuzzer support.
-        fuzzer: false,
     },
     native_coverage: false,
     recovery_available: true,
-    native_bridge_supported: true,
 
     // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
     // warning since this is intended right now.
     ldflags: ["-Wl,-z,muldefs"],
-
-    product_variables: {
-        experimental_mte: {
-            cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
-        },
-    },
-}
-
-// Defaults for native allocator libs/includes to make it
-// easier to change.
-// To enable scudo, change the below to libc_scudo_defaults
-// and comment out the defaults line in libc_scudo shared
-// library.
-// ========================================================
-cc_defaults {
-    name: "libc_native_allocator_defaults",
-
-    defaults: ["libc_jemalloc5_defaults"],
-}
-
-cc_defaults {
-    name: "libc_jemalloc5_defaults",
-
-    include_dirs: [
-        "external/jemalloc_new/include",
-    ],
-
-    whole_static_libs: [
-        "libjemalloc5",
-        "libc_jemalloc_wrapper",
-    ],
-}
-
-// Functions not implemented by jemalloc directly, or that need to
-// be modified for Android.
-cc_library_static {
-    name: "libc_jemalloc_wrapper",
-    defaults: ["libc_defaults"],
-    srcs: ["bionic/jemalloc_wrapper.cpp"],
-    cflags: ["-fvisibility=hidden"],
-
-    include_dirs: [
-        "external/jemalloc_new/include",
-    ],
-}
-
-cc_defaults {
-    name: "libc_scudo_defaults",
-
-    cflags: [
-        "-DUSE_SCUDO",
-    ],
-
-    whole_static_libs: [
-        "libscudo",
-    ],
 }
 
 // ========================================================
-// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
+// libc_stack_protector.a - stack protector code
 // ========================================================
 //
-// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
-// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
-// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
-// -ffreestanding.
+// Code that implements the stack protector (or that runs
+// before TLS has been set up) needs to be compiled with
+// -fno-stack-protector, since it accesses the stack canary
+// TLS slot.
 
 cc_library_static {
 
     srcs: [
         "bionic/__libc_init_main_thread.cpp",
         "bionic/__stack_chk_fail.cpp",
-        "bionic/bionic_call_ifunc_resolver.cpp",
-        "bionic/getauxval.cpp",
     ],
     arch: {
         arm64: {
@@ -174,25 +113,20 @@
     },
 
     defaults: ["libc_defaults"],
-    cflags: ["-fno-stack-protector", "-ffreestanding"],
-    name: "libc_bootstrap",
+    cflags: ["-fno-stack-protector"],
+    name: "libc_stack_protector",
 }
 
-// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
-// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
-// the stack protector global variable.
+// libc_init_static.cpp also needs to be built without stack protector,
+// because it's responsible for setting up TLS for static executables.
+// This isn't the case for dynamic executables because the dynamic linker
+// has already set up the main thread's TLS.
 
 cc_library_static {
     name: "libc_init_static",
     defaults: ["libc_defaults"],
     srcs: ["bionic/libc_init_static.cpp"],
-    cflags: [
-        "-fno-stack-protector",
-
-        // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
-        // from the linker before ifunc resolvers have made string.h functions available.
-        "-ffreestanding",
-    ],
+    cflags: ["-fno-stack-protector"],
 }
 
 cc_library_static {
@@ -284,6 +218,8 @@
     defaults: ["libc_defaults"],
     srcs: [
         "upstream-freebsd/lib/libc/gen/ldexp.c",
+        "upstream-freebsd/lib/libc/gen/sleep.c",
+        "upstream-freebsd/lib/libc/gen/usleep.c",
         "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
         "upstream-freebsd/lib/libc/stdlib/hcreate.c",
         "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
@@ -334,7 +270,6 @@
                 "upstream-freebsd/lib/libc/string/wcscat.c",
                 "upstream-freebsd/lib/libc/string/wcscpy.c",
                 "upstream-freebsd/lib/libc/string/wmemcmp.c",
-                "upstream-freebsd/lib/libc/string/wmemset.c",
             ],
         },
     },
@@ -449,7 +384,10 @@
         "upstream-openbsd/lib/libc/gen/fnmatch.c",
         "upstream-openbsd/lib/libc/gen/ftok.c",
         "upstream-openbsd/lib/libc/gen/getprogname.c",
+        "upstream-openbsd/lib/libc/gen/isctype.c",
         "upstream-openbsd/lib/libc/gen/setprogname.c",
+        "upstream-openbsd/lib/libc/gen/tolower_.c",
+        "upstream-openbsd/lib/libc/gen/toupper_.c",
         "upstream-openbsd/lib/libc/gen/verr.c",
         "upstream-openbsd/lib/libc/gen/verrx.c",
         "upstream-openbsd/lib/libc/gen/vwarn.c",
@@ -791,6 +729,12 @@
 cc_library_static {
     defaults: ["libc_defaults"],
     srcs: [
+        // The data that backs getauxval is initialized in the libc init
+        // functions which are invoked by the linker. If this file is included
+        // in libc_ndk.a, only one of the copies of the global data will be
+        // initialized, resulting in nullptr dereferences.
+        "bionic/getauxval.cpp",
+
         // These require getauxval, which isn't available on older platforms.
         "bionic/sysconf.cpp",
         "bionic/vdso.cpp",
@@ -807,7 +751,6 @@
 
     arch: {
         arm: {
-            asflags: libc_common_flags + ["-mno-restrict-it"],
             srcs: [
                 "arch-arm/generic/bionic/memcmp.S",
                 "arch-arm/generic/bionic/memmove.S",
@@ -846,11 +789,13 @@
                 "arch-arm/cortex-a9/bionic/memset.S",
                 "arch-arm/cortex-a9/bionic/stpcpy.S",
                 "arch-arm/cortex-a9/bionic/strcat.S",
+                "arch-arm/cortex-a9/bionic/strcmp.S",
                 "arch-arm/cortex-a9/bionic/strcpy.S",
                 "arch-arm/cortex-a9/bionic/strlen.S",
 
                 "arch-arm/krait/bionic/memcpy.S",
                 "arch-arm/krait/bionic/memset.S",
+                "arch-arm/krait/bionic/strcmp.S",
 
                 "arch-arm/cortex-a53/bionic/memcpy.S",
 
@@ -861,28 +806,20 @@
         },
         arm64: {
             srcs: [
+                "arch-arm64/generic/bionic/memchr.S",
                 "arch-arm64/generic/bionic/memcmp.S",
                 "arch-arm64/generic/bionic/memcpy.S",
                 "arch-arm64/generic/bionic/memmove.S",
                 "arch-arm64/generic/bionic/memset.S",
                 "arch-arm64/generic/bionic/stpcpy.S",
+                "arch-arm64/generic/bionic/strchr.S",
+                "arch-arm64/generic/bionic/strcmp.S",
                 "arch-arm64/generic/bionic/strcpy.S",
+                "arch-arm64/generic/bionic/strlen.S",
+                "arch-arm64/generic/bionic/strncmp.S",
+                "arch-arm64/generic/bionic/strnlen.S",
                 "arch-arm64/generic/bionic/wmemmove.S",
 
-                "arch-arm64/default/bionic/memchr.S",
-                "arch-arm64/default/bionic/strchr.S",
-                "arch-arm64/default/bionic/strcmp.S",
-                "arch-arm64/default/bionic/strlen.S",
-                "arch-arm64/default/bionic/strncmp.S",
-                "arch-arm64/default/bionic/strnlen.S",
-
-                "arch-arm64/mte/bionic/memchr.c",
-                "arch-arm64/mte/bionic/strchr.cpp",
-                "arch-arm64/mte/bionic/strcmp.c",
-                "arch-arm64/mte/bionic/strlen.c",
-                "arch-arm64/mte/bionic/strncmp.c",
-                "arch-arm64/mte/bionic/strnlen.c",
-
                 "arch-arm64/bionic/__bionic_clone.S",
                 "arch-arm64/bionic/_exit_with_stack_teardown.S",
                 "arch-arm64/bionic/setjmp.S",
@@ -963,7 +900,6 @@
                 "arch-x86/generic/string/wcscat.c",
                 "arch-x86/generic/string/wcscpy.c",
                 "arch-x86/generic/string/wmemcmp.c",
-                "arch-x86/generic/string/wmemset.c",
 
                 "arch-x86/atom/string/sse2-memchr-atom.S",
                 "arch-x86/atom/string/sse2-memrchr-atom.S",
@@ -1012,9 +948,6 @@
                 "arch-x86/atom/string/ssse3-strcpy-atom.S",
                 "arch-x86/atom/string/ssse3-strncpy-atom.S",
                 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
-
-                // avx2 functions
-                "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
             ],
 
             exclude_srcs: [
@@ -1037,7 +970,6 @@
                 "arch-x86_64/string/sse4-memcmp-slm.S",
                 "arch-x86_64/string/ssse3-strcmp-slm.S",
                 "arch-x86_64/string/ssse3-strncmp-slm.S",
-                "arch-x86_64/string/avx2-wmemset-kbl.S",
 
                 "arch-x86_64/bionic/__bionic_clone.S",
                 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
@@ -1079,6 +1011,7 @@
         "bionic/__libc_current_sigrtmin.cpp",
         "bionic/abort.cpp",
         "bionic/accept.cpp",
+        "bionic/accept4.cpp",
         "bionic/access.cpp",
         "bionic/arpa_inet.cpp",
         "bionic/assert.cpp",
@@ -1099,6 +1032,7 @@
         "bionic/clock_getcpuclockid.cpp",
         "bionic/clock_nanosleep.cpp",
         "bionic/clone.cpp",
+        "bionic/connect.cpp",
         "bionic/ctype.cpp",
         "bionic/dirent.cpp",
         "bionic/dup2.cpp",
@@ -1191,9 +1125,10 @@
         "bionic/sigaction.cpp",
         "bionic/signal.cpp",
         "bionic/sigprocmask.cpp",
-        "bionic/sleep.cpp",
+        "bionic/socket.cpp",
         "bionic/spawn.cpp",
         "bionic/stat.cpp",
+        "bionic/statvfs.cpp",
         "bionic/stdlib_l.cpp",
         "bionic/strchrnul.cpp",
         "bionic/strerror.cpp",
@@ -1210,8 +1145,6 @@
         "bionic/sys_sem.cpp",
         "bionic/sys_shm.cpp",
         "bionic/sys_signalfd.cpp",
-        "bionic/sys_statfs.cpp",
-        "bionic/sys_statvfs.cpp",
         "bionic/sys_time.cpp",
         "bionic/sysinfo.cpp",
         "bionic/syslog.cpp",
@@ -1221,12 +1154,10 @@
         "bionic/tdestroy.cpp",
         "bionic/termios.cpp",
         "bionic/thread_private.cpp",
-        "bionic/threads.cpp",
         "bionic/timespec_get.cpp",
         "bionic/tmpfile.cpp",
         "bionic/umount.cpp",
         "bionic/unlink.cpp",
-        "bionic/usleep.cpp",
         "bionic/wait.cpp",
         "bionic/wchar.cpp",
         "bionic/wchar_l.cpp",
@@ -1262,7 +1193,7 @@
 // ========================================================
 // libc_pthread.a - pthreads parts that previously lived in
 // libc_bionic.a. Relocated to their own library because
-// they can't be included in libc_ndk.a (as the layout of
+// they can't be included in libc_ndk.a (as they layout of
 // pthread_t has changed over the years and has ABI
 // compatibility issues).
 // ========================================================
@@ -1311,53 +1242,27 @@
 // libc_syscalls.a
 // ========================================================
 
-genrule {
-    name: "syscalls-arm.S",
-    out: ["syscalls-arm.S"],
-    srcs: ["SYSCALLS.TXT"],
-    tool_files: [":bionic-gensyscalls"],
-    cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
-}
-
-genrule {
-    name: "syscalls-arm64.S",
-    out: ["syscalls-arm64.S"],
-    srcs: ["SYSCALLS.TXT"],
-    tool_files: [":bionic-gensyscalls"],
-    cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
-}
-
-genrule {
-    name: "syscalls-x86.S",
-    out: ["syscalls-x86.S"],
-    srcs: ["SYSCALLS.TXT"],
-    tool_files: [":bionic-gensyscalls"],
-    cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
-}
-
-genrule {
-    name: "syscalls-x86_64.S",
-    out: ["syscalls-x86_64.S"],
-    srcs: ["SYSCALLS.TXT"],
-    tool_files: [":bionic-gensyscalls"],
-    cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
-}
-
 cc_library_static {
     defaults: ["libc_defaults"],
     srcs: ["bionic/__set_errno.cpp"],
     arch: {
         arm: {
-            srcs: [":syscalls-arm.S"],
+            srcs: ["arch-arm/syscalls/**/*.S"],
         },
         arm64: {
-            srcs: [":syscalls-arm64.S"],
+            srcs: ["arch-arm64/syscalls/**/*.S"],
+        },
+        mips: {
+            srcs: ["arch-mips/syscalls/**/*.S"],
+        },
+        mips64: {
+            srcs: ["arch-mips64/syscalls/**/*.S"],
         },
         x86: {
-            srcs: [":syscalls-x86.S"],
+            srcs: ["arch-x86/syscalls/**/*.S"],
         },
         x86_64: {
-            srcs: [":syscalls-x86_64.S"],
+            srcs: ["arch-x86_64/syscalls/**/*.S"],
         },
     },
     name: "libc_syscalls",
@@ -1395,10 +1300,7 @@
 
 cc_library_static {
     name: "libc_ndk",
-    defaults: [
-        "libc_defaults",
-        "libc_native_allocator_defaults",
-    ],
+    defaults: ["libc_defaults"],
     srcs: libc_common_src_files + [
         "bionic/malloc_common.cpp",
         "bionic/malloc_limit.cpp",
@@ -1427,17 +1329,19 @@
 
     whole_static_libs: [
         "libc_bionic_ndk",
-        "libc_bootstrap",
         "libc_fortify",
         "libc_freebsd",
         "libc_freebsd_large_stack",
         "libc_gdtoa",
+        "libc_malloc",
         "libc_netbsd",
         "libc_openbsd_large_stack",
         "libc_openbsd_ndk",
+        "libc_stack_protector",
         "libc_syscalls",
         "libc_tzcode",
         "libm",
+        "libjemalloc5",
         "libstdc++",
     ],
 }
@@ -1458,16 +1362,17 @@
     whole_static_libs: [
         "libc_bionic",
         "libc_bionic_ndk",
-        "libc_bootstrap",
         "libc_dns",
         "libc_fortify",
         "libc_freebsd",
         "libc_freebsd_large_stack",
         "libc_gdtoa",
+        "libc_malloc",
         "libc_netbsd",
         "libc_openbsd",
         "libc_openbsd_large_stack",
         "libc_openbsd_ndk",
+        "libc_stack_protector",
         "libc_syscalls",
         "libc_tzcode",
         "libstdc++",
@@ -1495,11 +1400,11 @@
 }
 
 // ========================================================
-// libc_static_dispatch.a
+// libc_common_static.a For static binaries.
 // ========================================================
 cc_library_static {
     defaults: ["libc_defaults"],
-    name: "libc_static_dispatch",
+    name: "libc_common_static",
 
     arch: {
         x86: {
@@ -1508,47 +1413,10 @@
         arm: {
             srcs: ["arch-arm/static_function_dispatch.S"],
         },
-        arm64: {
-            srcs: ["arch-arm64/static_function_dispatch.S"],
-        },
     },
-}
-
-// ========================================================
-// libc_dynamic_dispatch.a
-// ========================================================
-cc_library_static {
-    defaults: ["libc_defaults"],
-    name: "libc_dynamic_dispatch",
-
-    cflags: [
-        "-ffreestanding",
-        "-fno-stack-protector",
-        "-fno-jump-tables",
-    ],
-    arch: {
-        x86: {
-            srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
-        },
-        arm: {
-            srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
-        },
-        arm64: {
-            srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
-        },
-    },
-}
-
-// ========================================================
-// libc_common_static.a For static binaries.
-// ========================================================
-cc_library_static {
-    defaults: ["libc_defaults"],
-    name: "libc_common_static",
 
     whole_static_libs: [
         "libc_common",
-        "libc_static_dispatch",
     ],
 }
 
@@ -1559,47 +1427,64 @@
     defaults: ["libc_defaults"],
     name: "libc_common_shared",
 
-    whole_static_libs: [
-        "libc_common",
-        "libc_dynamic_dispatch",
+    cflags: [
+        "-fno-stack-protector",
+        "-fno-jump-tables",
     ],
-}
-
-// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
-// executable.
-cc_library_static {
-    name: "libc_unwind_static",
-    defaults: ["libc_defaults"],
-    cflags: ["-DLIBC_STATIC"],
-
-    srcs: ["bionic/dl_iterate_phdr_static.cpp"],
     arch: {
-        // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
+        x86: {
+            srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
+        },
         arm: {
-            srcs: ["arch-arm/bionic/exidx_static.c"],
+            srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
         },
     },
+
+    whole_static_libs: [
+        "libc_common",
+    ],
 }
 
 // ========================================================
 // libc_nomalloc.a
 // ========================================================
 //
-// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
-// excludes functions selected using ifunc's (e.g. for string.h). Link in either
-// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
+// This is a version of the static C library that does not
+// include malloc. It's useful in situations when the user wants
+// to provide their own malloc implementation, or wants to
+// explicitly disallow the use of malloc, such as in the
+// dynamic linker.
 
 cc_library_static {
     name: "libc_nomalloc",
+
     defaults: ["libc_defaults"],
 
+    arch: {
+        arm: {
+            srcs: ["arch-arm/bionic/exidx_static.c"],
+        },
+    },
+
+    cflags: ["-DLIBC_STATIC"],
+
     whole_static_libs: [
-        "libc_common",
+        "libc_common_static",
         "libc_init_static",
-        "libc_unwind_static",
     ],
 }
 
+// ========================================================
+// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
+// ========================================================
+cc_library_static {
+    defaults: ["libc_defaults"],
+    srcs: ["bionic/jemalloc_wrapper.cpp"],
+    cflags: ["-fvisibility=hidden"],
+
+    name: "libc_malloc",
+}
+
 filegroup {
     name: "libc_sources_shared",
     srcs: [
@@ -1618,6 +1503,7 @@
 filegroup {
     name: "libc_sources_static",
     srcs: [
+        "bionic/dl_iterate_phdr_static.cpp",
         "bionic/malloc_common.cpp",
         "bionic/malloc_limit.cpp",
     ],
@@ -1631,14 +1517,16 @@
     ],
 }
 
+filegroup {
+    name: "libc_sources_static_arm",
+    srcs: [ "arch-arm/bionic/exidx_static.c" ],
+}
+
 // ========================================================
 // libc.a + libc.so
 // ========================================================
 cc_library {
-    defaults: [
-        "libc_defaults",
-        "libc_native_allocator_defaults",
-    ],
+    defaults: ["libc_defaults"],
     name: "libc",
     static_ndk_lib: true,
     export_include_dirs: ["include"],
@@ -1653,7 +1541,6 @@
         whole_static_libs: [
             "libc_init_static",
             "libc_common_static",
-            "libc_unwind_static",
         ],
     },
     shared: {
@@ -1664,10 +1551,13 @@
         ],
     },
 
-    required: [
-        "tzdata",
-        "tz_version", // Version metadata for tzdata to help debugging.
-    ],
+    required: ["tzdata"],
+
+    // Leave the symbols in the shared library so that stack unwinders can produce
+    // meaningful name resolution.
+    strip: {
+        keep_symbols: true,
+    },
 
     // Do not pack libc.so relocations; see http://b/20645321 for details.
     pack_relocations: false,
@@ -1687,6 +1577,9 @@
     static_libs: [
         "libdl_android",
     ],
+    whole_static_libs: [
+        "libjemalloc5",
+    ],
 
     nocrt: true,
 
@@ -1703,23 +1596,12 @@
                 // special for arm
                 cflags: ["-DCRT_LEGACY_WORKAROUND"],
             },
-
-            // Arm 32 bit does not produce complete exidx unwind information
-            // so keep the .debug_frame which is relatively small and does
-            // include needed unwind information.
-            // See b/132992102 for details.
-            strip: {
-                keep_symbols_and_debug_frame: true,
+            static: {
+                srcs: [":libc_sources_static_arm"],
             },
         },
         arm64: {
             version_script: ":libc.arm64.map",
-
-            // Leave the symbols in the shared library so that stack unwinders can produce
-            // meaningful name resolution.
-            strip: {
-                keep_symbols: true,
-            },
         },
         x86: {
             // TODO: This is to work around b/24465209. Remove after root cause is fixed.
@@ -1727,21 +1609,9 @@
             ldflags: ["-Wl,--hash-style=both"],
 
             version_script: ":libc.x86.map",
-
-            // Leave the symbols in the shared library so that stack unwinders can produce
-            // meaningful name resolution.
-            strip: {
-                keep_symbols: true,
-            },
         },
         x86_64: {
             version_script: ":libc.x86_64.map",
-
-            // Leave the symbols in the shared library so that stack unwinders can produce
-            // meaningful name resolution.
-            strip: {
-                keep_symbols: true,
-            },
         },
     },
 
@@ -1750,14 +1620,7 @@
         versions: ["10000"],
     },
 
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
-
-    // Sorting bss symbols by size usually results in less dirty pages at run
-    // time, because small symbols are grouped together.
-    sort_bss_symbols_by_size: true,
+    symbol_ordering_file: "symbol_ordering",
 }
 
 genrule {
@@ -1792,27 +1655,6 @@
     cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
 }
 
-// Headers that only other parts of the platform can include.
-cc_library_headers {
-    name: "bionic_libc_platform_headers",
-    visibility: [
-        "//art:__subpackages__",
-        "//bionic/libc:__subpackages__",
-        "//frameworks:__subpackages__",
-        "//external/perfetto:__subpackages__",
-        "//external/scudo:__subpackages__",
-    ],
-    host_supported: true,
-    recovery_available: true,
-    native_bridge_supported: true,
-    export_include_dirs: [
-        "platform",
-    ],
-    system_shared_libs: [],
-    stl: "none",
-    sdk_version: "current",
-}
-
 // libc_headers for libasync_safe and libpropertyinfoparser
 cc_library_headers {
     name: "libc_headers",
@@ -1820,9 +1662,9 @@
     host_supported: true,
     vendor_available: true,
     recovery_available: true,
-    native_bridge_supported: true,
 
     no_libcrt: true,
+    no_libgcc: true,
     stl: "none",
     system_shared_libs: [],
 
@@ -1952,16 +1794,12 @@
     defaults: ["linux_bionic_supported"],
     vendor_available: true,
     recovery_available: true,
-    native_bridge_supported: true,
 
     cflags: [
         "-Wno-gcc-compat",
         "-Wall",
         "-Werror",
     ],
-    sanitize: {
-        never: true,
-    },
 }
 
 cc_defaults {
@@ -2214,7 +2052,6 @@
 
 ndk_library {
     name: "libc",
-    native_bridge_supported: true,
     symbol_file: "libc.map.txt",
     first_version: "9",
 }
@@ -2224,7 +2061,6 @@
     symbol_file: "libc.map.txt",
     export_headers_as_system: true,
     export_preprocessed_headers: ["include"],
-    native_bridge_supported: true,
     export_include_dirs: [
         "kernel/android/uapi",
         "kernel/uapi",
@@ -2358,7 +2194,8 @@
     ],
 }
 
-// Generate the C++ policy sources for app and system seccomp-bpf filters.
+// Generate the C++ policy sources for app, system, and global seccomp-bpf
+// filters.
 python_binary_host {
     name: "genseccomp",
     main: "tools/genseccomp.py",
@@ -2528,6 +2365,38 @@
     ],
 }
 
+cc_genrule {
+    name: "libseccomp_policy_global_sources",
+    recovery_available: true,
+    cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
+
+    tools: [ "genseccomp" ],
+
+    srcs: [
+        "SYSCALLS.TXT",
+        "SECCOMP_WHITELIST_COMMON.TXT",
+        "SECCOMP_WHITELIST_SYSTEM.TXT",
+        "SECCOMP_WHITELIST_APP.TXT",
+        "SECCOMP_WHITELIST_GLOBAL.TXT",
+        "SECCOMP_BLACKLIST_COMMON.TXT",
+        ":libseccomp_gen_syscall_nrs_arm",
+        ":libseccomp_gen_syscall_nrs_arm64",
+        ":libseccomp_gen_syscall_nrs_mips",
+        ":libseccomp_gen_syscall_nrs_mips64",
+        ":libseccomp_gen_syscall_nrs_x86",
+        ":libseccomp_gen_syscall_nrs_x86_64",
+    ],
+
+    out: [
+        "arm64_global_policy.cpp",
+        "arm_global_policy.cpp",
+        "mips64_global_policy.cpp",
+        "mips_global_policy.cpp",
+        "x86_64_global_policy.cpp",
+        "x86_global_policy.cpp",
+    ],
+}
+
 cc_library {
     name: "libseccomp_policy",
     recovery_available: true,
@@ -2535,6 +2404,7 @@
     generated_sources: [
         "libseccomp_policy_app_sources",
         "libseccomp_policy_app_zygote_sources",
+        "libseccomp_policy_global_sources",
         "libseccomp_policy_system_sources",
     ],
 
@@ -2557,8 +2427,9 @@
 
 // This is a temporary library that will use scudo as the native memory
 // allocator. To use it, add it as the first shared library.
-cc_defaults {
-    name: "libc_scudo_wrapper_defaults",
+cc_library_shared {
+    name: "libc_scudo",
+    vendor_available: true,
     srcs: [
         "bionic/malloc_common.cpp",
         "bionic/malloc_common_dynamic.cpp",
@@ -2568,27 +2439,31 @@
         "bionic/__set_errno.cpp",
     ],
     cflags: ["-DUSE_SCUDO"],
-    shared_libs: ["libscudo_wrapper"],
+    stl: "none",
+    system_shared_libs: [],
 
     header_libs: ["libc_headers"],
 
     static_libs: ["libasync_safe"],
 
+    allow_undefined_symbols: true,
+    shared_libs: ["libscudo_wrapper"],
+
     arch: {
         arm: {
-            srcs: [":syscalls-arm.S"],
+            srcs: ["arch-arm/syscalls/__rt_sigprocmask.S"],
         },
         arm64: {
-            srcs: [":syscalls-arm64.S"],
+            srcs: ["arch-arm64/syscalls/__rt_sigprocmask.S"],
         },
         x86: {
             srcs: [
                 "arch-x86/bionic/__libc_init_sysinfo.cpp",
-                ":syscalls-x86.S",
+                "arch-x86/syscalls/__rt_sigprocmask.S",
             ],
         },
         x86_64: {
-            srcs: [":syscalls-x86_64.S"],
+            srcs: ["arch-x86_64/syscalls/__rt_sigprocmask.S"],
         },
     },
 
@@ -2597,18 +2472,6 @@
     ldflags: ["-Wl,-z,global"],
 }
 
-cc_library_shared {
-    name: "libc_scudo",
-    defaults: ["libc_scudo_wrapper_defaults"],
-    vendor_available: true,
-    stl: "none",
-    system_shared_libs: [],
-
-    allow_undefined_symbols: true,
-    // Like libc, disable native coverage for libc_scudo.
-    native_coverage: false,
-}
-
 subdirs = [
     "bionic/scudo",
 ]
diff --git a/libc/NOTICE b/libc/NOTICE
index d9ac638..120c4fd 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -418,6 +418,50 @@
 
 -------------------------------------------------------------------
 
+Copyright (C) 2007 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
+Copyright (C) 2007 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in
+   the documentation and/or other materials provided with the
+   distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
 Copyright (C) 2008 The Android Open Source Project
 
 Licensed under the Apache License, Version 2.0 (the "License");
@@ -1025,22 +1069,6 @@
 -------------------------------------------------------------------
 
 Copyright (C) 2019 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 The Android Open Source Project
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -1068,34 +1096,6 @@
 
 -------------------------------------------------------------------
 
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in
-   the documentation and/or other materials provided with the
-   distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
 Copyright (c) 1980, 1983, 1988, 1993
    The Regents of the University of California.  All rights reserved.
 
@@ -5374,34 +5374,6 @@
 
 -------------------------------------------------------------------
 
-Copyright (c) 2012-2014 ARM Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. The name of the company may not be used to endorse or promote
-   products derived from this software without specific prior written
-   permission.
-
-THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
 Copyright (c) 2013
      MIPS Technologies, Inc., California.
 
diff --git a/libc/SECCOMP_WHITELIST_COMMON.TXT b/libc/SECCOMP_WHITELIST_COMMON.TXT
index 07f84a8..2faa559 100644
--- a/libc/SECCOMP_WHITELIST_COMMON.TXT
+++ b/libc/SECCOMP_WHITELIST_COMMON.TXT
@@ -32,7 +32,6 @@
 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	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
@@ -55,54 +54,33 @@
 # Needed for debugging 32-bit Chrome
 int	pipe:pipe(int pipefd[2])	arm,x86,mips
 
-# Needed by breakpad (b/34813887).
+# 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
 
-# Needed by sanitizers (b/34606909, b/136777266).
-int open:open(const char*, int, ...)  arm,x86,x86_64
-int stat64:stat64(const char*, struct stat64*)  arm,x86
-ssize_t readlink:readlink(const char*, char*, size_t)  arm,x86,x86_64
+# syscalls needed to boot android
+int	sigreturn:sigreturn(unsigned long __unused)	arm,x86,mips
 
-#
+# Needed by sanitizers (b/34606909)
+# 5 (__NR_open) and 195 (__NR_stat64) are also required, but they are
+# already allowed.
+ssize_t	readlink:readlink(const char *path, char *buf, size_t bufsiz)	arm,x86,x86_64,mips
+
+# Probed for and conditionally used by ART.
+int membarrier(int cmd, int flags) all
+
 # Useful new syscalls which we don't yet use in bionic.
-#
-
-# Since Linux 2.5, not in glibc.
+int sched_getattr(pid_t pid, struct sched_attr* attr, unsigned int flags) all
+int sched_setattr(pid_t pid, struct sched_attr* attr, unsigned int size, unsigned int flags) all
+int memfd_create(const char* name, unsigned int flags) all
+int renameat2(int olddirfd, const char* oldpath, int newdirfd, const char* newpath, unsigned int flags)  all
+int execveat(int dirfd, const char* pathname, char* const* argv, char* const* envp, int flags)  all
+ssize_t copy_file_range(int fd_in, loff_t* off_in, int fd_out, loff_t* off_out, size_t len, unsigned int flags) all
+int mlock2(const void* addr, size_t len, int flags) all
+ssize_t preadv2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
+ssize_t pwritev2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
 int io_setup(unsigned nr, aio_context_t *ctxp) all
 int io_destroy(aio_context_t ctx) all
 int io_submit(aio_context_t ctx, long nr,  struct iocb **iocbpp) all
 int io_getevents(aio_context_t ctx, long min_nr, long max_nr, struct io_event *events, struct timespec *timeout) all
 int io_cancel(aio_context_t ctx, struct iocb *, struct io_event *result) all
-# Since Linux 3.14, not in glibc.
-int sched_getattr(pid_t pid, struct sched_attr* attr, unsigned int flags) all
-int sched_setattr(pid_t pid, struct sched_attr* attr, unsigned int size, unsigned int flags) all
-# Since Linux 3.19, not in glibc (and not really needed to implement fexecve).
-int execveat(int dirfd, const char* pathname, char* const* argv, char* const* envp, int flags)  all
-# Since Linux 4.3, not in glibc. Probed for and conditionally used by ART.
-int membarrier(int cmd, int flags) all
-# Since Linux 4.5, glibc 2.27.
-ssize_t copy_file_range(int fd_in, loff_t* off_in, int fd_out, loff_t* off_out, size_t len, unsigned int flags) all
-# Since Linux 4.6, glibc 2.26.
-ssize_t preadv2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
-ssize_t pwritev2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
-# Since Linux 4.11, glibc 2.30.
-int statx(int, const char*, int, unsigned int, statx*) all
-# Since Linux 5.1, not in glibc.
-int clock_gettime64(clockid_t, timespec64*) lp32
-int clock_settime64(clockid_t, const timespec64*) lp32
-int clock_adjtime64(clockid_t, timex64*) lp32
-int clock_getres_time64(clockid_t, timespec64*) lp32
-int clock_nanosleep_time64(clockid_t, int, const timespec64*, timespec*) lp32
-int timer_gettime64(__kernel_timer_t, itimerspec64*) lp32
-int timer_settime64(__kernel_timer_t, int, const itimerspec64*, itimerspec64*) lp32
-int timerfd_gettime64(int, itimerspec64*) lp32
-int timerfd_settime64(int, int, const itimerspec64*, itimerspec64*) lp32
-int utimensat_time64(int, const char*, const timespec64[2], int) lp32
-int pselect6_time64(int, fd_set*, fd_set*, timespec64*, void*) lp32
-int ppoll_time64(pollfd*, unsigned int, timespec64*, const sigset64_t*, size_t) lp32
-int recvmmsg_time64(int, mmsghdr*, unsigned int, int, const timespec64*) lp32
-int semtimedop_time64(int, sembuf*, size_t, const timespec64*) lp32
-int rt_sigtimedwait_time64(const sigset64_t*, siginfo_t*, const timespec64*, size_t) lp32
-int futex_time64(int*, int, int, const timespec64*, int*, int) lp32
-int sched_rr_get_interval_time64(pid_t, timespec64*) lp32
diff --git a/libc/SECCOMP_WHITELIST_GLOBAL.TXT b/libc/SECCOMP_WHITELIST_GLOBAL.TXT
new file mode 100644
index 0000000..f3e5a98
--- /dev/null
+++ b/libc/SECCOMP_WHITELIST_GLOBAL.TXT
@@ -0,0 +1,18 @@
+# This file is used to populate seccomp's global whitelist policy in
+# combination with SYSCALLS.TXT, SECCOMP_BLACKLIST.TXT and
+# SECCOMP_WHITELIST.TXT.  Unlike the policy used in normal operation this
+# policy is applied globally during the early stage of init, if global seccomp
+# is enabled.
+#
+# See the description at the top of SYSCALLS.TXT for an explanation of the
+# format of the entries in this file.
+#
+# This file is processed by a python script named genseccomp.py.
+
+# syscalls needed to boot android
+int swapon(const char*, int) all
+long keyctl(int, ...) all
+key_serial_t add_key(const char*, const char*, const void*, size_t, key_serial_t) all
+
+# b/62715671
+int finit_module(int, const char*, int) all
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 21ebdbd..772f0e7 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -22,8 +22,7 @@
 #
 #      - Each parameter type is assumed to be stored in 32 bits.
 #
-# This file is processed by a python script named gensyscalls.py, run via
-# genrules in Android.bp.
+# This file is processed by a python script named gensyscalls.py.
 
 int     execve(const char*, char* const*, char* const*)  all
 
@@ -105,16 +104,14 @@
 ssize_t     __pwritev64:pwritev(int, const struct iovec*, int, long, long) lp32
 ssize_t     pwritev|pwritev64(int, const struct iovec*, int, off_t) lp64
 
-int         __close:close(int)  all
+int         ___close:close(int)  all
 pid_t       __getpid:getpid()  all
-int memfd_create(const char*, unsigned) all
 int         munmap(void*, size_t)  all
-void*       __mremap:mremap(void*, size_t, size_t, int, void*)  all
+void*       ___mremap:mremap(void*, size_t, size_t, int, void*)  all
 int         msync(const void*, size_t, int)    all
 int         mprotect(const void*, size_t, int)  all
 int         madvise(void*, size_t, int)  all
-int mlock(const void* addr, size_t len)    all
-int mlock2(const void* addr, size_t len, int flags)    all
+int         mlock(const void* addr, size_t len)    all
 int         munlock(const void* addr, size_t len)   all
 int         mlockall(int flags)   all
 int         munlockall()   all
@@ -125,7 +122,7 @@
 int         __fcntl64:fcntl64(int, int, void*)  lp32
 int         fcntl(int, int, void*)  lp64
 int         flock(int, int)   all
-int         __fchmod:fchmod(int, mode_t)  all
+int         ___fchmod:fchmod(int, mode_t)  all
 int         dup(int)  all
 int         pipe2(int*, int) all
 int         dup3(int, int, int)   all
@@ -135,16 +132,16 @@
 int         fchown:fchown(int, uid_t, gid_t)    arm64,mips,mips64,x86_64
 void        sync(void)  all
 int         syncfs(int)  all
-int         __fsetxattr:fsetxattr(int, const char*, const void*, size_t, int) all
-ssize_t     __fgetxattr:fgetxattr(int, const char*, void*, size_t) all
-ssize_t     __flistxattr:flistxattr(int, char*, size_t) all
+int         ___fsetxattr:fsetxattr(int, const char*, const void*, size_t, int) all
+ssize_t     ___fgetxattr:fgetxattr(int, const char*, void*, size_t) all
+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 __openat:openat(int, const char*, int, mode_t) all
-int __faccessat:faccessat(int, const char*, int)  all
-int __fchmodat:fchmodat(int, const char*, mode_t)  all
+int ___faccessat:faccessat(int, const char*, int)  all
+int ___fchmodat:fchmodat(int, const char*, mode_t)  all
 int fchownat(int, const char*, uid_t, gid_t, int)  all
 int fstatat64|fstatat:fstatat64(int, const char*, struct stat*, int)   lp32
 int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int)  arm64,x86_64
@@ -153,7 +150,6 @@
 int mknodat(int, const char*, mode_t, dev_t)  all
 int readlinkat(int, const char*, char*, size_t)  all
 int renameat(int, const char*, int, const char*)  all
-int renameat2(int, const char*, int, const char*, unsigned)  all
 int symlinkat(const char*, int, const char*)  all
 int unlinkat(int, const char*, int)   all
 int utimensat(int, const char*, const struct timespec times[2], int)  all
@@ -216,7 +212,7 @@
 clock_t       times(struct tms*)       all
 int           nanosleep(const struct timespec*, struct timespec*)   all
 int           clock_settime(clockid_t, const struct timespec*)  all
-int           __clock_nanosleep:clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*)  all
+int           ___clock_nanosleep:clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*)  all
 int           getitimer(int, const struct itimerval*)   all
 int           setitimer(int, const struct itimerval*, struct itimerval*)  all
 int           __timer_create:timer_create(clockid_t clockid, struct sigevent* evp, __kernel_timer_t* timerid)    all
@@ -237,7 +233,7 @@
 int     __rt_sigprocmask:rt_sigprocmask(int, const sigset64_t*, sigset64_t*, size_t)  all
 int     __rt_sigsuspend:rt_sigsuspend(const sigset64_t*, size_t)  all
 int     __rt_sigtimedwait:rt_sigtimedwait(const sigset64_t*, siginfo_t*, const timespec*, size_t)  all
-int     __rt_sigqueueinfo:rt_sigqueueinfo(pid_t, int, siginfo_t*)  all
+int     ___rt_sigqueueinfo:rt_sigqueueinfo(pid_t, int, siginfo_t*)  all
 int     __signalfd4:signalfd4(int, const sigset64_t*, size_t, int)  all
 
 # sockets
@@ -249,15 +245,15 @@
 int           __accept4:accept4(int, struct sockaddr*, socklen_t*, int)  arm,arm64,mips,mips64,x86_64
 int           getsockname(int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
 int           getpeername(int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
-int           __sendto:sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  arm,arm64,mips,mips64,x86_64
+int           sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  arm,arm64,mips,mips64,x86_64
 int           recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
 int           shutdown(int, int)  arm,arm64,mips,mips64,x86_64
 int           setsockopt(int, int, int, const void*, socklen_t)  arm,arm64,mips,mips64,x86_64
 int           getsockopt(int, int, int, void*, socklen_t*)    arm,arm64,mips,mips64,x86_64
 ssize_t       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
+ssize_t       sendmsg(int, const struct msghdr*, unsigned int)  arm,arm64,mips,mips64,x86_64
 int           recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   arm,arm64,mips,mips64,x86_64
-int           __sendmmsg:sendmmsg(int, struct mmsghdr*, unsigned int, int)   arm,arm64,mips,mips64,x86_64
+int           sendmmsg(int, struct mmsghdr*, unsigned int, int)   arm,arm64,mips,mips64,x86_64
 
 # sockets for x86. These are done as an "indexed" call to socketcall syscall.
 int           __socket:socketcall:1(int, int, int) x86
@@ -267,16 +263,16 @@
 int           getsockname:socketcall:6(int, struct sockaddr*, socklen_t*)  x86
 int           getpeername:socketcall:7(int, struct sockaddr*, socklen_t*)  x86
 int           socketpair:socketcall:8(int, int, int, int*)    x86
-int           __sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  x86
+int           sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  x86
 int           recvfrom:socketcall:12(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*)  x86
 int           shutdown:socketcall:13(int, int)  x86
 int           setsockopt:socketcall:14(int, int, int, const void*, socklen_t)  x86
 int           getsockopt:socketcall:15(int, int, int, void*, socklen_t*)    x86
-int           __sendmsg:socketcall:16(int, const struct msghdr*, unsigned int)  x86
+int           sendmsg:socketcall:16(int, const struct msghdr*, unsigned int)  x86
 int           recvmsg:socketcall:17(int, struct msghdr*, unsigned int)   x86
 int           __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int)  x86
 int           recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   x86
-int           __sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int)   x86
+int           sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int)   x86
 
 # scheduler & real-time
 int sched_setscheduler(pid_t pid, int policy, const struct sched_param* param)  all
diff --git a/libc/arch-arm/bionic/exidx_static.c b/libc/arch-arm/bionic/exidx_static.c
index 9830c54..ef3745f 100644
--- a/libc/arch-arm/bionic/exidx_static.c
+++ b/libc/arch-arm/bionic/exidx_static.c
@@ -43,11 +43,7 @@
 extern struct exidx_entry __exidx_end;
 extern struct exidx_entry __exidx_start;
 
-_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc __attribute__((unused)), int* pcount) {
+_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __attribute__((unused)), int* pcount) {
   *pcount = (&__exidx_end - &__exidx_start);
   return (_Unwind_Ptr)&__exidx_start;
 }
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int *pcount) {
-  return dl_unwind_find_exidx(pc, pcount);
-}
diff --git a/libc/arch-arm/bionic/vfork.S b/libc/arch-arm/bionic/vfork.S
index 6855db7..0b17d64 100644
--- a/libc/arch-arm/bionic/vfork.S
+++ b/libc/arch-arm/bionic/vfork.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <platform/bionic/tls_defines.h>
 #include <private/bionic_asm.h>
+#include <private/bionic_asm_tls.h>
 
 ENTRY(vfork)
 __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
diff --git a/libc/arch-arm/cortex-a15/bionic/strcmp.S b/libc/arch-arm/cortex-a15/bionic/strcmp.S
index 467201b..58dbf17 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcmp.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014 ARM Ltd
+ * Copyright (c) 2013 ARM Ltd
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,9 +29,9 @@
 #include <private/bionic_asm.h>
 
 #ifdef __ARMEB__
-#define S2LO lsl
-#define S2LOEQ lsleq
-#define S2HI lsr
+#define S2LOMEM lsl
+#define S2LOMEMEQ lsleq
+#define S2HIMEM lsr
 #define MSB 0x000000ff
 #define LSB 0xff000000
 #define BYTE0_OFFSET 24
@@ -39,9 +39,9 @@
 #define BYTE2_OFFSET 8
 #define BYTE3_OFFSET 0
 #else /* not  __ARMEB__ */
-#define S2LO lsr
-#define S2LOEQ lsreq
-#define S2HI lsl
+#define S2LOMEM lsr
+#define S2LOMEMEQ lsreq
+#define S2HIMEM lsl
 #define BYTE0_OFFSET 0
 #define BYTE1_OFFSET 8
 #define BYTE2_OFFSET 16
@@ -50,446 +50,330 @@
 #define LSB 0x000000ff
 #endif /* not  __ARMEB__ */
 
-/* Parameters and result.  */
-#define src1		r0
-#define src2		r1
-#define result		r0	/* Overlaps src1.  */
-
-/* Internal variables.  */
-#define tmp1		r4
-#define tmp2		r5
-#define const_m1	r12
-
-/* Additional internal variables for 64-bit aligned data.  */
-#define data1a		r2
-#define data1b		r3
-#define data2a		r6
-#define data2b		r7
-#define syndrome_a	tmp1
-#define syndrome_b	tmp2
-
-/* Additional internal variables for 32-bit aligned data.  */
-#define data1		r2
-#define data2		r3
-#define syndrome	tmp2
-
-	/* Implementation of strcmp for ARMv7 when DSP instructions are
-	   available.  Use ldrd to support wider loads, provided the data
-	   is sufficiently aligned.  Use saturating arithmetic to optimize
-	   the compares.  */
-
-	/* Build Options:
-	   STRCMP_NO_PRECHECK: Don't run a quick pre-check of the first
-	   byte in the string.  If comparing completely random strings
-	   the pre-check will save time, since there is a very high
-	   probability of a mismatch in the first character: we save
-	   significant overhead if this is the common case.  However,
-	   if strings are likely to be identical (eg because we're
-	   verifying a hit in a hash table), then this check is largely
-	   redundant.  */
-
-
 .syntax         unified
-.thumb
+
+#if defined (__thumb__)
+        .thumb
+        .thumb_func
+#endif
 
         // To avoid warning about deprecated instructions, add an explicit
         // arch. The code generated is exactly the same.
         .arch armv7-a
 
-	/* Macro to compute and return the result value for word-aligned
-	   cases.  */
-	.macro strcmp_epilogue_aligned synd d1 d2 restore_r6
-#ifdef __ARM_BIG_ENDIAN
-	/* If data1 contains a zero byte, then syndrome will contain a 1 in
-	   bit 7 of that byte.  Otherwise, the highest set bit in the
-	   syndrome will highlight the first different bit.  It is therefore
-	   sufficient to extract the eight bits starting with the syndrome
-	   bit.  */
-	clz	tmp1, \synd
-	lsl	r1, \d2, tmp1
-	.if \restore_r6
-	ldrd	r6, r7, [sp, #8]
-	.endif
-	.cfi_restore 6
-	.cfi_restore 7
-	lsl	\d1, \d1, tmp1
-	.cfi_remember_state
-	lsr	result, \d1, #24
-	ldrd	r4, r5, [sp], #16
-	.cfi_restore 4
-	.cfi_restore 5
-	sub	result, result, r1, lsr #24
-	bx	lr
-#else
-	/* To use the big-endian trick we'd have to reverse all three words.
-	   that's slower than this approach.  */
-	rev	\synd, \synd
-	clz	tmp1, \synd
-	bic	tmp1, tmp1, #7
-	lsr	r1, \d2, tmp1
-	.cfi_remember_state
-	.if \restore_r6
-	ldrd	r6, r7, [sp, #8]
-	.endif
-	.cfi_restore 6
-	.cfi_restore 7
-	lsr	\d1, \d1, tmp1
-	and	result, \d1, #255
-	and	r1, r1, #255
-	ldrd	r4, r5, [sp], #16
-	.cfi_restore 4
-	.cfi_restore 5
-	sub	result, result, r1
-
-	bx	lr
-#endif
-	.endm
-
-	.text
-	.p2align	5
-.Lstrcmp_start_addr:
-#ifndef STRCMP_NO_PRECHECK
-.Lfastpath_exit:
-	sub	r0, r2, r3
-	bx	lr
-	nop
-#endif
-
 ENTRY(strcmp_a15)
-#ifndef STRCMP_NO_PRECHECK
-	ldrb	r2, [src1]
-	ldrb	r3, [src2]
-	cmp	r2, #1
-	it	cs
-	cmpcs	r2, r3
-	bne	.Lfastpath_exit
-#endif
-	.cfi_sections .debug_frame
-	strd	r4, r5, [sp, #-16]!
-	.cfi_def_cfa_offset 16
-	.cfi_offset 4, -16
-	.cfi_offset 5, -12
-	orr	tmp1, src1, src2
-	strd	r6, r7, [sp, #8]
-	.cfi_offset 6, -8
-	.cfi_offset 7, -4
-	mvn	const_m1, #0
-	lsl	r2, tmp1, #29
-	cbz	r2, .Lloop_aligned8
+      /* Use LDRD whenever possible.  */
 
-.Lnot_aligned:
-	eor	tmp1, src1, src2
-	tst	tmp1, #7
-	bne	.Lmisaligned8
+/* The main thing to look out for when comparing large blocks is that
+   the loads do not cross a page boundary when loading past the index
+   of the byte with the first difference or the first string-terminator.
 
-	/* Deal with mutual misalignment by aligning downwards and then
-	   masking off the unwanted loaded data to prevent a difference.  */
-	and	tmp1, src1, #7
-	bic	src1, src1, #7
-	and	tmp2, tmp1, #3
-	bic	src2, src2, #7
-	lsl	tmp2, tmp2, #3	/* Bytes -> bits.  */
-	ldrd	data1a, data1b, [src1], #16
-	tst	tmp1, #4
-	ldrd	data2a, data2b, [src2], #16
-	/* In thumb code we can't use MVN with a register shift, but
-	   we do have ORN.  */
-	S2HI	tmp1, const_m1, tmp2
-	orn	data1a, data1a, tmp1
-	orn	data2a, data2a, tmp1
-	beq	.Lstart_realigned8
-	orn	data1b, data1b, tmp1
-	mov	data1a, const_m1
-	orn	data2b, data2b, tmp1
-	mov	data2a, const_m1
-	b	.Lstart_realigned8
+   For example, if the strings are identical and the string-terminator
+   is at index k, byte by byte comparison will not load beyond address
+   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
+   k; double word - up to 7 bytes.  If the load of these bytes crosses
+   a page boundary, it might cause a memory fault (if the page is not mapped)
+   that would not have happened in byte by byte comparison.
 
-	/* Unwind the inner loop by a factor of 2, giving 16 bytes per
-	   pass.  */
-	.p2align 5,,12  /* Don't start in the tail bytes of a cache line.  */
-	.p2align 2	/* Always word aligned.  */
-.Lloop_aligned8:
-	ldrd	data1a, data1b, [src1], #16
-	ldrd	data2a, data2b, [src2], #16
-.Lstart_realigned8:
-	uadd8	syndrome_b, data1a, const_m1	/* Only want GE bits,  */
-	eor	syndrome_a, data1a, data2a
-	sel	syndrome_a, syndrome_a, const_m1
-	cbnz	syndrome_a, .Ldiff_in_a
-	uadd8	syndrome_b, data1b, const_m1	/* Only want GE bits.  */
-	eor	syndrome_b, data1b, data2b
-	sel	syndrome_b, syndrome_b, const_m1
-	cbnz	syndrome_b, .Ldiff_in_b
+   If an address is (double) word aligned, then a load of a (double) word
+   from that address will not cross a page boundary.
+   Therefore, the algorithm below considers word and double-word alignment
+   of strings separately.  */
 
-	ldrd	data1a, data1b, [src1, #-8]
-	ldrd	data2a, data2b, [src2, #-8]
-	uadd8	syndrome_b, data1a, const_m1	/* Only want GE bits,  */
-	eor	syndrome_a, data1a, data2a
-	sel	syndrome_a, syndrome_a, const_m1
-	uadd8	syndrome_b, data1b, const_m1	/* Only want GE bits.  */
-	eor	syndrome_b, data1b, data2b
-	sel	syndrome_b, syndrome_b, const_m1
-	/* Can't use CBZ for backwards branch.  */
-	orrs	syndrome_b, syndrome_b, syndrome_a /* Only need if s_a == 0 */
-	beq	.Lloop_aligned8
+/* High-level description of the algorithm.
 
-.Ldiff_found:
-	cbnz	syndrome_a, .Ldiff_in_a
+   * The fast path: if both strings are double-word aligned,
+     use LDRD to load two words from each string in every loop iteration.
+   * If the strings have the same offset from a word boundary,
+     use LDRB to load and compare byte by byte until
+     the first string is aligned to a word boundary (at most 3 bytes).
+     This is optimized for quick return on short unaligned strings.
+   * If the strings have the same offset from a double-word boundary,
+     use LDRD to load two words from each string in every loop iteration, as in the fast path.
+   * If the strings do not have the same offset from a double-word boundary,
+     load a word from the second string before the loop to initialize the queue.
+     Use LDRD to load two words from every string in every loop iteration.
+     Inside the loop, load the second word from the second string only after comparing
+     the first word, using the queued value, to guarantee safety across page boundaries.
+   * If the strings do not have the same offset from a word boundary,
+     use LDR and a shift queue. Order of loads and comparisons matters,
+     similarly to the previous case.
 
-.Ldiff_in_b:
-	strcmp_epilogue_aligned syndrome_b, data1b, data2b 1
+   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
+   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
+   * The only difference between big and little endian is the use of REV in little endian
+     to compute the return value, instead of MOV.
+*/
 
-.Ldiff_in_a:
-	.cfi_restore_state
-	strcmp_epilogue_aligned syndrome_a, data1a, data2a 1
+        .macro m_cbz reg label
+#ifdef __thumb2__
+        cbz     \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        beq     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbz */
 
-	.cfi_restore_state
-.Lmisaligned8:
-	tst	tmp1, #3
-	bne	.Lmisaligned4
-	ands	tmp1, src1, #3
-	bne	.Lmutual_align4
+        .macro m_cbnz reg label
+#ifdef __thumb2__
+        cbnz    \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        bne     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbnz */
 
-	/* Unrolled by a factor of 2, to reduce the number of post-increment
-	   operations.  */
-.Lloop_aligned4:
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-.Lstart_realigned4:
-	uadd8	syndrome, data1, const_m1	/* Only need GE bits.  */
-	eor	syndrome, data1, data2
-	sel	syndrome, syndrome, const_m1
-	cbnz	syndrome, .Laligned4_done
-	ldr	data1, [src1, #-4]
-	ldr	data2, [src2, #-4]
-	uadd8	syndrome, data1, const_m1
-	eor	syndrome, data1, data2
-	sel	syndrome, syndrome, const_m1
-	cmp	syndrome, #0
-	beq	.Lloop_aligned4
+        .macro  init
+        /* Macro to save temporary registers and prepare magic values.  */
+        subs    sp, sp, #16
+        .cfi_def_cfa_offset 16
+        strd    r4, r5, [sp, #8]
+        .cfi_rel_offset r4, 0
+        .cfi_rel_offset r5, 4
+        strd    r6, r7, [sp]
+        .cfi_rel_offset r6, 8
+        .cfi_rel_offset r7, 12
+        mvn     r6, #0  /* all F */
+        mov     r7, #0  /* all 0 */
+        .endm   /* init */
 
-.Laligned4_done:
-	strcmp_epilogue_aligned syndrome, data1, data2, 0
+        .macro  magic_compare_and_branch w1 w2 label
+        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
+        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
+        magic_find_zero_bytes \w1
+        it      eq
+        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
+        bne     \label
+        .endm /* magic_compare_and_branch */
 
-.Lmutual_align4:
-	.cfi_restore_state
-	/* Deal with mutual misalignment by aligning downwards and then
-	   masking off the unwanted loaded data to prevent a difference.  */
-	lsl	tmp1, tmp1, #3	/* Bytes -> bits.  */
-	bic	src1, src1, #3
-	ldr	data1, [src1], #8
-	bic	src2, src2, #3
-	ldr	data2, [src2], #8
+        .macro  magic_find_zero_bytes w1
+        /* Macro to find all-zero bytes in w1, result is in ip.  */
+        uadd8   ip, \w1, r6
+        sel     ip, r7, r6
+        .endm /* magic_find_zero_bytes */
 
-	/* In thumb code we can't use MVN with a register shift, but
-	   we do have ORN.  */
-	S2HI	tmp1, const_m1, tmp1
-	orn	data1, data1, tmp1
-	orn	data2, data2, tmp1
-	b	.Lstart_realigned4
+        .macro  setup_return w1 w2
+#ifdef __ARMEB__
+        mov     r1, \w1
+        mov     r2, \w2
+#else /* not  __ARMEB__ */
+        rev     r1, \w1
+        rev     r2, \w2
+#endif /* not  __ARMEB__ */
+        .endm /* setup_return */
 
-.Lmisaligned4:
-	ands	tmp1, src1, #3
-	beq	.Lsrc1_aligned
-	sub	src2, src2, tmp1
-	bic	src1, src1, #3
-	lsls	tmp1, tmp1, #31
-	ldr	data1, [src1], #4
-	beq	.Laligned_m2
-	bcs	.Laligned_m1
+        pld [r0, #0]
+        pld [r1, #0]
 
-#ifdef STRCMP_NO_PRECHECK
-	ldrb	data2, [src2, #1]
-	uxtb	tmp1, data1, ror #BYTE1_OFFSET
-	subs	tmp1, tmp1, data2
-	bne	.Lmisaligned_exit
-	cbz	data2, .Lmisaligned_exit
+        /* Are both strings double-word aligned?  */
+        orr     ip, r0, r1
+        tst     ip, #7
+        bne     .L_do_align
 
-.Laligned_m2:
-	ldrb	data2, [src2, #2]
-	uxtb	tmp1, data1, ror #BYTE2_OFFSET
-	subs	tmp1, tmp1, data2
-	bne	.Lmisaligned_exit
-	cbz	data2, .Lmisaligned_exit
+        /* Fast path.  */
+        init
 
-.Laligned_m1:
-	ldrb	data2, [src2, #3]
-	uxtb	tmp1, data1, ror #BYTE3_OFFSET
-	subs	tmp1, tmp1, data2
-	bne	.Lmisaligned_exit
-	add	src2, src2, #4
-	cbnz	data2, .Lsrc1_aligned
-#else  /* STRCMP_NO_PRECHECK */
-	/* If we've done the pre-check, then we don't need to check the
-	   first byte again here.  */
-	ldrb	data2, [src2, #2]
-	uxtb	tmp1, data1, ror #BYTE2_OFFSET
-	subs	tmp1, tmp1, data2
-	bne	.Lmisaligned_exit
-	cbz	data2, .Lmisaligned_exit
+.L_doubleword_aligned:
 
-.Laligned_m2:
-	ldrb	data2, [src2, #3]
-	uxtb	tmp1, data1, ror #BYTE3_OFFSET
-	subs	tmp1, tmp1, data2
-	bne	.Lmisaligned_exit
-	cbnz	data2, .Laligned_m1
-#endif
+        /* Get here when the strings to compare are double-word aligned.  */
+        /* Compare two words in every iteration.  */
+        .p2align        2
+2:
+        pld [r0, #16]
+        pld [r1, #16]
 
-.Lmisaligned_exit:
-	.cfi_remember_state
-	mov	result, tmp1
-	ldr	r4, [sp], #16
-	.cfi_restore 4
-	bx	lr
+        /* Load the next double-word from each string.  */
+        ldrd    r2, r3, [r0], #8
+        ldrd    r4, r5, [r1], #8
 
-#ifndef STRCMP_NO_PRECHECK
-.Laligned_m1:
-	add	src2, src2, #4
-#endif
-.Lsrc1_aligned:
-	.cfi_restore_state
-	/* src1 is word aligned, but src2 has no common alignment
-	   with it.  */
-	ldr	data1, [src1], #4
-	lsls	tmp1, src2, #31		/* C=src2[1], Z=src2[0].  */
+        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
+        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
+        b       2b
 
-	bic	src2, src2, #3
-	ldr	data2, [src2], #4
-	bhi	.Loverlap1		/* C=1, Z=0 => src2[1:0] = 0b11.  */
-	bcs	.Loverlap2		/* C=1, Z=1 => src2[1:0] = 0b10.  */
+.L_do_align:
+        /* Is the first string word-aligned?  */
+        ands    ip, r0, #3
+        beq     .L_word_aligned_r0
 
-	/* (overlap3) C=0, Z=0 => src2[1:0] = 0b01.  */
-.Loverlap3:
-	bic	tmp1, data1, #MSB
-	uadd8	syndrome, data1, const_m1
-	eors	syndrome, tmp1, data2, S2LO #8
-	sel	syndrome, syndrome, const_m1
-	bne	4f
-	cbnz	syndrome, 5f
-	ldr	data2, [src2], #4
-	eor	tmp1, tmp1, data1
-	cmp	tmp1, data2, S2HI #24
-	bne	6f
-	ldr	data1, [src1], #4
-	b	.Loverlap3
-4:
-	S2LO	data2, data2, #8
-	b	.Lstrcmp_tail
+        /* Fast compare byte by byte until the first string is word-aligned.  */
+        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
+        to read until the next word boundary is 4-ip.  */
+        bic     r0, r0, #3
+        ldr     r2, [r0], #4
+        lsls    ip, ip, #31
+        beq     .L_byte2
+        bcs     .L_byte3
 
-5:
-	bics	syndrome, syndrome, #MSB
-	bne	.Lstrcmp_done_equal
+.L_byte1:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE1_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
 
-	/* We can only get here if the MSB of data1 contains 0, so
-	   fast-path the exit.  */
-	ldrb	result, [src2]
-	.cfi_remember_state
-	ldrd	r4, r5, [sp], #16
-	.cfi_restore 4
-	.cfi_restore 5
-	/* R6/7 Not used in this sequence.  */
-	.cfi_restore 6
-	.cfi_restore 7
-	neg	result, result
-	bx	lr
+.L_byte2:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE2_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
 
-6:
-	.cfi_restore_state
-	S2LO	data1, data1, #24
-	and	data2, data2, #LSB
-	b	.Lstrcmp_tail
+.L_byte3:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE3_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbnz  reg=r3, label=.L_word_aligned_r0
 
-	.p2align 5,,12	/* Ensure at least 3 instructions in cache line.  */
-.Loverlap2:
-	and	tmp1, data1, const_m1, S2LO #16
-	uadd8	syndrome, data1, const_m1
-	eors	syndrome, tmp1, data2, S2LO #16
-	sel	syndrome, syndrome, const_m1
-	bne	4f
-	cbnz	syndrome, 5f
-	ldr	data2, [src2], #4
-	eor	tmp1, tmp1, data1
-	cmp	tmp1, data2, S2HI #16
-	bne	6f
-	ldr	data1, [src1], #4
-	b	.Loverlap2
-4:
-	S2LO	data2, data2, #16
-	b	.Lstrcmp_tail
-5:
-	ands	syndrome, syndrome, const_m1, S2LO #16
-	bne	.Lstrcmp_done_equal
+.L_fast_return:
+        mov     r0, ip
+        bx      lr
 
-	ldrh	data2, [src2]
-	S2LO	data1, data1, #16
-#ifdef __ARM_BIG_ENDIAN
-	lsl	data2, data2, #16
-#endif
-	b	.Lstrcmp_tail
+.L_word_aligned_r0:
+        init
+        /* The first string is word-aligned.  */
+        /* Is the second string word-aligned?  */
+        ands    ip, r1, #3
+        bne     .L_strcmp_unaligned
 
-6:
-	S2LO	data1, data1, #16
-	and	data2, data2, const_m1, S2LO #16
-	b	.Lstrcmp_tail
+.L_word_aligned:
+        /* The strings are word-aligned. */
+        /* Is the first string double-word aligned?  */
+        tst     r0, #4
+        beq     .L_doubleword_aligned_r0
 
-	.p2align 5,,12	/* Ensure at least 3 instructions in cache line.  */
-.Loverlap1:
-	and	tmp1, data1, #LSB
-	uadd8	syndrome, data1, const_m1
-	eors	syndrome, tmp1, data2, S2LO #24
-	sel	syndrome, syndrome, const_m1
-	bne	4f
-	cbnz	syndrome, 5f
-	ldr	data2, [src2], #4
-	eor	tmp1, tmp1, data1
-	cmp	tmp1, data2, S2HI #8
-	bne	6f
-	ldr	data1, [src1], #4
-	b	.Loverlap1
-4:
-	S2LO	data2, data2, #24
-	b	.Lstrcmp_tail
-5:
-	tst	syndrome, #LSB
-	bne	.Lstrcmp_done_equal
-	ldr	data2, [src2]
-6:
-	S2LO	data1, data1, #8
-	bic	data2, data2, #MSB
-	b	.Lstrcmp_tail
+        /* If r0 is not double-word aligned yet, align it by loading
+        and comparing the next word from each string.  */
+        ldr     r2, [r0], #4
+        ldr     r4, [r1], #4
+        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
 
-.Lstrcmp_done_equal:
-	mov	result, #0
-	.cfi_remember_state
-	ldrd	r4, r5, [sp], #16
-	.cfi_restore 4
-	.cfi_restore 5
-	/* R6/7 not used in this sequence.  */
-	.cfi_restore 6
-	.cfi_restore 7
-	bx	lr
+.L_doubleword_aligned_r0:
+        /* Get here when r0 is double-word aligned.  */
+        /* Is r1 doubleword_aligned?  */
+        tst     r1, #4
+        beq     .L_doubleword_aligned
 
-.Lstrcmp_tail:
-	.cfi_restore_state
-#ifndef __ARM_BIG_ENDIAN
-	rev	data1, data1
-	rev	data2, data2
-	/* Now everything looks big-endian...  */
-#endif
-	uadd8	tmp1, data1, const_m1
-	eor	tmp1, data1, data2
-	sel	syndrome, tmp1, const_m1
-	clz	tmp1, syndrome
-	lsl	data1, data1, tmp1
-	lsl	data2, data2, tmp1
-	lsr	result, data1, #24
-	ldrd	r4, r5, [sp], #16
-	.cfi_restore 4
-	.cfi_restore 5
-	/* R6/7 not used in this sequence.  */
-	.cfi_restore 6
-	.cfi_restore 7
-	sub	result, result, data2, lsr #24
-	bx	lr
+        /* Get here when the strings to compare are word-aligned,
+        r0 is double-word aligned, but r1 is not double-word aligned.  */
+
+        /* Initialize the queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare two words in every iteration.  */
+        .p2align        2
+3:
+        pld [r0, #16]
+        pld [r1, #16]
+
+        /* Load the next double-word from each string and compare.  */
+        ldrd    r2, r3, [r0], #8
+        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
+        ldrd    r4, r5, [r1], #8
+        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
+        b       3b
+
+        .macro miscmp_word offsetlo offsethi
+        /* Macro to compare misaligned strings.  */
+        /* r0, r1 are word-aligned, and at least one of the strings
+        is not double-word aligned.  */
+        /* Compare one word in every loop iteration.  */
+        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
+        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
+
+        /* Initialize the shift queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare one word from each string in every loop iteration.  */
+        .p2align        2
+7:
+        ldr     r3, [r0], #4
+        S2LOMEM r5, r5, #\offsetlo
+        magic_find_zero_bytes w1=r3
+        cmp     r7, ip, S2HIMEM #\offsetlo
+        and     r2, r3, r6, S2LOMEM #\offsetlo
+        it      eq
+        cmpeq   r2, r5
+        bne     .L_return_25
+        ldr     r5, [r1], #4
+        cmp     ip, #0
+        eor r3, r2, r3
+        S2HIMEM r2, r5, #\offsethi
+        it      eq
+        cmpeq   r3, r2
+        bne     .L_return_32
+        b       7b
+        .endm /* miscmp_word */
+
+.L_strcmp_unaligned:
+        /* r0 is word-aligned, r1 is at offset ip from a word.  */
+        /* Align r1 to the (previous) word-boundary.  */
+        bic     r1, r1, #3
+
+        /* Unaligned comparison word by word using LDRs. */
+        cmp     ip, #2
+        beq     .L_miscmp_word_16                 /* If ip == 2.  */
+        bge     .L_miscmp_word_24                 /* If ip == 3.  */
+        miscmp_word offsetlo=8 offsethi=24        /* If ip == 1.  */
+.L_miscmp_word_16:  miscmp_word offsetlo=16 offsethi=16
+.L_miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
+
+
+.L_return_32:
+        setup_return w1=r3, w2=r2
+        b       .L_do_return
+.L_return_34:
+        setup_return w1=r3, w2=r4
+        b       .L_do_return
+.L_return_25:
+        setup_return w1=r2, w2=r5
+        b       .L_do_return
+.L_return_35:
+        setup_return w1=r3, w2=r5
+        b       .L_do_return
+.L_return_24:
+        setup_return w1=r2, w2=r4
+
+.L_do_return:
+
+#ifdef __ARMEB__
+        mov     r0, ip
+#else /* not  __ARMEB__ */
+        rev     r0, ip
+#endif /* not  __ARMEB__ */
+
+        /* Restore temporaries early, before computing the return value.  */
+        ldrd    r6, r7, [sp]
+        ldrd    r4, r5, [sp, #8]
+        adds    sp, sp, #16
+        .cfi_def_cfa_offset 0
+        .cfi_restore r4
+        .cfi_restore r5
+        .cfi_restore r6
+        .cfi_restore r7
+
+        /* There is a zero or a different byte between r1 and r2.  */
+        /* r0 contains a mask of all-zero bytes in r1.  */
+        /* Using r0 and not ip here because cbz requires low register.  */
+        m_cbz   reg=r0, label=.L_compute_return_value
+        clz     r0, r0
+        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
+        rsb     r0, r0, #24
+        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
+        lsr     r1, r1, r0
+        lsr     r2, r2, r0
+
+.L_compute_return_value:
+        movs    r0, #1
+        cmp     r1, r2
+        /* The return value is computed as follows.
+        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
+        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
+        which means r0:=r0-r0-1 and r0 is #-1 at return.
+        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
+        which means r0:=r0-r0 and r0 is #0 at return.
+        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
+        it      ls
+        sbcls   r0, r0, r0
+        bx      lr
 END(strcmp_a15)
diff --git a/libc/arch-arm/cortex-a9/bionic/strcmp.S b/libc/arch-arm/cortex-a9/bionic/strcmp.S
new file mode 100644
index 0000000..ba7ea13
--- /dev/null
+++ b/libc/arch-arm/cortex-a9/bionic/strcmp.S
@@ -0,0 +1,551 @@
+/*
+ * Copyright (c) 2013 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <private/bionic_asm.h>
+
+#ifdef __ARMEB__
+#define S2LOMEM lsl
+#define S2LOMEMEQ lsleq
+#define S2HIMEM lsr
+#define MSB 0x000000ff
+#define LSB 0xff000000
+#define BYTE0_OFFSET 24
+#define BYTE1_OFFSET 16
+#define BYTE2_OFFSET 8
+#define BYTE3_OFFSET 0
+#else /* not  __ARMEB__ */
+#define S2LOMEM lsr
+#define S2LOMEMEQ lsreq
+#define S2HIMEM lsl
+#define BYTE0_OFFSET 0
+#define BYTE1_OFFSET 8
+#define BYTE2_OFFSET 16
+#define BYTE3_OFFSET 24
+#define MSB 0xff000000
+#define LSB 0x000000ff
+#endif /* not  __ARMEB__ */
+
+.syntax         unified
+
+// To avoid warning about deprecated instructions, add an explicit
+// arch. The code generated is exactly the same.
+.arch armv7-a
+
+#if defined (__thumb__)
+        .thumb
+        .thumb_func
+#endif
+
+ENTRY(strcmp_a9)
+      /* Use LDRD whenever possible.  */
+
+/* The main thing to look out for when comparing large blocks is that
+   the loads do not cross a page boundary when loading past the index
+   of the byte with the first difference or the first string-terminator.
+
+   For example, if the strings are identical and the string-terminator
+   is at index k, byte by byte comparison will not load beyond address
+   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
+   k; double word - up to 7 bytes.  If the load of these bytes crosses
+   a page boundary, it might cause a memory fault (if the page is not mapped)
+   that would not have happened in byte by byte comparison.
+
+   If an address is (double) word aligned, then a load of a (double) word
+   from that address will not cross a page boundary.
+   Therefore, the algorithm below considers word and double-word alignment
+   of strings separately.  */
+
+/* High-level description of the algorithm.
+
+   * The fast path: if both strings are double-word aligned,
+     use LDRD to load two words from each string in every loop iteration.
+   * If the strings have the same offset from a word boundary,
+     use LDRB to load and compare byte by byte until
+     the first string is aligned to a word boundary (at most 3 bytes).
+     This is optimized for quick return on short unaligned strings.
+   * If the strings have the same offset from a double-word boundary,
+     use LDRD to load two words from each string in every loop iteration, as in the fast path.
+   * If the strings do not have the same offset from a double-word boundary,
+     load a word from the second string before the loop to initialize the queue.
+     Use LDRD to load two words from every string in every loop iteration.
+     Inside the loop, load the second word from the second string only after comparing
+     the first word, using the queued value, to guarantee safety across page boundaries.
+   * If the strings do not have the same offset from a word boundary,
+     use LDR and a shift queue. Order of loads and comparisons matters,
+     similarly to the previous case.
+
+   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
+   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
+   * The only difference between big and little endian is the use of REV in little endian
+     to compute the return value, instead of MOV.
+*/
+
+        .macro m_cbz reg label
+#ifdef __thumb2__
+        cbz     \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        beq     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbz */
+
+        .macro m_cbnz reg label
+#ifdef __thumb2__
+        cbnz    \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        bne     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbnz */
+
+        .macro  init
+        /* Macro to save temporary registers and prepare magic values.  */
+        subs    sp, sp, #16
+        .cfi_def_cfa_offset 16
+        strd    r4, r5, [sp, #8]
+        .cfi_rel_offset r4, 0
+        .cfi_rel_offset r5, 4
+        strd    r6, r7, [sp]
+        .cfi_rel_offset r6, 8
+        .cfi_rel_offset r7, 12
+        mvn     r6, #0  /* all F */
+        mov     r7, #0  /* all 0 */
+        .endm   /* init */
+
+        .macro  magic_compare_and_branch w1 w2 label
+        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
+        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
+        magic_find_zero_bytes \w1
+        it      eq
+        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
+        bne     \label
+        .endm /* magic_compare_and_branch */
+
+        .macro  magic_find_zero_bytes w1
+        /* Macro to find all-zero bytes in w1, result is in ip.  */
+        uadd8   ip, \w1, r6
+        sel     ip, r7, r6
+        .endm /* magic_find_zero_bytes */
+
+        .macro  setup_return w1 w2
+#ifdef __ARMEB__
+        mov     r1, \w1
+        mov     r2, \w2
+#else /* not  __ARMEB__ */
+        rev     r1, \w1
+        rev     r2, \w2
+#endif /* not  __ARMEB__ */
+        .endm /* setup_return */
+
+        pld [r0, #0]
+        pld [r1, #0]
+
+        /* Are both strings double-word aligned?  */
+        orr     ip, r0, r1
+        tst     ip, #7
+        bne     .L_do_align
+
+        /* Fast path.  */
+        init
+
+.L_doubleword_aligned:
+
+        /* Get here when the strings to compare are double-word aligned.  */
+        /* Compare two words in every iteration.  */
+        .p2align        2
+2:
+        pld [r0, #16]
+        pld [r1, #16]
+
+        /* Load the next double-word from each string.  */
+        ldrd    r2, r3, [r0], #8
+        ldrd    r4, r5, [r1], #8
+
+        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
+        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
+        b       2b
+
+.L_do_align:
+        /* Is the first string word-aligned?  */
+        ands    ip, r0, #3
+        beq     .L_word_aligned_r0
+
+        /* Fast compare byte by byte until the first string is word-aligned.  */
+        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
+        to read until the next word boundary is 4-ip.  */
+        bic     r0, r0, #3
+        ldr     r2, [r0], #4
+        lsls    ip, ip, #31
+        beq     .L_byte2
+        bcs     .L_byte3
+
+.L_byte1:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE1_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
+
+.L_byte2:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE2_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
+
+.L_byte3:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE3_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbnz  reg=r3, label=.L_word_aligned_r0
+
+.L_fast_return:
+        mov     r0, ip
+        bx      lr
+
+.L_word_aligned_r0:
+        init
+        /* The first string is word-aligned.  */
+        /* Is the second string word-aligned?  */
+        ands    ip, r1, #3
+        bne     .L_strcmp_unaligned
+
+.L_word_aligned:
+        /* The strings are word-aligned. */
+        /* Is the first string double-word aligned?  */
+        tst     r0, #4
+        beq     .L_doubleword_aligned_r0
+
+        /* If r0 is not double-word aligned yet, align it by loading
+        and comparing the next word from each string.  */
+        ldr     r2, [r0], #4
+        ldr     r4, [r1], #4
+        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
+
+.L_doubleword_aligned_r0:
+        /* Get here when r0 is double-word aligned.  */
+        /* Is r1 doubleword_aligned?  */
+        tst     r1, #4
+        beq     .L_doubleword_aligned
+
+        /* Get here when the strings to compare are word-aligned,
+        r0 is double-word aligned, but r1 is not double-word aligned.  */
+
+        /* Initialize the queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare two words in every iteration.  */
+        .p2align        2
+3:
+        pld [r0, #16]
+        pld [r1, #16]
+
+        /* Load the next double-word from each string and compare.  */
+        ldrd    r2, r3, [r0], #8
+        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
+        ldrd    r4, r5, [r1], #8
+        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
+        b       3b
+
+        .macro miscmp_word offsetlo offsethi
+        /* Macro to compare misaligned strings.  */
+        /* r0, r1 are word-aligned, and at least one of the strings
+        is not double-word aligned.  */
+        /* Compare one word in every loop iteration.  */
+        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
+        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
+
+        /* Initialize the shift queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare one word from each string in every loop iteration.  */
+        .p2align        2
+7:
+        ldr     r3, [r0], #4
+        S2LOMEM r5, r5, #\offsetlo
+        magic_find_zero_bytes w1=r3
+        cmp     r7, ip, S2HIMEM #\offsetlo
+        and     r2, r3, r6, S2LOMEM #\offsetlo
+        it      eq
+        cmpeq   r2, r5
+        bne     .L_return_25
+        ldr     r5, [r1], #4
+        cmp     ip, #0
+        eor r3, r2, r3
+        S2HIMEM r2, r5, #\offsethi
+        it      eq
+        cmpeq   r3, r2
+        bne     .L_return_32
+        b       7b
+        .endm /* miscmp_word */
+
+.L_return_32:
+        setup_return w1=r3, w2=r2
+        b       .L_do_return
+.L_return_34:
+        setup_return w1=r3, w2=r4
+        b       .L_do_return
+.L_return_25:
+        setup_return w1=r2, w2=r5
+        b       .L_do_return
+.L_return_35:
+        setup_return w1=r3, w2=r5
+        b       .L_do_return
+.L_return_24:
+        setup_return w1=r2, w2=r4
+
+.L_do_return:
+
+#ifdef __ARMEB__
+        mov     r0, ip
+#else /* not  __ARMEB__ */
+        rev     r0, ip
+#endif /* not  __ARMEB__ */
+
+        /* Restore temporaries early, before computing the return value.  */
+        ldrd    r6, r7, [sp]
+        ldrd    r4, r5, [sp, #8]
+        adds    sp, sp, #16
+        .cfi_def_cfa_offset 0
+        .cfi_restore r4
+        .cfi_restore r5
+        .cfi_restore r6
+        .cfi_restore r7
+
+        /* There is a zero or a different byte between r1 and r2.  */
+        /* r0 contains a mask of all-zero bytes in r1.  */
+        /* Using r0 and not ip here because cbz requires low register.  */
+        m_cbz   reg=r0, label=.L_compute_return_value
+        clz     r0, r0
+        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
+        rsb     r0, r0, #24
+        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
+        lsr     r1, r1, r0
+        lsr     r2, r2, r0
+
+.L_compute_return_value:
+        movs    r0, #1
+        cmp     r1, r2
+        /* The return value is computed as follows.
+        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
+        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
+        which means r0:=r0-r0-1 and r0 is #-1 at return.
+        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
+        which means r0:=r0-r0 and r0 is #0 at return.
+        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
+        it      ls
+        sbcls   r0, r0, r0
+        bx      lr
+
+    /* The code from the previous version of strcmp.S handles all of the
+     * cases where the first string and seconds string cannot both be
+     * aligned to a word boundary faster than the new algorithm. See
+     * bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S for the unedited
+     * version of the code.
+     */
+.L_strcmp_unaligned:
+	wp1 .req r0
+	wp2 .req r1
+	b1  .req r2
+	w1  .req r4
+	w2  .req r5
+	t1  .req ip
+	@ r3 is scratch
+
+2:
+	mov	b1, #1
+	orr	b1, b1, b1, lsl #8
+	orr	b1, b1, b1, lsl #16
+
+	and	t1, wp2, #3
+	bic	wp2, wp2, #3
+	ldr	w1, [wp1], #4
+	ldr	w2, [wp2], #4
+	cmp	t1, #2
+	beq	2f
+	bhi	3f
+
+	/* Critical inner Loop: Block with 3 bytes initial overlap */
+	.p2align	2
+1:
+	bic	t1, w1, #MSB
+	cmp	t1, w2, S2LOMEM #8
+	sub	r3, w1, b1
+	bic	r3, r3, w1
+	bne	4f
+	ands	r3, r3, b1, lsl #7
+	it	eq
+	ldreq	w2, [wp2], #4
+	bne	5f
+	eor	t1, t1, w1
+	cmp	t1, w2, S2HIMEM #24
+	bne	6f
+	ldr	w1, [wp1], #4
+	b	1b
+4:
+	S2LOMEM	w2, w2, #8
+	b	8f
+
+5:
+#ifdef __ARMEB__
+	/* The syndrome value may contain false ones if the string ends
+	 * with the bytes 0x01 0x00
+	 */
+	tst	w1, #0xff000000
+	itt	ne
+	tstne	w1, #0x00ff0000
+	tstne	w1, #0x0000ff00
+	beq	7f
+#else
+	bics	r3, r3, #0xff000000
+	bne	7f
+#endif
+	ldrb	w2, [wp2]
+	S2LOMEM	t1, w1, #24
+#ifdef __ARMEB__
+	lsl	w2, w2, #24
+#endif
+	b	8f
+
+6:
+	S2LOMEM	t1, w1, #24
+	and	w2, w2, #LSB
+	b	8f
+
+	/* Critical inner Loop: Block with 2 bytes initial overlap */
+	.p2align	2
+2:
+	S2HIMEM	t1, w1, #16
+	sub	r3, w1, b1
+	S2LOMEM	t1, t1, #16
+	bic	r3, r3, w1
+	cmp	t1, w2, S2LOMEM #16
+	bne	4f
+	ands	r3, r3, b1, lsl #7
+	it	eq
+	ldreq	w2, [wp2], #4
+	bne	5f
+	eor	t1, t1, w1
+	cmp	t1, w2, S2HIMEM #16
+	bne	6f
+	ldr	w1, [wp1], #4
+	b	2b
+
+5:
+#ifdef __ARMEB__
+	/* The syndrome value may contain false ones if the string ends
+	 * with the bytes 0x01 0x00
+	 */
+	tst	w1, #0xff000000
+	it	ne
+	tstne	w1, #0x00ff0000
+	beq	7f
+#else
+	lsls	r3, r3, #16
+	bne	7f
+#endif
+	ldrh	w2, [wp2]
+	S2LOMEM	t1, w1, #16
+#ifdef __ARMEB__
+	lsl	w2, w2, #16
+#endif
+	b	8f
+
+6:
+	S2HIMEM	w2, w2, #16
+	S2LOMEM	t1, w1, #16
+4:
+	S2LOMEM	w2, w2, #16
+	b	8f
+
+	/* Critical inner Loop: Block with 1 byte initial overlap */
+	.p2align	2
+3:
+	and	t1, w1, #LSB
+	cmp	t1, w2, S2LOMEM #24
+	sub	r3, w1, b1
+	bic	r3, r3, w1
+	bne	4f
+	ands	r3, r3, b1, lsl #7
+	it	eq
+	ldreq	w2, [wp2], #4
+	bne	5f
+	eor	t1, t1, w1
+	cmp	t1, w2, S2HIMEM #8
+	bne	6f
+	ldr	w1, [wp1], #4
+	b	3b
+4:
+	S2LOMEM	w2, w2, #24
+	b	8f
+5:
+	/* The syndrome value may contain false ones if the string ends
+	 * with the bytes 0x01 0x00
+	 */
+	tst	w1, #LSB
+	beq	7f
+	ldr	w2, [wp2], #4
+6:
+	S2LOMEM	t1, w1, #8
+	bic	w2, w2, #MSB
+	b	8f
+7:
+	mov	r0, #0
+
+    /* Restore registers and stack. */
+    ldrd    r6, r7, [sp]
+    ldrd    r4, r5, [sp, #8]
+    adds    sp, sp, #16
+    .cfi_def_cfa_offset 0
+    .cfi_restore r4
+    .cfi_restore r5
+    .cfi_restore r6
+    .cfi_restore r7
+
+	bx	lr
+
+8:
+	and	r2, t1, #LSB
+	and	r0, w2, #LSB
+	cmp	r0, #1
+	it	cs
+	cmpcs	r0, r2
+	itt	eq
+	S2LOMEMEQ	t1, t1, #8
+	S2LOMEMEQ	w2, w2, #8
+	beq	8b
+	sub	r0, r2, r0
+
+    /* Restore registers and stack. */
+    ldrd    r6, r7, [sp]
+    ldrd    r4, r5, [sp, #8]
+    adds    sp, sp, #16
+
+	bx	lr
+END(strcmp_a9)
diff --git a/libc/arch-arm/dynamic_function_dispatch.cpp b/libc/arch-arm/dynamic_function_dispatch.cpp
index 1d2f38f..640f330 100644
--- a/libc/arch-arm/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm/dynamic_function_dispatch.cpp
@@ -29,8 +29,6 @@
 #include <fcntl.h>
 #include <sys/syscall.h>
 
-#include <private/bionic_ifuncs.h>
-
 extern "C" {
 
 enum CpuVariant {
@@ -91,6 +89,20 @@
     return r0;
 }
 
+#define DEFINE_IFUNC(name) \
+    name##_func name __attribute__((ifunc(#name "_resolver"))); \
+    __attribute__((visibility("hidden"))) \
+    name##_func* name##_resolver()
+
+#define DECLARE_FUNC(type, name) \
+    __attribute__((visibility("hidden"))) \
+    type name
+
+#define RETURN_FUNC(type, name) { \
+        DECLARE_FUNC(type, name); \
+        return name; \
+    }
+
 static bool is_same_name(const char* a, const char* b) {
     static_assert(MAX_CPU_NAME_LEN % sizeof(int) == 0, "");
     const int* ia = reinterpret_cast<const int*>(a);
@@ -143,17 +155,17 @@
 }
 
 typedef void* memmove_func(void* __dst, const void* __src, size_t __n);
-DEFINE_IFUNC_FOR(memmove) {
+DEFINE_IFUNC(memmove) {
     RETURN_FUNC(memmove_func, memmove_a15);
 }
 
 typedef void* memcpy_func(void*, const void*, size_t);
-DEFINE_IFUNC_FOR(memcpy) {
-    return memmove_resolver(hwcap);
+DEFINE_IFUNC(memcpy) {
+    return memmove_resolver();
 }
 
 typedef void* __memcpy_func(void*, const void*, size_t);
-DEFINE_IFUNC_FOR(__memcpy) {
+DEFINE_IFUNC(__memcpy) {
     switch(get_cpu_variant()) {
         case kCortexA7:
             RETURN_FUNC(__memcpy_func, __memcpy_a7);
@@ -173,7 +185,7 @@
 }
 
 typedef void* __memset_chk_func(void* s, int c, size_t n, size_t n2);
-DEFINE_IFUNC_FOR(__memset_chk) {
+DEFINE_IFUNC(__memset_chk) {
     switch(get_cpu_variant()) {
         case kCortexA7:
         case kCortexA53:
@@ -190,7 +202,7 @@
 }
 
 typedef void* memset_func(void* __dst, int __ch, size_t __n);
-DEFINE_IFUNC_FOR(memset) {
+DEFINE_IFUNC(memset) {
     switch(get_cpu_variant()) {
         case kCortexA7:
         case kCortexA53:
@@ -207,7 +219,7 @@
 }
 
 typedef char* strcpy_func(char* __dst, const char* __src);
-DEFINE_IFUNC_FOR(strcpy) {
+DEFINE_IFUNC(strcpy) {
     switch(get_cpu_variant()) {
         case kCortexA9:
             RETURN_FUNC(strcpy_func, strcpy_a9);
@@ -217,7 +229,7 @@
 }
 
 typedef char* __strcpy_chk_func(char* dst, const char* src, size_t dst_len);
-DEFINE_IFUNC_FOR(__strcpy_chk) {
+DEFINE_IFUNC(__strcpy_chk) {
     switch(get_cpu_variant()) {
         case kCortexA7:
             RETURN_FUNC(__strcpy_chk_func, __strcpy_chk_a7);
@@ -236,7 +248,7 @@
 }
 
 typedef char* stpcpy_func(char* __dst, const char* __src);
-DEFINE_IFUNC_FOR(stpcpy) {
+DEFINE_IFUNC(stpcpy) {
     switch(get_cpu_variant()) {
         case kCortexA9:
             RETURN_FUNC(stpcpy_func, stpcpy_a9);
@@ -246,7 +258,7 @@
 }
 
 typedef char* strcat_func(char* __dst, const char* __src);
-DEFINE_IFUNC_FOR(strcat) {
+DEFINE_IFUNC(strcat) {
     switch(get_cpu_variant()) {
         case kCortexA9:
             RETURN_FUNC(strcat_func, strcat_a9);
@@ -256,7 +268,7 @@
 }
 
 typedef char* __strcat_chk_func(char* dst, const char* src, size_t dst_buf_size);
-DEFINE_IFUNC_FOR(__strcat_chk) {
+DEFINE_IFUNC(__strcat_chk) {
     switch(get_cpu_variant()) {
         case kCortexA7:
             RETURN_FUNC(__strcat_chk_func, __strcat_chk_a7);
@@ -275,12 +287,21 @@
 }
 
 typedef int strcmp_func(const char* __lhs, const char* __rhs);
-DEFINE_IFUNC_FOR(strcmp) {
-    RETURN_FUNC(strcmp_func, strcmp_a15);
+DEFINE_IFUNC(strcmp) {
+    switch(get_cpu_variant()) {
+        case kCortexA9:
+            RETURN_FUNC(strcmp_func, strcmp_a9);
+        case kCortexA55:
+        case kKrait:
+        case kKryo:
+            RETURN_FUNC(strcmp_func, strcmp_krait);
+        default:
+            RETURN_FUNC(strcmp_func, strcmp_a15);
+    }
 }
 
 typedef size_t strlen_func(const char* __s);
-DEFINE_IFUNC_FOR(strlen) {
+DEFINE_IFUNC(strlen) {
     switch(get_cpu_variant()) {
         case kCortexA9:
             RETURN_FUNC(strlen_func, strlen_a9);
diff --git a/libc/arch-arm/krait/bionic/strcmp.S b/libc/arch-arm/krait/bionic/strcmp.S
new file mode 100644
index 0000000..ec692e5
--- /dev/null
+++ b/libc/arch-arm/krait/bionic/strcmp.S
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2013 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <private/bionic_asm.h>
+
+#ifdef __ARMEB__
+#define S2LOMEM lsl
+#define S2LOMEMEQ lsleq
+#define S2HIMEM lsr
+#define MSB 0x000000ff
+#define LSB 0xff000000
+#define BYTE0_OFFSET 24
+#define BYTE1_OFFSET 16
+#define BYTE2_OFFSET 8
+#define BYTE3_OFFSET 0
+#else /* not  __ARMEB__ */
+#define S2LOMEM lsr
+#define S2LOMEMEQ lsreq
+#define S2HIMEM lsl
+#define BYTE0_OFFSET 0
+#define BYTE1_OFFSET 8
+#define BYTE2_OFFSET 16
+#define BYTE3_OFFSET 24
+#define MSB 0xff000000
+#define LSB 0x000000ff
+#endif /* not  __ARMEB__ */
+
+.syntax         unified
+
+// To avoid warning about deprecated instructions, add an explicit
+// arch. The code generated is exactly the same.
+.arch armv7-a
+
+#if defined (__thumb__)
+        .thumb
+        .thumb_func
+#endif
+
+ENTRY(strcmp_krait)
+      /* Use LDRD whenever possible.  */
+
+/* The main thing to look out for when comparing large blocks is that
+   the loads do not cross a page boundary when loading past the index
+   of the byte with the first difference or the first string-terminator.
+
+   For example, if the strings are identical and the string-terminator
+   is at index k, byte by byte comparison will not load beyond address
+   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
+   k; double word - up to 7 bytes.  If the load of these bytes crosses
+   a page boundary, it might cause a memory fault (if the page is not mapped)
+   that would not have happened in byte by byte comparison.
+
+   If an address is (double) word aligned, then a load of a (double) word
+   from that address will not cross a page boundary.
+   Therefore, the algorithm below considers word and double-word alignment
+   of strings separately.  */
+
+/* High-level description of the algorithm.
+
+   * The fast path: if both strings are double-word aligned,
+     use LDRD to load two words from each string in every loop iteration.
+   * If the strings have the same offset from a word boundary,
+     use LDRB to load and compare byte by byte until
+     the first string is aligned to a word boundary (at most 3 bytes).
+     This is optimized for quick return on short unaligned strings.
+   * If the strings have the same offset from a double-word boundary,
+     use LDRD to load two words from each string in every loop iteration, as in the fast path.
+   * If the strings do not have the same offset from a double-word boundary,
+     load a word from the second string before the loop to initialize the queue.
+     Use LDRD to load two words from every string in every loop iteration.
+     Inside the loop, load the second word from the second string only after comparing
+     the first word, using the queued value, to guarantee safety across page boundaries.
+   * If the strings do not have the same offset from a word boundary,
+     use LDR and a shift queue. Order of loads and comparisons matters,
+     similarly to the previous case.
+
+   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
+   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
+   * The only difference between big and little endian is the use of REV in little endian
+     to compute the return value, instead of MOV.
+*/
+
+        .macro m_cbz reg label
+#ifdef __thumb2__
+        cbz     \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        beq     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbz */
+
+        .macro m_cbnz reg label
+#ifdef __thumb2__
+        cbnz    \reg, \label
+#else   /* not defined __thumb2__ */
+        cmp     \reg, #0
+        bne     \label
+#endif /* not defined __thumb2__ */
+        .endm /* m_cbnz */
+
+        .macro  init
+        /* Macro to save temporary registers and prepare magic values.  */
+        subs    sp, sp, #16
+        .cfi_def_cfa_offset 16
+        strd    r4, r5, [sp, #8]
+        .cfi_rel_offset r4, 0
+        .cfi_rel_offset r5, 4
+        strd    r6, r7, [sp]
+        .cfi_rel_offset r6, 8
+        .cfi_rel_offset r7, 12
+        mvn     r6, #0  /* all F */
+        mov     r7, #0  /* all 0 */
+        .endm   /* init */
+
+        .macro  magic_compare_and_branch w1 w2 label
+        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
+        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
+        magic_find_zero_bytes \w1
+        it      eq
+        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
+        bne     \label
+        .endm /* magic_compare_and_branch */
+
+        .macro  magic_find_zero_bytes w1
+        /* Macro to find all-zero bytes in w1, result is in ip.  */
+        uadd8   ip, \w1, r6
+        sel     ip, r7, r6
+        .endm /* magic_find_zero_bytes */
+
+        .macro  setup_return w1 w2
+#ifdef __ARMEB__
+        mov     r1, \w1
+        mov     r2, \w2
+#else /* not  __ARMEB__ */
+        rev     r1, \w1
+        rev     r2, \w2
+#endif /* not  __ARMEB__ */
+        .endm /* setup_return */
+
+        pld [r0, #0]
+        pld [r1, #0]
+
+        /* Are both strings double-word aligned?  */
+        orr     ip, r0, r1
+        tst     ip, #7
+        bne     .L_do_align
+
+        /* Fast path.  */
+        init
+
+.L_doubleword_aligned:
+
+        /* Get here when the strings to compare are double-word aligned.  */
+        /* Compare two words in every iteration.  */
+        .p2align        2
+2:
+        pld [r0, #16]
+        pld [r1, #16]
+
+        /* Load the next double-word from each string.  */
+        ldrd    r2, r3, [r0], #8
+        ldrd    r4, r5, [r1], #8
+
+        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
+        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
+        b       2b
+
+.L_do_align:
+        /* Is the first string word-aligned?  */
+        ands    ip, r0, #3
+        beq     .L_word_aligned_r0
+
+        /* Fast compare byte by byte until the first string is word-aligned.  */
+        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
+        to read until the next word boundary is 4-ip.  */
+        bic     r0, r0, #3
+        ldr     r2, [r0], #4
+        lsls    ip, ip, #31
+        beq     .L_byte2
+        bcs     .L_byte3
+
+.L_byte1:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE1_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
+
+.L_byte2:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE2_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbz   reg=r3, label=.L_fast_return
+
+.L_byte3:
+        ldrb    ip, [r1], #1
+        uxtb    r3, r2, ror #BYTE3_OFFSET
+        subs    ip, r3, ip
+        bne     .L_fast_return
+        m_cbnz  reg=r3, label=.L_word_aligned_r0
+
+.L_fast_return:
+        mov     r0, ip
+        bx      lr
+
+.L_word_aligned_r0:
+        init
+        /* The first string is word-aligned.  */
+        /* Is the second string word-aligned?  */
+        ands    ip, r1, #3
+        bne     .L_strcmp_unaligned
+
+.L_word_aligned:
+        /* The strings are word-aligned. */
+        /* Is the first string double-word aligned?  */
+        tst     r0, #4
+        beq     .L_doubleword_aligned_r0
+
+        /* If r0 is not double-word aligned yet, align it by loading
+        and comparing the next word from each string.  */
+        ldr     r2, [r0], #4
+        ldr     r4, [r1], #4
+        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
+
+.L_doubleword_aligned_r0:
+        /* Get here when r0 is double-word aligned.  */
+        /* Is r1 doubleword_aligned?  */
+        tst     r1, #4
+        beq     .L_doubleword_aligned
+
+        /* Get here when the strings to compare are word-aligned,
+        r0 is double-word aligned, but r1 is not double-word aligned.  */
+
+        /* Initialize the queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare two words in every iteration.  */
+        .p2align        2
+3:
+        pld [r0, #16]
+        pld [r1, #16]
+
+        /* Load the next double-word from each string and compare.  */
+        ldrd    r2, r3, [r0], #8
+        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
+        ldrd    r4, r5, [r1], #8
+        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
+        b       3b
+
+        .macro miscmp_word offsetlo offsethi
+        /* Macro to compare misaligned strings.  */
+        /* r0, r1 are word-aligned, and at least one of the strings
+        is not double-word aligned.  */
+        /* Compare one word in every loop iteration.  */
+        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
+        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
+
+        /* Initialize the shift queue.  */
+        ldr     r5, [r1], #4
+
+        /* Compare one word from each string in every loop iteration.  */
+        .p2align        2
+7:
+        ldr     r3, [r0], #4
+        S2LOMEM r5, r5, #\offsetlo
+        magic_find_zero_bytes w1=r3
+        cmp     r7, ip, S2HIMEM #\offsetlo
+        and     r2, r3, r6, S2LOMEM #\offsetlo
+        it      eq
+        cmpeq   r2, r5
+        bne     .L_return_25
+        ldr     r5, [r1], #4
+        cmp     ip, #0
+        eor r3, r2, r3
+        S2HIMEM r2, r5, #\offsethi
+        it      eq
+        cmpeq   r3, r2
+        bne     .L_return_32
+        b       7b
+        .endm /* miscmp_word */
+
+.L_strcmp_unaligned:
+        /* r0 is word-aligned, r1 is at offset ip from a word.  */
+        /* Align r1 to the (previous) word-boundary.  */
+        bic     r1, r1, #3
+
+        /* Unaligned comparison word by word using LDRs. */
+        cmp     ip, #2
+        beq     .L_miscmp_word_16                 /* If ip == 2.  */
+        bge     .L_miscmp_word_24                 /* If ip == 3.  */
+        miscmp_word offsetlo=8 offsethi=24        /* If ip == 1.  */
+.L_miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
+
+
+.L_return_32:
+        setup_return w1=r3, w2=r2
+        b       .L_do_return
+.L_return_34:
+        setup_return w1=r3, w2=r4
+        b       .L_do_return
+.L_return_25:
+        setup_return w1=r2, w2=r5
+        b       .L_do_return
+.L_return_35:
+        setup_return w1=r3, w2=r5
+        b       .L_do_return
+.L_return_24:
+        setup_return w1=r2, w2=r4
+
+.L_do_return:
+
+#ifdef __ARMEB__
+        mov     r0, ip
+#else /* not  __ARMEB__ */
+        rev     r0, ip
+#endif /* not  __ARMEB__ */
+
+        /* Restore temporaries early, before computing the return value.  */
+        ldrd    r6, r7, [sp]
+        ldrd    r4, r5, [sp, #8]
+        adds    sp, sp, #16
+        .cfi_def_cfa_offset 0
+        .cfi_restore r4
+        .cfi_restore r5
+        .cfi_restore r6
+        .cfi_restore r7
+
+        /* There is a zero or a different byte between r1 and r2.  */
+        /* r0 contains a mask of all-zero bytes in r1.  */
+        /* Using r0 and not ip here because cbz requires low register.  */
+        m_cbz   reg=r0, label=.L_compute_return_value
+        clz     r0, r0
+        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
+        rsb     r0, r0, #24
+        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
+        lsr     r1, r1, r0
+        lsr     r2, r2, r0
+
+.L_compute_return_value:
+        movs    r0, #1
+        cmp     r1, r2
+        /* The return value is computed as follows.
+        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
+        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
+        which means r0:=r0-r0-1 and r0 is #-1 at return.
+        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
+        which means r0:=r0-r0 and r0 is #0 at return.
+        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
+        it      ls
+        sbcls   r0, r0, r0
+        bx      lr
+
+    /* The code from the previous version of strcmp.S handles this
+     * particular case (the second string is 2 bytes off a word alignment)
+     * faster than any current version. In this very specific case, use the
+     * previous version. See bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S
+     * for the unedited version of this code.
+     */
+.L_miscmp_word_16:
+	wp1 .req r0
+	wp2 .req r1
+	b1  .req r2
+	w1  .req r4
+	w2  .req r5
+	t1  .req ip
+	@ r3 is scratch
+
+    /* At this point, wp1 (r0) has already been word-aligned. */
+2:
+	mov	b1, #1
+	orr	b1, b1, b1, lsl #8
+	orr	b1, b1, b1, lsl #16
+
+	and	t1, wp2, #3
+	bic	wp2, wp2, #3
+	ldr	w1, [wp1], #4
+	ldr	w2, [wp2], #4
+
+	/* Critical inner Loop: Block with 2 bytes initial overlap */
+	.p2align	2
+2:
+	S2HIMEM	t1, w1, #16
+	sub	r3, w1, b1
+	S2LOMEM	t1, t1, #16
+	bic	r3, r3, w1
+	cmp	t1, w2, S2LOMEM #16
+	bne	4f
+	ands	r3, r3, b1, lsl #7
+	it	eq
+	ldreq	w2, [wp2], #4
+	bne	5f
+	eor	t1, t1, w1
+	cmp	t1, w2, S2HIMEM #16
+	bne	6f
+	ldr	w1, [wp1], #4
+	b	2b
+
+5:
+#ifdef __ARMEB__
+	/* The syndrome value may contain false ones if the string ends
+	 * with the bytes 0x01 0x00
+	 */
+	tst	w1, #0xff000000
+	it	ne
+	tstne	w1, #0x00ff0000
+	beq	7f
+#else
+	lsls	r3, r3, #16
+	bne	7f
+#endif
+	ldrh	w2, [wp2]
+	S2LOMEM	t1, w1, #16
+#ifdef __ARMEB__
+	lsl	w2, w2, #16
+#endif
+	b	8f
+
+6:
+	S2HIMEM	w2, w2, #16
+	S2LOMEM	t1, w1, #16
+4:
+	S2LOMEM	w2, w2, #16
+	b	8f
+
+7:
+	mov	r0, #0
+
+    /* Restore registers and stack. */
+    ldrd    r6, r7, [sp]
+    ldrd    r4, r5, [sp, #8]
+    adds    sp, sp, #16
+    .cfi_def_cfa_offset 0
+    .cfi_restore r4
+    .cfi_restore r5
+    .cfi_restore r6
+    .cfi_restore r7
+
+	bx	lr
+
+8:
+	and	r2, t1, #LSB
+	and	r0, w2, #LSB
+	cmp	r0, #1
+	it	cs
+	cmpcs	r0, r2
+	itt	eq
+	S2LOMEMEQ	t1, t1, #8
+	S2LOMEMEQ	w2, w2, #8
+	beq	8b
+	sub	r0, r2, r0
+
+    /* Restore registers and stack. */
+    ldrd    r6, r7, [sp]
+    ldrd    r4, r5, [sp, #8]
+    adds    sp, sp, #16
+    .cfi_def_cfa_offset 0
+    .cfi_restore r4
+    .cfi_restore r5
+    .cfi_restore r6
+    .cfi_restore r7
+
+	bx	lr
+END(strcmp_krait)
diff --git a/libc/arch-arm/syscalls/___clock_nanosleep.S b/libc/arch-arm/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..ef8f065
--- /dev/null
+++ b/libc/arch-arm/syscalls/___clock_nanosleep.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_clock_nanosleep
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-arm/syscalls/___close.S b/libc/arch-arm/syscalls/___close.S
new file mode 100644
index 0000000..05d3352
--- /dev/null
+++ b/libc/arch-arm/syscalls/___close.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_close
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___close)
+.hidden ___close
diff --git a/libc/arch-arm/syscalls/___faccessat.S b/libc/arch-arm/syscalls/___faccessat.S
new file mode 100644
index 0000000..8bb4cf8
--- /dev/null
+++ b/libc/arch-arm/syscalls/___faccessat.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_faccessat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-arm/syscalls/___fchmod.S b/libc/arch-arm/syscalls/___fchmod.S
new file mode 100644
index 0000000..b2312cb
--- /dev/null
+++ b/libc/arch-arm/syscalls/___fchmod.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fchmod
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-arm/syscalls/___fchmodat.S b/libc/arch-arm/syscalls/___fchmodat.S
new file mode 100644
index 0000000..4773610
--- /dev/null
+++ b/libc/arch-arm/syscalls/___fchmodat.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fchmodat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-arm/syscalls/___fgetxattr.S b/libc/arch-arm/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..25be039
--- /dev/null
+++ b/libc/arch-arm/syscalls/___fgetxattr.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fgetxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-arm/syscalls/___flistxattr.S b/libc/arch-arm/syscalls/___flistxattr.S
new file mode 100644
index 0000000..904e4ca
--- /dev/null
+++ b/libc/arch-arm/syscalls/___flistxattr.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_flistxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-arm/syscalls/___fsetxattr.S b/libc/arch-arm/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..5445191
--- /dev/null
+++ b/libc/arch-arm/syscalls/___fsetxattr.S
@@ -0,0 +1,23 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_fsetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-arm/syscalls/___mremap.S b/libc/arch-arm/syscalls/___mremap.S
new file mode 100644
index 0000000..ade8d78
--- /dev/null
+++ b/libc/arch-arm/syscalls/___mremap.S
@@ -0,0 +1,23 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_mremap
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-arm/syscalls/___rt_sigqueueinfo.S b/libc/arch-arm/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..1367e56
--- /dev/null
+++ b/libc/arch-arm/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigqueueinfo
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-arm/syscalls/__accept4.S b/libc/arch-arm/syscalls/__accept4.S
new file mode 100644
index 0000000..42aa47c
--- /dev/null
+++ b/libc/arch-arm/syscalls/__accept4.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_accept4
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__accept4)
diff --git a/libc/arch-arm/syscalls/__arm_fadvise64_64.S b/libc/arch-arm/syscalls/__arm_fadvise64_64.S
new file mode 100644
index 0000000..761c4d6
--- /dev/null
+++ b/libc/arch-arm/syscalls/__arm_fadvise64_64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__arm_fadvise64_64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_arm_fadvise64_64
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__arm_fadvise64_64)
diff --git a/libc/arch-arm/syscalls/__brk.S b/libc/arch-arm/syscalls/__brk.S
new file mode 100644
index 0000000..246924c
--- /dev/null
+++ b/libc/arch-arm/syscalls/__brk.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_brk
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__brk)
diff --git a/libc/arch-arm/syscalls/__clock_getres.S b/libc/arch-arm/syscalls/__clock_getres.S
new file mode 100644
index 0000000..439b5b8
--- /dev/null
+++ b/libc/arch-arm/syscalls/__clock_getres.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_clock_getres
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__clock_getres)
diff --git a/libc/arch-arm/syscalls/__clock_gettime.S b/libc/arch-arm/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..30eff03
--- /dev/null
+++ b/libc/arch-arm/syscalls/__clock_gettime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_clock_gettime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__clock_gettime)
diff --git a/libc/arch-arm/syscalls/__connect.S b/libc/arch-arm/syscalls/__connect.S
new file mode 100644
index 0000000..873b14d
--- /dev/null
+++ b/libc/arch-arm/syscalls/__connect.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_connect
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__connect)
diff --git a/libc/arch-arm/syscalls/__epoll_pwait.S b/libc/arch-arm/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..3642ee3
--- /dev/null
+++ b/libc/arch-arm/syscalls/__epoll_pwait.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_epoll_pwait
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__epoll_pwait)
diff --git a/libc/arch-arm/syscalls/__exit.S b/libc/arch-arm/syscalls/__exit.S
new file mode 100644
index 0000000..4ed31b0
--- /dev/null
+++ b/libc/arch-arm/syscalls/__exit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_exit
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__exit)
diff --git a/libc/arch-arm/syscalls/__fcntl64.S b/libc/arch-arm/syscalls/__fcntl64.S
new file mode 100644
index 0000000..0afdbee
--- /dev/null
+++ b/libc/arch-arm/syscalls/__fcntl64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fcntl64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fcntl64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__fcntl64)
diff --git a/libc/arch-arm/syscalls/__fstatfs64.S b/libc/arch-arm/syscalls/__fstatfs64.S
new file mode 100644
index 0000000..9117313
--- /dev/null
+++ b/libc/arch-arm/syscalls/__fstatfs64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fstatfs64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__fstatfs64)
diff --git a/libc/arch-arm/syscalls/__getcpu.S b/libc/arch-arm/syscalls/__getcpu.S
new file mode 100644
index 0000000..430acb3
--- /dev/null
+++ b/libc/arch-arm/syscalls/__getcpu.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getcpu
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__getcpu)
diff --git a/libc/arch-arm/syscalls/__getcwd.S b/libc/arch-arm/syscalls/__getcwd.S
new file mode 100644
index 0000000..53000b8
--- /dev/null
+++ b/libc/arch-arm/syscalls/__getcwd.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getcwd
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__getcwd)
diff --git a/libc/arch-arm/syscalls/__getdents64.S b/libc/arch-arm/syscalls/__getdents64.S
new file mode 100644
index 0000000..0ea61b8
--- /dev/null
+++ b/libc/arch-arm/syscalls/__getdents64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getdents64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__getdents64)
diff --git a/libc/arch-arm/syscalls/__getpid.S b/libc/arch-arm/syscalls/__getpid.S
new file mode 100644
index 0000000..b555385
--- /dev/null
+++ b/libc/arch-arm/syscalls/__getpid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getpid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__getpid)
diff --git a/libc/arch-arm/syscalls/__getpriority.S b/libc/arch-arm/syscalls/__getpriority.S
new file mode 100644
index 0000000..34f4bea
--- /dev/null
+++ b/libc/arch-arm/syscalls/__getpriority.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getpriority
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__getpriority)
diff --git a/libc/arch-arm/syscalls/__gettimeofday.S b/libc/arch-arm/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..de0eca5
--- /dev/null
+++ b/libc/arch-arm/syscalls/__gettimeofday.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_gettimeofday
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__gettimeofday)
diff --git a/libc/arch-arm/syscalls/__ioctl.S b/libc/arch-arm/syscalls/__ioctl.S
new file mode 100644
index 0000000..5871e58
--- /dev/null
+++ b/libc/arch-arm/syscalls/__ioctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_ioctl
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__ioctl)
diff --git a/libc/arch-arm/syscalls/__llseek.S b/libc/arch-arm/syscalls/__llseek.S
new file mode 100644
index 0000000..3cff318
--- /dev/null
+++ b/libc/arch-arm/syscalls/__llseek.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__llseek)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR__llseek
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__llseek)
diff --git a/libc/arch-arm/syscalls/__mmap2.S b/libc/arch-arm/syscalls/__mmap2.S
new file mode 100644
index 0000000..f11e467
--- /dev/null
+++ b/libc/arch-arm/syscalls/__mmap2.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__mmap2)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_mmap2
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__mmap2)
diff --git a/libc/arch-arm/syscalls/__openat.S b/libc/arch-arm/syscalls/__openat.S
new file mode 100644
index 0000000..403d9b5
--- /dev/null
+++ b/libc/arch-arm/syscalls/__openat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_openat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__openat)
diff --git a/libc/arch-arm/syscalls/__ppoll.S b/libc/arch-arm/syscalls/__ppoll.S
new file mode 100644
index 0000000..02de8a8
--- /dev/null
+++ b/libc/arch-arm/syscalls/__ppoll.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_ppoll
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__ppoll)
diff --git a/libc/arch-arm/syscalls/__preadv64.S b/libc/arch-arm/syscalls/__preadv64.S
new file mode 100644
index 0000000..19eaaa5
--- /dev/null
+++ b/libc/arch-arm/syscalls/__preadv64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__preadv64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_preadv
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__preadv64)
diff --git a/libc/arch-arm/syscalls/__pselect6.S b/libc/arch-arm/syscalls/__pselect6.S
new file mode 100644
index 0000000..8f31e1b
--- /dev/null
+++ b/libc/arch-arm/syscalls/__pselect6.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_pselect6
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__pselect6)
diff --git a/libc/arch-arm/syscalls/__ptrace.S b/libc/arch-arm/syscalls/__ptrace.S
new file mode 100644
index 0000000..8ad554d
--- /dev/null
+++ b/libc/arch-arm/syscalls/__ptrace.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_ptrace
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__ptrace)
diff --git a/libc/arch-arm/syscalls/__pwritev64.S b/libc/arch-arm/syscalls/__pwritev64.S
new file mode 100644
index 0000000..afcbe40
--- /dev/null
+++ b/libc/arch-arm/syscalls/__pwritev64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pwritev64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_pwritev
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__pwritev64)
diff --git a/libc/arch-arm/syscalls/__reboot.S b/libc/arch-arm/syscalls/__reboot.S
new file mode 100644
index 0000000..15ca814
--- /dev/null
+++ b/libc/arch-arm/syscalls/__reboot.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_reboot
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__reboot)
diff --git a/libc/arch-arm/syscalls/__rt_sigaction.S b/libc/arch-arm/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..21d9977
--- /dev/null
+++ b/libc/arch-arm/syscalls/__rt_sigaction.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigaction
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__rt_sigaction)
diff --git a/libc/arch-arm/syscalls/__rt_sigpending.S b/libc/arch-arm/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..b726b85
--- /dev/null
+++ b/libc/arch-arm/syscalls/__rt_sigpending.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigpending
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__rt_sigpending)
diff --git a/libc/arch-arm/syscalls/__rt_sigprocmask.S b/libc/arch-arm/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..11b326f
--- /dev/null
+++ b/libc/arch-arm/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigprocmask
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__rt_sigprocmask)
diff --git a/libc/arch-arm/syscalls/__rt_sigsuspend.S b/libc/arch-arm/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..5d06418
--- /dev/null
+++ b/libc/arch-arm/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigsuspend
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__rt_sigsuspend)
diff --git a/libc/arch-arm/syscalls/__rt_sigtimedwait.S b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..dc7c3e7
--- /dev/null
+++ b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_rt_sigtimedwait
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__rt_sigtimedwait)
diff --git a/libc/arch-arm/syscalls/__sched_getaffinity.S b/libc/arch-arm/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..21f8330
--- /dev/null
+++ b/libc/arch-arm/syscalls/__sched_getaffinity.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_getaffinity
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__sched_getaffinity)
diff --git a/libc/arch-arm/syscalls/__set_tid_address.S b/libc/arch-arm/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..79dfd7f
--- /dev/null
+++ b/libc/arch-arm/syscalls/__set_tid_address.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_set_tid_address
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__set_tid_address)
diff --git a/libc/arch-arm/syscalls/__set_tls.S b/libc/arch-arm/syscalls/__set_tls.S
new file mode 100644
index 0000000..a9a4b9a
--- /dev/null
+++ b/libc/arch-arm/syscalls/__set_tls.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tls)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__ARM_NR_set_tls
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__set_tls)
diff --git a/libc/arch-arm/syscalls/__sigaction.S b/libc/arch-arm/syscalls/__sigaction.S
new file mode 100644
index 0000000..8f3f143
--- /dev/null
+++ b/libc/arch-arm/syscalls/__sigaction.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sigaction)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sigaction
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__sigaction)
diff --git a/libc/arch-arm/syscalls/__signalfd4.S b/libc/arch-arm/syscalls/__signalfd4.S
new file mode 100644
index 0000000..51a27c8
--- /dev/null
+++ b/libc/arch-arm/syscalls/__signalfd4.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_signalfd4
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__signalfd4)
diff --git a/libc/arch-arm/syscalls/__socket.S b/libc/arch-arm/syscalls/__socket.S
new file mode 100644
index 0000000..c50cd6f
--- /dev/null
+++ b/libc/arch-arm/syscalls/__socket.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_socket
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__socket)
diff --git a/libc/arch-arm/syscalls/__statfs64.S b/libc/arch-arm/syscalls/__statfs64.S
new file mode 100644
index 0000000..320b0ee
--- /dev/null
+++ b/libc/arch-arm/syscalls/__statfs64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_statfs64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__statfs64)
diff --git a/libc/arch-arm/syscalls/__sync_file_range2.S b/libc/arch-arm/syscalls/__sync_file_range2.S
new file mode 100644
index 0000000..4346e1b
--- /dev/null
+++ b/libc/arch-arm/syscalls/__sync_file_range2.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range2)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_sync_file_range2
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__sync_file_range2)
diff --git a/libc/arch-arm/syscalls/__timer_create.S b/libc/arch-arm/syscalls/__timer_create.S
new file mode 100644
index 0000000..fd7567b
--- /dev/null
+++ b/libc/arch-arm/syscalls/__timer_create.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timer_create
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__timer_create)
diff --git a/libc/arch-arm/syscalls/__timer_delete.S b/libc/arch-arm/syscalls/__timer_delete.S
new file mode 100644
index 0000000..6761abb
--- /dev/null
+++ b/libc/arch-arm/syscalls/__timer_delete.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timer_delete
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__timer_delete)
diff --git a/libc/arch-arm/syscalls/__timer_getoverrun.S b/libc/arch-arm/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..a925d83
--- /dev/null
+++ b/libc/arch-arm/syscalls/__timer_getoverrun.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timer_getoverrun
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__timer_getoverrun)
diff --git a/libc/arch-arm/syscalls/__timer_gettime.S b/libc/arch-arm/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..c0da770
--- /dev/null
+++ b/libc/arch-arm/syscalls/__timer_gettime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timer_gettime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__timer_gettime)
diff --git a/libc/arch-arm/syscalls/__timer_settime.S b/libc/arch-arm/syscalls/__timer_settime.S
new file mode 100644
index 0000000..de4e7e6
--- /dev/null
+++ b/libc/arch-arm/syscalls/__timer_settime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timer_settime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__timer_settime)
diff --git a/libc/arch-arm/syscalls/__waitid.S b/libc/arch-arm/syscalls/__waitid.S
new file mode 100644
index 0000000..f4dfa59
--- /dev/null
+++ b/libc/arch-arm/syscalls/__waitid.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_waitid
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(__waitid)
diff --git a/libc/arch-arm/syscalls/_exit.S b/libc/arch-arm/syscalls/_exit.S
new file mode 100644
index 0000000..1c3d174
--- /dev/null
+++ b/libc/arch-arm/syscalls/_exit.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_exit_group
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-arm/syscalls/acct.S b/libc/arch-arm/syscalls/acct.S
new file mode 100644
index 0000000..cdf1099
--- /dev/null
+++ b/libc/arch-arm/syscalls/acct.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_acct
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(acct)
diff --git a/libc/arch-arm/syscalls/adjtimex.S b/libc/arch-arm/syscalls/adjtimex.S
new file mode 100644
index 0000000..6ebae7e
--- /dev/null
+++ b/libc/arch-arm/syscalls/adjtimex.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_adjtimex
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(adjtimex)
diff --git a/libc/arch-arm/syscalls/bind.S b/libc/arch-arm/syscalls/bind.S
new file mode 100644
index 0000000..af518d8
--- /dev/null
+++ b/libc/arch-arm/syscalls/bind.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_bind
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(bind)
diff --git a/libc/arch-arm/syscalls/cacheflush.S b/libc/arch-arm/syscalls/cacheflush.S
new file mode 100644
index 0000000..752749a
--- /dev/null
+++ b/libc/arch-arm/syscalls/cacheflush.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(cacheflush)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__ARM_NR_cacheflush
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(cacheflush)
diff --git a/libc/arch-arm/syscalls/capget.S b/libc/arch-arm/syscalls/capget.S
new file mode 100644
index 0000000..9be110b
--- /dev/null
+++ b/libc/arch-arm/syscalls/capget.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_capget
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(capget)
diff --git a/libc/arch-arm/syscalls/capset.S b/libc/arch-arm/syscalls/capset.S
new file mode 100644
index 0000000..0bd5009
--- /dev/null
+++ b/libc/arch-arm/syscalls/capset.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_capset
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(capset)
diff --git a/libc/arch-arm/syscalls/chdir.S b/libc/arch-arm/syscalls/chdir.S
new file mode 100644
index 0000000..c75f5e2
--- /dev/null
+++ b/libc/arch-arm/syscalls/chdir.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_chdir
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(chdir)
diff --git a/libc/arch-arm/syscalls/chroot.S b/libc/arch-arm/syscalls/chroot.S
new file mode 100644
index 0000000..d197d42
--- /dev/null
+++ b/libc/arch-arm/syscalls/chroot.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_chroot
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(chroot)
diff --git a/libc/arch-arm/syscalls/clock_adjtime.S b/libc/arch-arm/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..e59a240
--- /dev/null
+++ b/libc/arch-arm/syscalls/clock_adjtime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_clock_adjtime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(clock_adjtime)
diff --git a/libc/arch-arm/syscalls/clock_settime.S b/libc/arch-arm/syscalls/clock_settime.S
new file mode 100644
index 0000000..f00a072
--- /dev/null
+++ b/libc/arch-arm/syscalls/clock_settime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_clock_settime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(clock_settime)
diff --git a/libc/arch-arm/syscalls/delete_module.S b/libc/arch-arm/syscalls/delete_module.S
new file mode 100644
index 0000000..80dd0f5
--- /dev/null
+++ b/libc/arch-arm/syscalls/delete_module.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_delete_module
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(delete_module)
diff --git a/libc/arch-arm/syscalls/dup.S b/libc/arch-arm/syscalls/dup.S
new file mode 100644
index 0000000..0d06bdc
--- /dev/null
+++ b/libc/arch-arm/syscalls/dup.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_dup
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(dup)
diff --git a/libc/arch-arm/syscalls/dup3.S b/libc/arch-arm/syscalls/dup3.S
new file mode 100644
index 0000000..7dea858
--- /dev/null
+++ b/libc/arch-arm/syscalls/dup3.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_dup3
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(dup3)
diff --git a/libc/arch-arm/syscalls/epoll_create1.S b/libc/arch-arm/syscalls/epoll_create1.S
new file mode 100644
index 0000000..8b413d9
--- /dev/null
+++ b/libc/arch-arm/syscalls/epoll_create1.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_epoll_create1
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(epoll_create1)
diff --git a/libc/arch-arm/syscalls/epoll_ctl.S b/libc/arch-arm/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..807dd69
--- /dev/null
+++ b/libc/arch-arm/syscalls/epoll_ctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_epoll_ctl
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(epoll_ctl)
diff --git a/libc/arch-arm/syscalls/eventfd.S b/libc/arch-arm/syscalls/eventfd.S
new file mode 100644
index 0000000..51f4a49
--- /dev/null
+++ b/libc/arch-arm/syscalls/eventfd.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_eventfd2
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(eventfd)
diff --git a/libc/arch-arm/syscalls/execve.S b/libc/arch-arm/syscalls/execve.S
new file mode 100644
index 0000000..1b72f0e
--- /dev/null
+++ b/libc/arch-arm/syscalls/execve.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_execve
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(execve)
diff --git a/libc/arch-arm/syscalls/fallocate64.S b/libc/arch-arm/syscalls/fallocate64.S
new file mode 100644
index 0000000..4bfd5e3
--- /dev/null
+++ b/libc/arch-arm/syscalls/fallocate64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_fallocate
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fallocate64)
diff --git a/libc/arch-arm/syscalls/fchdir.S b/libc/arch-arm/syscalls/fchdir.S
new file mode 100644
index 0000000..dca18c4
--- /dev/null
+++ b/libc/arch-arm/syscalls/fchdir.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fchdir
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fchdir)
diff --git a/libc/arch-arm/syscalls/fchown.S b/libc/arch-arm/syscalls/fchown.S
new file mode 100644
index 0000000..51ee60c
--- /dev/null
+++ b/libc/arch-arm/syscalls/fchown.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fchown32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fchown)
diff --git a/libc/arch-arm/syscalls/fchownat.S b/libc/arch-arm/syscalls/fchownat.S
new file mode 100644
index 0000000..2aac0fe
--- /dev/null
+++ b/libc/arch-arm/syscalls/fchownat.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_fchownat
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fchownat)
diff --git a/libc/arch-arm/syscalls/fdatasync.S b/libc/arch-arm/syscalls/fdatasync.S
new file mode 100644
index 0000000..f97adc6
--- /dev/null
+++ b/libc/arch-arm/syscalls/fdatasync.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fdatasync
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fdatasync)
diff --git a/libc/arch-arm/syscalls/flock.S b/libc/arch-arm/syscalls/flock.S
new file mode 100644
index 0000000..e2874f6
--- /dev/null
+++ b/libc/arch-arm/syscalls/flock.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_flock
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(flock)
diff --git a/libc/arch-arm/syscalls/fremovexattr.S b/libc/arch-arm/syscalls/fremovexattr.S
new file mode 100644
index 0000000..89be704
--- /dev/null
+++ b/libc/arch-arm/syscalls/fremovexattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fremovexattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fremovexattr)
diff --git a/libc/arch-arm/syscalls/fstat64.S b/libc/arch-arm/syscalls/fstat64.S
new file mode 100644
index 0000000..c2c7101
--- /dev/null
+++ b/libc/arch-arm/syscalls/fstat64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstat64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fstat64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fstat64)
+
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-arm/syscalls/fstatat64.S b/libc/arch-arm/syscalls/fstatat64.S
new file mode 100644
index 0000000..545dc16
--- /dev/null
+++ b/libc/arch-arm/syscalls/fstatat64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstatat64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fstatat64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fstatat64)
+
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-arm/syscalls/fsync.S b/libc/arch-arm/syscalls/fsync.S
new file mode 100644
index 0000000..24b9a87
--- /dev/null
+++ b/libc/arch-arm/syscalls/fsync.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_fsync
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(fsync)
diff --git a/libc/arch-arm/syscalls/ftruncate64.S b/libc/arch-arm/syscalls/ftruncate64.S
new file mode 100644
index 0000000..ee1a2a6
--- /dev/null
+++ b/libc/arch-arm/syscalls/ftruncate64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_ftruncate64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(ftruncate64)
diff --git a/libc/arch-arm/syscalls/getegid.S b/libc/arch-arm/syscalls/getegid.S
new file mode 100644
index 0000000..f4e17b5
--- /dev/null
+++ b/libc/arch-arm/syscalls/getegid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getegid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getegid)
diff --git a/libc/arch-arm/syscalls/geteuid.S b/libc/arch-arm/syscalls/geteuid.S
new file mode 100644
index 0000000..01898f8
--- /dev/null
+++ b/libc/arch-arm/syscalls/geteuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_geteuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(geteuid)
diff --git a/libc/arch-arm/syscalls/getgid.S b/libc/arch-arm/syscalls/getgid.S
new file mode 100644
index 0000000..ee124a6
--- /dev/null
+++ b/libc/arch-arm/syscalls/getgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getgid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getgid)
diff --git a/libc/arch-arm/syscalls/getgroups.S b/libc/arch-arm/syscalls/getgroups.S
new file mode 100644
index 0000000..4c1bfdb
--- /dev/null
+++ b/libc/arch-arm/syscalls/getgroups.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getgroups32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getgroups)
diff --git a/libc/arch-arm/syscalls/getitimer.S b/libc/arch-arm/syscalls/getitimer.S
new file mode 100644
index 0000000..b9773ad
--- /dev/null
+++ b/libc/arch-arm/syscalls/getitimer.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getitimer
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getitimer)
diff --git a/libc/arch-arm/syscalls/getpeername.S b/libc/arch-arm/syscalls/getpeername.S
new file mode 100644
index 0000000..6bf6002
--- /dev/null
+++ b/libc/arch-arm/syscalls/getpeername.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getpeername
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getpeername)
diff --git a/libc/arch-arm/syscalls/getpgid.S b/libc/arch-arm/syscalls/getpgid.S
new file mode 100644
index 0000000..d5c9c8a
--- /dev/null
+++ b/libc/arch-arm/syscalls/getpgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getpgid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getpgid)
diff --git a/libc/arch-arm/syscalls/getppid.S b/libc/arch-arm/syscalls/getppid.S
new file mode 100644
index 0000000..91db24e
--- /dev/null
+++ b/libc/arch-arm/syscalls/getppid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getppid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getppid)
diff --git a/libc/arch-arm/syscalls/getrandom.S b/libc/arch-arm/syscalls/getrandom.S
new file mode 100644
index 0000000..3f28af6
--- /dev/null
+++ b/libc/arch-arm/syscalls/getrandom.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getrandom
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getrandom)
diff --git a/libc/arch-arm/syscalls/getresgid.S b/libc/arch-arm/syscalls/getresgid.S
new file mode 100644
index 0000000..8fb7f28
--- /dev/null
+++ b/libc/arch-arm/syscalls/getresgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getresgid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getresgid)
diff --git a/libc/arch-arm/syscalls/getresuid.S b/libc/arch-arm/syscalls/getresuid.S
new file mode 100644
index 0000000..ebec6e1
--- /dev/null
+++ b/libc/arch-arm/syscalls/getresuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getresuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getresuid)
diff --git a/libc/arch-arm/syscalls/getrlimit.S b/libc/arch-arm/syscalls/getrlimit.S
new file mode 100644
index 0000000..0c9e662
--- /dev/null
+++ b/libc/arch-arm/syscalls/getrlimit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_ugetrlimit
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getrlimit)
diff --git a/libc/arch-arm/syscalls/getrusage.S b/libc/arch-arm/syscalls/getrusage.S
new file mode 100644
index 0000000..e74a4ad
--- /dev/null
+++ b/libc/arch-arm/syscalls/getrusage.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getrusage
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getrusage)
diff --git a/libc/arch-arm/syscalls/getsid.S b/libc/arch-arm/syscalls/getsid.S
new file mode 100644
index 0000000..c918820
--- /dev/null
+++ b/libc/arch-arm/syscalls/getsid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getsid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getsid)
diff --git a/libc/arch-arm/syscalls/getsockname.S b/libc/arch-arm/syscalls/getsockname.S
new file mode 100644
index 0000000..a30a291
--- /dev/null
+++ b/libc/arch-arm/syscalls/getsockname.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getsockname
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getsockname)
diff --git a/libc/arch-arm/syscalls/getsockopt.S b/libc/arch-arm/syscalls/getsockopt.S
new file mode 100644
index 0000000..4143bbd
--- /dev/null
+++ b/libc/arch-arm/syscalls/getsockopt.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_getsockopt
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getsockopt)
diff --git a/libc/arch-arm/syscalls/getuid.S b/libc/arch-arm/syscalls/getuid.S
new file mode 100644
index 0000000..cdc86bc
--- /dev/null
+++ b/libc/arch-arm/syscalls/getuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getuid)
diff --git a/libc/arch-arm/syscalls/getxattr.S b/libc/arch-arm/syscalls/getxattr.S
new file mode 100644
index 0000000..116d917
--- /dev/null
+++ b/libc/arch-arm/syscalls/getxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_getxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(getxattr)
diff --git a/libc/arch-arm/syscalls/init_module.S b/libc/arch-arm/syscalls/init_module.S
new file mode 100644
index 0000000..8fecf68
--- /dev/null
+++ b/libc/arch-arm/syscalls/init_module.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_init_module
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(init_module)
diff --git a/libc/arch-arm/syscalls/inotify_add_watch.S b/libc/arch-arm/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..61e666c
--- /dev/null
+++ b/libc/arch-arm/syscalls/inotify_add_watch.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_inotify_add_watch
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(inotify_add_watch)
diff --git a/libc/arch-arm/syscalls/inotify_init1.S b/libc/arch-arm/syscalls/inotify_init1.S
new file mode 100644
index 0000000..6cf066e
--- /dev/null
+++ b/libc/arch-arm/syscalls/inotify_init1.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_inotify_init1
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(inotify_init1)
diff --git a/libc/arch-arm/syscalls/inotify_rm_watch.S b/libc/arch-arm/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..1455da1
--- /dev/null
+++ b/libc/arch-arm/syscalls/inotify_rm_watch.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_inotify_rm_watch
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(inotify_rm_watch)
diff --git a/libc/arch-arm/syscalls/kill.S b/libc/arch-arm/syscalls/kill.S
new file mode 100644
index 0000000..82df861
--- /dev/null
+++ b/libc/arch-arm/syscalls/kill.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_kill
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(kill)
diff --git a/libc/arch-arm/syscalls/klogctl.S b/libc/arch-arm/syscalls/klogctl.S
new file mode 100644
index 0000000..47a03c6
--- /dev/null
+++ b/libc/arch-arm/syscalls/klogctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_syslog
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(klogctl)
diff --git a/libc/arch-arm/syscalls/lgetxattr.S b/libc/arch-arm/syscalls/lgetxattr.S
new file mode 100644
index 0000000..157271c
--- /dev/null
+++ b/libc/arch-arm/syscalls/lgetxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_lgetxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(lgetxattr)
diff --git a/libc/arch-arm/syscalls/linkat.S b/libc/arch-arm/syscalls/linkat.S
new file mode 100644
index 0000000..6e74d06
--- /dev/null
+++ b/libc/arch-arm/syscalls/linkat.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_linkat
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(linkat)
diff --git a/libc/arch-arm/syscalls/listen.S b/libc/arch-arm/syscalls/listen.S
new file mode 100644
index 0000000..5ad75c0
--- /dev/null
+++ b/libc/arch-arm/syscalls/listen.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_listen
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(listen)
diff --git a/libc/arch-arm/syscalls/listxattr.S b/libc/arch-arm/syscalls/listxattr.S
new file mode 100644
index 0000000..093927d
--- /dev/null
+++ b/libc/arch-arm/syscalls/listxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_listxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(listxattr)
diff --git a/libc/arch-arm/syscalls/llistxattr.S b/libc/arch-arm/syscalls/llistxattr.S
new file mode 100644
index 0000000..5d0e7c8
--- /dev/null
+++ b/libc/arch-arm/syscalls/llistxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_llistxattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(llistxattr)
diff --git a/libc/arch-arm/syscalls/lremovexattr.S b/libc/arch-arm/syscalls/lremovexattr.S
new file mode 100644
index 0000000..4e0bcec
--- /dev/null
+++ b/libc/arch-arm/syscalls/lremovexattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_lremovexattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(lremovexattr)
diff --git a/libc/arch-arm/syscalls/lseek.S b/libc/arch-arm/syscalls/lseek.S
new file mode 100644
index 0000000..cbdc441
--- /dev/null
+++ b/libc/arch-arm/syscalls/lseek.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_lseek
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(lseek)
diff --git a/libc/arch-arm/syscalls/lsetxattr.S b/libc/arch-arm/syscalls/lsetxattr.S
new file mode 100644
index 0000000..c41fb88
--- /dev/null
+++ b/libc/arch-arm/syscalls/lsetxattr.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_lsetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(lsetxattr)
diff --git a/libc/arch-arm/syscalls/madvise.S b/libc/arch-arm/syscalls/madvise.S
new file mode 100644
index 0000000..c2d7d20
--- /dev/null
+++ b/libc/arch-arm/syscalls/madvise.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_madvise
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(madvise)
diff --git a/libc/arch-arm/syscalls/mincore.S b/libc/arch-arm/syscalls/mincore.S
new file mode 100644
index 0000000..c93fe94
--- /dev/null
+++ b/libc/arch-arm/syscalls/mincore.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mincore
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mincore)
diff --git a/libc/arch-arm/syscalls/mkdirat.S b/libc/arch-arm/syscalls/mkdirat.S
new file mode 100644
index 0000000..4f93c61
--- /dev/null
+++ b/libc/arch-arm/syscalls/mkdirat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mkdirat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mkdirat)
diff --git a/libc/arch-arm/syscalls/mknodat.S b/libc/arch-arm/syscalls/mknodat.S
new file mode 100644
index 0000000..91baae8
--- /dev/null
+++ b/libc/arch-arm/syscalls/mknodat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mknodat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mknodat)
diff --git a/libc/arch-arm/syscalls/mlock.S b/libc/arch-arm/syscalls/mlock.S
new file mode 100644
index 0000000..eb72f6f
--- /dev/null
+++ b/libc/arch-arm/syscalls/mlock.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mlock
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mlock)
diff --git a/libc/arch-arm/syscalls/mlockall.S b/libc/arch-arm/syscalls/mlockall.S
new file mode 100644
index 0000000..2984087
--- /dev/null
+++ b/libc/arch-arm/syscalls/mlockall.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mlockall
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mlockall)
diff --git a/libc/arch-arm/syscalls/mount.S b/libc/arch-arm/syscalls/mount.S
new file mode 100644
index 0000000..ed28ab2
--- /dev/null
+++ b/libc/arch-arm/syscalls/mount.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_mount
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mount)
diff --git a/libc/arch-arm/syscalls/mprotect.S b/libc/arch-arm/syscalls/mprotect.S
new file mode 100644
index 0000000..9bb1282
--- /dev/null
+++ b/libc/arch-arm/syscalls/mprotect.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_mprotect
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(mprotect)
diff --git a/libc/arch-arm/syscalls/msync.S b/libc/arch-arm/syscalls/msync.S
new file mode 100644
index 0000000..bcbab04
--- /dev/null
+++ b/libc/arch-arm/syscalls/msync.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_msync
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(msync)
diff --git a/libc/arch-arm/syscalls/munlock.S b/libc/arch-arm/syscalls/munlock.S
new file mode 100644
index 0000000..bf1b814
--- /dev/null
+++ b/libc/arch-arm/syscalls/munlock.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_munlock
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(munlock)
diff --git a/libc/arch-arm/syscalls/munlockall.S b/libc/arch-arm/syscalls/munlockall.S
new file mode 100644
index 0000000..b45a5a2
--- /dev/null
+++ b/libc/arch-arm/syscalls/munlockall.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_munlockall
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(munlockall)
diff --git a/libc/arch-arm/syscalls/munmap.S b/libc/arch-arm/syscalls/munmap.S
new file mode 100644
index 0000000..2b7a121
--- /dev/null
+++ b/libc/arch-arm/syscalls/munmap.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_munmap
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(munmap)
diff --git a/libc/arch-arm/syscalls/nanosleep.S b/libc/arch-arm/syscalls/nanosleep.S
new file mode 100644
index 0000000..83fd323
--- /dev/null
+++ b/libc/arch-arm/syscalls/nanosleep.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_nanosleep
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(nanosleep)
diff --git a/libc/arch-arm/syscalls/personality.S b/libc/arch-arm/syscalls/personality.S
new file mode 100644
index 0000000..5ad6132
--- /dev/null
+++ b/libc/arch-arm/syscalls/personality.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_personality
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(personality)
diff --git a/libc/arch-arm/syscalls/pipe2.S b/libc/arch-arm/syscalls/pipe2.S
new file mode 100644
index 0000000..f543f9d
--- /dev/null
+++ b/libc/arch-arm/syscalls/pipe2.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_pipe2
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(pipe2)
diff --git a/libc/arch-arm/syscalls/prctl.S b/libc/arch-arm/syscalls/prctl.S
new file mode 100644
index 0000000..a2d869c
--- /dev/null
+++ b/libc/arch-arm/syscalls/prctl.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_prctl
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(prctl)
diff --git a/libc/arch-arm/syscalls/pread64.S b/libc/arch-arm/syscalls/pread64.S
new file mode 100644
index 0000000..dc07bb3
--- /dev/null
+++ b/libc/arch-arm/syscalls/pread64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_pread64
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(pread64)
diff --git a/libc/arch-arm/syscalls/prlimit64.S b/libc/arch-arm/syscalls/prlimit64.S
new file mode 100644
index 0000000..0f04aaa
--- /dev/null
+++ b/libc/arch-arm/syscalls/prlimit64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_prlimit64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(prlimit64)
diff --git a/libc/arch-arm/syscalls/process_vm_readv.S b/libc/arch-arm/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..48c49dc
--- /dev/null
+++ b/libc/arch-arm/syscalls/process_vm_readv.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_process_vm_readv
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(process_vm_readv)
diff --git a/libc/arch-arm/syscalls/process_vm_writev.S b/libc/arch-arm/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..4c21c43
--- /dev/null
+++ b/libc/arch-arm/syscalls/process_vm_writev.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_process_vm_writev
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(process_vm_writev)
diff --git a/libc/arch-arm/syscalls/pwrite64.S b/libc/arch-arm/syscalls/pwrite64.S
new file mode 100644
index 0000000..5749f6b
--- /dev/null
+++ b/libc/arch-arm/syscalls/pwrite64.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_pwrite64
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(pwrite64)
diff --git a/libc/arch-arm/syscalls/quotactl.S b/libc/arch-arm/syscalls/quotactl.S
new file mode 100644
index 0000000..fde17f4
--- /dev/null
+++ b/libc/arch-arm/syscalls/quotactl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_quotactl
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(quotactl)
diff --git a/libc/arch-arm/syscalls/read.S b/libc/arch-arm/syscalls/read.S
new file mode 100644
index 0000000..5051358
--- /dev/null
+++ b/libc/arch-arm/syscalls/read.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_read
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(read)
diff --git a/libc/arch-arm/syscalls/readahead.S b/libc/arch-arm/syscalls/readahead.S
new file mode 100644
index 0000000..6952b4e
--- /dev/null
+++ b/libc/arch-arm/syscalls/readahead.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_readahead
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(readahead)
diff --git a/libc/arch-arm/syscalls/readlinkat.S b/libc/arch-arm/syscalls/readlinkat.S
new file mode 100644
index 0000000..36d46fa
--- /dev/null
+++ b/libc/arch-arm/syscalls/readlinkat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_readlinkat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(readlinkat)
diff --git a/libc/arch-arm/syscalls/readv.S b/libc/arch-arm/syscalls/readv.S
new file mode 100644
index 0000000..565af6a
--- /dev/null
+++ b/libc/arch-arm/syscalls/readv.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_readv
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(readv)
diff --git a/libc/arch-arm/syscalls/recvfrom.S b/libc/arch-arm/syscalls/recvfrom.S
new file mode 100644
index 0000000..115a09c
--- /dev/null
+++ b/libc/arch-arm/syscalls/recvfrom.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_recvfrom
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(recvfrom)
diff --git a/libc/arch-arm/syscalls/recvmmsg.S b/libc/arch-arm/syscalls/recvmmsg.S
new file mode 100644
index 0000000..6cf2b92
--- /dev/null
+++ b/libc/arch-arm/syscalls/recvmmsg.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_recvmmsg
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(recvmmsg)
diff --git a/libc/arch-arm/syscalls/recvmsg.S b/libc/arch-arm/syscalls/recvmsg.S
new file mode 100644
index 0000000..19a9fca
--- /dev/null
+++ b/libc/arch-arm/syscalls/recvmsg.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_recvmsg
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(recvmsg)
diff --git a/libc/arch-arm/syscalls/removexattr.S b/libc/arch-arm/syscalls/removexattr.S
new file mode 100644
index 0000000..46f847d
--- /dev/null
+++ b/libc/arch-arm/syscalls/removexattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_removexattr
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(removexattr)
diff --git a/libc/arch-arm/syscalls/renameat.S b/libc/arch-arm/syscalls/renameat.S
new file mode 100644
index 0000000..89fc513
--- /dev/null
+++ b/libc/arch-arm/syscalls/renameat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_renameat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(renameat)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_max.S b/libc/arch-arm/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..23b1d62
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_get_priority_max.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_get_priority_max
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_get_priority_max)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_min.S b/libc/arch-arm/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..65a967c
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_get_priority_min.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_get_priority_min
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_get_priority_min)
diff --git a/libc/arch-arm/syscalls/sched_getparam.S b/libc/arch-arm/syscalls/sched_getparam.S
new file mode 100644
index 0000000..700041e
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_getparam.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_getparam
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_getparam)
diff --git a/libc/arch-arm/syscalls/sched_getscheduler.S b/libc/arch-arm/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..b4f5d13
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_getscheduler.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_getscheduler
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_getscheduler)
diff --git a/libc/arch-arm/syscalls/sched_rr_get_interval.S b/libc/arch-arm/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..ea30b62
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_rr_get_interval
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_rr_get_interval)
diff --git a/libc/arch-arm/syscalls/sched_setaffinity.S b/libc/arch-arm/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..636845b
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_setaffinity.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_setaffinity
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_setaffinity)
diff --git a/libc/arch-arm/syscalls/sched_setparam.S b/libc/arch-arm/syscalls/sched_setparam.S
new file mode 100644
index 0000000..f24b96e
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_setparam.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_setparam
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_setparam)
diff --git a/libc/arch-arm/syscalls/sched_setscheduler.S b/libc/arch-arm/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..5bfa202
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_setscheduler.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_setscheduler
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_setscheduler)
diff --git a/libc/arch-arm/syscalls/sched_yield.S b/libc/arch-arm/syscalls/sched_yield.S
new file mode 100644
index 0000000..7b93a6e
--- /dev/null
+++ b/libc/arch-arm/syscalls/sched_yield.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sched_yield
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sched_yield)
diff --git a/libc/arch-arm/syscalls/sendfile.S b/libc/arch-arm/syscalls/sendfile.S
new file mode 100644
index 0000000..52e78d0
--- /dev/null
+++ b/libc/arch-arm/syscalls/sendfile.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sendfile
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sendfile)
diff --git a/libc/arch-arm/syscalls/sendfile64.S b/libc/arch-arm/syscalls/sendfile64.S
new file mode 100644
index 0000000..416e9d2
--- /dev/null
+++ b/libc/arch-arm/syscalls/sendfile64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sendfile64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sendfile64)
diff --git a/libc/arch-arm/syscalls/sendmmsg.S b/libc/arch-arm/syscalls/sendmmsg.S
new file mode 100644
index 0000000..f97d264
--- /dev/null
+++ b/libc/arch-arm/syscalls/sendmmsg.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sendmmsg
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sendmmsg)
diff --git a/libc/arch-arm/syscalls/sendmsg.S b/libc/arch-arm/syscalls/sendmsg.S
new file mode 100644
index 0000000..215219a
--- /dev/null
+++ b/libc/arch-arm/syscalls/sendmsg.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sendmsg
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sendmsg)
diff --git a/libc/arch-arm/syscalls/sendto.S b/libc/arch-arm/syscalls/sendto.S
new file mode 100644
index 0000000..29b7b0b
--- /dev/null
+++ b/libc/arch-arm/syscalls/sendto.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_sendto
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sendto)
diff --git a/libc/arch-arm/syscalls/setdomainname.S b/libc/arch-arm/syscalls/setdomainname.S
new file mode 100644
index 0000000..4014a48
--- /dev/null
+++ b/libc/arch-arm/syscalls/setdomainname.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setdomainname
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setdomainname)
diff --git a/libc/arch-arm/syscalls/setfsgid.S b/libc/arch-arm/syscalls/setfsgid.S
new file mode 100644
index 0000000..2f0f08c
--- /dev/null
+++ b/libc/arch-arm/syscalls/setfsgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setfsgid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setfsgid)
diff --git a/libc/arch-arm/syscalls/setfsuid.S b/libc/arch-arm/syscalls/setfsuid.S
new file mode 100644
index 0000000..ce663e0
--- /dev/null
+++ b/libc/arch-arm/syscalls/setfsuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setfsuid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setfsuid)
diff --git a/libc/arch-arm/syscalls/setgid.S b/libc/arch-arm/syscalls/setgid.S
new file mode 100644
index 0000000..6f1cbed
--- /dev/null
+++ b/libc/arch-arm/syscalls/setgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setgid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setgid)
diff --git a/libc/arch-arm/syscalls/setgroups.S b/libc/arch-arm/syscalls/setgroups.S
new file mode 100644
index 0000000..1fb494c
--- /dev/null
+++ b/libc/arch-arm/syscalls/setgroups.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setgroups32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setgroups)
diff --git a/libc/arch-arm/syscalls/sethostname.S b/libc/arch-arm/syscalls/sethostname.S
new file mode 100644
index 0000000..c4c2db5
--- /dev/null
+++ b/libc/arch-arm/syscalls/sethostname.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sethostname
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sethostname)
diff --git a/libc/arch-arm/syscalls/setitimer.S b/libc/arch-arm/syscalls/setitimer.S
new file mode 100644
index 0000000..511a5d1
--- /dev/null
+++ b/libc/arch-arm/syscalls/setitimer.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setitimer
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setitimer)
diff --git a/libc/arch-arm/syscalls/setns.S b/libc/arch-arm/syscalls/setns.S
new file mode 100644
index 0000000..b1902dc
--- /dev/null
+++ b/libc/arch-arm/syscalls/setns.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setns
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setns)
diff --git a/libc/arch-arm/syscalls/setpgid.S b/libc/arch-arm/syscalls/setpgid.S
new file mode 100644
index 0000000..fe05fc9
--- /dev/null
+++ b/libc/arch-arm/syscalls/setpgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setpgid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setpgid)
diff --git a/libc/arch-arm/syscalls/setpriority.S b/libc/arch-arm/syscalls/setpriority.S
new file mode 100644
index 0000000..960eee0
--- /dev/null
+++ b/libc/arch-arm/syscalls/setpriority.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setpriority
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setpriority)
diff --git a/libc/arch-arm/syscalls/setregid.S b/libc/arch-arm/syscalls/setregid.S
new file mode 100644
index 0000000..0b5f444
--- /dev/null
+++ b/libc/arch-arm/syscalls/setregid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setregid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setregid)
diff --git a/libc/arch-arm/syscalls/setresgid.S b/libc/arch-arm/syscalls/setresgid.S
new file mode 100644
index 0000000..64677d3
--- /dev/null
+++ b/libc/arch-arm/syscalls/setresgid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setresgid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setresgid)
diff --git a/libc/arch-arm/syscalls/setresuid.S b/libc/arch-arm/syscalls/setresuid.S
new file mode 100644
index 0000000..e3888f6
--- /dev/null
+++ b/libc/arch-arm/syscalls/setresuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setresuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setresuid)
diff --git a/libc/arch-arm/syscalls/setreuid.S b/libc/arch-arm/syscalls/setreuid.S
new file mode 100644
index 0000000..15c2665
--- /dev/null
+++ b/libc/arch-arm/syscalls/setreuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setreuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setreuid)
diff --git a/libc/arch-arm/syscalls/setrlimit.S b/libc/arch-arm/syscalls/setrlimit.S
new file mode 100644
index 0000000..b9014eb
--- /dev/null
+++ b/libc/arch-arm/syscalls/setrlimit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setrlimit
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setrlimit)
diff --git a/libc/arch-arm/syscalls/setsid.S b/libc/arch-arm/syscalls/setsid.S
new file mode 100644
index 0000000..fb71474
--- /dev/null
+++ b/libc/arch-arm/syscalls/setsid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setsid
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setsid)
diff --git a/libc/arch-arm/syscalls/setsockopt.S b/libc/arch-arm/syscalls/setsockopt.S
new file mode 100644
index 0000000..8ea3893
--- /dev/null
+++ b/libc/arch-arm/syscalls/setsockopt.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_setsockopt
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setsockopt)
diff --git a/libc/arch-arm/syscalls/settimeofday.S b/libc/arch-arm/syscalls/settimeofday.S
new file mode 100644
index 0000000..00dfdeb
--- /dev/null
+++ b/libc/arch-arm/syscalls/settimeofday.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_settimeofday
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(settimeofday)
diff --git a/libc/arch-arm/syscalls/setuid.S b/libc/arch-arm/syscalls/setuid.S
new file mode 100644
index 0000000..447ed1b
--- /dev/null
+++ b/libc/arch-arm/syscalls/setuid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_setuid32
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setuid)
diff --git a/libc/arch-arm/syscalls/setxattr.S b/libc/arch-arm/syscalls/setxattr.S
new file mode 100644
index 0000000..8ba4b77
--- /dev/null
+++ b/libc/arch-arm/syscalls/setxattr.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_setxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(setxattr)
diff --git a/libc/arch-arm/syscalls/shutdown.S b/libc/arch-arm/syscalls/shutdown.S
new file mode 100644
index 0000000..51ed0cf
--- /dev/null
+++ b/libc/arch-arm/syscalls/shutdown.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_shutdown
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(shutdown)
diff --git a/libc/arch-arm/syscalls/sigaltstack.S b/libc/arch-arm/syscalls/sigaltstack.S
new file mode 100644
index 0000000..2f97800
--- /dev/null
+++ b/libc/arch-arm/syscalls/sigaltstack.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sigaltstack
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sigaltstack)
diff --git a/libc/arch-arm/syscalls/socketpair.S b/libc/arch-arm/syscalls/socketpair.S
new file mode 100644
index 0000000..e537235
--- /dev/null
+++ b/libc/arch-arm/syscalls/socketpair.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_socketpair
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(socketpair)
diff --git a/libc/arch-arm/syscalls/splice.S b/libc/arch-arm/syscalls/splice.S
new file mode 100644
index 0000000..6bc3f0d
--- /dev/null
+++ b/libc/arch-arm/syscalls/splice.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    mov     ip, sp
+    stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_splice
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(splice)
diff --git a/libc/arch-arm/syscalls/swapoff.S b/libc/arch-arm/syscalls/swapoff.S
new file mode 100644
index 0000000..25832ef
--- /dev/null
+++ b/libc/arch-arm/syscalls/swapoff.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_swapoff
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(swapoff)
diff --git a/libc/arch-arm/syscalls/swapon.S b/libc/arch-arm/syscalls/swapon.S
new file mode 100644
index 0000000..df4c71e
--- /dev/null
+++ b/libc/arch-arm/syscalls/swapon.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_swapon
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(swapon)
diff --git a/libc/arch-arm/syscalls/symlinkat.S b/libc/arch-arm/syscalls/symlinkat.S
new file mode 100644
index 0000000..ec2ee4f
--- /dev/null
+++ b/libc/arch-arm/syscalls/symlinkat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_symlinkat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(symlinkat)
diff --git a/libc/arch-arm/syscalls/sync.S b/libc/arch-arm/syscalls/sync.S
new file mode 100644
index 0000000..b73dcaa
--- /dev/null
+++ b/libc/arch-arm/syscalls/sync.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sync
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sync)
diff --git a/libc/arch-arm/syscalls/syncfs.S b/libc/arch-arm/syscalls/syncfs.S
new file mode 100644
index 0000000..26f2f14
--- /dev/null
+++ b/libc/arch-arm/syscalls/syncfs.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_syncfs
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(syncfs)
diff --git a/libc/arch-arm/syscalls/sysinfo.S b/libc/arch-arm/syscalls/sysinfo.S
new file mode 100644
index 0000000..1584ea4
--- /dev/null
+++ b/libc/arch-arm/syscalls/sysinfo.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_sysinfo
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(sysinfo)
diff --git a/libc/arch-arm/syscalls/tee.S b/libc/arch-arm/syscalls/tee.S
new file mode 100644
index 0000000..efd12ca
--- /dev/null
+++ b/libc/arch-arm/syscalls/tee.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_tee
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(tee)
diff --git a/libc/arch-arm/syscalls/tgkill.S b/libc/arch-arm/syscalls/tgkill.S
new file mode 100644
index 0000000..43fe62c
--- /dev/null
+++ b/libc/arch-arm/syscalls/tgkill.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_tgkill
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(tgkill)
diff --git a/libc/arch-arm/syscalls/timerfd_create.S b/libc/arch-arm/syscalls/timerfd_create.S
new file mode 100644
index 0000000..4aa3107
--- /dev/null
+++ b/libc/arch-arm/syscalls/timerfd_create.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timerfd_create
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(timerfd_create)
diff --git a/libc/arch-arm/syscalls/timerfd_gettime.S b/libc/arch-arm/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..6ae93e4
--- /dev/null
+++ b/libc/arch-arm/syscalls/timerfd_gettime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timerfd_gettime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(timerfd_gettime)
diff --git a/libc/arch-arm/syscalls/timerfd_settime.S b/libc/arch-arm/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..2dd4aac
--- /dev/null
+++ b/libc/arch-arm/syscalls/timerfd_settime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_timerfd_settime
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(timerfd_settime)
diff --git a/libc/arch-arm/syscalls/times.S b/libc/arch-arm/syscalls/times.S
new file mode 100644
index 0000000..1ff636d
--- /dev/null
+++ b/libc/arch-arm/syscalls/times.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_times
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(times)
diff --git a/libc/arch-arm/syscalls/truncate.S b/libc/arch-arm/syscalls/truncate.S
new file mode 100644
index 0000000..0bee4d2
--- /dev/null
+++ b/libc/arch-arm/syscalls/truncate.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_truncate
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(truncate)
diff --git a/libc/arch-arm/syscalls/truncate64.S b/libc/arch-arm/syscalls/truncate64.S
new file mode 100644
index 0000000..74e9eb2
--- /dev/null
+++ b/libc/arch-arm/syscalls/truncate64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate64)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_truncate64
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(truncate64)
diff --git a/libc/arch-arm/syscalls/umask.S b/libc/arch-arm/syscalls/umask.S
new file mode 100644
index 0000000..ca3e058
--- /dev/null
+++ b/libc/arch-arm/syscalls/umask.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_umask
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(umask)
diff --git a/libc/arch-arm/syscalls/umount2.S b/libc/arch-arm/syscalls/umount2.S
new file mode 100644
index 0000000..6e1ba32
--- /dev/null
+++ b/libc/arch-arm/syscalls/umount2.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_umount2
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(umount2)
diff --git a/libc/arch-arm/syscalls/uname.S b/libc/arch-arm/syscalls/uname.S
new file mode 100644
index 0000000..4f2b8a2
--- /dev/null
+++ b/libc/arch-arm/syscalls/uname.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_uname
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(uname)
diff --git a/libc/arch-arm/syscalls/unlinkat.S b/libc/arch-arm/syscalls/unlinkat.S
new file mode 100644
index 0000000..ac7bfae
--- /dev/null
+++ b/libc/arch-arm/syscalls/unlinkat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_unlinkat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(unlinkat)
diff --git a/libc/arch-arm/syscalls/unshare.S b/libc/arch-arm/syscalls/unshare.S
new file mode 100644
index 0000000..4558a60
--- /dev/null
+++ b/libc/arch-arm/syscalls/unshare.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_unshare
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(unshare)
diff --git a/libc/arch-arm/syscalls/utimensat.S b/libc/arch-arm/syscalls/utimensat.S
new file mode 100644
index 0000000..9524507
--- /dev/null
+++ b/libc/arch-arm/syscalls/utimensat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_utimensat
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(utimensat)
diff --git a/libc/arch-arm/syscalls/vmsplice.S b/libc/arch-arm/syscalls/vmsplice.S
new file mode 100644
index 0000000..90ab8b4
--- /dev/null
+++ b/libc/arch-arm/syscalls/vmsplice.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_vmsplice
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(vmsplice)
diff --git a/libc/arch-arm/syscalls/wait4.S b/libc/arch-arm/syscalls/wait4.S
new file mode 100644
index 0000000..40bb5a5
--- /dev/null
+++ b/libc/arch-arm/syscalls/wait4.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_wait4
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(wait4)
diff --git a/libc/arch-arm/syscalls/write.S b/libc/arch-arm/syscalls/write.S
new file mode 100644
index 0000000..4abbe6b
--- /dev/null
+++ b/libc/arch-arm/syscalls/write.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_write
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(write)
diff --git a/libc/arch-arm/syscalls/writev.S b/libc/arch-arm/syscalls/writev.S
new file mode 100644
index 0000000..3103237
--- /dev/null
+++ b/libc/arch-arm/syscalls/writev.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    mov     ip, r7
+    .cfi_register r7, ip
+    ldr     r7, =__NR_writev
+    swi     #0
+    mov     r7, ip
+    .cfi_restore r7
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno_internal
+END(writev)
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index a76e9ca..6c01572 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -26,13 +26,10 @@
  * SUCH DAMAGE.
  */
 
-#include <platform/bionic/tls_defines.h>
 #include <private/bionic_asm.h>
+#include <private/bionic_asm_tls.h>
 #include <asm/signal.h>
-
-// Must match the defines in linux/sched.h
-#define CLONE_VM 0x00000100
-#define CLONE_VFORK 0x00004000
+#include <linux/sched.h>
 
 ENTRY(vfork)
 __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
diff --git a/libc/arch-arm64/default/bionic/memchr.S b/libc/arch-arm64/default/bionic/memchr.S
deleted file mode 100644
index 7fbcc8f..0000000
--- a/libc/arch-arm64/default/bionic/memchr.S
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
-   Copyright (c) 2014, ARM Limited
-   All rights Reserved.
-   Copyright (c) 2014, Linaro Ltd.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the company nor the names of its contributors
-         may be used to endorse or promote products derived from this
-         software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- * Neon Available.
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define chrin		w1
-#define cntin		x2
-
-#define result		x0
-
-#define src		x3
-#define	tmp		x4
-#define wtmp2		w5
-#define synd		x6
-#define soff		x9
-#define cntrem		x10
-
-#define vrepchr		v0
-#define vdata1		v1
-#define vdata2		v2
-#define vhas_chr1	v3
-#define vhas_chr2	v4
-#define vrepmask	v5
-#define vend		v6
-
-/*
- * Core algorithm:
- *
- * For each 32-byte chunk we calculate a 64-bit syndrome value, with two bits
- * per byte. For each tuple, bit 0 is set if the relevant byte matched the
- * requested character and bit 1 is not used (faster than using a 32bit
- * syndrome). Since the bits in the syndrome reflect exactly the order in which
- * things occur in the original string, counting trailing zeros allows to
- * identify exactly which byte has matched.
- */
-
-ENTRY(memchr_default)
-	/*
-	 * Magic constant 0x40100401 allows us to identify which lane matches
-	 * the requested byte.
-	 */
-	cbz	cntin, .Lzero_length
-	mov	wtmp2, #0x0401
-	movk	wtmp2, #0x4010, lsl #16
-	dup	vrepchr.16b, chrin
-	/* Work with aligned 32-byte chunks */
-	bic	src, srcin, #31
-	dup	vrepmask.4s, wtmp2
-	ands	soff, srcin, #31
-	and	cntrem, cntin, #31
-	b.eq	.Lloop
-
-	/*
-	 * Input string is not 32-byte aligned. We calculate the syndrome
-	 * value for the aligned 32 bytes block containing the first bytes
-	 * and mask the irrelevant part.
-	 */
-
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	sub	tmp, soff, #32
-	adds	cntin, cntin, tmp
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
-	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
-	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
-	mov	synd, vend.d[0]
-	/* Clear the soff*2 lower bits */
-	lsl	tmp, soff, #1
-	lsr	synd, synd, tmp
-	lsl	synd, synd, tmp
-	/* The first block can also be the last */
-	b.ls	.Lmasklast
-	/* Have we found something already? */
-	cbnz	synd, .Ltail
-
-.Lloop:
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	subs	cntin, cntin, #32
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	/* If we're out of data we finish regardless of the result */
-	b.ls	.Lend
-	/* Use a fast check for the termination condition */
-	orr	vend.16b, vhas_chr1.16b, vhas_chr2.16b
-	addp	vend.2d, vend.2d, vend.2d
-	mov	synd, vend.d[0]
-	/* We're not out of data, loop if we haven't found the character */
-	cbz	synd, .Lloop
-
-.Lend:
-	/* Termination condition found, let's calculate the syndrome value */
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
-	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
-	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
-	mov	synd, vend.d[0]
-	/* Only do the clear for the last possible block */
-	b.hi	.Ltail
-
-.Lmasklast:
-	/* Clear the (32 - ((cntrem + soff) % 32)) * 2 upper bits */
-	add	tmp, cntrem, soff
-	and	tmp, tmp, #31
-	sub	tmp, tmp, #32
-	neg	tmp, tmp, lsl #1
-	lsl	synd, synd, tmp
-	lsr	synd, synd, tmp
-
-.Ltail:
-	/* Count the trailing zeros using bit reversing */
-	rbit	synd, synd
-	/* Compensate the last post-increment */
-	sub	src, src, #32
-	/* Check that we have found a character */
-	cmp	synd, #0
-	/* And count the leading zeros */
-	clz	synd, synd
-	/* Compute the potential result */
-	add	result, src, synd, lsr #1
-	/* Select result or NULL */
-	csel	result, xzr, result, eq
-	ret
-
-.Lzero_length:
-	mov	result, xzr
-	ret
-END(memchr_default)
diff --git a/libc/arch-arm64/default/bionic/strchr.S b/libc/arch-arm64/default/bionic/strchr.S
deleted file mode 100644
index f8cb724..0000000
--- a/libc/arch-arm64/default/bionic/strchr.S
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
-   Copyright (c) 2014, ARM Limited
-   All rights Reserved.
-   Copyright (c) 2014, Linaro Ltd.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the company nor the names of its contributors
-         may be used to endorse or promote products derived from this
-         software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- * Neon Available.
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define chrin		w1
-
-#define result		x0
-
-#define src		x2
-#define	tmp1		x3
-#define wtmp2		w4
-#define tmp3		x5
-
-#define vrepchr		v0
-#define vdata1		v1
-#define vdata2		v2
-#define vhas_nul1	v3
-#define vhas_nul2	v4
-#define vhas_chr1	v5
-#define vhas_chr2	v6
-#define vrepmask_0	v7
-#define vrepmask_c	v16
-#define vend1		v17
-#define vend2		v18
-
-/* Core algorithm.
-
-   For each 32-byte hunk we calculate a 64-bit syndrome value, with
-   two bits per byte (LSB is always in bits 0 and 1, for both big
-   and little-endian systems).  For each tuple, bit 0 is set iff
-   the relevant byte matched the requested character; bit 1 is set
-   iff the relevant byte matched the NUL end of string (we trigger
-   off bit0 for the special case of looking for NUL).  Since the bits
-   in the syndrome reflect exactly the order in which things occur
-   in the original string a count_trailing_zeros() operation will
-   identify exactly which byte is causing the termination, and why.  */
-
-/* Locals and temporaries.  */
-
-ENTRY(strchr_default)
-	/* Magic constant 0x40100401 to allow us to identify which lane
-	   matches the requested byte.  Magic constant 0x80200802 used
-	   similarly for NUL termination.  */
-	mov	wtmp2, #0x0401
-	movk	wtmp2, #0x4010, lsl #16
-	dup	vrepchr.16b, chrin
-	bic	src, srcin, #31		/* Work with aligned 32-byte hunks.  */
-	dup	vrepmask_c.4s, wtmp2
-	ands	tmp1, srcin, #31
-	add	vrepmask_0.4s, vrepmask_c.4s, vrepmask_c.4s /* equiv: lsl #1 */
-	b.eq	.Lloop
-
-	/* Input string is not 32-byte aligned.  Rather than forcing
-	   the padding bytes to a safe value, we calculate the syndrome
-	   for all the bytes, but then mask off those bits of the
-	   syndrome that are related to the padding.  */
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	neg	tmp1, tmp1
-	cmeq	vhas_nul1.16b, vdata1.16b, #0
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_nul2.16b, vdata2.16b, #0
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
-	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	lsl	tmp1, tmp1, #1
-	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
-	mov	tmp3, #~0
-	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
-	lsr	tmp1, tmp3, tmp1
-
-	mov	tmp3, vend1.d[0]
-	bic	tmp1, tmp3, tmp1	// Mask padding bits.
-	cbnz	tmp1, .Ltail
-
-.Lloop:
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	cmeq	vhas_nul1.16b, vdata1.16b, #0
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_nul2.16b, vdata2.16b, #0
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	/* Use a fast check for the termination condition.  */
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	orr	vend1.16b, vend1.16b, vend2.16b
-	addp	vend1.2d, vend1.2d, vend1.2d
-	mov	tmp1, vend1.d[0]
-	cbz	tmp1, .Lloop
-
-	/* Termination condition found.  Now need to establish exactly why
-	   we terminated.  */
-	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
-	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
-	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
-
-	mov	tmp1, vend1.d[0]
-.Ltail:
-	/* Count the trailing zeros, by bit reversing...  */
-	rbit	tmp1, tmp1
-	/* Re-bias source.  */
-	sub	src, src, #32
-	clz	tmp1, tmp1	/* And counting the leading zeros.  */
-	/* Tmp1 is even if the target charager was found first.  Otherwise
-	   we've found the end of string and we weren't looking for NUL.  */
-	tst	tmp1, #1
-	add	result, src, tmp1, lsr #1
-	csel	result, result, xzr, eq
-	ret
-END(strchr_default)
diff --git a/libc/arch-arm64/default/bionic/strcmp.S b/libc/arch-arm64/default/bionic/strcmp.S
deleted file mode 100644
index dfac7c4..0000000
--- a/libc/arch-arm64/default/bionic/strcmp.S
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (c) 2012, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-#define L(label) .L ## label
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-/* Parameters and result.  */
-#define src1		x0
-#define src2		x1
-#define result		x0
-
-/* Internal variables.  */
-#define data1		x2
-#define data1w		w2
-#define data2		x3
-#define data2w		w3
-#define has_nul		x4
-#define diff		x5
-#define syndrome	x6
-#define tmp1		x7
-#define tmp2		x8
-#define tmp3		x9
-#define zeroones	x10
-#define pos		x11
-
-	/* Start of performance-critical section  -- one 64B cache line.  */
-ENTRY(strcmp_default)
-.p2align  6
-	eor	tmp1, src1, src2
-	mov	zeroones, #REP8_01
-	tst	tmp1, #7
-	b.ne	L(misaligned8)
-	ands	tmp1, src1, #7
-	b.ne	L(mutual_align)
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-L(loop_aligned):
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-L(start_realigned):
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	orr	syndrome, diff, has_nul
-	cbz	syndrome, L(loop_aligned)
-	/* End of performance-critical section  -- one 64B cache line.  */
-
-L(end):
-#ifndef	__AARCH64EB__
-	rev	syndrome, syndrome
-	rev	data1, data1
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	clz	pos, syndrome
-	rev	data2, data2
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#else
-	/* For big-endian we cannot use the trick with the syndrome value
-	   as carry-propagation can corrupt the upper bits if the trailing
-	   bytes in the string contain 0x01.  */
-	/* However, if there is no NUL byte in the dword, we can generate
-	   the result directly.  We can't just subtract the bytes as the
-	   MSB might be significant.  */
-	cbnz	has_nul, 1f
-	cmp	data1, data2
-	cset	result, ne
-	cneg	result, result, lo
-	ret
-1:
-	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
-	rev	tmp3, data1
-	sub	tmp1, tmp3, zeroones
-	orr	tmp2, tmp3, #REP8_7f
-	bic	has_nul, tmp1, tmp2
-	rev	has_nul, has_nul
-	orr	syndrome, diff, has_nul
-	clz	pos, syndrome
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#endif
-
-L(mutual_align):
-	/* Sources are mutually aligned, but are not currently at an
-	   alignment boundary.  Round down the addresses and then mask off
-	   the bytes that preceed the start point.  */
-	bic	src1, src1, #7
-	bic	src2, src2, #7
-	lsl	tmp1, tmp1, #3		/* Bytes beyond alignment -> bits.  */
-	ldr	data1, [src1], #8
-	neg	tmp1, tmp1		/* Bits to alignment -64.  */
-	ldr	data2, [src2], #8
-	mov	tmp2, #~0
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
-#endif
-	orr	data1, data1, tmp2
-	orr	data2, data2, tmp2
-	b	L(start_realigned)
-
-L(misaligned8):
-	/* Align SRC1 to 8 bytes and then compare 8 bytes at a time, always
-	   checking to make sure that we don't access beyond page boundary in
-	   SRC2.  */
-	tst	src1, #7
-	b.eq	L(loop_misaligned)
-L(do_misaligned):
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	cmp	data1w, #1
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.ne	L(done)
-	tst	src1, #7
-	b.ne	L(do_misaligned)
-
-L(loop_misaligned):
-	/* Test if we are within the last dword of the end of a 4K page.  If
-	   yes then jump back to the misaligned loop to copy a byte at a time.  */
-	and	tmp1, src2, #0xff8
-	eor	tmp1, tmp1, #0xff8
-	cbz	tmp1, L(do_misaligned)
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	orr	syndrome, diff, has_nul
-	cbz	syndrome, L(loop_misaligned)
-	b	L(end)
-
-L(done):
-	sub	result, data1, data2
-	ret
-END(strcmp_default)
diff --git a/libc/arch-arm64/default/bionic/strlen.S b/libc/arch-arm64/default/bionic/strlen.S
deleted file mode 100644
index 07c5294..0000000
--- a/libc/arch-arm64/default/bionic/strlen.S
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (c) 2013-2015, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-	 notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-	 notice, this list of conditions and the following disclaimer in the
-	 documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-	 names of its contributors may be used to endorse or promote products
-	 derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
- */
-
-#include <private/bionic_asm.h>
-
-/* To test the page crossing code path more thoroughly, compile with
-   -DTEST_PAGE_CROSS - this will force all calls through the slower
-   entry path.  This option is not intended for production use.	 */
-
-/* Arguments and results.  */
-#define srcin		x0
-#define len		x0
-
-/* Locals and temporaries.  */
-#define src		x1
-#define data1		x2
-#define data2		x3
-#define has_nul1	x4
-#define has_nul2	x5
-#define tmp1		x4
-#define tmp2		x5
-#define tmp3		x6
-#define tmp4		x7
-#define zeroones	x8
-
-#define L(l) .L ## l
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word. A faster check
-	   (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
-	   false hits for characters 129..255.	*/
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-#ifdef TEST_PAGE_CROSS
-# define MIN_PAGE_SIZE 15
-#else
-# define MIN_PAGE_SIZE 4096
-#endif
-
-	/* Since strings are short on average, we check the first 16 bytes
-	   of the string for a NUL character.  In order to do an unaligned ldp
-	   safely we have to do a page cross check first.  If there is a NUL
-	   byte we calculate the length from the 2 8-byte words using
-	   conditional select to reduce branch mispredictions (it is unlikely
-	   strlen will be repeatedly called on strings with the same length).
-
-	   If the string is longer than 16 bytes, we align src so don't need
-	   further page cross checks, and process 32 bytes per iteration
-	   using the fast NUL check.  If we encounter non-ASCII characters,
-	   fallback to a second loop using the full NUL check.
-
-	   If the page cross check fails, we read 16 bytes from an aligned
-	   address, remove any characters before the string, and continue
-	   in the main loop using aligned loads.  Since strings crossing a
-	   page in the first 16 bytes are rare (probability of
-	   16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
-
-	   AArch64 systems have a minimum page size of 4k.  We don't bother
-	   checking for larger page sizes - the cost of setting up the correct
-	   page size is just not worth the extra gain from a small reduction in
-	   the cases taking the slow path.  Note that we only care about
-	   whether the first fetch, which may be misaligned, crosses a page
-	   boundary.  */
-
-ENTRY(strlen_default)
-	and	tmp1, srcin, MIN_PAGE_SIZE - 1
-	mov	zeroones, REP8_01
-	cmp	tmp1, MIN_PAGE_SIZE - 16
-	b.gt	L(page_cross)
-	ldp	data1, data2, [srcin]
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul1/2 directly.
-	   Since we expect strings to be small and early-exit,
-	   byte-swap the data now so has_null1/2 will be correct.  */
-	rev	data1, data1
-	rev	data2, data2
-#endif
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(main_loop_entry)
-
-	/* Enter with C = has_nul1 == 0.  */
-	csel	has_nul1, has_nul1, has_nul2, cc
-	mov	len, 8
-	rev	has_nul1, has_nul1
-	clz	tmp1, has_nul1
-	csel	len, xzr, len, cc
-	add	len, len, tmp1, lsr 3
-	ret
-
-	/* The inner loop processes 32 bytes per iteration and uses the fast
-	   NUL check.  If we encounter non-ASCII characters, use a second
-	   loop with the accurate NUL check.  */
-	.p2align 4
-L(main_loop_entry):
-	bic	src, srcin, 15
-	sub	src, src, 16
-L(main_loop):
-	ldp	data1, data2, [src, 32]!
-.Lpage_cross_entry:
-	sub	tmp1, data1, zeroones
-	sub	tmp3, data2, zeroones
-	orr	tmp2, tmp1, tmp3
-	tst	tmp2, zeroones, lsl 7
-	bne	1f
-	ldp	data1, data2, [src, 16]
-	sub	tmp1, data1, zeroones
-	sub	tmp3, data2, zeroones
-	orr	tmp2, tmp1, tmp3
-	tst	tmp2, zeroones, lsl 7
-	beq	L(main_loop)
-	add	src, src, 16
-1:
-	/* The fast check failed, so do the slower, accurate NUL check.	 */
-	orr	tmp2, data1, REP8_7f
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(nonascii_loop)
-
-	/* Enter with C = has_nul1 == 0.  */
-L(tail):
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul1/2 directly.  The
-	   easiest way to get the correct byte is to byte-swap the data
-	   and calculate the syndrome a second time.  */
-	csel	data1, data1, data2, cc
-	rev	data1, data1
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	bic	has_nul1, tmp1, tmp2
-#else
-	csel	has_nul1, has_nul1, has_nul2, cc
-#endif
-	sub	len, src, srcin
-	rev	has_nul1, has_nul1
-	add	tmp2, len, 8
-	clz	tmp1, has_nul1
-	csel	len, len, tmp2, cc
-	add	len, len, tmp1, lsr 3
-	ret
-
-L(nonascii_loop):
-	ldp	data1, data2, [src, 16]!
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	bne	L(tail)
-	ldp	data1, data2, [src, 16]!
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(nonascii_loop)
-	b	L(tail)
-
-	/* Load 16 bytes from [srcin & ~15] and force the bytes that precede
-	   srcin to 0x7f, so we ignore any NUL bytes before the string.
-	   Then continue in the aligned loop.  */
-L(page_cross):
-	bic	src, srcin, 15
-	ldp	data1, data2, [src]
-	lsl	tmp1, srcin, 3
-	mov	tmp4, -1
-#ifdef __AARCH64EB__
-	/* Big-endian.	Early bytes are at MSB.	 */
-	lsr	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsl	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
-#endif
-	orr	tmp1, tmp1, REP8_80
-	orn	data1, data1, tmp1
-	orn	tmp2, data2, tmp1
-	tst	srcin, 8
-	csel	data1, data1, tmp4, eq
-	csel	data2, data2, tmp2, eq
-	b	L(page_cross_entry)
-
-END(strlen_default)
diff --git a/libc/arch-arm64/default/bionic/strncmp.S b/libc/arch-arm64/default/bionic/strncmp.S
deleted file mode 100644
index 5432b73..0000000
--- a/libc/arch-arm64/default/bionic/strncmp.S
+++ /dev/null
@@ -1,280 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-/* Parameters and result.  */
-#define src1		x0
-#define src2		x1
-#define limit		x2
-#define result		x0
-
-/* Internal variables.  */
-#define data1		x3
-#define data1w		w3
-#define data2		x4
-#define data2w		w4
-#define has_nul		x5
-#define diff		x6
-#define syndrome	x7
-#define tmp1		x8
-#define tmp2		x9
-#define tmp3		x10
-#define zeroones	x11
-#define pos		x12
-#define limit_wd	x13
-#define mask		x14
-#define endloop		x15
-#define count		mask
-
-	.text
-	.p2align 6
-	.rep 7
-	nop	/* Pad so that the loop below fits a cache line.  */
-	.endr
-ENTRY(strncmp_default)
-	cbz	limit, .Lret0
-	eor	tmp1, src1, src2
-	mov	zeroones, #REP8_01
-	tst	tmp1, #7
-	and	count, src1, #7
-	b.ne	.Lmisaligned8
-	cbnz	count, .Lmutual_align
-	/* Calculate the number of full and partial words -1.  */
-	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
-	lsr	limit_wd, limit_wd, #3	/* Convert to Dwords.  */
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-	/* Start of performance-critical section  -- one 64B cache line.  */
-.Lloop_aligned:
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-.Lstart_realigned:
-	subs	limit_wd, limit_wd, #1
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	csinv	endloop, diff, xzr, pl	/* Last Dword or differences.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	endloop, #0, #0, eq
-	b.eq	.Lloop_aligned
-	/* End of performance-critical section  -- one 64B cache line.  */
-
-	/* Not reached the limit, must have found the end or a diff.  */
-	tbz	limit_wd, #63, .Lnot_limit
-
-	/* Limit % 8 == 0 => all bytes significant.  */
-	ands	limit, limit, #7
-	b.eq	.Lnot_limit
-
-	lsl	limit, limit, #3	/* Bits -> bytes.  */
-	mov	mask, #~0
-#ifdef __AARCH64EB__
-	lsr	mask, mask, limit
-#else
-	lsl	mask, mask, limit
-#endif
-	bic	data1, data1, mask
-	bic	data2, data2, mask
-
-	/* Make sure that the NUL byte is marked in the syndrome.  */
-	orr	has_nul, has_nul, mask
-
-.Lnot_limit:
-	orr	syndrome, diff, has_nul
-
-#ifndef	__AARCH64EB__
-	rev	syndrome, syndrome
-	rev	data1, data1
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	clz	pos, syndrome
-	rev	data2, data2
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#else
-	/* For big-endian we cannot use the trick with the syndrome value
-	   as carry-propagation can corrupt the upper bits if the trailing
-	   bytes in the string contain 0x01.  */
-	/* However, if there is no NUL byte in the dword, we can generate
-	   the result directly.  We can't just subtract the bytes as the
-	   MSB might be significant.  */
-	cbnz	has_nul, 1f
-	cmp	data1, data2
-	cset	result, ne
-	cneg	result, result, lo
-	ret
-1:
-	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
-	rev	tmp3, data1
-	sub	tmp1, tmp3, zeroones
-	orr	tmp2, tmp3, #REP8_7f
-	bic	has_nul, tmp1, tmp2
-	rev	has_nul, has_nul
-	orr	syndrome, diff, has_nul
-	clz	pos, syndrome
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#endif
-
-.Lmutual_align:
-	/* Sources are mutually aligned, but are not currently at an
-	   alignment boundary.  Round down the addresses and then mask off
-	   the bytes that precede the start point.
-	   We also need to adjust the limit calculations, but without
-	   overflowing if the limit is near ULONG_MAX.  */
-	bic	src1, src1, #7
-	bic	src2, src2, #7
-	ldr	data1, [src1], #8
-	neg	tmp3, count, lsl #3	/* 64 - bits(bytes beyond align). */
-	ldr	data2, [src2], #8
-	mov	tmp2, #~0
-	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
-#endif
-	and	tmp3, limit_wd, #7
-	lsr	limit_wd, limit_wd, #3
-	/* Adjust the limit. Only low 3 bits used, so overflow irrelevant.  */
-	add	limit, limit, count
-	add	tmp3, tmp3, count
-	orr	data1, data1, tmp2
-	orr	data2, data2, tmp2
-	add	limit_wd, limit_wd, tmp3, lsr #3
-	b	.Lstart_realigned
-
-	.p2align 6
-	/* Don't bother with dwords for up to 16 bytes.  */
-.Lmisaligned8:
-	cmp	limit, #16
-	b.hs	.Ltry_misaligned_words
-
-.Lbyte_loop:
-	/* Perhaps we can do better than this.  */
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	subs	limit, limit, #1
-	ccmp	data1w, #1, #0, hi	/* NZCV = 0b0000.  */
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.eq	.Lbyte_loop
-.Ldone:
-	sub	result, data1, data2
-	ret
-	/* Align the SRC1 to a dword by doing a bytewise compare and then do
-	   the dword loop.  */
-.Ltry_misaligned_words:
-	lsr	limit_wd, limit, #3
-	cbz	count, .Ldo_misaligned
-
-	neg	count, count
-	and	count, count, #7
-	sub	limit, limit, count
-	lsr	limit_wd, limit, #3
-
-.Lpage_end_loop:
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	cmp	data1w, #1
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.ne	.Ldone
-	subs	count, count, #1
-	b.hi	.Lpage_end_loop
-
-.Ldo_misaligned:
-	/* Prepare ourselves for the next page crossing.  Unlike the aligned
-	   loop, we fetch 1 less dword because we risk crossing bounds on
-	   SRC2.  */
-	mov	count, #8
-	subs	limit_wd, limit_wd, #1
-	b.lo	.Ldone_loop
-.Lloop_misaligned:
-	and	tmp2, src2, #0xff8
-	eor	tmp2, tmp2, #0xff8
-	cbz	tmp2, .Lpage_end_loop
-
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	diff, #0, #0, eq
-	b.ne	.Lnot_limit
-	subs	limit_wd, limit_wd, #1
-	b.pl	.Lloop_misaligned
-
-.Ldone_loop:
-	/* We found a difference or a NULL before the limit was reached.  */
-	and	limit, limit, #7
-	cbz	limit, .Lnot_limit
-	/* Read the last word.  */
-	sub	src1, src1, 8
-	sub	src2, src2, 8
-	ldr	data1, [src1, limit]
-	ldr	data2, [src2, limit]
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	diff, #0, #0, eq
-	b.ne	.Lnot_limit
-
-.Lret0:
-	mov	result, #0
-	ret
-END(strncmp_default)
diff --git a/libc/arch-arm64/default/bionic/strnlen.S b/libc/arch-arm64/default/bionic/strnlen.S
deleted file mode 100644
index 1694532..0000000
--- a/libc/arch-arm64/default/bionic/strnlen.S
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define len		x0
-#define limit		x1
-
-/* Locals and temporaries.  */
-#define src		x2
-#define data1		x3
-#define data2		x4
-#define data2a		x5
-#define has_nul1	x6
-#define has_nul2	x7
-#define tmp1		x8
-#define tmp2		x9
-#define tmp3		x10
-#define tmp4		x11
-#define zeroones	x12
-#define pos		x13
-#define limit_wd	x14
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-	.text
-	.p2align	6
-.Lstart:
-	/* Pre-pad to ensure critical loop begins an icache line.  */
-	.rep 7
-	nop
-	.endr
-	/* Put this code here to avoid wasting more space with pre-padding.  */
-.Lhit_limit:
-	mov	len, limit
-	ret
-
-ENTRY(strnlen_default)
-	cbz	limit, .Lhit_limit
-	mov	zeroones, #REP8_01
-	bic	src, srcin, #15
-	ands	tmp1, srcin, #15
-	b.ne	.Lmisaligned
-	/* Calculate the number of full and partial words -1.  */
-	sub	limit_wd, limit, #1	/* Limit != 0, so no underflow.  */
-	lsr	limit_wd, limit_wd, #4	/* Convert to Qwords.  */
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-	/* The inner loop deals with two Dwords at a time.  This has a
-	   slightly higher start-up cost, but we should win quite quickly,
-	   especially on cores with a high number of issue slots per
-	   cycle, as we get much better parallelism out of the operations.  */
-
-	/* Start of critial section -- keep to one 64Byte cache line.  */
-.Lloop:
-	ldp	data1, data2, [src], #16
-.Lrealigned:
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, #REP8_7f
-	bic	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	subs	limit_wd, limit_wd, #1
-	orr	tmp1, has_nul1, has_nul2
-	ccmp	tmp1, #0, #0, pl	/* NZCV = 0000  */
-	b.eq	.Lloop
-	/* End of critical section -- keep to one 64Byte cache line.  */
-
-	orr	tmp1, has_nul1, has_nul2
-	cbz	tmp1, .Lhit_limit	/* No null in final Qword.  */
-
-	/* We know there's a null in the final Qword.  The easiest thing
-	   to do now is work out the length of the string and return
-	   MIN (len, limit).  */
-
-	sub	len, src, srcin
-	cbz	has_nul1, .Lnul_in_data2
-#ifdef __AARCH64EB__
-	mov	data2, data1
-#endif
-	sub	len, len, #8
-	mov	has_nul2, has_nul1
-.Lnul_in_data2:
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul directly.  The
-	   easiest way to get the correct byte is to byte-swap the data
-	   and calculate the syndrome a second time.  */
-	rev	data2, data2
-	sub	tmp1, data2, zeroones
-	orr	tmp2, data2, #REP8_7f
-	bic	has_nul2, tmp1, tmp2
-#endif
-	sub	len, len, #8
-	rev	has_nul2, has_nul2
-	clz	pos, has_nul2
-	add	len, len, pos, lsr #3		/* Bits to bytes.  */
-	cmp	len, limit
-	csel	len, len, limit, ls		/* Return the lower value.  */
-	ret
-
-.Lmisaligned:
-	/* Deal with a partial first word.
-	   We're doing two things in parallel here;
-	   1) Calculate the number of words (but avoiding overflow if
-	      limit is near ULONG_MAX) - to do this we need to work out
-	      limit + tmp1 - 1 as a 65-bit value before shifting it;
-	   2) Load and mask the initial data words - we force the bytes
-	      before the ones we are interested in to 0xff - this ensures
-	      early bytes will not hit any zero detection.  */
-	sub	limit_wd, limit, #1
-	neg	tmp4, tmp1
-	cmp	tmp1, #8
-
-	and	tmp3, limit_wd, #15
-	lsr	limit_wd, limit_wd, #4
-	mov	tmp2, #~0
-
-	ldp	data1, data2, [src], #16
-	lsl	tmp4, tmp4, #3		/* Bytes beyond alignment -> bits.  */
-	add	tmp3, tmp3, tmp1
-
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
-#endif
-	add	limit_wd, limit_wd, tmp3, lsr #4
-
-	orr	data1, data1, tmp2
-	orr	data2a, data2, tmp2
-
-	csinv	data1, data1, xzr, le
-	csel	data2, data2, data2a, le
-	b	.Lrealigned
-END(strnlen_default)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
deleted file mode 100644
index 37abea4..0000000
--- a/libc/arch-arm64/dynamic_function_dispatch.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2019 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 <platform/bionic/mte_kernel.h>
-#include <private/bionic_ifuncs.h>
-#include <stddef.h>
-#include <sys/auxv.h>
-
-extern "C" {
-
-static bool supports_mte(unsigned long hwcap2) {
-#ifdef ANDROID_EXPERIMENTAL_MTE
-    return hwcap2 & HWCAP2_MTE;
-#else
-    (void)hwcap2;
-    return false;
-#endif
-}
-
-typedef void* memchr_func(const void*, int, size_t);
-DEFINE_IFUNC_FOR(memchr) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(memchr_func, memchr_mte);
-    } else {
-        RETURN_FUNC(memchr_func, memchr_default);
-    }
-}
-
-typedef char* strchr_func(const char*, int);
-DEFINE_IFUNC_FOR(strchr) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strchr_func, strchr_mte);
-    } else {
-        RETURN_FUNC(strchr_func, strchr_default);
-    }
-}
-
-typedef int strcmp_func(const char*, const char*);
-DEFINE_IFUNC_FOR(strcmp) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strcmp_func, strcmp_mte);
-    } else {
-        RETURN_FUNC(strcmp_func, strcmp_default);
-    }
-}
-
-typedef size_t strlen_func(const char*);
-DEFINE_IFUNC_FOR(strlen) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strlen_func, strlen_mte);
-    } else {
-        RETURN_FUNC(strlen_func, strlen_default);
-    }
-}
-
-typedef int strncmp_func(const char*, const char*, int);
-DEFINE_IFUNC_FOR(strncmp) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strncmp_func, strncmp_mte);
-    } else {
-        RETURN_FUNC(strncmp_func, strncmp_default);
-    }
-}
-
-typedef size_t strnlen_func(const char*, int);
-DEFINE_IFUNC_FOR(strnlen) {
-    if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strnlen_func, strnlen_mte);
-    } else {
-        RETURN_FUNC(strnlen_func, strnlen_default);
-    }
-}
-
-}  // extern "C"
diff --git a/libc/arch-arm64/generic/bionic/memchr.S b/libc/arch-arm64/generic/bionic/memchr.S
new file mode 100644
index 0000000..7b7e699
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/memchr.S
@@ -0,0 +1,164 @@
+/*
+ *
+   Copyright (c) 2014, ARM Limited
+   All rights Reserved.
+   Copyright (c) 2014, Linaro Ltd.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the company nor the names of its contributors
+         may be used to endorse or promote products derived from this
+         software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Neon Available.
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results.  */
+#define srcin		x0
+#define chrin		w1
+#define cntin		x2
+
+#define result		x0
+
+#define src		x3
+#define	tmp		x4
+#define wtmp2		w5
+#define synd		x6
+#define soff		x9
+#define cntrem		x10
+
+#define vrepchr		v0
+#define vdata1		v1
+#define vdata2		v2
+#define vhas_chr1	v3
+#define vhas_chr2	v4
+#define vrepmask	v5
+#define vend		v6
+
+/*
+ * Core algorithm:
+ *
+ * For each 32-byte chunk we calculate a 64-bit syndrome value, with two bits
+ * per byte. For each tuple, bit 0 is set if the relevant byte matched the
+ * requested character and bit 1 is not used (faster than using a 32bit
+ * syndrome). Since the bits in the syndrome reflect exactly the order in which
+ * things occur in the original string, counting trailing zeros allows to
+ * identify exactly which byte has matched.
+ */
+
+ENTRY(memchr)
+	/*
+	 * Magic constant 0x40100401 allows us to identify which lane matches
+	 * the requested byte.
+	 */
+	cbz	cntin, .Lzero_length
+	mov	wtmp2, #0x0401
+	movk	wtmp2, #0x4010, lsl #16
+	dup	vrepchr.16b, chrin
+	/* Work with aligned 32-byte chunks */
+	bic	src, srcin, #31
+	dup	vrepmask.4s, wtmp2
+	ands	soff, srcin, #31
+	and	cntrem, cntin, #31
+	b.eq	.Lloop
+
+	/*
+	 * Input string is not 32-byte aligned. We calculate the syndrome
+	 * value for the aligned 32 bytes block containing the first bytes
+	 * and mask the irrelevant part.
+	 */
+
+	ld1	{vdata1.16b, vdata2.16b}, [src], #32
+	sub	tmp, soff, #32
+	adds	cntin, cntin, tmp
+	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
+	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
+	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
+	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
+	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
+	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
+	mov	synd, vend.d[0]
+	/* Clear the soff*2 lower bits */
+	lsl	tmp, soff, #1
+	lsr	synd, synd, tmp
+	lsl	synd, synd, tmp
+	/* The first block can also be the last */
+	b.ls	.Lmasklast
+	/* Have we found something already? */
+	cbnz	synd, .Ltail
+
+.Lloop:
+	ld1	{vdata1.16b, vdata2.16b}, [src], #32
+	subs	cntin, cntin, #32
+	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
+	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
+	/* If we're out of data we finish regardless of the result */
+	b.ls	.Lend
+	/* Use a fast check for the termination condition */
+	orr	vend.16b, vhas_chr1.16b, vhas_chr2.16b
+	addp	vend.2d, vend.2d, vend.2d
+	mov	synd, vend.d[0]
+	/* We're not out of data, loop if we haven't found the character */
+	cbz	synd, .Lloop
+
+.Lend:
+	/* Termination condition found, let's calculate the syndrome value */
+	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
+	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
+	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
+	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
+	mov	synd, vend.d[0]
+	/* Only do the clear for the last possible block */
+	b.hi	.Ltail
+
+.Lmasklast:
+	/* Clear the (32 - ((cntrem + soff) % 32)) * 2 upper bits */
+	add	tmp, cntrem, soff
+	and	tmp, tmp, #31
+	sub	tmp, tmp, #32
+	neg	tmp, tmp, lsl #1
+	lsl	synd, synd, tmp
+	lsr	synd, synd, tmp
+
+.Ltail:
+	/* Count the trailing zeros using bit reversing */
+	rbit	synd, synd
+	/* Compensate the last post-increment */
+	sub	src, src, #32
+	/* Check that we have found a character */
+	cmp	synd, #0
+	/* And count the leading zeros */
+	clz	synd, synd
+	/* Compute the potential result */
+	add	result, src, synd, lsr #1
+	/* Select result or NULL */
+	csel	result, xzr, result, eq
+	ret
+
+.Lzero_length:
+	mov	result, xzr
+	ret
+END(memchr)
diff --git a/libc/arch-arm64/generic/bionic/strchr.S b/libc/arch-arm64/generic/bionic/strchr.S
new file mode 100644
index 0000000..2db0c76
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strchr.S
@@ -0,0 +1,153 @@
+/*
+ *
+   Copyright (c) 2014, ARM Limited
+   All rights Reserved.
+   Copyright (c) 2014, Linaro Ltd.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the company nor the names of its contributors
+         may be used to endorse or promote products derived from this
+         software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Neon Available.
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results.  */
+#define srcin		x0
+#define chrin		w1
+
+#define result		x0
+
+#define src		x2
+#define	tmp1		x3
+#define wtmp2		w4
+#define tmp3		x5
+
+#define vrepchr		v0
+#define vdata1		v1
+#define vdata2		v2
+#define vhas_nul1	v3
+#define vhas_nul2	v4
+#define vhas_chr1	v5
+#define vhas_chr2	v6
+#define vrepmask_0	v7
+#define vrepmask_c	v16
+#define vend1		v17
+#define vend2		v18
+
+/* Core algorithm.
+
+   For each 32-byte hunk we calculate a 64-bit syndrome value, with
+   two bits per byte (LSB is always in bits 0 and 1, for both big
+   and little-endian systems).  For each tuple, bit 0 is set iff
+   the relevant byte matched the requested character; bit 1 is set
+   iff the relevant byte matched the NUL end of string (we trigger
+   off bit0 for the special case of looking for NUL).  Since the bits
+   in the syndrome reflect exactly the order in which things occur
+   in the original string a count_trailing_zeros() operation will
+   identify exactly which byte is causing the termination, and why.  */
+
+/* Locals and temporaries.  */
+
+ENTRY(strchr)
+	/* Magic constant 0x40100401 to allow us to identify which lane
+	   matches the requested byte.  Magic constant 0x80200802 used
+	   similarly for NUL termination.  */
+	mov	wtmp2, #0x0401
+	movk	wtmp2, #0x4010, lsl #16
+	dup	vrepchr.16b, chrin
+	bic	src, srcin, #31		/* Work with aligned 32-byte hunks.  */
+	dup	vrepmask_c.4s, wtmp2
+	ands	tmp1, srcin, #31
+	add	vrepmask_0.4s, vrepmask_c.4s, vrepmask_c.4s /* equiv: lsl #1 */
+	b.eq	.Lloop
+
+	/* Input string is not 32-byte aligned.  Rather than forcing
+	   the padding bytes to a safe value, we calculate the syndrome
+	   for all the bytes, but then mask off those bits of the
+	   syndrome that are related to the padding.  */
+	ld1	{vdata1.16b, vdata2.16b}, [src], #32
+	neg	tmp1, tmp1
+	cmeq	vhas_nul1.16b, vdata1.16b, #0
+	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
+	cmeq	vhas_nul2.16b, vdata2.16b, #0
+	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
+	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
+	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
+	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
+	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
+	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+	lsl	tmp1, tmp1, #1
+	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
+	mov	tmp3, #~0
+	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
+	lsr	tmp1, tmp3, tmp1
+
+	mov	tmp3, vend1.d[0]
+	bic	tmp1, tmp3, tmp1	// Mask padding bits.
+	cbnz	tmp1, .Ltail
+
+.Lloop:
+	ld1	{vdata1.16b, vdata2.16b}, [src], #32
+	cmeq	vhas_nul1.16b, vdata1.16b, #0
+	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
+	cmeq	vhas_nul2.16b, vdata2.16b, #0
+	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
+	/* Use a fast check for the termination condition.  */
+	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+	orr	vend1.16b, vend1.16b, vend2.16b
+	addp	vend1.2d, vend1.2d, vend1.2d
+	mov	tmp1, vend1.d[0]
+	cbz	tmp1, .Lloop
+
+	/* Termination condition found.  Now need to establish exactly why
+	   we terminated.  */
+	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
+	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
+	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
+	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
+	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
+	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
+
+	mov	tmp1, vend1.d[0]
+.Ltail:
+	/* Count the trailing zeros, by bit reversing...  */
+	rbit	tmp1, tmp1
+	/* Re-bias source.  */
+	sub	src, src, #32
+	clz	tmp1, tmp1	/* And counting the leading zeros.  */
+	/* Tmp1 is even if the target charager was found first.  Otherwise
+	   we've found the end of string and we weren't looking for NUL.  */
+	tst	tmp1, #1
+	add	result, src, tmp1, lsr #1
+	csel	result, result, xzr, eq
+	ret
+END(strchr)
diff --git a/libc/arch-arm64/generic/bionic/strcmp.S b/libc/arch-arm64/generic/bionic/strcmp.S
new file mode 100644
index 0000000..fbc215e
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strcmp.S
@@ -0,0 +1,192 @@
+/* Copyright (c) 2012, Linaro Limited
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the Linaro nor the
+         names of its contributors may be used to endorse or promote products
+         derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+#define L(label) .L ## label
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+/* Parameters and result.  */
+#define src1		x0
+#define src2		x1
+#define result		x0
+
+/* Internal variables.  */
+#define data1		x2
+#define data1w		w2
+#define data2		x3
+#define data2w		w3
+#define has_nul		x4
+#define diff		x5
+#define syndrome	x6
+#define tmp1		x7
+#define tmp2		x8
+#define tmp3		x9
+#define zeroones	x10
+#define pos		x11
+
+	/* Start of performance-critical section  -- one 64B cache line.  */
+ENTRY(strcmp)
+.p2align  6
+	eor	tmp1, src1, src2
+	mov	zeroones, #REP8_01
+	tst	tmp1, #7
+	b.ne	L(misaligned8)
+	ands	tmp1, src1, #7
+	b.ne	L(mutual_align)
+	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+	   can be done in parallel across the entire word.  */
+L(loop_aligned):
+	ldr	data1, [src1], #8
+	ldr	data2, [src2], #8
+L(start_realigned):
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	eor	diff, data1, data2	/* Non-zero if differences found.  */
+	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
+	orr	syndrome, diff, has_nul
+	cbz	syndrome, L(loop_aligned)
+	/* End of performance-critical section  -- one 64B cache line.  */
+
+L(end):
+#ifndef	__AARCH64EB__
+	rev	syndrome, syndrome
+	rev	data1, data1
+	/* The MS-non-zero bit of the syndrome marks either the first bit
+	   that is different, or the top bit of the first zero byte.
+	   Shifting left now will bring the critical information into the
+	   top bits.  */
+	clz	pos, syndrome
+	rev	data2, data2
+	lsl	data1, data1, pos
+	lsl	data2, data2, pos
+	/* But we need to zero-extend (char is unsigned) the value and then
+	   perform a signed 32-bit subtraction.  */
+	lsr	data1, data1, #56
+	sub	result, data1, data2, lsr #56
+	ret
+#else
+	/* For big-endian we cannot use the trick with the syndrome value
+	   as carry-propagation can corrupt the upper bits if the trailing
+	   bytes in the string contain 0x01.  */
+	/* However, if there is no NUL byte in the dword, we can generate
+	   the result directly.  We can't just subtract the bytes as the
+	   MSB might be significant.  */
+	cbnz	has_nul, 1f
+	cmp	data1, data2
+	cset	result, ne
+	cneg	result, result, lo
+	ret
+1:
+	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
+	rev	tmp3, data1
+	sub	tmp1, tmp3, zeroones
+	orr	tmp2, tmp3, #REP8_7f
+	bic	has_nul, tmp1, tmp2
+	rev	has_nul, has_nul
+	orr	syndrome, diff, has_nul
+	clz	pos, syndrome
+	/* The MS-non-zero bit of the syndrome marks either the first bit
+	   that is different, or the top bit of the first zero byte.
+	   Shifting left now will bring the critical information into the
+	   top bits.  */
+	lsl	data1, data1, pos
+	lsl	data2, data2, pos
+	/* But we need to zero-extend (char is unsigned) the value and then
+	   perform a signed 32-bit subtraction.  */
+	lsr	data1, data1, #56
+	sub	result, data1, data2, lsr #56
+	ret
+#endif
+
+L(mutual_align):
+	/* Sources are mutually aligned, but are not currently at an
+	   alignment boundary.  Round down the addresses and then mask off
+	   the bytes that preceed the start point.  */
+	bic	src1, src1, #7
+	bic	src2, src2, #7
+	lsl	tmp1, tmp1, #3		/* Bytes beyond alignment -> bits.  */
+	ldr	data1, [src1], #8
+	neg	tmp1, tmp1		/* Bits to alignment -64.  */
+	ldr	data2, [src2], #8
+	mov	tmp2, #~0
+#ifdef __AARCH64EB__
+	/* Big-endian.  Early bytes are at MSB.  */
+	lsl	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
+#else
+	/* Little-endian.  Early bytes are at LSB.  */
+	lsr	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
+#endif
+	orr	data1, data1, tmp2
+	orr	data2, data2, tmp2
+	b	L(start_realigned)
+
+L(misaligned8):
+	/* Align SRC1 to 8 bytes and then compare 8 bytes at a time, always
+	   checking to make sure that we don't access beyond page boundary in
+	   SRC2.  */
+	tst	src1, #7
+	b.eq	L(loop_misaligned)
+L(do_misaligned):
+	ldrb	data1w, [src1], #1
+	ldrb	data2w, [src2], #1
+	cmp	data1w, #1
+	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
+	b.ne	L(done)
+	tst	src1, #7
+	b.ne	L(do_misaligned)
+
+L(loop_misaligned):
+	/* Test if we are within the last dword of the end of a 4K page.  If
+	   yes then jump back to the misaligned loop to copy a byte at a time.  */
+	and	tmp1, src2, #0xff8
+	eor	tmp1, tmp1, #0xff8
+	cbz	tmp1, L(do_misaligned)
+	ldr	data1, [src1], #8
+	ldr	data2, [src2], #8
+
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	eor	diff, data1, data2	/* Non-zero if differences found.  */
+	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
+	orr	syndrome, diff, has_nul
+	cbz	syndrome, L(loop_misaligned)
+	b	L(end)
+
+L(done):
+	sub	result, data1, data2
+	ret
+END(strcmp)
diff --git a/libc/arch-arm64/generic/bionic/strlen.S b/libc/arch-arm64/generic/bionic/strlen.S
new file mode 100644
index 0000000..6e540fc
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strlen.S
@@ -0,0 +1,227 @@
+/* Copyright (c) 2013-2015, Linaro Limited
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+	 notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+	 notice, this list of conditions and the following disclaimer in the
+	 documentation and/or other materials provided with the distribution.
+       * Neither the name of the Linaro nor the
+	 names of its contributors may be used to endorse or promote products
+	 derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
+ */
+
+#include <private/bionic_asm.h>
+
+/* To test the page crossing code path more thoroughly, compile with
+   -DTEST_PAGE_CROSS - this will force all calls through the slower
+   entry path.  This option is not intended for production use.	 */
+
+/* Arguments and results.  */
+#define srcin		x0
+#define len		x0
+
+/* Locals and temporaries.  */
+#define src		x1
+#define data1		x2
+#define data2		x3
+#define has_nul1	x4
+#define has_nul2	x5
+#define tmp1		x4
+#define tmp2		x5
+#define tmp3		x6
+#define tmp4		x7
+#define zeroones	x8
+
+#define L(l) .L ## l
+
+	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+	   can be done in parallel across the entire word. A faster check
+	   (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
+	   false hits for characters 129..255.	*/
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+#ifdef TEST_PAGE_CROSS
+# define MIN_PAGE_SIZE 15
+#else
+# define MIN_PAGE_SIZE 4096
+#endif
+
+	/* Since strings are short on average, we check the first 16 bytes
+	   of the string for a NUL character.  In order to do an unaligned ldp
+	   safely we have to do a page cross check first.  If there is a NUL
+	   byte we calculate the length from the 2 8-byte words using
+	   conditional select to reduce branch mispredictions (it is unlikely
+	   strlen will be repeatedly called on strings with the same length).
+
+	   If the string is longer than 16 bytes, we align src so don't need
+	   further page cross checks, and process 32 bytes per iteration
+	   using the fast NUL check.  If we encounter non-ASCII characters,
+	   fallback to a second loop using the full NUL check.
+
+	   If the page cross check fails, we read 16 bytes from an aligned
+	   address, remove any characters before the string, and continue
+	   in the main loop using aligned loads.  Since strings crossing a
+	   page in the first 16 bytes are rare (probability of
+	   16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
+
+	   AArch64 systems have a minimum page size of 4k.  We don't bother
+	   checking for larger page sizes - the cost of setting up the correct
+	   page size is just not worth the extra gain from a small reduction in
+	   the cases taking the slow path.  Note that we only care about
+	   whether the first fetch, which may be misaligned, crosses a page
+	   boundary.  */
+
+ENTRY(strlen)
+	and	tmp1, srcin, MIN_PAGE_SIZE - 1
+	mov	zeroones, REP8_01
+	cmp	tmp1, MIN_PAGE_SIZE - 16
+	b.gt	L(page_cross)
+	ldp	data1, data2, [srcin]
+#ifdef __AARCH64EB__
+	/* For big-endian, carry propagation (if the final byte in the
+	   string is 0x01) means we cannot use has_nul1/2 directly.
+	   Since we expect strings to be small and early-exit,
+	   byte-swap the data now so has_null1/2 will be correct.  */
+	rev	data1, data1
+	rev	data2, data2
+#endif
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, REP8_7f
+	sub	tmp3, data2, zeroones
+	orr	tmp4, data2, REP8_7f
+	bics	has_nul1, tmp1, tmp2
+	bic	has_nul2, tmp3, tmp4
+	ccmp	has_nul2, 0, 0, eq
+	beq	L(main_loop_entry)
+
+	/* Enter with C = has_nul1 == 0.  */
+	csel	has_nul1, has_nul1, has_nul2, cc
+	mov	len, 8
+	rev	has_nul1, has_nul1
+	clz	tmp1, has_nul1
+	csel	len, xzr, len, cc
+	add	len, len, tmp1, lsr 3
+	ret
+
+	/* The inner loop processes 32 bytes per iteration and uses the fast
+	   NUL check.  If we encounter non-ASCII characters, use a second
+	   loop with the accurate NUL check.  */
+	.p2align 4
+L(main_loop_entry):
+	bic	src, srcin, 15
+	sub	src, src, 16
+L(main_loop):
+	ldp	data1, data2, [src, 32]!
+.Lpage_cross_entry:
+	sub	tmp1, data1, zeroones
+	sub	tmp3, data2, zeroones
+	orr	tmp2, tmp1, tmp3
+	tst	tmp2, zeroones, lsl 7
+	bne	1f
+	ldp	data1, data2, [src, 16]
+	sub	tmp1, data1, zeroones
+	sub	tmp3, data2, zeroones
+	orr	tmp2, tmp1, tmp3
+	tst	tmp2, zeroones, lsl 7
+	beq	L(main_loop)
+	add	src, src, 16
+1:
+	/* The fast check failed, so do the slower, accurate NUL check.	 */
+	orr	tmp2, data1, REP8_7f
+	orr	tmp4, data2, REP8_7f
+	bics	has_nul1, tmp1, tmp2
+	bic	has_nul2, tmp3, tmp4
+	ccmp	has_nul2, 0, 0, eq
+	beq	L(nonascii_loop)
+
+	/* Enter with C = has_nul1 == 0.  */
+L(tail):
+#ifdef __AARCH64EB__
+	/* For big-endian, carry propagation (if the final byte in the
+	   string is 0x01) means we cannot use has_nul1/2 directly.  The
+	   easiest way to get the correct byte is to byte-swap the data
+	   and calculate the syndrome a second time.  */
+	csel	data1, data1, data2, cc
+	rev	data1, data1
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, REP8_7f
+	bic	has_nul1, tmp1, tmp2
+#else
+	csel	has_nul1, has_nul1, has_nul2, cc
+#endif
+	sub	len, src, srcin
+	rev	has_nul1, has_nul1
+	add	tmp2, len, 8
+	clz	tmp1, has_nul1
+	csel	len, len, tmp2, cc
+	add	len, len, tmp1, lsr 3
+	ret
+
+L(nonascii_loop):
+	ldp	data1, data2, [src, 16]!
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, REP8_7f
+	sub	tmp3, data2, zeroones
+	orr	tmp4, data2, REP8_7f
+	bics	has_nul1, tmp1, tmp2
+	bic	has_nul2, tmp3, tmp4
+	ccmp	has_nul2, 0, 0, eq
+	bne	L(tail)
+	ldp	data1, data2, [src, 16]!
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, REP8_7f
+	sub	tmp3, data2, zeroones
+	orr	tmp4, data2, REP8_7f
+	bics	has_nul1, tmp1, tmp2
+	bic	has_nul2, tmp3, tmp4
+	ccmp	has_nul2, 0, 0, eq
+	beq	L(nonascii_loop)
+	b	L(tail)
+
+	/* Load 16 bytes from [srcin & ~15] and force the bytes that precede
+	   srcin to 0x7f, so we ignore any NUL bytes before the string.
+	   Then continue in the aligned loop.  */
+L(page_cross):
+	bic	src, srcin, 15
+	ldp	data1, data2, [src]
+	lsl	tmp1, srcin, 3
+	mov	tmp4, -1
+#ifdef __AARCH64EB__
+	/* Big-endian.	Early bytes are at MSB.	 */
+	lsr	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
+#else
+	/* Little-endian.  Early bytes are at LSB.  */
+	lsl	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
+#endif
+	orr	tmp1, tmp1, REP8_80
+	orn	data1, data1, tmp1
+	orn	tmp2, data2, tmp1
+	tst	srcin, 8
+	csel	data1, data1, tmp4, eq
+	csel	data2, data2, tmp2, eq
+	b	L(page_cross_entry)
+
+END(strlen)
diff --git a/libc/arch-arm64/generic/bionic/strncmp.S b/libc/arch-arm64/generic/bionic/strncmp.S
new file mode 100644
index 0000000..b81f43a
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strncmp.S
@@ -0,0 +1,280 @@
+/* Copyright (c) 2014, Linaro Limited
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the Linaro nor the
+         names of its contributors may be used to endorse or promote products
+         derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+/* Parameters and result.  */
+#define src1		x0
+#define src2		x1
+#define limit		x2
+#define result		x0
+
+/* Internal variables.  */
+#define data1		x3
+#define data1w		w3
+#define data2		x4
+#define data2w		w4
+#define has_nul		x5
+#define diff		x6
+#define syndrome	x7
+#define tmp1		x8
+#define tmp2		x9
+#define tmp3		x10
+#define zeroones	x11
+#define pos		x12
+#define limit_wd	x13
+#define mask		x14
+#define endloop		x15
+#define count		mask
+
+	.text
+	.p2align 6
+	.rep 7
+	nop	/* Pad so that the loop below fits a cache line.  */
+	.endr
+ENTRY(strncmp)
+	cbz	limit, .Lret0
+	eor	tmp1, src1, src2
+	mov	zeroones, #REP8_01
+	tst	tmp1, #7
+	and	count, src1, #7
+	b.ne	.Lmisaligned8
+	cbnz	count, .Lmutual_align
+	/* Calculate the number of full and partial words -1.  */
+	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
+	lsr	limit_wd, limit_wd, #3	/* Convert to Dwords.  */
+
+	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+	   can be done in parallel across the entire word.  */
+	/* Start of performance-critical section  -- one 64B cache line.  */
+.Lloop_aligned:
+	ldr	data1, [src1], #8
+	ldr	data2, [src2], #8
+.Lstart_realigned:
+	subs	limit_wd, limit_wd, #1
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	eor	diff, data1, data2	/* Non-zero if differences found.  */
+	csinv	endloop, diff, xzr, pl	/* Last Dword or differences.  */
+	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
+	ccmp	endloop, #0, #0, eq
+	b.eq	.Lloop_aligned
+	/* End of performance-critical section  -- one 64B cache line.  */
+
+	/* Not reached the limit, must have found the end or a diff.  */
+	tbz	limit_wd, #63, .Lnot_limit
+
+	/* Limit % 8 == 0 => all bytes significant.  */
+	ands	limit, limit, #7
+	b.eq	.Lnot_limit
+
+	lsl	limit, limit, #3	/* Bits -> bytes.  */
+	mov	mask, #~0
+#ifdef __AARCH64EB__
+	lsr	mask, mask, limit
+#else
+	lsl	mask, mask, limit
+#endif
+	bic	data1, data1, mask
+	bic	data2, data2, mask
+
+	/* Make sure that the NUL byte is marked in the syndrome.  */
+	orr	has_nul, has_nul, mask
+
+.Lnot_limit:
+	orr	syndrome, diff, has_nul
+
+#ifndef	__AARCH64EB__
+	rev	syndrome, syndrome
+	rev	data1, data1
+	/* The MS-non-zero bit of the syndrome marks either the first bit
+	   that is different, or the top bit of the first zero byte.
+	   Shifting left now will bring the critical information into the
+	   top bits.  */
+	clz	pos, syndrome
+	rev	data2, data2
+	lsl	data1, data1, pos
+	lsl	data2, data2, pos
+	/* But we need to zero-extend (char is unsigned) the value and then
+	   perform a signed 32-bit subtraction.  */
+	lsr	data1, data1, #56
+	sub	result, data1, data2, lsr #56
+	ret
+#else
+	/* For big-endian we cannot use the trick with the syndrome value
+	   as carry-propagation can corrupt the upper bits if the trailing
+	   bytes in the string contain 0x01.  */
+	/* However, if there is no NUL byte in the dword, we can generate
+	   the result directly.  We can't just subtract the bytes as the
+	   MSB might be significant.  */
+	cbnz	has_nul, 1f
+	cmp	data1, data2
+	cset	result, ne
+	cneg	result, result, lo
+	ret
+1:
+	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
+	rev	tmp3, data1
+	sub	tmp1, tmp3, zeroones
+	orr	tmp2, tmp3, #REP8_7f
+	bic	has_nul, tmp1, tmp2
+	rev	has_nul, has_nul
+	orr	syndrome, diff, has_nul
+	clz	pos, syndrome
+	/* The MS-non-zero bit of the syndrome marks either the first bit
+	   that is different, or the top bit of the first zero byte.
+	   Shifting left now will bring the critical information into the
+	   top bits.  */
+	lsl	data1, data1, pos
+	lsl	data2, data2, pos
+	/* But we need to zero-extend (char is unsigned) the value and then
+	   perform a signed 32-bit subtraction.  */
+	lsr	data1, data1, #56
+	sub	result, data1, data2, lsr #56
+	ret
+#endif
+
+.Lmutual_align:
+	/* Sources are mutually aligned, but are not currently at an
+	   alignment boundary.  Round down the addresses and then mask off
+	   the bytes that precede the start point.
+	   We also need to adjust the limit calculations, but without
+	   overflowing if the limit is near ULONG_MAX.  */
+	bic	src1, src1, #7
+	bic	src2, src2, #7
+	ldr	data1, [src1], #8
+	neg	tmp3, count, lsl #3	/* 64 - bits(bytes beyond align). */
+	ldr	data2, [src2], #8
+	mov	tmp2, #~0
+	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
+#ifdef __AARCH64EB__
+	/* Big-endian.  Early bytes are at MSB.  */
+	lsl	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
+#else
+	/* Little-endian.  Early bytes are at LSB.  */
+	lsr	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
+#endif
+	and	tmp3, limit_wd, #7
+	lsr	limit_wd, limit_wd, #3
+	/* Adjust the limit. Only low 3 bits used, so overflow irrelevant.  */
+	add	limit, limit, count
+	add	tmp3, tmp3, count
+	orr	data1, data1, tmp2
+	orr	data2, data2, tmp2
+	add	limit_wd, limit_wd, tmp3, lsr #3
+	b	.Lstart_realigned
+
+	.p2align 6
+	/* Don't bother with dwords for up to 16 bytes.  */
+.Lmisaligned8:
+	cmp	limit, #16
+	b.hs	.Ltry_misaligned_words
+
+.Lbyte_loop:
+	/* Perhaps we can do better than this.  */
+	ldrb	data1w, [src1], #1
+	ldrb	data2w, [src2], #1
+	subs	limit, limit, #1
+	ccmp	data1w, #1, #0, hi	/* NZCV = 0b0000.  */
+	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
+	b.eq	.Lbyte_loop
+.Ldone:
+	sub	result, data1, data2
+	ret
+	/* Align the SRC1 to a dword by doing a bytewise compare and then do
+	   the dword loop.  */
+.Ltry_misaligned_words:
+	lsr	limit_wd, limit, #3
+	cbz	count, .Ldo_misaligned
+
+	neg	count, count
+	and	count, count, #7
+	sub	limit, limit, count
+	lsr	limit_wd, limit, #3
+
+.Lpage_end_loop:
+	ldrb	data1w, [src1], #1
+	ldrb	data2w, [src2], #1
+	cmp	data1w, #1
+	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
+	b.ne	.Ldone
+	subs	count, count, #1
+	b.hi	.Lpage_end_loop
+
+.Ldo_misaligned:
+	/* Prepare ourselves for the next page crossing.  Unlike the aligned
+	   loop, we fetch 1 less dword because we risk crossing bounds on
+	   SRC2.  */
+	mov	count, #8
+	subs	limit_wd, limit_wd, #1
+	b.lo	.Ldone_loop
+.Lloop_misaligned:
+	and	tmp2, src2, #0xff8
+	eor	tmp2, tmp2, #0xff8
+	cbz	tmp2, .Lpage_end_loop
+
+	ldr	data1, [src1], #8
+	ldr	data2, [src2], #8
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	eor	diff, data1, data2	/* Non-zero if differences found.  */
+	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
+	ccmp	diff, #0, #0, eq
+	b.ne	.Lnot_limit
+	subs	limit_wd, limit_wd, #1
+	b.pl	.Lloop_misaligned
+
+.Ldone_loop:
+	/* We found a difference or a NULL before the limit was reached.  */
+	and	limit, limit, #7
+	cbz	limit, .Lnot_limit
+	/* Read the last word.  */
+	sub	src1, src1, 8
+	sub	src2, src2, 8
+	ldr	data1, [src1, limit]
+	ldr	data2, [src2, limit]
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	eor	diff, data1, data2	/* Non-zero if differences found.  */
+	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
+	ccmp	diff, #0, #0, eq
+	b.ne	.Lnot_limit
+
+.Lret0:
+	mov	result, #0
+	ret
+END(strncmp)
diff --git a/libc/arch-arm64/generic/bionic/strnlen.S b/libc/arch-arm64/generic/bionic/strnlen.S
new file mode 100644
index 0000000..0ad446e
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strnlen.S
@@ -0,0 +1,174 @@
+/* Copyright (c) 2014, Linaro Limited
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the Linaro nor the
+         names of its contributors may be used to endorse or promote products
+         derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results.  */
+#define srcin		x0
+#define len		x0
+#define limit		x1
+
+/* Locals and temporaries.  */
+#define src		x2
+#define data1		x3
+#define data2		x4
+#define data2a		x5
+#define has_nul1	x6
+#define has_nul2	x7
+#define tmp1		x8
+#define tmp2		x9
+#define tmp3		x10
+#define tmp4		x11
+#define zeroones	x12
+#define pos		x13
+#define limit_wd	x14
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+	.text
+	.p2align	6
+.Lstart:
+	/* Pre-pad to ensure critical loop begins an icache line.  */
+	.rep 7
+	nop
+	.endr
+	/* Put this code here to avoid wasting more space with pre-padding.  */
+.Lhit_limit:
+	mov	len, limit
+	ret
+
+ENTRY(strnlen)
+	cbz	limit, .Lhit_limit
+	mov	zeroones, #REP8_01
+	bic	src, srcin, #15
+	ands	tmp1, srcin, #15
+	b.ne	.Lmisaligned
+	/* Calculate the number of full and partial words -1.  */
+	sub	limit_wd, limit, #1	/* Limit != 0, so no underflow.  */
+	lsr	limit_wd, limit_wd, #4	/* Convert to Qwords.  */
+
+	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+	   can be done in parallel across the entire word.  */
+	/* The inner loop deals with two Dwords at a time.  This has a
+	   slightly higher start-up cost, but we should win quite quickly,
+	   especially on cores with a high number of issue slots per
+	   cycle, as we get much better parallelism out of the operations.  */
+
+	/* Start of critial section -- keep to one 64Byte cache line.  */
+.Lloop:
+	ldp	data1, data2, [src], #16
+.Lrealigned:
+	sub	tmp1, data1, zeroones
+	orr	tmp2, data1, #REP8_7f
+	sub	tmp3, data2, zeroones
+	orr	tmp4, data2, #REP8_7f
+	bic	has_nul1, tmp1, tmp2
+	bic	has_nul2, tmp3, tmp4
+	subs	limit_wd, limit_wd, #1
+	orr	tmp1, has_nul1, has_nul2
+	ccmp	tmp1, #0, #0, pl	/* NZCV = 0000  */
+	b.eq	.Lloop
+	/* End of critical section -- keep to one 64Byte cache line.  */
+
+	orr	tmp1, has_nul1, has_nul2
+	cbz	tmp1, .Lhit_limit	/* No null in final Qword.  */
+
+	/* We know there's a null in the final Qword.  The easiest thing
+	   to do now is work out the length of the string and return
+	   MIN (len, limit).  */
+
+	sub	len, src, srcin
+	cbz	has_nul1, .Lnul_in_data2
+#ifdef __AARCH64EB__
+	mov	data2, data1
+#endif
+	sub	len, len, #8
+	mov	has_nul2, has_nul1
+.Lnul_in_data2:
+#ifdef __AARCH64EB__
+	/* For big-endian, carry propagation (if the final byte in the
+	   string is 0x01) means we cannot use has_nul directly.  The
+	   easiest way to get the correct byte is to byte-swap the data
+	   and calculate the syndrome a second time.  */
+	rev	data2, data2
+	sub	tmp1, data2, zeroones
+	orr	tmp2, data2, #REP8_7f
+	bic	has_nul2, tmp1, tmp2
+#endif
+	sub	len, len, #8
+	rev	has_nul2, has_nul2
+	clz	pos, has_nul2
+	add	len, len, pos, lsr #3		/* Bits to bytes.  */
+	cmp	len, limit
+	csel	len, len, limit, ls		/* Return the lower value.  */
+	ret
+
+.Lmisaligned:
+	/* Deal with a partial first word.
+	   We're doing two things in parallel here;
+	   1) Calculate the number of words (but avoiding overflow if
+	      limit is near ULONG_MAX) - to do this we need to work out
+	      limit + tmp1 - 1 as a 65-bit value before shifting it;
+	   2) Load and mask the initial data words - we force the bytes
+	      before the ones we are interested in to 0xff - this ensures
+	      early bytes will not hit any zero detection.  */
+	sub	limit_wd, limit, #1
+	neg	tmp4, tmp1
+	cmp	tmp1, #8
+
+	and	tmp3, limit_wd, #15
+	lsr	limit_wd, limit_wd, #4
+	mov	tmp2, #~0
+
+	ldp	data1, data2, [src], #16
+	lsl	tmp4, tmp4, #3		/* Bytes beyond alignment -> bits.  */
+	add	tmp3, tmp3, tmp1
+
+#ifdef __AARCH64EB__
+	/* Big-endian.  Early bytes are at MSB.  */
+	lsl	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
+#else
+	/* Little-endian.  Early bytes are at LSB.  */
+	lsr	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
+#endif
+	add	limit_wd, limit_wd, tmp3, lsr #4
+
+	orr	data1, data1, tmp2
+	orr	data2a, data2, tmp2
+
+	csinv	data1, data1, xzr, le
+	csel	data2, data2, data2a, le
+	b	.Lrealigned
+END(strnlen)
diff --git a/libc/arch-arm64/mte/bionic/memchr.c b/libc/arch-arm64/mte/bionic/memchr.c
deleted file mode 100644
index 33b2fc2..0000000
--- a/libc/arch-arm64/mte/bionic/memchr.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define memchr memchr_mte
-#include <upstream-openbsd/lib/libc/string/memchr.c>
diff --git a/libc/arch-arm64/mte/bionic/strchr.cpp b/libc/arch-arm64/mte/bionic/strchr.cpp
deleted file mode 100644
index 7d394df..0000000
--- a/libc/arch-arm64/mte/bionic/strchr.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define strchr strchr_mte
-#include <bionic/strchr.cpp>
diff --git a/libc/arch-arm64/mte/bionic/strcmp.c b/libc/arch-arm64/mte/bionic/strcmp.c
deleted file mode 100644
index 0e134f0..0000000
--- a/libc/arch-arm64/mte/bionic/strcmp.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define strcmp strcmp_mte
-#include <upstream-openbsd/lib/libc/string/strcmp.c>
diff --git a/libc/arch-arm64/mte/bionic/strlen.c b/libc/arch-arm64/mte/bionic/strlen.c
deleted file mode 100644
index de88320..0000000
--- a/libc/arch-arm64/mte/bionic/strlen.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define strlen strlen_mte
-#include <upstream-openbsd/lib/libc/string/strlen.c>
diff --git a/libc/arch-arm64/mte/bionic/strncmp.c b/libc/arch-arm64/mte/bionic/strncmp.c
deleted file mode 100644
index 54d08e9..0000000
--- a/libc/arch-arm64/mte/bionic/strncmp.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define strncmp strncmp_mte
-#include <upstream-openbsd/lib/libc/string/strncmp.c>
diff --git a/libc/arch-arm64/mte/bionic/strnlen.c b/libc/arch-arm64/mte/bionic/strnlen.c
deleted file mode 100644
index 3dc251d..0000000
--- a/libc/arch-arm64/mte/bionic/strnlen.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define strnlen strnlen_mte
-#include <bionic/strnlen.c>
diff --git a/libc/arch-arm64/static_function_dispatch.S b/libc/arch-arm64/static_function_dispatch.S
deleted file mode 100644
index 8e3a4c1..0000000
--- a/libc/arch-arm64/static_function_dispatch.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2019 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>
-
-#define FUNCTION_DELEGATE(name, impl) \
-ENTRY(name); \
-    b impl; \
-END(name)
-
-FUNCTION_DELEGATE(memchr, memchr_mte)
-FUNCTION_DELEGATE(strchr, strchr_mte)
-FUNCTION_DELEGATE(strcmp, strcmp_mte)
-FUNCTION_DELEGATE(strlen, strlen_mte)
-FUNCTION_DELEGATE(strncmp, strncmp_mte)
-FUNCTION_DELEGATE(strnlen, strnlen_mte)
diff --git a/libc/arch-arm64/syscalls/___clock_nanosleep.S b/libc/arch-arm64/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..0dcfd4f
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___clock_nanosleep.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    mov     x8, __NR_clock_nanosleep
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-arm64/syscalls/___close.S b/libc/arch-arm64/syscalls/___close.S
new file mode 100644
index 0000000..8fb8361
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___close.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    mov     x8, __NR_close
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___close)
+.hidden ___close
diff --git a/libc/arch-arm64/syscalls/___faccessat.S b/libc/arch-arm64/syscalls/___faccessat.S
new file mode 100644
index 0000000..6a41b69
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___faccessat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    mov     x8, __NR_faccessat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-arm64/syscalls/___fchmod.S b/libc/arch-arm64/syscalls/___fchmod.S
new file mode 100644
index 0000000..a143c65
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___fchmod.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    mov     x8, __NR_fchmod
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-arm64/syscalls/___fchmodat.S b/libc/arch-arm64/syscalls/___fchmodat.S
new file mode 100644
index 0000000..1ab3736
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___fchmodat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    mov     x8, __NR_fchmodat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-arm64/syscalls/___fgetxattr.S b/libc/arch-arm64/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..c0334cc
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___fgetxattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    mov     x8, __NR_fgetxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-arm64/syscalls/___flistxattr.S b/libc/arch-arm64/syscalls/___flistxattr.S
new file mode 100644
index 0000000..02c8478
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___flistxattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    mov     x8, __NR_flistxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-arm64/syscalls/___fsetxattr.S b/libc/arch-arm64/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..92be8de
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___fsetxattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    mov     x8, __NR_fsetxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-arm64/syscalls/___mremap.S b/libc/arch-arm64/syscalls/___mremap.S
new file mode 100644
index 0000000..aeb93bc
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___mremap.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    mov     x8, __NR_mremap
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-arm64/syscalls/___rt_sigqueueinfo.S b/libc/arch-arm64/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..85ea132
--- /dev/null
+++ b/libc/arch-arm64/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    mov     x8, __NR_rt_sigqueueinfo
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-arm64/syscalls/__accept4.S b/libc/arch-arm64/syscalls/__accept4.S
new file mode 100644
index 0000000..559e6a7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__accept4.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    mov     x8, __NR_accept4
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__accept4)
+.hidden __accept4
diff --git a/libc/arch-arm64/syscalls/__brk.S b/libc/arch-arm64/syscalls/__brk.S
new file mode 100644
index 0000000..fb794bf
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__brk.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    mov     x8, __NR_brk
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__brk)
+.hidden __brk
diff --git a/libc/arch-arm64/syscalls/__clock_getres.S b/libc/arch-arm64/syscalls/__clock_getres.S
new file mode 100644
index 0000000..9d0deaa
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__clock_getres.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    mov     x8, __NR_clock_getres
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__clock_getres)
+.hidden __clock_getres
diff --git a/libc/arch-arm64/syscalls/__clock_gettime.S b/libc/arch-arm64/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..658ab29
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__clock_gettime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    mov     x8, __NR_clock_gettime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__clock_gettime)
+.hidden __clock_gettime
diff --git a/libc/arch-arm64/syscalls/__connect.S b/libc/arch-arm64/syscalls/__connect.S
new file mode 100644
index 0000000..c18e6eb
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__connect.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    mov     x8, __NR_connect
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__connect)
+.hidden __connect
diff --git a/libc/arch-arm64/syscalls/__epoll_pwait.S b/libc/arch-arm64/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..acf2bbf
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__epoll_pwait.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    mov     x8, __NR_epoll_pwait
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-arm64/syscalls/__exit.S b/libc/arch-arm64/syscalls/__exit.S
new file mode 100644
index 0000000..b6b1866
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__exit.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    mov     x8, __NR_exit
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__exit)
+.hidden __exit
diff --git a/libc/arch-arm64/syscalls/__fadvise64.S b/libc/arch-arm64/syscalls/__fadvise64.S
new file mode 100644
index 0000000..695d094
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__fadvise64.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fadvise64)
+    mov     x8, __NR_fadvise64
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__fadvise64)
+.hidden __fadvise64
diff --git a/libc/arch-arm64/syscalls/__fstatfs.S b/libc/arch-arm64/syscalls/__fstatfs.S
new file mode 100644
index 0000000..7e350d6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__fstatfs.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs)
+    mov     x8, __NR_fstatfs
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__fstatfs)
+.hidden __fstatfs
diff --git a/libc/arch-arm64/syscalls/__getcpu.S b/libc/arch-arm64/syscalls/__getcpu.S
new file mode 100644
index 0000000..11ed68e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__getcpu.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    mov     x8, __NR_getcpu
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-arm64/syscalls/__getcwd.S b/libc/arch-arm64/syscalls/__getcwd.S
new file mode 100644
index 0000000..c64f4d2
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__getcwd.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    mov     x8, __NR_getcwd
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-arm64/syscalls/__getdents64.S b/libc/arch-arm64/syscalls/__getdents64.S
new file mode 100644
index 0000000..9943390
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__getdents64.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    mov     x8, __NR_getdents64
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__getdents64)
+.hidden __getdents64
diff --git a/libc/arch-arm64/syscalls/__getpid.S b/libc/arch-arm64/syscalls/__getpid.S
new file mode 100644
index 0000000..fbc96df
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__getpid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+    mov     x8, __NR_getpid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__getpid)
+.hidden __getpid
diff --git a/libc/arch-arm64/syscalls/__getpriority.S b/libc/arch-arm64/syscalls/__getpriority.S
new file mode 100644
index 0000000..9d98e22
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__getpriority.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    mov     x8, __NR_getpriority
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-arm64/syscalls/__gettimeofday.S b/libc/arch-arm64/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..0c8206a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__gettimeofday.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    mov     x8, __NR_gettimeofday
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__gettimeofday)
+.hidden __gettimeofday
diff --git a/libc/arch-arm64/syscalls/__ioctl.S b/libc/arch-arm64/syscalls/__ioctl.S
new file mode 100644
index 0000000..62bc28c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__ioctl.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    mov     x8, __NR_ioctl
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-arm64/syscalls/__openat.S b/libc/arch-arm64/syscalls/__openat.S
new file mode 100644
index 0000000..8b6853f
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__openat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    mov     x8, __NR_openat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__openat)
+.hidden __openat
diff --git a/libc/arch-arm64/syscalls/__ppoll.S b/libc/arch-arm64/syscalls/__ppoll.S
new file mode 100644
index 0000000..1f54d67
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__ppoll.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    mov     x8, __NR_ppoll
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-arm64/syscalls/__pselect6.S b/libc/arch-arm64/syscalls/__pselect6.S
new file mode 100644
index 0000000..388d84e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__pselect6.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    mov     x8, __NR_pselect6
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-arm64/syscalls/__ptrace.S b/libc/arch-arm64/syscalls/__ptrace.S
new file mode 100644
index 0000000..d68b674
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__ptrace.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    mov     x8, __NR_ptrace
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-arm64/syscalls/__reboot.S b/libc/arch-arm64/syscalls/__reboot.S
new file mode 100644
index 0000000..79cd5be
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__reboot.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    mov     x8, __NR_reboot
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__reboot)
+.hidden __reboot
diff --git a/libc/arch-arm64/syscalls/__rt_sigaction.S b/libc/arch-arm64/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..65fea2e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigaction.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    mov     x8, __NR_rt_sigaction
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-arm64/syscalls/__rt_sigpending.S b/libc/arch-arm64/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..6553781
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigpending.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    mov     x8, __NR_rt_sigpending
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-arm64/syscalls/__rt_sigprocmask.S b/libc/arch-arm64/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..95127d6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    mov     x8, __NR_rt_sigprocmask
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-arm64/syscalls/__rt_sigsuspend.S b/libc/arch-arm64/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..7cbd8d6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    mov     x8, __NR_rt_sigsuspend
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-arm64/syscalls/__rt_sigtimedwait.S b/libc/arch-arm64/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..8001635
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    mov     x8, __NR_rt_sigtimedwait
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-arm64/syscalls/__sched_getaffinity.S b/libc/arch-arm64/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..7dad15e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__sched_getaffinity.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    mov     x8, __NR_sched_getaffinity
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-arm64/syscalls/__set_tid_address.S b/libc/arch-arm64/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..f7ae16d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__set_tid_address.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    mov     x8, __NR_set_tid_address
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-arm64/syscalls/__signalfd4.S b/libc/arch-arm64/syscalls/__signalfd4.S
new file mode 100644
index 0000000..f6e3497
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__signalfd4.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    mov     x8, __NR_signalfd4
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__signalfd4)
+.hidden __signalfd4
diff --git a/libc/arch-arm64/syscalls/__socket.S b/libc/arch-arm64/syscalls/__socket.S
new file mode 100644
index 0000000..344bb2d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__socket.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    mov     x8, __NR_socket
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__socket)
+.hidden __socket
diff --git a/libc/arch-arm64/syscalls/__statfs.S b/libc/arch-arm64/syscalls/__statfs.S
new file mode 100644
index 0000000..962c590
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__statfs.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs)
+    mov     x8, __NR_statfs
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__statfs)
+.hidden __statfs
diff --git a/libc/arch-arm64/syscalls/__sync_file_range.S b/libc/arch-arm64/syscalls/__sync_file_range.S
new file mode 100644
index 0000000..776e900
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__sync_file_range.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range)
+    mov     x8, __NR_sync_file_range
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__sync_file_range)
+.hidden __sync_file_range
diff --git a/libc/arch-arm64/syscalls/__timer_create.S b/libc/arch-arm64/syscalls/__timer_create.S
new file mode 100644
index 0000000..4790845
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__timer_create.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    mov     x8, __NR_timer_create
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-arm64/syscalls/__timer_delete.S b/libc/arch-arm64/syscalls/__timer_delete.S
new file mode 100644
index 0000000..ce12613
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__timer_delete.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    mov     x8, __NR_timer_delete
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-arm64/syscalls/__timer_getoverrun.S b/libc/arch-arm64/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..2cfdf6a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__timer_getoverrun.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    mov     x8, __NR_timer_getoverrun
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-arm64/syscalls/__timer_gettime.S b/libc/arch-arm64/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..a1ea323
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__timer_gettime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    mov     x8, __NR_timer_gettime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-arm64/syscalls/__timer_settime.S b/libc/arch-arm64/syscalls/__timer_settime.S
new file mode 100644
index 0000000..059d705
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__timer_settime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    mov     x8, __NR_timer_settime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-arm64/syscalls/__waitid.S b/libc/arch-arm64/syscalls/__waitid.S
new file mode 100644
index 0000000..8bd649d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/__waitid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    mov     x8, __NR_waitid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(__waitid)
+.hidden __waitid
diff --git a/libc/arch-arm64/syscalls/_exit.S b/libc/arch-arm64/syscalls/_exit.S
new file mode 100644
index 0000000..d50f38d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/_exit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    mov     x8, __NR_exit_group
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-arm64/syscalls/acct.S b/libc/arch-arm64/syscalls/acct.S
new file mode 100644
index 0000000..48cb4e9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/acct.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    mov     x8, __NR_acct
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(acct)
diff --git a/libc/arch-arm64/syscalls/adjtimex.S b/libc/arch-arm64/syscalls/adjtimex.S
new file mode 100644
index 0000000..712e468
--- /dev/null
+++ b/libc/arch-arm64/syscalls/adjtimex.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    mov     x8, __NR_adjtimex
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(adjtimex)
diff --git a/libc/arch-arm64/syscalls/bind.S b/libc/arch-arm64/syscalls/bind.S
new file mode 100644
index 0000000..47170ff
--- /dev/null
+++ b/libc/arch-arm64/syscalls/bind.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    mov     x8, __NR_bind
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(bind)
diff --git a/libc/arch-arm64/syscalls/capget.S b/libc/arch-arm64/syscalls/capget.S
new file mode 100644
index 0000000..7e0dfe9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/capget.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    mov     x8, __NR_capget
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(capget)
diff --git a/libc/arch-arm64/syscalls/capset.S b/libc/arch-arm64/syscalls/capset.S
new file mode 100644
index 0000000..e7b7a8d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/capset.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    mov     x8, __NR_capset
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(capset)
diff --git a/libc/arch-arm64/syscalls/chdir.S b/libc/arch-arm64/syscalls/chdir.S
new file mode 100644
index 0000000..723cd08
--- /dev/null
+++ b/libc/arch-arm64/syscalls/chdir.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    mov     x8, __NR_chdir
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(chdir)
diff --git a/libc/arch-arm64/syscalls/chroot.S b/libc/arch-arm64/syscalls/chroot.S
new file mode 100644
index 0000000..e4f6bd9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/chroot.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    mov     x8, __NR_chroot
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(chroot)
diff --git a/libc/arch-arm64/syscalls/clock_adjtime.S b/libc/arch-arm64/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..c2c191e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/clock_adjtime.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    mov     x8, __NR_clock_adjtime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(clock_adjtime)
diff --git a/libc/arch-arm64/syscalls/clock_settime.S b/libc/arch-arm64/syscalls/clock_settime.S
new file mode 100644
index 0000000..62354d1
--- /dev/null
+++ b/libc/arch-arm64/syscalls/clock_settime.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    mov     x8, __NR_clock_settime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(clock_settime)
diff --git a/libc/arch-arm64/syscalls/delete_module.S b/libc/arch-arm64/syscalls/delete_module.S
new file mode 100644
index 0000000..db8d947
--- /dev/null
+++ b/libc/arch-arm64/syscalls/delete_module.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    mov     x8, __NR_delete_module
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(delete_module)
diff --git a/libc/arch-arm64/syscalls/dup.S b/libc/arch-arm64/syscalls/dup.S
new file mode 100644
index 0000000..4e95045
--- /dev/null
+++ b/libc/arch-arm64/syscalls/dup.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    mov     x8, __NR_dup
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(dup)
diff --git a/libc/arch-arm64/syscalls/dup3.S b/libc/arch-arm64/syscalls/dup3.S
new file mode 100644
index 0000000..2e6be32
--- /dev/null
+++ b/libc/arch-arm64/syscalls/dup3.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    mov     x8, __NR_dup3
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(dup3)
diff --git a/libc/arch-arm64/syscalls/epoll_create1.S b/libc/arch-arm64/syscalls/epoll_create1.S
new file mode 100644
index 0000000..6ef518e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/epoll_create1.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    mov     x8, __NR_epoll_create1
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(epoll_create1)
diff --git a/libc/arch-arm64/syscalls/epoll_ctl.S b/libc/arch-arm64/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..1188f38
--- /dev/null
+++ b/libc/arch-arm64/syscalls/epoll_ctl.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    mov     x8, __NR_epoll_ctl
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(epoll_ctl)
diff --git a/libc/arch-arm64/syscalls/eventfd.S b/libc/arch-arm64/syscalls/eventfd.S
new file mode 100644
index 0000000..ca5df12
--- /dev/null
+++ b/libc/arch-arm64/syscalls/eventfd.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    mov     x8, __NR_eventfd2
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(eventfd)
diff --git a/libc/arch-arm64/syscalls/execve.S b/libc/arch-arm64/syscalls/execve.S
new file mode 100644
index 0000000..fc8fb68
--- /dev/null
+++ b/libc/arch-arm64/syscalls/execve.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    mov     x8, __NR_execve
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(execve)
diff --git a/libc/arch-arm64/syscalls/fallocate.S b/libc/arch-arm64/syscalls/fallocate.S
new file mode 100644
index 0000000..d42a0ba
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fallocate.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate)
+    mov     x8, __NR_fallocate
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fallocate)
+
+ALIAS_SYMBOL(fallocate64, fallocate)
diff --git a/libc/arch-arm64/syscalls/fchdir.S b/libc/arch-arm64/syscalls/fchdir.S
new file mode 100644
index 0000000..2e164cb
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fchdir.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    mov     x8, __NR_fchdir
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fchdir)
diff --git a/libc/arch-arm64/syscalls/fchown.S b/libc/arch-arm64/syscalls/fchown.S
new file mode 100644
index 0000000..4456f1b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fchown.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    mov     x8, __NR_fchown
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fchown)
diff --git a/libc/arch-arm64/syscalls/fchownat.S b/libc/arch-arm64/syscalls/fchownat.S
new file mode 100644
index 0000000..7ba6611
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fchownat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    mov     x8, __NR_fchownat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fchownat)
diff --git a/libc/arch-arm64/syscalls/fcntl.S b/libc/arch-arm64/syscalls/fcntl.S
new file mode 100644
index 0000000..e2787ae
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fcntl.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fcntl)
+    mov     x8, __NR_fcntl
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fcntl)
diff --git a/libc/arch-arm64/syscalls/fdatasync.S b/libc/arch-arm64/syscalls/fdatasync.S
new file mode 100644
index 0000000..225ab29
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fdatasync.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    mov     x8, __NR_fdatasync
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fdatasync)
diff --git a/libc/arch-arm64/syscalls/flock.S b/libc/arch-arm64/syscalls/flock.S
new file mode 100644
index 0000000..0c036c8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/flock.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    mov     x8, __NR_flock
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(flock)
diff --git a/libc/arch-arm64/syscalls/fremovexattr.S b/libc/arch-arm64/syscalls/fremovexattr.S
new file mode 100644
index 0000000..cf3a371
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fremovexattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    mov     x8, __NR_fremovexattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fremovexattr)
diff --git a/libc/arch-arm64/syscalls/fstat64.S b/libc/arch-arm64/syscalls/fstat64.S
new file mode 100644
index 0000000..f7c9f54
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fstat64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstat64)
+    mov     x8, __NR_fstat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fstat64)
+
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-arm64/syscalls/fstatat64.S b/libc/arch-arm64/syscalls/fstatat64.S
new file mode 100644
index 0000000..9f8f2c5
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fstatat64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstatat64)
+    mov     x8, __NR_newfstatat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fstatat64)
+
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-arm64/syscalls/fsync.S b/libc/arch-arm64/syscalls/fsync.S
new file mode 100644
index 0000000..2bc0d0b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/fsync.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    mov     x8, __NR_fsync
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(fsync)
diff --git a/libc/arch-arm64/syscalls/ftruncate.S b/libc/arch-arm64/syscalls/ftruncate.S
new file mode 100644
index 0000000..c21e098
--- /dev/null
+++ b/libc/arch-arm64/syscalls/ftruncate.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate)
+    mov     x8, __NR_ftruncate
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(ftruncate)
+
+ALIAS_SYMBOL(ftruncate64, ftruncate)
diff --git a/libc/arch-arm64/syscalls/getegid.S b/libc/arch-arm64/syscalls/getegid.S
new file mode 100644
index 0000000..f7d60d9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getegid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+    mov     x8, __NR_getegid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getegid)
diff --git a/libc/arch-arm64/syscalls/geteuid.S b/libc/arch-arm64/syscalls/geteuid.S
new file mode 100644
index 0000000..3096a92
--- /dev/null
+++ b/libc/arch-arm64/syscalls/geteuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+    mov     x8, __NR_geteuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(geteuid)
diff --git a/libc/arch-arm64/syscalls/getgid.S b/libc/arch-arm64/syscalls/getgid.S
new file mode 100644
index 0000000..2f921ff
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+    mov     x8, __NR_getgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getgid)
diff --git a/libc/arch-arm64/syscalls/getgroups.S b/libc/arch-arm64/syscalls/getgroups.S
new file mode 100644
index 0000000..a9a897e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getgroups.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    mov     x8, __NR_getgroups
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getgroups)
diff --git a/libc/arch-arm64/syscalls/getitimer.S b/libc/arch-arm64/syscalls/getitimer.S
new file mode 100644
index 0000000..f37063c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getitimer.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    mov     x8, __NR_getitimer
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getitimer)
diff --git a/libc/arch-arm64/syscalls/getpeername.S b/libc/arch-arm64/syscalls/getpeername.S
new file mode 100644
index 0000000..8374d60
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getpeername.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    mov     x8, __NR_getpeername
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getpeername)
diff --git a/libc/arch-arm64/syscalls/getpgid.S b/libc/arch-arm64/syscalls/getpgid.S
new file mode 100644
index 0000000..ffc0d91
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getpgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    mov     x8, __NR_getpgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getpgid)
diff --git a/libc/arch-arm64/syscalls/getppid.S b/libc/arch-arm64/syscalls/getppid.S
new file mode 100644
index 0000000..1e21bdf
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getppid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+    mov     x8, __NR_getppid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getppid)
diff --git a/libc/arch-arm64/syscalls/getrandom.S b/libc/arch-arm64/syscalls/getrandom.S
new file mode 100644
index 0000000..c8fe41f
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getrandom.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    mov     x8, __NR_getrandom
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getrandom)
diff --git a/libc/arch-arm64/syscalls/getresgid.S b/libc/arch-arm64/syscalls/getresgid.S
new file mode 100644
index 0000000..b15357a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getresgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    mov     x8, __NR_getresgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getresgid)
diff --git a/libc/arch-arm64/syscalls/getresuid.S b/libc/arch-arm64/syscalls/getresuid.S
new file mode 100644
index 0000000..53de6b7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getresuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    mov     x8, __NR_getresuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getresuid)
diff --git a/libc/arch-arm64/syscalls/getrlimit.S b/libc/arch-arm64/syscalls/getrlimit.S
new file mode 100644
index 0000000..03ee9a8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getrlimit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    mov     x8, __NR_getrlimit
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getrlimit)
+
+ALIAS_SYMBOL(getrlimit64, getrlimit)
diff --git a/libc/arch-arm64/syscalls/getrusage.S b/libc/arch-arm64/syscalls/getrusage.S
new file mode 100644
index 0000000..676221a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getrusage.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    mov     x8, __NR_getrusage
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getrusage)
diff --git a/libc/arch-arm64/syscalls/getsid.S b/libc/arch-arm64/syscalls/getsid.S
new file mode 100644
index 0000000..cfbdfdb
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getsid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    mov     x8, __NR_getsid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getsid)
diff --git a/libc/arch-arm64/syscalls/getsockname.S b/libc/arch-arm64/syscalls/getsockname.S
new file mode 100644
index 0000000..4cca55d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getsockname.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    mov     x8, __NR_getsockname
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getsockname)
diff --git a/libc/arch-arm64/syscalls/getsockopt.S b/libc/arch-arm64/syscalls/getsockopt.S
new file mode 100644
index 0000000..96b8c0f
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getsockopt.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    mov     x8, __NR_getsockopt
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getsockopt)
diff --git a/libc/arch-arm64/syscalls/getuid.S b/libc/arch-arm64/syscalls/getuid.S
new file mode 100644
index 0000000..ef95ba7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+    mov     x8, __NR_getuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getuid)
diff --git a/libc/arch-arm64/syscalls/getxattr.S b/libc/arch-arm64/syscalls/getxattr.S
new file mode 100644
index 0000000..2b38f3d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/getxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    mov     x8, __NR_getxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(getxattr)
diff --git a/libc/arch-arm64/syscalls/init_module.S b/libc/arch-arm64/syscalls/init_module.S
new file mode 100644
index 0000000..913c7cc
--- /dev/null
+++ b/libc/arch-arm64/syscalls/init_module.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    mov     x8, __NR_init_module
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(init_module)
diff --git a/libc/arch-arm64/syscalls/inotify_add_watch.S b/libc/arch-arm64/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..83a5b57
--- /dev/null
+++ b/libc/arch-arm64/syscalls/inotify_add_watch.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    mov     x8, __NR_inotify_add_watch
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(inotify_add_watch)
diff --git a/libc/arch-arm64/syscalls/inotify_init1.S b/libc/arch-arm64/syscalls/inotify_init1.S
new file mode 100644
index 0000000..d3bc81b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/inotify_init1.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    mov     x8, __NR_inotify_init1
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(inotify_init1)
diff --git a/libc/arch-arm64/syscalls/inotify_rm_watch.S b/libc/arch-arm64/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..c44445f
--- /dev/null
+++ b/libc/arch-arm64/syscalls/inotify_rm_watch.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    mov     x8, __NR_inotify_rm_watch
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(inotify_rm_watch)
diff --git a/libc/arch-arm64/syscalls/kill.S b/libc/arch-arm64/syscalls/kill.S
new file mode 100644
index 0000000..0334ff0
--- /dev/null
+++ b/libc/arch-arm64/syscalls/kill.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    mov     x8, __NR_kill
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(kill)
diff --git a/libc/arch-arm64/syscalls/klogctl.S b/libc/arch-arm64/syscalls/klogctl.S
new file mode 100644
index 0000000..625f359
--- /dev/null
+++ b/libc/arch-arm64/syscalls/klogctl.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    mov     x8, __NR_syslog
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(klogctl)
diff --git a/libc/arch-arm64/syscalls/lgetxattr.S b/libc/arch-arm64/syscalls/lgetxattr.S
new file mode 100644
index 0000000..89db206
--- /dev/null
+++ b/libc/arch-arm64/syscalls/lgetxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    mov     x8, __NR_lgetxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(lgetxattr)
diff --git a/libc/arch-arm64/syscalls/linkat.S b/libc/arch-arm64/syscalls/linkat.S
new file mode 100644
index 0000000..62aea3a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/linkat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    mov     x8, __NR_linkat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(linkat)
diff --git a/libc/arch-arm64/syscalls/listen.S b/libc/arch-arm64/syscalls/listen.S
new file mode 100644
index 0000000..ba97be9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/listen.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    mov     x8, __NR_listen
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(listen)
diff --git a/libc/arch-arm64/syscalls/listxattr.S b/libc/arch-arm64/syscalls/listxattr.S
new file mode 100644
index 0000000..48208e6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/listxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    mov     x8, __NR_listxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(listxattr)
diff --git a/libc/arch-arm64/syscalls/llistxattr.S b/libc/arch-arm64/syscalls/llistxattr.S
new file mode 100644
index 0000000..ed66005
--- /dev/null
+++ b/libc/arch-arm64/syscalls/llistxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    mov     x8, __NR_llistxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(llistxattr)
diff --git a/libc/arch-arm64/syscalls/lremovexattr.S b/libc/arch-arm64/syscalls/lremovexattr.S
new file mode 100644
index 0000000..b5e51c7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/lremovexattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    mov     x8, __NR_lremovexattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(lremovexattr)
diff --git a/libc/arch-arm64/syscalls/lseek.S b/libc/arch-arm64/syscalls/lseek.S
new file mode 100644
index 0000000..93afeb7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/lseek.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    mov     x8, __NR_lseek
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(lseek)
+
+ALIAS_SYMBOL(lseek64, lseek)
diff --git a/libc/arch-arm64/syscalls/lsetxattr.S b/libc/arch-arm64/syscalls/lsetxattr.S
new file mode 100644
index 0000000..b873513
--- /dev/null
+++ b/libc/arch-arm64/syscalls/lsetxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    mov     x8, __NR_lsetxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(lsetxattr)
diff --git a/libc/arch-arm64/syscalls/madvise.S b/libc/arch-arm64/syscalls/madvise.S
new file mode 100644
index 0000000..6fced41
--- /dev/null
+++ b/libc/arch-arm64/syscalls/madvise.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    mov     x8, __NR_madvise
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(madvise)
diff --git a/libc/arch-arm64/syscalls/mincore.S b/libc/arch-arm64/syscalls/mincore.S
new file mode 100644
index 0000000..5781b4c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mincore.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    mov     x8, __NR_mincore
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mincore)
diff --git a/libc/arch-arm64/syscalls/mkdirat.S b/libc/arch-arm64/syscalls/mkdirat.S
new file mode 100644
index 0000000..fa868a2
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mkdirat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    mov     x8, __NR_mkdirat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mkdirat)
diff --git a/libc/arch-arm64/syscalls/mknodat.S b/libc/arch-arm64/syscalls/mknodat.S
new file mode 100644
index 0000000..13632ec
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mknodat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    mov     x8, __NR_mknodat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mknodat)
diff --git a/libc/arch-arm64/syscalls/mlock.S b/libc/arch-arm64/syscalls/mlock.S
new file mode 100644
index 0000000..1eee85c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mlock.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    mov     x8, __NR_mlock
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mlock)
diff --git a/libc/arch-arm64/syscalls/mlockall.S b/libc/arch-arm64/syscalls/mlockall.S
new file mode 100644
index 0000000..d4ca185
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mlockall.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    mov     x8, __NR_mlockall
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mlockall)
diff --git a/libc/arch-arm64/syscalls/mmap.S b/libc/arch-arm64/syscalls/mmap.S
new file mode 100644
index 0000000..65371bc
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mmap.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mmap)
+    mov     x8, __NR_mmap
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mmap)
+
+ALIAS_SYMBOL(mmap64, mmap)
diff --git a/libc/arch-arm64/syscalls/mount.S b/libc/arch-arm64/syscalls/mount.S
new file mode 100644
index 0000000..cd35017
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mount.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    mov     x8, __NR_mount
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mount)
diff --git a/libc/arch-arm64/syscalls/mprotect.S b/libc/arch-arm64/syscalls/mprotect.S
new file mode 100644
index 0000000..9dd8812
--- /dev/null
+++ b/libc/arch-arm64/syscalls/mprotect.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    mov     x8, __NR_mprotect
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(mprotect)
diff --git a/libc/arch-arm64/syscalls/msync.S b/libc/arch-arm64/syscalls/msync.S
new file mode 100644
index 0000000..72387ea
--- /dev/null
+++ b/libc/arch-arm64/syscalls/msync.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    mov     x8, __NR_msync
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(msync)
diff --git a/libc/arch-arm64/syscalls/munlock.S b/libc/arch-arm64/syscalls/munlock.S
new file mode 100644
index 0000000..d2a248c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/munlock.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    mov     x8, __NR_munlock
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(munlock)
diff --git a/libc/arch-arm64/syscalls/munlockall.S b/libc/arch-arm64/syscalls/munlockall.S
new file mode 100644
index 0000000..ac42cb4
--- /dev/null
+++ b/libc/arch-arm64/syscalls/munlockall.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+    mov     x8, __NR_munlockall
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(munlockall)
diff --git a/libc/arch-arm64/syscalls/munmap.S b/libc/arch-arm64/syscalls/munmap.S
new file mode 100644
index 0000000..9d3f6a6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/munmap.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    mov     x8, __NR_munmap
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(munmap)
diff --git a/libc/arch-arm64/syscalls/nanosleep.S b/libc/arch-arm64/syscalls/nanosleep.S
new file mode 100644
index 0000000..d3e6fae
--- /dev/null
+++ b/libc/arch-arm64/syscalls/nanosleep.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    mov     x8, __NR_nanosleep
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(nanosleep)
diff --git a/libc/arch-arm64/syscalls/personality.S b/libc/arch-arm64/syscalls/personality.S
new file mode 100644
index 0000000..f9f3bf6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/personality.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    mov     x8, __NR_personality
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(personality)
diff --git a/libc/arch-arm64/syscalls/pipe2.S b/libc/arch-arm64/syscalls/pipe2.S
new file mode 100644
index 0000000..89181cd
--- /dev/null
+++ b/libc/arch-arm64/syscalls/pipe2.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    mov     x8, __NR_pipe2
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(pipe2)
diff --git a/libc/arch-arm64/syscalls/prctl.S b/libc/arch-arm64/syscalls/prctl.S
new file mode 100644
index 0000000..86f4df5
--- /dev/null
+++ b/libc/arch-arm64/syscalls/prctl.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    mov     x8, __NR_prctl
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(prctl)
diff --git a/libc/arch-arm64/syscalls/pread64.S b/libc/arch-arm64/syscalls/pread64.S
new file mode 100644
index 0000000..6c9f0e9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/pread64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    mov     x8, __NR_pread64
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(pread64)
+
+ALIAS_SYMBOL(pread, pread64)
diff --git a/libc/arch-arm64/syscalls/preadv.S b/libc/arch-arm64/syscalls/preadv.S
new file mode 100644
index 0000000..cb8300d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/preadv.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(preadv)
+    mov     x8, __NR_preadv
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(preadv)
+
+ALIAS_SYMBOL(preadv64, preadv)
diff --git a/libc/arch-arm64/syscalls/prlimit64.S b/libc/arch-arm64/syscalls/prlimit64.S
new file mode 100644
index 0000000..9c018ba
--- /dev/null
+++ b/libc/arch-arm64/syscalls/prlimit64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    mov     x8, __NR_prlimit64
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(prlimit64)
+
+ALIAS_SYMBOL(prlimit, prlimit64)
diff --git a/libc/arch-arm64/syscalls/process_vm_readv.S b/libc/arch-arm64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..1dd113b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/process_vm_readv.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    mov     x8, __NR_process_vm_readv
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(process_vm_readv)
diff --git a/libc/arch-arm64/syscalls/process_vm_writev.S b/libc/arch-arm64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..fb29cf8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/process_vm_writev.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    mov     x8, __NR_process_vm_writev
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(process_vm_writev)
diff --git a/libc/arch-arm64/syscalls/pwrite64.S b/libc/arch-arm64/syscalls/pwrite64.S
new file mode 100644
index 0000000..1599c14
--- /dev/null
+++ b/libc/arch-arm64/syscalls/pwrite64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    mov     x8, __NR_pwrite64
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(pwrite64)
+
+ALIAS_SYMBOL(pwrite, pwrite64)
diff --git a/libc/arch-arm64/syscalls/pwritev.S b/libc/arch-arm64/syscalls/pwritev.S
new file mode 100644
index 0000000..621466a
--- /dev/null
+++ b/libc/arch-arm64/syscalls/pwritev.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwritev)
+    mov     x8, __NR_pwritev
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(pwritev)
+
+ALIAS_SYMBOL(pwritev64, pwritev)
diff --git a/libc/arch-arm64/syscalls/quotactl.S b/libc/arch-arm64/syscalls/quotactl.S
new file mode 100644
index 0000000..b67d47e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/quotactl.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    mov     x8, __NR_quotactl
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(quotactl)
diff --git a/libc/arch-arm64/syscalls/read.S b/libc/arch-arm64/syscalls/read.S
new file mode 100644
index 0000000..ddb88c8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/read.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    mov     x8, __NR_read
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(read)
diff --git a/libc/arch-arm64/syscalls/readahead.S b/libc/arch-arm64/syscalls/readahead.S
new file mode 100644
index 0000000..445abd4
--- /dev/null
+++ b/libc/arch-arm64/syscalls/readahead.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    mov     x8, __NR_readahead
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(readahead)
diff --git a/libc/arch-arm64/syscalls/readlinkat.S b/libc/arch-arm64/syscalls/readlinkat.S
new file mode 100644
index 0000000..62cc9e2
--- /dev/null
+++ b/libc/arch-arm64/syscalls/readlinkat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    mov     x8, __NR_readlinkat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(readlinkat)
diff --git a/libc/arch-arm64/syscalls/readv.S b/libc/arch-arm64/syscalls/readv.S
new file mode 100644
index 0000000..6e7f151
--- /dev/null
+++ b/libc/arch-arm64/syscalls/readv.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    mov     x8, __NR_readv
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(readv)
diff --git a/libc/arch-arm64/syscalls/recvfrom.S b/libc/arch-arm64/syscalls/recvfrom.S
new file mode 100644
index 0000000..aecf165
--- /dev/null
+++ b/libc/arch-arm64/syscalls/recvfrom.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    mov     x8, __NR_recvfrom
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(recvfrom)
diff --git a/libc/arch-arm64/syscalls/recvmmsg.S b/libc/arch-arm64/syscalls/recvmmsg.S
new file mode 100644
index 0000000..b9cae69
--- /dev/null
+++ b/libc/arch-arm64/syscalls/recvmmsg.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    mov     x8, __NR_recvmmsg
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(recvmmsg)
diff --git a/libc/arch-arm64/syscalls/recvmsg.S b/libc/arch-arm64/syscalls/recvmsg.S
new file mode 100644
index 0000000..2dafdc9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/recvmsg.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    mov     x8, __NR_recvmsg
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(recvmsg)
diff --git a/libc/arch-arm64/syscalls/removexattr.S b/libc/arch-arm64/syscalls/removexattr.S
new file mode 100644
index 0000000..ede36a6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/removexattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    mov     x8, __NR_removexattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(removexattr)
diff --git a/libc/arch-arm64/syscalls/renameat.S b/libc/arch-arm64/syscalls/renameat.S
new file mode 100644
index 0000000..96025df
--- /dev/null
+++ b/libc/arch-arm64/syscalls/renameat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    mov     x8, __NR_renameat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(renameat)
diff --git a/libc/arch-arm64/syscalls/sched_get_priority_max.S b/libc/arch-arm64/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..c848889
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_get_priority_max.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    mov     x8, __NR_sched_get_priority_max
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_get_priority_max)
diff --git a/libc/arch-arm64/syscalls/sched_get_priority_min.S b/libc/arch-arm64/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..74b72a2
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_get_priority_min.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    mov     x8, __NR_sched_get_priority_min
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_get_priority_min)
diff --git a/libc/arch-arm64/syscalls/sched_getparam.S b/libc/arch-arm64/syscalls/sched_getparam.S
new file mode 100644
index 0000000..75a32d4
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_getparam.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    mov     x8, __NR_sched_getparam
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_getparam)
diff --git a/libc/arch-arm64/syscalls/sched_getscheduler.S b/libc/arch-arm64/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..e24baf2
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_getscheduler.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    mov     x8, __NR_sched_getscheduler
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_getscheduler)
diff --git a/libc/arch-arm64/syscalls/sched_rr_get_interval.S b/libc/arch-arm64/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..2a6936b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    mov     x8, __NR_sched_rr_get_interval
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_rr_get_interval)
diff --git a/libc/arch-arm64/syscalls/sched_setaffinity.S b/libc/arch-arm64/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..30b58f6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_setaffinity.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    mov     x8, __NR_sched_setaffinity
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_setaffinity)
diff --git a/libc/arch-arm64/syscalls/sched_setparam.S b/libc/arch-arm64/syscalls/sched_setparam.S
new file mode 100644
index 0000000..eaf25ba
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_setparam.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    mov     x8, __NR_sched_setparam
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_setparam)
diff --git a/libc/arch-arm64/syscalls/sched_setscheduler.S b/libc/arch-arm64/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..31d53c4
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_setscheduler.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    mov     x8, __NR_sched_setscheduler
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_setscheduler)
diff --git a/libc/arch-arm64/syscalls/sched_yield.S b/libc/arch-arm64/syscalls/sched_yield.S
new file mode 100644
index 0000000..4cfeeda
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sched_yield.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    mov     x8, __NR_sched_yield
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sched_yield)
diff --git a/libc/arch-arm64/syscalls/sendfile.S b/libc/arch-arm64/syscalls/sendfile.S
new file mode 100644
index 0000000..50ac12d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sendfile.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    mov     x8, __NR_sendfile
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sendfile)
+
+ALIAS_SYMBOL(sendfile64, sendfile)
diff --git a/libc/arch-arm64/syscalls/sendmmsg.S b/libc/arch-arm64/syscalls/sendmmsg.S
new file mode 100644
index 0000000..e91c246
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sendmmsg.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    mov     x8, __NR_sendmmsg
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sendmmsg)
diff --git a/libc/arch-arm64/syscalls/sendmsg.S b/libc/arch-arm64/syscalls/sendmsg.S
new file mode 100644
index 0000000..a343543
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sendmsg.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    mov     x8, __NR_sendmsg
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sendmsg)
diff --git a/libc/arch-arm64/syscalls/sendto.S b/libc/arch-arm64/syscalls/sendto.S
new file mode 100644
index 0000000..6a6813e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sendto.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    mov     x8, __NR_sendto
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sendto)
diff --git a/libc/arch-arm64/syscalls/setdomainname.S b/libc/arch-arm64/syscalls/setdomainname.S
new file mode 100644
index 0000000..18f8d4b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setdomainname.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    mov     x8, __NR_setdomainname
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setdomainname)
diff --git a/libc/arch-arm64/syscalls/setfsgid.S b/libc/arch-arm64/syscalls/setfsgid.S
new file mode 100644
index 0000000..1a45df3
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setfsgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    mov     x8, __NR_setfsgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setfsgid)
diff --git a/libc/arch-arm64/syscalls/setfsuid.S b/libc/arch-arm64/syscalls/setfsuid.S
new file mode 100644
index 0000000..cd4efd7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setfsuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    mov     x8, __NR_setfsuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setfsuid)
diff --git a/libc/arch-arm64/syscalls/setgid.S b/libc/arch-arm64/syscalls/setgid.S
new file mode 100644
index 0000000..c128fb9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    mov     x8, __NR_setgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setgid)
diff --git a/libc/arch-arm64/syscalls/setgroups.S b/libc/arch-arm64/syscalls/setgroups.S
new file mode 100644
index 0000000..aedabd6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setgroups.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    mov     x8, __NR_setgroups
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setgroups)
diff --git a/libc/arch-arm64/syscalls/sethostname.S b/libc/arch-arm64/syscalls/sethostname.S
new file mode 100644
index 0000000..2dea457
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sethostname.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    mov     x8, __NR_sethostname
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sethostname)
diff --git a/libc/arch-arm64/syscalls/setitimer.S b/libc/arch-arm64/syscalls/setitimer.S
new file mode 100644
index 0000000..7ce8617
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setitimer.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    mov     x8, __NR_setitimer
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setitimer)
diff --git a/libc/arch-arm64/syscalls/setns.S b/libc/arch-arm64/syscalls/setns.S
new file mode 100644
index 0000000..386e8f4
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setns.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    mov     x8, __NR_setns
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setns)
diff --git a/libc/arch-arm64/syscalls/setpgid.S b/libc/arch-arm64/syscalls/setpgid.S
new file mode 100644
index 0000000..458c88b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setpgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    mov     x8, __NR_setpgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setpgid)
diff --git a/libc/arch-arm64/syscalls/setpriority.S b/libc/arch-arm64/syscalls/setpriority.S
new file mode 100644
index 0000000..ed58f26
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setpriority.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    mov     x8, __NR_setpriority
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setpriority)
diff --git a/libc/arch-arm64/syscalls/setregid.S b/libc/arch-arm64/syscalls/setregid.S
new file mode 100644
index 0000000..30d902d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setregid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    mov     x8, __NR_setregid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setregid)
diff --git a/libc/arch-arm64/syscalls/setresgid.S b/libc/arch-arm64/syscalls/setresgid.S
new file mode 100644
index 0000000..f56e6ce
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setresgid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    mov     x8, __NR_setresgid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setresgid)
diff --git a/libc/arch-arm64/syscalls/setresuid.S b/libc/arch-arm64/syscalls/setresuid.S
new file mode 100644
index 0000000..d5c5cc6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setresuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    mov     x8, __NR_setresuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setresuid)
diff --git a/libc/arch-arm64/syscalls/setreuid.S b/libc/arch-arm64/syscalls/setreuid.S
new file mode 100644
index 0000000..e76c72e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setreuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    mov     x8, __NR_setreuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setreuid)
diff --git a/libc/arch-arm64/syscalls/setrlimit.S b/libc/arch-arm64/syscalls/setrlimit.S
new file mode 100644
index 0000000..52c75a1
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setrlimit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    mov     x8, __NR_setrlimit
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setrlimit)
+
+ALIAS_SYMBOL(setrlimit64, setrlimit)
diff --git a/libc/arch-arm64/syscalls/setsid.S b/libc/arch-arm64/syscalls/setsid.S
new file mode 100644
index 0000000..1bb4cc7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setsid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+    mov     x8, __NR_setsid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setsid)
diff --git a/libc/arch-arm64/syscalls/setsockopt.S b/libc/arch-arm64/syscalls/setsockopt.S
new file mode 100644
index 0000000..14b0136
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setsockopt.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    mov     x8, __NR_setsockopt
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setsockopt)
diff --git a/libc/arch-arm64/syscalls/settimeofday.S b/libc/arch-arm64/syscalls/settimeofday.S
new file mode 100644
index 0000000..4f0a078
--- /dev/null
+++ b/libc/arch-arm64/syscalls/settimeofday.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    mov     x8, __NR_settimeofday
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(settimeofday)
diff --git a/libc/arch-arm64/syscalls/setuid.S b/libc/arch-arm64/syscalls/setuid.S
new file mode 100644
index 0000000..5500dd6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setuid.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    mov     x8, __NR_setuid
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setuid)
diff --git a/libc/arch-arm64/syscalls/setxattr.S b/libc/arch-arm64/syscalls/setxattr.S
new file mode 100644
index 0000000..5ba9e3c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/setxattr.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    mov     x8, __NR_setxattr
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(setxattr)
diff --git a/libc/arch-arm64/syscalls/shutdown.S b/libc/arch-arm64/syscalls/shutdown.S
new file mode 100644
index 0000000..ab067fa
--- /dev/null
+++ b/libc/arch-arm64/syscalls/shutdown.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    mov     x8, __NR_shutdown
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(shutdown)
diff --git a/libc/arch-arm64/syscalls/sigaltstack.S b/libc/arch-arm64/syscalls/sigaltstack.S
new file mode 100644
index 0000000..a9cbcaf
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sigaltstack.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    mov     x8, __NR_sigaltstack
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sigaltstack)
diff --git a/libc/arch-arm64/syscalls/socketpair.S b/libc/arch-arm64/syscalls/socketpair.S
new file mode 100644
index 0000000..bd70dac
--- /dev/null
+++ b/libc/arch-arm64/syscalls/socketpair.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    mov     x8, __NR_socketpair
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(socketpair)
diff --git a/libc/arch-arm64/syscalls/splice.S b/libc/arch-arm64/syscalls/splice.S
new file mode 100644
index 0000000..a5450d9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/splice.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    mov     x8, __NR_splice
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(splice)
diff --git a/libc/arch-arm64/syscalls/swapoff.S b/libc/arch-arm64/syscalls/swapoff.S
new file mode 100644
index 0000000..0103bd7
--- /dev/null
+++ b/libc/arch-arm64/syscalls/swapoff.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    mov     x8, __NR_swapoff
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(swapoff)
diff --git a/libc/arch-arm64/syscalls/swapon.S b/libc/arch-arm64/syscalls/swapon.S
new file mode 100644
index 0000000..560c960
--- /dev/null
+++ b/libc/arch-arm64/syscalls/swapon.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    mov     x8, __NR_swapon
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(swapon)
diff --git a/libc/arch-arm64/syscalls/symlinkat.S b/libc/arch-arm64/syscalls/symlinkat.S
new file mode 100644
index 0000000..4a4ea27
--- /dev/null
+++ b/libc/arch-arm64/syscalls/symlinkat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    mov     x8, __NR_symlinkat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(symlinkat)
diff --git a/libc/arch-arm64/syscalls/sync.S b/libc/arch-arm64/syscalls/sync.S
new file mode 100644
index 0000000..d285d43
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sync.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    mov     x8, __NR_sync
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sync)
diff --git a/libc/arch-arm64/syscalls/syncfs.S b/libc/arch-arm64/syscalls/syncfs.S
new file mode 100644
index 0000000..773c0cb
--- /dev/null
+++ b/libc/arch-arm64/syscalls/syncfs.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    mov     x8, __NR_syncfs
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(syncfs)
diff --git a/libc/arch-arm64/syscalls/sysinfo.S b/libc/arch-arm64/syscalls/sysinfo.S
new file mode 100644
index 0000000..80a8641
--- /dev/null
+++ b/libc/arch-arm64/syscalls/sysinfo.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    mov     x8, __NR_sysinfo
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(sysinfo)
diff --git a/libc/arch-arm64/syscalls/tee.S b/libc/arch-arm64/syscalls/tee.S
new file mode 100644
index 0000000..d7baa26
--- /dev/null
+++ b/libc/arch-arm64/syscalls/tee.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    mov     x8, __NR_tee
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(tee)
diff --git a/libc/arch-arm64/syscalls/tgkill.S b/libc/arch-arm64/syscalls/tgkill.S
new file mode 100644
index 0000000..fd9ec3b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/tgkill.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    mov     x8, __NR_tgkill
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(tgkill)
diff --git a/libc/arch-arm64/syscalls/timerfd_create.S b/libc/arch-arm64/syscalls/timerfd_create.S
new file mode 100644
index 0000000..ee805fd
--- /dev/null
+++ b/libc/arch-arm64/syscalls/timerfd_create.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    mov     x8, __NR_timerfd_create
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(timerfd_create)
diff --git a/libc/arch-arm64/syscalls/timerfd_gettime.S b/libc/arch-arm64/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..4d5e2f9
--- /dev/null
+++ b/libc/arch-arm64/syscalls/timerfd_gettime.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    mov     x8, __NR_timerfd_gettime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(timerfd_gettime)
diff --git a/libc/arch-arm64/syscalls/timerfd_settime.S b/libc/arch-arm64/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..e925a0c
--- /dev/null
+++ b/libc/arch-arm64/syscalls/timerfd_settime.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    mov     x8, __NR_timerfd_settime
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(timerfd_settime)
diff --git a/libc/arch-arm64/syscalls/times.S b/libc/arch-arm64/syscalls/times.S
new file mode 100644
index 0000000..d7b9c74
--- /dev/null
+++ b/libc/arch-arm64/syscalls/times.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    mov     x8, __NR_times
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(times)
diff --git a/libc/arch-arm64/syscalls/truncate.S b/libc/arch-arm64/syscalls/truncate.S
new file mode 100644
index 0000000..e01cc7d
--- /dev/null
+++ b/libc/arch-arm64/syscalls/truncate.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    mov     x8, __NR_truncate
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(truncate)
+
+ALIAS_SYMBOL(truncate64, truncate)
diff --git a/libc/arch-arm64/syscalls/umask.S b/libc/arch-arm64/syscalls/umask.S
new file mode 100644
index 0000000..0d71fa6
--- /dev/null
+++ b/libc/arch-arm64/syscalls/umask.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    mov     x8, __NR_umask
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(umask)
diff --git a/libc/arch-arm64/syscalls/umount2.S b/libc/arch-arm64/syscalls/umount2.S
new file mode 100644
index 0000000..c25344e
--- /dev/null
+++ b/libc/arch-arm64/syscalls/umount2.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    mov     x8, __NR_umount2
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(umount2)
diff --git a/libc/arch-arm64/syscalls/uname.S b/libc/arch-arm64/syscalls/uname.S
new file mode 100644
index 0000000..dfdcc03
--- /dev/null
+++ b/libc/arch-arm64/syscalls/uname.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    mov     x8, __NR_uname
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(uname)
diff --git a/libc/arch-arm64/syscalls/unlinkat.S b/libc/arch-arm64/syscalls/unlinkat.S
new file mode 100644
index 0000000..b1eba63
--- /dev/null
+++ b/libc/arch-arm64/syscalls/unlinkat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    mov     x8, __NR_unlinkat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(unlinkat)
diff --git a/libc/arch-arm64/syscalls/unshare.S b/libc/arch-arm64/syscalls/unshare.S
new file mode 100644
index 0000000..74f5663
--- /dev/null
+++ b/libc/arch-arm64/syscalls/unshare.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    mov     x8, __NR_unshare
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(unshare)
diff --git a/libc/arch-arm64/syscalls/utimensat.S b/libc/arch-arm64/syscalls/utimensat.S
new file mode 100644
index 0000000..b8c6b04
--- /dev/null
+++ b/libc/arch-arm64/syscalls/utimensat.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    mov     x8, __NR_utimensat
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(utimensat)
diff --git a/libc/arch-arm64/syscalls/vmsplice.S b/libc/arch-arm64/syscalls/vmsplice.S
new file mode 100644
index 0000000..9490efb
--- /dev/null
+++ b/libc/arch-arm64/syscalls/vmsplice.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    mov     x8, __NR_vmsplice
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(vmsplice)
diff --git a/libc/arch-arm64/syscalls/wait4.S b/libc/arch-arm64/syscalls/wait4.S
new file mode 100644
index 0000000..12973b8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/wait4.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    mov     x8, __NR_wait4
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(wait4)
diff --git a/libc/arch-arm64/syscalls/write.S b/libc/arch-arm64/syscalls/write.S
new file mode 100644
index 0000000..e8c3270
--- /dev/null
+++ b/libc/arch-arm64/syscalls/write.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    mov     x8, __NR_write
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(write)
diff --git a/libc/arch-arm64/syscalls/writev.S b/libc/arch-arm64/syscalls/writev.S
new file mode 100644
index 0000000..baaffda
--- /dev/null
+++ b/libc/arch-arm64/syscalls/writev.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    mov     x8, __NR_writev
+    svc     #0
+
+    cmn     x0, #(MAX_ERRNO + 1)
+    cneg    x0, x0, hi
+    b.hi    __set_errno_internal
+
+    ret
+END(writev)
diff --git a/libc/arch-common/bionic/__dso_handle_so.h b/libc/arch-common/bionic/__dso_handle_so.h
index 2c0df7b..e2c26b6 100644
--- a/libc/arch-common/bionic/__dso_handle_so.h
+++ b/libc/arch-common/bionic/__dso_handle_so.h
@@ -26,14 +26,4 @@
  * SUCH DAMAGE.
  */
 
-/*
- * We would like __dso_handle to be:
- *   1. A const so that if a DSO does not have any RW data, .data section can
- *      be omitted.
- *   2. Of type void* so that no awkward type conversion is needed when
- *      &__dso_handle is passed to various functions, which all expect a void*.
- * To achieve both, we do the following aliasing trick.
- */
-static const void* const __dso_handle_const = &__dso_handle_const;
-__attribute__((__visibility__("hidden")))
-__attribute__((alias("__dso_handle_const"))) extern void* __dso_handle;
+__attribute__((__visibility__("hidden"))) void* __dso_handle = &__dso_handle;
diff --git a/libc/arch-common/bionic/crtbegin.c b/libc/arch-common/bionic/crtbegin.c
index bdda1cf..c4d2a5a 100644
--- a/libc/arch-common/bionic/crtbegin.c
+++ b/libc/arch-common/bionic/crtbegin.c
@@ -63,29 +63,6 @@
 #undef PRE
 #undef POST
 
-// On arm32 and arm64, when targeting Q and up, overalign the TLS segment to
-// (8 * sizeof(void*)), which reserves enough space between the thread pointer
-// and the executable's TLS segment for Bionic's TLS slots. It has the side
-// effect of placing a 0-sized TLS segment into Android executables that don't
-// use TLS, but this should be harmless.
-//
-// To ensure that the .tdata input section isn't deleted (e.g. by
-// --gc-sections), the .text input section (which contains _start) has a
-// relocation to the .tdata input section.
-#if __ANDROID_API__ >= __ANDROID_API_Q__
-#if defined(__arm__)
-asm("  .section .tdata,\"awT\",%progbits\n"
-    "  .p2align 5\n"
-    "  .text\n"
-    "  .reloc 0, R_ARM_NONE, .tdata\n");
-#elif defined(__aarch64__)
-asm("  .section .tdata,\"awT\",@progbits\n"
-    "  .p2align 6\n"
-    "  .text\n"
-    "  .reloc 0, R_AARCH64_NONE, .tdata\n");
-#endif
-#endif
-
 #include "__dso_handle.h"
 #include "atexit.h"
 #include "pthread_atfork.h"
diff --git a/libc/arch-mips/syscalls/___clock_nanosleep.S b/libc/arch-mips/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..55a77d4
--- /dev/null
+++ b/libc/arch-mips/syscalls/___clock_nanosleep.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_nanosleep
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-mips/syscalls/___close.S b/libc/arch-mips/syscalls/___close.S
new file mode 100644
index 0000000..592766a
--- /dev/null
+++ b/libc/arch-mips/syscalls/___close.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_close
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___close)
+.hidden ___close
diff --git a/libc/arch-mips/syscalls/___faccessat.S b/libc/arch-mips/syscalls/___faccessat.S
new file mode 100644
index 0000000..9222c6f
--- /dev/null
+++ b/libc/arch-mips/syscalls/___faccessat.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_faccessat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-mips/syscalls/___fchmod.S b/libc/arch-mips/syscalls/___fchmod.S
new file mode 100644
index 0000000..680c368
--- /dev/null
+++ b/libc/arch-mips/syscalls/___fchmod.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchmod
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-mips/syscalls/___fchmodat.S b/libc/arch-mips/syscalls/___fchmodat.S
new file mode 100644
index 0000000..0c8a6bb
--- /dev/null
+++ b/libc/arch-mips/syscalls/___fchmodat.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchmodat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-mips/syscalls/___fgetxattr.S b/libc/arch-mips/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..a1cc13b
--- /dev/null
+++ b/libc/arch-mips/syscalls/___fgetxattr.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fgetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-mips/syscalls/___flistxattr.S b/libc/arch-mips/syscalls/___flistxattr.S
new file mode 100644
index 0000000..77856fd
--- /dev/null
+++ b/libc/arch-mips/syscalls/___flistxattr.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_flistxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-mips/syscalls/___fsetxattr.S b/libc/arch-mips/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..9c6a419
--- /dev/null
+++ b/libc/arch-mips/syscalls/___fsetxattr.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fsetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-mips/syscalls/___mremap.S b/libc/arch-mips/syscalls/___mremap.S
new file mode 100644
index 0000000..768b958
--- /dev/null
+++ b/libc/arch-mips/syscalls/___mremap.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mremap
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-mips/syscalls/___rt_sigqueueinfo.S b/libc/arch-mips/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..dde3782
--- /dev/null
+++ b/libc/arch-mips/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigqueueinfo
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-mips/syscalls/__accept4.S b/libc/arch-mips/syscalls/__accept4.S
new file mode 100644
index 0000000..596660c
--- /dev/null
+++ b/libc/arch-mips/syscalls/__accept4.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_accept4
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__accept4)
diff --git a/libc/arch-mips/syscalls/__brk.S b/libc/arch-mips/syscalls/__brk.S
new file mode 100644
index 0000000..ea0f2c3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__brk.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_brk
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__brk)
diff --git a/libc/arch-mips/syscalls/__clock_getres.S b/libc/arch-mips/syscalls/__clock_getres.S
new file mode 100644
index 0000000..d4e67c5
--- /dev/null
+++ b/libc/arch-mips/syscalls/__clock_getres.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_getres
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__clock_getres)
diff --git a/libc/arch-mips/syscalls/__clock_gettime.S b/libc/arch-mips/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..a68990b
--- /dev/null
+++ b/libc/arch-mips/syscalls/__clock_gettime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_gettime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__clock_gettime)
diff --git a/libc/arch-mips/syscalls/__connect.S b/libc/arch-mips/syscalls/__connect.S
new file mode 100644
index 0000000..9a87105
--- /dev/null
+++ b/libc/arch-mips/syscalls/__connect.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_connect
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__connect)
diff --git a/libc/arch-mips/syscalls/__epoll_pwait.S b/libc/arch-mips/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..68f9d1f
--- /dev/null
+++ b/libc/arch-mips/syscalls/__epoll_pwait.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_pwait
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__epoll_pwait)
diff --git a/libc/arch-mips/syscalls/__exit.S b/libc/arch-mips/syscalls/__exit.S
new file mode 100644
index 0000000..d4d1ab8
--- /dev/null
+++ b/libc/arch-mips/syscalls/__exit.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_exit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__exit)
diff --git a/libc/arch-mips/syscalls/__fadvise64.S b/libc/arch-mips/syscalls/__fadvise64.S
new file mode 100644
index 0000000..be0694e
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fadvise64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fadvise64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fadvise64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__fadvise64)
diff --git a/libc/arch-mips/syscalls/__fcntl64.S b/libc/arch-mips/syscalls/__fcntl64.S
new file mode 100644
index 0000000..d6e54e4
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fcntl64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fcntl64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fcntl64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__fcntl64)
diff --git a/libc/arch-mips/syscalls/__fstatfs64.S b/libc/arch-mips/syscalls/__fstatfs64.S
new file mode 100644
index 0000000..8dc2ed3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fstatfs64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstatfs64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__fstatfs64)
diff --git a/libc/arch-mips/syscalls/__getcpu.S b/libc/arch-mips/syscalls/__getcpu.S
new file mode 100644
index 0000000..b159f2c
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getcpu.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getcpu
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__getcpu)
diff --git a/libc/arch-mips/syscalls/__getcwd.S b/libc/arch-mips/syscalls/__getcwd.S
new file mode 100644
index 0000000..6482244
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getcwd.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getcwd
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__getcwd)
diff --git a/libc/arch-mips/syscalls/__getdents64.S b/libc/arch-mips/syscalls/__getdents64.S
new file mode 100644
index 0000000..8324a80
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getdents64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getdents64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__getdents64)
diff --git a/libc/arch-mips/syscalls/__getpid.S b/libc/arch-mips/syscalls/__getpid.S
new file mode 100644
index 0000000..9f122e0
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getpid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__getpid)
diff --git a/libc/arch-mips/syscalls/__getpriority.S b/libc/arch-mips/syscalls/__getpriority.S
new file mode 100644
index 0000000..22aa7c1
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getpriority.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpriority
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__getpriority)
diff --git a/libc/arch-mips/syscalls/__gettimeofday.S b/libc/arch-mips/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..021ca7f
--- /dev/null
+++ b/libc/arch-mips/syscalls/__gettimeofday.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_gettimeofday
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__gettimeofday)
diff --git a/libc/arch-mips/syscalls/__ioctl.S b/libc/arch-mips/syscalls/__ioctl.S
new file mode 100644
index 0000000..fb45f5d
--- /dev/null
+++ b/libc/arch-mips/syscalls/__ioctl.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ioctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__ioctl)
diff --git a/libc/arch-mips/syscalls/__llseek.S b/libc/arch-mips/syscalls/__llseek.S
new file mode 100644
index 0000000..d622d92
--- /dev/null
+++ b/libc/arch-mips/syscalls/__llseek.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__llseek)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR__llseek
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__llseek)
diff --git a/libc/arch-mips/syscalls/__mmap2.S b/libc/arch-mips/syscalls/__mmap2.S
new file mode 100644
index 0000000..435fc77
--- /dev/null
+++ b/libc/arch-mips/syscalls/__mmap2.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__mmap2)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mmap2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__mmap2)
diff --git a/libc/arch-mips/syscalls/__openat.S b/libc/arch-mips/syscalls/__openat.S
new file mode 100644
index 0000000..a30c4a8
--- /dev/null
+++ b/libc/arch-mips/syscalls/__openat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_openat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__openat)
diff --git a/libc/arch-mips/syscalls/__ppoll.S b/libc/arch-mips/syscalls/__ppoll.S
new file mode 100644
index 0000000..e2f4363
--- /dev/null
+++ b/libc/arch-mips/syscalls/__ppoll.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ppoll
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__ppoll)
diff --git a/libc/arch-mips/syscalls/__preadv64.S b/libc/arch-mips/syscalls/__preadv64.S
new file mode 100644
index 0000000..3bc732a
--- /dev/null
+++ b/libc/arch-mips/syscalls/__preadv64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__preadv64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_preadv
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__preadv64)
diff --git a/libc/arch-mips/syscalls/__pselect6.S b/libc/arch-mips/syscalls/__pselect6.S
new file mode 100644
index 0000000..34c7df1
--- /dev/null
+++ b/libc/arch-mips/syscalls/__pselect6.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pselect6
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__pselect6)
diff --git a/libc/arch-mips/syscalls/__ptrace.S b/libc/arch-mips/syscalls/__ptrace.S
new file mode 100644
index 0000000..f3879ea
--- /dev/null
+++ b/libc/arch-mips/syscalls/__ptrace.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ptrace
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__ptrace)
diff --git a/libc/arch-mips/syscalls/__pwritev64.S b/libc/arch-mips/syscalls/__pwritev64.S
new file mode 100644
index 0000000..569a0d4
--- /dev/null
+++ b/libc/arch-mips/syscalls/__pwritev64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pwritev64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pwritev
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__pwritev64)
diff --git a/libc/arch-mips/syscalls/__reboot.S b/libc/arch-mips/syscalls/__reboot.S
new file mode 100644
index 0000000..c77d09b
--- /dev/null
+++ b/libc/arch-mips/syscalls/__reboot.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_reboot
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__reboot)
diff --git a/libc/arch-mips/syscalls/__rt_sigaction.S b/libc/arch-mips/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..ae18296
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigaction.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigaction
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__rt_sigaction)
diff --git a/libc/arch-mips/syscalls/__rt_sigpending.S b/libc/arch-mips/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..b3597c8
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigpending.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigpending
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__rt_sigpending)
diff --git a/libc/arch-mips/syscalls/__rt_sigprocmask.S b/libc/arch-mips/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..ca165c3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigprocmask
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__rt_sigprocmask)
diff --git a/libc/arch-mips/syscalls/__rt_sigsuspend.S b/libc/arch-mips/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..afd6837
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigsuspend
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__rt_sigsuspend)
diff --git a/libc/arch-mips/syscalls/__rt_sigtimedwait.S b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..c9d6d3c
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigtimedwait
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__rt_sigtimedwait)
diff --git a/libc/arch-mips/syscalls/__sched_getaffinity.S b/libc/arch-mips/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..94ea2a4
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sched_getaffinity.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getaffinity
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__sched_getaffinity)
diff --git a/libc/arch-mips/syscalls/__set_tid_address.S b/libc/arch-mips/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..4a28783
--- /dev/null
+++ b/libc/arch-mips/syscalls/__set_tid_address.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_set_tid_address
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__set_tid_address)
diff --git a/libc/arch-mips/syscalls/__set_tls.S b/libc/arch-mips/syscalls/__set_tls.S
new file mode 100644
index 0000000..00825b3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__set_tls.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tls)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_set_thread_area
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__set_tls)
diff --git a/libc/arch-mips/syscalls/__sigaction.S b/libc/arch-mips/syscalls/__sigaction.S
new file mode 100644
index 0000000..ef91e1d
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sigaction.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sigaction)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigaction
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__sigaction)
diff --git a/libc/arch-mips/syscalls/__signalfd4.S b/libc/arch-mips/syscalls/__signalfd4.S
new file mode 100644
index 0000000..754ad37
--- /dev/null
+++ b/libc/arch-mips/syscalls/__signalfd4.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_signalfd4
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__signalfd4)
diff --git a/libc/arch-mips/syscalls/__socket.S b/libc/arch-mips/syscalls/__socket.S
new file mode 100644
index 0000000..5d59e03
--- /dev/null
+++ b/libc/arch-mips/syscalls/__socket.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_socket
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__socket)
diff --git a/libc/arch-mips/syscalls/__statfs64.S b/libc/arch-mips/syscalls/__statfs64.S
new file mode 100644
index 0000000..8ebe9f3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__statfs64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_statfs64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__statfs64)
diff --git a/libc/arch-mips/syscalls/__sync_file_range.S b/libc/arch-mips/syscalls/__sync_file_range.S
new file mode 100644
index 0000000..ffd9c09
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sync_file_range.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sync_file_range
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__sync_file_range)
diff --git a/libc/arch-mips/syscalls/__timer_create.S b/libc/arch-mips/syscalls/__timer_create.S
new file mode 100644
index 0000000..fc1b9a5
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_create.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_create
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__timer_create)
diff --git a/libc/arch-mips/syscalls/__timer_delete.S b/libc/arch-mips/syscalls/__timer_delete.S
new file mode 100644
index 0000000..b1ca8b7
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_delete.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_delete
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__timer_delete)
diff --git a/libc/arch-mips/syscalls/__timer_getoverrun.S b/libc/arch-mips/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..07e75e5
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_getoverrun.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_getoverrun
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__timer_getoverrun)
diff --git a/libc/arch-mips/syscalls/__timer_gettime.S b/libc/arch-mips/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..7ee9cad
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_gettime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_gettime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__timer_gettime)
diff --git a/libc/arch-mips/syscalls/__timer_settime.S b/libc/arch-mips/syscalls/__timer_settime.S
new file mode 100644
index 0000000..4f7d95a
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_settime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_settime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__timer_settime)
diff --git a/libc/arch-mips/syscalls/__waitid.S b/libc/arch-mips/syscalls/__waitid.S
new file mode 100644
index 0000000..274d7b6
--- /dev/null
+++ b/libc/arch-mips/syscalls/__waitid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_waitid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(__waitid)
diff --git a/libc/arch-mips/syscalls/_exit.S b/libc/arch-mips/syscalls/_exit.S
new file mode 100644
index 0000000..f41912c
--- /dev/null
+++ b/libc/arch-mips/syscalls/_exit.S
@@ -0,0 +1,21 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_exit_group
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-mips/syscalls/_flush_cache.S b/libc/arch-mips/syscalls/_flush_cache.S
new file mode 100644
index 0000000..fa737e8
--- /dev/null
+++ b/libc/arch-mips/syscalls/_flush_cache.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_flush_cache)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_cacheflush
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(_flush_cache)
diff --git a/libc/arch-mips/syscalls/acct.S b/libc/arch-mips/syscalls/acct.S
new file mode 100644
index 0000000..9908c3f
--- /dev/null
+++ b/libc/arch-mips/syscalls/acct.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_acct
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(acct)
diff --git a/libc/arch-mips/syscalls/adjtimex.S b/libc/arch-mips/syscalls/adjtimex.S
new file mode 100644
index 0000000..bc525d0
--- /dev/null
+++ b/libc/arch-mips/syscalls/adjtimex.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_adjtimex
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(adjtimex)
diff --git a/libc/arch-mips/syscalls/bind.S b/libc/arch-mips/syscalls/bind.S
new file mode 100644
index 0000000..cda6e24
--- /dev/null
+++ b/libc/arch-mips/syscalls/bind.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_bind
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(bind)
diff --git a/libc/arch-mips/syscalls/capget.S b/libc/arch-mips/syscalls/capget.S
new file mode 100644
index 0000000..9c8d430
--- /dev/null
+++ b/libc/arch-mips/syscalls/capget.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_capget
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(capget)
diff --git a/libc/arch-mips/syscalls/capset.S b/libc/arch-mips/syscalls/capset.S
new file mode 100644
index 0000000..f30beba
--- /dev/null
+++ b/libc/arch-mips/syscalls/capset.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_capset
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(capset)
diff --git a/libc/arch-mips/syscalls/chdir.S b/libc/arch-mips/syscalls/chdir.S
new file mode 100644
index 0000000..17de18d
--- /dev/null
+++ b/libc/arch-mips/syscalls/chdir.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(chdir)
diff --git a/libc/arch-mips/syscalls/chroot.S b/libc/arch-mips/syscalls/chroot.S
new file mode 100644
index 0000000..c1998af
--- /dev/null
+++ b/libc/arch-mips/syscalls/chroot.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chroot
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(chroot)
diff --git a/libc/arch-mips/syscalls/clock_adjtime.S b/libc/arch-mips/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..10f0d39
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_adjtime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_adjtime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(clock_adjtime)
diff --git a/libc/arch-mips/syscalls/clock_settime.S b/libc/arch-mips/syscalls/clock_settime.S
new file mode 100644
index 0000000..651729d
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_settime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_settime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(clock_settime)
diff --git a/libc/arch-mips/syscalls/delete_module.S b/libc/arch-mips/syscalls/delete_module.S
new file mode 100644
index 0000000..def5a16
--- /dev/null
+++ b/libc/arch-mips/syscalls/delete_module.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_delete_module
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(delete_module)
diff --git a/libc/arch-mips/syscalls/dup.S b/libc/arch-mips/syscalls/dup.S
new file mode 100644
index 0000000..0c0ee8d
--- /dev/null
+++ b/libc/arch-mips/syscalls/dup.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_dup
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(dup)
diff --git a/libc/arch-mips/syscalls/dup3.S b/libc/arch-mips/syscalls/dup3.S
new file mode 100644
index 0000000..cbec960
--- /dev/null
+++ b/libc/arch-mips/syscalls/dup3.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_dup3
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(dup3)
diff --git a/libc/arch-mips/syscalls/epoll_create1.S b/libc/arch-mips/syscalls/epoll_create1.S
new file mode 100644
index 0000000..fc268fe
--- /dev/null
+++ b/libc/arch-mips/syscalls/epoll_create1.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_create1
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(epoll_create1)
diff --git a/libc/arch-mips/syscalls/epoll_ctl.S b/libc/arch-mips/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..222c97a
--- /dev/null
+++ b/libc/arch-mips/syscalls/epoll_ctl.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_ctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(epoll_ctl)
diff --git a/libc/arch-mips/syscalls/eventfd.S b/libc/arch-mips/syscalls/eventfd.S
new file mode 100644
index 0000000..2bca718
--- /dev/null
+++ b/libc/arch-mips/syscalls/eventfd.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_eventfd2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(eventfd)
diff --git a/libc/arch-mips/syscalls/execve.S b/libc/arch-mips/syscalls/execve.S
new file mode 100644
index 0000000..3dd36a1
--- /dev/null
+++ b/libc/arch-mips/syscalls/execve.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_execve
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(execve)
diff --git a/libc/arch-mips/syscalls/fallocate64.S b/libc/arch-mips/syscalls/fallocate64.S
new file mode 100644
index 0000000..ed50bb5
--- /dev/null
+++ b/libc/arch-mips/syscalls/fallocate64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fallocate
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fallocate64)
diff --git a/libc/arch-mips/syscalls/fchdir.S b/libc/arch-mips/syscalls/fchdir.S
new file mode 100644
index 0000000..5b92e85
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchdir.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fchdir)
diff --git a/libc/arch-mips/syscalls/fchown.S b/libc/arch-mips/syscalls/fchown.S
new file mode 100644
index 0000000..afd96e8
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchown.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fchown)
diff --git a/libc/arch-mips/syscalls/fchownat.S b/libc/arch-mips/syscalls/fchownat.S
new file mode 100644
index 0000000..be2021b
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchownat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchownat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fchownat)
diff --git a/libc/arch-mips/syscalls/fdatasync.S b/libc/arch-mips/syscalls/fdatasync.S
new file mode 100644
index 0000000..0b37d8f
--- /dev/null
+++ b/libc/arch-mips/syscalls/fdatasync.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fdatasync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fdatasync)
diff --git a/libc/arch-mips/syscalls/flock.S b/libc/arch-mips/syscalls/flock.S
new file mode 100644
index 0000000..badb41d
--- /dev/null
+++ b/libc/arch-mips/syscalls/flock.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_flock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(flock)
diff --git a/libc/arch-mips/syscalls/fremovexattr.S b/libc/arch-mips/syscalls/fremovexattr.S
new file mode 100644
index 0000000..290ecc8
--- /dev/null
+++ b/libc/arch-mips/syscalls/fremovexattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fremovexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fremovexattr)
diff --git a/libc/arch-mips/syscalls/fstat64.S b/libc/arch-mips/syscalls/fstat64.S
new file mode 100644
index 0000000..3ecc2ba
--- /dev/null
+++ b/libc/arch-mips/syscalls/fstat64.S
@@ -0,0 +1,21 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstat64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fstat64)
+
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-mips/syscalls/fstatat64.S b/libc/arch-mips/syscalls/fstatat64.S
new file mode 100644
index 0000000..5b7550c
--- /dev/null
+++ b/libc/arch-mips/syscalls/fstatat64.S
@@ -0,0 +1,21 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstatat64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstatat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fstatat64)
+
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-mips/syscalls/fsync.S b/libc/arch-mips/syscalls/fsync.S
new file mode 100644
index 0000000..24e86a2
--- /dev/null
+++ b/libc/arch-mips/syscalls/fsync.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fsync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(fsync)
diff --git a/libc/arch-mips/syscalls/ftruncate64.S b/libc/arch-mips/syscalls/ftruncate64.S
new file mode 100644
index 0000000..858141c
--- /dev/null
+++ b/libc/arch-mips/syscalls/ftruncate64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ftruncate64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(ftruncate64)
diff --git a/libc/arch-mips/syscalls/getegid.S b/libc/arch-mips/syscalls/getegid.S
new file mode 100644
index 0000000..6bdf47f
--- /dev/null
+++ b/libc/arch-mips/syscalls/getegid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getegid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getegid)
diff --git a/libc/arch-mips/syscalls/geteuid.S b/libc/arch-mips/syscalls/geteuid.S
new file mode 100644
index 0000000..07b571e
--- /dev/null
+++ b/libc/arch-mips/syscalls/geteuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_geteuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(geteuid)
diff --git a/libc/arch-mips/syscalls/getgid.S b/libc/arch-mips/syscalls/getgid.S
new file mode 100644
index 0000000..a2020fa
--- /dev/null
+++ b/libc/arch-mips/syscalls/getgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getgid)
diff --git a/libc/arch-mips/syscalls/getgroups.S b/libc/arch-mips/syscalls/getgroups.S
new file mode 100644
index 0000000..86510dc
--- /dev/null
+++ b/libc/arch-mips/syscalls/getgroups.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getgroups
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getgroups)
diff --git a/libc/arch-mips/syscalls/getitimer.S b/libc/arch-mips/syscalls/getitimer.S
new file mode 100644
index 0000000..6d671f5
--- /dev/null
+++ b/libc/arch-mips/syscalls/getitimer.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getitimer
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getitimer)
diff --git a/libc/arch-mips/syscalls/getpeername.S b/libc/arch-mips/syscalls/getpeername.S
new file mode 100644
index 0000000..b372574
--- /dev/null
+++ b/libc/arch-mips/syscalls/getpeername.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpeername
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getpeername)
diff --git a/libc/arch-mips/syscalls/getpgid.S b/libc/arch-mips/syscalls/getpgid.S
new file mode 100644
index 0000000..25a1fdf
--- /dev/null
+++ b/libc/arch-mips/syscalls/getpgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getpgid)
diff --git a/libc/arch-mips/syscalls/getppid.S b/libc/arch-mips/syscalls/getppid.S
new file mode 100644
index 0000000..54f1252
--- /dev/null
+++ b/libc/arch-mips/syscalls/getppid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getppid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getppid)
diff --git a/libc/arch-mips/syscalls/getrandom.S b/libc/arch-mips/syscalls/getrandom.S
new file mode 100644
index 0000000..9a32c78
--- /dev/null
+++ b/libc/arch-mips/syscalls/getrandom.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getrandom
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getrandom)
diff --git a/libc/arch-mips/syscalls/getresgid.S b/libc/arch-mips/syscalls/getresgid.S
new file mode 100644
index 0000000..8336f66
--- /dev/null
+++ b/libc/arch-mips/syscalls/getresgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getresgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getresgid)
diff --git a/libc/arch-mips/syscalls/getresuid.S b/libc/arch-mips/syscalls/getresuid.S
new file mode 100644
index 0000000..9e4cb36
--- /dev/null
+++ b/libc/arch-mips/syscalls/getresuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getresuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getresuid)
diff --git a/libc/arch-mips/syscalls/getrlimit.S b/libc/arch-mips/syscalls/getrlimit.S
new file mode 100644
index 0000000..2ae1c04
--- /dev/null
+++ b/libc/arch-mips/syscalls/getrlimit.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getrlimit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getrlimit)
diff --git a/libc/arch-mips/syscalls/getrusage.S b/libc/arch-mips/syscalls/getrusage.S
new file mode 100644
index 0000000..c4a5aec
--- /dev/null
+++ b/libc/arch-mips/syscalls/getrusage.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getrusage
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getrusage)
diff --git a/libc/arch-mips/syscalls/getsid.S b/libc/arch-mips/syscalls/getsid.S
new file mode 100644
index 0000000..26f84c3
--- /dev/null
+++ b/libc/arch-mips/syscalls/getsid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getsid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getsid)
diff --git a/libc/arch-mips/syscalls/getsockname.S b/libc/arch-mips/syscalls/getsockname.S
new file mode 100644
index 0000000..f54df87
--- /dev/null
+++ b/libc/arch-mips/syscalls/getsockname.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getsockname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getsockname)
diff --git a/libc/arch-mips/syscalls/getsockopt.S b/libc/arch-mips/syscalls/getsockopt.S
new file mode 100644
index 0000000..32cd721
--- /dev/null
+++ b/libc/arch-mips/syscalls/getsockopt.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getsockopt
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getsockopt)
diff --git a/libc/arch-mips/syscalls/getuid.S b/libc/arch-mips/syscalls/getuid.S
new file mode 100644
index 0000000..d2fe78f
--- /dev/null
+++ b/libc/arch-mips/syscalls/getuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getuid)
diff --git a/libc/arch-mips/syscalls/getxattr.S b/libc/arch-mips/syscalls/getxattr.S
new file mode 100644
index 0000000..0e5a33f
--- /dev/null
+++ b/libc/arch-mips/syscalls/getxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(getxattr)
diff --git a/libc/arch-mips/syscalls/init_module.S b/libc/arch-mips/syscalls/init_module.S
new file mode 100644
index 0000000..e4434c3
--- /dev/null
+++ b/libc/arch-mips/syscalls/init_module.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_init_module
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(init_module)
diff --git a/libc/arch-mips/syscalls/inotify_add_watch.S b/libc/arch-mips/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..3710cb7
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_add_watch.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_add_watch
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(inotify_add_watch)
diff --git a/libc/arch-mips/syscalls/inotify_init1.S b/libc/arch-mips/syscalls/inotify_init1.S
new file mode 100644
index 0000000..b38f018
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_init1.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_init1
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(inotify_init1)
diff --git a/libc/arch-mips/syscalls/inotify_rm_watch.S b/libc/arch-mips/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..a7b6fbe
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_rm_watch.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_rm_watch
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(inotify_rm_watch)
diff --git a/libc/arch-mips/syscalls/kill.S b/libc/arch-mips/syscalls/kill.S
new file mode 100644
index 0000000..1075da1
--- /dev/null
+++ b/libc/arch-mips/syscalls/kill.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_kill
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(kill)
diff --git a/libc/arch-mips/syscalls/klogctl.S b/libc/arch-mips/syscalls/klogctl.S
new file mode 100644
index 0000000..c3fa53c
--- /dev/null
+++ b/libc/arch-mips/syscalls/klogctl.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_syslog
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(klogctl)
diff --git a/libc/arch-mips/syscalls/lgetxattr.S b/libc/arch-mips/syscalls/lgetxattr.S
new file mode 100644
index 0000000..b05850d
--- /dev/null
+++ b/libc/arch-mips/syscalls/lgetxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lgetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(lgetxattr)
diff --git a/libc/arch-mips/syscalls/linkat.S b/libc/arch-mips/syscalls/linkat.S
new file mode 100644
index 0000000..eacc488
--- /dev/null
+++ b/libc/arch-mips/syscalls/linkat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_linkat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(linkat)
diff --git a/libc/arch-mips/syscalls/listen.S b/libc/arch-mips/syscalls/listen.S
new file mode 100644
index 0000000..cbda026
--- /dev/null
+++ b/libc/arch-mips/syscalls/listen.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_listen
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(listen)
diff --git a/libc/arch-mips/syscalls/listxattr.S b/libc/arch-mips/syscalls/listxattr.S
new file mode 100644
index 0000000..0ee14a0
--- /dev/null
+++ b/libc/arch-mips/syscalls/listxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_listxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(listxattr)
diff --git a/libc/arch-mips/syscalls/llistxattr.S b/libc/arch-mips/syscalls/llistxattr.S
new file mode 100644
index 0000000..46f79df
--- /dev/null
+++ b/libc/arch-mips/syscalls/llistxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_llistxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(llistxattr)
diff --git a/libc/arch-mips/syscalls/lremovexattr.S b/libc/arch-mips/syscalls/lremovexattr.S
new file mode 100644
index 0000000..74aa7c9
--- /dev/null
+++ b/libc/arch-mips/syscalls/lremovexattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lremovexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(lremovexattr)
diff --git a/libc/arch-mips/syscalls/lseek.S b/libc/arch-mips/syscalls/lseek.S
new file mode 100644
index 0000000..9f93986
--- /dev/null
+++ b/libc/arch-mips/syscalls/lseek.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lseek
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(lseek)
diff --git a/libc/arch-mips/syscalls/lsetxattr.S b/libc/arch-mips/syscalls/lsetxattr.S
new file mode 100644
index 0000000..a87121f
--- /dev/null
+++ b/libc/arch-mips/syscalls/lsetxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lsetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(lsetxattr)
diff --git a/libc/arch-mips/syscalls/madvise.S b/libc/arch-mips/syscalls/madvise.S
new file mode 100644
index 0000000..5fd4856
--- /dev/null
+++ b/libc/arch-mips/syscalls/madvise.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_madvise
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(madvise)
diff --git a/libc/arch-mips/syscalls/mincore.S b/libc/arch-mips/syscalls/mincore.S
new file mode 100644
index 0000000..db74719
--- /dev/null
+++ b/libc/arch-mips/syscalls/mincore.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mincore
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mincore)
diff --git a/libc/arch-mips/syscalls/mkdirat.S b/libc/arch-mips/syscalls/mkdirat.S
new file mode 100644
index 0000000..3ff69c3
--- /dev/null
+++ b/libc/arch-mips/syscalls/mkdirat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mkdirat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mkdirat)
diff --git a/libc/arch-mips/syscalls/mknodat.S b/libc/arch-mips/syscalls/mknodat.S
new file mode 100644
index 0000000..651a619
--- /dev/null
+++ b/libc/arch-mips/syscalls/mknodat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mknodat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mknodat)
diff --git a/libc/arch-mips/syscalls/mlock.S b/libc/arch-mips/syscalls/mlock.S
new file mode 100644
index 0000000..d1bb3a4
--- /dev/null
+++ b/libc/arch-mips/syscalls/mlock.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mlock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mlock)
diff --git a/libc/arch-mips/syscalls/mlockall.S b/libc/arch-mips/syscalls/mlockall.S
new file mode 100644
index 0000000..495be12
--- /dev/null
+++ b/libc/arch-mips/syscalls/mlockall.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mlockall
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mlockall)
diff --git a/libc/arch-mips/syscalls/mount.S b/libc/arch-mips/syscalls/mount.S
new file mode 100644
index 0000000..6eccf01
--- /dev/null
+++ b/libc/arch-mips/syscalls/mount.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mount
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mount)
diff --git a/libc/arch-mips/syscalls/mprotect.S b/libc/arch-mips/syscalls/mprotect.S
new file mode 100644
index 0000000..486fd5d
--- /dev/null
+++ b/libc/arch-mips/syscalls/mprotect.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mprotect
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(mprotect)
diff --git a/libc/arch-mips/syscalls/msync.S b/libc/arch-mips/syscalls/msync.S
new file mode 100644
index 0000000..6554fd0
--- /dev/null
+++ b/libc/arch-mips/syscalls/msync.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_msync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(msync)
diff --git a/libc/arch-mips/syscalls/munlock.S b/libc/arch-mips/syscalls/munlock.S
new file mode 100644
index 0000000..3a3f50c
--- /dev/null
+++ b/libc/arch-mips/syscalls/munlock.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_munlock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(munlock)
diff --git a/libc/arch-mips/syscalls/munlockall.S b/libc/arch-mips/syscalls/munlockall.S
new file mode 100644
index 0000000..4efb260
--- /dev/null
+++ b/libc/arch-mips/syscalls/munlockall.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_munlockall
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(munlockall)
diff --git a/libc/arch-mips/syscalls/munmap.S b/libc/arch-mips/syscalls/munmap.S
new file mode 100644
index 0000000..364f0c1
--- /dev/null
+++ b/libc/arch-mips/syscalls/munmap.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_munmap
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(munmap)
diff --git a/libc/arch-mips/syscalls/nanosleep.S b/libc/arch-mips/syscalls/nanosleep.S
new file mode 100644
index 0000000..7e88d00
--- /dev/null
+++ b/libc/arch-mips/syscalls/nanosleep.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_nanosleep
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(nanosleep)
diff --git a/libc/arch-mips/syscalls/personality.S b/libc/arch-mips/syscalls/personality.S
new file mode 100644
index 0000000..67f9ec1
--- /dev/null
+++ b/libc/arch-mips/syscalls/personality.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_personality
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(personality)
diff --git a/libc/arch-mips/syscalls/pipe2.S b/libc/arch-mips/syscalls/pipe2.S
new file mode 100644
index 0000000..4040d1f
--- /dev/null
+++ b/libc/arch-mips/syscalls/pipe2.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pipe2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(pipe2)
diff --git a/libc/arch-mips/syscalls/prctl.S b/libc/arch-mips/syscalls/prctl.S
new file mode 100644
index 0000000..e6b0024
--- /dev/null
+++ b/libc/arch-mips/syscalls/prctl.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_prctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(prctl)
diff --git a/libc/arch-mips/syscalls/pread64.S b/libc/arch-mips/syscalls/pread64.S
new file mode 100644
index 0000000..0181595
--- /dev/null
+++ b/libc/arch-mips/syscalls/pread64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pread64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(pread64)
diff --git a/libc/arch-mips/syscalls/prlimit64.S b/libc/arch-mips/syscalls/prlimit64.S
new file mode 100644
index 0000000..c93af64
--- /dev/null
+++ b/libc/arch-mips/syscalls/prlimit64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_prlimit64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(prlimit64)
diff --git a/libc/arch-mips/syscalls/process_vm_readv.S b/libc/arch-mips/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..e571db0
--- /dev/null
+++ b/libc/arch-mips/syscalls/process_vm_readv.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_process_vm_readv
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(process_vm_readv)
diff --git a/libc/arch-mips/syscalls/process_vm_writev.S b/libc/arch-mips/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..cab3b6d
--- /dev/null
+++ b/libc/arch-mips/syscalls/process_vm_writev.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_process_vm_writev
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(process_vm_writev)
diff --git a/libc/arch-mips/syscalls/pwrite64.S b/libc/arch-mips/syscalls/pwrite64.S
new file mode 100644
index 0000000..4f46f75
--- /dev/null
+++ b/libc/arch-mips/syscalls/pwrite64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pwrite64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(pwrite64)
diff --git a/libc/arch-mips/syscalls/quotactl.S b/libc/arch-mips/syscalls/quotactl.S
new file mode 100644
index 0000000..2c8044a
--- /dev/null
+++ b/libc/arch-mips/syscalls/quotactl.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_quotactl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(quotactl)
diff --git a/libc/arch-mips/syscalls/read.S b/libc/arch-mips/syscalls/read.S
new file mode 100644
index 0000000..afc6199
--- /dev/null
+++ b/libc/arch-mips/syscalls/read.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_read
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(read)
diff --git a/libc/arch-mips/syscalls/readahead.S b/libc/arch-mips/syscalls/readahead.S
new file mode 100644
index 0000000..1fe93d8
--- /dev/null
+++ b/libc/arch-mips/syscalls/readahead.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readahead
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(readahead)
diff --git a/libc/arch-mips/syscalls/readlinkat.S b/libc/arch-mips/syscalls/readlinkat.S
new file mode 100644
index 0000000..927f86f
--- /dev/null
+++ b/libc/arch-mips/syscalls/readlinkat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readlinkat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(readlinkat)
diff --git a/libc/arch-mips/syscalls/readv.S b/libc/arch-mips/syscalls/readv.S
new file mode 100644
index 0000000..6af3ac4
--- /dev/null
+++ b/libc/arch-mips/syscalls/readv.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readv
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(readv)
diff --git a/libc/arch-mips/syscalls/recvfrom.S b/libc/arch-mips/syscalls/recvfrom.S
new file mode 100644
index 0000000..448d892
--- /dev/null
+++ b/libc/arch-mips/syscalls/recvfrom.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_recvfrom
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(recvfrom)
diff --git a/libc/arch-mips/syscalls/recvmmsg.S b/libc/arch-mips/syscalls/recvmmsg.S
new file mode 100644
index 0000000..42660e2
--- /dev/null
+++ b/libc/arch-mips/syscalls/recvmmsg.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_recvmmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(recvmmsg)
diff --git a/libc/arch-mips/syscalls/recvmsg.S b/libc/arch-mips/syscalls/recvmsg.S
new file mode 100644
index 0000000..71c7990
--- /dev/null
+++ b/libc/arch-mips/syscalls/recvmsg.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_recvmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(recvmsg)
diff --git a/libc/arch-mips/syscalls/removexattr.S b/libc/arch-mips/syscalls/removexattr.S
new file mode 100644
index 0000000..4830373
--- /dev/null
+++ b/libc/arch-mips/syscalls/removexattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_removexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(removexattr)
diff --git a/libc/arch-mips/syscalls/renameat.S b/libc/arch-mips/syscalls/renameat.S
new file mode 100644
index 0000000..1486f95
--- /dev/null
+++ b/libc/arch-mips/syscalls/renameat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_renameat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(renameat)
diff --git a/libc/arch-mips/syscalls/sched_get_priority_max.S b/libc/arch-mips/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..f1d35c6
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_get_priority_max.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_get_priority_max
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_get_priority_max)
diff --git a/libc/arch-mips/syscalls/sched_get_priority_min.S b/libc/arch-mips/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..cdb5539
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_get_priority_min.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_get_priority_min
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_get_priority_min)
diff --git a/libc/arch-mips/syscalls/sched_getparam.S b/libc/arch-mips/syscalls/sched_getparam.S
new file mode 100644
index 0000000..71724bd
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_getparam.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getparam
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_getparam)
diff --git a/libc/arch-mips/syscalls/sched_getscheduler.S b/libc/arch-mips/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..8fae1c2
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_getscheduler.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getscheduler
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_getscheduler)
diff --git a/libc/arch-mips/syscalls/sched_rr_get_interval.S b/libc/arch-mips/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..eb53d77
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_rr_get_interval
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_rr_get_interval)
diff --git a/libc/arch-mips/syscalls/sched_setaffinity.S b/libc/arch-mips/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..a4837fa
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setaffinity.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setaffinity
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_setaffinity)
diff --git a/libc/arch-mips/syscalls/sched_setparam.S b/libc/arch-mips/syscalls/sched_setparam.S
new file mode 100644
index 0000000..4b6d0a2
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setparam.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setparam
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_setparam)
diff --git a/libc/arch-mips/syscalls/sched_setscheduler.S b/libc/arch-mips/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..69d7259
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setscheduler.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setscheduler
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_setscheduler)
diff --git a/libc/arch-mips/syscalls/sched_yield.S b/libc/arch-mips/syscalls/sched_yield.S
new file mode 100644
index 0000000..da6b531
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_yield.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_yield
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sched_yield)
diff --git a/libc/arch-mips/syscalls/sendfile.S b/libc/arch-mips/syscalls/sendfile.S
new file mode 100644
index 0000000..9145cea
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendfile.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendfile
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sendfile)
diff --git a/libc/arch-mips/syscalls/sendfile64.S b/libc/arch-mips/syscalls/sendfile64.S
new file mode 100644
index 0000000..0093917
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendfile64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendfile64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sendfile64)
diff --git a/libc/arch-mips/syscalls/sendmmsg.S b/libc/arch-mips/syscalls/sendmmsg.S
new file mode 100644
index 0000000..d4e9806
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendmmsg.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendmmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sendmmsg)
diff --git a/libc/arch-mips/syscalls/sendmsg.S b/libc/arch-mips/syscalls/sendmsg.S
new file mode 100644
index 0000000..ec019d6
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendmsg.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sendmsg)
diff --git a/libc/arch-mips/syscalls/sendto.S b/libc/arch-mips/syscalls/sendto.S
new file mode 100644
index 0000000..884fd06
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendto.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendto
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sendto)
diff --git a/libc/arch-mips/syscalls/setdomainname.S b/libc/arch-mips/syscalls/setdomainname.S
new file mode 100644
index 0000000..9144a81
--- /dev/null
+++ b/libc/arch-mips/syscalls/setdomainname.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setdomainname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setdomainname)
diff --git a/libc/arch-mips/syscalls/setfsgid.S b/libc/arch-mips/syscalls/setfsgid.S
new file mode 100644
index 0000000..b927d23
--- /dev/null
+++ b/libc/arch-mips/syscalls/setfsgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setfsgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setfsgid)
diff --git a/libc/arch-mips/syscalls/setfsuid.S b/libc/arch-mips/syscalls/setfsuid.S
new file mode 100644
index 0000000..c95f30f
--- /dev/null
+++ b/libc/arch-mips/syscalls/setfsuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setfsuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setfsuid)
diff --git a/libc/arch-mips/syscalls/setgid.S b/libc/arch-mips/syscalls/setgid.S
new file mode 100644
index 0000000..a1665cc
--- /dev/null
+++ b/libc/arch-mips/syscalls/setgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setgid)
diff --git a/libc/arch-mips/syscalls/setgroups.S b/libc/arch-mips/syscalls/setgroups.S
new file mode 100644
index 0000000..f8f4c52
--- /dev/null
+++ b/libc/arch-mips/syscalls/setgroups.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setgroups
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setgroups)
diff --git a/libc/arch-mips/syscalls/sethostname.S b/libc/arch-mips/syscalls/sethostname.S
new file mode 100644
index 0000000..1a3e37b
--- /dev/null
+++ b/libc/arch-mips/syscalls/sethostname.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sethostname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sethostname)
diff --git a/libc/arch-mips/syscalls/setitimer.S b/libc/arch-mips/syscalls/setitimer.S
new file mode 100644
index 0000000..1a32e97
--- /dev/null
+++ b/libc/arch-mips/syscalls/setitimer.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setitimer
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setitimer)
diff --git a/libc/arch-mips/syscalls/setns.S b/libc/arch-mips/syscalls/setns.S
new file mode 100644
index 0000000..6021aa6
--- /dev/null
+++ b/libc/arch-mips/syscalls/setns.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setns
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setns)
diff --git a/libc/arch-mips/syscalls/setpgid.S b/libc/arch-mips/syscalls/setpgid.S
new file mode 100644
index 0000000..449eabd
--- /dev/null
+++ b/libc/arch-mips/syscalls/setpgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setpgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setpgid)
diff --git a/libc/arch-mips/syscalls/setpriority.S b/libc/arch-mips/syscalls/setpriority.S
new file mode 100644
index 0000000..53f500b
--- /dev/null
+++ b/libc/arch-mips/syscalls/setpriority.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setpriority
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setpriority)
diff --git a/libc/arch-mips/syscalls/setregid.S b/libc/arch-mips/syscalls/setregid.S
new file mode 100644
index 0000000..f251969
--- /dev/null
+++ b/libc/arch-mips/syscalls/setregid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setregid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setregid)
diff --git a/libc/arch-mips/syscalls/setresgid.S b/libc/arch-mips/syscalls/setresgid.S
new file mode 100644
index 0000000..78eb897
--- /dev/null
+++ b/libc/arch-mips/syscalls/setresgid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setresgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setresgid)
diff --git a/libc/arch-mips/syscalls/setresuid.S b/libc/arch-mips/syscalls/setresuid.S
new file mode 100644
index 0000000..c78a4db
--- /dev/null
+++ b/libc/arch-mips/syscalls/setresuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setresuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setresuid)
diff --git a/libc/arch-mips/syscalls/setreuid.S b/libc/arch-mips/syscalls/setreuid.S
new file mode 100644
index 0000000..81e8551
--- /dev/null
+++ b/libc/arch-mips/syscalls/setreuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setreuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setreuid)
diff --git a/libc/arch-mips/syscalls/setrlimit.S b/libc/arch-mips/syscalls/setrlimit.S
new file mode 100644
index 0000000..ad11caf
--- /dev/null
+++ b/libc/arch-mips/syscalls/setrlimit.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setrlimit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setrlimit)
diff --git a/libc/arch-mips/syscalls/setsid.S b/libc/arch-mips/syscalls/setsid.S
new file mode 100644
index 0000000..c83d39f
--- /dev/null
+++ b/libc/arch-mips/syscalls/setsid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setsid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setsid)
diff --git a/libc/arch-mips/syscalls/setsockopt.S b/libc/arch-mips/syscalls/setsockopt.S
new file mode 100644
index 0000000..2d398ef
--- /dev/null
+++ b/libc/arch-mips/syscalls/setsockopt.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setsockopt
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setsockopt)
diff --git a/libc/arch-mips/syscalls/settimeofday.S b/libc/arch-mips/syscalls/settimeofday.S
new file mode 100644
index 0000000..4ae8057
--- /dev/null
+++ b/libc/arch-mips/syscalls/settimeofday.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_settimeofday
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(settimeofday)
diff --git a/libc/arch-mips/syscalls/setuid.S b/libc/arch-mips/syscalls/setuid.S
new file mode 100644
index 0000000..732fb8a
--- /dev/null
+++ b/libc/arch-mips/syscalls/setuid.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setuid)
diff --git a/libc/arch-mips/syscalls/setxattr.S b/libc/arch-mips/syscalls/setxattr.S
new file mode 100644
index 0000000..36a5d47
--- /dev/null
+++ b/libc/arch-mips/syscalls/setxattr.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(setxattr)
diff --git a/libc/arch-mips/syscalls/shutdown.S b/libc/arch-mips/syscalls/shutdown.S
new file mode 100644
index 0000000..885a501
--- /dev/null
+++ b/libc/arch-mips/syscalls/shutdown.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_shutdown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(shutdown)
diff --git a/libc/arch-mips/syscalls/sigaltstack.S b/libc/arch-mips/syscalls/sigaltstack.S
new file mode 100644
index 0000000..4276d71
--- /dev/null
+++ b/libc/arch-mips/syscalls/sigaltstack.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigaltstack
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sigaltstack)
diff --git a/libc/arch-mips/syscalls/socketpair.S b/libc/arch-mips/syscalls/socketpair.S
new file mode 100644
index 0000000..ac66b34
--- /dev/null
+++ b/libc/arch-mips/syscalls/socketpair.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_socketpair
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(socketpair)
diff --git a/libc/arch-mips/syscalls/splice.S b/libc/arch-mips/syscalls/splice.S
new file mode 100644
index 0000000..afecd83
--- /dev/null
+++ b/libc/arch-mips/syscalls/splice.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_splice
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(splice)
diff --git a/libc/arch-mips/syscalls/swapoff.S b/libc/arch-mips/syscalls/swapoff.S
new file mode 100644
index 0000000..dfe3a5c
--- /dev/null
+++ b/libc/arch-mips/syscalls/swapoff.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_swapoff
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(swapoff)
diff --git a/libc/arch-mips/syscalls/swapon.S b/libc/arch-mips/syscalls/swapon.S
new file mode 100644
index 0000000..12cfca1
--- /dev/null
+++ b/libc/arch-mips/syscalls/swapon.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_swapon
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(swapon)
diff --git a/libc/arch-mips/syscalls/symlinkat.S b/libc/arch-mips/syscalls/symlinkat.S
new file mode 100644
index 0000000..a349ede
--- /dev/null
+++ b/libc/arch-mips/syscalls/symlinkat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_symlinkat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(symlinkat)
diff --git a/libc/arch-mips/syscalls/sync.S b/libc/arch-mips/syscalls/sync.S
new file mode 100644
index 0000000..80667b3
--- /dev/null
+++ b/libc/arch-mips/syscalls/sync.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sync)
diff --git a/libc/arch-mips/syscalls/syncfs.S b/libc/arch-mips/syscalls/syncfs.S
new file mode 100644
index 0000000..78ee0e7
--- /dev/null
+++ b/libc/arch-mips/syscalls/syncfs.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_syncfs
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(syncfs)
diff --git a/libc/arch-mips/syscalls/sysinfo.S b/libc/arch-mips/syscalls/sysinfo.S
new file mode 100644
index 0000000..42fa57d
--- /dev/null
+++ b/libc/arch-mips/syscalls/sysinfo.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sysinfo
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(sysinfo)
diff --git a/libc/arch-mips/syscalls/tee.S b/libc/arch-mips/syscalls/tee.S
new file mode 100644
index 0000000..97867e3
--- /dev/null
+++ b/libc/arch-mips/syscalls/tee.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_tee
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(tee)
diff --git a/libc/arch-mips/syscalls/tgkill.S b/libc/arch-mips/syscalls/tgkill.S
new file mode 100644
index 0000000..cded9e5
--- /dev/null
+++ b/libc/arch-mips/syscalls/tgkill.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_tgkill
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(tgkill)
diff --git a/libc/arch-mips/syscalls/timerfd_create.S b/libc/arch-mips/syscalls/timerfd_create.S
new file mode 100644
index 0000000..840f7e2
--- /dev/null
+++ b/libc/arch-mips/syscalls/timerfd_create.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timerfd_create
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(timerfd_create)
diff --git a/libc/arch-mips/syscalls/timerfd_gettime.S b/libc/arch-mips/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..7ddc25f
--- /dev/null
+++ b/libc/arch-mips/syscalls/timerfd_gettime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timerfd_gettime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(timerfd_gettime)
diff --git a/libc/arch-mips/syscalls/timerfd_settime.S b/libc/arch-mips/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..b4e7926
--- /dev/null
+++ b/libc/arch-mips/syscalls/timerfd_settime.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timerfd_settime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(timerfd_settime)
diff --git a/libc/arch-mips/syscalls/times.S b/libc/arch-mips/syscalls/times.S
new file mode 100644
index 0000000..ad4003b
--- /dev/null
+++ b/libc/arch-mips/syscalls/times.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_times
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(times)
diff --git a/libc/arch-mips/syscalls/truncate.S b/libc/arch-mips/syscalls/truncate.S
new file mode 100644
index 0000000..cb077e9
--- /dev/null
+++ b/libc/arch-mips/syscalls/truncate.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_truncate
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(truncate)
diff --git a/libc/arch-mips/syscalls/truncate64.S b/libc/arch-mips/syscalls/truncate64.S
new file mode 100644
index 0000000..4ccd2ad
--- /dev/null
+++ b/libc/arch-mips/syscalls/truncate64.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate64)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_truncate64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(truncate64)
diff --git a/libc/arch-mips/syscalls/umask.S b/libc/arch-mips/syscalls/umask.S
new file mode 100644
index 0000000..196dc07
--- /dev/null
+++ b/libc/arch-mips/syscalls/umask.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_umask
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(umask)
diff --git a/libc/arch-mips/syscalls/umount2.S b/libc/arch-mips/syscalls/umount2.S
new file mode 100644
index 0000000..f61e3e9
--- /dev/null
+++ b/libc/arch-mips/syscalls/umount2.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_umount2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(umount2)
diff --git a/libc/arch-mips/syscalls/uname.S b/libc/arch-mips/syscalls/uname.S
new file mode 100644
index 0000000..c3408e0
--- /dev/null
+++ b/libc/arch-mips/syscalls/uname.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_uname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(uname)
diff --git a/libc/arch-mips/syscalls/unlinkat.S b/libc/arch-mips/syscalls/unlinkat.S
new file mode 100644
index 0000000..400a0b6
--- /dev/null
+++ b/libc/arch-mips/syscalls/unlinkat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_unlinkat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(unlinkat)
diff --git a/libc/arch-mips/syscalls/unshare.S b/libc/arch-mips/syscalls/unshare.S
new file mode 100644
index 0000000..2e81abb
--- /dev/null
+++ b/libc/arch-mips/syscalls/unshare.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_unshare
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(unshare)
diff --git a/libc/arch-mips/syscalls/utimensat.S b/libc/arch-mips/syscalls/utimensat.S
new file mode 100644
index 0000000..70d0bdd
--- /dev/null
+++ b/libc/arch-mips/syscalls/utimensat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_utimensat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(utimensat)
diff --git a/libc/arch-mips/syscalls/vmsplice.S b/libc/arch-mips/syscalls/vmsplice.S
new file mode 100644
index 0000000..e575962
--- /dev/null
+++ b/libc/arch-mips/syscalls/vmsplice.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_vmsplice
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(vmsplice)
diff --git a/libc/arch-mips/syscalls/wait4.S b/libc/arch-mips/syscalls/wait4.S
new file mode 100644
index 0000000..c9572da
--- /dev/null
+++ b/libc/arch-mips/syscalls/wait4.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_wait4
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(wait4)
diff --git a/libc/arch-mips/syscalls/write.S b/libc/arch-mips/syscalls/write.S
new file mode 100644
index 0000000..501c211
--- /dev/null
+++ b/libc/arch-mips/syscalls/write.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_write
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(write)
diff --git a/libc/arch-mips/syscalls/writev.S b/libc/arch-mips/syscalls/writev.S
new file mode 100644
index 0000000..597d7fa
--- /dev/null
+++ b/libc/arch-mips/syscalls/writev.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_writev
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno_internal
+    j $t9
+    nop
+    .set reorder
+END(writev)
diff --git a/libc/arch-mips64/syscalls/___clock_nanosleep.S b/libc/arch-mips64/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..1633136
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___clock_nanosleep.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    .set push
+    .set noreorder
+    li $v0, __NR_clock_nanosleep
+    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(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-mips64/syscalls/___close.S b/libc/arch-mips64/syscalls/___close.S
new file mode 100644
index 0000000..a8ab9a3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___close.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    .set push
+    .set noreorder
+    li $v0, __NR_close
+    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(___close)
+.hidden ___close
diff --git a/libc/arch-mips64/syscalls/___faccessat.S b/libc/arch-mips64/syscalls/___faccessat.S
new file mode 100644
index 0000000..6e15b92
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___faccessat.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    .set push
+    .set noreorder
+    li $v0, __NR_faccessat
+    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(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-mips64/syscalls/___fchmod.S b/libc/arch-mips64/syscalls/___fchmod.S
new file mode 100644
index 0000000..610c7f7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___fchmod.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    .set push
+    .set noreorder
+    li $v0, __NR_fchmod
+    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(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-mips64/syscalls/___fchmodat.S b/libc/arch-mips64/syscalls/___fchmodat.S
new file mode 100644
index 0000000..70ad465
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___fchmodat.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    .set push
+    .set noreorder
+    li $v0, __NR_fchmodat
+    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(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-mips64/syscalls/___fgetxattr.S b/libc/arch-mips64/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..fefb416
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___fgetxattr.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_fgetxattr
+    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(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-mips64/syscalls/___flistxattr.S b/libc/arch-mips64/syscalls/___flistxattr.S
new file mode 100644
index 0000000..ff1991d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___flistxattr.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_flistxattr
+    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(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-mips64/syscalls/___fsetxattr.S b/libc/arch-mips64/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..454be4b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___fsetxattr.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_fsetxattr
+    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(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-mips64/syscalls/___mremap.S b/libc/arch-mips64/syscalls/___mremap.S
new file mode 100644
index 0000000..4c996a6
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___mremap.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    .set push
+    .set noreorder
+    li $v0, __NR_mremap
+    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(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-mips64/syscalls/___rt_sigqueueinfo.S b/libc/arch-mips64/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..5cb239a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigqueueinfo
+    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(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-mips64/syscalls/__accept4.S b/libc/arch-mips64/syscalls/__accept4.S
new file mode 100644
index 0000000..d13222e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__accept4.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    .set push
+    .set noreorder
+    li $v0, __NR_accept4
+    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(__accept4)
+.hidden __accept4
diff --git a/libc/arch-mips64/syscalls/__brk.S b/libc/arch-mips64/syscalls/__brk.S
new file mode 100644
index 0000000..a643a66
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__brk.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    .set push
+    .set noreorder
+    li $v0, __NR_brk
+    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(__brk)
+.hidden __brk
diff --git a/libc/arch-mips64/syscalls/__clock_getres.S b/libc/arch-mips64/syscalls/__clock_getres.S
new file mode 100644
index 0000000..fb871c9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__clock_getres.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    .set push
+    .set noreorder
+    li $v0, __NR_clock_getres
+    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(__clock_getres)
+.hidden __clock_getres
diff --git a/libc/arch-mips64/syscalls/__clock_gettime.S b/libc/arch-mips64/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..fb3486b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__clock_gettime.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    .set push
+    .set noreorder
+    li $v0, __NR_clock_gettime
+    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(__clock_gettime)
+.hidden __clock_gettime
diff --git a/libc/arch-mips64/syscalls/__connect.S b/libc/arch-mips64/syscalls/__connect.S
new file mode 100644
index 0000000..01f465f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__connect.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    .set push
+    .set noreorder
+    li $v0, __NR_connect
+    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(__connect)
+.hidden __connect
diff --git a/libc/arch-mips64/syscalls/__epoll_pwait.S b/libc/arch-mips64/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..7362583
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__epoll_pwait.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    .set push
+    .set noreorder
+    li $v0, __NR_epoll_pwait
+    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(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-mips64/syscalls/__exit.S b/libc/arch-mips64/syscalls/__exit.S
new file mode 100644
index 0000000..d32746a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__exit.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    .set push
+    .set noreorder
+    li $v0, __NR_exit
+    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(__exit)
+.hidden __exit
diff --git a/libc/arch-mips64/syscalls/__fadvise64.S b/libc/arch-mips64/syscalls/__fadvise64.S
new file mode 100644
index 0000000..6170142
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__fadvise64.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fadvise64)
+    .set push
+    .set noreorder
+    li $v0, __NR_fadvise64
+    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(__fadvise64)
+.hidden __fadvise64
diff --git a/libc/arch-mips64/syscalls/__fstatfs.S b/libc/arch-mips64/syscalls/__fstatfs.S
new file mode 100644
index 0000000..bc57bb1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__fstatfs.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs)
+    .set push
+    .set noreorder
+    li $v0, __NR_fstatfs
+    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(__fstatfs)
+.hidden __fstatfs
diff --git a/libc/arch-mips64/syscalls/__getcpu.S b/libc/arch-mips64/syscalls/__getcpu.S
new file mode 100644
index 0000000..05acc44
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__getcpu.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    .set push
+    .set noreorder
+    li $v0, __NR_getcpu
+    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(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-mips64/syscalls/__getcwd.S b/libc/arch-mips64/syscalls/__getcwd.S
new file mode 100644
index 0000000..572d52d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__getcwd.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    .set push
+    .set noreorder
+    li $v0, __NR_getcwd
+    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(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-mips64/syscalls/__getdents64.S b/libc/arch-mips64/syscalls/__getdents64.S
new file mode 100644
index 0000000..9166c5f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__getdents64.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    .set push
+    .set noreorder
+    li $v0, __NR_getdents64
+    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(__getdents64)
+.hidden __getdents64
diff --git a/libc/arch-mips64/syscalls/__getpid.S b/libc/arch-mips64/syscalls/__getpid.S
new file mode 100644
index 0000000..7344062
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__getpid.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getpid
+    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(__getpid)
+.hidden __getpid
diff --git a/libc/arch-mips64/syscalls/__getpriority.S b/libc/arch-mips64/syscalls/__getpriority.S
new file mode 100644
index 0000000..faa386a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__getpriority.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    .set push
+    .set noreorder
+    li $v0, __NR_getpriority
+    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(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-mips64/syscalls/__gettimeofday.S b/libc/arch-mips64/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..2316491
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__gettimeofday.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    .set push
+    .set noreorder
+    li $v0, __NR_gettimeofday
+    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(__gettimeofday)
+.hidden __gettimeofday
diff --git a/libc/arch-mips64/syscalls/__ioctl.S b/libc/arch-mips64/syscalls/__ioctl.S
new file mode 100644
index 0000000..7193cc1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__ioctl.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    .set push
+    .set noreorder
+    li $v0, __NR_ioctl
+    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(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-mips64/syscalls/__openat.S b/libc/arch-mips64/syscalls/__openat.S
new file mode 100644
index 0000000..a1d6d2f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__openat.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    .set push
+    .set noreorder
+    li $v0, __NR_openat
+    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(__openat)
+.hidden __openat
diff --git a/libc/arch-mips64/syscalls/__ppoll.S b/libc/arch-mips64/syscalls/__ppoll.S
new file mode 100644
index 0000000..5992310
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__ppoll.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    .set push
+    .set noreorder
+    li $v0, __NR_ppoll
+    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(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-mips64/syscalls/__pselect6.S b/libc/arch-mips64/syscalls/__pselect6.S
new file mode 100644
index 0000000..e55eee7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__pselect6.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    .set push
+    .set noreorder
+    li $v0, __NR_pselect6
+    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(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-mips64/syscalls/__ptrace.S b/libc/arch-mips64/syscalls/__ptrace.S
new file mode 100644
index 0000000..842d778
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__ptrace.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    .set push
+    .set noreorder
+    li $v0, __NR_ptrace
+    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(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-mips64/syscalls/__reboot.S b/libc/arch-mips64/syscalls/__reboot.S
new file mode 100644
index 0000000..6b1ae9f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__reboot.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    .set push
+    .set noreorder
+    li $v0, __NR_reboot
+    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(__reboot)
+.hidden __reboot
diff --git a/libc/arch-mips64/syscalls/__rt_sigaction.S b/libc/arch-mips64/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..484b482
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__rt_sigaction.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigaction
+    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(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-mips64/syscalls/__rt_sigpending.S b/libc/arch-mips64/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..5961578
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__rt_sigpending.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigpending
+    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(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-mips64/syscalls/__rt_sigprocmask.S b/libc/arch-mips64/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..c962f66
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigprocmask
+    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(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-mips64/syscalls/__rt_sigsuspend.S b/libc/arch-mips64/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..7613af2
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigsuspend
+    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(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-mips64/syscalls/__rt_sigtimedwait.S b/libc/arch-mips64/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..0c80a2e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    .set push
+    .set noreorder
+    li $v0, __NR_rt_sigtimedwait
+    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(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-mips64/syscalls/__sched_getaffinity.S b/libc/arch-mips64/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..5f5dae2
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__sched_getaffinity.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_getaffinity
+    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(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-mips64/syscalls/__set_tid_address.S b/libc/arch-mips64/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..a411701
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__set_tid_address.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    .set push
+    .set noreorder
+    li $v0, __NR_set_tid_address
+    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(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-mips64/syscalls/__set_tls.S b/libc/arch-mips64/syscalls/__set_tls.S
new file mode 100644
index 0000000..a72c8e3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__set_tls.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tls)
+    .set push
+    .set noreorder
+    li $v0, __NR_set_thread_area
+    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(__set_tls)
+.hidden __set_tls
diff --git a/libc/arch-mips64/syscalls/__signalfd4.S b/libc/arch-mips64/syscalls/__signalfd4.S
new file mode 100644
index 0000000..35e2a0a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__signalfd4.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    .set push
+    .set noreorder
+    li $v0, __NR_signalfd4
+    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(__signalfd4)
+.hidden __signalfd4
diff --git a/libc/arch-mips64/syscalls/__socket.S b/libc/arch-mips64/syscalls/__socket.S
new file mode 100644
index 0000000..dce2031
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__socket.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    .set push
+    .set noreorder
+    li $v0, __NR_socket
+    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(__socket)
+.hidden __socket
diff --git a/libc/arch-mips64/syscalls/__statfs.S b/libc/arch-mips64/syscalls/__statfs.S
new file mode 100644
index 0000000..9960fc7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__statfs.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs)
+    .set push
+    .set noreorder
+    li $v0, __NR_statfs
+    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(__statfs)
+.hidden __statfs
diff --git a/libc/arch-mips64/syscalls/__sync_file_range.S b/libc/arch-mips64/syscalls/__sync_file_range.S
new file mode 100644
index 0000000..eeb470d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__sync_file_range.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range)
+    .set push
+    .set noreorder
+    li $v0, __NR_sync_file_range
+    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(__sync_file_range)
+.hidden __sync_file_range
diff --git a/libc/arch-mips64/syscalls/__timer_create.S b/libc/arch-mips64/syscalls/__timer_create.S
new file mode 100644
index 0000000..2fecc4d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__timer_create.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    .set push
+    .set noreorder
+    li $v0, __NR_timer_create
+    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(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-mips64/syscalls/__timer_delete.S b/libc/arch-mips64/syscalls/__timer_delete.S
new file mode 100644
index 0000000..be6ac60
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__timer_delete.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    .set push
+    .set noreorder
+    li $v0, __NR_timer_delete
+    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(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-mips64/syscalls/__timer_getoverrun.S b/libc/arch-mips64/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..dfabba6
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__timer_getoverrun.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    .set push
+    .set noreorder
+    li $v0, __NR_timer_getoverrun
+    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(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-mips64/syscalls/__timer_gettime.S b/libc/arch-mips64/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..49606c2
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__timer_gettime.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    .set push
+    .set noreorder
+    li $v0, __NR_timer_gettime
+    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(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-mips64/syscalls/__timer_settime.S b/libc/arch-mips64/syscalls/__timer_settime.S
new file mode 100644
index 0000000..a61d92c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__timer_settime.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    .set push
+    .set noreorder
+    li $v0, __NR_timer_settime
+    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(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-mips64/syscalls/__waitid.S b/libc/arch-mips64/syscalls/__waitid.S
new file mode 100644
index 0000000..bc4810c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/__waitid.S
@@ -0,0 +1,26 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    .set push
+    .set noreorder
+    li $v0, __NR_waitid
+    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(__waitid)
+.hidden __waitid
diff --git a/libc/arch-mips64/syscalls/_exit.S b/libc/arch-mips64/syscalls/_exit.S
new file mode 100644
index 0000000..638fdb1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/_exit.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    .set push
+    .set noreorder
+    li $v0, __NR_exit_group
+    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(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-mips64/syscalls/acct.S b/libc/arch-mips64/syscalls/acct.S
new file mode 100644
index 0000000..abf4c26
--- /dev/null
+++ b/libc/arch-mips64/syscalls/acct.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    .set push
+    .set noreorder
+    li $v0, __NR_acct
+    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(acct)
diff --git a/libc/arch-mips64/syscalls/adjtimex.S b/libc/arch-mips64/syscalls/adjtimex.S
new file mode 100644
index 0000000..716f46f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/adjtimex.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    .set push
+    .set noreorder
+    li $v0, __NR_adjtimex
+    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(adjtimex)
diff --git a/libc/arch-mips64/syscalls/bind.S b/libc/arch-mips64/syscalls/bind.S
new file mode 100644
index 0000000..a0b43ab
--- /dev/null
+++ b/libc/arch-mips64/syscalls/bind.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    .set push
+    .set noreorder
+    li $v0, __NR_bind
+    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(bind)
diff --git a/libc/arch-mips64/syscalls/capget.S b/libc/arch-mips64/syscalls/capget.S
new file mode 100644
index 0000000..1fd3b43
--- /dev/null
+++ b/libc/arch-mips64/syscalls/capget.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    .set push
+    .set noreorder
+    li $v0, __NR_capget
+    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(capget)
diff --git a/libc/arch-mips64/syscalls/capset.S b/libc/arch-mips64/syscalls/capset.S
new file mode 100644
index 0000000..e183202
--- /dev/null
+++ b/libc/arch-mips64/syscalls/capset.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    .set push
+    .set noreorder
+    li $v0, __NR_capset
+    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(capset)
diff --git a/libc/arch-mips64/syscalls/chdir.S b/libc/arch-mips64/syscalls/chdir.S
new file mode 100644
index 0000000..c4dc3b7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/chdir.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    .set push
+    .set noreorder
+    li $v0, __NR_chdir
+    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(chdir)
diff --git a/libc/arch-mips64/syscalls/chroot.S b/libc/arch-mips64/syscalls/chroot.S
new file mode 100644
index 0000000..7880087
--- /dev/null
+++ b/libc/arch-mips64/syscalls/chroot.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    .set push
+    .set noreorder
+    li $v0, __NR_chroot
+    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(chroot)
diff --git a/libc/arch-mips64/syscalls/clock_adjtime.S b/libc/arch-mips64/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..3650647
--- /dev/null
+++ b/libc/arch-mips64/syscalls/clock_adjtime.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    .set push
+    .set noreorder
+    li $v0, __NR_clock_adjtime
+    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(clock_adjtime)
diff --git a/libc/arch-mips64/syscalls/clock_settime.S b/libc/arch-mips64/syscalls/clock_settime.S
new file mode 100644
index 0000000..fa63bad
--- /dev/null
+++ b/libc/arch-mips64/syscalls/clock_settime.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    .set push
+    .set noreorder
+    li $v0, __NR_clock_settime
+    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(clock_settime)
diff --git a/libc/arch-mips64/syscalls/delete_module.S b/libc/arch-mips64/syscalls/delete_module.S
new file mode 100644
index 0000000..41f0333
--- /dev/null
+++ b/libc/arch-mips64/syscalls/delete_module.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    .set push
+    .set noreorder
+    li $v0, __NR_delete_module
+    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(delete_module)
diff --git a/libc/arch-mips64/syscalls/dup.S b/libc/arch-mips64/syscalls/dup.S
new file mode 100644
index 0000000..b916cd5
--- /dev/null
+++ b/libc/arch-mips64/syscalls/dup.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    .set push
+    .set noreorder
+    li $v0, __NR_dup
+    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(dup)
diff --git a/libc/arch-mips64/syscalls/dup3.S b/libc/arch-mips64/syscalls/dup3.S
new file mode 100644
index 0000000..975e768
--- /dev/null
+++ b/libc/arch-mips64/syscalls/dup3.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    .set push
+    .set noreorder
+    li $v0, __NR_dup3
+    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(dup3)
diff --git a/libc/arch-mips64/syscalls/epoll_create1.S b/libc/arch-mips64/syscalls/epoll_create1.S
new file mode 100644
index 0000000..2cb913a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/epoll_create1.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    .set push
+    .set noreorder
+    li $v0, __NR_epoll_create1
+    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(epoll_create1)
diff --git a/libc/arch-mips64/syscalls/epoll_ctl.S b/libc/arch-mips64/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..2a8f731
--- /dev/null
+++ b/libc/arch-mips64/syscalls/epoll_ctl.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    .set push
+    .set noreorder
+    li $v0, __NR_epoll_ctl
+    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(epoll_ctl)
diff --git a/libc/arch-mips64/syscalls/eventfd.S b/libc/arch-mips64/syscalls/eventfd.S
new file mode 100644
index 0000000..f8eaee7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/eventfd.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    .set push
+    .set noreorder
+    li $v0, __NR_eventfd2
+    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(eventfd)
diff --git a/libc/arch-mips64/syscalls/execve.S b/libc/arch-mips64/syscalls/execve.S
new file mode 100644
index 0000000..6f7d1d7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/execve.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    .set push
+    .set noreorder
+    li $v0, __NR_execve
+    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(execve)
diff --git a/libc/arch-mips64/syscalls/fallocate.S b/libc/arch-mips64/syscalls/fallocate.S
new file mode 100644
index 0000000..6685475
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fallocate.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate)
+    .set push
+    .set noreorder
+    li $v0, __NR_fallocate
+    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(fallocate)
+
+ALIAS_SYMBOL(fallocate64, fallocate)
diff --git a/libc/arch-mips64/syscalls/fchdir.S b/libc/arch-mips64/syscalls/fchdir.S
new file mode 100644
index 0000000..ba76746
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fchdir.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    .set push
+    .set noreorder
+    li $v0, __NR_fchdir
+    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(fchdir)
diff --git a/libc/arch-mips64/syscalls/fchown.S b/libc/arch-mips64/syscalls/fchown.S
new file mode 100644
index 0000000..edbc1f1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fchown.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    .set push
+    .set noreorder
+    li $v0, __NR_fchown
+    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(fchown)
diff --git a/libc/arch-mips64/syscalls/fchownat.S b/libc/arch-mips64/syscalls/fchownat.S
new file mode 100644
index 0000000..219a32e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fchownat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    .set push
+    .set noreorder
+    li $v0, __NR_fchownat
+    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(fchownat)
diff --git a/libc/arch-mips64/syscalls/fcntl.S b/libc/arch-mips64/syscalls/fcntl.S
new file mode 100644
index 0000000..25571f9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fcntl.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fcntl)
+    .set push
+    .set noreorder
+    li $v0, __NR_fcntl
+    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(fcntl)
diff --git a/libc/arch-mips64/syscalls/fdatasync.S b/libc/arch-mips64/syscalls/fdatasync.S
new file mode 100644
index 0000000..b8f21c7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fdatasync.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    .set push
+    .set noreorder
+    li $v0, __NR_fdatasync
+    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(fdatasync)
diff --git a/libc/arch-mips64/syscalls/flock.S b/libc/arch-mips64/syscalls/flock.S
new file mode 100644
index 0000000..0242f98
--- /dev/null
+++ b/libc/arch-mips64/syscalls/flock.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    .set push
+    .set noreorder
+    li $v0, __NR_flock
+    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(flock)
diff --git a/libc/arch-mips64/syscalls/fremovexattr.S b/libc/arch-mips64/syscalls/fremovexattr.S
new file mode 100644
index 0000000..b328c67
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fremovexattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_fremovexattr
+    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(fremovexattr)
diff --git a/libc/arch-mips64/syscalls/fsync.S b/libc/arch-mips64/syscalls/fsync.S
new file mode 100644
index 0000000..197159f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/fsync.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    .set push
+    .set noreorder
+    li $v0, __NR_fsync
+    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(fsync)
diff --git a/libc/arch-mips64/syscalls/ftruncate.S b/libc/arch-mips64/syscalls/ftruncate.S
new file mode 100644
index 0000000..09b06fa
--- /dev/null
+++ b/libc/arch-mips64/syscalls/ftruncate.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate)
+    .set push
+    .set noreorder
+    li $v0, __NR_ftruncate
+    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(ftruncate)
+
+ALIAS_SYMBOL(ftruncate64, ftruncate)
diff --git a/libc/arch-mips64/syscalls/getegid.S b/libc/arch-mips64/syscalls/getegid.S
new file mode 100644
index 0000000..9192835
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getegid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getegid
+    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(getegid)
diff --git a/libc/arch-mips64/syscalls/geteuid.S b/libc/arch-mips64/syscalls/geteuid.S
new file mode 100644
index 0000000..5a5cbf9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/geteuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_geteuid
+    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(geteuid)
diff --git a/libc/arch-mips64/syscalls/getgid.S b/libc/arch-mips64/syscalls/getgid.S
new file mode 100644
index 0000000..c434419
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getgid
+    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(getgid)
diff --git a/libc/arch-mips64/syscalls/getgroups.S b/libc/arch-mips64/syscalls/getgroups.S
new file mode 100644
index 0000000..29ac854
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getgroups.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    .set push
+    .set noreorder
+    li $v0, __NR_getgroups
+    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(getgroups)
diff --git a/libc/arch-mips64/syscalls/getitimer.S b/libc/arch-mips64/syscalls/getitimer.S
new file mode 100644
index 0000000..445fb1d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getitimer.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    .set push
+    .set noreorder
+    li $v0, __NR_getitimer
+    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(getitimer)
diff --git a/libc/arch-mips64/syscalls/getpeername.S b/libc/arch-mips64/syscalls/getpeername.S
new file mode 100644
index 0000000..0f081c8
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getpeername.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    .set push
+    .set noreorder
+    li $v0, __NR_getpeername
+    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(getpeername)
diff --git a/libc/arch-mips64/syscalls/getpgid.S b/libc/arch-mips64/syscalls/getpgid.S
new file mode 100644
index 0000000..7859ad4
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getpgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getpgid
+    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(getpgid)
diff --git a/libc/arch-mips64/syscalls/getppid.S b/libc/arch-mips64/syscalls/getppid.S
new file mode 100644
index 0000000..c67ed1f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getppid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getppid
+    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(getppid)
diff --git a/libc/arch-mips64/syscalls/getrandom.S b/libc/arch-mips64/syscalls/getrandom.S
new file mode 100644
index 0000000..b4f5ea8
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getrandom.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    .set push
+    .set noreorder
+    li $v0, __NR_getrandom
+    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(getrandom)
diff --git a/libc/arch-mips64/syscalls/getresgid.S b/libc/arch-mips64/syscalls/getresgid.S
new file mode 100644
index 0000000..ba1aafe
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getresgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getresgid
+    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(getresgid)
diff --git a/libc/arch-mips64/syscalls/getresuid.S b/libc/arch-mips64/syscalls/getresuid.S
new file mode 100644
index 0000000..d9c40f9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getresuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getresuid
+    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(getresuid)
diff --git a/libc/arch-mips64/syscalls/getrlimit.S b/libc/arch-mips64/syscalls/getrlimit.S
new file mode 100644
index 0000000..ae1cc86
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getrlimit.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    .set push
+    .set noreorder
+    li $v0, __NR_getrlimit
+    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(getrlimit)
+
+ALIAS_SYMBOL(getrlimit64, getrlimit)
diff --git a/libc/arch-mips64/syscalls/getrusage.S b/libc/arch-mips64/syscalls/getrusage.S
new file mode 100644
index 0000000..4c6d3f1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getrusage.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    .set push
+    .set noreorder
+    li $v0, __NR_getrusage
+    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(getrusage)
diff --git a/libc/arch-mips64/syscalls/getsid.S b/libc/arch-mips64/syscalls/getsid.S
new file mode 100644
index 0000000..6a7b844
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getsid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getsid
+    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(getsid)
diff --git a/libc/arch-mips64/syscalls/getsockname.S b/libc/arch-mips64/syscalls/getsockname.S
new file mode 100644
index 0000000..742c496
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getsockname.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    .set push
+    .set noreorder
+    li $v0, __NR_getsockname
+    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(getsockname)
diff --git a/libc/arch-mips64/syscalls/getsockopt.S b/libc/arch-mips64/syscalls/getsockopt.S
new file mode 100644
index 0000000..451006e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getsockopt.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    .set push
+    .set noreorder
+    li $v0, __NR_getsockopt
+    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(getsockopt)
diff --git a/libc/arch-mips64/syscalls/getuid.S b/libc/arch-mips64/syscalls/getuid.S
new file mode 100644
index 0000000..964d5a6
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_getuid
+    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(getuid)
diff --git a/libc/arch-mips64/syscalls/getxattr.S b/libc/arch-mips64/syscalls/getxattr.S
new file mode 100644
index 0000000..23fc3d1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/getxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_getxattr
+    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(getxattr)
diff --git a/libc/arch-mips64/syscalls/init_module.S b/libc/arch-mips64/syscalls/init_module.S
new file mode 100644
index 0000000..3b02055
--- /dev/null
+++ b/libc/arch-mips64/syscalls/init_module.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    .set push
+    .set noreorder
+    li $v0, __NR_init_module
+    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(init_module)
diff --git a/libc/arch-mips64/syscalls/inotify_add_watch.S b/libc/arch-mips64/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..583b8bb
--- /dev/null
+++ b/libc/arch-mips64/syscalls/inotify_add_watch.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    .set push
+    .set noreorder
+    li $v0, __NR_inotify_add_watch
+    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(inotify_add_watch)
diff --git a/libc/arch-mips64/syscalls/inotify_init1.S b/libc/arch-mips64/syscalls/inotify_init1.S
new file mode 100644
index 0000000..5ccb9af
--- /dev/null
+++ b/libc/arch-mips64/syscalls/inotify_init1.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    .set push
+    .set noreorder
+    li $v0, __NR_inotify_init1
+    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(inotify_init1)
diff --git a/libc/arch-mips64/syscalls/inotify_rm_watch.S b/libc/arch-mips64/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..7f18c0f
--- /dev/null
+++ b/libc/arch-mips64/syscalls/inotify_rm_watch.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    .set push
+    .set noreorder
+    li $v0, __NR_inotify_rm_watch
+    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(inotify_rm_watch)
diff --git a/libc/arch-mips64/syscalls/kill.S b/libc/arch-mips64/syscalls/kill.S
new file mode 100644
index 0000000..dcc440b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/kill.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    .set push
+    .set noreorder
+    li $v0, __NR_kill
+    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(kill)
diff --git a/libc/arch-mips64/syscalls/klogctl.S b/libc/arch-mips64/syscalls/klogctl.S
new file mode 100644
index 0000000..62af663
--- /dev/null
+++ b/libc/arch-mips64/syscalls/klogctl.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    .set push
+    .set noreorder
+    li $v0, __NR_syslog
+    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(klogctl)
diff --git a/libc/arch-mips64/syscalls/lgetxattr.S b/libc/arch-mips64/syscalls/lgetxattr.S
new file mode 100644
index 0000000..20e3134
--- /dev/null
+++ b/libc/arch-mips64/syscalls/lgetxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_lgetxattr
+    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(lgetxattr)
diff --git a/libc/arch-mips64/syscalls/linkat.S b/libc/arch-mips64/syscalls/linkat.S
new file mode 100644
index 0000000..425c417
--- /dev/null
+++ b/libc/arch-mips64/syscalls/linkat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    .set push
+    .set noreorder
+    li $v0, __NR_linkat
+    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(linkat)
diff --git a/libc/arch-mips64/syscalls/listen.S b/libc/arch-mips64/syscalls/listen.S
new file mode 100644
index 0000000..8263ec3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/listen.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    .set push
+    .set noreorder
+    li $v0, __NR_listen
+    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(listen)
diff --git a/libc/arch-mips64/syscalls/listxattr.S b/libc/arch-mips64/syscalls/listxattr.S
new file mode 100644
index 0000000..5f04ffc
--- /dev/null
+++ b/libc/arch-mips64/syscalls/listxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_listxattr
+    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(listxattr)
diff --git a/libc/arch-mips64/syscalls/llistxattr.S b/libc/arch-mips64/syscalls/llistxattr.S
new file mode 100644
index 0000000..9663fd9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/llistxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_llistxattr
+    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(llistxattr)
diff --git a/libc/arch-mips64/syscalls/lremovexattr.S b/libc/arch-mips64/syscalls/lremovexattr.S
new file mode 100644
index 0000000..905548a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/lremovexattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_lremovexattr
+    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(lremovexattr)
diff --git a/libc/arch-mips64/syscalls/lseek.S b/libc/arch-mips64/syscalls/lseek.S
new file mode 100644
index 0000000..1eee1fa
--- /dev/null
+++ b/libc/arch-mips64/syscalls/lseek.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    .set push
+    .set noreorder
+    li $v0, __NR_lseek
+    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(lseek)
+
+ALIAS_SYMBOL(lseek64, lseek)
diff --git a/libc/arch-mips64/syscalls/lsetxattr.S b/libc/arch-mips64/syscalls/lsetxattr.S
new file mode 100644
index 0000000..38e3523
--- /dev/null
+++ b/libc/arch-mips64/syscalls/lsetxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_lsetxattr
+    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(lsetxattr)
diff --git a/libc/arch-mips64/syscalls/madvise.S b/libc/arch-mips64/syscalls/madvise.S
new file mode 100644
index 0000000..5283700
--- /dev/null
+++ b/libc/arch-mips64/syscalls/madvise.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    .set push
+    .set noreorder
+    li $v0, __NR_madvise
+    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(madvise)
diff --git a/libc/arch-mips64/syscalls/mincore.S b/libc/arch-mips64/syscalls/mincore.S
new file mode 100644
index 0000000..c7f419a
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mincore.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    .set push
+    .set noreorder
+    li $v0, __NR_mincore
+    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(mincore)
diff --git a/libc/arch-mips64/syscalls/mkdirat.S b/libc/arch-mips64/syscalls/mkdirat.S
new file mode 100644
index 0000000..2e1a45b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mkdirat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    .set push
+    .set noreorder
+    li $v0, __NR_mkdirat
+    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(mkdirat)
diff --git a/libc/arch-mips64/syscalls/mknodat.S b/libc/arch-mips64/syscalls/mknodat.S
new file mode 100644
index 0000000..42d73c4
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mknodat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    .set push
+    .set noreorder
+    li $v0, __NR_mknodat
+    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(mknodat)
diff --git a/libc/arch-mips64/syscalls/mlock.S b/libc/arch-mips64/syscalls/mlock.S
new file mode 100644
index 0000000..dd6b784
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mlock.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    .set push
+    .set noreorder
+    li $v0, __NR_mlock
+    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(mlock)
diff --git a/libc/arch-mips64/syscalls/mlockall.S b/libc/arch-mips64/syscalls/mlockall.S
new file mode 100644
index 0000000..a4debce
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mlockall.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    .set push
+    .set noreorder
+    li $v0, __NR_mlockall
+    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(mlockall)
diff --git a/libc/arch-mips64/syscalls/mmap.S b/libc/arch-mips64/syscalls/mmap.S
new file mode 100644
index 0000000..e380c72
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mmap.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mmap)
+    .set push
+    .set noreorder
+    li $v0, __NR_mmap
+    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(mmap)
+
+ALIAS_SYMBOL(mmap64, mmap)
diff --git a/libc/arch-mips64/syscalls/mount.S b/libc/arch-mips64/syscalls/mount.S
new file mode 100644
index 0000000..4d2bca1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mount.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    .set push
+    .set noreorder
+    li $v0, __NR_mount
+    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(mount)
diff --git a/libc/arch-mips64/syscalls/mprotect.S b/libc/arch-mips64/syscalls/mprotect.S
new file mode 100644
index 0000000..e1f3ab0
--- /dev/null
+++ b/libc/arch-mips64/syscalls/mprotect.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    .set push
+    .set noreorder
+    li $v0, __NR_mprotect
+    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(mprotect)
diff --git a/libc/arch-mips64/syscalls/msync.S b/libc/arch-mips64/syscalls/msync.S
new file mode 100644
index 0000000..ec2d175
--- /dev/null
+++ b/libc/arch-mips64/syscalls/msync.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    .set push
+    .set noreorder
+    li $v0, __NR_msync
+    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(msync)
diff --git a/libc/arch-mips64/syscalls/munlock.S b/libc/arch-mips64/syscalls/munlock.S
new file mode 100644
index 0000000..95c4df1
--- /dev/null
+++ b/libc/arch-mips64/syscalls/munlock.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    .set push
+    .set noreorder
+    li $v0, __NR_munlock
+    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(munlock)
diff --git a/libc/arch-mips64/syscalls/munlockall.S b/libc/arch-mips64/syscalls/munlockall.S
new file mode 100644
index 0000000..9862461
--- /dev/null
+++ b/libc/arch-mips64/syscalls/munlockall.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+    .set push
+    .set noreorder
+    li $v0, __NR_munlockall
+    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(munlockall)
diff --git a/libc/arch-mips64/syscalls/munmap.S b/libc/arch-mips64/syscalls/munmap.S
new file mode 100644
index 0000000..2ca802d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/munmap.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    .set push
+    .set noreorder
+    li $v0, __NR_munmap
+    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(munmap)
diff --git a/libc/arch-mips64/syscalls/nanosleep.S b/libc/arch-mips64/syscalls/nanosleep.S
new file mode 100644
index 0000000..291bb00
--- /dev/null
+++ b/libc/arch-mips64/syscalls/nanosleep.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    .set push
+    .set noreorder
+    li $v0, __NR_nanosleep
+    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(nanosleep)
diff --git a/libc/arch-mips64/syscalls/personality.S b/libc/arch-mips64/syscalls/personality.S
new file mode 100644
index 0000000..a85cd76
--- /dev/null
+++ b/libc/arch-mips64/syscalls/personality.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    .set push
+    .set noreorder
+    li $v0, __NR_personality
+    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(personality)
diff --git a/libc/arch-mips64/syscalls/pipe2.S b/libc/arch-mips64/syscalls/pipe2.S
new file mode 100644
index 0000000..96e25e2
--- /dev/null
+++ b/libc/arch-mips64/syscalls/pipe2.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    .set push
+    .set noreorder
+    li $v0, __NR_pipe2
+    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(pipe2)
diff --git a/libc/arch-mips64/syscalls/prctl.S b/libc/arch-mips64/syscalls/prctl.S
new file mode 100644
index 0000000..14b7155
--- /dev/null
+++ b/libc/arch-mips64/syscalls/prctl.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    .set push
+    .set noreorder
+    li $v0, __NR_prctl
+    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(prctl)
diff --git a/libc/arch-mips64/syscalls/pread64.S b/libc/arch-mips64/syscalls/pread64.S
new file mode 100644
index 0000000..74dada3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/pread64.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    .set push
+    .set noreorder
+    li $v0, __NR_pread64
+    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(pread64)
+
+ALIAS_SYMBOL(pread, pread64)
diff --git a/libc/arch-mips64/syscalls/preadv.S b/libc/arch-mips64/syscalls/preadv.S
new file mode 100644
index 0000000..744b06c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/preadv.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(preadv)
+    .set push
+    .set noreorder
+    li $v0, __NR_preadv
+    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(preadv)
+
+ALIAS_SYMBOL(preadv64, preadv)
diff --git a/libc/arch-mips64/syscalls/prlimit64.S b/libc/arch-mips64/syscalls/prlimit64.S
new file mode 100644
index 0000000..c60cf8e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/prlimit64.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    .set push
+    .set noreorder
+    li $v0, __NR_prlimit64
+    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(prlimit64)
+
+ALIAS_SYMBOL(prlimit, prlimit64)
diff --git a/libc/arch-mips64/syscalls/process_vm_readv.S b/libc/arch-mips64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..38ff7eb
--- /dev/null
+++ b/libc/arch-mips64/syscalls/process_vm_readv.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    .set push
+    .set noreorder
+    li $v0, __NR_process_vm_readv
+    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(process_vm_readv)
diff --git a/libc/arch-mips64/syscalls/process_vm_writev.S b/libc/arch-mips64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..c317cae
--- /dev/null
+++ b/libc/arch-mips64/syscalls/process_vm_writev.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    .set push
+    .set noreorder
+    li $v0, __NR_process_vm_writev
+    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(process_vm_writev)
diff --git a/libc/arch-mips64/syscalls/pwrite64.S b/libc/arch-mips64/syscalls/pwrite64.S
new file mode 100644
index 0000000..1d6ac69
--- /dev/null
+++ b/libc/arch-mips64/syscalls/pwrite64.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    .set push
+    .set noreorder
+    li $v0, __NR_pwrite64
+    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(pwrite64)
+
+ALIAS_SYMBOL(pwrite, pwrite64)
diff --git a/libc/arch-mips64/syscalls/pwritev.S b/libc/arch-mips64/syscalls/pwritev.S
new file mode 100644
index 0000000..f3044f9
--- /dev/null
+++ b/libc/arch-mips64/syscalls/pwritev.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwritev)
+    .set push
+    .set noreorder
+    li $v0, __NR_pwritev
+    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(pwritev)
+
+ALIAS_SYMBOL(pwritev64, pwritev)
diff --git a/libc/arch-mips64/syscalls/quotactl.S b/libc/arch-mips64/syscalls/quotactl.S
new file mode 100644
index 0000000..83735ac
--- /dev/null
+++ b/libc/arch-mips64/syscalls/quotactl.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    .set push
+    .set noreorder
+    li $v0, __NR_quotactl
+    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(quotactl)
diff --git a/libc/arch-mips64/syscalls/read.S b/libc/arch-mips64/syscalls/read.S
new file mode 100644
index 0000000..b44e6af
--- /dev/null
+++ b/libc/arch-mips64/syscalls/read.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    .set push
+    .set noreorder
+    li $v0, __NR_read
+    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(read)
diff --git a/libc/arch-mips64/syscalls/readahead.S b/libc/arch-mips64/syscalls/readahead.S
new file mode 100644
index 0000000..f111ac4
--- /dev/null
+++ b/libc/arch-mips64/syscalls/readahead.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    .set push
+    .set noreorder
+    li $v0, __NR_readahead
+    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(readahead)
diff --git a/libc/arch-mips64/syscalls/readlinkat.S b/libc/arch-mips64/syscalls/readlinkat.S
new file mode 100644
index 0000000..987943b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/readlinkat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    .set push
+    .set noreorder
+    li $v0, __NR_readlinkat
+    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(readlinkat)
diff --git a/libc/arch-mips64/syscalls/readv.S b/libc/arch-mips64/syscalls/readv.S
new file mode 100644
index 0000000..04bf55c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/readv.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    .set push
+    .set noreorder
+    li $v0, __NR_readv
+    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(readv)
diff --git a/libc/arch-mips64/syscalls/recvfrom.S b/libc/arch-mips64/syscalls/recvfrom.S
new file mode 100644
index 0000000..7c906ac
--- /dev/null
+++ b/libc/arch-mips64/syscalls/recvfrom.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    .set push
+    .set noreorder
+    li $v0, __NR_recvfrom
+    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(recvfrom)
diff --git a/libc/arch-mips64/syscalls/recvmmsg.S b/libc/arch-mips64/syscalls/recvmmsg.S
new file mode 100644
index 0000000..0c022cb
--- /dev/null
+++ b/libc/arch-mips64/syscalls/recvmmsg.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    .set push
+    .set noreorder
+    li $v0, __NR_recvmmsg
+    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(recvmmsg)
diff --git a/libc/arch-mips64/syscalls/recvmsg.S b/libc/arch-mips64/syscalls/recvmsg.S
new file mode 100644
index 0000000..a06bcdd
--- /dev/null
+++ b/libc/arch-mips64/syscalls/recvmsg.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    .set push
+    .set noreorder
+    li $v0, __NR_recvmsg
+    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(recvmsg)
diff --git a/libc/arch-mips64/syscalls/removexattr.S b/libc/arch-mips64/syscalls/removexattr.S
new file mode 100644
index 0000000..fb5d8de
--- /dev/null
+++ b/libc/arch-mips64/syscalls/removexattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_removexattr
+    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(removexattr)
diff --git a/libc/arch-mips64/syscalls/renameat.S b/libc/arch-mips64/syscalls/renameat.S
new file mode 100644
index 0000000..9a8ab45
--- /dev/null
+++ b/libc/arch-mips64/syscalls/renameat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    .set push
+    .set noreorder
+    li $v0, __NR_renameat
+    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(renameat)
diff --git a/libc/arch-mips64/syscalls/sched_get_priority_max.S b/libc/arch-mips64/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..89b3649
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_get_priority_max.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_get_priority_max
+    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(sched_get_priority_max)
diff --git a/libc/arch-mips64/syscalls/sched_get_priority_min.S b/libc/arch-mips64/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..31c162d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_get_priority_min.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_get_priority_min
+    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(sched_get_priority_min)
diff --git a/libc/arch-mips64/syscalls/sched_getparam.S b/libc/arch-mips64/syscalls/sched_getparam.S
new file mode 100644
index 0000000..a15aaf5
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_getparam.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_getparam
+    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(sched_getparam)
diff --git a/libc/arch-mips64/syscalls/sched_getscheduler.S b/libc/arch-mips64/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..0e48a16
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_getscheduler.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_getscheduler
+    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(sched_getscheduler)
diff --git a/libc/arch-mips64/syscalls/sched_rr_get_interval.S b/libc/arch-mips64/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..8ee4fe7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_rr_get_interval
+    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(sched_rr_get_interval)
diff --git a/libc/arch-mips64/syscalls/sched_setaffinity.S b/libc/arch-mips64/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..a5056b4
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_setaffinity.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_setaffinity
+    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(sched_setaffinity)
diff --git a/libc/arch-mips64/syscalls/sched_setparam.S b/libc/arch-mips64/syscalls/sched_setparam.S
new file mode 100644
index 0000000..def1e4e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_setparam.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_setparam
+    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(sched_setparam)
diff --git a/libc/arch-mips64/syscalls/sched_setscheduler.S b/libc/arch-mips64/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..0178541
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_setscheduler.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_setscheduler
+    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(sched_setscheduler)
diff --git a/libc/arch-mips64/syscalls/sched_yield.S b/libc/arch-mips64/syscalls/sched_yield.S
new file mode 100644
index 0000000..f69ac3c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sched_yield.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    .set push
+    .set noreorder
+    li $v0, __NR_sched_yield
+    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(sched_yield)
diff --git a/libc/arch-mips64/syscalls/sendfile.S b/libc/arch-mips64/syscalls/sendfile.S
new file mode 100644
index 0000000..b4d3994
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sendfile.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    .set push
+    .set noreorder
+    li $v0, __NR_sendfile
+    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(sendfile)
+
+ALIAS_SYMBOL(sendfile64, sendfile)
diff --git a/libc/arch-mips64/syscalls/sendmmsg.S b/libc/arch-mips64/syscalls/sendmmsg.S
new file mode 100644
index 0000000..2ecd7ef
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sendmmsg.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    .set push
+    .set noreorder
+    li $v0, __NR_sendmmsg
+    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(sendmmsg)
diff --git a/libc/arch-mips64/syscalls/sendmsg.S b/libc/arch-mips64/syscalls/sendmsg.S
new file mode 100644
index 0000000..d4f9735
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sendmsg.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    .set push
+    .set noreorder
+    li $v0, __NR_sendmsg
+    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(sendmsg)
diff --git a/libc/arch-mips64/syscalls/sendto.S b/libc/arch-mips64/syscalls/sendto.S
new file mode 100644
index 0000000..e10abd5
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sendto.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    .set push
+    .set noreorder
+    li $v0, __NR_sendto
+    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(sendto)
diff --git a/libc/arch-mips64/syscalls/setdomainname.S b/libc/arch-mips64/syscalls/setdomainname.S
new file mode 100644
index 0000000..5e6b7c0
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setdomainname.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    .set push
+    .set noreorder
+    li $v0, __NR_setdomainname
+    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(setdomainname)
diff --git a/libc/arch-mips64/syscalls/setfsgid.S b/libc/arch-mips64/syscalls/setfsgid.S
new file mode 100644
index 0000000..05d9681
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setfsgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setfsgid
+    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(setfsgid)
diff --git a/libc/arch-mips64/syscalls/setfsuid.S b/libc/arch-mips64/syscalls/setfsuid.S
new file mode 100644
index 0000000..8097b77
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setfsuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setfsuid
+    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(setfsuid)
diff --git a/libc/arch-mips64/syscalls/setgid.S b/libc/arch-mips64/syscalls/setgid.S
new file mode 100644
index 0000000..7ba4874
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setgid
+    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(setgid)
diff --git a/libc/arch-mips64/syscalls/setgroups.S b/libc/arch-mips64/syscalls/setgroups.S
new file mode 100644
index 0000000..f482d0d
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setgroups.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    .set push
+    .set noreorder
+    li $v0, __NR_setgroups
+    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(setgroups)
diff --git a/libc/arch-mips64/syscalls/sethostname.S b/libc/arch-mips64/syscalls/sethostname.S
new file mode 100644
index 0000000..651df0e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sethostname.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    .set push
+    .set noreorder
+    li $v0, __NR_sethostname
+    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(sethostname)
diff --git a/libc/arch-mips64/syscalls/setitimer.S b/libc/arch-mips64/syscalls/setitimer.S
new file mode 100644
index 0000000..35c2bda
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setitimer.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    .set push
+    .set noreorder
+    li $v0, __NR_setitimer
+    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(setitimer)
diff --git a/libc/arch-mips64/syscalls/setns.S b/libc/arch-mips64/syscalls/setns.S
new file mode 100644
index 0000000..d640545
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setns.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    .set push
+    .set noreorder
+    li $v0, __NR_setns
+    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(setns)
diff --git a/libc/arch-mips64/syscalls/setpgid.S b/libc/arch-mips64/syscalls/setpgid.S
new file mode 100644
index 0000000..8c5f71e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setpgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setpgid
+    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(setpgid)
diff --git a/libc/arch-mips64/syscalls/setpriority.S b/libc/arch-mips64/syscalls/setpriority.S
new file mode 100644
index 0000000..5777a0c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setpriority.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    .set push
+    .set noreorder
+    li $v0, __NR_setpriority
+    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(setpriority)
diff --git a/libc/arch-mips64/syscalls/setregid.S b/libc/arch-mips64/syscalls/setregid.S
new file mode 100644
index 0000000..03be155
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setregid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setregid
+    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(setregid)
diff --git a/libc/arch-mips64/syscalls/setresgid.S b/libc/arch-mips64/syscalls/setresgid.S
new file mode 100644
index 0000000..555e925
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setresgid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setresgid
+    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(setresgid)
diff --git a/libc/arch-mips64/syscalls/setresuid.S b/libc/arch-mips64/syscalls/setresuid.S
new file mode 100644
index 0000000..6884f38
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setresuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setresuid
+    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(setresuid)
diff --git a/libc/arch-mips64/syscalls/setreuid.S b/libc/arch-mips64/syscalls/setreuid.S
new file mode 100644
index 0000000..4163765
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setreuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setreuid
+    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(setreuid)
diff --git a/libc/arch-mips64/syscalls/setrlimit.S b/libc/arch-mips64/syscalls/setrlimit.S
new file mode 100644
index 0000000..5cc8a52
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setrlimit.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    .set push
+    .set noreorder
+    li $v0, __NR_setrlimit
+    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(setrlimit)
+
+ALIAS_SYMBOL(setrlimit64, setrlimit)
diff --git a/libc/arch-mips64/syscalls/setsid.S b/libc/arch-mips64/syscalls/setsid.S
new file mode 100644
index 0000000..5422096
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setsid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setsid
+    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(setsid)
diff --git a/libc/arch-mips64/syscalls/setsockopt.S b/libc/arch-mips64/syscalls/setsockopt.S
new file mode 100644
index 0000000..8c3ce62
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setsockopt.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    .set push
+    .set noreorder
+    li $v0, __NR_setsockopt
+    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(setsockopt)
diff --git a/libc/arch-mips64/syscalls/settimeofday.S b/libc/arch-mips64/syscalls/settimeofday.S
new file mode 100644
index 0000000..9723dee
--- /dev/null
+++ b/libc/arch-mips64/syscalls/settimeofday.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    .set push
+    .set noreorder
+    li $v0, __NR_settimeofday
+    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(settimeofday)
diff --git a/libc/arch-mips64/syscalls/setuid.S b/libc/arch-mips64/syscalls/setuid.S
new file mode 100644
index 0000000..4ed7a7c
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setuid.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    .set push
+    .set noreorder
+    li $v0, __NR_setuid
+    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(setuid)
diff --git a/libc/arch-mips64/syscalls/setxattr.S b/libc/arch-mips64/syscalls/setxattr.S
new file mode 100644
index 0000000..d837b5e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/setxattr.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    .set push
+    .set noreorder
+    li $v0, __NR_setxattr
+    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(setxattr)
diff --git a/libc/arch-mips64/syscalls/shutdown.S b/libc/arch-mips64/syscalls/shutdown.S
new file mode 100644
index 0000000..3a616bd
--- /dev/null
+++ b/libc/arch-mips64/syscalls/shutdown.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    .set push
+    .set noreorder
+    li $v0, __NR_shutdown
+    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(shutdown)
diff --git a/libc/arch-mips64/syscalls/sigaltstack.S b/libc/arch-mips64/syscalls/sigaltstack.S
new file mode 100644
index 0000000..13b539b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sigaltstack.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    .set push
+    .set noreorder
+    li $v0, __NR_sigaltstack
+    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(sigaltstack)
diff --git a/libc/arch-mips64/syscalls/socketpair.S b/libc/arch-mips64/syscalls/socketpair.S
new file mode 100644
index 0000000..b95dabd
--- /dev/null
+++ b/libc/arch-mips64/syscalls/socketpair.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    .set push
+    .set noreorder
+    li $v0, __NR_socketpair
+    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(socketpair)
diff --git a/libc/arch-mips64/syscalls/splice.S b/libc/arch-mips64/syscalls/splice.S
new file mode 100644
index 0000000..9eae4d0
--- /dev/null
+++ b/libc/arch-mips64/syscalls/splice.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    .set push
+    .set noreorder
+    li $v0, __NR_splice
+    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(splice)
diff --git a/libc/arch-mips64/syscalls/swapoff.S b/libc/arch-mips64/syscalls/swapoff.S
new file mode 100644
index 0000000..c70d1bc
--- /dev/null
+++ b/libc/arch-mips64/syscalls/swapoff.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    .set push
+    .set noreorder
+    li $v0, __NR_swapoff
+    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(swapoff)
diff --git a/libc/arch-mips64/syscalls/swapon.S b/libc/arch-mips64/syscalls/swapon.S
new file mode 100644
index 0000000..879c68e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/swapon.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    .set push
+    .set noreorder
+    li $v0, __NR_swapon
+    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(swapon)
diff --git a/libc/arch-mips64/syscalls/symlinkat.S b/libc/arch-mips64/syscalls/symlinkat.S
new file mode 100644
index 0000000..2483993
--- /dev/null
+++ b/libc/arch-mips64/syscalls/symlinkat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    .set push
+    .set noreorder
+    li $v0, __NR_symlinkat
+    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(symlinkat)
diff --git a/libc/arch-mips64/syscalls/sync.S b/libc/arch-mips64/syscalls/sync.S
new file mode 100644
index 0000000..61cc1a3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sync.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    .set push
+    .set noreorder
+    li $v0, __NR_sync
+    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(sync)
diff --git a/libc/arch-mips64/syscalls/syncfs.S b/libc/arch-mips64/syscalls/syncfs.S
new file mode 100644
index 0000000..8eb2501
--- /dev/null
+++ b/libc/arch-mips64/syscalls/syncfs.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    .set push
+    .set noreorder
+    li $v0, __NR_syncfs
+    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(syncfs)
diff --git a/libc/arch-mips64/syscalls/sysinfo.S b/libc/arch-mips64/syscalls/sysinfo.S
new file mode 100644
index 0000000..2c7acc7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/sysinfo.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    .set push
+    .set noreorder
+    li $v0, __NR_sysinfo
+    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(sysinfo)
diff --git a/libc/arch-mips64/syscalls/tee.S b/libc/arch-mips64/syscalls/tee.S
new file mode 100644
index 0000000..cd60f0b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/tee.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    .set push
+    .set noreorder
+    li $v0, __NR_tee
+    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(tee)
diff --git a/libc/arch-mips64/syscalls/tgkill.S b/libc/arch-mips64/syscalls/tgkill.S
new file mode 100644
index 0000000..86d7d4b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/tgkill.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    .set push
+    .set noreorder
+    li $v0, __NR_tgkill
+    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(tgkill)
diff --git a/libc/arch-mips64/syscalls/timerfd_create.S b/libc/arch-mips64/syscalls/timerfd_create.S
new file mode 100644
index 0000000..8086217
--- /dev/null
+++ b/libc/arch-mips64/syscalls/timerfd_create.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    .set push
+    .set noreorder
+    li $v0, __NR_timerfd_create
+    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(timerfd_create)
diff --git a/libc/arch-mips64/syscalls/timerfd_gettime.S b/libc/arch-mips64/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..4b17e12
--- /dev/null
+++ b/libc/arch-mips64/syscalls/timerfd_gettime.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    .set push
+    .set noreorder
+    li $v0, __NR_timerfd_gettime
+    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(timerfd_gettime)
diff --git a/libc/arch-mips64/syscalls/timerfd_settime.S b/libc/arch-mips64/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..51c8cd7
--- /dev/null
+++ b/libc/arch-mips64/syscalls/timerfd_settime.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    .set push
+    .set noreorder
+    li $v0, __NR_timerfd_settime
+    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(timerfd_settime)
diff --git a/libc/arch-mips64/syscalls/times.S b/libc/arch-mips64/syscalls/times.S
new file mode 100644
index 0000000..5922b67
--- /dev/null
+++ b/libc/arch-mips64/syscalls/times.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    .set push
+    .set noreorder
+    li $v0, __NR_times
+    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(times)
diff --git a/libc/arch-mips64/syscalls/truncate.S b/libc/arch-mips64/syscalls/truncate.S
new file mode 100644
index 0000000..a23223b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/truncate.S
@@ -0,0 +1,27 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    .set push
+    .set noreorder
+    li $v0, __NR_truncate
+    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(truncate)
+
+ALIAS_SYMBOL(truncate64, truncate)
diff --git a/libc/arch-mips64/syscalls/umask.S b/libc/arch-mips64/syscalls/umask.S
new file mode 100644
index 0000000..ca0ab49
--- /dev/null
+++ b/libc/arch-mips64/syscalls/umask.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    .set push
+    .set noreorder
+    li $v0, __NR_umask
+    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(umask)
diff --git a/libc/arch-mips64/syscalls/umount2.S b/libc/arch-mips64/syscalls/umount2.S
new file mode 100644
index 0000000..45d5c2e
--- /dev/null
+++ b/libc/arch-mips64/syscalls/umount2.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    .set push
+    .set noreorder
+    li $v0, __NR_umount2
+    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(umount2)
diff --git a/libc/arch-mips64/syscalls/uname.S b/libc/arch-mips64/syscalls/uname.S
new file mode 100644
index 0000000..3385cfa
--- /dev/null
+++ b/libc/arch-mips64/syscalls/uname.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    .set push
+    .set noreorder
+    li $v0, __NR_uname
+    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(uname)
diff --git a/libc/arch-mips64/syscalls/unlinkat.S b/libc/arch-mips64/syscalls/unlinkat.S
new file mode 100644
index 0000000..030f643
--- /dev/null
+++ b/libc/arch-mips64/syscalls/unlinkat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    .set push
+    .set noreorder
+    li $v0, __NR_unlinkat
+    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(unlinkat)
diff --git a/libc/arch-mips64/syscalls/unshare.S b/libc/arch-mips64/syscalls/unshare.S
new file mode 100644
index 0000000..e58a7fc
--- /dev/null
+++ b/libc/arch-mips64/syscalls/unshare.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    .set push
+    .set noreorder
+    li $v0, __NR_unshare
+    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(unshare)
diff --git a/libc/arch-mips64/syscalls/utimensat.S b/libc/arch-mips64/syscalls/utimensat.S
new file mode 100644
index 0000000..a524baa
--- /dev/null
+++ b/libc/arch-mips64/syscalls/utimensat.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    .set push
+    .set noreorder
+    li $v0, __NR_utimensat
+    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(utimensat)
diff --git a/libc/arch-mips64/syscalls/vmsplice.S b/libc/arch-mips64/syscalls/vmsplice.S
new file mode 100644
index 0000000..5e97d86
--- /dev/null
+++ b/libc/arch-mips64/syscalls/vmsplice.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    .set push
+    .set noreorder
+    li $v0, __NR_vmsplice
+    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(vmsplice)
diff --git a/libc/arch-mips64/syscalls/wait4.S b/libc/arch-mips64/syscalls/wait4.S
new file mode 100644
index 0000000..33b0e61
--- /dev/null
+++ b/libc/arch-mips64/syscalls/wait4.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    .set push
+    .set noreorder
+    li $v0, __NR_wait4
+    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(wait4)
diff --git a/libc/arch-mips64/syscalls/write.S b/libc/arch-mips64/syscalls/write.S
new file mode 100644
index 0000000..0499094
--- /dev/null
+++ b/libc/arch-mips64/syscalls/write.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    .set push
+    .set noreorder
+    li $v0, __NR_write
+    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(write)
diff --git a/libc/arch-mips64/syscalls/writev.S b/libc/arch-mips64/syscalls/writev.S
new file mode 100644
index 0000000..5054af3
--- /dev/null
+++ b/libc/arch-mips64/syscalls/writev.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    .set push
+    .set noreorder
+    li $v0, __NR_writev
+    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(writev)
diff --git a/libc/arch-x86/bionic/vfork.S b/libc/arch-x86/bionic/vfork.S
index 663169c..24ede3d 100644
--- a/libc/arch-x86/bionic/vfork.S
+++ b/libc/arch-x86/bionic/vfork.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <platform/bionic/tls_defines.h>
 #include <private/bionic_asm.h>
+#include <private/bionic_asm_tls.h>
 
 // This custom code preserves the return address across the system call.
 
diff --git a/libc/arch-x86/dynamic_function_dispatch.cpp b/libc/arch-x86/dynamic_function_dispatch.cpp
index e94fa1f..70f4b3e 100644
--- a/libc/arch-x86/dynamic_function_dispatch.cpp
+++ b/libc/arch-x86/dynamic_function_dispatch.cpp
@@ -28,10 +28,22 @@
 
 #include <stddef.h>
 
-#include <private/bionic_ifuncs.h>
-
 extern "C" {
 
+#define DEFINE_IFUNC_FOR(name) \
+    name##_func name __attribute__((ifunc(#name "_resolver"))); \
+    __attribute__((visibility("hidden"))) \
+    name##_func* name##_resolver()
+
+#define DECLARE_FUNC(type, name) \
+    __attribute__((visibility("hidden"))) \
+    type name
+
+#define RETURN_FUNC(type, name) { \
+        DECLARE_FUNC(type, name); \
+        return name; \
+    }
+
 typedef int memcmp_func(const void* __lhs, const void* __rhs, size_t __n);
 DEFINE_IFUNC_FOR(memcmp) {
     __builtin_cpu_init();
@@ -95,13 +107,6 @@
     RETURN_FUNC(wmemcmp_func, wmemcmp_freebsd);
 }
 
-typedef int wmemset_func(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
-DEFINE_IFUNC_FOR(wmemset) {
-    __builtin_cpu_init();
-    if (__builtin_cpu_supports("avx2")) RETURN_FUNC(wmemset_func, wmemset_avx2);
-    RETURN_FUNC(wmemset_func, wmemset_freebsd);
-}
-
 typedef int strcmp_func(const char* __lhs, const char* __rhs);
 DEFINE_IFUNC_FOR(strcmp) {
     __builtin_cpu_init();
diff --git a/libc/arch-x86/generic/string/wmemset.c b/libc/arch-x86/generic/string/wmemset.c
deleted file mode 100644
index eff533c..0000000
--- a/libc/arch-x86/generic/string/wmemset.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-#define wmemset wmemset_freebsd
-
-#include <upstream-freebsd/lib/libc/string/wmemset.c>
diff --git a/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S b/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S
deleted file mode 100644
index 69b66c7..0000000
--- a/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-Copyright (C) 2019 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>
-
-#ifndef WMEMSET
- #define WMEMSET wmemset_avx2
-#endif
-
-ENTRY(WMEMSET)
-# BB#0:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%edi
-	pushl	%esi
-	pushl	%eax
-	movl	32(%esp), %ecx
-	movl	24(%esp), %eax
-	testl	%ecx, %ecx
-	je	.LBB0_12
-# BB#1:
-	movl	28(%esp), %edx
-	xorl	%edi, %edi
-	movl	%eax, %esi
-	cmpl	$32, %ecx
-	jb	.LBB0_10
-# BB#2:
-	movl	%ecx, %eax
-	andl	$-32, %eax
-	vmovd	%edx, %xmm0
-	vpbroadcastd	%xmm0, %ymm0
-	movl	%eax, (%esp)            # 4-byte Spill
-	leal	-32(%eax), %esi
-	movl	%esi, %eax
-	shrl	$5, %eax
-	leal	1(%eax), %edi
-	andl	$7, %edi
-	xorl	%ebx, %ebx
-	cmpl	$224, %esi
-	jb	.LBB0_5
-# BB#3:
-	movl	24(%esp), %esi
-	leal	992(%esi), %ebp
-	leal	-1(%edi), %esi
-	subl	%eax, %esi
-	xorl	%ebx, %ebx
-	.p2align	4, 0x90
-.LBB0_4:                                # =>This Inner Loop Header: Depth=1
-	vmovdqu	%ymm0, -992(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -960(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -928(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -896(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -864(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -832(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -800(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -768(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -736(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -704(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -672(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -640(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -608(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -576(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -544(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -512(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -480(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -448(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -416(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -384(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -352(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -320(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -288(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -256(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -224(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -192(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -160(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -128(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -96(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -64(%ebp,%ebx,4)
-	vmovdqu	%ymm0, -32(%ebp,%ebx,4)
-	vmovdqu	%ymm0, (%ebp,%ebx,4)
-	addl	$256, %ebx              # imm = 0x100
-	addl	$8, %esi
-	jne	.LBB0_4
-.LBB0_5:
-	testl	%edi, %edi
-	movl	24(%esp), %eax
-	je	.LBB0_8
-# BB#6:
-	leal	(%eax,%ebx,4), %esi
-	addl	$96, %esi
-	negl	%edi
-	.p2align	4, 0x90
-.LBB0_7:                                # =>This Inner Loop Header: Depth=1
-	vmovdqu	%ymm0, -96(%esi)
-	vmovdqu	%ymm0, -64(%esi)
-	vmovdqu	%ymm0, -32(%esi)
-	vmovdqu	%ymm0, (%esi)
-	subl	$-128, %esi
-	addl	$1, %edi
-	jne	.LBB0_7
-.LBB0_8:
-	movl	(%esp), %edi            # 4-byte Reload
-	cmpl	%ecx, %edi
-	je	.LBB0_12
-# BB#9:
-	leal	(%eax,%edi,4), %esi
-.LBB0_10:
-	subl	%edi, %ecx
-	.p2align	4, 0x90
-.LBB0_11:                               # =>This Inner Loop Header: Depth=1
-	movl	%edx, (%esi)
-	addl	$4, %esi
-	addl	$-1, %ecx
-	jne	.LBB0_11
-.LBB0_12:
-	addl	$4, %esp
-	popl	%esi
-	popl	%edi
-	popl	%ebx
-	popl	%ebp
-	vzeroupper
-	retl
-END(WMEMSET)
diff --git a/libc/arch-x86/static_function_dispatch.S b/libc/arch-x86/static_function_dispatch.S
index 1560c04..7e8e63d 100644
--- a/libc/arch-x86/static_function_dispatch.S
+++ b/libc/arch-x86/static_function_dispatch.S
@@ -45,7 +45,6 @@
 FUNCTION_DELEGATE(strncmp, strncmp_generic)
 FUNCTION_DELEGATE(strcat, strcat_generic)
 FUNCTION_DELEGATE(wmemcmp, wmemcmp_freebsd)
-FUNCTION_DELEGATE(wmemset, wmemset_freebsd)
 FUNCTION_DELEGATE(wcscat, wcscat_freebsd)
 FUNCTION_DELEGATE(strncat, strncat_openbsd)
 FUNCTION_DELEGATE(strlcat, strlcat_openbsd)
diff --git a/libc/arch-x86/syscalls/___clock_nanosleep.S b/libc/arch-x86/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..6998749
--- /dev/null
+++ b/libc/arch-x86/syscalls/___clock_nanosleep.S
@@ -0,0 +1,45 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_clock_nanosleep, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-x86/syscalls/___close.S b/libc/arch-x86/syscalls/___close.S
new file mode 100644
index 0000000..b9ebdaa
--- /dev/null
+++ b/libc/arch-x86/syscalls/___close.S
@@ -0,0 +1,30 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_close, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(___close)
+.hidden ___close
diff --git a/libc/arch-x86/syscalls/___faccessat.S b/libc/arch-x86/syscalls/___faccessat.S
new file mode 100644
index 0000000..b92b03d
--- /dev/null
+++ b/libc/arch-x86/syscalls/___faccessat.S
@@ -0,0 +1,40 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_faccessat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-x86/syscalls/___fchmod.S b/libc/arch-x86/syscalls/___fchmod.S
new file mode 100644
index 0000000..92e864c
--- /dev/null
+++ b/libc/arch-x86/syscalls/___fchmod.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_fchmod, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-x86/syscalls/___fchmodat.S b/libc/arch-x86/syscalls/___fchmodat.S
new file mode 100644
index 0000000..81edf96
--- /dev/null
+++ b/libc/arch-x86/syscalls/___fchmodat.S
@@ -0,0 +1,40 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_fchmodat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-x86/syscalls/___fgetxattr.S b/libc/arch-x86/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..712728d
--- /dev/null
+++ b/libc/arch-x86/syscalls/___fgetxattr.S
@@ -0,0 +1,45 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_fgetxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-x86/syscalls/___flistxattr.S b/libc/arch-x86/syscalls/___flistxattr.S
new file mode 100644
index 0000000..a22ef35
--- /dev/null
+++ b/libc/arch-x86/syscalls/___flistxattr.S
@@ -0,0 +1,40 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_flistxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-x86/syscalls/___fsetxattr.S b/libc/arch-x86/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..b90c972
--- /dev/null
+++ b/libc/arch-x86/syscalls/___fsetxattr.S
@@ -0,0 +1,50 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_fsetxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-x86/syscalls/___mremap.S b/libc/arch-x86/syscalls/___mremap.S
new file mode 100644
index 0000000..9d9bfcb
--- /dev/null
+++ b/libc/arch-x86/syscalls/___mremap.S
@@ -0,0 +1,50 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_mremap, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-x86/syscalls/___rt_sigqueueinfo.S b/libc/arch-x86/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..e299707
--- /dev/null
+++ b/libc/arch-x86/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,40 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_rt_sigqueueinfo, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-x86/syscalls/__accept4.S b/libc/arch-x86/syscalls/__accept4.S
new file mode 100644
index 0000000..112a8a7
--- /dev/null
+++ b/libc/arch-x86/syscalls/__accept4.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $18, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__accept4)
diff --git a/libc/arch-x86/syscalls/__brk.S b/libc/arch-x86/syscalls/__brk.S
new file mode 100644
index 0000000..bf2f1d2
--- /dev/null
+++ b/libc/arch-x86/syscalls/__brk.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_brk, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__brk)
diff --git a/libc/arch-x86/syscalls/__clock_getres.S b/libc/arch-x86/syscalls/__clock_getres.S
new file mode 100644
index 0000000..77b0aa9
--- /dev/null
+++ b/libc/arch-x86/syscalls/__clock_getres.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_clock_getres, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__clock_getres)
diff --git a/libc/arch-x86/syscalls/__clock_gettime.S b/libc/arch-x86/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..0c0c1c4
--- /dev/null
+++ b/libc/arch-x86/syscalls/__clock_gettime.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_clock_gettime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__clock_gettime)
diff --git a/libc/arch-x86/syscalls/__connect.S b/libc/arch-x86/syscalls/__connect.S
new file mode 100644
index 0000000..5ea160c
--- /dev/null
+++ b/libc/arch-x86/syscalls/__connect.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $3, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__connect)
diff --git a/libc/arch-x86/syscalls/__epoll_pwait.S b/libc/arch-x86/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..3750760
--- /dev/null
+++ b/libc/arch-x86/syscalls/__epoll_pwait.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_epoll_pwait, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__epoll_pwait)
diff --git a/libc/arch-x86/syscalls/__exit.S b/libc/arch-x86/syscalls/__exit.S
new file mode 100644
index 0000000..841c8cf
--- /dev/null
+++ b/libc/arch-x86/syscalls/__exit.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_exit, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__exit)
diff --git a/libc/arch-x86/syscalls/__fadvise64.S b/libc/arch-x86/syscalls/__fadvise64.S
new file mode 100644
index 0000000..d580a61
--- /dev/null
+++ b/libc/arch-x86/syscalls/__fadvise64.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fadvise64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_fadvise64_64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__fadvise64)
diff --git a/libc/arch-x86/syscalls/__fcntl64.S b/libc/arch-x86/syscalls/__fcntl64.S
new file mode 100644
index 0000000..c886411
--- /dev/null
+++ b/libc/arch-x86/syscalls/__fcntl64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fcntl64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_fcntl64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__fcntl64)
diff --git a/libc/arch-x86/syscalls/__fstatfs64.S b/libc/arch-x86/syscalls/__fstatfs64.S
new file mode 100644
index 0000000..2c97435
--- /dev/null
+++ b/libc/arch-x86/syscalls/__fstatfs64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_fstatfs64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__fstatfs64)
diff --git a/libc/arch-x86/syscalls/__getcpu.S b/libc/arch-x86/syscalls/__getcpu.S
new file mode 100644
index 0000000..fde7306
--- /dev/null
+++ b/libc/arch-x86/syscalls/__getcpu.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_getcpu, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__getcpu)
diff --git a/libc/arch-x86/syscalls/__getcwd.S b/libc/arch-x86/syscalls/__getcwd.S
new file mode 100644
index 0000000..dc0bded
--- /dev/null
+++ b/libc/arch-x86/syscalls/__getcwd.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_getcwd, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__getcwd)
diff --git a/libc/arch-x86/syscalls/__getdents64.S b/libc/arch-x86/syscalls/__getdents64.S
new file mode 100644
index 0000000..4228da2
--- /dev/null
+++ b/libc/arch-x86/syscalls/__getdents64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_getdents64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__getdents64)
diff --git a/libc/arch-x86/syscalls/__getpid.S b/libc/arch-x86/syscalls/__getpid.S
new file mode 100644
index 0000000..aa5d343
--- /dev/null
+++ b/libc/arch-x86/syscalls/__getpid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_getpid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(__getpid)
diff --git a/libc/arch-x86/syscalls/__getpriority.S b/libc/arch-x86/syscalls/__getpriority.S
new file mode 100644
index 0000000..cf2fbc3
--- /dev/null
+++ b/libc/arch-x86/syscalls/__getpriority.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_getpriority, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__getpriority)
diff --git a/libc/arch-x86/syscalls/__gettimeofday.S b/libc/arch-x86/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..4e24cdd6
--- /dev/null
+++ b/libc/arch-x86/syscalls/__gettimeofday.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_gettimeofday, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__gettimeofday)
diff --git a/libc/arch-x86/syscalls/__ioctl.S b/libc/arch-x86/syscalls/__ioctl.S
new file mode 100644
index 0000000..2189638
--- /dev/null
+++ b/libc/arch-x86/syscalls/__ioctl.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_ioctl, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__ioctl)
diff --git a/libc/arch-x86/syscalls/__llseek.S b/libc/arch-x86/syscalls/__llseek.S
new file mode 100644
index 0000000..9213891
--- /dev/null
+++ b/libc/arch-x86/syscalls/__llseek.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__llseek)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR__llseek, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__llseek)
diff --git a/libc/arch-x86/syscalls/__mmap2.S b/libc/arch-x86/syscalls/__mmap2.S
new file mode 100644
index 0000000..0904a3d
--- /dev/null
+++ b/libc/arch-x86/syscalls/__mmap2.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__mmap2)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_mmap2, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__mmap2)
diff --git a/libc/arch-x86/syscalls/__openat.S b/libc/arch-x86/syscalls/__openat.S
new file mode 100644
index 0000000..03c03bd
--- /dev/null
+++ b/libc/arch-x86/syscalls/__openat.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_openat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__openat)
diff --git a/libc/arch-x86/syscalls/__ppoll.S b/libc/arch-x86/syscalls/__ppoll.S
new file mode 100644
index 0000000..1a55b03
--- /dev/null
+++ b/libc/arch-x86/syscalls/__ppoll.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_ppoll, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__ppoll)
diff --git a/libc/arch-x86/syscalls/__preadv64.S b/libc/arch-x86/syscalls/__preadv64.S
new file mode 100644
index 0000000..5db22a3
--- /dev/null
+++ b/libc/arch-x86/syscalls/__preadv64.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__preadv64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_preadv, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__preadv64)
diff --git a/libc/arch-x86/syscalls/__pselect6.S b/libc/arch-x86/syscalls/__pselect6.S
new file mode 100644
index 0000000..18327fd
--- /dev/null
+++ b/libc/arch-x86/syscalls/__pselect6.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_pselect6, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__pselect6)
diff --git a/libc/arch-x86/syscalls/__ptrace.S b/libc/arch-x86/syscalls/__ptrace.S
new file mode 100644
index 0000000..a522e95
--- /dev/null
+++ b/libc/arch-x86/syscalls/__ptrace.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_ptrace, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__ptrace)
diff --git a/libc/arch-x86/syscalls/__pwritev64.S b/libc/arch-x86/syscalls/__pwritev64.S
new file mode 100644
index 0000000..19f1865
--- /dev/null
+++ b/libc/arch-x86/syscalls/__pwritev64.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pwritev64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_pwritev, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__pwritev64)
diff --git a/libc/arch-x86/syscalls/__reboot.S b/libc/arch-x86/syscalls/__reboot.S
new file mode 100644
index 0000000..711a4e6
--- /dev/null
+++ b/libc/arch-x86/syscalls/__reboot.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_reboot, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__reboot)
diff --git a/libc/arch-x86/syscalls/__rt_sigaction.S b/libc/arch-x86/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..ebc431d
--- /dev/null
+++ b/libc/arch-x86/syscalls/__rt_sigaction.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_rt_sigaction, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__rt_sigaction)
diff --git a/libc/arch-x86/syscalls/__rt_sigpending.S b/libc/arch-x86/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..ecf2945
--- /dev/null
+++ b/libc/arch-x86/syscalls/__rt_sigpending.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_rt_sigpending, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__rt_sigpending)
diff --git a/libc/arch-x86/syscalls/__rt_sigprocmask.S b/libc/arch-x86/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..cdd0f10
--- /dev/null
+++ b/libc/arch-x86/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_rt_sigprocmask, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__rt_sigprocmask)
diff --git a/libc/arch-x86/syscalls/__rt_sigsuspend.S b/libc/arch-x86/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..ef96949
--- /dev/null
+++ b/libc/arch-x86/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_rt_sigsuspend, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__rt_sigsuspend)
diff --git a/libc/arch-x86/syscalls/__rt_sigtimedwait.S b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..8205221
--- /dev/null
+++ b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_rt_sigtimedwait, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__rt_sigtimedwait)
diff --git a/libc/arch-x86/syscalls/__sched_getaffinity.S b/libc/arch-x86/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..ba658af
--- /dev/null
+++ b/libc/arch-x86/syscalls/__sched_getaffinity.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_sched_getaffinity, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__sched_getaffinity)
diff --git a/libc/arch-x86/syscalls/__set_thread_area.S b/libc/arch-x86/syscalls/__set_thread_area.S
new file mode 100644
index 0000000..7fc04bd
--- /dev/null
+++ b/libc/arch-x86/syscalls/__set_thread_area.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_thread_area)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_set_thread_area, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__set_thread_area)
diff --git a/libc/arch-x86/syscalls/__set_tid_address.S b/libc/arch-x86/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..4301156
--- /dev/null
+++ b/libc/arch-x86/syscalls/__set_tid_address.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_set_tid_address, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__set_tid_address)
diff --git a/libc/arch-x86/syscalls/__sigaction.S b/libc/arch-x86/syscalls/__sigaction.S
new file mode 100644
index 0000000..6b2b7f3
--- /dev/null
+++ b/libc/arch-x86/syscalls/__sigaction.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sigaction)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_sigaction, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__sigaction)
diff --git a/libc/arch-x86/syscalls/__signalfd4.S b/libc/arch-x86/syscalls/__signalfd4.S
new file mode 100644
index 0000000..ea817cf
--- /dev/null
+++ b/libc/arch-x86/syscalls/__signalfd4.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_signalfd4, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__signalfd4)
diff --git a/libc/arch-x86/syscalls/__socket.S b/libc/arch-x86/syscalls/__socket.S
new file mode 100644
index 0000000..06d1f1f
--- /dev/null
+++ b/libc/arch-x86/syscalls/__socket.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $1, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__socket)
diff --git a/libc/arch-x86/syscalls/__statfs64.S b/libc/arch-x86/syscalls/__statfs64.S
new file mode 100644
index 0000000..79e1f4b
--- /dev/null
+++ b/libc/arch-x86/syscalls/__statfs64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_statfs64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__statfs64)
diff --git a/libc/arch-x86/syscalls/__sync_file_range.S b/libc/arch-x86/syscalls/__sync_file_range.S
new file mode 100644
index 0000000..f5bf3ec
--- /dev/null
+++ b/libc/arch-x86/syscalls/__sync_file_range.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_sync_file_range, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__sync_file_range)
diff --git a/libc/arch-x86/syscalls/__timer_create.S b/libc/arch-x86/syscalls/__timer_create.S
new file mode 100644
index 0000000..4e16b1c
--- /dev/null
+++ b/libc/arch-x86/syscalls/__timer_create.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_timer_create, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__timer_create)
diff --git a/libc/arch-x86/syscalls/__timer_delete.S b/libc/arch-x86/syscalls/__timer_delete.S
new file mode 100644
index 0000000..fea422e
--- /dev/null
+++ b/libc/arch-x86/syscalls/__timer_delete.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_timer_delete, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__timer_delete)
diff --git a/libc/arch-x86/syscalls/__timer_getoverrun.S b/libc/arch-x86/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..e921073
--- /dev/null
+++ b/libc/arch-x86/syscalls/__timer_getoverrun.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_timer_getoverrun, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(__timer_getoverrun)
diff --git a/libc/arch-x86/syscalls/__timer_gettime.S b/libc/arch-x86/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..4e20356
--- /dev/null
+++ b/libc/arch-x86/syscalls/__timer_gettime.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_timer_gettime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__timer_gettime)
diff --git a/libc/arch-x86/syscalls/__timer_settime.S b/libc/arch-x86/syscalls/__timer_settime.S
new file mode 100644
index 0000000..9b8af34
--- /dev/null
+++ b/libc/arch-x86/syscalls/__timer_settime.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_timer_settime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__timer_settime)
diff --git a/libc/arch-x86/syscalls/__waitid.S b/libc/arch-x86/syscalls/__waitid.S
new file mode 100644
index 0000000..f134b42
--- /dev/null
+++ b/libc/arch-x86/syscalls/__waitid.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_waitid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(__waitid)
diff --git a/libc/arch-x86/syscalls/_exit.S b/libc/arch-x86/syscalls/_exit.S
new file mode 100644
index 0000000..1e89261
--- /dev/null
+++ b/libc/arch-x86/syscalls/_exit.S
@@ -0,0 +1,31 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_exit_group, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-x86/syscalls/acct.S b/libc/arch-x86/syscalls/acct.S
new file mode 100644
index 0000000..48c4c5c
--- /dev/null
+++ b/libc/arch-x86/syscalls/acct.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_acct, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(acct)
diff --git a/libc/arch-x86/syscalls/adjtimex.S b/libc/arch-x86/syscalls/adjtimex.S
new file mode 100644
index 0000000..1b0d8b1
--- /dev/null
+++ b/libc/arch-x86/syscalls/adjtimex.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_adjtimex, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(adjtimex)
diff --git a/libc/arch-x86/syscalls/bind.S b/libc/arch-x86/syscalls/bind.S
new file mode 100644
index 0000000..c1f84da
--- /dev/null
+++ b/libc/arch-x86/syscalls/bind.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $2, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(bind)
diff --git a/libc/arch-x86/syscalls/capget.S b/libc/arch-x86/syscalls/capget.S
new file mode 100644
index 0000000..fafde37
--- /dev/null
+++ b/libc/arch-x86/syscalls/capget.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_capget, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(capget)
diff --git a/libc/arch-x86/syscalls/capset.S b/libc/arch-x86/syscalls/capset.S
new file mode 100644
index 0000000..28e5338
--- /dev/null
+++ b/libc/arch-x86/syscalls/capset.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_capset, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(capset)
diff --git a/libc/arch-x86/syscalls/chdir.S b/libc/arch-x86/syscalls/chdir.S
new file mode 100644
index 0000000..4b639eb
--- /dev/null
+++ b/libc/arch-x86/syscalls/chdir.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_chdir, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(chdir)
diff --git a/libc/arch-x86/syscalls/chroot.S b/libc/arch-x86/syscalls/chroot.S
new file mode 100644
index 0000000..8887f86
--- /dev/null
+++ b/libc/arch-x86/syscalls/chroot.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_chroot, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(chroot)
diff --git a/libc/arch-x86/syscalls/clock_adjtime.S b/libc/arch-x86/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..4ccf1a6
--- /dev/null
+++ b/libc/arch-x86/syscalls/clock_adjtime.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_clock_adjtime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(clock_adjtime)
diff --git a/libc/arch-x86/syscalls/clock_settime.S b/libc/arch-x86/syscalls/clock_settime.S
new file mode 100644
index 0000000..62dc021
--- /dev/null
+++ b/libc/arch-x86/syscalls/clock_settime.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_clock_settime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(clock_settime)
diff --git a/libc/arch-x86/syscalls/delete_module.S b/libc/arch-x86/syscalls/delete_module.S
new file mode 100644
index 0000000..b0c8ff9
--- /dev/null
+++ b/libc/arch-x86/syscalls/delete_module.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_delete_module, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(delete_module)
diff --git a/libc/arch-x86/syscalls/dup.S b/libc/arch-x86/syscalls/dup.S
new file mode 100644
index 0000000..637cfae
--- /dev/null
+++ b/libc/arch-x86/syscalls/dup.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_dup, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(dup)
diff --git a/libc/arch-x86/syscalls/dup3.S b/libc/arch-x86/syscalls/dup3.S
new file mode 100644
index 0000000..4d08eab
--- /dev/null
+++ b/libc/arch-x86/syscalls/dup3.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_dup3, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(dup3)
diff --git a/libc/arch-x86/syscalls/epoll_create1.S b/libc/arch-x86/syscalls/epoll_create1.S
new file mode 100644
index 0000000..93d1c00
--- /dev/null
+++ b/libc/arch-x86/syscalls/epoll_create1.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_epoll_create1, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(epoll_create1)
diff --git a/libc/arch-x86/syscalls/epoll_ctl.S b/libc/arch-x86/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..a2d8d27
--- /dev/null
+++ b/libc/arch-x86/syscalls/epoll_ctl.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_epoll_ctl, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(epoll_ctl)
diff --git a/libc/arch-x86/syscalls/eventfd.S b/libc/arch-x86/syscalls/eventfd.S
new file mode 100644
index 0000000..89f9442
--- /dev/null
+++ b/libc/arch-x86/syscalls/eventfd.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_eventfd2, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(eventfd)
diff --git a/libc/arch-x86/syscalls/execve.S b/libc/arch-x86/syscalls/execve.S
new file mode 100644
index 0000000..7695635
--- /dev/null
+++ b/libc/arch-x86/syscalls/execve.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_execve, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(execve)
diff --git a/libc/arch-x86/syscalls/fallocate64.S b/libc/arch-x86/syscalls/fallocate64.S
new file mode 100644
index 0000000..eabc642
--- /dev/null
+++ b/libc/arch-x86/syscalls/fallocate64.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_fallocate, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fallocate64)
diff --git a/libc/arch-x86/syscalls/fchdir.S b/libc/arch-x86/syscalls/fchdir.S
new file mode 100644
index 0000000..5701644
--- /dev/null
+++ b/libc/arch-x86/syscalls/fchdir.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_fchdir, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(fchdir)
diff --git a/libc/arch-x86/syscalls/fchown.S b/libc/arch-x86/syscalls/fchown.S
new file mode 100644
index 0000000..0d41389
--- /dev/null
+++ b/libc/arch-x86/syscalls/fchown.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_fchown32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fchown)
diff --git a/libc/arch-x86/syscalls/fchownat.S b/libc/arch-x86/syscalls/fchownat.S
new file mode 100644
index 0000000..56b7777
--- /dev/null
+++ b/libc/arch-x86/syscalls/fchownat.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_fchownat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fchownat)
diff --git a/libc/arch-x86/syscalls/fdatasync.S b/libc/arch-x86/syscalls/fdatasync.S
new file mode 100644
index 0000000..6ee9e15
--- /dev/null
+++ b/libc/arch-x86/syscalls/fdatasync.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_fdatasync, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(fdatasync)
diff --git a/libc/arch-x86/syscalls/flock.S b/libc/arch-x86/syscalls/flock.S
new file mode 100644
index 0000000..b65543d
--- /dev/null
+++ b/libc/arch-x86/syscalls/flock.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_flock, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(flock)
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
new file mode 100644
index 0000000..3511d5d
--- /dev/null
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_fremovexattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fremovexattr)
diff --git a/libc/arch-x86/syscalls/fstat64.S b/libc/arch-x86/syscalls/fstat64.S
new file mode 100644
index 0000000..16eca69
--- /dev/null
+++ b/libc/arch-x86/syscalls/fstat64.S
@@ -0,0 +1,36 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstat64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_fstat64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fstat64)
+
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-x86/syscalls/fstatat64.S b/libc/arch-x86/syscalls/fstatat64.S
new file mode 100644
index 0000000..402cf60
--- /dev/null
+++ b/libc/arch-x86/syscalls/fstatat64.S
@@ -0,0 +1,46 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstatat64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_fstatat64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(fstatat64)
+
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-x86/syscalls/fsync.S b/libc/arch-x86/syscalls/fsync.S
new file mode 100644
index 0000000..53aeee6
--- /dev/null
+++ b/libc/arch-x86/syscalls/fsync.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_fsync, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(fsync)
diff --git a/libc/arch-x86/syscalls/ftruncate64.S b/libc/arch-x86/syscalls/ftruncate64.S
new file mode 100644
index 0000000..2fa792f
--- /dev/null
+++ b/libc/arch-x86/syscalls/ftruncate64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_ftruncate64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(ftruncate64)
diff --git a/libc/arch-x86/syscalls/getegid.S b/libc/arch-x86/syscalls/getegid.S
new file mode 100644
index 0000000..cb1921e
--- /dev/null
+++ b/libc/arch-x86/syscalls/getegid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_getegid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(getegid)
diff --git a/libc/arch-x86/syscalls/geteuid.S b/libc/arch-x86/syscalls/geteuid.S
new file mode 100644
index 0000000..c08d3ae
--- /dev/null
+++ b/libc/arch-x86/syscalls/geteuid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_geteuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(geteuid)
diff --git a/libc/arch-x86/syscalls/getgid.S b/libc/arch-x86/syscalls/getgid.S
new file mode 100644
index 0000000..9189ae9
--- /dev/null
+++ b/libc/arch-x86/syscalls/getgid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_getgid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(getgid)
diff --git a/libc/arch-x86/syscalls/getgroups.S b/libc/arch-x86/syscalls/getgroups.S
new file mode 100644
index 0000000..8737d51
--- /dev/null
+++ b/libc/arch-x86/syscalls/getgroups.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_getgroups32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getgroups)
diff --git a/libc/arch-x86/syscalls/getitimer.S b/libc/arch-x86/syscalls/getitimer.S
new file mode 100644
index 0000000..e088114
--- /dev/null
+++ b/libc/arch-x86/syscalls/getitimer.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_getitimer, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getitimer)
diff --git a/libc/arch-x86/syscalls/getpeername.S b/libc/arch-x86/syscalls/getpeername.S
new file mode 100644
index 0000000..40bb814
--- /dev/null
+++ b/libc/arch-x86/syscalls/getpeername.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $7, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getpeername)
diff --git a/libc/arch-x86/syscalls/getpgid.S b/libc/arch-x86/syscalls/getpgid.S
new file mode 100644
index 0000000..9d362e8
--- /dev/null
+++ b/libc/arch-x86/syscalls/getpgid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_getpgid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(getpgid)
diff --git a/libc/arch-x86/syscalls/getppid.S b/libc/arch-x86/syscalls/getppid.S
new file mode 100644
index 0000000..afb40a1
--- /dev/null
+++ b/libc/arch-x86/syscalls/getppid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_getppid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(getppid)
diff --git a/libc/arch-x86/syscalls/getrandom.S b/libc/arch-x86/syscalls/getrandom.S
new file mode 100644
index 0000000..2e8ebc9
--- /dev/null
+++ b/libc/arch-x86/syscalls/getrandom.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_getrandom, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getrandom)
diff --git a/libc/arch-x86/syscalls/getresgid.S b/libc/arch-x86/syscalls/getresgid.S
new file mode 100644
index 0000000..131c101
--- /dev/null
+++ b/libc/arch-x86/syscalls/getresgid.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_getresgid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getresgid)
diff --git a/libc/arch-x86/syscalls/getresuid.S b/libc/arch-x86/syscalls/getresuid.S
new file mode 100644
index 0000000..94a8767
--- /dev/null
+++ b/libc/arch-x86/syscalls/getresuid.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_getresuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getresuid)
diff --git a/libc/arch-x86/syscalls/getrlimit.S b/libc/arch-x86/syscalls/getrlimit.S
new file mode 100644
index 0000000..c686f7c
--- /dev/null
+++ b/libc/arch-x86/syscalls/getrlimit.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_ugetrlimit, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getrlimit)
diff --git a/libc/arch-x86/syscalls/getrusage.S b/libc/arch-x86/syscalls/getrusage.S
new file mode 100644
index 0000000..51d1df1
--- /dev/null
+++ b/libc/arch-x86/syscalls/getrusage.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_getrusage, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getrusage)
diff --git a/libc/arch-x86/syscalls/getsid.S b/libc/arch-x86/syscalls/getsid.S
new file mode 100644
index 0000000..a4568e6
--- /dev/null
+++ b/libc/arch-x86/syscalls/getsid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_getsid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(getsid)
diff --git a/libc/arch-x86/syscalls/getsockname.S b/libc/arch-x86/syscalls/getsockname.S
new file mode 100644
index 0000000..0fd5836
--- /dev/null
+++ b/libc/arch-x86/syscalls/getsockname.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $6, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getsockname)
diff --git a/libc/arch-x86/syscalls/getsockopt.S b/libc/arch-x86/syscalls/getsockopt.S
new file mode 100644
index 0000000..fa6fccf
--- /dev/null
+++ b/libc/arch-x86/syscalls/getsockopt.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $15, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getsockopt)
diff --git a/libc/arch-x86/syscalls/getuid.S b/libc/arch-x86/syscalls/getuid.S
new file mode 100644
index 0000000..11cc0c6
--- /dev/null
+++ b/libc/arch-x86/syscalls/getuid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_getuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(getuid)
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
new file mode 100644
index 0000000..871362e
--- /dev/null
+++ b/libc/arch-x86/syscalls/getxattr.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_getxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(getxattr)
diff --git a/libc/arch-x86/syscalls/init_module.S b/libc/arch-x86/syscalls/init_module.S
new file mode 100644
index 0000000..0147eee
--- /dev/null
+++ b/libc/arch-x86/syscalls/init_module.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_init_module, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(init_module)
diff --git a/libc/arch-x86/syscalls/inotify_add_watch.S b/libc/arch-x86/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..f196440
--- /dev/null
+++ b/libc/arch-x86/syscalls/inotify_add_watch.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_inotify_add_watch, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(inotify_add_watch)
diff --git a/libc/arch-x86/syscalls/inotify_init1.S b/libc/arch-x86/syscalls/inotify_init1.S
new file mode 100644
index 0000000..7f0dcfb
--- /dev/null
+++ b/libc/arch-x86/syscalls/inotify_init1.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_inotify_init1, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(inotify_init1)
diff --git a/libc/arch-x86/syscalls/inotify_rm_watch.S b/libc/arch-x86/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..595e053
--- /dev/null
+++ b/libc/arch-x86/syscalls/inotify_rm_watch.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_inotify_rm_watch, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(inotify_rm_watch)
diff --git a/libc/arch-x86/syscalls/kill.S b/libc/arch-x86/syscalls/kill.S
new file mode 100644
index 0000000..4ee56e6
--- /dev/null
+++ b/libc/arch-x86/syscalls/kill.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_kill, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(kill)
diff --git a/libc/arch-x86/syscalls/klogctl.S b/libc/arch-x86/syscalls/klogctl.S
new file mode 100644
index 0000000..3d07942
--- /dev/null
+++ b/libc/arch-x86/syscalls/klogctl.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_syslog, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(klogctl)
diff --git a/libc/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
new file mode 100644
index 0000000..659b088
--- /dev/null
+++ b/libc/arch-x86/syscalls/lgetxattr.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_lgetxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(lgetxattr)
diff --git a/libc/arch-x86/syscalls/linkat.S b/libc/arch-x86/syscalls/linkat.S
new file mode 100644
index 0000000..644172d
--- /dev/null
+++ b/libc/arch-x86/syscalls/linkat.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_linkat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(linkat)
diff --git a/libc/arch-x86/syscalls/listen.S b/libc/arch-x86/syscalls/listen.S
new file mode 100644
index 0000000..ce7c3a9
--- /dev/null
+++ b/libc/arch-x86/syscalls/listen.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $4, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(listen)
diff --git a/libc/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
new file mode 100644
index 0000000..2fe799e
--- /dev/null
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_listxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(listxattr)
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
new file mode 100644
index 0000000..666d87e
--- /dev/null
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_llistxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(llistxattr)
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
new file mode 100644
index 0000000..bda772b
--- /dev/null
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_lremovexattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(lremovexattr)
diff --git a/libc/arch-x86/syscalls/lseek.S b/libc/arch-x86/syscalls/lseek.S
new file mode 100644
index 0000000..9142b5c
--- /dev/null
+++ b/libc/arch-x86/syscalls/lseek.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_lseek, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(lseek)
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
new file mode 100644
index 0000000..fa977b3
--- /dev/null
+++ b/libc/arch-x86/syscalls/lsetxattr.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_lsetxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(lsetxattr)
diff --git a/libc/arch-x86/syscalls/madvise.S b/libc/arch-x86/syscalls/madvise.S
new file mode 100644
index 0000000..21f472e
--- /dev/null
+++ b/libc/arch-x86/syscalls/madvise.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_madvise, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(madvise)
diff --git a/libc/arch-x86/syscalls/mincore.S b/libc/arch-x86/syscalls/mincore.S
new file mode 100644
index 0000000..4179c9a
--- /dev/null
+++ b/libc/arch-x86/syscalls/mincore.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_mincore, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mincore)
diff --git a/libc/arch-x86/syscalls/mkdirat.S b/libc/arch-x86/syscalls/mkdirat.S
new file mode 100644
index 0000000..6a9d94c
--- /dev/null
+++ b/libc/arch-x86/syscalls/mkdirat.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_mkdirat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mkdirat)
diff --git a/libc/arch-x86/syscalls/mknodat.S b/libc/arch-x86/syscalls/mknodat.S
new file mode 100644
index 0000000..a1fae7f
--- /dev/null
+++ b/libc/arch-x86/syscalls/mknodat.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_mknodat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mknodat)
diff --git a/libc/arch-x86/syscalls/mlock.S b/libc/arch-x86/syscalls/mlock.S
new file mode 100644
index 0000000..1c57ac0
--- /dev/null
+++ b/libc/arch-x86/syscalls/mlock.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_mlock, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mlock)
diff --git a/libc/arch-x86/syscalls/mlockall.S b/libc/arch-x86/syscalls/mlockall.S
new file mode 100644
index 0000000..9f54de3
--- /dev/null
+++ b/libc/arch-x86/syscalls/mlockall.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_mlockall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(mlockall)
diff --git a/libc/arch-x86/syscalls/mount.S b/libc/arch-x86/syscalls/mount.S
new file mode 100644
index 0000000..4a9f91a
--- /dev/null
+++ b/libc/arch-x86/syscalls/mount.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_mount, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mount)
diff --git a/libc/arch-x86/syscalls/mprotect.S b/libc/arch-x86/syscalls/mprotect.S
new file mode 100644
index 0000000..5eec550
--- /dev/null
+++ b/libc/arch-x86/syscalls/mprotect.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_mprotect, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(mprotect)
diff --git a/libc/arch-x86/syscalls/msync.S b/libc/arch-x86/syscalls/msync.S
new file mode 100644
index 0000000..7754da6
--- /dev/null
+++ b/libc/arch-x86/syscalls/msync.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_msync, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(msync)
diff --git a/libc/arch-x86/syscalls/munlock.S b/libc/arch-x86/syscalls/munlock.S
new file mode 100644
index 0000000..d2ae9f0
--- /dev/null
+++ b/libc/arch-x86/syscalls/munlock.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_munlock, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(munlock)
diff --git a/libc/arch-x86/syscalls/munlockall.S b/libc/arch-x86/syscalls/munlockall.S
new file mode 100644
index 0000000..e709b8c
--- /dev/null
+++ b/libc/arch-x86/syscalls/munlockall.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_munlockall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(munlockall)
diff --git a/libc/arch-x86/syscalls/munmap.S b/libc/arch-x86/syscalls/munmap.S
new file mode 100644
index 0000000..7ddc5aa
--- /dev/null
+++ b/libc/arch-x86/syscalls/munmap.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_munmap, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(munmap)
diff --git a/libc/arch-x86/syscalls/nanosleep.S b/libc/arch-x86/syscalls/nanosleep.S
new file mode 100644
index 0000000..580f5e1
--- /dev/null
+++ b/libc/arch-x86/syscalls/nanosleep.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_nanosleep, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(nanosleep)
diff --git a/libc/arch-x86/syscalls/personality.S b/libc/arch-x86/syscalls/personality.S
new file mode 100644
index 0000000..3e003c4
--- /dev/null
+++ b/libc/arch-x86/syscalls/personality.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_personality, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(personality)
diff --git a/libc/arch-x86/syscalls/pipe2.S b/libc/arch-x86/syscalls/pipe2.S
new file mode 100644
index 0000000..8a93281
--- /dev/null
+++ b/libc/arch-x86/syscalls/pipe2.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_pipe2, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(pipe2)
diff --git a/libc/arch-x86/syscalls/prctl.S b/libc/arch-x86/syscalls/prctl.S
new file mode 100644
index 0000000..22b4a83
--- /dev/null
+++ b/libc/arch-x86/syscalls/prctl.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_prctl, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(prctl)
diff --git a/libc/arch-x86/syscalls/pread64.S b/libc/arch-x86/syscalls/pread64.S
new file mode 100644
index 0000000..9002f17
--- /dev/null
+++ b/libc/arch-x86/syscalls/pread64.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_pread64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(pread64)
diff --git a/libc/arch-x86/syscalls/prlimit64.S b/libc/arch-x86/syscalls/prlimit64.S
new file mode 100644
index 0000000..13f6682
--- /dev/null
+++ b/libc/arch-x86/syscalls/prlimit64.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_prlimit64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(prlimit64)
diff --git a/libc/arch-x86/syscalls/process_vm_readv.S b/libc/arch-x86/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..e2cd044
--- /dev/null
+++ b/libc/arch-x86/syscalls/process_vm_readv.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_process_vm_readv, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(process_vm_readv)
diff --git a/libc/arch-x86/syscalls/process_vm_writev.S b/libc/arch-x86/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..de0d218
--- /dev/null
+++ b/libc/arch-x86/syscalls/process_vm_writev.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_process_vm_writev, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(process_vm_writev)
diff --git a/libc/arch-x86/syscalls/pwrite64.S b/libc/arch-x86/syscalls/pwrite64.S
new file mode 100644
index 0000000..7532729
--- /dev/null
+++ b/libc/arch-x86/syscalls/pwrite64.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_pwrite64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(pwrite64)
diff --git a/libc/arch-x86/syscalls/quotactl.S b/libc/arch-x86/syscalls/quotactl.S
new file mode 100644
index 0000000..326cf87
--- /dev/null
+++ b/libc/arch-x86/syscalls/quotactl.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_quotactl, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(quotactl)
diff --git a/libc/arch-x86/syscalls/read.S b/libc/arch-x86/syscalls/read.S
new file mode 100644
index 0000000..d4b69b5
--- /dev/null
+++ b/libc/arch-x86/syscalls/read.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_read, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(read)
diff --git a/libc/arch-x86/syscalls/readahead.S b/libc/arch-x86/syscalls/readahead.S
new file mode 100644
index 0000000..8ce22bb
--- /dev/null
+++ b/libc/arch-x86/syscalls/readahead.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_readahead, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(readahead)
diff --git a/libc/arch-x86/syscalls/readlinkat.S b/libc/arch-x86/syscalls/readlinkat.S
new file mode 100644
index 0000000..8b74a4e
--- /dev/null
+++ b/libc/arch-x86/syscalls/readlinkat.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_readlinkat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(readlinkat)
diff --git a/libc/arch-x86/syscalls/readv.S b/libc/arch-x86/syscalls/readv.S
new file mode 100644
index 0000000..a1cb08f
--- /dev/null
+++ b/libc/arch-x86/syscalls/readv.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_readv, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(readv)
diff --git a/libc/arch-x86/syscalls/recvfrom.S b/libc/arch-x86/syscalls/recvfrom.S
new file mode 100644
index 0000000..cedd703
--- /dev/null
+++ b/libc/arch-x86/syscalls/recvfrom.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $12, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(recvfrom)
diff --git a/libc/arch-x86/syscalls/recvmmsg.S b/libc/arch-x86/syscalls/recvmmsg.S
new file mode 100644
index 0000000..130332a
--- /dev/null
+++ b/libc/arch-x86/syscalls/recvmmsg.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $19, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(recvmmsg)
diff --git a/libc/arch-x86/syscalls/recvmsg.S b/libc/arch-x86/syscalls/recvmsg.S
new file mode 100644
index 0000000..c8d2a08
--- /dev/null
+++ b/libc/arch-x86/syscalls/recvmsg.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $17, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(recvmsg)
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
new file mode 100644
index 0000000..ab7891e
--- /dev/null
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_removexattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(removexattr)
diff --git a/libc/arch-x86/syscalls/renameat.S b/libc/arch-x86/syscalls/renameat.S
new file mode 100644
index 0000000..40caaaf
--- /dev/null
+++ b/libc/arch-x86/syscalls/renameat.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_renameat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(renameat)
diff --git a/libc/arch-x86/syscalls/sched_get_priority_max.S b/libc/arch-x86/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..637c9dd
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_get_priority_max.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sched_get_priority_max, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sched_get_priority_max)
diff --git a/libc/arch-x86/syscalls/sched_get_priority_min.S b/libc/arch-x86/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..c38a3aa
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_get_priority_min.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sched_get_priority_min, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sched_get_priority_min)
diff --git a/libc/arch-x86/syscalls/sched_getparam.S b/libc/arch-x86/syscalls/sched_getparam.S
new file mode 100644
index 0000000..09901bd
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_getparam.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_sched_getparam, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sched_getparam)
diff --git a/libc/arch-x86/syscalls/sched_getscheduler.S b/libc/arch-x86/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..adc4023
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_getscheduler.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sched_getscheduler, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sched_getscheduler)
diff --git a/libc/arch-x86/syscalls/sched_rr_get_interval.S b/libc/arch-x86/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..818f62e
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_sched_rr_get_interval, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sched_rr_get_interval)
diff --git a/libc/arch-x86/syscalls/sched_setaffinity.S b/libc/arch-x86/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..b06d778
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_setaffinity.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_sched_setaffinity, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sched_setaffinity)
diff --git a/libc/arch-x86/syscalls/sched_setparam.S b/libc/arch-x86/syscalls/sched_setparam.S
new file mode 100644
index 0000000..dba5bc2
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_setparam.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_sched_setparam, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sched_setparam)
diff --git a/libc/arch-x86/syscalls/sched_setscheduler.S b/libc/arch-x86/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..466a425
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_setscheduler.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_sched_setscheduler, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sched_setscheduler)
diff --git a/libc/arch-x86/syscalls/sched_yield.S b/libc/arch-x86/syscalls/sched_yield.S
new file mode 100644
index 0000000..b17b14e
--- /dev/null
+++ b/libc/arch-x86/syscalls/sched_yield.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sched_yield, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sched_yield)
diff --git a/libc/arch-x86/syscalls/sendfile.S b/libc/arch-x86/syscalls/sendfile.S
new file mode 100644
index 0000000..e091706
--- /dev/null
+++ b/libc/arch-x86/syscalls/sendfile.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_sendfile, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sendfile)
diff --git a/libc/arch-x86/syscalls/sendfile64.S b/libc/arch-x86/syscalls/sendfile64.S
new file mode 100644
index 0000000..317c4f4
--- /dev/null
+++ b/libc/arch-x86/syscalls/sendfile64.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_sendfile64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sendfile64)
diff --git a/libc/arch-x86/syscalls/sendmmsg.S b/libc/arch-x86/syscalls/sendmmsg.S
new file mode 100644
index 0000000..c0097f8
--- /dev/null
+++ b/libc/arch-x86/syscalls/sendmmsg.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $20, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sendmmsg)
diff --git a/libc/arch-x86/syscalls/sendmsg.S b/libc/arch-x86/syscalls/sendmsg.S
new file mode 100644
index 0000000..775ebee
--- /dev/null
+++ b/libc/arch-x86/syscalls/sendmsg.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $16, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sendmsg)
diff --git a/libc/arch-x86/syscalls/sendto.S b/libc/arch-x86/syscalls/sendto.S
new file mode 100644
index 0000000..2df5e4f
--- /dev/null
+++ b/libc/arch-x86/syscalls/sendto.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $11, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sendto)
diff --git a/libc/arch-x86/syscalls/setdomainname.S b/libc/arch-x86/syscalls/setdomainname.S
new file mode 100644
index 0000000..8b6afe2
--- /dev/null
+++ b/libc/arch-x86/syscalls/setdomainname.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setdomainname, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setdomainname)
diff --git a/libc/arch-x86/syscalls/setfsgid.S b/libc/arch-x86/syscalls/setfsgid.S
new file mode 100644
index 0000000..af4ef89
--- /dev/null
+++ b/libc/arch-x86/syscalls/setfsgid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_setfsgid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(setfsgid)
diff --git a/libc/arch-x86/syscalls/setfsuid.S b/libc/arch-x86/syscalls/setfsuid.S
new file mode 100644
index 0000000..8001e42
--- /dev/null
+++ b/libc/arch-x86/syscalls/setfsuid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_setfsuid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(setfsuid)
diff --git a/libc/arch-x86/syscalls/setgid.S b/libc/arch-x86/syscalls/setgid.S
new file mode 100644
index 0000000..c0ddec4
--- /dev/null
+++ b/libc/arch-x86/syscalls/setgid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_setgid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(setgid)
diff --git a/libc/arch-x86/syscalls/setgroups.S b/libc/arch-x86/syscalls/setgroups.S
new file mode 100644
index 0000000..7bd3bfc
--- /dev/null
+++ b/libc/arch-x86/syscalls/setgroups.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setgroups32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setgroups)
diff --git a/libc/arch-x86/syscalls/sethostname.S b/libc/arch-x86/syscalls/sethostname.S
new file mode 100644
index 0000000..26ff1e7
--- /dev/null
+++ b/libc/arch-x86/syscalls/sethostname.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_sethostname, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sethostname)
diff --git a/libc/arch-x86/syscalls/setitimer.S b/libc/arch-x86/syscalls/setitimer.S
new file mode 100644
index 0000000..063847b
--- /dev/null
+++ b/libc/arch-x86/syscalls/setitimer.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_setitimer, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setitimer)
diff --git a/libc/arch-x86/syscalls/setns.S b/libc/arch-x86/syscalls/setns.S
new file mode 100644
index 0000000..28d838e
--- /dev/null
+++ b/libc/arch-x86/syscalls/setns.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setns, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setns)
diff --git a/libc/arch-x86/syscalls/setpgid.S b/libc/arch-x86/syscalls/setpgid.S
new file mode 100644
index 0000000..c5d0d27
--- /dev/null
+++ b/libc/arch-x86/syscalls/setpgid.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setpgid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setpgid)
diff --git a/libc/arch-x86/syscalls/setpriority.S b/libc/arch-x86/syscalls/setpriority.S
new file mode 100644
index 0000000..17c81c6
--- /dev/null
+++ b/libc/arch-x86/syscalls/setpriority.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_setpriority, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setpriority)
diff --git a/libc/arch-x86/syscalls/setregid.S b/libc/arch-x86/syscalls/setregid.S
new file mode 100644
index 0000000..dd8101a
--- /dev/null
+++ b/libc/arch-x86/syscalls/setregid.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setregid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setregid)
diff --git a/libc/arch-x86/syscalls/setresgid.S b/libc/arch-x86/syscalls/setresgid.S
new file mode 100644
index 0000000..6f6de5a
--- /dev/null
+++ b/libc/arch-x86/syscalls/setresgid.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_setresgid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setresgid)
diff --git a/libc/arch-x86/syscalls/setresuid.S b/libc/arch-x86/syscalls/setresuid.S
new file mode 100644
index 0000000..ab0059c
--- /dev/null
+++ b/libc/arch-x86/syscalls/setresuid.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_setresuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setresuid)
diff --git a/libc/arch-x86/syscalls/setreuid.S b/libc/arch-x86/syscalls/setreuid.S
new file mode 100644
index 0000000..7fda62e
--- /dev/null
+++ b/libc/arch-x86/syscalls/setreuid.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setreuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setreuid)
diff --git a/libc/arch-x86/syscalls/setrlimit.S b/libc/arch-x86/syscalls/setrlimit.S
new file mode 100644
index 0000000..595633e
--- /dev/null
+++ b/libc/arch-x86/syscalls/setrlimit.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_setrlimit, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setrlimit)
diff --git a/libc/arch-x86/syscalls/setsid.S b/libc/arch-x86/syscalls/setsid.S
new file mode 100644
index 0000000..80ad8a9
--- /dev/null
+++ b/libc/arch-x86/syscalls/setsid.S
@@ -0,0 +1,24 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    movl    $__NR_setsid, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    ret
+END(setsid)
diff --git a/libc/arch-x86/syscalls/setsockopt.S b/libc/arch-x86/syscalls/setsockopt.S
new file mode 100644
index 0000000..bca34e1
--- /dev/null
+++ b/libc/arch-x86/syscalls/setsockopt.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $14, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setsockopt)
diff --git a/libc/arch-x86/syscalls/settimeofday.S b/libc/arch-x86/syscalls/settimeofday.S
new file mode 100644
index 0000000..31437d0
--- /dev/null
+++ b/libc/arch-x86/syscalls/settimeofday.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_settimeofday, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(settimeofday)
diff --git a/libc/arch-x86/syscalls/setuid.S b/libc/arch-x86/syscalls/setuid.S
new file mode 100644
index 0000000..2461182
--- /dev/null
+++ b/libc/arch-x86/syscalls/setuid.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_setuid32, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(setuid)
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
new file mode 100644
index 0000000..787891e
--- /dev/null
+++ b/libc/arch-x86/syscalls/setxattr.S
@@ -0,0 +1,49 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     28(%esp), %ebx
+    mov     32(%esp), %ecx
+    mov     36(%esp), %edx
+    mov     40(%esp), %esi
+    mov     44(%esp), %edi
+    movl    $__NR_setxattr, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(setxattr)
diff --git a/libc/arch-x86/syscalls/shutdown.S b/libc/arch-x86/syscalls/shutdown.S
new file mode 100644
index 0000000..46e5c18
--- /dev/null
+++ b/libc/arch-x86/syscalls/shutdown.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $13, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(shutdown)
diff --git a/libc/arch-x86/syscalls/sigaltstack.S b/libc/arch-x86/syscalls/sigaltstack.S
new file mode 100644
index 0000000..90eae16
--- /dev/null
+++ b/libc/arch-x86/syscalls/sigaltstack.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_sigaltstack, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(sigaltstack)
diff --git a/libc/arch-x86/syscalls/socketpair.S b/libc/arch-x86/syscalls/socketpair.S
new file mode 100644
index 0000000..c9c7595
--- /dev/null
+++ b/libc/arch-x86/syscalls/socketpair.S
@@ -0,0 +1,35 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     $8, %ebx
+    mov     %esp, %ecx
+    addl    $16, %ecx
+    movl    $__NR_socketcall, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(socketpair)
diff --git a/libc/arch-x86/syscalls/splice.S b/libc/arch-x86/syscalls/splice.S
new file mode 100644
index 0000000..2d82a3d
--- /dev/null
+++ b/libc/arch-x86/syscalls/splice.S
@@ -0,0 +1,54 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+    pushl   %edi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edi, 0
+    pushl   %ebp
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ebp, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     32(%esp), %ebx
+    mov     36(%esp), %ecx
+    mov     40(%esp), %edx
+    mov     44(%esp), %esi
+    mov     48(%esp), %edi
+    mov     52(%esp), %ebp
+    movl    $__NR_splice, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebp
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(splice)
diff --git a/libc/arch-x86/syscalls/swapoff.S b/libc/arch-x86/syscalls/swapoff.S
new file mode 100644
index 0000000..d10a748
--- /dev/null
+++ b/libc/arch-x86/syscalls/swapoff.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_swapoff, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(swapoff)
diff --git a/libc/arch-x86/syscalls/swapon.S b/libc/arch-x86/syscalls/swapon.S
new file mode 100644
index 0000000..dc7db64
--- /dev/null
+++ b/libc/arch-x86/syscalls/swapon.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_swapon, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(swapon)
diff --git a/libc/arch-x86/syscalls/symlinkat.S b/libc/arch-x86/syscalls/symlinkat.S
new file mode 100644
index 0000000..51b1330
--- /dev/null
+++ b/libc/arch-x86/syscalls/symlinkat.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_symlinkat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(symlinkat)
diff --git a/libc/arch-x86/syscalls/sync.S b/libc/arch-x86/syscalls/sync.S
new file mode 100644
index 0000000..c75e9f9
--- /dev/null
+++ b/libc/arch-x86/syscalls/sync.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sync, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sync)
diff --git a/libc/arch-x86/syscalls/syncfs.S b/libc/arch-x86/syscalls/syncfs.S
new file mode 100644
index 0000000..c08688a
--- /dev/null
+++ b/libc/arch-x86/syscalls/syncfs.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_syncfs, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(syncfs)
diff --git a/libc/arch-x86/syscalls/sysinfo.S b/libc/arch-x86/syscalls/sysinfo.S
new file mode 100644
index 0000000..a40d664
--- /dev/null
+++ b/libc/arch-x86/syscalls/sysinfo.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_sysinfo, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(sysinfo)
diff --git a/libc/arch-x86/syscalls/tee.S b/libc/arch-x86/syscalls/tee.S
new file mode 100644
index 0000000..693ad1e
--- /dev/null
+++ b/libc/arch-x86/syscalls/tee.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_tee, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(tee)
diff --git a/libc/arch-x86/syscalls/tgkill.S b/libc/arch-x86/syscalls/tgkill.S
new file mode 100644
index 0000000..5cce4d8
--- /dev/null
+++ b/libc/arch-x86/syscalls/tgkill.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_tgkill, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(tgkill)
diff --git a/libc/arch-x86/syscalls/timerfd_create.S b/libc/arch-x86/syscalls/timerfd_create.S
new file mode 100644
index 0000000..335b7a6
--- /dev/null
+++ b/libc/arch-x86/syscalls/timerfd_create.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_timerfd_create, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(timerfd_create)
diff --git a/libc/arch-x86/syscalls/timerfd_gettime.S b/libc/arch-x86/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..9dc1a2f
--- /dev/null
+++ b/libc/arch-x86/syscalls/timerfd_gettime.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_timerfd_gettime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(timerfd_gettime)
diff --git a/libc/arch-x86/syscalls/timerfd_settime.S b/libc/arch-x86/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..477b5bb
--- /dev/null
+++ b/libc/arch-x86/syscalls/timerfd_settime.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_timerfd_settime, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(timerfd_settime)
diff --git a/libc/arch-x86/syscalls/times.S b/libc/arch-x86/syscalls/times.S
new file mode 100644
index 0000000..14fe221
--- /dev/null
+++ b/libc/arch-x86/syscalls/times.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_times, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(times)
diff --git a/libc/arch-x86/syscalls/truncate.S b/libc/arch-x86/syscalls/truncate.S
new file mode 100644
index 0000000..dd99942
--- /dev/null
+++ b/libc/arch-x86/syscalls/truncate.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_truncate, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(truncate)
diff --git a/libc/arch-x86/syscalls/truncate64.S b/libc/arch-x86/syscalls/truncate64.S
new file mode 100644
index 0000000..35e4037
--- /dev/null
+++ b/libc/arch-x86/syscalls/truncate64.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate64)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_truncate64, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(truncate64)
diff --git a/libc/arch-x86/syscalls/umask.S b/libc/arch-x86/syscalls/umask.S
new file mode 100644
index 0000000..3333fac
--- /dev/null
+++ b/libc/arch-x86/syscalls/umask.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_umask, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(umask)
diff --git a/libc/arch-x86/syscalls/umount2.S b/libc/arch-x86/syscalls/umount2.S
new file mode 100644
index 0000000..48e1eb5
--- /dev/null
+++ b/libc/arch-x86/syscalls/umount2.S
@@ -0,0 +1,34 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    movl    $__NR_umount2, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
+END(umount2)
diff --git a/libc/arch-x86/syscalls/uname.S b/libc/arch-x86/syscalls/uname.S
new file mode 100644
index 0000000..9eea2c1
--- /dev/null
+++ b/libc/arch-x86/syscalls/uname.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_uname, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(uname)
diff --git a/libc/arch-x86/syscalls/unlinkat.S b/libc/arch-x86/syscalls/unlinkat.S
new file mode 100644
index 0000000..e039a34
--- /dev/null
+++ b/libc/arch-x86/syscalls/unlinkat.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_unlinkat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(unlinkat)
diff --git a/libc/arch-x86/syscalls/unshare.S b/libc/arch-x86/syscalls/unshare.S
new file mode 100644
index 0000000..ae68d7e
--- /dev/null
+++ b/libc/arch-x86/syscalls/unshare.S
@@ -0,0 +1,29 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     12(%esp), %ebx
+    movl    $__NR_unshare, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %ebx
+    ret
+END(unshare)
diff --git a/libc/arch-x86/syscalls/utimensat.S b/libc/arch-x86/syscalls/utimensat.S
new file mode 100644
index 0000000..43eebc7
--- /dev/null
+++ b/libc/arch-x86/syscalls/utimensat.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_utimensat, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(utimensat)
diff --git a/libc/arch-x86/syscalls/vmsplice.S b/libc/arch-x86/syscalls/vmsplice.S
new file mode 100644
index 0000000..195b0bf
--- /dev/null
+++ b/libc/arch-x86/syscalls/vmsplice.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_vmsplice, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(vmsplice)
diff --git a/libc/arch-x86/syscalls/wait4.S b/libc/arch-x86/syscalls/wait4.S
new file mode 100644
index 0000000..281d5f2
--- /dev/null
+++ b/libc/arch-x86/syscalls/wait4.S
@@ -0,0 +1,44 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+    pushl   %esi
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset esi, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    movl    $__NR_wait4, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(wait4)
diff --git a/libc/arch-x86/syscalls/write.S b/libc/arch-x86/syscalls/write.S
new file mode 100644
index 0000000..e9e5f4e
--- /dev/null
+++ b/libc/arch-x86/syscalls/write.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_write, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(write)
diff --git a/libc/arch-x86/syscalls/writev.S b/libc/arch-x86/syscalls/writev.S
new file mode 100644
index 0000000..6649905
--- /dev/null
+++ b/libc/arch-x86/syscalls/writev.S
@@ -0,0 +1,39 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    pushl   %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset ebx, 0
+    pushl   %ecx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset ecx, 0
+    pushl   %edx
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset edx, 0
+
+    call    __kernel_syscall
+    pushl   %eax
+    .cfi_adjust_cfa_offset 4
+    .cfi_rel_offset eax, 0
+
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    movl    $__NR_writev, %eax
+    call    *(%esp)
+    addl    $4, %esp
+
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno_internal
+    addl    $4, %esp
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
+END(writev)
diff --git a/libc/arch-x86_64/bionic/vfork.S b/libc/arch-x86_64/bionic/vfork.S
index 86c5db2..e32b517 100644
--- a/libc/arch-x86_64/bionic/vfork.S
+++ b/libc/arch-x86_64/bionic/vfork.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <platform/bionic/tls_defines.h>
 #include <private/bionic_asm.h>
+#include <private/bionic_asm_tls.h>
 
 // This custom code preserves the return address across the system call.
 
diff --git a/libc/arch-x86_64/string/avx2-wmemset-kbl.S b/libc/arch-x86_64/string/avx2-wmemset-kbl.S
deleted file mode 100644
index 7c485cf..0000000
--- a/libc/arch-x86_64/string/avx2-wmemset-kbl.S
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-Copyright (C) 2019 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>
-
-#ifndef WMEMSET
- #define WMEMSET wmemset_avx2
-#endif
-
-        .section .text.avx2,"ax",@progbits
-
-ENTRY (WMEMSET)
-# BB#0:
-	testq	%rdx, %rdx
-	je	.LBB0_14
-# BB#1:
-	cmpq	$32, %rdx
-	jae	.LBB0_3
-# BB#2:
-	xorl	%r8d, %r8d
-	movq	%rdi, %rax
-	jmp	.LBB0_12
-.LBB0_3:
-	movq	%rdx, %r8
-	andq	$-32, %r8
-	vmovd	%esi, %xmm0
-	vpbroadcastd	%xmm0, %ymm0
-	leaq	-32(%r8), %rcx
-	movq	%rcx, %rax
-	shrq	$5, %rax
-	leal	1(%rax), %r9d
-	andl	$7, %r9d
-	cmpq	$224, %rcx
-	jae	.LBB0_5
-# BB#4:
-	xorl	%eax, %eax
-	testq	%r9, %r9
-	jne	.LBB0_8
-	jmp	.LBB0_10
-.LBB0_5:
-	leaq	992(%rdi), %rcx
-	leaq	-1(%r9), %r10
-	subq	%rax, %r10
-	xorl	%eax, %eax
-	.p2align	4, 0x90
-.LBB0_6:                                # =>This Inner Loop Header: Depth=1
-	vmovdqu	%ymm0, -992(%rcx,%rax,4)
-	vmovdqu	%ymm0, -960(%rcx,%rax,4)
-	vmovdqu	%ymm0, -928(%rcx,%rax,4)
-	vmovdqu	%ymm0, -896(%rcx,%rax,4)
-	vmovdqu	%ymm0, -864(%rcx,%rax,4)
-	vmovdqu	%ymm0, -832(%rcx,%rax,4)
-	vmovdqu	%ymm0, -800(%rcx,%rax,4)
-	vmovdqu	%ymm0, -768(%rcx,%rax,4)
-	vmovdqu	%ymm0, -736(%rcx,%rax,4)
-	vmovdqu	%ymm0, -704(%rcx,%rax,4)
-	vmovdqu	%ymm0, -672(%rcx,%rax,4)
-	vmovdqu	%ymm0, -640(%rcx,%rax,4)
-	vmovdqu	%ymm0, -608(%rcx,%rax,4)
-	vmovdqu	%ymm0, -576(%rcx,%rax,4)
-	vmovdqu	%ymm0, -544(%rcx,%rax,4)
-	vmovdqu	%ymm0, -512(%rcx,%rax,4)
-	vmovdqu	%ymm0, -480(%rcx,%rax,4)
-	vmovdqu	%ymm0, -448(%rcx,%rax,4)
-	vmovdqu	%ymm0, -416(%rcx,%rax,4)
-	vmovdqu	%ymm0, -384(%rcx,%rax,4)
-	vmovdqu	%ymm0, -352(%rcx,%rax,4)
-	vmovdqu	%ymm0, -320(%rcx,%rax,4)
-	vmovdqu	%ymm0, -288(%rcx,%rax,4)
-	vmovdqu	%ymm0, -256(%rcx,%rax,4)
-	vmovdqu	%ymm0, -224(%rcx,%rax,4)
-	vmovdqu	%ymm0, -192(%rcx,%rax,4)
-	vmovdqu	%ymm0, -160(%rcx,%rax,4)
-	vmovdqu	%ymm0, -128(%rcx,%rax,4)
-	vmovdqu	%ymm0, -96(%rcx,%rax,4)
-	vmovdqu	%ymm0, -64(%rcx,%rax,4)
-	vmovdqu	%ymm0, -32(%rcx,%rax,4)
-	vmovdqu	%ymm0, (%rcx,%rax,4)
-	addq	$256, %rax              # imm = 0x100
-	addq	$8, %r10
-	jne	.LBB0_6
-# BB#7:
-	testq	%r9, %r9
-	je	.LBB0_10
-.LBB0_8:
-	leaq	(%rdi,%rax,4), %rax
-	addq	$96, %rax
-	negq	%r9
-	.p2align	4, 0x90
-.LBB0_9:                                # =>This Inner Loop Header: Depth=1
-	vmovdqu	%ymm0, -96(%rax)
-	vmovdqu	%ymm0, -64(%rax)
-	vmovdqu	%ymm0, -32(%rax)
-	vmovdqu	%ymm0, (%rax)
-	subq	$-128, %rax
-	addq	$1, %r9
-	jne	.LBB0_9
-.LBB0_10:
-	cmpq	%rdx, %r8
-	je	.LBB0_14
-# BB#11:
-	leaq	(%rdi,%r8,4), %rax
-.LBB0_12:
-	subq	%r8, %rdx
-	.p2align	4, 0x90
-.LBB0_13:                               # =>This Inner Loop Header: Depth=1
-	movl	%esi, (%rax)
-	addq	$4, %rax
-	addq	$-1, %rdx
-	jne	.LBB0_13
-.LBB0_14:
-	movq	%rdi, %rax
-	vzeroupper
-	retq
-END(WMEMSET)
diff --git a/libc/arch-x86_64/syscalls/___clock_nanosleep.S b/libc/arch-x86_64/syscalls/___clock_nanosleep.S
new file mode 100644
index 0000000..3286eb2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___clock_nanosleep.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___clock_nanosleep)
+    movq    %rcx, %r10
+    movl    $__NR_clock_nanosleep, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___clock_nanosleep)
+.hidden ___clock_nanosleep
diff --git a/libc/arch-x86_64/syscalls/___close.S b/libc/arch-x86_64/syscalls/___close.S
new file mode 100644
index 0000000..8607f05
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___close.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___close)
+    movl    $__NR_close, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___close)
+.hidden ___close
diff --git a/libc/arch-x86_64/syscalls/___faccessat.S b/libc/arch-x86_64/syscalls/___faccessat.S
new file mode 100644
index 0000000..e8fd3f5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___faccessat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___faccessat)
+    movl    $__NR_faccessat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___faccessat)
+.hidden ___faccessat
diff --git a/libc/arch-x86_64/syscalls/___fchmod.S b/libc/arch-x86_64/syscalls/___fchmod.S
new file mode 100644
index 0000000..7bccbef
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___fchmod.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmod)
+    movl    $__NR_fchmod, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___fchmod)
+.hidden ___fchmod
diff --git a/libc/arch-x86_64/syscalls/___fchmodat.S b/libc/arch-x86_64/syscalls/___fchmodat.S
new file mode 100644
index 0000000..483ec7d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___fchmodat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fchmodat)
+    movl    $__NR_fchmodat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___fchmodat)
+.hidden ___fchmodat
diff --git a/libc/arch-x86_64/syscalls/___fgetxattr.S b/libc/arch-x86_64/syscalls/___fgetxattr.S
new file mode 100644
index 0000000..302fd77
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___fgetxattr.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fgetxattr)
+    movq    %rcx, %r10
+    movl    $__NR_fgetxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-x86_64/syscalls/___flistxattr.S b/libc/arch-x86_64/syscalls/___flistxattr.S
new file mode 100644
index 0000000..b4695cc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___flistxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___flistxattr)
+    movl    $__NR_flistxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___flistxattr)
+.hidden ___flistxattr
diff --git a/libc/arch-x86_64/syscalls/___fsetxattr.S b/libc/arch-x86_64/syscalls/___fsetxattr.S
new file mode 100644
index 0000000..125ef20
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___fsetxattr.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___fsetxattr)
+    movq    %rcx, %r10
+    movl    $__NR_fsetxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___fsetxattr)
+.hidden ___fsetxattr
diff --git a/libc/arch-x86_64/syscalls/___mremap.S b/libc/arch-x86_64/syscalls/___mremap.S
new file mode 100644
index 0000000..cc6dee9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___mremap.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___mremap)
+    movq    %rcx, %r10
+    movl    $__NR_mremap, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___mremap)
+.hidden ___mremap
diff --git a/libc/arch-x86_64/syscalls/___rt_sigqueueinfo.S b/libc/arch-x86_64/syscalls/___rt_sigqueueinfo.S
new file mode 100644
index 0000000..8c6b30b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/___rt_sigqueueinfo.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(___rt_sigqueueinfo)
+    movl    $__NR_rt_sigqueueinfo, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(___rt_sigqueueinfo)
+.hidden ___rt_sigqueueinfo
diff --git a/libc/arch-x86_64/syscalls/__accept4.S b/libc/arch-x86_64/syscalls/__accept4.S
new file mode 100644
index 0000000..aa5beba
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__accept4.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__accept4)
+    movq    %rcx, %r10
+    movl    $__NR_accept4, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__accept4)
+.hidden __accept4
diff --git a/libc/arch-x86_64/syscalls/__arch_prctl.S b/libc/arch-x86_64/syscalls/__arch_prctl.S
new file mode 100644
index 0000000..0a604f4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__arch_prctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__arch_prctl)
+    movl    $__NR_arch_prctl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__arch_prctl)
+.hidden __arch_prctl
diff --git a/libc/arch-x86_64/syscalls/__brk.S b/libc/arch-x86_64/syscalls/__brk.S
new file mode 100644
index 0000000..b6c0f2f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__brk.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__brk)
+    movl    $__NR_brk, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__brk)
+.hidden __brk
diff --git a/libc/arch-x86_64/syscalls/__clock_getres.S b/libc/arch-x86_64/syscalls/__clock_getres.S
new file mode 100644
index 0000000..aff974e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__clock_getres.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_getres)
+    movl    $__NR_clock_getres, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__clock_getres)
+.hidden __clock_getres
diff --git a/libc/arch-x86_64/syscalls/__clock_gettime.S b/libc/arch-x86_64/syscalls/__clock_gettime.S
new file mode 100644
index 0000000..ccacdb2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__clock_gettime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__clock_gettime)
+    movl    $__NR_clock_gettime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__clock_gettime)
+.hidden __clock_gettime
diff --git a/libc/arch-x86_64/syscalls/__connect.S b/libc/arch-x86_64/syscalls/__connect.S
new file mode 100644
index 0000000..d7531ad
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__connect.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__connect)
+    movl    $__NR_connect, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__connect)
+.hidden __connect
diff --git a/libc/arch-x86_64/syscalls/__epoll_pwait.S b/libc/arch-x86_64/syscalls/__epoll_pwait.S
new file mode 100644
index 0000000..b486c4a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__epoll_pwait.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__epoll_pwait)
+    movq    %rcx, %r10
+    movl    $__NR_epoll_pwait, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-x86_64/syscalls/__exit.S b/libc/arch-x86_64/syscalls/__exit.S
new file mode 100644
index 0000000..99b11fc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__exit.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__exit)
+    movl    $__NR_exit, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__exit)
+.hidden __exit
diff --git a/libc/arch-x86_64/syscalls/__fadvise64.S b/libc/arch-x86_64/syscalls/__fadvise64.S
new file mode 100644
index 0000000..8810d88
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__fadvise64.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fadvise64)
+    movq    %rcx, %r10
+    movl    $__NR_fadvise64, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__fadvise64)
+.hidden __fadvise64
diff --git a/libc/arch-x86_64/syscalls/__fstatfs.S b/libc/arch-x86_64/syscalls/__fstatfs.S
new file mode 100644
index 0000000..b50e355
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__fstatfs.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__fstatfs)
+    movl    $__NR_fstatfs, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__fstatfs)
+.hidden __fstatfs
diff --git a/libc/arch-x86_64/syscalls/__getcpu.S b/libc/arch-x86_64/syscalls/__getcpu.S
new file mode 100644
index 0000000..3903e9f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getcpu.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcpu)
+    movl    $__NR_getcpu, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-x86_64/syscalls/__getcwd.S b/libc/arch-x86_64/syscalls/__getcwd.S
new file mode 100644
index 0000000..d39c1d7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getcwd.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getcwd)
+    movl    $__NR_getcwd, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-x86_64/syscalls/__getdents64.S b/libc/arch-x86_64/syscalls/__getdents64.S
new file mode 100644
index 0000000..b5eb943
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getdents64.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getdents64)
+    movl    $__NR_getdents64, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__getdents64)
+.hidden __getdents64
diff --git a/libc/arch-x86_64/syscalls/__getpid.S b/libc/arch-x86_64/syscalls/__getpid.S
new file mode 100644
index 0000000..ec4316e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getpid.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpid)
+    movl    $__NR_getpid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__getpid)
+.hidden __getpid
diff --git a/libc/arch-x86_64/syscalls/__getpriority.S b/libc/arch-x86_64/syscalls/__getpriority.S
new file mode 100644
index 0000000..7c618a1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getpriority.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__getpriority)
+    movl    $__NR_getpriority, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-x86_64/syscalls/__gettimeofday.S b/libc/arch-x86_64/syscalls/__gettimeofday.S
new file mode 100644
index 0000000..69b9b6e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__gettimeofday.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__gettimeofday)
+    movl    $__NR_gettimeofday, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__gettimeofday)
+.hidden __gettimeofday
diff --git a/libc/arch-x86_64/syscalls/__ioctl.S b/libc/arch-x86_64/syscalls/__ioctl.S
new file mode 100644
index 0000000..0eb34f0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__ioctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ioctl)
+    movl    $__NR_ioctl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-x86_64/syscalls/__openat.S b/libc/arch-x86_64/syscalls/__openat.S
new file mode 100644
index 0000000..14f53ca
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__openat.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__openat)
+    movq    %rcx, %r10
+    movl    $__NR_openat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__openat)
+.hidden __openat
diff --git a/libc/arch-x86_64/syscalls/__ppoll.S b/libc/arch-x86_64/syscalls/__ppoll.S
new file mode 100644
index 0000000..82b97dd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__ppoll.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ppoll)
+    movq    %rcx, %r10
+    movl    $__NR_ppoll, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-x86_64/syscalls/__pselect6.S b/libc/arch-x86_64/syscalls/__pselect6.S
new file mode 100644
index 0000000..c11d814
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__pselect6.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__pselect6)
+    movq    %rcx, %r10
+    movl    $__NR_pselect6, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-x86_64/syscalls/__ptrace.S b/libc/arch-x86_64/syscalls/__ptrace.S
new file mode 100644
index 0000000..729e007
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__ptrace.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__ptrace)
+    movq    %rcx, %r10
+    movl    $__NR_ptrace, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-x86_64/syscalls/__reboot.S b/libc/arch-x86_64/syscalls/__reboot.S
new file mode 100644
index 0000000..b462dc7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__reboot.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__reboot)
+    movq    %rcx, %r10
+    movl    $__NR_reboot, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__reboot)
+.hidden __reboot
diff --git a/libc/arch-x86_64/syscalls/__rt_sigaction.S b/libc/arch-x86_64/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..17c5995
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigaction.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigaction)
+    movq    %rcx, %r10
+    movl    $__NR_rt_sigaction, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-x86_64/syscalls/__rt_sigpending.S b/libc/arch-x86_64/syscalls/__rt_sigpending.S
new file mode 100644
index 0000000..b5b81bb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigpending.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigpending)
+    movl    $__NR_rt_sigpending, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-x86_64/syscalls/__rt_sigprocmask.S b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..e8b3f2a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigprocmask)
+    movq    %rcx, %r10
+    movl    $__NR_rt_sigprocmask, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-x86_64/syscalls/__rt_sigsuspend.S b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..f6366a2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigsuspend)
+    movl    $__NR_rt_sigsuspend, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..9bcb811
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__rt_sigtimedwait)
+    movq    %rcx, %r10
+    movl    $__NR_rt_sigtimedwait, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-x86_64/syscalls/__sched_getaffinity.S b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..0ca6818
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sched_getaffinity)
+    movl    $__NR_sched_getaffinity, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-x86_64/syscalls/__set_tid_address.S b/libc/arch-x86_64/syscalls/__set_tid_address.S
new file mode 100644
index 0000000..3dad660
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__set_tid_address.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    movl    $__NR_set_tid_address, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-x86_64/syscalls/__signalfd4.S b/libc/arch-x86_64/syscalls/__signalfd4.S
new file mode 100644
index 0000000..b44bfe5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__signalfd4.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__signalfd4)
+    movq    %rcx, %r10
+    movl    $__NR_signalfd4, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__signalfd4)
+.hidden __signalfd4
diff --git a/libc/arch-x86_64/syscalls/__socket.S b/libc/arch-x86_64/syscalls/__socket.S
new file mode 100644
index 0000000..0563d2f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__socket.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__socket)
+    movl    $__NR_socket, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__socket)
+.hidden __socket
diff --git a/libc/arch-x86_64/syscalls/__statfs.S b/libc/arch-x86_64/syscalls/__statfs.S
new file mode 100644
index 0000000..607a809
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__statfs.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__statfs)
+    movl    $__NR_statfs, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__statfs)
+.hidden __statfs
diff --git a/libc/arch-x86_64/syscalls/__sync_file_range.S b/libc/arch-x86_64/syscalls/__sync_file_range.S
new file mode 100644
index 0000000..6a2c430
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__sync_file_range.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__sync_file_range)
+    movq    %rcx, %r10
+    movl    $__NR_sync_file_range, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__sync_file_range)
+.hidden __sync_file_range
diff --git a/libc/arch-x86_64/syscalls/__timer_create.S b/libc/arch-x86_64/syscalls/__timer_create.S
new file mode 100644
index 0000000..cb955a4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_create.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_create)
+    movl    $__NR_timer_create, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-x86_64/syscalls/__timer_delete.S b/libc/arch-x86_64/syscalls/__timer_delete.S
new file mode 100644
index 0000000..7abc7d8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_delete.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_delete)
+    movl    $__NR_timer_delete, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-x86_64/syscalls/__timer_getoverrun.S b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..f2a0e24
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_getoverrun)
+    movl    $__NR_timer_getoverrun, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-x86_64/syscalls/__timer_gettime.S b/libc/arch-x86_64/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..62c2b47
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_gettime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_gettime)
+    movl    $__NR_timer_gettime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-x86_64/syscalls/__timer_settime.S b/libc/arch-x86_64/syscalls/__timer_settime.S
new file mode 100644
index 0000000..225fa8e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_settime.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__timer_settime)
+    movq    %rcx, %r10
+    movl    $__NR_timer_settime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-x86_64/syscalls/__waitid.S b/libc/arch-x86_64/syscalls/__waitid.S
new file mode 100644
index 0000000..ff8a3c5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__waitid.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__waitid)
+    movq    %rcx, %r10
+    movl    $__NR_waitid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(__waitid)
+.hidden __waitid
diff --git a/libc/arch-x86_64/syscalls/_exit.S b/libc/arch-x86_64/syscalls/_exit.S
new file mode 100644
index 0000000..1ab4d4f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/_exit.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(_exit)
+    movl    $__NR_exit_group, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(_exit)
+
+ALIAS_SYMBOL(_Exit, _exit)
diff --git a/libc/arch-x86_64/syscalls/acct.S b/libc/arch-x86_64/syscalls/acct.S
new file mode 100644
index 0000000..a739707
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/acct.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(acct)
+    movl    $__NR_acct, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(acct)
diff --git a/libc/arch-x86_64/syscalls/adjtimex.S b/libc/arch-x86_64/syscalls/adjtimex.S
new file mode 100644
index 0000000..292b9f3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/adjtimex.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(adjtimex)
+    movl    $__NR_adjtimex, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(adjtimex)
diff --git a/libc/arch-x86_64/syscalls/bind.S b/libc/arch-x86_64/syscalls/bind.S
new file mode 100644
index 0000000..e5bc263
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/bind.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(bind)
+    movl    $__NR_bind, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(bind)
diff --git a/libc/arch-x86_64/syscalls/capget.S b/libc/arch-x86_64/syscalls/capget.S
new file mode 100644
index 0000000..9ce1583
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/capget.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capget)
+    movl    $__NR_capget, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(capget)
diff --git a/libc/arch-x86_64/syscalls/capset.S b/libc/arch-x86_64/syscalls/capset.S
new file mode 100644
index 0000000..2776756
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/capset.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(capset)
+    movl    $__NR_capset, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(capset)
diff --git a/libc/arch-x86_64/syscalls/chdir.S b/libc/arch-x86_64/syscalls/chdir.S
new file mode 100644
index 0000000..269905c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chdir.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chdir)
+    movl    $__NR_chdir, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(chdir)
diff --git a/libc/arch-x86_64/syscalls/chroot.S b/libc/arch-x86_64/syscalls/chroot.S
new file mode 100644
index 0000000..713b1b3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chroot.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(chroot)
+    movl    $__NR_chroot, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(chroot)
diff --git a/libc/arch-x86_64/syscalls/clock_adjtime.S b/libc/arch-x86_64/syscalls/clock_adjtime.S
new file mode 100644
index 0000000..0601930
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_adjtime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_adjtime)
+    movl    $__NR_clock_adjtime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(clock_adjtime)
diff --git a/libc/arch-x86_64/syscalls/clock_settime.S b/libc/arch-x86_64/syscalls/clock_settime.S
new file mode 100644
index 0000000..26070a4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_settime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(clock_settime)
+    movl    $__NR_clock_settime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(clock_settime)
diff --git a/libc/arch-x86_64/syscalls/delete_module.S b/libc/arch-x86_64/syscalls/delete_module.S
new file mode 100644
index 0000000..63f17ad
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/delete_module.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(delete_module)
+    movl    $__NR_delete_module, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(delete_module)
diff --git a/libc/arch-x86_64/syscalls/dup.S b/libc/arch-x86_64/syscalls/dup.S
new file mode 100644
index 0000000..5016f77
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/dup.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup)
+    movl    $__NR_dup, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(dup)
diff --git a/libc/arch-x86_64/syscalls/dup3.S b/libc/arch-x86_64/syscalls/dup3.S
new file mode 100644
index 0000000..9abd168
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/dup3.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(dup3)
+    movl    $__NR_dup3, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(dup3)
diff --git a/libc/arch-x86_64/syscalls/epoll_create1.S b/libc/arch-x86_64/syscalls/epoll_create1.S
new file mode 100644
index 0000000..d1e4bfc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/epoll_create1.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_create1)
+    movl    $__NR_epoll_create1, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(epoll_create1)
diff --git a/libc/arch-x86_64/syscalls/epoll_ctl.S b/libc/arch-x86_64/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..f429b96
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/epoll_ctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(epoll_ctl)
+    movq    %rcx, %r10
+    movl    $__NR_epoll_ctl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(epoll_ctl)
diff --git a/libc/arch-x86_64/syscalls/eventfd.S b/libc/arch-x86_64/syscalls/eventfd.S
new file mode 100644
index 0000000..dcc5105
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/eventfd.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(eventfd)
+    movl    $__NR_eventfd2, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(eventfd)
diff --git a/libc/arch-x86_64/syscalls/execve.S b/libc/arch-x86_64/syscalls/execve.S
new file mode 100644
index 0000000..947baa4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/execve.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(execve)
+    movl    $__NR_execve, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(execve)
diff --git a/libc/arch-x86_64/syscalls/fallocate.S b/libc/arch-x86_64/syscalls/fallocate.S
new file mode 100644
index 0000000..f6f891b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fallocate.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fallocate)
+    movq    %rcx, %r10
+    movl    $__NR_fallocate, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fallocate)
+
+ALIAS_SYMBOL(fallocate64, fallocate)
diff --git a/libc/arch-x86_64/syscalls/fchdir.S b/libc/arch-x86_64/syscalls/fchdir.S
new file mode 100644
index 0000000..d005c14
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchdir.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchdir)
+    movl    $__NR_fchdir, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fchdir)
diff --git a/libc/arch-x86_64/syscalls/fchown.S b/libc/arch-x86_64/syscalls/fchown.S
new file mode 100644
index 0000000..d5bdc71
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchown.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchown)
+    movl    $__NR_fchown, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fchown)
diff --git a/libc/arch-x86_64/syscalls/fchownat.S b/libc/arch-x86_64/syscalls/fchownat.S
new file mode 100644
index 0000000..ff05e9e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchownat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fchownat)
+    movq    %rcx, %r10
+    movl    $__NR_fchownat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fchownat)
diff --git a/libc/arch-x86_64/syscalls/fcntl.S b/libc/arch-x86_64/syscalls/fcntl.S
new file mode 100644
index 0000000..f28195b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fcntl.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fcntl)
+    movl    $__NR_fcntl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fcntl)
diff --git a/libc/arch-x86_64/syscalls/fdatasync.S b/libc/arch-x86_64/syscalls/fdatasync.S
new file mode 100644
index 0000000..27239b9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fdatasync.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fdatasync)
+    movl    $__NR_fdatasync, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fdatasync)
diff --git a/libc/arch-x86_64/syscalls/flock.S b/libc/arch-x86_64/syscalls/flock.S
new file mode 100644
index 0000000..1bc6678
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/flock.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(flock)
+    movl    $__NR_flock, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(flock)
diff --git a/libc/arch-x86_64/syscalls/fremovexattr.S b/libc/arch-x86_64/syscalls/fremovexattr.S
new file mode 100644
index 0000000..517094c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fremovexattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fremovexattr)
+    movl    $__NR_fremovexattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fremovexattr)
diff --git a/libc/arch-x86_64/syscalls/fstat64.S b/libc/arch-x86_64/syscalls/fstat64.S
new file mode 100644
index 0000000..a0d4fa1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fstat64.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstat64)
+    movl    $__NR_fstat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fstat64)
+
+ALIAS_SYMBOL(fstat, fstat64)
diff --git a/libc/arch-x86_64/syscalls/fstatat64.S b/libc/arch-x86_64/syscalls/fstatat64.S
new file mode 100644
index 0000000..1984d68
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fstatat64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fstatat64)
+    movq    %rcx, %r10
+    movl    $__NR_newfstatat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fstatat64)
+
+ALIAS_SYMBOL(fstatat, fstatat64)
diff --git a/libc/arch-x86_64/syscalls/fsync.S b/libc/arch-x86_64/syscalls/fsync.S
new file mode 100644
index 0000000..e7ec6da
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fsync.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(fsync)
+    movl    $__NR_fsync, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(fsync)
diff --git a/libc/arch-x86_64/syscalls/ftruncate.S b/libc/arch-x86_64/syscalls/ftruncate.S
new file mode 100644
index 0000000..7917468
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/ftruncate.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(ftruncate)
+    movl    $__NR_ftruncate, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(ftruncate)
+
+ALIAS_SYMBOL(ftruncate64, ftruncate)
diff --git a/libc/arch-x86_64/syscalls/getegid.S b/libc/arch-x86_64/syscalls/getegid.S
new file mode 100644
index 0000000..84ba240
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getegid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getegid)
+    movl    $__NR_getegid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getegid)
diff --git a/libc/arch-x86_64/syscalls/geteuid.S b/libc/arch-x86_64/syscalls/geteuid.S
new file mode 100644
index 0000000..18a991a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/geteuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(geteuid)
+    movl    $__NR_geteuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(geteuid)
diff --git a/libc/arch-x86_64/syscalls/getgid.S b/libc/arch-x86_64/syscalls/getgid.S
new file mode 100644
index 0000000..5e4b0ef
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgid)
+    movl    $__NR_getgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getgid)
diff --git a/libc/arch-x86_64/syscalls/getgroups.S b/libc/arch-x86_64/syscalls/getgroups.S
new file mode 100644
index 0000000..b5dd81c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getgroups.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getgroups)
+    movl    $__NR_getgroups, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getgroups)
diff --git a/libc/arch-x86_64/syscalls/getitimer.S b/libc/arch-x86_64/syscalls/getitimer.S
new file mode 100644
index 0000000..c4bb120
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getitimer.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getitimer)
+    movl    $__NR_getitimer, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getitimer)
diff --git a/libc/arch-x86_64/syscalls/getpeername.S b/libc/arch-x86_64/syscalls/getpeername.S
new file mode 100644
index 0000000..0b212be
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getpeername.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpeername)
+    movl    $__NR_getpeername, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getpeername)
diff --git a/libc/arch-x86_64/syscalls/getpgid.S b/libc/arch-x86_64/syscalls/getpgid.S
new file mode 100644
index 0000000..d1b0e8b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getpgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getpgid)
+    movl    $__NR_getpgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getpgid)
diff --git a/libc/arch-x86_64/syscalls/getppid.S b/libc/arch-x86_64/syscalls/getppid.S
new file mode 100644
index 0000000..e1cfee0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getppid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getppid)
+    movl    $__NR_getppid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getppid)
diff --git a/libc/arch-x86_64/syscalls/getrandom.S b/libc/arch-x86_64/syscalls/getrandom.S
new file mode 100644
index 0000000..c5e44a9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getrandom.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrandom)
+    movl    $__NR_getrandom, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getrandom)
diff --git a/libc/arch-x86_64/syscalls/getresgid.S b/libc/arch-x86_64/syscalls/getresgid.S
new file mode 100644
index 0000000..0b7ea7a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getresgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresgid)
+    movl    $__NR_getresgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getresgid)
diff --git a/libc/arch-x86_64/syscalls/getresuid.S b/libc/arch-x86_64/syscalls/getresuid.S
new file mode 100644
index 0000000..0d7a054
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getresuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getresuid)
+    movl    $__NR_getresuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getresuid)
diff --git a/libc/arch-x86_64/syscalls/getrlimit.S b/libc/arch-x86_64/syscalls/getrlimit.S
new file mode 100644
index 0000000..00ed08a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getrlimit.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrlimit)
+    movl    $__NR_getrlimit, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getrlimit)
+
+ALIAS_SYMBOL(getrlimit64, getrlimit)
diff --git a/libc/arch-x86_64/syscalls/getrusage.S b/libc/arch-x86_64/syscalls/getrusage.S
new file mode 100644
index 0000000..eef7fb8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getrusage.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getrusage)
+    movl    $__NR_getrusage, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getrusage)
diff --git a/libc/arch-x86_64/syscalls/getsid.S b/libc/arch-x86_64/syscalls/getsid.S
new file mode 100644
index 0000000..022f959
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsid)
+    movl    $__NR_getsid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getsid)
diff --git a/libc/arch-x86_64/syscalls/getsockname.S b/libc/arch-x86_64/syscalls/getsockname.S
new file mode 100644
index 0000000..36fdcf7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsockname.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockname)
+    movl    $__NR_getsockname, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getsockname)
diff --git a/libc/arch-x86_64/syscalls/getsockopt.S b/libc/arch-x86_64/syscalls/getsockopt.S
new file mode 100644
index 0000000..c1e11e7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsockopt.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getsockopt)
+    movq    %rcx, %r10
+    movl    $__NR_getsockopt, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getsockopt)
diff --git a/libc/arch-x86_64/syscalls/getuid.S b/libc/arch-x86_64/syscalls/getuid.S
new file mode 100644
index 0000000..93cd0f8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getuid)
+    movl    $__NR_getuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getuid)
diff --git a/libc/arch-x86_64/syscalls/getxattr.S b/libc/arch-x86_64/syscalls/getxattr.S
new file mode 100644
index 0000000..01378b0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(getxattr)
+    movq    %rcx, %r10
+    movl    $__NR_getxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(getxattr)
diff --git a/libc/arch-x86_64/syscalls/init_module.S b/libc/arch-x86_64/syscalls/init_module.S
new file mode 100644
index 0000000..c005de4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/init_module.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(init_module)
+    movl    $__NR_init_module, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(init_module)
diff --git a/libc/arch-x86_64/syscalls/inotify_add_watch.S b/libc/arch-x86_64/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..edf2930
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_add_watch.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_add_watch)
+    movl    $__NR_inotify_add_watch, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(inotify_add_watch)
diff --git a/libc/arch-x86_64/syscalls/inotify_init1.S b/libc/arch-x86_64/syscalls/inotify_init1.S
new file mode 100644
index 0000000..b158018
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_init1.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_init1)
+    movl    $__NR_inotify_init1, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(inotify_init1)
diff --git a/libc/arch-x86_64/syscalls/inotify_rm_watch.S b/libc/arch-x86_64/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..f2fc10e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_rm_watch.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(inotify_rm_watch)
+    movl    $__NR_inotify_rm_watch, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(inotify_rm_watch)
diff --git a/libc/arch-x86_64/syscalls/kill.S b/libc/arch-x86_64/syscalls/kill.S
new file mode 100644
index 0000000..fe93f34
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/kill.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    movl    $__NR_kill, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(kill)
diff --git a/libc/arch-x86_64/syscalls/klogctl.S b/libc/arch-x86_64/syscalls/klogctl.S
new file mode 100644
index 0000000..fb2aca3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/klogctl.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(klogctl)
+    movl    $__NR_syslog, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(klogctl)
diff --git a/libc/arch-x86_64/syscalls/lgetxattr.S b/libc/arch-x86_64/syscalls/lgetxattr.S
new file mode 100644
index 0000000..36202a2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lgetxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lgetxattr)
+    movq    %rcx, %r10
+    movl    $__NR_lgetxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(lgetxattr)
diff --git a/libc/arch-x86_64/syscalls/linkat.S b/libc/arch-x86_64/syscalls/linkat.S
new file mode 100644
index 0000000..d195e19
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/linkat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(linkat)
+    movq    %rcx, %r10
+    movl    $__NR_linkat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(linkat)
diff --git a/libc/arch-x86_64/syscalls/listen.S b/libc/arch-x86_64/syscalls/listen.S
new file mode 100644
index 0000000..756b629
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/listen.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listen)
+    movl    $__NR_listen, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(listen)
diff --git a/libc/arch-x86_64/syscalls/listxattr.S b/libc/arch-x86_64/syscalls/listxattr.S
new file mode 100644
index 0000000..d0b2112
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/listxattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(listxattr)
+    movl    $__NR_listxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(listxattr)
diff --git a/libc/arch-x86_64/syscalls/llistxattr.S b/libc/arch-x86_64/syscalls/llistxattr.S
new file mode 100644
index 0000000..49fb969
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/llistxattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(llistxattr)
+    movl    $__NR_llistxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(llistxattr)
diff --git a/libc/arch-x86_64/syscalls/lremovexattr.S b/libc/arch-x86_64/syscalls/lremovexattr.S
new file mode 100644
index 0000000..1e1bc30
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lremovexattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lremovexattr)
+    movl    $__NR_lremovexattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(lremovexattr)
diff --git a/libc/arch-x86_64/syscalls/lseek.S b/libc/arch-x86_64/syscalls/lseek.S
new file mode 100644
index 0000000..69d60c2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lseek.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lseek)
+    movl    $__NR_lseek, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(lseek)
+
+ALIAS_SYMBOL(lseek64, lseek)
diff --git a/libc/arch-x86_64/syscalls/lsetxattr.S b/libc/arch-x86_64/syscalls/lsetxattr.S
new file mode 100644
index 0000000..965ee03
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lsetxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(lsetxattr)
+    movq    %rcx, %r10
+    movl    $__NR_lsetxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(lsetxattr)
diff --git a/libc/arch-x86_64/syscalls/madvise.S b/libc/arch-x86_64/syscalls/madvise.S
new file mode 100644
index 0000000..75d47f6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/madvise.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(madvise)
+    movl    $__NR_madvise, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(madvise)
diff --git a/libc/arch-x86_64/syscalls/mincore.S b/libc/arch-x86_64/syscalls/mincore.S
new file mode 100644
index 0000000..2d8a28a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mincore.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mincore)
+    movl    $__NR_mincore, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mincore)
diff --git a/libc/arch-x86_64/syscalls/mkdirat.S b/libc/arch-x86_64/syscalls/mkdirat.S
new file mode 100644
index 0000000..8a76013
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mkdirat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mkdirat)
+    movl    $__NR_mkdirat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mkdirat)
diff --git a/libc/arch-x86_64/syscalls/mknodat.S b/libc/arch-x86_64/syscalls/mknodat.S
new file mode 100644
index 0000000..a8859d4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mknodat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mknodat)
+    movq    %rcx, %r10
+    movl    $__NR_mknodat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mknodat)
diff --git a/libc/arch-x86_64/syscalls/mlock.S b/libc/arch-x86_64/syscalls/mlock.S
new file mode 100644
index 0000000..d34b3ae
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mlock.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlock)
+    movl    $__NR_mlock, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mlock)
diff --git a/libc/arch-x86_64/syscalls/mlockall.S b/libc/arch-x86_64/syscalls/mlockall.S
new file mode 100644
index 0000000..31ccaa0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mlockall.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mlockall)
+    movl    $__NR_mlockall, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mlockall)
diff --git a/libc/arch-x86_64/syscalls/mmap.S b/libc/arch-x86_64/syscalls/mmap.S
new file mode 100644
index 0000000..0c25473
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mmap.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mmap)
+    movq    %rcx, %r10
+    movl    $__NR_mmap, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mmap)
+
+ALIAS_SYMBOL(mmap64, mmap)
diff --git a/libc/arch-x86_64/syscalls/mount.S b/libc/arch-x86_64/syscalls/mount.S
new file mode 100644
index 0000000..dcbd473
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mount.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mount)
+    movq    %rcx, %r10
+    movl    $__NR_mount, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mount)
diff --git a/libc/arch-x86_64/syscalls/mprotect.S b/libc/arch-x86_64/syscalls/mprotect.S
new file mode 100644
index 0000000..2ad4b25
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mprotect.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(mprotect)
+    movl    $__NR_mprotect, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(mprotect)
diff --git a/libc/arch-x86_64/syscalls/msync.S b/libc/arch-x86_64/syscalls/msync.S
new file mode 100644
index 0000000..099dbbf
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/msync.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(msync)
+    movl    $__NR_msync, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(msync)
diff --git a/libc/arch-x86_64/syscalls/munlock.S b/libc/arch-x86_64/syscalls/munlock.S
new file mode 100644
index 0000000..bb5940c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munlock.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlock)
+    movl    $__NR_munlock, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(munlock)
diff --git a/libc/arch-x86_64/syscalls/munlockall.S b/libc/arch-x86_64/syscalls/munlockall.S
new file mode 100644
index 0000000..f9579df
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munlockall.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munlockall)
+    movl    $__NR_munlockall, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(munlockall)
diff --git a/libc/arch-x86_64/syscalls/munmap.S b/libc/arch-x86_64/syscalls/munmap.S
new file mode 100644
index 0000000..d1c580e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munmap.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(munmap)
+    movl    $__NR_munmap, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(munmap)
diff --git a/libc/arch-x86_64/syscalls/nanosleep.S b/libc/arch-x86_64/syscalls/nanosleep.S
new file mode 100644
index 0000000..b19f7f5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/nanosleep.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(nanosleep)
+    movl    $__NR_nanosleep, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(nanosleep)
diff --git a/libc/arch-x86_64/syscalls/personality.S b/libc/arch-x86_64/syscalls/personality.S
new file mode 100644
index 0000000..6937e4c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/personality.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(personality)
+    movl    $__NR_personality, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(personality)
diff --git a/libc/arch-x86_64/syscalls/pipe2.S b/libc/arch-x86_64/syscalls/pipe2.S
new file mode 100644
index 0000000..d488c87
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pipe2.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pipe2)
+    movl    $__NR_pipe2, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(pipe2)
diff --git a/libc/arch-x86_64/syscalls/prctl.S b/libc/arch-x86_64/syscalls/prctl.S
new file mode 100644
index 0000000..4f3d2ae
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/prctl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prctl)
+    movq    %rcx, %r10
+    movl    $__NR_prctl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(prctl)
diff --git a/libc/arch-x86_64/syscalls/pread64.S b/libc/arch-x86_64/syscalls/pread64.S
new file mode 100644
index 0000000..eaa47b1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pread64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pread64)
+    movq    %rcx, %r10
+    movl    $__NR_pread64, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(pread64)
+
+ALIAS_SYMBOL(pread, pread64)
diff --git a/libc/arch-x86_64/syscalls/preadv.S b/libc/arch-x86_64/syscalls/preadv.S
new file mode 100644
index 0000000..7771a44
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/preadv.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(preadv)
+    movq    %rcx, %r10
+    movl    $__NR_preadv, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(preadv)
+
+ALIAS_SYMBOL(preadv64, preadv)
diff --git a/libc/arch-x86_64/syscalls/prlimit64.S b/libc/arch-x86_64/syscalls/prlimit64.S
new file mode 100644
index 0000000..737b863
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/prlimit64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(prlimit64)
+    movq    %rcx, %r10
+    movl    $__NR_prlimit64, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(prlimit64)
+
+ALIAS_SYMBOL(prlimit, prlimit64)
diff --git a/libc/arch-x86_64/syscalls/process_vm_readv.S b/libc/arch-x86_64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..597649e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/process_vm_readv.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+    movq    %rcx, %r10
+    movl    $__NR_process_vm_readv, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(process_vm_readv)
diff --git a/libc/arch-x86_64/syscalls/process_vm_writev.S b/libc/arch-x86_64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..397c007
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/process_vm_writev.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+    movq    %rcx, %r10
+    movl    $__NR_process_vm_writev, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(process_vm_writev)
diff --git a/libc/arch-x86_64/syscalls/pwrite64.S b/libc/arch-x86_64/syscalls/pwrite64.S
new file mode 100644
index 0000000..edb60af
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pwrite64.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwrite64)
+    movq    %rcx, %r10
+    movl    $__NR_pwrite64, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(pwrite64)
+
+ALIAS_SYMBOL(pwrite, pwrite64)
diff --git a/libc/arch-x86_64/syscalls/pwritev.S b/libc/arch-x86_64/syscalls/pwritev.S
new file mode 100644
index 0000000..d3bd8fa
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pwritev.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(pwritev)
+    movq    %rcx, %r10
+    movl    $__NR_pwritev, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(pwritev)
+
+ALIAS_SYMBOL(pwritev64, pwritev)
diff --git a/libc/arch-x86_64/syscalls/quotactl.S b/libc/arch-x86_64/syscalls/quotactl.S
new file mode 100644
index 0000000..427358a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/quotactl.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(quotactl)
+    movq    %rcx, %r10
+    movl    $__NR_quotactl, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(quotactl)
diff --git a/libc/arch-x86_64/syscalls/read.S b/libc/arch-x86_64/syscalls/read.S
new file mode 100644
index 0000000..df70e7f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/read.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(read)
+    movl    $__NR_read, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(read)
diff --git a/libc/arch-x86_64/syscalls/readahead.S b/libc/arch-x86_64/syscalls/readahead.S
new file mode 100644
index 0000000..38cb1c0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readahead.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readahead)
+    movl    $__NR_readahead, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(readahead)
diff --git a/libc/arch-x86_64/syscalls/readlinkat.S b/libc/arch-x86_64/syscalls/readlinkat.S
new file mode 100644
index 0000000..9fd64e5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readlinkat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readlinkat)
+    movq    %rcx, %r10
+    movl    $__NR_readlinkat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(readlinkat)
diff --git a/libc/arch-x86_64/syscalls/readv.S b/libc/arch-x86_64/syscalls/readv.S
new file mode 100644
index 0000000..2510c56
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readv.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(readv)
+    movl    $__NR_readv, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(readv)
diff --git a/libc/arch-x86_64/syscalls/recvfrom.S b/libc/arch-x86_64/syscalls/recvfrom.S
new file mode 100644
index 0000000..6c09078
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/recvfrom.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvfrom)
+    movq    %rcx, %r10
+    movl    $__NR_recvfrom, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(recvfrom)
diff --git a/libc/arch-x86_64/syscalls/recvmmsg.S b/libc/arch-x86_64/syscalls/recvmmsg.S
new file mode 100644
index 0000000..78da691
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/recvmmsg.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmmsg)
+    movq    %rcx, %r10
+    movl    $__NR_recvmmsg, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(recvmmsg)
diff --git a/libc/arch-x86_64/syscalls/recvmsg.S b/libc/arch-x86_64/syscalls/recvmsg.S
new file mode 100644
index 0000000..945f17b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/recvmsg.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(recvmsg)
+    movl    $__NR_recvmsg, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(recvmsg)
diff --git a/libc/arch-x86_64/syscalls/removexattr.S b/libc/arch-x86_64/syscalls/removexattr.S
new file mode 100644
index 0000000..9b47615
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/removexattr.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(removexattr)
+    movl    $__NR_removexattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(removexattr)
diff --git a/libc/arch-x86_64/syscalls/renameat.S b/libc/arch-x86_64/syscalls/renameat.S
new file mode 100644
index 0000000..3a94a75
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/renameat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(renameat)
+    movq    %rcx, %r10
+    movl    $__NR_renameat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(renameat)
diff --git a/libc/arch-x86_64/syscalls/sched_get_priority_max.S b/libc/arch-x86_64/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..1a0da23
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_get_priority_max.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_max)
+    movl    $__NR_sched_get_priority_max, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_get_priority_max)
diff --git a/libc/arch-x86_64/syscalls/sched_get_priority_min.S b/libc/arch-x86_64/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..3785877
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_get_priority_min.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_get_priority_min)
+    movl    $__NR_sched_get_priority_min, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_get_priority_min)
diff --git a/libc/arch-x86_64/syscalls/sched_getparam.S b/libc/arch-x86_64/syscalls/sched_getparam.S
new file mode 100644
index 0000000..409b501
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_getparam.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getparam)
+    movl    $__NR_sched_getparam, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_getparam)
diff --git a/libc/arch-x86_64/syscalls/sched_getscheduler.S b/libc/arch-x86_64/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..5200504
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_getscheduler.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_getscheduler)
+    movl    $__NR_sched_getscheduler, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_getscheduler)
diff --git a/libc/arch-x86_64/syscalls/sched_rr_get_interval.S b/libc/arch-x86_64/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..276feb1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_rr_get_interval)
+    movl    $__NR_sched_rr_get_interval, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_rr_get_interval)
diff --git a/libc/arch-x86_64/syscalls/sched_setaffinity.S b/libc/arch-x86_64/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..1fb87e5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setaffinity.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setaffinity)
+    movl    $__NR_sched_setaffinity, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_setaffinity)
diff --git a/libc/arch-x86_64/syscalls/sched_setparam.S b/libc/arch-x86_64/syscalls/sched_setparam.S
new file mode 100644
index 0000000..91ca83b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setparam.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setparam)
+    movl    $__NR_sched_setparam, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_setparam)
diff --git a/libc/arch-x86_64/syscalls/sched_setscheduler.S b/libc/arch-x86_64/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..7fa499a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setscheduler.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_setscheduler)
+    movl    $__NR_sched_setscheduler, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_setscheduler)
diff --git a/libc/arch-x86_64/syscalls/sched_yield.S b/libc/arch-x86_64/syscalls/sched_yield.S
new file mode 100644
index 0000000..8eb10f6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_yield.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sched_yield)
+    movl    $__NR_sched_yield, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sched_yield)
diff --git a/libc/arch-x86_64/syscalls/sendfile.S b/libc/arch-x86_64/syscalls/sendfile.S
new file mode 100644
index 0000000..c0fa4ee
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendfile.S
@@ -0,0 +1,18 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendfile)
+    movq    %rcx, %r10
+    movl    $__NR_sendfile, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sendfile)
+
+ALIAS_SYMBOL(sendfile64, sendfile)
diff --git a/libc/arch-x86_64/syscalls/sendmmsg.S b/libc/arch-x86_64/syscalls/sendmmsg.S
new file mode 100644
index 0000000..cf4a78d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendmmsg.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmmsg)
+    movq    %rcx, %r10
+    movl    $__NR_sendmmsg, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sendmmsg)
diff --git a/libc/arch-x86_64/syscalls/sendmsg.S b/libc/arch-x86_64/syscalls/sendmsg.S
new file mode 100644
index 0000000..84566b5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendmsg.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendmsg)
+    movl    $__NR_sendmsg, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sendmsg)
diff --git a/libc/arch-x86_64/syscalls/sendto.S b/libc/arch-x86_64/syscalls/sendto.S
new file mode 100644
index 0000000..be3bace
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendto.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sendto)
+    movq    %rcx, %r10
+    movl    $__NR_sendto, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sendto)
diff --git a/libc/arch-x86_64/syscalls/setdomainname.S b/libc/arch-x86_64/syscalls/setdomainname.S
new file mode 100644
index 0000000..40d1a33
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setdomainname.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setdomainname)
+    movl    $__NR_setdomainname, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setdomainname)
diff --git a/libc/arch-x86_64/syscalls/setfsgid.S b/libc/arch-x86_64/syscalls/setfsgid.S
new file mode 100644
index 0000000..22a36b2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setfsgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsgid)
+    movl    $__NR_setfsgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setfsgid)
diff --git a/libc/arch-x86_64/syscalls/setfsuid.S b/libc/arch-x86_64/syscalls/setfsuid.S
new file mode 100644
index 0000000..0bd0c97
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setfsuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setfsuid)
+    movl    $__NR_setfsuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setfsuid)
diff --git a/libc/arch-x86_64/syscalls/setgid.S b/libc/arch-x86_64/syscalls/setgid.S
new file mode 100644
index 0000000..650f8e2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgid)
+    movl    $__NR_setgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setgid)
diff --git a/libc/arch-x86_64/syscalls/setgroups.S b/libc/arch-x86_64/syscalls/setgroups.S
new file mode 100644
index 0000000..c798c14
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setgroups.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setgroups)
+    movl    $__NR_setgroups, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setgroups)
diff --git a/libc/arch-x86_64/syscalls/sethostname.S b/libc/arch-x86_64/syscalls/sethostname.S
new file mode 100644
index 0000000..4bcd12d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sethostname.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sethostname)
+    movl    $__NR_sethostname, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sethostname)
diff --git a/libc/arch-x86_64/syscalls/setitimer.S b/libc/arch-x86_64/syscalls/setitimer.S
new file mode 100644
index 0000000..c5fabb2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setitimer.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setitimer)
+    movl    $__NR_setitimer, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setitimer)
diff --git a/libc/arch-x86_64/syscalls/setns.S b/libc/arch-x86_64/syscalls/setns.S
new file mode 100644
index 0000000..c2ae97d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setns.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+    movl    $__NR_setns, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setns)
diff --git a/libc/arch-x86_64/syscalls/setpgid.S b/libc/arch-x86_64/syscalls/setpgid.S
new file mode 100644
index 0000000..4d4313c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setpgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpgid)
+    movl    $__NR_setpgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setpgid)
diff --git a/libc/arch-x86_64/syscalls/setpriority.S b/libc/arch-x86_64/syscalls/setpriority.S
new file mode 100644
index 0000000..3c508c3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setpriority.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setpriority)
+    movl    $__NR_setpriority, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setpriority)
diff --git a/libc/arch-x86_64/syscalls/setregid.S b/libc/arch-x86_64/syscalls/setregid.S
new file mode 100644
index 0000000..181a8b9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setregid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setregid)
+    movl    $__NR_setregid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setregid)
diff --git a/libc/arch-x86_64/syscalls/setresgid.S b/libc/arch-x86_64/syscalls/setresgid.S
new file mode 100644
index 0000000..fe44786
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setresgid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresgid)
+    movl    $__NR_setresgid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setresgid)
diff --git a/libc/arch-x86_64/syscalls/setresuid.S b/libc/arch-x86_64/syscalls/setresuid.S
new file mode 100644
index 0000000..58cd2ca
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setresuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setresuid)
+    movl    $__NR_setresuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setresuid)
diff --git a/libc/arch-x86_64/syscalls/setreuid.S b/libc/arch-x86_64/syscalls/setreuid.S
new file mode 100644
index 0000000..e25658b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setreuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setreuid)
+    movl    $__NR_setreuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setreuid)
diff --git a/libc/arch-x86_64/syscalls/setrlimit.S b/libc/arch-x86_64/syscalls/setrlimit.S
new file mode 100644
index 0000000..3843ff9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setrlimit.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setrlimit)
+    movl    $__NR_setrlimit, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setrlimit)
+
+ALIAS_SYMBOL(setrlimit64, setrlimit)
diff --git a/libc/arch-x86_64/syscalls/setsid.S b/libc/arch-x86_64/syscalls/setsid.S
new file mode 100644
index 0000000..01d9269
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setsid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsid)
+    movl    $__NR_setsid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setsid)
diff --git a/libc/arch-x86_64/syscalls/setsockopt.S b/libc/arch-x86_64/syscalls/setsockopt.S
new file mode 100644
index 0000000..629fdf0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setsockopt.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setsockopt)
+    movq    %rcx, %r10
+    movl    $__NR_setsockopt, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setsockopt)
diff --git a/libc/arch-x86_64/syscalls/settimeofday.S b/libc/arch-x86_64/syscalls/settimeofday.S
new file mode 100644
index 0000000..ac5b9b1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/settimeofday.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(settimeofday)
+    movl    $__NR_settimeofday, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(settimeofday)
diff --git a/libc/arch-x86_64/syscalls/setuid.S b/libc/arch-x86_64/syscalls/setuid.S
new file mode 100644
index 0000000..f335a76
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setuid.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setuid)
+    movl    $__NR_setuid, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setuid)
diff --git a/libc/arch-x86_64/syscalls/setxattr.S b/libc/arch-x86_64/syscalls/setxattr.S
new file mode 100644
index 0000000..d750423
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setxattr.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setxattr)
+    movq    %rcx, %r10
+    movl    $__NR_setxattr, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(setxattr)
diff --git a/libc/arch-x86_64/syscalls/shutdown.S b/libc/arch-x86_64/syscalls/shutdown.S
new file mode 100644
index 0000000..a030c97
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/shutdown.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(shutdown)
+    movl    $__NR_shutdown, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(shutdown)
diff --git a/libc/arch-x86_64/syscalls/sigaltstack.S b/libc/arch-x86_64/syscalls/sigaltstack.S
new file mode 100644
index 0000000..71ce537
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sigaltstack.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sigaltstack)
+    movl    $__NR_sigaltstack, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sigaltstack)
diff --git a/libc/arch-x86_64/syscalls/socketpair.S b/libc/arch-x86_64/syscalls/socketpair.S
new file mode 100644
index 0000000..dbcf50d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/socketpair.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(socketpair)
+    movq    %rcx, %r10
+    movl    $__NR_socketpair, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(socketpair)
diff --git a/libc/arch-x86_64/syscalls/splice.S b/libc/arch-x86_64/syscalls/splice.S
new file mode 100644
index 0000000..1b2ec84
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/splice.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(splice)
+    movq    %rcx, %r10
+    movl    $__NR_splice, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(splice)
diff --git a/libc/arch-x86_64/syscalls/swapoff.S b/libc/arch-x86_64/syscalls/swapoff.S
new file mode 100644
index 0000000..df922a0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/swapoff.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapoff)
+    movl    $__NR_swapoff, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(swapoff)
diff --git a/libc/arch-x86_64/syscalls/swapon.S b/libc/arch-x86_64/syscalls/swapon.S
new file mode 100644
index 0000000..036b422
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/swapon.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(swapon)
+    movl    $__NR_swapon, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(swapon)
diff --git a/libc/arch-x86_64/syscalls/symlinkat.S b/libc/arch-x86_64/syscalls/symlinkat.S
new file mode 100644
index 0000000..fdbced5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/symlinkat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(symlinkat)
+    movl    $__NR_symlinkat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(symlinkat)
diff --git a/libc/arch-x86_64/syscalls/sync.S b/libc/arch-x86_64/syscalls/sync.S
new file mode 100644
index 0000000..a4153fd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sync.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sync)
+    movl    $__NR_sync, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sync)
diff --git a/libc/arch-x86_64/syscalls/syncfs.S b/libc/arch-x86_64/syscalls/syncfs.S
new file mode 100644
index 0000000..12dee08
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/syncfs.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(syncfs)
+    movl    $__NR_syncfs, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(syncfs)
diff --git a/libc/arch-x86_64/syscalls/sysinfo.S b/libc/arch-x86_64/syscalls/sysinfo.S
new file mode 100644
index 0000000..754ef61
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sysinfo.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(sysinfo)
+    movl    $__NR_sysinfo, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(sysinfo)
diff --git a/libc/arch-x86_64/syscalls/tee.S b/libc/arch-x86_64/syscalls/tee.S
new file mode 100644
index 0000000..31d66dc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/tee.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tee)
+    movq    %rcx, %r10
+    movl    $__NR_tee, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(tee)
diff --git a/libc/arch-x86_64/syscalls/tgkill.S b/libc/arch-x86_64/syscalls/tgkill.S
new file mode 100644
index 0000000..9c46887
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/tgkill.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    movl    $__NR_tgkill, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(tgkill)
diff --git a/libc/arch-x86_64/syscalls/timerfd_create.S b/libc/arch-x86_64/syscalls/timerfd_create.S
new file mode 100644
index 0000000..56b45e8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_create.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_create)
+    movl    $__NR_timerfd_create, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(timerfd_create)
diff --git a/libc/arch-x86_64/syscalls/timerfd_gettime.S b/libc/arch-x86_64/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..8c9b5d6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_gettime.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_gettime)
+    movl    $__NR_timerfd_gettime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(timerfd_gettime)
diff --git a/libc/arch-x86_64/syscalls/timerfd_settime.S b/libc/arch-x86_64/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..a524c0c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_settime.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(timerfd_settime)
+    movq    %rcx, %r10
+    movl    $__NR_timerfd_settime, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(timerfd_settime)
diff --git a/libc/arch-x86_64/syscalls/times.S b/libc/arch-x86_64/syscalls/times.S
new file mode 100644
index 0000000..89502bd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/times.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(times)
+    movl    $__NR_times, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(times)
diff --git a/libc/arch-x86_64/syscalls/truncate.S b/libc/arch-x86_64/syscalls/truncate.S
new file mode 100644
index 0000000..4b953a3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/truncate.S
@@ -0,0 +1,17 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(truncate)
+    movl    $__NR_truncate, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(truncate)
+
+ALIAS_SYMBOL(truncate64, truncate)
diff --git a/libc/arch-x86_64/syscalls/umask.S b/libc/arch-x86_64/syscalls/umask.S
new file mode 100644
index 0000000..acd37e8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/umask.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umask)
+    movl    $__NR_umask, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(umask)
diff --git a/libc/arch-x86_64/syscalls/umount2.S b/libc/arch-x86_64/syscalls/umount2.S
new file mode 100644
index 0000000..438aedb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/umount2.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(umount2)
+    movl    $__NR_umount2, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(umount2)
diff --git a/libc/arch-x86_64/syscalls/uname.S b/libc/arch-x86_64/syscalls/uname.S
new file mode 100644
index 0000000..6f077df
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/uname.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(uname)
+    movl    $__NR_uname, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(uname)
diff --git a/libc/arch-x86_64/syscalls/unlinkat.S b/libc/arch-x86_64/syscalls/unlinkat.S
new file mode 100644
index 0000000..80f0251
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/unlinkat.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unlinkat)
+    movl    $__NR_unlinkat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(unlinkat)
diff --git a/libc/arch-x86_64/syscalls/unshare.S b/libc/arch-x86_64/syscalls/unshare.S
new file mode 100644
index 0000000..8316d20
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/unshare.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(unshare)
+    movl    $__NR_unshare, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(unshare)
diff --git a/libc/arch-x86_64/syscalls/utimensat.S b/libc/arch-x86_64/syscalls/utimensat.S
new file mode 100644
index 0000000..3e43826
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/utimensat.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(utimensat)
+    movq    %rcx, %r10
+    movl    $__NR_utimensat, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(utimensat)
diff --git a/libc/arch-x86_64/syscalls/vmsplice.S b/libc/arch-x86_64/syscalls/vmsplice.S
new file mode 100644
index 0000000..df775c6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/vmsplice.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(vmsplice)
+    movq    %rcx, %r10
+    movl    $__NR_vmsplice, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(vmsplice)
diff --git a/libc/arch-x86_64/syscalls/wait4.S b/libc/arch-x86_64/syscalls/wait4.S
new file mode 100644
index 0000000..d392dc7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/wait4.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(wait4)
+    movq    %rcx, %r10
+    movl    $__NR_wait4, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(wait4)
diff --git a/libc/arch-x86_64/syscalls/write.S b/libc/arch-x86_64/syscalls/write.S
new file mode 100644
index 0000000..145c793
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/write.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(write)
+    movl    $__NR_write, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(write)
diff --git a/libc/arch-x86_64/syscalls/writev.S b/libc/arch-x86_64/syscalls/writev.S
new file mode 100644
index 0000000..8f8956f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/writev.S
@@ -0,0 +1,15 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(writev)
+    movl    $__NR_writev, %eax
+    syscall
+    cmpq    $-MAX_ERRNO, %rax
+    jb      1f
+    negl    %eax
+    movl    %eax, %edi
+    call    __set_errno_internal
+1:
+    ret
+END(writev)
diff --git a/libc/async_safe/Android.bp b/libc/async_safe/Android.bp
index c28d53a..fbaaad1 100644
--- a/libc/async_safe/Android.bp
+++ b/libc/async_safe/Android.bp
@@ -10,7 +10,6 @@
     name: "libasync_safe",
     vendor_available: true,
     recovery_available: true,
-    native_bridge_supported: true,
 
     include_dirs: ["bionic/libc"],
     header_libs: ["libc_headers", "liblog_headers"],
@@ -23,7 +22,6 @@
 cc_library_headers {
     name: "libasync_safe_headers",
     recovery_available: true,
-    native_bridge_supported: true,
     defaults: ["linux_bionic_supported"],
 
     export_include_dirs: ["include"],
diff --git a/libc/bionic/NetdClient.cpp b/libc/bionic/NetdClient.cpp
index d9debbf..87eec27 100644
--- a/libc/bionic/NetdClient.cpp
+++ b/libc/bionic/NetdClient.cpp
@@ -31,7 +31,7 @@
 static void netdClientInitFunction(void* handle, const char* symbol, FunctionType* function) {
     typedef void (*InitFunctionType)(FunctionType*);
     InitFunctionType initFunction = reinterpret_cast<InitFunctionType>(dlsym(handle, symbol));
-    if (initFunction != nullptr) {
+    if (initFunction != NULL) {
         initFunction(function);
     }
 }
@@ -45,23 +45,20 @@
         return;
     }
 
-    void* handle = dlopen("libnetd_client.so", RTLD_NOW);
-    if (handle == nullptr) {
+    void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW);
+    if (netdClientHandle == NULL) {
         // If the library is not available, it's not an error. We'll just use
         // default implementations of functions that it would've overridden.
         return;
     }
-
-    netdClientInitFunction(handle, "netdClientInitAccept4", &__netdClientDispatch.accept4);
-    netdClientInitFunction(handle, "netdClientInitConnect", &__netdClientDispatch.connect);
-    netdClientInitFunction(handle, "netdClientInitSendmmsg", &__netdClientDispatch.sendmmsg);
-    netdClientInitFunction(handle, "netdClientInitSendmsg", &__netdClientDispatch.sendmsg);
-    netdClientInitFunction(handle, "netdClientInitSendto", &__netdClientDispatch.sendto);
-    netdClientInitFunction(handle, "netdClientInitSocket", &__netdClientDispatch.socket);
-
-    netdClientInitFunction(handle, "netdClientInitNetIdForResolv",
+    netdClientInitFunction(netdClientHandle, "netdClientInitAccept4",
+                           &__netdClientDispatch.accept4);
+    netdClientInitFunction(netdClientHandle, "netdClientInitConnect",
+                           &__netdClientDispatch.connect);
+    netdClientInitFunction(netdClientHandle, "netdClientInitNetIdForResolv",
                            &__netdClientDispatch.netIdForResolv);
-    netdClientInitFunction(handle, "netdClientInitDnsOpenProxy",
+    netdClientInitFunction(netdClientHandle, "netdClientInitSocket", &__netdClientDispatch.socket);
+    netdClientInitFunction(netdClientHandle, "netdClientInitDnsOpenProxy",
                            &__netdClientDispatch.dnsOpenProxy);
 }
 
diff --git a/libc/bionic/NetdClientDispatch.cpp b/libc/bionic/NetdClientDispatch.cpp
index 463ef36..a873173 100644
--- a/libc/bionic/NetdClientDispatch.cpp
+++ b/libc/bionic/NetdClientDispatch.cpp
@@ -16,8 +16,6 @@
 
 #include "private/NetdClientDispatch.h"
 
-#include <sys/socket.h>
-
 #ifdef __i386__
 #define __socketcall __attribute__((__cdecl__))
 #else
@@ -26,9 +24,6 @@
 
 extern "C" __socketcall int __accept4(int, sockaddr*, socklen_t*, int);
 extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
-extern "C" __socketcall int __sendmmsg(int, const mmsghdr*, unsigned int, int);
-extern "C" __socketcall ssize_t __sendmsg(int, const msghdr*, unsigned int);
-extern "C" __socketcall int __sendto(int, const void*, size_t, int, const sockaddr*, socklen_t);
 extern "C" __socketcall int __socket(int, int, int);
 
 static unsigned fallBackNetIdForResolv(unsigned netId) {
@@ -44,35 +39,7 @@
 __LIBC_HIDDEN__ NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
     __accept4,
     __connect,
-    __sendmmsg,
-    __sendmsg,
-    __sendto,
     __socket,
     fallBackNetIdForResolv,
     fallBackDnsOpenProxy,
 };
-
-int accept4(int fd, sockaddr* addr, socklen_t* addr_length, int flags) {
-    return __netdClientDispatch.accept4(fd, addr, addr_length, flags);
-}
-
-int connect(int fd, const sockaddr* addr, socklen_t addr_length) {
-    return __netdClientDispatch.connect(fd, addr, addr_length);
-}
-
-int sendmmsg(int fd, const struct mmsghdr* msgs, unsigned int msg_count, int flags) {
-    return __netdClientDispatch.sendmmsg(fd, msgs, msg_count, flags);
-}
-
-ssize_t sendmsg(int fd, const struct msghdr* msg, int flags) {
-    return __netdClientDispatch.sendmsg(fd, msg, flags);
-}
-
-ssize_t sendto(int fd, const void* buf, size_t n, int flags,
-               const struct sockaddr* dst_addr, socklen_t dst_addr_length) {
-    return __netdClientDispatch.sendto(fd, buf, n, flags, dst_addr, dst_addr_length);
-}
-
-int socket(int domain, int type, int protocol) {
-    return __netdClientDispatch.socket(domain, type, protocol);
-}
diff --git a/libc/bionic/__cxa_guard.cpp b/libc/bionic/__cxa_guard.cpp
index e2e7477..30b5f41 100644
--- a/libc/bionic/__cxa_guard.cpp
+++ b/libc/bionic/__cxa_guard.cpp
@@ -16,7 +16,9 @@
 
 #include <endian.h>
 #include <limits.h>
+#undef _USING_LIBCXX  // Prevent using of <atomic>.
 #include <stdatomic.h>
+
 #include <stddef.h>
 
 #include "private/bionic_futex.h"
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
index 94cf1f8..4984e38 100644
--- a/libc/bionic/__libc_init_main_thread.cpp
+++ b/libc/bionic/__libc_init_main_thread.cpp
@@ -57,9 +57,7 @@
 //
 // This is in a file by itself because it needs to be built with
 // -fno-stack-protector because it's responsible for setting up the main
-// thread's TLS (which stack protector relies on). It's also built with
-// -ffreestanding because the early init function runs in the linker before
-// ifunc resolvers have run.
+// thread's TLS (which stack protector relies on).
 
 // Do enough setup to:
 //  - Let the dynamic linker invoke system calls (and access errno)
@@ -67,8 +65,7 @@
 //  - Allow the stack protector to work (with a zero cookie)
 // Avoid doing much more because, when this code is called within the dynamic
 // linker, the linker binary hasn't been relocated yet, so certain kinds of code
-// are hazardous, such as accessing non-hidden global variables or calling
-// string.h functions.
+// are hazardous, such as accessing non-hidden global variables.
 __BIONIC_WEAK_FOR_NATIVE_BRIDGE
 extern "C" void __libc_init_main_thread_early(const KernelArgumentBlock& args,
                                               bionic_tcb* temp_tcb) {
@@ -83,23 +80,6 @@
   main_thread.set_cached_pid(main_thread.tid);
 }
 
-// This code is used both by each new pthread and the code that initializes the main thread.
-void __init_tcb(bionic_tcb* tcb, pthread_internal_t* thread) {
-#ifdef TLS_SLOT_SELF
-  // On x86, slot 0 must point to itself so code can read the thread pointer by
-  // loading %fs:0 or %gs:0.
-  tcb->tls_slot(TLS_SLOT_SELF) = &tcb->tls_slot(TLS_SLOT_SELF);
-#endif
-  tcb->tls_slot(TLS_SLOT_THREAD_ID) = thread;
-}
-
-void __init_tcb_dtv(bionic_tcb* tcb) {
-  // Initialize the DTV slot to a statically-allocated empty DTV. The first
-  // access to a dynamic TLS variable allocates a new DTV.
-  static const TlsDtv zero_dtv = {};
-  __set_tcb_dtv(tcb, const_cast<TlsDtv*>(&zero_dtv));
-}
-
 // Finish initializing the main thread.
 __BIONIC_WEAK_FOR_NATIVE_BRIDGE
 extern "C" void __libc_init_main_thread_late() {
@@ -155,11 +135,8 @@
 
   main_thread.mmap_base = mapping.mmap_base;
   main_thread.mmap_size = mapping.mmap_size;
-  main_thread.mmap_base_unguarded = mapping.mmap_base_unguarded;
-  main_thread.mmap_size_unguarded = mapping.mmap_size_unguarded;
 
   __set_tls(&new_tcb->tls_slot(0));
 
-  __set_stack_and_tls_vma_name(true);
   __free_temp_bionic_tls(temp_tls);
 }
diff --git a/libc/bionic/accept4.cpp b/libc/bionic/accept4.cpp
new file mode 100644
index 0000000..9f58dc1
--- /dev/null
+++ b/libc/bionic/accept4.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "private/NetdClientDispatch.h"
+
+#include <sys/socket.h>
+
+int accept4(int sockfd, sockaddr* addr, socklen_t* addrlen, int flags) {
+    return __netdClientDispatch.accept4(sockfd, addr, addrlen, flags);
+}
diff --git a/libc/bionic/bionic_allocator.cpp b/libc/bionic/bionic_allocator.cpp
index 168d6ba..da0f7d0 100644
--- a/libc/bionic/bionic_allocator.cpp
+++ b/libc/bionic/bionic_allocator.cpp
@@ -45,11 +45,11 @@
 
 //
 // BionicAllocator is a general purpose allocator designed to provide the same
-// functionality as the malloc/free/realloc/memalign libc functions.
+// functionality as the malloc/free/realloc libc functions.
 //
 // On alloc:
-// If size is > 1k allocator proxies malloc call directly to mmap.
-// If size <= 1k allocator uses BionicSmallObjectAllocator for the size
+// If size is >= 1k allocator proxies malloc call directly to mmap
+// If size < 1k allocator uses SmallObjectAllocator for the size
 // rounded up to the nearest power of two.
 //
 // On free:
@@ -57,10 +57,10 @@
 // For a pointer allocated using proxy-to-mmap allocator unmaps
 // the memory.
 //
-// For a pointer allocated using BionicSmallObjectAllocator it adds
+// For a pointer allocated using SmallObjectAllocator it adds
 // the block to free_blocks_list in the corresponding page. If the number of
-// free pages reaches 2, BionicSmallObjectAllocator munmaps one of the pages
-// keeping the other one in reserve.
+// free pages reaches 2, SmallObjectAllocator munmaps one of the pages keeping
+// the other one in reserve.
 
 // Memory management for large objects is fairly straightforward, but for small
 // objects it is more complicated.  If you are changing this code, one simple
diff --git a/libc/bionic/bionic_call_ifunc_resolver.cpp b/libc/bionic/bionic_call_ifunc_resolver.cpp
deleted file mode 100644
index 437de78..0000000
--- a/libc/bionic/bionic_call_ifunc_resolver.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2019 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_call_ifunc_resolver.h"
-#include <sys/auxv.h>
-#include <sys/ifunc.h>
-
-#include "private/bionic_auxv.h"
-
-// This code is called in the linker before it has been relocated, so minimize calls into other
-// parts of Bionic. In particular, we won't ever have two ifunc resolvers called concurrently, so
-// initializing the ifunc resolver argument doesn't need to be thread-safe.
-
-ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr) {
-#if defined(__aarch64__)
-  typedef ElfW(Addr) (*ifunc_resolver_t)(uint64_t, __ifunc_arg_t*);
-  static __ifunc_arg_t arg;
-  static bool initialized = false;
-  if (!initialized) {
-    initialized = true;
-    arg._size = sizeof(__ifunc_arg_t);
-    arg._hwcap = getauxval(AT_HWCAP);
-    arg._hwcap2 = getauxval(AT_HWCAP2);
-  }
-  return reinterpret_cast<ifunc_resolver_t>(resolver_addr)(arg._hwcap | _IFUNC_ARG_HWCAP, &arg);
-#elif defined(__arm__)
-  typedef ElfW(Addr) (*ifunc_resolver_t)(unsigned long);
-  static unsigned long hwcap;
-  static bool initialized = false;
-  if (!initialized) {
-    initialized = true;
-    hwcap = getauxval(AT_HWCAP);
-  }
-  return reinterpret_cast<ifunc_resolver_t>(resolver_addr)(hwcap);
-#else
-  typedef ElfW(Addr) (*ifunc_resolver_t)(void);
-  return reinterpret_cast<ifunc_resolver_t>(resolver_addr)();
-#endif
-}
diff --git a/libc/bionic/bionic_netlink.cpp b/libc/bionic/bionic_netlink.cpp
index 5d5a026..f2449dc 100644
--- a/libc/bionic/bionic_netlink.cpp
+++ b/libc/bionic/bionic_netlink.cpp
@@ -39,6 +39,8 @@
 #include "private/ErrnoRestorer.h"
 
 NetlinkConnection::NetlinkConnection() {
+  fd_ = -1;
+
   // The kernel keeps packets under 8KiB (NLMSG_GOODSIZE),
   // but that's a bit too large to go on the stack.
   size_ = 8192;
@@ -46,6 +48,8 @@
 }
 
 NetlinkConnection::~NetlinkConnection() {
+  ErrnoRestorer errno_restorer;
+  if (fd_ != -1) close(fd_);
   delete[] data_;
 }
 
@@ -55,9 +59,9 @@
   if (data_ == nullptr) return false;
 
   // Did we open a netlink socket yet?
-  if (fd_.get() == -1) {
-    fd_.reset(socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE));
-    if (fd_.get() == -1) return false;
+  if (fd_ == -1) {
+    fd_ = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
+    if (fd_ == -1) return false;
   }
 
   // Construct and send the message.
@@ -70,13 +74,13 @@
   request.hdr.nlmsg_type = type;
   request.hdr.nlmsg_len = sizeof(request);
   request.msg.rtgen_family = AF_UNSPEC; // All families.
-  return (TEMP_FAILURE_RETRY(send(fd_.get(), &request, sizeof(request), 0)) == sizeof(request));
+  return (TEMP_FAILURE_RETRY(send(fd_, &request, sizeof(request), 0)) == sizeof(request));
 }
 
 bool NetlinkConnection::ReadResponses(void callback(void*, nlmsghdr*), void* context) {
   // Read through all the responses, handing interesting ones to the callback.
   ssize_t bytes_read;
-  while ((bytes_read = TEMP_FAILURE_RETRY(recv(fd_.get(), data_, size_, 0))) > 0) {
+  while ((bytes_read = TEMP_FAILURE_RETRY(recv(fd_, data_, size_, 0))) > 0) {
     nlmsghdr* hdr = reinterpret_cast<nlmsghdr*>(data_);
     for (; NLMSG_OK(hdr, static_cast<size_t>(bytes_read)); hdr = NLMSG_NEXT(hdr, bytes_read)) {
       if (hdr->nlmsg_type == NLMSG_DONE) return true;
diff --git a/libc/bionic/bionic_netlink.h b/libc/bionic/bionic_netlink.h
index fc1bd0f..a21200e 100644
--- a/libc/bionic/bionic_netlink.h
+++ b/libc/bionic/bionic_netlink.h
@@ -33,8 +33,6 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "private/ScopedFd.h"
-
 struct nlmsghdr;
 
 class NetlinkConnection {
@@ -46,7 +44,7 @@
   bool ReadResponses(void callback(void*, nlmsghdr*), void* context);
 
  private:
-  ScopedFd fd_;
+  int fd_;
   char* data_;
   size_t size_;
 };
diff --git a/libc/bionic/bionic_systrace.cpp b/libc/bionic/bionic_systrace.cpp
index 1140d2d..6182ed8 100644
--- a/libc/bionic/bionic_systrace.cpp
+++ b/libc/bionic/bionic_systrace.cpp
@@ -24,7 +24,6 @@
 #include "private/bionic_systrace.h"
 #include "private/CachedProperty.h"
 
-#include <async_safe/log.h>
 #include <cutils/trace.h> // For ATRACE_TAG_BIONIC.
 
 #define WRITE_OFFSET   32
@@ -66,7 +65,7 @@
   // kernel trace_marker.
   int length = strlen(message);
   char buf[length + WRITE_OFFSET];
-  size_t len = async_safe_format_buffer(buf, length + WRITE_OFFSET, "B|%d|%s", getpid(), message);
+  size_t len = snprintf(buf, length + WRITE_OFFSET, "B|%d|%s", getpid(), message);
 
   // Tracing may stop just after checking property and before writing the message.
   // So the write is acceptable to fail. See b/20666100.
diff --git a/libc/bionic/clock_nanosleep.cpp b/libc/bionic/clock_nanosleep.cpp
index 6f77d83..eade850 100644
--- a/libc/bionic/clock_nanosleep.cpp
+++ b/libc/bionic/clock_nanosleep.cpp
@@ -30,11 +30,11 @@
 
 #include "private/ErrnoRestorer.h"
 
-extern "C" int __clock_nanosleep(clockid_t, int, const timespec*, timespec*);
+extern "C" int ___clock_nanosleep(clockid_t, int, const timespec*, timespec*);
 
 int clock_nanosleep(clockid_t clock_id, int flags, const timespec* in, timespec* out) {
   if (clock_id == CLOCK_THREAD_CPUTIME_ID) return EINVAL;
 
   ErrnoRestorer errno_restorer;
-  return (__clock_nanosleep(clock_id, flags, in, out) == 0) ? 0 : errno;
+  return (___clock_nanosleep(clock_id, flags, in, out) == 0) ? 0 : errno;
 }
diff --git a/libc/bionic/connect.cpp b/libc/bionic/connect.cpp
new file mode 100644
index 0000000..1673f4a
--- /dev/null
+++ b/libc/bionic/connect.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "private/NetdClientDispatch.h"
+
+#include <sys/socket.h>
+
+int connect(int sockfd, const sockaddr* addr, socklen_t addrlen) {
+    return __netdClientDispatch.connect(sockfd, addr, addrlen);
+}
diff --git a/libc/bionic/ctype.cpp b/libc/bionic/ctype.cpp
index ba8afca..2b31d52 100644
--- a/libc/bionic/ctype.cpp
+++ b/libc/bionic/ctype.cpp
@@ -28,146 +28,58 @@
 
 #include <ctype.h>
 
-static inline int __in_range(int c, char lo, char hi) {
-  return c >= lo && c <= hi;
-}
-
-int isalnum(int c) {
-  // `isalnum(c)` is `isalpha(c) || isdigit(c)`, but there's no obvious way
-  // to simplify that, and the table lookup is just slightly faster...
-  // Note that this is unsafe for inputs less than -1 (EOF) or greater than
-  // 0xff. This is true of other C libraries too.
-  return (_ctype_[c + 1] & (_CTYPE_U|_CTYPE_L|_CTYPE_N));
-}
-
 int isalnum_l(int c, locale_t) {
   return isalnum(c);
 }
 
-int isalpha(int c) {
-  return __in_range(c, 'A', 'Z') || __in_range(c, 'a', 'z');
-}
-
 int isalpha_l(int c, locale_t) {
   return isalpha(c);
 }
 
-int isascii(int c) {
-  return static_cast<unsigned>(c) < 0x80;
-}
-
-int isblank(int c) {
-  return c == ' ' || c == '\t';
-}
-
 int isblank_l(int c, locale_t) {
   return isblank(c);
 }
 
-int iscntrl(int c) {
-  return (static_cast<unsigned>(c) < ' ') || c == 0x7f;
-}
-
 int iscntrl_l(int c, locale_t) {
   return iscntrl(c);
 }
 
-int isdigit(int c) {
-  return __in_range(c, '0', '9');
-}
-
 int isdigit_l(int c, locale_t) {
   return isdigit(c);
 }
 
-int isgraph(int c) {
-  return __in_range(c, '!', '~');
-}
-
 int isgraph_l(int c, locale_t) {
   return isgraph(c);
 }
 
-int islower(int c) {
-  return __in_range(c, 'a', 'z');
-}
-
 int islower_l(int c, locale_t) {
   return islower(c);
 }
 
-int isprint(int c) {
-  return __in_range(c, ' ', '~');
-}
-
 int isprint_l(int c, locale_t) {
   return isprint(c);
 }
 
-int ispunct(int c) {
-  // `ispunct(c)` is `isgraph(c) && !isalnum(c)`, but there's no obvious way
-  // to simplify that, and the table lookup is just slightly faster...
-  // Note that this is unsafe for inputs less than -1 (EOF) or greater than
-  // 0xff. This is true of other C libraries too.
-  return (_ctype_[c + 1] & _CTYPE_P);
-}
-
 int ispunct_l(int c, locale_t) {
   return ispunct(c);
 }
 
-int isspace(int c) {
-  return c == ' ' || __in_range(c, '\t', '\r');
-}
-
 int isspace_l(int c, locale_t) {
   return isspace(c);
 }
 
-int isupper(int c) {
-  return __in_range(c, 'A', 'Z');
-}
-
 int isupper_l(int c, locale_t) {
   return isupper(c);
 }
 
-int isxdigit(int c) {
-  return __in_range(c, '0', '9') || __in_range(c, 'a', 'f') || __in_range(c, 'A', 'F');
-}
-
 int isxdigit_l(int c, locale_t) {
   return isxdigit(c);
 }
 
-int toascii(int c) {
-  return c & 0x7f;
-}
-
-int _toupper(int c) {
-  // Using EOR rather than AND makes no difference on arm, but saves an
-  // instruction on arm64.
-  return c ^ 0x20;
-}
-
-int toupper(int c) {
-  if (c >= 'a' && c <= 'z') return _toupper(c);
-  return c;
-}
-
 int toupper_l(int c, locale_t) {
   return toupper(c);
 }
 
-int _tolower(int c) {
-  return c | 0x20;
-}
-
-int tolower(int c) {
-  if (c >= 'A' && c <= 'Z') return _tolower(c);
-  return c;
-}
-
 int tolower_l(int c, locale_t) {
   return tolower(c);
 }
diff --git a/libc/bionic/dl_iterate_phdr_static.cpp b/libc/bionic/dl_iterate_phdr_static.cpp
index 7b44810..bbce1fc 100644
--- a/libc/bionic/dl_iterate_phdr_static.cpp
+++ b/libc/bionic/dl_iterate_phdr_static.cpp
@@ -32,10 +32,6 @@
 #include <sys/types.h>
 #include <link.h>
 
-#include "private/bionic_elf_tls.h"
-#include "private/bionic_globals.h"
-#include "pthread_internal.h"
-
 /* ld provides this to us in the default link script */
 extern "C" void* __executable_start;
 
@@ -56,21 +52,6 @@
   exe_info.dlpi_name = NULL;
   exe_info.dlpi_phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<uintptr_t>(ehdr) + ehdr->e_phoff);
   exe_info.dlpi_phnum = ehdr->e_phnum;
-  exe_info.dlpi_adds = 0;
-  exe_info.dlpi_subs = 0;
-
-  const TlsModules& tls_modules = __libc_shared_globals()->tls_modules;
-  if (tls_modules.module_count == 0) {
-    exe_info.dlpi_tls_modid = 0;
-    exe_info.dlpi_tls_data = nullptr;
-  } else {
-    const size_t kExeModuleId = 1;
-    const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
-    const TlsModule& tls_module = tls_modules.module_table[__tls_module_id_to_idx(kExeModuleId)];
-    char* static_tls = reinterpret_cast<char*>(__get_bionic_tcb()) - layout.offset_bionic_tcb();
-    exe_info.dlpi_tls_modid = kExeModuleId;
-    exe_info.dlpi_tls_data = static_tls + tls_module.static_offset;
-  }
 
   // Try the executable first.
   int rc = cb(&exe_info, sizeof(exe_info), data);
@@ -90,10 +71,6 @@
   vdso_info.dlpi_name = NULL;
   vdso_info.dlpi_phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff);
   vdso_info.dlpi_phnum = ehdr_vdso->e_phnum;
-  vdso_info.dlpi_adds = 0;
-  vdso_info.dlpi_subs = 0;
-  vdso_info.dlpi_tls_modid = 0;
-  vdso_info.dlpi_tls_data = nullptr;
   for (size_t i = 0; i < vdso_info.dlpi_phnum; ++i) {
     if (vdso_info.dlpi_phdr[i].p_type == PT_LOAD) {
       vdso_info.dlpi_addr = (ElfW(Addr)) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr;
diff --git a/libc/bionic/faccessat.cpp b/libc/bionic/faccessat.cpp
index bfaec51..a86aeb2 100644
--- a/libc/bionic/faccessat.cpp
+++ b/libc/bionic/faccessat.cpp
@@ -30,7 +30,7 @@
 #include <unistd.h>
 #include <errno.h>
 
-extern "C" int __faccessat(int, const char*, int);
+extern "C" int ___faccessat(int, const char*, int);
 
 int faccessat(int dirfd, const char* pathname, int mode, int flags) {
   // "The mode specifies the accessibility check(s) to be performed,
@@ -56,5 +56,5 @@
     return -1;
   }
 
-  return __faccessat(dirfd, pathname, mode);
+  return ___faccessat(dirfd, pathname, mode);
 }
diff --git a/libc/bionic/fchmod.cpp b/libc/bionic/fchmod.cpp
index 0326fc2..a486aae 100644
--- a/libc/bionic/fchmod.cpp
+++ b/libc/bionic/fchmod.cpp
@@ -35,11 +35,11 @@
 
 #include "private/FdPath.h"
 
-extern "C" int __fchmod(int, mode_t);
+extern "C" int ___fchmod(int, mode_t);
 
 int fchmod(int fd, mode_t mode) {
   int saved_errno = errno;
-  int result = __fchmod(fd, mode);
+  int result = ___fchmod(fd, mode);
   if (result == 0 || errno != EBADF) {
     return result;
   }
diff --git a/libc/bionic/fchmodat.cpp b/libc/bionic/fchmodat.cpp
index 632d2ac..1f83c4b 100644
--- a/libc/bionic/fchmodat.cpp
+++ b/libc/bionic/fchmodat.cpp
@@ -32,9 +32,9 @@
 #include <errno.h>
 #include <unistd.h>
 
-#include "private/ScopedFd.h"
+#include "private/ErrnoRestorer.h"
 
-extern "C" int __fchmodat(int, const char*, mode_t);
+extern "C" int ___fchmodat(int, const char*, mode_t);
 
 int fchmodat(int dirfd, const char* pathname, mode_t mode, int flags) {
   if ((flags & ~AT_SYMLINK_NOFOLLOW) != 0) {
@@ -47,16 +47,21 @@
     // at https://sourceware.org/bugzilla/show_bug.cgi?id=14578
     // comment #10
 
-    ScopedFd fd(openat(dirfd, pathname, O_PATH | O_NOFOLLOW | O_CLOEXEC));
-    if (fd.get() == -1) return -1;
+    int fd = openat(dirfd, pathname, O_PATH | O_NOFOLLOW | O_CLOEXEC);
+    if (fd == -1) {
+      return -1; // returns errno from openat
+    }
 
     // POSIX requires that ENOTSUP be returned when the system
     // doesn't support setting the mode of a symbolic link.
     // This is true for all Linux kernels.
     // We rely on the O_PATH compatibility layer added in the
     // fchmod() function to get errno correct.
-    return fchmod(fd.get(), mode);
+    int result = fchmod(fd, mode);
+    ErrnoRestorer errno_restorer; // don't let close() clobber errno
+    close(fd);
+    return result;
   }
 
-  return __fchmodat(dirfd, pathname, mode);
+  return ___fchmodat(dirfd, pathname, mode);
 }
diff --git a/libc/bionic/fdsan.cpp b/libc/bionic/fdsan.cpp
index 4ebc796..6440ae0 100644
--- a/libc/bionic/fdsan.cpp
+++ b/libc/bionic/fdsan.cpp
@@ -46,7 +46,7 @@
 #include "private/bionic_inline_raise.h"
 #include "pthread_internal.h"
 
-extern "C" int __close(int fd);
+extern "C" int ___close(int fd);
 pid_t __get_cached_pid();
 
 static constexpr const char* kFdsanPropertyName = "debug.fdsan";
@@ -106,8 +106,30 @@
 }
 
 void __libc_init_fdsan() {
-  constexpr auto default_level = ANDROID_FDSAN_ERROR_LEVEL_FATAL;
-  android_fdsan_set_error_level_from_property(default_level);
+  constexpr auto default_level = ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE;
+  const prop_info* pi = __system_property_find(kFdsanPropertyName);
+  if (!pi) {
+    android_fdsan_set_error_level(default_level);
+    return;
+  }
+  __system_property_read_callback(
+      pi,
+      [](void*, const char*, const char* value, uint32_t) {
+        if (strcasecmp(value, "1") == 0 || strcasecmp(value, "fatal") == 0) {
+          android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_FATAL);
+        } else if (strcasecmp(value, "warn") == 0) {
+          android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS);
+        } else if (strcasecmp(value, "warn_once") == 0) {
+          android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE);
+        } else {
+          if (strlen(value) != 0 && strcasecmp(value, "0") != 0) {
+            async_safe_format_log(ANDROID_LOG_ERROR, "libc",
+                                  "debug.fdsan set to unknown value '%s', disabling", value);
+          }
+          android_fdsan_set_error_level(default_level);
+        }
+      },
+      nullptr);
 }
 
 static FdTable& GetFdTable() {
@@ -247,7 +269,7 @@
 int android_fdsan_close_with_tag(int fd, uint64_t expected_tag) {
   FdEntry* fde = GetFdEntry(fd);
   if (!fde) {
-    return __close(fd);
+    return ___close(fd);
   }
 
   uint64_t tag = expected_tag;
@@ -277,7 +299,7 @@
     }
   }
 
-  int rc = __close(fd);
+  int rc = ___close(fd);
   // If we were expecting to close with a tag, abort on EBADF.
   if (expected_tag && rc == -1 && errno == EBADF) {
     fdsan_error("double-close of file descriptor %d detected", fd);
@@ -333,45 +355,6 @@
   return atomic_exchange(&GetFdTable().error_level, new_level);
 }
 
-android_fdsan_error_level android_fdsan_set_error_level_from_property(
-    android_fdsan_error_level default_level) {
-  const prop_info* pi = __system_property_find(kFdsanPropertyName);
-  if (!pi) {
-    return android_fdsan_set_error_level(default_level);
-  }
-
-  struct callback_data {
-    android_fdsan_error_level default_value;
-    android_fdsan_error_level result;
-  };
-
-  callback_data data;
-  data.default_value = default_level;
-
-  __system_property_read_callback(
-      pi,
-      [](void* arg, const char*, const char* value, uint32_t) {
-        callback_data* data = static_cast<callback_data*>(arg);
-
-        if (strcasecmp(value, "1") == 0 || strcasecmp(value, "fatal") == 0) {
-          data->result = android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_FATAL);
-        } else if (strcasecmp(value, "warn") == 0) {
-          data->result = android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS);
-        } else if (strcasecmp(value, "warn_once") == 0) {
-          data->result = android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE);
-        } else {
-          if (strlen(value) != 0 && strcasecmp(value, "0") != 0) {
-            async_safe_format_log(ANDROID_LOG_ERROR, "libc",
-                                  "debug.fdsan set to unknown value '%s', disabling", value);
-          }
-          data->result = android_fdsan_set_error_level(data->default_value);
-        }
-      },
-      &data);
-
-  return data.result;
-}
-
 int close(int fd) {
   int rc = android_fdsan_close_with_tag(fd, 0);
   if (rc == -1 && errno == EINTR) {
diff --git a/libc/bionic/fgetxattr.cpp b/libc/bionic/fgetxattr.cpp
index c753235..38b7ac3 100644
--- a/libc/bionic/fgetxattr.cpp
+++ b/libc/bionic/fgetxattr.cpp
@@ -35,11 +35,11 @@
 
 #include "private/FdPath.h"
 
-extern "C" ssize_t __fgetxattr(int, const char*, void*, size_t);
+extern "C" ssize_t ___fgetxattr(int, const char*, void*, size_t);
 
 ssize_t fgetxattr(int fd, const char *name, void *value, size_t size) {
   int saved_errno = errno;
-  ssize_t result = __fgetxattr(fd, name, value, size);
+  ssize_t result = ___fgetxattr(fd, name, value, size);
 
   if (result != -1 || errno != EBADF) {
     return result;
diff --git a/libc/bionic/flistxattr.cpp b/libc/bionic/flistxattr.cpp
index 3bad383..8ad9b85 100644
--- a/libc/bionic/flistxattr.cpp
+++ b/libc/bionic/flistxattr.cpp
@@ -35,11 +35,11 @@
 
 #include "private/FdPath.h"
 
-extern "C" ssize_t __flistxattr(int, char*, size_t);
+extern "C" ssize_t ___flistxattr(int, char*, size_t);
 
 ssize_t flistxattr(int fd, char *list, size_t size) {
   int saved_errno = errno;
-  ssize_t result = __flistxattr(fd, list, size);
+  ssize_t result = ___flistxattr(fd, list, size);
   if (result != -1 || errno != EBADF) {
     return result;
   }
diff --git a/libc/bionic/fork.cpp b/libc/bionic/fork.cpp
index cda5e85..fc00207 100644
--- a/libc/bionic/fork.cpp
+++ b/libc/bionic/fork.cpp
@@ -55,10 +55,6 @@
     // fork, close all of their fds blindly, and then exec.
     android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
 
-    // Reset the stack_and_tls VMA name so it doesn't end with a tid from the
-    // parent process.
-    __set_stack_and_tls_vma_name(true);
-
     __bionic_atfork_run_child();
   } else {
     __bionic_atfork_run_parent();
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 3b804b0..20e265e 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -249,7 +249,7 @@
 // This is a variant of __stpncpy_chk, but it also checks to make
 // sure we don't read beyond the end of "src". The code for this is
 // based on the original version of stpncpy, but modified to check
-// how much we read from "src" during the copy operation.
+// how much we read from "src" at the end of the copy operation.
 char* __stpncpy_chk2(char* dst, const char* src, size_t n, size_t dst_len, size_t src_len) {
   __check_buffer_access("stpncpy", "write into", n, dst_len);
   if (n != 0) {
@@ -257,11 +257,6 @@
     const char* s = src;
 
     do {
-      size_t s_copy_len = static_cast<size_t>(s - src);
-      if (__predict_false(s_copy_len >= src_len)) {
-        __fortify_fatal("stpncpy: detected read past end of %zu-byte buffer", src_len);
-      }
-
       if ((*d++ = *s++) == 0) {
         // NUL pad the remaining n-1 bytes.
         while (--n != 0) {
@@ -270,6 +265,11 @@
         break;
       }
     } while (--n != 0);
+
+    size_t s_copy_len = static_cast<size_t>(s - src);
+    if (__predict_false(s_copy_len > src_len)) {
+      __fortify_fatal("stpncpy: detected read past end of %zu-byte buffer", src_len);
+    }
   }
 
   return dst;
@@ -360,7 +360,7 @@
 // This is a variant of __strncpy_chk, but it also checks to make
 // sure we don't read beyond the end of "src". The code for this is
 // based on the original version of strncpy, but modified to check
-// how much we read from "src" during the copy operation.
+// how much we read from "src" at the end of the copy operation.
 char* __strncpy_chk2(char* dst, const char* src, size_t n, size_t dst_len, size_t src_len) {
   __check_buffer_access("strncpy", "write into", n, dst_len);
   if (n != 0) {
@@ -368,11 +368,6 @@
     const char* s = src;
 
     do {
-      size_t s_copy_len = static_cast<size_t>(s - src);
-      if (__predict_false(s_copy_len >= src_len)) {
-        __fortify_fatal("strncpy: detected read past end of %zu-byte buffer", src_len);
-      }
-
       if ((*d++ = *s++) == 0) {
         // NUL pad the remaining n-1 bytes.
         while (--n != 0) {
@@ -381,6 +376,11 @@
         break;
       }
     } while (--n != 0);
+
+    size_t s_copy_len = static_cast<size_t>(s - src);
+    if (__predict_false(s_copy_len > src_len)) {
+      __fortify_fatal("strncpy: detected read past end of %zu-byte buffer", src_len);
+    }
   }
 
   return dst;
@@ -500,10 +500,3 @@
   return memcpy(dst, src, count);
 }
 #endif // NO___MEMCPY_CHK
-
-// Runtime implementation of __mempcpy_chk (used directly by compiler, not in headers).
-extern "C" void* __mempcpy_chk(void* dst, const void* src, size_t count, size_t dst_len) {
-  __check_count("mempcpy", "count", count);
-  __check_buffer_access("mempcpy", "write into", count, dst_len);
-  return mempcpy(dst, src, count);
-}
diff --git a/libc/bionic/fsetxattr.cpp b/libc/bionic/fsetxattr.cpp
index 00955bd..9ad0c76 100644
--- a/libc/bionic/fsetxattr.cpp
+++ b/libc/bionic/fsetxattr.cpp
@@ -35,11 +35,11 @@
 
 #include "private/FdPath.h"
 
-extern "C" int __fsetxattr(int, const char*, const void*, size_t, int);
+extern "C" int ___fsetxattr(int, const char*, const void*, size_t, int);
 
 int fsetxattr(int fd, const char* name, const void* value, size_t size, int flags) {
   int saved_errno = errno;
-  int result = __fsetxattr(fd, name, value, size, flags);
+  int result = ___fsetxattr(fd, name, value, size, flags);
   if (result == 0 || errno != EBADF) {
     return result;
   }
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index f865f97..c8f867b 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -36,6 +36,7 @@
 
 // This function needs to be safe to call before TLS is set up, so it can't
 // access errno or the stack protector.
+__attribute__((no_stack_protector))
 __LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool& exists) {
   for (ElfW(auxv_t)* v = __libc_shared_globals()->auxv; v->a_type != AT_NULL; ++v) {
     if (v->a_type == type) {
diff --git a/libc/bionic/getentropy.cpp b/libc/bionic/getentropy.cpp
index 9c93e71..2c6e417 100644
--- a/libc/bionic/getentropy.cpp
+++ b/libc/bionic/getentropy.cpp
@@ -31,20 +31,22 @@
 #include <sys/random.h>
 #include <unistd.h>
 
-#include "private/ScopedFd.h"
-
 static int getentropy_urandom(void* buffer, size_t buffer_size, int saved_errno) {
-  ScopedFd fd(TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY | O_NOFOLLOW | O_CLOEXEC, 0)));
-  if (fd.get() == -1) return -1;
+  int fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY | O_NOFOLLOW | O_CLOEXEC, 0));
+  if (fd == -1) return -1;
 
   size_t collected = 0;
   while (collected < buffer_size) {
-    ssize_t count = TEMP_FAILURE_RETRY(read(fd.get(), static_cast<char*>(buffer) + collected,
+    ssize_t count = TEMP_FAILURE_RETRY(read(fd, static_cast<char*>(buffer) + collected,
                                             buffer_size - collected));
-    if (count == -1) return -1;
+    if (count == -1) {
+      close(fd);
+      return -1;
+    }
     collected += count;
   }
 
+  close(fd);
   errno = saved_errno;
   return 0;
 }
diff --git a/libc/bionic/grp_pwd.cpp b/libc/bionic/grp_pwd.cpp
index 6f8c07e..dadda49 100644
--- a/libc/bionic/grp_pwd.cpp
+++ b/libc/bionic/grp_pwd.cpp
@@ -26,9 +26,6 @@
  * SUCH DAMAGE.
  */
 
-#include "private/grp_pwd.h"
-
-#include <android/api-level.h>
 #include <ctype.h>
 #include <errno.h>
 #include <grp.h>
@@ -38,33 +35,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/system_properties.h>
-#include <sys/types.h>
 #include <unistd.h>
 
-#include "private/ErrnoRestorer.h"
 #include "private/android_filesystem_config.h"
 #include "private/bionic_macros.h"
+#include "private/grp_pwd.h"
+#include "private/ErrnoRestorer.h"
 
 // Generated android_ids array
 #include "generated_android_ids.h"
 #include "grp_pwd_file.h"
 
-static PasswdFile passwd_files[] = {
-  { "/system/etc/passwd", "system_" },
-  { "/vendor/etc/passwd", "vendor_" },
-  { "/odm/etc/passwd", "odm_" },
-  { "/product/etc/passwd", "product_" },
-  { "/system_ext/etc/passwd", "system_ext_" },
-};
-
-static GroupFile group_files[] = {
-  { "/system/etc/group", "system_" },
-  { "/vendor/etc/group", "vendor_" },
-  { "/odm/etc/group", "odm_" },
-  { "/product/etc/group", "product_" },
-  { "/system_ext/etc/group", "system_ext_" },
-};
+static PasswdFile vendor_passwd("/vendor/etc/passwd", "vendor_");
+static GroupFile vendor_group("/vendor/etc/group", "vendor_");
 
 // POSIX seems to envisage an implementation where the <pwd.h> functions are
 // implemented by brute-force searching with getpwent(3), and the <grp.h>
@@ -73,42 +56,99 @@
 // functions to share state, but <grp.h> functions can't clobber <passwd.h>
 // functions' state and vice versa.
 #include "bionic/pthread_internal.h"
-
-static void init_group_state(group_state_t* state) {
-  memset(state, 0, sizeof(group_state_t) - sizeof(state->getgrent_idx));
-  state->group_.gr_name = state->group_name_buffer_;
-  state->group_.gr_mem = state->group_members_;
-  state->group_.gr_mem[0] = state->group_.gr_name;
-}
-
 static group_state_t* get_group_tls_buffer() {
-  auto result = &__get_bionic_tls().group;
-  init_group_state(result);
-  return result;
-}
-
-static void init_passwd_state(passwd_state_t* state) {
-  memset(state, 0, sizeof(passwd_state_t) - sizeof(state->getpwent_idx));
-  state->passwd_.pw_name = state->name_buffer_;
-  state->passwd_.pw_dir = state->dir_buffer_;
-  state->passwd_.pw_shell = state->sh_buffer_;
+  return &__get_bionic_tls().group;
 }
 
 static passwd_state_t* get_passwd_tls_buffer() {
-  auto result = &__get_bionic_tls().passwd;
-  init_passwd_state(result);
+  return &__get_bionic_tls().passwd;
+}
+
+static void init_group_state(group_state_t* state) {
+  memset(state, 0, sizeof(group_state_t) - sizeof(state->getgrent_idx));
+  state->group_.gr_mem = state->group_members_;
+}
+
+static group_state_t* __group_state() {
+  group_state_t* result = get_group_tls_buffer();
+  if (result != nullptr) {
+    init_group_state(result);
+  }
   return result;
 }
 
+static int do_getpw_r(int by_name, const char* name, uid_t uid,
+                      passwd* dst, char* buf, size_t byte_count,
+                      passwd** result) {
+  // getpwnam_r and getpwuid_r don't modify errno, but library calls we
+  // make might.
+  ErrnoRestorer errno_restorer;
+  *result = nullptr;
+
+  // Our implementation of getpwnam(3) and getpwuid(3) use thread-local
+  // storage, so we can call them as long as we copy everything out
+  // before returning.
+  const passwd* src = by_name ? getpwnam(name) : getpwuid(uid); // NOLINT: see above.
+
+  // POSIX allows failure to find a match to be considered a non-error.
+  // Reporting success (0) but with *result NULL is glibc's behavior.
+  if (src == nullptr) {
+    return (errno == ENOENT) ? 0 : errno;
+  }
+
+  // Work out where our strings will go in 'buf', and whether we've got
+  // enough space.
+  size_t required_byte_count = 0;
+  dst->pw_name = buf;
+  required_byte_count += strlen(src->pw_name) + 1;
+  dst->pw_dir = buf + required_byte_count;
+  required_byte_count += strlen(src->pw_dir) + 1;
+  dst->pw_shell = buf + required_byte_count;
+  required_byte_count += strlen(src->pw_shell) + 1;
+  if (byte_count < required_byte_count) {
+    return ERANGE;
+  }
+
+  // Copy the strings.
+  snprintf(buf, byte_count, "%s%c%s%c%s", src->pw_name, 0, src->pw_dir, 0, src->pw_shell);
+
+  // pw_passwd and pw_gecos are non-POSIX and unused (always NULL) in bionic.
+  // Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL.
+  dst->pw_passwd = nullptr;
+#if defined(__LP64__)
+  dst->pw_gecos = nullptr;
+#endif
+
+  // Copy the integral fields.
+  dst->pw_gid = src->pw_gid;
+  dst->pw_uid = src->pw_uid;
+
+  *result = dst;
+  return 0;
+}
+
+int getpwnam_r(const char* name, passwd* pwd,
+               char* buf, size_t byte_count, passwd** result) {
+  return do_getpw_r(1, name, -1, pwd, buf, byte_count, result);
+}
+
+int getpwuid_r(uid_t uid, passwd* pwd,
+               char* buf, size_t byte_count, passwd** result) {
+  return do_getpw_r(0, nullptr, uid, pwd, buf, byte_count, result);
+}
+
 static passwd* android_iinfo_to_passwd(passwd_state_t* state,
                                        const android_id_info* iinfo) {
   snprintf(state->name_buffer_, sizeof(state->name_buffer_), "%s", iinfo->name);
   snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/");
-  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/bin/sh");
+  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh");
 
   passwd* pw = &state->passwd_;
+  pw->pw_name  = state->name_buffer_;
   pw->pw_uid   = iinfo->aid;
   pw->pw_gid   = iinfo->aid;
+  pw->pw_dir   = state->dir_buffer_;
+  pw->pw_shell = state->sh_buffer_;
   return pw;
 }
 
@@ -117,23 +157,43 @@
   snprintf(state->group_name_buffer_, sizeof(state->group_name_buffer_), "%s", iinfo->name);
 
   group* gr = &state->group_;
-  gr->gr_gid = iinfo->aid;
+  gr->gr_name   = state->group_name_buffer_;
+  gr->gr_gid    = iinfo->aid;
+  gr->gr_mem[0] = gr->gr_name;
   return gr;
 }
 
-static const android_id_info* find_android_id_info(unsigned id) {
+static passwd* android_id_to_passwd(passwd_state_t* state, unsigned id) {
   for (size_t n = 0; n < android_id_count; ++n) {
     if (android_ids[n].aid == id) {
-      return &android_ids[n];
+      return android_iinfo_to_passwd(state, android_ids + n);
     }
   }
   return nullptr;
 }
 
-static const android_id_info* find_android_id_info(const char* name) {
+static passwd* android_name_to_passwd(passwd_state_t* state, const char* name) {
   for (size_t n = 0; n < android_id_count; ++n) {
     if (!strcmp(android_ids[n].name, name)) {
-      return &android_ids[n];
+      return android_iinfo_to_passwd(state, android_ids + n);
+    }
+  }
+  return nullptr;
+}
+
+static group* android_id_to_group(group_state_t* state, unsigned id) {
+  for (size_t n = 0; n < android_id_count; ++n) {
+    if (android_ids[n].aid == id) {
+      return android_iinfo_to_group(state, android_ids + n);
+    }
+  }
+  return nullptr;
+}
+
+static group* android_name_to_group(group_state_t* state, const char* name) {
+  for (size_t n = 0; n < android_id_count; ++n) {
+    if (!strcmp(android_ids[n].name, name)) {
+      return android_iinfo_to_group(state, android_ids + n);
     }
   }
   return nullptr;
@@ -142,17 +202,10 @@
 // These are a list of the reserved app ranges, and should never contain anything below
 // AID_APP_START.  They exist per user, so a given uid/gid modulo AID_USER_OFFSET will map
 // to these ranges.
-struct IdRange {
-  id_t start;
-  id_t end;
-};
-
-static constexpr IdRange user_ranges[] = {
-  { AID_APP_START, AID_APP_END },
-  { AID_ISOLATED_START, AID_ISOLATED_END },
-};
-
-static constexpr IdRange group_ranges[] = {
+static constexpr struct {
+  uid_t start;
+  uid_t end;
+} user_ranges[] = {
   { AID_APP_START, AID_APP_END },
   { AID_CACHE_GID_START, AID_CACHE_GID_END },
   { AID_EXT_GID_START, AID_EXT_GID_END },
@@ -161,40 +214,22 @@
   { AID_ISOLATED_START, AID_ISOLATED_END },
 };
 
-template <class T, size_t N>
-static constexpr bool verify_user_ranges_ascending(T (&ranges)[N]) {
-  auto array_size = N;
+static constexpr bool verify_user_ranges_ascending() {
+  auto array_size = arraysize(user_ranges);
   if (array_size < 2) return false;
 
-  if (ranges[0].start > ranges[0].end) return false;
+  if (user_ranges[0].start > user_ranges[0].end) return false;
 
   for (size_t i = 1; i < array_size; ++i) {
-    if (ranges[i].start > ranges[i].end) return false;
-    if (ranges[i - 1].end > ranges[i].start) return false;
+    if (user_ranges[i].start > user_ranges[i].end) return false;
+    if (user_ranges[i - 1].end > user_ranges[i].start) return false;
   }
   return true;
 }
 
-static_assert(verify_user_ranges_ascending(user_ranges), "user_ranges must have ascending ranges");
-static_assert(verify_user_ranges_ascending(group_ranges), "user_ranges must have ascending ranges");
+static_assert(verify_user_ranges_ascending(), "user_ranges must have ascending ranges");
 
-// This list comes from PackageManagerService.java, where platform AIDs are added to list of valid
-// AIDs for packages via addSharedUserLPw().
-static constexpr const id_t secondary_user_platform_ids[] = {
-  AID_SYSTEM, AID_RADIO,          AID_LOG,           AID_NFC, AID_BLUETOOTH,
-  AID_SHELL,  AID_SECURE_ELEMENT, AID_NETWORK_STACK,
-};
-
-static bool platform_id_secondary_user_allowed(id_t id) {
-  for (const auto& allowed_id : secondary_user_platform_ids) {
-    if (allowed_id == id) {
-      return true;
-    }
-  }
-  return false;
-}
-
-static bool is_valid_app_id(id_t id, bool is_group) {
+static bool is_valid_app_id(id_t id) {
   id_t appid = id % AID_USER_OFFSET;
 
   // AID_OVERFLOWUID is never a valid app id, so we explicitly return false to ensure this.
@@ -203,23 +238,15 @@
     return false;
   }
 
-  auto ranges_size = is_group ? arraysize(group_ranges) : arraysize(user_ranges);
-  auto ranges = is_group ? group_ranges : user_ranges;
-
-  // If we're checking an appid that resolves below the user range, then it's a platform AID for a
-  // seconary user. We only allow a reduced set of these, so we must check that it is allowed.
-  if (appid < ranges[0].start && platform_id_secondary_user_allowed(appid)) {
+  // If we've resolved to something before app_start, we have already checked against
+  // android_ids, so no need to check again.
+  if (appid < user_ranges[0].start) {
     return true;
   }
 
-  // The shared GID range is only valid for the first user.
-  if (appid >= AID_SHARED_GID_START && appid <= AID_SHARED_GID_END && appid != id) {
-    return false;
-  }
-
   // Otherwise check that the appid is in one of the reserved ranges.
-  for (size_t i = 0; i < ranges_size; ++i) {
-    if (appid >= ranges[i].start && appid <= ranges[i].end) {
+  for (size_t i = 0; i < arraysize(user_ranges); ++i) {
+    if (appid >= user_ranges[i].start && appid <= user_ranges[i].end) {
       return true;
     }
   }
@@ -228,29 +255,26 @@
 }
 
 // This provides an iterater for app_ids within the first user's app id's.
-static id_t get_next_app_id(id_t current_id, bool is_group) {
-  auto ranges_size = is_group ? arraysize(group_ranges) : arraysize(user_ranges);
-  auto ranges = is_group ? group_ranges : user_ranges;
-
-  // If current_id is below the first of the ranges, then we're uninitialized, and return the first
-  // valid id.
-  if (current_id < ranges[0].start) {
-    return ranges[0].start;
+static uid_t get_next_app_id(uid_t current_id) {
+  // If current_id is below the first of the user_ranges, then we're uninitialized, and return the
+  // first valid id.
+  if (current_id < user_ranges[0].start) {
+    return user_ranges[0].start;
   }
 
-  id_t incremented_id = current_id + 1;
+  uid_t incremented_id = current_id + 1;
 
   // Check to see if our incremented_id is between two ranges, and if so, return the beginning of
   // the next valid range.
-  for (size_t i = 1; i < ranges_size; ++i) {
-    if (incremented_id > ranges[i - 1].end && incremented_id < ranges[i].start) {
-      return ranges[i].start;
+  for (size_t i = 1; i < arraysize(user_ranges); ++i) {
+    if (incremented_id > user_ranges[i - 1].end && incremented_id < user_ranges[i].start) {
+      return user_ranges[i].start;
     }
   }
 
   // Check to see if our incremented_id is above final range, and return -1 to indicate that we've
   // completed if so.
-  if (incremented_id > ranges[ranges_size - 1].end) {
+  if (incremented_id > user_ranges[arraysize(user_ranges) - 1].end) {
     return -1;
   }
 
@@ -260,8 +284,6 @@
 
 // Translate a user/group name to the corresponding user/group id.
 // all_a1234 -> 0 * AID_USER_OFFSET + AID_SHARED_GID_START + 1234 (group name only)
-// u0_a1234_ext_cache -> 0 * AID_USER_OFFSET + AID_EXT_CACHE_GID_START + 1234 (group name only)
-// u0_a1234_ext -> 0 * AID_USER_OFFSET + AID_EXT_GID_START + 1234 (group name only)
 // u0_a1234_cache -> 0 * AID_USER_OFFSET + AID_CACHE_GID_START + 1234 (group name only)
 // u0_a1234 -> 0 * AID_USER_OFFSET + AID_APP_START + 1234
 // u2_i1000 -> 2 * AID_USER_OFFSET + AID_ISOLATED_START + 1000
@@ -300,19 +322,9 @@
     } else {
       // end will point to \0 if the strtoul below succeeds.
       appid = strtoul(end+2, &end, 10);
-      if (is_group) {
-        if (!strcmp(end, "_ext_cache")) {
-          end += 10;
-          appid += AID_EXT_CACHE_GID_START;
-        } else if (!strcmp(end, "_ext")) {
-          end += 4;
-          appid += AID_EXT_GID_START;
-        } else if (!strcmp(end, "_cache")) {
-          end += 6;
-          appid += AID_CACHE_GID_START;
-        } else {
-          appid += AID_APP_START;
-        }
+      if (is_group && !strcmp(end, "_cache")) {
+        end += 6;
+        appid += AID_CACHE_GID_START;
       } else {
         appid += AID_APP_START;
       }
@@ -320,12 +332,14 @@
   } else if (end[1] == 'i' && isdigit(end[2])) {
     // end will point to \0 if the strtoul below succeeds.
     appid = strtoul(end+2, &end, 10) + AID_ISOLATED_START;
-  } else if (auto* android_id_info = find_android_id_info(end + 1); android_id_info != nullptr) {
-    appid = android_id_info->aid;
-    end += strlen(android_id_info->name) + 1;
-    if (!platform_id_secondary_user_allowed(appid)) {
-      errno = ENOENT;
-      return 0;
+  } else {
+    for (size_t n = 0; n < android_id_count; n++) {
+      if (!strcmp(android_ids[n].name, end + 1)) {
+        appid = android_ids[n].aid;
+        // Move the end pointer to the null terminator.
+        end += strlen(android_ids[n].name) + 1;
+        break;
+      }
     }
   }
 
@@ -356,8 +370,11 @@
   if (appid >= AID_ISOLATED_START) {
     snprintf(buffer, bufferlen, "u%u_i%u", userid, appid - AID_ISOLATED_START);
   } else if (appid < AID_APP_START) {
-    if (auto* android_id_info = find_android_id_info(appid); android_id_info != nullptr) {
-      snprintf(buffer, bufferlen, "u%u_%s", userid, android_id_info->name);
+    for (size_t n = 0; n < android_id_count; n++) {
+      if (android_ids[n].aid == appid) {
+        snprintf(buffer, bufferlen, "u%u_%s", userid, android_ids[n].name);
+        return;
+      }
     }
   } else {
     snprintf(buffer, bufferlen, "u%u_a%u", userid, appid - AID_APP_START);
@@ -371,54 +388,28 @@
     snprintf(buffer, bufferlen, "u%u_i%u", userid, appid - AID_ISOLATED_START);
   } else if (userid == 0 && appid >= AID_SHARED_GID_START && appid <= AID_SHARED_GID_END) {
     snprintf(buffer, bufferlen, "all_a%u", appid - AID_SHARED_GID_START);
-  } else if (appid >= AID_EXT_CACHE_GID_START && appid <= AID_EXT_CACHE_GID_END) {
-    snprintf(buffer, bufferlen, "u%u_a%u_ext_cache", userid, appid - AID_EXT_CACHE_GID_START);
-  } else if (appid >= AID_EXT_GID_START && appid <= AID_EXT_GID_END) {
-    snprintf(buffer, bufferlen, "u%u_a%u_ext", userid, appid - AID_EXT_GID_START);
   } else if (appid >= AID_CACHE_GID_START && appid <= AID_CACHE_GID_END) {
     snprintf(buffer, bufferlen, "u%u_a%u_cache", userid, appid - AID_CACHE_GID_START);
   } else if (appid < AID_APP_START) {
-    if (auto* android_id_info = find_android_id_info(appid); android_id_info != nullptr) {
-      snprintf(buffer, bufferlen, "u%u_%s", userid, android_id_info->name);
+    for (size_t n = 0; n < android_id_count; n++) {
+      if (android_ids[n].aid == appid) {
+        snprintf(buffer, bufferlen, "u%u_%s", userid, android_ids[n].name);
+        return;
+      }
     }
   } else {
     snprintf(buffer, bufferlen, "u%u_a%u", userid, appid - AID_APP_START);
   }
 }
 
-static bool device_launched_before_api_29() {
-  // Check if ro.product.first_api_level is set to a value > 0 and < 29, if so, this device was
-  // launched before API 29 (Q). Any other value is considered to be either in development or
-  // launched after.
-  // Cache the value as __system_property_get() is expensive and this may be called often.
-  static bool result = [] {
-    char value[PROP_VALUE_MAX] = { 0 };
-    if (__system_property_get("ro.product.first_api_level", value) == 0) {
-      return false;
-    }
-    int value_int = atoi(value);
-    return value_int != 0 && value_int < 29;
-  }();
-  return result;
-}
-
 // oem_XXXX -> uid
 //  Supported ranges:
 //   AID_OEM_RESERVED_START to AID_OEM_RESERVED_END (2900-2999)
 //   AID_OEM_RESERVED_2_START to AID_OEM_RESERVED_2_END (5000-5999)
 // Check OEM id is within range.
 static bool is_oem_id(id_t id) {
-  // Upgrading devices launched before API level 29 may not comply with the below check.
-  // Due to the difficulty in changing uids after launch, it is waived for these devices.
-  // The legacy range:
-  // AID_OEM_RESERVED_START to AID_EVERYBODY (2900-9996), excluding builtin AIDs.
-  if (device_launched_before_api_29() && id >= AID_OEM_RESERVED_START && id < AID_EVERYBODY &&
-      find_android_id_info(id) == nullptr) {
-    return true;
-  }
-
-  return (id >= AID_OEM_RESERVED_START && id <= AID_OEM_RESERVED_END) ||
-         (id >= AID_OEM_RESERVED_2_START && id <= AID_OEM_RESERVED_2_END);
+  return (((id >= AID_OEM_RESERVED_START) && (id <= AID_OEM_RESERVED_END)) ||
+      ((id >= AID_OEM_RESERVED_2_START) && (id <= AID_OEM_RESERVED_2_END)));
 }
 
 // Translate an OEM name to the corresponding user/group id.
@@ -434,42 +425,43 @@
 }
 
 static passwd* oem_id_to_passwd(uid_t uid, passwd_state_t* state) {
-  for (auto& passwd_file : passwd_files) {
-    if (passwd_file.FindById(uid, state)) {
-      return &state->passwd_;
-    }
-  }
-
   if (!is_oem_id(uid)) {
     return nullptr;
   }
 
+  if (vendor_passwd.FindById(uid, state)) {
+    return &state->passwd_;
+  }
+
   snprintf(state->name_buffer_, sizeof(state->name_buffer_), "oem_%u", uid);
   snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/");
-  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/bin/sh");
+  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/vendor/bin/sh");
 
   passwd* pw = &state->passwd_;
+  pw->pw_name  = state->name_buffer_;
+  pw->pw_dir   = state->dir_buffer_;
+  pw->pw_shell = state->sh_buffer_;
   pw->pw_uid   = uid;
   pw->pw_gid   = uid;
   return pw;
 }
 
 static group* oem_id_to_group(gid_t gid, group_state_t* state) {
-  for (auto& group_file : group_files) {
-    if (group_file.FindById(gid, state)) {
-      return &state->group_;
-    }
-  }
-
   if (!is_oem_id(gid)) {
     return nullptr;
   }
 
+  if (vendor_group.FindById(gid, state)) {
+    return &state->group_;
+  }
+
   snprintf(state->group_name_buffer_, sizeof(state->group_name_buffer_),
            "oem_%u", gid);
 
   group* gr = &state->group_;
-  gr->gr_gid = gid;
+  gr->gr_name   = state->group_name_buffer_;
+  gr->gr_gid    = gid;
+  gr->gr_mem[0] = gr->gr_name;
   return gr;
 }
 
@@ -480,7 +472,7 @@
 // AID_USER_OFFSET+                        -> u1_radio, u1_a1234, u2_i1234, etc.
 // returns a passwd structure (sets errno to ENOENT on failure).
 static passwd* app_id_to_passwd(uid_t uid, passwd_state_t* state) {
-  if (uid < AID_APP_START || !is_valid_app_id(uid, false)) {
+  if (uid < AID_APP_START || !is_valid_app_id(uid)) {
     errno = ENOENT;
     return nullptr;
   }
@@ -494,9 +486,12 @@
       snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/data");
   }
 
-  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/bin/sh");
+  snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh");
 
   passwd* pw = &state->passwd_;
+  pw->pw_name  = state->name_buffer_;
+  pw->pw_dir   = state->dir_buffer_;
+  pw->pw_shell = state->sh_buffer_;
   pw->pw_uid   = uid;
   pw->pw_gid   = uid;
   return pw;
@@ -505,7 +500,7 @@
 // Translate a gid into the corresponding app_<gid>
 // group structure (sets errno to ENOENT on failure).
 static group* app_id_to_group(gid_t gid, group_state_t* state) {
-  if (gid < AID_APP_START || !is_valid_app_id(gid, true)) {
+  if (gid < AID_APP_START || !is_valid_app_id(gid)) {
     errno = ENOENT;
     return nullptr;
   }
@@ -513,80 +508,55 @@
   print_app_name_from_gid(gid, state->group_name_buffer_, sizeof(state->group_name_buffer_));
 
   group* gr = &state->group_;
-  gr->gr_gid = gid;
+  gr->gr_name   = state->group_name_buffer_;
+  gr->gr_gid    = gid;
+  gr->gr_mem[0] = gr->gr_name;
   return gr;
 }
 
-passwd* getpwuid_internal(uid_t uid, passwd_state_t* state) {
-  if (auto* android_id_info = find_android_id_info(uid); android_id_info != nullptr) {
-    return android_iinfo_to_passwd(state, android_id_info);
+passwd* getpwuid(uid_t uid) { // NOLINT: implementing bad function.
+  passwd_state_t* state = get_passwd_tls_buffer();
+  if (state == nullptr) {
+    return nullptr;
   }
 
+  passwd* pw = android_id_to_passwd(state, uid);
+  if (pw != nullptr) {
+    return pw;
+  }
   // Handle OEM range.
-  passwd* pw = oem_id_to_passwd(uid, state);
+  pw = oem_id_to_passwd(uid, state);
   if (pw != nullptr) {
     return pw;
   }
   return app_id_to_passwd(uid, state);
 }
 
-passwd* getpwuid(uid_t uid) {  // NOLINT: implementing bad function.
+passwd* getpwnam(const char* login) { // NOLINT: implementing bad function.
   passwd_state_t* state = get_passwd_tls_buffer();
-  return getpwuid_internal(uid, state);
-}
-
-passwd* getpwnam_internal(const char* login, passwd_state_t* state) {
-  if (auto* android_id_info = find_android_id_info(login); android_id_info != nullptr) {
-    return android_iinfo_to_passwd(state, android_id_info);
+  if (state == nullptr) {
+    return nullptr;
   }
 
-  for (auto& passwd_file : passwd_files) {
-    if (passwd_file.FindByName(login, state)) {
+  passwd* pw = android_name_to_passwd(state, login);
+  if (pw != nullptr) {
+    return pw;
+  }
+
+  if (vendor_passwd.FindByName(login, state)) {
+    if (is_oem_id(state->passwd_.pw_uid)) {
       return &state->passwd_;
     }
   }
 
   // Handle OEM range.
-  passwd* pw = oem_id_to_passwd(oem_id_from_name(login), state);
+  pw = oem_id_to_passwd(oem_id_from_name(login), state);
   if (pw != nullptr) {
     return pw;
   }
   return app_id_to_passwd(app_id_from_name(login, false), state);
 }
 
-passwd* getpwnam(const char* login) {  // NOLINT: implementing bad function.
-  passwd_state_t* state = get_passwd_tls_buffer();
-  return getpwnam_internal(login, state);
-}
-
-static int getpasswd_r(bool by_name, const char* name, uid_t uid, struct passwd* pwd, char* buf,
-                       size_t buflen, struct passwd** result) {
-  ErrnoRestorer errno_restorer;
-  *result = nullptr;
-  char* p =
-      reinterpret_cast<char*>(__BIONIC_ALIGN(reinterpret_cast<uintptr_t>(buf), sizeof(uintptr_t)));
-  if (p + sizeof(passwd_state_t) > buf + buflen) {
-    return ERANGE;
-  }
-  passwd_state_t* state = reinterpret_cast<passwd_state_t*>(p);
-  init_passwd_state(state);
-  passwd* retval = (by_name ? getpwnam_internal(name, state) : getpwuid_internal(uid, state));
-  if (retval != nullptr) {
-    *pwd = *retval;
-    *result = pwd;
-    return 0;
-  }
-  return errno;
-}
-
-int getpwnam_r(const char* name, passwd* pwd, char* buf, size_t byte_count, passwd** result) {
-  return getpasswd_r(true, name, -1, pwd, buf, byte_count, result);
-}
-
-int getpwuid_r(uid_t uid, passwd* pwd, char* buf, size_t byte_count, passwd** result) {
-  return getpasswd_r(false, nullptr, uid, pwd, buf, byte_count, result);
-}
-
 // All users are in just one group, the one passed in.
 int getgrouplist(const char* /*user*/, gid_t group, gid_t* groups, int* ngroups) {
   if (*ngroups < 1) {
@@ -624,6 +594,9 @@
 
 passwd* getpwent() {
   passwd_state_t* state = get_passwd_tls_buffer();
+  if (state == nullptr) {
+    return nullptr;
+  }
   if (state->getpwent_idx < 0) {
     return nullptr;
   }
@@ -650,23 +623,7 @@
         state->getpwent_idx++ - start + AID_OEM_RESERVED_2_START, state);
   }
 
-  start = end;
-  end += AID_SYSTEM_EXT_RESERVED_END - AID_SYSTEM_RESERVED_START + 1;
-
-  if (state->getpwent_idx < end) {
-    // No one calls this enough to worry about how inefficient the below is.
-    auto* oem_passwd =
-        oem_id_to_passwd(state->getpwent_idx++ - start + AID_SYSTEM_RESERVED_START, state);
-    while (oem_passwd == nullptr && state->getpwent_idx < end) {
-      oem_passwd =
-          oem_id_to_passwd(state->getpwent_idx++ - start + AID_SYSTEM_RESERVED_START, state);
-    }
-    if (oem_passwd != nullptr) {
-      return oem_passwd;
-    }
-  }
-
-  state->getpwent_idx = get_next_app_id(state->getpwent_idx, false);
+  state->getpwent_idx = get_next_app_id(state->getpwent_idx);
 
   if (state->getpwent_idx != -1) {
     return app_id_to_passwd(state->getpwent_idx, state);
@@ -677,12 +634,12 @@
 }
 
 static group* getgrgid_internal(gid_t gid, group_state_t* state) {
-  if (auto* android_id_info = find_android_id_info(gid); android_id_info != nullptr) {
-    return android_iinfo_to_group(state, android_id_info);
+  group* grp = android_id_to_group(state, gid);
+  if (grp != nullptr) {
+    return grp;
   }
-
   // Handle OEM range.
-  group* grp = oem_id_to_group(gid, state);
+  grp = oem_id_to_group(gid, state);
   if (grp != nullptr) {
     return grp;
   }
@@ -690,23 +647,27 @@
 }
 
 group* getgrgid(gid_t gid) { // NOLINT: implementing bad function.
-  group_state_t* state = get_group_tls_buffer();
+  group_state_t* state = __group_state();
+  if (state == nullptr) {
+    return nullptr;
+  }
   return getgrgid_internal(gid, state);
 }
 
 static group* getgrnam_internal(const char* name, group_state_t* state) {
-  if (auto* android_id_info = find_android_id_info(name); android_id_info != nullptr) {
-    return android_iinfo_to_group(state, android_id_info);
+  group* grp = android_name_to_group(state, name);
+  if (grp != nullptr) {
+    return grp;
   }
 
-  for (auto& group_file : group_files) {
-    if (group_file.FindByName(name, state)) {
+  if (vendor_group.FindByName(name, state)) {
+    if (is_oem_id(state->group_.gr_gid)) {
       return &state->group_;
     }
   }
 
   // Handle OEM range.
-  group* grp = oem_id_to_group(oem_id_from_name(name), state);
+  grp = oem_id_to_group(oem_id_from_name(name), state);
   if (grp != nullptr) {
     return grp;
   }
@@ -714,7 +675,10 @@
 }
 
 group* getgrnam(const char* name) { // NOLINT: implementing bad function.
-  group_state_t* state = get_group_tls_buffer();
+  group_state_t* state = __group_state();
+  if (state == nullptr) {
+    return nullptr;
+  }
   return getgrnam_internal(name, state);
 }
 
@@ -760,6 +724,9 @@
 
 group* getgrent() {
   group_state_t* state = get_group_tls_buffer();
+  if (state == nullptr) {
+    return nullptr;
+  }
   if (state->getgrent_idx < 0) {
     return nullptr;
   }
@@ -767,6 +734,7 @@
   size_t start = 0;
   ssize_t end = android_id_count;
   if (state->getgrent_idx < end) {
+    init_group_state(state);
     return android_iinfo_to_group(state, android_ids + state->getgrent_idx++);
   }
 
@@ -774,6 +742,7 @@
   end += AID_OEM_RESERVED_END - AID_OEM_RESERVED_START + 1;
 
   if (state->getgrent_idx < end) {
+    init_group_state(state);
     return oem_id_to_group(
         state->getgrent_idx++ - start + AID_OEM_RESERVED_START, state);
   }
@@ -782,30 +751,15 @@
   end += AID_OEM_RESERVED_2_END - AID_OEM_RESERVED_2_START + 1;
 
   if (state->getgrent_idx < end) {
+    init_group_state(state);
     return oem_id_to_group(
         state->getgrent_idx++ - start + AID_OEM_RESERVED_2_START, state);
   }
 
   start = end;
-  end += AID_SYSTEM_EXT_RESERVED_END - AID_SYSTEM_RESERVED_START + 1;
-
-  if (state->getgrent_idx < end) {
-    // No one calls this enough to worry about how inefficient the below is.
-    init_group_state(state);
-    auto* oem_group =
-        oem_id_to_group(state->getgrent_idx++ - start + AID_SYSTEM_RESERVED_START, state);
-    while (oem_group == nullptr && state->getgrent_idx < end) {
-      oem_group = oem_id_to_group(state->getgrent_idx++ - start + AID_SYSTEM_RESERVED_START, state);
-    }
-    if (oem_group != nullptr) {
-      return oem_group;
-    }
-  }
-
-  start = end;
   end += AID_USER_OFFSET - AID_APP_START; // Do not expose higher groups
 
-  state->getgrent_idx = get_next_app_id(state->getgrent_idx, true);
+  state->getgrent_idx = get_next_app_id(state->getgrent_idx);
 
   if (state->getgrent_idx != -1) {
     return app_id_to_group(state->getgrent_idx, state);
diff --git a/libc/bionic/grp_pwd_file.cpp b/libc/bionic/grp_pwd_file.cpp
index 81cf893..201c9d0 100644
--- a/libc/bionic/grp_pwd_file.cpp
+++ b/libc/bionic/grp_pwd_file.cpp
@@ -37,7 +37,6 @@
 #include <async_safe/log.h>
 
 #include "private/ErrnoRestorer.h"
-#include "private/ScopedFd.h"
 
 // This file mmap's /*/etc/passwd and /*/etc/group in order to return their contents without any
 // allocations.  Note that these files and the strings contained within them are explicitly not
@@ -231,16 +230,19 @@
 }
 
 bool MmapFile::DoMmap() {
-  ScopedFd fd(open(filename_, O_CLOEXEC | O_NOFOLLOW | O_RDONLY));
+  int fd = open(filename_, O_CLOEXEC | O_NOFOLLOW | O_RDONLY);
 
   struct stat fd_stat;
-  if (fstat(fd.get(), &fd_stat) == -1) {
+  if (fstat(fd, &fd_stat) == -1) {
+    close(fd);
     return false;
   }
 
   auto mmap_size = fd_stat.st_size;
 
-  void* map_result = mmap(nullptr, mmap_size, PROT_READ, MAP_SHARED, fd.get(), 0);
+  void* map_result = mmap(nullptr, mmap_size, PROT_READ, MAP_SHARED, fd, 0);
+  close(fd);
+
   if (map_result == MAP_FAILED) {
     return false;
   }
@@ -268,8 +270,8 @@
 
   while (line_beginning < end) {
     line_beginning = ParseLine(line_beginning, end, line->fields, line->kNumFields);
-    // To comply with Treble, users/groups from each partition need to be prefixed with
-    // the partition name.
+    // To comply with Treble, users/groups from the vendor partition need to be prefixed with
+    // vendor_.
     if (required_prefix_ != nullptr) {
       if (strncmp(line->fields[0], required_prefix_, strlen(required_prefix_)) != 0) {
         char name[kGrpPwdBufferSize];
diff --git a/libc/bionic/jemalloc.h b/libc/bionic/jemalloc.h
index 4ce51c0..b9a4e99 100644
--- a/libc/bionic/jemalloc.h
+++ b/libc/bionic/jemalloc.h
@@ -29,8 +29,8 @@
 __BEGIN_DECLS
 
 void* je_aligned_alloc_wrapper(size_t, size_t);
-int je_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
-int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) __attribute__((nothrow));
+int je_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
+int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
 struct mallinfo je_mallinfo();
 void je_malloc_disable();
 void je_malloc_enable();
diff --git a/libc/bionic/jemalloc_wrapper.cpp b/libc/bionic/jemalloc_wrapper.cpp
index ef488ee..7d04457 100644
--- a/libc/bionic/jemalloc_wrapper.cpp
+++ b/libc/bionic/jemalloc_wrapper.cpp
@@ -140,32 +140,30 @@
     return -1;
   }
 
-  fflush(fp);
-  int fd = fileno(fp);
-  MallocXmlElem root(fd, "malloc", "version=\"jemalloc-1\"");
+  MallocXmlElem root(fp, "malloc", "version=\"jemalloc-1\"");
 
   // Dump all of the large allocations in the arenas.
   for (size_t i = 0; i < je_mallinfo_narenas(); i++) {
     struct mallinfo mi = je_mallinfo_arena_info(i);
     if (mi.hblkhd != 0) {
-      MallocXmlElem arena_elem(fd, "heap", "nr=\"%d\"", i);
+      MallocXmlElem arena_elem(fp, "heap", "nr=\"%d\"", i);
       {
-        MallocXmlElem(fd, "allocated-large").Contents("%zu", mi.ordblks);
-        MallocXmlElem(fd, "allocated-huge").Contents("%zu", mi.uordblks);
-        MallocXmlElem(fd, "allocated-bins").Contents("%zu", mi.fsmblks);
+        MallocXmlElem(fp, "allocated-large").Contents("%zu", mi.ordblks);
+        MallocXmlElem(fp, "allocated-huge").Contents("%zu", mi.uordblks);
+        MallocXmlElem(fp, "allocated-bins").Contents("%zu", mi.fsmblks);
 
         size_t total = 0;
         for (size_t j = 0; j < je_mallinfo_nbins(); j++) {
           struct mallinfo mi = je_mallinfo_bin_info(i, j);
           if (mi.ordblks != 0) {
-            MallocXmlElem bin_elem(fd, "bin", "nr=\"%d\"", j);
-            MallocXmlElem(fd, "allocated").Contents("%zu", mi.ordblks);
-            MallocXmlElem(fd, "nmalloc").Contents("%zu", mi.uordblks);
-            MallocXmlElem(fd, "ndalloc").Contents("%zu", mi.fordblks);
+            MallocXmlElem bin_elem(fp, "bin", "nr=\"%d\"", j);
+            MallocXmlElem(fp, "allocated").Contents("%zu", mi.ordblks);
+            MallocXmlElem(fp, "nmalloc").Contents("%zu", mi.uordblks);
+            MallocXmlElem(fp, "ndalloc").Contents("%zu", mi.fordblks);
             total += mi.ordblks;
           }
         }
-        MallocXmlElem(fd, "bins-total").Contents("%zu", total);
+        MallocXmlElem(fp, "bins-total").Contents("%zu", total);
       }
     }
   }
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 1f099cf..b229cda 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -232,7 +232,6 @@
     "LD_AOUT_LIBRARY_PATH",
     "LD_AOUT_PRELOAD",
     "LD_AUDIT",
-    "LD_CONFIG_FILE",
     "LD_DEBUG",
     "LD_DEBUG_OUTPUT",
     "LD_DYNAMIC_WEAK",
@@ -243,7 +242,6 @@
     "LD_SHOW_AUXV",
     "LD_USE_LOAD_BIAS",
     "LIBC_DEBUG_MALLOC_OPTIONS",
-    "LIBC_HOOKS_ENABLE",
     "LOCALDOMAIN",
     "LOCPATH",
     "MALLOC_CHECK_",
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index d6d5552..4f3b4f7 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -69,13 +69,6 @@
 __LIBC_HIDDEN__ void* __libc_sysinfo = reinterpret_cast<void*>(__libc_int0x80);
 #endif
 
-extern "C" __attribute__((weak)) void __hwasan_library_loaded(ElfW(Addr) base,
-                                                              const ElfW(Phdr)* phdr,
-                                                              ElfW(Half) phnum);
-extern "C" __attribute__((weak)) void __hwasan_library_unloaded(ElfW(Addr) base,
-                                                                const ElfW(Phdr)* phdr,
-                                                                ElfW(Half) phnum);
-
 // We need a helper function for __libc_preinit because compiling with LTO may
 // inline functions requiring a stack protector check, but __stack_chk_guard is
 // not initialized at the start of __libc_preinit. __libc_preinit_impl will run
@@ -98,14 +91,6 @@
 
   // Hooks for various libraries to let them know that we're starting up.
   __libc_globals.mutate(__libc_init_malloc);
-
-#if __has_feature(hwaddress_sanitizer)
-  // Notify the HWASan runtime library whenever a library is loaded or unloaded
-  // so that it can update its shadow memory.
-  __libc_shared_globals()->load_hook = __hwasan_library_loaded;
-  __libc_shared_globals()->unload_hook = __hwasan_library_unloaded;
-#endif
-
   netdClientInit();
 }
 
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 28c0b0c..b4bddce 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -39,7 +39,6 @@
 #include "libc_init_common.h"
 #include "pthread_internal.h"
 
-#include "private/bionic_call_ifunc_resolver.h"
 #include "private/bionic_elf_tls.h"
 #include "private/bionic_globals.h"
 #include "private/bionic_macros.h"
@@ -82,10 +81,11 @@
     return;
   }
 
+  typedef ElfW(Addr) (*ifunc_resolver_t)(void);
   for (ElfW(Rela) *r = __rela_iplt_start; r != __rela_iplt_end; ++r) {
     ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
     ElfW(Addr) resolver = r->r_addend;
-    *offset = __bionic_call_ifunc_resolver(resolver);
+    *offset = reinterpret_cast<ifunc_resolver_t>(resolver)();
   }
 }
 #else
@@ -103,10 +103,11 @@
     return;
   }
 
+  typedef ElfW(Addr) (*ifunc_resolver_t)(void);
   for (ElfW(Rel) *r = __rel_iplt_start; r != __rel_iplt_end; ++r) {
     ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
     ElfW(Addr) resolver = *offset;
-    *offset = __bionic_call_ifunc_resolver(resolver);
+    *offset = reinterpret_cast<ifunc_resolver_t>(resolver)();
   }
 }
 #endif
@@ -231,9 +232,6 @@
   g_target_sdk_version = target;
 }
 
-// This function is called in the dynamic linker before ifunc resolvers have run, so this file is
-// compiled with -ffreestanding to avoid implicit string.h function calls. (It shouldn't strictly
-// be necessary, though.)
 __LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals() {
   static libc_shared_globals globals;
   return &globals;
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
index a0da3db..9dc4d12 100644
--- a/libc/bionic/malloc_common.cpp
+++ b/libc/bionic/malloc_common.cpp
@@ -39,7 +39,7 @@
 #include <stdio.h>
 
 #include <private/bionic_config.h>
-#include <platform/bionic/malloc.h>
+#include <private/bionic_malloc.h>
 
 #include "malloc_common.h"
 #include "malloc_limit.h"
@@ -215,9 +215,9 @@
     void (*callback)(uintptr_t base, size_t size, void* arg), void* arg) {
   auto dispatch_table = GetDispatchTable();
   if (__predict_false(dispatch_table != nullptr)) {
-    return dispatch_table->malloc_iterate(base, size, callback, arg);
+    return dispatch_table->iterate(base, size, callback, arg);
   }
-  return Malloc(malloc_iterate)(base, size, callback, arg);
+  return Malloc(iterate)(base, size, callback, arg);
 }
 
 // Disable calls to malloc so malloc_iterate gets a consistent view of
@@ -247,10 +247,9 @@
 
 #if __has_feature(hwaddress_sanitizer)
 // FIXME: implement these in HWASan allocator.
-extern "C" int __sanitizer_malloc_iterate(uintptr_t base __unused, size_t size __unused,
-                                          void (*callback)(uintptr_t base, size_t size, void* arg)
-                                              __unused,
-                                          void* arg __unused) {
+extern "C" int __sanitizer_iterate(uintptr_t base __unused, size_t size __unused,
+                                   void (*callback)(uintptr_t base, size_t size, void* arg) __unused,
+                                   void* arg __unused) {
   return 0;
 }
 
diff --git a/libc/bionic/malloc_common.h b/libc/bionic/malloc_common.h
index 89dccc3..2176e63 100644
--- a/libc/bionic/malloc_common.h
+++ b/libc/bionic/malloc_common.h
@@ -42,9 +42,9 @@
 __BEGIN_DECLS
 
 // FIXME: implement these in HWASan allocator.
-int __sanitizer_malloc_iterate(uintptr_t base, size_t size,
-                               void (*callback)(uintptr_t base, size_t size, void* arg),
-                               void* arg);
+int __sanitizer_iterate(uintptr_t base, size_t size,
+                        void (*callback)(uintptr_t base, size_t size, void* arg),
+                        void* arg);
 void __sanitizer_malloc_disable();
 void __sanitizer_malloc_enable();
 int __sanitizer_malloc_info(int options, FILE* fp);
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 0ac3f62..8035746 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -57,10 +57,10 @@
 
 #include <android/dlext.h>
 
-#include <platform/bionic/malloc.h>
 #include <private/bionic_config.h>
 #include <private/bionic_defs.h>
 #include <private/bionic_malloc_dispatch.h>
+#include <private/bionic_malloc.h>
 
 #include <sys/system_properties.h>
 
@@ -95,7 +95,7 @@
 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
     Malloc(valloc),
 #endif
-    Malloc(malloc_iterate),
+    Malloc(iterate),
     Malloc(malloc_disable),
     Malloc(malloc_enable),
     Malloc(mallopt),
@@ -184,8 +184,7 @@
   if (!InitMallocFunction<MallocRealloc>(impl_handler, &table->realloc, prefix, "realloc")) {
     return false;
   }
-  if (!InitMallocFunction<MallocIterate>(impl_handler, &table->malloc_iterate, prefix,
-                                         "malloc_iterate")) {
+  if (!InitMallocFunction<MallocIterate>(impl_handler, &table->iterate, prefix, "iterate")) {
     return false;
   }
   if (!InitMallocFunction<MallocMallocDisable>(impl_handler, &table->malloc_disable, prefix,
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp
index 5860222..5d3735d 100644
--- a/libc/bionic/malloc_heapprofd.cpp
+++ b/libc/bionic/malloc_heapprofd.cpp
@@ -37,8 +37,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <platform/bionic/malloc.h>
 #include <private/bionic_config.h>
+#include <private/bionic_malloc.h>
 #include <private/bionic_malloc_dispatch.h>
 #include <sys/system_properties.h>
 
@@ -104,7 +104,7 @@
 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
     Malloc(valloc),
 #endif
-    Malloc(malloc_iterate),
+    Malloc(iterate),
     Malloc(malloc_disable),
     Malloc(malloc_enable),
     Malloc(mallopt),
@@ -116,7 +116,6 @@
   // Zygote child processes must be marked profileable.
   if (gZygoteChild &&
       !atomic_load_explicit(&gZygoteChildProfileable, memory_order_acquire)) {
-    error_log("%s: not enabling heapprofd, not marked profileable.", getprogname());
     return;
   }
 
diff --git a/libc/bionic/malloc_limit.cpp b/libc/bionic/malloc_limit.cpp
index d8c0ebe..b42865b 100644
--- a/libc/bionic/malloc_limit.cpp
+++ b/libc/bionic/malloc_limit.cpp
@@ -113,7 +113,7 @@
 
 void* LimitCalloc(size_t n_elements, size_t elem_size) {
   size_t total;
-  if (__builtin_mul_overflow(n_elements, elem_size, &total) || !CheckLimit(total)) {
+  if (__builtin_add_overflow(n_elements, elem_size, &total) || !CheckLimit(total)) {
     warning_log("malloc_limit: calloc(%zu, %zu) exceeds limit %" PRId64, n_elements, elem_size,
                 gAllocLimit);
     return nullptr;
@@ -350,9 +350,9 @@
 static int LimitIterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*), void* arg) {
   auto dispatch_table = GetDefaultDispatchTable();
   if (__predict_false(dispatch_table != nullptr)) {
-    return dispatch_table->malloc_iterate(base, size, callback, arg);
+    return dispatch_table->iterate(base, size, callback, arg);
   }
-  return Malloc(malloc_iterate)(base, size, callback, arg);
+  return Malloc(iterate)(base, size, callback, arg);
 }
 
 static void LimitMallocDisable() {
diff --git a/libc/bionic/mremap.cpp b/libc/bionic/mremap.cpp
index a4e5323..896ccef 100644
--- a/libc/bionic/mremap.cpp
+++ b/libc/bionic/mremap.cpp
@@ -34,7 +34,7 @@
 
 #include "private/bionic_macros.h"
 
-extern "C" void* __mremap(void*, size_t, size_t, int, void*);
+extern "C" void* ___mremap(void*, size_t, size_t, int, void*);
 
 void* mremap(void* old_address, size_t old_size, size_t new_size, int flags, ...) {
   // prevent allocations large enough for `end - start` to overflow
@@ -53,5 +53,5 @@
     new_address = va_arg(ap, void*);
     va_end(ap);
   }
-  return __mremap(old_address, old_size, new_size, flags, new_address);
+  return ___mremap(old_address, old_size, new_size, flags, new_address);
 }
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index c816830..2c3299f 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -72,7 +72,7 @@
 
 // TODO: does anything still need this?
 void** __get_tls() {
-#include "platform/bionic/tls.h"
+#include "private/__get_tls.h"
   return __get_tls();
 }
 
diff --git a/libc/bionic/ndk_cruft_data.cpp b/libc/bionic/ndk_cruft_data.cpp
deleted file mode 100644
index e512b4a..0000000
--- a/libc/bionic/ndk_cruft_data.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-
-// Ancient NDKs' <ctype.h> contained inline references to these tables.
-
-#if !defined(__LP64__)
-
-/*	$OpenBSD: tolower_.c,v 1.11 2015/09/19 04:02:21 guenther Exp $ */
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- */
-
-static const short _C_tolower_[] = {
-	-1,
-	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
-	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
-	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
-	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
-	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
-	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
-	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
-	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
-	0x40,	'a',	'b',	'c',	'd',	'e',	'f',	'g',
-	'h',	'i',	'j',	'k',	'l',	'm',	'n',	'o',
-	'p',	'q',	'r',	's',	't',	'u',	'v',	'w',
-	'x',	'y',	'z',	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
-	0x60,	0x61,	0x62,	0x63,	0x64,	0x65,	0x66,	0x67,
-	0x68,	0x69,	0x6a,	0x6b,	0x6c,	0x6d,	0x6e,	0x6f,
-	0x70,	0x71,	0x72,	0x73,	0x74,	0x75,	0x76,	0x77,
-	0x78,	0x79,	0x7a,	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
-	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
-	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
-	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
-	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
-	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
-	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
-	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
-	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
-	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
-	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
-	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
-	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
-	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
-	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
-	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
-	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
-};
-
-const short *_tolower_tab_ = _C_tolower_;
-
-/*	$OpenBSD: toupper_.c,v 1.12 2015/09/19 04:02:21 guenther Exp $ */
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- */
-
-static const short _C_toupper_[] = {
-	-1,
-	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
-	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
-	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
-	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
-	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
-	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
-	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
-	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
-	0x40,	0x41,	0x42,	0x43,	0x44,	0x45,	0x46,	0x47,
-	0x48,	0x49,	0x4a,	0x4b,	0x4c,	0x4d,	0x4e,	0x4f,
-	0x50,	0x51,	0x52,	0x53,	0x54,	0x55,	0x56,	0x57,
-	0x58,	0x59,	0x5a,	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
-	0x60,	'A',	'B',	'C',	'D',	'E',	'F',	'G',
-	'H',	'I',	'J',	'K',	'L',	'M',	'N',	'O',
-	'P',	'Q',	'R',	'S',	'T',	'U',	'V',	'W',
-	'X',	'Y',	'Z',	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
-	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
-	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
-	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
-	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
-	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
-	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
-	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
-	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
-	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
-	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
-	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
-	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
-	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
-	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
-	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
-	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
-};
-
-const short *_toupper_tab_ = _C_toupper_;
-
-#endif
diff --git a/libc/bionic/net_if.cpp b/libc/bionic/net_if.cpp
index ad53364..db9c9ea2 100644
--- a/libc/bionic/net_if.cpp
+++ b/libc/bionic/net_if.cpp
@@ -40,27 +40,37 @@
 #include <sys/socket.h>
 #include <unistd.h>
 
-#include "private/ScopedFd.h"
+#include "private/ErrnoRestorer.h"
 
 #include "bionic_netlink.h"
 
 char* if_indextoname(unsigned ifindex, char* ifname) {
-  ScopedFd s(socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0));
-  if (s.get() == -1) return nullptr;
+  int s = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+  if (s == -1) return nullptr;
 
-  ifreq ifr = {.ifr_ifindex = static_cast<int>(ifindex)};
-  return (ioctl(s.get(), SIOCGIFNAME, &ifr) == -1) ? nullptr
-                                                   : strncpy(ifname, ifr.ifr_name, IFNAMSIZ);
+  struct ifreq ifr;
+  memset(&ifr, 0, sizeof(ifr));
+  ifr.ifr_ifindex = ifindex;
+
+  int rc = ioctl(s, SIOCGIFNAME, &ifr);
+  ErrnoRestorer errno_restorer;
+  close(s);
+  return (rc == -1) ? nullptr : strncpy(ifname, ifr.ifr_name, IFNAMSIZ);
 }
 
 unsigned if_nametoindex(const char* ifname) {
-  ScopedFd s(socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0));
-  if (s.get() == -1) return 0;
+  int s = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+  if (s == -1) return 0;
 
-  ifreq ifr = {};
+  struct ifreq ifr;
+  memset(&ifr, 0, sizeof(ifr));
   strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
   ifr.ifr_name[IFNAMSIZ - 1] = 0;
-  return (ioctl(s.get(), SIOCGIFINDEX, &ifr) == -1) ? 0 : ifr.ifr_ifindex;
+
+  int rc = ioctl(s, SIOCGIFINDEX, &ifr);
+  ErrnoRestorer errno_restorer;
+  close(s);
+  return (rc == -1) ? 0 : ifr.ifr_ifindex;
 }
 
 struct if_list {
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp
index e857069..9f0f8fa 100644
--- a/libc/bionic/pthread_cond.cpp
+++ b/libc/bionic/pthread_cond.cpp
@@ -215,18 +215,6 @@
   return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, false, abs_timeout);
 }
 
-int pthread_cond_clockwait(pthread_cond_t* cond_interface, pthread_mutex_t* mutex, clockid_t clock,
-                           const struct timespec* abs_timeout) {
-  switch (clock) {
-    case CLOCK_MONOTONIC:
-      return pthread_cond_timedwait_monotonic_np(cond_interface, mutex, abs_timeout);
-    case CLOCK_REALTIME:
-      return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, true, abs_timeout);
-    default:
-      return EINVAL;
-  }
-}
-
 #if !defined(__LP64__)
 // TODO: this exists only for backward binary compatibility on 32 bit platforms.
 extern "C" int pthread_cond_timedwait_monotonic(pthread_cond_t* cond_interface,
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 03af2d9..4cf14ad 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -54,12 +54,31 @@
 void __init_user_desc(struct user_desc*, bool, void*);
 #endif
 
+// This code is used both by each new pthread and the code that initializes the main thread.
+__attribute__((no_stack_protector))
+void __init_tcb(bionic_tcb* tcb, pthread_internal_t* thread) {
+#ifdef TLS_SLOT_SELF
+  // On x86, slot 0 must point to itself so code can read the thread pointer by
+  // loading %fs:0 or %gs:0.
+  tcb->tls_slot(TLS_SLOT_SELF) = &tcb->tls_slot(TLS_SLOT_SELF);
+#endif
+  tcb->tls_slot(TLS_SLOT_THREAD_ID) = thread;
+}
+
 __attribute__((no_stack_protector))
 void __init_tcb_stack_guard(bionic_tcb* tcb) {
   // GCC looks in the TLS for the stack guard on x86, so copy it there from our global.
   tcb->tls_slot(TLS_SLOT_STACK_GUARD) = reinterpret_cast<void*>(__stack_chk_guard);
 }
 
+__attribute__((no_stack_protector))
+void __init_tcb_dtv(bionic_tcb* tcb) {
+  // Initialize the DTV slot to a statically-allocated empty DTV. The first
+  // access to a dynamic TLS variable allocates a new DTV.
+  static const TlsDtv zero_dtv = {};
+  __set_tcb_dtv(tcb, const_cast<TlsDtv*>(&zero_dtv));
+}
+
 void __init_bionic_tls_ptrs(bionic_tcb* tcb, bionic_tls* tls) {
   tcb->thread()->bionic_tls = tls;
   tcb->tls_slot(TLS_SLOT_BIONIC_TLS) = tls;
@@ -235,8 +254,6 @@
   ThreadMapping result = {};
   result.mmap_base = space;
   result.mmap_size = mmap_size;
-  result.mmap_base_unguarded = space + stack_guard_size;
-  result.mmap_size_unguarded = mmap_size - stack_guard_size - PTHREAD_GUARD_SIZE;
   result.static_tls = space + mmap_size - PTHREAD_GUARD_SIZE - layout.size();
   result.stack_base = space;
   result.stack_top = result.static_tls;
@@ -298,35 +315,12 @@
   thread->attr = *attr;
   thread->mmap_base = mapping.mmap_base;
   thread->mmap_size = mapping.mmap_size;
-  thread->mmap_base_unguarded = mapping.mmap_base_unguarded;
-  thread->mmap_size_unguarded = mapping.mmap_size_unguarded;
 
   *tcbp = tcb;
   *child_stack = stack_top;
   return 0;
 }
 
-void __set_stack_and_tls_vma_name(bool is_main_thread) {
-  // Name the thread's stack-and-tls area to help with debugging. This mapped area also includes
-  // static TLS data, which is typically a few pages (e.g. bionic_tls).
-  pthread_internal_t* thread = __get_thread();
-  const char* name;
-  if (is_main_thread) {
-    name = "stack_and_tls:main";
-  } else {
-    // The kernel doesn't copy the name string, but this variable will last at least as long as the
-    // mapped area. The mapped area's VMAs are unmapped with a single call to munmap.
-    auto& name_buffer = thread->vma_name_buffer;
-    static_assert(arraysize(name_buffer) >= arraysize("stack_and_tls:") + 11 + 1);
-    async_safe_format_buffer(name_buffer, arraysize(name_buffer), "stack_and_tls:%d", thread->tid);
-    name = name_buffer;
-  }
-  prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, thread->mmap_base_unguarded, thread->mmap_size_unguarded,
-        name);
-}
-
-extern "C" int __rt_sigprocmask(int, const sigset64_t*, sigset64_t*, size_t);
-
 __attribute__((no_sanitize("hwaddress")))
 static int __pthread_start(void* arg) {
   pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(arg);
@@ -339,9 +333,7 @@
   // accesses previously made by the creating thread are visible to us.
   thread->startup_handshake_lock.lock();
 
-  __set_stack_and_tls_vma_name(false);
   __init_additional_stacks(thread);
-  __rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
 
   void* result = thread->start_routine(thread->start_routine_arg);
   pthread_exit(result);
@@ -404,12 +396,7 @@
   __init_user_desc(&tls_descriptor, false, tls);
   tls = &tls_descriptor;
 #endif
-
-  sigset64_t block_all_mask;
-  sigfillset64(&block_all_mask);
-  __rt_sigprocmask(SIG_SETMASK, &block_all_mask, &thread->start_mask, sizeof(thread->start_mask));
   int rc = clone(__pthread_start, child_stack, flags, thread, &(thread->tid), tls, &(thread->tid));
-  __rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
   if (rc == -1) {
     int clone_errno = errno;
     // We don't have to unlock the mutex at all because clone(2) failed so there's no child waiting to
diff --git a/libc/bionic/pthread_getcpuclockid.cpp b/libc/bionic/pthread_getcpuclockid.cpp
index 6d1884e..0b35998 100644
--- a/libc/bionic/pthread_getcpuclockid.cpp
+++ b/libc/bionic/pthread_getcpuclockid.cpp
@@ -28,10 +28,8 @@
 
 #include <errno.h>
 
-#include "private/bionic_defs.h"
 #include "pthread_internal.h"
 
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
 int pthread_getcpuclockid(pthread_t t, clockid_t* clockid) {
   pid_t tid = __pthread_internal_gettid(t, "pthread_getcpuclockid");
   if (tid == -1) return ESRCH;
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 22b0558..a1e0c45 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -98,7 +98,6 @@
   void* (*start_routine)(void*);
   void* start_routine_arg;
   void* return_value;
-  sigset64_t start_mask;
 
   void* alternate_signal_stack;
 
@@ -130,11 +129,6 @@
   void* mmap_base;
   size_t mmap_size;
 
-  // The location of the VMA to label as the thread's stack_and_tls.
-  void* mmap_base_unguarded;
-  size_t mmap_size_unguarded;
-  char vma_name_buffer[32];
-
   thread_local_dtor* thread_local_dtors;
 
   /*
@@ -153,8 +147,6 @@
 struct ThreadMapping {
   char* mmap_base;
   size_t mmap_size;
-  char* mmap_base_unguarded;
-  size_t mmap_size_unguarded;
 
   char* static_tls;
   char* stack_base;
@@ -170,7 +162,6 @@
 __LIBC_HIDDEN__ void __init_additional_stacks(pthread_internal_t*);
 __LIBC_HIDDEN__ int __init_thread(pthread_internal_t* thread);
 __LIBC_HIDDEN__ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_size);
-__LIBC_HIDDEN__ void __set_stack_and_tls_vma_name(bool is_main_thread);
 
 __LIBC_HIDDEN__ pthread_t __pthread_internal_add(pthread_internal_t* thread);
 __LIBC_HIDDEN__ pthread_internal_t* __pthread_internal_find(pthread_t pthread_id, const char* caller);
diff --git a/libc/bionic/pthread_kill.cpp b/libc/bionic/pthread_kill.cpp
index cada9c2..8b38f4c 100644
--- a/libc/bionic/pthread_kill.cpp
+++ b/libc/bionic/pthread_kill.cpp
@@ -29,11 +29,9 @@
 #include <errno.h>
 #include <unistd.h>
 
-#include "private/bionic_defs.h"
 #include "private/ErrnoRestorer.h"
 #include "pthread_internal.h"
 
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
 int pthread_kill(pthread_t t, int sig) {
   ErrnoRestorer errno_restorer;
 
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index de62a5c..f92184e 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -646,15 +646,6 @@
         // we call wake, the thread we eventually wake will find an unlocked mutex
         // and will execute. Either way we have correct behavior and nobody is
         // orphaned on the wait queue.
-        //
-        // The pthread_mutex_internal_t object may have been deallocated between the
-        // atomic exchange and the wake call. In that case, this wake call could
-        // target unmapped memory or memory used by an otherwise unrelated futex
-        // operation. Even if the kernel avoids spurious futex wakeups from its
-        // point of view, this wake call could trigger a spurious wakeup in any
-        // futex accessible from this process. References:
-        //  - https://lkml.org/lkml/2014/11/27/472
-        //  - http://austingroupbugs.net/view.php?id=811#c2267
         __futex_wake_ex(&mutex->state, shared, 1);
     }
 }
@@ -989,24 +980,6 @@
     return __pthread_mutex_timedlock(mutex_interface, false, abs_timeout, __FUNCTION__);
 }
 
-int pthread_mutex_clocklock(pthread_mutex_t* mutex_interface, clockid_t clock,
-                            const struct timespec* abs_timeout) {
-  switch (clock) {
-    case CLOCK_MONOTONIC:
-      return __pthread_mutex_timedlock(mutex_interface, false, abs_timeout, __FUNCTION__);
-    case CLOCK_REALTIME:
-      return __pthread_mutex_timedlock(mutex_interface, true, abs_timeout, __FUNCTION__);
-    default: {
-      pthread_mutex_internal_t* mutex = __get_internal_mutex(mutex_interface);
-      uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed);
-      if (IsMutexDestroyed(old_state)) {
-        return HandleUsingDestroyedMutex(mutex_interface, __FUNCTION__);
-      }
-      return EINVAL;
-    }
-  }
-}
-
 int pthread_mutex_destroy(pthread_mutex_t* mutex_interface) {
     pthread_mutex_internal_t* mutex = __get_internal_mutex(mutex_interface);
     uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed);
diff --git a/libc/bionic/pthread_rwlock.cpp b/libc/bionic/pthread_rwlock.cpp
index ebf6697..2b9be98 100644
--- a/libc/bionic/pthread_rwlock.cpp
+++ b/libc/bionic/pthread_rwlock.cpp
@@ -429,18 +429,6 @@
   return __pthread_rwlock_timedrdlock(rwlock, false, abs_timeout);
 }
 
-int pthread_rwlock_clockrdlock(pthread_rwlock_t* rwlock_interface, clockid_t clock,
-                               const struct timespec* abs_timeout) {
-  switch (clock) {
-    case CLOCK_MONOTONIC:
-      return pthread_rwlock_timedrdlock_monotonic_np(rwlock_interface, abs_timeout);
-    case CLOCK_REALTIME:
-      return pthread_rwlock_timedrdlock(rwlock_interface, abs_timeout);
-    default:
-      return EINVAL;
-  }
-}
-
 int pthread_rwlock_tryrdlock(pthread_rwlock_t* rwlock_interface) {
   return __pthread_rwlock_tryrdlock(__get_internal_rwlock(rwlock_interface));
 }
@@ -467,18 +455,6 @@
   return __pthread_rwlock_timedwrlock(rwlock, false, abs_timeout);
 }
 
-int pthread_rwlock_clockwrlock(pthread_rwlock_t* rwlock_interface, clockid_t clock,
-                               const struct timespec* abs_timeout) {
-  switch (clock) {
-    case CLOCK_MONOTONIC:
-      return pthread_rwlock_timedwrlock_monotonic_np(rwlock_interface, abs_timeout);
-    case CLOCK_REALTIME:
-      return pthread_rwlock_timedwrlock(rwlock_interface, abs_timeout);
-    default:
-      return EINVAL;
-  }
-}
-
 int pthread_rwlock_trywrlock(pthread_rwlock_t* rwlock_interface) {
   return __pthread_rwlock_trywrlock(__get_internal_rwlock(rwlock_interface));
 }
diff --git a/libc/bionic/pthread_setname_np.cpp b/libc/bionic/pthread_setname_np.cpp
index 5236e4d..f673983 100644
--- a/libc/bionic/pthread_setname_np.cpp
+++ b/libc/bionic/pthread_setname_np.cpp
@@ -36,7 +36,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "private/bionic_defs.h"
 #include "private/ErrnoRestorer.h"
 #include "pthread_internal.h"
 
@@ -50,7 +49,6 @@
   return open(comm_name, O_CLOEXEC | flags);
 }
 
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
 int pthread_getname_np(pthread_t t, char* buf, size_t buf_size) {
   ErrnoRestorer errno_restorer;
 
@@ -82,7 +80,6 @@
   return 0;
 }
 
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
 int pthread_setname_np(pthread_t t, const char* thread_name) {
   ErrnoRestorer errno_restorer;
 
diff --git a/libc/bionic/pthread_sigqueue.cpp b/libc/bionic/pthread_sigqueue.cpp
index 93c349e..5d13ed5 100644
--- a/libc/bionic/pthread_sigqueue.cpp
+++ b/libc/bionic/pthread_sigqueue.cpp
@@ -32,11 +32,9 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#include "private/bionic_defs.h"
 #include "private/ErrnoRestorer.h"
 #include "pthread_internal.h"
 
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
 int pthread_sigqueue(pthread_t t, int sig, const union sigval value) {
   ErrnoRestorer errno_restorer;
 
diff --git a/libc/bionic/scudo.h b/libc/bionic/scudo.h
index a80d754..d9933c4 100644
--- a/libc/bionic/scudo.h
+++ b/libc/bionic/scudo.h
@@ -52,7 +52,7 @@
 void* scudo_valloc(size_t);
 #endif
 
-int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
+int scudo_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
 void scudo_malloc_disable();
 void scudo_malloc_enable();
 
diff --git a/libc/bionic/scudo/Android.bp b/libc/bionic/scudo/Android.bp
index 9b77c06..8b518bb 100644
--- a/libc/bionic/scudo/Android.bp
+++ b/libc/bionic/scudo/Android.bp
@@ -57,7 +57,4 @@
             version_script: "exported64.map",
         },
     },
-
-    // Like libc, disable native coverage for libscudo_wrapper.
-    native_coverage: false,
 }
diff --git a/libc/bionic/scudo_wrapper.cpp b/libc/bionic/scudo_wrapper.cpp
index debd8d9..e17f20b 100644
--- a/libc/bionic/scudo_wrapper.cpp
+++ b/libc/bionic/scudo_wrapper.cpp
@@ -48,7 +48,7 @@
   return -1;
 }
 
-int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
+int scudo_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
   return 0;
 }
 
diff --git a/libc/bionic/semaphore.cpp b/libc/bionic/semaphore.cpp
index 455e36b..e0486b4 100644
--- a/libc/bionic/semaphore.cpp
+++ b/libc/bionic/semaphore.cpp
@@ -275,17 +275,6 @@
   return __sem_timedwait(sem, abs_timeout, false);
 }
 
-int sem_clockwait(sem_t* sem, clockid_t clock, const timespec* abs_timeout) {
-  switch (clock) {
-    case CLOCK_MONOTONIC:
-      return sem_timedwait_monotonic_np(sem, abs_timeout);
-    case CLOCK_REALTIME:
-      return sem_timedwait(sem, abs_timeout);
-    default:
-      return EINVAL;
-  }
-}
-
 int sem_post(sem_t* sem) {
   atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem);
   unsigned int shared = SEM_GET_SHARED(sem_count_ptr);
diff --git a/libc/bionic/signal.cpp b/libc/bionic/signal.cpp
index 8246cb4..d6be09a 100644
--- a/libc/bionic/signal.cpp
+++ b/libc/bionic/signal.cpp
@@ -41,7 +41,7 @@
 #include "private/sigrtmin.h"
 
 extern "C" int __rt_sigpending(const sigset64_t*, size_t);
-extern "C" int __rt_sigqueueinfo(pid_t, int, siginfo_t*);
+extern "C" int ___rt_sigqueueinfo(pid_t, int, siginfo_t*);
 extern "C" int __rt_sigsuspend(const sigset64_t*, size_t);
 extern "C" int __rt_sigtimedwait(const sigset64_t*, siginfo_t*, const timespec*, size_t);
 
@@ -216,7 +216,7 @@
   info.si_pid = getpid();
   info.si_uid = getuid();
   info.si_value = value;
-  return __rt_sigqueueinfo(pid, sig, &info);
+  return ___rt_sigqueueinfo(pid, sig, &info);
 }
 
 int sigrelse(int sig) {
diff --git a/libc/bionic/sleep.cpp b/libc/bionic/sleep.cpp
deleted file mode 100644
index fcfd9b2..0000000
--- a/libc/bionic/sleep.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <unistd.h>
-
-#include <time.h>
-
-unsigned sleep(unsigned s) {
-#if !defined(__LP64__)
-  // `s` is `unsigned`, but tv_sec is `int` on LP32.
-  if (s > INT_MAX) return s - INT_MAX + sleep(INT_MAX);
-#endif
-
-  timespec ts = {.tv_sec = static_cast<time_t>(s)};
-  return (nanosleep(&ts, &ts) == -1) ? ts.tv_sec : 0;
-}
diff --git a/libc/bionic/socket.cpp b/libc/bionic/socket.cpp
new file mode 100644
index 0000000..2f9e145
--- /dev/null
+++ b/libc/bionic/socket.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "private/NetdClientDispatch.h"
+
+#include <sys/socket.h>
+
+int socket(int domain, int type, int protocol) {
+    return __netdClientDispatch.socket(domain, type, protocol);
+}
diff --git a/libc/bionic/statvfs.cpp b/libc/bionic/statvfs.cpp
new file mode 100644
index 0000000..cd825eb
--- /dev/null
+++ b/libc/bionic/statvfs.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/statvfs.h>
+
+#include <sys/statfs.h>
+
+// Paper over the fact that 32-bit kernels use fstatfs64/statfs64 with an extra argument,
+// but 64-bit kernels don't have the "64" bit suffix or the extra size_t argument.
+#if defined(__LP64__)
+extern "C" int __fstatfs(int, struct statfs*);
+extern "C" int __statfs(const char*, struct statfs*);
+#  define __fstatfs64(fd,size,buf) __fstatfs(fd,buf)
+#  define __statfs64(path,size,buf) __statfs(path,buf)
+#else
+extern "C" int __fstatfs64(int, size_t, struct statfs*);
+extern "C" int __statfs64(const char*, size_t, struct statfs*);
+#endif
+
+// The kernel sets a private ST_VALID flag to signal to the C library whether the
+// f_flags field is valid. This flag should not be exposed to users of the C library.
+#define ST_VALID 0x0020
+
+static void __statfs_to_statvfs(const struct statfs& in, struct statvfs* out) {
+  out->f_bsize = in.f_bsize;
+  out->f_frsize = in.f_frsize;
+  out->f_blocks = in.f_blocks;
+  out->f_bfree = in.f_bfree;
+  out->f_bavail = in.f_bavail;
+  out->f_files = in.f_files;
+  out->f_ffree = in.f_ffree;
+  out->f_favail = in.f_ffree;
+  out->f_fsid = in.f_fsid.__val[0] | (static_cast<uint64_t>(in.f_fsid.__val[1]) << 32);
+  out->f_flag = in.f_flags;
+  out->f_namemax = in.f_namelen;
+}
+
+int fstatfs(int fd, struct statfs* result) {
+  int rc = __fstatfs64(fd, sizeof(*result), result);
+  if (rc != 0) {
+    return rc;
+  }
+  result->f_flags &= ~ST_VALID;
+  return 0;
+}
+__strong_alias(fstatfs64, fstatfs);
+
+int statfs(const char* path, struct statfs* result) {
+  int rc = __statfs64(path, sizeof(*result), result);
+  if (rc != 0) {
+    return rc;
+  }
+  result->f_flags &= ~ST_VALID;
+  return 0;
+}
+__strong_alias(statfs64, statfs);
+
+int statvfs(const char* path, struct statvfs* result) {
+  struct statfs tmp;
+  int rc = statfs(path, &tmp);
+  if (rc != 0) {
+    return rc;
+  }
+  __statfs_to_statvfs(tmp, result);
+  return 0;
+}
+__strong_alias(statvfs64, statvfs);
+
+int fstatvfs(int fd, struct statvfs* result) {
+  struct statfs tmp;
+  int rc = fstatfs(fd, &tmp);
+  if (rc != 0) {
+    return rc;
+  }
+  __statfs_to_statvfs(tmp, result);
+  return 0;
+}
+__strong_alias(fstatvfs64, fstatvfs);
diff --git a/libc/bionic/sys_statfs.cpp b/libc/bionic/sys_statfs.cpp
deleted file mode 100644
index d78de2d..0000000
--- a/libc/bionic/sys_statfs.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/statfs.h>
-
-// Paper over the fact that 32-bit kernels use fstatfs64/statfs64 with
-// an extra argument, but 64-bit kernels don't have the "64" bit suffix or
-// the extra size_t argument.
-#if defined(__LP64__)
-extern "C" int __fstatfs(int, struct statfs*);
-extern "C" int __statfs(const char*, struct statfs*);
-#  define __fstatfs64(fd,size,buf) __fstatfs(fd,buf)
-#  define __statfs64(path,size,buf) __statfs(path,buf)
-#else
-extern "C" int __fstatfs64(int, size_t, struct statfs*);
-extern "C" int __statfs64(const char*, size_t, struct statfs*);
-#endif
-
-// The kernel sets a private ST_VALID flag to signal to the C library
-// whether the f_flags field is valid. This flag should not be exposed to
-// users of the C library.
-#define ST_VALID 0x0020
-
-int fstatfs(int fd, struct statfs* result) {
-  int rc = __fstatfs64(fd, sizeof(*result), result);
-  if (rc != 0) {
-    return rc;
-  }
-  result->f_flags &= ~ST_VALID;
-  return 0;
-}
-__strong_alias(fstatfs64, fstatfs);
-
-int statfs(const char* path, struct statfs* result) {
-  int rc = __statfs64(path, sizeof(*result), result);
-  if (rc != 0) {
-    return rc;
-  }
-  result->f_flags &= ~ST_VALID;
-  return 0;
-}
-__strong_alias(statfs64, statfs);
diff --git a/libc/bionic/sys_statvfs.cpp b/libc/bionic/sys_statvfs.cpp
deleted file mode 100644
index ef5dc57..0000000
--- a/libc/bionic/sys_statvfs.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/statvfs.h>
-
-// libc++ uses statvfs (for Darwin compatibility), but on Linux statvfs is
-// just another name for statfs, so it didn't arrive until API level 19. We
-// make the implementation available as inlines to support std::filesystem
-// for NDK users (see https://github.com/android-ndk/ndk/issues/609).
-
-#define __BIONIC_SYS_STATVFS_INLINE /* Out of line. */
-#define __BIONIC_NEED_STATVFS_INLINES
-#undef __BIONIC_NEED_STATVFS64_INLINES
-#include <bits/sys_statvfs_inlines.h>
-
-// Historically we provided actual symbols for statvfs64 and fstatvfs64.
-// They're not particularly useful, but we can't take them away.
-__strong_alias(statvfs64, statvfs);
-__strong_alias(fstatvfs64, fstatvfs);
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index e981a58..c508db1 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -46,7 +46,6 @@
 
 #include "private/bionic_defs.h"
 #include "private/bionic_macros.h"
-#include "private/ScopedFd.h"
 
 static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
 static const char* kServiceVersionPropertyName = "ro.property_service.version";
@@ -54,8 +53,8 @@
 class PropertyServiceConnection {
  public:
   PropertyServiceConnection() : last_error_(0) {
-    socket_.reset(::socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0));
-    if (socket_.get() == -1) {
+    socket_ = ::socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
+    if (socket_ == -1) {
       last_error_ = errno;
       return;
     }
@@ -67,15 +66,15 @@
     addr.sun_family = AF_LOCAL;
     socklen_t alen = namelen + offsetof(sockaddr_un, sun_path) + 1;
 
-    if (TEMP_FAILURE_RETRY(connect(socket_.get(),
-                                   reinterpret_cast<sockaddr*>(&addr), alen)) == -1) {
+    if (TEMP_FAILURE_RETRY(connect(socket_, reinterpret_cast<sockaddr*>(&addr), alen)) == -1) {
       last_error_ = errno;
-      socket_.reset();
+      close(socket_);
+      socket_ = -1;
     }
   }
 
   bool IsValid() {
-    return socket_.get() != -1;
+    return socket_ != -1;
   }
 
   int GetLastError() {
@@ -83,12 +82,18 @@
   }
 
   bool RecvInt32(int32_t* value) {
-    int result = TEMP_FAILURE_RETRY(recv(socket_.get(), value, sizeof(*value), MSG_WAITALL));
+    int result = TEMP_FAILURE_RETRY(recv(socket_, value, sizeof(*value), MSG_WAITALL));
     return CheckSendRecvResult(result, sizeof(*value));
   }
 
   int socket() {
-    return socket_.get();
+    return socket_;
+  }
+
+  ~PropertyServiceConnection() {
+    if (socket_ != -1) {
+      close(socket_);
+    }
   }
 
  private:
@@ -104,7 +109,7 @@
     return last_error_ == 0;
   }
 
-  ScopedFd socket_;
+  int socket_;
   int last_error_;
 
   friend class SocketWriter;
diff --git a/libc/bionic/threads.cpp b/libc/bionic/threads.cpp
deleted file mode 100644
index f597580..0000000
--- a/libc/bionic/threads.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 <threads.h>
-
-#define __BIONIC_THREADS_INLINE /* Out of line. */
-#include <bits/threads_inlines.h>
diff --git a/libc/bionic/usleep.cpp b/libc/bionic/usleep.cpp
deleted file mode 100644
index 2204684..0000000
--- a/libc/bionic/usleep.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <unistd.h>
-
-#include <time.h>
-
-int usleep(useconds_t us) {
-  timespec ts;
-  ts.tv_sec = us / 1000000;
-  ts.tv_nsec = (us % 1000000) * 1000;
-  return nanosleep(&ts, nullptr);
-}
diff --git a/libc/bionic/wctype.cpp b/libc/bionic/wctype.cpp
index 082dada..6e33b6c 100644
--- a/libc/bionic/wctype.cpp
+++ b/libc/bionic/wctype.cpp
@@ -117,24 +117,12 @@
 }
 
 wint_t towlower(wint_t wc) {
-  if (wc < 0x80) {
-    if (wc >= 'A' && wc <= 'Z') return wc | 0x20;
-    return wc;
-  }
-
   typedef UChar32 (*FnT)(UChar32);
   static auto u_tolower = reinterpret_cast<FnT>(__find_icu_symbol("u_tolower"));
   return u_tolower ? u_tolower(wc) : tolower(wc);
 }
 
 wint_t towupper(wint_t wc) {
-  if (wc < 0x80) {
-    // Using EOR rather than AND makes no difference on arm, but saves an
-    // instruction on arm64.
-    if (wc >= 'a' && wc <= 'z') return wc ^ 0x20;
-    return wc;
-  }
-
   typedef UChar32 (*FnT)(UChar32);
   static auto u_toupper = reinterpret_cast<FnT>(__find_icu_symbol("u_toupper"));
   return u_toupper ? u_toupper(wc) : toupper(wc);
diff --git a/libc/dns/nameser/ns_name.c b/libc/dns/nameser/ns_name.c
index c2dc80f..3a202c1 100644
--- a/libc/dns/nameser/ns_name.c
+++ b/libc/dns/nameser/ns_name.c
@@ -692,7 +692,7 @@
 {
 	const u_char *cp;
 	u_int n;
-	int l=0;
+	int l;
 
 	cp = *ptrptr;
 	while (cp < eom && (n = *cp++) != 0) {
@@ -702,7 +702,7 @@
 			cp += n;
 			continue;
 		case NS_TYPE_ELT: /* EDNS0 extended label */
-			if (cp < eom && (l = labellen(cp - 1)) < 0) {
+			if ((l = labellen(cp - 1)) < 0) {
 				errno = EMSGSIZE; /* XXX */
 				return(-1);
 			}
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
index d0c11d2..4e1aa61 100644
--- a/libc/dns/net/getaddrinfo.c
+++ b/libc/dns/net/getaddrinfo.c
@@ -470,7 +470,7 @@
 			break;
 		}
 
-		ai = calloc(1, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage));
+		struct addrinfo* ai = calloc(1, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage));
 		if (ai == NULL) {
 			break;
 		}
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 577fb00..a175857 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -31,85 +31,75 @@
 /**
  * @file android/api-level.h
  * @brief Functions and constants for dealing with multiple API levels.
- *
- * See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
  */
 
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
 
+#ifndef __ANDROID_API_FUTURE__
 /**
- * Magic version number for an Android OS build which has not yet turned
- * into an official release, for comparison against `__ANDROID_API__`. See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * Magic version number for an Android OS build which has
+ * not yet turned into an official release,
+ * for comparisons against __ANDROID_API__.
  */
 #define __ANDROID_API_FUTURE__ 10000
+#endif
 
-/* This #ifndef should never be true except when doxygen is generating docs. */
 #ifndef __ANDROID_API__
 /**
  * `__ANDROID_API__` is the API level being targeted. For the OS,
  * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the
- * compiler system based on the API level you claimed to target. See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * compiler/build system based on the API level you claimed to target.
  */
 #define __ANDROID_API__ __ANDROID_API_FUTURE__
 #endif
 
-/** Names the Gingerbread API level (9), for comparison against `__ANDROID_API__`. */
+/** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_G__ 9
 
-/** Names the Ice-Cream Sandwich API level (14), for comparison against `__ANDROID_API__`. */
+/** Names the Ice-Cream Sandwich API level (14), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_I__ 14
 
-/** Names the Jellybean API level (16), for comparison against `__ANDROID_API__`. */
+/** Names the Jellybean API level (16), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_J__ 16
 
-/** Names the Jellybean MR1 API level (17), for comparison against `__ANDROID_API__`. */
+/** Names the Jellybean MR1 API level (17), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_J_MR1__ 17
 
-/** Names the Jellybean MR2 API level (18), for comparison against `__ANDROID_API__`. */
+/** Names the Jellybean MR2 API level (18), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_J_MR2__ 18
 
-/** Names the KitKat API level (19), for comparison against `__ANDROID_API__`. */
+/** Names the KitKat API level (19), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_K__ 19
 
-/** Names the Lollipop API level (21), for comparison against `__ANDROID_API__`. */
+/** Names the Lollipop API level (21), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_L__ 21
 
-/** Names the Lollipop MR1 API level (22), for comparison against `__ANDROID_API__`. */
+/** Names the Lollipop MR1 API level (22), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_L_MR1__ 22
 
-/** Names the Marshmallow API level (23), for comparison against `__ANDROID_API__`. */
+/** Names the Marshmallow API level (23), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_M__ 23
 
-/** Names the Nougat API level (24), for comparison against `__ANDROID_API__`. */
+/** Names the Nougat API level (24), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_N__ 24
 
-/** Names the Nougat MR1 API level (25), for comparison against `__ANDROID_API__`. */
+/** Names the Nougat MR1 API level (25), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_N_MR1__ 25
 
-/** Names the Oreo API level (26), for comparison against `__ANDROID_API__`. */
+/** Names the Oreo API level (26), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_O__ 26
 
-/** Names the Oreo MR1 API level (27), for comparison against `__ANDROID_API__`. */
+/** Names the Oreo MR1 API level (27), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_O_MR1__ 27
 
-/** Names the Pie API level (28), for comparison against `__ANDROID_API__`. */
+/** Names the Pie API level (28), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_P__ 28
 
-/**
- * Names the "Q" API level (29), for comparison against `__ANDROID_API__`.
- * This release was called Android 10 publicly, not to be (but sure to be)
- * confused with API level 10.
- */
+/** Names the "Q" API level (29), for comparisons against __ANDROID_API__. */
 #define __ANDROID_API_Q__ 29
 
-/** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */
-#define __ANDROID_API_R__ 30
-
 /**
  * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__`
  * if there is no known target SDK version (for code not running in the
diff --git a/libc/include/android/fdsan.h b/libc/include/android/fdsan.h
index 83b9318..1169ed0 100644
--- a/libc/include/android/fdsan.h
+++ b/libc/include/android/fdsan.h
@@ -197,8 +197,4 @@
  */
 enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level) __INTRODUCED_IN(29) __attribute__((__weak__));
 
-/*
- * Set the error level to the global setting if available, or a default value.
- */
-enum android_fdsan_error_level android_fdsan_set_error_level_from_property(enum android_fdsan_error_level default_level) __INTRODUCED_IN(30) __attribute__((__weak__));
 __END_DECLS
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
index d2c7677..5ca9813 100644
--- a/libc/include/android/legacy_signal_inlines.h
+++ b/libc/include/android/legacy_signal_inlines.h
@@ -52,7 +52,7 @@
 
 static __inline int __ndk_legacy___libc_current_sigrtmin() {
   if (__libc_current_sigrtmin) return __libc_current_sigrtmin();
-  return __SIGRTMIN + 7; /* Should match __libc_current_sigrtmin. */
+  return __SIGRTMIN + 6; /* Should match __libc_current_sigrtmin. */
 }
 
 #undef SIGRTMAX
diff --git a/libc/include/android/legacy_sys_statvfs_inlines.h b/libc/include/android/legacy_sys_statvfs_inlines.h
deleted file mode 100644
index 369e6a2..0000000
--- a/libc/include/android/legacy_sys_statvfs_inlines.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-/**
- * @file legacy_sys_statvfs_inlines.h
- * @brief Inline definitions of statvfs/fstatvfs for old API levels.
- */
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#define __BIONIC_NEED_STATVFS64_INLINES
-#if __ANDROID_API__ < 19
-#define __BIONIC_NEED_STATVFS_INLINES
-#endif
-
-#define __BIONIC_SYS_STATVFS_INLINE static __inline
-#include <bits/sys_statvfs_inlines.h>
-
-#endif
diff --git a/libc/include/android/legacy_threads_inlines.h b/libc/include/android/legacy_threads_inlines.h
deleted file mode 100644
index e73ef37..0000000
--- a/libc/include/android/legacy_threads_inlines.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < __ANDROID_API_R__
-
-#define __BIONIC_THREADS_INLINE static __inline
-#include <bits/threads_inlines.h>
-
-#endif
diff --git a/libc/include/arpa/nameser.h b/libc/include/arpa/nameser.h
index 89ece1c..e0b5c45 100644
--- a/libc/include/arpa/nameser.h
+++ b/libc/include/arpa/nameser.h
@@ -591,29 +591,33 @@
 /* The names of these symbols were accidentally prefixed with __ in L. */
 /* The duplication here is intentional to avoid declaring different symbols with the same
  * declaration. */
-int ns_msg_getflag(ns_msg __handle, int __flag) __INTRODUCED_IN_64(22);
-uint16_t ns_get16(const u_char* __src) __INTRODUCED_IN_64(22);
-uint32_t ns_get32(const u_char* __src) __INTRODUCED_IN_64(22);
-void ns_put16(uint16_t __src, u_char* __dst) __INTRODUCED_IN_64(22);
-void ns_put32(uint32_t __src, u_char* __dst) __INTRODUCED_IN_64(22);
-int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle) __INTRODUCED_IN_64(22);
-int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count) __INTRODUCED_IN_64(22);
-int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr) __INTRODUCED_IN_64(22);
-int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom) __INTRODUCED_IN_64(22);
-void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(22);
+int ns_msg_getflag(ns_msg __handle, int __flag) __INTRODUCED_IN_64(23);
+uint16_t ns_get16(const u_char* __src) __INTRODUCED_IN_64(23);
+uint32_t ns_get32(const u_char* __src) __INTRODUCED_IN_64(23);
+void ns_put16(uint16_t __src, u_char* __dst) __INTRODUCED_IN_64(23);
+void ns_put32(uint32_t __src, u_char* __dst) __INTRODUCED_IN_64(23);
+int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle) __INTRODUCED_IN_64(23);
+int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count) __INTRODUCED_IN_64(23);
+int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr) __INTRODUCED_IN_64(23);
+int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size)
+  __INTRODUCED_IN_64(23);
+int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(23);
+int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size)
+  __INTRODUCED_IN_64(23);
+int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(23);
+int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size)
+  __INTRODUCED_IN_64(23);
+int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr)
+  __INTRODUCED_IN_64(23);
+int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom) __INTRODUCED_IN_64(23);
+void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(23);
 
-int ns_makecanon(const char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_samename(const char* __lhs, const char* __rhs) __INTRODUCED_IN_64(22);
+int ns_makecanon(const char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_samename(const char* __lhs, const char* __rhs) __INTRODUCED_IN_64(23);
 #endif /* !defined(__LP64__) */
 
 __END_DECLS
diff --git a/libc/include/bits/elf_arm64.h b/libc/include/bits/elf_arm64.h
index 6bb8384..d838c0b 100644
--- a/libc/include/bits/elf_arm64.h
+++ b/libc/include/bits/elf_arm64.h
@@ -83,9 +83,9 @@
 #define R_AARCH64_GLOB_DAT              1025    /* Create GOT entry.  */
 #define R_AARCH64_JUMP_SLOT             1026    /* Create PLT entry.  */
 #define R_AARCH64_RELATIVE              1027    /* Adjust by program base.  */
-#define R_AARCH64_TLS_DTPMOD            1028    /* Module index. */
-#define R_AARCH64_TLS_DTPREL            1029    /* Module-relative offset. */
-#define R_AARCH64_TLS_TPREL             1030    /* TP-relative offset. */
+#define R_AARCH64_TLS_DTPREL64          1028    /* Module-relative offset. */
+#define R_AARCH64_TLS_DTPMOD64          1029    /* Module index. */
+#define R_AARCH64_TLS_TPREL64           1030    /* TP-relative offset. */
 #define R_AARCH64_TLSDESC               1031    /* 16-byte descriptor: resolver func + arg. */
 #define R_AARCH64_IRELATIVE             1032
 
diff --git a/libc/include/bits/fortify/fcntl.h b/libc/include/bits/fortify/fcntl.h
index ded62ee..e7f2c82 100644
--- a/libc/include/bits/fortify/fcntl.h
+++ b/libc/include/bits/fortify/fcntl.h
@@ -45,6 +45,7 @@
 /* O_TMPFILE shares bits with O_DIRECTORY. */
 #define __open_modes_useful(flags) (((flags) & O_CREAT) || ((flags) & O_TMPFILE) == O_TMPFILE)
 
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
 __BIONIC_ERROR_FUNCTION_VISIBILITY
 int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
         __errorattr(__open_too_many_args_error);
@@ -59,11 +60,7 @@
 int open(const char* const __pass_object_size pathname, int flags)
         __overloadable
         __clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
     return __open_2(pathname, flags);
-#else
-    return __open_real(pathname, flags);
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 }
 
 __BIONIC_FORTIFY_INLINE
@@ -83,11 +80,7 @@
 int openat(int dirfd, const char* const __pass_object_size pathname, int flags)
         __overloadable
         __clang_error_if(__open_modes_useful(flags), "'openat' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
     return __openat_2(dirfd, pathname, flags);
-#else
-    return __openat_real(dirfd, pathname, flags);
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 }
 
 __BIONIC_FORTIFY_INLINE
@@ -97,49 +90,7 @@
                            "'openat' " __open_useless_modes_warning) {
     return __openat_real(dirfd, pathname, flags, modes);
 }
-
-#if __ANDROID_API__ >= __ANDROID_API_L__
-/* Note that open == open64, so we reuse those bits in the open64 variants below.  */
-
-__BIONIC_ERROR_FUNCTION_VISIBILITY
-int open64(const char* pathname, int flags, mode_t modes, ...) __overloadable
-        __errorattr(__open_too_many_args_error);
-
-__BIONIC_FORTIFY_INLINE
-int open64(const char* const __pass_object_size pathname, int flags)
-        __overloadable
-        __clang_error_if(__open_modes_useful(flags), "'open64' " __open_too_few_args_error) {
-    return __open_2(pathname, flags);
-}
-
-__BIONIC_FORTIFY_INLINE
-int open64(const char* const __pass_object_size pathname, int flags, mode_t modes)
-        __overloadable
-        __clang_warning_if(!__open_modes_useful(flags) && modes,
-                           "'open64' " __open_useless_modes_warning) {
-    return __open_real(pathname, flags, modes);
-}
-
-__BIONIC_ERROR_FUNCTION_VISIBILITY
-int openat64(int dirfd, const char* pathname, int flags, mode_t modes, ...)
-        __overloadable
-        __errorattr(__open_too_many_args_error);
-
-__BIONIC_FORTIFY_INLINE
-int openat64(int dirfd, const char* const __pass_object_size pathname, int flags)
-        __overloadable
-        __clang_error_if(__open_modes_useful(flags), "'openat64' " __open_too_few_args_error) {
-    return __openat_2(dirfd, pathname, flags);
-}
-
-__BIONIC_FORTIFY_INLINE
-int openat64(int dirfd, const char* const __pass_object_size pathname, int flags, mode_t modes)
-        __overloadable
-        __clang_warning_if(!__open_modes_useful(flags) && modes,
-                           "'openat64' " __open_useless_modes_warning) {
-    return __openat_real(dirfd, pathname, flags, modes);
-}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
 #undef __open_too_many_args_error
 #undef __open_too_few_args_error
diff --git a/libc/include/bits/fortify/poll.h b/libc/include/bits/fortify/poll.h
index 7a727a4..718ee96 100644
--- a/libc/include/bits/fortify/poll.h
+++ b/libc/include/bits/fortify/poll.h
@@ -35,57 +35,51 @@
 int __ppoll64_chk(struct pollfd*, nfds_t, const struct timespec*, const sigset64_t*, size_t) __INTRODUCED_IN(28);
 
 #if defined(__BIONIC_FORTIFY)
-#define __bos_fd_count_trivially_safe(bos_val, fds, fd_count)              \
-  __bos_dynamic_check_impl_and((bos_val), >=, (sizeof(*fds) * (fd_count)), \
-                               (fd_count) <= __BIONIC_CAST(static_cast, nfds_t, -1) / sizeof(*fds))
+#if __ANDROID_API__ >= __ANDROID_API_M__
 
 __BIONIC_FORTIFY_INLINE
 int poll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, int timeout)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
+    __clang_error_if(__bos(fds) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                       __bos(fds) < sizeof(*fds) * fd_count,
                      "in call to 'poll', fd_count is larger than the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_M__
   size_t bos_fds = __bos(fds);
 
-  if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
-    return __poll_chk(fds, fd_count, timeout, bos_fds);
+  if (bos_fds == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+    return __call_bypassing_fortify(poll)(fds, fd_count, timeout);
   }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-  return __call_bypassing_fortify(poll)(fds, fd_count, timeout);
+  return __poll_chk(fds, fd_count, timeout, bos_fds);
 }
 
-#if __ANDROID_API__ >= __ANDROID_API_L__
 __BIONIC_FORTIFY_INLINE
 int ppoll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset_t* mask)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
+    __clang_error_if(__bos(fds) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                       __bos(fds) < sizeof(*fds) * fd_count,
                      "in call to 'ppoll', fd_count is larger than the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_M__
   size_t bos_fds = __bos(fds);
 
-  if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
-    return __ppoll_chk(fds, fd_count, timeout, mask, bos_fds);
+  if (bos_fds == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+    return __call_bypassing_fortify(ppoll)(fds, fd_count, timeout, mask);
   }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-  return __call_bypassing_fortify(ppoll)(fds, fd_count, timeout, mask);
+  return __ppoll_chk(fds, fd_count, timeout, mask, bos_fds);
 }
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
 
 #if __ANDROID_API__ >= __ANDROID_API_P__
 __BIONIC_FORTIFY_INLINE
 int ppoll64(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset64_t* mask)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
+    __clang_error_if(__bos(fds) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                       __bos(fds) < sizeof(*fds) * fd_count,
                      "in call to 'ppoll64', fd_count is larger than the given buffer") {
   size_t bos_fds = __bos(fds);
 
-  if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
-    return __ppoll64_chk(fds, fd_count, timeout, mask, bos_fds);
+  if (bos_fds == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+    return __call_bypassing_fortify(ppoll64)(fds, fd_count, timeout, mask);
   }
-  return __call_bypassing_fortify(ppoll64)(fds, fd_count, timeout, mask);
+  return __ppoll64_chk(fds, fd_count, timeout, mask, bos_fds);
 }
-#endif /* __ANDROID_API__ >= __ANDROID_API_P__ */
+#endif
 
-#undef __bos_fd_count_trivially_safe
-
+#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
 #endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/socket.h b/libc/include/bits/fortify/socket.h
index cf5f189..3d070c5 100644
--- a/libc/include/bits/fortify/socket.h
+++ b/libc/include/bits/fortify/socket.h
@@ -37,40 +37,43 @@
 
 #if defined(__BIONIC_FORTIFY)
 
+#define __recvfrom_bad_size "'recvfrom' called with size bigger than buffer"
+#define __sendto_bad_size "'sendto' called with size bigger than buffer"
+
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
-                     "'recvfrom' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__
+    __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos(buf) < len,
+                     __recvfrom_bad_size) {
   size_t bos = __bos0(buf);
 
-  if (!__bos_trivially_ge(bos, len)) {
-    return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len);
+  if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+    return __call_bypassing_fortify(recvfrom)(fd, buf, len, flags, src_addr, addr_len);
   }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-  return __call_bypassing_fortify(recvfrom)(fd, buf, len, flags, src_addr, addr_len);
+  return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len);
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
 
+#if __ANDROID_API__ >= __ANDROID_API_N_MR1__
 __BIONIC_FORTIFY_INLINE
 ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, int flags, const struct sockaddr* dest_addr, socklen_t addr_len)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
-                     "'sendto' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N_MR1__
+    __clang_error_if(__bos0(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(buf) < len,
+                     __sendto_bad_size) {
   size_t bos = __bos0(buf);
 
-  if (!__bos_trivially_ge(bos, len)) {
-    return __sendto_chk(fd, buf, len, bos, flags, dest_addr, addr_len);
+  if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+    return __call_bypassing_fortify(sendto)(fd, buf, len, flags, dest_addr, addr_len);
   }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N_MR1__ */
-  return __call_bypassing_fortify(sendto)(fd, buf, len, flags, dest_addr, addr_len);
+  return __sendto_chk(fd, buf, len, bos, flags, dest_addr, addr_len);
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_N_MR1__ */
 
 __BIONIC_FORTIFY_INLINE
 ssize_t recv(int socket, void* const buf __pass_object_size0, size_t len, int flags)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
+    __clang_error_if(__bos0(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(buf) < len,
                      "'recv' called with size bigger than buffer") {
   return recvfrom(socket, buf, len, flags, NULL, 0);
 }
@@ -78,9 +81,11 @@
 __BIONIC_FORTIFY_INLINE
 ssize_t send(int socket, const void* const buf __pass_object_size0, size_t len, int flags)
     __overloadable
-    __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
+    __clang_error_if(__bos0(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(buf) < len,
                      "'send' called with size bigger than buffer") {
   return sendto(socket, buf, len, flags, NULL, 0);
 }
 
+#undef __recvfrom_bad_size
+#undef __sendto_bad_size
 #endif /* __BIONIC_FORTIFY */
diff --git a/libc/include/bits/fortify/stat.h b/libc/include/bits/fortify/stat.h
index 6a2e822..b248aca 100644
--- a/libc/include/bits/fortify/stat.h
+++ b/libc/include/bits/fortify/stat.h
@@ -31,21 +31,21 @@
 #endif
 
 mode_t __umask_chk(mode_t) __INTRODUCED_IN(18);
-mode_t __umask_real(mode_t mode) __RENAME(umask);
 
 #if defined(__BIONIC_FORTIFY)
+#define __umask_invalid_mode_str "'umask' called with invalid mode"
 
+#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
 /* Abuse enable_if to make this an overload of umask. */
 __BIONIC_FORTIFY_INLINE
 mode_t umask(mode_t mode)
     __overloadable
     __enable_if(1, "")
-    __clang_error_if(mode & ~0777, "'umask' called with invalid mode") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
+    __clang_error_if(mode & ~0777, __umask_invalid_mode_str) {
   return __umask_chk(mode);
-#else
-  return __umask_real(mode);
-#endif  /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
+
+#undef __umask_invalid_mode_str
 
 #endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/stdio.h b/libc/include/bits/fortify/stdio.h
index 528d5fb..0b5700a 100644
--- a/libc/include/bits/fortify/stdio.h
+++ b/libc/include/bits/fortify/stdio.h
@@ -37,7 +37,6 @@
 #if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
 
 #if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE __printflike(3, 0)
 int vsnprintf(char* const __pass_object_size dest, size_t size, const char* format, va_list ap)
         __overloadable {
@@ -50,24 +49,19 @@
 }
 #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+/*
+ * Simple case: `format` can't have format specifiers, so we can just compare
+ * its length to the length of `dest`
+ */
 __BIONIC_ERROR_FUNCTION_VISIBILITY
-int sprintf(char* dest, const char* format)
+int snprintf(char* dest, size_t size, const char* format)
     __overloadable
-    __enable_if(__bos_unevaluated_lt(__bos(dest), __builtin_strlen(format)),
+    __enable_if(__bos(dest) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                    __bos(dest) < __builtin_strlen(format),
                 "format string will always overflow destination buffer")
     __errorattr("format string will always overflow destination buffer");
 
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
-int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
-    va_list va;
-    va_start(va, format);
-    int result = __builtin___vsprintf_chk(dest, 0, __bos(dest), format, va);
-    va_end(va);
-    return result;
-}
-
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_VARIADIC __printflike(3, 4)
 int snprintf(char* const __pass_object_size dest, size_t size, const char* format, ...)
         __overloadable {
@@ -77,27 +71,39 @@
     va_end(va);
     return result;
 }
+
+__BIONIC_ERROR_FUNCTION_VISIBILITY
+int sprintf(char* dest, const char* format)
+    __overloadable
+    __enable_if(__bos(dest) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                __bos(dest) < __builtin_strlen(format),
+                "format string will always overflow destination buffer")
+    __errorattr("format string will always overflow destination buffer");
+
+__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
+int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
+    va_list va;
+    va_start(va, format);
+    int result = __builtin___vsprintf_chk(dest, 0, __bos(dest), format, va);
+    va_end(va);
+    return result;
+}
 #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
-#define __bos_trivially_ge_mul(bos_val, size, count) \
-  __bos_dynamic_check_impl_and(bos_val, >=, (size) * (count), \
-                               !__unsafe_check_mul_overflow(size, count))
-
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 size_t fread(void* const __pass_object_size0 buf, size_t size, size_t count, FILE* stream)
         __overloadable
         __clang_error_if(__unsafe_check_mul_overflow(size, count),
                          "in call to 'fread', size * count overflows")
-        __clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
+        __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf),
                          "in call to 'fread', size * count is too large for the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_mul(bos, size, count)) {
-        return __fread_chk(buf, size, count, stream, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(fread)(buf, size, count, stream);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __call_bypassing_fortify(fread)(buf, size, count, stream);
+    return __fread_chk(buf, size, count, stream, bos);
 }
 
 __BIONIC_FORTIFY_INLINE
@@ -105,33 +111,33 @@
         __overloadable
         __clang_error_if(__unsafe_check_mul_overflow(size, count),
                          "in call to 'fwrite', size * count overflows")
-        __clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
+        __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf),
                          "in call to 'fwrite', size * count is too large for the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_mul(bos, size, count)) {
-        return __fwrite_chk(buf, size, count, stream, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(fwrite)(buf, size, count, stream);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __call_bypassing_fortify(fwrite)(buf, size, count, stream);
-}
-#undef __bos_trivially_ge_mul
 
+    return __fwrite_chk(buf, size, count, stream, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
 __BIONIC_FORTIFY_INLINE
 char* fgets(char* const __pass_object_size dest, int size, FILE* stream)
         __overloadable
         __clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
-        __clang_error_if(__bos_unevaluated_lt(__bos(dest), size),
+        __clang_error_if(size > __bos(dest),
                          "in call to 'fgets', size is larger than the destination buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
     size_t bos = __bos(dest);
 
-    if (!__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
-        return __fgets_chk(dest, size, stream, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(fgets)(dest, size, stream);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __call_bypassing_fortify(fgets)(dest, size, stream);
+
+    return __fgets_chk(dest, size, stream, bos);
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
 #endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/stdlib.h b/libc/include/bits/fortify/stdlib.h
index 623be58..d47c0b0 100644
--- a/libc/include/bits/fortify/stdlib.h
+++ b/libc/include/bits/fortify/stdlib.h
@@ -31,17 +31,18 @@
 #endif
 
 #if defined(__BIONIC_FORTIFY)
+#define __realpath_buf_too_small_str \
+    "'realpath' output parameter must be NULL or a pointer to a buffer with >= PATH_MAX bytes"
 
 /* PATH_MAX is unavailable without polluting the namespace, but it's always 4096 on Linux */
 #define __PATH_MAX 4096
 
 char* realpath(const char* path, char* resolved)
-        __clang_error_if(!path, "'realpath': NULL path is never correct; flipped arguments?")
-        __clang_error_if(__bos_unevaluated_lt(__bos(resolved), __PATH_MAX),
-                         "'realpath' output parameter must be NULL or a pointer to a buffer "
-                         "with >= PATH_MAX bytes");
-
+        __clang_error_if(__bos(resolved) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                         __bos(resolved) < __PATH_MAX, __realpath_buf_too_small_str)
+        __clang_error_if(!path, "'realpath': NULL path is never correct; flipped arguments?");
 /* No need for a definition; the only issues we can catch are at compile-time. */
 
 #undef __PATH_MAX
+#undef __realpath_buf_too_small_str
 #endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/string.h b/libc/include/bits/fortify/string.h
index bd36483..14bb133 100644
--- a/libc/include/bits/fortify/string.h
+++ b/libc/include/bits/fortify/string.h
@@ -41,112 +41,71 @@
 extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
 
 #if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
 void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
-        __overloadable {
-    size_t bos_dst = __bos0(dst);
-    if (__bos_trivially_ge(bos_dst, copy_amount)) {
-        return __builtin_memcpy(dst, src, copy_amount);
-    }
-    return __builtin___memcpy_chk(dst, src, copy_amount, bos_dst);
+        __overloadable
+        __clang_error_if(__bos0(dst) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(dst) < copy_amount,
+                         "'memcpy' called with size bigger than buffer") {
+    return __builtin___memcpy_chk(dst, src, copy_amount, __bos0(dst));
 }
 
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
-void* memmove(void* const dst __pass_object_size0, const void* src, size_t len) __overloadable {
-    size_t bos_dst = __bos0(dst);
-    if (__bos_trivially_ge(bos_dst, len)) {
-        return __builtin_memmove(dst, src, len);
-    }
-    return __builtin___memmove_chk(dst, src, len, bos_dst);
+void* memmove(void* const dst __pass_object_size0, const void* src, size_t len)
+        __overloadable
+        __clang_error_if(__bos0(dst) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(dst) < len,
+                         "'memmove' called with size bigger than buffer") {
+    return __builtin___memmove_chk(dst, src, len, __bos0(dst));
 }
 #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
-#if defined(__USE_GNU)
-#if __ANDROID_API__ >= __ANDROID_API_R__
-__BIONIC_FORTIFY_INLINE
-void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_lt(__bos0(dst), copy_amount),
-                         "'mempcpy' called with size bigger than buffer") {
-    size_t bos_dst = __bos0(dst);
-    if (__bos_trivially_ge(bos_dst, copy_amount)) {
-        return __builtin_mempcpy(dst, src, copy_amount);
-    }
-    return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
-}
-#endif /* __ANDROID_API__ >= __ANDROID_API_R__ */
-#endif /* __USE_GNU */
-
+#if __ANDROID_API__ >= __ANDROID_API_L__
 __BIONIC_FORTIFY_INLINE
 char* stpcpy(char* const dst __pass_object_size, const char* src)
         __overloadable
-        __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
+        __clang_error_if(__bos(dst) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                             __bos(dst) <= __builtin_strlen(src),
                          "'stpcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_L__
-    size_t bos_dst = __bos(dst);
-    if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
-        return __builtin___stpcpy_chk(dst, src, bos_dst);
-    }
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
-    return __builtin_stpcpy(dst, src);
+    return __builtin___stpcpy_chk(dst, src, __bos(dst));
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
 
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
 __BIONIC_FORTIFY_INLINE
 char* strcpy(char* const dst __pass_object_size, const char* src)
         __overloadable
-        __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
+        __clang_error_if(__bos(dst) != __BIONIC_FORTIFY_UNKNOWN_SIZE &&
+                             __bos(dst) <= __builtin_strlen(src),
                          "'strcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-    size_t bos_dst = __bos(dst);
-    if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
-        return __builtin___strcpy_chk(dst, src, bos_dst);
-    }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __builtin_strcpy(dst, src);
+    return __builtin___strcpy_chk(dst, src, __bos(dst));
 }
 
 __BIONIC_FORTIFY_INLINE
-char* strcat(char* const dst __pass_object_size, const char* src)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
-                         "'strcat' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+char* strcat(char* const dst __pass_object_size, const char* src) __overloadable {
     return __builtin___strcat_chk(dst, src, __bos(dst));
-#else
-    return __builtin_strcat(dst, src);
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 }
 
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
 char* strncat(char* const dst __pass_object_size, const char* src, size_t n) __overloadable {
     return __builtin___strncat_chk(dst, src, n, __bos(dst));
 }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
-void* memset(void* const s __pass_object_size0, int c, size_t n) __overloadable
+void* memset(void* const s __pass_object_size0, int c, size_t n)
+        __overloadable
+        __clang_error_if(__bos0(s) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(s) < n,
+                         "'memset' called with size bigger than buffer")
         /* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
         __clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-    size_t bos = __bos0(s);
-    if (!__bos_trivially_ge(bos, n)) {
-        return __builtin___memset_chk(s, c, n, bos);
-    }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __builtin_memset(s, c, n);
+    return __builtin___memset_chk(s, c, n, __bos0(s));
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
 
 #if __ANDROID_API__ >= __ANDROID_API_M__
 __BIONIC_FORTIFY_INLINE
 void* memchr(const void* const s __pass_object_size, int c, size_t n) __overloadable {
     size_t bos = __bos(s);
 
-    if (__bos_trivially_ge(bos, n)) {
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
         return __builtin_memchr(s, c, n);
     }
 
@@ -157,7 +116,7 @@
 void* __memrchr_fortify(const void* const __pass_object_size s, int c, size_t n) __overloadable {
     size_t bos = __bos(s);
 
-    if (__bos_trivially_ge(bos, n)) {
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
         return __memrchr_real(s, c, n);
     }
 
@@ -166,7 +125,6 @@
 #endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
 char* stpncpy(char* const dst __pass_object_size, const char* const src __pass_object_size, size_t n)
         __overloadable {
@@ -181,7 +139,6 @@
     return __stpncpy_chk2(dst, src, n, bos_dst, bos_src);
 }
 
-/* No diag -- clang diagnoses misuses of this on its own.  */
 __BIONIC_FORTIFY_INLINE
 char* strncpy(char* const dst __pass_object_size, const char* const src __pass_object_size, size_t n)
         __overloadable {
@@ -197,71 +154,77 @@
 }
 #endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
 
-__BIONIC_FORTIFY_INLINE
-size_t strlcpy(char* const dst __pass_object_size, const char* src, size_t size)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
-                         "'strlcpy' called with size bigger than buffer") {
 #if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+__BIONIC_FORTIFY_INLINE
+size_t strlcpy(char* const dst __pass_object_size, const char* src, size_t size) __overloadable {
     size_t bos = __bos(dst);
 
-    if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
-        return __strlcpy_chk(dst, src, size, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(strlcpy)(dst, src, size);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __call_bypassing_fortify(strlcpy)(dst, src, size);
+
+    return __strlcpy_chk(dst, src, size, bos);
 }
 
 __BIONIC_FORTIFY_INLINE
-size_t strlcat(char* const dst __pass_object_size, const char* src, size_t size)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
-                         "'strlcat' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+size_t strlcat(char* const dst __pass_object_size, const char* src, size_t size) __overloadable {
     size_t bos = __bos(dst);
 
-    if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
-        return __strlcat_chk(dst, src, size, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(strlcat)(dst, src, size);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __call_bypassing_fortify(strlcat)(dst, src, size);
+
+    return __strlcat_chk(dst, src, size, bos);
+}
+
+/*
+ * If we can evaluate the size of s at compile-time, just call __builtin_strlen
+ * on it directly. This makes it way easier for compilers to fold things like
+ * strlen("Foo") into a constant, as users would expect. -1ULL is chosen simply
+ * because it's large.
+ */
+__BIONIC_FORTIFY_INLINE
+size_t strlen(const char* const s __pass_object_size)
+        __overloadable __enable_if(__builtin_strlen(s) != -1ULL,
+                                   "enabled if s is a known good string.") {
+    return __builtin_strlen(s);
 }
 
 __BIONIC_FORTIFY_INLINE
 size_t strlen(const char* const s __pass_object_size0) __overloadable {
     size_t bos = __bos0(s);
 
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-    if (!__bos_trivially_gt(bos, __builtin_strlen(s))) {
-        return __strlen_chk(s, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __builtin_strlen(s);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    return __builtin_strlen(s);
-}
 
+    return __strlen_chk(s, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+
+#if  __ANDROID_API__ >= __ANDROID_API_J_MR2__
 __BIONIC_FORTIFY_INLINE
 char* strchr(const char* const s __pass_object_size, int c) __overloadable {
-#if  __ANDROID_API__ >= __ANDROID_API_J_MR2__
     size_t bos = __bos(s);
 
-    if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
-        return __strchr_chk(s, c, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __builtin_strchr(s, c);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
-    return __builtin_strchr(s, c);
+
+    return __strchr_chk(s, c, bos);
 }
 
 __BIONIC_FORTIFY_INLINE
 char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
-#if  __ANDROID_API__ >= __ANDROID_API_J_MR2__
     size_t bos = __bos(s);
 
-    if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
-        return __strrchr_chk(s, c, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __builtin_strrchr(s, c);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
-    return __builtin_strrchr(s, c);
+
+    return __strrchr_chk(s, c, bos);
 }
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
 
 #if __ANDROID_API__ >= __ANDROID_API_M__
 #if defined(__cplusplus)
diff --git a/libc/include/bits/fortify/strings.h b/libc/include/bits/fortify/strings.h
deleted file mode 100644
index cc268db..0000000
--- a/libc/include/bits/fortify/strings.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2019 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(__BIONIC_FORTIFY)
-
-__BIONIC_FORTIFY_INLINE
-void __bionic_bcopy(const void *src, void* const dst __pass_object_size0, size_t len)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_lt(__bos0(dst), len),
-                         "'bcopy' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-    size_t bos = __bos0(dst);
-    if (!__bos_trivially_ge(bos, len)) {
-        __builtin___memmove_chk(dst, src, len, bos);
-        return;
-    }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    __builtin_memmove(dst, src, len);
-}
-
-__BIONIC_FORTIFY_INLINE
-void __bionic_bzero(void* const b __pass_object_size0, size_t len)
-        __overloadable
-        __clang_error_if(__bos_unevaluated_lt(__bos0(b), len),
-                         "'bzero' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
-    size_t bos = __bos0(b);
-    if (!__bos_trivially_ge(bos, len)) {
-        __builtin___memset_chk(b, 0, len, bos);
-        return;
-    }
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-    __builtin_memset(b, 0, len);
-}
-
-#endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/unistd.h b/libc/include/bits/fortify/unistd.h
index 45ed2cf..a07907b 100644
--- a/libc/include/bits/fortify/unistd.h
+++ b/libc/include/bits/fortify/unistd.h
@@ -35,13 +35,14 @@
 ssize_t __pread_real(int, void*, size_t, off_t) __RENAME(pread);
 
 ssize_t __pread64_chk(int, void*, size_t, off64_t, size_t) __INTRODUCED_IN(23);
-ssize_t __pread64_real(int, void*, size_t, off64_t) __RENAME(pread64);
+ssize_t __pread64_real(int, void*, size_t, off64_t) __RENAME(pread64) __INTRODUCED_IN(12);
 
 ssize_t __pwrite_chk(int, const void*, size_t, off_t, size_t) __INTRODUCED_IN(24);
 ssize_t __pwrite_real(int, const void*, size_t, off_t) __RENAME(pwrite);
 
 ssize_t __pwrite64_chk(int, const void*, size_t, off64_t, size_t) __INTRODUCED_IN(24);
-ssize_t __pwrite64_real(int, const void*, size_t, off64_t) __RENAME(pwrite64);
+ssize_t __pwrite64_real(int, const void*, size_t, off64_t) __RENAME(pwrite64)
+  __INTRODUCED_IN(12);
 
 ssize_t __read_chk(int, void*, size_t, size_t) __INTRODUCED_IN(21);
 ssize_t __write_chk(int, const void*, size_t, size_t) __INTRODUCED_IN(24);
@@ -62,154 +63,146 @@
     __clang_error_if((what) > SSIZE_MAX, "in call to '" #fn "', '" #what "' must be <= SSIZE_MAX")
 
 #define __error_if_overflows_objectsize(what, objsize, fn) \
-    __clang_error_if(__bos_unevaluated_lt((objsize), (what)), \
+    __clang_error_if((objsize) != __BIONIC_FORTIFY_UNKNOWN_SIZE && (what) > (objsize), \
                      "in call to '" #fn "', '" #what "' bytes overflows the given object")
 
-#define __bos_trivially_ge_no_overflow(bos_val, index)  \
-      ((__bos_dynamic_check_impl_and((bos_val), >=, (index), (bos_val) <= SSIZE_MAX) && \
-        __builtin_constant_p(index) && (index) <= SSIZE_MAX))
-
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 char* getcwd(char* const __pass_object_size buf, size_t size)
         __overloadable
         __error_if_overflows_objectsize(size, __bos(buf), getcwd) {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos(buf);
 
-    if (!__bos_trivially_ge(bos, size)) {
-        return __getcwd_chk(buf, size, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(getcwd)(buf, size);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __call_bypassing_fortify(getcwd)(buf, size);
-}
 
-#if !defined(__USE_FILE_OFFSET64)
+    return __getcwd_chk(buf, size, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_M__
 __BIONIC_FORTIFY_INLINE
 ssize_t pread(int fd, void* const __pass_object_size0 buf, size_t count, off_t offset)
         __overloadable
         __error_if_overflows_ssizet(count, pread)
         __error_if_overflows_objectsize(count, __bos0(buf), pread) {
-#if __ANDROID_API__ >= __ANDROID_API_M__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos);
+    if (count == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __PREAD_PREFIX(real)(fd, buf, count, offset);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-    return __PREAD_PREFIX(real)(fd, buf, count, offset);
+
+    return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos);
 }
-#endif /* !defined(__USE_FILE_OFFSET64) */
 
 __BIONIC_FORTIFY_INLINE
 ssize_t pread64(int fd, void* const __pass_object_size0 buf, size_t count, off64_t offset)
         __overloadable
         __error_if_overflows_ssizet(count, pread64)
         __error_if_overflows_objectsize(count, __bos0(buf), pread64) {
-#if __ANDROID_API__ >= __ANDROID_API_M__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __pread64_chk(fd, buf, count, offset, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __pread64_real(fd, buf, count, offset);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-    return __pread64_real(fd, buf, count, offset);
-}
 
-#if !defined(__USE_FILE_OFFSET64)
+    return __pread64_chk(fd, buf, count, offset, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 ssize_t pwrite(int fd, const void* const __pass_object_size0 buf, size_t count, off_t offset)
         __overloadable
         __error_if_overflows_ssizet(count, pwrite)
         __error_if_overflows_objectsize(count, __bos0(buf), pwrite) {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __PWRITE_PREFIX(chk)(fd, buf, count, offset, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __PWRITE_PREFIX(real)(fd, buf, count, offset);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __PWRITE_PREFIX(real)(fd, buf, count, offset);
+
+    return __PWRITE_PREFIX(chk)(fd, buf, count, offset, bos);
 }
-#endif /* !defined(__USE_FILE_OFFSET64) */
 
 __BIONIC_FORTIFY_INLINE
 ssize_t pwrite64(int fd, const void* const __pass_object_size0 buf, size_t count, off64_t offset)
         __overloadable
         __error_if_overflows_ssizet(count, pwrite64)
         __error_if_overflows_objectsize(count, __bos0(buf), pwrite64) {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __pwrite64_chk(fd, buf, count, offset, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __pwrite64_real(fd, buf, count, offset);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __pwrite64_real(fd, buf, count, offset);
-}
 
+    return __pwrite64_chk(fd, buf, count, offset, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_L__
 __BIONIC_FORTIFY_INLINE
 ssize_t read(int fd, void* const __pass_object_size0 buf, size_t count)
         __overloadable
         __error_if_overflows_ssizet(count, read)
         __error_if_overflows_objectsize(count, __bos0(buf), read) {
-#if __ANDROID_API__ >= __ANDROID_API_L__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __read_chk(fd, buf, count, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(read)(fd, buf, count);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
-    return __call_bypassing_fortify(read)(fd, buf, count);
-}
 
+    return __read_chk(fd, buf, count, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 ssize_t write(int fd, const void* const __pass_object_size0 buf, size_t count)
         __overloadable
         __error_if_overflows_ssizet(count, write)
         __error_if_overflows_objectsize(count, __bos0(buf), write) {
-#if __ANDROID_API__ >= __ANDROID_API_N__
     size_t bos = __bos0(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, count)) {
-        return __write_chk(fd, buf, count, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(write)(fd, buf, count);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
-    return __call_bypassing_fortify(write)(fd, buf, count);
-}
 
+    return __write_chk(fd, buf, count, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+
+#if __ANDROID_API__ >= __ANDROID_API_M__
 __BIONIC_FORTIFY_INLINE
 ssize_t readlink(const char* path, char* const __pass_object_size buf, size_t size)
         __overloadable
         __error_if_overflows_ssizet(size, readlink)
         __error_if_overflows_objectsize(size, __bos(buf), readlink) {
-#if __ANDROID_API__ >= __ANDROID_API_M__
     size_t bos = __bos(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, size)) {
-        return __readlink_chk(path, buf, size, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(readlink)(path, buf, size);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-    return __call_bypassing_fortify(readlink)(path, buf, size);
+
+    return __readlink_chk(path, buf, size, bos);
 }
 
-#if __ANDROID_API__ >= __ANDROID_API_L__
 __BIONIC_FORTIFY_INLINE
 ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size buf, size_t size)
         __overloadable
         __error_if_overflows_ssizet(size, readlinkat)
         __error_if_overflows_objectsize(size, __bos(buf), readlinkat) {
-#if __ANDROID_API__ >= __ANDROID_API_M__
     size_t bos = __bos(buf);
 
-    if (!__bos_trivially_ge_no_overflow(bos, size)) {
-        return __readlinkat_chk(dirfd, path, buf, size, bos);
+    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+        return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
     }
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
-    return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
-}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
 
-#undef __bos_trivially_ge_no_overflow
+    return __readlinkat_chk(dirfd, path, buf, size, bos);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+
 #undef __enable_if_no_overflow_ssizet
 #undef __error_if_overflows_objectsize
 #undef __error_if_overflows_ssizet
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index aabcaab..52eff56 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -1,5 +1,6 @@
-/* Generated file. Do not edit. */
-#pragma once
+/* Generated by gensyscalls.py. Do not edit. */
+#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_
+#define _BIONIC_BITS_GLIBC_SYSCALLS_H_
 #if defined(__NR__llseek)
   #define SYS__llseek __NR__llseek
 #endif
@@ -60,6 +61,12 @@
 #if defined(__NR_brk)
   #define SYS_brk __NR_brk
 #endif
+#if defined(__NR_cachectl)
+  #define SYS_cachectl __NR_cachectl
+#endif
+#if defined(__NR_cacheflush)
+  #define SYS_cacheflush __NR_cacheflush
+#endif
 #if defined(__NR_capget)
   #define SYS_capget __NR_capget
 #endif
@@ -84,39 +91,21 @@
 #if defined(__NR_clock_adjtime)
   #define SYS_clock_adjtime __NR_clock_adjtime
 #endif
-#if defined(__NR_clock_adjtime64)
-  #define SYS_clock_adjtime64 __NR_clock_adjtime64
-#endif
 #if defined(__NR_clock_getres)
   #define SYS_clock_getres __NR_clock_getres
 #endif
-#if defined(__NR_clock_getres_time64)
-  #define SYS_clock_getres_time64 __NR_clock_getres_time64
-#endif
 #if defined(__NR_clock_gettime)
   #define SYS_clock_gettime __NR_clock_gettime
 #endif
-#if defined(__NR_clock_gettime64)
-  #define SYS_clock_gettime64 __NR_clock_gettime64
-#endif
 #if defined(__NR_clock_nanosleep)
   #define SYS_clock_nanosleep __NR_clock_nanosleep
 #endif
-#if defined(__NR_clock_nanosleep_time64)
-  #define SYS_clock_nanosleep_time64 __NR_clock_nanosleep_time64
-#endif
 #if defined(__NR_clock_settime)
   #define SYS_clock_settime __NR_clock_settime
 #endif
-#if defined(__NR_clock_settime64)
-  #define SYS_clock_settime64 __NR_clock_settime64
-#endif
 #if defined(__NR_clone)
   #define SYS_clone __NR_clone
 #endif
-#if defined(__NR_clone3)
-  #define SYS_clone3 __NR_clone3
-#endif
 #if defined(__NR_close)
   #define SYS_close __NR_close
 #endif
@@ -246,21 +235,9 @@
 #if defined(__NR_fremovexattr)
   #define SYS_fremovexattr __NR_fremovexattr
 #endif
-#if defined(__NR_fsconfig)
-  #define SYS_fsconfig __NR_fsconfig
-#endif
 #if defined(__NR_fsetxattr)
   #define SYS_fsetxattr __NR_fsetxattr
 #endif
-#if defined(__NR_fsmount)
-  #define SYS_fsmount __NR_fsmount
-#endif
-#if defined(__NR_fsopen)
-  #define SYS_fsopen __NR_fsopen
-#endif
-#if defined(__NR_fspick)
-  #define SYS_fspick __NR_fspick
-#endif
 #if defined(__NR_fstat)
   #define SYS_fstat __NR_fstat
 #endif
@@ -291,9 +268,6 @@
 #if defined(__NR_futex)
   #define SYS_futex __NR_futex
 #endif
-#if defined(__NR_futex_time64)
-  #define SYS_futex_time64 __NR_futex_time64
-#endif
 #if defined(__NR_futimesat)
   #define SYS_futimesat __NR_futimesat
 #endif
@@ -447,24 +421,12 @@
 #if defined(__NR_io_pgetevents)
   #define SYS_io_pgetevents __NR_io_pgetevents
 #endif
-#if defined(__NR_io_pgetevents_time64)
-  #define SYS_io_pgetevents_time64 __NR_io_pgetevents_time64
-#endif
 #if defined(__NR_io_setup)
   #define SYS_io_setup __NR_io_setup
 #endif
 #if defined(__NR_io_submit)
   #define SYS_io_submit __NR_io_submit
 #endif
-#if defined(__NR_io_uring_enter)
-  #define SYS_io_uring_enter __NR_io_uring_enter
-#endif
-#if defined(__NR_io_uring_register)
-  #define SYS_io_uring_register __NR_io_uring_register
-#endif
-#if defined(__NR_io_uring_setup)
-  #define SYS_io_uring_setup __NR_io_uring_setup
-#endif
 #if defined(__NR_ioctl)
   #define SYS_ioctl __NR_ioctl
 #endif
@@ -597,9 +559,6 @@
 #if defined(__NR_mount)
   #define SYS_mount __NR_mount
 #endif
-#if defined(__NR_move_mount)
-  #define SYS_move_mount __NR_move_mount
-#endif
 #if defined(__NR_move_pages)
   #define SYS_move_pages __NR_move_pages
 #endif
@@ -621,15 +580,9 @@
 #if defined(__NR_mq_timedreceive)
   #define SYS_mq_timedreceive __NR_mq_timedreceive
 #endif
-#if defined(__NR_mq_timedreceive_time64)
-  #define SYS_mq_timedreceive_time64 __NR_mq_timedreceive_time64
-#endif
 #if defined(__NR_mq_timedsend)
   #define SYS_mq_timedsend __NR_mq_timedsend
 #endif
-#if defined(__NR_mq_timedsend_time64)
-  #define SYS_mq_timedsend_time64 __NR_mq_timedsend_time64
-#endif
 #if defined(__NR_mq_unlink)
   #define SYS_mq_unlink __NR_mq_unlink
 #endif
@@ -696,9 +649,6 @@
 #if defined(__NR_open_by_handle_at)
   #define SYS_open_by_handle_at __NR_open_by_handle_at
 #endif
-#if defined(__NR_open_tree)
-  #define SYS_open_tree __NR_open_tree
-#endif
 #if defined(__NR_openat)
   #define SYS_openat __NR_openat
 #endif
@@ -720,12 +670,6 @@
 #if defined(__NR_personality)
   #define SYS_personality __NR_personality
 #endif
-#if defined(__NR_pidfd_open)
-  #define SYS_pidfd_open __NR_pidfd_open
-#endif
-#if defined(__NR_pidfd_send_signal)
-  #define SYS_pidfd_send_signal __NR_pidfd_send_signal
-#endif
 #if defined(__NR_pipe)
   #define SYS_pipe __NR_pipe
 #endif
@@ -750,9 +694,6 @@
 #if defined(__NR_ppoll)
   #define SYS_ppoll __NR_ppoll
 #endif
-#if defined(__NR_ppoll_time64)
-  #define SYS_ppoll_time64 __NR_ppoll_time64
-#endif
 #if defined(__NR_prctl)
   #define SYS_prctl __NR_prctl
 #endif
@@ -783,9 +724,6 @@
 #if defined(__NR_pselect6)
   #define SYS_pselect6 __NR_pselect6
 #endif
-#if defined(__NR_pselect6_time64)
-  #define SYS_pselect6_time64 __NR_pselect6_time64
-#endif
 #if defined(__NR_ptrace)
   #define SYS_ptrace __NR_ptrace
 #endif
@@ -837,9 +775,6 @@
 #if defined(__NR_recvmmsg)
   #define SYS_recvmmsg __NR_recvmmsg
 #endif
-#if defined(__NR_recvmmsg_time64)
-  #define SYS_recvmmsg_time64 __NR_recvmmsg_time64
-#endif
 #if defined(__NR_recvmsg)
   #define SYS_recvmsg __NR_recvmsg
 #endif
@@ -891,9 +826,6 @@
 #if defined(__NR_rt_sigtimedwait)
   #define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
 #endif
-#if defined(__NR_rt_sigtimedwait_time64)
-  #define SYS_rt_sigtimedwait_time64 __NR_rt_sigtimedwait_time64
-#endif
 #if defined(__NR_rt_tgsigqueueinfo)
   #define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
 #endif
@@ -918,9 +850,6 @@
 #if defined(__NR_sched_rr_get_interval)
   #define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
 #endif
-#if defined(__NR_sched_rr_get_interval_time64)
-  #define SYS_sched_rr_get_interval_time64 __NR_sched_rr_get_interval_time64
-#endif
 #if defined(__NR_sched_setaffinity)
   #define SYS_sched_setaffinity __NR_sched_setaffinity
 #endif
@@ -957,9 +886,6 @@
 #if defined(__NR_semtimedop)
   #define SYS_semtimedop __NR_semtimedop
 #endif
-#if defined(__NR_semtimedop_time64)
-  #define SYS_semtimedop_time64 __NR_semtimedop_time64
-#endif
 #if defined(__NR_send)
   #define SYS_send __NR_send
 #endif
@@ -1197,6 +1123,9 @@
 #if defined(__NR_syslog)
   #define SYS_syslog __NR_syslog
 #endif
+#if defined(__NR_sysmips)
+  #define SYS_sysmips __NR_sysmips
+#endif
 #if defined(__NR_tee)
   #define SYS_tee __NR_tee
 #endif
@@ -1218,14 +1147,11 @@
 #if defined(__NR_timer_gettime)
   #define SYS_timer_gettime __NR_timer_gettime
 #endif
-#if defined(__NR_timer_gettime64)
-  #define SYS_timer_gettime64 __NR_timer_gettime64
-#endif
 #if defined(__NR_timer_settime)
   #define SYS_timer_settime __NR_timer_settime
 #endif
-#if defined(__NR_timer_settime64)
-  #define SYS_timer_settime64 __NR_timer_settime64
+#if defined(__NR_timerfd)
+  #define SYS_timerfd __NR_timerfd
 #endif
 #if defined(__NR_timerfd_create)
   #define SYS_timerfd_create __NR_timerfd_create
@@ -1233,15 +1159,9 @@
 #if defined(__NR_timerfd_gettime)
   #define SYS_timerfd_gettime __NR_timerfd_gettime
 #endif
-#if defined(__NR_timerfd_gettime64)
-  #define SYS_timerfd_gettime64 __NR_timerfd_gettime64
-#endif
 #if defined(__NR_timerfd_settime)
   #define SYS_timerfd_settime __NR_timerfd_settime
 #endif
-#if defined(__NR_timerfd_settime64)
-  #define SYS_timerfd_settime64 __NR_timerfd_settime64
-#endif
 #if defined(__NR_times)
   #define SYS_times __NR_times
 #endif
@@ -1299,9 +1219,6 @@
 #if defined(__NR_utimensat)
   #define SYS_utimensat __NR_utimensat
 #endif
-#if defined(__NR_utimensat_time64)
-  #define SYS_utimensat_time64 __NR_utimensat_time64
-#endif
 #if defined(__NR_utimes)
   #define SYS_utimes __NR_utimes
 #endif
@@ -1338,3 +1255,4 @@
 #if defined(__NR_writev)
   #define SYS_writev __NR_writev
 #endif
+#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */
diff --git a/libc/include/bits/seek_constants.h b/libc/include/bits/seek_constants.h
index 6f3f22d..6b88606 100644
--- a/libc/include/bits/seek_constants.h
+++ b/libc/include/bits/seek_constants.h
@@ -39,23 +39,3 @@
 #define SEEK_CUR 1
 /** Seek relative to the end of the file. */
 #define SEEK_END 2
-
-#if defined(__USE_GNU)
-
-/**
- * Seek to the first data (non-hole) location in the file
- * greater than or equal to the given offset.
- *
- * See [lseek(2)](http://man7.org/linux/man-pages/man2/lseek.2.html).
- */
-#define SEEK_DATA 3
-
-/**
- * Seek to the first hole (non-data) location in the file
- * greater than or equal to the given offset.
- *
- * See [lseek(2)](http://man7.org/linux/man-pages/man2/lseek.2.html).
- */
-#define SEEK_HOLE 4
-
-#endif
diff --git a/libc/include/bits/stdatomic.h b/libc/include/bits/stdatomic.h
deleted file mode 100644
index 633cb86..0000000
--- a/libc/include/bits/stdatomic.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*-
- * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
- *                    David Chisnall <theraven@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <stdbool.h>
-
-/*
- * C: Do it ourselves.
- * Note that the runtime representation defined here should be compatible
- * with the C++ one, i.e. an _Atomic(T) needs to contain the same
- * bits as a T.
- */
-
-#include <stddef.h>  /* For ptrdiff_t. */
-#include <stdint.h>  /* TODO: don't drag in all the macros, just the types. */
-// Include uchar.h only when available.  Bionic's stdatomic.h is also used for
-// the host (via a copy in prebuilts/clang) and uchar.h is not available in the
-// glibc used for the host.
-#if defined(__BIONIC__)
-# include <uchar.h>  /* For char16_t and char32_t.              */
-#endif
-
-/*
- * 7.17.1 Atomic lock-free macros.
- */
-
-#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE
-#define	ATOMIC_BOOL_LOCK_FREE		__GCC_ATOMIC_BOOL_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE
-#define	ATOMIC_CHAR_LOCK_FREE		__GCC_ATOMIC_CHAR_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-#define	ATOMIC_CHAR16_T_LOCK_FREE	__GCC_ATOMIC_CHAR16_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-#define	ATOMIC_CHAR32_T_LOCK_FREE	__GCC_ATOMIC_CHAR32_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-#define	ATOMIC_WCHAR_T_LOCK_FREE	__GCC_ATOMIC_WCHAR_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE
-#define	ATOMIC_SHORT_LOCK_FREE		__GCC_ATOMIC_SHORT_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_INT_LOCK_FREE
-#define	ATOMIC_INT_LOCK_FREE		__GCC_ATOMIC_INT_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_LONG_LOCK_FREE
-#define	ATOMIC_LONG_LOCK_FREE		__GCC_ATOMIC_LONG_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE
-#define	ATOMIC_LLONG_LOCK_FREE		__GCC_ATOMIC_LLONG_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE
-#define	ATOMIC_POINTER_LOCK_FREE	__GCC_ATOMIC_POINTER_LOCK_FREE
-#endif
-
-/*
- * 7.17.2 Initialization.
- */
-
-#define	ATOMIC_VAR_INIT(value)		(value)
-#define	atomic_init(obj, value)		__c11_atomic_init(obj, value)
-
-/*
- * Clang and recent GCC both provide predefined macros for the memory
- * orderings.  If we are using a compiler that doesn't define them, use the
- * clang values - these will be ignored in the fallback path.
- */
-
-#ifndef __ATOMIC_RELAXED
-#define __ATOMIC_RELAXED		0
-#endif
-#ifndef __ATOMIC_CONSUME
-#define __ATOMIC_CONSUME		1
-#endif
-#ifndef __ATOMIC_ACQUIRE
-#define __ATOMIC_ACQUIRE		2
-#endif
-#ifndef __ATOMIC_RELEASE
-#define __ATOMIC_RELEASE		3
-#endif
-#ifndef __ATOMIC_ACQ_REL
-#define __ATOMIC_ACQ_REL		4
-#endif
-#ifndef __ATOMIC_SEQ_CST
-#define __ATOMIC_SEQ_CST		5
-#endif
-
-/*
- * 7.17.3 Order and consistency.
- *
- * The memory_order_* constants that denote the barrier behaviour of the
- * atomic operations.
- * The enum values must be identical to those used by the
- * C++ <atomic> header.
- */
-
-typedef enum {
-	memory_order_relaxed = __ATOMIC_RELAXED,
-	memory_order_consume = __ATOMIC_CONSUME,
-	memory_order_acquire = __ATOMIC_ACQUIRE,
-	memory_order_release = __ATOMIC_RELEASE,
-	memory_order_acq_rel = __ATOMIC_ACQ_REL,
-	memory_order_seq_cst = __ATOMIC_SEQ_CST
-} memory_order;
-
-/*
- * 7.17.4 Fences.
- */
-
-static __inline void atomic_thread_fence(memory_order __order __attribute__((unused))) {
-	__c11_atomic_thread_fence(__order);
-}
-
-static __inline void atomic_signal_fence(memory_order __order __attribute__((unused))) {
-	__c11_atomic_signal_fence(__order);
-}
-
-/*
- * 7.17.5 Lock-free property.
- */
-
-#define	atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
-
-/*
- * 7.17.6 Atomic integer types.
- */
-
-typedef _Atomic(bool)			atomic_bool;
-typedef _Atomic(char)			atomic_char;
-typedef _Atomic(signed char)		atomic_schar;
-typedef _Atomic(unsigned char)		atomic_uchar;
-typedef _Atomic(short)			atomic_short;
-typedef _Atomic(unsigned short)		atomic_ushort;
-typedef _Atomic(int)			atomic_int;
-typedef _Atomic(unsigned int)		atomic_uint;
-typedef _Atomic(long)			atomic_long;
-typedef _Atomic(unsigned long)		atomic_ulong;
-typedef _Atomic(long long)		atomic_llong;
-typedef _Atomic(unsigned long long)	atomic_ullong;
-#if defined(__BIONIC__) || (defined(__cplusplus) && __cplusplus >= 201103L)
-  typedef _Atomic(char16_t)		atomic_char16_t;
-  typedef _Atomic(char32_t)		atomic_char32_t;
-#endif
-typedef _Atomic(wchar_t)		atomic_wchar_t;
-typedef _Atomic(int_least8_t)		atomic_int_least8_t;
-typedef _Atomic(uint_least8_t)	atomic_uint_least8_t;
-typedef _Atomic(int_least16_t)	atomic_int_least16_t;
-typedef _Atomic(uint_least16_t)	atomic_uint_least16_t;
-typedef _Atomic(int_least32_t)	atomic_int_least32_t;
-typedef _Atomic(uint_least32_t)	atomic_uint_least32_t;
-typedef _Atomic(int_least64_t)	atomic_int_least64_t;
-typedef _Atomic(uint_least64_t)	atomic_uint_least64_t;
-typedef _Atomic(int_fast8_t)		atomic_int_fast8_t;
-typedef _Atomic(uint_fast8_t)		atomic_uint_fast8_t;
-typedef _Atomic(int_fast16_t)		atomic_int_fast16_t;
-typedef _Atomic(uint_fast16_t)	atomic_uint_fast16_t;
-typedef _Atomic(int_fast32_t)		atomic_int_fast32_t;
-typedef _Atomic(uint_fast32_t)	atomic_uint_fast32_t;
-typedef _Atomic(int_fast64_t)		atomic_int_fast64_t;
-typedef _Atomic(uint_fast64_t)	atomic_uint_fast64_t;
-typedef _Atomic(intptr_t)		atomic_intptr_t;
-typedef _Atomic(uintptr_t)		atomic_uintptr_t;
-typedef _Atomic(size_t)		atomic_size_t;
-typedef _Atomic(ptrdiff_t)		atomic_ptrdiff_t;
-typedef _Atomic(intmax_t)		atomic_intmax_t;
-typedef _Atomic(uintmax_t)		atomic_uintmax_t;
-
-/*
- * 7.17.7 Operations on atomic types.
- */
-
-/*
- * Compiler-specific operations.
- */
-
-#define	atomic_compare_exchange_strong_explicit(object, expected,	\
-    desired, success, failure)						\
-	__c11_atomic_compare_exchange_strong(object, expected, desired,	\
-	    success, failure)
-#define	atomic_compare_exchange_weak_explicit(object, expected,		\
-    desired, success, failure)						\
-	__c11_atomic_compare_exchange_weak(object, expected, desired,	\
-	    success, failure)
-#define	atomic_exchange_explicit(object, desired, order)		\
-	__c11_atomic_exchange(object, desired, order)
-#define	atomic_fetch_add_explicit(object, operand, order)		\
-	__c11_atomic_fetch_add(object, operand, order)
-#define	atomic_fetch_and_explicit(object, operand, order)		\
-	__c11_atomic_fetch_and(object, operand, order)
-#define	atomic_fetch_or_explicit(object, operand, order)		\
-	__c11_atomic_fetch_or(object, operand, order)
-#define	atomic_fetch_sub_explicit(object, operand, order)		\
-	__c11_atomic_fetch_sub(object, operand, order)
-#define	atomic_fetch_xor_explicit(object, operand, order)		\
-	__c11_atomic_fetch_xor(object, operand, order)
-#define	atomic_load_explicit(object, order)				\
-	__c11_atomic_load(object, order)
-#define	atomic_store_explicit(object, desired, order)			\
-	__c11_atomic_store(object, desired, order)
-
-/*
- * Convenience functions.
- */
-
-#define	atomic_compare_exchange_strong(object, expected, desired)	\
-	atomic_compare_exchange_strong_explicit(object, expected,	\
-	    desired, memory_order_seq_cst, memory_order_seq_cst)
-#define	atomic_compare_exchange_weak(object, expected, desired)		\
-	atomic_compare_exchange_weak_explicit(object, expected,		\
-	    desired, memory_order_seq_cst, memory_order_seq_cst)
-#define	atomic_exchange(object, desired)				\
-	atomic_exchange_explicit(object, desired, memory_order_seq_cst)
-#define	atomic_fetch_add(object, operand)				\
-	atomic_fetch_add_explicit(object, operand, memory_order_seq_cst)
-#define	atomic_fetch_and(object, operand)				\
-	atomic_fetch_and_explicit(object, operand, memory_order_seq_cst)
-#define	atomic_fetch_or(object, operand)				\
-	atomic_fetch_or_explicit(object, operand, memory_order_seq_cst)
-#define	atomic_fetch_sub(object, operand)				\
-	atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst)
-#define	atomic_fetch_xor(object, operand)				\
-	atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst)
-#define	atomic_load(object)						\
-	atomic_load_explicit(object, memory_order_seq_cst)
-#define	atomic_store(object, desired)					\
-	atomic_store_explicit(object, desired, memory_order_seq_cst)
-
-/*
- * 7.17.8 Atomic flag type and operations.
- *
- * XXX: Assume atomic_bool can be used as an atomic_flag. Is there some
- * kind of compiler built-in type we could use?
- */
-
-typedef struct {
-	atomic_bool	__flag;
-} atomic_flag;
-
-#define	ATOMIC_FLAG_INIT		{ ATOMIC_VAR_INIT(false) }
-
-static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, memory_order __order) {
-	return (atomic_exchange_explicit(&__object->__flag, 1, __order));
-}
-
-static __inline void atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) {
-	atomic_store_explicit(&__object->__flag, 0, __order);
-}
-
-static __inline bool atomic_flag_test_and_set(volatile atomic_flag *__object) {
-	return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst));
-}
-
-static __inline void atomic_flag_clear(volatile atomic_flag *__object) {
-	atomic_flag_clear_explicit(__object, memory_order_seq_cst);
-}
diff --git a/libc/include/bits/sys_statvfs_inlines.h b/libc/include/bits/sys_statvfs_inlines.h
deleted file mode 100644
index 991fac7..0000000
--- a/libc/include/bits/sys_statvfs_inlines.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-
-#if defined(__BIONIC_SYS_STATVFS_INLINE)
-
-__BEGIN_DECLS
-
-#if defined(__BIONIC_NEED_STATVFS_INLINES)
-
-static __inline void __bionic_statfs_to_statvfs(const struct statfs* __src,
-                                                struct statvfs* __dst) {
-  __dst->f_bsize = __src->f_bsize;
-  __dst->f_frsize = __src->f_frsize;
-  __dst->f_blocks = __src->f_blocks;
-  __dst->f_bfree = __src->f_bfree;
-  __dst->f_bavail = __src->f_bavail;
-  __dst->f_files = __src->f_files;
-  __dst->f_ffree = __src->f_ffree;
-  __dst->f_favail = __src->f_ffree;
-  __dst->f_fsid = __src->f_fsid.__val[0] |
-      __BIONIC_CAST(static_cast, uint64_t, __src->f_fsid.__val[1]) << 32;
-  __dst->f_flag = __src->f_flags;
-  __dst->f_namemax = __src->f_namelen;
-}
-
-__BIONIC_SYS_STATVFS_INLINE int statvfs(const char* __path,
-                                        struct statvfs* __result) {
-  struct statfs __tmp;
-  int __rc = statfs(__path, &__tmp);
-  if (__rc != 0) return __rc;
-  __bionic_statfs_to_statvfs(&__tmp, __result);
-  return 0;
-}
-
-__BIONIC_SYS_STATVFS_INLINE int fstatvfs(int __fd,
-                                         struct statvfs* __result) {
-  struct statfs __tmp;
-  int __rc = fstatfs(__fd, &__tmp);
-  if (__rc != 0) return __rc;
-  __bionic_statfs_to_statvfs(&__tmp, __result);
-  return 0;
-}
-
-#endif
-
-#if defined(__BIONIC_NEED_STATVFS64_INLINES)
-
-__BIONIC_SYS_STATVFS_INLINE int statvfs64(const char* __path,
-                                          struct statvfs64* __result) {
-  return statvfs(__path, __BIONIC_CAST(reinterpret_cast, struct statvfs*,
-                                       __result));
-}
-
-__BIONIC_SYS_STATVFS_INLINE int fstatvfs64(int __fd,
-                                          struct statvfs64* __result) {
-  return fstatvfs(__fd, __BIONIC_CAST(reinterpret_cast, struct statvfs*,
-                                      __result));
-}
-
-#endif
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/bits/threads_inlines.h b/libc/include/bits/threads_inlines.h
deleted file mode 100644
index 8f2beb0..0000000
--- a/libc/include/bits/threads_inlines.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <threads.h>
-
-#include <errno.h>
-#include <sched.h>
-#include <stdlib.h>
-
-#if defined(__BIONIC_THREADS_INLINE)
-
-__BEGIN_DECLS
-
-static __inline int __bionic_thrd_error(int __pthread_code) {
-  switch (__pthread_code) {
-    case 0: return 0;
-    case ENOMEM: return thrd_nomem;
-    case ETIMEDOUT: return thrd_timedout;
-    case EBUSY: return thrd_busy;
-    default: return thrd_error;
-  }
-}
-
-__BIONIC_THREADS_INLINE void call_once(once_flag* __flag,
-                                       void (*__function)(void)) {
-  pthread_once(__flag, __function);
-}
-
-
-
-__BIONIC_THREADS_INLINE int cnd_broadcast(cnd_t* __cnd) {
-  return __bionic_thrd_error(pthread_cond_broadcast(__cnd));
-}
-
-__BIONIC_THREADS_INLINE void cnd_destroy(cnd_t* __cnd) {
-  pthread_cond_destroy(__cnd);
-}
-
-__BIONIC_THREADS_INLINE int cnd_init(cnd_t* __cnd) {
-  return __bionic_thrd_error(pthread_cond_init(__cnd, NULL));
-}
-
-__BIONIC_THREADS_INLINE int cnd_signal(cnd_t* __cnd) {
-  return __bionic_thrd_error(pthread_cond_signal(__cnd));
-}
-
-__BIONIC_THREADS_INLINE int cnd_timedwait(cnd_t* __cnd,
-                                          mtx_t* __mtx,
-                                          const struct timespec* __timeout) {
-  return __bionic_thrd_error(pthread_cond_timedwait(__cnd, __mtx, __timeout));
-}
-
-__BIONIC_THREADS_INLINE int cnd_wait(cnd_t* __cnd, mtx_t* __mtx) {
-  return __bionic_thrd_error(pthread_cond_wait(__cnd, __mtx));
-}
-
-
-
-__BIONIC_THREADS_INLINE void mtx_destroy(mtx_t* __mtx) {
-  pthread_mutex_destroy(__mtx);
-}
-
-__BIONIC_THREADS_INLINE int mtx_init(mtx_t* __mtx, int __type) {
-  int __pthread_type = (__type & mtx_recursive) ? PTHREAD_MUTEX_RECURSIVE
-                                                : PTHREAD_MUTEX_NORMAL;
-  __type &= ~mtx_recursive;
-  if (__type != mtx_plain && __type != mtx_timed) return thrd_error;
-
-  pthread_mutexattr_t __attr;
-  pthread_mutexattr_init(&__attr);
-  pthread_mutexattr_settype(&__attr, __pthread_type);
-  return __bionic_thrd_error(pthread_mutex_init(__mtx, &__attr));
-}
-
-__BIONIC_THREADS_INLINE int mtx_lock(mtx_t* __mtx) {
-  return __bionic_thrd_error(pthread_mutex_lock(__mtx));
-}
-
-#if __ANDROID_API__ >= __ANDROID_API_L__
-__BIONIC_THREADS_INLINE int mtx_timedlock(mtx_t* __mtx,
-                                          const struct timespec* __timeout) {
-  return __bionic_thrd_error(pthread_mutex_timedlock(__mtx, __timeout));
-}
-#endif
-
-__BIONIC_THREADS_INLINE int mtx_trylock(mtx_t* __mtx) {
-  return __bionic_thrd_error(pthread_mutex_trylock(__mtx));
-}
-
-__BIONIC_THREADS_INLINE int mtx_unlock(mtx_t* __mtx) {
-  return __bionic_thrd_error(pthread_mutex_unlock(__mtx));
-}
-
-
-
-struct __bionic_thrd_data {
-  thrd_start_t __func;
-  void* __arg;
-};
-
-static inline void* __bionic_thrd_trampoline(void* __arg) {
-  struct __bionic_thrd_data __data =
-      *__BIONIC_CAST(static_cast, struct __bionic_thrd_data*, __arg);
-  free(__arg);
-  int __result = __data.__func(__data.__arg);
-  return __BIONIC_CAST(reinterpret_cast, void*,
-                       __BIONIC_CAST(static_cast, uintptr_t, __result));
-}
-
-__BIONIC_THREADS_INLINE int thrd_create(thrd_t* __thrd,
-                                        thrd_start_t __func,
-                                        void* __arg) {
-  struct __bionic_thrd_data* __pthread_arg =
-      __BIONIC_CAST(static_cast, struct __bionic_thrd_data*,
-                    malloc(sizeof(struct __bionic_thrd_data)));
-  __pthread_arg->__func = __func;
-  __pthread_arg->__arg = __arg;
-  int __result = __bionic_thrd_error(pthread_create(__thrd, NULL,
-                                                    __bionic_thrd_trampoline,
-                                                    __pthread_arg));
-  if (__result != thrd_success) free(__pthread_arg);
-  return __result;
-}
-
-__BIONIC_THREADS_INLINE thrd_t thrd_current(void) {
-  return pthread_self();
-}
-
-__BIONIC_THREADS_INLINE int thrd_detach(thrd_t __thrd) {
-  return __bionic_thrd_error(pthread_detach(__thrd));
-}
-
-__BIONIC_THREADS_INLINE int thrd_equal(thrd_t __lhs, thrd_t __rhs) {
-  return pthread_equal(__lhs, __rhs);
-}
-
-__BIONIC_THREADS_INLINE void thrd_exit(int __result) {
-  pthread_exit(__BIONIC_CAST(reinterpret_cast, void*,
-                             __BIONIC_CAST(static_cast, uintptr_t, __result)));
-}
-
-__BIONIC_THREADS_INLINE int thrd_join(thrd_t __thrd, int* __result) {
-  void* __pthread_result;
-  if (pthread_join(__thrd, &__pthread_result) != 0) return thrd_error;
-  if (__result) {
-    *__result = __BIONIC_CAST(reinterpret_cast, intptr_t, __pthread_result);
-  }
-  return thrd_success;
-}
-
-__BIONIC_THREADS_INLINE int thrd_sleep(const struct timespec* __duration,
-                                       struct timespec* __remaining) {
-  int __rc = nanosleep(__duration, __remaining);
-  if (__rc == 0) return 0;
-  return (errno == EINTR) ? -1 : -2;
-}
-
-__BIONIC_THREADS_INLINE void thrd_yield(void) {
-  sched_yield();
-}
-
-
-
-__BIONIC_THREADS_INLINE int tss_create(tss_t* __key, tss_dtor_t __dtor) {
-  return __bionic_thrd_error(pthread_key_create(__key, __dtor));
-}
-
-__BIONIC_THREADS_INLINE void tss_delete(tss_t __key) {
-  pthread_key_delete(__key);
-}
-
-__BIONIC_THREADS_INLINE void* tss_get(tss_t __key) {
-  return pthread_getspecific(__key);
-}
-
-__BIONIC_THREADS_INLINE int tss_set(tss_t __key, void* __value) {
-  return __bionic_thrd_error(pthread_setspecific(__key, __value));
-}
-
-__END_DECLS
-
-#endif  // __BIONIC_THREADS_INLINE
diff --git a/libc/include/bits/timespec.h b/libc/include/bits/timespec.h
index daad03f..0497cfe 100644
--- a/libc/include/bits/timespec.h
+++ b/libc/include/bits/timespec.h
@@ -46,7 +46,7 @@
 struct timespec {
   /** Number of seconds. */
   time_t tv_sec;
-  /** Number of nanoseconds. Must be less than 1,000,000,000. */
+  /** Number of nanoseconds. Must be less than 1,000,000. */
   long tv_nsec;
 };
 #endif
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index e7df299..e91b0e2 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -97,7 +97,7 @@
 int isspace(int __ch);
 /** Returns true if `ch` is in `[A-Z]`. */
 int isupper(int __ch);
-/** Returns true if `ch` is in `[0-9A-Fa-f]`. */
+/** Returns true if `ch` is in `[0-9a-f]`. */
 int isxdigit(int __ch);
 
 /** Returns the corresponding lower-case character if `ch` is upper-case, or `ch` otherwise. */
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index c45c91f..1c5d64c 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -26,14 +26,9 @@
  * SUCH DAMAGE.
  */
 
-#pragma once
+#ifndef _FCNTL_H
 #define _FCNTL_H
 
-/**
- * @file fcntl.h
- * @brief File control operations.
- */
-
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <linux/fadvise.h>
@@ -53,180 +48,47 @@
 
 #ifdef __LP64__
 /* LP64 kernels don't have F_*64 defines because their flock is 64-bit. */
-/** Flag for flock(). */
 #define F_GETLK64  F_GETLK
-/** Flag for flock(). */
 #define F_SETLK64  F_SETLK
-/** Flag for flock(). */
 #define F_SETLKW64 F_SETLKW
 #endif
 
-/** Flag for open(). */
 #define O_ASYNC FASYNC
-/** Flag for open(). */
 #define O_RSYNC O_SYNC
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-/** Flag for splice(). */
 #define SPLICE_F_MOVE 1
-/** Flag for splice(). */
 #define SPLICE_F_NONBLOCK 2
-/** Flag for splice(). */
 #define SPLICE_F_MORE 4
-/** Flag for splice(). */
 #define SPLICE_F_GIFT 8
 #endif
 
 #if __ANDROID_API__ >= __ANDROID_API_O__
-/** Flag for sync_file_range(). */
 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
-/** Flag for sync_file_range(). */
 #define SYNC_FILE_RANGE_WRITE 2
-/** Flag for sync_file_range(). */
 #define SYNC_FILE_RANGE_WAIT_AFTER 4
 #endif
 
-/**
- * [creat(2)](http://man7.org/linux/man-pages/man2/creat.2.html)
- * creates a file.
- *
- * Returns a new file descriptor on success and returns -1 and sets `errno` on
- * failure.
- */
 int creat(const char* __path, mode_t __mode);
-/** See creat(). */
 int creat64(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
-
-/**
- * [openat(2)](http://man7.org/linux/man-pages/man2/openat.2.html)
- * opens (and possibly creates) a file.
- *
- * Returns a new file descriptor on success and returns -1 and sets `errno` on
- * failure.
- */
 int openat(int __dir_fd, const char* __path, int __flags, ...);
-/** See openat(). */
 int openat64(int __dir_fd, const char* __path, int __flags, ...) __INTRODUCED_IN(21);
-
-/**
- * [open(2)](http://man7.org/linux/man-pages/man2/open.2.html)
- * opens (and possibly creates) a file.
- *
- * Returns a new file descriptor on success and returns -1 and sets `errno` on
- * failure.
- */
 int open(const char* __path, int __flags, ...);
-/** See open(). */
 int open64(const char* __path, int __flags, ...) __INTRODUCED_IN(21);
-
-/**
- * [splice(2)](http://man7.org/linux/man-pages/man2/splice.2.html)
- * splices data to/from a pipe.
- *
- * Valid flags are `SPLICE_F_MOVE`, `SPLICE_F_NONBLOCK`, `SPLICE_F_MORE`, and
- * `SPLICE_F_GIFT`.
- *
- * Returns the number of bytes spliced on success and returns -1 and sets
- * `errno` on failure.
- *
- * Available since API level 21.
- */
 ssize_t splice(int __in_fd, off64_t* __in_offset, int __out_fd, off64_t* __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
-
-/**
- * [tee(2)](http://man7.org/linux/man-pages/man2/tee.2.html)
- * duplicates data from one pipe to another.
- *
- * Valid flags are `SPLICE_F_MOVE`, `SPLICE_F_NONBLOCK`, `SPLICE_F_MORE`, and
- * `SPLICE_F_GIFT`.
- *
- * Returns the number of bytes duplicated on success and returns -1 and sets
- * `errno` on failure.
- *
- * Available since API level 21.
- */
 ssize_t tee(int __in_fd, int __out_fd, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
-
-/**
- * [vmsplice(2)](http://man7.org/linux/man-pages/man2/vmsplice.2.html)
- * splices data to/from a pipe.
- *
- * Valid flags are `SPLICE_F_MOVE`, `SPLICE_F_NONBLOCK`, `SPLICE_F_MORE`, and
- * `SPLICE_F_GIFT`.
- *
- * Returns the number of bytes spliced on success and returns -1 and sets
- * `errno` on failure.
- *
- * Available since API level 21.
- */
 ssize_t vmsplice(int __fd, const struct iovec* __iov, size_t __count, unsigned int __flags) __INTRODUCED_IN(21);
 
-/**
- * [fallocate(2)](http://man7.org/linux/man-pages/man2/fallocate.2.html)
- * is a Linux-specific extension of posix_fallocate().
- *
- * Valid flags are `FALLOC_FL_KEEP_SIZE`, `FALLOC_FL_PUNCH_HOLE`,
- * `FALLOC_FL_NO_HIDE_STALE`, `FALLOC_FL_COLLAPSE_RANGE`,
- * `FALLOC_FL_ZERO_RANGE`, `FALLOC_FL_INSERT_RANGE`, and
- * `FALLOC_FL_UNSHARE_RANGE`.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- *
- * Available since API level 21.
- */
 int fallocate(int __fd, int __mode, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(fallocate64) __INTRODUCED_IN(21);
-/** See fallocate(). */
 int fallocate64(int __fd, int __mode, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
-
-/**
- * [posix_fadvise(2)](http://man7.org/linux/man-pages/man2/posix_fadvise.2.html)
- * declares an expected access pattern for file data.
- *
- * Valid flags are `POSIX_FADV_NORMAL`, `POSIX_FADV_RANDOM`,
- * `POSIX_FADV_SEQUENTIAL`, `POSIX_FADV_WILLNEED`, `POSIX_FADV_DONTNEED`,
- * and `POSIX_FADV_NOREUSE`.
- *
- * Returns 0 on success and returns an error number on failure.
- *
- * Available since API level 21.
- */
 int posix_fadvise(int __fd, off_t __offset, off_t __length, int __advice) __RENAME_IF_FILE_OFFSET64(posix_fadvise64) __INTRODUCED_IN(21);
-/** See posix_fadvise(). */
 int posix_fadvise64(int __fd, off64_t __offset, off64_t __length, int __advice) __INTRODUCED_IN(21);
-
-/**
- * [posix_fallocate(2)](http://man7.org/linux/man-pages/man2/posix_fallocate.2.html)
- * allocates file space.
- *
- * Returns 0 on success and returns an error number on failure.
- *
- * Available since API level 21.
- */
 int posix_fallocate(int __fd, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(posix_fallocate64) __INTRODUCED_IN(21);
-/** See posix_fallocate(). */
 int posix_fallocate64(int __fd, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
 
 #if defined(__USE_GNU)
-
-/**
- * [readahead(2)](http://man7.org/linux/man-pages/man2/readahead.2.html)
- * initiates readahead for the given file.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-ssize_t readahead(int __fd, off64_t __offset, size_t __length);
-
-/**
- * [sync_file_range(2)](http://man7.org/linux/man-pages/man2/sync_file_range.2.html)
- * syncs part of a file with disk.
- *
- * Valid flags are `SYNC_FILE_RANGE_WAIT_BEFORE`, `SYNC_FILE_RANGE_WRITE`, and
- * `SYNC_FILE_RANGE_WAIT_AFTER`.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
+ssize_t readahead(int __fd, off64_t __offset, size_t __length) __INTRODUCED_IN(16);
 int sync_file_range(int __fd, off64_t __offset, off64_t __length, unsigned int __flags) __INTRODUCED_IN(26);
-
 #endif
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
@@ -234,3 +96,5 @@
 #endif
 
 __END_DECLS
+
+#endif
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index 90ac805..886612e 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -46,9 +46,11 @@
 // fenv was always available on x86.
 #if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
 int feclearexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+    __INTRODUCED_IN_X86(9);
 int feraiseexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+    __INTRODUCED_IN_X86(9);
 int fetestexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 
 int fegetround(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
@@ -57,7 +59,8 @@
 int fegetenv(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 int feholdexcept(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 int fesetenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+    __INTRODUCED_IN_X86(9);
 
 int feenableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 int fedisableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
diff --git a/libc/include/link.h b/libc/include/link.h
index bd430f5..072f093 100644
--- a/libc/include/link.h
+++ b/libc/include/link.h
@@ -47,12 +47,6 @@
   const char* dlpi_name;
   const ElfW(Phdr)* dlpi_phdr;
   ElfW(Half) dlpi_phnum;
-
-  // These fields were added in Android R.
-  unsigned long long dlpi_adds;
-  unsigned long long dlpi_subs;
-  size_t dlpi_tls_modid;
-  void* dlpi_tls_data;
 };
 
 #if defined(__arm__)
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index aa046b9..eba18a8 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -125,8 +125,7 @@
 
 /**
  * [mallinfo(3)](http://man7.org/linux/man-pages/man3/mallinfo.3.html) returns
- * information about the current state of the heap. Note that mallinfo() is
- * inherently unreliable and consider using malloc_info() instead.
+ * information about the current state of the heap.
  */
 struct mallinfo mallinfo(void);
 
diff --git a/libc/include/math.h b/libc/include/math.h
index 7efc83a..beb66a7 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -217,7 +217,7 @@
 long double lgammal(long double __x) __RENAME_LDBL(lgamma, 3, 21);
 
 double tgamma(double __x);
-float tgammaf(float __x);
+float tgammaf(float __x) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
 long double tgammal(long double __x) __RENAME_LDBL(tgamma, 3, 21);
 
 double ceil(double __x);
@@ -276,8 +276,8 @@
 float copysignf(float __value, float __sign) __attribute_const__;
 long double copysignl(long double __value, long double __sign) __RENAME_LDBL(copysign, 3, 3) __attribute_const__;
 
-double nan(const char* __kind) __attribute_const__;
-float nanf(const char* __kind) __attribute_const__;
+double nan(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
+float nanf(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
 long double nanl(const char* __kind) __RENAME_LDBL(nan, 13, 13) __attribute_const__;
 
 double nextafter(double __x, double __y);
diff --git a/libc/include/netinet/ether.h b/libc/include/netinet/ether.h
index 480063d..6268a14 100644
--- a/libc/include/netinet/ether.h
+++ b/libc/include/netinet/ether.h
@@ -43,31 +43,39 @@
  * representation of the given Ethernet address.
  *
  * Returns a pointer to a static buffer.
+ *
+ * Available since API level 11.
  */
-char* ether_ntoa(const struct ether_addr* __addr);
+char* ether_ntoa(const struct ether_addr* __addr) __INTRODUCED_IN(11);
 
 /**
  * [ether_ntoa_r(3)](http://man7.org/linux/man-pages/man3/ether_ntoa_r.3.html) returns a string
  * representation of the given Ethernet address.
  *
  * Returns a pointer to the given buffer.
+ *
+ * Available since API level 11.
  */
-char* ether_ntoa_r(const struct ether_addr* __addr, char* __buf);
+char* ether_ntoa_r(const struct ether_addr* __addr, char* __buf) __INTRODUCED_IN(11);
 
 /**
  * [ether_aton(3)](http://man7.org/linux/man-pages/man3/ether_aton.3.html) returns an `ether_addr`
  * corresponding to the given Ethernet address string.
  *
  * Returns a pointer to a static buffer, or NULL if the given string isn't a valid MAC address.
+ *
+ * Available since API level 11.
  */
-struct ether_addr* ether_aton(const char* __ascii);
+struct ether_addr* ether_aton(const char* __ascii) __INTRODUCED_IN(11);
 
 /**
  * [ether_aton_r(3)](http://man7.org/linux/man-pages/man3/ether_aton_r.3.html) returns an
  * `ether_addr` corresponding to the given Ethernet address string.
  *
  * Returns a pointer to the given buffer, or NULL if the given string isn't a valid MAC address.
+ *
+ * Available since API level 11.
  */
-struct ether_addr* ether_aton_r(const char* __ascii, struct ether_addr* __addr);
+struct ether_addr* ether_aton_r(const char* __ascii, struct ether_addr* __addr) __INTRODUCED_IN(11);
 
 __END_DECLS
diff --git a/libc/include/paths.h b/libc/include/paths.h
index 0aa4d93..0cf2789 100644
--- a/libc/include/paths.h
+++ b/libc/include/paths.h
@@ -47,7 +47,7 @@
 #define _PATH_CONSOLE "/dev/console"
 
 /** Default shell search path. */
-#define _PATH_DEFPATH "/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin"
+#define _PATH_DEFPATH "/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin"
 
 /** Path to the directory containing device files. */
 #define _PATH_DEV "/dev/"
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index b549871..724e5b7 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -92,7 +92,7 @@
 #define PTHREAD_SCOPE_SYSTEM 0
 #define PTHREAD_SCOPE_PROCESS 1
 
-int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void));
+int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void)) __INTRODUCED_IN(12);
 
 int pthread_attr_destroy(pthread_attr_t* __attr);
 int pthread_attr_getdetachstate(const pthread_attr_t* __attr, int* __state);
@@ -121,8 +121,6 @@
 int pthread_condattr_setpshared(pthread_condattr_t* __attr, int __shared);
 
 int pthread_cond_broadcast(pthread_cond_t* __cond);
-int pthread_cond_clockwait(pthread_cond_t* __cond, pthread_mutex_t* __mutex, clockid_t __clock,
-                           const struct timespec* __timeout) __INTRODUCED_IN(30);
 int pthread_cond_destroy(pthread_cond_t* __cond);
 int pthread_cond_init(pthread_cond_t* __cond, const pthread_condattr_t* __attr);
 int pthread_cond_signal(pthread_cond_t* __cond);
@@ -132,10 +130,8 @@
  * typically inappropriate, since that clock can change dramatically, causing the timeout to
  * either expire earlier or much later than intended.
  * Condition variables have an initialization option to use CLOCK_MONOTONIC, and in addition,
- * Android provides pthread_cond_timedwait_monotonic_np to use CLOCK_MONOTONIC on a condition
- * variable for this single wait no matter how it was initialized.
- * Note that pthread_cond_clockwait() allows specifying an arbitrary clock and has superseded this
- * function.
+ * Android provides this API to use CLOCK_MONOTONIC on a condition variable for this single wait
+ * no matter how it was initialized.
  */
 int pthread_cond_timedwait_monotonic_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex,
                                         const struct timespec* __timeout) __INTRODUCED_IN_64(28);
@@ -185,8 +181,6 @@
 int pthread_mutexattr_settype(pthread_mutexattr_t* __attr, int __type);
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t* __attr, int __protocol) __INTRODUCED_IN(28);
 
-int pthread_mutex_clocklock(pthread_mutex_t* __mutex, clockid_t __clock,
-                            const struct timespec* __abstime) __INTRODUCED_IN(30);
 int pthread_mutex_destroy(pthread_mutex_t* __mutex);
 int pthread_mutex_init(pthread_mutex_t* __mutex, const pthread_mutexattr_t* __attr);
 int pthread_mutex_lock(pthread_mutex_t* __mutex);
@@ -194,13 +188,11 @@
   __INTRODUCED_IN(21);
 
 /*
- * POSIX historically only supported using pthread_mutex_timedlock() with CLOCK_REALTIME, however
- * that is typically inappropriate, since that clock can change dramatically, causing the timeout to
+ * POSIX only supports using pthread_mutex_timedlock() with CLOCK_REALTIME, however that is
+ * typically inappropriate, since that clock can change dramatically, causing the timeout to
  * either expire earlier or much later than intended.
  * This function is added to use a timespec based on CLOCK_MONOTONIC that does not suffer
  * from this issue.
- * Note that pthread_mutex_clocklock() allows specifying an arbitrary clock and has superseded this
- * function.
  */
 int pthread_mutex_timedlock_monotonic_np(pthread_mutex_t* __mutex, const struct timespec* __timeout)
     __INTRODUCED_IN(28);
@@ -234,10 +226,6 @@
   __INTRODUCED_IN(23);
 int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t* __attr, int __kind) __INTRODUCED_IN(23);
 
-int pthread_rwlock_clockrdlock(pthread_rwlock_t* __rwlock, clockid_t __clock,
-                               const struct timespec* __timeout) __INTRODUCED_IN(30);
-int pthread_rwlock_clockwrlock(pthread_rwlock_t* __rwlock, clockid_t __clock,
-                               const struct timespec* __timeout) __INTRODUCED_IN(30);
 int pthread_rwlock_destroy(pthread_rwlock_t* __rwlock);
 int pthread_rwlock_init(pthread_rwlock_t* __rwlock, const pthread_rwlockattr_t* __attr);
 int pthread_rwlock_rdlock(pthread_rwlock_t* __rwlock);
diff --git a/libc/include/pwd.h b/libc/include/pwd.h
index d481aac..5c516d7 100644
--- a/libc/include/pwd.h
+++ b/libc/include/pwd.h
@@ -89,8 +89,8 @@
 void setpwent(void) __INTRODUCED_IN(26);
 void endpwent(void) __INTRODUCED_IN(26);
 
-int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
-int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
+int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
+int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
 
 __END_DECLS
 
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 52a8ca6..1f50366 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -56,7 +56,7 @@
 int clone(int (*__fn)(void*), void* __child_stack, int __flags, void* __arg, ...)
     __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(17);
 int unshare(int __flags) __INTRODUCED_IN(17);
-int sched_getcpu(void);
+int sched_getcpu(void) __INTRODUCED_IN(12);
 int setns(int __fd, int __ns_type) __INTRODUCED_IN(21);
 
 #ifdef __LP64__
@@ -74,8 +74,8 @@
   __CPU_BITTYPE  __bits[ CPU_SETSIZE / __CPU_BITS ];
 } cpu_set_t;
 
-int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set);
-int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* __set);
+int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
+int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* __set) __INTRODUCED_IN(12);
 
 #define CPU_ZERO(set)          CPU_ZERO_S(sizeof(cpu_set_t), set)
 #define CPU_SET(cpu, set)      CPU_SET_S(cpu, sizeof(cpu_set_t), set)
@@ -98,8 +98,8 @@
 #define CPU_ALLOC(count)  __sched_cpualloc((count))
 #define CPU_FREE(set)     __sched_cpufree((set))
 
-cpu_set_t* __sched_cpualloc(size_t __count);
-void __sched_cpufree(cpu_set_t* __set);
+cpu_set_t* __sched_cpualloc(size_t __count) __INTRODUCED_IN(12);
+void __sched_cpufree(cpu_set_t* __set) __INTRODUCED_IN(12);
 
 #define CPU_ZERO_S(setsize, set)  __builtin_memset(set, 0, setsize)
 
@@ -143,7 +143,7 @@
 
 #define CPU_COUNT_S(setsize, set)  __sched_cpucount((setsize), (set))
 
-int __sched_cpucount(size_t __set_size, const cpu_set_t* __set);
+int __sched_cpucount(size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
 
 #endif /* __USE_GNU */
 
diff --git a/libc/include/search.h b/libc/include/search.h
index 7a75404..97fdeda 100644
--- a/libc/include/search.h
+++ b/libc/include/search.h
@@ -6,56 +6,30 @@
  * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $
  */
 
-#pragma once
-
-/**
- * @file search.h
- * @brief Queues, hash tables, trees, and linear array searches.
- */
+#ifndef _SEARCH_H_
+#define _SEARCH_H_
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-/** See hsearch()/hsearch_r(). */
 typedef enum {
   FIND,
   ENTER
 } ACTION;
 
-/** See hsearch()/hsearch_r(). */
 typedef struct entry {
-  /** The string key. */
   char* key;
-  /** The associated data. */
   void* data;
 } ENTRY;
 
-/**
- * Constants given to the twalk() visitor.
- * Note that the constant names are misleading.
- */
 typedef enum {
-  /**
-   * If this is the first visit to a non-leaf node.
-   * Use this for *preorder* traversal.
-   */
   preorder,
-  /**
-   * If this is the second visit to a non-leaf node.
-   * Use this for *inorder* traversal.
-   */
   postorder,
-  /**
-   * If this is the third visit to a non-leaf node.
-   * Use this for *postorder* traversal.
-   */
   endorder,
-  /** If this is the first and only visit to a leaf node. */
   leaf
 } VISIT;
 
 #if defined(__USE_BSD) || defined(__USE_GNU)
-/** The hash table type for hcreate_r()/hdestroy_r()/hsearch_r(). */
 struct hsearch_data {
   struct __hsearch* __hsearch;
 };
@@ -63,157 +37,30 @@
 
 __BEGIN_DECLS
 
-/**
- * [insque(3)](http://man7.org/linux/man-pages/man3/insque.3.html) inserts
- * an item in a queue (an intrusive doubly-linked list).
- *
- * Available since API level 21.
- */
 void insque(void* __element, void* __previous) __INTRODUCED_IN(21);
-
-/**
- * [remque(3)](http://man7.org/linux/man-pages/man3/remque.3.html) removes
- * an item from a queue (an intrusive doubly-linked list).
- *
- * Available since API level 21.
- */
 void remque(void* __element) __INTRODUCED_IN(21);
 
-/**
- * [hcreate(3)](http://man7.org/linux/man-pages/man3/hcreate.3.html)
- * initializes the global hash table, with space for at least `__n` elements.
- *
- * See hcreate_r() if you need more than one hash table.
- *
- * Returns *non-zero* on success and returns 0 and sets `errno` on failure.
- *
- * Available since API level 28.
- */
-int hcreate(size_t __n) __INTRODUCED_IN(28);
-
-/**
- * [hdestroy(3)](http://man7.org/linux/man-pages/man3/hdestroy.3.html) destroys
- * the global hash table.
- *
- * See hdestroy_r() if you need more than one hash table.
- *
- * Available since API level 28.
- */
+int hcreate(size_t) __INTRODUCED_IN(28);
 void hdestroy(void) __INTRODUCED_IN(28);
-
-/**
- * [hsearch(3)](http://man7.org/linux/man-pages/man3/hsearch.3.html) finds or
- * inserts `__entry` in the global hash table, based on `__action`.
- *
- * See hsearch_r() if you need more than one hash table.
- *
- * Returns a pointer to the entry on success, and returns NULL and sets
- * `errno` on failure.
- *
- * Available since API level 28.
- */
-ENTRY* hsearch(ENTRY __entry, ACTION __action) __INTRODUCED_IN(28);
+ENTRY* hsearch(ENTRY, ACTION) __INTRODUCED_IN(28);
 
 #if defined(__USE_BSD) || defined(__USE_GNU)
-
-/**
- * [hcreate_r(3)](http://man7.org/linux/man-pages/man3/hcreate_r.3.html)
- * initializes a hash table `__table` with space for at least `__n` elements.
- *
- * Returns *non-zero* on success and returns 0 and sets `errno` on failure.
- *
- * Available since API level 28.
- */
-int hcreate_r(size_t __n, struct hsearch_data* __table) __INTRODUCED_IN(28);
-
-/**
- * [hdestroy_r(3)](http://man7.org/linux/man-pages/man3/hdestroy_r.3.html) destroys
- * the hash table `__table`.
- *
- * Available since API level 28.
- */
-void hdestroy_r(struct hsearch_data* __table) __INTRODUCED_IN(28);
-
-/**
- * [hsearch_r(3)](http://man7.org/linux/man-pages/man3/hsearch_r.3.html) finds or
- * inserts `__entry` in the hash table `__table`, based on `__action`.
- *
- * Returns *non-zero* on success and returns 0 and sets `errno` on failure.
- * A pointer to the entry is returned in `*__result`.
- *
- * Available since API level 28.
- */
-int hsearch_r(ENTRY __entry, ACTION __action, ENTRY** __result, struct hsearch_data* __table) __INTRODUCED_IN(28);
-
+int hcreate_r(size_t, struct hsearch_data*) __INTRODUCED_IN(28);
+void hdestroy_r(struct hsearch_data*) __INTRODUCED_IN(28);
+int hsearch_r(ENTRY, ACTION, ENTRY**, struct hsearch_data*) __INTRODUCED_IN(28);
 #endif
 
-/**
- * [lfind(3)](http://man7.org/linux/man-pages/man3/lfind.3.html) brute-force
- * searches the unsorted array `__array` (of `__count` items each of size `__size`)
- * for `__key`, using `__comparator`.
- *
- * See bsearch() if you have a sorted array.
- *
- * Returns a pointer to the matching element on success, or NULL on failure.
- *
- * Available since API level 21.
- */
-void* lfind(const void* __key, const void* __array, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(21);
+void* lfind(const void* __key, const void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
+  __INTRODUCED_IN(21);
+void* lsearch(const void* __key, void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
+  __INTRODUCED_IN(21);
 
-/**
- * [lsearch(3)](http://man7.org/linux/man-pages/man3/lsearch.3.html) brute-force
- * searches the unsorted array `__array` (of `__count` items each of size `__size`)
- * for `__key`, using `__comparator`.
- *
- * Unlike lfind(), on failure lsearch() will *insert* `__key` at the end of
- * `__array` and increment `*__count`.
- *
- * Returns a pointer to the matching element on success, or to the newly-added
- * element on failure.
- *
- * Available since API level 21.
- */
-void* lsearch(const void* __key, void* __array, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(21);
-
-/**
- * [tdelete(3)](http://man7.org/linux/man-pages/man3/tdelete.3.html) searches
- * for and removes an element in the tree `*__root_ptr`. The search is performed
- * using `__comparator`.
- *
- * Returns a pointer to the parent of the deleted node, or NULL on failure.
- */
-void* tdelete(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*));
-
-/**
- * [tdestroy(3)](http://man7.org/linux/man-pages/man3/tdestroy.3.html) destroys
- * the hash table `__root` using `__free_fn` on each node.
- */
-void tdestroy(void* __root, void (*__free_fn)(void*));
-
-/**
- * [tfind(3)](http://man7.org/linux/man-pages/man3/tfind.3.html) searches
- * for an element in the tree `*__root_ptr`. The search is performed using
- * `__comparator`.
- *
- * Returns a pointer to the matching node, or NULL on failure.
- */
-void* tfind(const void* __key, void* const* __root_ptr, int (*__comparator)(const void*, const void*));
-
-/**
- * [tsearch(3)](http://man7.org/linux/man-pages/man3/tsearch.3.html) searches
- * for an element in the tree `*__root_ptr`. The search is performed using
- * `__comparator`.
- *
- * Unlike tfind(), on failure tsearch() will *insert* `__key` into the tree.
- *
- * Returns a pointer to the matching node, or to the newly-added node.
- */
-void* tsearch(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*));
-
-/**
- * [twalk(3)](http://man7.org/linux/man-pages/man3/twalk.3.html) calls
- * `__visitor` on every node in the tree.
- */
-void twalk(const void* __root, void (*__visitor)(const void*, VISIT, int));
+void* tdelete(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void tdestroy(void* __root, void (*__free_fn)(void*)) __INTRODUCED_IN(16);
+void* tfind(const void* __key, void* const* __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void* tsearch(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void twalk(const void* __root, void (*__visitor)(const void*, VISIT, int)) __INTRODUCED_IN(21);
 
 __END_DECLS
+
+#endif
diff --git a/libc/include/semaphore.h b/libc/include/semaphore.h
index 5d66f7e..01d685b 100644
--- a/libc/include/semaphore.h
+++ b/libc/include/semaphore.h
@@ -30,7 +30,6 @@
 #define _SEMAPHORE_H
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
 
 __BEGIN_DECLS
 
@@ -45,19 +44,16 @@
 
 #define SEM_FAILED __BIONIC_CAST(reinterpret_cast, sem_t*, 0)
 
-int sem_clockwait(sem_t* __sem, clockid_t __clock, const struct timespec* __ts) __INTRODUCED_IN(30);
 int sem_destroy(sem_t* __sem);
 int sem_getvalue(sem_t* __sem, int* __value);
 int sem_init(sem_t* __sem, int __shared, unsigned int __value);
 int sem_post(sem_t* __sem);
 int sem_timedwait(sem_t* __sem, const struct timespec* __ts);
 /*
- * POSIX historically only supported using sem_timedwait() with CLOCK_REALTIME, however that is
- * typically inappropriate, since that clock can change dramatically, causing the timeout to either
+ * POSIX only supports using sem_timedwait() with CLOCK_REALTIME, however that is typically
+ * inappropriate, since that clock can change dramatically, causing the timeout to either
  * expire earlier or much later than intended.  This function is added to use a timespec based
  * on CLOCK_MONOTONIC that does not suffer from this issue.
- * Note that sem_clockwait() allows specifying an arbitrary clock and has superseded this
- * function.
  */
 int sem_timedwait_monotonic_np(sem_t* __sem, const struct timespec* __ts) __INTRODUCED_IN(28);
 int sem_trywait(sem_t* __sem);
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index b22071f..195f251 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -65,16 +65,18 @@
 
 __BEGIN_DECLS
 
-int _setjmp(jmp_buf __env) __returns_twice;
-__noreturn void _longjmp(jmp_buf __env, int __value);
+int _setjmp(jmp_buf __env);
+void _longjmp(jmp_buf __env, int __value);
 
-int setjmp(jmp_buf __env) __returns_twice;
-__noreturn void longjmp(jmp_buf __env, int __value);
+int setjmp(jmp_buf __env);
+void longjmp(jmp_buf __env, int __value);
 
 #define setjmp(__env) setjmp(__env)
 
-int sigsetjmp(sigjmp_buf __env, int __save_signal_mask);
-__noreturn void siglongjmp(sigjmp_buf __env, int __value);
+int sigsetjmp(sigjmp_buf __env, int __save_signal_mask)
+    __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
+void siglongjmp(sigjmp_buf __env, int __value)
+    __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
 
 __END_DECLS
 
diff --git a/libc/include/signal.h b/libc/include/signal.h
index cd11656..c788ca6 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -105,7 +105,7 @@
 int raise(int __signal);
 int kill(pid_t __pid, int __signal);
 int killpg(int __pgrp, int __signal);
-int tgkill(int __tgid, int __tid, int __signal);
+int tgkill(int __tgid, int __tid, int __signal) __INTRODUCED_IN_32(16);
 
 int sigaltstack(const stack_t* __new_signal_stack, stack_t* __old_signal_stack);
 
diff --git a/libc/include/stdatomic.h b/libc/include/stdatomic.h
index b7dac4a..3c61334 100644
--- a/libc/include/stdatomic.h
+++ b/libc/include/stdatomic.h
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 
-#if defined(__cplusplus) && __cplusplus >= 201103L && __has_include(<atomic>)
+#if defined(__cplusplus) && __cplusplus >= 201103L && defined(_USING_LIBCXX)
 # if __has_feature(cxx_atomic)
 #  define _STDATOMIC_HAVE_ATOMIC
 # endif
@@ -127,8 +127,260 @@
 
 #else /* <atomic> unavailable, possibly because this is C, not C++ */
 
-/* Actual implementation is in bits/stdatomic.h since our test code is C++. */
-#include <bits/stdatomic.h>
+#include <sys/types.h>
+#include <stdbool.h>
+
+/*
+ * C: Do it ourselves.
+ * Note that the runtime representation defined here should be compatible
+ * with the C++ one, i.e. an _Atomic(T) needs to contain the same
+ * bits as a T.
+ */
+
+#include <stddef.h>  /* For ptrdiff_t. */
+#include <stdint.h>  /* TODO: don't drag in all the macros, just the types. */
+// Include uchar.h only when available.  Bionic's stdatomic.h is also used for
+// the host (via a copy in prebuilts/clang) and uchar.h is not available in the
+// glibc used for the host.
+#if defined(__BIONIC__)
+# include <uchar.h>  /* For char16_t and char32_t.              */
+#endif
+
+/*
+ * 7.17.1 Atomic lock-free macros.
+ */
+
+#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE
+#define	ATOMIC_BOOL_LOCK_FREE		__GCC_ATOMIC_BOOL_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE
+#define	ATOMIC_CHAR_LOCK_FREE		__GCC_ATOMIC_CHAR_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define	ATOMIC_CHAR16_T_LOCK_FREE	__GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define	ATOMIC_CHAR32_T_LOCK_FREE	__GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define	ATOMIC_WCHAR_T_LOCK_FREE	__GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE
+#define	ATOMIC_SHORT_LOCK_FREE		__GCC_ATOMIC_SHORT_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_INT_LOCK_FREE
+#define	ATOMIC_INT_LOCK_FREE		__GCC_ATOMIC_INT_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_LONG_LOCK_FREE
+#define	ATOMIC_LONG_LOCK_FREE		__GCC_ATOMIC_LONG_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE
+#define	ATOMIC_LLONG_LOCK_FREE		__GCC_ATOMIC_LLONG_LOCK_FREE
+#endif
+#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE
+#define	ATOMIC_POINTER_LOCK_FREE	__GCC_ATOMIC_POINTER_LOCK_FREE
+#endif
+
+/*
+ * 7.17.2 Initialization.
+ */
+
+#define	ATOMIC_VAR_INIT(value)		(value)
+#define	atomic_init(obj, value)		__c11_atomic_init(obj, value)
+
+/*
+ * Clang and recent GCC both provide predefined macros for the memory
+ * orderings.  If we are using a compiler that doesn't define them, use the
+ * clang values - these will be ignored in the fallback path.
+ */
+
+#ifndef __ATOMIC_RELAXED
+#define __ATOMIC_RELAXED		0
+#endif
+#ifndef __ATOMIC_CONSUME
+#define __ATOMIC_CONSUME		1
+#endif
+#ifndef __ATOMIC_ACQUIRE
+#define __ATOMIC_ACQUIRE		2
+#endif
+#ifndef __ATOMIC_RELEASE
+#define __ATOMIC_RELEASE		3
+#endif
+#ifndef __ATOMIC_ACQ_REL
+#define __ATOMIC_ACQ_REL		4
+#endif
+#ifndef __ATOMIC_SEQ_CST
+#define __ATOMIC_SEQ_CST		5
+#endif
+
+/*
+ * 7.17.3 Order and consistency.
+ *
+ * The memory_order_* constants that denote the barrier behaviour of the
+ * atomic operations.
+ * The enum values must be identical to those used by the
+ * C++ <atomic> header.
+ */
+
+typedef enum {
+	memory_order_relaxed = __ATOMIC_RELAXED,
+	memory_order_consume = __ATOMIC_CONSUME,
+	memory_order_acquire = __ATOMIC_ACQUIRE,
+	memory_order_release = __ATOMIC_RELEASE,
+	memory_order_acq_rel = __ATOMIC_ACQ_REL,
+	memory_order_seq_cst = __ATOMIC_SEQ_CST
+} memory_order;
+
+/*
+ * 7.17.4 Fences.
+ */
+
+static __inline void atomic_thread_fence(memory_order __order __attribute__((unused))) {
+	__c11_atomic_thread_fence(__order);
+}
+
+static __inline void atomic_signal_fence(memory_order __order __attribute__((unused))) {
+	__c11_atomic_signal_fence(__order);
+}
+
+/*
+ * 7.17.5 Lock-free property.
+ */
+
+#define	atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
+
+/*
+ * 7.17.6 Atomic integer types.
+ */
+
+typedef _Atomic(bool)			atomic_bool;
+typedef _Atomic(char)			atomic_char;
+typedef _Atomic(signed char)		atomic_schar;
+typedef _Atomic(unsigned char)		atomic_uchar;
+typedef _Atomic(short)			atomic_short;
+typedef _Atomic(unsigned short)		atomic_ushort;
+typedef _Atomic(int)			atomic_int;
+typedef _Atomic(unsigned int)		atomic_uint;
+typedef _Atomic(long)			atomic_long;
+typedef _Atomic(unsigned long)		atomic_ulong;
+typedef _Atomic(long long)		atomic_llong;
+typedef _Atomic(unsigned long long)	atomic_ullong;
+#if defined(__BIONIC__) || (defined(__cplusplus) && __cplusplus >= 201103L)
+  typedef _Atomic(char16_t)		atomic_char16_t;
+  typedef _Atomic(char32_t)		atomic_char32_t;
+#endif
+typedef _Atomic(wchar_t)		atomic_wchar_t;
+typedef _Atomic(int_least8_t)		atomic_int_least8_t;
+typedef _Atomic(uint_least8_t)	atomic_uint_least8_t;
+typedef _Atomic(int_least16_t)	atomic_int_least16_t;
+typedef _Atomic(uint_least16_t)	atomic_uint_least16_t;
+typedef _Atomic(int_least32_t)	atomic_int_least32_t;
+typedef _Atomic(uint_least32_t)	atomic_uint_least32_t;
+typedef _Atomic(int_least64_t)	atomic_int_least64_t;
+typedef _Atomic(uint_least64_t)	atomic_uint_least64_t;
+typedef _Atomic(int_fast8_t)		atomic_int_fast8_t;
+typedef _Atomic(uint_fast8_t)		atomic_uint_fast8_t;
+typedef _Atomic(int_fast16_t)		atomic_int_fast16_t;
+typedef _Atomic(uint_fast16_t)	atomic_uint_fast16_t;
+typedef _Atomic(int_fast32_t)		atomic_int_fast32_t;
+typedef _Atomic(uint_fast32_t)	atomic_uint_fast32_t;
+typedef _Atomic(int_fast64_t)		atomic_int_fast64_t;
+typedef _Atomic(uint_fast64_t)	atomic_uint_fast64_t;
+typedef _Atomic(intptr_t)		atomic_intptr_t;
+typedef _Atomic(uintptr_t)		atomic_uintptr_t;
+typedef _Atomic(size_t)		atomic_size_t;
+typedef _Atomic(ptrdiff_t)		atomic_ptrdiff_t;
+typedef _Atomic(intmax_t)		atomic_intmax_t;
+typedef _Atomic(uintmax_t)		atomic_uintmax_t;
+
+/*
+ * 7.17.7 Operations on atomic types.
+ */
+
+/*
+ * Compiler-specific operations.
+ */
+
+#define	atomic_compare_exchange_strong_explicit(object, expected,	\
+    desired, success, failure)						\
+	__c11_atomic_compare_exchange_strong(object, expected, desired,	\
+	    success, failure)
+#define	atomic_compare_exchange_weak_explicit(object, expected,		\
+    desired, success, failure)						\
+	__c11_atomic_compare_exchange_weak(object, expected, desired,	\
+	    success, failure)
+#define	atomic_exchange_explicit(object, desired, order)		\
+	__c11_atomic_exchange(object, desired, order)
+#define	atomic_fetch_add_explicit(object, operand, order)		\
+	__c11_atomic_fetch_add(object, operand, order)
+#define	atomic_fetch_and_explicit(object, operand, order)		\
+	__c11_atomic_fetch_and(object, operand, order)
+#define	atomic_fetch_or_explicit(object, operand, order)		\
+	__c11_atomic_fetch_or(object, operand, order)
+#define	atomic_fetch_sub_explicit(object, operand, order)		\
+	__c11_atomic_fetch_sub(object, operand, order)
+#define	atomic_fetch_xor_explicit(object, operand, order)		\
+	__c11_atomic_fetch_xor(object, operand, order)
+#define	atomic_load_explicit(object, order)				\
+	__c11_atomic_load(object, order)
+#define	atomic_store_explicit(object, desired, order)			\
+	__c11_atomic_store(object, desired, order)
+
+/*
+ * Convenience functions.
+ */
+
+#define	atomic_compare_exchange_strong(object, expected, desired)	\
+	atomic_compare_exchange_strong_explicit(object, expected,	\
+	    desired, memory_order_seq_cst, memory_order_seq_cst)
+#define	atomic_compare_exchange_weak(object, expected, desired)		\
+	atomic_compare_exchange_weak_explicit(object, expected,		\
+	    desired, memory_order_seq_cst, memory_order_seq_cst)
+#define	atomic_exchange(object, desired)				\
+	atomic_exchange_explicit(object, desired, memory_order_seq_cst)
+#define	atomic_fetch_add(object, operand)				\
+	atomic_fetch_add_explicit(object, operand, memory_order_seq_cst)
+#define	atomic_fetch_and(object, operand)				\
+	atomic_fetch_and_explicit(object, operand, memory_order_seq_cst)
+#define	atomic_fetch_or(object, operand)				\
+	atomic_fetch_or_explicit(object, operand, memory_order_seq_cst)
+#define	atomic_fetch_sub(object, operand)				\
+	atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst)
+#define	atomic_fetch_xor(object, operand)				\
+	atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst)
+#define	atomic_load(object)						\
+	atomic_load_explicit(object, memory_order_seq_cst)
+#define	atomic_store(object, desired)					\
+	atomic_store_explicit(object, desired, memory_order_seq_cst)
+
+/*
+ * 7.17.8 Atomic flag type and operations.
+ *
+ * XXX: Assume atomic_bool can be used as an atomic_flag. Is there some
+ * kind of compiler built-in type we could use?
+ */
+
+typedef struct {
+	atomic_bool	__flag;
+} atomic_flag;
+
+#define	ATOMIC_FLAG_INIT		{ ATOMIC_VAR_INIT(false) }
+
+static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, memory_order __order) {
+	return (atomic_exchange_explicit(&__object->__flag, 1, __order));
+}
+
+static __inline void atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) {
+	atomic_store_explicit(&__object->__flag, 0, __order);
+}
+
+static __inline bool atomic_flag_test_and_set(volatile atomic_flag *__object) {
+	return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst));
+}
+
+static __inline void atomic_flag_clear(volatile atomic_flag *__object) {
+	atomic_flag_clear_explicit(__object, memory_order_seq_cst);
+}
 
 #endif /* <atomic> unavailable */
 
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 6632c01..8bd690f 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -165,53 +165,9 @@
 char* tempnam(const char* __dir, const char* __prefix)
     __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
 
-/**
- * [rename(2)](http://man7.org/linux/man-pages/man2/rename.2.html) changes
- * the name or location of a file.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int rename(const char* __old_path, const char* __new_path);
-
-/**
- * [renameat(2)](http://man7.org/linux/man-pages/man2/renameat.2.html) changes
- * the name or location of a file, interpreting relative paths using an fd.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int renameat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path);
 
-#if defined(__USE_GNU)
-
-/**
- * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html)
- * to fail if the new path already exists.
- */
-#define RENAME_NOREPLACE (1<<0)
-
-/**
- * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html)
- * to atomically exchange the two paths.
- */
-#define RENAME_EXCHANGE (1<<1)
-
-/**
- * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html)
- * to create a union/overlay filesystem object.
- */
-#define RENAME_WHITEOUT (1<<2)
-
-/**
- * [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html) changes
- * the name or location of a file, interpreting relative paths using an fd,
- * with optional `RENAME_` flags.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
-int renameat2(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, unsigned __flags) __INTRODUCED_IN(30);
-
-#endif
-
 int fseek(FILE* __fp, long __offset, int __whence);
 long ftell(FILE* __fp);
 
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index b66e3c6..d5b8619 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -90,7 +90,7 @@
 long atol(const char* __s) __attribute_pure__;
 long long atoll(const char* __s) __attribute_pure__;
 
-__wur char* realpath(const char* __path, char* __resolved);
+char* realpath(const char* __path, char* __resolved);
 int system(const char* __command);
 
 void* bsearch(const void* __key, const void* __base, size_t __nmemb, size_t __size, int (*__comparator)(const void* __lhs, const void* __rhs));
diff --git a/libc/include/strings.h b/libc/include/strings.h
index d6ee1c8..ccdac04 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -51,17 +51,17 @@
 
 __BEGIN_DECLS
 
+#if defined(__BIONIC_FORTIFY)
 /** Deprecated. Use memmove() instead. */
-#define bcopy(b1, b2, len) __bionic_bcopy((b1), (b2), (len))
-static __inline__ __always_inline void __bionic_bcopy(const void* b1, void* b2, size_t len) {
-  __builtin_memmove(b2, b1, len);
-}
-
+#define bcopy(b1, b2, len) (void)(__builtin___memmove_chk((b2), (b1), (len), __bos0(b2)))
 /** Deprecated. Use memset() instead. */
-#define bzero(b, len) __bionic_bzero((b), (len))
-static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
-  __builtin_memset(b, 0, len);
-}
+#define bzero(b, len) (void)(__builtin___memset_chk((b), '\0', (len), __bos0(b)))
+#else
+/** Deprecated. Use memmove() instead. */
+#define bcopy(b1, b2, len) (void)(__builtin_memmove((b2), (b1), (len)))
+/** Deprecated. Use memset() instead. */
+#define bzero(b, len) (void)(__builtin_memset((b), '\0', (len)))
+#endif
 
 #if !defined(__i386__) || __ANDROID_API__ >= __ANDROID_API_J_MR2__
 /**
@@ -72,10 +72,6 @@
 int ffs(int __i) __INTRODUCED_IN_X86(18);
 #endif
 
-#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
-#include <bits/fortify/strings.h>
-#endif
-
 __END_DECLS
 
 #include <android/legacy_strings_inlines.h>
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 8078bda..a919a79 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -36,10 +36,6 @@
 
 #pragma once
 
-/**
- * `__BIONIC__` is always defined if you're building with bionic. See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
- */
 #define __BIONIC__ 1
 
 #if defined(__cplusplus)
@@ -90,7 +86,6 @@
 #define __noreturn __attribute__((__noreturn__))
 #define __mallocfunc  __attribute__((__malloc__))
 #define __packed __attribute__((__packed__))
-#define __returns_twice __attribute__((__returns_twice__))
 #define __unused __attribute__((__unused__))
 #define __used __attribute__((__used__))
 
@@ -293,24 +288,6 @@
 #define __pass_object_size __pass_object_size_n(__bos_level)
 #define __pass_object_size0 __pass_object_size_n(0)
 
-/* Intended for use in unevaluated contexts, e.g. diagnose_if conditions. */
-#define __bos_unevaluated_lt(bos_val, val) \
-  ((bos_val) != __BIONIC_FORTIFY_UNKNOWN_SIZE && (bos_val) < (val))
-
-#define __bos_unevaluated_le(bos_val, val) \
-  ((bos_val) != __BIONIC_FORTIFY_UNKNOWN_SIZE && (bos_val) <= (val))
-
-/* Intended for use in evaluated contexts. */
-#define __bos_dynamic_check_impl_and(bos_val, op, index, cond) \
-  (bos_val == __BIONIC_FORTIFY_UNKNOWN_SIZE ||                 \
-   (__builtin_constant_p(index) && bos_val op index && (cond)))
-
-#define __bos_dynamic_check_impl(bos_val, op, index) \
-  __bos_dynamic_check_impl_and(bos_val, op, index, 1)
-
-#define __bos_trivially_ge(bos_val, index) __bos_dynamic_check_impl((bos_val), >=, (index))
-#define __bos_trivially_gt(bos_val, index) __bos_dynamic_check_impl((bos_val), >, (index))
-
 #if defined(__BIONIC_FORTIFY) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS)
 #  define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
 #endif
@@ -359,6 +336,3 @@
 
 #include <android/versioning.h>
 #include <android/api-level.h>
-#if __has_include(<android/ndk-version.h>)
-#include <android/ndk-version.h>
-#endif
diff --git a/libc/include/sys/eventfd.h b/libc/include/sys/eventfd.h
index 1b6ad29..85f9877 100644
--- a/libc/include/sys/eventfd.h
+++ b/libc/include/sys/eventfd.h
@@ -38,8 +38,6 @@
 
 __BEGIN_DECLS
 
-/** The eventfd() flag to provide semaphore-like semantics for reads. */
-#define EFD_SEMAPHORE (1 << 0)
 /** The eventfd() flag for a close-on-exec file descriptor. */
 #define EFD_CLOEXEC O_CLOEXEC
 /** The eventfd() flag for a non-blocking file descriptor. */
diff --git a/libc/include/sys/ifunc.h b/libc/include/sys/ifunc.h
deleted file mode 100644
index 7fbca4a..0000000
--- a/libc/include/sys/ifunc.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-/**
- * @file sys/ifunc.h
- * @brief Declarations used for ifunc resolvers. Currently only meaningful for arm64.
- */
-
-__BEGIN_DECLS
-
-#if defined(__aarch64__)
-
-/**
- * Provides information about hardware capabilities to ifunc resolvers.
- *
- * Starting with API level 30, ifunc resolvers on arm64 are passed two arguments. The first is a
- * uint64_t whose value is equal to getauxval(AT_HWCAP) | _IFUNC_ARG_HWCAP. The second is a pointer
- * to a data structure of this type. Prior to API level 30, no arguments are passed to ifunc
- * resolvers. Code that wishes to be compatible with prior API levels should not accept any
- * arguments in the resolver.
- */
-typedef struct __ifunc_arg_t {
-  /** Set to sizeof(__ifunc_arg_t). */
-  unsigned long _size;
-
-  /** Set to getauxval(AT_HWCAP). */
-  unsigned long _hwcap;
-
-  /** Set to getauxval(AT_HWCAP2). */
-  unsigned long _hwcap2;
-} __ifunc_arg_t;
-
-/**
- * If this bit is set in the first argument to an ifunc resolver, indicates that the second argument
- * is a pointer to a data structure of type __ifunc_arg_t. This bit is always set on Android
- * starting with API level 30.
- */
-#define _IFUNC_ARG_HWCAP (1ULL << 62)
-
-#endif
-
-__END_DECLS
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 3b83229..4073fbf 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -26,27 +26,34 @@
  * SUCH DAMAGE.
  */
 
-#pragma once
+#ifndef _SYS_MMAN_H_
+#define _SYS_MMAN_H_
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
-#include <linux/memfd.h>
-#include <linux/mman.h>
+#include <asm/mman.h>
 
 __BEGIN_DECLS
 
-/** Alternative spelling of the `MAP_ANONYMOUS` flag for mmap(). */
-#define MAP_ANON MAP_ANONYMOUS
+#ifndef MAP_ANON
+#define MAP_ANON  MAP_ANONYMOUS
+#endif
 
-/** Return value for mmap(). */
 #define MAP_FAILED __BIONIC_CAST(reinterpret_cast, void*, -1)
 
-/**
- * [mmap(2)](http://man7.org/linux/man-pages/man2/mmap.2.html)
- * creates a memory mapping for the given range.
+#define MREMAP_MAYMOVE  1
+#define MREMAP_FIXED    2
+
+/*
+ * See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
  *
- * Returns the address of the mapping on success,
- * and returns `MAP_FAILED` and sets `errno` on failure.
+ * mmap64 wasn't really around until L, but we added an inline for it since it
+ * allows a lot more code to compile with _FILE_OFFSET_BITS=64.
+ *
+ * GCC removes the static inline unless it is explicitly used. We can get around
+ * this with __attribute__((used)), but that needlessly adds a definition of
+ * mmap64 to every translation unit that includes this header. Instead, just
+ * preserve the old behavior for GCC and emit a useful diagnostic.
  */
 #if defined(__USE_FILE_OFFSET64)
 void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset) __RENAME(mmap64);
@@ -55,126 +62,25 @@
 #endif
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-/**
- * mmap64() is a variant of mmap() that takes a 64-bit offset even on LP32.
- *
- * See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
- *
- * mmap64 wasn't really around until L, but we added an inline for it since it
- * allows a lot more code to compile with _FILE_OFFSET_BITS=64.
- */
 void* mmap64(void* __addr, size_t __size, int __prot, int __flags, int __fd, off64_t __offset) __INTRODUCED_IN(21);
 #endif
 
-/**
- * [munmap(2)](http://man7.org/linux/man-pages/man2/munmap.2.html)
- * deletes a memory mapping for the given range.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int munmap(void* __addr, size_t __size);
-
-/**
- * [msync(2)](http://man7.org/linux/man-pages/man2/msync.2.html)
- * flushes changes to a memory-mapped file to disk.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int msync(void* __addr, size_t __size, int __flags);
-
-/**
- * [mprotect(2)](http://man7.org/linux/man-pages/man2/mprotect.2.html)
- * sets the protection on a memory region.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int mprotect(void* __addr, size_t __size, int __prot);
-
-/** Flag for mremap(). */
-#define MREMAP_MAYMOVE  1
-
-/** Flag for mremap(). */
-#define MREMAP_FIXED    2
-
-/**
- * [mremap(2)](http://man7.org/linux/man-pages/man2/mremap.2.html)
- * expands or shrinks an existing memory mapping.
- *
- * Returns the address of the mapping on success,
- * and returns `MAP_FAILED` and sets `errno` on failure.
- */
 void* mremap(void* __old_addr, size_t __old_size, size_t __new_size, int __flags, ...);
 
-/**
- * [mlockall(2)](http://man7.org/linux/man-pages/man2/mlockall.2.html)
- * locks pages (preventing swapping).
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int mlockall(int __flags) __INTRODUCED_IN(17);
-
-/**
- * [munlockall(2)](http://man7.org/linux/man-pages/man2/munlockall.2.html)
- * unlocks pages (allowing swapping).
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int munlockall(void) __INTRODUCED_IN(17);
 
-/**
- * [mlock(2)](http://man7.org/linux/man-pages/man2/mlock.2.html)
- * locks pages (preventing swapping).
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int mlock(const void* __addr, size_t __size);
-
-/**
- * [mlock2(2)](http://man7.org/linux/man-pages/man2/mlock.2.html)
- * locks pages (preventing swapping), with optional flags.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
-int mlock2(const void* __addr, size_t __size, int __flags) __INTRODUCED_IN(30);
-
-/**
- * [munlock(2)](http://man7.org/linux/man-pages/man2/munlock.2.html)
- * unlocks pages (allowing swapping).
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int munlock(const void* __addr, size_t __size);
 
-/**
- * [mincore(2)](http://man7.org/linux/man-pages/man2/mincore.2.html)
- * tests whether pages are resident in memory.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int mincore(void* __addr, size_t __size, unsigned char* __vector);
 
-/**
- * [madvise(2)](http://man7.org/linux/man-pages/man2/madvise.2.html)
- * gives the kernel advice about future usage patterns.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int madvise(void* __addr, size_t __size, int __advice);
 
-#if defined(__USE_GNU)
-
-/**
- * [memfd_create(2)](http://man7.org/linux/man-pages/man2/memfd_create.2.html)
- * creates an anonymous file.
- *
- * Returns an fd on success, and returns -1 and sets `errno` on failure.
- */
-int memfd_create(const char* __name, unsigned __flags) __INTRODUCED_IN(30);
-
-#endif
-
 #if __ANDROID_API__ >= __ANDROID_API_M__
-
 /*
  * Some third-party code uses the existence of POSIX_MADV_NORMAL to detect the
  * availability of posix_madvise. This is not correct, since having up-to-date
@@ -183,30 +89,16 @@
  *
  * https://github.com/android-ndk/ndk/issues/395
  */
-
-/** Flag for posix_madvise(). */
 #define POSIX_MADV_NORMAL     MADV_NORMAL
-/** Flag for posix_madvise(). */
 #define POSIX_MADV_RANDOM     MADV_RANDOM
-/** Flag for posix_madvise(). */
 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
-/** Flag for posix_madvise(). */
 #define POSIX_MADV_WILLNEED   MADV_WILLNEED
-/** Flag for posix_madvise(). */
 #define POSIX_MADV_DONTNEED   MADV_DONTNEED
-
 #endif
-
-/**
- * [posix_madvise(3)](http://man7.org/linux/man-pages/man3/posix_madvise.3.html)
- * gives the kernel advice about future usage patterns.
- *
- * Returns 0 on success, and returns a positive error number on failure.
- *
- * See also madvise() which has been available much longer.
- */
 int posix_madvise(void* __addr, size_t __size, int __advice) __INTRODUCED_IN(23);
 
 __END_DECLS
 
 #include <android/legacy_sys_mman_inlines.h>
+
+#endif
diff --git a/libc/include/sys/personality.h b/libc/include/sys/personality.h
index 9eb992f..cea0bf8 100644
--- a/libc/include/sys/personality.h
+++ b/libc/include/sys/personality.h
@@ -43,7 +43,9 @@
  * process' personality.
  *
  * Returns the previous persona on success, and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 15.
  */
-int personality(unsigned int __persona);
+int personality(unsigned int __persona) __INTRODUCED_IN(15);
 
 __END_DECLS
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 1ee8d2a..9be444c 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -26,12 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#pragma once
-
-/**
- * @file sys/select.h
- * @brief Wait for events on a set of file descriptors (but use <poll.h> instead).
- */
+#ifndef _SYS_SELECT_H_
+#define _SYS_SELECT_H_
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
@@ -43,17 +39,9 @@
 
 typedef unsigned long fd_mask;
 
-/**
- * The limit on the largest fd that can be used with this API.
- * Use <poll.h> instead.
- */
 #define FD_SETSIZE 1024
 #define NFDBITS (8 * sizeof(fd_mask))
 
-/**
- * The type of a file descriptor set. Limited to 1024 fds.
- * Use <poll.h> instead.
- */
 typedef struct {
   fd_mask fds_bits[FD_SETSIZE/NFDBITS];
 } fd_set;
@@ -79,53 +67,21 @@
 #define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
 #define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
 
+
 #if __ANDROID_API__ >= __ANDROID_API_L__
-
-/** Removes `fd` from the given set. Use <poll.h> instead. */
 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
-/** Adds `fd` to the given set. Use <poll.h> instead. */
 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
-/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
-
 #else
-
-/** Removes `fd` from the given set. Use <poll.h> instead. */
 #define FD_CLR(fd, set) __FD_CLR(fd, set)
-/** Adds `fd` to the given set. Use <poll.h> instead. */
 #define FD_SET(fd, set) __FD_SET(fd, set)
-/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
 #define FD_ISSET(fd, set) __FD_ISSET(fd, set)
-
 #endif /* __ANDROID_API >= 21 */
 
-/**
- * [select(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
- * set of file descriptors. Use poll() instead.
- *
- * Returns the number of ready file descriptors on success, 0 for timeout,
- * and returns -1 and sets `errno` on failure.
- */
 int select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout);
-
-/**
- * [pselect(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
- * set of file descriptors. Use ppoll() instead.
- *
- * Returns the number of ready file descriptors on success, 0 for timeout,
- * and returns -1 and sets `errno` on failure.
- */
 int pselect(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset_t* __mask);
-
-/**
- * [pselect64(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
- * set of file descriptors. Use ppoll64() instead.
- *
- * Returns the number of ready file descriptors on success, 0 for timeout,
- * and returns -1 and sets `errno` on failure.
- *
- * Available since API level 28.
- */
 int pselect64(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset64_t* __mask) __INTRODUCED_IN(28);
 
 __END_DECLS
+
+#endif
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 79113b6..84a5015 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -185,7 +185,8 @@
 
 #define UTIME_NOW  ((1L << 30) - 1L)
 #define UTIME_OMIT ((1L << 30) - 2L)
-int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags);
+int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags)
+  __INTRODUCED_IN(12);
 int futimens(int __dir_fd, const struct timespec __times[2]) __INTRODUCED_IN(19);
 
 __END_DECLS
diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h
index 93fa3d7..e60cadc 100644
--- a/libc/include/sys/statvfs.h
+++ b/libc/include/sys/statvfs.h
@@ -14,12 +14,8 @@
  * limitations under the License.
  */
 
-#pragma once
-
-/**
- * @file sys/statvfs.h
- * @brief Filesystem statistics.
- */
+#ifndef _SYS_STATVFS_H_
+#define _SYS_STATVFS_H_
 
 #include <stdint.h>
 #include <sys/cdefs.h>
@@ -27,123 +23,47 @@
 
 __BEGIN_DECLS
 
-struct statvfs {
-  /** Block size. */
-  unsigned long f_bsize;
-  /** Fragment size. */
-  unsigned long f_frsize;
-  /** Total size of filesystem in `f_frsize` blocks. */
-  fsblkcnt_t f_blocks;
-  /** Number of free blocks. */
-  fsblkcnt_t f_bfree;
-  /** Number of free blocks for non-root. */
-  fsblkcnt_t f_bavail;
-  /** Number of inodes. */
-  fsfilcnt_t f_files;
-  /** Number of free inodes. */
-  fsfilcnt_t f_ffree;
-  /** Number of free inodes for non-root. */
-  fsfilcnt_t f_favail;
-  /** Filesystem id. */
-  unsigned long f_fsid;
-  /** Mount flags. (See `ST_` constants.) */
-  unsigned long f_flag;
-  /** Maximum filename length. */
-  unsigned long f_namemax;
-
-#if defined(__LP64__)
-  uint32_t __f_reserved[6];
+#ifdef __LP64__
+#define __STATVFS64_RESERVED uint32_t __f_reserved[6];
+#else
+#define __STATVFS64_RESERVED
 #endif
-};
 
-struct statvfs64 {
-  /** Block size. */
-  unsigned long f_bsize;
-  /** Fragment size. */
-  unsigned long f_frsize;
-  /** Total size of filesystem in `f_frsize` blocks. */
-  fsblkcnt_t f_blocks;
-  /** Number of free blocks. */
-  fsblkcnt_t f_bfree;
-  /** Number of free blocks for non-root. */
-  fsblkcnt_t f_bavail;
-  /** Number of inodes. */
-  fsfilcnt_t f_files;
-  /** Number of free inodes. */
-  fsfilcnt_t f_ffree;
-  /** Number of free inodes for non-root. */
-  fsfilcnt_t f_favail;
-  /** Filesystem id. */
-  unsigned long f_fsid;
-  /** Mount flags. (See `ST_` constants.) */
-  unsigned long f_flag;
-  /** Maximum filename length. */
-  unsigned long f_namemax;
+#define __STATVFS64_BODY \
+  unsigned long f_bsize; \
+  unsigned long f_frsize; \
+  fsblkcnt_t    f_blocks; \
+  fsblkcnt_t    f_bfree; \
+  fsblkcnt_t    f_bavail; \
+  fsfilcnt_t    f_files; \
+  fsfilcnt_t    f_ffree; \
+  fsfilcnt_t    f_favail; \
+  unsigned long f_fsid; \
+  unsigned long f_flag; \
+  unsigned long f_namemax; \
+  __STATVFS64_RESERVED
 
-#if defined(__LP64__)
-  uint32_t __f_reserved[6];
-#endif
-};
+struct statvfs { __STATVFS64_BODY };
+struct statvfs64 { __STATVFS64_BODY };
 
-/** Flag for `f_flag` in `struct statvfs`: mounted read-only. */
+#undef __STATVFS64_BODY
+#undef __STATVFS64_RESERVED
+
 #define ST_RDONLY      0x0001
-
-/** Flag for `f_flag` in `struct statvfs`: setuid/setgid ignored. */
 #define ST_NOSUID      0x0002
-
-/** Flag for `f_flag` in `struct statvfs`: access to device files disallowed. */
 #define ST_NODEV       0x0004
-
-/** Flag for `f_flag` in `struct statvfs`: execution disallowed. */
 #define ST_NOEXEC      0x0008
-
-/** Flag for `f_flag` in `struct statvfs`: writes synced immediately. */
 #define ST_SYNCHRONOUS 0x0010
-
-/** Flag for `f_flag` in `struct statvfs`: mandatory locking permitted. */
 #define ST_MANDLOCK    0x0040
-
-/** Flag for `f_flag` in `struct statvfs`: access times not updated. */
 #define ST_NOATIME     0x0400
-
-/** Flag for `f_flag` in `struct statvfs`: directory access times not updated. */
 #define ST_NODIRATIME  0x0800
-
-/** Flag for `f_flag` in `struct statvfs`: see `MS_RELATIME`. */
 #define ST_RELATIME    0x1000
 
-#if __ANDROID_API__ >= 19
-// These functions are implemented as static inlines before API level 19.
-
-/**
- * [statvfs(3)](http://man7.org/linux/man-pages/man3/statvfs.3.html)
- * queries filesystem statistics for the given path.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
 int statvfs(const char* __path, struct statvfs* __buf) __INTRODUCED_IN(19);
-
-/**
- * [fstatvfs(3)](http://man7.org/linux/man-pages/man3/fstatvfs.3.html)
- * queries filesystem statistics for the given file descriptor.
- *
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
- */
-int fstatvfs(int __fd, struct statvfs* __buf) __INTRODUCED_IN(19);
-
-#endif
-
-#if __ANDROID_API__ >= 21
-// These functions are implemented as static inlines before API level 21.
-
-/** Equivalent to statvfs(). */
 int statvfs64(const char* __path, struct statvfs64* __buf) __INTRODUCED_IN(21);
-
-/** Equivalent to fstatvfs(). */
+int fstatvfs(int __fd, struct statvfs* __buf) __INTRODUCED_IN(19);
 int fstatvfs64(int __fd, struct statvfs64* __buf) __INTRODUCED_IN(21);
 
-#endif
-
 __END_DECLS
 
-#include <android/legacy_sys_statvfs_inlines.h>
+#endif
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index a2e1923..f469599 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -43,7 +43,7 @@
 /*
  * Sets system property `name` to `value`, creating the system property if it doesn't already exist.
  */
-int __system_property_set(const char* __name, const char* __value);
+int __system_property_set(const char* __name, const char* __value) __INTRODUCED_IN(12);
 
 /*
  * Returns a `prop_info` corresponding system property `name`, or nullptr if it doesn't exist.
diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
index dc58026..d15b3fc 100644
--- a/libc/include/sys/xattr.h
+++ b/libc/include/sys/xattr.h
@@ -26,12 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#pragma once
-
-/**
- * @file sys/xattr.h
- * @brief Extended attribute functions.
- */
+#ifndef _SYS_XATTR_H_
+#define _SYS_XATTR_H_
 
 #include <linux/xattr.h>
 #include <sys/cdefs.h>
@@ -39,120 +35,25 @@
 
 __BEGIN_DECLS
 
-/**
- * [fsetxattr(2)](http://man7.org/linux/man-pages/man2/fsetxattr.2.html)
- * sets an extended attribute on the file referred to by the given file
- * descriptor.
- *
- * Valid flags are `XATTR_CREATE` and `XATTR_REPLACE`.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int fsetxattr(int __fd, const char* __name, const void* __value, size_t __size, int __flags);
+int fsetxattr(int __fd, const char* __name, const void* __value, size_t __size, int __flags)
+  __INTRODUCED_IN(16);
+int setxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags)
+  __INTRODUCED_IN(16);
+int lsetxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags)
+  __INTRODUCED_IN(16);
 
-/**
- * [setxattr(2)](http://man7.org/linux/man-pages/man2/setxattr.2.html)
- * sets an extended attribute on the file referred to by the given path.
- *
- * Valid flags are `XATTR_CREATE` and `XATTR_REPLACE`.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int setxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags);
+ssize_t fgetxattr(int __fd, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
+ssize_t getxattr(const char* __path, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
+ssize_t lgetxattr(const char* __path, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
 
-/**
- * [lsetxattr(2)](http://man7.org/linux/man-pages/man2/lsetxattr.2.html)
- * sets an extended attribute on the file referred to by the given path, which
- * is the link itself rather than its target in the case of a symbolic link.
- *
- * Valid flags are `XATTR_CREATE` and `XATTR_REPLACE`.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int lsetxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags);
+ssize_t listxattr(const char* __path, char* __list, size_t __size) __INTRODUCED_IN(16);
+ssize_t llistxattr(const char* __path, char* __list, size_t __size) __INTRODUCED_IN(16);
+ssize_t flistxattr(int __fd, char* __list, size_t __size) __INTRODUCED_IN(16);
 
-/**
- * [fgetxattr(2)](http://man7.org/linux/man-pages/man2/fgetxattr.2.html)
- * gets an extended attribute on the file referred to by the given file
- * descriptor.
- *
- * Returns the non-negative length of the value on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t fgetxattr(int __fd, const char* __name, void* __value, size_t __size);
-
-/**
- * [getxattr(2)](http://man7.org/linux/man-pages/man2/getxattr.2.html)
- * gets an extended attribute on the file referred to by the given path.
- *
- * Returns the non-negative length of the value on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t getxattr(const char* __path, const char* __name, void* __value, size_t __size);
-
-/**
- * [lgetxattr(2)](http://man7.org/linux/man-pages/man2/lgetxattr.2.html)
- * gets an extended attribute on the file referred to by the given path, which
- * is the link itself rather than its target in the case of a symbolic link.
- *
- * Returns the non-negative length of the value on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t lgetxattr(const char* __path, const char* __name, void* __value, size_t __size);
-
-/**
- * [flistxattr(2)](http://man7.org/linux/man-pages/man2/flistxattr.2.html)
- * lists the extended attributes on the file referred to by the given file
- * descriptor.
- *
- * Returns the non-negative length of the list on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t flistxattr(int __fd, char* __list, size_t __size);
-
-/**
- * [listxattr(2)](http://man7.org/linux/man-pages/man2/listxattr.2.html)
- * lists the extended attributes on the file referred to by the given path.
- *
- * Returns the non-negative length of the list on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t listxattr(const char* __path, char* __list, size_t __size);
-
-/**
- * [llistxattr(2)](http://man7.org/linux/man-pages/man2/llistxattr.2.html)
- * lists the extended attributes on the file referred to by the given path, which
- * is the link itself rather than its target in the case of a symbolic link.
- *
- * Returns the non-negative length of the list on success, or
- * returns -1 and sets `errno` on failure.
- */
-ssize_t llistxattr(const char* __path, char* __list, size_t __size);
-
-/**
- * [fremovexattr(2)](http://man7.org/linux/man-pages/man2/fremovexattr.2.html)
- * removes an extended attribute on the file referred to by the given file
- * descriptor.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int fremovexattr(int __fd, const char* __name);
-
-/**
- * [lremovexattr(2)](http://man7.org/linux/man-pages/man2/lremovexattr.2.html)
- * removes an extended attribute on the file referred to by the given path, which
- * is the link itself rather than its target in the case of a symbolic link.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int lremovexattr(const char* __path, const char* __name);
-
-/**
- * [removexattr(2)](http://man7.org/linux/man-pages/man2/removexattr.2.html)
- * removes an extended attribute on the file referred to by the given path.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
-int removexattr(const char* __path, const char* __name);
+int removexattr(const char* __path, const char* __name) __INTRODUCED_IN(16);
+int lremovexattr(const char* __path, const char* __name) __INTRODUCED_IN(16);
+int fremovexattr(int __fd, const char* __name) __INTRODUCED_IN(16);
 
 __END_DECLS
+
+#endif
diff --git a/libc/include/threads.h b/libc/include/threads.h
deleted file mode 100644
index 752761d..0000000
--- a/libc/include/threads.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-/**
- * @file threads.h
- * @brief C11 threads.
- */
-
-#include <sys/cdefs.h>
-
-#include <pthread.h>
-#include <time.h>
-
-#define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
-#define TSS_DTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS
-
-/** The type for a condition variable. */
-typedef pthread_cond_t cnd_t;
-/** The type for a thread. */
-typedef pthread_t thrd_t;
-/** The type for a thread-specific storage key. */
-typedef pthread_key_t tss_t;
-/** The type for a mutex. */
-typedef pthread_mutex_t mtx_t;
-
-/** The type for a thread-specific storage destructor. */
-typedef void (*tss_dtor_t)(void*);
-/** The type of the function passed to thrd_create() to create a new thread. */
-typedef int (*thrd_start_t)(void*);
-
-/** The type used by call_once(). */
-typedef pthread_once_t once_flag;
-
-enum {
-  mtx_plain = 0x1,
-  mtx_recursive = 0x2,
-  mtx_timed = 0x4,
-};
-
-enum {
-  thrd_success = 0,
-  thrd_busy = 1,
-  thrd_error = 2,
-  thrd_nomem = 3,
-  thrd_timedout = 4,
-};
-
-#if !defined(__cplusplus)
-#define thread_local _Thread_local
-#endif
-
-__BEGIN_DECLS
-
-#if __ANDROID_API__ >= __ANDROID_API_R__
-// This file is implemented as static inlines before API level 30.
-
-/** Uses `__flag` to ensure that `__function` is called exactly once. */
-void call_once(once_flag* __flag, void (*__function)(void)) __INTRODUCED_IN(30);
-
-
-
-/**
- * Unblocks all threads blocked on `__cond`.
- */
-int cnd_broadcast(cnd_t* __cond) __INTRODUCED_IN(30);
-
-/**
- * Destroys a condition variable.
- */
-void cnd_destroy(cnd_t* __cond) __INTRODUCED_IN(30);
-
-/**
- * Creates a condition variable.
- */
-int cnd_init(cnd_t* __cond) __INTRODUCED_IN(30);
-
-/**
- * Unblocks one thread blocked on `__cond`.
- */
-int cnd_signal(cnd_t* __cond) __INTRODUCED_IN(30);
-
-/**
- * Unlocks `__mutex` and blocks until `__cond` is signaled or `__timeout` occurs.
- */
-int cnd_timedwait(cnd_t* __cond, mtx_t* __mutex, const struct timespec* __timeout)
-    __INTRODUCED_IN(30);
-
-/**
- * Unlocks `__mutex` and blocks until `__cond` is signaled.
- */
-int cnd_wait(cnd_t* __cond, mtx_t* __mutex) __INTRODUCED_IN(30);
-
-
-
-/**
- * Destroys a mutex.
- */
-void mtx_destroy(mtx_t* __mutex) __INTRODUCED_IN(30);
-
-/**
- * Creates a mutex.
- */
-int mtx_init(mtx_t* __mutex, int __type) __INTRODUCED_IN(30);
-
-/**
- * Blocks until `__mutex` is acquired.
- */
-int mtx_lock(mtx_t* __mutex) __INTRODUCED_IN(30);
-
-/**
- * Blocks until `__mutex` is acquired or `__timeout` expires.
- */
-int mtx_timedlock(mtx_t* __mutex, const struct timespec* __timeout) __INTRODUCED_IN(30);
-
-/**
- * Acquires `__mutex` or returns `thrd_busy`.
- */
-int mtx_trylock(mtx_t* __mutex) __INTRODUCED_IN(30);
-
-/**
- * Unlocks `__mutex`.
- */
-int mtx_unlock(mtx_t* __mutex) __INTRODUCED_IN(30);
-
-
-
-/**
- * Creates a new thread running `__function(__arg)`, and sets `*__thrd` to
- * the new thread.
- */
-int thrd_create(thrd_t* __thrd, thrd_start_t __function, void* __arg) __INTRODUCED_IN(30);
-
-/**
- * Returns the `thrd_t` corresponding to the caller.
- */
-thrd_t thrd_current(void) __INTRODUCED_IN(30);
-
-/**
- * Tells the OS to automatically dispose of `__thrd` when it exits.
- */
-int thrd_detach(thrd_t __thrd) __INTRODUCED_IN(30);
-
-/**
- * Tests whether two threads are the same thread.
- */
-int thrd_equal(thrd_t __lhs, thrd_t __rhs) __INTRODUCED_IN(30);
-
-/**
- * Terminates the calling thread, setting its result to `__result`.
- */
-void thrd_exit(int __result) __noreturn __INTRODUCED_IN(30);
-
-/**
- * Blocks until `__thrd` terminates. If `__result` is not null, `*__result`
- * is set to the exiting thread's result.
- */
-int thrd_join(thrd_t __thrd, int* __result) __INTRODUCED_IN(30);
-
-/**
- * Blocks the caller for at least `__duration` unless a signal is delivered.
- * If a signal causes the sleep to end early and `__remaining` is not null,
- * `*__remaining` is set to the time remaining.
- *
- * Returns 0 on success, or -1 if a signal was delivered.
- */
-int thrd_sleep(const struct timespec* __duration, struct timespec* __remaining) __INTRODUCED_IN(30);
-
-/**
- * Request that other threads should be scheduled.
- */
-void thrd_yield(void) __INTRODUCED_IN(30);
-
-
-
-/**
- * Creates a thread-specific storage key with the associated destructor (which
- * may be null).
- */
-int tss_create(tss_t* __key, tss_dtor_t __dtor) __INTRODUCED_IN(30);
-
-/**
- * Destroys a thread-specific storage key.
- */
-void tss_delete(tss_t __key) __INTRODUCED_IN(30);
-
-/**
- * Returns the value for the current thread held in the thread-specific storage
- * identified by `__key`.
- */
-void* tss_get(tss_t __key) __INTRODUCED_IN(30);
-
-/**
- * Sets the current thread's value for the thread-specific storage identified
- * by `__key` to `__value`.
- */
-int tss_set(tss_t __key, void* __value) __INTRODUCED_IN(30);
-
-#endif
-
-__END_DECLS
-
-#include <android/legacy_threads_inlines.h>
diff --git a/libc/include/time.h b/libc/include/time.h
index a7a6fe5..48c5efc 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -105,8 +105,8 @@
 int timer_getoverrun(timer_t __timer);
 
 /* Non-standard extensions that are in the BSDs and glibc. */
-time_t timelocal(struct tm* __tm);
-time_t timegm(struct tm* __tm);
+time_t timelocal(struct tm* __tm) __INTRODUCED_IN(12);
+time_t timegm(struct tm* __tm) __INTRODUCED_IN(12);
 
 #define TIME_UTC 1
 int timespec_get(struct timespec* __ts, int __base) __INTRODUCED_IN(29);
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 7c01549..90173aa 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -78,7 +78,7 @@
 __noreturn void _exit(int __status);
 
 pid_t  fork(void);
-pid_t  vfork(void) __returns_twice;
+pid_t  vfork(void);
 pid_t  getpid(void);
 pid_t  gettid(void) __attribute_const__;
 pid_t  getpgid(pid_t __pid);
@@ -204,7 +204,7 @@
 long pathconf(const char* __path, int __name);
 
 int access(const char* __path, int __mode);
-int faccessat(int __dirfd, const char* __path, int __mode, int __flags);
+int faccessat(int __dirfd, const char* __path, int __mode, int __flags) __INTRODUCED_IN(16);
 int link(const char* __old_path, const char* __new_path);
 int linkat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, int __flags) __INTRODUCED_IN(21);
 int unlink(const char* __path);
@@ -214,7 +214,7 @@
 int rmdir(const char* __path);
 int pipe(int __fds[2]);
 #if defined(__USE_GNU)
-int pipe2(int __fds[2], int __flags);
+int pipe2(int __fds[2], int __flags) __INTRODUCED_IN(9);
 #endif
 int chroot(const char* __path);
 int symlink(const char* __old_path, const char* __new_path);
@@ -242,15 +242,17 @@
 int dup2(int __old_fd, int __new_fd);
 int dup3(int __old_fd, int __new_fd, int __flags) __INTRODUCED_IN(21);
 int fsync(int __fd);
-int fdatasync(int __fd);
+int fdatasync(int __fd) __INTRODUCED_IN(9);
 
 /* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
 #if defined(__USE_FILE_OFFSET64)
 int truncate(const char* __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
 off_t lseek(int __fd, off_t __offset, int __whence) __RENAME(lseek64);
-ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset) __RENAME(pread64);
-ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset) __RENAME(pwrite64);
-int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64);
+ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset)
+  __RENAME(pread64) __INTRODUCED_IN(12);
+ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset)
+  __RENAME(pwrite64) __INTRODUCED_IN(12);
+int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64) __INTRODUCED_IN(12);
 #else
 int truncate(const char* __path, off_t __length);
 off_t lseek(int __fd, off_t __offset, int __whence);
@@ -261,9 +263,9 @@
 
 int truncate64(const char* __path, off64_t __length) __INTRODUCED_IN(21);
 off64_t lseek64(int __fd, off64_t __offset, int __whence);
-ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset);
-ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset);
-int ftruncate64(int __fd, off64_t __length);
+ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
+ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
+int ftruncate64(int __fd, off64_t __length) __INTRODUCED_IN(12);
 
 int pause(void);
 unsigned int alarm(unsigned int __seconds);
@@ -278,7 +280,7 @@
 
 int isatty(int __fd);
 char* ttyname(int __fd);
-int ttyname_r(int __fd, char* __buf, size_t __buf_size);
+int ttyname_r(int __fd, char* __buf, size_t __buf_size) __INTRODUCED_IN(8);
 
 int acct(const char* __path);
 
diff --git a/libc/kernel/README.TXT b/libc/kernel/README.TXT
new file mode 100644
index 0000000..313dc0d
--- /dev/null
+++ b/libc/kernel/README.TXT
@@ -0,0 +1,87 @@
+Bionic Kernel Header Files
+==========================
+
+Bionic comes with a processed set of all of the uapi Linux kernel headers that
+can safely be included by userland applications and libraries.
+
+These clean headers are automatically generated by several scripts located
+in the 'bionic/kernel/tools' directory. The tools process the original
+unmodified kernel headers in order to get rid of many annoying
+declarations and constructs that usually result in compilation failure.
+
+The 'clean headers' only contain type and macro definitions, with the
+exception of a couple static inline functions used for performance
+reason (e.g. optimized CPU-specific byte-swapping routines).
+
+They can be included from C++, or when compiling code in strict ANSI mode.
+They can be also included before or after any Bionic C library header.
+
+Description of the directories involved in generating the parsed kernel headers:
+
+  * 'external/kernel-headers/original/'
+    Contains the uapi kernel headers found in the android kernel. Note this
+    also includes the header files that are generated by building the kernel
+    sources.
+
+  * 'bionic/libc/kernel/uapi'
+    Contains the cleaned kernel headers and mirrors the directory structure
+    in 'external/kernel-headers/original/uapi/'.
+
+  * 'bionic/libc/kernel/tools'
+    Contains various Python and shell scripts used to get and re-generate
+    the headers.
+
+The tools to get/parse the headers:
+
+  * tools/generate_uapi_headers.sh
+    Checks out the android kernel and generates all uapi header files.
+    copies all the changed files into external/kernel-headers.
+
+  * tools/clean_header.py
+    Prints the clean version of a given kernel header. With the -u option,
+    this will also update the corresponding clean header file if its
+    content has changed. You can also process more than one file with -u.
+
+  * tools/update_all.py
+    Automatically update all clean headers from the content of
+    'external/kernel-headers/original'.
+
+How To Update The Headers
+=========================
+
+IMPORTANT IMPORTANT:
+
+WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
+NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
+OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT.
+
+Download the Linux kernel source code:
+
+  > mkdir kernel_src
+  > cd kernel_src
+  kernel_src> git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
+
+Then checkout the stable tag for the new kernel headers to import:
+
+  kernel_src> cd linux-stable
+  kernel_src/linux-stable> git checkout tags/vXXX
+
+Before running the command to import the headers, make sure that you have
+done a lunch TARGET. The script uses a variable set by the lunch command
+to determine which directory to use as the destination directory.
+
+After running lunch, run this command to import the headers into the android
+source tree:
+
+  bionic/libc/kernel/tools/generate_uapi_headers.sh --use-kernel-dir kernel_src
+
+Next, run this command to copy the parsed files to bionic/libc/kernel/uapi:
+
+  bionic/libc/kernel/tools/update_all.py
+
+Finally, run this command to regenerate the syscalls list:
+
+  bionic/libc/tools/gensyscalls.py
+
+After this, you will need to build/test the tree to make sure that these
+changes do not introduce any errors.
diff --git a/libc/kernel/README.md b/libc/kernel/README.md
deleted file mode 100644
index 9036b9f..0000000
--- a/libc/kernel/README.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# Bionic Kernel Header Files
-
-Bionic comes with a processed set of all of the uapi Linux kernel headers that
-can safely be included by userland applications and libraries.
-
-These clean headers are automatically generated by several scripts located
-in the `tools/` directory. The tools process the original
-unmodified kernel headers in order to get rid of many annoying
-declarations and constructs that usually result in compilation failure.
-
-The 'clean headers' only contain type and macro definitions, with the
-exception of a couple static inline functions used for performance
-reason (e.g. optimized CPU-specific byte-swapping routines).
-
-They can be included from C++, or when compiling code in strict ANSI mode.
-They can be also included before or after any Bionic C library header.
-
-Description of the directories involved in generating the parsed kernel headers:
-
-  * `external/kernel-headers/original/`
-    Contains the uapi kernel headers found in the android kernel. Note this
-    also includes the header files that are generated by building the kernel
-    sources.
-
-  * `bionic/libc/kernel/uapi/`
-    Contains the cleaned kernel headers and mirrors the directory structure
-    in `external/kernel-headers/original/uapi/`.
-
-  * `bionic/libc/kernel/tools/`
-    Contains various Python and shell scripts used to get and re-generate
-    the headers.
-
-The tools to get/parse the headers:
-
-  * `tools/generate_uapi_headers.sh`
-    Checks out the android kernel and generates all uapi header files.
-    copies all the changed files into external/kernel-headers.
-
-  * `tools/clean_header.py`
-    Prints the clean version of a given kernel header. With the -u option,
-    this will also update the corresponding clean header file if its
-    content has changed. You can also process more than one file with -u.
-
-  * `tools/update_all.py`
-    Automatically update all clean headers from the content of
-    `external/kernel-headers/original/`.
-
-## How To Update The Headers
-
-IMPORTANT IMPORTANT:
-
-WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
-NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
-OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT.
-
-Download the Linux kernel source code:
-```
-  > mkdir kernel_src
-  > cd kernel_src
-  kernel_src> git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
-```
-
-Then checkout the stable tag for the new kernel headers to import:
-```
-  kernel_src> cd linux-stable
-  kernel_src/linux-stable> git checkout tags/vXXX
-```
-
-Before running the command to import the headers, make sure that you have
-done a lunch TARGET. The script uses a variable set by the lunch command
-to determine which directory to use as the destination directory.
-
-After running lunch, run this command to import the headers into the android
-source tree:
-```
-  bionic/libc/kernel/tools/generate_uapi_headers.sh --use-kernel-dir kernel_src
-```
-
-Next, run this command to copy the parsed files to bionic/libc/kernel/uapi:
-```
-  bionic/libc/kernel/tools/update_all.py
-```
-
-After this, you will need to build/test the tree to make sure that these
-changes do not introduce any errors.
diff --git a/libc/kernel/android/README.TXT b/libc/kernel/android/README.TXT
new file mode 100644
index 0000000..bc2efde
--- /dev/null
+++ b/libc/kernel/android/README.TXT
@@ -0,0 +1,17 @@
+The files under the uapi directory are android kernel uapi header files that
+exist in android kernels, but have not been upstreamed into the regular
+kernel.
+
+None of these files will get updated automatically, and are frozen at their
+current value.
+
+The files under the scsi directory are frozen copies of kernel scsi headers.
+Linux's scsi headers are a mix of userspace-facing and kernel-facing
+declarations that can't be directly used by userspace. The glibc
+maintainers manually copy-and-pasted these definitions into their own
+scsi headers and haven't substantially updated them in 15 years. The
+musl libc project has a similar set of definitions in its scsi headers.
+
+These files are actually maintained in external/kernel-headers/modified/scsi.
+Any modification should first be made there then copied into the scsi
+directory.
diff --git a/libc/kernel/android/README.md b/libc/kernel/android/README.md
deleted file mode 100644
index 88062c0..0000000
--- a/libc/kernel/android/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-The files under the uapi directory are android kernel uapi header files that
-exist in android kernels, but have not been upstreamed into the regular
-kernel.
-
-None of these files are updated automatically, and are frozen at their
-current value.
-
-The files under the scsi directory are frozen copies of kernel scsi headers.
-Linux's scsi headers are a mix of userspace-facing and kernel-facing
-declarations that can't be directly used by userspace. The glibc
-maintainers manually copy-and-pasted these definitions into their own
-scsi headers and haven't substantially updated them in 15 years. The
-musl libc project has a similar set of definitions in its scsi headers.
-
-These files are actually maintained in `external/kernel-headers/modified/scsi/`.
-Any modification should first be made there then copied into the scsi
-directory.
diff --git a/libc/kernel/tools/update_all.py b/libc/kernel/tools/update_all.py
index cef24dd..0f30ecd 100755
--- a/libc/kernel/tools/update_all.py
+++ b/libc/kernel/tools/update_all.py
@@ -4,7 +4,7 @@
 from defaults import *
 from utils import *
 
-def Usage():
+def usage():
     print """\
   usage: %(progname)s [kernel-original-path] [kernel-modified-path]
 
@@ -24,7 +24,7 @@
 """ % { "progname" : os.path.basename(sys.argv[0]) }
     sys.exit(0)
 
-def ProcessFiles(updater, original_dir, modified_dir, src_rel_dir, update_rel_dir):
+def processFiles(updater, original_dir, modified_dir, src_rel_dir, update_rel_dir):
     # Delete the old headers before updating to the new headers.
     update_dir = os.path.join(get_kernel_dir(), update_rel_dir)
     shutil.rmtree(update_dir)
@@ -64,66 +64,15 @@
             update_path = os.path.join(update_rel_dir, rel_path)
             print "cleaning %s -> %s (%s)" % (src_str, update_path, state)
 
-
-# This lets us support regular system calls like __NR_write and also weird
-# ones like __ARM_NR_cacheflush, where the NR doesn't come at the start.
-def make__NR_name(name):
-    if name.startswith('__ARM_NR_'):
-        return name
-    else:
-        return '__NR_%s' % (name)
-
-
-# Scan Linux kernel asm/unistd.h files containing __NR_* constants
-# and write out equivalent SYS_* constants for glibc source compatibility.
-def GenerateGlibcSyscallsHeader(updater):
-    libc_root = '%s/bionic/libc/' % os.environ['ANDROID_BUILD_TOP']
-
-    # Collect the set of all syscalls for all architectures.
-    syscalls = set()
-    pattern = re.compile(r'^\s*#\s*define\s*__NR_([a-z_]\S+)')
-    for unistd_h in ['kernel/uapi/asm-generic/unistd.h',
-                     'kernel/uapi/asm-arm/asm/unistd.h',
-                     'kernel/uapi/asm-arm/asm/unistd-common.h',
-                     'kernel/uapi/asm-arm/asm/unistd-eabi.h',
-                     'kernel/uapi/asm-arm/asm/unistd-oabi.h',
-                     'kernel/uapi/asm-x86/asm/unistd_32.h',
-                     'kernel/uapi/asm-x86/asm/unistd_64.h',
-                     'kernel/uapi/asm-x86/asm/unistd_x32.h']:
-        for line in open(os.path.join(libc_root, unistd_h)):
-            m = re.search(pattern, line)
-            if m:
-                nr_name = m.group(1)
-                if 'reserved' not in nr_name and 'unused' not in nr_name:
-                    syscalls.add(nr_name)
-
-    # Create a single file listing them all.
-    # Note that the input files include #if trickery, so even for a single
-    # architecture we don't know exactly which ones are available.
-    # https://b.corp.google.com/issues/37110151
-    content = '/* Generated file. Do not edit. */\n'
-    content += '#pragma once\n'
-
-    for syscall in sorted(syscalls):
-        nr_name = make__NR_name(syscall)
-        content += '#if defined(%s)\n' % nr_name
-        content += '  #define SYS_%s %s\n' % (syscall, nr_name)
-        content += '#endif\n'
-
-    syscall_file = os.path.join(libc_root, 'include/bits/glibc-syscalls.h')
-    updater.readFile(syscall_file)
-    updater.editFile(syscall_file, content)
-
-
 try:
     optlist, args = getopt.getopt(sys.argv[1:], '')
 except:
     # Unrecognized option
     sys.stderr.write("error: unrecognized option\n")
-    Usage()
+    usage()
 
 if len(optlist) > 0 or len(args) > 2:
-    Usage()
+    usage()
 
 if len(args) > 0:
     original_dir = args[0]
@@ -142,16 +91,10 @@
     panic("The kernel modified directory %s is not a directory\n" % modified_dir)
 
 updater = BatchFileUpdater()
-
 # Process the original uapi headers first.
-ProcessFiles(updater, original_dir, modified_dir, "uapi", "uapi"),
+processFiles(updater, original_dir, modified_dir, "uapi", "uapi"),
 
 # Now process the special files.
-ProcessFiles(updater, original_dir, modified_dir, "scsi", os.path.join("android", "scsi", "scsi"))
+processFiles(updater, original_dir, modified_dir, "scsi", os.path.join("android", "scsi", "scsi"))
 
 updater.updateGitFiles()
-
-# Now re-generate the <bits/glibc-syscalls.h> from the new uapi headers.
-updater = BatchFileUpdater()
-GenerateGlibcSyscallsHeader(updater)
-updater.updateGitFiles()
diff --git a/libc/kernel/uapi/asm-arm/asm/kvm.h b/libc/kernel/uapi/asm-arm/asm/kvm.h
index 72bcb03..95f0c4d 100644
--- a/libc/kernel/uapi/asm-arm/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm/asm/kvm.h
@@ -146,16 +146,6 @@
 #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
 #define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
 #define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
 #define KVM_DEV_ARM_VGIC_GRP_ADDR 0
 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
 #define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-common.h b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
index 091bd74..824a7d3 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-common.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
@@ -373,38 +373,4 @@
 #define __NR_statx (__NR_SYSCALL_BASE + 397)
 #define __NR_rseq (__NR_SYSCALL_BASE + 398)
 #define __NR_io_pgetevents (__NR_SYSCALL_BASE + 399)
-#define __NR_migrate_pages (__NR_SYSCALL_BASE + 400)
-#define __NR_kexec_file_load (__NR_SYSCALL_BASE + 401)
-#define __NR_clock_gettime64 (__NR_SYSCALL_BASE + 403)
-#define __NR_clock_settime64 (__NR_SYSCALL_BASE + 404)
-#define __NR_clock_adjtime64 (__NR_SYSCALL_BASE + 405)
-#define __NR_clock_getres_time64 (__NR_SYSCALL_BASE + 406)
-#define __NR_clock_nanosleep_time64 (__NR_SYSCALL_BASE + 407)
-#define __NR_timer_gettime64 (__NR_SYSCALL_BASE + 408)
-#define __NR_timer_settime64 (__NR_SYSCALL_BASE + 409)
-#define __NR_timerfd_gettime64 (__NR_SYSCALL_BASE + 410)
-#define __NR_timerfd_settime64 (__NR_SYSCALL_BASE + 411)
-#define __NR_utimensat_time64 (__NR_SYSCALL_BASE + 412)
-#define __NR_pselect6_time64 (__NR_SYSCALL_BASE + 413)
-#define __NR_ppoll_time64 (__NR_SYSCALL_BASE + 414)
-#define __NR_io_pgetevents_time64 (__NR_SYSCALL_BASE + 416)
-#define __NR_recvmmsg_time64 (__NR_SYSCALL_BASE + 417)
-#define __NR_mq_timedsend_time64 (__NR_SYSCALL_BASE + 418)
-#define __NR_mq_timedreceive_time64 (__NR_SYSCALL_BASE + 419)
-#define __NR_semtimedop_time64 (__NR_SYSCALL_BASE + 420)
-#define __NR_rt_sigtimedwait_time64 (__NR_SYSCALL_BASE + 421)
-#define __NR_futex_time64 (__NR_SYSCALL_BASE + 422)
-#define __NR_sched_rr_get_interval_time64 (__NR_SYSCALL_BASE + 423)
-#define __NR_pidfd_send_signal (__NR_SYSCALL_BASE + 424)
-#define __NR_io_uring_setup (__NR_SYSCALL_BASE + 425)
-#define __NR_io_uring_enter (__NR_SYSCALL_BASE + 426)
-#define __NR_io_uring_register (__NR_SYSCALL_BASE + 427)
-#define __NR_open_tree (__NR_SYSCALL_BASE + 428)
-#define __NR_move_mount (__NR_SYSCALL_BASE + 429)
-#define __NR_fsopen (__NR_SYSCALL_BASE + 430)
-#define __NR_fsconfig (__NR_SYSCALL_BASE + 431)
-#define __NR_fsmount (__NR_SYSCALL_BASE + 432)
-#define __NR_fspick (__NR_SYSCALL_BASE + 433)
-#define __NR_pidfd_open (__NR_SYSCALL_BASE + 434)
-#define __NR_clone3 (__NR_SYSCALL_BASE + 435)
 #endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/hwcap.h b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
index 8a38ab7..44853a4 100644
--- a/libc/kernel/uapi/asm-arm64/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
@@ -50,13 +50,4 @@
 #define HWCAP_SB (1 << 29)
 #define HWCAP_PACA (1 << 30)
 #define HWCAP_PACG (1UL << 31)
-#define HWCAP2_DCPODP (1 << 0)
-#define HWCAP2_SVE2 (1 << 1)
-#define HWCAP2_SVEAES (1 << 2)
-#define HWCAP2_SVEPMULL (1 << 3)
-#define HWCAP2_SVEBITPERM (1 << 4)
-#define HWCAP2_SVESHA3 (1 << 5)
-#define HWCAP2_SVESM4 (1 << 6)
-#define HWCAP2_FLAGM2 (1 << 7)
-#define HWCAP2_FRINT (1 << 8)
 #endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/kvm.h b/libc/kernel/uapi/asm-arm64/asm/kvm.h
index e345744..e79562c 100644
--- a/libc/kernel/uapi/asm-arm64/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm64/asm/kvm.h
@@ -29,7 +29,6 @@
 #include <linux/psci.h>
 #include <linux/types.h>
 #include <asm/ptrace.h>
-#include <asm/sve_context.h>
 #define __KVM_HAVE_GUEST_DEBUG
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_READONLY_MEM
@@ -70,9 +69,6 @@
 #define KVM_ARM_VCPU_EL1_32BIT 1
 #define KVM_ARM_VCPU_PSCI_0_2 2
 #define KVM_ARM_VCPU_PMU_V3 3
-#define KVM_ARM_VCPU_SVE 4
-#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5
-#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6
 struct kvm_vcpu_init {
   __u32 target;
   __u32 features[7];
@@ -141,30 +137,6 @@
 #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
 #define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
 #define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
-#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
-#define KVM_REG_ARM64_SVE_ZREG_BASE 0
-#define KVM_REG_ARM64_SVE_PREG_BASE 0x400
-#define KVM_REG_ARM64_SVE_FFR_BASE 0x600
-#define KVM_ARM64_SVE_NUM_ZREGS __SVE_NUM_ZREGS
-#define KVM_ARM64_SVE_NUM_PREGS __SVE_NUM_PREGS
-#define KVM_ARM64_SVE_MAX_SLICES 32
-#define KVM_REG_ARM64_SVE_ZREG(n,i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | KVM_REG_SIZE_U2048 | (((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
-#define KVM_REG_ARM64_SVE_PREG(n,i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | KVM_REG_SIZE_U256 | (((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
-#define KVM_REG_ARM64_SVE_FFR(i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | KVM_REG_SIZE_U256 | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
-#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN
-#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
-#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_SIZE_U512 | 0xffff)
-#define KVM_ARM64_SVE_VLS_WORDS ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
 #define KVM_DEV_ARM_VGIC_GRP_ADDR 0
 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
 #define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
diff --git a/libc/kernel/uapi/asm-arm64/asm/ptrace.h b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
index b3e0aea..15fde29 100644
--- a/libc/kernel/uapi/asm-arm64/asm/ptrace.h
+++ b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
@@ -45,9 +45,8 @@
 #define PSR_s 0x00ff0000
 #define PSR_x 0x0000ff00
 #define PSR_c 0x000000ff
-#define PTRACE_SYSEMU 31
-#define PTRACE_SYSEMU_SINGLESTEP 32
 #ifndef __ASSEMBLY__
+#include <linux/prctl.h>
 struct user_pt_regs {
   __u64 regs[31];
   __u64 sp;
@@ -80,8 +79,8 @@
 #define SVE_PT_REGS_MASK (1 << 0)
 #define SVE_PT_REGS_FPSIMD 0
 #define SVE_PT_REGS_SVE SVE_PT_REGS_MASK
-#define SVE_PT_VL_INHERIT ((1 << 17) >> 16)
-#define SVE_PT_VL_ONEXEC ((1 << 18) >> 16)
+#define SVE_PT_VL_INHERIT (PR_SVE_VL_INHERIT >> 16)
+#define SVE_PT_VL_ONEXEC (PR_SVE_SET_VL_ONEXEC >> 16)
 #define SVE_PT_REGS_OFFSET ((sizeof(struct user_sve_header) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
 #define SVE_PT_FPSIMD_OFFSET SVE_PT_REGS_OFFSET
 #define SVE_PT_FPSIMD_SIZE(vq,flags) (sizeof(struct user_fpsimd_state))
@@ -106,14 +105,5 @@
   __u64 data_mask;
   __u64 insn_mask;
 };
-struct user_pac_address_keys {
-  __uint128_t apiakey;
-  __uint128_t apibkey;
-  __uint128_t apdakey;
-  __uint128_t apdbkey;
-};
-struct user_pac_generic_keys {
-  __uint128_t apgakey;
-};
 #endif
 #endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/unistd.h b/libc/kernel/uapi/asm-arm64/asm/unistd.h
index 2f7a859..0648b02 100644
--- a/libc/kernel/uapi/asm-arm64/asm/unistd.h
+++ b/libc/kernel/uapi/asm-arm64/asm/unistd.h
@@ -18,6 +18,4 @@
  ****************************************************************************/
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
 #include <asm-generic/unistd.h>
diff --git a/libc/kernel/uapi/asm-generic/mman-common.h b/libc/kernel/uapi/asm-generic/mman-common.h
index 21d0356..6f688a1 100644
--- a/libc/kernel/uapi/asm-generic/mman-common.h
+++ b/libc/kernel/uapi/asm-generic/mman-common.h
@@ -25,16 +25,14 @@
 #define PROT_NONE 0x0
 #define PROT_GROWSDOWN 0x01000000
 #define PROT_GROWSUP 0x02000000
+#define MAP_SHARED 0x01
+#define MAP_PRIVATE 0x02
+#define MAP_SHARED_VALIDATE 0x03
 #define MAP_TYPE 0x0f
 #define MAP_FIXED 0x10
 #define MAP_ANONYMOUS 0x20
-#define MAP_POPULATE 0x008000
-#define MAP_NONBLOCK 0x010000
-#define MAP_STACK 0x020000
-#define MAP_HUGETLB 0x040000
-#define MAP_SYNC 0x080000
+#define MAP_UNINITIALIZED 0x0
 #define MAP_FIXED_NOREPLACE 0x100000
-#define MAP_UNINITIALIZED 0x4000000
 #define MLOCK_ONFAULT 0x01
 #define MS_ASYNC 1
 #define MS_INVALIDATE 2
diff --git a/libc/kernel/uapi/asm-generic/mman.h b/libc/kernel/uapi/asm-generic/mman.h
index 33d43f7..84caab7 100644
--- a/libc/kernel/uapi/asm-generic/mman.h
+++ b/libc/kernel/uapi/asm-generic/mman.h
@@ -24,6 +24,11 @@
 #define MAP_EXECUTABLE 0x1000
 #define MAP_LOCKED 0x2000
 #define MAP_NORESERVE 0x4000
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
+#define MAP_SYNC 0x80000
 #define MCL_CURRENT 1
 #define MCL_FUTURE 2
 #define MCL_ONFAULT 4
diff --git a/libc/kernel/uapi/asm-generic/socket.h b/libc/kernel/uapi/asm-generic/socket.h
index 11557aa..7c52ccc 100644
--- a/libc/kernel/uapi/asm-generic/socket.h
+++ b/libc/kernel/uapi/asm-generic/socket.h
@@ -18,7 +18,6 @@
  ****************************************************************************/
 #ifndef __ASM_GENERIC_SOCKET_H
 #define __ASM_GENERIC_SOCKET_H
-#include <linux/posix_types.h>
 #include <asm/sockios.h>
 #define SOL_SOCKET 1
 #define SO_DEBUG 1
@@ -43,8 +42,8 @@
 #define SO_PEERCRED 17
 #define SO_RCVLOWAT 18
 #define SO_SNDLOWAT 19
-#define SO_RCVTIMEO_OLD 20
-#define SO_SNDTIMEO_OLD 21
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
 #endif
 #define SO_SECURITY_AUTHENTICATION 22
 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23
@@ -54,10 +53,16 @@
 #define SO_DETACH_FILTER 27
 #define SO_GET_FILTER SO_ATTACH_FILTER
 #define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
 #define SO_ACCEPTCONN 30
 #define SO_PEERSEC 31
 #define SO_PASSSEC 34
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
 #define SO_MARK 36
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
 #define SO_PROTOCOL 38
 #define SO_DOMAIN 39
 #define SO_RXQ_OVFL 40
@@ -85,30 +90,4 @@
 #define SO_ZEROCOPY 60
 #define SO_TXTIME 61
 #define SCM_TXTIME SO_TXTIME
-#define SO_BINDTOIFINDEX 62
-#define SO_TIMESTAMP_OLD 29
-#define SO_TIMESTAMPNS_OLD 35
-#define SO_TIMESTAMPING_OLD 37
-#define SO_TIMESTAMP_NEW 63
-#define SO_TIMESTAMPNS_NEW 64
-#define SO_TIMESTAMPING_NEW 65
-#define SO_RCVTIMEO_NEW 66
-#define SO_SNDTIMEO_NEW 67
-#define SO_DETACH_REUSEPORT_BPF 68
-#if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
-#define SO_TIMESTAMP SO_TIMESTAMP_OLD
-#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
-#define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
-#define SO_RCVTIMEO SO_RCVTIMEO_OLD
-#define SO_SNDTIMEO SO_SNDTIMEO_OLD
-#else
-#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
-#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
-#define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
-#define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
-#define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
-#endif
-#define SCM_TIMESTAMP SO_TIMESTAMP
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-#define SCM_TIMESTAMPING SO_TIMESTAMPING
 #endif
diff --git a/libc/kernel/uapi/asm-generic/sockios.h b/libc/kernel/uapi/asm-generic/sockios.h
index afbc6ad..0725dcc 100644
--- a/libc/kernel/uapi/asm-generic/sockios.h
+++ b/libc/kernel/uapi/asm-generic/sockios.h
@@ -23,6 +23,6 @@
 #define FIOGETOWN 0x8903
 #define SIOCGPGRP 0x8904
 #define SIOCATMARK 0x8905
-#define SIOCGSTAMP_OLD 0x8906
-#define SIOCGSTAMPNS_OLD 0x8907
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
 #endif
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 2128ff5..4113881 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -36,9 +36,7 @@
 #define __NR_io_destroy 1
 #define __NR_io_submit 2
 #define __NR_io_cancel 3
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_io_getevents 4
-#endif
 #define __NR_setxattr 5
 #define __NR_lsetxattr 6
 #define __NR_fsetxattr 7
@@ -108,10 +106,8 @@
 #define __NR_preadv 69
 #define __NR_pwritev 70
 #define __NR3264_sendfile 71
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_pselect6 72
 #define __NR_ppoll 73
-#endif
 #define __NR_signalfd4 74
 #define __NR_vmsplice 75
 #define __NR_splice 76
@@ -130,13 +126,9 @@
 #define __NR_sync_file_range 84
 #endif
 #define __NR_timerfd_create 85
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_timerfd_settime 86
 #define __NR_timerfd_gettime 87
-#endif
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_utimensat 88
-#endif
 #define __NR_acct 89
 #define __NR_capget 90
 #define __NR_capset 91
@@ -146,34 +138,24 @@
 #define __NR_waitid 95
 #define __NR_set_tid_address 96
 #define __NR_unshare 97
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_futex 98
-#endif
 #define __NR_set_robust_list 99
 #define __NR_get_robust_list 100
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_nanosleep 101
-#endif
 #define __NR_getitimer 102
 #define __NR_setitimer 103
 #define __NR_kexec_load 104
 #define __NR_init_module 105
 #define __NR_delete_module 106
 #define __NR_timer_create 107
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_timer_gettime 108
-#endif
 #define __NR_timer_getoverrun 109
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_timer_settime 110
-#endif
 #define __NR_timer_delete 111
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_clock_settime 112
 #define __NR_clock_gettime 113
 #define __NR_clock_getres 114
 #define __NR_clock_nanosleep 115
-#endif
 #define __NR_syslog 116
 #define __NR_ptrace 117
 #define __NR_sched_setparam 118
@@ -185,9 +167,7 @@
 #define __NR_sched_yield 124
 #define __NR_sched_get_priority_max 125
 #define __NR_sched_get_priority_min 126
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_sched_rr_get_interval 127
-#endif
 #define __NR_restart_syscall 128
 #define __NR_kill 129
 #define __NR_tkill 130
@@ -197,9 +177,7 @@
 #define __NR_rt_sigaction 134
 #define __NR_rt_sigprocmask 135
 #define __NR_rt_sigpending 136
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_rt_sigtimedwait 137
-#endif
 #define __NR_rt_sigqueueinfo 138
 #define __NR_rt_sigreturn 139
 #define __NR_setpriority 140
@@ -225,19 +203,15 @@
 #define __NR_uname 160
 #define __NR_sethostname 161
 #define __NR_setdomainname 162
-#ifdef __ARCH_WANT_SET_GET_RLIMIT
 #define __NR_getrlimit 163
 #define __NR_setrlimit 164
-#endif
 #define __NR_getrusage 165
 #define __NR_umask 166
 #define __NR_prctl 167
 #define __NR_getcpu 168
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_gettimeofday 169
 #define __NR_settimeofday 170
 #define __NR_adjtimex 171
-#endif
 #define __NR_getpid 172
 #define __NR_getppid 173
 #define __NR_getuid 174
@@ -248,10 +222,8 @@
 #define __NR_sysinfo 179
 #define __NR_mq_open 180
 #define __NR_mq_unlink 181
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_mq_timedsend 182
 #define __NR_mq_timedreceive 183
-#endif
 #define __NR_mq_notify 184
 #define __NR_mq_getsetattr 185
 #define __NR_msgget 186
@@ -260,9 +232,7 @@
 #define __NR_msgsnd 189
 #define __NR_semget 190
 #define __NR_semctl 191
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_semtimedop 192
-#endif
 #define __NR_semop 193
 #define __NR_shmget 194
 #define __NR_shmctl 195
@@ -315,21 +285,15 @@
 #define __NR_rt_tgsigqueueinfo 240
 #define __NR_perf_event_open 241
 #define __NR_accept4 242
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_recvmmsg 243
-#endif
 #define __NR_arch_specific_syscall 244
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_wait4 260
-#endif
 #define __NR_prlimit64 261
 #define __NR_fanotify_init 262
 #define __NR_fanotify_mark 263
 #define __NR_name_to_handle_at 264
 #define __NR_open_by_handle_at 265
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_clock_adjtime 266
-#endif
 #define __NR_syncfs 267
 #define __NR_setns 268
 #define __NR_sendmmsg 269
@@ -355,49 +319,11 @@
 #define __NR_pkey_alloc 289
 #define __NR_pkey_free 290
 #define __NR_statx 291
-#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_io_pgetevents 292
-#endif
 #define __NR_rseq 293
 #define __NR_kexec_file_load 294
-#if __BITS_PER_LONG == 32
-#define __NR_clock_gettime64 403
-#define __NR_clock_settime64 404
-#define __NR_clock_adjtime64 405
-#define __NR_clock_getres_time64 406
-#define __NR_clock_nanosleep_time64 407
-#define __NR_timer_gettime64 408
-#define __NR_timer_settime64 409
-#define __NR_timerfd_gettime64 410
-#define __NR_timerfd_settime64 411
-#define __NR_utimensat_time64 412
-#define __NR_pselect6_time64 413
-#define __NR_ppoll_time64 414
-#define __NR_io_pgetevents_time64 416
-#define __NR_recvmmsg_time64 417
-#define __NR_mq_timedsend_time64 418
-#define __NR_mq_timedreceive_time64 419
-#define __NR_semtimedop_time64 420
-#define __NR_rt_sigtimedwait_time64 421
-#define __NR_futex_time64 422
-#define __NR_sched_rr_get_interval_time64 423
-#endif
-#define __NR_pidfd_send_signal 424
-#define __NR_io_uring_setup 425
-#define __NR_io_uring_enter 426
-#define __NR_io_uring_register 427
-#define __NR_open_tree 428
-#define __NR_move_mount 429
-#define __NR_fsopen 430
-#define __NR_fsconfig 431
-#define __NR_fsmount 432
-#define __NR_fspick 433
-#define __NR_pidfd_open 434
-#ifdef __ARCH_WANT_SYS_CLONE3
-#define __NR_clone3 435
-#endif
 #undef __NR_syscalls
-#define __NR_syscalls 436
+#define __NR_syscalls 295
 #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
 #define __NR_fcntl __NR3264_fcntl
 #define __NR_statfs __NR3264_statfs
diff --git a/libc/kernel/uapi/asm-mips/asm/inst.h b/libc/kernel/uapi/asm-mips/asm/inst.h
index 8489575..090a40b 100644
--- a/libc/kernel/uapi/asm-mips/asm/inst.h
+++ b/libc/kernel/uapi/asm-mips/asm/inst.h
@@ -146,15 +146,15 @@
   tlt_op,
   tltu_op,
   teq_op,
-  seleqz_op,
-  tne_op,
-  selnez_op,
-  dsll_op,
   spec5_unused_op,
+  tne_op,
+  spec6_unused_op,
+  dsll_op,
+  spec7_unused_op,
   dsrl_op,
   dsra_op,
   dsll32_op,
-  spec6_unused_op,
+  spec8_unused_op,
   dsrl32_op,
   dsra32_op
 };
diff --git a/libc/kernel/uapi/asm-mips/asm/mman.h b/libc/kernel/uapi/asm-mips/asm/mman.h
index 8664a81..7ca4a99 100644
--- a/libc/kernel/uapi/asm-mips/asm/mman.h
+++ b/libc/kernel/uapi/asm-mips/asm/mman.h
@@ -25,6 +25,9 @@
 #define PROT_SEM 0x10
 #define PROT_GROWSDOWN 0x01000000
 #define PROT_GROWSUP 0x02000000
+#define MAP_SHARED 0x001
+#define MAP_PRIVATE 0x002
+#define MAP_SHARED_VALIDATE 0x003
 #define MAP_TYPE 0x00f
 #define MAP_FIXED 0x010
 #define MAP_RENAME 0x020
diff --git a/libc/kernel/uapi/asm-mips/asm/posix_types.h b/libc/kernel/uapi/asm-mips/asm/posix_types.h
index 30c9f32..7ae19d2 100644
--- a/libc/kernel/uapi/asm-mips/asm/posix_types.h
+++ b/libc/kernel/uapi/asm-mips/asm/posix_types.h
@@ -21,5 +21,11 @@
 #include <asm/sgidefs.h>
 typedef long __kernel_daddr_t;
 #define __kernel_daddr_t __kernel_daddr_t
+#if _MIPS_SZLONG == 32
+typedef struct {
+  long val[2];
+} __kernel_fsid_t;
+#define __kernel_fsid_t __kernel_fsid_t
+#endif
 #include <asm-generic/posix_types.h>
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/socket.h b/libc/kernel/uapi/asm-mips/asm/socket.h
index d24c09e..960b141 100644
--- a/libc/kernel/uapi/asm-mips/asm/socket.h
+++ b/libc/kernel/uapi/asm-mips/asm/socket.h
@@ -18,7 +18,6 @@
  ****************************************************************************/
 #ifndef _UAPI_ASM_SOCKET_H
 #define _UAPI_ASM_SOCKET_H
-#include <linux/posix_types.h>
 #include <asm/sockios.h>
 #define SOL_SOCKET 0xffff
 #define SO_DEBUG 0x0001
@@ -36,8 +35,8 @@
 #define SO_RCVBUF 0x1002
 #define SO_SNDLOWAT 0x1003
 #define SO_RCVLOWAT 0x1004
-#define SO_SNDTIMEO_OLD 0x1005
-#define SO_RCVTIMEO_OLD 0x1006
+#define SO_SNDTIMEO 0x1005
+#define SO_RCVTIMEO 0x1006
 #define SO_ACCEPTCONN 0x1009
 #define SO_PROTOCOL 0x1028
 #define SO_DOMAIN 0x1029
@@ -54,11 +53,17 @@
 #define SO_DETACH_FILTER 27
 #define SO_GET_FILTER SO_ATTACH_FILTER
 #define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
 #define SO_PEERSEC 30
 #define SO_SNDBUFFORCE 31
 #define SO_RCVBUFFORCE 33
 #define SO_PASSSEC 34
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
 #define SO_MARK 36
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
 #define SO_RXQ_OVFL 40
 #define SO_WIFI_STATUS 41
 #define SCM_WIFI_STATUS SO_WIFI_STATUS
@@ -84,30 +89,4 @@
 #define SO_ZEROCOPY 60
 #define SO_TXTIME 61
 #define SCM_TXTIME SO_TXTIME
-#define SO_BINDTOIFINDEX 62
-#define SO_TIMESTAMP_OLD 29
-#define SO_TIMESTAMPNS_OLD 35
-#define SO_TIMESTAMPING_OLD 37
-#define SO_TIMESTAMP_NEW 63
-#define SO_TIMESTAMPNS_NEW 64
-#define SO_TIMESTAMPING_NEW 65
-#define SO_RCVTIMEO_NEW 66
-#define SO_SNDTIMEO_NEW 67
-#define SO_DETACH_REUSEPORT_BPF 68
-#if __BITS_PER_LONG == 64
-#define SO_TIMESTAMP SO_TIMESTAMP_OLD
-#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
-#define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
-#define SO_RCVTIMEO SO_RCVTIMEO_OLD
-#define SO_SNDTIMEO SO_SNDTIMEO_OLD
-#else
-#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
-#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
-#define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
-#define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
-#define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
-#endif
-#define SCM_TIMESTAMP SO_TIMESTAMP
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-#define SCM_TIMESTAMPING SO_TIMESTAMPING
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sockios.h b/libc/kernel/uapi/asm-mips/asm/sockios.h
index 4240418..02261d7 100644
--- a/libc/kernel/uapi/asm-mips/asm/sockios.h
+++ b/libc/kernel/uapi/asm-mips/asm/sockios.h
@@ -24,6 +24,6 @@
 #define SIOCATMARK _IOR('s', 7, int)
 #define SIOCSPGRP _IOW('s', 8, pid_t)
 #define SIOCGPGRP _IOR('s', 9, pid_t)
-#define SIOCGSTAMP_OLD 0x8906
-#define SIOCGSTAMPNS_OLD 0x8907
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
index 285b1f0..a72d9d2 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
@@ -350,35 +350,4 @@
 #define __NR_statx (__NR_Linux + 330)
 #define __NR_rseq (__NR_Linux + 331)
 #define __NR_io_pgetevents (__NR_Linux + 332)
-#define __NR_clock_gettime64 (__NR_Linux + 403)
-#define __NR_clock_settime64 (__NR_Linux + 404)
-#define __NR_clock_adjtime64 (__NR_Linux + 405)
-#define __NR_clock_getres_time64 (__NR_Linux + 406)
-#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
-#define __NR_timer_gettime64 (__NR_Linux + 408)
-#define __NR_timer_settime64 (__NR_Linux + 409)
-#define __NR_timerfd_gettime64 (__NR_Linux + 410)
-#define __NR_timerfd_settime64 (__NR_Linux + 411)
-#define __NR_utimensat_time64 (__NR_Linux + 412)
-#define __NR_pselect6_time64 (__NR_Linux + 413)
-#define __NR_ppoll_time64 (__NR_Linux + 414)
-#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
-#define __NR_recvmmsg_time64 (__NR_Linux + 417)
-#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
-#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
-#define __NR_semtimedop_time64 (__NR_Linux + 420)
-#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
-#define __NR_futex_time64 (__NR_Linux + 422)
-#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
index 9b2650f..5ea908a 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
@@ -346,15 +346,4 @@
 #define __NR_statx (__NR_Linux + 326)
 #define __NR_rseq (__NR_Linux + 327)
 #define __NR_io_pgetevents (__NR_Linux + 328)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
index a335768..2b74f63 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
@@ -19,5 +19,5 @@
 #ifndef _UAPI_ASM_MIPS_UNISTD_NR_N32_H
 #define _UAPI_ASM_MIPS_UNISTD_NR_N32_H
 #define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls 435
+#define __NR_N32_Linux_syscalls 333
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
index c4812a5..22300b2 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
@@ -19,5 +19,5 @@
 #ifndef _UAPI_ASM_MIPS_UNISTD_NR_N64_H
 #define _UAPI_ASM_MIPS_UNISTD_NR_N64_H
 #define __NR_64_Linux 5000
-#define __NR_64_Linux_syscalls 435
+#define __NR_64_Linux_syscalls 329
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
index 041051a..02cbd21 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
@@ -19,5 +19,5 @@
 #ifndef _UAPI_ASM_MIPS_UNISTD_NR_O32_H
 #define _UAPI_ASM_MIPS_UNISTD_NR_O32_H
 #define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 435
+#define __NR_O32_Linux_syscalls 369
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
index acbfa6b..bc248dd 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
@@ -386,45 +386,4 @@
 #define __NR_statx (__NR_Linux + 366)
 #define __NR_rseq (__NR_Linux + 367)
 #define __NR_io_pgetevents (__NR_Linux + 368)
-#define __NR_semget (__NR_Linux + 393)
-#define __NR_semctl (__NR_Linux + 394)
-#define __NR_shmget (__NR_Linux + 395)
-#define __NR_shmctl (__NR_Linux + 396)
-#define __NR_shmat (__NR_Linux + 397)
-#define __NR_shmdt (__NR_Linux + 398)
-#define __NR_msgget (__NR_Linux + 399)
-#define __NR_msgsnd (__NR_Linux + 400)
-#define __NR_msgrcv (__NR_Linux + 401)
-#define __NR_msgctl (__NR_Linux + 402)
-#define __NR_clock_gettime64 (__NR_Linux + 403)
-#define __NR_clock_settime64 (__NR_Linux + 404)
-#define __NR_clock_adjtime64 (__NR_Linux + 405)
-#define __NR_clock_getres_time64 (__NR_Linux + 406)
-#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
-#define __NR_timer_gettime64 (__NR_Linux + 408)
-#define __NR_timer_settime64 (__NR_Linux + 409)
-#define __NR_timerfd_gettime64 (__NR_Linux + 410)
-#define __NR_timerfd_settime64 (__NR_Linux + 411)
-#define __NR_utimensat_time64 (__NR_Linux + 412)
-#define __NR_pselect6_time64 (__NR_Linux + 413)
-#define __NR_ppoll_time64 (__NR_Linux + 414)
-#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
-#define __NR_recvmmsg_time64 (__NR_Linux + 417)
-#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
-#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
-#define __NR_semtimedop_time64 (__NR_Linux + 420)
-#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
-#define __NR_futex_time64 (__NR_Linux + 422)
-#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/bootparam.h b/libc/kernel/uapi/asm-x86/asm/bootparam.h
index af66fdb..dc90f57 100644
--- a/libc/kernel/uapi/asm-x86/asm/bootparam.h
+++ b/libc/kernel/uapi/asm-x86/asm/bootparam.h
@@ -38,8 +38,6 @@
 #define XLF_EFI_HANDOVER_32 (1 << 2)
 #define XLF_EFI_HANDOVER_64 (1 << 3)
 #define XLF_EFI_KEXEC (1 << 4)
-#define XLF_5LEVEL (1 << 5)
-#define XLF_5LEVEL_ENABLED (1 << 6)
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 #include <linux/screen_info.h>
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index d4865fb..4386f76 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -317,23 +317,14 @@
 #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
 #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
 #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
-#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
-#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
-#define KVM_STATE_NESTED_FORMAT_VMX 0
-#define KVM_STATE_NESTED_FORMAT_SVM 1
 #define KVM_STATE_NESTED_GUEST_MODE 0x00000001
 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002
 #define KVM_STATE_NESTED_EVMCS 0x00000004
 #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002
-#define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000
-struct kvm_vmx_nested_state_data {
-  __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
-  __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
-};
-struct kvm_vmx_nested_state_hdr {
+struct kvm_vmx_nested_state {
   __u64 vmxon_pa;
-  __u64 vmcs12_pa;
+  __u64 vmcs_pa;
   struct {
     __u16 flags;
   } smm;
@@ -343,21 +334,9 @@
   __u16 format;
   __u32 size;
   union {
-    struct kvm_vmx_nested_state_hdr vmx;
+    struct kvm_vmx_nested_state vmx;
     __u8 pad[120];
-  } hdr;
-  union {
-    struct kvm_vmx_nested_state_data vmx[0];
-  } data;
+  };
+  __u8 data[0];
 };
-struct kvm_pmu_event_filter {
-  __u32 action;
-  __u32 nevents;
-  __u32 fixed_counter_bitmap;
-  __u32 flags;
-  __u32 pad[4];
-  __u64 events[0];
-};
-#define KVM_PMU_EVENT_ALLOW 0
-#define KVM_PMU_EVENT_DENY 1
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm_para.h b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
index ad8fe0b..47ecca9 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm_para.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
@@ -32,8 +32,6 @@
 #define KVM_FEATURE_PV_TLB_FLUSH 9
 #define KVM_FEATURE_ASYNC_PF_VMEXIT 10
 #define KVM_FEATURE_PV_SEND_IPI 11
-#define KVM_FEATURE_POLL_CONTROL 12
-#define KVM_FEATURE_PV_SCHED_YIELD 13
 #define KVM_HINTS_REALTIME 0
 #define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24
 #define MSR_KVM_WALL_CLOCK 0x11
@@ -44,7 +42,6 @@
 #define MSR_KVM_ASYNC_PF_EN 0x4b564d02
 #define MSR_KVM_STEAL_TIME 0x4b564d03
 #define MSR_KVM_PV_EOI_EN 0x4b564d04
-#define MSR_KVM_POLL_CONTROL 0x4b564d05
 struct kvm_steal_time {
   __u64 steal;
   __u32 version;
diff --git a/libc/kernel/uapi/asm-x86/asm/perf_regs.h b/libc/kernel/uapi/asm-x86/asm/perf_regs.h
index 984b7ea..6a015ba 100644
--- a/libc/kernel/uapi/asm-x86/asm/perf_regs.h
+++ b/libc/kernel/uapi/asm-x86/asm/perf_regs.h
@@ -45,23 +45,5 @@
   PERF_REG_X86_R15,
   PERF_REG_X86_32_MAX = PERF_REG_X86_GS + 1,
   PERF_REG_X86_64_MAX = PERF_REG_X86_R15 + 1,
-  PERF_REG_X86_XMM0 = 32,
-  PERF_REG_X86_XMM1 = 34,
-  PERF_REG_X86_XMM2 = 36,
-  PERF_REG_X86_XMM3 = 38,
-  PERF_REG_X86_XMM4 = 40,
-  PERF_REG_X86_XMM5 = 42,
-  PERF_REG_X86_XMM6 = 44,
-  PERF_REG_X86_XMM7 = 46,
-  PERF_REG_X86_XMM8 = 48,
-  PERF_REG_X86_XMM9 = 50,
-  PERF_REG_X86_XMM10 = 52,
-  PERF_REG_X86_XMM11 = 54,
-  PERF_REG_X86_XMM12 = 56,
-  PERF_REG_X86_XMM13 = 58,
-  PERF_REG_X86_XMM14 = 60,
-  PERF_REG_X86_XMM15 = 62,
-  PERF_REG_X86_XMM_MAX = PERF_REG_X86_XMM15 + 2,
 };
-#define PERF_REG_EXTENDED_MASK (~((1ULL << PERF_REG_X86_XMM0) - 1))
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index 06e4a01..4afa676 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -401,46 +401,4 @@
 #define __NR_arch_prctl 384
 #define __NR_io_pgetevents 385
 #define __NR_rseq 386
-#define __NR_semget 393
-#define __NR_semctl 394
-#define __NR_shmget 395
-#define __NR_shmctl 396
-#define __NR_shmat 397
-#define __NR_shmdt 398
-#define __NR_msgget 399
-#define __NR_msgsnd 400
-#define __NR_msgrcv 401
-#define __NR_msgctl 402
-#define __NR_clock_gettime64 403
-#define __NR_clock_settime64 404
-#define __NR_clock_adjtime64 405
-#define __NR_clock_getres_time64 406
-#define __NR_clock_nanosleep_time64 407
-#define __NR_timer_gettime64 408
-#define __NR_timer_settime64 409
-#define __NR_timerfd_gettime64 410
-#define __NR_timerfd_settime64 411
-#define __NR_utimensat_time64 412
-#define __NR_pselect6_time64 413
-#define __NR_ppoll_time64 414
-#define __NR_io_pgetevents_time64 416
-#define __NR_recvmmsg_time64 417
-#define __NR_mq_timedsend_time64 418
-#define __NR_mq_timedreceive_time64 419
-#define __NR_semtimedop_time64 420
-#define __NR_rt_sigtimedwait_time64 421
-#define __NR_futex_time64 422
-#define __NR_sched_rr_get_interval_time64 423
-#define __NR_pidfd_send_signal 424
-#define __NR_io_uring_setup 425
-#define __NR_io_uring_enter 426
-#define __NR_io_uring_register 427
-#define __NR_open_tree 428
-#define __NR_move_mount 429
-#define __NR_fsopen 430
-#define __NR_fsconfig 431
-#define __NR_fsmount 432
-#define __NR_fspick 433
-#define __NR_pidfd_open 434
-#define __NR_clone3 435
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index bcb6eae..a118200 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -353,16 +353,4 @@
 #define __NR_statx 332
 #define __NR_io_pgetevents 333
 #define __NR_rseq 334
-#define __NR_pidfd_send_signal 424
-#define __NR_io_uring_setup 425
-#define __NR_io_uring_enter 426
-#define __NR_io_uring_register 427
-#define __NR_open_tree 428
-#define __NR_move_mount 429
-#define __NR_fsopen 430
-#define __NR_fsconfig 431
-#define __NR_fsmount 432
-#define __NR_fspick 433
-#define __NR_pidfd_open 434
-#define __NR_clone3 435
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index 3357bd1..b5f3fb1 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -306,18 +306,6 @@
 #define __NR_statx (__X32_SYSCALL_BIT + 332)
 #define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333)
 #define __NR_rseq (__X32_SYSCALL_BIT + 334)
-#define __NR_pidfd_send_signal (__X32_SYSCALL_BIT + 424)
-#define __NR_io_uring_setup (__X32_SYSCALL_BIT + 425)
-#define __NR_io_uring_enter (__X32_SYSCALL_BIT + 426)
-#define __NR_io_uring_register (__X32_SYSCALL_BIT + 427)
-#define __NR_open_tree (__X32_SYSCALL_BIT + 428)
-#define __NR_move_mount (__X32_SYSCALL_BIT + 429)
-#define __NR_fsopen (__X32_SYSCALL_BIT + 430)
-#define __NR_fsconfig (__X32_SYSCALL_BIT + 431)
-#define __NR_fsmount (__X32_SYSCALL_BIT + 432)
-#define __NR_fspick (__X32_SYSCALL_BIT + 433)
-#define __NR_pidfd_open (__X32_SYSCALL_BIT + 434)
-#define __NR_clone3 (__X32_SYSCALL_BIT + 435)
 #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
 #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
 #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
diff --git a/libc/kernel/uapi/drm/amdgpu_drm.h b/libc/kernel/uapi/drm/amdgpu_drm.h
index dda9ced..baa2e44 100644
--- a/libc/kernel/uapi/drm/amdgpu_drm.h
+++ b/libc/kernel/uapi/drm/amdgpu_drm.h
@@ -117,8 +117,6 @@
 #define AMDGPU_CTX_QUERY2_FLAGS_RESET (1 << 0)
 #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1 << 1)
 #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1 << 2)
-#define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1 << 3)
-#define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1 << 4)
 #define AMDGPU_CTX_PRIORITY_UNSET - 2048
 #define AMDGPU_CTX_PRIORITY_VERY_LOW - 1023
 #define AMDGPU_CTX_PRIORITY_LOW - 512
@@ -160,12 +158,11 @@
   struct drm_amdgpu_vm_out out;
 };
 #define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1
-#define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2
 struct drm_amdgpu_sched_in {
   __u32 op;
   __u32 fd;
   __s32 priority;
-  __u32 ctx_id;
+  __u32 flags;
 };
 union drm_amdgpu_sched {
   struct drm_amdgpu_sched_in in;
@@ -326,9 +323,6 @@
 #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04
 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05
 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06
-#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07
-#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08
-#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09
 struct drm_amdgpu_cs_chunk {
   __u32 chunk_id;
   __u32 length_dw;
@@ -352,7 +346,6 @@
 #define AMDGPU_IB_FLAG_PREAMBLE (1 << 1)
 #define AMDGPU_IB_FLAG_PREEMPT (1 << 2)
 #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
-#define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4)
 struct drm_amdgpu_cs_chunk_ib {
   __u32 _pad;
   __u32 flags;
@@ -376,11 +369,6 @@
 struct drm_amdgpu_cs_chunk_sem {
   __u32 handle;
 };
-struct drm_amdgpu_cs_chunk_syncobj {
-  __u32 handle;
-  __u32 flags;
-  __u64 point;
-};
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
@@ -425,7 +413,6 @@
 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10
 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
 #define AMDGPU_INFO_FW_DMCU 0x12
-#define AMDGPU_INFO_FW_TA 0x13
 #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
 #define AMDGPU_INFO_VRAM_USAGE 0x10
 #define AMDGPU_INFO_GTT_USAGE 0x11
@@ -453,21 +440,6 @@
 #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9
 #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E
 #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F
-#define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20
-#define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0)
-#define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1)
-#define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2)
-#define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3)
-#define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4)
-#define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5)
-#define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6)
-#define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7)
-#define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8)
-#define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9)
-#define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10)
-#define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11)
-#define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12)
-#define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13)
 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
 #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
@@ -546,7 +518,6 @@
 #define AMDGPU_VRAM_TYPE_HBM 6
 #define AMDGPU_VRAM_TYPE_DDR3 7
 #define AMDGPU_VRAM_TYPE_DDR4 8
-#define AMDGPU_VRAM_TYPE_GDDR6 9
 struct drm_amdgpu_info_device {
   __u32 device_id;
   __u32 chip_rev;
@@ -595,7 +566,6 @@
   __u32 cu_ao_bitmap[4][4];
   __u64 high_va_offset;
   __u64 high_va_max;
-  __u32 pa_sc_tile_steering_override;
 };
 struct drm_amdgpu_info_hw_ip {
   __u32 hw_ip_version_major;
@@ -630,7 +600,6 @@
 #define AMDGPU_FAMILY_CZ 135
 #define AMDGPU_FAMILY_AI 141
 #define AMDGPU_FAMILY_RV 142
-#define AMDGPU_FAMILY_NV 143
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/drm/drm.h b/libc/kernel/uapi/drm/drm.h
index 7c5ffbb..ef64ed7 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -23,7 +23,6 @@
 #include <asm/ioctl.h>
 typedef unsigned int drm_handle_t;
 #else
-#include <stdint.h>
 #include <sys/ioccom.h>
 #include <sys/types.h>
 typedef int8_t __s8;
@@ -364,7 +363,6 @@
 #define DRM_CAP_PAGE_FLIP_TARGET 0x11
 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
 #define DRM_CAP_SYNCOBJ 0x13
-#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
 struct drm_get_cap {
   __u64 capability;
   __u64 value;
@@ -402,17 +400,8 @@
   __s32 fd;
   __u32 pad;
 };
-struct drm_syncobj_transfer {
-  __u32 src_handle;
-  __u32 dst_handle;
-  __u64 src_point;
-  __u64 dst_point;
-  __u32 flags;
-  __u32 pad;
-};
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
-#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)
 struct drm_syncobj_wait {
   __u64 handles;
   __s64 timeout_nsec;
@@ -421,26 +410,11 @@
   __u32 first_signaled;
   __u32 pad;
 };
-struct drm_syncobj_timeline_wait {
-  __u64 handles;
-  __u64 points;
-  __s64 timeout_nsec;
-  __u32 count_handles;
-  __u32 flags;
-  __u32 first_signaled;
-  __u32 pad;
-};
 struct drm_syncobj_array {
   __u64 handles;
   __u32 count_handles;
   __u32 pad;
 };
-struct drm_syncobj_timeline_array {
-  __u64 handles;
-  __u64 points;
-  __u32 count_handles;
-  __u32 pad;
-};
 struct drm_crtc_get_sequence {
   __u32 crtc_id;
   __u32 active;
@@ -568,10 +542,6 @@
 #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees)
 #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)
 #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
-#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
-#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
-#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
-#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 #define DRM_COMMAND_BASE 0x40
 #define DRM_COMMAND_END 0xA0
 struct drm_event {
diff --git a/libc/kernel/uapi/drm/drm_fourcc.h b/libc/kernel/uapi/drm/drm_fourcc.h
index 593d87c..d95bda0 100644
--- a/libc/kernel/uapi/drm/drm_fourcc.h
+++ b/libc/kernel/uapi/drm/drm_fourcc.h
@@ -70,33 +70,16 @@
 #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0')
 #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
 #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0')
-#define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H')
-#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H')
-#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H')
-#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H')
 #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V')
 #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U')
 #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y')
 #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y')
 #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V')
 #define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V')
-#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4')
-#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0')
-#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0')
-#define DRM_FORMAT_Y212 fourcc_code('Y', '2', '1', '2')
-#define DRM_FORMAT_Y216 fourcc_code('Y', '2', '1', '6')
-#define DRM_FORMAT_Y410 fourcc_code('Y', '4', '1', '0')
-#define DRM_FORMAT_Y412 fourcc_code('Y', '4', '1', '2')
-#define DRM_FORMAT_Y416 fourcc_code('Y', '4', '1', '6')
-#define DRM_FORMAT_XVYU2101010 fourcc_code('X', 'V', '3', '0')
-#define DRM_FORMAT_XVYU12_16161616 fourcc_code('X', 'V', '3', '6')
-#define DRM_FORMAT_XVYU16161616 fourcc_code('X', 'V', '4', '8')
 #define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0')
 #define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0')
 #define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2')
 #define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2')
-#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8')
-#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0')
 #define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8')
 #define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8')
 #define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8')
@@ -111,10 +94,6 @@
 #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1')
 #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4')
 #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2')
-#define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0')
-#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
-#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2')
-#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6')
 #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9')
 #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9')
 #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1')
@@ -135,7 +114,6 @@
 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08
-#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09
 #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
 #define fourcc_mod_code(vendor,val) ((((__u64) DRM_FORMAT_MOD_VENDOR_ ##vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
 #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
@@ -179,17 +157,12 @@
 #define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf
 #define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL)
 #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL)
-#define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL)
-#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL)
 #define AFBC_FORMAT_MOD_YTR (1ULL << 4)
 #define AFBC_FORMAT_MOD_SPLIT (1ULL << 5)
 #define AFBC_FORMAT_MOD_SPARSE (1ULL << 6)
 #define AFBC_FORMAT_MOD_CBR (1ULL << 7)
 #define AFBC_FORMAT_MOD_TILED (1ULL << 8)
 #define AFBC_FORMAT_MOD_SC (1ULL << 9)
-#define AFBC_FORMAT_MOD_DB (1ULL << 10)
-#define AFBC_FORMAT_MOD_BCH (1ULL << 11)
-#define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1)
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/drm/drm_mode.h b/libc/kernel/uapi/drm/drm_mode.h
index 403c787..1944c9c 100644
--- a/libc/kernel/uapi/drm/drm_mode.h
+++ b/libc/kernel/uapi/drm/drm_mode.h
@@ -22,6 +22,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#define DRM_DISPLAY_INFO_LEN 32
 #define DRM_CONNECTOR_NAME_LEN 32
 #define DRM_DISPLAY_MODE_LEN 32
 #define DRM_PROP_NAME_LEN 32
@@ -368,26 +369,6 @@
   __u16 blue;
   __u16 reserved;
 };
-struct hdr_metadata_infoframe {
-  __u8 eotf;
-  __u8 metadata_type;
-  struct {
-    __u16 x, y;
-  } display_primaries[3];
-  struct {
-    __u16 x, y;
-  } white_point;
-  __u16 max_display_mastering_luminance;
-  __u16 min_display_mastering_luminance;
-  __u16 max_cll;
-  __u16 max_fall;
-};
-struct hdr_output_metadata {
-  __u32 metadata_type;
-  union {
-    struct hdr_metadata_infoframe hdmi_metadata_type1;
-  };
-};
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index 8965f01..b3fd9fd 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -25,12 +25,6 @@
 #define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR"
 #define I915_ERROR_UEVENT "ERROR"
 #define I915_RESET_UEVENT "RESET"
-struct i915_user_extension {
-  __u64 next_extension;
-  __u32 name;
-  __u32 flags;
-  __u32 rsvd[4];
-};
 enum i915_mocs_table_index {
   I915_MOCS_UNCACHED,
   I915_MOCS_PTE,
@@ -43,12 +37,6 @@
   I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
   I915_ENGINE_CLASS_INVALID = - 1
 };
-struct i915_engine_class_instance {
-  __u16 engine_class;
-  __u16 engine_instance;
-#define I915_ENGINE_CLASS_INVALID_NONE - 1
-#define I915_ENGINE_CLASS_INVALID_VIRTUAL - 2
-};
 enum drm_i915_pmu_engine_sample {
   I915_SAMPLE_BUSY = 0,
   I915_SAMPLE_WAIT = 1,
@@ -214,8 +202,6 @@
 #define DRM_I915_PERF_ADD_CONFIG 0x37
 #define DRM_I915_PERF_REMOVE_CONFIG 0x38
 #define DRM_I915_QUERY 0x39
-#define DRM_I915_GEM_VM_CREATE 0x3a
-#define DRM_I915_GEM_VM_DESTROY 0x3b
 #define DRM_IOCTL_I915_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLUSH)
 #define DRM_IOCTL_I915_FLIP DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLIP)
@@ -263,7 +249,6 @@
 #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
 #define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
 #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
-#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext)
 #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
 #define DRM_IOCTL_I915_REG_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
 #define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
@@ -274,8 +259,6 @@
 #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
 #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
 #define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
-#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
-#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
 typedef struct drm_i915_batchbuffer {
   int start;
   int used;
@@ -345,7 +328,6 @@
 #define I915_SCHEDULER_CAP_ENABLED (1ul << 0)
 #define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
 #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
-#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
 #define I915_PARAM_HUC_STATUS 42
 #define I915_PARAM_HAS_EXEC_ASYNC 43
 #define I915_PARAM_HAS_EXEC_FENCE 44
@@ -357,7 +339,6 @@
 #define I915_PARAM_HAS_CONTEXT_ISOLATION 50
 #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
 #define I915_PARAM_MMAP_GTT_COHERENT 52
-#define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
 typedef struct drm_i915_getparam {
   __s32 param;
   int __user * value;
@@ -518,7 +499,7 @@
   __u32 DR4;
   __u32 num_cliprects;
   __u64 cliprects_ptr;
-#define I915_EXEC_RING_MASK (0x3f)
+#define I915_EXEC_RING_MASK (7 << 0)
 #define I915_EXEC_DEFAULT (0 << 0)
 #define I915_EXEC_RENDER (1 << 0)
 #define I915_EXEC_BSD (2 << 0)
@@ -547,8 +528,7 @@
 #define I915_EXEC_FENCE_OUT (1 << 17)
 #define I915_EXEC_BATCH_FIRST (1 << 18)
 #define I915_EXEC_FENCE_ARRAY (1 << 19)
-#define I915_EXEC_FENCE_SUBMIT (1 << 20)
-#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SUBMIT << 1))
+#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_ARRAY << 1))
 #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2,context) (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
 #define i915_execbuffer2_get_context_id(eb2) ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
@@ -685,100 +665,10 @@
   __u32 ctx_id;
   __u32 pad;
 };
-struct drm_i915_gem_context_create_ext {
-  __u32 ctx_id;
-  __u32 flags;
-#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0)
-#define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1)
-#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN (- (I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1))
-  __u64 extensions;
-};
-struct drm_i915_gem_context_param {
-  __u32 ctx_id;
-  __u32 size;
-  __u64 param;
-#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
-#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
-#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
-#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4
-#define I915_CONTEXT_PARAM_BANNABLE 0x5
-#define I915_CONTEXT_PARAM_PRIORITY 0x6
-#define I915_CONTEXT_MAX_USER_PRIORITY 1023
-#define I915_CONTEXT_DEFAULT_PRIORITY 0
-#define I915_CONTEXT_MIN_USER_PRIORITY - 1023
-#define I915_CONTEXT_PARAM_SSEU 0x7
-#define I915_CONTEXT_PARAM_RECOVERABLE 0x8
-#define I915_CONTEXT_PARAM_VM 0x9
-#define I915_CONTEXT_PARAM_ENGINES 0xa
-  __u64 value;
-};
-struct drm_i915_gem_context_param_sseu {
-  struct i915_engine_class_instance engine;
-  __u32 flags;
-#define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0)
-  __u64 slice_mask;
-  __u64 subslice_mask;
-  __u16 min_eus_per_subslice;
-  __u16 max_eus_per_subslice;
-  __u32 rsvd;
-};
-struct i915_context_engines_load_balance {
-  struct i915_user_extension base;
-  __u16 engine_index;
-  __u16 num_siblings;
-  __u32 flags;
-  __u64 mbz64;
-  struct i915_engine_class_instance engines[0];
-} __attribute__((packed));
-#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 num_siblings; __u32 flags; __u64 mbz64; struct i915_engine_class_instance engines[N__]; \
-} __attribute__((packed)) name__
-struct i915_context_engines_bond {
-  struct i915_user_extension base;
-  struct i915_engine_class_instance master;
-  __u16 virtual_index;
-  __u16 num_bonds;
-  __u64 flags;
-  __u64 mbz64[4];
-  struct i915_engine_class_instance engines[0];
-} __attribute__((packed));
-#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__,N__) struct { struct i915_user_extension base; struct i915_engine_class_instance master; __u16 virtual_index; __u16 num_bonds; __u64 flags; __u64 mbz64[4]; struct i915_engine_class_instance engines[N__]; \
-} __attribute__((packed)) name__
-struct i915_context_param_engines {
-  __u64 extensions;
-#define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0
-#define I915_CONTEXT_ENGINES_EXT_BOND 1
-  struct i915_engine_class_instance engines[0];
-} __attribute__((packed));
-#define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__,N__) struct { __u64 extensions; struct i915_engine_class_instance engines[N__]; \
-} __attribute__((packed)) name__
-struct drm_i915_gem_context_create_ext_setparam {
-#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
-  struct i915_user_extension base;
-  struct drm_i915_gem_context_param param;
-};
-struct drm_i915_gem_context_create_ext_clone {
-#define I915_CONTEXT_CREATE_EXT_CLONE 1
-  struct i915_user_extension base;
-  __u32 clone_id;
-  __u32 flags;
-#define I915_CONTEXT_CLONE_ENGINES (1u << 0)
-#define I915_CONTEXT_CLONE_FLAGS (1u << 1)
-#define I915_CONTEXT_CLONE_SCHEDATTR (1u << 2)
-#define I915_CONTEXT_CLONE_SSEU (1u << 3)
-#define I915_CONTEXT_CLONE_TIMELINE (1u << 4)
-#define I915_CONTEXT_CLONE_VM (1u << 5)
-#define I915_CONTEXT_CLONE_UNKNOWN - (I915_CONTEXT_CLONE_VM << 1)
-  __u64 rsvd;
-};
 struct drm_i915_gem_context_destroy {
   __u32 ctx_id;
   __u32 pad;
 };
-struct drm_i915_gem_vm_control {
-  __u64 extensions;
-  __u32 flags;
-  __u32 vm_id;
-};
 struct drm_i915_reg_read {
   __u64 offset;
 #define I915_REG_READ_8B_WA (1ul << 0)
@@ -800,6 +690,21 @@
 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000
   __u32 handle;
 };
+struct drm_i915_gem_context_param {
+  __u32 ctx_id;
+  __u32 size;
+  __u64 param;
+#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
+#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
+#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
+#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4
+#define I915_CONTEXT_PARAM_BANNABLE 0x5
+#define I915_CONTEXT_PARAM_PRIORITY 0x6
+#define I915_CONTEXT_MAX_USER_PRIORITY 1023
+#define I915_CONTEXT_DEFAULT_PRIORITY 0
+#define I915_CONTEXT_MIN_USER_PRIORITY - 1023
+  __u64 value;
+};
 enum drm_i915_oa_format {
   I915_OA_FORMAT_A13 = 1,
   I915_OA_FORMAT_A29,
@@ -854,7 +759,6 @@
 struct drm_i915_query_item {
   __u64 query_id;
 #define DRM_I915_QUERY_TOPOLOGY_INFO 1
-#define DRM_I915_QUERY_ENGINE_INFO 2
   __s32 length;
   __u32 flags;
   __u64 data_ptr;
@@ -875,20 +779,6 @@
   __u16 eu_stride;
   __u8 data[];
 };
-struct drm_i915_engine_info {
-  struct i915_engine_class_instance engine;
-  __u32 rsvd0;
-  __u64 flags;
-  __u64 capabilities;
-#define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0)
-#define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1)
-  __u64 rsvd1[4];
-};
-struct drm_i915_query_engine_info {
-  __u32 num_engines;
-  __u32 rsvd[3];
-  struct drm_i915_engine_info engines[];
-};
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/drm/lima_drm.h b/libc/kernel/uapi/drm/lima_drm.h
deleted file mode 100644
index bb70cf7..0000000
--- a/libc/kernel/uapi/drm/lima_drm.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __LIMA_DRM_H__
-#define __LIMA_DRM_H__
-#include "drm.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-enum drm_lima_param_gpu_id {
-  DRM_LIMA_PARAM_GPU_ID_UNKNOWN,
-  DRM_LIMA_PARAM_GPU_ID_MALI400,
-  DRM_LIMA_PARAM_GPU_ID_MALI450,
-};
-enum drm_lima_param {
-  DRM_LIMA_PARAM_GPU_ID,
-  DRM_LIMA_PARAM_NUM_PP,
-  DRM_LIMA_PARAM_GP_VERSION,
-  DRM_LIMA_PARAM_PP_VERSION,
-};
-struct drm_lima_get_param {
-  __u32 param;
-  __u32 pad;
-  __u64 value;
-};
-struct drm_lima_gem_create {
-  __u32 size;
-  __u32 flags;
-  __u32 handle;
-  __u32 pad;
-};
-struct drm_lima_gem_info {
-  __u32 handle;
-  __u32 va;
-  __u64 offset;
-};
-#define LIMA_SUBMIT_BO_READ 0x01
-#define LIMA_SUBMIT_BO_WRITE 0x02
-struct drm_lima_gem_submit_bo {
-  __u32 handle;
-  __u32 flags;
-};
-#define LIMA_GP_FRAME_REG_NUM 6
-struct drm_lima_gp_frame {
-  __u32 frame[LIMA_GP_FRAME_REG_NUM];
-};
-#define LIMA_PP_FRAME_REG_NUM 23
-#define LIMA_PP_WB_REG_NUM 12
-struct drm_lima_m400_pp_frame {
-  __u32 frame[LIMA_PP_FRAME_REG_NUM];
-  __u32 num_pp;
-  __u32 wb[3 * LIMA_PP_WB_REG_NUM];
-  __u32 plbu_array_address[4];
-  __u32 fragment_stack_address[4];
-};
-struct drm_lima_m450_pp_frame {
-  __u32 frame[LIMA_PP_FRAME_REG_NUM];
-  __u32 num_pp;
-  __u32 wb[3 * LIMA_PP_WB_REG_NUM];
-  __u32 use_dlbu;
-  __u32 _pad;
-  union {
-    __u32 plbu_array_address[8];
-    __u32 dlbu_regs[4];
-  };
-  __u32 fragment_stack_address[8];
-};
-#define LIMA_PIPE_GP 0x00
-#define LIMA_PIPE_PP 0x01
-#define LIMA_SUBMIT_FLAG_EXPLICIT_FENCE (1 << 0)
-struct drm_lima_gem_submit {
-  __u32 ctx;
-  __u32 pipe;
-  __u32 nr_bos;
-  __u32 frame_size;
-  __u64 bos;
-  __u64 frame;
-  __u32 flags;
-  __u32 out_sync;
-  __u32 in_sync[2];
-};
-#define LIMA_GEM_WAIT_READ 0x01
-#define LIMA_GEM_WAIT_WRITE 0x02
-struct drm_lima_gem_wait {
-  __u32 handle;
-  __u32 op;
-  __s64 timeout_ns;
-};
-struct drm_lima_ctx_create {
-  __u32 id;
-  __u32 _pad;
-};
-struct drm_lima_ctx_free {
-  __u32 id;
-  __u32 _pad;
-};
-#define DRM_LIMA_GET_PARAM 0x00
-#define DRM_LIMA_GEM_CREATE 0x01
-#define DRM_LIMA_GEM_INFO 0x02
-#define DRM_LIMA_GEM_SUBMIT 0x03
-#define DRM_LIMA_GEM_WAIT 0x04
-#define DRM_LIMA_CTX_CREATE 0x05
-#define DRM_LIMA_CTX_FREE 0x06
-#define DRM_IOCTL_LIMA_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GET_PARAM, struct drm_lima_get_param)
-#define DRM_IOCTL_LIMA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GEM_CREATE, struct drm_lima_gem_create)
-#define DRM_IOCTL_LIMA_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GEM_INFO, struct drm_lima_gem_info)
-#define DRM_IOCTL_LIMA_GEM_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_GEM_SUBMIT, struct drm_lima_gem_submit)
-#define DRM_IOCTL_LIMA_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_GEM_WAIT, struct drm_lima_gem_wait)
-#define DRM_IOCTL_LIMA_CTX_CREATE DRM_IOR(DRM_COMMAND_BASE + DRM_LIMA_CTX_CREATE, struct drm_lima_ctx_create)
-#define DRM_IOCTL_LIMA_CTX_FREE DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_CTX_FREE, struct drm_lima_ctx_free)
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libc/kernel/uapi/drm/msm_drm.h b/libc/kernel/uapi/drm/msm_drm.h
index 3c1b734..f6bee3e 100644
--- a/libc/kernel/uapi/drm/msm_drm.h
+++ b/libc/kernel/uapi/drm/msm_drm.h
@@ -40,8 +40,6 @@
 #define MSM_PARAM_TIMESTAMP 0x05
 #define MSM_PARAM_GMEM_BASE 0x06
 #define MSM_PARAM_NR_RINGS 0x07
-#define MSM_PARAM_PP_PGTABLE 0x08
-#define MSM_PARAM_FAULTS 0x09
 struct drm_msm_param {
   __u32 pipe;
   __u32 param;
@@ -145,14 +143,6 @@
   __u32 prio;
   __u32 id;
 };
-#define MSM_SUBMITQUEUE_PARAM_FAULTS 0
-struct drm_msm_submitqueue_query {
-  __u64 data;
-  __u32 id;
-  __u32 param;
-  __u32 len;
-  __u32 pad;
-};
 #define DRM_MSM_GET_PARAM 0x00
 #define DRM_MSM_GEM_NEW 0x02
 #define DRM_MSM_GEM_INFO 0x03
@@ -163,7 +153,6 @@
 #define DRM_MSM_GEM_MADVISE 0x08
 #define DRM_MSM_SUBMITQUEUE_NEW 0x0A
 #define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B
-#define DRM_MSM_SUBMITQUEUE_QUERY 0x0C
 #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
 #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
 #define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info)
@@ -174,7 +163,6 @@
 #define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise)
 #define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue)
 #define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32)
-#define DRM_IOCTL_MSM_SUBMITQUEUE_QUERY DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_QUERY, struct drm_msm_submitqueue_query)
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/drm/nouveau_drm.h b/libc/kernel/uapi/drm/nouveau_drm.h
index 186ffcc..54c3b97 100644
--- a/libc/kernel/uapi/drm/nouveau_drm.h
+++ b/libc/kernel/uapi/drm/nouveau_drm.h
@@ -112,42 +112,11 @@
 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05
 #define DRM_NOUVEAU_GPUOBJ_FREE 0x06
 #define DRM_NOUVEAU_NVIF 0x07
-#define DRM_NOUVEAU_SVM_INIT 0x08
-#define DRM_NOUVEAU_SVM_BIND 0x09
 #define DRM_NOUVEAU_GEM_NEW 0x40
 #define DRM_NOUVEAU_GEM_PUSHBUF 0x41
 #define DRM_NOUVEAU_GEM_CPU_PREP 0x42
 #define DRM_NOUVEAU_GEM_CPU_FINI 0x43
 #define DRM_NOUVEAU_GEM_INFO 0x44
-struct drm_nouveau_svm_init {
-  __u64 unmanaged_addr;
-  __u64 unmanaged_size;
-};
-struct drm_nouveau_svm_bind {
-  __u64 header;
-  __u64 va_start;
-  __u64 va_end;
-  __u64 npages;
-  __u64 stride;
-  __u64 result;
-  __u64 reserved0;
-  __u64 reserved1;
-};
-#define NOUVEAU_SVM_BIND_COMMAND_SHIFT 0
-#define NOUVEAU_SVM_BIND_COMMAND_BITS 8
-#define NOUVEAU_SVM_BIND_COMMAND_MASK ((1 << 8) - 1)
-#define NOUVEAU_SVM_BIND_PRIORITY_SHIFT 8
-#define NOUVEAU_SVM_BIND_PRIORITY_BITS 8
-#define NOUVEAU_SVM_BIND_PRIORITY_MASK ((1 << 8) - 1)
-#define NOUVEAU_SVM_BIND_TARGET_SHIFT 16
-#define NOUVEAU_SVM_BIND_TARGET_BITS 32
-#define NOUVEAU_SVM_BIND_TARGET_MASK 0xffffffff
-#define NOUVEAU_SVM_BIND_VALID_BITS 48
-#define NOUVEAU_SVM_BIND_VALID_MASK ((1ULL << NOUVEAU_SVM_BIND_VALID_BITS) - 1)
-#define NOUVEAU_SVM_BIND_COMMAND__MIGRATE 0
-#define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM (1UL << 31)
-#define DRM_IOCTL_NOUVEAU_SVM_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init)
-#define DRM_IOCTL_NOUVEAU_SVM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind)
 #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
 #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
 #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
diff --git a/libc/kernel/uapi/drm/panfrost_drm.h b/libc/kernel/uapi/drm/panfrost_drm.h
deleted file mode 100644
index 4da1447..0000000
--- a/libc/kernel/uapi/drm/panfrost_drm.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _PANFROST_DRM_H_
-#define _PANFROST_DRM_H_
-#include "drm.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define DRM_PANFROST_SUBMIT 0x00
-#define DRM_PANFROST_WAIT_BO 0x01
-#define DRM_PANFROST_CREATE_BO 0x02
-#define DRM_PANFROST_MMAP_BO 0x03
-#define DRM_PANFROST_GET_PARAM 0x04
-#define DRM_PANFROST_GET_BO_OFFSET 0x05
-#define DRM_PANFROST_PERFCNT_ENABLE 0x06
-#define DRM_PANFROST_PERFCNT_DUMP 0x07
-#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
-#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
-#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo)
-#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo)
-#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
-#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
-#define DRM_IOCTL_PANFROST_PERFCNT_ENABLE DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable)
-#define DRM_IOCTL_PANFROST_PERFCNT_DUMP DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump)
-#define PANFROST_JD_REQ_FS (1 << 0)
-struct drm_panfrost_submit {
-  __u64 jc;
-  __u64 in_syncs;
-  __u32 in_sync_count;
-  __u32 out_sync;
-  __u64 bo_handles;
-  __u32 bo_handle_count;
-  __u32 requirements;
-};
-struct drm_panfrost_wait_bo {
-  __u32 handle;
-  __u32 pad;
-  __s64 timeout_ns;
-};
-struct drm_panfrost_create_bo {
-  __u32 size;
-  __u32 flags;
-  __u32 handle;
-  __u32 pad;
-  __u64 offset;
-};
-struct drm_panfrost_mmap_bo {
-  __u32 handle;
-  __u32 flags;
-  __u64 offset;
-};
-enum drm_panfrost_param {
-  DRM_PANFROST_PARAM_GPU_PROD_ID,
-};
-struct drm_panfrost_get_param {
-  __u32 param;
-  __u32 pad;
-  __u64 value;
-};
-struct drm_panfrost_get_bo_offset {
-  __u32 handle;
-  __u32 pad;
-  __u64 offset;
-};
-struct drm_panfrost_perfcnt_enable {
-  __u32 enable;
-  __u32 counterset;
-};
-struct drm_panfrost_perfcnt_dump {
-  __u64 buf_ptr;
-};
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libc/kernel/uapi/drm/v3d_drm.h b/libc/kernel/uapi/drm/v3d_drm.h
index 0b6b94f..985f327 100644
--- a/libc/kernel/uapi/drm/v3d_drm.h
+++ b/libc/kernel/uapi/drm/v3d_drm.h
@@ -29,7 +29,6 @@
 #define DRM_V3D_GET_PARAM 0x04
 #define DRM_V3D_GET_BO_OFFSET 0x05
 #define DRM_V3D_SUBMIT_TFU 0x06
-#define DRM_V3D_SUBMIT_CSD 0x07
 #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
 #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
 #define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)
@@ -37,7 +36,6 @@
 #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)
 #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
 #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
-#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
 struct drm_v3d_submit_cl {
   __u32 bcl_start;
   __u32 bcl_end;
@@ -78,7 +76,6 @@
   DRM_V3D_PARAM_V3D_CORE0_IDENT1,
   DRM_V3D_PARAM_V3D_CORE0_IDENT2,
   DRM_V3D_PARAM_SUPPORTS_TFU,
-  DRM_V3D_PARAM_SUPPORTS_CSD,
 };
 struct drm_v3d_get_param {
   __u32 param;
@@ -102,14 +99,6 @@
   __u32 in_sync;
   __u32 out_sync;
 };
-struct drm_v3d_submit_csd {
-  __u32 cfg[7];
-  __u32 coef[4];
-  __u64 bo_handles;
-  __u32 bo_handle_count;
-  __u32 in_sync;
-  __u32 out_sync;
-};
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/linux/adfs_fs.h b/libc/kernel/uapi/linux/adfs_fs.h
index aa1d732..6fb9347 100644
--- a/libc/kernel/uapi/linux/adfs_fs.h
+++ b/libc/kernel/uapi/linux/adfs_fs.h
@@ -41,13 +41,12 @@
   __u8 log2sharesize : 4;
   __u8 unused40 : 4;
   __u8 big_flag : 1;
-  __u8 unused41 : 7;
+  __u8 unused41 : 1;
   __u8 nzones_high;
-  __u8 reserved43;
   __le32 format_version;
   __le32 root_size;
   __u8 unused52[60 - 52];
-} __attribute__((packed, aligned(4)));
+};
 #define ADFS_DISCRECORD (0xc00)
 #define ADFS_DR_OFFSET (0x1c0)
 #define ADFS_DR_SIZE 60
diff --git a/libc/kernel/uapi/linux/aspeed-p2a-ctrl.h b/libc/kernel/uapi/linux/aspeed-p2a-ctrl.h
deleted file mode 100644
index 94e5132..0000000
--- a/libc/kernel/uapi/linux/aspeed-p2a-ctrl.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_ASPEED_P2A_CTRL_H
-#define _UAPI_LINUX_ASPEED_P2A_CTRL_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#define ASPEED_P2A_CTRL_READ_ONLY 0
-#define ASPEED_P2A_CTRL_READWRITE 1
-struct aspeed_p2a_ctrl_mapping {
-  __u64 addr;
-  __u32 length;
-  __u32 flags;
-};
-#define __ASPEED_P2A_CTRL_IOCTL_MAGIC 0xb3
-#define ASPEED_P2A_CTRL_IOCTL_SET_WINDOW _IOW(__ASPEED_P2A_CTRL_IOCTL_MAGIC, 0x00, struct aspeed_p2a_ctrl_mapping)
-#define ASPEED_P2A_CTRL_IOCTL_GET_MEMORY_CONFIG _IOWR(__ASPEED_P2A_CTRL_IOCTL_MAGIC, 0x01, struct aspeed_p2a_ctrl_mapping)
-#endif
diff --git a/libc/kernel/uapi/linux/audit.h b/libc/kernel/uapi/linux/audit.h
index 3f1d8f0..0698fc8 100644
--- a/libc/kernel/uapi/linux/audit.h
+++ b/libc/kernel/uapi/linux/audit.h
@@ -79,8 +79,6 @@
 #define AUDIT_REPLACE 1329
 #define AUDIT_KERN_MODULE 1330
 #define AUDIT_FANOTIFY 1331
-#define AUDIT_TIME_INJOFFSET 1332
-#define AUDIT_TIME_ADJNTPVAL 1333
 #define AUDIT_AVC 1400
 #define AUDIT_SELINUX_ERR 1401
 #define AUDIT_AVC_PATH 1402
@@ -211,7 +209,6 @@
 #define AUDIT_OBJ_GID 110
 #define AUDIT_FIELD_COMPARE 111
 #define AUDIT_EXE 112
-#define AUDIT_SADDR_FAM 113
 #define AUDIT_ARG0 200
 #define AUDIT_ARG1 (AUDIT_ARG0 + 1)
 #define AUDIT_ARG2 (AUDIT_ARG0 + 2)
@@ -265,19 +262,11 @@
 #define __AUDIT_ARCH_LE 0x40000000
 #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_ALPHA (EM_ALPHA | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_ARCOMPACT (EM_ARCOMPACT | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_ARCOMPACTBE (EM_ARCOMPACT)
-#define AUDIT_ARCH_ARCV2 (EM_ARCV2 | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_ARCV2BE (EM_ARCV2)
 #define AUDIT_ARCH_ARM (EM_ARM | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_ARMEB (EM_ARM)
-#define AUDIT_ARCH_C6X (EM_TI_C6000 | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_C6XBE (EM_TI_C6000)
 #define AUDIT_ARCH_CRIS (EM_CRIS | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_CSKY (EM_CSKY | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV (EM_FRV)
-#define AUDIT_ARCH_H8300 (EM_H8_300)
-#define AUDIT_ARCH_HEXAGON (EM_HEXAGON)
 #define AUDIT_ARCH_I386 (EM_386 | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64 (EM_IA_64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R (EM_M32R)
@@ -289,9 +278,6 @@
 #define AUDIT_ARCH_MIPS64N32 (EM_MIPS | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_CONVENTION_MIPS64_N32)
 #define AUDIT_ARCH_MIPSEL64 (EM_MIPS | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE | __AUDIT_ARCH_CONVENTION_MIPS64_N32)
-#define AUDIT_ARCH_NDS32 (EM_NDS32 | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_NDS32BE (EM_NDS32)
-#define AUDIT_ARCH_NIOS2 (EM_ALTERA_NIOS2 | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
 #define AUDIT_ARCH_PARISC (EM_PARISC)
 #define AUDIT_ARCH_PARISC64 (EM_PARISC | __AUDIT_ARCH_64BIT)
@@ -311,7 +297,6 @@
 #define AUDIT_ARCH_TILEGX (EM_TILEGX | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEGX32 (EM_TILEGX | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEPRO (EM_TILEPRO | __AUDIT_ARCH_LE)
-#define AUDIT_ARCH_UNICORE (EM_UNICORE | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_X86_64 (EM_X86_64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
 #define AUDIT_ARCH_XTENSA (EM_XTENSA)
 #define AUDIT_PERM_EXEC 1
diff --git a/libc/kernel/uapi/linux/auto_fs.h b/libc/kernel/uapi/linux/auto_fs.h
index 39d1ac8..9a9dd65 100644
--- a/libc/kernel/uapi/linux/auto_fs.h
+++ b/libc/kernel/uapi/linux/auto_fs.h
@@ -24,7 +24,7 @@
 #define AUTOFS_PROTO_VERSION 5
 #define AUTOFS_MIN_PROTO_VERSION 3
 #define AUTOFS_MAX_PROTO_VERSION 5
-#define AUTOFS_PROTO_SUBVERSION 5
+#define AUTOFS_PROTO_SUBVERSION 4
 #if defined(__ia64__) || defined(__alpha__)
 typedef unsigned long autofs_wqt_t;
 #else
diff --git a/libc/kernel/uapi/linux/batadv_packet.h b/libc/kernel/uapi/linux/batadv_packet.h
index ede53cf..6d5226c 100644
--- a/libc/kernel/uapi/linux/batadv_packet.h
+++ b/libc/kernel/uapi/linux/batadv_packet.h
@@ -60,8 +60,6 @@
   BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
   BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
   BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
-  BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
-  BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
 };
 #define BATADV_TT_DATA_TYPE_MASK 0x0F
 enum batadv_tt_data_flags {
diff --git a/libc/kernel/uapi/linux/batman_adv.h b/libc/kernel/uapi/linux/batman_adv.h
index 96b259b..efec2bb 100644
--- a/libc/kernel/uapi/linux/batman_adv.h
+++ b/libc/kernel/uapi/linux/batman_adv.h
@@ -19,7 +19,6 @@
 #ifndef _UAPI_LINUX_BATMAN_ADV_H_
 #define _UAPI_LINUX_BATMAN_ADV_H_
 #define BATADV_NL_NAME "batadv"
-#define BATADV_NL_MCAST_GROUP_CONFIG "config"
 #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
 enum batadv_tt_client_flags {
   BATADV_TT_CLIENT_DEL = (1 << 0),
@@ -38,11 +37,6 @@
   BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),
   BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),
 };
-enum batadv_gw_modes {
-  BATADV_GW_MODE_OFF,
-  BATADV_GW_MODE_CLIENT,
-  BATADV_GW_MODE_SERVER,
-};
 enum batadv_nl_attrs {
   BATADV_ATTR_UNSPEC,
   BATADV_ATTR_VERSION,
@@ -84,40 +78,17 @@
   BATADV_ATTR_DAT_CACHE_VID,
   BATADV_ATTR_MCAST_FLAGS,
   BATADV_ATTR_MCAST_FLAGS_PRIV,
-  BATADV_ATTR_VLANID,
-  BATADV_ATTR_AGGREGATED_OGMS_ENABLED,
-  BATADV_ATTR_AP_ISOLATION_ENABLED,
-  BATADV_ATTR_ISOLATION_MARK,
-  BATADV_ATTR_ISOLATION_MASK,
-  BATADV_ATTR_BONDING_ENABLED,
-  BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED,
-  BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED,
-  BATADV_ATTR_FRAGMENTATION_ENABLED,
-  BATADV_ATTR_GW_BANDWIDTH_DOWN,
-  BATADV_ATTR_GW_BANDWIDTH_UP,
-  BATADV_ATTR_GW_MODE,
-  BATADV_ATTR_GW_SEL_CLASS,
-  BATADV_ATTR_HOP_PENALTY,
-  BATADV_ATTR_LOG_LEVEL,
-  BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED,
-  BATADV_ATTR_NETWORK_CODING_ENABLED,
-  BATADV_ATTR_ORIG_INTERVAL,
-  BATADV_ATTR_ELP_INTERVAL,
-  BATADV_ATTR_THROUGHPUT_OVERRIDE,
-  BATADV_ATTR_MULTICAST_FANOUT,
   __BATADV_ATTR_AFTER_LAST,
   NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
   BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
 };
 enum batadv_nl_commands {
   BATADV_CMD_UNSPEC,
-  BATADV_CMD_GET_MESH,
-  BATADV_CMD_GET_MESH_INFO = BATADV_CMD_GET_MESH,
+  BATADV_CMD_GET_MESH_INFO,
   BATADV_CMD_TP_METER,
   BATADV_CMD_TP_METER_CANCEL,
   BATADV_CMD_GET_ROUTING_ALGOS,
-  BATADV_CMD_GET_HARDIF,
-  BATADV_CMD_GET_HARDIFS = BATADV_CMD_GET_HARDIF,
+  BATADV_CMD_GET_HARDIFS,
   BATADV_CMD_GET_TRANSTABLE_LOCAL,
   BATADV_CMD_GET_TRANSTABLE_GLOBAL,
   BATADV_CMD_GET_ORIGINATORS,
@@ -127,10 +98,6 @@
   BATADV_CMD_GET_BLA_BACKBONE,
   BATADV_CMD_GET_DAT_CACHE,
   BATADV_CMD_GET_MCAST_FLAGS,
-  BATADV_CMD_SET_MESH,
-  BATADV_CMD_SET_HARDIF,
-  BATADV_CMD_GET_VLAN,
-  BATADV_CMD_SET_VLAN,
   __BATADV_CMD_AFTER_LAST,
   BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
 };
diff --git a/libc/kernel/uapi/linux/binfmts.h b/libc/kernel/uapi/linux/binfmts.h
index 8c4fed0..729008e 100644
--- a/libc/kernel/uapi/linux/binfmts.h
+++ b/libc/kernel/uapi/linux/binfmts.h
@@ -22,5 +22,5 @@
 struct pt_regs;
 #define MAX_ARG_STRLEN (PAGE_SIZE * 32)
 #define MAX_ARG_STRINGS 0x7FFFFFFF
-#define BINPRM_BUF_SIZE 256
+#define BINPRM_BUF_SIZE 128
 #endif
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index 7e78758..894b9f7 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -20,7 +20,6 @@
 #define _UAPI__LINUX_BPF_H__
 #include <linux/types.h>
 #include <linux/bpf_common.h>
-#define BPF_JMP32 0x06
 #define BPF_ALU64 0x07
 #define BPF_DW 0x18
 #define BPF_XADD 0xc0
@@ -93,7 +92,6 @@
   BPF_BTF_GET_FD_BY_ID,
   BPF_TASK_FD_QUERY,
   BPF_MAP_LOOKUP_AND_DELETE_ELEM,
-  BPF_MAP_FREEZE,
 };
 enum bpf_map_type {
   BPF_MAP_TYPE_UNSPEC,
@@ -120,7 +118,6 @@
   BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
   BPF_MAP_TYPE_QUEUE,
   BPF_MAP_TYPE_STACK,
-  BPF_MAP_TYPE_SK_STORAGE,
 };
 enum bpf_prog_type {
   BPF_PROG_TYPE_UNSPEC,
@@ -146,9 +143,6 @@
   BPF_PROG_TYPE_LIRC_MODE2,
   BPF_PROG_TYPE_SK_REUSEPORT,
   BPF_PROG_TYPE_FLOW_DISSECTOR,
-  BPF_PROG_TYPE_CGROUP_SYSCTL,
-  BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
-  BPF_PROG_TYPE_CGROUP_SOCKOPT,
 };
 enum bpf_attach_type {
   BPF_CGROUP_INET_INGRESS,
@@ -169,11 +163,6 @@
   BPF_CGROUP_UDP6_SENDMSG,
   BPF_LIRC_MODE2,
   BPF_FLOW_DISSECTOR,
-  BPF_CGROUP_SYSCTL,
-  BPF_CGROUP_UDP4_RECVMSG,
-  BPF_CGROUP_UDP6_RECVMSG,
-  BPF_CGROUP_GETSOCKOPT,
-  BPF_CGROUP_SETSOCKOPT,
   __MAX_BPF_ATTACH_TYPE
 };
 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
@@ -181,14 +170,11 @@
 #define BPF_F_ALLOW_MULTI (1U << 1)
 #define BPF_F_STRICT_ALIGNMENT (1U << 0)
 #define BPF_F_ANY_ALIGNMENT (1U << 1)
-#define BPF_F_TEST_RND_HI32 (1U << 2)
 #define BPF_PSEUDO_MAP_FD 1
-#define BPF_PSEUDO_MAP_VALUE 2
 #define BPF_PSEUDO_CALL 1
 #define BPF_ANY 0
 #define BPF_NOEXIST 1
 #define BPF_EXIST 2
-#define BPF_F_LOCK 4
 #define BPF_F_NO_PREALLOC (1U << 0)
 #define BPF_F_NO_COMMON_LRU (1U << 1)
 #define BPF_F_NUMA_NODE (1U << 2)
@@ -197,8 +183,6 @@
 #define BPF_F_WRONLY (1U << 4)
 #define BPF_F_STACK_BUILD_ID (1U << 5)
 #define BPF_F_ZERO_SEED (1U << 6)
-#define BPF_F_RDONLY_PROG (1U << 7)
-#define BPF_F_WRONLY_PROG (1U << 8)
 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
 enum bpf_stack_build_id_status {
   BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -279,10 +263,6 @@
     __aligned_u64 data_out;
     __u32 repeat;
     __u32 duration;
-    __u32 ctx_size_in;
-    __u32 ctx_size_out;
-    __aligned_u64 ctx_in;
-    __aligned_u64 ctx_out;
   } test;
   struct {
     union {
@@ -330,7 +310,7 @@
     __u64 probe_addr;
   } task_fd_query;
 } __attribute__((aligned(8)));
-#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal),
+#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel),
 #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
 enum bpf_func_id {
   __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
@@ -356,19 +336,8 @@
 #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
 #define BPF_F_CTXLEN_MASK (0xfffffULL << 32)
 #define BPF_F_CURRENT_NETNS (- 1L)
-#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)
-#define BPF_ADJ_ROOM_ENCAP_L2_MASK 0xff
-#define BPF_ADJ_ROOM_ENCAP_L2_SHIFT 56
-#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1)
-#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2)
-#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3)
-#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4)
-#define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64) len & BPF_ADJ_ROOM_ENCAP_L2_MASK) << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
-#define BPF_F_SYSCTL_BASE_NAME (1ULL << 0)
-#define BPF_SK_STORAGE_GET_F_CREATE (1ULL << 0)
 enum bpf_adj_room_mode {
   BPF_ADJ_ROOM_NET,
-  BPF_ADJ_ROOM_MAC,
 };
 enum bpf_hdr_start_off {
   BPF_HDR_START_MAC,
@@ -376,8 +345,7 @@
 };
 enum bpf_lwt_encap_mode {
   BPF_LWT_ENCAP_SEG6,
-  BPF_LWT_ENCAP_SEG6_INLINE,
-  BPF_LWT_ENCAP_IP,
+  BPF_LWT_ENCAP_SEG6_INLINE
 };
 #define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \
 } __attribute__((aligned(8)))
@@ -411,8 +379,6 @@
   __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
   __u64 tstamp;
   __u32 wire_len;
-  __u32 gso_segs;
-  __bpf_md_ptr(struct bpf_sock *, sk);
 };
 struct bpf_tunnel_key {
   __u32 tunnel_id;
@@ -439,7 +405,6 @@
   BPF_OK = 0,
   BPF_DROP = 2,
   BPF_REDIRECT = 7,
-  BPF_LWT_REROUTE = 128,
 };
 struct bpf_sock {
   __u32 bound_dev_if;
@@ -451,38 +416,6 @@
   __u32 src_ip4;
   __u32 src_ip6[4];
   __u32 src_port;
-  __u32 dst_port;
-  __u32 dst_ip4;
-  __u32 dst_ip6[4];
-  __u32 state;
-};
-struct bpf_tcp_sock {
-  __u32 snd_cwnd;
-  __u32 srtt_us;
-  __u32 rtt_min;
-  __u32 snd_ssthresh;
-  __u32 rcv_nxt;
-  __u32 snd_nxt;
-  __u32 snd_una;
-  __u32 mss_cache;
-  __u32 ecn_flags;
-  __u32 rate_delivered;
-  __u32 rate_interval_us;
-  __u32 packets_out;
-  __u32 retrans_out;
-  __u32 total_retrans;
-  __u32 segs_in;
-  __u32 data_segs_in;
-  __u32 segs_out;
-  __u32 data_segs_out;
-  __u32 lost_out;
-  __u32 sacked_out;
-  __u64 bytes_received;
-  __u64 bytes_acked;
-  __u32 dsack_dups;
-  __u32 delivered;
-  __u32 delivered_ce;
-  __u32 icsk_retransmits;
 };
 struct bpf_sock_tuple {
   union {
@@ -500,9 +433,6 @@
     } ipv6;
   };
 };
-struct bpf_xdp_sock {
-  __u32 queue_id;
-};
 #define XDP_PACKET_HEADROOM 256
 enum xdp_action {
   XDP_ABORTED = 0,
@@ -559,7 +489,6 @@
   char name[BPF_OBJ_NAME_LEN];
   __u32 ifindex;
   __u32 gpl_compatible : 1;
-  __u32 : 31;
   __u64 netns_dev;
   __u64 netns_ino;
   __u32 nr_jited_ksyms;
@@ -578,8 +507,6 @@
   __u32 jited_line_info_rec_size;
   __u32 nr_prog_tags;
   __aligned_u64 prog_tags;
-  __u64 run_time_ns;
-  __u64 run_cnt;
 } __attribute__((aligned(8)));
 struct bpf_map_info {
   __u32 type;
@@ -612,7 +539,6 @@
   __u32 protocol;
   __u32 msg_src_ip4;
   __u32 msg_src_ip6[4];
-  __bpf_md_ptr(struct bpf_sock *, sk);
 };
 struct bpf_sock_ops {
   __u32 op;
@@ -654,13 +580,11 @@
   __u32 sk_txhash;
   __u64 bytes_received;
   __u64 bytes_acked;
-  __bpf_md_ptr(struct bpf_sock *, sk);
 };
 #define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0)
 #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1)
 #define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2)
-#define BPF_SOCK_OPS_RTT_CB_FLAG (1 << 3)
-#define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF
+#define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7
 enum {
   BPF_SOCK_OPS_VOID,
   BPF_SOCK_OPS_TIMEOUT_INIT,
@@ -674,7 +598,6 @@
   BPF_SOCK_OPS_RETRANS_CB,
   BPF_SOCK_OPS_STATE_CB,
   BPF_SOCK_OPS_TCP_LISTEN_CB,
-  BPF_SOCK_OPS_RTT_CB,
 };
 enum {
   BPF_TCP_ESTABLISHED = 1,
@@ -711,8 +634,8 @@
 struct bpf_raw_tracepoint_args {
   __u64 args[0];
 };
-#define BPF_FIB_LOOKUP_DIRECT (1U << 0)
-#define BPF_FIB_LOOKUP_OUTPUT (1U << 1)
+#define BPF_FIB_LOOKUP_DIRECT BIT(0)
+#define BPF_FIB_LOOKUP_OUTPUT BIT(1)
 enum {
   BPF_FIB_LKUP_RET_SUCCESS,
   BPF_FIB_LKUP_RET_BLACKHOLE,
@@ -791,20 +714,4 @@
   __u32 line_off;
   __u32 line_col;
 };
-struct bpf_spin_lock {
-  __u32 val;
-};
-struct bpf_sysctl {
-  __u32 write;
-  __u32 file_pos;
-};
-struct bpf_sockopt {
-  __bpf_md_ptr(struct bpf_sock *, sk);
-  __bpf_md_ptr(void *, optval);
-  __bpf_md_ptr(void *, optval_end);
-  __s32 level;
-  __s32 optname;
-  __s32 optlen;
-  __s32 retval;
-};
 #endif
diff --git a/libc/kernel/uapi/linux/btf.h b/libc/kernel/uapi/linux/btf.h
index 475e2eb..6e13631 100644
--- a/libc/kernel/uapi/linux/btf.h
+++ b/libc/kernel/uapi/linux/btf.h
@@ -59,12 +59,10 @@
 #define BTF_KIND_RESTRICT 11
 #define BTF_KIND_FUNC 12
 #define BTF_KIND_FUNC_PROTO 13
-#define BTF_KIND_VAR 14
-#define BTF_KIND_DATASEC 15
-#define BTF_KIND_MAX BTF_KIND_DATASEC
-#define NR_BTF_KINDS (BTF_KIND_MAX + 1)
+#define BTF_KIND_MAX 13
+#define NR_BTF_KINDS 14
 #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
-#define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16)
+#define BTF_INT_OFFSET(VAL) (((VAL & 0x00ff0000)) >> 16)
 #define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff)
 #define BTF_INT_SIGNED (1 << 0)
 #define BTF_INT_CHAR (1 << 1)
@@ -89,16 +87,4 @@
   __u32 name_off;
   __u32 type;
 };
-enum {
-  BTF_VAR_STATIC = 0,
-  BTF_VAR_GLOBAL_ALLOCATED,
-};
-struct btf_var {
-  __u32 linkage;
-};
-struct btf_var_secinfo {
-  __u32 type;
-  __u32 offset;
-  __u32 size;
-};
 #endif
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index 14cd6e8..0dae543 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -458,7 +458,6 @@
 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, struct btrfs_ioctl_vol_args)
-#define BTRFS_IOC_FORGET_DEV _IOW(BTRFS_IOCTL_MAGIC, 5, struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
 #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
 #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
diff --git a/libc/kernel/uapi/linux/btrfs_tree.h b/libc/kernel/uapi/linux/btrfs_tree.h
index be0c8b0..0618f66 100644
--- a/libc/kernel/uapi/linux/btrfs_tree.h
+++ b/libc/kernel/uapi/linux/btrfs_tree.h
@@ -383,7 +383,6 @@
 #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA)
 #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID10)
 #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
-#define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1)
 #define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
 #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
 #define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE)
diff --git a/libc/kernel/uapi/linux/cec.h b/libc/kernel/uapi/linux/cec.h
index a3aa2d6..05af529 100644
--- a/libc/kernel/uapi/linux/cec.h
+++ b/libc/kernel/uapi/linux/cec.h
@@ -38,7 +38,6 @@
   __u8 tx_error_cnt;
 };
 #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0)
-#define CEC_MSG_FL_RAW (1 << 1)
 #define CEC_TX_STATUS_OK (1 << 0)
 #define CEC_TX_STATUS_ARB_LOST (1 << 1)
 #define CEC_TX_STATUS_NACK (1 << 2)
diff --git a/libc/kernel/uapi/linux/coda.h b/libc/kernel/uapi/linux/coda.h
index aad1b97..93d6f7c 100644
--- a/libc/kernel/uapi/linux/coda.h
+++ b/libc/kernel/uapi/linux/coda.h
@@ -38,6 +38,10 @@
 typedef unsigned long long u_quad_t;
 #endif
 #define inline
+struct timespec {
+  long ts_sec;
+  long ts_nsec;
+};
 #else
 #include <sys/time.h>
 typedef unsigned long long u_quad_t;
@@ -53,6 +57,12 @@
 #else
 #define cdev_t dev_t
 #endif
+#ifdef __CYGWIN32__
+struct timespec {
+  time_t tv_sec;
+  long tv_nsec;
+};
+#endif
 #ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
 typedef signed char int8_t;
@@ -122,10 +132,6 @@
   C_VFIFO,
   C_VBAD
 };
-struct coda_timespec {
-  int64_t tv_sec;
-  long tv_nsec;
-};
 struct coda_vattr {
   long va_type;
   u_short va_mode;
@@ -135,9 +141,9 @@
   long va_fileid;
   u_quad_t va_size;
   long va_blocksize;
-  struct coda_timespec va_atime;
-  struct coda_timespec va_mtime;
-  struct coda_timespec va_ctime;
+  struct timespec va_atime;
+  struct timespec va_mtime;
+  struct timespec va_ctime;
   u_long va_gen;
   u_long va_flags;
   cdev_t va_rdev;
@@ -184,18 +190,17 @@
 #define CODA_STATFS 34
 #define CODA_STORE 35
 #define CODA_RELEASE 36
-#define CODA_ACCESS_INTENT 37
-#define CODA_NCALLS 38
+#define CODA_NCALLS 37
 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
 #define VC_MAXDATASIZE 8192
 #define VC_MAXMSGSIZE sizeof(union inputArgs) + sizeof(union outputArgs) + VC_MAXDATASIZE
 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
-#define CODA_KERNEL_VERSION 5
+#define CODA_KERNEL_VERSION 3
 struct coda_in_hdr {
   u_int32_t opcode;
   u_int32_t unique;
-  __kernel_pid_t pid;
-  __kernel_pid_t pgid;
+  pid_t pid;
+  pid_t pgid;
   vuid_t uid;
 };
 struct coda_out_hdr {
@@ -434,21 +439,6 @@
   struct coda_out_hdr oh;
   struct coda_statfs stat;
 };
-#define CODA_ACCESS_TYPE_READ 1
-#define CODA_ACCESS_TYPE_WRITE 2
-#define CODA_ACCESS_TYPE_MMAP 3
-#define CODA_ACCESS_TYPE_READ_FINISH 4
-#define CODA_ACCESS_TYPE_WRITE_FINISH 5
-struct coda_access_intent_in {
-  struct coda_in_hdr ih;
-  struct CodaFid VFid;
-  int count;
-  int pos;
-  int type;
-};
-struct coda_access_intent_out {
-  struct coda_out_hdr out;
-};
 #define CODA_NOCACHE 0x80000000
 union inputArgs {
   struct coda_in_hdr ih;
@@ -474,7 +464,6 @@
   struct coda_open_by_fd_in coda_open_by_fd;
   struct coda_open_by_path_in coda_open_by_path;
   struct coda_statfs_in coda_statfs;
-  struct coda_access_intent_in coda_access_intent;
 };
 union outputArgs {
   struct coda_out_hdr oh;
diff --git a/libc/kernel/uapi/linux/coda_psdev.h b/libc/kernel/uapi/linux/coda_psdev.h
new file mode 100644
index 0000000..3880961
--- /dev/null
+++ b/libc/kernel/uapi/linux/coda_psdev.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI__CODA_PSDEV_H
+#define _UAPI__CODA_PSDEV_H
+#include <linux/magic.h>
+#define CODA_PSDEV_MAJOR 67
+#define MAX_CODADEVS 5
+struct upc_req {
+  struct list_head uc_chain;
+  caddr_t uc_data;
+  u_short uc_flags;
+  u_short uc_inSize;
+  u_short uc_outSize;
+  u_short uc_opcode;
+  int uc_unique;
+  wait_queue_head_t uc_sleep;
+};
+#define CODA_REQ_ASYNC 0x1
+#define CODA_REQ_READ 0x2
+#define CODA_REQ_WRITE 0x4
+#define CODA_REQ_ABORT 0x8
+#endif
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index 1cf9d95..7c55a0a 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -71,20 +71,6 @@
   DEVLINK_CMD_REGION_NEW,
   DEVLINK_CMD_REGION_DEL,
   DEVLINK_CMD_REGION_READ,
-  DEVLINK_CMD_PORT_PARAM_GET,
-  DEVLINK_CMD_PORT_PARAM_SET,
-  DEVLINK_CMD_PORT_PARAM_NEW,
-  DEVLINK_CMD_PORT_PARAM_DEL,
-  DEVLINK_CMD_INFO_GET,
-  DEVLINK_CMD_HEALTH_REPORTER_GET,
-  DEVLINK_CMD_HEALTH_REPORTER_SET,
-  DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
-  DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE,
-  DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
-  DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
-  DEVLINK_CMD_FLASH_UPDATE,
-  DEVLINK_CMD_FLASH_UPDATE_END,
-  DEVLINK_CMD_FLASH_UPDATE_STATUS,
   __DEVLINK_CMD_MAX,
   DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
 };
@@ -121,8 +107,6 @@
   DEVLINK_PORT_FLAVOUR_PHYSICAL,
   DEVLINK_PORT_FLAVOUR_CPU,
   DEVLINK_PORT_FLAVOUR_DSA,
-  DEVLINK_PORT_FLAVOUR_PCI_PF,
-  DEVLINK_PORT_FLAVOUR_PCI_VF,
 };
 enum devlink_param_cmode {
   DEVLINK_PARAM_CMODE_RUNTIME,
@@ -234,37 +218,6 @@
   DEVLINK_ATTR_REGION_CHUNK_DATA,
   DEVLINK_ATTR_REGION_CHUNK_ADDR,
   DEVLINK_ATTR_REGION_CHUNK_LEN,
-  DEVLINK_ATTR_INFO_DRIVER_NAME,
-  DEVLINK_ATTR_INFO_SERIAL_NUMBER,
-  DEVLINK_ATTR_INFO_VERSION_FIXED,
-  DEVLINK_ATTR_INFO_VERSION_RUNNING,
-  DEVLINK_ATTR_INFO_VERSION_STORED,
-  DEVLINK_ATTR_INFO_VERSION_NAME,
-  DEVLINK_ATTR_INFO_VERSION_VALUE,
-  DEVLINK_ATTR_SB_POOL_CELL_SIZE,
-  DEVLINK_ATTR_FMSG,
-  DEVLINK_ATTR_FMSG_OBJ_NEST_START,
-  DEVLINK_ATTR_FMSG_PAIR_NEST_START,
-  DEVLINK_ATTR_FMSG_ARR_NEST_START,
-  DEVLINK_ATTR_FMSG_NEST_END,
-  DEVLINK_ATTR_FMSG_OBJ_NAME,
-  DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE,
-  DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA,
-  DEVLINK_ATTR_HEALTH_REPORTER,
-  DEVLINK_ATTR_HEALTH_REPORTER_NAME,
-  DEVLINK_ATTR_HEALTH_REPORTER_STATE,
-  DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,
-  DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,
-  DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,
-  DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,
-  DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,
-  DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,
-  DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,
-  DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG,
-  DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,
-  DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,
-  DEVLINK_ATTR_PORT_PCI_PF_NUMBER,
-  DEVLINK_ATTR_PORT_PCI_VF_NUMBER,
   __DEVLINK_ATTR_MAX,
   DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
 };
diff --git a/libc/kernel/uapi/linux/dm-ioctl.h b/libc/kernel/uapi/linux/dm-ioctl.h
index 3aa627d..05847a7 100644
--- a/libc/kernel/uapi/linux/dm-ioctl.h
+++ b/libc/kernel/uapi/linux/dm-ioctl.h
@@ -102,9 +102,9 @@
 #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 #define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 40
+#define DM_VERSION_MINOR 39
 #define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl(2019-01-18)"
+#define DM_VERSION_EXTRA "-ioctl(2018-04-03)"
 #define DM_READONLY_FLAG (1 << 0)
 #define DM_SUSPEND_FLAG (1 << 1)
 #define DM_PERSISTENT_DEV_FLAG (1 << 3)
diff --git a/libc/kernel/uapi/linux/dma-buf.h b/libc/kernel/uapi/linux/dma-buf.h
index 3d7c099..7771906 100644
--- a/libc/kernel/uapi/linux/dma-buf.h
+++ b/libc/kernel/uapi/linux/dma-buf.h
@@ -28,8 +28,6 @@
 #define DMA_BUF_SYNC_START (0 << 2)
 #define DMA_BUF_SYNC_END (1 << 2)
 #define DMA_BUF_SYNC_VALID_FLAGS_MASK (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
-#define DMA_BUF_NAME_LEN 32
 #define DMA_BUF_BASE 'b'
 #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
-#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
 #endif
diff --git a/libc/kernel/uapi/linux/elf-em.h b/libc/kernel/uapi/linux/elf-em.h
index d1ed1f6..99835ae 100644
--- a/libc/kernel/uapi/linux/elf-em.h
+++ b/libc/kernel/uapi/linux/elf-em.h
@@ -45,19 +45,14 @@
 #define EM_M32R 88
 #define EM_MN10300 89
 #define EM_OPENRISC 92
-#define EM_ARCOMPACT 93
 #define EM_XTENSA 94
 #define EM_BLACKFIN 106
-#define EM_UNICORE 110
 #define EM_ALTERA_NIOS2 113
 #define EM_TI_C6000 140
-#define EM_HEXAGON 164
-#define EM_NDS32 167
 #define EM_AARCH64 183
 #define EM_TILEPRO 188
 #define EM_MICROBLAZE 189
 #define EM_TILEGX 191
-#define EM_ARCV2 195
 #define EM_RISCV 243
 #define EM_BPF 247
 #define EM_CSKY 252
diff --git a/libc/kernel/uapi/linux/elf.h b/libc/kernel/uapi/linux/elf.h
index 8f2e668..9845bd3 100644
--- a/libc/kernel/uapi/linux/elf.h
+++ b/libc/kernel/uapi/linux/elf.h
@@ -356,8 +356,6 @@
 #define NT_ARM_SYSTEM_CALL 0x404
 #define NT_ARM_SVE 0x405
 #define NT_ARM_PAC_MASK 0x406
-#define NT_ARM_PACA_KEYS 0x407
-#define NT_ARM_PACG_KEYS 0x408
 #define NT_ARC_V2 0x600
 #define NT_VMCOREDD 0x700
 #define NT_MIPS_DSP 0x800
diff --git a/libc/kernel/uapi/linux/errqueue.h b/libc/kernel/uapi/linux/errqueue.h
index 7959d2b..f4a244f 100644
--- a/libc/kernel/uapi/linux/errqueue.h
+++ b/libc/kernel/uapi/linux/errqueue.h
@@ -19,7 +19,6 @@
 #ifndef _UAPI_LINUX_ERRQUEUE_H
 #define _UAPI_LINUX_ERRQUEUE_H
 #include <linux/types.h>
-#include <linux/time_types.h>
 struct sock_extended_err {
   __u32 ee_errno;
   __u8 ee_origin;
@@ -44,9 +43,6 @@
 struct scm_timestamping {
   struct timespec ts[3];
 };
-struct scm_timestamping64 {
-  struct __kernel_timespec ts[3];
-};
 enum {
   SCM_TSTAMP_SND,
   SCM_TSTAMP_SCHED,
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 6b2b8d5..25e1a9e 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -101,12 +101,9 @@
 };
 #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff
 #define DOWNSHIFT_DEV_DISABLE 0
-#define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0
-#define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff
 enum phy_tunable_id {
   ETHTOOL_PHY_ID_UNSPEC,
   ETHTOOL_PHY_DOWNSHIFT,
-  ETHTOOL_PHY_FAST_LINK_DOWN,
   __ETHTOOL_PHY_TUNABLE_COUNT,
 };
 struct ethtool_regs {
@@ -589,24 +586,7 @@
   ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49,
   ETHTOOL_LINK_MODE_FEC_RS_BIT = 50,
   ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51,
-  ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52,
-  ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53,
-  ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54,
-  ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55,
-  ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56,
-  ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57,
-  ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58,
-  ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59,
-  ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60,
-  ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61,
-  ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62,
-  ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63,
-  ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64,
-  ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65,
-  ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66,
-  ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67,
-  ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68,
-  __ETHTOOL_LINK_MODE_MASK_NBITS
+  __ETHTOOL_LINK_MODE_LAST = ETHTOOL_LINK_MODE_FEC_BASER_BIT,
 };
 #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) (1UL << (ETHTOOL_LINK_MODE_ ##base_name ##_BIT))
 #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
@@ -684,7 +664,6 @@
 #define SPEED_50000 50000
 #define SPEED_56000 56000
 #define SPEED_100000 100000
-#define SPEED_200000 200000
 #define SPEED_UNKNOWN - 1
 #define DUPLEX_HALF 0x00
 #define DUPLEX_FULL 0x01
@@ -759,8 +738,6 @@
 #define ETH_MODULE_SFF_8636_LEN 256
 #define ETH_MODULE_SFF_8436 0x4
 #define ETH_MODULE_SFF_8436_LEN 256
-#define ETH_MODULE_SFF_8636_MAX_LEN 640
-#define ETH_MODULE_SFF_8436_MAX_LEN 640
 enum ethtool_reset_flags {
   ETH_RESET_MGMT = 1 << 0,
   ETH_RESET_IRQ = 1 << 1,
diff --git a/libc/kernel/uapi/linux/fanotify.h b/libc/kernel/uapi/linux/fanotify.h
index 8b4494f..4c33fde 100644
--- a/libc/kernel/uapi/linux/fanotify.h
+++ b/libc/kernel/uapi/linux/fanotify.h
@@ -21,16 +21,9 @@
 #include <linux/types.h>
 #define FAN_ACCESS 0x00000001
 #define FAN_MODIFY 0x00000002
-#define FAN_ATTRIB 0x00000004
 #define FAN_CLOSE_WRITE 0x00000008
 #define FAN_CLOSE_NOWRITE 0x00000010
 #define FAN_OPEN 0x00000020
-#define FAN_MOVED_FROM 0x00000040
-#define FAN_MOVED_TO 0x00000080
-#define FAN_CREATE 0x00000100
-#define FAN_DELETE 0x00000200
-#define FAN_DELETE_SELF 0x00000400
-#define FAN_MOVE_SELF 0x00000800
 #define FAN_OPEN_EXEC 0x00001000
 #define FAN_Q_OVERFLOW 0x00004000
 #define FAN_OPEN_PERM 0x00010000
@@ -39,7 +32,6 @@
 #define FAN_ONDIR 0x40000000
 #define FAN_EVENT_ON_CHILD 0x08000000
 #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
-#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
 #define FAN_CLOEXEC 0x00000001
 #define FAN_NONBLOCK 0x00000002
 #define FAN_CLASS_NOTIF 0x00000000
@@ -50,7 +42,6 @@
 #define FAN_UNLIMITED_MARKS 0x00000020
 #define FAN_ENABLE_AUDIT 0x00000040
 #define FAN_REPORT_TID 0x00000100
-#define FAN_REPORT_FID 0x00000200
 #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
 #define FAN_MARK_ADD 0x00000001
 #define FAN_MARK_REMOVE 0x00000002
@@ -76,17 +67,6 @@
   __s32 fd;
   __s32 pid;
 };
-#define FAN_EVENT_INFO_TYPE_FID 1
-struct fanotify_event_info_header {
-  __u8 info_type;
-  __u8 pad;
-  __u16 len;
-};
-struct fanotify_event_info_fid {
-  struct fanotify_event_info_header hdr;
-  __kernel_fsid_t fsid;
-  unsigned char handle[0];
-};
 struct fanotify_response {
   __s32 fd;
   __u32 response;
diff --git a/libc/kernel/uapi/linux/fcntl.h b/libc/kernel/uapi/linux/fcntl.h
index e2045c8..e98a67b 100644
--- a/libc/kernel/uapi/linux/fcntl.h
+++ b/libc/kernel/uapi/linux/fcntl.h
@@ -32,7 +32,6 @@
 #define F_SEAL_SHRINK 0x0002
 #define F_SEAL_GROW 0x0004
 #define F_SEAL_WRITE 0x0008
-#define F_SEAL_FUTURE_WRITE 0x0010
 #define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
 #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
 #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
@@ -60,5 +59,4 @@
 #define AT_STATX_SYNC_AS_STAT 0x0000
 #define AT_STATX_FORCE_SYNC 0x2000
 #define AT_STATX_DONT_SYNC 0x4000
-#define AT_RECURSIVE 0x8000
 #endif
diff --git a/libc/kernel/uapi/linux/flat.h b/libc/kernel/uapi/linux/flat.h
new file mode 100644
index 0000000..d2af100
--- /dev/null
+++ b/libc/kernel/uapi/linux/flat.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_FLAT_H
+#define _UAPI_LINUX_FLAT_H
+#define FLAT_VERSION 0x00000004L
+#define MAX_SHARED_LIBS (1)
+struct flat_hdr {
+  char magic[4];
+  unsigned long rev;
+  unsigned long entry;
+  unsigned long data_start;
+  unsigned long data_end;
+  unsigned long bss_end;
+  unsigned long stack_size;
+  unsigned long reloc_start;
+  unsigned long reloc_count;
+  unsigned long flags;
+  unsigned long build_date;
+  unsigned long filler[5];
+};
+#define FLAT_FLAG_RAM 0x0001
+#define FLAT_FLAG_GOTPIC 0x0002
+#define FLAT_FLAG_GZIP 0x0004
+#define FLAT_FLAG_GZDATA 0x0008
+#define FLAT_FLAG_KTRACE 0x0010
+#endif
diff --git a/libc/kernel/uapi/linux/fou.h b/libc/kernel/uapi/linux/fou.h
index a16b8c6..7e59bd0 100644
--- a/libc/kernel/uapi/linux/fou.h
+++ b/libc/kernel/uapi/linux/fou.h
@@ -27,12 +27,6 @@
   FOU_ATTR_IPPROTO,
   FOU_ATTR_TYPE,
   FOU_ATTR_REMCSUM_NOPARTIAL,
-  FOU_ATTR_LOCAL_V4,
-  FOU_ATTR_LOCAL_V6,
-  FOU_ATTR_PEER_V4,
-  FOU_ATTR_PEER_V6,
-  FOU_ATTR_PEER_PORT,
-  FOU_ATTR_IFINDEX,
   __FOU_ATTR_MAX,
 };
 #define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/fs.h b/libc/kernel/uapi/linux/fs.h
index 5edd66b..84dc010 100644
--- a/libc/kernel/uapi/linux/fs.h
+++ b/libc/kernel/uapi/linux/fs.h
@@ -219,7 +219,6 @@
 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
 #define SYNC_FILE_RANGE_WRITE 2
 #define SYNC_FILE_RANGE_WAIT_AFTER 4
-#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WAIT_AFTER)
 typedef int __bitwise __kernel_rwf_t;
 #define RWF_HIPRI ((__force __kernel_rwf_t) 0x00000001)
 #define RWF_DSYNC ((__force __kernel_rwf_t) 0x00000002)
diff --git a/libc/kernel/uapi/linux/fuse.h b/libc/kernel/uapi/linux/fuse.h
index 86b01f0..3c3a124 100644
--- a/libc/kernel/uapi/linux/fuse.h
+++ b/libc/kernel/uapi/linux/fuse.h
@@ -20,7 +20,7 @@
 #define _LINUX_FUSE_H
 #include <stdint.h>
 #define FUSE_KERNEL_VERSION 7
-#define FUSE_KERNEL_MINOR_VERSION 31
+#define FUSE_KERNEL_MINOR_VERSION 28
 #define FUSE_ROOT_ID 1
 struct fuse_attr {
   uint64_t ino;
@@ -73,7 +73,6 @@
 #define FOPEN_KEEP_CACHE (1 << 1)
 #define FOPEN_NONSEEKABLE (1 << 2)
 #define FOPEN_CACHE_DIR (1 << 3)
-#define FOPEN_STREAM (1 << 4)
 #define FUSE_ASYNC_READ (1 << 0)
 #define FUSE_POSIX_LOCKS (1 << 1)
 #define FUSE_FILE_OPS (1 << 2)
@@ -98,8 +97,6 @@
 #define FUSE_ABORT_ERROR (1 << 21)
 #define FUSE_MAX_PAGES (1 << 22)
 #define FUSE_CACHE_SYMLINKS (1 << 23)
-#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
-#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
 #define CUSE_UNRESTRICTED_IOCTL (1 << 0)
 #define FUSE_RELEASE_FLUSH (1 << 0)
 #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
@@ -107,17 +104,14 @@
 #define FUSE_LK_FLOCK (1 << 0)
 #define FUSE_WRITE_CACHE (1 << 0)
 #define FUSE_WRITE_LOCKOWNER (1 << 1)
-#define FUSE_WRITE_KILL_PRIV (1 << 2)
 #define FUSE_READ_LOCKOWNER (1 << 1)
 #define FUSE_IOCTL_COMPAT (1 << 0)
 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
 #define FUSE_IOCTL_RETRY (1 << 2)
 #define FUSE_IOCTL_32BIT (1 << 3)
 #define FUSE_IOCTL_DIR (1 << 4)
-#define FUSE_IOCTL_COMPAT_X32 (1 << 5)
 #define FUSE_IOCTL_MAX_IOV 256
 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
-#define FUSE_FSYNC_FDATASYNC (1 << 0)
 enum fuse_opcode {
   FUSE_LOOKUP = 1,
   FUSE_FORGET = 2,
diff --git a/libc/kernel/uapi/linux/icmpv6.h b/libc/kernel/uapi/linux/icmpv6.h
index 798a945..fd03585 100644
--- a/libc/kernel/uapi/linux/icmpv6.h
+++ b/libc/kernel/uapi/linux/icmpv6.h
@@ -77,7 +77,6 @@
 #define ICMPV6_PKT_TOOBIG 2
 #define ICMPV6_TIME_EXCEED 3
 #define ICMPV6_PARAMPROB 4
-#define ICMPV6_ERRMSG_MAX 127
 #define ICMPV6_INFOMSG_MASK 0x80
 #define ICMPV6_ECHO_REQUEST 128
 #define ICMPV6_ECHO_REPLY 129
@@ -91,8 +90,6 @@
 #define ICMPV6_DHAAD_REPLY 145
 #define ICMPV6_MOBILE_PREFIX_SOL 146
 #define ICMPV6_MOBILE_PREFIX_ADV 147
-#define ICMPV6_MRDISC_ADV 151
-#define ICMPV6_MSG_MAX 255
 #define ICMPV6_NOROUTE 0
 #define ICMPV6_ADM_PROHIBITED 1
 #define ICMPV6_NOT_NEIGHBOUR 2
diff --git a/libc/kernel/uapi/linux/if_bonding.h b/libc/kernel/uapi/linux/if_bonding.h
index a1fa959..f77f866 100644
--- a/libc/kernel/uapi/linux/if_bonding.h
+++ b/libc/kernel/uapi/linux/if_bonding.h
@@ -69,24 +69,4 @@
   __u16 partner_key;
   __u8 partner_system[ETH_ALEN];
 };
-enum {
-  BOND_XSTATS_UNSPEC,
-  BOND_XSTATS_3AD,
-  __BOND_XSTATS_MAX
-};
-#define BOND_XSTATS_MAX (__BOND_XSTATS_MAX - 1)
-enum {
-  BOND_3AD_STAT_LACPDU_RX,
-  BOND_3AD_STAT_LACPDU_TX,
-  BOND_3AD_STAT_LACPDU_UNKNOWN_RX,
-  BOND_3AD_STAT_LACPDU_ILLEGAL_RX,
-  BOND_3AD_STAT_MARKER_RX,
-  BOND_3AD_STAT_MARKER_TX,
-  BOND_3AD_STAT_MARKER_RESP_RX,
-  BOND_3AD_STAT_MARKER_RESP_TX,
-  BOND_3AD_STAT_MARKER_UNKNOWN_RX,
-  BOND_3AD_STAT_PAD,
-  __BOND_3AD_STAT_MAX
-};
-#define BOND_3AD_STAT_MAX (__BOND_3AD_STAT_MAX - 1)
 #endif
diff --git a/libc/kernel/uapi/linux/if_ether.h b/libc/kernel/uapi/linux/if_ether.h
index dd2dedb..4fb58f1 100644
--- a/libc/kernel/uapi/linux/if_ether.h
+++ b/libc/kernel/uapi/linux/if_ether.h
@@ -72,7 +72,6 @@
 #define ETH_P_802_EX1 0x88B5
 #define ETH_P_PREAUTH 0x88C7
 #define ETH_P_TIPC 0x88CA
-#define ETH_P_LLDP 0x88CC
 #define ETH_P_MACSEC 0x88E5
 #define ETH_P_8021AH 0x88E7
 #define ETH_P_MVRP 0x88F5
@@ -91,7 +90,6 @@
 #define ETH_P_QINQ2 0x9200
 #define ETH_P_QINQ3 0x9300
 #define ETH_P_EDSA 0xDADA
-#define ETH_P_DSA_8021Q 0xDADB
 #define ETH_P_IFE 0xED3E
 #define ETH_P_AF_IUCV 0xFBFB
 #define ETH_P_802_3_MIN 0x0600
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 45ef92b..416c48b 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -515,7 +515,6 @@
   IFLA_BOND_AD_USER_PORT_KEY,
   IFLA_BOND_AD_ACTOR_SYSTEM,
   IFLA_BOND_TLB_DYNAMIC_LB,
-  IFLA_BOND_PEER_NOTIF_DELAY,
   __IFLA_BOND_MAX,
 };
 #define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
@@ -562,7 +561,6 @@
   IFLA_VF_IB_NODE_GUID,
   IFLA_VF_IB_PORT_GUID,
   IFLA_VF_VLAN_LIST,
-  IFLA_VF_BROADCAST,
   __IFLA_VF_MAX,
 };
 #define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
@@ -570,9 +568,6 @@
   __u32 vf;
   __u8 mac[32];
 };
-struct ifla_vf_broadcast {
-  __u8 broadcast[32];
-};
 struct ifla_vf_vlan {
   __u32 vf;
   __u32 vlan;
@@ -731,7 +726,6 @@
 enum {
   LINK_XSTATS_TYPE_UNSPEC,
   LINK_XSTATS_TYPE_BRIDGE,
-  LINK_XSTATS_TYPE_BOND,
   __LINK_XSTATS_TYPE_MAX
 };
 #define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_packet.h b/libc/kernel/uapi/linux/if_packet.h
index db24bbe..300aa7b 100644
--- a/libc/kernel/uapi/linux/if_packet.h
+++ b/libc/kernel/uapi/linux/if_packet.h
@@ -117,7 +117,7 @@
 #define TP_STATUS_WRONG_FORMAT (1 << 2)
 #define TP_STATUS_TS_SOFTWARE (1 << 29)
 #define TP_STATUS_TS_SYS_HARDWARE (1 << 30)
-#define TP_STATUS_TS_RAW_HARDWARE (1U << 31)
+#define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
 #define TP_FT_REQ_FILL_RXHASH 0x1
 struct tpacket_hdr {
   unsigned long tp_status;
diff --git a/libc/kernel/uapi/linux/if_tun.h b/libc/kernel/uapi/linux/if_tun.h
index d1a8f9e..cb2d2d2 100644
--- a/libc/kernel/uapi/linux/if_tun.h
+++ b/libc/kernel/uapi/linux/if_tun.h
@@ -52,7 +52,6 @@
 #define TUNSETSTEERINGEBPF _IOR('T', 224, int)
 #define TUNSETFILTEREBPF _IOR('T', 225, int)
 #define TUNSETCARRIER _IOW('T', 226, int)
-#define TUNGETDEVNETNS _IO('T', 227)
 #define IFF_TUN 0x0001
 #define IFF_TAP 0x0002
 #define IFF_NAPI 0x0010
diff --git a/libc/kernel/uapi/linux/if_vlan.h b/libc/kernel/uapi/linux/if_vlan.h
index 8ca8900..27403b6 100644
--- a/libc/kernel/uapi/linux/if_vlan.h
+++ b/libc/kernel/uapi/linux/if_vlan.h
@@ -35,7 +35,6 @@
   VLAN_FLAG_GVRP = 0x2,
   VLAN_FLAG_LOOSE_BINDING = 0x4,
   VLAN_FLAG_MVRP = 0x8,
-  VLAN_FLAG_BRIDGE_BINDING = 0x10,
 };
 enum vlan_name_types {
   VLAN_NAME_TYPE_PLUS_VID,
diff --git a/libc/kernel/uapi/linux/if_xdp.h b/libc/kernel/uapi/linux/if_xdp.h
index 2c2596c..a0935bd 100644
--- a/libc/kernel/uapi/linux/if_xdp.h
+++ b/libc/kernel/uapi/linux/if_xdp.h
@@ -47,7 +47,6 @@
 #define XDP_UMEM_FILL_RING 5
 #define XDP_UMEM_COMPLETION_RING 6
 #define XDP_STATISTICS 7
-#define XDP_OPTIONS 8
 struct xdp_umem_reg {
   __u64 addr;
   __u64 len;
@@ -59,10 +58,6 @@
   __u64 rx_invalid_descs;
   __u64 tx_invalid_descs;
 };
-struct xdp_options {
-  __u32 flags;
-};
-#define XDP_OPTIONS_ZEROCOPY (1 << 0)
 #define XDP_PGOFF_RX_RING 0
 #define XDP_PGOFF_TX_RING 0x80000000
 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
diff --git a/libc/kernel/uapi/linux/igmp.h b/libc/kernel/uapi/linux/igmp.h
index 885b0f8..f5d1164 100644
--- a/libc/kernel/uapi/linux/igmp.h
+++ b/libc/kernel/uapi/linux/igmp.h
@@ -73,7 +73,6 @@
 #define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22
 #define IGMP_MTRACE_RESP 0x1e
 #define IGMP_MTRACE 0x1f
-#define IGMP_MRDISC_ADV 0x30
 #define IGMP_DELAYING_MEMBER 0x01
 #define IGMP_IDLE_MEMBER 0x02
 #define IGMP_LAZY_MEMBER 0x03
diff --git a/libc/kernel/uapi/linux/iio/types.h b/libc/kernel/uapi/linux/iio/types.h
index e3f3ec4..834a2eb 100644
--- a/libc/kernel/uapi/linux/iio/types.h
+++ b/libc/kernel/uapi/linux/iio/types.h
@@ -53,7 +53,6 @@
   IIO_GRAVITY,
   IIO_POSITIONRELATIVE,
   IIO_PHASE,
-  IIO_MASSCONCENTRATION,
 };
 enum iio_modifier {
   IIO_NO_MOD,
@@ -94,12 +93,6 @@
   IIO_MOD_VOC,
   IIO_MOD_LIGHT_UV,
   IIO_MOD_LIGHT_DUV,
-  IIO_MOD_PM1,
-  IIO_MOD_PM2P5,
-  IIO_MOD_PM4,
-  IIO_MOD_PM10,
-  IIO_MOD_ETHANOL,
-  IIO_MOD_H2,
 };
 enum iio_event_type {
   IIO_EV_TYPE_THRESH,
diff --git a/libc/kernel/uapi/linux/in.h b/libc/kernel/uapi/linux/in.h
index f1dab00..9ed00b4 100644
--- a/libc/kernel/uapi/linux/in.h
+++ b/libc/kernel/uapi/linux/in.h
@@ -215,7 +215,6 @@
 #define INADDR_UNSPEC_GROUP 0xe0000000U
 #define INADDR_ALLHOSTS_GROUP 0xe0000001U
 #define INADDR_ALLRTRS_GROUP 0xe0000002U
-#define INADDR_ALLSNOOPERS_GROUP 0xe000006aU
 #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU
 #endif
 #include <asm/byteorder.h>
diff --git a/libc/kernel/uapi/linux/in6.h b/libc/kernel/uapi/linux/in6.h
index 2eb64d0..3627f52 100644
--- a/libc/kernel/uapi/linux/in6.h
+++ b/libc/kernel/uapi/linux/in6.h
@@ -133,7 +133,6 @@
 #define IPV6_JOIN_ANYCAST 27
 #define IPV6_LEAVE_ANYCAST 28
 #define IPV6_MULTICAST_ALL 29
-#define IPV6_ROUTER_ALERT_ISOLATE 30
 #define IPV6_PMTUDISC_DONT 0
 #define IPV6_PMTUDISC_WANT 1
 #define IPV6_PMTUDISC_DO 2
diff --git a/libc/kernel/uapi/linux/input-event-codes.h b/libc/kernel/uapi/linux/input-event-codes.h
index 5d20c24..1ca3cb0 100644
--- a/libc/kernel/uapi/linux/input-event-codes.h
+++ b/libc/kernel/uapi/linux/input-event-codes.h
@@ -389,12 +389,10 @@
 #define KEY_TITLE 0x171
 #define KEY_SUBTITLE 0x172
 #define KEY_ANGLE 0x173
-#define KEY_FULL_SCREEN 0x174
-#define KEY_ZOOM KEY_FULL_SCREEN
+#define KEY_ZOOM 0x174
 #define KEY_MODE 0x175
 #define KEY_KEYBOARD 0x176
-#define KEY_ASPECT_RATIO 0x177
-#define KEY_SCREEN KEY_ASPECT_RATIO
+#define KEY_SCREEN 0x177
 #define KEY_PC 0x178
 #define KEY_TV 0x179
 #define KEY_TV2 0x17a
@@ -543,7 +541,6 @@
 #define KEY_SCREENSAVER 0x245
 #define KEY_VOICECOMMAND 0x246
 #define KEY_ASSISTANT 0x247
-#define KEY_KBD_LAYOUT_NEXT 0x248
 #define KEY_BRIGHTNESS_MIN 0x250
 #define KEY_BRIGHTNESS_MAX 0x251
 #define KEY_KBDINPUTASSIST_PREV 0x260
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
deleted file mode 100644
index c5055ba..0000000
--- a/libc/kernel/uapi/linux/io_uring.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef LINUX_IO_URING_H
-#define LINUX_IO_URING_H
-#include <linux/fs.h>
-#include <linux/types.h>
-struct io_uring_sqe {
-  __u8 opcode;
-  __u8 flags;
-  __u16 ioprio;
-  __s32 fd;
-  __u64 off;
-  __u64 addr;
-  __u32 len;
-  union {
-    __kernel_rwf_t rw_flags;
-    __u32 fsync_flags;
-    __u16 poll_events;
-    __u32 sync_range_flags;
-    __u32 msg_flags;
-  };
-  __u64 user_data;
-  union {
-    __u16 buf_index;
-    __u64 __pad2[3];
-  };
-};
-#define IOSQE_FIXED_FILE (1U << 0)
-#define IOSQE_IO_DRAIN (1U << 1)
-#define IOSQE_IO_LINK (1U << 2)
-#define IORING_SETUP_IOPOLL (1U << 0)
-#define IORING_SETUP_SQPOLL (1U << 1)
-#define IORING_SETUP_SQ_AFF (1U << 2)
-#define IORING_OP_NOP 0
-#define IORING_OP_READV 1
-#define IORING_OP_WRITEV 2
-#define IORING_OP_FSYNC 3
-#define IORING_OP_READ_FIXED 4
-#define IORING_OP_WRITE_FIXED 5
-#define IORING_OP_POLL_ADD 6
-#define IORING_OP_POLL_REMOVE 7
-#define IORING_OP_SYNC_FILE_RANGE 8
-#define IORING_OP_SENDMSG 9
-#define IORING_OP_RECVMSG 10
-#define IORING_FSYNC_DATASYNC (1U << 0)
-struct io_uring_cqe {
-  __u64 user_data;
-  __s32 res;
-  __u32 flags;
-};
-#define IORING_OFF_SQ_RING 0ULL
-#define IORING_OFF_CQ_RING 0x8000000ULL
-#define IORING_OFF_SQES 0x10000000ULL
-struct io_sqring_offsets {
-  __u32 head;
-  __u32 tail;
-  __u32 ring_mask;
-  __u32 ring_entries;
-  __u32 flags;
-  __u32 dropped;
-  __u32 array;
-  __u32 resv1;
-  __u64 resv2;
-};
-#define IORING_SQ_NEED_WAKEUP (1U << 0)
-struct io_cqring_offsets {
-  __u32 head;
-  __u32 tail;
-  __u32 ring_mask;
-  __u32 ring_entries;
-  __u32 overflow;
-  __u32 cqes;
-  __u64 resv[2];
-};
-#define IORING_ENTER_GETEVENTS (1U << 0)
-#define IORING_ENTER_SQ_WAKEUP (1U << 1)
-struct io_uring_params {
-  __u32 sq_entries;
-  __u32 cq_entries;
-  __u32 flags;
-  __u32 sq_thread_cpu;
-  __u32 sq_thread_idle;
-  __u32 resv[5];
-  struct io_sqring_offsets sq_off;
-  struct io_cqring_offsets cq_off;
-};
-#define IORING_REGISTER_BUFFERS 0
-#define IORING_UNREGISTER_BUFFERS 1
-#define IORING_REGISTER_FILES 2
-#define IORING_UNREGISTER_FILES 3
-#define IORING_REGISTER_EVENTFD 4
-#define IORING_UNREGISTER_EVENTFD 5
-#endif
diff --git a/libc/kernel/uapi/linux/iommu.h b/libc/kernel/uapi/linux/iommu.h
deleted file mode 100644
index 3c7849a..0000000
--- a/libc/kernel/uapi/linux/iommu.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_IOMMU_H
-#define _UAPI_IOMMU_H
-#include <linux/types.h>
-#define IOMMU_FAULT_PERM_READ (1 << 0)
-#define IOMMU_FAULT_PERM_WRITE (1 << 1)
-#define IOMMU_FAULT_PERM_EXEC (1 << 2)
-#define IOMMU_FAULT_PERM_PRIV (1 << 3)
-enum iommu_fault_type {
-  IOMMU_FAULT_DMA_UNRECOV = 1,
-  IOMMU_FAULT_PAGE_REQ,
-};
-enum iommu_fault_reason {
-  IOMMU_FAULT_REASON_UNKNOWN = 0,
-  IOMMU_FAULT_REASON_PASID_FETCH,
-  IOMMU_FAULT_REASON_BAD_PASID_ENTRY,
-  IOMMU_FAULT_REASON_PASID_INVALID,
-  IOMMU_FAULT_REASON_WALK_EABT,
-  IOMMU_FAULT_REASON_PTE_FETCH,
-  IOMMU_FAULT_REASON_PERMISSION,
-  IOMMU_FAULT_REASON_ACCESS,
-  IOMMU_FAULT_REASON_OOR_ADDRESS,
-};
-struct iommu_fault_unrecoverable {
-  __u32 reason;
-#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0)
-#define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1)
-#define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2)
-  __u32 flags;
-  __u32 pasid;
-  __u32 perm;
-  __u64 addr;
-  __u64 fetch_addr;
-};
-struct iommu_fault_page_request {
-#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
-#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
-#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
-  __u32 flags;
-  __u32 pasid;
-  __u32 grpid;
-  __u32 perm;
-  __u64 addr;
-  __u64 private_data[2];
-};
-struct iommu_fault {
-  __u32 type;
-  __u32 padding;
-  union {
-    struct iommu_fault_unrecoverable event;
-    struct iommu_fault_page_request prm;
-    __u8 padding2[56];
-  };
-};
-enum iommu_page_response_code {
-  IOMMU_PAGE_RESP_SUCCESS = 0,
-  IOMMU_PAGE_RESP_INVALID,
-  IOMMU_PAGE_RESP_FAILURE,
-};
-struct iommu_page_response {
-#define IOMMU_PAGE_RESP_VERSION_1 1
-  __u32 version;
-#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
-  __u32 flags;
-  __u32 pasid;
-  __u32 grpid;
-  __u32 code;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/ip_vs.h b/libc/kernel/uapi/linux/ip_vs.h
index 6e3defe..d89598d 100644
--- a/libc/kernel/uapi/linux/ip_vs.h
+++ b/libc/kernel/uapi/linux/ip_vs.h
@@ -85,15 +85,6 @@
 #define IP_VS_PENAME_MAXLEN 16
 #define IP_VS_IFNAME_MAXLEN 16
 #define IP_VS_PEDATA_MAXLEN 255
-enum {
-  IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0,
-  IP_VS_CONN_F_TUNNEL_TYPE_GUE,
-  IP_VS_CONN_F_TUNNEL_TYPE_GRE,
-  IP_VS_CONN_F_TUNNEL_TYPE_MAX,
-};
-#define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM (0)
-#define IP_VS_TUNNEL_ENCAP_FLAG_CSUM (1 << 0)
-#define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM (1 << 1)
 struct ip_vs_service_user {
   __u16 protocol;
   __be32 addr;
@@ -245,9 +236,6 @@
   IPVS_DEST_ATTR_STATS,
   IPVS_DEST_ATTR_ADDR_FAMILY,
   IPVS_DEST_ATTR_STATS64,
-  IPVS_DEST_ATTR_TUN_TYPE,
-  IPVS_DEST_ATTR_TUN_PORT,
-  IPVS_DEST_ATTR_TUN_FLAGS,
   __IPVS_DEST_ATTR_MAX,
 };
 #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/isdn.h b/libc/kernel/uapi/linux/isdn.h
new file mode 100644
index 0000000..b1ec37e
--- /dev/null
+++ b/libc/kernel/uapi/linux/isdn.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI__ISDN_H__
+#define _UAPI__ISDN_H__
+#include <linux/ioctl.h>
+#include <linux/tty.h>
+#define ISDN_MAX_DRIVERS 32
+#define ISDN_MAX_CHANNELS 64
+#define IIOCNETAIF _IO('I', 1)
+#define IIOCNETDIF _IO('I', 2)
+#define IIOCNETSCF _IO('I', 3)
+#define IIOCNETGCF _IO('I', 4)
+#define IIOCNETANM _IO('I', 5)
+#define IIOCNETDNM _IO('I', 6)
+#define IIOCNETGNM _IO('I', 7)
+#define IIOCGETSET _IO('I', 8)
+#define IIOCSETSET _IO('I', 9)
+#define IIOCSETVER _IO('I', 10)
+#define IIOCNETHUP _IO('I', 11)
+#define IIOCSETGST _IO('I', 12)
+#define IIOCSETBRJ _IO('I', 13)
+#define IIOCSIGPRF _IO('I', 14)
+#define IIOCGETPRF _IO('I', 15)
+#define IIOCSETPRF _IO('I', 16)
+#define IIOCGETMAP _IO('I', 17)
+#define IIOCSETMAP _IO('I', 18)
+#define IIOCNETASL _IO('I', 19)
+#define IIOCNETDIL _IO('I', 20)
+#define IIOCGETCPS _IO('I', 21)
+#define IIOCGETDVR _IO('I', 22)
+#define IIOCNETLCR _IO('I', 23)
+#define IIOCNETDWRSET _IO('I', 24)
+#define IIOCNETALN _IO('I', 32)
+#define IIOCNETDLN _IO('I', 33)
+#define IIOCNETGPN _IO('I', 34)
+#define IIOCDBGVAR _IO('I', 127)
+#define IIOCDRVCTL _IO('I', 128)
+#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
+#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
+#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
+#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
+#define ISDN_NET_ENCAP_ETHER 0
+#define ISDN_NET_ENCAP_RAWIP 1
+#define ISDN_NET_ENCAP_IPTYP 2
+#define ISDN_NET_ENCAP_CISCOHDLC 3
+#define ISDN_NET_ENCAP_SYNCPPP 4
+#define ISDN_NET_ENCAP_UIHDLC 5
+#define ISDN_NET_ENCAP_CISCOHDLCK 6
+#define ISDN_NET_ENCAP_X25IFACE 7
+#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
+#define ISDN_USAGE_NONE 0
+#define ISDN_USAGE_RAW 1
+#define ISDN_USAGE_MODEM 2
+#define ISDN_USAGE_NET 3
+#define ISDN_USAGE_VOICE 4
+#define ISDN_USAGE_FAX 5
+#define ISDN_USAGE_MASK 7
+#define ISDN_USAGE_DISABLED 32
+#define ISDN_USAGE_EXCLUSIVE 64
+#define ISDN_USAGE_OUTGOING 128
+#define ISDN_MODEM_NUMREG 24
+#define ISDN_LMSNLEN 255
+#define ISDN_CMSGLEN 50
+#define ISDN_MSNLEN 32
+#define NET_DV 0x06
+#define TTY_DV 0x06
+#define INF_DV 0x01
+typedef struct {
+  char drvid[25];
+  unsigned long arg;
+} isdn_ioctl_struct;
+typedef struct {
+  char name[10];
+  char phone[ISDN_MSNLEN];
+  int outgoing;
+} isdn_net_ioctl_phone;
+typedef struct {
+  char name[10];
+  char master[10];
+  char slave[10];
+  char eaz[256];
+  char drvid[25];
+  int onhtime;
+  int charge;
+  int l2_proto;
+  int l3_proto;
+  int p_encap;
+  int exclusive;
+  int dialmax;
+  int slavedelay;
+  int cbdelay;
+  int chargehup;
+  int ihup;
+  int secure;
+  int callback;
+  int cbhup;
+  int pppbind;
+  int chargeint;
+  int triggercps;
+  int dialtimeout;
+  int dialwait;
+  int dialmode;
+} isdn_net_ioctl_cfg;
+#define ISDN_NET_DIALMODE_MASK 0xC0
+#define ISDN_NET_DM_OFF 0x00
+#define ISDN_NET_DM_MANUAL 0x40
+#define ISDN_NET_DM_AUTO 0x80
+#define ISDN_NET_DIALMODE(x) ((& (x))->flags & ISDN_NET_DIALMODE_MASK)
+#endif
diff --git a/libc/kernel/uapi/linux/isdn/capicmd.h b/libc/kernel/uapi/linux/isdn/capicmd.h
index 419b278..d6ce6ed 100644
--- a/libc/kernel/uapi/linux/isdn/capicmd.h
+++ b/libc/kernel/uapi/linux/isdn/capicmd.h
@@ -21,7 +21,6 @@
 #define CAPI_MSG_BASELEN 8
 #define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN + 4 + 4 + 2 + 2 + 2)
 #define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN + 4 + 2)
-#define CAPI_DISCONNECT_B3_RESP_LEN (CAPI_MSG_BASELEN + 4)
 #define CAPI_ALERT 0x01
 #define CAPI_CONNECT 0x02
 #define CAPI_CONNECT_ACTIVE 0x03
diff --git a/libc/kernel/uapi/linux/isdn_divertif.h b/libc/kernel/uapi/linux/isdn_divertif.h
new file mode 100644
index 0000000..d353113
--- /dev/null
+++ b/libc/kernel/uapi/linux/isdn_divertif.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ISDN_DIVERTIF_H
+#define _UAPI_LINUX_ISDN_DIVERTIF_H
+#define DIVERT_IF_MAGIC 0x25873401
+#define DIVERT_CMD_REG 0x00
+#define DIVERT_CMD_REL 0x01
+#define DIVERT_NO_ERR 0x00
+#define DIVERT_CMD_ERR 0x01
+#define DIVERT_VER_ERR 0x02
+#define DIVERT_REG_ERR 0x03
+#define DIVERT_REL_ERR 0x04
+#define DIVERT_REG_NAME isdn_register_divert
+#endif
diff --git a/libc/kernel/uapi/linux/isdn_ppp.h b/libc/kernel/uapi/linux/isdn_ppp.h
new file mode 100644
index 0000000..83cb77c
--- /dev/null
+++ b/libc/kernel/uapi/linux/isdn_ppp.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ISDN_PPP_H
+#define _UAPI_LINUX_ISDN_PPP_H
+#define CALLTYPE_INCOMING 0x1
+#define CALLTYPE_OUTGOING 0x2
+#define CALLTYPE_CALLBACK 0x4
+#define IPPP_VERSION "2.2.0"
+struct pppcallinfo {
+  int calltype;
+  unsigned char local_num[64];
+  unsigned char remote_num[64];
+  int charge_units;
+};
+#define PPPIOCGCALLINFO _IOWR('t', 128, struct pppcallinfo)
+#define PPPIOCBUNDLE _IOW('t', 129, int)
+#define PPPIOCGMPFLAGS _IOR('t', 130, int)
+#define PPPIOCSMPFLAGS _IOW('t', 131, int)
+#define PPPIOCSMPMTU _IOW('t', 132, int)
+#define PPPIOCSMPMRU _IOW('t', 133, int)
+#define PPPIOCGCOMPRESSORS _IOR('t', 134, unsigned long[8])
+#define PPPIOCSCOMPRESSOR _IOW('t', 135, int)
+#define PPPIOCGIFNAME _IOR('t', 136, char[IFNAMSIZ])
+#define SC_MP_PROT 0x00000200
+#define SC_REJ_MP_PROT 0x00000400
+#define SC_OUT_SHORT_SEQ 0x00000800
+#define SC_IN_SHORT_SEQ 0x00004000
+#define SC_DECOMP_ON 0x01
+#define SC_COMP_ON 0x02
+#define SC_DECOMP_DISCARD 0x04
+#define SC_COMP_DISCARD 0x08
+#define SC_LINK_DECOMP_ON 0x10
+#define SC_LINK_COMP_ON 0x20
+#define SC_LINK_DECOMP_DISCARD 0x40
+#define SC_LINK_COMP_DISCARD 0x80
+#define ISDN_PPP_COMP_MAX_OPTIONS 16
+#define IPPP_COMP_FLAG_XMIT 0x1
+#define IPPP_COMP_FLAG_LINK 0x2
+struct isdn_ppp_comp_data {
+  int num;
+  unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
+  int optlen;
+  int flags;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/isdnif.h b/libc/kernel/uapi/linux/isdnif.h
new file mode 100644
index 0000000..933f4b1
--- /dev/null
+++ b/libc/kernel/uapi/linux/isdnif.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI__ISDNIF_H__
+#define _UAPI__ISDNIF_H__
+#define ISDN_PTYPE_UNKNOWN 0
+#define ISDN_PTYPE_1TR6 1
+#define ISDN_PTYPE_EURO 2
+#define ISDN_PTYPE_LEASED 3
+#define ISDN_PTYPE_NI1 4
+#define ISDN_PTYPE_MAX 7
+#define ISDN_PROTO_L2_X75I 0
+#define ISDN_PROTO_L2_X75UI 1
+#define ISDN_PROTO_L2_X75BUI 2
+#define ISDN_PROTO_L2_HDLC 3
+#define ISDN_PROTO_L2_TRANS 4
+#define ISDN_PROTO_L2_X25DTE 5
+#define ISDN_PROTO_L2_X25DCE 6
+#define ISDN_PROTO_L2_V11096 7
+#define ISDN_PROTO_L2_V11019 8
+#define ISDN_PROTO_L2_V11038 9
+#define ISDN_PROTO_L2_MODEM 10
+#define ISDN_PROTO_L2_FAX 11
+#define ISDN_PROTO_L2_HDLC_56K 12
+#define ISDN_PROTO_L2_MAX 15
+#define ISDN_PROTO_L3_TRANS 0
+#define ISDN_PROTO_L3_TRANSDSP 1
+#define ISDN_PROTO_L3_FCLASS2 2
+#define ISDN_PROTO_L3_FCLASS1 3
+#define ISDN_PROTO_L3_MAX 7
+#endif
diff --git a/libc/kernel/uapi/linux/isst_if.h b/libc/kernel/uapi/linux/isst_if.h
deleted file mode 100644
index 322f70d..0000000
--- a/libc/kernel/uapi/linux/isst_if.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ISST_IF_H
-#define __ISST_IF_H
-#include <linux/types.h>
-struct isst_if_platform_info {
-  __u16 api_version;
-  __u16 driver_version;
-  __u16 max_cmds_per_ioctl;
-  __u8 mbox_supported;
-  __u8 mmio_supported;
-};
-struct isst_if_cpu_map {
-  __u32 logical_cpu;
-  __u32 physical_cpu;
-};
-struct isst_if_cpu_maps {
-  __u32 cmd_count;
-  struct isst_if_cpu_map cpu_map[1];
-};
-struct isst_if_io_reg {
-  __u32 read_write;
-  __u32 logical_cpu;
-  __u32 reg;
-  __u32 value;
-};
-struct isst_if_io_regs {
-  __u32 req_count;
-  struct isst_if_io_reg io_reg[1];
-};
-struct isst_if_mbox_cmd {
-  __u32 logical_cpu;
-  __u32 parameter;
-  __u32 req_data;
-  __u32 resp_data;
-  __u16 command;
-  __u16 sub_command;
-  __u32 reserved;
-};
-struct isst_if_mbox_cmds {
-  __u32 cmd_count;
-  struct isst_if_mbox_cmd mbox_cmd[1];
-};
-struct isst_if_msr_cmd {
-  __u32 read_write;
-  __u32 logical_cpu;
-  __u64 msr;
-  __u64 data;
-};
-struct isst_if_msr_cmds {
-  __u32 cmd_count;
-  struct isst_if_msr_cmd msr_cmd[1];
-};
-#define ISST_IF_MAGIC 0xFE
-#define ISST_IF_GET_PLATFORM_INFO _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *)
-#define ISST_IF_GET_PHY_ID _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *)
-#define ISST_IF_IO_CMD _IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *)
-#define ISST_IF_MBOX_COMMAND _IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *)
-#define ISST_IF_MSR_COMMAND _IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *)
-#endif
diff --git a/libc/kernel/uapi/linux/kernel-page-flags.h b/libc/kernel/uapi/linux/kernel-page-flags.h
index d66cd7f..afa0393 100644
--- a/libc/kernel/uapi/linux/kernel-page-flags.h
+++ b/libc/kernel/uapi/linux/kernel-page-flags.h
@@ -41,7 +41,7 @@
 #define KPF_NOPAGE 20
 #define KPF_KSM 21
 #define KPF_THP 22
-#define KPF_OFFLINE 23
+#define KPF_BALLOON 23
 #define KPF_ZERO_PAGE 24
 #define KPF_IDLE 25
 #define KPF_PGTABLE 26
diff --git a/libc/kernel/uapi/linux/keyctl.h b/libc/kernel/uapi/linux/keyctl.h
index e3fef38..53f0468 100644
--- a/libc/kernel/uapi/linux/keyctl.h
+++ b/libc/kernel/uapi/linux/keyctl.h
@@ -66,8 +66,6 @@
 #define KEYCTL_PKEY_SIGN 27
 #define KEYCTL_PKEY_VERIFY 28
 #define KEYCTL_RESTRICT_KEYRING 29
-#define KEYCTL_MOVE 30
-#define KEYCTL_CAPABILITIES 31
 struct keyctl_dh_params {
   union {
 #ifndef __cplusplus
@@ -106,15 +104,4 @@
   };
   __u32 __spare[7];
 };
-#define KEYCTL_MOVE_EXCL 0x00000001
-#define KEYCTL_CAPS0_CAPABILITIES 0x01
-#define KEYCTL_CAPS0_PERSISTENT_KEYRINGS 0x02
-#define KEYCTL_CAPS0_DIFFIE_HELLMAN 0x04
-#define KEYCTL_CAPS0_PUBLIC_KEY 0x08
-#define KEYCTL_CAPS0_BIG_KEY 0x10
-#define KEYCTL_CAPS0_INVALIDATE 0x20
-#define KEYCTL_CAPS0_RESTRICT_KEYRING 0x40
-#define KEYCTL_CAPS0_MOVE 0x80
-#define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01
-#define KEYCTL_CAPS1_NS_KEY_TAG 0x02
 #endif
diff --git a/libc/kernel/uapi/linux/kfd_ioctl.h b/libc/kernel/uapi/linux/kfd_ioctl.h
index 8b09f00..5e20606 100644
--- a/libc/kernel/uapi/linux/kfd_ioctl.h
+++ b/libc/kernel/uapi/linux/kfd_ioctl.h
@@ -26,10 +26,9 @@
   __u32 major_version;
   __u32 minor_version;
 };
-#define KFD_IOC_QUEUE_TYPE_COMPUTE 0x0
-#define KFD_IOC_QUEUE_TYPE_SDMA 0x1
-#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 0x2
-#define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 0x3
+#define KFD_IOC_QUEUE_TYPE_COMPUTE 0
+#define KFD_IOC_QUEUE_TYPE_SDMA 1
+#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
 #define KFD_MAX_QUEUE_PERCENTAGE 100
 #define KFD_MAX_QUEUE_PRIORITY 15
 struct kfd_ioctl_create_queue_args {
@@ -149,10 +148,6 @@
 #define KFD_HW_EXCEPTION_PER_ENGINE_RESET 1
 #define KFD_HW_EXCEPTION_GPU_HANG 0
 #define KFD_HW_EXCEPTION_ECC 1
-#define KFD_MEM_ERR_NO_RAS 0
-#define KFD_MEM_ERR_SRAM_ECC 1
-#define KFD_MEM_ERR_POISON_CONSUMED 2
-#define KFD_MEM_ERR_GPU_HANG 3
 struct kfd_ioctl_create_event_args {
   __u64 event_page_offset;
   __u32 event_trigger_data;
@@ -184,7 +179,7 @@
   struct kfd_memory_exception_failure failure;
   __u64 va;
   __u32 gpu_id;
-  __u32 ErrorType;
+  __u32 pad;
 };
 struct kfd_hsa_hw_exception_data {
   __u32 reset_type;
@@ -237,7 +232,6 @@
 #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1)
 #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2)
 #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3)
-#define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4)
 #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31)
 #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30)
 #define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29)
@@ -281,10 +275,6 @@
   __u32 gpu_id;
   __u32 dmabuf_fd;
 };
-enum kfd_mmio_remap {
-  KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0,
-  KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4,
-};
 #define AMDKFD_IOCTL_BASE 'K'
 #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
 #define AMDKFD_IOR(nr,type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 7b8fb1b..8cfa34d 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -529,8 +529,7 @@
 #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
 #define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
 #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
-#define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
-#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE | KVM_X86_DISABLE_EXITS_CSTATE)
+#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE)
 struct kvm_enable_cap {
   __u32 cap;
   __u32 flags;
@@ -771,12 +770,6 @@
 #define KVM_CAP_ARM_VM_IPA_SIZE 165
 #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
 #define KVM_CAP_HYPERV_CPUID 167
-#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
-#define KVM_CAP_PPC_IRQ_XIVE 169
-#define KVM_CAP_ARM_SVE 170
-#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
-#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
-#define KVM_CAP_PMU_EVENT_FILTER 173
 #ifdef KVM_CAP_IRQ_ROUTING
 struct kvm_irq_routing_irqchip {
   __u32 irqchip;
@@ -893,7 +886,6 @@
 #define KVM_REG_SIZE_U256 0x0050000000000000ULL
 #define KVM_REG_SIZE_U512 0x0060000000000000ULL
 #define KVM_REG_SIZE_U1024 0x0070000000000000ULL
-#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
 struct kvm_reg_list {
   __u64 n;
   __u64 reg[0];
@@ -948,8 +940,6 @@
 #define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
   KVM_DEV_TYPE_ARM_VGIC_ITS,
 #define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
-  KVM_DEV_TYPE_XIVE,
-#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
   KVM_DEV_TYPE_MAX,
 };
 struct kvm_vfio_spapr_tce {
@@ -1019,7 +1009,6 @@
 #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
 #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
 #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
-#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
 #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
 #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
 #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
@@ -1094,7 +1083,6 @@
 #define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
 #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
 #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
-#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
 enum sev_cmd_id {
   KVM_SEV_INIT = 0,
   KVM_SEV_ES_INIT,
diff --git a/libc/kernel/uapi/linux/kvm_para.h b/libc/kernel/uapi/linux/kvm_para.h
index 9a4dd29..b08a605 100644
--- a/libc/kernel/uapi/linux/kvm_para.h
+++ b/libc/kernel/uapi/linux/kvm_para.h
@@ -34,6 +34,5 @@
 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8
 #define KVM_HC_CLOCK_PAIRING 9
 #define KVM_HC_SEND_IPI 10
-#define KVM_HC_SCHED_YIELD 11
 #include <asm/kvm_para.h>
 #endif
diff --git a/libc/kernel/uapi/linux/limits.h b/libc/kernel/uapi/linux/limits.h
index 101b7aa..ad0e33e 100644
--- a/libc/kernel/uapi/linux/limits.h
+++ b/libc/kernel/uapi/linux/limits.h
@@ -16,8 +16,8 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _UAPI_LINUX_LIMITS_H
-#define _UAPI_LINUX_LIMITS_H
+#ifndef _LINUX_LIMITS_H
+#define _LINUX_LIMITS_H
 #define NR_OPEN 1024
 #define NGROUPS_MAX 65536
 #define ARG_MAX 131072
diff --git a/libc/kernel/uapi/linux/lirc.h b/libc/kernel/uapi/linux/lirc.h
index 20b08e9..4a8d0ff 100644
--- a/libc/kernel/uapi/linux/lirc.h
+++ b/libc/kernel/uapi/linux/lirc.h
@@ -127,9 +127,5 @@
   RC_PROTO_XMP = 21,
   RC_PROTO_CEC = 22,
   RC_PROTO_IMON = 23,
-  RC_PROTO_RCMM12 = 24,
-  RC_PROTO_RCMM24 = 25,
-  RC_PROTO_RCMM32 = 26,
-  RC_PROTO_XBOX_DVD = 27,
 };
 #endif
diff --git a/libc/kernel/uapi/linux/magic.h b/libc/kernel/uapi/linux/magic.h
index 38b5c85..f3b337e 100644
--- a/libc/kernel/uapi/linux/magic.h
+++ b/libc/kernel/uapi/linux/magic.h
@@ -94,6 +94,4 @@
 #define UDF_SUPER_MAGIC 0x15013346
 #define BALLOON_KVM_MAGIC 0x13661366
 #define ZSMALLOC_MAGIC 0x58295829
-#define DMA_BUF_MAGIC 0x444d4142
-#define Z3FOLD_MAGIC 0x33
 #endif
diff --git a/libc/kernel/uapi/linux/mdio.h b/libc/kernel/uapi/linux/mdio.h
index 14f1e77..2617f2e 100644
--- a/libc/kernel/uapi/linux/mdio.h
+++ b/libc/kernel/uapi/linux/mdio.h
@@ -47,7 +47,6 @@
 #define MDIO_AN_ADVERTISE 16
 #define MDIO_AN_LPA 19
 #define MDIO_PCS_EEE_ABLE 20
-#define MDIO_PMA_NG_EXTABLE 21
 #define MDIO_PCS_EEE_WK_ERR 22
 #define MDIO_PHYXS_LNSTAT 24
 #define MDIO_AN_EEE_ADV 60
@@ -83,8 +82,6 @@
 #define MDIO_PCS_CTRL1_CLKSTOP_EN 0x400
 #define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
 #define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
-#define MDIO_CTRL1_SPEED2_5G (MDIO_CTRL1_SPEEDSELEXT | 0x18)
-#define MDIO_CTRL1_SPEED5G (MDIO_CTRL1_SPEEDSELEXT | 0x1c)
 #define MDIO_STAT1_LPOWERABLE 0x0002
 #define MDIO_STAT1_LSTATUS BMSR_LSTATUS
 #define MDIO_STAT1_FAULT 0x0080
@@ -102,7 +99,6 @@
 #define MDIO_PMA_SPEED_10 0x0040
 #define MDIO_PCS_SPEED_10P2B 0x0002
 #define MDIO_DEVS_PRESENT(devad) (1 << (devad))
-#define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0)
 #define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
 #define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
 #define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
@@ -111,8 +107,6 @@
 #define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
 #define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
 #define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
-#define MDIO_DEVS_VEND1 MDIO_DEVS_PRESENT(MDIO_MMD_VEND1)
-#define MDIO_DEVS_VEND2 MDIO_DEVS_PRESENT(MDIO_MMD_VEND2)
 #define MDIO_PMA_CTRL2_TYPE 0x000f
 #define MDIO_PMA_CTRL2_10GBCX4 0x0000
 #define MDIO_PMA_CTRL2_10GBEW 0x0001
@@ -130,8 +124,6 @@
 #define MDIO_PMA_CTRL2_1000BKX 0x000d
 #define MDIO_PMA_CTRL2_100BTX 0x000e
 #define MDIO_PMA_CTRL2_10BT 0x000f
-#define MDIO_PMA_CTRL2_2_5GBT 0x0030
-#define MDIO_PMA_CTRL2_5GBT 0x0031
 #define MDIO_PCS_CTRL2_TYPE 0x0003
 #define MDIO_PCS_CTRL2_10GBR 0x0000
 #define MDIO_PCS_CTRL2_10GBX 0x0001
@@ -177,7 +169,6 @@
 #define MDIO_PMA_EXTABLE_1000BKX 0x0040
 #define MDIO_PMA_EXTABLE_100BTX 0x0080
 #define MDIO_PMA_EXTABLE_10BT 0x0100
-#define MDIO_PMA_EXTABLE_NBT 0x4000
 #define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
 #define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
 #define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
@@ -197,11 +188,7 @@
 #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001
 #define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
 #define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
-#define MDIO_AN_10GBT_CTRL_ADV2_5G 0x0080
-#define MDIO_AN_10GBT_CTRL_ADV5G 0x0100
 #define MDIO_AN_10GBT_CTRL_ADV10G 0x1000
-#define MDIO_AN_10GBT_STAT_LP2_5G 0x0020
-#define MDIO_AN_10GBT_STAT_LP5G 0x0040
 #define MDIO_AN_10GBT_STAT_LPTRR 0x0200
 #define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400
 #define MDIO_AN_10GBT_STAT_LP10G 0x0800
@@ -217,8 +204,6 @@
 #define MDIO_EEE_1000KX 0x0010
 #define MDIO_EEE_10GKX4 0x0020
 #define MDIO_EEE_10GKR 0x0040
-#define MDIO_PMA_NG_EXTABLE_2_5GBT 0x0001
-#define MDIO_PMA_NG_EXTABLE_5GBT 0x0002
 #define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001
 #define MDIO_PMA_LASI_RX_PCSLFLT 0x0008
 #define MDIO_PMA_LASI_RX_PMALFLT 0x0010
diff --git a/libc/kernel/uapi/linux/media-bus-format.h b/libc/kernel/uapi/linux/media-bus-format.h
index 1b13002..7c701b1 100644
--- a/libc/kernel/uapi/linux/media-bus-format.h
+++ b/libc/kernel/uapi/linux/media-bus-format.h
@@ -34,7 +34,6 @@
 #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015
 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010
 #define MEDIA_BUS_FMT_BGR888_1X24 0x1013
-#define MEDIA_BUS_FMT_BGR888_3X8 0x101b
 #define MEDIA_BUS_FMT_GBR888_1X24 0x1014
 #define MEDIA_BUS_FMT_RGB888_1X24 0x100a
 #define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b
diff --git a/libc/kernel/uapi/linux/media.h b/libc/kernel/uapi/linux/media.h
index fe29568..4ba0ef6 100644
--- a/libc/kernel/uapi/linux/media.h
+++ b/libc/kernel/uapi/linux/media.h
@@ -68,7 +68,7 @@
 #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002)
 #define MEDIA_ENT_FL_DEFAULT (1 << 0)
 #define MEDIA_ENT_FL_CONNECTOR (1 << 1)
-#define MEDIA_ENT_ID_FLAG_NEXT (1U << 31)
+#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
 struct media_entity_desc {
   __u32 id;
   char name[32];
@@ -141,10 +141,6 @@
 #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3)
 #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4)
 #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5)
-#define MEDIA_INTF_T_ALSA_BASE 0x00000300
-#define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE)
-#define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1)
-#define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2)
 #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) ((media_version) >= ((4 << 16) | (19 << 8) | 0))
 struct media_v2_entity {
   __u32 id;
@@ -223,6 +219,10 @@
 #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER
 #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER
 #define MEDIA_ENT_F_DTV_DECODER MEDIA_ENT_F_DV_DECODER
+#define MEDIA_INTF_T_ALSA_BASE 0x00000300
+#define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE)
+#define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1)
+#define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2)
 #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3)
 #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4)
 #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5)
diff --git a/libc/kernel/uapi/linux/mii.h b/libc/kernel/uapi/linux/mii.h
index 3c6c564..5c87990 100644
--- a/libc/kernel/uapi/linux/mii.h
+++ b/libc/kernel/uapi/linux/mii.h
@@ -113,8 +113,6 @@
 #define EXPANSION_NPCAPABLE 0x0008
 #define EXPANSION_MFAULTS 0x0010
 #define EXPANSION_RESV 0xffe0
-#define ESTATUS_1000_XFULL 0x8000
-#define ESTATUS_1000_XHALF 0x4000
 #define ESTATUS_1000_TFULL 0x2000
 #define ESTATUS_1000_THALF 0x1000
 #define NWAYTEST_RESV1 0x00ff
diff --git a/libc/kernel/uapi/linux/mman.h b/libc/kernel/uapi/linux/mman.h
index e469374..0c9c397 100644
--- a/libc/kernel/uapi/linux/mman.h
+++ b/libc/kernel/uapi/linux/mman.h
@@ -25,9 +25,6 @@
 #define OVERCOMMIT_GUESS 0
 #define OVERCOMMIT_ALWAYS 1
 #define OVERCOMMIT_NEVER 2
-#define MAP_SHARED 0x01
-#define MAP_PRIVATE 0x02
-#define MAP_SHARED_VALIDATE 0x03
 #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
 #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
 #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
diff --git a/libc/kernel/uapi/linux/mount.h b/libc/kernel/uapi/linux/mount.h
index 10c53a5..54a4719 100644
--- a/libc/kernel/uapi/linux/mount.h
+++ b/libc/kernel/uapi/linux/mount.h
@@ -52,38 +52,4 @@
 #define MS_RMT_MASK (MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME)
 #define MS_MGC_VAL 0xC0ED0000
 #define MS_MGC_MSK 0xffff0000
-#define OPEN_TREE_CLONE 1
-#define OPEN_TREE_CLOEXEC O_CLOEXEC
-#define MOVE_MOUNT_F_SYMLINKS 0x00000001
-#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002
-#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004
-#define MOVE_MOUNT_T_SYMLINKS 0x00000010
-#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020
-#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040
-#define MOVE_MOUNT__MASK 0x00000077
-#define FSOPEN_CLOEXEC 0x00000001
-#define FSPICK_CLOEXEC 0x00000001
-#define FSPICK_SYMLINK_NOFOLLOW 0x00000002
-#define FSPICK_NO_AUTOMOUNT 0x00000004
-#define FSPICK_EMPTY_PATH 0x00000008
-enum fsconfig_command {
-  FSCONFIG_SET_FLAG = 0,
-  FSCONFIG_SET_STRING = 1,
-  FSCONFIG_SET_BINARY = 2,
-  FSCONFIG_SET_PATH = 3,
-  FSCONFIG_SET_PATH_EMPTY = 4,
-  FSCONFIG_SET_FD = 5,
-  FSCONFIG_CMD_CREATE = 6,
-  FSCONFIG_CMD_RECONFIGURE = 7,
-};
-#define FSMOUNT_CLOEXEC 0x00000001
-#define MOUNT_ATTR_RDONLY 0x00000001
-#define MOUNT_ATTR_NOSUID 0x00000002
-#define MOUNT_ATTR_NODEV 0x00000004
-#define MOUNT_ATTR_NOEXEC 0x00000008
-#define MOUNT_ATTR__ATIME 0x00000070
-#define MOUNT_ATTR_RELATIME 0x00000000
-#define MOUNT_ATTR_NOATIME 0x00000010
-#define MOUNT_ATTR_STRICTATIME 0x00000020
-#define MOUNT_ATTR_NODIRATIME 0x00000080
 #endif
diff --git a/libc/kernel/uapi/linux/mroute.h b/libc/kernel/uapi/linux/mroute.h
index 7e0078f..f0cb21b 100644
--- a/libc/kernel/uapi/linux/mroute.h
+++ b/libc/kernel/uapi/linux/mroute.h
@@ -34,15 +34,10 @@
 #define MRT_TABLE (MRT_BASE + 9)
 #define MRT_ADD_MFC_PROXY (MRT_BASE + 10)
 #define MRT_DEL_MFC_PROXY (MRT_BASE + 11)
-#define MRT_FLUSH (MRT_BASE + 12)
-#define MRT_MAX (MRT_BASE + 12)
+#define MRT_MAX (MRT_BASE + 11)
 #define SIOCGETVIFCNT SIOCPROTOPRIVATE
 #define SIOCGETSGCNT (SIOCPROTOPRIVATE + 1)
 #define SIOCGETRPF (SIOCPROTOPRIVATE + 2)
-#define MRT_FLUSH_MFC 1
-#define MRT_FLUSH_MFC_STATIC 2
-#define MRT_FLUSH_VIFS 4
-#define MRT_FLUSH_VIFS_STATIC 8
 #define MAXVIFS 32
 typedef unsigned long vifbitmap_t;
 typedef unsigned short vifi_t;
diff --git a/libc/kernel/uapi/linux/mroute6.h b/libc/kernel/uapi/linux/mroute6.h
index e6c83e9..ccb38d9 100644
--- a/libc/kernel/uapi/linux/mroute6.h
+++ b/libc/kernel/uapi/linux/mroute6.h
@@ -35,15 +35,10 @@
 #define MRT6_TABLE (MRT6_BASE + 9)
 #define MRT6_ADD_MFC_PROXY (MRT6_BASE + 10)
 #define MRT6_DEL_MFC_PROXY (MRT6_BASE + 11)
-#define MRT6_FLUSH (MRT6_BASE + 12)
-#define MRT6_MAX (MRT6_BASE + 12)
+#define MRT6_MAX (MRT6_BASE + 11)
 #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE
 #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE + 1)
 #define SIOCGETRPF (SIOCPROTOPRIVATE + 2)
-#define MRT6_FLUSH_MFC 1
-#define MRT6_FLUSH_MFC_STATIC 2
-#define MRT6_FLUSH_MIFS 4
-#define MRT6_FLUSH_MIFS_STATIC 8
 #define MAXMIFS 32
 typedef unsigned long mifbitmap_t;
 typedef unsigned short mifi_t;
diff --git a/libc/kernel/uapi/linux/ndctl.h b/libc/kernel/uapi/linux/ndctl.h
index e47091f..742fbad 100644
--- a/libc/kernel/uapi/linux/ndctl.h
+++ b/libc/kernel/uapi/linux/ndctl.h
@@ -157,6 +157,5 @@
 #define NVDIMM_FAMILY_HPE1 1
 #define NVDIMM_FAMILY_HPE2 2
 #define NVDIMM_FAMILY_MSFT 3
-#define NVDIMM_FAMILY_HYPERV 4
 #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg)
 #endif
diff --git a/libc/kernel/uapi/linux/netfilter/nf_synproxy.h b/libc/kernel/uapi/linux/netfilter/nf_synproxy.h
deleted file mode 100644
index 474838e..0000000
--- a/libc/kernel/uapi/linux/netfilter/nf_synproxy.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _NF_SYNPROXY_H
-#define _NF_SYNPROXY_H
-#include <linux/types.h>
-#define NF_SYNPROXY_OPT_MSS 0x01
-#define NF_SYNPROXY_OPT_WSCALE 0x02
-#define NF_SYNPROXY_OPT_SACK_PERM 0x04
-#define NF_SYNPROXY_OPT_TIMESTAMP 0x08
-#define NF_SYNPROXY_OPT_ECN 0x10
-#define NF_SYNPROXY_OPT_MASK (NF_SYNPROXY_OPT_MSS | NF_SYNPROXY_OPT_WSCALE | NF_SYNPROXY_OPT_SACK_PERM | NF_SYNPROXY_OPT_TIMESTAMP)
-struct nf_synproxy_info {
-  __u8 options;
-  __u8 wscale;
-  __u16 mss;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index ec6ac82..2bb7c86 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -125,7 +125,6 @@
   NFTA_CHAIN_TYPE,
   NFTA_CHAIN_COUNTERS,
   NFTA_CHAIN_PAD,
-  NFTA_CHAIN_FLAGS,
   __NFTA_CHAIN_MAX
 };
 #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
@@ -140,7 +139,6 @@
   NFTA_RULE_USERDATA,
   NFTA_RULE_PAD,
   NFTA_RULE_ID,
-  NFTA_RULE_POSITION_ID,
   __NFTA_RULE_MAX
 };
 #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
@@ -373,7 +371,6 @@
 enum nft_exthdr_op {
   NFT_EXTHDR_OP_IPV6,
   NFT_EXTHDR_OP_TCPOPT,
-  NFT_EXTHDR_OP_IPV4,
   __NFT_EXTHDR_OP_MAX
 };
 #define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1)
@@ -416,10 +413,6 @@
   NFT_META_CGROUP,
   NFT_META_PRANDOM,
   NFT_META_SECPATH,
-  NFT_META_IIFKIND,
-  NFT_META_OIFKIND,
-  NFT_META_BRI_IIFPVID,
-  NFT_META_BRI_IIFVPROTO,
 };
 enum nft_rt_keys {
   NFT_RT_CLASSID,
@@ -500,7 +493,7 @@
   NFT_CT_DST_IP,
   NFT_CT_SRC_IP6,
   NFT_CT_DST_IP6,
-  NFT_CT_ID,
+  NFT_CT_TIMEOUT,
   __NFT_CT_MAX
 };
 #define NFT_CT_MAX (__NFT_CT_MAX - 1)
@@ -578,7 +571,7 @@
   NFT_LOGLEVEL_AUDIT,
   __NFT_LOGLEVEL_MAX
 };
-#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1)
+#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX + 1)
 enum nft_queue_attributes {
   NFTA_QUEUE_UNSPEC,
   NFTA_QUEUE_NUM,
@@ -744,16 +737,6 @@
   __NFTA_CT_TIMEOUT_MAX,
 };
 #define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1)
-enum nft_ct_expectation_attributes {
-  NFTA_CT_EXPECT_UNSPEC,
-  NFTA_CT_EXPECT_L3PROTO,
-  NFTA_CT_EXPECT_L4PROTO,
-  NFTA_CT_EXPECT_DPORT,
-  NFTA_CT_EXPECT_TIMEOUT,
-  NFTA_CT_EXPECT_SIZE,
-  __NFTA_CT_EXPECT_MAX,
-};
-#define NFTA_CT_EXPECT_MAX (__NFTA_CT_EXPECT_MAX - 1)
 #define NFT_OBJECT_UNSPEC 0
 #define NFT_OBJECT_COUNTER 1
 #define NFT_OBJECT_QUOTA 2
@@ -763,8 +746,7 @@
 #define NFT_OBJECT_TUNNEL 6
 #define NFT_OBJECT_CT_TIMEOUT 7
 #define NFT_OBJECT_SECMARK 8
-#define NFT_OBJECT_CT_EXPECT 9
-#define __NFT_OBJECT_MAX 10
+#define __NFT_OBJECT_MAX 9
 #define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1)
 enum nft_object_attributes {
   NFTA_OBJ_UNSPEC,
@@ -801,21 +783,9 @@
   NFTA_OSF_UNSPEC,
   NFTA_OSF_DREG,
   NFTA_OSF_TTL,
-  NFTA_OSF_FLAGS,
   __NFTA_OSF_MAX,
 };
 #define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1)
-enum nft_osf_flags {
-  NFT_OSF_F_VERSION = (1 << 0),
-};
-enum nft_synproxy_attributes {
-  NFTA_SYNPROXY_UNSPEC,
-  NFTA_SYNPROXY_MSS,
-  NFTA_SYNPROXY_WSCALE,
-  NFTA_SYNPROXY_FLAGS,
-  __NFTA_SYNPROXY_MAX,
-};
-#define NFTA_SYNPROXY_MAX (__NFTA_SYNPROXY_MAX - 1)
 enum nft_devices_attributes {
   NFTA_DEVICE_UNSPEC,
   NFTA_DEVICE_NAME,
@@ -952,18 +922,10 @@
   __NFT_TUNNEL_MAX
 };
 #define NFT_TUNNEL_MAX (__NFT_TUNNEL_MAX - 1)
-enum nft_tunnel_mode {
-  NFT_TUNNEL_MODE_NONE,
-  NFT_TUNNEL_MODE_RX,
-  NFT_TUNNEL_MODE_TX,
-  __NFT_TUNNEL_MODE_MAX
-};
-#define NFT_TUNNEL_MODE_MAX (__NFT_TUNNEL_MODE_MAX - 1)
 enum nft_tunnel_attributes {
   NFTA_TUNNEL_UNSPEC,
   NFTA_TUNNEL_KEY,
   NFTA_TUNNEL_DREG,
-  NFTA_TUNNEL_MODE,
   __NFTA_TUNNEL_MAX
 };
 #define NFTA_TUNNEL_MAX (__NFTA_TUNNEL_MAX - 1)
diff --git a/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h b/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
index 4d7f436..cb53431 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
@@ -18,11 +18,15 @@
  ****************************************************************************/
 #ifndef _XT_SYNPROXY_H
 #define _XT_SYNPROXY_H
-#include <linux/netfilter/nf_synproxy.h>
-#define XT_SYNPROXY_OPT_MSS NF_SYNPROXY_OPT_MSS
-#define XT_SYNPROXY_OPT_WSCALE NF_SYNPROXY_OPT_WSCALE
-#define XT_SYNPROXY_OPT_SACK_PERM NF_SYNPROXY_OPT_SACK_PERM
-#define XT_SYNPROXY_OPT_TIMESTAMP NF_SYNPROXY_OPT_TIMESTAMP
-#define XT_SYNPROXY_OPT_ECN NF_SYNPROXY_OPT_ECN
-#define xt_synproxy_info nf_synproxy_info
+#include <linux/types.h>
+#define XT_SYNPROXY_OPT_MSS 0x01
+#define XT_SYNPROXY_OPT_WSCALE 0x02
+#define XT_SYNPROXY_OPT_SACK_PERM 0x04
+#define XT_SYNPROXY_OPT_TIMESTAMP 0x08
+#define XT_SYNPROXY_OPT_ECN 0x10
+struct xt_synproxy_info {
+  __u8 options;
+  __u8 wscale;
+  __u16 mss;
+};
 #endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_connlabel.h b/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
index 7548fa1..f59cbee 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
@@ -16,8 +16,6 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _UAPI_XT_CONNLABEL_H
-#define _UAPI_XT_CONNLABEL_H
 #include <linux/types.h>
 #define XT_CONNLABEL_MAXBIT 127
 enum xt_connlabel_mtopts {
@@ -28,4 +26,3 @@
   __u16 bit;
   __u16 options;
 };
-#endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_nfacct.h b/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
index a2b042e..4060002 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
@@ -24,8 +24,4 @@
   char name[NFACCT_NAME_MAX];
   struct nf_acct * nfacct;
 };
-struct xt_nfacct_match_info_v1 {
-  char name[NFACCT_NAME_MAX];
-  struct nf_acct * nfacct __attribute__((aligned(8)));
-};
 #endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_owner.h b/libc/kernel/uapi/linux/netfilter/xt_owner.h
index e077aad..d829dab 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_owner.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_owner.h
@@ -23,9 +23,7 @@
   XT_OWNER_UID = 1 << 0,
   XT_OWNER_GID = 1 << 1,
   XT_OWNER_SOCKET = 1 << 2,
-  XT_OWNER_SUPPL_GROUPS = 1 << 3,
 };
-#define XT_OWNER_MASK (XT_OWNER_UID | XT_OWNER_GID | XT_OWNER_SOCKET | XT_OWNER_SUPPL_GROUPS)
 struct xt_owner_match_info {
   __u32 uid_min, uid_max;
   __u32 gid_min, gid_max;
diff --git a/libc/kernel/uapi/linux/nexthop.h b/libc/kernel/uapi/linux/nexthop.h
deleted file mode 100644
index a2a959f..0000000
--- a/libc/kernel/uapi/linux/nexthop.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_NEXTHOP_H
-#define _UAPI_LINUX_NEXTHOP_H
-#include <linux/types.h>
-struct nhmsg {
-  unsigned char nh_family;
-  unsigned char nh_scope;
-  unsigned char nh_protocol;
-  unsigned char resvd;
-  unsigned int nh_flags;
-};
-struct nexthop_grp {
-  __u32 id;
-  __u8 weight;
-  __u8 resvd1;
-  __u16 resvd2;
-};
-enum {
-  NEXTHOP_GRP_TYPE_MPATH,
-  __NEXTHOP_GRP_TYPE_MAX,
-};
-#define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
-enum {
-  NHA_UNSPEC,
-  NHA_ID,
-  NHA_GROUP,
-  NHA_GROUP_TYPE,
-  NHA_BLACKHOLE,
-  NHA_OIF,
-  NHA_GATEWAY,
-  NHA_ENCAP_TYPE,
-  NHA_ENCAP,
-  NHA_GROUPS,
-  NHA_MASTER,
-  __NHA_MAX,
-};
-#define NHA_MAX (__NHA_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/nfs_mount.h b/libc/kernel/uapi/linux/nfs_mount.h
index 5b00222..ddd318a 100644
--- a/libc/kernel/uapi/linux/nfs_mount.h
+++ b/libc/kernel/uapi/linux/nfs_mount.h
@@ -62,4 +62,10 @@
 #define NFS_MOUNT_NORDIRPLUS 0x4000
 #define NFS_MOUNT_UNSHARED 0x8000
 #define NFS_MOUNT_FLAGMASK 0xFFFF
+#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
+#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
+#define NFS_MOUNT_NORESVPORT 0x40000
+#define NFS_MOUNT_LEGACY_INTERFACE 0x80000
+#define NFS_MOUNT_LOCAL_FLOCK 0x100000
+#define NFS_MOUNT_LOCAL_FCNTL 0x200000
 #endif
diff --git a/libc/kernel/uapi/linux/nfsd/cld.h b/libc/kernel/uapi/linux/nfsd/cld.h
index ed99e73..82651d1 100644
--- a/libc/kernel/uapi/linux/nfsd/cld.h
+++ b/libc/kernel/uapi/linux/nfsd/cld.h
@@ -26,7 +26,6 @@
   Cld_Remove,
   Cld_Check,
   Cld_GraceDone,
-  Cld_GraceStart,
 };
 struct cld_name {
   __u16 cn_len;
diff --git a/libc/kernel/uapi/linux/nilfs2_ondisk.h b/libc/kernel/uapi/linux/nilfs2_ondisk.h
index a05e7b7..e9995a1 100644
--- a/libc/kernel/uapi/linux/nilfs2_ondisk.h
+++ b/libc/kernel/uapi/linux/nilfs2_ondisk.h
@@ -20,7 +20,6 @@
 #define _LINUX_NILFS2_ONDISK_H
 #include <linux/types.h>
 #include <linux/magic.h>
-#include <asm/byteorder.h>
 #define NILFS_INODE_BMAP_SIZE 7
 struct nilfs_inode {
   __le64 i_blocks;
@@ -249,11 +248,11 @@
   NILFS_CHECKPOINT_MINOR,
 };
 #define NILFS_CHECKPOINT_FNS(flag,name) static inline void nilfs_checkpoint_set_ ##name(struct nilfs_checkpoint * cp) \
-{ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) | (1UL << NILFS_CHECKPOINT_ ##flag)); \
+{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | (1UL << NILFS_CHECKPOINT_ ##flag)); \
 } static inline void nilfs_checkpoint_clear_ ##name(struct nilfs_checkpoint * cp) \
-{ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) & ~(1UL << NILFS_CHECKPOINT_ ##flag)); \
+{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & ~(1UL << NILFS_CHECKPOINT_ ##flag)); \
 } static inline int nilfs_checkpoint_ ##name(const struct nilfs_checkpoint * cp) \
-{ return ! ! (__le32_to_cpu(cp->cp_flags) & (1UL << NILFS_CHECKPOINT_ ##flag)); \
+{ return ! ! (le32_to_cpu(cp->cp_flags) & (1UL << NILFS_CHECKPOINT_ ##flag)); \
 }
 struct nilfs_cpfile_header {
   __le64 ch_ncheckpoints;
@@ -273,11 +272,11 @@
   NILFS_SEGMENT_USAGE_ERROR,
 };
 #define NILFS_SEGMENT_USAGE_FNS(flag,name) static inline void nilfs_segment_usage_set_ ##name(struct nilfs_segment_usage * su) \
-{ su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) | (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
+{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
 } static inline void nilfs_segment_usage_clear_ ##name(struct nilfs_segment_usage * su) \
-{ su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) & ~(1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
+{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) & ~(1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
 } static inline int nilfs_segment_usage_ ##name(const struct nilfs_segment_usage * su) \
-{ return ! ! (__le32_to_cpu(su->su_flags) & (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
+{ return ! ! (le32_to_cpu(su->su_flags) & (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
 }
 struct nilfs_sufile_header {
   __le64 sh_ncleansegs;
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index 082601d..29a7b66 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -168,8 +168,6 @@
   NL80211_CMD_PEER_MEASUREMENT_RESULT,
   NL80211_CMD_PEER_MEASUREMENT_COMPLETE,
   NL80211_CMD_NOTIFY_RADAR,
-  NL80211_CMD_UPDATE_OWE_INFO,
-  NL80211_CMD_PROBE_MESH_LINK,
   __NL80211_CMD_AFTER_LAST,
   NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
 };
@@ -460,11 +458,6 @@
   NL80211_ATTR_FTM_RESPONDER_STATS,
   NL80211_ATTR_TIMEOUT,
   NL80211_ATTR_PEER_MEASUREMENTS,
-  NL80211_ATTR_AIRTIME_WEIGHT,
-  NL80211_ATTR_STA_TX_POWER_SETTING,
-  NL80211_ATTR_STA_TX_POWER,
-  NL80211_ATTR_SAE_PASSWORD,
-  NL80211_ATTR_TWT_RESPONDER,
   __NL80211_ATTR_AFTER_LAST,
   NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
   NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -497,14 +490,14 @@
 #define NL80211_WIPHY_NAME_MAXLEN 64
 #define NL80211_MAX_SUPP_RATES 32
 #define NL80211_MAX_SUPP_HT_RATES 77
-#define NL80211_MAX_SUPP_REG_RULES 128
+#define NL80211_MAX_SUPP_REG_RULES 64
 #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
 #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
 #define NL80211_HT_CAPABILITY_LEN 26
 #define NL80211_VHT_CAPABILITY_LEN 12
 #define NL80211_HE_MIN_CAPABILITY_LEN 16
-#define NL80211_HE_MAX_CAPABILITY_LEN 54
+#define NL80211_HE_MAX_CAPABILITY_LEN 51
 #define NL80211_MAX_NR_CIPHER_SUITES 5
 #define NL80211_MAX_NR_AKM_SUITES 2
 #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10
@@ -635,9 +628,6 @@
   NL80211_STA_INFO_RX_MPDUS,
   NL80211_STA_INFO_FCS_ERROR_COUNT,
   NL80211_STA_INFO_CONNECTED_TO_GATE,
-  NL80211_STA_INFO_TX_DURATION,
-  NL80211_STA_INFO_AIRTIME_WEIGHT,
-  NL80211_STA_INFO_AIRTIME_LINK_METRIC,
   __NL80211_STA_INFO_AFTER_LAST,
   NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
 };
@@ -685,8 +675,6 @@
   NL80211_MPATH_INFO_FLAGS,
   NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
   NL80211_MPATH_INFO_DISCOVERY_RETRIES,
-  NL80211_MPATH_INFO_HOP_COUNT,
-  NL80211_MPATH_INFO_PATH_CHANGE,
   __NL80211_MPATH_INFO_AFTER_LAST,
   NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
 };
@@ -790,7 +778,6 @@
   NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI,
   NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST,
   NL80211_SCHED_SCAN_MATCH_ATTR_BSSID,
-  NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI,
   __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
   NL80211_SCHED_SCAN_MATCH_ATTR_MAX = __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1
 };
@@ -943,11 +930,6 @@
   NL80211_CHAN_HT40MINUS,
   NL80211_CHAN_HT40PLUS
 };
-enum nl80211_key_mode {
-  NL80211_KEY_RX_TX,
-  NL80211_KEY_NO_TX,
-  NL80211_KEY_SET_TX
-};
 enum nl80211_chan_width {
   NL80211_CHAN_WIDTH_20_NOHT,
   NL80211_CHAN_WIDTH_20,
@@ -1019,7 +1001,6 @@
 enum nl80211_wpa_versions {
   NL80211_WPA_VERSION_1 = 1 << 0,
   NL80211_WPA_VERSION_2 = 1 << 1,
-  NL80211_WPA_VERSION_3 = 1 << 2,
 };
 enum nl80211_key_default_types {
   __NL80211_KEY_DEFAULT_TYPE_INVALID,
@@ -1037,7 +1018,6 @@
   NL80211_KEY_DEFAULT_MGMT,
   NL80211_KEY_TYPE,
   NL80211_KEY_DEFAULT_TYPES,
-  NL80211_KEY_MODE,
   __NL80211_KEY_AFTER_LAST,
   NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
 };
@@ -1287,7 +1267,7 @@
   NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
   NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29,
   NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30,
-  NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1U << 31,
+  NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31,
 };
 enum nl80211_ext_feature_index {
   NL80211_EXT_FEATURE_VHT_IBSS,
@@ -1324,12 +1304,6 @@
   NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
   NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
   NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
-  NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
-  NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
-  NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
-  NL80211_EXT_FEATURE_EXT_KEY_ID,
-  NL80211_EXT_FEATURE_STA_TX_PWR,
-  NL80211_EXT_FEATURE_SAE_OFFLOAD,
   NUM_NL80211_EXT_FEATURES,
   MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
 };
@@ -1401,7 +1375,6 @@
 #define NL80211_CRIT_PROTO_MAX_DURATION 5000
 enum nl80211_rxmgmt_flags {
   NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
-  NL80211_RXMGMT_FLAG_EXTERNAL_AUTH = 1 << 1,
 };
 #define NL80211_VENDOR_ID_IS_LINUX 0x80000000
 struct nl80211_vendor_cmd_info {
diff --git a/libc/kernel/uapi/linux/openvswitch.h b/libc/kernel/uapi/linux/openvswitch.h
index 2344ab1..7e75ac6 100644
--- a/libc/kernel/uapi/linux/openvswitch.h
+++ b/libc/kernel/uapi/linux/openvswitch.h
@@ -205,7 +205,6 @@
   OVS_TUNNEL_KEY_ATTR_IPV6_DST,
   OVS_TUNNEL_KEY_ATTR_PAD,
   OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS,
-  OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE,
   __OVS_TUNNEL_KEY_ATTR_MAX
 };
 #define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1)
@@ -385,7 +384,6 @@
   OVS_CT_ATTR_NAT,
   OVS_CT_ATTR_FORCE_COMMIT,
   OVS_CT_ATTR_EVENTMASK,
-  OVS_CT_ATTR_TIMEOUT,
   __OVS_CT_ATTR_MAX
 };
 #define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1)
@@ -406,14 +404,6 @@
 struct ovs_action_push_eth {
   struct ovs_key_ethernet addresses;
 };
-enum ovs_check_pkt_len_attr {
-  OVS_CHECK_PKT_LEN_ATTR_UNSPEC,
-  OVS_CHECK_PKT_LEN_ATTR_PKT_LEN,
-  OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER,
-  OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL,
-  __OVS_CHECK_PKT_LEN_ATTR_MAX,
-};
-#define OVS_CHECK_PKT_LEN_ATTR_MAX (__OVS_CHECK_PKT_LEN_ATTR_MAX - 1)
 enum ovs_action_attr {
   OVS_ACTION_ATTR_UNSPEC,
   OVS_ACTION_ATTR_OUTPUT,
@@ -436,7 +426,6 @@
   OVS_ACTION_ATTR_POP_NSH,
   OVS_ACTION_ATTR_METER,
   OVS_ACTION_ATTR_CLONE,
-  OVS_ACTION_ATTR_CHECK_PKT_LEN,
   __OVS_ACTION_ATTR_MAX,
 };
 #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/pci_regs.h b/libc/kernel/uapi/linux/pci_regs.h
index bd4d98f..8122fbb 100644
--- a/libc/kernel/uapi/linux/pci_regs.h
+++ b/libc/kernel/uapi/linux/pci_regs.h
@@ -275,7 +275,7 @@
 #define PCI_MSIX_ENTRY_UPPER_ADDR 4
 #define PCI_MSIX_ENTRY_DATA 8
 #define PCI_MSIX_ENTRY_VECTOR_CTRL 12
-#define PCI_MSIX_ENTRY_CTRL_MASKBIT 0x00000001
+#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
 #define PCI_CHSWP_CSR 2
 #define PCI_CHSWP_DHA 0x01
 #define PCI_CHSWP_EIM 0x02
@@ -299,9 +299,6 @@
 #define PCI_EA_FIRST_ENT_BRIDGE 8
 #define PCI_EA_ES 0x00000007
 #define PCI_EA_BEI 0x000000f0
-#define PCI_EA_SEC_BUS_MASK 0xff
-#define PCI_EA_SUB_BUS_MASK 0xff00
-#define PCI_EA_SUB_BUS_SHIFT 8
 #define PCI_EA_BEI_BAR0 0
 #define PCI_EA_BEI_BAR5 5
 #define PCI_EA_BEI_BRIDGE 6
@@ -437,7 +434,6 @@
 #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002
 #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003
 #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004
-#define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005
 #define PCI_EXP_LNKCAP_MLW 0x000003f0
 #define PCI_EXP_LNKCAP_ASPMS 0x00000c00
 #define PCI_EXP_LNKCAP_L0SEL 0x00007000
@@ -466,7 +462,6 @@
 #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002
 #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003
 #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004
-#define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005
 #define PCI_EXP_LNKSTA_NLW 0x03f0
 #define PCI_EXP_LNKSTA_NLW_X1 0x0010
 #define PCI_EXP_LNKSTA_NLW_X2 0x0020
@@ -564,7 +559,6 @@
 #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004
 #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008
 #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010
-#define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020
 #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100
 #define PCI_EXP_LNKCTL2 48
 #define PCI_EXP_LNKCTL2_TLS 0x000f
@@ -572,7 +566,6 @@
 #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002
 #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003
 #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004
-#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005
 #define PCI_EXP_LNKSTA2 50
 #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52
 #define PCI_EXP_SLTCAP2 52
@@ -746,20 +739,18 @@
 #define PCI_ATS_CAP 0x04
 #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f)
 #define PCI_ATS_MAX_QDEP 32
-#define PCI_ATS_CAP_PAGE_ALIGNED 0x0020
 #define PCI_ATS_CTRL 0x06
 #define PCI_ATS_CTRL_ENABLE 0x8000
 #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f)
 #define PCI_ATS_MIN_STU 12
 #define PCI_EXT_CAP_ATS_SIZEOF 8
 #define PCI_PRI_CTRL 0x04
-#define PCI_PRI_CTRL_ENABLE 0x0001
-#define PCI_PRI_CTRL_RESET 0x0002
+#define PCI_PRI_CTRL_ENABLE 0x01
+#define PCI_PRI_CTRL_RESET 0x02
 #define PCI_PRI_STATUS 0x06
-#define PCI_PRI_STATUS_RF 0x0001
-#define PCI_PRI_STATUS_UPRGI 0x0002
-#define PCI_PRI_STATUS_STOPPED 0x0100
-#define PCI_PRI_STATUS_PASID 0x8000
+#define PCI_PRI_STATUS_RF 0x001
+#define PCI_PRI_STATUS_UPRGI 0x002
+#define PCI_PRI_STATUS_STOPPED 0x100
 #define PCI_PRI_MAX_REQ 0x08
 #define PCI_PRI_ALLOC_REQ 0x0c
 #define PCI_EXT_CAP_PRI_SIZEOF 16
@@ -772,16 +763,16 @@
 #define PCI_PASID_CTRL_PRIV 0x04
 #define PCI_EXT_CAP_PASID_SIZEOF 8
 #define PCI_SRIOV_CAP 0x04
-#define PCI_SRIOV_CAP_VFM 0x00000001
+#define PCI_SRIOV_CAP_VFM 0x01
 #define PCI_SRIOV_CAP_INTR(x) ((x) >> 21)
 #define PCI_SRIOV_CTRL 0x08
-#define PCI_SRIOV_CTRL_VFE 0x0001
-#define PCI_SRIOV_CTRL_VFM 0x0002
-#define PCI_SRIOV_CTRL_INTR 0x0004
-#define PCI_SRIOV_CTRL_MSE 0x0008
-#define PCI_SRIOV_CTRL_ARI 0x0010
+#define PCI_SRIOV_CTRL_VFE 0x01
+#define PCI_SRIOV_CTRL_VFM 0x02
+#define PCI_SRIOV_CTRL_INTR 0x04
+#define PCI_SRIOV_CTRL_MSE 0x08
+#define PCI_SRIOV_CTRL_ARI 0x10
 #define PCI_SRIOV_STATUS 0x0a
-#define PCI_SRIOV_STATUS_VFM 0x0001
+#define PCI_SRIOV_STATUS_VFM 0x01
 #define PCI_SRIOV_INITIAL_VF 0x0c
 #define PCI_SRIOV_TOTAL_VF 0x0e
 #define PCI_SRIOV_NUM_VF 0x10
@@ -808,13 +799,13 @@
 #define PCI_LTR_SCALE_SHIFT 10
 #define PCI_EXT_CAP_LTR_SIZEOF 8
 #define PCI_ACS_CAP 0x04
-#define PCI_ACS_SV 0x0001
-#define PCI_ACS_TB 0x0002
-#define PCI_ACS_RR 0x0004
-#define PCI_ACS_CR 0x0008
-#define PCI_ACS_UF 0x0010
-#define PCI_ACS_EC 0x0020
-#define PCI_ACS_DT 0x0040
+#define PCI_ACS_SV 0x01
+#define PCI_ACS_TB 0x02
+#define PCI_ACS_RR 0x04
+#define PCI_ACS_CR 0x08
+#define PCI_ACS_UF 0x10
+#define PCI_ACS_EC 0x20
+#define PCI_ACS_DT 0x40
 #define PCI_ACS_EGRESS_BITS 0x05
 #define PCI_ACS_CTRL 0x06
 #define PCI_ACS_EGRESS_CTL_V 0x08
diff --git a/libc/kernel/uapi/linux/perf_event.h b/libc/kernel/uapi/linux/perf_event.h
index 9048588..bf51785 100644
--- a/libc/kernel/uapi/linux/perf_event.h
+++ b/libc/kernel/uapi/linux/perf_event.h
@@ -198,7 +198,7 @@
   };
   __u64 sample_type;
   __u64 read_format;
-  __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, __reserved_1 : 33;
+  __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, __reserved_1 : 35;
   union {
     __u32 wakeup_events;
     __u32 wakeup_watermark;
@@ -230,6 +230,7 @@
   __u32 prog_cnt;
   __u32 ids[0];
 };
+#define perf_flags(attr) (* (& (attr)->read_format + 1))
 #define PERF_EVENT_IOC_ENABLE _IO('$', 0)
 #define PERF_EVENT_IOC_DISABLE _IO('$', 1)
 #define PERF_EVENT_IOC_REFRESH _IO('$', 2)
@@ -326,22 +327,8 @@
   PERF_RECORD_SWITCH = 14,
   PERF_RECORD_SWITCH_CPU_WIDE = 15,
   PERF_RECORD_NAMESPACES = 16,
-  PERF_RECORD_KSYMBOL = 17,
-  PERF_RECORD_BPF_EVENT = 18,
   PERF_RECORD_MAX,
 };
-enum perf_record_ksymbol_type {
-  PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0,
-  PERF_RECORD_KSYMBOL_TYPE_BPF = 1,
-  PERF_RECORD_KSYMBOL_TYPE_MAX
-};
-#define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0)
-enum perf_bpf_event_type {
-  PERF_BPF_EVENT_UNKNOWN = 0,
-  PERF_BPF_EVENT_PROG_LOAD = 1,
-  PERF_BPF_EVENT_PROG_UNLOAD = 2,
-  PERF_BPF_EVENT_MAX,
-};
 #define PERF_MAX_STACK_DEPTH 127
 #define PERF_MAX_CONTEXTS_PER_STACK 8
 enum perf_callchain_context {
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index 0727916..2018f0b 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -59,44 +59,9 @@
 #define TC_ACT_JUMP __TC_ACT_EXT(1)
 #define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2)
 #define TC_ACT_EXT_OPCODE_MAX TC_ACT_GOTO_CHAIN
-#define TCA_ACT_GACT 5
-#define TCA_ACT_IPT 6
-#define TCA_ACT_PEDIT 7
-#define TCA_ACT_MIRRED 8
-#define TCA_ACT_NAT 9
-#define TCA_ACT_XT 10
-#define TCA_ACT_SKBEDIT 11
-#define TCA_ACT_VLAN 12
-#define TCA_ACT_BPF 13
-#define TCA_ACT_CONNMARK 14
-#define TCA_ACT_SKBMOD 15
-#define TCA_ACT_CSUM 16
-#define TCA_ACT_TUNNEL_KEY 17
-#define TCA_ACT_SIMP 22
-#define TCA_ACT_IFE 25
-#define TCA_ACT_SAMPLE 26
-enum tca_id {
+enum {
   TCA_ID_UNSPEC = 0,
   TCA_ID_POLICE = 1,
-  TCA_ID_GACT = TCA_ACT_GACT,
-  TCA_ID_IPT = TCA_ACT_IPT,
-  TCA_ID_PEDIT = TCA_ACT_PEDIT,
-  TCA_ID_MIRRED = TCA_ACT_MIRRED,
-  TCA_ID_NAT = TCA_ACT_NAT,
-  TCA_ID_XT = TCA_ACT_XT,
-  TCA_ID_SKBEDIT = TCA_ACT_SKBEDIT,
-  TCA_ID_VLAN = TCA_ACT_VLAN,
-  TCA_ID_BPF = TCA_ACT_BPF,
-  TCA_ID_CONNMARK = TCA_ACT_CONNMARK,
-  TCA_ID_SKBMOD = TCA_ACT_SKBMOD,
-  TCA_ID_CSUM = TCA_ACT_CSUM,
-  TCA_ID_TUNNEL_KEY = TCA_ACT_TUNNEL_KEY,
-  TCA_ID_SIMP = TCA_ACT_SIMP,
-  TCA_ID_IFE = TCA_ACT_IFE,
-  TCA_ID_SAMPLE = TCA_ACT_SAMPLE,
-  TCA_ID_CTINFO,
-  TCA_ID_MPLS,
-  TCA_ID_CT,
   __TCA_ID_MAX = 255
 };
 #define TCA_ID_MAX __TCA_ID_MAX
@@ -302,18 +267,12 @@
   __TCA_FLOW_MAX
 };
 #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1)
-struct tc_basic_pcnt {
-  __u64 rcnt;
-  __u64 rhit;
-};
 enum {
   TCA_BASIC_UNSPEC,
   TCA_BASIC_CLASSID,
   TCA_BASIC_EMATCHES,
   TCA_BASIC_ACT,
   TCA_BASIC_POLICE,
-  TCA_BASIC_PCNT,
-  TCA_BASIC_PAD,
   __TCA_BASIC_MAX
 };
 #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
@@ -434,24 +393,10 @@
   TCA_FLOWER_KEY_PORT_SRC_MAX,
   TCA_FLOWER_KEY_PORT_DST_MIN,
   TCA_FLOWER_KEY_PORT_DST_MAX,
-  TCA_FLOWER_KEY_CT_STATE,
-  TCA_FLOWER_KEY_CT_STATE_MASK,
-  TCA_FLOWER_KEY_CT_ZONE,
-  TCA_FLOWER_KEY_CT_ZONE_MASK,
-  TCA_FLOWER_KEY_CT_MARK,
-  TCA_FLOWER_KEY_CT_MARK_MASK,
-  TCA_FLOWER_KEY_CT_LABELS,
-  TCA_FLOWER_KEY_CT_LABELS_MASK,
   __TCA_FLOWER_MAX,
 };
 #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
 enum {
-  TCA_FLOWER_KEY_CT_FLAGS_NEW = 1 << 0,
-  TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1,
-  TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2,
-  TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3,
-};
-enum {
   TCA_FLOWER_KEY_ENC_OPTS_UNSPEC,
   TCA_FLOWER_KEY_ENC_OPTS_GENEVE,
   __TCA_FLOWER_KEY_ENC_OPTS_MAX,
@@ -470,16 +415,11 @@
   TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
 };
 #define TCA_FLOWER_MASK_FLAGS_RANGE (1 << 0)
-struct tc_matchall_pcnt {
-  __u64 rhit;
-};
 enum {
   TCA_MATCHALL_UNSPEC,
   TCA_MATCHALL_CLASSID,
   TCA_MATCHALL_ACT,
   TCA_MATCHALL_FLAGS,
-  TCA_MATCHALL_PCNT,
-  TCA_MATCHALL_PAD,
   __TCA_MATCHALL_MAX,
 };
 #define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1)
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index 15ee3b0..dc0cd2f 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -18,7 +18,6 @@
  ****************************************************************************/
 #ifndef __LINUX_PKT_SCHED_H
 #define __LINUX_PKT_SCHED_H
-#include <linux/const.h>
 #include <linux/types.h>
 #define TC_PRIO_BESTEFFORT 0
 #define TC_PRIO_FILLER 1
@@ -714,7 +713,7 @@
 };
 #define TCA_PIE_MAX (__TCA_PIE_MAX - 1)
 struct tc_pie_xstats {
-  __u64 prob;
+  __u32 prob;
   __u32 delay;
   __u32 avg_dq_rate;
   __u32 packets_in;
@@ -741,9 +740,8 @@
   __s32 delta;
   __s32 clockid;
   __u32 flags;
-#define TC_ETF_DEADLINE_MODE_ON _BITUL(0)
-#define TC_ETF_OFFLOAD_ON _BITUL(1)
-#define TC_ETF_SKIP_SOCK_CHECK _BITUL(2)
+#define TC_ETF_DEADLINE_MODE_ON BIT(0)
+#define TC_ETF_OFFLOAD_ON BIT(1)
 };
 enum {
   TCA_ETF_UNSPEC,
@@ -770,7 +768,6 @@
   TCA_CAKE_INGRESS,
   TCA_CAKE_ACK_FILTER,
   TCA_CAKE_SPLIT_GSO,
-  TCA_CAKE_FWMARK,
   __TCA_CAKE_MAX
 };
 #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1)
@@ -877,7 +874,6 @@
   __TCA_TAPRIO_SCHED_MAX,
 };
 #define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1)
-#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST 0x1
 enum {
   TCA_TAPRIO_ATTR_UNSPEC,
   TCA_TAPRIO_ATTR_PRIOMAP,
@@ -886,11 +882,6 @@
   TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY,
   TCA_TAPRIO_ATTR_SCHED_CLOCKID,
   TCA_TAPRIO_PAD,
-  TCA_TAPRIO_ATTR_ADMIN_SCHED,
-  TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME,
-  TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION,
-  TCA_TAPRIO_ATTR_FLAGS,
-  TCA_TAPRIO_ATTR_TXTIME_DELAY,
   __TCA_TAPRIO_ATTR_MAX,
 };
 #define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/pmu.h b/libc/kernel/uapi/linux/pmu.h
index d3d08b0..2c7ffef 100644
--- a/libc/kernel/uapi/linux/pmu.h
+++ b/libc/kernel/uapi/linux/pmu.h
@@ -23,9 +23,7 @@
 #define PMU_POWER_CTRL 0x11
 #define PMU_ADB_CMD 0x20
 #define PMU_ADB_POLL_OFF 0x21
-#define PMU_WRITE_XPRAM 0x32
 #define PMU_WRITE_NVRAM 0x33
-#define PMU_READ_XPRAM 0x3a
 #define PMU_READ_NVRAM 0x3b
 #define PMU_SET_RTC 0x30
 #define PMU_READ_RTC 0x38
diff --git a/libc/kernel/uapi/linux/prctl.h b/libc/kernel/uapi/linux/prctl.h
index 9015e29..5031e8d 100644
--- a/libc/kernel/uapi/linux/prctl.h
+++ b/libc/kernel/uapi/linux/prctl.h
@@ -143,7 +143,6 @@
 #define PR_SPEC_ENABLE (1UL << 1)
 #define PR_SPEC_DISABLE (1UL << 2)
 #define PR_SPEC_FORCE_DISABLE (1UL << 3)
-#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
 #define PR_PAC_RESET_KEYS 54
 #define PR_PAC_APIAKEY (1UL << 0)
 #define PR_PAC_APIBKEY (1UL << 1)
diff --git a/libc/kernel/uapi/linux/psci.h b/libc/kernel/uapi/linux/psci.h
index bc522e7..658552a 100644
--- a/libc/kernel/uapi/linux/psci.h
+++ b/libc/kernel/uapi/linux/psci.h
@@ -40,10 +40,7 @@
 #define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7)
 #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10)
 #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14)
-#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15)
-#define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18)
 #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14)
-#define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18)
 #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff
 #define PSCI_0_2_POWER_STATE_ID_SHIFT 0
 #define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16
@@ -68,9 +65,6 @@
 #define PSCI_VERSION(maj,min) ((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | ((min) & PSCI_VERSION_MINOR_MASK))
 #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1
 #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT)
-#define PSCI_1_0_OS_INITIATED BIT(0)
-#define PSCI_1_0_SUSPEND_MODE_PC 0
-#define PSCI_1_0_SUSPEND_MODE_OSI 1
 #define PSCI_RET_SUCCESS 0
 #define PSCI_RET_NOT_SUPPORTED - 1
 #define PSCI_RET_INVALID_PARAMS - 2
diff --git a/libc/kernel/uapi/linux/psp-sev.h b/libc/kernel/uapi/linux/psp-sev.h
index b3f88dc..10582d4 100644
--- a/libc/kernel/uapi/linux/psp-sev.h
+++ b/libc/kernel/uapi/linux/psp-sev.h
@@ -28,7 +28,6 @@
   SEV_PDH_CERT_EXPORT,
   SEV_PEK_CERT_IMPORT,
   SEV_GET_ID,
-  SEV_GET_ID2,
   SEV_MAX,
 };
 typedef enum {
@@ -84,10 +83,6 @@
   __u8 socket1[64];
   __u8 socket2[64];
 } __packed;
-struct sev_user_data_get_id2 {
-  __u64 address;
-  __u32 length;
-} __packed;
 struct sev_issue_cmd {
   __u32 cmd;
   __u64 data;
diff --git a/libc/kernel/uapi/linux/ptrace.h b/libc/kernel/uapi/linux/ptrace.h
index a1528db..4a68738 100644
--- a/libc/kernel/uapi/linux/ptrace.h
+++ b/libc/kernel/uapi/linux/ptrace.h
@@ -55,34 +55,6 @@
   __u64 filter_off;
   __u64 flags;
 };
-#define PTRACE_GET_SYSCALL_INFO 0x420e
-#define PTRACE_SYSCALL_INFO_NONE 0
-#define PTRACE_SYSCALL_INFO_ENTRY 1
-#define PTRACE_SYSCALL_INFO_EXIT 2
-#define PTRACE_SYSCALL_INFO_SECCOMP 3
-struct ptrace_syscall_info {
-  __u8 op;
-  __u32 arch __attribute__((__aligned__(sizeof(__u32))));
-  __u64 instruction_pointer;
-  __u64 stack_pointer;
-  union {
-    struct {
-      __u64 nr;
-      __u64 args[6];
-    } entry;
-    struct {
-      __s64 rval;
-      __u8 is_error;
-    } exit;
-    struct {
-      __u64 nr;
-      __u64 args[6];
-      __u32 ret_data;
-    } seccomp;
-  };
-};
-#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
-#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
 #define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
 #define PTRACE_EVENT_FORK 1
 #define PTRACE_EVENT_VFORK 2
diff --git a/libc/kernel/uapi/linux/rds.h b/libc/kernel/uapi/linux/rds.h
index 537aab5..05da0cd 100644
--- a/libc/kernel/uapi/linux/rds.h
+++ b/libc/kernel/uapi/linux/rds.h
@@ -36,9 +36,6 @@
 #define RDS_TRANS_TCP 2
 #define RDS_TRANS_COUNT 3
 #define RDS_TRANS_NONE (~0)
-#define SIOCRDSSETTOS (SIOCPROTOPRIVATE)
-#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1)
-typedef __u8 rds_tos_t;
 #define RDS_CMSG_RDMA_ARGS 1
 #define RDS_CMSG_RDMA_DEST 2
 #define RDS_CMSG_RDMA_MAP 3
@@ -85,7 +82,6 @@
   __be32 faddr;
   __u8 transport[TRANSNAMSIZ];
   __u8 flags;
-  __u8 tos;
 } __attribute__((packed));
 struct rds6_info_connection {
   __u64 next_tx_seq;
@@ -105,7 +101,6 @@
   __be16 lport;
   __be16 fport;
   __u8 flags;
-  __u8 tos;
 } __attribute__((packed));
 struct rds6_info_message {
   __u64 seq;
@@ -145,7 +140,6 @@
   __u32 last_sent_nxt;
   __u32 last_expected_una;
   __u32 last_seen_una;
-  __u8 tos;
 } __attribute__((packed));
 struct rds6_info_tcp_socket {
   struct in6_addr local_addr;
@@ -169,9 +163,6 @@
   __u32 max_send_sge;
   __u32 rdma_mr_max;
   __u32 rdma_mr_size;
-  __u8 tos;
-  __u8 sl;
-  __u32 cache_allocs;
 };
 struct rds6_info_rdma_connection {
   struct in6_addr src_addr;
@@ -183,9 +174,6 @@
   __u32 max_send_sge;
   __u32 rdma_mr_max;
   __u32 rdma_mr_size;
-  __u8 tos;
-  __u8 sl;
-  __u32 cache_allocs;
 };
 enum rds_message_rxpath_latency {
   RDS_MSG_RX_HDR_TO_DGRAM_START = 0,
diff --git a/libc/kernel/uapi/linux/rtnetlink.h b/libc/kernel/uapi/linux/rtnetlink.h
index b0feb7e..33af1b3 100644
--- a/libc/kernel/uapi/linux/rtnetlink.h
+++ b/libc/kernel/uapi/linux/rtnetlink.h
@@ -139,12 +139,6 @@
 #define RTM_DELCHAIN RTM_DELCHAIN
   RTM_GETCHAIN,
 #define RTM_GETCHAIN RTM_GETCHAIN
-  RTM_NEWNEXTHOP = 104,
-#define RTM_NEWNEXTHOP RTM_NEWNEXTHOP
-  RTM_DELNEXTHOP,
-#define RTM_DELNEXTHOP RTM_DELNEXTHOP
-  RTM_GETNEXTHOP,
-#define RTM_GETNEXTHOP RTM_GETNEXTHOP
   __RTM_MAX,
 #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
 };
@@ -263,7 +257,6 @@
   RTA_IP_PROTO,
   RTA_SPORT,
   RTA_DPORT,
-  RTA_NH_ID,
   __RTA_MAX
 };
 #define RTA_MAX (__RTA_MAX - 1)
@@ -529,8 +522,6 @@
 #define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R
   RTNLGRP_IPV6_MROUTE_R,
 #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R
-  RTNLGRP_NEXTHOP,
-#define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP
   __RTNLGRP_MAX
 };
 #define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/sched.h b/libc/kernel/uapi/linux/sched.h
index b396348..20d4956 100644
--- a/libc/kernel/uapi/linux/sched.h
+++ b/libc/kernel/uapi/linux/sched.h
@@ -18,13 +18,11 @@
  ****************************************************************************/
 #ifndef _UAPI_LINUX_SCHED_H
 #define _UAPI_LINUX_SCHED_H
-#include <linux/types.h>
 #define CSIGNAL 0x000000ff
 #define CLONE_VM 0x00000100
 #define CLONE_FS 0x00000200
 #define CLONE_FILES 0x00000400
 #define CLONE_SIGHAND 0x00000800
-#define CLONE_PIDFD 0x00001000
 #define CLONE_PTRACE 0x00002000
 #define CLONE_VFORK 0x00004000
 #define CLONE_PARENT 0x00008000
@@ -44,16 +42,6 @@
 #define CLONE_NEWPID 0x20000000
 #define CLONE_NEWNET 0x40000000
 #define CLONE_IO 0x80000000
-struct clone_args {
-  __aligned_u64 flags;
-  __aligned_u64 pidfd;
-  __aligned_u64 child_tid;
-  __aligned_u64 parent_tid;
-  __aligned_u64 exit_signal;
-  __aligned_u64 stack;
-  __aligned_u64 stack_size;
-  __aligned_u64 tls;
-};
 #define SCHED_NORMAL 0
 #define SCHED_FIFO 1
 #define SCHED_RR 2
@@ -64,11 +52,5 @@
 #define SCHED_FLAG_RESET_ON_FORK 0x01
 #define SCHED_FLAG_RECLAIM 0x02
 #define SCHED_FLAG_DL_OVERRUN 0x04
-#define SCHED_FLAG_KEEP_POLICY 0x08
-#define SCHED_FLAG_KEEP_PARAMS 0x10
-#define SCHED_FLAG_UTIL_CLAMP_MIN 0x20
-#define SCHED_FLAG_UTIL_CLAMP_MAX 0x40
-#define SCHED_FLAG_KEEP_ALL (SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS)
-#define SCHED_FLAG_UTIL_CLAMP (SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX)
-#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN | SCHED_FLAG_KEEP_ALL | SCHED_FLAG_UTIL_CLAMP)
+#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN)
 #endif
diff --git a/libc/kernel/uapi/linux/sched/types.h b/libc/kernel/uapi/linux/sched/types.h
index 385b21a..cf6f1c7 100644
--- a/libc/kernel/uapi/linux/sched/types.h
+++ b/libc/kernel/uapi/linux/sched/types.h
@@ -23,7 +23,6 @@
   int sched_priority;
 };
 #define SCHED_ATTR_SIZE_VER0 48
-#define SCHED_ATTR_SIZE_VER1 56
 struct sched_attr {
   __u32 size;
   __u32 sched_policy;
@@ -33,7 +32,5 @@
   __u64 sched_runtime;
   __u64 sched_deadline;
   __u64 sched_period;
-  __u32 sched_util_min;
-  __u32 sched_util_max;
 };
 #endif
diff --git a/libc/kernel/uapi/linux/sctp.h b/libc/kernel/uapi/linux/sctp.h
index 18c5d21..66fde70 100644
--- a/libc/kernel/uapi/linux/sctp.h
+++ b/libc/kernel/uapi/linux/sctp.h
@@ -21,9 +21,6 @@
 #include <linux/types.h>
 #include <linux/socket.h>
 typedef __s32 sctp_assoc_t;
-#define SCTP_FUTURE_ASSOC 0
-#define SCTP_CURRENT_ASSOC 1
-#define SCTP_ALL_ASSOC 2
 #define SCTP_RTOINFO 0
 #define SCTP_ASSOCINFO 1
 #define SCTP_INITMSG 2
diff --git a/libc/kernel/uapi/linux/sed-opal.h b/libc/kernel/uapi/linux/sed-opal.h
index fc12509..a532073 100644
--- a/libc/kernel/uapi/linux/sed-opal.h
+++ b/libc/kernel/uapi/linux/sed-opal.h
@@ -25,10 +25,6 @@
   OPAL_MBR_ENABLE = 0x0,
   OPAL_MBR_DISABLE = 0x01,
 };
-enum opal_mbr_done_flag {
-  OPAL_MBR_NOT_DONE = 0x0,
-  OPAL_MBR_DONE = 0x01
-};
 enum opal_user {
   OPAL_ADMIN1 = 0x0,
   OPAL_USER1 = 0x01,
@@ -85,17 +81,6 @@
   __u8 enable_disable;
   __u8 __align[7];
 };
-struct opal_mbr_done {
-  struct opal_key key;
-  __u8 done_flag;
-  __u8 __align[7];
-};
-struct opal_shadow_mbr {
-  struct opal_key key;
-  const __u64 data;
-  __u64 offset;
-  __u64 size;
-};
 #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
 #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
 #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
@@ -108,7 +93,4 @@
 #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
 #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
 #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
-#define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key)
-#define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
-#define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
 #endif
diff --git a/libc/kernel/uapi/linux/serial_core.h b/libc/kernel/uapi/linux/serial_core.h
index 29fcdf4..b9af467 100644
--- a/libc/kernel/uapi/linux/serial_core.h
+++ b/libc/kernel/uapi/linux/serial_core.h
@@ -60,7 +60,6 @@
 #define PORT_SUNZILOG 38
 #define PORT_SUNSAB 39
 #define PORT_NPCM 40
-#define PORT_TEGRA_TCU 41
 #define PORT_PCH_8LINE 44
 #define PORT_PCH_2LINE 45
 #define PORT_DZ 46
@@ -88,6 +87,7 @@
 #define PORT_M32R_SIO 68
 #define PORT_JSM 69
 #define PORT_PNX8XXX 70
+#define PORT_NETX 71
 #define PORT_SUNHV 72
 #define PORT_S3C2412 73
 #define PORT_UARTLITE 74
@@ -135,6 +135,4 @@
 #define PORT_MPS2UART 116
 #define PORT_MTK_BTIF 117
 #define PORT_RDA 118
-#define PORT_MLB_USIO 119
-#define PORT_SIFIVE_V0 120
 #endif
diff --git a/libc/kernel/uapi/linux/snmp.h b/libc/kernel/uapi/linux/snmp.h
index 9f500ca..75dea54 100644
--- a/libc/kernel/uapi/linux/snmp.h
+++ b/libc/kernel/uapi/linux/snmp.h
@@ -250,8 +250,6 @@
   LINUX_MIB_TCPACKCOMPRESSED,
   LINUX_MIB_TCPZEROWINDOWDROP,
   LINUX_MIB_TCPRCVQDROP,
-  LINUX_MIB_TCPWQUEUETOOBIG,
-  LINUX_MIB_TCPFASTOPENPASSIVEALTKEY,
   __LINUX_MIB_MAX
 };
 enum {
diff --git a/libc/kernel/uapi/linux/socket.h b/libc/kernel/uapi/linux/socket.h
index 608d31f..4f52bcb 100644
--- a/libc/kernel/uapi/linux/socket.h
+++ b/libc/kernel/uapi/linux/socket.h
@@ -19,14 +19,10 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 #define _K_SS_MAXSIZE 128
+#define _K_SS_ALIGNSIZE (__alignof__(struct sockaddr *))
 typedef unsigned short __kernel_sa_family_t;
 struct sockaddr_storage {
-  union {
-    struct {
-      __kernel_sa_family_t ss_family;
-      char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
-    };
-    void * __align;
-  };
-};
+  __kernel_sa_family_t ss_family;
+  char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
+} __attribute__((aligned(_K_SS_ALIGNSIZE)));
 #endif
diff --git a/libc/kernel/uapi/linux/sockios.h b/libc/kernel/uapi/linux/sockios.h
index 2d13d93..c68a5b1 100644
--- a/libc/kernel/uapi/linux/sockios.h
+++ b/libc/kernel/uapi/linux/sockios.h
@@ -18,20 +18,10 @@
  ****************************************************************************/
 #ifndef _LINUX_SOCKIOS_H
 #define _LINUX_SOCKIOS_H
-#include <asm/bitsperlong.h>
 #include <asm/sockios.h>
 #define SIOCINQ FIONREAD
 #define SIOCOUTQ TIOCOUTQ
 #define SOCK_IOC_TYPE 0x89
-#define SIOCGSTAMP_NEW _IOR(SOCK_IOC_TYPE, 0x06, long long[2])
-#define SIOCGSTAMPNS_NEW _IOR(SOCK_IOC_TYPE, 0x07, long long[2])
-#if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
-#define SIOCGSTAMP SIOCGSTAMP_OLD
-#define SIOCGSTAMPNS SIOCGSTAMPNS_OLD
-#else
-#define SIOCGSTAMP ((sizeof(struct timeval)) == 8 ? SIOCGSTAMP_OLD : SIOCGSTAMP_NEW)
-#define SIOCGSTAMPNS ((sizeof(struct timespec)) == 8 ? SIOCGSTAMPNS_OLD : SIOCGSTAMPNS_NEW)
-#endif
 #define SIOCADDRT 0x890B
 #define SIOCDELRT 0x890C
 #define SIOCRTMSG 0x890D
diff --git a/libc/kernel/uapi/linux/spi/spidev.h b/libc/kernel/uapi/linux/spi/spidev.h
index 343285b..2fe8264 100644
--- a/libc/kernel/uapi/linux/spi/spidev.h
+++ b/libc/kernel/uapi/linux/spi/spidev.h
@@ -47,8 +47,7 @@
   __u8 cs_change;
   __u8 tx_nbits;
   __u8 rx_nbits;
-  __u8 word_delay_usecs;
-  __u8 pad;
+  __u16 pad;
 };
 #define SPI_MSGSIZE(N) ((((N) * (sizeof(struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) ? ((N) * (sizeof(struct spi_ioc_transfer))) : 0)
 #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
diff --git a/libc/kernel/uapi/linux/switchtec_ioctl.h b/libc/kernel/uapi/linux/switchtec_ioctl.h
index 2143148..09cf9cd 100644
--- a/libc/kernel/uapi/linux/switchtec_ioctl.h
+++ b/libc/kernel/uapi/linux/switchtec_ioctl.h
@@ -46,21 +46,13 @@
   __u32 length;
   __u32 active;
 };
-struct switchtec_ioctl_event_summary_legacy {
-  __u64 global;
-  __u64 part_bitmap;
-  __u32 local_part;
-  __u32 padding;
-  __u32 part[48];
-  __u32 pff[48];
-};
 struct switchtec_ioctl_event_summary {
   __u64 global;
   __u64 part_bitmap;
   __u32 local_part;
   __u32 padding;
   __u32 part[48];
-  __u32 pff[255];
+  __u32 pff[48];
 };
 #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0
 #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1
@@ -122,7 +114,6 @@
 #define SWITCHTEC_IOCTL_FLASH_INFO _IOR('W', 0x40, struct switchtec_ioctl_flash_info)
 #define SWITCHTEC_IOCTL_FLASH_PART_INFO _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info)
 #define SWITCHTEC_IOCTL_EVENT_SUMMARY _IOR('W', 0x42, struct switchtec_ioctl_event_summary)
-#define SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY _IOR('W', 0x42, struct switchtec_ioctl_event_summary_legacy)
 #define SWITCHTEC_IOCTL_EVENT_CTL _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl)
 #define SWITCHTEC_IOCTL_PFF_TO_PORT _IOWR('W', 0x44, struct switchtec_ioctl_pff_port)
 #define SWITCHTEC_IOCTL_PORT_TO_PFF _IOWR('W', 0x45, struct switchtec_ioctl_pff_port)
diff --git a/libc/kernel/uapi/linux/tc_act/tc_bpf.h b/libc/kernel/uapi/linux/tc_act/tc_bpf.h
index 48094d4..c4963a5 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_bpf.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_bpf.h
@@ -19,6 +19,7 @@
 #ifndef __LINUX_TC_BPF_H
 #define __LINUX_TC_BPF_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_BPF 13
 struct tc_act_bpf {
   tc_gen;
 };
diff --git a/libc/kernel/uapi/linux/tc_act/tc_connmark.h b/libc/kernel/uapi/linux/tc_act/tc_connmark.h
index 5fe979c..32cc44b 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_connmark.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_connmark.h
@@ -20,6 +20,7 @@
 #define __UAPI_TC_CONNMARK_H
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
+#define TCA_ACT_CONNMARK 14
 struct tc_connmark {
   tc_gen;
   __u16 zone;
diff --git a/libc/kernel/uapi/linux/tc_act/tc_csum.h b/libc/kernel/uapi/linux/tc_act/tc_csum.h
index 1fcd00d..7de4019 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_csum.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_csum.h
@@ -20,6 +20,7 @@
 #define __LINUX_TC_CSUM_H
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
+#define TCA_ACT_CSUM 16
 enum {
   TCA_CSUM_UNSPEC,
   TCA_CSUM_PARMS,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ct.h b/libc/kernel/uapi/linux/tc_act/tc_ct.h
deleted file mode 100644
index 0443b95..0000000
--- a/libc/kernel/uapi/linux/tc_act/tc_ct.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __UAPI_TC_CT_H
-#define __UAPI_TC_CT_H
-#include <linux/types.h>
-#include <linux/pkt_cls.h>
-enum {
-  TCA_CT_UNSPEC,
-  TCA_CT_PARMS,
-  TCA_CT_TM,
-  TCA_CT_ACTION,
-  TCA_CT_ZONE,
-  TCA_CT_MARK,
-  TCA_CT_MARK_MASK,
-  TCA_CT_LABELS,
-  TCA_CT_LABELS_MASK,
-  TCA_CT_NAT_IPV4_MIN,
-  TCA_CT_NAT_IPV4_MAX,
-  TCA_CT_NAT_IPV6_MIN,
-  TCA_CT_NAT_IPV6_MAX,
-  TCA_CT_NAT_PORT_MIN,
-  TCA_CT_NAT_PORT_MAX,
-  TCA_CT_PAD,
-  __TCA_CT_MAX
-};
-#define TCA_CT_MAX (__TCA_CT_MAX - 1)
-#define TCA_CT_ACT_COMMIT (1 << 0)
-#define TCA_CT_ACT_FORCE (1 << 1)
-#define TCA_CT_ACT_CLEAR (1 << 2)
-#define TCA_CT_ACT_NAT (1 << 3)
-#define TCA_CT_ACT_NAT_SRC (1 << 4)
-#define TCA_CT_ACT_NAT_DST (1 << 5)
-struct tc_ct {
-  tc_gen;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ctinfo.h b/libc/kernel/uapi/linux/tc_act/tc_ctinfo.h
deleted file mode 100644
index 18fdf60..0000000
--- a/libc/kernel/uapi/linux/tc_act/tc_ctinfo.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __UAPI_TC_CTINFO_H
-#define __UAPI_TC_CTINFO_H
-#include <linux/types.h>
-#include <linux/pkt_cls.h>
-struct tc_ctinfo {
-  tc_gen;
-};
-enum {
-  TCA_CTINFO_UNSPEC,
-  TCA_CTINFO_PAD,
-  TCA_CTINFO_TM,
-  TCA_CTINFO_ACT,
-  TCA_CTINFO_ZONE,
-  TCA_CTINFO_PARMS_DSCP_MASK,
-  TCA_CTINFO_PARMS_DSCP_STATEMASK,
-  TCA_CTINFO_PARMS_CPMARK_MASK,
-  TCA_CTINFO_STATS_DSCP_SET,
-  TCA_CTINFO_STATS_DSCP_ERROR,
-  TCA_CTINFO_STATS_CPMARK_SET,
-  __TCA_CTINFO_MAX
-};
-#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_gact.h b/libc/kernel/uapi/linux/tc_act/tc_gact.h
index ac96dff..11d8533 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_gact.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_gact.h
@@ -20,6 +20,7 @@
 #define __LINUX_TC_GACT_H
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
+#define TCA_ACT_GACT 5
 struct tc_gact {
   tc_gen;
 };
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ife.h b/libc/kernel/uapi/linux/tc_act/tc_ife.h
index 346ebac..3193be0 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_ife.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_ife.h
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 #include <linux/ife.h>
+#define TCA_ACT_IFE 25
 #define IFE_ENCODE 1
 #define IFE_DECODE 0
 struct tc_ife {
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ipt.h b/libc/kernel/uapi/linux/tc_act/tc_ipt.h
index d578ce7..89b0706 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_ipt.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_ipt.h
@@ -19,6 +19,8 @@
 #ifndef __LINUX_TC_IPT_H
 #define __LINUX_TC_IPT_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_IPT 6
+#define TCA_ACT_XT 10
 enum {
   TCA_IPT_UNSPEC,
   TCA_IPT_TABLE,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_mirred.h b/libc/kernel/uapi/linux/tc_act/tc_mirred.h
index af04d03..2eb4f81 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_mirred.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_mirred.h
@@ -20,6 +20,7 @@
 #define __LINUX_TC_MIR_H
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
+#define TCA_ACT_MIRRED 8
 #define TCA_EGRESS_REDIR 1
 #define TCA_EGRESS_MIRROR 2
 #define TCA_INGRESS_REDIR 3
diff --git a/libc/kernel/uapi/linux/tc_act/tc_mpls.h b/libc/kernel/uapi/linux/tc_act/tc_mpls.h
deleted file mode 100644
index e1a4905..0000000
--- a/libc/kernel/uapi/linux/tc_act/tc_mpls.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __LINUX_TC_MPLS_H
-#define __LINUX_TC_MPLS_H
-#include <linux/pkt_cls.h>
-#define TCA_MPLS_ACT_POP 1
-#define TCA_MPLS_ACT_PUSH 2
-#define TCA_MPLS_ACT_MODIFY 3
-#define TCA_MPLS_ACT_DEC_TTL 4
-struct tc_mpls {
-  tc_gen;
-  int m_action;
-};
-enum {
-  TCA_MPLS_UNSPEC,
-  TCA_MPLS_TM,
-  TCA_MPLS_PARMS,
-  TCA_MPLS_PAD,
-  TCA_MPLS_PROTO,
-  TCA_MPLS_LABEL,
-  TCA_MPLS_TC,
-  TCA_MPLS_TTL,
-  TCA_MPLS_BOS,
-  __TCA_MPLS_MAX,
-};
-#define TCA_MPLS_MAX (__TCA_MPLS_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_nat.h b/libc/kernel/uapi/linux/tc_act/tc_nat.h
index 14aeffb..093c7da 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_nat.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_nat.h
@@ -20,6 +20,7 @@
 #define __LINUX_TC_NAT_H
 #include <linux/pkt_cls.h>
 #include <linux/types.h>
+#define TCA_ACT_NAT 9
 enum {
   TCA_NAT_UNSPEC,
   TCA_NAT_PARMS,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_pedit.h b/libc/kernel/uapi/linux/tc_act/tc_pedit.h
index cb8bd22..93eb1dc 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_pedit.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_pedit.h
@@ -20,6 +20,7 @@
 #define __LINUX_TC_PED_H
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
+#define TCA_ACT_PEDIT 7
 enum {
   TCA_PEDIT_UNSPEC,
   TCA_PEDIT_TM,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_sample.h b/libc/kernel/uapi/linux/tc_act/tc_sample.h
index 7d9a32e..64f5d08 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_sample.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_sample.h
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 #include <linux/if_ether.h>
+#define TCA_ACT_SAMPLE 26
 struct tc_sample {
   tc_gen;
 };
diff --git a/libc/kernel/uapi/linux/tc_act/tc_skbedit.h b/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
index 5706d4d..30d529a 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
@@ -19,6 +19,7 @@
 #ifndef __LINUX_TC_SKBEDIT_H
 #define __LINUX_TC_SKBEDIT_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_SKBEDIT 11
 #define SKBEDIT_F_PRIORITY 0x1
 #define SKBEDIT_F_QUEUE_MAPPING 0x2
 #define SKBEDIT_F_MARK 0x4
diff --git a/libc/kernel/uapi/linux/tc_act/tc_skbmod.h b/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
index 0a53b06..5b34c28 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
@@ -19,6 +19,7 @@
 #ifndef __LINUX_TC_SKBMOD_H
 #define __LINUX_TC_SKBMOD_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_SKBMOD 15
 #define SKBMOD_F_DMAC 0x1
 #define SKBMOD_F_SMAC 0x2
 #define SKBMOD_F_ETYPE 0x4
diff --git a/libc/kernel/uapi/linux/tc_act/tc_tunnel_key.h b/libc/kernel/uapi/linux/tc_act/tc_tunnel_key.h
index 4511b18..bd5fb24 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_tunnel_key.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_tunnel_key.h
@@ -19,6 +19,7 @@
 #ifndef __LINUX_TC_TUNNEL_KEY_H
 #define __LINUX_TC_TUNNEL_KEY_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_TUNNEL_KEY 17
 #define TCA_TUNNEL_KEY_ACT_SET 1
 #define TCA_TUNNEL_KEY_ACT_RELEASE 2
 struct tc_tunnel_key {
diff --git a/libc/kernel/uapi/linux/tc_act/tc_vlan.h b/libc/kernel/uapi/linux/tc_act/tc_vlan.h
index ecd445d..b1b8ce7 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_vlan.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_vlan.h
@@ -19,6 +19,7 @@
 #ifndef __LINUX_TC_VLAN_H
 #define __LINUX_TC_VLAN_H
 #include <linux/pkt_cls.h>
+#define TCA_ACT_VLAN 12
 #define TCA_VLAN_ACT_POP 1
 #define TCA_VLAN_ACT_PUSH 2
 #define TCA_VLAN_ACT_MODIFY 3
diff --git a/libc/kernel/uapi/linux/tcp.h b/libc/kernel/uapi/linux/tcp.h
index 1ec025f..ce3d735 100644
--- a/libc/kernel/uapi/linux/tcp.h
+++ b/libc/kernel/uapi/linux/tcp.h
@@ -92,7 +92,6 @@
 #define TCP_ZEROCOPY_RECEIVE 35
 #define TCP_INQ 36
 #define TCP_CM_INQ TCP_INQ
-#define TCP_TX_DELAY 37
 #define TCP_REPAIR_ON 1
 #define TCP_REPAIR_OFF 0
 #define TCP_REPAIR_OFF_NO_WP - 1
diff --git a/libc/kernel/uapi/linux/time.h b/libc/kernel/uapi/linux/time.h
index dbf105b..96a7042 100644
--- a/libc/kernel/uapi/linux/time.h
+++ b/libc/kernel/uapi/linux/time.h
@@ -19,7 +19,6 @@
 #ifndef _UAPI_LINUX_TIME_H
 #define _UAPI_LINUX_TIME_H
 #include <linux/types.h>
-#include <linux/time_types.h>
 #ifndef _STRUCT_TIMESPEC
 #define _STRUCT_TIMESPEC
 struct timespec {
@@ -46,6 +45,22 @@
   struct timeval it_interval;
   struct timeval it_value;
 };
+#ifndef __kernel_timespec
+struct __kernel_timespec {
+  __kernel_time64_t tv_sec;
+  long long tv_nsec;
+};
+#endif
+#ifndef __kernel_itimerspec
+struct __kernel_itimerspec {
+  struct __kernel_timespec it_interval;
+  struct __kernel_timespec it_value;
+};
+#endif
+struct __kernel_old_timeval {
+  __kernel_long_t tv_sec;
+  __kernel_long_t tv_usec;
+};
 #define CLOCK_REALTIME 0
 #define CLOCK_MONOTONIC 1
 #define CLOCK_PROCESS_CPUTIME_ID 2
diff --git a/libc/kernel/uapi/linux/time_types.h b/libc/kernel/uapi/linux/time_types.h
deleted file mode 100644
index 425e6ae..0000000
--- a/libc/kernel/uapi/linux/time_types.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_TIME_TYPES_H
-#define _UAPI_LINUX_TIME_TYPES_H
-#include <linux/types.h>
-struct __kernel_timespec {
-  __kernel_time64_t tv_sec;
-  long long tv_nsec;
-};
-struct __kernel_itimerspec {
-  struct __kernel_timespec it_interval;
-  struct __kernel_timespec it_value;
-};
-#ifndef __kernel_old_timeval
-struct __kernel_old_timeval {
-  __kernel_long_t tv_sec;
-  __kernel_long_t tv_usec;
-};
-#endif
-struct __kernel_sock_timeval {
-  __s64 tv_sec;
-  __s64 tv_usec;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/timex.h b/libc/kernel/uapi/linux/timex.h
index 803eaec..e574b4b 100644
--- a/libc/kernel/uapi/linux/timex.h
+++ b/libc/kernel/uapi/linux/timex.h
@@ -53,46 +53,6 @@
   int : 32;
   int : 32;
 };
-struct __kernel_timex_timeval {
-  __kernel_time64_t tv_sec;
-  long long tv_usec;
-};
-struct __kernel_timex {
-  unsigned int modes;
-  int : 32;
-  long long offset;
-  long long freq;
-  long long maxerror;
-  long long esterror;
-  int status;
-  int : 32;
-  long long constant;
-  long long precision;
-  long long tolerance;
-  struct __kernel_timex_timeval time;
-  long long tick;
-  long long ppsfreq;
-  long long jitter;
-  int shift;
-  int : 32;
-  long long stabil;
-  long long jitcnt;
-  long long calcnt;
-  long long errcnt;
-  long long stbcnt;
-  int tai;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-  int : 32;
-};
 #define ADJ_OFFSET 0x0001
 #define ADJ_FREQUENCY 0x0002
 #define ADJ_MAXERROR 0x0004
diff --git a/libc/kernel/uapi/linux/tipc.h b/libc/kernel/uapi/linux/tipc.h
index b66b340..72bcad9 100644
--- a/libc/kernel/uapi/linux/tipc.h
+++ b/libc/kernel/uapi/linux/tipc.h
@@ -111,7 +111,6 @@
 #define TIPC_MCAST_REPLICAST 134
 #define TIPC_GROUP_JOIN 135
 #define TIPC_GROUP_LEAVE 136
-#define TIPC_SOCK_RECVQ_USED 137
 #define TIPC_GROUP_LOOPBACK 0x1
 #define TIPC_GROUP_MEMBER_EVTS 0x2
 struct tipc_group_req {
diff --git a/libc/kernel/uapi/linux/tipc_netlink.h b/libc/kernel/uapi/linux/tipc_netlink.h
index 3721118..911bbde 100644
--- a/libc/kernel/uapi/linux/tipc_netlink.h
+++ b/libc/kernel/uapi/linux/tipc_netlink.h
@@ -212,8 +212,6 @@
   TIPC_NLA_PROP_TOL,
   TIPC_NLA_PROP_WIN,
   TIPC_NLA_PROP_MTU,
-  TIPC_NLA_PROP_BROADCAST,
-  TIPC_NLA_PROP_BROADCAST_RATIO,
   __TIPC_NLA_PROP_MAX,
   TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1
 };
diff --git a/libc/kernel/uapi/linux/tls.h b/libc/kernel/uapi/linux/tls.h
index e188826..b6910af 100644
--- a/libc/kernel/uapi/linux/tls.h
+++ b/libc/kernel/uapi/linux/tls.h
@@ -27,27 +27,12 @@
 #define TLS_1_2_VERSION_MAJOR 0x3
 #define TLS_1_2_VERSION_MINOR 0x3
 #define TLS_1_2_VERSION TLS_VERSION_NUMBER(TLS_1_2)
-#define TLS_1_3_VERSION_MAJOR 0x3
-#define TLS_1_3_VERSION_MINOR 0x4
-#define TLS_1_3_VERSION TLS_VERSION_NUMBER(TLS_1_3)
 #define TLS_CIPHER_AES_GCM_128 51
 #define TLS_CIPHER_AES_GCM_128_IV_SIZE 8
 #define TLS_CIPHER_AES_GCM_128_KEY_SIZE 16
 #define TLS_CIPHER_AES_GCM_128_SALT_SIZE 4
 #define TLS_CIPHER_AES_GCM_128_TAG_SIZE 16
 #define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8
-#define TLS_CIPHER_AES_GCM_256 52
-#define TLS_CIPHER_AES_GCM_256_IV_SIZE 8
-#define TLS_CIPHER_AES_GCM_256_KEY_SIZE 32
-#define TLS_CIPHER_AES_GCM_256_SALT_SIZE 4
-#define TLS_CIPHER_AES_GCM_256_TAG_SIZE 16
-#define TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE 8
-#define TLS_CIPHER_AES_CCM_128 53
-#define TLS_CIPHER_AES_CCM_128_IV_SIZE 8
-#define TLS_CIPHER_AES_CCM_128_KEY_SIZE 16
-#define TLS_CIPHER_AES_CCM_128_SALT_SIZE 4
-#define TLS_CIPHER_AES_CCM_128_TAG_SIZE 16
-#define TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE 8
 #define TLS_SET_RECORD_TYPE 1
 #define TLS_GET_RECORD_TYPE 2
 struct tls_crypto_info {
@@ -61,18 +46,4 @@
   unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE];
   unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE];
 };
-struct tls12_crypto_info_aes_gcm_256 {
-  struct tls_crypto_info info;
-  unsigned char iv[TLS_CIPHER_AES_GCM_256_IV_SIZE];
-  unsigned char key[TLS_CIPHER_AES_GCM_256_KEY_SIZE];
-  unsigned char salt[TLS_CIPHER_AES_GCM_256_SALT_SIZE];
-  unsigned char rec_seq[TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE];
-};
-struct tls12_crypto_info_aes_ccm_128 {
-  struct tls_crypto_info info;
-  unsigned char iv[TLS_CIPHER_AES_CCM_128_IV_SIZE];
-  unsigned char key[TLS_CIPHER_AES_CCM_128_KEY_SIZE];
-  unsigned char salt[TLS_CIPHER_AES_CCM_128_SALT_SIZE];
-  unsigned char rec_seq[TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE];
-};
 #endif
diff --git a/libc/kernel/uapi/linux/unix_diag.h b/libc/kernel/uapi/linux/unix_diag.h
index 4bcc47a..837ab5a 100644
--- a/libc/kernel/uapi/linux/unix_diag.h
+++ b/libc/kernel/uapi/linux/unix_diag.h
@@ -34,7 +34,6 @@
 #define UDIAG_SHOW_ICONS 0x00000008
 #define UDIAG_SHOW_RQLEN 0x00000010
 #define UDIAG_SHOW_MEMINFO 0x00000020
-#define UDIAG_SHOW_UID 0x00000040
 struct unix_diag_msg {
   __u8 udiag_family;
   __u8 udiag_type;
@@ -51,7 +50,6 @@
   UNIX_DIAG_RQLEN,
   UNIX_DIAG_MEMINFO,
   UNIX_DIAG_SHUTDOWN,
-  UNIX_DIAG_UID,
   __UNIX_DIAG_MAX,
 };
 #define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1)
diff --git a/libc/kernel/uapi/linux/usbdevice_fs.h b/libc/kernel/uapi/linux/usbdevice_fs.h
index 03f3bfb..87afabe 100644
--- a/libc/kernel/uapi/linux/usbdevice_fs.h
+++ b/libc/kernel/uapi/linux/usbdevice_fs.h
@@ -52,14 +52,6 @@
   unsigned int devnum;
   unsigned char slow;
 };
-struct usbdevfs_conninfo_ex {
-  __u32 size;
-  __u32 busnum;
-  __u32 devnum;
-  __u32 speed;
-  __u8 num_ports;
-  __u8 ports[7];
-};
 #define USBDEVFS_URB_SHORT_NOT_OK 0x01
 #define USBDEVFS_URB_ISO_ASAP 0x02
 #define USBDEVFS_URB_BULK_CONTINUATION 0x04
@@ -109,7 +101,6 @@
 #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10
 #define USBDEVFS_CAP_MMAP 0x20
 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40
-#define USBDEVFS_CAP_CONNINFO_EX 0x80
 #define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
 #define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
 struct usbdevfs_disconnect_claim {
@@ -157,5 +148,4 @@
 #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams)
 #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32)
 #define USBDEVFS_GET_SPEED _IO('U', 31)
-#define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len)
 #endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 9288710..3c2d2b2 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -299,8 +299,6 @@
 #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE + 221)
 enum v4l2_mpeg_video_multi_slice_mode {
   V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
-  V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB = 1,
-  V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES = 2,
   V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
   V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
 };
@@ -312,24 +310,6 @@
 #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 227)
 #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 228)
 #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE + 229)
-#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE + 270)
-enum v4l2_mpeg_video_mpeg2_level {
-  V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0,
-  V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN = 1,
-  V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440 = 2,
-  V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH = 3,
-};
-#define V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE (V4L2_CID_MPEG_BASE + 271)
-enum v4l2_mpeg_video_mpeg2_profile {
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE = 0,
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN = 1,
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_SNR_SCALABLE = 2,
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_SPATIALLY_SCALABLE = 3,
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH = 4,
-  V4L2_MPEG_VIDEO_MPEG2_PROFILE_MULTIVIEW = 5,
-};
-#define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_MPEG_BASE + 290)
-#define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_MPEG_BASE + 291)
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE + 300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE + 301)
 #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE + 302)
@@ -459,12 +439,6 @@
 };
 #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE + 381)
 #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE + 382)
-#define V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION (V4L2_CID_MPEG_BASE + 383)
-#define V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET (V4L2_CID_MPEG_BASE + 384)
-#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP (V4L2_CID_MPEG_BASE + 385)
-#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP (V4L2_CID_MPEG_BASE + 386)
-#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP (V4L2_CID_MPEG_BASE + 387)
-#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP (V4L2_CID_MPEG_BASE + 388)
 #define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE + 400)
 #define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE + 401)
 #define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE + 402)
diff --git a/libc/kernel/uapi/linux/vbox_vmmdev_types.h b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
index 3b27029..46b3486 100644
--- a/libc/kernel/uapi/linux/vbox_vmmdev_types.h
+++ b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
@@ -84,30 +84,6 @@
 #else
 #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32
 #endif
-#define VMMDEV_REQUESTOR_USR_NOT_GIVEN 0x00000000
-#define VMMDEV_REQUESTOR_USR_DRV 0x00000001
-#define VMMDEV_REQUESTOR_USR_DRV_OTHER 0x00000002
-#define VMMDEV_REQUESTOR_USR_ROOT 0x00000003
-#define VMMDEV_REQUESTOR_USR_USER 0x00000006
-#define VMMDEV_REQUESTOR_USR_MASK 0x00000007
-#define VMMDEV_REQUESTOR_KERNEL 0x00000000
-#define VMMDEV_REQUESTOR_USERMODE 0x00000008
-#define VMMDEV_REQUESTOR_MODE_MASK 0x00000008
-#define VMMDEV_REQUESTOR_CON_DONT_KNOW 0x00000000
-#define VMMDEV_REQUESTOR_CON_NO 0x00000010
-#define VMMDEV_REQUESTOR_CON_YES 0x00000020
-#define VMMDEV_REQUESTOR_CON_MASK 0x00000030
-#define VMMDEV_REQUESTOR_GRP_VBOX 0x00000080
-#define VMMDEV_REQUESTOR_TRUST_NOT_GIVEN 0x00000000
-#define VMMDEV_REQUESTOR_TRUST_UNTRUSTED 0x00001000
-#define VMMDEV_REQUESTOR_TRUST_LOW 0x00002000
-#define VMMDEV_REQUESTOR_TRUST_MEDIUM 0x00003000
-#define VMMDEV_REQUESTOR_TRUST_MEDIUM_PLUS 0x00004000
-#define VMMDEV_REQUESTOR_TRUST_HIGH 0x00005000
-#define VMMDEV_REQUESTOR_TRUST_SYSTEM 0x00006000
-#define VMMDEV_REQUESTOR_TRUST_PROTECTED 0x00007000
-#define VMMDEV_REQUESTOR_TRUST_MASK 0x00007000
-#define VMMDEV_REQUESTOR_USER_DEVICE 0x00008000
 enum vmmdev_hgcm_service_location_type {
   VMMDEV_HGCM_LOC_INVALID = 0,
   VMMDEV_HGCM_LOC_LOCALHOST = 1,
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index f78358d..43c04d1 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,5 +16,5 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define LINUX_VERSION_CODE 328450
+#define LINUX_VERSION_CODE 327683
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/libc/kernel/uapi/linux/vfio.h b/libc/kernel/uapi/linux/vfio.h
index 62cd970..b947abc 100644
--- a/libc/kernel/uapi/linux/vfio.h
+++ b/libc/kernel/uapi/linux/vfio.h
@@ -114,8 +114,6 @@
 #define VFIO_DEVICE_GFX_LINK_STATE_UP 1
 #define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2
 };
-#define VFIO_REGION_TYPE_CCW (2)
-#define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1)
 #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1)
 #define VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD (1)
 #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3
diff --git a/libc/kernel/uapi/linux/vfio_ccw.h b/libc/kernel/uapi/linux/vfio_ccw.h
index 6ed6830..047862f 100644
--- a/libc/kernel/uapi/linux/vfio_ccw.h
+++ b/libc/kernel/uapi/linux/vfio_ccw.h
@@ -28,10 +28,4 @@
   __u8 irb_area[IRB_AREA_SIZE];
   __u32 ret_code;
 } __packed;
-#define VFIO_CCW_ASYNC_CMD_HSCH (1 << 0)
-#define VFIO_CCW_ASYNC_CMD_CSCH (1 << 1)
-struct ccw_cmd_region {
-  __u32 command;
-  __u32 ret_code;
-} __packed;
 #endif
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index e81697e..74e591d 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -27,7 +27,7 @@
 #define VIDEO_MAX_FRAME 32
 #define VIDEO_MAX_PLANES 8
 #define v4l2_fourcc(a,b,c,d) ((__u32) (a) | ((__u32) (b) << 8) | ((__u32) (c) << 16) | ((__u32) (d) << 24))
-#define v4l2_fourcc_be(a,b,c,d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
+#define v4l2_fourcc_be(a,b,c,d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
 enum v4l2_field {
   V4L2_FIELD_ANY = 0,
   V4L2_FIELD_NONE = 1,
@@ -44,8 +44,6 @@
 #define V4L2_FIELD_HAS_BOTTOM(field) ((field) == V4L2_FIELD_BOTTOM || (field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT || (field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT)
 #define V4L2_FIELD_HAS_BOTH(field) ((field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT || (field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT)
 #define V4L2_FIELD_HAS_T_OR_B(field) ((field) == V4L2_FIELD_BOTTOM || (field) == V4L2_FIELD_TOP || (field) == V4L2_FIELD_ALTERNATE)
-#define V4L2_FIELD_IS_INTERLACED(field) ((field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT)
-#define V4L2_FIELD_IS_SEQUENTIAL(field) ((field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT)
 enum v4l2_buf_type {
   V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
   V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
@@ -64,7 +62,7 @@
   V4L2_BUF_TYPE_PRIVATE = 0x80,
 };
 #define V4L2_TYPE_IS_MULTIPLANAR(type) ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
-#define V4L2_TYPE_IS_OUTPUT(type) ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY || (type) == V4L2_BUF_TYPE_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SDR_OUTPUT || (type) == V4L2_BUF_TYPE_META_OUTPUT)
+#define V4L2_TYPE_IS_OUTPUT(type) ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY || (type) == V4L2_BUF_TYPE_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SDR_OUTPUT)
 enum v4l2_tuner_type {
   V4L2_TUNER_RADIO = 1,
   V4L2_TUNER_ANALOG_TV = 2,
@@ -206,21 +204,9 @@
 #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4')
 #define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2')
 #define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2')
-#define V4L2_PIX_FMT_RGBA444 v4l2_fourcc('R', 'A', '1', '2')
-#define V4L2_PIX_FMT_RGBX444 v4l2_fourcc('R', 'X', '1', '2')
-#define V4L2_PIX_FMT_ABGR444 v4l2_fourcc('A', 'B', '1', '2')
-#define V4L2_PIX_FMT_XBGR444 v4l2_fourcc('X', 'B', '1', '2')
-#define V4L2_PIX_FMT_BGRA444 v4l2_fourcc('G', 'A', '1', '2')
-#define V4L2_PIX_FMT_BGRX444 v4l2_fourcc('B', 'X', '1', '2')
 #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O')
 #define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5')
 #define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5')
-#define V4L2_PIX_FMT_RGBA555 v4l2_fourcc('R', 'A', '1', '5')
-#define V4L2_PIX_FMT_RGBX555 v4l2_fourcc('R', 'X', '1', '5')
-#define V4L2_PIX_FMT_ABGR555 v4l2_fourcc('A', 'B', '1', '5')
-#define V4L2_PIX_FMT_XBGR555 v4l2_fourcc('X', 'B', '1', '5')
-#define V4L2_PIX_FMT_BGRA555 v4l2_fourcc('B', 'A', '1', '5')
-#define V4L2_PIX_FMT_BGRX555 v4l2_fourcc('B', 'X', '1', '5')
 #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P')
 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q')
 #define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5')
@@ -232,11 +218,7 @@
 #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4')
 #define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4')
 #define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4')
-#define V4L2_PIX_FMT_BGRA32 v4l2_fourcc('R', 'A', '2', '4')
-#define V4L2_PIX_FMT_BGRX32 v4l2_fourcc('R', 'X', '2', '4')
 #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4')
-#define V4L2_PIX_FMT_RGBA32 v4l2_fourcc('A', 'B', '2', '4')
-#define V4L2_PIX_FMT_RGBX32 v4l2_fourcc('X', 'B', '2', '4')
 #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')
 #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4')
 #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y')
@@ -260,10 +242,6 @@
 #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O')
 #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P')
 #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4')
-#define V4L2_PIX_FMT_AYUV32 v4l2_fourcc('A', 'Y', 'U', 'V')
-#define V4L2_PIX_FMT_XYUV32 v4l2_fourcc('X', 'Y', 'U', 'V')
-#define V4L2_PIX_FMT_VUYA32 v4l2_fourcc('V', 'U', 'Y', 'A')
-#define V4L2_PIX_FMT_VUYX32 v4l2_fourcc('V', 'U', 'Y', 'X')
 #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4')
 #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2')
 #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')
@@ -348,7 +326,6 @@
 #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
 #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C')
 #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')
-#define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')
 #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')
 #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A')
 #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0')
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index f7e1392..010d819 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -32,6 +32,4 @@
 #define VIRTIO_ID_INPUT 18
 #define VIRTIO_ID_VSOCK 19
 #define VIRTIO_ID_CRYPTO 20
-#define VIRTIO_ID_IOMMU 23
-#define VIRTIO_ID_PMEM 27
 #endif
diff --git a/libc/kernel/uapi/linux/virtio_iommu.h b/libc/kernel/uapi/linux/virtio_iommu.h
deleted file mode 100644
index b08de57..0000000
--- a/libc/kernel/uapi/linux/virtio_iommu.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_VIRTIO_IOMMU_H
-#define _UAPI_LINUX_VIRTIO_IOMMU_H
-#include <linux/types.h>
-#define VIRTIO_IOMMU_F_INPUT_RANGE 0
-#define VIRTIO_IOMMU_F_DOMAIN_RANGE 1
-#define VIRTIO_IOMMU_F_MAP_UNMAP 2
-#define VIRTIO_IOMMU_F_BYPASS 3
-#define VIRTIO_IOMMU_F_PROBE 4
-#define VIRTIO_IOMMU_F_MMIO 5
-struct virtio_iommu_range_64 {
-  __le64 start;
-  __le64 end;
-};
-struct virtio_iommu_range_32 {
-  __le32 start;
-  __le32 end;
-};
-struct virtio_iommu_config {
-  __le64 page_size_mask;
-  struct virtio_iommu_range_64 input_range;
-  struct virtio_iommu_range_32 domain_range;
-  __le32 probe_size;
-};
-#define VIRTIO_IOMMU_T_ATTACH 0x01
-#define VIRTIO_IOMMU_T_DETACH 0x02
-#define VIRTIO_IOMMU_T_MAP 0x03
-#define VIRTIO_IOMMU_T_UNMAP 0x04
-#define VIRTIO_IOMMU_T_PROBE 0x05
-#define VIRTIO_IOMMU_S_OK 0x00
-#define VIRTIO_IOMMU_S_IOERR 0x01
-#define VIRTIO_IOMMU_S_UNSUPP 0x02
-#define VIRTIO_IOMMU_S_DEVERR 0x03
-#define VIRTIO_IOMMU_S_INVAL 0x04
-#define VIRTIO_IOMMU_S_RANGE 0x05
-#define VIRTIO_IOMMU_S_NOENT 0x06
-#define VIRTIO_IOMMU_S_FAULT 0x07
-#define VIRTIO_IOMMU_S_NOMEM 0x08
-struct virtio_iommu_req_head {
-  __u8 type;
-  __u8 reserved[3];
-};
-struct virtio_iommu_req_tail {
-  __u8 status;
-  __u8 reserved[3];
-};
-struct virtio_iommu_req_attach {
-  struct virtio_iommu_req_head head;
-  __le32 domain;
-  __le32 endpoint;
-  __u8 reserved[8];
-  struct virtio_iommu_req_tail tail;
-};
-struct virtio_iommu_req_detach {
-  struct virtio_iommu_req_head head;
-  __le32 domain;
-  __le32 endpoint;
-  __u8 reserved[8];
-  struct virtio_iommu_req_tail tail;
-};
-#define VIRTIO_IOMMU_MAP_F_READ (1 << 0)
-#define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1)
-#define VIRTIO_IOMMU_MAP_F_MMIO (1 << 2)
-#define VIRTIO_IOMMU_MAP_F_MASK (VIRTIO_IOMMU_MAP_F_READ | VIRTIO_IOMMU_MAP_F_WRITE | VIRTIO_IOMMU_MAP_F_MMIO)
-struct virtio_iommu_req_map {
-  struct virtio_iommu_req_head head;
-  __le32 domain;
-  __le64 virt_start;
-  __le64 virt_end;
-  __le64 phys_start;
-  __le32 flags;
-  struct virtio_iommu_req_tail tail;
-};
-struct virtio_iommu_req_unmap {
-  struct virtio_iommu_req_head head;
-  __le32 domain;
-  __le64 virt_start;
-  __le64 virt_end;
-  __u8 reserved[4];
-  struct virtio_iommu_req_tail tail;
-};
-#define VIRTIO_IOMMU_PROBE_T_NONE 0
-#define VIRTIO_IOMMU_PROBE_T_RESV_MEM 1
-#define VIRTIO_IOMMU_PROBE_T_MASK 0xfff
-struct virtio_iommu_probe_property {
-  __le16 type;
-  __le16 length;
-};
-#define VIRTIO_IOMMU_RESV_MEM_T_RESERVED 0
-#define VIRTIO_IOMMU_RESV_MEM_T_MSI 1
-struct virtio_iommu_probe_resv_mem {
-  struct virtio_iommu_probe_property head;
-  __u8 subtype;
-  __u8 reserved[3];
-  __le64 start;
-  __le64 end;
-};
-struct virtio_iommu_req_probe {
-  struct virtio_iommu_req_head head;
-  __le32 endpoint;
-  __u8 reserved[64];
-  __u8 properties[];
-};
-#define VIRTIO_IOMMU_FAULT_R_UNKNOWN 0
-#define VIRTIO_IOMMU_FAULT_R_DOMAIN 1
-#define VIRTIO_IOMMU_FAULT_R_MAPPING 2
-#define VIRTIO_IOMMU_FAULT_F_READ (1 << 0)
-#define VIRTIO_IOMMU_FAULT_F_WRITE (1 << 1)
-#define VIRTIO_IOMMU_FAULT_F_EXEC (1 << 2)
-#define VIRTIO_IOMMU_FAULT_F_ADDRESS (1 << 8)
-struct virtio_iommu_fault {
-  __u8 reason;
-  __u8 reserved[3];
-  __le32 flags;
-  __le32 endpoint;
-  __u8 reserved2[4];
-  __le64 address;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/virtio_pmem.h b/libc/kernel/uapi/linux/virtio_pmem.h
deleted file mode 100644
index 38740f3..0000000
--- a/libc/kernel/uapi/linux/virtio_pmem.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_VIRTIO_PMEM_H
-#define _UAPI_LINUX_VIRTIO_PMEM_H
-#include <linux/types.h>
-#include <linux/virtio_ids.h>
-#include <linux/virtio_config.h>
-struct virtio_pmem_config {
-  __u64 start;
-  __u64 size;
-};
-#define VIRTIO_PMEM_REQ_TYPE_FLUSH 0
-struct virtio_pmem_resp {
-  __le32 ret;
-};
-struct virtio_pmem_req {
-  __le32 type;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/wanrouter.h b/libc/kernel/uapi/linux/wanrouter.h
new file mode 100644
index 0000000..9bd45a3
--- /dev/null
+++ b/libc/kernel/uapi/linux/wanrouter.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ROUTER_H
+#define _UAPI_ROUTER_H
+enum wan_states {
+  WAN_UNCONFIGURED,
+  WAN_DISCONNECTED,
+  WAN_CONNECTING,
+  WAN_CONNECTED
+};
+#endif
diff --git a/libc/kernel/uapi/linux/xdp_diag.h b/libc/kernel/uapi/linux/xdp_diag.h
deleted file mode 100644
index f7d203f..0000000
--- a/libc/kernel/uapi/linux/xdp_diag.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_XDP_DIAG_H
-#define _LINUX_XDP_DIAG_H
-#include <linux/types.h>
-struct xdp_diag_req {
-  __u8 sdiag_family;
-  __u8 sdiag_protocol;
-  __u16 pad;
-  __u32 xdiag_ino;
-  __u32 xdiag_show;
-  __u32 xdiag_cookie[2];
-};
-struct xdp_diag_msg {
-  __u8 xdiag_family;
-  __u8 xdiag_type;
-  __u16 pad;
-  __u32 xdiag_ino;
-  __u32 xdiag_cookie[2];
-};
-#define XDP_SHOW_INFO (1 << 0)
-#define XDP_SHOW_RING_CFG (1 << 1)
-#define XDP_SHOW_UMEM (1 << 2)
-#define XDP_SHOW_MEMINFO (1 << 3)
-enum {
-  XDP_DIAG_NONE,
-  XDP_DIAG_INFO,
-  XDP_DIAG_UID,
-  XDP_DIAG_RX_RING,
-  XDP_DIAG_TX_RING,
-  XDP_DIAG_UMEM,
-  XDP_DIAG_UMEM_FILL_RING,
-  XDP_DIAG_UMEM_COMPLETION_RING,
-  XDP_DIAG_MEMINFO,
-  __XDP_DIAG_MAX,
-};
-#define XDP_DIAG_MAX (__XDP_DIAG_MAX - 1)
-struct xdp_diag_info {
-  __u32 ifindex;
-  __u32 queue_id;
-};
-struct xdp_diag_ring {
-  __u32 entries;
-};
-#define XDP_DU_F_ZEROCOPY (1 << 0)
-struct xdp_diag_umem {
-  __u64 size;
-  __u32 id;
-  __u32 num_pages;
-  __u32 chunk_size;
-  __u32 headroom;
-  __u32 ifindex;
-  __u32 queue_id;
-  __u32 flags;
-  __u32 refs;
-};
-#endif
diff --git a/libc/kernel/uapi/misc/fastrpc.h b/libc/kernel/uapi/misc/fastrpc.h
deleted file mode 100644
index 6f99e63..0000000
--- a/libc/kernel/uapi/misc/fastrpc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __QCOM_FASTRPC_H__
-#define __QCOM_FASTRPC_H__
-#include <linux/types.h>
-#define FASTRPC_IOCTL_ALLOC_DMA_BUFF _IOWR('R', 1, struct fastrpc_alloc_dma_buf)
-#define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32)
-#define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke)
-#define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4)
-#define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)
-struct fastrpc_invoke_args {
-  __u64 ptr;
-  __u64 length;
-  __s32 fd;
-  __u32 reserved;
-};
-struct fastrpc_invoke {
-  __u32 handle;
-  __u32 sc;
-  __u64 args;
-};
-struct fastrpc_init_create {
-  __u32 filelen;
-  __s32 filefd;
-  __u32 attrs;
-  __u32 siglen;
-  __u64 file;
-};
-struct fastrpc_alloc_dma_buf {
-  __s32 fd;
-  __u32 flags;
-  __u64 size;
-};
-#endif
diff --git a/libc/kernel/uapi/misc/habanalabs.h b/libc/kernel/uapi/misc/habanalabs.h
deleted file mode 100644
index 8fcf30f..0000000
--- a/libc/kernel/uapi/misc/habanalabs.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef HABANALABS_H_
-#define HABANALABS_H_
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000
-enum goya_queue_id {
-  GOYA_QUEUE_ID_DMA_0 = 0,
-  GOYA_QUEUE_ID_DMA_1,
-  GOYA_QUEUE_ID_DMA_2,
-  GOYA_QUEUE_ID_DMA_3,
-  GOYA_QUEUE_ID_DMA_4,
-  GOYA_QUEUE_ID_CPU_PQ,
-  GOYA_QUEUE_ID_MME,
-  GOYA_QUEUE_ID_TPC0,
-  GOYA_QUEUE_ID_TPC1,
-  GOYA_QUEUE_ID_TPC2,
-  GOYA_QUEUE_ID_TPC3,
-  GOYA_QUEUE_ID_TPC4,
-  GOYA_QUEUE_ID_TPC5,
-  GOYA_QUEUE_ID_TPC6,
-  GOYA_QUEUE_ID_TPC7,
-  GOYA_QUEUE_ID_SIZE
-};
-enum goya_engine_id {
-  GOYA_ENGINE_ID_DMA_0 = 0,
-  GOYA_ENGINE_ID_DMA_1,
-  GOYA_ENGINE_ID_DMA_2,
-  GOYA_ENGINE_ID_DMA_3,
-  GOYA_ENGINE_ID_DMA_4,
-  GOYA_ENGINE_ID_MME_0,
-  GOYA_ENGINE_ID_TPC_0,
-  GOYA_ENGINE_ID_TPC_1,
-  GOYA_ENGINE_ID_TPC_2,
-  GOYA_ENGINE_ID_TPC_3,
-  GOYA_ENGINE_ID_TPC_4,
-  GOYA_ENGINE_ID_TPC_5,
-  GOYA_ENGINE_ID_TPC_6,
-  GOYA_ENGINE_ID_TPC_7,
-  GOYA_ENGINE_ID_SIZE
-};
-enum hl_device_status {
-  HL_DEVICE_STATUS_OPERATIONAL,
-  HL_DEVICE_STATUS_IN_RESET,
-  HL_DEVICE_STATUS_MALFUNCTION
-};
-#define HL_INFO_HW_IP_INFO 0
-#define HL_INFO_HW_EVENTS 1
-#define HL_INFO_DRAM_USAGE 2
-#define HL_INFO_HW_IDLE 3
-#define HL_INFO_DEVICE_STATUS 4
-#define HL_INFO_VERSION_MAX_LEN 128
-struct hl_info_hw_ip_info {
-  __u64 sram_base_address;
-  __u64 dram_base_address;
-  __u64 dram_size;
-  __u32 sram_size;
-  __u32 num_of_events;
-  __u32 device_id;
-  __u32 reserved[3];
-  __u32 armcp_cpld_version;
-  __u32 psoc_pci_pll_nr;
-  __u32 psoc_pci_pll_nf;
-  __u32 psoc_pci_pll_od;
-  __u32 psoc_pci_pll_div_factor;
-  __u8 tpc_enabled_mask;
-  __u8 dram_enabled;
-  __u8 pad[2];
-  __u8 armcp_version[HL_INFO_VERSION_MAX_LEN];
-};
-struct hl_info_dram_usage {
-  __u64 dram_free_mem;
-  __u64 ctx_dram_mem;
-};
-struct hl_info_hw_idle {
-  __u32 is_idle;
-  __u32 busy_engines_mask;
-};
-struct hl_info_device_status {
-  __u32 status;
-  __u32 pad;
-};
-struct hl_info_args {
-  __u64 return_pointer;
-  __u32 return_size;
-  __u32 op;
-  __u32 ctx_id;
-  __u32 pad;
-};
-#define HL_CB_OP_CREATE 0
-#define HL_CB_OP_DESTROY 1
-struct hl_cb_in {
-  __u64 cb_handle;
-  __u32 op;
-  __u32 cb_size;
-  __u32 ctx_id;
-  __u32 pad;
-};
-struct hl_cb_out {
-  __u64 cb_handle;
-};
-union hl_cb_args {
-  struct hl_cb_in in;
-  struct hl_cb_out out;
-};
-struct hl_cs_chunk {
-  __u64 cb_handle;
-  __u32 queue_index;
-  __u32 cb_size;
-  __u32 cs_chunk_flags;
-  __u32 pad[11];
-};
-#define HL_CS_FLAGS_FORCE_RESTORE 0x1
-#define HL_CS_STATUS_SUCCESS 0
-struct hl_cs_in {
-  __u64 chunks_restore;
-  __u64 chunks_execute;
-  __u64 chunks_store;
-  __u32 num_chunks_restore;
-  __u32 num_chunks_execute;
-  __u32 num_chunks_store;
-  __u32 cs_flags;
-  __u32 ctx_id;
-};
-struct hl_cs_out {
-  __u64 seq;
-  __u32 status;
-  __u32 pad;
-};
-union hl_cs_args {
-  struct hl_cs_in in;
-  struct hl_cs_out out;
-};
-struct hl_wait_cs_in {
-  __u64 seq;
-  __u64 timeout_us;
-  __u32 ctx_id;
-  __u32 pad;
-};
-#define HL_WAIT_CS_STATUS_COMPLETED 0
-#define HL_WAIT_CS_STATUS_BUSY 1
-#define HL_WAIT_CS_STATUS_TIMEDOUT 2
-#define HL_WAIT_CS_STATUS_ABORTED 3
-#define HL_WAIT_CS_STATUS_INTERRUPTED 4
-struct hl_wait_cs_out {
-  __u32 status;
-  __u32 pad;
-};
-union hl_wait_cs_args {
-  struct hl_wait_cs_in in;
-  struct hl_wait_cs_out out;
-};
-#define HL_MEM_OP_ALLOC 0
-#define HL_MEM_OP_FREE 1
-#define HL_MEM_OP_MAP 2
-#define HL_MEM_OP_UNMAP 3
-#define HL_MEM_CONTIGUOUS 0x1
-#define HL_MEM_SHARED 0x2
-#define HL_MEM_USERPTR 0x4
-struct hl_mem_in {
-  union {
-    struct {
-      __u64 mem_size;
-    } alloc;
-    struct {
-      __u64 handle;
-    } free;
-    struct {
-      __u64 hint_addr;
-      __u64 handle;
-    } map_device;
-    struct {
-      __u64 host_virt_addr;
-      __u64 hint_addr;
-      __u64 mem_size;
-    } map_host;
-    struct {
-      __u64 device_virt_addr;
-    } unmap;
-  };
-  __u32 op;
-  __u32 flags;
-  __u32 ctx_id;
-  __u32 pad;
-};
-struct hl_mem_out {
-  union {
-    __u64 device_virt_addr;
-    __u64 handle;
-  };
-};
-union hl_mem_args {
-  struct hl_mem_in in;
-  struct hl_mem_out out;
-};
-#define HL_DEBUG_MAX_AUX_VALUES 10
-struct hl_debug_params_etr {
-  __u64 buffer_address;
-  __u64 buffer_size;
-  __u32 sink_mode;
-  __u32 pad;
-};
-struct hl_debug_params_etf {
-  __u64 buffer_address;
-  __u64 buffer_size;
-  __u32 sink_mode;
-  __u32 pad;
-};
-struct hl_debug_params_stm {
-  __u64 he_mask;
-  __u64 sp_mask;
-  __u32 id;
-  __u32 frequency;
-};
-struct hl_debug_params_bmon {
-  __u64 start_addr0;
-  __u64 addr_mask0;
-  __u64 start_addr1;
-  __u64 addr_mask1;
-  __u32 bw_win;
-  __u32 win_capture;
-  __u32 id;
-  __u32 pad;
-};
-struct hl_debug_params_spmu {
-  __u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
-  __u32 event_types_num;
-  __u32 pad;
-};
-#define HL_DEBUG_OP_ETR 0
-#define HL_DEBUG_OP_ETF 1
-#define HL_DEBUG_OP_STM 2
-#define HL_DEBUG_OP_FUNNEL 3
-#define HL_DEBUG_OP_BMON 4
-#define HL_DEBUG_OP_SPMU 5
-#define HL_DEBUG_OP_TIMESTAMP 6
-#define HL_DEBUG_OP_SET_MODE 7
-struct hl_debug_args {
-  __u64 input_ptr;
-  __u64 output_ptr;
-  __u32 input_size;
-  __u32 output_size;
-  __u32 op;
-  __u32 reg_idx;
-  __u32 enable;
-  __u32 ctx_id;
-};
-#define HL_IOCTL_INFO _IOWR('H', 0x01, struct hl_info_args)
-#define HL_IOCTL_CB _IOWR('H', 0x02, union hl_cb_args)
-#define HL_IOCTL_CS _IOWR('H', 0x03, union hl_cs_args)
-#define HL_IOCTL_WAIT_CS _IOWR('H', 0x04, union hl_wait_cs_args)
-#define HL_IOCTL_MEMORY _IOWR('H', 0x05, union hl_mem_args)
-#define HL_IOCTL_DEBUG _IOWR('H', 0x06, struct hl_debug_args)
-#define HL_COMMAND_START 0x01
-#define HL_COMMAND_END 0x07
-#endif
diff --git a/libc/kernel/uapi/mtd/ubi-user.h b/libc/kernel/uapi/mtd/ubi-user.h
index 866fbd2..8405536 100644
--- a/libc/kernel/uapi/mtd/ubi-user.h
+++ b/libc/kernel/uapi/mtd/ubi-user.h
@@ -27,8 +27,6 @@
 #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
 #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
 #define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
-#define UBI_IOCRPEB _IOW(UBI_IOC_MAGIC, 4, __s32)
-#define UBI_IOCSPEB _IOW(UBI_IOC_MAGIC, 5, __s32)
 #define UBI_CTRL_IOC_MAGIC 'o'
 #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
 #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
diff --git a/libc/kernel/uapi/rdma/bnxt_re-abi.h b/libc/kernel/uapi/rdma/bnxt_re-abi.h
index 3e45dc3..4e29624 100644
--- a/libc/kernel/uapi/rdma/bnxt_re-abi.h
+++ b/libc/kernel/uapi/rdma/bnxt_re-abi.h
@@ -20,12 +20,6 @@
 #define __BNXT_RE_UVERBS_ABI_H__
 #include <linux/types.h>
 #define BNXT_RE_ABI_VERSION 1
-#define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT 0x00
-#define BNXT_RE_CHIP_ID0_CHIP_REV_SFT 0x10
-#define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18
-enum {
-  BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL
-};
 struct bnxt_re_uctx_resp {
   __u32 dev_id;
   __u32 max_qp;
@@ -33,9 +27,6 @@
   __u32 cqe_sz;
   __u32 max_cqd;
   __u32 rsvd;
-  __aligned_u64 comp_mask;
-  __u32 chip_id0;
-  __u32 chip_id1;
 };
 struct bnxt_re_pd_resp {
   __u32 pdid;
diff --git a/libc/kernel/uapi/rdma/efa-abi.h b/libc/kernel/uapi/rdma/efa-abi.h
deleted file mode 100644
index 1445c9c..0000000
--- a/libc/kernel/uapi/rdma/efa-abi.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef EFA_ABI_USER_H
-#define EFA_ABI_USER_H
-#include <linux/types.h>
-#define EFA_UVERBS_ABI_VERSION 1
-enum efa_ibv_user_cmds_supp_udata {
-  EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0,
-  EFA_USER_CMDS_SUPP_UDATA_CREATE_AH = 1 << 1,
-};
-struct efa_ibv_alloc_ucontext_resp {
-  __u32 comp_mask;
-  __u32 cmds_supp_udata_mask;
-  __u16 sub_cqs_per_cq;
-  __u16 inline_buf_size;
-  __u32 max_llq_size;
-};
-struct efa_ibv_alloc_pd_resp {
-  __u32 comp_mask;
-  __u16 pdn;
-  __u8 reserved_30[2];
-};
-struct efa_ibv_create_cq {
-  __u32 comp_mask;
-  __u32 cq_entry_size;
-  __u16 num_sub_cqs;
-  __u8 reserved_50[6];
-};
-struct efa_ibv_create_cq_resp {
-  __u32 comp_mask;
-  __u8 reserved_20[4];
-  __aligned_u64 q_mmap_key;
-  __aligned_u64 q_mmap_size;
-  __u16 cq_idx;
-  __u8 reserved_d0[6];
-};
-enum {
-  EFA_QP_DRIVER_TYPE_SRD = 0,
-};
-struct efa_ibv_create_qp {
-  __u32 comp_mask;
-  __u32 rq_ring_size;
-  __u32 sq_ring_size;
-  __u32 driver_qp_type;
-};
-struct efa_ibv_create_qp_resp {
-  __u32 comp_mask;
-  __u32 rq_db_offset;
-  __u32 sq_db_offset;
-  __u32 llq_desc_offset;
-  __aligned_u64 rq_mmap_key;
-  __aligned_u64 rq_mmap_size;
-  __aligned_u64 rq_db_mmap_key;
-  __aligned_u64 sq_db_mmap_key;
-  __aligned_u64 llq_desc_mmap_key;
-  __u16 send_sub_cq_idx;
-  __u16 recv_sub_cq_idx;
-  __u8 reserved_1e0[4];
-};
-struct efa_ibv_create_ah_resp {
-  __u32 comp_mask;
-  __u16 efa_address_handle;
-  __u8 reserved_30[2];
-};
-struct efa_ibv_ex_query_device_resp {
-  __u32 comp_mask;
-  __u32 max_sq_wr;
-  __u32 max_rq_wr;
-  __u16 max_sq_sge;
-  __u16 max_rq_sge;
-};
-#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_cm.h b/libc/kernel/uapi/rdma/ib_user_cm.h
new file mode 100644
index 0000000..5ba46b8
--- /dev/null
+++ b/libc/kernel/uapi/rdma/ib_user_cm.h
@@ -0,0 +1,265 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef IB_USER_CM_H
+#define IB_USER_CM_H
+#include <linux/types.h>
+#include <rdma/ib_user_sa.h>
+#define IB_USER_CM_ABI_VERSION 5
+enum {
+  IB_USER_CM_CMD_CREATE_ID,
+  IB_USER_CM_CMD_DESTROY_ID,
+  IB_USER_CM_CMD_ATTR_ID,
+  IB_USER_CM_CMD_LISTEN,
+  IB_USER_CM_CMD_NOTIFY,
+  IB_USER_CM_CMD_SEND_REQ,
+  IB_USER_CM_CMD_SEND_REP,
+  IB_USER_CM_CMD_SEND_RTU,
+  IB_USER_CM_CMD_SEND_DREQ,
+  IB_USER_CM_CMD_SEND_DREP,
+  IB_USER_CM_CMD_SEND_REJ,
+  IB_USER_CM_CMD_SEND_MRA,
+  IB_USER_CM_CMD_SEND_LAP,
+  IB_USER_CM_CMD_SEND_APR,
+  IB_USER_CM_CMD_SEND_SIDR_REQ,
+  IB_USER_CM_CMD_SEND_SIDR_REP,
+  IB_USER_CM_CMD_EVENT,
+  IB_USER_CM_CMD_INIT_QP_ATTR,
+};
+struct ib_ucm_cmd_hdr {
+  __u32 cmd;
+  __u16 in;
+  __u16 out;
+};
+struct ib_ucm_create_id {
+  __aligned_u64 uid;
+  __aligned_u64 response;
+};
+struct ib_ucm_create_id_resp {
+  __u32 id;
+};
+struct ib_ucm_destroy_id {
+  __aligned_u64 response;
+  __u32 id;
+  __u32 reserved;
+};
+struct ib_ucm_destroy_id_resp {
+  __u32 events_reported;
+};
+struct ib_ucm_attr_id {
+  __aligned_u64 response;
+  __u32 id;
+  __u32 reserved;
+};
+struct ib_ucm_attr_id_resp {
+  __be64 service_id;
+  __be64 service_mask;
+  __be32 local_id;
+  __be32 remote_id;
+};
+struct ib_ucm_init_qp_attr {
+  __aligned_u64 response;
+  __u32 id;
+  __u32 qp_state;
+};
+struct ib_ucm_listen {
+  __be64 service_id;
+  __be64 service_mask;
+  __u32 id;
+  __u32 reserved;
+};
+struct ib_ucm_notify {
+  __u32 id;
+  __u32 event;
+};
+struct ib_ucm_private_data {
+  __aligned_u64 data;
+  __u32 id;
+  __u8 len;
+  __u8 reserved[3];
+};
+struct ib_ucm_req {
+  __u32 id;
+  __u32 qpn;
+  __u32 qp_type;
+  __u32 psn;
+  __be64 sid;
+  __aligned_u64 data;
+  __aligned_u64 primary_path;
+  __aligned_u64 alternate_path;
+  __u8 len;
+  __u8 peer_to_peer;
+  __u8 responder_resources;
+  __u8 initiator_depth;
+  __u8 remote_cm_response_timeout;
+  __u8 flow_control;
+  __u8 local_cm_response_timeout;
+  __u8 retry_count;
+  __u8 rnr_retry_count;
+  __u8 max_cm_retries;
+  __u8 srq;
+  __u8 reserved[5];
+};
+struct ib_ucm_rep {
+  __aligned_u64 uid;
+  __aligned_u64 data;
+  __u32 id;
+  __u32 qpn;
+  __u32 psn;
+  __u8 len;
+  __u8 responder_resources;
+  __u8 initiator_depth;
+  __u8 target_ack_delay;
+  __u8 failover_accepted;
+  __u8 flow_control;
+  __u8 rnr_retry_count;
+  __u8 srq;
+  __u8 reserved[4];
+};
+struct ib_ucm_info {
+  __u32 id;
+  __u32 status;
+  __aligned_u64 info;
+  __aligned_u64 data;
+  __u8 info_len;
+  __u8 data_len;
+  __u8 reserved[6];
+};
+struct ib_ucm_mra {
+  __aligned_u64 data;
+  __u32 id;
+  __u8 len;
+  __u8 timeout;
+  __u8 reserved[2];
+};
+struct ib_ucm_lap {
+  __aligned_u64 path;
+  __aligned_u64 data;
+  __u32 id;
+  __u8 len;
+  __u8 reserved[3];
+};
+struct ib_ucm_sidr_req {
+  __u32 id;
+  __u32 timeout;
+  __be64 sid;
+  __aligned_u64 data;
+  __aligned_u64 path;
+  __u16 reserved_pkey;
+  __u8 len;
+  __u8 max_cm_retries;
+  __u8 reserved[4];
+};
+struct ib_ucm_sidr_rep {
+  __u32 id;
+  __u32 qpn;
+  __u32 qkey;
+  __u32 status;
+  __aligned_u64 info;
+  __aligned_u64 data;
+  __u8 info_len;
+  __u8 data_len;
+  __u8 reserved[6];
+};
+struct ib_ucm_event_get {
+  __aligned_u64 response;
+  __aligned_u64 data;
+  __aligned_u64 info;
+  __u8 data_len;
+  __u8 info_len;
+  __u8 reserved[6];
+};
+struct ib_ucm_req_event_resp {
+  struct ib_user_path_rec primary_path;
+  struct ib_user_path_rec alternate_path;
+  __be64 remote_ca_guid;
+  __u32 remote_qkey;
+  __u32 remote_qpn;
+  __u32 qp_type;
+  __u32 starting_psn;
+  __u8 responder_resources;
+  __u8 initiator_depth;
+  __u8 local_cm_response_timeout;
+  __u8 flow_control;
+  __u8 remote_cm_response_timeout;
+  __u8 retry_count;
+  __u8 rnr_retry_count;
+  __u8 srq;
+  __u8 port;
+  __u8 reserved[7];
+};
+struct ib_ucm_rep_event_resp {
+  __be64 remote_ca_guid;
+  __u32 remote_qkey;
+  __u32 remote_qpn;
+  __u32 starting_psn;
+  __u8 responder_resources;
+  __u8 initiator_depth;
+  __u8 target_ack_delay;
+  __u8 failover_accepted;
+  __u8 flow_control;
+  __u8 rnr_retry_count;
+  __u8 srq;
+  __u8 reserved[5];
+};
+struct ib_ucm_rej_event_resp {
+  __u32 reason;
+};
+struct ib_ucm_mra_event_resp {
+  __u8 timeout;
+  __u8 reserved[3];
+};
+struct ib_ucm_lap_event_resp {
+  struct ib_user_path_rec path;
+};
+struct ib_ucm_apr_event_resp {
+  __u32 status;
+};
+struct ib_ucm_sidr_req_event_resp {
+  __u16 pkey;
+  __u8 port;
+  __u8 reserved;
+};
+struct ib_ucm_sidr_rep_event_resp {
+  __u32 status;
+  __u32 qkey;
+  __u32 qpn;
+};
+#define IB_UCM_PRES_DATA 0x01
+#define IB_UCM_PRES_INFO 0x02
+#define IB_UCM_PRES_PRIMARY 0x04
+#define IB_UCM_PRES_ALTERNATE 0x08
+struct ib_ucm_event_resp {
+  __aligned_u64 uid;
+  __u32 id;
+  __u32 event;
+  __u32 present;
+  __u32 reserved;
+  union {
+    struct ib_ucm_req_event_resp req_resp;
+    struct ib_ucm_rep_event_resp rep_resp;
+    struct ib_ucm_rej_event_resp rej_resp;
+    struct ib_ucm_mra_event_resp mra_resp;
+    struct ib_ucm_lap_event_resp lap_resp;
+    struct ib_ucm_apr_event_resp apr_resp;
+    struct ib_ucm_sidr_req_event_resp sidr_req_resp;
+    struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
+    __u32 send_status;
+  } u;
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_verbs.h b/libc/kernel/uapi/rdma/ib_user_verbs.h
index 25df6e2..3154b7a 100644
--- a/libc/kernel/uapi/rdma/ib_user_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_verbs.h
@@ -201,8 +201,6 @@
   struct ib_uverbs_tm_caps tm_caps;
   struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
   __aligned_u64 max_dm_size;
-  __u32 xrc_odp_caps;
-  __u32 reserved;
 };
 struct ib_uverbs_query_port {
   __aligned_u64 response;
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index e01b6d3..4c85c6c 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -164,7 +164,6 @@
   MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0,
   MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1,
   MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE = 1 << 2,
-  MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT = 1 << 3,
 };
 enum mlx5_ib_tunnel_offloads {
   MLX5_IB_TUNNELED_OFFLOADS_VXLAN = 1 << 0,
@@ -263,7 +262,6 @@
   MLX5_IB_CREATE_QP_RESP_MASK_TISN = 1UL << 1,
   MLX5_IB_CREATE_QP_RESP_MASK_RQN = 1UL << 2,
   MLX5_IB_CREATE_QP_RESP_MASK_SQN = 1UL << 3,
-  MLX5_IB_CREATE_QP_RESP_MASK_TIR_ICM_ADDR = 1UL << 4,
 };
 struct mlx5_ib_create_qp_resp {
   __u32 bfreg_index;
@@ -274,7 +272,6 @@
   __u32 rqn;
   __u32 sqn;
   __u32 reserved1;
-  __u64 tir_icm_addr;
 };
 struct mlx5_ib_alloc_mw {
   __u32 comp_mask;
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
index dcd281a..dcc3d85 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -26,13 +26,11 @@
 enum mlx5_ib_alloc_dm_attrs {
   MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX,
-  MLX5_IB_ATTR_ALLOC_DM_REQ_TYPE,
 };
 enum mlx5_ib_devx_methods {
   MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_METHOD_DEVX_QUERY_UAR,
   MLX5_IB_METHOD_DEVX_QUERY_EQN,
-  MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT,
 };
 enum mlx5_ib_devx_other_attrs {
   MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT),
@@ -60,20 +58,6 @@
   MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_IN,
   MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_OUT,
 };
-enum mlx5_ib_devx_obj_query_async_attrs {
-  MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-  MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_CMD_IN,
-  MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_FD,
-  MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_WR_ID,
-  MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN,
-};
-enum mlx5_ib_devx_subscribe_event_attrs {
-  MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-  MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE,
-  MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST,
-  MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM,
-  MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE,
-};
 enum mlx5_ib_devx_query_eqn_attrs {
   MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN,
@@ -83,7 +67,6 @@
   MLX5_IB_METHOD_DEVX_OBJ_DESTROY,
   MLX5_IB_METHOD_DEVX_OBJ_MODIFY,
   MLX5_IB_METHOD_DEVX_OBJ_QUERY,
-  MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY,
 };
 enum mlx5_ib_devx_umem_reg_attrs {
   MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
@@ -99,26 +82,11 @@
   MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_METHOD_DEVX_UMEM_DEREG,
 };
-enum mlx5_ib_devx_async_cmd_fd_alloc_attrs {
-  MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-};
-enum mlx5_ib_devx_async_event_fd_alloc_attrs {
-  MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-  MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS,
-};
-enum mlx5_ib_devx_async_cmd_fd_methods {
-  MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
-};
-enum mlx5_ib_devx_async_event_fd_methods {
-  MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
-};
 enum mlx5_ib_objects {
   MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_OBJECT_DEVX_OBJ,
   MLX5_IB_OBJECT_DEVX_UMEM,
   MLX5_IB_OBJECT_FLOW_MATCHER,
-  MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD,
-  MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD,
 };
 enum mlx5_ib_flow_matcher_create_attrs {
   MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
@@ -126,7 +94,6 @@
   MLX5_IB_ATTR_FLOW_MATCHER_FLOW_TYPE,
   MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA,
   MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS,
-  MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE,
 };
 enum mlx5_ib_flow_matcher_destroy_attrs {
   MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index 64bc843..dc246e5 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -25,7 +25,6 @@
 enum mlx5_ib_uapi_flow_table_type {
   MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX = 0x0,
   MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX = 0x1,
-  MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2,
 };
 enum mlx5_ib_uapi_flow_action_packet_reformat_type {
   MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 = 0x0,
@@ -33,20 +32,4 @@
   MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 = 0x2,
   MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL = 0x3,
 };
-struct mlx5_ib_uapi_devx_async_cmd_hdr {
-  __aligned_u64 wr_id;
-  __u8 out_data[];
-};
-enum mlx5_ib_uapi_dm_type {
-  MLX5_IB_UAPI_DM_TYPE_MEMIC,
-  MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM,
-  MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM,
-};
-enum mlx5_ib_uapi_devx_create_event_channel_flags {
-  MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
-};
-struct mlx5_ib_uapi_devx_async_event_hdr {
-  __aligned_u64 cookie;
-  __u8 out_data[];
-};
 #endif
diff --git a/libc/kernel/uapi/rdma/rdma_netlink.h b/libc/kernel/uapi/rdma/rdma_netlink.h
index ed585cf..69805f1 100644
--- a/libc/kernel/uapi/rdma/rdma_netlink.h
+++ b/libc/kernel/uapi/rdma/rdma_netlink.h
@@ -20,24 +20,30 @@
 #define _UAPI_RDMA_NETLINK_H
 #include <linux/types.h>
 enum {
-  RDMA_NL_IWCM = 2,
+  RDMA_NL_RDMA_CM = 1,
+  RDMA_NL_IWCM,
   RDMA_NL_RSVD,
   RDMA_NL_LS,
   RDMA_NL_NLDEV,
   RDMA_NL_NUM_CLIENTS
 };
 enum {
-  RDMA_NL_GROUP_IWPM = 2,
+  RDMA_NL_GROUP_CM = 1,
+  RDMA_NL_GROUP_IWPM,
   RDMA_NL_GROUP_LS,
   RDMA_NL_NUM_GROUPS
 };
 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
 #define RDMA_NL_GET_TYPE(client,op) ((client << 10) + op)
-#define IWPM_UABI_VERSION_MIN 3
-#define IWPM_UABI_VERSION 4
 enum {
-  IWPM_FLAGS_NO_PORT_MAP = (1 << 0),
+  RDMA_NL_RDMA_CM_ID_STATS = 0,
+  RDMA_NL_RDMA_CM_NUM_OPS
+};
+enum {
+  RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
+  RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
+  RDMA_NL_RDMA_CM_NUM_ATTR,
 };
 enum {
   RDMA_NL_IWPM_REG_PID = 0,
@@ -48,9 +54,18 @@
   RDMA_NL_IWPM_HANDLE_ERR,
   RDMA_NL_IWPM_MAPINFO,
   RDMA_NL_IWPM_MAPINFO_NUM,
-  RDMA_NL_IWPM_HELLO,
   RDMA_NL_IWPM_NUM_OPS
 };
+struct rdma_cm_id_stats {
+  __u32 qp_num;
+  __u32 bound_dev_if;
+  __u32 port_space;
+  __s32 pid;
+  __u8 cm_state;
+  __u8 node_type;
+  __u8 port_num;
+  __u8 qp_type;
+};
 enum {
   IWPM_NLA_REG_PID_UNSPEC = 0,
   IWPM_NLA_REG_PID_SEQ,
@@ -72,33 +87,18 @@
   IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
   IWPM_NLA_MANAGE_MAPPING_SEQ,
   IWPM_NLA_MANAGE_ADDR,
-  IWPM_NLA_MANAGE_FLAGS,
-  IWPM_NLA_MANAGE_MAPPING_MAX
-};
-enum {
-  IWPM_NLA_RMANAGE_MAPPING_UNSPEC = 0,
-  IWPM_NLA_RMANAGE_MAPPING_SEQ,
-  IWPM_NLA_RMANAGE_ADDR,
-  IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR,
-  IWPM_NLA_MANAGE_MAPPED_LOC_ADDR = IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR,
+  IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
   IWPM_NLA_RMANAGE_MAPPING_ERR,
   IWPM_NLA_RMANAGE_MAPPING_MAX
 };
+#define IWPM_NLA_MANAGE_MAPPING_MAX 3
+#define IWPM_NLA_QUERY_MAPPING_MAX 4
 #define IWPM_NLA_MAPINFO_SEND_MAX 3
-#define IWPM_NLA_REMOVE_MAPPING_MAX 3
 enum {
   IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
   IWPM_NLA_QUERY_MAPPING_SEQ,
   IWPM_NLA_QUERY_LOCAL_ADDR,
   IWPM_NLA_QUERY_REMOTE_ADDR,
-  IWPM_NLA_QUERY_FLAGS,
-  IWPM_NLA_QUERY_MAPPING_MAX,
-};
-enum {
-  IWPM_NLA_RQUERY_MAPPING_UNSPEC = 0,
-  IWPM_NLA_RQUERY_MAPPING_SEQ,
-  IWPM_NLA_RQUERY_LOCAL_ADDR,
-  IWPM_NLA_RQUERY_REMOTE_ADDR,
   IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
   IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
   IWPM_NLA_RQUERY_MAPPING_ERR,
@@ -114,7 +114,6 @@
   IWPM_NLA_MAPINFO_UNSPEC = 0,
   IWPM_NLA_MAPINFO_LOCAL_ADDR,
   IWPM_NLA_MAPINFO_MAPPED_ADDR,
-  IWPM_NLA_MAPINFO_FLAGS,
   IWPM_NLA_MAPINFO_MAX
 };
 enum {
@@ -131,20 +130,6 @@
   IWPM_NLA_ERR_MAX
 };
 enum {
-  IWPM_NLA_HELLO_UNSPEC = 0,
-  IWPM_NLA_HELLO_ABI_VERSION,
-  IWPM_NLA_HELLO_MAX
-};
-enum {
-  RDMA_NODE_IB_CA = 1,
-  RDMA_NODE_IB_SWITCH,
-  RDMA_NODE_IB_ROUTER,
-  RDMA_NODE_RNIC,
-  RDMA_NODE_USNIC,
-  RDMA_NODE_USNIC_UDP,
-  RDMA_NODE_UNSPECIFIED,
-};
-enum {
   RDMA_NL_LS_OP_RESOLVE = 0,
   RDMA_NL_LS_OP_SET_TIMEOUT,
   RDMA_NL_LS_OP_IP_RESOLVE,
@@ -189,23 +174,18 @@
   RDMA_NLDEV_CMD_UNSPEC,
   RDMA_NLDEV_CMD_GET,
   RDMA_NLDEV_CMD_SET,
-  RDMA_NLDEV_CMD_NEWLINK,
-  RDMA_NLDEV_CMD_DELLINK,
-  RDMA_NLDEV_CMD_PORT_GET,
-  RDMA_NLDEV_CMD_SYS_GET,
-  RDMA_NLDEV_CMD_SYS_SET,
+  RDMA_NLDEV_CMD_PORT_GET = 5,
   RDMA_NLDEV_CMD_RES_GET = 9,
   RDMA_NLDEV_CMD_RES_QP_GET,
   RDMA_NLDEV_CMD_RES_CM_ID_GET,
   RDMA_NLDEV_CMD_RES_CQ_GET,
   RDMA_NLDEV_CMD_RES_MR_GET,
   RDMA_NLDEV_CMD_RES_PD_GET,
-  RDMA_NLDEV_CMD_GET_CHARDEV,
-  RDMA_NLDEV_CMD_STAT_SET,
-  RDMA_NLDEV_CMD_STAT_GET,
-  RDMA_NLDEV_CMD_STAT_DEL,
   RDMA_NLDEV_NUM_OPS
 };
+enum {
+  RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
+};
 enum rdma_nldev_print_type {
   RDMA_NLDEV_PRINT_TYPE_UNSPEC,
   RDMA_NLDEV_PRINT_TYPE_HEX,
@@ -272,40 +252,6 @@
   RDMA_NLDEV_ATTR_DRIVER_U32,
   RDMA_NLDEV_ATTR_DRIVER_S64,
   RDMA_NLDEV_ATTR_DRIVER_U64,
-  RDMA_NLDEV_ATTR_RES_PDN,
-  RDMA_NLDEV_ATTR_RES_CQN,
-  RDMA_NLDEV_ATTR_RES_MRN,
-  RDMA_NLDEV_ATTR_RES_CM_IDN,
-  RDMA_NLDEV_ATTR_RES_CTXN,
-  RDMA_NLDEV_ATTR_LINK_TYPE,
-  RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
-  RDMA_NLDEV_ATTR_DEV_PROTOCOL,
-  RDMA_NLDEV_NET_NS_FD,
-  RDMA_NLDEV_ATTR_CHARDEV_TYPE,
-  RDMA_NLDEV_ATTR_CHARDEV_NAME,
-  RDMA_NLDEV_ATTR_CHARDEV_ABI,
-  RDMA_NLDEV_ATTR_CHARDEV,
-  RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID,
-  RDMA_NLDEV_ATTR_STAT_MODE,
-  RDMA_NLDEV_ATTR_STAT_RES,
-  RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK,
-  RDMA_NLDEV_ATTR_STAT_COUNTER,
-  RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY,
-  RDMA_NLDEV_ATTR_STAT_COUNTER_ID,
-  RDMA_NLDEV_ATTR_STAT_HWCOUNTERS,
-  RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY,
-  RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME,
-  RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE,
-  RDMA_NLDEV_ATTR_DEV_DIM,
   RDMA_NLDEV_ATTR_MAX
 };
-enum rdma_nl_counter_mode {
-  RDMA_COUNTER_MODE_NONE,
-  RDMA_COUNTER_MODE_AUTO,
-  RDMA_COUNTER_MODE_MANUAL,
-  RDMA_COUNTER_MODE_MAX,
-};
-enum rdma_nl_counter_mask {
-  RDMA_COUNTER_MASK_QP_TYPE = 1,
-};
 #endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_cm.h b/libc/kernel/uapi/rdma/rdma_user_cm.h
index 9042b6f..b200491 100644
--- a/libc/kernel/uapi/rdma/rdma_user_cm.h
+++ b/libc/kernel/uapi/rdma/rdma_user_cm.h
@@ -238,9 +238,6 @@
   RDMA_OPTION_ID_TOS = 0,
   RDMA_OPTION_ID_REUSEADDR = 1,
   RDMA_OPTION_ID_AFONLY = 2,
-  RDMA_OPTION_ID_ACK_TIMEOUT = 3
-};
-enum {
   RDMA_OPTION_IB_PATH = 1
 };
 struct rdma_ucm_set_option {
diff --git a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
index b779bc8..7cd6cd0 100644
--- a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
@@ -70,7 +70,5 @@
   RDMA_DRIVER_RXE,
   RDMA_DRIVER_HFI1,
   RDMA_DRIVER_QIB,
-  RDMA_DRIVER_EFA,
-  RDMA_DRIVER_SIW,
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_rxe.h b/libc/kernel/uapi/rdma/rdma_user_rxe.h
index e4a2f40..a57ed1a 100644
--- a/libc/kernel/uapi/rdma/rdma_user_rxe.h
+++ b/libc/kernel/uapi/rdma/rdma_user_rxe.h
@@ -39,7 +39,8 @@
 struct rxe_av {
   __u8 port_num;
   __u8 network_type;
-  __u8 dmac[6];
+  __u16 reserved1;
+  __u32 reserved2;
   struct rxe_global_route grh;
   union {
     struct sockaddr_in _sockaddr_in;
diff --git a/libc/kernel/uapi/rdma/rvt-abi.h b/libc/kernel/uapi/rdma/rvt-abi.h
deleted file mode 100644
index 49632ee..0000000
--- a/libc/kernel/uapi/rdma/rvt-abi.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef RVT_ABI_USER_H
-#define RVT_ABI_USER_H
-#include <linux/types.h>
-#include <rdma/ib_user_verbs.h>
-#ifndef RDMA_ATOMIC_UAPI
-#define RDMA_ATOMIC_UAPI(_type,_name) struct { _type val; } _name
-#endif
-struct rvt_wqe_sge {
-  __aligned_u64 addr;
-  __u32 length;
-  __u32 lkey;
-};
-struct rvt_cq_wc {
-  RDMA_ATOMIC_UAPI(__u32, head);
-  RDMA_ATOMIC_UAPI(__u32, tail);
-  struct ib_uverbs_wc uqueue[];
-};
-struct rvt_rwqe {
-  __u64 wr_id;
-  __u8 num_sge;
-  __u8 padding[7];
-  struct rvt_wqe_sge sg_list[];
-};
-struct rvt_rwq {
-  RDMA_ATOMIC_UAPI(__u32, head);
-  RDMA_ATOMIC_UAPI(__u32, tail);
-  struct rvt_rwqe wq[];
-};
-#endif
diff --git a/libc/kernel/uapi/rdma/siw-abi.h b/libc/kernel/uapi/rdma/siw-abi.h
deleted file mode 100644
index e2363a1..0000000
--- a/libc/kernel/uapi/rdma/siw-abi.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _SIW_USER_H
-#define _SIW_USER_H
-#include <linux/types.h>
-#define SIW_NODE_DESC_COMMON "Software iWARP stack"
-#define SIW_ABI_VERSION 1
-#define SIW_MAX_SGE 6
-#define SIW_UOBJ_MAX_KEY 0x08FFFF
-#define SIW_INVAL_UOBJ_KEY (SIW_UOBJ_MAX_KEY + 1)
-struct siw_uresp_create_cq {
-  __u32 cq_id;
-  __u32 num_cqe;
-  __aligned_u64 cq_key;
-};
-struct siw_uresp_create_qp {
-  __u32 qp_id;
-  __u32 num_sqe;
-  __u32 num_rqe;
-  __u32 pad;
-  __aligned_u64 sq_key;
-  __aligned_u64 rq_key;
-};
-struct siw_ureq_reg_mr {
-  __u8 stag_key;
-  __u8 reserved[3];
-  __u32 pad;
-};
-struct siw_uresp_reg_mr {
-  __u32 stag;
-  __u32 pad;
-};
-struct siw_uresp_create_srq {
-  __u32 num_rqe;
-  __u32 pad;
-  __aligned_u64 srq_key;
-};
-struct siw_uresp_alloc_ctx {
-  __u32 dev_id;
-  __u32 pad;
-};
-enum siw_opcode {
-  SIW_OP_WRITE,
-  SIW_OP_READ,
-  SIW_OP_READ_LOCAL_INV,
-  SIW_OP_SEND,
-  SIW_OP_SEND_WITH_IMM,
-  SIW_OP_SEND_REMOTE_INV,
-  SIW_OP_FETCH_AND_ADD,
-  SIW_OP_COMP_AND_SWAP,
-  SIW_OP_RECEIVE,
-  SIW_OP_READ_RESPONSE,
-  SIW_OP_INVAL_STAG,
-  SIW_OP_REG_MR,
-  SIW_NUM_OPCODES
-};
-struct siw_sge {
-  __aligned_u64 laddr;
-  __u32 length;
-  __u32 lkey;
-};
-#define SIW_MAX_INLINE (sizeof(struct siw_sge) * (SIW_MAX_SGE - 1))
-#if SIW_MAX_SGE < 2
-#error "SIW_MAX_SGE must be at least 2"
-#endif
-enum siw_wqe_flags {
-  SIW_WQE_VALID = 1,
-  SIW_WQE_INLINE = (1 << 1),
-  SIW_WQE_SIGNALLED = (1 << 2),
-  SIW_WQE_SOLICITED = (1 << 3),
-  SIW_WQE_READ_FENCE = (1 << 4),
-  SIW_WQE_REM_INVAL = (1 << 5),
-  SIW_WQE_COMPLETED = (1 << 6)
-};
-struct siw_sqe {
-  __aligned_u64 id;
-  __u16 flags;
-  __u8 num_sge;
-  __u8 opcode;
-  __u32 rkey;
-  union {
-    __aligned_u64 raddr;
-    __aligned_u64 base_mr;
-  };
-  union {
-    struct siw_sge sge[SIW_MAX_SGE];
-    __aligned_u64 access;
-  };
-};
-struct siw_rqe {
-  __aligned_u64 id;
-  __u16 flags;
-  __u8 num_sge;
-  __u8 opcode;
-  __u32 unused;
-  struct siw_sge sge[SIW_MAX_SGE];
-};
-enum siw_notify_flags {
-  SIW_NOTIFY_NOT = (0),
-  SIW_NOTIFY_SOLICITED = (1 << 0),
-  SIW_NOTIFY_NEXT_COMPLETION = (1 << 1),
-  SIW_NOTIFY_MISSED_EVENTS = (1 << 2),
-  SIW_NOTIFY_ALL = SIW_NOTIFY_SOLICITED | SIW_NOTIFY_NEXT_COMPLETION | SIW_NOTIFY_MISSED_EVENTS
-};
-enum siw_wc_status {
-  SIW_WC_SUCCESS,
-  SIW_WC_LOC_LEN_ERR,
-  SIW_WC_LOC_PROT_ERR,
-  SIW_WC_LOC_QP_OP_ERR,
-  SIW_WC_WR_FLUSH_ERR,
-  SIW_WC_BAD_RESP_ERR,
-  SIW_WC_LOC_ACCESS_ERR,
-  SIW_WC_REM_ACCESS_ERR,
-  SIW_WC_REM_INV_REQ_ERR,
-  SIW_WC_GENERAL_ERR,
-  SIW_NUM_WC_STATUS
-};
-struct siw_cqe {
-  __aligned_u64 id;
-  __u8 flags;
-  __u8 opcode;
-  __u16 status;
-  __u32 bytes;
-  union {
-    __aligned_u64 imm_data;
-    __u32 inval_stag;
-  };
-  union {
-    struct ib_qp * base_qp;
-    __aligned_u64 qp_id;
-  };
-};
-struct siw_cq_ctrl {
-  __u32 flags;
-  __u32 pad;
-};
-#endif
diff --git a/libc/kernel/uapi/scsi/fc/fc_els.h b/libc/kernel/uapi/scsi/fc/fc_els.h
index 1cabadd..7e9409a 100644
--- a/libc/kernel/uapi/scsi/fc/fc_els.h
+++ b/libc/kernel/uapi/scsi/fc/fc_els.h
@@ -40,7 +40,6 @@
   ELS_RRQ = 0x12,
   ELS_REC = 0x13,
   ELS_SRR = 0x14,
-  ELS_FPIN = 0x16,
   ELS_PRLI = 0x20,
   ELS_PRLO = 0x21,
   ELS_SCN = 0x22,
@@ -82,7 +81,7 @@
   ELS_LKA = 0x80,
   ELS_AUTH_ELS = 0x90,
 };
-#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_FPIN] = "FPIN",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
+#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
 }
 struct fc_els_ls_acc {
   __u8 la_cmd;
@@ -543,20 +542,4 @@
   ELS_CLID_IC_LOOP_TO = 7,
   ELS_CLID_IC_LIP = 8,
 };
-enum fc_fn_dtag {
-  ELS_FN_DTAG_LNK_INTEGRITY = 0x00020001,
-  ELS_FN_DTAG_PEER_CONGEST = 0x00020003,
-  ELS_FN_DTAG_CONGESTION = 0x00020004,
-};
-struct fc_fn_desc {
-  __be32 fn_desc_tag;
-  __be32 fn_desc_value_len;
-  __u8 fn_desc_value[0];
-};
-struct fc_els_fpin {
-  __u8 fpin_cmd;
-  __u8 fpin_zero[3];
-  __be32 fpin_desc_cnt;
-  struct fc_fn_desc fpin_desc[0];
-};
 #endif
diff --git a/libc/kernel/uapi/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index abc81dd..e5473a5 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -24,7 +24,6 @@
 #include <sys/ioctl.h>
 #endif
 #include <stdlib.h>
-#include <time.h>
 #define SNDRV_PROTOCOL_VERSION(major,minor,subminor) (((major) << 16) | ((minor) << 8) | (subminor))
 #define SNDRV_PROTOCOL_MAJOR(version) (((version) >> 16) & 0xffff)
 #define SNDRV_PROTOCOL_MINOR(version) (((version) >> 8) & 0xff)
diff --git a/libc/kernel/uapi/sound/sof/abi.h b/libc/kernel/uapi/sound/sof/abi.h
deleted file mode 100644
index 0948673..0000000
--- a/libc/kernel/uapi/sound/sof/abi.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
-#define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
-#define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 8
-#define SOF_ABI_PATCH 0
-#define SOF_ABI_MAJOR_SHIFT 24
-#define SOF_ABI_MAJOR_MASK 0xff
-#define SOF_ABI_MINOR_SHIFT 12
-#define SOF_ABI_MINOR_MASK 0xfff
-#define SOF_ABI_PATCH_SHIFT 0
-#define SOF_ABI_PATCH_MASK 0xfff
-#define SOF_ABI_VER(major,minor,patch) (((major) << SOF_ABI_MAJOR_SHIFT) | ((minor) << SOF_ABI_MINOR_SHIFT) | ((patch) << SOF_ABI_PATCH_SHIFT))
-#define SOF_ABI_VERSION_MAJOR(version) (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK)
-#define SOF_ABI_VERSION_MINOR(version) (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK)
-#define SOF_ABI_VERSION_PATCH(version) (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK)
-#define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver,client_ver) (SOF_ABI_VERSION_MAJOR((sof_ver)) != SOF_ABI_VERSION_MAJOR((client_ver)))
-#define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH)
-#define SOF_ABI_MAGIC 0x00464F53
-#endif
diff --git a/libc/kernel/uapi/sound/sof/fw.h b/libc/kernel/uapi/sound/sof/fw.h
deleted file mode 100644
index c36c2b9..0000000
--- a/libc/kernel/uapi/sound/sof/fw.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __INCLUDE_UAPI_SOF_FW_H__
-#define __INCLUDE_UAPI_SOF_FW_H__
-#include <linux/types.h>
-#define SND_SOF_FW_SIG_SIZE 4
-#define SND_SOF_FW_ABI 1
-#define SND_SOF_FW_SIG "Reef"
-enum snd_sof_fw_blk_type {
-  SOF_FW_BLK_TYPE_INVALID = - 1,
-  SOF_FW_BLK_TYPE_START = 0,
-  SOF_FW_BLK_TYPE_RSRVD0 = SOF_FW_BLK_TYPE_START,
-  SOF_FW_BLK_TYPE_IRAM = 1,
-  SOF_FW_BLK_TYPE_DRAM = 2,
-  SOF_FW_BLK_TYPE_SRAM = 3,
-  SOF_FW_BLK_TYPE_ROM = 4,
-  SOF_FW_BLK_TYPE_IMR = 5,
-  SOF_FW_BLK_TYPE_RSRVD6 = 6,
-  SOF_FW_BLK_TYPE_RSRVD7 = 7,
-  SOF_FW_BLK_TYPE_RSRVD8 = 8,
-  SOF_FW_BLK_TYPE_RSRVD9 = 9,
-  SOF_FW_BLK_TYPE_RSRVD10 = 10,
-  SOF_FW_BLK_TYPE_RSRVD11 = 11,
-  SOF_FW_BLK_TYPE_RSRVD12 = 12,
-  SOF_FW_BLK_TYPE_RSRVD13 = 13,
-  SOF_FW_BLK_TYPE_RSRVD14 = 14,
-  SOF_FW_BLK_TYPE_NUM
-};
-struct snd_sof_blk_hdr {
-  enum snd_sof_fw_blk_type type;
-  __u32 size;
-  __u32 offset;
-} __packed;
-enum snd_sof_fw_mod_type {
-  SOF_FW_BASE = 0,
-  SOF_FW_MODULE = 1,
-};
-struct snd_sof_mod_hdr {
-  enum snd_sof_fw_mod_type type;
-  __u32 size;
-  __u32 num_blocks;
-} __packed;
-struct snd_sof_fw_header {
-  unsigned char sig[SND_SOF_FW_SIG_SIZE];
-  __u32 file_size;
-  __u32 num_modules;
-  __u32 abi;
-} __packed;
-#endif
diff --git a/libc/kernel/uapi/sound/sof/header.h b/libc/kernel/uapi/sound/sof/header.h
deleted file mode 100644
index 3fbd4a4..0000000
--- a/libc/kernel/uapi/sound/sof/header.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
-#define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
-#include <linux/types.h>
-struct sof_abi_hdr {
-  __u32 magic;
-  __u32 type;
-  __u32 size;
-  __u32 abi;
-  __u32 reserved[4];
-  __u32 data[0];
-} __packed;
-#endif
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
deleted file mode 100644
index 0f80cfa..0000000
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __INCLUDE_UAPI_SOF_TOPOLOGY_H__
-#define __INCLUDE_UAPI_SOF_TOPOLOGY_H__
-#define SOF_TPLG_KCTL_VOL_ID 256
-#define SOF_TPLG_KCTL_ENUM_ID 257
-#define SOF_TPLG_KCTL_BYTES_ID 258
-#define SOF_TPLG_KCTL_SWITCH_ID 259
-#define SOF_TKN_BUF_SIZE 100
-#define SOF_TKN_BUF_CAPS 101
-#define SOF_TKN_DAI_TYPE 154
-#define SOF_TKN_DAI_INDEX 155
-#define SOF_TKN_DAI_DIRECTION 156
-#define SOF_TKN_SCHED_PERIOD 200
-#define SOF_TKN_SCHED_PRIORITY 201
-#define SOF_TKN_SCHED_MIPS 202
-#define SOF_TKN_SCHED_CORE 203
-#define SOF_TKN_SCHED_FRAMES 204
-#define SOF_TKN_SCHED_TIME_DOMAIN 205
-#define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250
-#define SOF_TKN_VOLUME_RAMP_STEP_MS 251
-#define SOF_TKN_SRC_RATE_IN 300
-#define SOF_TKN_SRC_RATE_OUT 301
-#define SOF_TKN_PCM_DMAC_CONFIG 353
-#define SOF_TKN_COMP_PERIOD_SINK_COUNT 400
-#define SOF_TKN_COMP_PERIOD_SOURCE_COUNT 401
-#define SOF_TKN_COMP_FORMAT 402
-#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
-#define SOF_TKN_INTEL_SSP_MCLK_ID 501
-#define SOF_TKN_INTEL_SSP_SAMPLE_BITS 502
-#define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503
-#define SOF_TKN_INTEL_SSP_QUIRKS 504
-#define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505
-#define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600
-#define SOF_TKN_INTEL_DMIC_CLK_MIN 601
-#define SOF_TKN_INTEL_DMIC_CLK_MAX 602
-#define SOF_TKN_INTEL_DMIC_DUTY_MIN 603
-#define SOF_TKN_INTEL_DMIC_DUTY_MAX 604
-#define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605
-#define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608
-#define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609
-#define SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS 610
-#define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700
-#define SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable 701
-#define SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable 702
-#define SOF_TKN_INTEL_DMIC_PDM_POLARITY_A 703
-#define SOF_TKN_INTEL_DMIC_PDM_POLARITY_B 704
-#define SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE 705
-#define SOF_TKN_INTEL_DMIC_PDM_SKEW 706
-#define SOF_TKN_TONE_SAMPLE_RATE 800
-#define SOF_TKN_PROCESS_TYPE 900
-#define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE
-#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index a4ab600..8819223 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -690,7 +690,7 @@
     ns_name_ntol; # arm64 x86_64 mips64 introduced=22
     ns_name_ntop; # arm64 x86_64 mips64 introduced=22
     ns_name_pack; # arm64 x86_64 mips64 introduced=22
-    ns_name_pton; # arm64 x86_64 mips64 introduced=22
+    ns_name_pton; # arm64 x86_64 mips64 introduced=23
     ns_name_rollback; # arm64 x86_64 mips64 introduced=22
     ns_name_skip; # arm64 x86_64 mips64 introduced=22
     ns_name_uncompress; # arm64 x86_64 mips64 introduced=22
@@ -1468,10 +1468,10 @@
     __system_properties_init; # apex
 
     # Used by libmemunreachable
-    malloc_backtrace; # apex vndk
-    malloc_disable; # apex vndk
-    malloc_enable; # apex vndk
-    malloc_iterate; # apex vndk
+    malloc_backtrace; # apex
+    malloc_disable; # apex
+    malloc_enable; # apex
+    malloc_iterate; # apex
 
     # Used by libandroid_net
     android_getaddrinfofornet; # apex
@@ -1480,45 +1480,6 @@
     android_mallopt; # apex
 } LIBC_P;
 
-LIBC_R { # introduced=R
-  global:
-    __mempcpy_chk;
-    __tls_get_addr; # arm64
-    call_once;
-    cnd_broadcast;
-    cnd_destroy;
-    cnd_init;
-    cnd_signal;
-    cnd_timedwait;
-    cnd_wait;
-    memfd_create;
-    mlock2;
-    mtx_destroy;
-    mtx_init;
-    mtx_lock;
-    mtx_timedlock;
-    mtx_trylock;
-    mtx_unlock;
-    pthread_cond_clockwait;
-    pthread_mutex_clocklock;
-    pthread_rwlock_clockrdlock;
-    pthread_rwlock_clockwrlock;
-    renameat2;
-    sem_clockwait;
-    thrd_create;
-    thrd_current;
-    thrd_detach;
-    thrd_equal;
-    thrd_exit;
-    thrd_join;
-    thrd_sleep;
-    thrd_yield;
-    tss_create;
-    tss_delete;
-    tss_get;
-    tss_set;
-} LIBC_Q;
-
 LIBC_PRIVATE {
   global:
     ___Unwind_Backtrace; # arm
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 7340f95..bcbd7da 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -3,8 +3,8 @@
 // ==============================================================
 // Used by libmemunreachable
 cc_library_static {
+
     name: "libc_malloc_debug_backtrace",
-    vendor_available: true,
 
     srcs: [
         "backtrace.cpp",
@@ -16,6 +16,7 @@
     whole_static_libs: [
         "libbase",
         "libasync_safe",
+        "libdemangle",
     ],
 
     include_dirs: ["bionic/libc"],
@@ -27,23 +28,12 @@
     },
     native_coverage: false,
 
-    target: {
-        android: {
-            static_libs: ["libc++demangle"],
-        },
-    },
-
     // -Wno-error=format-zero-length needed for gcc to compile.
     cflags: [
         "-Wall",
         "-Werror",
         "-Wno-error=format-zero-length",
     ],
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
 }
 
 // ==============================================================
@@ -76,6 +66,7 @@
     static_libs: [
         "libasync_safe",
         "libbase",
+        "libdemangle",
         "libc_malloc_debug_backtrace",
     ],
 
@@ -107,15 +98,6 @@
         "-Wno-error=format-zero-length",
         "-Wthread-safety",
     ],
-
-    apex_available: [
-        "com.android.runtime",
-    ],
-    static: {
-        apex_available: [
-            "//apex_available:platform",
-        ],
-    },
 }
 
 // ==============================================================
@@ -138,12 +120,9 @@
         "bionic/libc/async_safe/include",
     ],
 
-    header_libs: [
-        "bionic_libc_platform_headers",
-    ],
-
     static_libs: [
         "libc_malloc_debug",
+        "libdemangle",
         "libtinyxml2",
     ],
 
@@ -166,13 +145,7 @@
 cc_test {
     name: "malloc_debug_system_tests",
 
-    include_dirs: [
-        "bionic/libc",
-    ],
-
-    header_libs: [
-        "bionic_libc_platform_headers",
-    ],
+    include_dirs: ["bionic/libc"],
 
     srcs: [
         "tests/malloc_debug_system_tests.cpp",
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index b1e28b7..617d128 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -43,6 +43,7 @@
 
 #include <android-base/stringprintf.h>
 #include <android-base/thread_annotations.h>
+#include <demangle.h>
 #include <private/bionic_macros.h>
 
 #include "Config.h"
@@ -53,8 +54,6 @@
 #include "malloc_debug.h"
 #include "UnwindBacktrace.h"
 
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
 std::atomic_uint8_t PointerData::backtrace_enabled_;
 std::atomic_bool PointerData::backtrace_dump_;
 
@@ -554,7 +553,7 @@
   return pointers_.count(pointer) != 0;
 }
 
-void PointerData::DumpLiveToFile(int fd) {
+void PointerData::DumpLiveToFile(FILE* fp) {
   std::vector<ListInfoType> list;
 
   std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
@@ -566,13 +565,13 @@
     total_memory += info.size * info.num_allocations;
   }
 
-  dprintf(fd, "Total memory: %zu\n", total_memory);
-  dprintf(fd, "Allocation records: %zd\n", list.size());
-  dprintf(fd, "Backtrace size: %zu\n", g_debug->config().backtrace_frames());
-  dprintf(fd, "\n");
+  fprintf(fp, "Total memory: %zu\n", total_memory);
+  fprintf(fp, "Allocation records: %zd\n", list.size());
+  fprintf(fp, "Backtrace size: %zu\n", g_debug->config().backtrace_frames());
+  fprintf(fp, "\n");
 
   for (const auto& info : list) {
-    dprintf(fd, "z %d  sz %8zu  num    %zu  bt", (info.zygote_child_alloc) ? 1 : 0, info.size,
+    fprintf(fp, "z %d  sz %8zu  num    %zu  bt", (info.zygote_child_alloc) ? 1 : 0, info.size,
             info.num_allocations);
     FrameInfoType* frame_info = info.frame_info;
     if (frame_info != nullptr) {
@@ -580,36 +579,27 @@
         if (frame_info->frames[i] == 0) {
           break;
         }
-        dprintf(fd, " %" PRIxPTR, frame_info->frames[i]);
+        fprintf(fp, " %" PRIxPTR, frame_info->frames[i]);
       }
     }
-    dprintf(fd, "\n");
+    fprintf(fp, "\n");
     if (info.backtrace_info != nullptr) {
-      dprintf(fd, "  bt_info");
+      fprintf(fp, "  bt_info");
       for (const auto& frame : *info.backtrace_info) {
-        dprintf(fd, " {");
+        fprintf(fp, " {");
         if (frame.map_info != nullptr && !frame.map_info->name.empty()) {
-          dprintf(fd, "\"%s\"", frame.map_info->name.c_str());
+          fprintf(fp, "\"%s\"", frame.map_info->name.c_str());
         } else {
-          dprintf(fd, "\"\"");
+          fprintf(fp, "\"\"");
         }
-        dprintf(fd, " %" PRIx64, frame.rel_pc);
+        fprintf(fp, " %" PRIx64, frame.rel_pc);
         if (frame.function_name.empty()) {
-          dprintf(fd, " \"\" 0}");
+          fprintf(fp, " \"\" 0}");
         } else {
-          char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr,
-                                                nullptr);
-          const char* name;
-          if (demangled_name != nullptr) {
-            name = demangled_name;
-          } else {
-            name = frame.function_name.c_str();
-          }
-          dprintf(fd, " \"%s\" %" PRIx64 "}", name, frame.function_offset);
-          free(demangled_name);
+          fprintf(fp, " \"%s\" %" PRIx64 "}", demangle(frame.function_name.c_str()).c_str(), frame.function_offset);
         }
       }
-      dprintf(fd, "\n");
+      fprintf(fp, "\n");
     }
   }
 }
diff --git a/libc/malloc_debug/PointerData.h b/libc/malloc_debug/PointerData.h
index 78f0ed8..c7958f3 100644
--- a/libc/malloc_debug/PointerData.h
+++ b/libc/malloc_debug/PointerData.h
@@ -152,7 +152,7 @@
 
   static void GetAllocList(std::vector<ListInfoType>* list);
   static void LogLeaks();
-  static void DumpLiveToFile(int fd);
+  static void DumpLiveToFile(FILE* fp);
 
   static void GetInfo(uint8_t** info, size_t* overall_size, size_t* info_size, size_t* total_memory,
                       size_t* backtrace_size);
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index 92fb3fa..ddafc73 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -36,6 +36,7 @@
 #include <vector>
 
 #include <android-base/stringprintf.h>
+#include <demangle.h>
 #include <unwindstack/LocalUnwinder.h>
 #include <unwindstack/MapInfo.h>
 
@@ -48,8 +49,6 @@
 #define PAD_PTR "08" PRIx64
 #endif
 
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
 static pthread_once_t g_setup_once = PTHREAD_ONCE_INIT;
 
 static unwindstack::LocalUnwinder* g_unwinder;
@@ -101,14 +100,7 @@
     }
 
     if (!info->function_name.empty()) {
-      line += " (";
-      char* demangled_name = __cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
-      if (demangled_name != nullptr) {
-        line += demangled_name;
-        free(demangled_name);
-      } else {
-        line += info->function_name;
-      }
+      line += " (" + demangle(info->function_name.c_str());
       if (info->function_offset != 0) {
         line += "+" + std::to_string(info->function_offset);
       }
diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp
index ab5c505..0e3a53f 100644
--- a/libc/malloc_debug/backtrace.cpp
+++ b/libc/malloc_debug/backtrace.cpp
@@ -36,6 +36,8 @@
 #include <unistd.h>
 #include <unwind.h>
 
+#include <demangle.h>
+
 #include "MapData.h"
 #include "backtrace.h"
 #include "debug_log.h"
@@ -162,18 +164,10 @@
 
     char buf[1024];
     if (symbol != nullptr) {
-      char* demangled_name = __cxa_demangle(symbol, nullptr, nullptr, nullptr);
-      const char* name;
-      if (demangled_name != nullptr) {
-        name = demangled_name;
-      } else {
-        name = symbol;
-      }
       async_safe_format_buffer(buf, sizeof(buf),
                                "          #%02zd  pc %" PAD_PTR "  %s%s (%s+%" PRIuPTR ")\n",
-                               frame_num, rel_pc, soname, offset_buf, name,
+                               frame_num, rel_pc, soname, offset_buf, demangle(symbol).c_str(),
                                frames[frame_num] - offset);
-      free(demangled_name);
     } else {
       async_safe_format_buffer(buf, sizeof(buf), "          #%02zd  pc %" PAD_PTR "  %s%s\n",
                                frame_num, rel_pc, soname, offset_buf);
diff --git a/libc/malloc_debug/exported32.map b/libc/malloc_debug/exported32.map
index f75d173..8ed37fa 100644
--- a/libc/malloc_debug/exported32.map
+++ b/libc/malloc_debug/exported32.map
@@ -8,13 +8,13 @@
     debug_free_malloc_leak_info;
     debug_get_malloc_leak_info;
     debug_initialize;
+    debug_iterate;
     debug_mallinfo;
     debug_malloc;
     debug_malloc_backtrace;
     debug_malloc_disable;
     debug_malloc_enable;
     debug_malloc_info;
-    debug_malloc_iterate;
     debug_malloc_usable_size;
     debug_mallopt;
     debug_memalign;
diff --git a/libc/malloc_debug/exported64.map b/libc/malloc_debug/exported64.map
index 6dea58c..cdff88b 100644
--- a/libc/malloc_debug/exported64.map
+++ b/libc/malloc_debug/exported64.map
@@ -8,13 +8,13 @@
     debug_free_malloc_leak_info;
     debug_get_malloc_leak_info;
     debug_initialize;
+    debug_iterate;
     debug_mallinfo;
     debug_malloc;
     debug_malloc_backtrace;
     debug_malloc_disable;
     debug_malloc_enable;
     debug_malloc_info;
-    debug_malloc_iterate;
     debug_malloc_usable_size;
     debug_mallopt;
     debug_memalign;
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index c0765a9..53fcead 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -91,8 +91,8 @@
 int debug_mallopt(int param, int value);
 int debug_malloc_info(int options, FILE* fp);
 int debug_posix_memalign(void** memptr, size_t alignment, size_t size);
-int debug_malloc_iterate(uintptr_t base, size_t size,
-                         void (*callback)(uintptr_t base, size_t size, void* arg), void* arg);
+int debug_iterate(uintptr_t base, size_t size,
+                  void (*callback)(uintptr_t base, size_t size, void* arg), void* arg);
 void debug_malloc_disable();
 void debug_malloc_enable();
 
@@ -252,19 +252,12 @@
   return g_debug->GetPointer(header);
 }
 
-extern "C" void __asan_init() __attribute__((weak));
-
 bool debug_initialize(const MallocDispatch* malloc_dispatch, bool* zygote_child,
                       const char* options) {
   if (zygote_child == nullptr || options == nullptr) {
     return false;
   }
 
-  if (__asan_init != 0) {
-    error_log("malloc debug cannot be enabled alongside ASAN");
-    return false;
-  }
-
   InitAtfork();
 
   g_zygote_child = zygote_child;
@@ -785,23 +778,16 @@
   if (DebugCallsDisabled() || !g_debug->TrackPointers()) {
     return g_dispatch->malloc_info(options, fp);
   }
-
-  // Make sure any pending output is written to the file.
-  fflush(fp);
-
   ScopedConcurrentLock lock;
   ScopedDisableDebugCalls disable;
 
-  // Avoid any issues where allocations are made that will be freed
-  // in the fclose.
-  int fd = fileno(fp);
-  MallocXmlElem root(fd, "malloc", "version=\"debug-malloc-1\"");
+  MallocXmlElem root(fp, "malloc", "version=\"debug-malloc-1\"");
   std::vector<ListInfoType> list;
   PointerData::GetAllocList(&list);
 
   size_t alloc_num = 0;
   for (size_t i = 0; i < list.size(); i++) {
-    MallocXmlElem alloc(fd, "allocation", "nr=\"%zu\"", alloc_num);
+    MallocXmlElem alloc(fp, "allocation", "nr=\"%zu\"", alloc_num);
 
     size_t total = 1;
     size_t size = list[i].size;
@@ -809,8 +795,8 @@
       i++;
       total++;
     }
-    MallocXmlElem(fd, "size").Contents("%zu", list[i].size);
-    MallocXmlElem(fd, "total").Contents("%zu", total);
+    MallocXmlElem(fp, "size").Contents("%zu", list[i].size);
+    MallocXmlElem(fp, "total").Contents("%zu", total);
     alloc_num++;
   }
   return 0;
@@ -841,7 +827,7 @@
   return (*memptr != nullptr) ? 0 : ENOMEM;
 }
 
-int debug_malloc_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*),
+int debug_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*),
                   void* arg) {
   ScopedConcurrentLock lock;
   if (g_debug->TrackPointers()) {
@@ -854,7 +840,7 @@
 
   // An option that adds a header will add pointer tracking, so no need to
   // check if headers are enabled.
-  return g_dispatch->malloc_iterate(base, size, callback, arg);
+  return g_dispatch->iterate(base, size, callback, arg);
 }
 
 void debug_malloc_disable() {
@@ -912,28 +898,25 @@
 
 static std::mutex g_dump_lock;
 
-static void write_dump(int fd) {
-  dprintf(fd, "Android Native Heap Dump v1.2\n\n");
+static void write_dump(FILE* fp) {
+  fprintf(fp, "Android Native Heap Dump v1.2\n\n");
 
   std::string fingerprint = android::base::GetProperty("ro.build.fingerprint", "unknown");
-  dprintf(fd, "Build fingerprint: '%s'\n\n", fingerprint.c_str());
+  fprintf(fp, "Build fingerprint: '%s'\n\n", fingerprint.c_str());
 
-  PointerData::DumpLiveToFile(fd);
+  PointerData::DumpLiveToFile(fp);
 
-  dprintf(fd, "MAPS\n");
+  fprintf(fp, "MAPS\n");
   std::string content;
   if (!android::base::ReadFileToString("/proc/self/maps", &content)) {
-    dprintf(fd, "Could not open /proc/self/maps\n");
+    fprintf(fp, "Could not open /proc/self/maps\n");
   } else {
-    dprintf(fd, "%s", content.c_str());
+    fprintf(fp, "%s", content.c_str());
   }
-  dprintf(fd, "END\n");
+  fprintf(fp, "END\n");
 }
 
 bool debug_write_malloc_leak_info(FILE* fp) {
-  // Make sure any pending output is written to the file.
-  fflush(fp);
-
   ScopedConcurrentLock lock;
   ScopedDisableDebugCalls disable;
 
@@ -943,8 +926,7 @@
     return false;
   }
 
-  write_dump(fileno(fp));
-
+  write_dump(fp);
   return true;
 }
 
@@ -954,13 +936,13 @@
 
   std::lock_guard<std::mutex> guard(g_dump_lock);
 
-  int fd = open(file_name, O_RDWR | O_CREAT | O_NOFOLLOW | O_TRUNC | O_CLOEXEC, 0644);
-  if (fd == -1) {
+  FILE* fp = fopen(file_name, "w+e");
+  if (fp == nullptr) {
     error_log("Unable to create file: %s", file_name);
     return;
   }
 
   error_log("Dumping to file: %s\n", file_name);
-  write_dump(fd);
-  close(fd);
+  write_dump(fp);
+  fclose(fp);
 }
diff --git a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
index 67bb8d9..f85c45b 100644
--- a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
@@ -37,7 +37,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <android-base/file.h>
 #include <android-base/stringprintf.h>
 #include <gtest/gtest.h>
 #include <log/log.h>
@@ -46,7 +45,7 @@
 #include <thread>
 #include <vector>
 
-#include <bionic/malloc.h>
+#include "private/bionic_malloc.h"
 
 static constexpr time_t kTimeoutSeconds = 10;
 
@@ -175,7 +174,6 @@
 }
 
 static void FindStrings(pid_t pid, std::vector<const char*> match_strings,
-                        std::vector<const char*> no_match_strings = std::vector<const char*>{},
                         time_t timeout_seconds = kTimeoutSeconds) {
   std::string log_str;
   time_t start = time(nullptr);
@@ -183,18 +181,12 @@
   while (true) {
     GetLogStr(pid, &log_str);
     found_all = true;
-    // Look for the expected strings.
     for (auto str : match_strings) {
       if (log_str.find(str) == std::string::npos) {
         found_all = false;
         break;
       }
     }
-
-    // Verify the unexpected strings are not present.
-    for (auto str : no_match_strings) {
-      ASSERT_TRUE(log_str.find(str) == std::string::npos) << "Unexpectedly found '" << str << "' in log output:\n" << log_str;
-    }
     if (found_all) {
       return;
     }
@@ -202,7 +194,7 @@
       break;
     }
   }
-  ASSERT_TRUE(found_all) << "Didn't find expected log output:\n" << log_str;
+  ASSERT_TRUE(found_all) << "Didn't find expected log output:\n" + log_str;
 }
 
 TEST(MallocTests, DISABLED_smoke) {}
@@ -472,45 +464,3 @@
         << "Found crash in log.\nLog message: " << log_str;
   }
 }
-
-TEST(MallocTests, DISABLED_write_leak_info) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  FILE* fp = fdopen(tf.fd, "w+");
-  if (fp == nullptr) {
-    printf("Unable to create %s\n", tf.path);
-    _exit(1);
-  }
-  tf.release();
-
-  void* ptr = malloc(1000);
-  if (ptr == nullptr) {
-    printf("malloc failed\n");
-    _exit(1);
-  }
-  memset(ptr, 0, 1000);
-
-  android_mallopt(M_WRITE_MALLOC_LEAK_INFO_TO_FILE, fp, sizeof(fp));
-
-  fclose(fp);
-
-  free(ptr);
-}
-
-TEST(MallocDebugSystemTest, write_leak_info_no_header) {
-  pid_t pid;
-  ASSERT_NO_FATAL_FAILURE(Exec("MallocTests.DISABLED_write_leak_info", "verbose backtrace", &pid, 0));
-
-  ASSERT_NO_FATAL_FAILURE(FindStrings(pid, std::vector<const char*>{"malloc debug enabled"},
-
-                          std::vector<const char*>{" HAS INVALID TAG ", "USED AFTER FREE ", "UNKNOWN POINTER "}));
-}
-
-TEST(MallocDebugSystemTest, write_leak_info_header) {
-  pid_t pid;
-  ASSERT_NO_FATAL_FAILURE(Exec("MallocTests.DISABLED_write_leak_info", "verbose backtrace guard", &pid, 0));
-
-  ASSERT_NO_FATAL_FAILURE(FindStrings(pid, std::vector<const char*>{"malloc debug enabled"},
-                          std::vector<const char*>{" HAS INVALID TAG ", "USED AFTER FREE ", "UNKNOWN POINTER "}));
-}
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index 70457b9..0238d10 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -27,8 +27,6 @@
 
 #include <algorithm>
 #include <memory>
-#include <string>
-#include <string_view>
 #include <thread>
 #include <vector>
 #include <utility>
@@ -75,9 +73,6 @@
 void* debug_valloc(size_t);
 #endif
 
-bool debug_write_malloc_leak_info(FILE*);
-void debug_dump_heap(const char*);
-
 __END_DECLS
 
 constexpr char DIVIDER[] =
@@ -1307,10 +1302,6 @@
 }
 
 static std::string SanitizeHeapData(const std::string& data) {
-  if (data.empty()) {
-    return data;
-  }
-
   // Remove the map data since it's not consistent.
   std::string sanitized;
   bool skip_map_data = false;
@@ -1338,7 +1329,7 @@
       sanitized += line + '\n';
     }
   }
-  return android::base::Trim(sanitized);
+  return sanitized;
 }
 
 void MallocDebugTest::BacktraceDumpOnSignal(bool trigger_with_alloc) {
@@ -1411,7 +1402,9 @@
 z 1  sz       40  num    1  bt 300 400
 MAPS
 MAP_DATA
-END)";
+END
+
+)";
   ASSERT_STREQ(expected.c_str(), sanitized.c_str()) << "Actual data: \n" << actual;
 
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -1470,7 +1463,9 @@
 z 0  sz      300  num    1  bt 100 200
 MAPS
 MAP_DATA
-END)";
+END
+
+)";
   ASSERT_STREQ(expected.c_str(), sanitized.c_str()) << "Actual data: \n" << actual;
 
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -1518,7 +1513,9 @@
 z 0  sz      300  num    2  bt 100 200
 MAPS
 MAP_DATA
-END)";
+END
+
+)";
   ASSERT_STREQ(expected.c_str(), sanitized.c_str()) << "Actual data: \n" << actual;
 
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -1578,7 +1575,9 @@
   bt_info {"" 100 "fake1" a} {"" 200 "fake2" 14}
 MAPS
 MAP_DATA
-END)";
+END
+
+)";
   ASSERT_STREQ(expected.c_str(), sanitized.c_str()) << "Actual data: \n" << actual;
 
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -2473,19 +2472,15 @@
 TEST_F(MallocDebugTest, malloc_info_no_pointer_tracking) {
   Init("fill");
 
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  FILE* fp = fdopen(tf.fd, "w+");
-  tf.release();
-  ASSERT_TRUE(fp != nullptr);
-  ASSERT_EQ(0, debug_malloc_info(0, fp));
-  ASSERT_EQ(0, fclose(fp));
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
+  char* buffer;
+  size_t size;
+  FILE* memstream = open_memstream(&buffer, &size);
+  ASSERT_TRUE(memstream != nullptr);
+  ASSERT_EQ(0, debug_malloc_info(0, memstream));
+  ASSERT_EQ(0, fclose(memstream));
 
   tinyxml2::XMLDocument doc;
-  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(contents.c_str()));
+  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(buffer));
   auto root = doc.FirstChildElement();
   ASSERT_TRUE(root != nullptr);
   ASSERT_STREQ("malloc", root->Name());
@@ -2506,21 +2501,17 @@
   std::unique_ptr<void, decltype(debug_free)*> ptr4(debug_malloc(1200), debug_free);
   ASSERT_TRUE(ptr4.get() != nullptr);
 
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  FILE* fp = fdopen(tf.fd, "w+");
-  tf.release();
-  ASSERT_TRUE(fp != nullptr);
-  ASSERT_EQ(0, debug_malloc_info(0, fp));
-  ASSERT_EQ(0, fclose(fp));
+  char* buffer;
+  size_t size;
+  FILE* memstream = open_memstream(&buffer, &size);
+  ASSERT_TRUE(memstream != nullptr);
+  ASSERT_EQ(0, debug_malloc_info(0, memstream));
+  ASSERT_EQ(0, fclose(memstream));
 
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
-
-  SCOPED_TRACE(testing::Message() << "Output:\n" << contents);
+  SCOPED_TRACE(testing::Message() << "Output:\n" << buffer);
 
   tinyxml2::XMLDocument doc;
-  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(contents.c_str()));
+  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(buffer));
   auto root = doc.FirstChildElement();
   ASSERT_TRUE(root != nullptr);
   ASSERT_STREQ("malloc", root->Name());
@@ -2557,134 +2548,3 @@
   ASSERT_EQ(tinyxml2::XML_SUCCESS, alloc->FirstChildElement("total")->QueryIntText(&val));
   ASSERT_EQ(1, val);
 }
-
-static void AllocPtrsWithBacktrace(std::vector<void*>* ptrs) {
-  backtrace_fake_add(std::vector<uintptr_t> {0xf, 0xe, 0xd, 0xc});
-  void* ptr = debug_malloc(1024);
-  ASSERT_TRUE(ptr != nullptr);
-  memset(ptr, 0, 1024);
-  ptrs->push_back(ptr);
-
-  backtrace_fake_add(std::vector<uintptr_t> {0xbc000, 0xbc001, 0xbc002});
-  ptr = debug_malloc(500);
-  ASSERT_TRUE(ptr != nullptr);
-  memset(ptr, 0, 500);
-  ptrs->push_back(ptr);
-
-  backtrace_fake_add(std::vector<uintptr_t> {0x104});
-  ptr = debug_malloc(100);
-  ASSERT_TRUE(ptr != nullptr);
-  memset(ptr, 0, 100);
-  ptrs->push_back(ptr);
-}
-
-static constexpr std::string_view kDumpInfo = R"(Android Native Heap Dump v1.2
-
-Build fingerprint: ''
-
-Total memory: 1624
-Allocation records: 3
-Backtrace size: 16
-
-z 0  sz     1024  num    1  bt f e d c
-z 0  sz      500  num    1  bt bc000 bc001 bc002
-z 0  sz      100  num    1  bt 104
-MAPS
-MAP_DATA
-END)";
-
-TEST_F(MallocDebugTest, debug_write_malloc_leak_info) {
-  Init("backtrace=16");
-
-  std::vector<void*> ptrs;
-  AllocPtrsWithBacktrace(&ptrs);
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  close(tf.fd);
-  tf.release();
-  FILE* fp = fopen(tf.path, "w+");
-  ASSERT_TRUE(fp != nullptr);
-
-  ASSERT_TRUE(debug_write_malloc_leak_info(fp));
-
-  fclose(fp);
-
-  for (auto ptr : ptrs) {
-    debug_free(ptr);
-  }
-  ptrs.clear();
-
-  std::string expected(kDumpInfo);
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
-  contents = SanitizeHeapData(contents);
-  ASSERT_EQ(expected, contents);
-  ASSERT_STREQ("", getFakeLogBuf().c_str());
-  ASSERT_STREQ("", getFakeLogPrint().c_str());
-}
-
-TEST_F(MallocDebugTest, debug_write_malloc_leak_info_extra_data) {
-  Init("backtrace=16");
-
-  std::vector<void*> ptrs;
-  AllocPtrsWithBacktrace(&ptrs);
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  close(tf.fd);
-  tf.release();
-  FILE* fp = fopen(tf.path, "w+");
-  ASSERT_TRUE(fp != nullptr);
-
-  fprintf(fp, "This message should appear before the output.\n");
-  ASSERT_TRUE(debug_write_malloc_leak_info(fp));
-  fprintf(fp, "This message should appear after the output.\n");
-
-  fclose(fp);
-
-  for (auto ptr : ptrs) {
-    debug_free(ptr);
-  }
-  ptrs.clear();
-
-  std::string expected = "This message should appear before the output.\n"
-                         + std::string(kDumpInfo)
-                         + "\nThis message should appear after the output.";
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
-  contents = SanitizeHeapData(contents);
-  ASSERT_EQ(expected, contents);
-  ASSERT_STREQ("", getFakeLogBuf().c_str());
-  ASSERT_STREQ("", getFakeLogPrint().c_str());
-}
-
-TEST_F(MallocDebugTest, dump_heap) {
-  Init("backtrace=16");
-
-  std::vector<void*> ptrs;
-  AllocPtrsWithBacktrace(&ptrs);
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  close(tf.fd);
-  tf.release();
-  debug_dump_heap(tf.path);
-
-  for (auto ptr : ptrs) {
-    debug_free(ptr);
-  }
-  ptrs.clear();
-
-  std::string expected(kDumpInfo);
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
-  contents = SanitizeHeapData(contents);
-  ASSERT_EQ(expected, contents);
-  ASSERT_STREQ("", getFakeLogBuf().c_str());
-  std::string expected_log = std::string("6 malloc_debug Dumping to file: ") + tf.path + "\n\n";
-  ASSERT_EQ(expected_log, getFakeLogPrint());
-}
diff --git a/libc/malloc_hooks/Android.bp b/libc/malloc_hooks/Android.bp
index 861c371..d119f89 100644
--- a/libc/malloc_hooks/Android.bp
+++ b/libc/malloc_hooks/Android.bp
@@ -32,15 +32,6 @@
         "-Werror",
         "-fno-stack-protector",
     ],
-
-    apex_available: [
-        "com.android.runtime",
-    ],
-    static: {
-        apex_available: [
-            "//apex_available:platform",
-        ],
-    },
 }
 
 // ==============================================================
@@ -58,13 +49,7 @@
     shared_libs: ["libbase"],
 
     local_include_dirs: ["tests"],
-    include_dirs: [
-        "bionic/libc",
-        "bionic"
-    ],
-    header_libs: [
-        "bionic_libc_platform_headers",
-    ],
+    include_dirs: ["bionic/libc", "bionic"],
 
     cflags: [
         "-Wall",
diff --git a/libc/malloc_hooks/exported32.map b/libc/malloc_hooks/exported32.map
index 2b02806..293d9ac 100644
--- a/libc/malloc_hooks/exported32.map
+++ b/libc/malloc_hooks/exported32.map
@@ -7,13 +7,13 @@
     hooks_free_malloc_leak_info;
     hooks_get_malloc_leak_info;
     hooks_initialize;
+    hooks_iterate;
     hooks_mallinfo;
     hooks_malloc;
     hooks_malloc_backtrace;
     hooks_malloc_disable;
     hooks_malloc_enable;
     hooks_malloc_info;
-    hooks_malloc_iterate;
     hooks_malloc_usable_size;
     hooks_mallopt;
     hooks_memalign;
diff --git a/libc/malloc_hooks/exported64.map b/libc/malloc_hooks/exported64.map
index 59ec1f0..340106b 100644
--- a/libc/malloc_hooks/exported64.map
+++ b/libc/malloc_hooks/exported64.map
@@ -7,13 +7,13 @@
     hooks_free_malloc_leak_info;
     hooks_get_malloc_leak_info;
     hooks_initialize;
+    hooks_iterate;
     hooks_mallinfo;
     hooks_malloc;
     hooks_malloc_backtrace;
     hooks_malloc_disable;
     hooks_malloc_enable;
     hooks_malloc_info;
-    hooks_malloc_iterate;
     hooks_malloc_usable_size;
     hooks_mallopt;
     hooks_memalign;
diff --git a/libc/malloc_hooks/malloc_hooks.cpp b/libc/malloc_hooks/malloc_hooks.cpp
index 1ba8696..b1c1d50 100644
--- a/libc/malloc_hooks/malloc_hooks.cpp
+++ b/libc/malloc_hooks/malloc_hooks.cpp
@@ -67,7 +67,7 @@
 struct mallinfo hooks_mallinfo();
 int hooks_mallopt(int param, int value);
 int hooks_posix_memalign(void** memptr, size_t alignment, size_t size);
-int hooks_malloc_iterate(uintptr_t base, size_t size,
+int hooks_iterate(uintptr_t base, size_t size,
     void (*callback)(uintptr_t base, size_t size, void* arg), void* arg);
 void hooks_malloc_disable();
 void hooks_malloc_enable();
@@ -209,7 +209,7 @@
   return g_dispatch->posix_memalign(memptr, alignment, size);
 }
 
-int hooks_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
+int hooks_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
   return 0;
 }
 
diff --git a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
index 1858781..86e20ea 100644
--- a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
+++ b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
@@ -38,7 +38,7 @@
 
 #include <gtest/gtest.h>
 
-#include <bionic/malloc.h>
+#include <private/bionic_malloc.h>
 #include <private/bionic_malloc_dispatch.h>
 #include <tests/utils.h>
 
diff --git a/libc/platform/bionic/mte_kernel.h b/libc/platform/bionic/mte_kernel.h
deleted file mode 100644
index 04f2bb6..0000000
--- a/libc/platform/bionic/mte_kernel.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-// Defines constants used as part of the interface in an experimental MTE branch
-// of the Linux kernel, which may be found at:
-//
-// https://github.com/pcc/linux/tree/android-experimental-mte
-//
-// This interface should not be considered to be stable.
-
-#ifdef ANDROID_EXPERIMENTAL_MTE
-#define HWCAP2_MTE (1UL << 31)
-#define PROT_MTE 0x10
-#endif
diff --git a/libc/platform/bionic/tls.h b/libc/platform/bionic/tls.h
deleted file mode 100644
index ca39020..0000000
--- a/libc/platform/bionic/tls.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#if defined(__aarch64__)
-# define __get_tls() ({ void** __val; __asm__("mrs %0, tpidr_el0" : "=r"(__val)); __val; })
-#elif defined(__arm__)
-# define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; })
-#elif defined(__mips__)
-# define __get_tls() \
-    /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \
-    ({ register void** __val asm("v1"); \
-       __asm__(".set    push\n" \
-               ".set    mips32r2\n" \
-               "rdhwr   %0,$29\n" \
-               ".set    pop\n" : "=r"(__val)); \
-       __val; })
-#elif defined(__i386__)
-# define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; })
-#elif defined(__x86_64__)
-# define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; })
-#else
-#error unsupported architecture
-#endif
-
-#include "tls_defines.h"
diff --git a/libc/private/MallocXmlElem.h b/libc/private/MallocXmlElem.h
index a367972..04d3eee 100644
--- a/libc/private/MallocXmlElem.h
+++ b/libc/private/MallocXmlElem.h
@@ -18,39 +18,38 @@
 
 #include <stdarg.h>
 #include <stdio.h>
-#include <unistd.h>
 
 #include <private/bionic_macros.h>
 
 class MallocXmlElem {
  public:
   // Name must be valid throughout lifetime of the object.
-  explicit MallocXmlElem(int fd, const char* name,
-                         const char* attr_fmt = nullptr, ...) : fd_(fd), name_(name) {
-    dprintf(fd_, "<%s", name_);
+  explicit MallocXmlElem(FILE* fp, const char* name,
+                         const char* attr_fmt = nullptr, ...) : fp_(fp), name_(name) {
+    fprintf(fp, "<%s", name_);
     if (attr_fmt != nullptr) {
       va_list args;
       va_start(args, attr_fmt);
-      write(fd_, " ", 1);
-      vdprintf(fd_, attr_fmt, args);
+      fputc(' ', fp_);
+      vfprintf(fp_, attr_fmt, args);
       va_end(args);
     }
-    write(fd_, ">", 1);
+    fputc('>', fp_);
   }
 
   ~MallocXmlElem() noexcept {
-    dprintf(fd_, "</%s>", name_);
+    fprintf(fp_, "</%s>", name_);
   }
 
   void Contents(const char* fmt, ...) {
     va_list args;
     va_start(args, fmt);
-    vdprintf(fd_, fmt, args);
+    vfprintf(fp_, fmt, args);
     va_end(args);
   }
 
 private:
-  int fd_;
+  FILE* fp_;
   const char* name_;
 
   BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(MallocXmlElem);
diff --git a/libc/private/NetdClientDispatch.h b/libc/private/NetdClientDispatch.h
index 7ebbe0c..20e7f25 100644
--- a/libc/private/NetdClientDispatch.h
+++ b/libc/private/NetdClientDispatch.h
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef PRIVATE_NETD_CLIENT_DISPATCH_H
+#define PRIVATE_NETD_CLIENT_DISPATCH_H
 
 #include <sys/cdefs.h>
 #include <sys/socket.h>
@@ -24,9 +25,6 @@
 struct NetdClientDispatch {
     int (*accept4)(int, struct sockaddr*, socklen_t*, int);
     int (*connect)(int, const struct sockaddr*, socklen_t);
-    int (*sendmmsg)(int, const struct mmsghdr*, unsigned int, int);
-    ssize_t (*sendmsg)(int, const struct msghdr*, unsigned int);
-    int (*sendto)(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
     int (*socket)(int, int, int);
     unsigned (*netIdForResolv)(unsigned);
     int (*dnsOpenProxy)();
@@ -35,3 +33,5 @@
 extern __LIBC_HIDDEN__ struct NetdClientDispatch __netdClientDispatch;
 
 __END_DECLS
+
+#endif  // PRIVATE_NETD_CLIENT_DISPATCH_H
diff --git a/libc/private/ScopedFd.h b/libc/private/ScopedFd.h
deleted file mode 100644
index 1cec916..0000000
--- a/libc/private/ScopedFd.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <unistd.h>
-
-#include "private/bionic_macros.h"
-#include "private/ErrnoRestorer.h"
-
-class ScopedFd final {
- public:
-  explicit ScopedFd(int fd) : fd_(fd) {
-  }
-
-  ScopedFd() : fd_(-1) {
-  }
-
-  ~ScopedFd() {
-    reset(-1);
-  }
-
-  void reset(int fd = -1) {
-    if (fd_ != -1) {
-      ErrnoRestorer e;
-      close(fd_);
-    }
-    fd_ = fd;
-  }
-
-  int get() const {
-    return fd_;
-  }
-
- private:
-  int fd_;
-
-  BIONIC_DISALLOW_COPY_AND_ASSIGN(ScopedFd);
-};
diff --git a/libc/private/WriteProtected.h b/libc/private/WriteProtected.h
index 26c239c..69a6822 100644
--- a/libc/private/WriteProtected.h
+++ b/libc/private/WriteProtected.h
@@ -46,16 +46,6 @@
 
   WriteProtectedContents<T> contents;
 
-  int set_protection(int prot) {
-    auto addr = &contents;
-#if __has_feature(hwaddress_sanitizer)
-    // The mprotect system call does not currently untag pointers, so do it
-    // ourselves.
-    addr = untag_address(addr);
-#endif
-    return mprotect(reinterpret_cast<void*>(addr), PAGE_SIZE, prot);
-  }
-
  public:
   WriteProtected() = default;
   BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtected);
@@ -65,7 +55,7 @@
     // multiple times by accident.
     memset(&contents, 0, sizeof(contents));
 
-    if (set_protection(PROT_READ)) {
+    if (mprotect(&contents, PAGE_SIZE, PROT_READ)) {
       async_safe_fatal("failed to make WriteProtected nonwritable in initialize");
     }
   }
@@ -80,12 +70,12 @@
 
   template <typename Mutator>
   void mutate(Mutator mutator) {
-    if (set_protection(PROT_READ | PROT_WRITE) != 0) {
+    if (mprotect(&contents, PAGE_SIZE, PROT_READ | PROT_WRITE) != 0) {
       async_safe_fatal("failed to make WriteProtected writable in mutate: %s",
                        strerror(errno));
     }
     mutator(&contents.value);
-    if (set_protection(PROT_READ) != 0) {
+    if (mprotect(&contents, PAGE_SIZE, PROT_READ) != 0) {
       async_safe_fatal("failed to make WriteProtected nonwritable in mutate: %s",
                        strerror(errno));
     }
diff --git a/libc/private/__get_tls.h b/libc/private/__get_tls.h
new file mode 100644
index 0000000..04c5fdb
--- /dev/null
+++ b/libc/private/__get_tls.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __BIONIC_PRIVATE_GET_TLS_H_
+#define __BIONIC_PRIVATE_GET_TLS_H_
+
+#if defined(__aarch64__)
+# define __get_tls() ({ void** __val; __asm__("mrs %0, tpidr_el0" : "=r"(__val)); __val; })
+#elif defined(__arm__)
+# define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; })
+#elif defined(__mips__)
+# define __get_tls() \
+    /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \
+    ({ register void** __val asm("v1"); \
+       __asm__(".set    push\n" \
+               ".set    mips32r2\n" \
+               "rdhwr   %0,$29\n" \
+               ".set    pop\n" : "=r"(__val)); \
+       __val; })
+#elif defined(__i386__)
+# define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; })
+#elif defined(__x86_64__)
+# define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; })
+#else
+#error unsupported architecture
+#endif
+
+#endif /* __BIONIC_PRIVATE_GET_TLS_H_ */
diff --git a/libc/platform/bionic/tls_defines.h b/libc/private/bionic_asm_tls.h
similarity index 100%
rename from libc/platform/bionic/tls_defines.h
rename to libc/private/bionic_asm_tls.h
diff --git a/libc/private/bionic_call_ifunc_resolver.h b/libc/private/bionic_call_ifunc_resolver.h
deleted file mode 100644
index e0ea35b..0000000
--- a/libc/private/bionic_call_ifunc_resolver.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <link.h>
-#include <sys/cdefs.h>
-
-__LIBC_HIDDEN__ ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr);
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index ef735ba..d73079e 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -88,10 +88,6 @@
   TlsModules tls_modules;
   BionicAllocator tls_allocator;
 
-  // Values passed from the HWASan runtime (via libc.so) to the loader.
-  void (*load_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
-  void (*unload_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
-
   // Values passed from the linker to libc.so.
   const char* init_progname = nullptr;
   char** init_environ = nullptr;
diff --git a/libc/private/bionic_ifuncs.h b/libc/private/bionic_ifuncs.h
deleted file mode 100644
index f175bec..0000000
--- a/libc/private/bionic_ifuncs.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <sys/ifunc.h>
-
-#if defined(__aarch64__)
-#define IFUNC_ARGS (uint64_t hwcap __attribute__((unused)), \
-                    __ifunc_arg_t* arg __attribute__((unused)))
-#elif defined(__arm__)
-#define IFUNC_ARGS (unsigned long hwcap __attribute__((unused)))
-#else
-#define IFUNC_ARGS ()
-#endif
-
-#define DEFINE_IFUNC_FOR(name) \
-    name##_func name __attribute__((ifunc(#name "_resolver"))); \
-    __attribute__((visibility("hidden"))) \
-    name##_func* name##_resolver IFUNC_ARGS
-
-#define DECLARE_FUNC(type, name) \
-    __attribute__((visibility("hidden"))) \
-    type name
-
-#define RETURN_FUNC(type, name) { \
-        DECLARE_FUNC(type, name); \
-        return name; \
-    }
diff --git a/libc/private/bionic_lock.h b/libc/private/bionic_lock.h
index d70ba6c..ec179d1 100644
--- a/libc/private/bionic_lock.h
+++ b/libc/private/bionic_lock.h
@@ -72,12 +72,6 @@
   void unlock() {
     bool shared = process_shared; /* cache to local variable */
     if (atomic_exchange_explicit(&state, Unlocked, memory_order_release) == LockedWithWaiter) {
-      // The Lock object may have been deallocated between the atomic exchange and the futex wake
-      // call, so avoid accessing any fields of Lock here. In that case, the wake call may target
-      // unmapped memory or trigger a spurious futex wakeup. The same situation happens with
-      // pthread mutexes. References:
-      //  - https://lkml.org/lkml/2014/11/27/472
-      //  - http://austingroupbugs.net/view.php?id=811#c2267
       __futex_wake_ex(&state, shared, 1);
     }
   }
diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h
index 54903f5..4800e3a 100644
--- a/libc/private/bionic_macros.h
+++ b/libc/private/bionic_macros.h
@@ -50,7 +50,10 @@
 }
 
 #if defined(__arm__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined r14")
+// Do not emit anything for arm, clang does not allow emiting an arm unwind
+// directive.
+// #define BIONIC_STOP_UNWIND asm volatile(".cantunwind")
+#define BIONIC_STOP_UNWIND
 #elif defined(__aarch64__)
 #define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined x30")
 #elif defined(__i386__)
@@ -84,12 +87,3 @@
 #else
 #define __BIONIC_FALLTHROUGH
 #endif
-
-template <typename T>
-static inline T* untag_address(T* p) {
-#if defined(__aarch64__)
-  return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ((1ULL << 56) - 1));
-#else
-  return p;
-#endif
-}
diff --git a/libc/platform/bionic/malloc.h b/libc/private/bionic_malloc.h
similarity index 100%
rename from libc/platform/bionic/malloc.h
rename to libc/private/bionic_malloc.h
diff --git a/libc/private/bionic_malloc_dispatch.h b/libc/private/bionic_malloc_dispatch.h
index 52d8573..aea3a1c 100644
--- a/libc/private/bionic_malloc_dispatch.h
+++ b/libc/private/bionic_malloc_dispatch.h
@@ -70,7 +70,7 @@
 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   MallocValloc valloc;
 #endif
-  MallocIterate malloc_iterate;
+  MallocIterate iterate;
   MallocMallocDisable malloc_disable;
   MallocMallocEnable malloc_enable;
   MallocMallopt mallopt;
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 9a80140..90914c3 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -34,9 +34,9 @@
 #include <sys/cdefs.h>
 #include <sys/param.h>
 
-#include <platform/bionic/tls.h>
-
+#include "bionic_asm_tls.h"
 #include "bionic_macros.h"
+#include "__get_tls.h"
 #include "grp_pwd.h"
 
 /** WARNING WARNING WARNING
diff --git a/libc/private/sigrtmin.h b/libc/private/sigrtmin.h
index 5de1a32..d78d980 100644
--- a/libc/private/sigrtmin.h
+++ b/libc/private/sigrtmin.h
@@ -39,14 +39,13 @@
 //   33 (__SIGRTMIN + 1)        libbacktrace
 //   34 (__SIGRTMIN + 2)        libcore
 //   35 (__SIGRTMIN + 3)        debuggerd -b
-//   36 (__SIGRTMIN + 4)        heapprofd native dumps
+//   36 (__SIGRTMIN + 4)        heapprofd
 //   37 (__SIGRTMIN + 5)        coverage (libprofile-extras)
-//   38 (__SIGRTMIN + 6)        heapprofd ART managed heap dumps
 //
 // If you change this, also change __ndk_legacy___libc_current_sigrtmin
 // in <android/legacy_signal_inlines.h> to match.
 
-#define __SIGRT_RESERVED 7
+#define __SIGRT_RESERVED 6
 static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigset, int how) {
   int (*block)(sigset64_t*, int);
   int (*unblock)(sigset64_t*, int);
@@ -73,6 +72,5 @@
   unblock(&sigset, __SIGRTMIN + 3);
   unblock(&sigset, __SIGRTMIN + 4);
   unblock(&sigset, __SIGRTMIN + 5);
-  unblock(&sigset, __SIGRTMIN + 6);
   return sigset;
 }
diff --git a/libc/seccomp/include/seccomp_policy.h b/libc/seccomp/include/seccomp_policy.h
index 383c42e..fd0fb60 100644
--- a/libc/seccomp/include/seccomp_policy.h
+++ b/libc/seccomp/include/seccomp_policy.h
@@ -23,6 +23,7 @@
 bool set_app_seccomp_filter();
 bool set_app_zygote_seccomp_filter();
 bool set_system_seccomp_filter();
+bool set_global_seccomp_filter();
 
 // Installs a filter that limits setresuid/setresgid to a range of
 // [uid_gid_min..uid_gid_max] (for the real-, effective- and super-ids).
diff --git a/libc/seccomp/seccomp_bpfs.h b/libc/seccomp/seccomp_bpfs.h
index 8245429..d9e8047 100644
--- a/libc/seccomp/seccomp_bpfs.h
+++ b/libc/seccomp/seccomp_bpfs.h
@@ -25,6 +25,8 @@
 extern const size_t arm_app_zygote_filter_size;
 extern const struct sock_filter arm_system_filter[];
 extern const size_t arm_system_filter_size;
+extern const struct sock_filter arm_global_filter[];
+extern const size_t arm_global_filter_size;
 
 extern const struct sock_filter arm64_app_filter[];
 extern const size_t arm64_app_filter_size;
@@ -32,6 +34,8 @@
 extern const size_t arm64_app_zygote_filter_size;
 extern const struct sock_filter arm64_system_filter[];
 extern const size_t arm64_system_filter_size;
+extern const struct sock_filter arm64_global_filter[];
+extern const size_t arm64_global_filter_size;
 
 extern const struct sock_filter x86_app_filter[];
 extern const size_t x86_app_filter_size;
@@ -39,6 +43,8 @@
 extern const size_t x86_app_zygote_filter_size;
 extern const struct sock_filter x86_system_filter[];
 extern const size_t x86_system_filter_size;
+extern const struct sock_filter x86_global_filter[];
+extern const size_t x86_global_filter_size;
 
 extern const struct sock_filter x86_64_app_filter[];
 extern const size_t x86_64_app_filter_size;
@@ -46,6 +52,8 @@
 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 x86_64_global_filter[];
+extern const size_t x86_64_global_filter_size;
 
 extern const struct sock_filter mips_app_filter[];
 extern const size_t mips_app_filter_size;
@@ -53,6 +61,8 @@
 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 mips_global_filter[];
+extern const size_t mips_global_filter_size;
 
 extern const struct sock_filter mips64_app_filter[];
 extern const size_t mips64_app_filter_size;
@@ -60,3 +70,5 @@
 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;
+extern const struct sock_filter mips64_global_filter[];
+extern const size_t mips64_global_filter_size;
diff --git a/libc/seccomp/seccomp_policy.cpp b/libc/seccomp/seccomp_policy.cpp
index bce7b14..222a2c8 100644
--- a/libc/seccomp/seccomp_policy.cpp
+++ b/libc/seccomp/seccomp_policy.cpp
@@ -39,6 +39,8 @@
 static const size_t primary_app_zygote_filter_size = arm64_app_zygote_filter_size;
 static const struct sock_filter* primary_system_filter = arm64_system_filter;
 static const size_t primary_system_filter_size = arm64_system_filter_size;
+static const struct sock_filter* primary_global_filter = arm64_global_filter;
+static const size_t primary_global_filter_size = arm64_global_filter_size;
 
 static const long primary_setresgid = __arm64_setresgid;
 static const long primary_setresuid = __arm64_setresuid;
@@ -49,6 +51,8 @@
 static const size_t secondary_app_zygote_filter_size = arm_app_zygote_filter_size;
 static const struct sock_filter* secondary_system_filter = arm_system_filter;
 static const size_t secondary_system_filter_size = arm_system_filter_size;
+static const struct sock_filter* secondary_global_filter = arm_global_filter;
+static const size_t secondary_global_filter_size = arm_global_filter_size;
 
 static const long secondary_setresgid = __arm_setresgid;
 static const long secondary_setresuid = __arm_setresuid;
@@ -62,6 +66,8 @@
 static const size_t primary_app_zygote_filter_size = x86_64_app_zygote_filter_size;
 static const struct sock_filter* primary_system_filter = x86_64_system_filter;
 static const size_t primary_system_filter_size = x86_64_system_filter_size;
+static const struct sock_filter* primary_global_filter = x86_64_global_filter;
+static const size_t primary_global_filter_size = x86_64_global_filter_size;
 
 static const long primary_setresgid = __x86_64_setresgid;
 static const long primary_setresuid = __x86_64_setresuid;
@@ -72,6 +78,8 @@
 static const size_t secondary_app_zygote_filter_size = x86_app_zygote_filter_size;
 static const struct sock_filter* secondary_system_filter = x86_system_filter;
 static const size_t secondary_system_filter_size = x86_system_filter_size;
+static const struct sock_filter* secondary_global_filter = x86_global_filter;
+static const size_t secondary_global_filter_size = x86_global_filter_size;
 
 static const long secondary_setresgid = __x86_setresgid;
 static const long secondary_setresuid = __x86_setresuid;
@@ -85,6 +93,8 @@
 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 struct sock_filter* primary_global_filter = mips64_global_filter;
+static const size_t primary_global_filter_size = mips64_global_filter_size;
 
 static const long primary_setresgid = __mips64_setresgid;
 static const long primary_setresuid = __mips64_setresuid;
@@ -95,6 +105,8 @@
 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 struct sock_filter* secondary_global_filter = mips_global_filter;
+static const size_t secondary_global_filter_size = mips_global_filter_size;
 
 static const long secondary_setresgid = __mips_setresgid;
 static const long secondary_setresuid = __mips_setresuid;
@@ -233,6 +245,7 @@
   APP,
   APP_ZYGOTE,
   SYSTEM,
+  GLOBAL
 };
 
 bool _set_seccomp_filter(FilterType type) {
@@ -259,6 +272,13 @@
         s = secondary_system_filter;
         s_size = secondary_system_filter_size;
         break;
+      case GLOBAL:
+        p = primary_global_filter;
+        p_size = primary_global_filter_size;
+        s = secondary_global_filter;
+        s_size = secondary_global_filter_size;
+        break;
+
     }
 
 #ifdef DUAL_ARCH
@@ -305,6 +325,10 @@
     return _set_seccomp_filter(FilterType::SYSTEM);
 }
 
+bool set_global_seccomp_filter() {
+    return _set_seccomp_filter(FilterType::GLOBAL);
+}
+
 bool install_setuidgid_seccomp_filter(uint32_t uid_gid_min, uint32_t uid_gid_max) {
     return _install_setuidgid_filter(uid_gid_min, uid_gid_max);
 }
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index a0b4219..91c7689 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -57,6 +57,8 @@
 #include "private/ErrnoRestorer.h"
 #include "private/thread_private.h"
 
+extern "C" int ___close(int fd);
+
 #define ALIGNBYTES (sizeof(uintptr_t) - 1)
 #define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
 
diff --git a/libc/symbol_ordering b/libc/symbol_ordering
new file mode 100644
index 0000000..c04692b
--- /dev/null
+++ b/libc/symbol_ordering
@@ -0,0 +1,210 @@
+# This file is generated by sorting symbols in the .bss section in libc.so by
+# their sizes and taking out symbols that are unique to a target.  By sorting
+# symbols by size, we usually have less dirty pages at runtime, because small
+# symbols are grouped together.
+
+ctl_initialized
+gGlobalsMutating
+global_hashtable_initialized
+gmtcheck.gmt_is_set
+had_conf_error
+je_background_thread_enabled_state
+je_log_init_done
+je_opt_abort
+je_opt_abort_conf
+je_opt_background_thread
+je_opt_junk_alloc
+je_opt_junk_free
+je_opt_stats_print
+je_opt_utrace
+je_opt_xmalloc
+je_opt_zero
+je_tsd_booted
+malloc_disabled_tcache
+malloc_slow_flags
+mmap_flags
+os_overcommits
+restartloop
+_ZL24gHeapprofdInitInProgress
+_ZL27gHeapprofdInitHookInstalled
+_ZL23gZygoteChildProfileable
+_ZZ17__find_icu_symbolPKcE9found_icu
+ru_a
+ru_b
+ru_counter
+ru_g
+ru_msb
+ru_seed
+ru_seed2
+ru_x
+_ZZ12bindresvportE4port
+a0
+__atexit
+atexit_mutex
+b0
+ctl_arenas
+ctl_stats
+__cxa_finalize.call_depth
+daylight
+dirty_decay_ms_default.0
+environ
+error_message_count
+error_one_per_line
+error_print_progname
+__free_hook
+g_atexit_lock
+gGlobalsMutateLock
+global_hashtable
+gmtptr
+handlers
+je_background_thread_info
+je_hooks_arena_new_hook
+je_init_system_thp_mode
+je_malloc_conf
+je_malloc_disable.once_control
+je_malloc_message
+je_narenas_auto
+je_ncpus
+je_nhbins
+je_opt_dirty_decay_ms
+je_opt_metadata_thp
+je_opt_muzzy_decay_ms
+je_opt_narenas
+je_opt_thp
+je_tcache_bin_info
+je_tcache_maxclass
+je_tcaches
+je_tsd_tsd
+lastenv
+lcl_is_set
+lclptr
+locallock
+malloc_disabled_lock
+__malloc_hook
+malloc_initializer
+mbrlen.mbs
+mbtowc.mbs
+__memalign_hook
+muzzy_decay_ms_default.0
+narenas_total
+ncleanups
+optarg
+optreset
+os_page
+p5s
+__progname
+random_mutex
+__realloc_hook
+_res_cache_list_lock
+_res_cache_once
+_res_key
+__res_randomid.__libc_mutex_random
+rs
+_rs_forkdetect._rs_pid
+_rs_forked
+rsx
+ru_pid
+ru_prf
+ru_reseed
+__stack_chk_guard
+stack_nelms
+strtok.last
+suboptarg
+__system_property_area__
+tcaches_avail
+tcaches_past
+timezone
+tmpnam.tmpcount
+ut
+wctomb.mbs
+_ZL11g_arc4_lock
+_ZL13g_locale_once
+_ZL13g_thread_list
+_ZL14syslog_log_tag
+_ZL16gHeapprofdHandle
+_ZL17g_libicuuc_handle
+_ZL18netdClientInitOnce
+_ZL30g_propservice_protocol_version
+_ZN9prop_area13pa_data_size_E
+_ZN9prop_area8pa_size_E
+_ZZ10mbsnrtowcsE15__private_state
+_ZZ10wcsnrtombsE15__private_state
+_ZZ13error_at_lineE9last_file
+_ZZ13error_at_lineE9last_line
+_ZZ14__icu_charTypejE10u_charType
+_ZZ23__bionic_get_shell_pathE7sh_path
+_ZZ23__icu_hasBinaryPropertyj9UPropertyPFiiEE19u_hasBinaryProperty
+_ZZ25__icu_getIntPropertyValuej9UPropertyE21u_getIntPropertyValue
+_ZZ7mbrtowcE15__private_state
+_ZZ7wcrtombE15__private_state
+_ZZ8c16rtombE15__private_state
+_ZZ8c32rtombE15__private_state
+_ZZ8iswcntrlE10u_charType
+_ZZ8iswdigitE9u_isdigit
+_ZZ8iswpunctE9u_ispunct
+_ZZ8mbrtoc16E15__private_state
+_ZZ8mbrtoc32E15__private_state
+_ZZ8towlowerE9u_tolower
+_ZZ8towupperE9u_toupper
+ether_aton.addr
+seed48.sseed
+__dtoa_locks
+_ZGVZ14__icu_charTypejE10u_charType
+_ZGVZ14tzset_unlockedE20persist_sys_timezone
+_ZGVZ17__find_icu_symbolPKcE9found_icu
+_ZGVZ23__bionic_get_shell_pathE7sh_path
+_ZGVZ23__icu_hasBinaryPropertyj9UPropertyPFiiEE19u_hasBinaryProperty
+_ZGVZ25__icu_getIntPropertyValuej9UPropertyE21u_getIntPropertyValue
+_ZGVZ8iswcntrlE10u_charType
+_ZGVZ8iswdigitE9u_isdigit
+_ZGVZ8iswpunctE9u_ispunct
+_ZGVZ8towlowerE9u_tolower
+_ZGVZ8towupperE9u_toupper
+_ZL10gAllocated
+_ZL11gAllocLimit
+_ZL13g_atfork_list
+_ZL6g_lock
+_ZL6g_tags
+je_opt_stats_print_opts
+nuls
+precsize_ntoa.retbuf
+__p_secstodate.output
+ether_ntoa.buf
+inet_ntoa.b
+__p_class.classbuf
+__p_type.typebuf
+__sym_ntop.unname
+__sym_ntos.unname
+_ZL10gFunctions
+_ZL12vendor_group
+_ZL13vendor_passwd
+freelist
+__p_option.nbuf
+__p_time.nbuf
+_ZL18g_thread_list_lock
+tm
+_ZL8g_locale
+ctl_mtx
+init_lock
+je_arenas_lock
+je_background_thread_lock
+tcaches_mtx
+je_tsd_init_head
+buf_asctime
+__loc_ntoa.tmpbuf
+utmp
+_ZZ14tzset_unlockedE20persist_sys_timezone
+arena_binind_div_info
+__hexdig_D2A
+lcl_TZname
+inet_nsap_ntoa_tmpbuf
+_ZL7key_map
+_ZL17system_properties
+private_mem
+_res_cache_list
+__libc_globals
+tmpnam.buf
+je_extents_rtree
+_nres
+je_arenas
+je_extent_mutex_pool
diff --git a/libc/system_properties/Android.bp b/libc/system_properties/Android.bp
index 8780dda..911afb1 100644
--- a/libc/system_properties/Android.bp
+++ b/libc/system_properties/Android.bp
@@ -1,7 +1,6 @@
 cc_library_static {
     name: "libsystemproperties",
     defaults: ["libc_defaults"],
-    native_bridge_supported: true,
     srcs: [
         "context_node.cpp",
         "contexts_split.cpp",
diff --git a/libc/tools/Android.bp b/libc/tools/Android.bp
deleted file mode 100644
index 13179a0..0000000
--- a/libc/tools/Android.bp
+++ /dev/null
@@ -1,4 +0,0 @@
-filegroup {
-    name: "bionic-gensyscalls",
-    srcs: ["gensyscalls.py"]
-}
diff --git a/libc/tools/generate-NOTICE.py b/libc/tools/generate-NOTICE.py
index 7218445..17429e1 100755
--- a/libc/tools/generate-NOTICE.py
+++ b/libc/tools/generate-NOTICE.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 # Run with directory arguments from any directory, with no special setup required.
+# Or:
+# for i in libc libdl libm linker libstdc++ ; do ./libc/tools/generate-NOTICE.py $i > $i/NOTICE ; done
 
 import ftplib
 import hashlib
diff --git a/libc/tools/genfunctosyscallnrs.py b/libc/tools/genfunctosyscallnrs.py
index ecfc8ab..6a456f2 100755
--- a/libc/tools/genfunctosyscallnrs.py
+++ b/libc/tools/genfunctosyscallnrs.py
@@ -8,7 +8,7 @@
 import subprocess
 import textwrap
 
-from gensyscalls import SupportedArchitectures, SysCallsTxtParser
+from gensyscalls import SysCallsTxtParser
 from genseccomp import parse_syscall_NRs
 
 def load_syscall_names_from_file(file_path, architecture):
@@ -22,7 +22,7 @@
   return arch_map
 
 def gen_syscall_nrs(out_file, base_syscall_file, syscall_NRs):
-  for arch in SupportedArchitectures:
+  for arch in ('arm', 'arm64', 'mips', 'mips64', 'x86', 'x86_64'):
     base_names = load_syscall_names_from_file(base_syscall_file, arch)
 
     for func,syscall in base_names.iteritems():
diff --git a/libc/tools/genseccomp.py b/libc/tools/genseccomp.py
index cc0ff99..365e198 100755
--- a/libc/tools/genseccomp.py
+++ b/libc/tools/genseccomp.py
@@ -8,7 +8,7 @@
 import subprocess
 import textwrap
 
-from gensyscalls import SupportedArchitectures, SysCallsTxtParser
+from gensyscalls import SysCallsTxtParser
 
 
 BPF_JGE = "BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, {0}, {1}, {2})"
@@ -181,7 +181,7 @@
 
 
 def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files, syscall_NRs):
-  for arch in SupportedArchitectures:
+  for arch in ('arm', 'arm64', 'mips', 'mips64', 'x86', 'x86_64'):
     base_names = load_syscall_names_from_file(base_syscall_file, arch)
     whitelist_names = set()
     blacklist_names = set()
@@ -215,7 +215,7 @@
   parser.add_argument("--verbose", "-v", help="Enables verbose logging.")
   parser.add_argument("--name-modifier",
                       help=("Specifies the name modifier for the policy. "
-                            "One of {app,system}."))
+                            "One of {app,global,system}."))
   parser.add_argument("--out-dir",
                       help="The output directory for the policy files")
   parser.add_argument("base_file", metavar="base-file", type=str,
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 60fb698..9a3b95e 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -8,6 +8,8 @@
 import commands
 import filecmp
 import glob
+import logging
+import os.path
 import re
 import shutil
 import stat
@@ -16,10 +18,41 @@
 import tempfile
 
 
-SupportedArchitectures = [ "arm", "arm64", "mips", "mips64", "x86", "x86_64" ]
+all_arches = [ "arm", "arm64", "mips", "mips64", "x86", "x86_64" ]
 
-syscall_stub_header = \
+
+# temp directory where we store all intermediate files
+bionic_temp = tempfile.mkdtemp(prefix="bionic_gensyscalls");
+# Make sure the directory is deleted when the script exits.
+atexit.register(shutil.rmtree, bionic_temp)
+
+bionic_libc_root = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+                                "..")
+
+warning = "Generated by gensyscalls.py. Do not edit."
+
+DRY_RUN = False
+
+def make_dir(path):
+    path = os.path.abspath(path)
+    if not os.path.exists(path):
+        parent = os.path.dirname(path)
+        if parent:
+            make_dir(parent)
+        os.mkdir(path)
+
+
+def create_file(relpath):
+    full_path = os.path.join(bionic_temp, relpath)
+    dir = os.path.dirname(full_path)
+    make_dir(dir)
+    return open(full_path, "w")
+
+
+syscall_stub_header = "/* " + warning + " */\n" + \
 """
+#include <private/bionic_asm.h>
+
 ENTRY(%(func)s)
 """
 
@@ -64,7 +97,7 @@
 
 
 #
-# Arm64 assembler template for each syscall stub
+# Arm64 assembler templates for each syscall stub
 #
 
 arm64_call = syscall_stub_header + """\
@@ -81,7 +114,7 @@
 
 
 #
-# MIPS assembler template for each syscall stub
+# MIPS assembler templates for each syscall stub
 #
 
 mips_call = syscall_stub_header + """\
@@ -103,7 +136,7 @@
 
 
 #
-# MIPS64 assembler template for each syscall stub
+# MIPS64 assembler templates for each syscall stub
 #
 
 mips64_call = syscall_stub_header + """\
@@ -166,7 +199,7 @@
 
 
 #
-# x86_64 assembler template for each syscall stub
+# x86_64 assembler templates for each syscall stub
 #
 
 x86_64_call = """\
@@ -262,7 +295,8 @@
         stub += "\nALIAS_SYMBOL(%s, %s)\n" % (alias, syscall["func"])
 
     # Use hidden visibility on LP64 for any functions beginning with underscores.
-    if pointer_length == 64 and syscall["func"].startswith("__"):
+    # Force hidden visibility for any functions which begin with 3 underscores
+    if (pointer_length == 64 and syscall["func"].startswith("__")) or syscall["func"].startswith("___"):
         stub += '.hidden ' + syscall["func"] + '\n'
 
     return stub
@@ -453,19 +487,19 @@
         # Parse the architecture list.
         arch_list = line[pos_rparen+1:].strip()
         if arch_list == "all":
-            for arch in SupportedArchitectures:
+            for arch in all_arches:
                 t[arch] = True
         elif arch_list == "lp32":
-            for arch in SupportedArchitectures:
+            for arch in all_arches:
                 if "64" not in arch:
                     t[arch] = True
         elif arch_list == "lp64":
-            for arch in SupportedArchitectures:
+            for arch in all_arches:
                 if "64" in arch:
                     t[arch] = True
         else:
             for arch in string.split(arch_list, ','):
-                if arch in SupportedArchitectures:
+                if arch in all_arches:
                     t[arch] = True
                 else:
                     E("invalid syscall architecture '%s' in '%s'" % (arch, line))
@@ -473,6 +507,8 @@
 
         self.syscalls.append(t)
 
+        logging.debug(t)
+
     def parse_open_file(self, fp):
         for line in fp:
             self.lineno += 1
@@ -482,53 +518,182 @@
             self.parse_line(line)
 
     def parse_file(self, file_path):
+        logging.debug("parse_file: %s" % file_path)
         with open(file_path) as fp:
             self.parse_open_file(fp)
 
 
-def main(arch, syscall_file):
-    parser = SysCallsTxtParser()
-    parser.parse_file(syscall_file)
+class State:
+    def __init__(self):
+        self.old_stubs = []
+        self.new_stubs = []
+        self.other_files = []
+        self.syscalls = []
 
-    for syscall in parser.syscalls:
-        syscall["__NR_name"] = make__NR_name(syscall["name"])
 
-        if syscall.has_key("arm"):
-            syscall["asm-arm"] = add_footer(32, arm_eabi_genstub(syscall), syscall)
+    def process_file(self, input):
+        parser = SysCallsTxtParser()
+        parser.parse_file(input)
+        self.syscalls = parser.syscalls
+        parser = None
 
-        if syscall.has_key("arm64"):
-            syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
+        for syscall in self.syscalls:
+            syscall["__NR_name"] = make__NR_name(syscall["name"])
 
-        if syscall.has_key("x86"):
-            if syscall["socketcall_id"] >= 0:
-                syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
-            else:
-                syscall["asm-x86"] = add_footer(32, x86_genstub(syscall), syscall)
-        elif syscall["socketcall_id"] >= 0:
-            E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
-            return
+            if syscall.has_key("arm"):
+                syscall["asm-arm"] = add_footer(32, arm_eabi_genstub(syscall), syscall)
 
-        if syscall.has_key("mips"):
-            syscall["asm-mips"] = add_footer(32, mips_genstub(syscall), syscall)
+            if syscall.has_key("arm64"):
+                syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
 
-        if syscall.has_key("mips64"):
-            syscall["asm-mips64"] = add_footer(64, mips64_genstub(syscall), syscall)
+            if syscall.has_key("x86"):
+                if syscall["socketcall_id"] >= 0:
+                    syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
+                else:
+                    syscall["asm-x86"] = add_footer(32, x86_genstub(syscall), syscall)
+            elif syscall["socketcall_id"] >= 0:
+                E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
+                return
 
-        if syscall.has_key("x86_64"):
-            syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
+            if syscall.has_key("mips"):
+                syscall["asm-mips"] = add_footer(32, mips_genstub(syscall), syscall)
 
-    print("/* Generated by gensyscalls.py. Do not edit. */\n")
-    print("#include <private/bionic_asm.h>\n")
-    for syscall in parser.syscalls:
-        if syscall.has_key("asm-%s" % arch):
-            print(syscall["asm-%s" % arch])
+            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)
+
+
+    # Scan Linux kernel asm/unistd.h files containing __NR_* constants
+    # and write out equivalent SYS_* constants for glibc source compatibility.
+    def gen_glibc_syscalls_h(self):
+        glibc_syscalls_h_path = "include/bits/glibc-syscalls.h"
+        logging.info("generating " + glibc_syscalls_h_path)
+        glibc_fp = create_file(glibc_syscalls_h_path)
+        glibc_fp.write("/* %s */\n" % warning)
+        glibc_fp.write("#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
+        glibc_fp.write("#define _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
+
+        # Collect the set of all syscalls for all architectures.
+        syscalls = set()
+        pattern = re.compile(r'^\s*#\s*define\s*__NR_([a-z_]\S+)')
+        for unistd_h in ["kernel/uapi/asm-generic/unistd.h",
+                         "kernel/uapi/asm-arm/asm/unistd.h",
+                         "kernel/uapi/asm-arm/asm/unistd-common.h",
+                         "kernel/uapi/asm-arm/asm/unistd-eabi.h",
+                         "kernel/uapi/asm-arm/asm/unistd-oabi.h",
+                         "kernel/uapi/asm-mips/asm/unistd.h",
+                         "kernel/uapi/asm-mips/asm/unistd_n32.h",
+                         "kernel/uapi/asm-mips/asm/unistd_n64.h",
+                         "kernel/uapi/asm-mips/asm/unistd_nr_n32.h",
+                         "kernel/uapi/asm-mips/asm/unistd_nr_n64.h",
+                         "kernel/uapi/asm-mips/asm/unistd_nr_o32.h",
+                         "kernel/uapi/asm-mips/asm/unistd_o32.h",
+                         "kernel/uapi/asm-x86/asm/unistd_32.h",
+                         "kernel/uapi/asm-x86/asm/unistd_64.h",
+                         "kernel/uapi/asm-x86/asm/unistd_x32.h"]:
+          for line in open(os.path.join(bionic_libc_root, unistd_h)):
+            m = re.search(pattern, line)
+            if m:
+              nr_name = m.group(1)
+              if 'reserved' not in nr_name and 'unused' not in nr_name:
+                syscalls.add(nr_name)
+
+        # Write out a single file listing them all. Note that the input
+        # files include #if trickery, so even for a single architecture
+        # we don't know exactly which ones are available.
+        # https://code.google.com/p/android/issues/detail?id=215853
+        for syscall in sorted(syscalls):
+          nr_name = make__NR_name(syscall)
+          glibc_fp.write("#if defined(%s)\n" % nr_name)
+          glibc_fp.write("  #define SYS_%s %s\n" % (syscall, nr_name))
+          glibc_fp.write("#endif\n")
+
+        glibc_fp.write("#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */\n")
+        glibc_fp.close()
+        self.other_files.append(glibc_syscalls_h_path)
+
+
+    # Write each syscall stub.
+    def gen_syscall_stubs(self):
+        for syscall in self.syscalls:
+            for arch in all_arches:
+                if syscall.has_key("asm-%s" % arch):
+                    filename = "arch-%s/syscalls/%s.S" % (arch, syscall["func"])
+                    logging.info(">>> generating " + filename)
+                    fp = create_file(filename)
+                    fp.write(syscall["asm-%s" % arch])
+                    fp.close()
+                    self.new_stubs.append(filename)
+
+
+    def regenerate(self):
+        logging.info("scanning for existing architecture-specific stub files...")
+
+        for arch in all_arches:
+            arch_dir = "arch-" + arch
+            logging.info("scanning " + os.path.join(bionic_libc_root, arch_dir))
+            rel_path = os.path.join(arch_dir, "syscalls")
+            for file in os.listdir(os.path.join(bionic_libc_root, rel_path)):
+                if file.endswith(".S"):
+                  self.old_stubs.append(os.path.join(rel_path, file))
+
+        logging.info("found %d stub files" % len(self.old_stubs))
+
+        if not os.path.exists(bionic_temp):
+            logging.info("creating %s..." % bionic_temp)
+            make_dir(bionic_temp)
+
+        logging.info("re-generating stubs and support files...")
+
+        self.gen_glibc_syscalls_h()
+        self.gen_syscall_stubs()
+
+        logging.info("comparing files...")
+        adds    = []
+        edits   = []
+
+        for stub in self.new_stubs + self.other_files:
+            tmp_file = os.path.join(bionic_temp, stub)
+            libc_file = os.path.join(bionic_libc_root, stub)
+            if not os.path.exists(libc_file):
+                # new file, git add it
+                logging.info("new file:     " + stub)
+                adds.append(libc_file)
+                shutil.copyfile(tmp_file, libc_file)
+
+            elif not filecmp.cmp(tmp_file, libc_file):
+                logging.info("changed file: " + stub)
+                edits.append(stub)
+
+        deletes = []
+        for stub in self.old_stubs:
+            if not stub in self.new_stubs:
+                logging.info("deleted file: " + stub)
+                deletes.append(os.path.join(bionic_libc_root, stub))
+
+        if not DRY_RUN:
+            if adds:
+                commands.getoutput("git add " + " ".join(adds))
+            if deletes:
+                commands.getoutput("git rm " + " ".join(deletes))
+            if edits:
+                for file in edits:
+                    shutil.copyfile(os.path.join(bionic_temp, file),
+                                    os.path.join(bionic_libc_root, file))
+                commands.getoutput("git add " + " ".join((os.path.join(bionic_libc_root, file)) for file in edits))
+
+            commands.getoutput("git add %s" % (os.path.join(bionic_libc_root, "SYSCALLS.TXT")))
+
+        if (not adds) and (not deletes) and (not edits):
+            logging.info("no changes detected!")
+        else:
+            logging.info("ready to go!!")
+
+logging.basicConfig(level=logging.INFO)
 
 if __name__ == "__main__":
-    if len(sys.argv) < 2:
-      print "Usage: gensyscalls.py ARCH SOURCE_FILE"
-      sys.exit(1)
-
-    arch = sys.argv[1]
-    syscall_file = sys.argv[2]
-    main(arch, syscall_file)
+    state = State()
+    state.process_file(os.path.join(bionic_libc_root, "SYSCALLS.TXT"))
+    state.regenerate()
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index 6d84303..1742d79 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -199,36 +199,37 @@
 int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
   int fd;
 
-  // Try the three locations for the tzdata file in a strict order:
-  // 1: The O-MR1 time zone updates via APK update mechanism. This is
-  //    tried first because it allows us to test that the time zone updates
-  //    via APK mechanism still works even on devices with the time zone
-  //    module.
-  // 2: The time zone data module which contains the main copy. This is the
-  //    common case.
-  // 3: The ultimate fallback: the non-updatable copy in /system.
-
 #if defined(__ANDROID__)
-  // On Android devices, bionic has to work even if exec takes place without
-  // environment variables set. So, all paths are hardcoded here.
-
+  // On Android devices, try the four hard-coded locations in order.
+  //
+  // 1: The O-MR1 time zone updates via APK update mechanism. This is
+  // tried first because it allows us to test that the time zone updates
+  // via APK mechanism still works even on devices with the time zone
+  // module.
   fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
 
+  // 2: The time zone data module which may contain newer data on
+  // devices that support module updates.
   fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
 
+  // 3: The runtime module, which should exist even on devices that
+  // do not support APEX file updates.
+  fd = __bionic_open_tzdata_path("/apex/com.android.runtime/etc/tz/tzdata",
+                                 olson_id, entry_length);
+  if (fd >= 0) return fd;
+
+  // 4: The ultimate fallback: the non-updatable copy in /system.
   fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
 #else
-  // On the host, we don't expect the hard-coded locations above to exist, and
-  // we're not worried about security so we trust $ANDROID_DATA,
-  // $ANDROID_TZDATA_ROOT, and $ANDROID_ROOT to point us in the right direction
-  // instead.
-
+  // On the host, we don't expect those locations to exist, and we're not
+  // worried about security so we trust $ANDROID_DATA, $ANDROID_RUNTIME_ROOT,
+  // $ANDROID_TZDATA_ROOT, and $ANDROID_ROOT to point us in the right direction.
   char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
   fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
   free(path);
@@ -239,6 +240,11 @@
   free(path);
   if (fd >= 0) return fd;
 
+  path = make_path("ANDROID_RUNTIME_ROOT", "/etc/tz/tzdata");
+  fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
+  free(path);
+  if (fd >= 0) return fd;
+
   path = make_path("ANDROID_ROOT", "/usr/share/zoneinfo/tzdata");
   fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
   free(path);
diff --git a/libc/upstream-freebsd/android/include/freebsd-compat.h b/libc/upstream-freebsd/android/include/freebsd-compat.h
index b16a688..6f7a3f0 100644
--- a/libc/upstream-freebsd/android/include/freebsd-compat.h
+++ b/libc/upstream-freebsd/android/include/freebsd-compat.h
@@ -14,13 +14,37 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_FREEBSD_COMPAT_H_included
+#define _BIONIC_FREEBSD_COMPAT_H_included
 
 #define _BSD_SOURCE
 
+#include <sys/cdefs.h>
+#include <stddef.h> // For size_t.
+
 #define REPLACE_GETOPT
 
+/*
+ * FreeBSD's libc has three symbols for every symbol:
+ *
+ *     __f will be the actual implementation.
+ *     _f will be a weak reference to __f (used for calls to f from within the library).
+ *     f will be a weak reference to __f (used for calls to f from outside the library).
+ *
+ * We collapse this into just the one symbol, f.
+ */
+
+/* Prevent weak reference generation. */
+#define __weak_reference(sym,alias)
+
+/* Ensure that the implementation itself gets the underscore-free name. */
+#define __sleep sleep
+#define __usleep usleep
+
+/* Redirect internal C library calls to the public function. */
+#define _nanosleep nanosleep
+
 /* FreeBSD has this, but we can't really implement it correctly on Linux. */
 #define issetugid() 0
 
-#define __compiler_membar() __asm __volatile(" " : : : "memory")
+#endif
diff --git a/libc/upstream-freebsd/android/include/machine/atomic.h b/libc/upstream-freebsd/android/include/machine/atomic.h
deleted file mode 100644
index e69de29..0000000
--- a/libc/upstream-freebsd/android/include/machine/atomic.h
+++ /dev/null
diff --git a/libc/upstream-freebsd/android/include/namespace.h b/libc/upstream-freebsd/android/include/namespace.h
index e69de29..a3f850e 100644
--- a/libc/upstream-freebsd/android/include/namespace.h
+++ b/libc/upstream-freebsd/android/include/namespace.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BIONIC_FREEBSD_NAMESPACE_H_included
+#define _BIONIC_FREEBSD_NAMESPACE_H_included
+
+#endif
diff --git a/libc/upstream-freebsd/android/include/un-namespace.h b/libc/upstream-freebsd/android/include/un-namespace.h
index e69de29..a3f850e 100644
--- a/libc/upstream-freebsd/android/include/un-namespace.h
+++ b/libc/upstream-freebsd/android/include/un-namespace.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BIONIC_FREEBSD_NAMESPACE_H_included
+#define _BIONIC_FREEBSD_NAMESPACE_H_included
+
+#endif
diff --git a/libc/upstream-freebsd/lib/libc/gen/sleep.c b/libc/upstream-freebsd/lib/libc/gen/sleep.c
new file mode 100644
index 0000000..b807c2d
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/gen/sleep.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)sleep.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <errno.h>
+#include <limits.h>
+#include <time.h>
+#include <unistd.h>
+#include "un-namespace.h"
+
+unsigned int
+__sleep(unsigned int seconds)
+{
+	struct timespec time_to_sleep;
+	struct timespec time_remaining;
+
+	/*
+	 * Avoid overflow when `seconds' is huge.  This assumes that
+	 * the maximum value for a time_t is >= INT_MAX.
+	 */
+	if (seconds > INT_MAX)
+		return (seconds - INT_MAX + __sleep(INT_MAX));
+
+	time_to_sleep.tv_sec = seconds;
+	time_to_sleep.tv_nsec = 0;
+	if (_nanosleep(&time_to_sleep, &time_remaining) != -1)
+		return (0);
+	if (errno != EINTR)
+		return (seconds);		/* best guess */
+	return (time_remaining.tv_sec +
+		(time_remaining.tv_nsec != 0)); /* round up */
+}
+
+__weak_reference(__sleep, sleep);
+__weak_reference(__sleep, _sleep);
diff --git a/libc/upstream-freebsd/lib/libc/gen/usleep.c b/libc/upstream-freebsd/lib/libc/gen/usleep.c
new file mode 100644
index 0000000..7d6559b
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/gen/usleep.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)usleep.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <time.h>
+#include <unistd.h>
+#include "un-namespace.h"
+
+int
+__usleep(useconds_t useconds)
+{
+	struct timespec time_to_sleep;
+
+	time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
+	time_to_sleep.tv_sec = useconds / 1000000;
+	return (_nanosleep(&time_to_sleep, NULL));
+}
+
+__weak_reference(__usleep, usleep);
+__weak_reference(__usleep, _usleep);
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
index 6a3067c..9534a2a 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
@@ -55,7 +55,7 @@
 #endif /* LIBC_SCCS and not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/stdlib/getopt_long.c 342757 2019-01-04 03:13:24Z kevans $");
+__FBSDID("$FreeBSD$");
 
 #include <err.h>
 #include <errno.h>
@@ -481,8 +481,6 @@
 #endif
 		if (*place == '-') {
 			place++;		/* --foo long option */
-			if (*place == '\0')
-				return (BADARG);	/* malformed option */
 #ifdef GNU_COMPATIBLE
 			dash_prefix = DD_PREFIX;
 #endif
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c b/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
index b175d34..d512857 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2015 Nuxi, https://nuxi.nl/
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/stdlib/hcreate.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD: head/lib/libc/stdlib/hcreate.c 292767 2015-12-27 07:50:11Z ed $");
 
 #include <search.h>
 #include <stdbool.h>
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/qsort.c b/libc/upstream-freebsd/lib/libc/stdlib/qsort.c
index e0db4f3..1ccc518 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/qsort.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/qsort.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -33,7 +31,7 @@
 static char sccsid[] = "@(#)qsort.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/stdlib/qsort.c 334928 2018-06-10 17:54:44Z kib $");
+__FBSDID("$FreeBSD$");
 
 #include <stdlib.h>
 
@@ -43,27 +41,53 @@
 typedef int		 cmp_t(const void *, const void *);
 #endif
 static inline char	*med3(char *, char *, char *, cmp_t *, void *);
+static inline void	 swapfunc(char *, char *, size_t, int, int);
 
 #define	MIN(a, b)	((a) < (b) ? a : b)
 
 /*
  * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
  */
-
-static inline void
-swapfunc(char *a, char *b, size_t es)
-{
-	char t;
-
-	do {
-		t = *a;
-		*a++ = *b;
-		*b++ = t;
-	} while (--es > 0);
+#define	swapcode(TYPE, parmi, parmj, n) {		\
+	size_t i = (n) / sizeof (TYPE);			\
+	TYPE *pi = (TYPE *) (parmi);		\
+	TYPE *pj = (TYPE *) (parmj);		\
+	do { 						\
+		TYPE	t = *pi;		\
+		*pi++ = *pj;				\
+		*pj++ = t;				\
+	} while (--i > 0);				\
 }
 
+#define	SWAPINIT(TYPE, a, es) swaptype_ ## TYPE =	\
+	((char *)a - (char *)0) % sizeof(TYPE) ||	\
+	es % sizeof(TYPE) ? 2 : es == sizeof(TYPE) ? 0 : 1;
+
+static inline void
+swapfunc(char *a, char *b, size_t n, int swaptype_long, int swaptype_int)
+{
+	if (swaptype_long <= 1)
+		swapcode(long, a, b, n)
+	else if (swaptype_int <= 1)
+		swapcode(int, a, b, n)
+	else
+		swapcode(char, a, b, n)
+}
+
+#define	swap(a, b)					\
+	if (swaptype_long == 0) {			\
+		long t = *(long *)(a);			\
+		*(long *)(a) = *(long *)(b);		\
+		*(long *)(b) = t;			\
+	} else if (swaptype_int == 0) {			\
+		int t = *(int *)(a);			\
+		*(int *)(a) = *(int *)(b);		\
+		*(int *)(b) = t;			\
+	} else						\
+		swapfunc(a, b, es, swaptype_long, swaptype_int)
+
 #define	vecswap(a, b, n)				\
-	if ((n) > 0) swapfunc(a, b, n)
+	if ((n) > 0) swapfunc(a, b, n, swaptype_long, swaptype_int)
 
 #ifdef I_AM_QSORT_R
 #define	CMP(t, x, y) (cmp((t), (x), (y)))
@@ -95,16 +119,17 @@
 	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
 	size_t d1, d2;
 	int cmp_result;
-	int swap_cnt;
+	int swaptype_long, swaptype_int, swap_cnt;
 
-loop:
+loop:	SWAPINIT(long, a, es);
+	SWAPINIT(int, a, es);
 	swap_cnt = 0;
 	if (n < 7) {
 		for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
 			for (pl = pm; 
 			     pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
 			     pl -= es)
-				swapfunc(pl, pl - es, es);
+				swap(pl, pl - es);
 		return;
 	}
 	pm = (char *)a + (n / 2) * es;
@@ -120,7 +145,7 @@
 		}
 		pm = med3(pl, pm, pn, cmp, thunk);
 	}
-	swapfunc(a, pm, es);
+	swap(a, pm);
 	pa = pb = (char *)a + es;
 
 	pc = pd = (char *)a + (n - 1) * es;
@@ -128,7 +153,7 @@
 		while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
 			if (cmp_result == 0) {
 				swap_cnt = 1;
-				swapfunc(pa, pb, es);
+				swap(pa, pb);
 				pa += es;
 			}
 			pb += es;
@@ -136,14 +161,14 @@
 		while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
 			if (cmp_result == 0) {
 				swap_cnt = 1;
-				swapfunc(pc, pd, es);
+				swap(pc, pd);
 				pd -= es;
 			}
 			pc -= es;
 		}
 		if (pb > pc)
 			break;
-		swapfunc(pb, pc, es);
+		swap(pb, pc);
 		swap_cnt = 1;
 		pb += es;
 		pc -= es;
@@ -153,7 +178,7 @@
 			for (pl = pm; 
 			     pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
 			     pl -= es)
-				swapfunc(pl, pl - es, es);
+				swap(pl, pl - es);
 		return;
 	}
 
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c b/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
index 9e4e79d..ef8cdb1 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2011 David Chisnall
  * All rights reserved.
  *
@@ -25,11 +23,9 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/lib/libc/stdlib/quick_exit.c 326193 2017-11-25 17:12:48Z pfg $
+ * $FreeBSD$
  */
 
-#include <sys/types.h>
-#include <machine/atomic.h>
 #include <stdlib.h>
 #include <pthread.h>
 
@@ -64,7 +60,6 @@
 	h->cleanup = func;
 	pthread_mutex_lock(&atexit_mutex);
 	h->next = handlers;
-	__compiler_membar();
 	handlers = h;
 	pthread_mutex_unlock(&atexit_mutex);
 	return (0);
@@ -79,9 +74,7 @@
 	 * XXX: The C++ spec requires us to call std::terminate if there is an
 	 * exception here.
 	 */
-	for (h = handlers; NULL != h; h = h->next) {
-		__compiler_membar();
+	for (h = handlers; NULL != h; h = h->next)
 		h->cleanup();
-	}
 	_Exit(status);
 }
diff --git a/libc/upstream-freebsd/lib/libc/string/wcpcpy.c b/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
index e040dba..df63d72 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
@@ -1,6 +1,4 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
+/*
  * Copyright (c) 1999
  *	David E. O'Brien
  * Copyright (c) 1988, 1993
@@ -35,7 +33,7 @@
 static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcpcpy.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcpncpy.c b/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
index 8bf6e87..87b361c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcpncpy.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c b/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
index 5bd468d..0143543 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcscasecmp.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 #include <wctype.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscat.c b/libc/upstream-freebsd/lib/libc/string/wcscat.c
index 792f61e..7ae4e80 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscat.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcscat.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcschr.c b/libc/upstream-freebsd/lib/libc/string/wcschr.c
index ca740c0..1df1fe6 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcschr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcschr.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2002 Tim J. Robbins
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcschr.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscmp.c b/libc/upstream-freebsd/lib/libc/string/wcscmp.c
index db01892..c2abe4c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscmp.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -39,7 +37,7 @@
 __RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
-__FBSDID("$FreeBSD: head/lib/libc/string/wcscmp.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscpy.c b/libc/upstream-freebsd/lib/libc/string/wcscpy.c
index a639e74..0c6e1f2 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscpy.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcscpy.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscspn.c b/libc/upstream-freebsd/lib/libc/string/wcscspn.c
index 8a7682f..7729dc8 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscspn.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscspn.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcscspn.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsdup.c b/libc/upstream-freebsd/lib/libc/string/wcsdup.c
index b97f766..1e5db92 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsdup.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsdup.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2005 Tim J. Robbins.
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsdup.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <stdlib.h>
 #include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcslcat.c b/libc/upstream-freebsd/lib/libc/string/wcslcat.c
index 9706fa6..f5f1e1e 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcslcat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcslcat.c
@@ -1,6 +1,4 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
+/*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
  * All rights reserved.
  *
@@ -35,7 +33,7 @@
 __RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcslcat.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <wchar.h>
@@ -56,7 +54,7 @@
 	size_t dlen;
 
 	/* Find the end of dst and adjust bytes left but don't go past end */
-	while (n-- != 0 && *d != '\0')
+	while (*d != '\0' && n-- != 0)
 		d++;
 	dlen = d - dst;
 	n = siz - dlen;
diff --git a/libc/upstream-freebsd/lib/libc/string/wcslen.c b/libc/upstream-freebsd/lib/libc/string/wcslen.c
index c596825..ca3004e 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcslen.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcslen.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcslen.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c b/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
index a963444..a42d98c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsncasecmp.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 #include <wctype.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncat.c b/libc/upstream-freebsd/lib/libc/string/wcsncat.c
index 0214af4..44f1ff9 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncat.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsncat.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
@@ -50,7 +48,7 @@
 		p++;
 	q = p;
 	r = s2;
-	while (n && *r) {
+	while (*r && n) {
 		*q++ = *r++;
 		n--;
 	}
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncmp.c b/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
index 77b709c..8236d96 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
@@ -1,6 +1,4 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
+/*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -36,7 +34,7 @@
 __RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsncmp.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncpy.c b/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
index 4075ecc..215e9a1 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -38,7 +36,7 @@
 #endif /* LIBC_SCCS and not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsncpy.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsnlen.c b/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
index 271d341..f03cf76 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsnlen.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcspbrk.c b/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
index 63efb01..2ff71ba 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcspbrk.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsrchr.c b/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
index 97665ca..37c81ec 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2002 Tim J. Robbins
  * All rights reserved.
  *
@@ -27,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsrchr.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsspn.c b/libc/upstream-freebsd/lib/libc/string/wcsspn.c
index b08a39e..6569206 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsspn.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsspn.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsspn.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsstr.c b/libc/upstream-freebsd/lib/libc/string/wcsstr.c
index 4309025..ce598a6 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsstr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsstr.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -38,7 +36,7 @@
 #endif /* LIBC_SCCS and not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcsstr.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wcstok.c b/libc/upstream-freebsd/lib/libc/string/wcstok.c
index 8d62bf7..441fbd4 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcstok.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcstok.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 1998 Softweyr LLC.  All rights reserved.
  *
  * strtok_r, from Berkeley strtok
@@ -35,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/string/wcstok.c 326025 2017-11-20 19:49:47Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemchr.c b/libc/upstream-freebsd/lib/libc/string/wmemchr.c
index 412a276..cab89c9 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemchr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemchr.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wmemchr.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemcmp.c b/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
index c1e9f3c..fdb1f98 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wmemcmp.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemcpy.c b/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
index e0d6c04..c10770c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wmemcpy.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <string.h>
 #include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemmove.c b/libc/upstream-freebsd/lib/libc/string/wmemmove.c
index b84c2c0..05cfd10 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemmove.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemmove.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wmemmove.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <string.h>
 #include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemset.c b/libc/upstream-freebsd/lib/libc/string/wmemset.c
index d4d6308..0e96356 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemset.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemset.c
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
  *
@@ -34,7 +32,7 @@
 __RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 #endif
-__FBSDID("$FreeBSD: head/lib/libc/string/wmemset.c 326193 2017-11-25 17:12:48Z pfg $");
+__FBSDID("$FreeBSD$");
 
 #include <wchar.h>
 
diff --git a/libc/upstream-netbsd/android/include/env.h b/libc/upstream-netbsd/android/include/env.h
index e69de29..8f99f9d 100644
--- a/libc/upstream-netbsd/android/include/env.h
+++ b/libc/upstream-netbsd/android/include/env.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BIONIC_NETBSD_ENV_H_included
+#define _BIONIC_NETBSD_ENV_H_included
+
+/* Placeholder. */
+
+#endif
diff --git a/libc/upstream-netbsd/android/include/extern.h b/libc/upstream-netbsd/android/include/extern.h
index b8e6151..616becd 100644
--- a/libc/upstream-netbsd/android/include/extern.h
+++ b/libc/upstream-netbsd/android/include/extern.h
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_NETBSD_EXTERN_H_included
+#define _BIONIC_NETBSD_EXTERN_H_included
 
 #include <sys/cdefs.h>
 
@@ -23,3 +24,5 @@
 const char* __strsignal(int, char*, size_t);
 
 __END_DECLS
+
+#endif
diff --git a/libc/upstream-netbsd/android/include/namespace.h b/libc/upstream-netbsd/android/include/namespace.h
index ae7585c..630ea9b 100644
--- a/libc/upstream-netbsd/android/include/namespace.h
+++ b/libc/upstream-netbsd/android/include/namespace.h
@@ -14,7 +14,10 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_NETBSD_NAMESPACE_H_included
+#define _BIONIC_NETBSD_NAMESPACE_H_included
 
 __LIBC_HIDDEN__ int __res_enable_mt(void);
 __LIBC_HIDDEN__ int __res_disable_mt(void);
+
+#endif
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index ea630b2..af5ae29 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_NETBSD_COMPAT_H_included
+#define _BIONIC_NETBSD_COMPAT_H_included
 
 #define _BSD_SOURCE
 #define _GNU_SOURCE
@@ -46,3 +47,5 @@
 /* Use appropriate shell depending on process's executable. */
 __LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
 #define _PATH_BSHELL __bionic_get_shell_path()
+
+#endif
diff --git a/libc/upstream-netbsd/android/include/port_after.h b/libc/upstream-netbsd/android/include/port_after.h
index e69de29..3f8b6f8 100644
--- a/libc/upstream-netbsd/android/include/port_after.h
+++ b/libc/upstream-netbsd/android/include/port_after.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included
+#define _BIONIC_NETBSD_PORT_BEFORE_H_included
+
+#endif
diff --git a/libc/upstream-netbsd/android/include/port_before.h b/libc/upstream-netbsd/android/include/port_before.h
index 8266f81..9fa9487 100644
--- a/libc/upstream-netbsd/android/include/port_before.h
+++ b/libc/upstream-netbsd/android/include/port_before.h
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included
+#define _BIONIC_NETBSD_PORT_BEFORE_H_included
 
 #include "namespace.h"
 #include <sys/cdefs.h>
@@ -23,3 +24,5 @@
 
 #define ISC_FORMAT_PRINTF(a,b) __printflike(a,b)
 #define ISC_SOCKLEN_T socklen_t
+
+#endif
diff --git a/libc/upstream-openbsd/android/include/arith.h b/libc/upstream-openbsd/android/include/arith.h
index 554aa85..cb116d4 100644
--- a/libc/upstream-openbsd/android/include/arith.h
+++ b/libc/upstream-openbsd/android/include/arith.h
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-#pragma once
-
 #define IEEE_8087
 
 #if defined(__LP64__)
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index afd1077..c99e2ce 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -14,20 +14,34 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef _BIONIC_OPENBSD_COMPAT_H_included
+#define _BIONIC_OPENBSD_COMPAT_H_included
 
 #define _BSD_SOURCE
 #include <sys/cdefs.h>
 
 #include <stddef.h> // For size_t.
 
-#include <sys/random.h> // For getentropy.
+// TODO: libandroid_support uses this file, so we need to wait for
+// <sys/random.h> to be in the NDK headers before we can lose this declaration.
+//#include <sys/random.h> // For getentropy.
+int getentropy(void*, size_t);
 
 #define __BEGIN_HIDDEN_DECLS _Pragma("GCC visibility push(hidden)")
 #define __END_HIDDEN_DECLS _Pragma("GCC visibility pop")
 
 extern const char* __progname;
 
+/* Redirect internal C library calls to the public function. */
+#define _err err
+#define _errx errx
+#define _verr verr
+#define _verrx verrx
+#define _vwarn vwarn
+#define _vwarnx vwarnx
+#define _warn warn
+#define _warnx warnx
+
 /* Ignore all DEF_STRONG/DEF_WEAK in OpenBSD. */
 #define DEF_STRONG(sym)
 #define DEF_WEAK(sym)
@@ -66,5 +80,14 @@
 __LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
 #define _PATH_BSHELL __bionic_get_shell_path()
 
+/* LP32 NDK ctype.h contained references to these. */
+__LIBC32_LEGACY_PUBLIC__ extern const short* _tolower_tab_;
+__LIBC32_LEGACY_PUBLIC__ extern const short* _toupper_tab_;
+
+__LIBC_HIDDEN__ extern const char _C_ctype_[];
+__LIBC_HIDDEN__ extern const short _C_toupper_[];
+__LIBC_HIDDEN__ extern const short _C_tolower_[];
 __LIBC_HIDDEN__ extern char* __findenv(const char*, int, int*);
 __LIBC_HIDDEN__ extern char* _mktemp(char*);
+
+#endif
diff --git a/libc/upstream-openbsd/lib/libc/gen/isctype.c b/libc/upstream-openbsd/lib/libc/gen/isctype.c
new file mode 100644
index 0000000..a4e944c
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/gen/isctype.c
@@ -0,0 +1,163 @@
+/*	$OpenBSD: isctype.c,v 1.12 2015/09/13 11:38:08 guenther Exp $ */
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define _ANSI_LIBRARY
+#include <ctype.h>
+#include <stdio.h>
+
+#undef isalnum
+int
+isalnum(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
+}
+DEF_STRONG(isalnum);
+
+#undef isalpha
+int
+isalpha(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L)));
+}
+DEF_STRONG(isalpha);
+
+#undef isblank
+int
+isblank(int c)
+{
+	return (c == ' ' || c == '\t');
+}
+DEF_STRONG(isblank);
+
+#undef iscntrl
+int
+iscntrl(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C));
+}
+DEF_STRONG(iscntrl);
+
+#undef isdigit
+int
+isdigit(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N));
+}
+DEF_STRONG(isdigit);
+
+#undef isgraph
+int
+isgraph(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
+}
+DEF_STRONG(isgraph);
+
+#undef islower
+int
+islower(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L));
+}
+DEF_STRONG(islower);
+
+#undef isprint
+int
+isprint(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
+}
+DEF_STRONG(isprint);
+
+#undef ispunct
+int
+ispunct(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P));
+}
+DEF_STRONG(ispunct);
+
+#undef isspace
+int
+isspace(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S));
+}
+DEF_STRONG(isspace);
+
+#undef isupper
+int
+isupper(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U));
+}
+DEF_STRONG(isupper);
+
+#undef isxdigit
+int
+isxdigit(int c)
+{
+	return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
+}
+DEF_STRONG(isxdigit);
+
+#undef isascii
+int
+isascii(int c)
+{
+	return ((unsigned int)c <= 0177);
+}
+DEF_WEAK(isascii);
+
+#undef toascii
+int
+toascii(int c)
+{
+	return (c & 0177);
+}
+
+#undef _toupper
+int
+_toupper(int c)
+{
+	return (c - 'a' + 'A');
+}
+
+#undef _tolower
+int
+_tolower(int c)
+{
+	return (c - 'A' + 'a');
+}
diff --git a/libc/upstream-openbsd/lib/libc/gen/tolower_.c b/libc/upstream-openbsd/lib/libc/gen/tolower_.c
new file mode 100644
index 0000000..2402c42
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/gen/tolower_.c
@@ -0,0 +1,61 @@
+/*	$OpenBSD: tolower_.c,v 1.11 2015/09/19 04:02:21 guenther Exp $ */
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#define _ANSI_LIBRARY
+#include <ctype.h>
+#include <stdio.h>
+#include "ctype_private.h"
+
+const short _C_tolower_[1 + CTYPE_NUM_CHARS] = {
+	EOF,
+	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
+	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
+	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
+	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
+	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
+	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
+	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
+	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
+	0x40,	'a',	'b',	'c',	'd',	'e',	'f',	'g',
+	'h',	'i',	'j',	'k',	'l',	'm',	'n',	'o',
+	'p',	'q',	'r',	's',	't',	'u',	'v',	'w',
+	'x',	'y',	'z',	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
+	0x60,	0x61,	0x62,	0x63,	0x64,	0x65,	0x66,	0x67,
+	0x68,	0x69,	0x6a,	0x6b,	0x6c,	0x6d,	0x6e,	0x6f,
+	0x70,	0x71,	0x72,	0x73,	0x74,	0x75,	0x76,	0x77,
+	0x78,	0x79,	0x7a,	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
+	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
+	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
+	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
+	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
+	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
+	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
+	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
+	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
+	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
+	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
+	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
+	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
+	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
+	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
+	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
+	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
+};
+
+const short *_tolower_tab_ = _C_tolower_;
+#if 0
+DEF_STRONG(_tolower_tab_);
+#endif
+
+#undef tolower
+int
+tolower(int c)
+{
+	if ((unsigned int)c > 255)
+		return(c);
+	return((_tolower_tab_ + 1)[c]);
+}
+DEF_STRONG(tolower);
diff --git a/libc/upstream-openbsd/lib/libc/gen/toupper_.c b/libc/upstream-openbsd/lib/libc/gen/toupper_.c
new file mode 100644
index 0000000..8408f9e
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/gen/toupper_.c
@@ -0,0 +1,62 @@
+/*	$OpenBSD: toupper_.c,v 1.12 2015/09/19 04:02:21 guenther Exp $ */
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#define _ANSI_LIBRARY
+#include <ctype.h>
+#include <stdio.h>
+
+#include "ctype_private.h"
+
+const short _C_toupper_[1 + CTYPE_NUM_CHARS] = {
+	EOF,
+	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
+	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
+	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
+	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
+	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
+	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
+	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
+	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
+	0x40,	0x41,	0x42,	0x43,	0x44,	0x45,	0x46,	0x47,
+	0x48,	0x49,	0x4a,	0x4b,	0x4c,	0x4d,	0x4e,	0x4f,
+	0x50,	0x51,	0x52,	0x53,	0x54,	0x55,	0x56,	0x57,
+	0x58,	0x59,	0x5a,	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
+	0x60,	'A',	'B',	'C',	'D',	'E',	'F',	'G',
+	'H',	'I',	'J',	'K',	'L',	'M',	'N',	'O',
+	'P',	'Q',	'R',	'S',	'T',	'U',	'V',	'W',
+	'X',	'Y',	'Z',	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
+	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
+	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
+	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
+	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
+	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
+	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
+	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
+	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
+	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
+	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
+	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
+	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
+	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
+	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
+	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
+	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
+};
+
+const short *_toupper_tab_ = _C_toupper_;
+#if 0
+DEF_STRONG(_toupper_tab_);
+#endif
+
+#undef toupper
+int
+toupper(int c)
+{
+	if ((unsigned int)c > 255)
+		return(c);
+	return((_toupper_tab_ + 1)[c]);
+}
+DEF_STRONG(toupper);
diff --git a/libc/upstream-openbsd/lib/libc/string/strlen.c b/libc/upstream-openbsd/lib/libc/string/strlen.c
deleted file mode 100644
index a5721d3..0000000
--- a/libc/upstream-openbsd/lib/libc/string/strlen.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*	$OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $	*/
-
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <string.h>
-
-size_t
-strlen(const char *str)
-{
-	const char *s;
-
-	for (s = str; *s; ++s)
-		;
-	return (s - str);
-}
-
-DEF_STRONG(strlen);
diff --git a/libc/versioner-dependencies/common/clang-builtins b/libc/versioner-dependencies/common/clang-builtins
index 148dd2b..7bd481c 120000
--- a/libc/versioner-dependencies/common/clang-builtins
+++ b/libc/versioner-dependencies/common/clang-builtins
@@ -1 +1 @@
-../../../../prebuilts/clang-tools/linux-x86/clang-headers
\ No newline at end of file
+../../../../external/clang/lib/Headers/
\ No newline at end of file
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 15263e9..fbbe7ba 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -5,7 +5,6 @@
     name: "libdl_static",
     defaults: ["linux_bionic_supported"],
     recovery_available: true,
-    native_bridge_supported: true,
 
     srcs: [
         "libdl.cpp",
@@ -33,7 +32,6 @@
 cc_library {
     name: "libdl",
     recovery_available: true,
-    native_bridge_supported: true,
     static_ndk_lib: true,
 
     defaults: ["linux_bionic_supported"],
@@ -111,11 +109,6 @@
         symbol_file: "libdl.map.txt",
         versions: ["10000"],
     },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
 }
 
 cc_library {
@@ -123,7 +116,6 @@
 
     defaults: ["linux_bionic_supported"],
     recovery_available: true,
-    native_bridge_supported: true,
 
     // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
     // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
@@ -189,14 +181,12 @@
 
 ndk_library {
     name: "libdl",
-    native_bridge_supported: true,
     symbol_file: "libdl.map.txt",
     first_version: "9",
 }
 
 llndk_library {
     name: "libdl",
-    native_bridge_supported: true,
     symbol_file: "libdl.map.txt",
 }
 
diff --git a/libdl/MODULE_LICENSE_APACHE2 b/libdl/MODULE_LICENSE_BSD
similarity index 100%
rename from libdl/MODULE_LICENSE_APACHE2
rename to libdl/MODULE_LICENSE_BSD
diff --git a/libdl/NOTICE b/libdl/NOTICE
deleted file mode 100644
index d645695..0000000
--- a/libdl/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/libdl/libdl_android.cpp b/libdl/libdl_android.cpp
index 77b3bf8..9ad8250 100644
--- a/libdl/libdl_android.cpp
+++ b/libdl/libdl_android.cpp
@@ -28,7 +28,7 @@
 void __loader_android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size);
 
 __attribute__((__weak__, visibility("default")))
-void __loader_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
+    void __loader_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
 
 __attribute__((__weak__, visibility("default")))
 void __loader_android_set_application_target_sdk_version(int target);
diff --git a/libdl/libdl_cfi.cpp b/libdl/libdl_cfi.cpp
index 3b68fc7..1dd5b21 100644
--- a/libdl/libdl_cfi.cpp
+++ b/libdl/libdl_cfi.cpp
@@ -44,8 +44,7 @@
 }
 
 static uint16_t shadow_load(void* p) {
-  // Untag the pointer to move it into the address space covered by the shadow.
-  uintptr_t addr = reinterpret_cast<uintptr_t>(untag_address(p));
+  uintptr_t addr = reinterpret_cast<uintptr_t>(p);
   uintptr_t ofs = CFIShadow::MemToShadowOffset(addr);
   if (ofs > CFIShadow::kShadowSize) return CFIShadow::kInvalidShadow;
   return *reinterpret_cast<uint16_t*>(shadow_base_storage.v + ofs);
diff --git a/libdl/libdl_static.cpp b/libdl/libdl_static.cpp
index 3bbf963..7146762 100644
--- a/libdl/libdl_static.cpp
+++ b/libdl/libdl_static.cpp
@@ -23,7 +23,7 @@
 }
 
 char* dlerror() {
-  return const_cast<char*>("libdl.a is a stub --- use libdl.so instead");
+  return nullptr;
 }
 
 void* dlsym(void* /*handle*/, const char* /*symbol*/) {
@@ -41,3 +41,9 @@
 int dlclose(void* /*handle*/) {
   return -1;
 }
+
+#if defined(__arm__)
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr /*pc*/, int* /*pcount*/) {
+  return 0;
+}
+#endif
diff --git a/libm/Android.bp b/libm/Android.bp
index bf05b17..8c32810 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -324,16 +324,8 @@
         x86: {
             srcs: [
                 "i387/fenv.c",
-                "x86/ceil.S",
-                "x86/ceilf.S",
-                "x86/floor.S",
-                "x86/floorf.S",
-                "x86/rint.S",
-                "x86/rintf.S",
                 "x86/sqrt.S",
                 "x86/sqrtf.S",
-                "x86/trunc.S",
-                "x86/truncf.S",
                 "x86/e_acos.S",
                 "x86/e_asin.S",
                 "x86/e_atan2.S",
@@ -367,23 +359,37 @@
                 "upstream-freebsd/lib/msun/src/e_sqrtf.c",
                 "upstream-freebsd/lib/msun/src/s_atan.c",
                 "upstream-freebsd/lib/msun/src/s_cbrt.c",
-                "upstream-freebsd/lib/msun/src/s_ceil.c",
-                "upstream-freebsd/lib/msun/src/s_ceilf.c",
                 "upstream-freebsd/lib/msun/src/s_cos.c",
                 "upstream-freebsd/lib/msun/src/s_expm1.c",
-                "upstream-freebsd/lib/msun/src/s_floor.c",
-                "upstream-freebsd/lib/msun/src/s_floorf.c",
                 "upstream-freebsd/lib/msun/src/s_log1p.c",
                 "upstream-freebsd/lib/msun/src/s_lrint.c",
                 "upstream-freebsd/lib/msun/src/s_lrintf.c",
-                "upstream-freebsd/lib/msun/src/s_rint.c",
-                "upstream-freebsd/lib/msun/src/s_rintf.c",
                 "upstream-freebsd/lib/msun/src/s_sin.c",
                 "upstream-freebsd/lib/msun/src/s_tan.c",
                 "upstream-freebsd/lib/msun/src/s_tanh.c",
-                "upstream-freebsd/lib/msun/src/s_trunc.c",
-                "upstream-freebsd/lib/msun/src/s_truncf.c",
             ],
+            sse4_1: {
+                srcs: [
+                    "x86/ceil.S",
+                    "x86/ceilf.S",
+                    "x86/floor.S",
+                    "x86/floorf.S",
+                    "x86/rint.S",
+                    "x86/rintf.S",
+                    "x86/trunc.S",
+                    "x86/truncf.S",
+                ],
+                exclude_srcs: [
+                    "upstream-freebsd/lib/msun/src/s_ceil.c",
+                    "upstream-freebsd/lib/msun/src/s_ceilf.c",
+                    "upstream-freebsd/lib/msun/src/s_floor.c",
+                    "upstream-freebsd/lib/msun/src/s_floorf.c",
+                    "upstream-freebsd/lib/msun/src/s_rint.c",
+                    "upstream-freebsd/lib/msun/src/s_rintf.c",
+                    "upstream-freebsd/lib/msun/src/s_trunc.c",
+                    "upstream-freebsd/lib/msun/src/s_truncf.c",
+                ],
+            },
             local_include_dirs: ["i387"],
             pack_relocations: false,
             ldflags: ["-Wl,--hash-style=both"],
@@ -393,16 +399,8 @@
         x86_64: {
             srcs: [
                 "amd64/fenv.c",
-                "x86_64/ceil.S",
-                "x86_64/ceilf.S",
-                "x86_64/floor.S",
-                "x86_64/floorf.S",
-                "x86_64/rint.S",
-                "x86_64/rintf.S",
                 "x86_64/sqrt.S",
                 "x86_64/sqrtf.S",
-                "x86_64/trunc.S",
-                "x86_64/truncf.S",
                 "x86_64/e_acos.S",
                 "x86_64/e_asin.S",
                 "x86_64/e_atan2.S",
@@ -433,25 +431,39 @@
                 "upstream-freebsd/lib/msun/src/e_sqrtf.c",
                 "upstream-freebsd/lib/msun/src/s_atan.c",
                 "upstream-freebsd/lib/msun/src/s_cbrt.c",
-                "upstream-freebsd/lib/msun/src/s_ceil.c",
-                "upstream-freebsd/lib/msun/src/s_ceilf.c",
                 "upstream-freebsd/lib/msun/src/s_cos.c",
                 "upstream-freebsd/lib/msun/src/s_expm1.c",
-                "upstream-freebsd/lib/msun/src/s_floor.c",
-                "upstream-freebsd/lib/msun/src/s_floorf.c",
                 "upstream-freebsd/lib/msun/src/s_log1p.c",
                 "upstream-freebsd/lib/msun/src/s_llrint.c",
                 "upstream-freebsd/lib/msun/src/s_llrintf.c",
                 "upstream-freebsd/lib/msun/src/s_lrint.c",
                 "upstream-freebsd/lib/msun/src/s_lrintf.c",
-                "upstream-freebsd/lib/msun/src/s_rint.c",
-                "upstream-freebsd/lib/msun/src/s_rintf.c",
                 "upstream-freebsd/lib/msun/src/s_sin.c",
                 "upstream-freebsd/lib/msun/src/s_tan.c",
                 "upstream-freebsd/lib/msun/src/s_tanh.c",
-                "upstream-freebsd/lib/msun/src/s_trunc.c",
-                "upstream-freebsd/lib/msun/src/s_truncf.c",
             ],
+            sse4_1: {
+                srcs: [
+                    "x86_64/ceil.S",
+                    "x86_64/ceilf.S",
+                    "x86_64/floor.S",
+                    "x86_64/floorf.S",
+                    "x86_64/rint.S",
+                    "x86_64/rintf.S",
+                    "x86_64/trunc.S",
+                    "x86_64/truncf.S",
+                ],
+                exclude_srcs: [
+                    "upstream-freebsd/lib/msun/src/s_ceil.c",
+                    "upstream-freebsd/lib/msun/src/s_ceilf.c",
+                    "upstream-freebsd/lib/msun/src/s_floor.c",
+                    "upstream-freebsd/lib/msun/src/s_floorf.c",
+                    "upstream-freebsd/lib/msun/src/s_rint.c",
+                    "upstream-freebsd/lib/msun/src/s_rintf.c",
+                    "upstream-freebsd/lib/msun/src/s_trunc.c",
+                    "upstream-freebsd/lib/msun/src/s_truncf.c",
+                ],
+            },
             version_script: ":libm.x86_64.map",
         },
     },
@@ -463,6 +475,7 @@
 
     cflags: [
         "-D__BIONIC_LP32_USE_LONG_DOUBLE",
+        "-D__BIONIC_NO_MATH_INLINES",
         "-D_BSD_SOURCE",
         "-DFLT_EVAL_METHOD=0",
         "-include freebsd-compat.h",
@@ -490,33 +503,25 @@
     native_coverage: bionic_coverage,
     sanitize: {
         address: false,
-        fuzzer: false,
+        coverage: false,
         integer_overflow: false,
     },
     stl: "none",
-    native_bridge_supported: true,
 
     stubs: {
         symbol_file: "libm.map.txt",
         versions: ["10000"],
     },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
 }
 
 ndk_library {
     name: "libm",
-    native_bridge_supported: true,
     symbol_file: "libm.map.txt",
     first_version: "9",
 }
 
 llndk_library {
     name: "libm",
-    native_bridge_supported: true,
     symbol_file: "libm.map.txt",
 }
 
diff --git a/libm/fake_long_double.c b/libm/fake_long_double.c
index 26edfeb..ef031cc 100644
--- a/libm/fake_long_double.c
+++ b/libm/fake_long_double.c
@@ -37,10 +37,20 @@
 long lroundl(long double a1) { return lround(a1); }
 long double modfl(long double a1, long double* a2) { double i; double f = modf(a1, &i); *a2 = i; return f; }
 float nexttowardf(float a1, long double a2) { return nextafterf(a1, (float) a2); }
+long double powl(long double x, long double y) { return pow(x, y); }
 long double roundl(long double a1) { return round(a1); }
 void sincosl(long double x, long double* s, long double* c) { sincos(x, (double*) s, (double*) c); }
 
 #endif // __LP64__
 
-// FreeBSD doesn't have an ld128 implementation of tgammal, so both LP32 and LP64 need this.
+// FreeBSD doesn't have an ld128 implementations of tgammal, so both LP32 and LP64 need this.
 long double tgammal(long double x) { return tgamma(x); }
+
+// external/arm-optimized-routines does not provide the long double
+// wrappers for the routines it implements.
+#if (LDBL_MANT_DIG == 53)
+long double expl(long double x) { return exp(x); }
+long double exp2l(long double x) { return exp2(x); }
+long double logl(long double x) { return log(x); }
+long double log2l(long double x) { return log2(x); }
+#endif
diff --git a/libm/upstream-freebsd/lib/msun/src/e_exp.c b/libm/upstream-freebsd/lib/msun/src/e_exp.c
index dd88d3e..94c9769 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_exp.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_exp.c
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_exp.c 352710 2019-09-25 18:50:57Z dim $");
+__FBSDID("$FreeBSD$");
 
 /* __ieee754_exp(x)
  * Returns the exponential of x.
@@ -145,9 +145,9 @@
     /* x is now in primary range */
 	t  = x*x;
 	if(k >= -1021)
-	    INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0);
+	    INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0);
 	else
-	    INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0);
+	    INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0);
 	c  = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
 	if(k==0) 	return one-((x*c)/(c-2.0)-x); 
 	else 		y = one-((lo-(x*c)/(2.0-c))-hi);
diff --git a/libm/upstream-freebsd/lib/msun/src/e_expf.c b/libm/upstream-freebsd/lib/msun/src/e_expf.c
index aaf6d5f..b1fe2c5 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_expf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_expf.c
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_expf.c 352710 2019-09-25 18:50:57Z dim $");
+__FBSDID("$FreeBSD$");
 
 #include <float.h>
 
@@ -83,9 +83,9 @@
     /* x is now in primary range */
 	t  = x*x;
 	if(k >= -125)
-	    SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23);
+	    SET_FLOAT_WORD(twopk,0x3f800000+(k<<23));
 	else
-	    SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23);
+	    SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23));
 	c  = x - t*(P1+t*P2);
 	if(k==0) 	return one-((x*c)/(c-(float)2.0)-x);
 	else 		y = one-((lo-(x*c)/((float)2.0-c))-hi);
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0.c b/libm/upstream-freebsd/lib/msun/src/e_j0.c
index a008b42..6bca542 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0.c
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j0.c 343953 2019-02-10 08:46:07Z peterj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0.c 343023 2019-01-14 15:48:35Z pfg $");
 
 /* __ieee754_j0(x), __ieee754_y0(x)
  * Bessel function of the first and second kinds of order zero.
@@ -93,7 +93,8 @@
 	if(ix>=0x7ff00000) return one/(x*x);
 	x = fabs(x);
 	if(ix >= 0x40000000) {	/* |x| >= 2.0 */
-		sincos(x, &s, &c);
+		s = sin(x);
+		c = cos(x);
 		ss = s-c;
 		cc = s+c;
 		if(ix<0x7fe00000) {  /* Make sure x+x does not overflow. */
@@ -172,7 +173,8 @@
          *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
          * to compute the worse one.
          */
-                sincos(x, &s, &c);
+                s = sin(x);
+                c = cos(x);
                 ss = s-c;
                 cc = s+c;
 	/*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0f.c b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
index 495a5e5..714caac 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343953 2019-02-10 08:46:07Z peterj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343023 2019-01-14 15:48:35Z pfg $");
 
 /*
  * See e_j0.c for complete comments.
@@ -55,7 +55,8 @@
 	if(ix>=0x7f800000) return one/(x*x);
 	x = fabsf(x);
 	if(ix >= 0x40000000) {	/* |x| >= 2.0 */
-		sincosf(x, &s, &c);
+		s = sinf(x);
+		c = cosf(x);
 		ss = s-c;
 		cc = s+c;
 		if(ix<0x7f000000) {  /* Make sure x+x does not overflow. */
@@ -127,7 +128,8 @@
          *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
          * to compute the worse one.
          */
-                sincosf(x, &s, &c);
+                s = sinf(x);
+                c = cosf(x);
                 ss = s-c;
                 cc = s+c;
 	/*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1.c b/libm/upstream-freebsd/lib/msun/src/e_j1.c
index 6d1c41c..78bb329 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1.c
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j1.c 343953 2019-02-10 08:46:07Z peterj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1.c 336089 2018-07-08 16:26:13Z markj $");
 
 /* __ieee754_j1(x), __ieee754_y1(x)
  * Bessel function of the first and second kinds of order zero.
@@ -94,7 +94,8 @@
 	if(ix>=0x7ff00000) return one/x;
 	y = fabs(x);
 	if(ix >= 0x40000000) {	/* |x| >= 2.0 */
-		sincos(y, &s, &c);
+		s = sin(y);
+		c = cos(y);
 		ss = -s-c;
 		cc = s-c;
 		if(ix<0x7fe00000) {  /* make sure y+y not overflow */
@@ -158,7 +159,8 @@
 	/* y1(x<0) = NaN and raise invalid exception. */
         if(hx<0) return vzero/vzero;
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-                sincos(x, &s, &c);
+                s = sin(x);
+                c = cos(x);
                 ss = -s-c;
                 cc = s-c;
                 if(ix<0x7fe00000) {  /* make sure x+x not overflow */
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1f.c b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
index 31fc28a..3abe201 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j1f.c 343953 2019-02-10 08:46:07Z peterj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1f.c 336089 2018-07-08 16:26:13Z markj $");
 
 /*
  * See e_j1.c for complete comments.
@@ -56,7 +56,8 @@
 	if(ix>=0x7f800000) return one/x;
 	y = fabsf(x);
 	if(ix >= 0x40000000) {	/* |x| >= 2.0 */
-		sincosf(y, &s, &c);
+		s = sinf(y);
+		c = cosf(y);
 		ss = -s-c;
 		cc = s-c;
 		if(ix<0x7f000000) {  /* make sure y+y not overflow */
@@ -113,7 +114,8 @@
 	if(ix==0) return -one/vzero;
 	if(hx<0) return vzero/vzero;
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-                sincosf(x, &s, &c);
+                s = sinf(x);
+                c = cosf(x);
                 ss = -s-c;
                 cc = s-c;
                 if(ix<0x7f000000) {  /* make sure x+x not overflow */
diff --git a/libm/upstream-freebsd/lib/msun/src/e_jn.c b/libm/upstream-freebsd/lib/msun/src/e_jn.c
index c039cf2..58ec905 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_jn.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_jn.c
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_jn.c 343953 2019-02-10 08:46:07Z peterj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_jn.c 336089 2018-07-08 16:26:13Z markj $");
 
 /*
  * __ieee754_jn(n, x), __ieee754_yn(n, x)
@@ -54,7 +54,7 @@
 __ieee754_jn(int n, double x)
 {
 	int32_t i,hx,ix,lx, sgn;
-	double a, b, c, s, temp, di;
+	double a, b, temp, di;
 	double z, w;
 
     /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
@@ -91,12 +91,11 @@
      *		   2	-s+c		-c-s
      *		   3	 s+c		 c-s
      */
-		sincos(x, &s, &c);
 		switch(n&3) {
-		    case 0: temp =  c+s; break;
-		    case 1: temp = -c+s; break;
-		    case 2: temp = -c-s; break;
-		    case 3: temp =  c-s; break;
+		    case 0: temp =  cos(x)+sin(x); break;
+		    case 1: temp = -cos(x)+sin(x); break;
+		    case 2: temp = -cos(x)-sin(x); break;
+		    case 3: temp =  cos(x)-sin(x); break;
 		}
 		b = invsqrtpi*temp/sqrt(x);
 	    } else {
@@ -217,7 +216,7 @@
 {
 	int32_t i,hx,ix,lx;
 	int32_t sign;
-	double a, b, c, s, temp;
+	double a, b, temp;
 
 	EXTRACT_WORDS(hx,lx,x);
 	ix = 0x7fffffff&hx;
@@ -249,12 +248,11 @@
      *		   2	-s+c		-c-s
      *		   3	 s+c		 c-s
      */
-		sincos(x, &s, &c);
 		switch(n&3) {
-		    case 0: temp =  s-c; break;
-		    case 1: temp = -s-c; break;
-		    case 2: temp = -s+c; break;
-		    case 3: temp =  s+c; break;
+		    case 0: temp =  sin(x)-cos(x); break;
+		    case 1: temp = -sin(x)-cos(x); break;
+		    case 2: temp = -sin(x)+cos(x); break;
+		    case 3: temp =  sin(x)+cos(x); break;
 		}
 		b = invsqrtpi*temp/sqrt(x);
 	} else {
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1.c b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
index 21256ce..37998a3 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1.c 352710 2019-09-25 18:50:57Z dim $");
+__FBSDID("$FreeBSD$");
 
 /* expm1(x)
  * Returns exp(x)-1, the exponential of x minus 1.
@@ -188,7 +188,7 @@
 	e  = hxs*((r1-t)/(6.0 - x*t));
 	if(k==0) return x - (x*e-hxs);		/* c is 0 */
 	else {
-	    INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0);	/* 2^k */
+	    INSERT_WORDS(twopk,0x3ff00000+(k<<20),0);	/* 2^k */
 	    e  = (x*(e-c)-c);
 	    e -= hxs;
 	    if(k== -1) return 0.5*(x-e)-0.5;
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
index 4d9ab36..c0a3934 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1f.c 352710 2019-09-25 18:50:57Z dim $");
+__FBSDID("$FreeBSD$");
 
 #include <float.h>
 
@@ -94,7 +94,7 @@
 	e  = hxs*((r1-t)/((float)6.0 - x*t));
 	if(k==0) return x - (x*e-hxs);		/* c is 0 */
 	else {
-	    SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23);	/* 2^k */
+	    SET_FLOAT_WORD(twopk,0x3f800000+(k<<23));	/* 2^k */
 	    e  = (x*(e-c)-c);
 	    e -= hxs;
 	    if(k== -1) return (float)0.5*(x-e)-(float)0.5;
diff --git a/libm/upstream-freebsd/lib/msun/src/s_lround.c b/libm/upstream-freebsd/lib/msun/src/s_lround.c
index ce2aee7..b6a25b7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_lround.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_lround.c
@@ -32,7 +32,7 @@
 #include <math.h>
 
 #ifndef type
-__FBSDID("$FreeBSD: head/lib/msun/src/s_lround.c 353329 2019-10-08 21:39:51Z brooks $");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_lround.c 326219 2017-11-26 02:00:33Z pfg $");
 #define type		double
 #define	roundit		round
 #define dtype		long
@@ -49,9 +49,9 @@
  * that everything is in range.  At compile time, INRANGE(x) should reduce to
  * two floating-point comparisons in the former case, or TRUE otherwise.
  */
-static const type dtype_min = (type)DTYPE_MIN - 0.5;
-static const type dtype_max = (type)DTYPE_MAX + 0.5;
-#define	INRANGE(x)	(dtype_max - (type)DTYPE_MAX != 0.5 || \
+static const type dtype_min = DTYPE_MIN - 0.5;
+static const type dtype_max = DTYPE_MAX + 0.5;
+#define	INRANGE(x)	(dtype_max - DTYPE_MAX != 0.5 || \
 			 ((x) > dtype_min && (x) < dtype_max))
 
 dtype
diff --git a/libm/x86/e_exp.S b/libm/x86/e_exp.S
new file mode 100644
index 0000000..eab619d
--- /dev/null
+++ b/libm/x86/e_exp.S
@@ -0,0 +1,576 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+// Description:
+//  Let K = 64 (table size).
+//        x    x/log(2)     n
+//       e  = 2          = 2 * T[j] * (1 + P(y))
+//  where
+//       x = m*log(2)/K + y,    y in [-log(2)/K..log(2)/K]
+//       m = n*K + j,           m,n,j - signed integer, j in [-K/2..K/2]
+//                  j/K
+//       values of 2   are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
+//
+//       P(y) is a minimax polynomial approximation of exp(x)-1
+//       on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
+//
+//  To avoid problems with arithmetic overflow and underflow,
+//            n                        n1  n2
+//  value of 2  is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
+//  where BIAS is a value of exponent bias.
+//
+// Special cases:
+//  exp(NaN) = NaN
+//  exp(+INF) = +INF
+//  exp(-INF) = 0
+//  exp(x) = 1 for subnormals
+//  for finite argument, only exp(0)=1 is exact
+//  For IEEE double
+//    if x >  709.782712893383973096 then exp(x) overflow
+//    if x < -745.133219101941108420 then exp(x) underflow
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  static_func
+        .text
+        .align __bionic_asm_align
+        .type static_func, @function
+static_func:
+..B1.1:
+        call      ..L2
+..L2:
+        popl      %eax
+        lea       _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
+        lea       static_const_table@GOTOFF(%eax), %eax
+        ret
+        .size   static_func,.-static_func
+# -- End  static_func
+
+# -- Begin  exp
+ENTRY(exp)
+# parameter 1: 8 + %ebp
+..B2.1:
+..B2.2:
+        pushl     %ebp
+        movl      %esp, %ebp
+        subl      $120, %esp
+        movl      %ebx, 64(%esp)
+        call      static_func
+        movl      %eax, %ebx
+        movsd     128(%esp), %xmm0
+        unpcklpd  %xmm0, %xmm0
+        movapd    64(%ebx), %xmm1
+        movapd    48(%ebx), %xmm6
+        movapd    80(%ebx), %xmm2
+        movapd    96(%ebx), %xmm3
+        pextrw    $3, %xmm0, %eax
+        andl      $32767, %eax
+        movl      $16527, %edx
+        subl      %eax, %edx
+        subl      $15504, %eax
+        orl       %eax, %edx
+        cmpl      $-2147483648, %edx
+        jae       .L_2TAG_PACKET_0.0.2
+        mulpd     %xmm0, %xmm1
+        addpd     %xmm6, %xmm1
+        movapd    %xmm1, %xmm7
+        subpd     %xmm6, %xmm1
+        mulpd     %xmm1, %xmm2
+        movapd    128(%ebx), %xmm4
+        mulpd     %xmm1, %xmm3
+        movapd    144(%ebx), %xmm5
+        subpd     %xmm2, %xmm0
+        movd      %xmm7, %eax
+        movl      %eax, %ecx
+        andl      $63, %ecx
+        shll      $4, %ecx
+        sarl      $6, %eax
+        movl      %eax, %edx
+        movdqa    16(%ebx), %xmm6
+        pand      %xmm6, %xmm7
+        movdqa    32(%ebx), %xmm6
+        paddq     %xmm6, %xmm7
+        psllq     $46, %xmm7
+        subpd     %xmm3, %xmm0
+        movapd    160(%ebx,%ecx), %xmm2
+        mulpd     %xmm0, %xmm4
+        movapd    %xmm0, %xmm6
+        movapd    %xmm0, %xmm1
+        mulpd     %xmm6, %xmm6
+        mulpd     %xmm6, %xmm0
+        addpd     %xmm4, %xmm5
+        mulsd     %xmm6, %xmm0
+        mulpd     112(%ebx), %xmm6
+        addsd     %xmm2, %xmm1
+        unpckhpd  %xmm2, %xmm2
+        mulpd     %xmm5, %xmm0
+        addsd     %xmm0, %xmm1
+        orpd      %xmm7, %xmm2
+        unpckhpd  %xmm0, %xmm0
+        addsd     %xmm1, %xmm0
+        addsd     %xmm6, %xmm0
+        addl      $894, %edx
+        cmpl      $1916, %edx
+        ja        .L_2TAG_PACKET_1.0.2
+        mulsd     %xmm2, %xmm0
+        addsd     %xmm2, %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_1.0.2:
+        fstcw     24(%esp)
+        movzwl    24(%esp), %edx
+        orl       $768, %edx
+        movw      %dx, 28(%esp)
+        fldcw     28(%esp)
+        movl      %eax, %edx
+        sarl      $1, %eax
+        subl      %eax, %edx
+        movdqa    (%ebx), %xmm6
+        pandn     %xmm2, %xmm6
+        addl      $1023, %eax
+        movd      %eax, %xmm3
+        psllq     $52, %xmm3
+        orpd      %xmm3, %xmm6
+        addl      $1023, %edx
+        movd      %edx, %xmm4
+        psllq     $52, %xmm4
+        movsd     %xmm0, 8(%esp)
+        fldl      8(%esp)
+        movsd     %xmm6, 16(%esp)
+        fldl      16(%esp)
+        fmul      %st, %st(1)
+        faddp     %st, %st(1)
+        movsd     %xmm4, 8(%esp)
+        fldl      8(%esp)
+        fmulp     %st, %st(1)
+        fstpl     8(%esp)
+        movsd     8(%esp), %xmm0
+        fldcw     24(%esp)
+        pextrw    $3, %xmm0, %ecx
+        andl      $32752, %ecx
+        cmpl      $32752, %ecx
+        jae       .L_2TAG_PACKET_3.0.2
+        cmpl      $0, %ecx
+        je        .L_2TAG_PACKET_4.0.2
+        jmp       .L_2TAG_PACKET_2.0.2
+        cmpl      $-2147483648, %ecx
+        jb        .L_2TAG_PACKET_3.0.2
+        cmpl      $-1064950997, %ecx
+        jb        .L_2TAG_PACKET_2.0.2
+        ja        .L_2TAG_PACKET_4.0.2
+        movl      128(%esp), %edx
+        cmpl      $-17155601, %edx
+        jb        .L_2TAG_PACKET_2.0.2
+        jmp       .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_3.0.2:
+        movl      $14, %edx
+        jmp       .L_2TAG_PACKET_5.0.2
+.L_2TAG_PACKET_4.0.2:
+        movl      $15, %edx
+.L_2TAG_PACKET_5.0.2:
+        movsd     %xmm0, (%esp)
+        movsd     128(%esp), %xmm0
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_7.0.2:
+        cmpl      $2146435072, %eax
+        jae       .L_2TAG_PACKET_8.0.2
+        movl      132(%esp), %eax
+        cmpl      $-2147483648, %eax
+        jae       .L_2TAG_PACKET_9.0.2
+        movsd     1208(%ebx), %xmm0
+        mulsd     %xmm0, %xmm0
+        movl      $14, %edx
+        jmp       .L_2TAG_PACKET_5.0.2
+.L_2TAG_PACKET_9.0.2:
+        movsd     1216(%ebx), %xmm0
+        mulsd     %xmm0, %xmm0
+        movl      $15, %edx
+        jmp       .L_2TAG_PACKET_5.0.2
+.L_2TAG_PACKET_8.0.2:
+        movl      128(%esp), %edx
+        cmpl      $2146435072, %eax
+        ja        .L_2TAG_PACKET_10.0.2
+        cmpl      $0, %edx
+        jne       .L_2TAG_PACKET_10.0.2
+        movl      132(%esp), %eax
+        cmpl      $2146435072, %eax
+        jne       .L_2TAG_PACKET_11.0.2
+        movsd     1192(%ebx), %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_11.0.2:
+        movsd     1200(%ebx), %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_10.0.2:
+        movsd     128(%esp), %xmm0
+        addsd     %xmm0, %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_0.0.2:
+        movl      132(%esp), %eax
+        andl      $2147483647, %eax
+        cmpl      $1083179008, %eax
+        jae       .L_2TAG_PACKET_7.0.2
+        movsd     128(%esp), %xmm0
+        addsd     1184(%ebx), %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_2.0.2:
+        movsd     %xmm0, 48(%esp)
+        fldl      48(%esp)
+.L_2TAG_PACKET_6.0.2:
+        movl      64(%esp), %ebx
+        movl      %ebp, %esp
+        popl      %ebp
+        ret       
+..B2.3:
+END(exp)
+# -- End  exp
+
+# Start file scope ASM
+ALIAS_SYMBOL(expl, exp);
+# End file scope ASM
+	.section .rodata, "a"
+	.align 16
+	.align 16
+static_const_table:
+	.long	0
+	.long	4293918720
+	.long	0
+	.long	4293918720
+	.long	4294967232
+	.long	0
+	.long	4294967232
+	.long	0
+	.long	65472
+	.long	0
+	.long	65472
+	.long	0
+	.long	0
+	.long	1127743488
+	.long	0
+	.long	1127743488
+	.long	1697350398
+	.long	1079448903
+	.long	1697350398
+	.long	1079448903
+	.long	4277796864
+	.long	1065758274
+	.long	4277796864
+	.long	1065758274
+	.long	3164486458
+	.long	1025308570
+	.long	3164486458
+	.long	1025308570
+	.long	4294967294
+	.long	1071644671
+	.long	4294967294
+	.long	1071644671
+	.long	3811088480
+	.long	1062650204
+	.long	1432067621
+	.long	1067799893
+	.long	3230715663
+	.long	1065423125
+	.long	1431604129
+	.long	1069897045
+	.long	0
+	.long	0
+	.long	0
+	.long	0
+	.long	235107661
+	.long	1018002367
+	.long	1048019040
+	.long	11418
+	.long	896005651
+	.long	1015861842
+	.long	3541402996
+	.long	22960
+	.long	1642514529
+	.long	1012987726
+	.long	410360776
+	.long	34629
+	.long	1568897900
+	.long	1016568486
+	.long	1828292879
+	.long	46424
+	.long	1882168529
+	.long	1010744893
+	.long	852742562
+	.long	58348
+	.long	509852888
+	.long	1017336174
+	.long	3490863952
+	.long	70401
+	.long	653277307
+	.long	1017431380
+	.long	2930322911
+	.long	82586
+	.long	1649557430
+	.long	1017729363
+	.long	1014845818
+	.long	94904
+	.long	1058231231
+	.long	1015777676
+	.long	3949972341
+	.long	107355
+	.long	1044000607
+	.long	1016786167
+	.long	828946858
+	.long	119943
+	.long	1151779725
+	.long	1015705409
+	.long	2288159958
+	.long	132667
+	.long	3819481236
+	.long	1016499965
+	.long	1853186616
+	.long	145530
+	.long	2552227826
+	.long	1015039787
+	.long	1709341917
+	.long	158533
+	.long	1829350193
+	.long	1015216097
+	.long	4112506593
+	.long	171677
+	.long	1913391795
+	.long	1015756674
+	.long	2799960843
+	.long	184965
+	.long	1303423926
+	.long	1015238005
+	.long	171030293
+	.long	198398
+	.long	1574172746
+	.long	1016061241
+	.long	2992903935
+	.long	211976
+	.long	3424156969
+	.long	1017196428
+	.long	926591434
+	.long	225703
+	.long	1938513547
+	.long	1017631273
+	.long	887463926
+	.long	239579
+	.long	2804567149
+	.long	1015390024
+	.long	1276261410
+	.long	253606
+	.long	631083525
+	.long	1017690182
+	.long	569847337
+	.long	267786
+	.long	1623370770
+	.long	1011049453
+	.long	1617004845
+	.long	282120
+	.long	3667985273
+	.long	1013894369
+	.long	3049340112
+	.long	296610
+	.long	3145379760
+	.long	1014403278
+	.long	3577096743
+	.long	311258
+	.long	2603100681
+	.long	1017152460
+	.long	1990012070
+	.long	326066
+	.long	3249202951
+	.long	1017448880
+	.long	1453150081
+	.long	341035
+	.long	419288974
+	.long	1016280325
+	.long	917841882
+	.long	356167
+	.long	3793507337
+	.long	1016095713
+	.long	3712504873
+	.long	371463
+	.long	728023093
+	.long	1016345318
+	.long	363667784
+	.long	386927
+	.long	2582678538
+	.long	1017123460
+	.long	2956612996
+	.long	402558
+	.long	7592966
+	.long	1016721543
+	.long	2186617380
+	.long	418360
+	.long	228611441
+	.long	1016696141
+	.long	1719614412
+	.long	434334
+	.long	2261665670
+	.long	1017457593
+	.long	1013258798
+	.long	450482
+	.long	544148907
+	.long	1017323666
+	.long	3907805043
+	.long	466805
+	.long	2383914918
+	.long	1017143586
+	.long	1447192520
+	.long	483307
+	.long	1176412038
+	.long	1017267372
+	.long	1944781190
+	.long	499988
+	.long	2882956373
+	.long	1013312481
+	.long	919555682
+	.long	516851
+	.long	3154077648
+	.long	1016528543
+	.long	2571947538
+	.long	533897
+	.long	348651999
+	.long	1016405780
+	.long	2604962540
+	.long	551129
+	.long	3253791412
+	.long	1015920431
+	.long	1110089947
+	.long	568549
+	.long	1509121860
+	.long	1014756995
+	.long	2568320822
+	.long	586158
+	.long	2617649212
+	.long	1017340090
+	.long	2966275556
+	.long	603959
+	.long	553214634
+	.long	1016457425
+	.long	2682146383
+	.long	621954
+	.long	730975783
+	.long	1014083580
+	.long	2191782032
+	.long	640145
+	.long	1486499517
+	.long	1016818996
+	.long	2069751140
+	.long	658534
+	.long	2595788928
+	.long	1016407932
+	.long	2990417244
+	.long	677123
+	.long	1853053619
+	.long	1015310724
+	.long	1434058175
+	.long	695915
+	.long	2462790535
+	.long	1015814775
+	.long	2572866477
+	.long	714911
+	.long	3693944214
+	.long	1017259110
+	.long	3092190714
+	.long	734114
+	.long	2979333550
+	.long	1017188654
+	.long	4076559942
+	.long	753526
+	.long	174054861
+	.long	1014300631
+	.long	2420883922
+	.long	773150
+	.long	816778419
+	.long	1014197934
+	.long	3716502172
+	.long	792987
+	.long	3507050924
+	.long	1015341199
+	.long	777507147
+	.long	813041
+	.long	1821514088
+	.long	1013410604
+	.long	3706687593
+	.long	833312
+	.long	920623539
+	.long	1016295433
+	.long	1242007931
+	.long	853805
+	.long	2789017511
+	.long	1014276997
+	.long	3707479175
+	.long	874520
+	.long	3586233004
+	.long	1015962192
+	.long	64696965
+	.long	895462
+	.long	474650514
+	.long	1016642419
+	.long	863738718
+	.long	916631
+	.long	1614448851
+	.long	1014281732
+	.long	3884662774
+	.long	938030
+	.long	2450082086
+	.long	1016164135
+	.long	2728693977
+	.long	959663
+	.long	1101668360
+	.long	1015989180
+	.long	3999357479
+	.long	981531
+	.long	835814894
+	.long	1015702697
+	.long	1533953344
+	.long	1003638
+	.long	1301400989
+	.long	1014466875
+	.long	2174652632
+	.long	1025985
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	2146435072
+	.long	0
+	.long	0
+	.long	4294967295
+	.long	2146435071
+	.long	0
+	.long	1048576
+	.type	static_const_table,@object
+	.size	static_const_table,1224
+	.data
+	.section .note.GNU-stack, ""
+# End
diff --git a/libm/x86/e_log.S b/libm/x86/e_log.S
new file mode 100644
index 0000000..a6181ca
--- /dev/null
+++ b/libm/x86/e_log.S
@@ -0,0 +1,780 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+//    x=2^k * mx, mx in [1,2)
+//
+//    Get B~1/mx based on the output of rcpss instruction (B0)
+//    B = int((B0*2^7+0.5))/2^7
+//
+//    Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
+//
+//    Result:  k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6)  and
+//             p(r) is a degree 7 polynomial
+//             -log(B) read from data table (high, low parts)
+//             Result is formed from high and low parts
+//
+// Special cases:
+//  log(NaN) = quiet NaN, and raise invalid exception
+//  log(+INF) = that INF
+//  log(0) = -INF with divide-by-zero exception raised
+//  log(1) = +0
+//  log(x) = NaN with invalid exception raised if x < -0, including -INF
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  static_func
+        .text
+        .align __bionic_asm_align
+        .type static_func, @function
+static_func:
+..B1.1:
+        call      ..L2
+..L2:
+        popl      %eax
+        lea       _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
+        lea       static_const_table@GOTOFF(%eax), %eax
+        ret
+        .size   static_func,.-static_func
+# -- End  static_func
+
+# -- Begin  log
+ENTRY(log)
+# parameter 1: 8 + %ebp
+..B2.1:
+..B2.2:
+        pushl     %ebp
+        movl      %esp, %ebp
+        subl      $104, %esp
+        movl      %ebx, 40(%esp)
+        call      static_func
+        movl      %eax, %ebx
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        xorpd     %xmm3, %xmm3
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm3
+        movsd     112(%esp), %xmm0
+        movapd    %xmm0, %xmm1
+        movl      $32768, %ecx
+        movd      %ecx, %xmm4
+        movsd     2128(%ebx), %xmm5
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        psllq     $5, %xmm0
+        movl      $16352, %ecx
+        psrlq     $34, %xmm0
+        rcpss     %xmm0, %xmm0
+        psllq     $12, %xmm1
+        pshufd    $228, %xmm5, %xmm6
+        psrlq     $12, %xmm1
+        subl      $16, %eax
+        cmpl      $32736, %eax
+        jae       .L_2TAG_PACKET_0.0.2
+.L_2TAG_PACKET_1.0.2:
+        paddd     %xmm4, %xmm0
+        orpd      %xmm3, %xmm1
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm1, %xmm5
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm1
+        mulpd     %xmm0, %xmm5
+        andl      $32752, %eax
+        subl      %ecx, %eax
+        cvtsi2sdl %eax, %xmm7
+        mulsd     %xmm0, %xmm1
+        movsd     2064(%ebx), %xmm6
+        movapd    2080(%ebx), %xmm3
+        subsd     %xmm2, %xmm5
+        andl      $16711680, %edx
+        shrl      $12, %edx
+        movapd    (%ebx,%edx), %xmm0
+        movapd    2096(%ebx), %xmm4
+        addsd     %xmm5, %xmm1
+        movapd    2112(%ebx), %xmm2
+        mulsd     %xmm7, %xmm6
+        pshufd    $68, %xmm1, %xmm5
+        mulsd     2072(%ebx), %xmm7
+        mulsd     %xmm1, %xmm3
+        addsd     %xmm6, %xmm0
+        mulpd     %xmm5, %xmm4
+        mulpd     %xmm5, %xmm5
+        pshufd    $228, %xmm0, %xmm6
+        addsd     %xmm1, %xmm0
+        addpd     %xmm2, %xmm4
+        mulpd     %xmm5, %xmm3
+        subsd     %xmm0, %xmm6
+        mulsd     %xmm1, %xmm4
+        pshufd    $238, %xmm0, %xmm2
+        addsd     %xmm6, %xmm1
+        mulsd     %xmm5, %xmm5
+        addsd     %xmm2, %xmm7
+        addpd     %xmm3, %xmm4
+        addsd     %xmm7, %xmm1
+        mulpd     %xmm5, %xmm4
+        addsd     %xmm4, %xmm1
+        pshufd    $238, %xmm4, %xmm5
+        addsd     %xmm5, %xmm1
+        addsd     %xmm1, %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_0.0.2:
+        movsd     112(%esp), %xmm0
+        movapd    %xmm0, %xmm1
+        addl      $16, %eax
+        cmpl      $32768, %eax
+        jae       .L_2TAG_PACKET_3.0.2
+        cmpl      $16, %eax
+        jb        .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_5.0.2:
+        addsd     %xmm0, %xmm0
+        jmp       .L_2TAG_PACKET_2.0.2
+.L_2TAG_PACKET_6.0.2:
+        ja        .L_2TAG_PACKET_5.0.2
+        cmpl      $0, %edx
+        ja        .L_2TAG_PACKET_5.0.2
+        jmp       .L_2TAG_PACKET_7.0.2
+.L_2TAG_PACKET_3.0.2:
+        movd      %xmm1, %edx
+        psrlq     $32, %xmm1
+        movd      %xmm1, %ecx
+        addl      %ecx, %ecx
+        cmpl      $-2097152, %ecx
+        jae       .L_2TAG_PACKET_6.0.2
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_8.0.2
+.L_2TAG_PACKET_7.0.2:
+        xorpd     %xmm1, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm1
+        movl      $3, %edx
+        mulsd     %xmm1, %xmm0
+.L_2TAG_PACKET_9.0.2:
+        movsd     %xmm0, (%esp)
+        movsd     112(%esp), %xmm0
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_10.0.2
+.L_2TAG_PACKET_8.0.2:
+        xorpd     %xmm1, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $49136, %eax
+        pinsrw    $3, %eax, %xmm0
+        divsd     %xmm1, %xmm0
+        movl      $2, %edx
+        jmp       .L_2TAG_PACKET_9.0.2
+.L_2TAG_PACKET_4.0.2:
+        movd      %xmm1, %edx
+        psrlq     $32, %xmm1
+        movd      %xmm1, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_8.0.2
+        xorpd     %xmm1, %xmm1
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm1
+        mulsd     %xmm1, %xmm0
+        movapd    %xmm0, %xmm1
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        psllq     $5, %xmm0
+        movl      $18416, %ecx
+        psrlq     $34, %xmm0
+        rcpss     %xmm0, %xmm0
+        psllq     $12, %xmm1
+        pshufd    $228, %xmm5, %xmm6
+        psrlq     $12, %xmm1
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_2.0.2:
+        movsd     %xmm0, 24(%esp)
+        fldl      24(%esp)
+.L_2TAG_PACKET_10.0.2:
+        movl      40(%esp), %ebx
+        movl      %ebp, %esp
+        popl      %ebp
+        ret       
+..B2.3:
+END(log)
+# -- End  log
+
+# Start file scope ASM
+ALIAS_SYMBOL(logl, log);
+# End file scope ASM
+	.section .rodata, "a"
+	.align 16
+	.align 16
+static_const_table:
+	.long	4277811200
+	.long	1072049730
+	.long	2479318832
+	.long	1026487127
+	.long	2854492160
+	.long	1072033410
+	.long	215631550
+	.long	1025638968
+	.long	1547061248
+	.long	1072017216
+	.long	2886781435
+	.long	1026423395
+	.long	649825280
+	.long	1072001146
+	.long	4281533405
+	.long	1024038923
+	.long	646346752
+	.long	1071985198
+	.long	1562735921
+	.long	1023790276
+	.long	2203734016
+	.long	1071969370
+	.long	1838397691
+	.long	3173936209
+	.long	1872169984
+	.long	1071953661
+	.long	3981202460
+	.long	1022325013
+	.long	669557760
+	.long	1071938069
+	.long	4182597802
+	.long	3173174122
+	.long	4076413952
+	.long	1071922591
+	.long	1209029111
+	.long	3170736207
+	.long	556125184
+	.long	1071907228
+	.long	821086028
+	.long	3173437049
+	.long	204914688
+	.long	1071891976
+	.long	2097025986
+	.long	3171071798
+	.long	387545088
+	.long	1071876834
+	.long	3142936996
+	.long	3173092218
+	.long	2912783360
+	.long	1071861800
+	.long	2502420140
+	.long	1024505919
+	.long	1144260608
+	.long	1071846874
+	.long	3315658140
+	.long	3173469843
+	.long	1471209472
+	.long	1071832053
+	.long	129621009
+	.long	3172443877
+	.long	1829683200
+	.long	1071817336
+	.long	3885467693
+	.long	1025535275
+	.long	288676864
+	.long	1071802722
+	.long	86139472
+	.long	3171639793
+	.long	3636378624
+	.long	1071788208
+	.long	1850238587
+	.long	1024654342
+	.long	1606817792
+	.long	1071773795
+	.long	3388899795
+	.long	3173675586
+	.long	1236164608
+	.long	1071759480
+	.long	3983599207
+	.long	1020046558
+	.long	1089616896
+	.long	1071745262
+	.long	4171974224
+	.long	1024773198
+	.long	4143093760
+	.long	1071731139
+	.long	2727587401
+	.long	3173965207
+	.long	600267776
+	.long	1071717112
+	.long	3147685042
+	.long	3173353031
+	.long	2249313280
+	.long	1071703177
+	.long	125835074
+	.long	1025255832
+	.long	3805303808
+	.long	1071689334
+	.long	2289991207
+	.long	1025460331
+	.long	87278592
+	.long	1071675583
+	.long	1106114045
+	.long	1025933602
+	.long	3195405312
+	.long	1071661920
+	.long	3885316576
+	.long	3171206239
+	.long	3853649920
+	.long	1071648346
+	.long	2977069852
+	.long	3171236771
+	.long	2944026624
+	.long	1071625048
+	.long	1008093493
+	.long	1023444474
+	.long	3993180160
+	.long	1071598247
+	.long	1862355595
+	.long	1024642533
+	.long	1454641152
+	.long	1071571617
+	.long	1514603089
+	.long	1026500596
+	.long	3286085632
+	.long	1071545154
+	.long	1400028424
+	.long	3173279056
+	.long	438773760
+	.long	1071518858
+	.long	120727864
+	.long	3172148914
+	.long	1212979200
+	.long	1071492725
+	.long	1625055594
+	.long	3172901933
+	.long	1189017600
+	.long	1071466754
+	.long	3920062376
+	.long	1025727407
+	.long	403064832
+	.long	1071440943
+	.long	1053271728
+	.long	3171391427
+	.long	3343210496
+	.long	1071415289
+	.long	3243395502
+	.long	3173627613
+	.long	1765777408
+	.long	1071389792
+	.long	2145968512
+	.long	1026354304
+	.long	461430784
+	.long	1071364449
+	.long	4094322285
+	.long	1026021467
+	.long	71706624
+	.long	1071339258
+	.long	763632021
+	.long	1024496933
+	.long	1380503552
+	.long	1071314217
+	.long	1383547992
+	.long	3173088453
+	.long	1015732224
+	.long	1071289325
+	.long	3198646877
+	.long	1025390322
+	.long	35977216
+	.long	1071264580
+	.long	2141026805
+	.long	1025754693
+	.long	3927306240
+	.long	1071239979
+	.long	282116272
+	.long	3173394334
+	.long	1125341184
+	.long	1071215523
+	.long	2768427504
+	.long	3172279059
+	.long	1666971648
+	.long	1071191208
+	.long	786837629
+	.long	3172427445
+	.long	2827694080
+	.long	1071167033
+	.long	3857122416
+	.long	3173014241
+	.long	2003683328
+	.long	1071142997
+	.long	859010954
+	.long	1026545007
+	.long	1004017664
+	.long	1071119098
+	.long	3356644970
+	.long	3173458064
+	.long	1753020416
+	.long	1071095334
+	.long	788338552
+	.long	1026157693
+	.long	1992718336
+	.long	1071071704
+	.long	1239179443
+	.long	1026394889
+	.long	3870234624
+	.long	1071048206
+	.long	2082614663
+	.long	1024926053
+	.long	1050437632
+	.long	1071024840
+	.long	660007840
+	.long	1025548499
+	.long	188395520
+	.long	1071001603
+	.long	3878792704
+	.long	3173889571
+	.long	3747176448
+	.long	1070978493
+	.long	144991708
+	.long	3171552042
+	.long	1405669376
+	.long	1070955511
+	.long	3999088879
+	.long	1025486317
+	.long	121151488
+	.long	1070932654
+	.long	2170865497
+	.long	1026473584
+	.long	2652319744
+	.long	1070909920
+	.long	453695652
+	.long	3173916809
+	.long	3262236672
+	.long	1070887309
+	.long	157800053
+	.long	3173984206
+	.long	601221120
+	.long	1070864820
+	.long	3968917661
+	.long	1023992886
+	.long	1999843328
+	.long	1070842450
+	.long	3053895004
+	.long	1024998228
+	.long	1992167424
+	.long	1070820199
+	.long	2968614856
+	.long	1024552653
+	.long	3788726272
+	.long	1070798065
+	.long	3542170808
+	.long	3173573242
+	.long	2094829568
+	.long	1070776048
+	.long	1246758132
+	.long	1026202874
+	.long	288675840
+	.long	1070754146
+	.long	3747328950
+	.long	1026331585
+	.long	1829681152
+	.long	1070732357
+	.long	3125197546
+	.long	1024100318
+	.long	1666869248
+	.long	1070710681
+	.long	1363656119
+	.long	1026336493
+	.long	3417110528
+	.long	1070689116
+	.long	4154791553
+	.long	1026267853
+	.long	2183653376
+	.long	1070667662
+	.long	1671819292
+	.long	3173785870
+	.long	1734434816
+	.long	1070646317
+	.long	373091049
+	.long	1025972363
+	.long	1615681536
+	.long	1070625080
+	.long	384650897
+	.long	1022926043
+	.long	1445382144
+	.long	1070603950
+	.long	344320330
+	.long	3172397196
+	.long	1823715328
+	.long	1070569756
+	.long	3389841200
+	.long	1025231852
+	.long	3839688704
+	.long	1070527917
+	.long	1706790417
+	.long	3167363349
+	.long	4293332992
+	.long	1070486286
+	.long	1614935088
+	.long	1019351591
+	.long	2966720512
+	.long	1070444861
+	.long	4145393717
+	.long	3173711658
+	.long	4066729984
+	.long	1070403639
+	.long	1974925028
+	.long	3171437182
+	.long	3337621504
+	.long	1070362619
+	.long	3314953170
+	.long	3169971314
+	.long	943448064
+	.long	1070321799
+	.long	1498682038
+	.long	3173862340
+	.long	1465634816
+	.long	1070281176
+	.long	1319952810
+	.long	3171693965
+	.long	1015734272
+	.long	1070240749
+	.long	1347821929
+	.long	3173544515
+	.long	118001664
+	.long	1070200516
+	.long	1751482746
+	.long	1026134093
+	.long	3707174912
+	.long	1070160474
+	.long	1486946159
+	.long	1023930920
+	.long	3946381312
+	.long	1070120623
+	.long	2867408081
+	.long	3171368276
+	.long	1699848192
+	.long	1070080961
+	.long	2590187139
+	.long	1025379803
+	.long	2235846656
+	.long	1070041485
+	.long	1888568069
+	.long	3172754960
+	.long	2339729408
+	.long	1070002194
+	.long	3852214753
+	.long	3173323149
+	.long	3196850176
+	.long	1069963086
+	.long	742141560
+	.long	1025101707
+	.long	1800683520
+	.long	1069924160
+	.long	3949500444
+	.long	3172102179
+	.long	3835801600
+	.long	1069885413
+	.long	3848895943
+	.long	1025913832
+	.long	2201202688
+	.long	1069846845
+	.long	1425913464
+	.long	1025868665
+	.long	2778279936
+	.long	1069808453
+	.long	2120889677
+	.long	3173831128
+	.long	2954203136
+	.long	1069770236
+	.long	592147081
+	.long	1019621288
+	.long	210141184
+	.long	1069732193
+	.long	3414275233
+	.long	1023647084
+	.long	709476352
+	.long	1069694321
+	.long	2413027164
+	.long	1024462115
+	.long	2116284416
+	.long	1069656619
+	.long	1144559924
+	.long	1026336654
+	.long	2183651328
+	.long	1069619086
+	.long	3459057650
+	.long	1025634168
+	.long	3047047168
+	.long	1069581720
+	.long	1879674924
+	.long	3173508573
+	.long	970711040
+	.long	1069541521
+	.long	1335954173
+	.long	3173332182
+	.long	2198478848
+	.long	1069467449
+	.long	2951103968
+	.long	3173892200
+	.long	1669611520
+	.long	1069393703
+	.long	531044147
+	.long	1025149248
+	.long	29114368
+	.long	1069320280
+	.long	3327831251
+	.long	1025918673
+	.long	2376949760
+	.long	1069247176
+	.long	737634533
+	.long	3172176000
+	.long	1085390848
+	.long	1069174390
+	.long	3108243400
+	.long	3171828406
+	.long	1566130176
+	.long	1069101918
+	.long	985483226
+	.long	1025708380
+	.long	792780800
+	.long	1069029758
+	.long	4184866295
+	.long	1024426204
+	.long	183156736
+	.long	1068957907
+	.long	2845699378
+	.long	1022107277
+	.long	1301782528
+	.long	1068886362
+	.long	1012735262
+	.long	3173804294
+	.long	1562411008
+	.long	1068815121
+	.long	2197086703
+	.long	3170187813
+	.long	2815549440
+	.long	1068744181
+	.long	2782613207
+	.long	1026345054
+	.long	2756124672
+	.long	1068673540
+	.long	2929486205
+	.long	3173037800
+	.long	3511050240
+	.long	1068603195
+	.long	1443733147
+	.long	3173331549
+	.long	3047047168
+	.long	1068533144
+	.long	1879674924
+	.long	3172459997
+	.long	3221667840
+	.long	1068427825
+	.long	1338588027
+	.long	3171815742
+	.long	3453861888
+	.long	1068288883
+	.long	1205348359
+	.long	3172624626
+	.long	3506110464
+	.long	1068150514
+	.long	893105198
+	.long	1025571866
+	.long	346013696
+	.long	1068012714
+	.long	3495569021
+	.long	3172563349
+	.long	4074029056
+	.long	1067875476
+	.long	3961106338
+	.long	3171065595
+	.long	3559784448
+	.long	1067738798
+	.long	1975385384
+	.long	3173783155
+	.long	797769728
+	.long	1067602675
+	.long	3760305787
+	.long	1026047642
+	.long	2313633792
+	.long	1067467101
+	.long	1559353171
+	.long	1023480256
+	.long	3960766464
+	.long	1067213778
+	.long	1067365107
+	.long	1025865926
+	.long	684261376
+	.long	1066944805
+	.long	844762164
+	.long	3173687482
+	.long	630718464
+	.long	1066676905
+	.long	2458269694
+	.long	1024033081
+	.long	1486061568
+	.long	1066410070
+	.long	115537874
+	.long	3173243995
+	.long	2743664640
+	.long	1065886792
+	.long	3665098304
+	.long	3173471607
+	.long	1971912704
+	.long	1065357333
+	.long	2577214440
+	.long	3171993451
+	.long	1498939392
+	.long	1064306693
+	.long	3409036923
+	.long	1025599151
+	.long	0
+	.long	0
+	.long	0
+	.long	2147483648
+	.long	4277811200
+	.long	1067855426
+	.long	2479318832
+	.long	1022292823
+	.long	2454267026
+	.long	1069697316
+	.long	0
+	.long	3218079744
+	.long	1030730101
+	.long	3217380702
+	.long	1431655765
+	.long	1070945621
+	.long	2576980378
+	.long	1070176665
+	.long	0
+	.long	3219128320
+	.long	0
+	.long	4294959104
+	.long	0
+	.long	4294959104
+	.type	static_const_table,@object
+	.size	static_const_table,2144
+	.data
+	.section .note.GNU-stack, ""
+# End
diff --git a/libm/x86/e_pow.S b/libm/x86/e_pow.S
new file mode 100644
index 0000000..43e30d8
--- /dev/null
+++ b/libm/x86/e_pow.S
@@ -0,0 +1,4277 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+//    Let x=2^k * mx, mx in [1,2)
+//
+//    log2(x) calculation:
+//
+//    Get B~1/mx based on the output of rcpps instruction (B0)
+//    B = int((B0*LH*2^9+0.5))/2^9
+//    LH is a short approximation for log2(e)
+//
+//    Reduced argument, scaled by LH:
+//                r=B*mx-LH (computed accurately in high and low parts)
+//
+//    log2(x) result:  k - log2(B) + p(r)
+//             p(r) is a degree 8 polynomial
+//             -log2(B) read from data table (high, low parts)
+//             log2(x) is formed from high and low parts
+//    For |x| in [1-1/32, 1+1/16), a slower but more accurate computation
+//    based om the same table design is performed.
+//
+//   Main path is taken if | floor(log2(|log2(|x|)|) + floor(log2|y|) | < 8,
+//   to filter out all potential OF/UF cases.
+//   exp2(y*log2(x)) is computed using an 8-bit index table and a degree 5
+//   polynomial
+//
+// Special cases:
+//  pow(-0,y) = -INF and raises the divide-by-zero exception for y an odd 
+//  integer < 0.
+//  pow(-0,y) = +INF and raises the divide-by-zero exception for y < 0 and 
+//  not an odd integer.
+//  pow(-0,y) = -0 for y an odd integer > 0.
+//  pow(-0,y) = +0 for y > 0 and not an odd integer.
+//  pow(-1,-INF) = 1.
+//  pow(+1,y) = 1 for any y, even a NaN.
+//  pow(x,-0) = 1 for any x, even a NaN.
+//  pow(x,y) = a NaN and raises the invalid exception for finite x < 0 and
+//  finite non-integer y.
+//  pow(x,-INF) = +INF for |x|<1.
+//  pow(x,-INF) = +0 for |x|>1.
+//  pow(x,+INF) = +0 for |x|<1.
+//  pow(x,+INF) = +INF for |x|>1.
+//  pow(-INF,y) = -0 for y an odd integer < 0.
+//  pow(-INF,y) = +0 for y < 0 and not an odd integer.
+//  pow(-INF,y) = -INF for y an odd integer > 0.
+//  pow(-INF,y) = +INF for y > 0 and not an odd integer.
+//  pow(+INF,y) = +0 for y <0.
+//  pow(+INF,y) = +INF for y >0.
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  static_func
+        .text
+        .align __bionic_asm_align
+        .type static_func, @function
+static_func:
+..B1.1:
+        call      ..L2
+..L2:
+        popl      %eax
+        lea       _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
+        lea       static_const_table@GOTOFF(%eax), %eax
+        ret
+        .size   static_func,.-static_func
+# -- End  static_func
+
+# -- Begin  pow
+ENTRY(pow)
+# parameter 1: 8 + %ebp
+# parameter 2: 16 + %ebp
+..B2.1:
+..B2.2:
+        pushl     %ebp
+        movl      %esp, %ebp
+        subl      $120, %esp
+        movl      %ebx, 64(%esp)
+        call      static_func
+        movl      %eax, %ebx
+        movsd     128(%esp), %xmm0
+        movsd     136(%esp), %xmm1
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        movl      $1069088768, %ecx
+        movd      %ecx, %xmm7
+        movsd     %xmm1, 16(%esp)
+        xorpd     %xmm1, %xmm1
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm1
+        movsd     %xmm0, 8(%esp)
+        movapd    %xmm0, %xmm3
+        movl      $8192, %edx
+        movd      %edx, %xmm4
+        movapd    8240(%ebx), %xmm6
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        psllq     $5, %xmm0
+        movsd     8256(%ebx), %xmm2
+        psrlq     $34, %xmm0
+        movl      %eax, %edx
+        andl      $32752, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        rcpss     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        psrlq     $12, %xmm3
+        movl      %esi, 24(%esp)
+        subl      $16, %eax
+        cmpl      $32736, %eax
+        jae       .L_2TAG_PACKET_0.0.2
+        movl      $0, %esi
+.L_2TAG_PACKET_1.0.2:
+        mulss     %xmm7, %xmm0
+        movl      $-1, %edx
+        subl      $4, %ecx
+        shll      %cl, %edx
+        movd      %edx, %xmm5
+        orpd      %xmm1, %xmm3
+        subl      $16351, %eax
+        cmpl      $1, %eax
+        jbe       .L_2TAG_PACKET_2.0.2
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm3, %xmm5
+.L_2TAG_PACKET_3.0.2:
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        subl      $1, %eax
+        sarl      $4, %eax
+        cvtsi2sdl %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+.L_2TAG_PACKET_4.0.2:
+        mulsd     %xmm0, %xmm3
+        movapd    8272(%ebx), %xmm1
+        subsd     %xmm2, %xmm5
+        movapd    8288(%ebx), %xmm4
+        movl      %eax, %ecx
+        sarl      $31, %eax
+        addl      %eax, %ecx
+        xorl      %ecx, %eax
+        addl      $1, %eax
+        bsr       %eax, %eax
+        unpcklpd  %xmm3, %xmm5
+        movapd    8304(%ebx), %xmm6
+        addsd     %xmm5, %xmm3
+        andl      $16760832, %edx
+        shrl      $10, %edx
+        addpd     -3616(%ebx,%edx), %xmm5
+        movapd    8320(%ebx), %xmm0
+        pshufd    $68, %xmm3, %xmm2
+        mulsd     %xmm3, %xmm3
+        mulpd     %xmm2, %xmm1
+        mulpd     %xmm2, %xmm4
+        addsd     %xmm7, %xmm5
+        mulsd     %xmm3, %xmm2
+        addpd     %xmm1, %xmm6
+        mulsd     %xmm3, %xmm3
+        addpd     %xmm4, %xmm0
+        movsd     16(%esp), %xmm1
+        movzwl    22(%esp), %ecx
+        pshufd    $238, %xmm5, %xmm7
+        movsd     8368(%ebx), %xmm4
+        mulpd     %xmm2, %xmm6
+        pshufd    $68, %xmm3, %xmm3
+        mulpd     %xmm2, %xmm0
+        shll      $4, %eax
+        subl      $15872, %eax
+        andl      $32752, %ecx
+        addl      %ecx, %eax
+        mulpd     %xmm6, %xmm3
+        cmpl      $624, %eax
+        jae       .L_2TAG_PACKET_5.0.2
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %edx
+        pinsrw    $3, %edx, %xmm6
+        movapd    %xmm1, %xmm2
+        andpd     %xmm1, %xmm4
+        subsd     %xmm4, %xmm1
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm7, %xmm0
+        mulsd     %xmm5, %xmm1
+        movapd    %xmm6, %xmm7
+        addsd     %xmm4, %xmm6
+        addpd     %xmm0, %xmm3
+        movd      %xmm6, %edx
+        subsd     %xmm7, %xmm6
+        pshufd    $238, %xmm3, %xmm0
+        subsd     %xmm6, %xmm4
+        addsd     %xmm3, %xmm0
+        movl      %edx, %ecx
+        andl      $255, %edx
+        addl      %edx, %edx
+        movapd    8384(%ebx,%edx,8), %xmm5
+        addsd     %xmm1, %xmm4
+        mulsd     %xmm0, %xmm2
+        movapd    12480(%ebx), %xmm7
+        movapd    12496(%ebx), %xmm3
+        shll      $12, %ecx
+        xorl      %esi, %ecx
+        andl      $-1048576, %ecx
+        movd      %ecx, %xmm6
+        addsd     %xmm4, %xmm2
+        movsd     12512(%ebx), %xmm1
+        pshufd    $68, %xmm2, %xmm0
+        pshufd    $68, %xmm2, %xmm4
+        mulpd     %xmm0, %xmm0
+        movl      24(%esp), %esi
+        mulpd     %xmm4, %xmm7
+        pshufd    $17, %xmm6, %xmm6
+        mulsd     %xmm2, %xmm1
+        mulsd     %xmm0, %xmm0
+        paddd     %xmm6, %xmm5
+        addpd     %xmm7, %xmm3
+        mulsd     %xmm5, %xmm1
+        pshufd    $238, %xmm5, %xmm6
+        mulpd     %xmm3, %xmm0
+        addsd     %xmm6, %xmm1
+        pshufd    $238, %xmm0, %xmm3
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        addsd     %xmm1, %xmm0
+        addsd     %xmm3, %xmm0
+        addsd     %xmm5, %xmm0
+        movsd     %xmm0, (%esp)
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_7.0.2:
+        movsd     128(%esp), %xmm0
+        movsd     136(%esp), %xmm1
+        mulsd     %xmm1, %xmm0
+        movsd     %xmm0, (%esp)
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_0.0.2:
+        addl      $16, %eax
+        movl      $32752, %edx
+        andl      %eax, %edx
+        cmpl      $32752, %edx
+        je        .L_2TAG_PACKET_8.0.2
+        testl     $32768, %eax
+        jne       .L_2TAG_PACKET_9.0.2
+.L_2TAG_PACKET_10.0.2:
+        movl      16(%esp), %ecx
+        xorl      %edx, %edx
+        testl     %ecx, %ecx
+        movl      $1, %ecx
+        cmovne    %ecx, %edx
+        orl       20(%esp), %edx
+        cmpl      $1072693248, %edx
+        je        .L_2TAG_PACKET_7.0.2
+        movsd     8(%esp), %xmm0
+        movsd     8(%esp), %xmm3
+        movd      %xmm3, %edx
+        psrlq     $32, %xmm3
+        movd      %xmm3, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_11.0.2
+        xorpd     %xmm3, %xmm3
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm3
+        mulsd     %xmm3, %xmm0
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        movapd    %xmm0, %xmm3
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        movl      $18416, %ecx
+        psllq     $5, %xmm0
+        movsd     8256(%ebx), %xmm2
+        psrlq     $34, %xmm0
+        rcpss     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        movapd    8240(%ebx), %xmm6
+        psrlq     $12, %xmm3
+        mulss     %xmm7, %xmm0
+        movl      $-1024, %edx
+        movd      %edx, %xmm5
+        orpd      %xmm1, %xmm3
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm3, %xmm5
+        movl      $0, %esi
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        andl      $32752, %eax
+        subl      $18416, %eax
+        sarl      $4, %eax
+        cvtsi2sdl %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        jmp       .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_12.0.2:
+        movl      16(%esp), %ecx
+        xorl      %edx, %edx
+        testl     %ecx, %ecx
+        movl      $1, %ecx
+        cmovne    %ecx, %edx
+        orl       20(%esp), %edx
+        cmpl      $1072693248, %edx
+        je        .L_2TAG_PACKET_7.0.2
+        movsd     8(%esp), %xmm0
+        movsd     8(%esp), %xmm3
+        movd      %xmm3, %edx
+        psrlq     $32, %xmm3
+        movd      %xmm3, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_11.0.2
+        xorpd     %xmm3, %xmm3
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm3
+        mulsd     %xmm3, %xmm0
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        movapd    %xmm0, %xmm3
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        movl      $18416, %ecx
+        psllq     $5, %xmm0
+        movsd     8256(%ebx), %xmm2
+        psrlq     $34, %xmm0
+        rcpss     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        movapd    8240(%ebx), %xmm6
+        psrlq     $12, %xmm3
+        mulss     %xmm7, %xmm0
+        movl      $-1024, %edx
+        movd      %edx, %xmm5
+        orpd      %xmm1, %xmm3
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm3, %xmm5
+        movl      $-2147483648, %esi
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        andl      $32752, %eax
+        subl      $18416, %eax
+        sarl      $4, %eax
+        cvtsi2sdl %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        jmp       .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_5.0.2:
+        cmpl      $0, %eax
+        jl        .L_2TAG_PACKET_13.0.2
+        cmpl      $736, %eax
+        jae       .L_2TAG_PACKET_14.0.2
+.L_2TAG_PACKET_15.0.2:
+        addsd     %xmm7, %xmm0
+        movsd     12544(%ebx), %xmm2
+        addpd     %xmm0, %xmm3
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %eax
+        pinsrw    $3, %eax, %xmm6
+        pshufd    $238, %xmm3, %xmm0
+        addsd     %xmm3, %xmm0
+        movapd    %xmm5, %xmm3
+        addsd     %xmm0, %xmm5
+        movapd    %xmm2, %xmm4
+        subsd     %xmm5, %xmm3
+        movapd    %xmm5, %xmm7
+        andpd     %xmm2, %xmm5
+        movapd    %xmm1, %xmm2
+        andpd     %xmm1, %xmm4
+        subsd     %xmm5, %xmm7
+        addsd     %xmm3, %xmm0
+        subsd     %xmm4, %xmm1
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm7, %xmm0
+        mulsd     %xmm0, %xmm2
+        movapd    %xmm6, %xmm7
+        mulsd     %xmm5, %xmm1
+        addsd     %xmm4, %xmm6
+        movd      %xmm6, %eax
+        subsd     %xmm7, %xmm6
+        addsd     %xmm1, %xmm2
+        movapd    12480(%ebx), %xmm7
+        movapd    12496(%ebx), %xmm3
+        subsd     %xmm6, %xmm4
+        pextrw    $3, %xmm6, %edx
+        movl      %eax, %ecx
+        andl      $255, %eax
+        addl      %eax, %eax
+        movapd    8384(%ebx,%eax,8), %xmm5
+        addsd     %xmm4, %xmm2
+        sarl      $8, %ecx
+        movl      %ecx, %eax
+        sarl      $1, %ecx
+        subl      %ecx, %eax
+        shll      $20, %ecx
+        xorl      %esi, %ecx
+        movd      %ecx, %xmm6
+        movsd     12512(%ebx), %xmm1
+        andl      $32767, %edx
+        cmpl      $16529, %edx
+        ja        .L_2TAG_PACKET_14.0.2
+        pshufd    $68, %xmm2, %xmm0
+        pshufd    $68, %xmm2, %xmm4
+        mulpd     %xmm0, %xmm0
+        mulpd     %xmm4, %xmm7
+        pshufd    $17, %xmm6, %xmm6
+        mulsd     %xmm2, %xmm1
+        mulsd     %xmm0, %xmm0
+        paddd     %xmm6, %xmm5
+        addpd     %xmm7, %xmm3
+        mulsd     %xmm5, %xmm1
+        pshufd    $238, %xmm5, %xmm6
+        mulpd     %xmm3, %xmm0
+        addsd     %xmm6, %xmm1
+        pshufd    $238, %xmm0, %xmm3
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        shll      $4, %eax
+        xorpd     %xmm4, %xmm4
+        addl      $16368, %eax
+        pinsrw    $3, %eax, %xmm4
+        addsd     %xmm1, %xmm0
+        movl      24(%esp), %esi
+        addsd     %xmm3, %xmm0
+        movapd    %xmm0, %xmm1
+        addsd     %xmm5, %xmm0
+        mulsd     %xmm4, %xmm0
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        je        .L_2TAG_PACKET_16.0.2
+        cmpl      $32752, %eax
+        je        .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_18.0.2:
+        movsd     %xmm0, (%esp)
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_8.0.2:
+        movsd     16(%esp), %xmm1
+        movsd     8(%esp), %xmm0
+        movapd    %xmm0, %xmm2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_19.0.2
+        addsd     %xmm0, %xmm0
+        movd      %xmm1, %eax
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_20.0.2
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_20.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        movl      $29, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_22.0.2:
+        movsd     16(%esp), %xmm0
+        addpd     %xmm0, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_19.0.2:
+        movd      %xmm1, %eax
+        movapd    %xmm1, %xmm2
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_23.0.2
+        pextrw    $3, %xmm2, %eax
+        andl      $32752, %eax
+        cmpl      $32752, %eax
+        jne       .L_2TAG_PACKET_24.0.2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        jne       .L_2TAG_PACKET_22.0.2
+.L_2TAG_PACKET_24.0.2:
+        pextrw    $3, %xmm0, %eax
+        testl     $32768, %eax
+        jne       .L_2TAG_PACKET_25.0.2
+        testl     $-2147483648, %ecx
+        jne       .L_2TAG_PACKET_26.0.2
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_27.0.2:
+        movsd     16(%esp), %xmm1
+        movd      %xmm1, %eax
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_28.0.2
+        testl     $2, %eax
+        jne       .L_2TAG_PACKET_29.0.2
+        jmp       .L_2TAG_PACKET_28.0.2
+.L_2TAG_PACKET_25.0.2:
+        shrl      $20, %ecx
+        andl      $2047, %ecx
+        cmpl      $1075, %ecx
+        ja        .L_2TAG_PACKET_28.0.2
+        je        .L_2TAG_PACKET_30.0.2
+        cmpl      $1074, %ecx
+        ja        .L_2TAG_PACKET_27.0.2
+        cmpl      $1023, %ecx
+        jb        .L_2TAG_PACKET_28.0.2
+        movsd     16(%esp), %xmm1
+        movl      $17208, %eax
+        xorpd     %xmm3, %xmm3
+        pinsrw    $3, %eax, %xmm3
+        movapd    %xmm3, %xmm4
+        addsd     %xmm1, %xmm3
+        subsd     %xmm3, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        jne       .L_2TAG_PACKET_28.0.2
+        movd      %xmm3, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_28.0.2
+.L_2TAG_PACKET_29.0.2:
+        movsd     16(%esp), %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32768, %eax
+        je        .L_2TAG_PACKET_18.0.2
+        xorpd     %xmm0, %xmm0
+        movl      $32768, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_28.0.2:
+        movsd     16(%esp), %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32768, %eax
+        jne       .L_2TAG_PACKET_26.0.2
+.L_2TAG_PACKET_31.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_30.0.2:
+        movsd     16(%esp), %xmm1
+        movd      %xmm1, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_28.0.2
+        jmp       .L_2TAG_PACKET_29.0.2
+.L_2TAG_PACKET_32.0.2:
+        movd      %xmm1, %eax
+        psrlq     $20, %xmm1
+        movd      %xmm1, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_33.0.2
+        movsd     16(%esp), %xmm0
+        addsd     %xmm0, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_33.0.2:
+        movsd     8(%esp), %xmm0
+        pextrw    $3, %xmm0, %eax
+        cmpl      $49136, %eax
+        jne       .L_2TAG_PACKET_34.0.2
+        movd      %xmm0, %ecx
+        psrlq     $20, %xmm0
+        movd      %xmm0, %edx
+        orl       %edx, %ecx
+        jne       .L_2TAG_PACKET_34.0.2
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_34.0.2:
+        movsd     16(%esp), %xmm1
+        andl      $32752, %eax
+        subl      $16368, %eax
+        pextrw    $3, %xmm1, %edx
+        xorpd     %xmm0, %xmm0
+        xorl      %edx, %eax
+        andl      $32768, %eax
+        jne       .L_2TAG_PACKET_18.0.2
+        movl      $32752, %ecx
+        pinsrw    $3, %ecx, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_35.0.2:
+        movd      %xmm1, %eax
+        cmpl      $17184, %edx
+        ja        .L_2TAG_PACKET_36.0.2
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_37.0.2
+        testl     $2, %eax
+        je        .L_2TAG_PACKET_38.0.2
+        jmp       .L_2TAG_PACKET_39.0.2
+.L_2TAG_PACKET_36.0.2:
+        testl     $1, %eax
+        je        .L_2TAG_PACKET_38.0.2
+        jmp       .L_2TAG_PACKET_39.0.2
+.L_2TAG_PACKET_9.0.2:
+        movsd     8(%esp), %xmm2
+        movd      %xmm2, %eax
+        psrlq     $31, %xmm2
+        movd      %xmm2, %ecx
+        orl       %ecx, %eax
+        je        .L_2TAG_PACKET_11.0.2
+        movsd     16(%esp), %xmm1
+        pextrw    $3, %xmm1, %edx
+        movd      %xmm1, %eax
+        movapd    %xmm1, %xmm2
+        psrlq     $32, %xmm2
+        movd      %xmm2, %ecx
+        addl      %ecx, %ecx
+        orl       %eax, %ecx
+        je        .L_2TAG_PACKET_40.0.2
+        andl      $32752, %edx
+        cmpl      $32752, %edx
+        je        .L_2TAG_PACKET_32.0.2
+        cmpl      $17200, %edx
+        ja        .L_2TAG_PACKET_38.0.2
+        cmpl      $17184, %edx
+        jae       .L_2TAG_PACKET_35.0.2
+        cmpl      $16368, %edx
+        jb        .L_2TAG_PACKET_37.0.2
+        movl      $17208, %eax
+        xorpd     %xmm2, %xmm2
+        pinsrw    $3, %eax, %xmm2
+        movapd    %xmm2, %xmm4
+        addsd     %xmm1, %xmm2
+        subsd     %xmm2, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32767, %eax
+        jne       .L_2TAG_PACKET_37.0.2
+        movd      %xmm2, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_38.0.2
+.L_2TAG_PACKET_39.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm1
+        movsd     8256(%ebx), %xmm2
+        movsd     8(%esp), %xmm4
+        pextrw    $3, %xmm4, %eax
+        movl      $8192, %edx
+        movd      %edx, %xmm4
+        andl      $32767, %eax
+        subl      $16, %eax
+        jl        .L_2TAG_PACKET_12.0.2
+        movl      %eax, %edx
+        andl      $32752, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        movl      $-2147483648, %esi
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_37.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm1
+        xorpd     %xmm0, %xmm0
+        mulsd     %xmm1, %xmm0
+        movl      $28, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_38.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm1
+        movsd     8256(%ebx), %xmm2
+        movsd     8(%esp), %xmm4
+        pextrw    $3, %xmm4, %eax
+        movl      $8192, %edx
+        movd      %edx, %xmm4
+        andl      $32767, %eax
+        subl      $16, %eax
+        jl        .L_2TAG_PACKET_10.0.2
+        movl      %eax, %edx
+        andl      $32752, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        movl      $0, %esi
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_23.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_26.0.2:
+        xorpd     %xmm0, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_13.0.2:
+        addl      $384, %eax
+        cmpl      $0, %eax
+        jl        .L_2TAG_PACKET_41.0.2
+        mulsd     %xmm1, %xmm5
+        addsd     %xmm7, %xmm0
+        shrl      $31, %esi
+        addpd     %xmm0, %xmm3
+        pshufd    $238, %xmm3, %xmm0
+        addsd     %xmm0, %xmm3
+        movsd     12528(%ebx,%esi,8), %xmm4
+        mulsd     %xmm3, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        shll      $15, %esi
+        orl       %esi, %eax
+        pinsrw    $3, %eax, %xmm0
+        addsd     %xmm1, %xmm5
+        movl      24(%esp), %esi
+        mulsd     %xmm4, %xmm5
+        addsd     %xmm5, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_41.0.2:
+        movl      24(%esp), %esi
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_40.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_42.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        movl      $26, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_11.0.2:
+        movsd     16(%esp), %xmm1
+        movapd    %xmm1, %xmm2
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        cmpl      $32752, %eax
+        jne       .L_2TAG_PACKET_43.0.2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        jne       .L_2TAG_PACKET_22.0.2
+.L_2TAG_PACKET_43.0.2:
+        movd      %xmm1, %eax
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_42.0.2
+        shrl      $21, %edx
+        cmpl      $1075, %edx
+        ja        .L_2TAG_PACKET_44.0.2
+        je        .L_2TAG_PACKET_45.0.2
+        cmpl      $1023, %edx
+        jb        .L_2TAG_PACKET_44.0.2
+        movsd     16(%esp), %xmm1
+        movl      $17208, %eax
+        xorpd     %xmm3, %xmm3
+        pinsrw    $3, %eax, %xmm3
+        movapd    %xmm3, %xmm4
+        addsd     %xmm1, %xmm3
+        subsd     %xmm3, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        jne       .L_2TAG_PACKET_44.0.2
+        movd      %xmm3, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_44.0.2
+.L_2TAG_PACKET_46.0.2:
+        movsd     8(%esp), %xmm0
+        testl     $-2147483648, %ecx
+        jne       .L_2TAG_PACKET_47.0.2
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_45.0.2:
+        movsd     16(%esp), %xmm1
+        movd      %xmm1, %eax
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_46.0.2
+.L_2TAG_PACKET_44.0.2:
+        testl     $-2147483648, %ecx
+        je        .L_2TAG_PACKET_26.0.2
+        xorpd     %xmm0, %xmm0
+.L_2TAG_PACKET_47.0.2:
+        movl      $16368, %eax
+        xorpd     %xmm1, %xmm1
+        pinsrw    $3, %eax, %xmm1
+        divsd     %xmm0, %xmm1
+        movapd    %xmm1, %xmm0
+        movl      $27, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_14.0.2:
+        movsd     8(%esp), %xmm2
+        movsd     16(%esp), %xmm6
+        pextrw    $3, %xmm2, %eax
+        pextrw    $3, %xmm6, %edx
+        movl      $32752, %ecx
+        andl      %edx, %ecx
+        cmpl      $32752, %ecx
+        je        .L_2TAG_PACKET_48.0.2
+        andl      $32752, %eax
+        subl      $16368, %eax
+        xorl      %eax, %edx
+        testl     $32768, %edx
+        jne       .L_2TAG_PACKET_49.0.2
+.L_2TAG_PACKET_50.0.2:
+        movl      $32736, %eax
+        pinsrw    $3, %eax, %xmm0
+        shrl      $16, %esi
+        orl       %esi, %eax
+        pinsrw    $3, %eax, %xmm1
+        movl      24(%esp), %esi
+        mulsd     %xmm1, %xmm0
+.L_2TAG_PACKET_17.0.2:
+        movl      $24, %edx
+.L_2TAG_PACKET_21.0.2:
+        movsd     %xmm0, (%esp)
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_49.0.2:
+        movl      $16, %eax
+        pinsrw    $3, %eax, %xmm0
+        mulsd     %xmm0, %xmm0
+        testl     $-2147483648, %esi
+        je        .L_2TAG_PACKET_51.0.2
+        movsd     12560(%ebx), %xmm2
+        xorpd     %xmm2, %xmm0
+.L_2TAG_PACKET_51.0.2:
+        movl      24(%esp), %esi
+        movl      $25, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_16.0.2:
+        pextrw    $3, %xmm5, %ecx
+        pextrw    $3, %xmm4, %edx
+        movl      $-1, %eax
+        andl      $32752, %ecx
+        subl      $16368, %ecx
+        andl      $32752, %edx
+        addl      %ecx, %edx
+        movl      $-31, %ecx
+        sarl      $4, %edx
+        subl      %edx, %ecx
+        jle       .L_2TAG_PACKET_52.0.2
+        cmpl      $20, %ecx
+        ja        .L_2TAG_PACKET_53.0.2
+        shll      %cl, %eax
+.L_2TAG_PACKET_52.0.2:
+        movd      %eax, %xmm0
+        psllq     $32, %xmm0
+        andpd     %xmm5, %xmm0
+        subsd     %xmm0, %xmm5
+        addsd     %xmm1, %xmm5
+        mulsd     %xmm4, %xmm0
+        mulsd     %xmm4, %xmm5
+        addsd     %xmm5, %xmm0
+.L_2TAG_PACKET_53.0.2:
+        movl      $25, %edx
+        jmp       .L_2TAG_PACKET_21.0.2
+.L_2TAG_PACKET_2.0.2:
+        movzwl    22(%esp), %ecx
+        movl      $-2147483648, %edx
+        movd      %edx, %xmm1
+        xorpd     %xmm7, %xmm7
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        paddq     %xmm3, %xmm1
+        andpd     %xmm1, %xmm5
+        andl      $32752, %ecx
+        cmpl      $16560, %ecx
+        jb        .L_2TAG_PACKET_3.0.2
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        addl      $16351, %eax
+        shrl      $4, %eax
+        subl      $1022, %eax
+        cvtsi2sdl %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        movsd     (%ebx), %xmm4
+        mulsd     %xmm0, %xmm3
+        movsd     (%ebx), %xmm6
+        subsd     %xmm2, %xmm5
+        movsd     8(%ebx), %xmm1
+        pshufd    $68, %xmm3, %xmm2
+        unpcklpd  %xmm3, %xmm5
+        addsd     %xmm5, %xmm3
+        movsd     8(%ebx), %xmm0
+        andl      $16760832, %edx
+        shrl      $10, %edx
+        addpd     -3616(%ebx,%edx), %xmm7
+        mulsd     %xmm5, %xmm4
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm2, %xmm6
+        mulsd     %xmm2, %xmm1
+        movapd    %xmm5, %xmm2
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm0, %xmm5
+        movapd    %xmm7, %xmm0
+        addsd     %xmm3, %xmm2
+        addsd     %xmm5, %xmm7
+        mulsd     %xmm2, %xmm6
+        subsd     %xmm7, %xmm0
+        movapd    %xmm7, %xmm2
+        addsd     %xmm4, %xmm7
+        addsd     %xmm5, %xmm0
+        subsd     %xmm7, %xmm2
+        addsd     %xmm2, %xmm4
+        pshufd    $238, %xmm5, %xmm2
+        movapd    %xmm7, %xmm5
+        addsd     %xmm2, %xmm7
+        addsd     %xmm0, %xmm4
+        movapd    8272(%ebx), %xmm0
+        subsd     %xmm7, %xmm5
+        addsd     %xmm4, %xmm6
+        movapd    %xmm7, %xmm4
+        addsd     %xmm2, %xmm5
+        addsd     %xmm1, %xmm7
+        movapd    8336(%ebx), %xmm2
+        subsd     %xmm7, %xmm4
+        addsd     %xmm5, %xmm6
+        addsd     %xmm1, %xmm4
+        pshufd    $238, %xmm7, %xmm5
+        movapd    %xmm7, %xmm1
+        addsd     %xmm5, %xmm7
+        subsd     %xmm7, %xmm1
+        addsd     %xmm5, %xmm1
+        movapd    8352(%ebx), %xmm5
+        pshufd    $68, %xmm3, %xmm3
+        addsd     %xmm4, %xmm6
+        addsd     %xmm1, %xmm6
+        movapd    8304(%ebx), %xmm1
+        mulpd     %xmm3, %xmm0
+        mulpd     %xmm3, %xmm2
+        pshufd    $68, %xmm3, %xmm4
+        mulpd     %xmm3, %xmm3
+        addpd     %xmm1, %xmm0
+        addpd     %xmm2, %xmm5
+        mulsd     %xmm3, %xmm4
+        movsd     16(%ebx), %xmm2
+        mulpd     %xmm3, %xmm3
+        movsd     16(%esp), %xmm1
+        movzwl    22(%esp), %ecx
+        mulpd     %xmm4, %xmm0
+        pextrw    $3, %xmm7, %eax
+        mulpd     %xmm4, %xmm5
+        mulpd     %xmm3, %xmm0
+        movsd     8376(%ebx), %xmm4
+        andpd     %xmm7, %xmm2
+        addsd     %xmm6, %xmm5
+        subsd     %xmm2, %xmm7
+        addpd     %xmm0, %xmm5
+        andl      $32752, %eax
+        subl      $16368, %eax
+        andl      $32752, %ecx
+        cmpl      $32752, %ecx
+        je        .L_2TAG_PACKET_48.0.2
+        addl      %eax, %ecx
+        cmpl      $16576, %ecx
+        jae       .L_2TAG_PACKET_54.0.2
+        pshufd    $238, %xmm5, %xmm0
+        andpd     %xmm1, %xmm4
+        movapd    %xmm1, %xmm3
+        addsd     %xmm0, %xmm5
+        subsd     %xmm4, %xmm1
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %edx
+        pinsrw    $3, %edx, %xmm6
+        addsd     %xmm5, %xmm7
+        mulsd     %xmm2, %xmm4
+        mulsd     %xmm2, %xmm1
+        movapd    %xmm6, %xmm5
+        mulsd     %xmm7, %xmm3
+        addsd     %xmm4, %xmm6
+        addsd     %xmm3, %xmm1
+        movapd    12480(%ebx), %xmm7
+        movd      %xmm6, %edx
+        subsd     %xmm5, %xmm6
+        movapd    12496(%ebx), %xmm3
+        movsd     12512(%ebx), %xmm2
+        subsd     %xmm6, %xmm4
+        movl      %edx, %ecx
+        andl      $255, %edx
+        addl      %edx, %edx
+        movapd    8384(%ebx,%edx,8), %xmm5
+        addsd     %xmm1, %xmm4
+        pextrw    $3, %xmm6, %edx
+        shrl      $8, %ecx
+        movl      %ecx, %eax
+        shrl      $1, %ecx
+        subl      %ecx, %eax
+        shll      $20, %ecx
+        movd      %ecx, %xmm6
+        pshufd    $68, %xmm4, %xmm0
+        pshufd    $68, %xmm4, %xmm1
+        mulpd     %xmm0, %xmm0
+        mulpd     %xmm1, %xmm7
+        pshufd    $17, %xmm6, %xmm6
+        mulsd     %xmm4, %xmm2
+        andl      $32767, %edx
+        cmpl      $16529, %edx
+        ja        .L_2TAG_PACKET_14.0.2
+        mulsd     %xmm0, %xmm0
+        paddd     %xmm6, %xmm5
+        addpd     %xmm7, %xmm3
+        mulsd     %xmm5, %xmm2
+        pshufd    $238, %xmm5, %xmm6
+        mulpd     %xmm3, %xmm0
+        addsd     %xmm6, %xmm2
+        pshufd    $238, %xmm0, %xmm3
+        addl      $1023, %eax
+        shll      $20, %eax
+        orl       %esi, %eax
+        movd      %eax, %xmm4
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        addsd     %xmm2, %xmm0
+        psllq     $32, %xmm4
+        addsd     %xmm3, %xmm0
+        movapd    %xmm0, %xmm1
+        addsd     %xmm5, %xmm0
+        movl      24(%esp), %esi
+        mulsd     %xmm4, %xmm0
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        je        .L_2TAG_PACKET_16.0.2
+        cmpl      $32752, %eax
+        je        .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_55.0.2:
+        movsd     %xmm0, (%esp)
+        fldl      (%esp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_48.0.2:
+        movl      24(%esp), %esi
+.L_2TAG_PACKET_56.0.2:
+        movsd     8(%esp), %xmm0
+        movsd     16(%esp), %xmm1
+        addsd     %xmm1, %xmm1
+        xorpd     %xmm2, %xmm2
+        movl      $49136, %eax
+        pinsrw    $3, %eax, %xmm2
+        addsd     %xmm0, %xmm2
+        pextrw    $3, %xmm2, %eax
+        cmpl      $0, %eax
+        je        .L_2TAG_PACKET_18.0.2
+        movd      %xmm1, %edx
+        movapd    %xmm1, %xmm3
+        psrlq     $20, %xmm3
+        movd      %xmm3, %ecx
+        orl       %edx, %ecx
+        je        .L_2TAG_PACKET_57.0.2
+        addsd     %xmm1, %xmm1
+        movapd    %xmm1, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_57.0.2:
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        pextrw    $3, %xmm1, %edx
+        xorpd     %xmm0, %xmm0
+        subl      $16368, %eax
+        xorl      %edx, %eax
+        testl     $32768, %eax
+        jne       .L_2TAG_PACKET_18.0.2
+        movl      $32752, %edx
+        pinsrw    $3, %edx, %xmm0
+        jmp       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_54.0.2:
+        pextrw    $3, %xmm1, %eax
+        pextrw    $3, %xmm2, %ecx
+        xorl      %ecx, %eax
+        testl     $32768, %eax
+        je        .L_2TAG_PACKET_50.0.2
+        jmp       .L_2TAG_PACKET_49.0.2
+.L_2TAG_PACKET_6.0.2:
+        movl      64(%esp), %ebx
+        movl      %ebp, %esp
+        popl      %ebp
+        ret       
+..B2.3:
+END(pow)
+# -- End  pow
+	.section .rodata, "a"
+	.align 16
+	.align 16
+static_const_table:
+	.long	0
+	.long	3218479616
+	.long	0
+	.long	3210587105
+	.long	4160749568
+	.long	4294967295
+	.long	0
+	.long	4294965248
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	0
+	.long	536870912
+	.long	1072689162
+	.long	2523013013
+	.long	1046157398
+	.long	3758096384
+	.long	1072685081
+	.long	3851513758
+	.long	3190968952
+	.long	0
+	.long	1072681007
+	.long	2241466466
+	.long	1046044599
+	.long	3221225472
+	.long	1072676937
+	.long	2990928271
+	.long	3193084984
+	.long	3758096384
+	.long	1072672873
+	.long	2905112743
+	.long	3192918576
+	.long	1610612736
+	.long	1072668815
+	.long	3370591264
+	.long	1046051793
+	.long	2147483648
+	.long	1072664762
+	.long	3272361216
+	.long	3193793653
+	.long	3758096384
+	.long	1072660714
+	.long	46546755
+	.long	1043206936
+	.long	3221225472
+	.long	1072656672
+	.long	3017067724
+	.long	3192177962
+	.long	0
+	.long	1072652636
+	.long	3688436631
+	.long	3192814956
+	.long	2684354560
+	.long	1072648604
+	.long	1707461992
+	.long	3193056712
+	.long	2684354560
+	.long	1072644578
+	.long	1188114540
+	.long	3193603086
+	.long	3758096384
+	.long	1072640557
+	.long	3533180564
+	.long	1045459375
+	.long	2684354560
+	.long	1072636542
+	.long	2000337630
+	.long	3193475557
+	.long	2684354560
+	.long	1072632532
+	.long	3698062443
+	.long	3193752766
+	.long	3758096384
+	.long	1072628527
+	.long	3161606138
+	.long	3190532995
+	.long	2147483648
+	.long	1072624528
+	.long	3165265478
+	.long	3193158459
+	.long	1610612736
+	.long	1072620534
+	.long	1600940077
+	.long	3193226777
+	.long	2147483648
+	.long	1072616545
+	.long	1363272552
+	.long	3192614278
+	.long	3758096384
+	.long	1072612561
+	.long	3966209910
+	.long	3191249654
+	.long	2147483648
+	.long	1072608583
+	.long	1093672789
+	.long	3190637330
+	.long	1610612736
+	.long	1072604610
+	.long	1735239357
+	.long	3192753616
+	.long	1610612736
+	.long	1072600642
+	.long	1470665156
+	.long	1045559697
+	.long	2684354560
+	.long	1072596679
+	.long	3840624926
+	.long	1045928953
+	.long	536870912
+	.long	1072592722
+	.long	4259072556
+	.long	3191035622
+	.long	3221225472
+	.long	1072588769
+	.long	3613088753
+	.long	3192165681
+	.long	2147483648
+	.long	1072584822
+	.long	3175234446
+	.long	1039486948
+	.long	1610612736
+	.long	1072580880
+	.long	856576441
+	.long	1045702812
+	.long	2147483648
+	.long	1072576943
+	.long	2253498719
+	.long	3193285334
+	.long	2684354560
+	.long	1072573011
+	.long	1587070728
+	.long	3190801577
+	.long	3758096384
+	.long	1072569084
+	.long	159986317
+	.long	1042519436
+	.long	1073741824
+	.long	1072565163
+	.long	3999541949
+	.long	3192020440
+	.long	2684354560
+	.long	1072561246
+	.long	3281310262
+	.long	1045586786
+	.long	536870912
+	.long	1072557335
+	.long	3775179406
+	.long	1045226055
+	.long	3221225472
+	.long	1072553428
+	.long	643472356
+	.long	3193681786
+	.long	1073741824
+	.long	1072549527
+	.long	248169775
+	.long	1045068977
+	.long	3758096384
+	.long	1072545630
+	.long	307016632
+	.long	1042640932
+	.long	2147483648
+	.long	1072541739
+	.long	3872718526
+	.long	3189781486
+	.long	536870912
+	.long	1072537853
+	.long	969711630
+	.long	3191724732
+	.long	3221225472
+	.long	1072533971
+	.long	4018820394
+	.long	3193189264
+	.long	1073741824
+	.long	1072530095
+	.long	3102233092
+	.long	1045510224
+	.long	3758096384
+	.long	1072526223
+	.long	1029307912
+	.long	3193812776
+	.long	1073741824
+	.long	1072522357
+	.long	984083153
+	.long	1045987403
+	.long	3221225472
+	.long	1072518495
+	.long	4171455401
+	.long	3193084080
+	.long	0
+	.long	1072514639
+	.long	2592660757
+	.long	1046121691
+	.long	1073741824
+	.long	1072510787
+	.long	2964365712
+	.long	1046054453
+	.long	2147483648
+	.long	1072506940
+	.long	3792777877
+	.long	3193704729
+	.long	2147483648
+	.long	1072503098
+	.long	2948536104
+	.long	3192467100
+	.long	1610612736
+	.long	1072499261
+	.long	3836005619
+	.long	1041873166
+	.long	536870912
+	.long	1072495429
+	.long	3124543160
+	.long	1044409168
+	.long	3221225472
+	.long	1072491601
+	.long	286227933
+	.long	1041065990
+	.long	1073741824
+	.long	1072487779
+	.long	2111296776
+	.long	3193604419
+	.long	2147483648
+	.long	1072483961
+	.long	2606822001
+	.long	3192940394
+	.long	2147483648
+	.long	1072480148
+	.long	194696800
+	.long	1046026063
+	.long	1610612736
+	.long	1072476340
+	.long	8535452
+	.long	1046200178
+	.long	536870912
+	.long	1072472537
+	.long	950463625
+	.long	3192731897
+	.long	2147483648
+	.long	1072468738
+	.long	973831566
+	.long	1045683197
+	.long	3221225472
+	.long	1072464944
+	.long	3330435892
+	.long	3190277577
+	.long	3221225472
+	.long	1072461155
+	.long	208692097
+	.long	3193517651
+	.long	1610612736
+	.long	1072457371
+	.long	2113097415
+	.long	1044781749
+	.long	3758096384
+	.long	1072453591
+	.long	1088808936
+	.long	3193716142
+	.long	0
+	.long	1072449817
+	.long	1443002127
+	.long	3193250205
+	.long	3221225472
+	.long	1072446046
+	.long	3967357419
+	.long	1046109477
+	.long	1610612736
+	.long	1072442281
+	.long	3013517861
+	.long	3193159691
+	.long	2147483648
+	.long	1072438520
+	.long	2524586286
+	.long	1046121951
+	.long	1610612736
+	.long	1072434764
+	.long	1476892861
+	.long	1046434731
+	.long	0
+	.long	1072431013
+	.long	3089640950
+	.long	3192305780
+	.long	536870912
+	.long	1072427266
+	.long	3812255529
+	.long	1045730879
+	.long	0
+	.long	1072423524
+	.long	995354762
+	.long	3191528673
+	.long	1610612736
+	.long	1072419786
+	.long	3260567684
+	.long	1046273695
+	.long	2147483648
+	.long	1072416053
+	.long	2738210286
+	.long	3191471516
+	.long	536870912
+	.long	1072412325
+	.long	1931849805
+	.long	1044560405
+	.long	1610612736
+	.long	1072408601
+	.long	358896655
+	.long	1044029237
+	.long	1073741824
+	.long	1072404882
+	.long	2214589842
+	.long	3193202126
+	.long	2684354560
+	.long	1072401167
+	.long	3118097363
+	.long	3192592906
+	.long	2147483648
+	.long	1072397457
+	.long	1835998884
+	.long	1045788247
+	.long	0
+	.long	1072393752
+	.long	1585488319
+	.long	1045289910
+	.long	0
+	.long	1072390051
+	.long	480160949
+	.long	1046030455
+	.long	2684354560
+	.long	1072386354
+	.long	1832959667
+	.long	3193013644
+	.long	2684354560
+	.long	1072382662
+	.long	3611346555
+	.long	1044544210
+	.long	1073741824
+	.long	1072378975
+	.long	2749418734
+	.long	3193712580
+	.long	1073741824
+	.long	1072375292
+	.long	2390043472
+	.long	3191710658
+	.long	3221225472
+	.long	1072371613
+	.long	2828199902
+	.long	1042265217
+	.long	3221225472
+	.long	1072367939
+	.long	569209321
+	.long	3191230982
+	.long	536870912
+	.long	1072364270
+	.long	236159139
+	.long	1046240123
+	.long	536870912
+	.long	1072360605
+	.long	1010656270
+	.long	3193813968
+	.long	1610612736
+	.long	1072356944
+	.long	2409080597
+	.long	1044025029
+	.long	536870912
+	.long	1072353288
+	.long	598419513
+	.long	1043327370
+	.long	1073741824
+	.long	1072349636
+	.long	4105950479
+	.long	1045747958
+	.long	3758096384
+	.long	1072345988
+	.long	343243853
+	.long	3192420172
+	.long	3221225472
+	.long	1072342345
+	.long	2088439530
+	.long	1046172091
+	.long	536870912
+	.long	1072338707
+	.long	4117721107
+	.long	1043882496
+	.long	3758096384
+	.long	1072335072
+	.long	3192032958
+	.long	3192998645
+	.long	3758096384
+	.long	1072331442
+	.long	2366522518
+	.long	1045401957
+	.long	1610612736
+	.long	1072327817
+	.long	3685533141
+	.long	3193701947
+	.long	536870912
+	.long	1072324196
+	.long	1058658672
+	.long	3193572492
+	.long	536870912
+	.long	1072320579
+	.long	166346347
+	.long	1045456348
+	.long	2147483648
+	.long	1072316966
+	.long	2027889772
+	.long	1046349302
+	.long	1073741824
+	.long	1072313358
+	.long	1079497888
+	.long	1044585259
+	.long	1073741824
+	.long	1072309754
+	.long	2189851573
+	.long	1045132990
+	.long	2684354560
+	.long	1072306154
+	.long	2486629386
+	.long	3193613625
+	.long	536870912
+	.long	1072302559
+	.long	1263686579
+	.long	1044789259
+	.long	0
+	.long	1072298968
+	.long	2412061798
+	.long	3191369627
+	.long	536870912
+	.long	1072295381
+	.long	584315716
+	.long	3193144135
+	.long	1610612736
+	.long	1072291798
+	.long	449000738
+	.long	1046330451
+	.long	0
+	.long	1072288220
+	.long	3938320157
+	.long	1044446220
+	.long	3758096384
+	.long	1072284645
+	.long	2949844595
+	.long	3193462371
+	.long	3758096384
+	.long	1072281075
+	.long	2771329642
+	.long	3192121593
+	.long	536870912
+	.long	1072277510
+	.long	3971508621
+	.long	3193002806
+	.long	2147483648
+	.long	1072273948
+	.long	4071942301
+	.long	1044952619
+	.long	536870912
+	.long	1072270391
+	.long	2090502395
+	.long	1044660556
+	.long	0
+	.long	1072266838
+	.long	3657520961
+	.long	3193770938
+	.long	3758096384
+	.long	1072263288
+	.long	1608175110
+	.long	1045543239
+	.long	0
+	.long	1072259744
+	.long	2506924180
+	.long	1045530501
+	.long	1073741824
+	.long	1072256203
+	.long	18238493
+	.long	1046305623
+	.long	3221225472
+	.long	1072252666
+	.long	3862640487
+	.long	3192882407
+	.long	1073741824
+	.long	1072249134
+	.long	3850158761
+	.long	1043656099
+	.long	3758096384
+	.long	1072245605
+	.long	2356524356
+	.long	1045915296
+	.long	3221225472
+	.long	1072242081
+	.long	936497287
+	.long	3193842353
+	.long	2147483648
+	.long	1072238561
+	.long	2840845344
+	.long	1046454771
+	.long	2147483648
+	.long	1072235045
+	.long	3688100713
+	.long	1044895451
+	.long	2684354560
+	.long	1072231533
+	.long	479979913
+	.long	3193842442
+	.long	2684354560
+	.long	1072228025
+	.long	1016321898
+	.long	1046251032
+	.long	3758096384
+	.long	1072224521
+	.long	562232474
+	.long	3191974558
+	.long	536870912
+	.long	1072221022
+	.long	3870512029
+	.long	3193113881
+	.long	1610612736
+	.long	1072217526
+	.long	1239780547
+	.long	3191583604
+	.long	2684354560
+	.long	1072214034
+	.long	2815421327
+	.long	1045873682
+	.long	0
+	.long	1072210547
+	.long	2371009561
+	.long	1041508792
+	.long	1610612736
+	.long	1072207063
+	.long	1304636524
+	.long	3192414284
+	.long	3221225472
+	.long	1072203583
+	.long	210144854
+	.long	3193327333
+	.long	0
+	.long	1072200108
+	.long	1454303272
+	.long	1046360024
+	.long	1610612736
+	.long	1072196636
+	.long	2095757548
+	.long	1044984677
+	.long	3221225472
+	.long	1072193168
+	.long	2027215580
+	.long	3192880933
+	.long	0
+	.long	1072189705
+	.long	214794880
+	.long	1043457954
+	.long	1073741824
+	.long	1072186245
+	.long	884624917
+	.long	1043497079
+	.long	2147483648
+	.long	1072182789
+	.long	2792396634
+	.long	3193171685
+	.long	2684354560
+	.long	1072179337
+	.long	4128995250
+	.long	3192103434
+	.long	2684354560
+	.long	1072175889
+	.long	333866043
+	.long	1046372325
+	.long	3221225472
+	.long	1072172445
+	.long	2194445544
+	.long	3193958905
+	.long	2684354560
+	.long	1072169005
+	.long	2316082269
+	.long	3192041703
+	.long	1610612736
+	.long	1072165569
+	.long	581005057
+	.long	1046322848
+	.long	536870912
+	.long	1072162137
+	.long	3280786513
+	.long	1045457251
+	.long	3221225472
+	.long	1072158708
+	.long	2567093361
+	.long	1044710359
+	.long	1073741824
+	.long	1072155284
+	.long	3740443584
+	.long	1044224237
+	.long	2684354560
+	.long	1072151863
+	.long	3981028272
+	.long	1042596351
+	.long	3758096384
+	.long	1072148446
+	.long	3820011120
+	.long	3191915623
+	.long	0
+	.long	1072145034
+	.long	2946439484
+	.long	3193831276
+	.long	3758096384
+	.long	1072141624
+	.long	3075274422
+	.long	3190132432
+	.long	2684354560
+	.long	1072138219
+	.long	496052167
+	.long	1043619760
+	.long	1073741824
+	.long	1072134818
+	.long	271106589
+	.long	3192265149
+	.long	2684354560
+	.long	1072131420
+	.long	2091955684
+	.long	1044443554
+	.long	3758096384
+	.long	1072128026
+	.long	723240109
+	.long	3191007419
+	.long	3758096384
+	.long	1072124636
+	.long	1748629070
+	.long	1044510075
+	.long	3221225472
+	.long	1072121250
+	.long	3289522046
+	.long	3193095178
+	.long	1610612736
+	.long	1072117868
+	.long	3599052146
+	.long	3193720427
+	.long	3221225472
+	.long	1072114489
+	.long	2446758135
+	.long	3193436303
+	.long	3758096384
+	.long	1072111114
+	.long	1652171097
+	.long	3192137173
+	.long	3221225472
+	.long	1072107743
+	.long	1353007155
+	.long	1044523902
+	.long	1610612736
+	.long	1072104376
+	.long	990601105
+	.long	1046296663
+	.long	3758096384
+	.long	1072101012
+	.long	2228627618
+	.long	3193041040
+	.long	0
+	.long	1072097653
+	.long	812484756
+	.long	3191950723
+	.long	3758096384
+	.long	1072094296
+	.long	817833130
+	.long	3192279242
+	.long	2147483648
+	.long	1072090944
+	.long	3563228521
+	.long	3193810951
+	.long	3221225472
+	.long	1072087595
+	.long	2729108859
+	.long	3190936185
+	.long	3221225472
+	.long	1072084250
+	.long	2249121662
+	.long	3190639690
+	.long	2147483648
+	.long	1072080909
+	.long	4082471745
+	.long	3193929368
+	.long	3758096384
+	.long	1072077571
+	.long	2827323806
+	.long	3193708561
+	.long	3758096384
+	.long	1072074237
+	.long	735866167
+	.long	1042434690
+	.long	2684354560
+	.long	1072070907
+	.long	3240808889
+	.long	3191918422
+	.long	0
+	.long	1072067581
+	.long	466482777
+	.long	3186962221
+	.long	0
+	.long	1072064258
+	.long	1576076296
+	.long	1045849056
+	.long	3221225472
+	.long	1072060938
+	.long	2751923560
+	.long	3191910703
+	.long	0
+	.long	1072057623
+	.long	1908755527
+	.long	1046437515
+	.long	0
+	.long	1072054311
+	.long	3175841411
+	.long	1044572886
+	.long	2684354560
+	.long	1072051002
+	.long	1633258450
+	.long	3192670420
+	.long	3221225472
+	.long	1072047697
+	.long	1867746657
+	.long	1045726209
+	.long	2684354560
+	.long	1072044396
+	.long	338968864
+	.long	3193084662
+	.long	0
+	.long	1072041099
+	.long	1501742471
+	.long	3191742031
+	.long	0
+	.long	1072037805
+	.long	4266775786
+	.long	3192686970
+	.long	2147483648
+	.long	1072034514
+	.long	4249283553
+	.long	1045769728
+	.long	2684354560
+	.long	1072031227
+	.long	2758366873
+	.long	1046402161
+	.long	1610612736
+	.long	1072027944
+	.long	2161186990
+	.long	1044736865
+	.long	2684354560
+	.long	1072024664
+	.long	810300171
+	.long	1045748777
+	.long	2147483648
+	.long	1072021388
+	.long	183688927
+	.long	3191515581
+	.long	3758096384
+	.long	1072018115
+	.long	368874072
+	.long	3192363575
+	.long	3221225472
+	.long	1072014846
+	.long	2459092970
+	.long	1041794640
+	.long	536870912
+	.long	1072011581
+	.long	867488640
+	.long	1046310291
+	.long	536870912
+	.long	1072008319
+	.long	50140871
+	.long	1043327329
+	.long	2684354560
+	.long	1072005060
+	.long	1241902518
+	.long	3192739252
+	.long	2684354560
+	.long	1072001805
+	.long	1027881659
+	.long	3193858388
+	.long	0
+	.long	1071998554
+	.long	38457322
+	.long	1045489179
+	.long	0
+	.long	1071995306
+	.long	3432963337
+	.long	3190969347
+	.long	1610612736
+	.long	1071992061
+	.long	534931792
+	.long	1046302734
+	.long	1610612736
+	.long	1071988820
+	.long	1817895268
+	.long	3192551860
+	.long	3221225472
+	.long	1071985582
+	.long	357237383
+	.long	3191870833
+	.long	2684354560
+	.long	1071982348
+	.long	108262401
+	.long	3193365867
+	.long	3758096384
+	.long	1071979117
+	.long	1964729244
+	.long	1042502249
+	.long	2684354560
+	.long	1071975890
+	.long	2088446957
+	.long	1038010503
+	.long	3221225472
+	.long	1071972666
+	.long	2947239447
+	.long	1046377845
+	.long	1610612736
+	.long	1071969446
+	.long	774932072
+	.long	1046064854
+	.long	2147483648
+	.long	1071966229
+	.long	4080937590
+	.long	3193041284
+	.long	3758096384
+	.long	1071963015
+	.long	2208251454
+	.long	1045945089
+	.long	3221225472
+	.long	1071959805
+	.long	2850924475
+	.long	1045650959
+	.long	0
+	.long	1071956599
+	.long	714040997
+	.long	1046275153
+	.long	3221225472
+	.long	1071953395
+	.long	85533782
+	.long	3192816920
+	.long	3221225472
+	.long	1071950195
+	.long	1252511005
+	.long	1044805706
+	.long	1073741824
+	.long	1071946999
+	.long	2384659038
+	.long	3193391602
+	.long	0
+	.long	1071943806
+	.long	416481813
+	.long	1043730233
+	.long	536870912
+	.long	1071940616
+	.long	1675424499
+	.long	1046348030
+	.long	3221225472
+	.long	1071937429
+	.long	1175989513
+	.long	3193009113
+	.long	2684354560
+	.long	1071934246
+	.long	2400084650
+	.long	3192451713
+	.long	3758096384
+	.long	1071931066
+	.long	1467335692
+	.long	3193350868
+	.long	1610612736
+	.long	1071927890
+	.long	266493801
+	.long	1044954481
+	.long	1073741824
+	.long	1071924717
+	.long	3919093445
+	.long	1046023575
+	.long	2147483648
+	.long	1071921547
+	.long	3017408483
+	.long	1044880828
+	.long	536870912
+	.long	1071918381
+	.long	948849966
+	.long	3193892224
+	.long	3758096384
+	.long	1071915217
+	.long	1870232600
+	.long	1045777228
+	.long	536870912
+	.long	1071912058
+	.long	822381492
+	.long	3193639186
+	.long	2147483648
+	.long	1071908901
+	.long	788243705
+	.long	1044966343
+	.long	1073741824
+	.long	1071905748
+	.long	1344278809
+	.long	1044428545
+	.long	1073741824
+	.long	1071902598
+	.long	172864300
+	.long	1045765608
+	.long	2684354560
+	.long	1071899451
+	.long	211555467
+	.long	3192963574
+	.long	536870912
+	.long	1071896308
+	.long	3373438023
+	.long	1045643168
+	.long	0
+	.long	1071893168
+	.long	2867180960
+	.long	3189945998
+	.long	536870912
+	.long	1071890031
+	.long	36724362
+	.long	3193240584
+	.long	1610612736
+	.long	1071886897
+	.long	2140176984
+	.long	1045945349
+	.long	0
+	.long	1071883767
+	.long	436842360
+	.long	1040712587
+	.long	3758096384
+	.long	1071880639
+	.long	1225147329
+	.long	3193814594
+	.long	3758096384
+	.long	1071877515
+	.long	1586157348
+	.long	3191614322
+	.long	536870912
+	.long	1071874395
+	.long	3329332918
+	.long	1041699791
+	.long	2684354560
+	.long	1071871277
+	.long	1635968041
+	.long	3191783756
+	.long	1073741824
+	.long	1071868163
+	.long	2876158382
+	.long	1046097093
+	.long	1073741824
+	.long	1071865052
+	.long	4267556964
+	.long	3193723000
+	.long	1073741824
+	.long	1071861944
+	.long	195475940
+	.long	1045520795
+	.long	2147483648
+	.long	1071858839
+	.long	2239193514
+	.long	1046478675
+	.long	0
+	.long	1071855738
+	.long	4168275596
+	.long	1044926285
+	.long	2684354560
+	.long	1071852639
+	.long	142514114
+	.long	1045595182
+	.long	2147483648
+	.long	1071849544
+	.long	1943457984
+	.long	3192930015
+	.long	2147483648
+	.long	1071846452
+	.long	202659489
+	.long	3193926317
+	.long	2684354560
+	.long	1071843363
+	.long	2208408789
+	.long	3193857484
+	.long	3758096384
+	.long	1071840277
+	.long	2237297552
+	.long	3192939576
+	.long	1073741824
+	.long	1071837195
+	.long	2726920839
+	.long	1044193954
+	.long	3758096384
+	.long	1071834115
+	.long	2337732207
+	.long	3193611773
+	.long	2147483648
+	.long	1071831039
+	.long	1390088602
+	.long	1044000317
+	.long	1610612736
+	.long	1071827966
+	.long	3806188736
+	.long	3193463913
+	.long	1073741824
+	.long	1071824896
+	.long	1795276560
+	.long	1043671965
+	.long	1073741824
+	.long	1071821829
+	.long	2960792799
+	.long	1046240474
+	.long	2147483648
+	.long	1071818765
+	.long	3350591592
+	.long	3193333939
+	.long	3221225472
+	.long	1071815704
+	.long	408870754
+	.long	3193322854
+	.long	0
+	.long	1071812647
+	.long	4146717132
+	.long	1046063520
+	.long	2147483648
+	.long	1071809592
+	.long	1681114919
+	.long	3192114313
+	.long	0
+	.long	1071806541
+	.long	1098393137
+	.long	3190846732
+	.long	2684354560
+	.long	1071803492
+	.long	2437484983
+	.long	3193448718
+	.long	1073741824
+	.long	1071800447
+	.long	1036809185
+	.long	3192023501
+	.long	0
+	.long	1071797405
+	.long	659668848
+	.long	3193596312
+	.long	3221225472
+	.long	1071794365
+	.long	1112062459
+	.long	3192773376
+	.long	2147483648
+	.long	1071791329
+	.long	4082956335
+	.long	1045830513
+	.long	1610612736
+	.long	1071788296
+	.long	2387089965
+	.long	1045532601
+	.long	1610612736
+	.long	1071785266
+	.long	1522101980
+	.long	3193941957
+	.long	1073741824
+	.long	1071782239
+	.long	2157197585
+	.long	3188193305
+	.long	1073741824
+	.long	1071779215
+	.long	946810220
+	.long	3193223819
+	.long	1073741824
+	.long	1071776194
+	.long	4069942444
+	.long	3193878549
+	.long	536870912
+	.long	1071773176
+	.long	1693463440
+	.long	1046360588
+	.long	536870912
+	.long	1071770161
+	.long	1954543254
+	.long	1046409381
+	.long	1073741824
+	.long	1071767149
+	.long	1050471249
+	.long	3193933095
+	.long	536870912
+	.long	1071764140
+	.long	1256240478
+	.long	1046456865
+	.long	536870912
+	.long	1071761134
+	.long	676764254
+	.long	1046055503
+	.long	536870912
+	.long	1071758131
+	.long	1421032967
+	.long	1044779786
+	.long	536870912
+	.long	1071755131
+	.long	38735992
+	.long	3192766355
+	.long	0
+	.long	1071752134
+	.long	2960669690
+	.long	1044484680
+	.long	3758096384
+	.long	1071749139
+	.long	788707382
+	.long	1045299895
+	.long	3221225472
+	.long	1071746148
+	.long	685689300
+	.long	1040778831
+	.long	2147483648
+	.long	1071743160
+	.long	1170994182
+	.long	1046159174
+	.long	1073741824
+	.long	1071740175
+	.long	64591436
+	.long	1046153849
+	.long	0
+	.long	1071737193
+	.long	2338031659
+	.long	3189997702
+	.long	2684354560
+	.long	1071734213
+	.long	1941624568
+	.long	3186752676
+	.long	536870912
+	.long	1071731237
+	.long	1401255580
+	.long	1046383990
+	.long	2684354560
+	.long	1071728263
+	.long	376888427
+	.long	1045896456
+	.long	536870912
+	.long	1071725293
+	.long	2831424639
+	.long	3193539109
+	.long	1610612736
+	.long	1071722325
+	.long	3303123696
+	.long	1044599415
+	.long	2684354560
+	.long	1071719360
+	.long	1077295329
+	.long	3189877372
+	.long	3221225472
+	.long	1071716398
+	.long	1434061099
+	.long	3184529771
+	.long	3221225472
+	.long	1071713439
+	.long	2104991590
+	.long	1045062074
+	.long	3221225472
+	.long	1071710483
+	.long	722060869
+	.long	3193788526
+	.long	536870912
+	.long	1071704580
+	.long	3928796486
+	.long	1046129020
+	.long	536870912
+	.long	1071698688
+	.long	588844628
+	.long	1045492135
+	.long	2684354560
+	.long	1071692807
+	.long	326739366
+	.long	3193004445
+	.long	1610612736
+	.long	1071686938
+	.long	2456436042
+	.long	1046278169
+	.long	2684354560
+	.long	1071681080
+	.long	2831303512
+	.long	1043670046
+	.long	536870912
+	.long	1071675234
+	.long	607223418
+	.long	1045507322
+	.long	0
+	.long	1071669399
+	.long	4254921332
+	.long	3193290483
+	.long	0
+	.long	1071663575
+	.long	914994333
+	.long	3191263853
+	.long	1073741824
+	.long	1071657762
+	.long	4147050180
+	.long	3193228552
+	.long	2684354560
+	.long	1071651960
+	.long	594554157
+	.long	3193503935
+	.long	0
+	.long	1071646170
+	.long	1062846796
+	.long	1045944331
+	.long	1073741824
+	.long	1071636109
+	.long	2909238893
+	.long	3193436884
+	.long	1073741824
+	.long	1071624572
+	.long	1682918119
+	.long	1042211899
+	.long	1073741824
+	.long	1071613057
+	.long	2419209426
+	.long	1045437062
+	.long	1073741824
+	.long	1071601564
+	.long	2951341321
+	.long	3190193214
+	.long	0
+	.long	1071590093
+	.long	3084900875
+	.long	3192394907
+	.long	1073741824
+	.long	1071578643
+	.long	999567454
+	.long	1046433447
+	.long	2147483648
+	.long	1071567215
+	.long	1570101857
+	.long	3193291160
+	.long	0
+	.long	1071555809
+	.long	1080647881
+	.long	3185154585
+	.long	0
+	.long	1071544424
+	.long	3526309177
+	.long	1044843640
+	.long	2147483648
+	.long	1071533060
+	.long	2213463349
+	.long	3191738930
+	.long	1073741824
+	.long	1071521718
+	.long	1039925195
+	.long	3192618353
+	.long	1073741824
+	.long	1071510397
+	.long	2115757280
+	.long	3193671567
+	.long	1073741824
+	.long	1071499097
+	.long	1188751495
+	.long	3191145560
+	.long	2147483648
+	.long	1071487818
+	.long	3983461449
+	.long	3193897029
+	.long	2147483648
+	.long	1071476560
+	.long	782141500
+	.long	1042879962
+	.long	2147483648
+	.long	1071465323
+	.long	4038904626
+	.long	1045063881
+	.long	2147483648
+	.long	1071454107
+	.long	2613036921
+	.long	3193217642
+	.long	0
+	.long	1071442912
+	.long	2095723435
+	.long	1044629175
+	.long	1073741824
+	.long	1071431737
+	.long	3879795974
+	.long	1045767874
+	.long	1073741824
+	.long	1071420583
+	.long	2662198042
+	.long	3191434637
+	.long	3221225472
+	.long	1071409449
+	.long	4037605722
+	.long	3193703090
+	.long	2147483648
+	.long	1071398336
+	.long	1860331835
+	.long	1040814822
+	.long	3221225472
+	.long	1071387243
+	.long	1522972033
+	.long	3190305974
+	.long	1073741824
+	.long	1071376171
+	.long	2361534207
+	.long	1043699366
+	.long	0
+	.long	1071365119
+	.long	4180309179
+	.long	1044142099
+	.long	0
+	.long	1071354087
+	.long	1201038528
+	.long	3192968772
+	.long	0
+	.long	1071343075
+	.long	1342478171
+	.long	3193251215
+	.long	0
+	.long	1071332083
+	.long	3836883348
+	.long	3193472007
+	.long	3221225472
+	.long	1071321110
+	.long	3864874250
+	.long	1045593126
+	.long	2147483648
+	.long	1071310158
+	.long	2169494998
+	.long	1046045346
+	.long	1073741824
+	.long	1071299226
+	.long	3785165075
+	.long	3193319246
+	.long	2147483648
+	.long	1071288313
+	.long	1137692678
+	.long	3192716779
+	.long	1073741824
+	.long	1071277420
+	.long	1752107598
+	.long	1046366120
+	.long	3221225472
+	.long	1071266546
+	.long	1912656912
+	.long	1046352281
+	.long	3221225472
+	.long	1071255692
+	.long	2882676334
+	.long	1046406353
+	.long	1073741824
+	.long	1071244858
+	.long	963612460
+	.long	1045282811
+	.long	0
+	.long	1071234043
+	.long	3811255773
+	.long	1046231636
+	.long	1073741824
+	.long	1071223247
+	.long	1126055989
+	.long	3192224037
+	.long	2147483648
+	.long	1071212470
+	.long	2079145427
+	.long	1044432413
+	.long	0
+	.long	1071201713
+	.long	3611595621
+	.long	1043358745
+	.long	2147483648
+	.long	1071190974
+	.long	390522769
+	.long	1045888252
+	.long	1073741824
+	.long	1071180255
+	.long	4087939723
+	.long	3192930745
+	.long	3221225472
+	.long	1071169554
+	.long	1451494480
+	.long	3190219274
+	.long	1073741824
+	.long	1071158873
+	.long	427176194
+	.long	3193042022
+	.long	2147483648
+	.long	1071148210
+	.long	1882381948
+	.long	3192727946
+	.long	2147483648
+	.long	1071137566
+	.long	3736313771
+	.long	3192087019
+	.long	1073741824
+	.long	1071126941
+	.long	1560398816
+	.long	3193185715
+	.long	2147483648
+	.long	1071116334
+	.long	1021942441
+	.long	1041526696
+	.long	2147483648
+	.long	1071105746
+	.long	3517080249
+	.long	3193576041
+	.long	3221225472
+	.long	1071095176
+	.long	2248589878
+	.long	1044527624
+	.long	2147483648
+	.long	1071084625
+	.long	2412896695
+	.long	1046112867
+	.long	3221225472
+	.long	1071074092
+	.long	3834725738
+	.long	1044562378
+	.long	1073741824
+	.long	1071063578
+	.long	1150920407
+	.long	1043768986
+	.long	0
+	.long	1071053082
+	.long	1379393428
+	.long	3188690690
+	.long	0
+	.long	1071042604
+	.long	3058183278
+	.long	3193617655
+	.long	0
+	.long	1071032144
+	.long	421133665
+	.long	3193417186
+	.long	0
+	.long	1071021702
+	.long	2860161357
+	.long	3191816125
+	.long	0
+	.long	1071011278
+	.long	1742405964
+	.long	1043580240
+	.long	0
+	.long	1071000872
+	.long	2821215927
+	.long	3188984273
+	.long	3221225472
+	.long	1070990483
+	.long	510275597
+	.long	1045813401
+	.long	2147483648
+	.long	1070980113
+	.long	304266588
+	.long	3191193536
+	.long	3221225472
+	.long	1070969760
+	.long	1854784211
+	.long	1046302073
+	.long	0
+	.long	1070959426
+	.long	3773082854
+	.long	3193008899
+	.long	2147483648
+	.long	1070949108
+	.long	3003572392
+	.long	1046404879
+	.long	3221225472
+	.long	1070938808
+	.long	1702149204
+	.long	1046407257
+	.long	2147483648
+	.long	1070928526
+	.long	3935314439
+	.long	1046438280
+	.long	3221225472
+	.long	1070918261
+	.long	2677087609
+	.long	1045501749
+	.long	2147483648
+	.long	1070908014
+	.long	4190598039
+	.long	3193640515
+	.long	1073741824
+	.long	1070897784
+	.long	368874072
+	.long	1044879927
+	.long	2147483648
+	.long	1070887571
+	.long	3584052697
+	.long	3192024662
+	.long	3221225472
+	.long	1070877375
+	.long	3762307829
+	.long	1045886918
+	.long	1073741824
+	.long	1070867197
+	.long	495710920
+	.long	1046317072
+	.long	0
+	.long	1070857036
+	.long	2292768238
+	.long	3190887508
+	.long	3221225472
+	.long	1070846891
+	.long	1044078151
+	.long	3193772914
+	.long	1073741824
+	.long	1070836764
+	.long	3266010457
+	.long	1043443755
+	.long	3221225472
+	.long	1070826653
+	.long	3571665822
+	.long	1045547823
+	.long	1073741824
+	.long	1070816560
+	.long	393348347
+	.long	3190525143
+	.long	2147483648
+	.long	1070806483
+	.long	4241722498
+	.long	3192084193
+	.long	2147483648
+	.long	1070796423
+	.long	1693797068
+	.long	3192807972
+	.long	0
+	.long	1070786380
+	.long	2860086745
+	.long	1046331646
+	.long	2147483648
+	.long	1070776353
+	.long	1366141759
+	.long	3192979363
+	.long	1073741824
+	.long	1070766343
+	.long	737899283
+	.long	1045853346
+	.long	3221225472
+	.long	1070756349
+	.long	88734873
+	.long	1043881257
+	.long	3221225472
+	.long	1070746372
+	.long	1438003315
+	.long	3192917101
+	.long	0
+	.long	1070736412
+	.long	1066505530
+	.long	1043896695
+	.long	3221225472
+	.long	1070726467
+	.long	2706653041
+	.long	3191113643
+	.long	3221225472
+	.long	1070716539
+	.long	1321764476
+	.long	1039573724
+	.long	0
+	.long	1070706628
+	.long	1126753211
+	.long	1044502976
+	.long	2147483648
+	.long	1070696732
+	.long	773642884
+	.long	1044110727
+	.long	1073741824
+	.long	1070686853
+	.long	1263743406
+	.long	3193115278
+	.long	0
+	.long	1070676990
+	.long	3115237732
+	.long	3193089176
+	.long	3221225472
+	.long	1070667142
+	.long	3642626838
+	.long	3191146032
+	.long	2147483648
+	.long	1070657311
+	.long	2091696428
+	.long	1044337177
+	.long	1073741824
+	.long	1070647496
+	.long	3168958391
+	.long	1044197568
+	.long	0
+	.long	1070637697
+	.long	711148669
+	.long	3193181047
+	.long	2147483648
+	.long	1070627913
+	.long	4207182773
+	.long	3193402092
+	.long	3221225472
+	.long	1070618145
+	.long	918070640
+	.long	3192902845
+	.long	3221225472
+	.long	1070608393
+	.long	3135571447
+	.long	3192193928
+	.long	2147483648
+	.long	1070598657
+	.long	1043705517
+	.long	3193188604
+	.long	2147483648
+	.long	1070581777
+	.long	1886680492
+	.long	1043890286
+	.long	2147483648
+	.long	1070562367
+	.long	3373799420
+	.long	3191917802
+	.long	2147483648
+	.long	1070542988
+	.long	2919618025
+	.long	3192461752
+	.long	2147483648
+	.long	1070523640
+	.long	2926365158
+	.long	3193113492
+	.long	0
+	.long	1070504323
+	.long	519978638
+	.long	1045918846
+	.long	0
+	.long	1070485037
+	.long	3665353151
+	.long	3193546248
+	.long	0
+	.long	1070465781
+	.long	2327718958
+	.long	1045050797
+	.long	0
+	.long	1070446556
+	.long	345326861
+	.long	3188224716
+	.long	2147483648
+	.long	1070427361
+	.long	2263747488
+	.long	3192871328
+	.long	0
+	.long	1070408197
+	.long	3894192264
+	.long	1045693123
+	.long	0
+	.long	1070389063
+	.long	994321593
+	.long	1046347203
+	.long	2147483648
+	.long	1070369959
+	.long	3540366700
+	.long	1042296230
+	.long	0
+	.long	1070350886
+	.long	966420752
+	.long	3192400412
+	.long	2147483648
+	.long	1070331842
+	.long	1954511160
+	.long	3193467762
+	.long	2147483648
+	.long	1070312828
+	.long	1875003040
+	.long	1045485629
+	.long	0
+	.long	1070293845
+	.long	4003372005
+	.long	3193714109
+	.long	2147483648
+	.long	1070274890
+	.long	2216083644
+	.long	1045720399
+	.long	0
+	.long	1070255966
+	.long	1240985743
+	.long	1045879414
+	.long	0
+	.long	1070237071
+	.long	1573064162
+	.long	1046427916
+	.long	0
+	.long	1070218206
+	.long	2500166582
+	.long	3193848169
+	.long	2147483648
+	.long	1070199369
+	.long	862131539
+	.long	1045606065
+	.long	0
+	.long	1070180563
+	.long	3733427622
+	.long	3193545988
+	.long	0
+	.long	1070161785
+	.long	124515358
+	.long	1045504766
+	.long	2147483648
+	.long	1070143036
+	.long	689228007
+	.long	1044238436
+	.long	0
+	.long	1070124317
+	.long	976284835
+	.long	3189879978
+	.long	2147483648
+	.long	1070105626
+	.long	2997446224
+	.long	3193394244
+	.long	2147483648
+	.long	1070086964
+	.long	594985163
+	.long	3190453447
+	.long	2147483648
+	.long	1070068331
+	.long	3634411091
+	.long	3193012662
+	.long	0
+	.long	1070049727
+	.long	841316482
+	.long	3192551604
+	.long	0
+	.long	1070031151
+	.long	518949849
+	.long	3189505693
+	.long	2147483648
+	.long	1070012603
+	.long	207633604
+	.long	1043791305
+	.long	2147483648
+	.long	1069994084
+	.long	925415631
+	.long	3189658670
+	.long	2147483648
+	.long	1069975593
+	.long	3348775015
+	.long	1046231055
+	.long	0
+	.long	1069957131
+	.long	4137593961
+	.long	1045760644
+	.long	2147483648
+	.long	1069938696
+	.long	3081207972
+	.long	1046319652
+	.long	2147483648
+	.long	1069920290
+	.long	2912811806
+	.long	3193250863
+	.long	0
+	.long	1069901912
+	.long	1704663230
+	.long	3192651171
+	.long	2147483648
+	.long	1069883561
+	.long	1726887473
+	.long	3193427817
+	.long	2147483648
+	.long	1069865238
+	.long	516302873
+	.long	1042556919
+	.long	2147483648
+	.long	1069846943
+	.long	3737277289
+	.long	3192083505
+	.long	0
+	.long	1069828676
+	.long	2829909067
+	.long	3191628520
+	.long	0
+	.long	1069810436
+	.long	3474800299
+	.long	3187384991
+	.long	2147483648
+	.long	1069792223
+	.long	2041291754
+	.long	3186735048
+	.long	2147483648
+	.long	1069774038
+	.long	3100739290
+	.long	3192991951
+	.long	2147483648
+	.long	1069755880
+	.long	2641686866
+	.long	1042449846
+	.long	0
+	.long	1069737750
+	.long	1353612457
+	.long	3192928544
+	.long	2147483648
+	.long	1069719646
+	.long	1823398190
+	.long	3193125156
+	.long	0
+	.long	1069701570
+	.long	2629108558
+	.long	3192983089
+	.long	2147483648
+	.long	1069683520
+	.long	314889080
+	.long	3193178947
+	.long	2147483648
+	.long	1069665497
+	.long	3426846470
+	.long	1046055034
+	.long	0
+	.long	1069647502
+	.long	2451521798
+	.long	3193081447
+	.long	2147483648
+	.long	1069629532
+	.long	963200030
+	.long	1046315089
+	.long	0
+	.long	1069611590
+	.long	3644976987
+	.long	1046450297
+	.long	2147483648
+	.long	1069593674
+	.long	1514045874
+	.long	3193337489
+	.long	0
+	.long	1069575785
+	.long	2640752615
+	.long	3192734715
+	.long	0
+	.long	1069557922
+	.long	177381730
+	.long	3193107348
+	.long	0
+	.long	1069532650
+	.long	546871269
+	.long	1045601847
+	.long	0
+	.long	1069497029
+	.long	2220408187
+	.long	1045964849
+	.long	0
+	.long	1069461461
+	.long	3101209784
+	.long	3192417098
+	.long	0
+	.long	1069425944
+	.long	3768825782
+	.long	1046196178
+	.long	0
+	.long	1069390480
+	.long	737308942
+	.long	1043872555
+	.long	0
+	.long	1069355068
+	.long	1944808119
+	.long	3193362317
+	.long	0
+	.long	1069319707
+	.long	852406261
+	.long	3191004250
+	.long	0
+	.long	1069284398
+	.long	3202370743
+	.long	3192549796
+	.long	0
+	.long	1069249140
+	.long	900633975
+	.long	1043862575
+	.long	0
+	.long	1069213934
+	.long	3417168564
+	.long	3193213168
+	.long	0
+	.long	1069178778
+	.long	2513309972
+	.long	1046051953
+	.long	0
+	.long	1069143674
+	.long	1836846968
+	.long	1044036653
+	.long	0
+	.long	1069108621
+	.long	675391362
+	.long	3193334972
+	.long	0
+	.long	1069073618
+	.long	1859398086
+	.long	3191668729
+	.long	0
+	.long	1069038666
+	.long	3835994043
+	.long	3193252196
+	.long	0
+	.long	1069003764
+	.long	563337246
+	.long	3192060530
+	.long	0
+	.long	1068968912
+	.long	3715154210
+	.long	1045592716
+	.long	0
+	.long	1068934111
+	.long	51415636
+	.long	3192193939
+	.long	0
+	.long	1068899359
+	.long	822049108
+	.long	1045846080
+	.long	0
+	.long	1068864658
+	.long	3739043340
+	.long	3193184949
+	.long	0
+	.long	1068830006
+	.long	2500828997
+	.long	3193115638
+	.long	0
+	.long	1068795403
+	.long	1479335089
+	.long	1045458233
+	.long	0
+	.long	1068760850
+	.long	1914098598
+	.long	1045079833
+	.long	0
+	.long	1068726346
+	.long	1470374909
+	.long	1046125471
+	.long	0
+	.long	1068691892
+	.long	2048101185
+	.long	3192960024
+	.long	0
+	.long	1068657486
+	.long	801101802
+	.long	1042523454
+	.long	0
+	.long	1068623129
+	.long	412171467
+	.long	1044799425
+	.long	0
+	.long	1068588821
+	.long	2124566049
+	.long	1040459843
+	.long	0
+	.long	1068554561
+	.long	2087558263
+	.long	1046083102
+	.long	0
+	.long	1068520350
+	.long	290389316
+	.long	1045220023
+	.long	0
+	.long	1068473430
+	.long	393737815
+	.long	1045770085
+	.long	0
+	.long	1068405202
+	.long	3273111658
+	.long	3193594336
+	.long	0
+	.long	1068337068
+	.long	3076935419
+	.long	3191993934
+	.long	0
+	.long	1068269030
+	.long	1564279721
+	.long	1040713632
+	.long	0
+	.long	1068201088
+	.long	1950103787
+	.long	3191285473
+	.long	0
+	.long	1068133240
+	.long	111301617
+	.long	1046140470
+	.long	0
+	.long	1068065488
+	.long	2740933659
+	.long	1046091898
+	.long	0
+	.long	1067997832
+	.long	1267131462
+	.long	3192947024
+	.long	0
+	.long	1067930268
+	.long	629787343
+	.long	1045599114
+	.long	0
+	.long	1067862800
+	.long	2943029746
+	.long	3191100621
+	.long	0
+	.long	1067795426
+	.long	2538631151
+	.long	3193953989
+	.long	0
+	.long	1067728144
+	.long	3881795033
+	.long	3191377363
+	.long	0
+	.long	1067660956
+	.long	2752747058
+	.long	3186250103
+	.long	0
+	.long	1067593862
+	.long	892170014
+	.long	3193330390
+	.long	0
+	.long	1067526860
+	.long	2000985783
+	.long	3192968647
+	.long	0
+	.long	1067459950
+	.long	1954077304
+	.long	1044399908
+	.long	0
+	.long	1067335900
+	.long	4120702847
+	.long	3193150730
+	.long	0
+	.long	1067202448
+	.long	353489980
+	.long	1045676744
+	.long	0
+	.long	1067069184
+	.long	2609643324
+	.long	3192108001
+	.long	0
+	.long	1066936100
+	.long	2904433317
+	.long	1044836541
+	.long	0
+	.long	1066803200
+	.long	319656790
+	.long	1044863904
+	.long	0
+	.long	1066670484
+	.long	2407987331
+	.long	3192995083
+	.long	0
+	.long	1066537948
+	.long	2437746120
+	.long	3193127733
+	.long	0
+	.long	1066405592
+	.long	762570215
+	.long	3189946997
+	.long	0
+	.long	1066145040
+	.long	3317159694
+	.long	1046060125
+	.long	0
+	.long	1065881056
+	.long	2317845886
+	.long	3191679176
+	.long	0
+	.long	1065617424
+	.long	3665195816
+	.long	1045633853
+	.long	0
+	.long	1065354160
+	.long	2008730355
+	.long	3193898211
+	.long	0
+	.long	1064829264
+	.long	3746236192
+	.long	1046121471
+	.long	0
+	.long	1064303680
+	.long	885296753
+	.long	3191852441
+	.long	0
+	.long	1063253696
+	.long	449976495
+	.long	3192682663
+	.long	0
+	.long	0
+	.long	0
+	.long	2147483648
+	.long	0
+	.long	4294965248
+	.long	0
+	.long	4294965248
+	.long	0
+	.long	1073160192
+	.long	370913857
+	.long	3210587105
+	.long	1841914130
+	.long	3213059448
+	.long	3995341938
+	.long	3214607105
+	.long	2677381210
+	.long	3216320731
+	.long	3011779882
+	.long	3218479542
+	.long	1367832035
+	.long	1066403058
+	.long	2894285243
+	.long	1067936923
+	.long	1215221452
+	.long	1069835102
+	.long	370913857
+	.long	3210587105
+	.long	2677381210
+	.long	3216320731
+	.long	4172642429
+	.long	1056068382
+	.long	1215221451
+	.long	1069835102
+	.long	1092638156
+	.long	3184925618
+	.long	0
+	.long	4294967288
+	.long	0
+	.long	4294967295
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	997195776
+	.long	4200250559
+	.long	1072696090
+	.long	2808127345
+	.long	3162830514
+	.long	2851812149
+	.long	1072698941
+	.long	2595802551
+	.long	1016815913
+	.long	339411585
+	.long	1072701800
+	.long	264588982
+	.long	3162685233
+	.long	1048019041
+	.long	1072704666
+	.long	1398474845
+	.long	3161559171
+	.long	772914124
+	.long	1072707540
+	.long	4004372762
+	.long	1013278737
+	.long	3899555717
+	.long	1072710421
+	.long	427280750
+	.long	3163595548
+	.long	1928746161
+	.long	1072713311
+	.long	983617676
+	.long	1015333753
+	.long	3541402996
+	.long	1072716208
+	.long	2759177317
+	.long	1015903202
+	.long	238821257
+	.long	1072719114
+	.long	1469694871
+	.long	3163933563
+	.long	702412510
+	.long	1072722027
+	.long	3803266087
+	.long	3163328991
+	.long	728934454
+	.long	1072724948
+	.long	1413842688
+	.long	1015227188
+	.long	410360776
+	.long	1072727877
+	.long	1269990655
+	.long	1013024446
+	.long	4133881824
+	.long	1072730813
+	.long	2148155345
+	.long	3163979875
+	.long	3402036099
+	.long	1072733758
+	.long	405889334
+	.long	1016154232
+	.long	2602514713
+	.long	1072736711
+	.long	2268929336
+	.long	1015402860
+	.long	1828292879
+	.long	1072739672
+	.long	1255956747
+	.long	1016636974
+	.long	1172597893
+	.long	1072742641
+	.long	114433263
+	.long	1016396169
+	.long	728909815
+	.long	1072745618
+	.long	383930225
+	.long	1016078044
+	.long	590962156
+	.long	1072748603
+	.long	3829346666
+	.long	3164324173
+	.long	852742562
+	.long	1072751596
+	.long	667253586
+	.long	1010842135
+	.long	1608493509
+	.long	1072754597
+	.long	3159622171
+	.long	3163856313
+	.long	2952712987
+	.long	1072757606
+	.long	3293494651
+	.long	3161168877
+	.long	685187902
+	.long	1072760624
+	.long	378731989
+	.long	1015891691
+	.long	3490863953
+	.long	1072763649
+	.long	960797498
+	.long	3163997456
+	.long	2875075254
+	.long	1072766683
+	.long	4144233330
+	.long	3164382292
+	.long	3228316108
+	.long	1072769725
+	.long	3010241991
+	.long	3159471380
+	.long	351405227
+	.long	1072772776
+	.long	3125337328
+	.long	3160871055
+	.long	2930322912
+	.long	1072775834
+	.long	2599499422
+	.long	3163762623
+	.long	2471440686
+	.long	1072778901
+	.long	968836267
+	.long	3163263464
+	.long	3366293073
+	.long	1072781976
+	.long	3119426314
+	.long	1015169130
+	.long	1416741826
+	.long	1072785060
+	.long	2196380210
+	.long	1012462139
+	.long	1014845819
+	.long	1072788152
+	.long	3117910646
+	.long	3162607681
+	.long	2257959872
+	.long	1072791252
+	.long	3802946148
+	.long	1014013503
+	.long	948735466
+	.long	1072794361
+	.long	3516338028
+	.long	3163623459
+	.long	1480023343
+	.long	1072797478
+	.long	2247196168
+	.long	1016376029
+	.long	3949972341
+	.long	1072800603
+	.long	2068408548
+	.long	1015962444
+	.long	4162030108
+	.long	1072803737
+	.long	2763428480
+	.long	1016577925
+	.long	2214878420
+	.long	1072806880
+	.long	892270087
+	.long	3164164998
+	.long	2502433899
+	.long	1072810031
+	.long	2148595913
+	.long	1016072567
+	.long	828946858
+	.long	1072813191
+	.long	10642492
+	.long	1016988014
+	.long	1588871207
+	.long	1072816359
+	.long	143439582
+	.long	3164011992
+	.long	586995997
+	.long	1072819536
+	.long	41662348
+	.long	3163676568
+	.long	2218315341
+	.long	1072822721
+	.long	2694295388
+	.long	3164337444
+	.long	2288159958
+	.long	1072825915
+	.long	2169144469
+	.long	1015924597
+	.long	897099801
+	.long	1072829118
+	.long	754756297
+	.long	1016289581
+	.long	2440944790
+	.long	1072832329
+	.long	2492769774
+	.long	1015196030
+	.long	2725843665
+	.long	1072835549
+	.long	1433917087
+	.long	1015887099
+	.long	1853186616
+	.long	1072838778
+	.long	3066496371
+	.long	1016705150
+	.long	4219606026
+	.long	1072842015
+	.long	2434574742
+	.long	1015730124
+	.long	1337108031
+	.long	1072845262
+	.long	3203724452
+	.long	1015726421
+	.long	1897844341
+	.long	1072848517
+	.long	1254300460
+	.long	1016324514
+	.long	1709341917
+	.long	1072851781
+	.long	2571168217
+	.long	1015201075
+	.long	874372905
+	.long	1072855054
+	.long	100263788
+	.long	1016989308
+	.long	3790955393
+	.long	1072858335
+	.long	2352942462
+	.long	3164228666
+	.long	1972484976
+	.long	1072861626
+	.long	675290301
+	.long	3162688626
+	.long	4112506593
+	.long	1072864925
+	.long	2947355221
+	.long	1015419624
+	.long	1724976915
+	.long	1072868234
+	.long	420909223
+	.long	3164165955
+	.long	3504003472
+	.long	1072871551
+	.long	3594001060
+	.long	3158379228
+	.long	964107055
+	.long	1072874878
+	.long	2800439588
+	.long	3163881797
+	.long	2799960843
+	.long	1072878213
+	.long	1423655381
+	.long	1016070727
+	.long	526652809
+	.long	1072881558
+	.long	4223459736
+	.long	1016927951
+	.long	2839424854
+	.long	1072884911
+	.long	1171596163
+	.long	1014090255
+	.long	1253935211
+	.long	1072888274
+	.long	1395382931
+	.long	3160751189
+	.long	171030293
+	.long	1072891646
+	.long	3526460132
+	.long	1015477354
+	.long	3991843581
+	.long	1072895026
+	.long	4092853457
+	.long	1015634339
+	.long	4232894513
+	.long	1072898416
+	.long	2383938684
+	.long	1015717095
+	.long	1000925746
+	.long	1072901816
+	.long	1018491672
+	.long	3164358120
+	.long	2992903935
+	.long	1072905224
+	.long	2218154406
+	.long	1016276769
+	.long	1726216749
+	.long	1072908642
+	.long	2466808228
+	.long	3162724981
+	.long	1603444721
+	.long	1072912069
+	.long	1548633640
+	.long	3163249902
+	.long	2732492859
+	.long	1072915505
+	.long	2691479646
+	.long	3163304260
+	.long	926591435
+	.long	1072918951
+	.long	3208833762
+	.long	3163962090
+	.long	589198666
+	.long	1072922406
+	.long	2664346172
+	.long	3164206538
+	.long	1829099622
+	.long	1072925870
+	.long	1016661181
+	.long	3164509581
+	.long	460407023
+	.long	1072929344
+	.long	4237175092
+	.long	3164187045
+	.long	887463927
+	.long	1072932827
+	.long	3596744163
+	.long	3161842742
+	.long	3219942644
+	.long	1072936319
+	.long	3798990616
+	.long	1016417382
+	.long	3272845541
+	.long	1072939821
+	.long	928852419
+	.long	3164536824
+	.long	1156440435
+	.long	1072943333
+	.long	2351451249
+	.long	1015015632
+	.long	1276261410
+	.long	1072946854
+	.long	300981948
+	.long	1015732745
+	.long	3743175029
+	.long	1072950384
+	.long	2072812490
+	.long	3163223651
+	.long	78413852
+	.long	1072953925
+	.long	4183226867
+	.long	3164065827
+	.long	3278348324
+	.long	1072957474
+	.long	3069497416
+	.long	1015799288
+	.long	569847338
+	.long	1072961034
+	.long	472945272
+	.long	3160339305
+	.long	654919306
+	.long	1072964603
+	.long	3232961757
+	.long	3164096045
+	.long	3645941911
+	.long	1072968181
+	.long	3814685081
+	.long	3162621917
+	.long	1065662932
+	.long	1072971770
+	.long	2533670915
+	.long	1015578814
+	.long	1617004845
+	.long	1072975368
+	.long	82804944
+	.long	1011391354
+	.long	1118294578
+	.long	1072978976
+	.long	2197495694
+	.long	3160957977
+	.long	3978100823
+	.long	1072982593
+	.long	3513027190
+	.long	1016894539
+	.long	1720398391
+	.long	1072986221
+	.long	3980678963
+	.long	3164348656
+	.long	3049340112
+	.long	1072989858
+	.long	3062915824
+	.long	1014219171
+	.long	3784486610
+	.long	1072993505
+	.long	1581883040
+	.long	3162747529
+	.long	4040676318
+	.long	1072997162
+	.long	4090609238
+	.long	1016712034
+	.long	3933059031
+	.long	1073000829
+	.long	2133366768
+	.long	3162580408
+	.long	3577096743
+	.long	1073004506
+	.long	2951496418
+	.long	1014842263
+	.long	3088564500
+	.long	1073008193
+	.long	1762311517
+	.long	1016094249
+	.long	2583551245
+	.long	1073011890
+	.long	3161094195
+	.long	1016655067
+	.long	2178460671
+	.long	1073015597
+	.long	777878098
+	.long	3163891069
+	.long	1990012071
+	.long	1073019314
+	.long	3529070563
+	.long	3163861769
+	.long	2135241198
+	.long	1073023041
+	.long	1236747871
+	.long	1014637723
+	.long	2731501122
+	.long	1073026778
+	.long	1774031855
+	.long	3163518597
+	.long	3896463087
+	.long	1073030525
+	.long	1139797873
+	.long	3162282381
+	.long	1453150082
+	.long	1073034283
+	.long	498154669
+	.long	3162536638
+	.long	4109806887
+	.long	1073038050
+	.long	422403966
+	.long	1015517805
+	.long	3395129871
+	.long	1073041828
+	.long	4025345435
+	.long	3163383964
+	.long	3723038930
+	.long	1073045616
+	.long	378465264
+	.long	3163618158
+	.long	917841882
+	.long	1073049415
+	.long	18715565
+	.long	1016707884
+	.long	3689071823
+	.long	1073053223
+	.long	2321004996
+	.long	3163601292
+	.long	3566716925
+	.long	1073057042
+	.long	1536826856
+	.long	1015191009
+	.long	671025100
+	.long	1073060872
+	.long	3832014351
+	.long	3164070606
+	.long	3712504873
+	.long	1073064711
+	.long	88491949
+	.long	1016476236
+	.long	4222122499
+	.long	1073068561
+	.long	1277378074
+	.long	3164305313
+	.long	2321106615
+	.long	1073072422
+	.long	2171176610
+	.long	1010584347
+	.long	2425981843
+	.long	1073076293
+	.long	2830390851
+	.long	3164395175
+	.long	363667784
+	.long	1073080175
+	.long	813753950
+	.long	1016833785
+	.long	551349105
+	.long	1073084067
+	.long	3821916050
+	.long	3163155165
+	.long	3111574537
+	.long	1073087969
+	.long	2606161479
+	.long	3163808322
+	.long	3872257780
+	.long	1073091882
+	.long	1253592103
+	.long	1017006910
+	.long	2956612997
+	.long	1073095806
+	.long	2118169751
+	.long	3163784129
+	.long	488188413
+	.long	1073099741
+	.long	3199821029
+	.long	1016612624
+	.long	885834528
+	.long	1073103686
+	.long	1973258547
+	.long	3163310140
+	.long	4273770423
+	.long	1073107641
+	.long	3383180809
+	.long	3164267477
+	.long	2186617381
+	.long	1073111608
+	.long	2270764084
+	.long	3164321289
+	.long	3339203574
+	.long	1073115585
+	.long	1483497780
+	.long	3163457330
+	.long	3561793907
+	.long	1073119573
+	.long	1157054053
+	.long	1012938926
+	.long	2979960120
+	.long	1073123572
+	.long	2599109725
+	.long	1015547069
+	.long	1719614413
+	.long	1073127582
+	.long	330458198
+	.long	3164331316
+	.long	4201977662
+	.long	1073131602
+	.long	748330254
+	.long	1014642933
+	.long	1963711167
+	.long	1073135634
+	.long	1744767757
+	.long	3161622870
+	.long	3721688645
+	.long	1073139676
+	.long	3069276937
+	.long	1016887977
+	.long	1013258799
+	.long	1073143730
+	.long	1748797611
+	.long	3161177658
+	.long	2555984613
+	.long	1073147794
+	.long	2652555442
+	.long	3163601268
+	.long	4182873220
+	.long	1073151869
+	.long	629542646
+	.long	3163044879
+	.long	1727278727
+	.long	1073155956
+	.long	3562710623
+	.long	1012520516
+	.long	3907805044
+	.long	1073160053
+	.long	2257091225
+	.long	3162598983
+	.long	2263535754
+	.long	1073164162
+	.long	752233586
+	.long	3163687584
+	.long	1218806132
+	.long	1073168282
+	.long	1818613052
+	.long	3163597017
+	.long	903334909
+	.long	1073172413
+	.long	1636462108
+	.long	1016088573
+	.long	1447192521
+	.long	1073176555
+	.long	1462857171
+	.long	3163563097
+	.long	2980802057
+	.long	1073180708
+	.long	378619896
+	.long	1016821879
+	.long	1339972927
+	.long	1073184873
+	.long	167908909
+	.long	1016620728
+	.long	950803702
+	.long	1073189049
+	.long	1655364926
+	.long	1016285608
+	.long	1944781191
+	.long	1073193236
+	.long	3993278767
+	.long	3162772855
+	.long	158781403
+	.long	1073197435
+	.long	2221464712
+	.long	3164335029
+	.long	19972402
+	.long	1073201645
+	.long	3507899862
+	.long	1017057868
+	.long	1660913392
+	.long	1073205866
+	.long	4218599604
+	.long	1016184283
+	.long	919555682
+	.long	1073210099
+	.long	3121969534
+	.long	1013996802
+	.long	2224145553
+	.long	1073214343
+	.long	3482522030
+	.long	3162537745
+	.long	1413356050
+	.long	1073218599
+	.long	1651349291
+	.long	3163716742
+	.long	2916157145
+	.long	1073222866
+	.long	219487565
+	.long	1016357943
+	.long	2571947539
+	.long	1073227145
+	.long	3558159064
+	.long	3164425245
+	.long	515457527
+	.long	1073231436
+	.long	836709333
+	.long	1016699802
+	.long	1176749997
+	.long	1073235738
+	.long	2738998779
+	.long	3163084420
+	.long	396319521
+	.long	1073240052
+	.long	4172420816
+	.long	3160123208
+	.long	2604962541
+	.long	1073244377
+	.long	2614425274
+	.long	3164587768
+	.long	3643909174
+	.long	1073248714
+	.long	3537586109
+	.long	1015403223
+	.long	3649726105
+	.long	1073253063
+	.long	4085036346
+	.long	1016698050
+	.long	2759350287
+	.long	1073257424
+	.long	1148526634
+	.long	1016943509
+	.long	1110089947
+	.long	1073261797
+	.long	1451641639
+	.long	1016523249
+	.long	3134592888
+	.long	1073266181
+	.long	4232266862
+	.long	1017039710
+	.long	380978316
+	.long	1073270578
+	.long	854188970
+	.long	3161511262
+	.long	1577608921
+	.long	1073274986
+	.long	1875489510
+	.long	3164016970
+	.long	2568320822
+	.long	1073279406
+	.long	2732824428
+	.long	1015401491
+	.long	3492293770
+	.long	1073283838
+	.long	2248032210
+	.long	1016435402
+	.long	194117574
+	.long	1073288283
+	.long	777528612
+	.long	3164460665
+	.long	1403662306
+	.long	1073292739
+	.long	2788809599
+	.long	3162719583
+	.long	2966275557
+	.long	1073297207
+	.long	2176155324
+	.long	3160891335
+	.long	727685349
+	.long	1073301688
+	.long	2038246809
+	.long	3163407318
+	.long	3418903055
+	.long	1073306180
+	.long	2527457337
+	.long	3161869180
+	.long	2591453363
+	.long	1073310685
+	.long	2132396182
+	.long	3160122774
+	.long	2682146384
+	.long	1073315202
+	.long	2082178513
+	.long	3164411995
+	.long	3833209506
+	.long	1073319731
+	.long	2722920684
+	.long	1014803418
+	.long	1892288442
+	.long	1073324273
+	.long	2446255666
+	.long	3163648957
+	.long	1297350157
+	.long	1073328827
+	.long	1308022040
+	.long	3164461134
+	.long	2191782032
+	.long	1073333393
+	.long	2960257726
+	.long	1014791238
+	.long	424392917
+	.long	1073337972
+	.long	2749202995
+	.long	3163887294
+	.long	434316067
+	.long	1073342563
+	.long	2028358766
+	.long	1014506698
+	.long	2366108318
+	.long	1073347166
+	.long	2867985102
+	.long	3162810830
+	.long	2069751141
+	.long	1073351782
+	.long	1562170675
+	.long	3163773257
+	.long	3985553595
+	.long	1073356410
+	.long	4002146062
+	.long	1016882712
+	.long	3964284211
+	.long	1073361051
+	.long	2111583915
+	.long	1016475740
+	.long	2152073944
+	.long	1073365705
+	.long	1486860576
+	.long	3164252032
+	.long	2990417245
+	.long	1073370371
+	.long	3683467745
+	.long	3164417902
+	.long	2331271250
+	.long	1073375050
+	.long	812057446
+	.long	1013256022
+	.long	321958744
+	.long	1073379742
+	.long	3401933767
+	.long	1016843134
+	.long	1405169241
+	.long	1073384446
+	.long	2998539689
+	.long	3163879527
+	.long	1434058175
+	.long	1073389163
+	.long	251133233
+	.long	1016134345
+	.long	557149882
+	.long	1073393893
+	.long	3672720709
+	.long	1015585841
+	.long	3218338682
+	.long	1073398635
+	.long	3404164304
+	.long	3163525684
+	.long	977020788
+	.long	1073403391
+	.long	3065100517
+	.long	1016590139
+	.long	2572866477
+	.long	1073408159
+	.long	878562433
+	.long	1016570317
+	.long	3861050111
+	.long	1073412940
+	.long	254893773
+	.long	3163861756
+	.long	697153126
+	.long	1073417735
+	.long	1283515429
+	.long	3164331765
+	.long	1822067026
+	.long	1073422542
+	.long	1241994956
+	.long	1016388866
+	.long	3092190715
+	.long	1073427362
+	.long	814012168
+	.long	3160571998
+	.long	364333489
+	.long	1073432196
+	.long	3923737744
+	.long	3162469949
+	.long	2380618042
+	.long	1073437042
+	.long	3149557219
+	.long	3164369375
+	.long	703710506
+	.long	1073441902
+	.long	1384660846
+	.long	1016244467
+	.long	4076559943
+	.long	1073446774
+	.long	2119478331
+	.long	3161806927
+	.long	4062661092
+	.long	1073451660
+	.long	1422616006
+	.long	3164303894
+	.long	815859274
+	.long	1073456560
+	.long	240396590
+	.long	3164536019
+	.long	3080351519
+	.long	1073461472
+	.long	3379126789
+	.long	3158266577
+	.long	2420883922
+	.long	1073466398
+	.long	2049810052
+	.long	1015168464
+	.long	3287523847
+	.long	1073471337
+	.long	1625971539
+	.long	3158058531
+	.long	1540824585
+	.long	1073476290
+	.long	1064017011
+	.long	3164536266
+	.long	1631695677
+	.long	1073481256
+	.long	2717633076
+	.long	3163392602
+	.long	3716502172
+	.long	1073486235
+	.long	2303740125
+	.long	1015091301
+	.long	3657065772
+	.long	1073491228
+	.long	399025623
+	.long	3164005654
+	.long	1610600570
+	.long	1073496235
+	.long	3766732298
+	.long	1016808759
+	.long	2029714210
+	.long	1073501255
+	.long	613660079
+	.long	1016147719
+	.long	777507147
+	.long	1073506289
+	.long	4282924205
+	.long	1016236109
+	.long	2307442995
+	.long	1073511336
+	.long	3190117721
+	.long	3163453115
+	.long	2483480501
+	.long	1073516397
+	.long	1216371780
+	.long	1014082748
+	.long	1464976603
+	.long	1073521472
+	.long	3507292405
+	.long	3163026110
+	.long	3706687593
+	.long	1073526560
+	.long	3521726939
+	.long	1014301643
+	.long	778901109
+	.long	1073531663
+	.long	2248183954
+	.long	3162317327
+	.long	1432208378
+	.long	1073536779
+	.long	1401068914
+	.long	3163412539
+	.long	1532734324
+	.long	1073541909
+	.long	3094216535
+	.long	3164211433
+	.long	1242007932
+	.long	1073547053
+	.long	1132034716
+	.long	3164388407
+	.long	721996136
+	.long	1073552211
+	.long	563754734
+	.long	1016419894
+	.long	135105010
+	.long	1073557383
+	.long	1906148728
+	.long	3164424315
+	.long	3939148246
+	.long	1073562568
+	.long	3210352148
+	.long	1016322899
+	.long	3707479175
+	.long	1073567768
+	.long	3613079303
+	.long	1015213314
+	.long	3898795731
+	.long	1073572982
+	.long	1249994144
+	.long	1012918394
+	.long	382305176
+	.long	1073578211
+	.long	2347622376
+	.long	3163627201
+	.long	1912561781
+	.long	1073583453
+	.long	3147495102
+	.long	1016726829
+	.long	64696965
+	.long	1073588710
+	.long	1768797490
+	.long	1016865536
+	.long	3594158869
+	.long	1073593980
+	.long	2456521700
+	.long	3164305137
+	.long	4076975200
+	.long	1073599265
+	.long	2029000899
+	.long	1016257111
+	.long	1679558232
+	.long	1073604565
+	.long	2390342287
+	.long	3164382546
+	.long	863738719
+	.long	1073609879
+	.long	1326992220
+	.long	3163661773
+	.long	1796832535
+	.long	1073615207
+	.long	3176955716
+	.long	3161634089
+	.long	351641897
+	.long	1073620550
+	.long	2172261526
+	.long	3164059175
+	.long	991358482
+	.long	1073625907
+	.long	838715019
+	.long	3164206244
+	.long	3884662774
+	.long	1073631278
+	.long	2158611599
+	.long	1015258761
+	.long	610758006
+	.long	1073636665
+	.long	1965209397
+	.long	3162914808
+	.long	4224142467
+	.long	1073642065
+	.long	3389820386
+	.long	1016255778
+	.long	2009970496
+	.long	1073647481
+	.long	2159039665
+	.long	3163621524
+	.long	2728693978
+	.long	1073652911
+	.long	396109971
+	.long	3164511267
+	.long	2256325230
+	.long	1073658356
+	.long	580117746
+	.long	1016365871
+	.long	764307441
+	.long	1073663816
+	.long	3021057420
+	.long	3164378099
+	.long	2719515920
+	.long	1073669290
+	.long	2760332941
+	.long	1016186509
+	.long	3999357479
+	.long	1073674779
+	.long	2258941616
+	.long	1016973300
+	.long	481706282
+	.long	1073680284
+	.long	1696079173
+	.long	3163759104
+	.long	929806999
+	.long	1073685803
+	.long	3205336643
+	.long	1016308133
+	.long	1222472308
+	.long	1073691337
+	.long	1054357470
+	.long	3162069594
+	.long	1533953344
+	.long	1073696886
+	.long	769171851
+	.long	1016714209
+	.long	2038973688
+	.long	1073702450
+	.long	892941374
+	.long	1017095035
+	.long	2912730644
+	.long	1073708029
+	.long	3490067722
+	.long	3164453650
+	.long	35929225
+	.long	1073713624
+	.long	2809788041
+	.long	3160485544
+	.long	2174652632
+	.long	1073719233
+	.long	4087714590
+	.long	1015498835
+	.long	915592468
+	.long	1073724858
+	.long	352947894
+	.long	3162072947
+	.long	730821105
+	.long	1073730498
+	.long	2523232743
+	.long	1013115764
+	.long	1797923801
+	.long	1073736153
+	.long	1950547427
+	.long	1014277635
+	.long	3884607281
+	.long	1062590591
+	.long	3607404736
+	.long	1068264200
+	.long	1874480759
+	.long	1065595563
+	.long	4286760335
+	.long	1070514109
+	.long	4277811695
+	.long	1072049730
+	.long	0
+	.long	0
+	.long	4277811695
+	.long	1072049730
+	.long	4277811695
+	.long	3219533378
+	.long	4160749568
+	.long	4294967295
+	.long	4160749568
+	.long	4294967295
+	.long	0
+	.long	2147483648
+	.long	0
+	.long	0
+	.type	static_const_table,@object
+	.size	static_const_table,12576
+	.data
+	.section .note.GNU-stack, ""
+# End
diff --git a/libm/x86_64/e_exp.S b/libm/x86_64/e_exp.S
new file mode 100644
index 0000000..6882dfc
--- /dev/null
+++ b/libm/x86_64/e_exp.S
@@ -0,0 +1,636 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+// Description:
+//  Let K = 64 (table size).
+//        x    x/log(2)     n
+//       e  = 2          = 2 * T[j] * (1 + P(y))
+//  where
+//       x = m*log(2)/K + y,    y in [-log(2)/K..log(2)/K]
+//       m = n*K + j,           m,n,j - signed integer, j in [-K/2..K/2]
+//                  j/K
+//       values of 2   are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
+//
+//       P(y) is a minimax polynomial approximation of exp(x)-1
+//       on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
+//
+//  To avoid problems with arithmetic overflow and underflow,
+//            n                        n1  n2
+//  value of 2  is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
+//  where BIAS is a value of exponent bias.
+//
+// Special cases:
+//  exp(NaN) = NaN
+//  exp(+INF) = +INF
+//  exp(-INF) = 0
+//  exp(x) = 1 for subnormals
+//  for finite argument, only exp(0)=1 is exact
+//  For IEEE double
+//    if x >  709.782712893383973096 then exp(x) overflow
+//    if x < -745.133219101941108420 then exp(x) underflow
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  exp
+ENTRY(exp)
+# parameter 1: %xmm0
+..B1.1:
+..___tag_value_exp.1:
+        subq      $24, %rsp
+..___tag_value_exp.3:
+        movsd     %xmm0, 8(%rsp)
+..B1.2:
+        unpcklpd  %xmm0, %xmm0
+        movapd    cv(%rip), %xmm1
+        movapd    Shifter(%rip), %xmm6
+        movapd    16+cv(%rip), %xmm2
+        movapd    32+cv(%rip), %xmm3
+        pextrw    $3, %xmm0, %eax
+        andl      $32767, %eax
+        movl      $16527, %edx
+        subl      %eax, %edx
+        subl      $15504, %eax
+        orl       %eax, %edx
+        cmpl      $-2147483648, %edx
+        jae       .L_2TAG_PACKET_0.0.2
+        mulpd     %xmm0, %xmm1
+        addpd     %xmm6, %xmm1
+        movapd    %xmm1, %xmm7
+        subpd     %xmm6, %xmm1
+        mulpd     %xmm1, %xmm2
+        movapd    64+cv(%rip), %xmm4
+        mulpd     %xmm1, %xmm3
+        movapd    80+cv(%rip), %xmm5
+        subpd     %xmm2, %xmm0
+        movd      %xmm7, %eax
+        movl      %eax, %ecx
+        andl      $63, %ecx
+        shll      $4, %ecx
+        sarl      $6, %eax
+        movl      %eax, %edx
+        movdqa    mmask(%rip), %xmm6
+        pand      %xmm6, %xmm7
+        movdqa    bias(%rip), %xmm6
+        paddq     %xmm6, %xmm7
+        psllq     $46, %xmm7
+        subpd     %xmm3, %xmm0
+        lea       Tbl_addr(%rip), %r8
+        movapd    (%rcx,%r8), %xmm2
+        mulpd     %xmm0, %xmm4
+        movapd    %xmm0, %xmm6
+        movapd    %xmm0, %xmm1
+        mulpd     %xmm6, %xmm6
+        mulpd     %xmm6, %xmm0
+        addpd     %xmm4, %xmm5
+        mulsd     %xmm6, %xmm0
+        mulpd     48+cv(%rip), %xmm6
+        addsd     %xmm2, %xmm1
+        unpckhpd  %xmm2, %xmm2
+        mulpd     %xmm5, %xmm0
+        addsd     %xmm0, %xmm1
+        orpd      %xmm7, %xmm2
+        unpckhpd  %xmm0, %xmm0
+        addsd     %xmm1, %xmm0
+        addsd     %xmm6, %xmm0
+        addl      $894, %edx
+        cmpl      $1916, %edx
+        ja        .L_2TAG_PACKET_1.0.2
+        mulsd     %xmm2, %xmm0
+        addsd     %xmm2, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_1.0.2:
+        xorpd     %xmm3, %xmm3
+        movapd    ALLONES(%rip), %xmm4
+        movl      $-1022, %edx
+        subl      %eax, %edx
+        movd      %edx, %xmm5
+        psllq     %xmm5, %xmm4
+        movl      %eax, %ecx
+        sarl      $1, %eax
+        pinsrw    $3, %eax, %xmm3
+        movapd    ebias(%rip), %xmm6
+        psllq     $4, %xmm3
+        psubd     %xmm3, %xmm2
+        mulsd     %xmm2, %xmm0
+        cmpl      $52, %edx
+        jg        .L_2TAG_PACKET_2.0.2
+        andpd     %xmm2, %xmm4
+        paddd     %xmm6, %xmm3
+        subsd     %xmm4, %xmm2
+        addsd     %xmm2, %xmm0
+        cmpl      $1023, %ecx
+        jge       .L_2TAG_PACKET_3.0.2
+        pextrw    $3, %xmm0, %ecx
+        andl      $32768, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_4.0.2
+        movapd    %xmm0, %xmm6
+        addsd     %xmm4, %xmm0
+        mulsd     %xmm3, %xmm0
+        pextrw    $3, %xmm0, %ecx
+        andl      $32752, %ecx
+        cmpl      $0, %ecx
+        je        .L_2TAG_PACKET_5.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_5.0.2:
+        mulsd     %xmm3, %xmm6
+        mulsd     %xmm3, %xmm4
+        movq      %xmm6, %xmm0
+        pxor      %xmm4, %xmm6
+        psrad     $31, %xmm6
+        pshufd    $85, %xmm6, %xmm6
+        psllq     $1, %xmm0
+        psrlq     $1, %xmm0
+        pxor      %xmm6, %xmm0
+        psrlq     $63, %xmm6
+        paddq     %xmm6, %xmm0
+        paddq     %xmm4, %xmm0
+        movl      $15, (%rsp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_4.0.2:
+        addsd     %xmm4, %xmm0
+        mulsd     %xmm3, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_3.0.2:
+        addsd     %xmm4, %xmm0
+        mulsd     %xmm3, %xmm0
+        pextrw    $3, %xmm0, %ecx
+        andl      $32752, %ecx
+        cmpl      $32752, %ecx
+        jnb       .L_2TAG_PACKET_7.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_2.0.2:
+        paddd     %xmm6, %xmm3
+        addpd     %xmm2, %xmm0
+        mulsd     %xmm3, %xmm0
+        movl      $15, (%rsp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_8.0.2:
+        cmpl      $2146435072, %eax
+        jae       .L_2TAG_PACKET_9.0.2
+        movl      12(%rsp), %eax
+        cmpl      $-2147483648, %eax
+        jae       .L_2TAG_PACKET_10.0.2
+        movsd     XMAX(%rip), %xmm0
+        mulsd     %xmm0, %xmm0
+.L_2TAG_PACKET_7.0.2:
+        movl      $14, (%rsp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_10.0.2:
+        movsd     XMIN(%rip), %xmm0
+        mulsd     %xmm0, %xmm0
+        movl      $15, (%rsp)
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_9.0.2:
+        movl      8(%rsp), %edx
+        cmpl      $2146435072, %eax
+        ja        .L_2TAG_PACKET_11.0.2
+        cmpl      $0, %edx
+        jne       .L_2TAG_PACKET_11.0.2
+        movl      12(%rsp), %eax
+        cmpl      $2146435072, %eax
+        jne       .L_2TAG_PACKET_12.0.2
+        movsd     INF(%rip), %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_12.0.2:
+        movsd     ZERO(%rip), %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_11.0.2:
+        movsd     8(%rsp), %xmm0
+        addsd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_0.0.2:
+        movl      12(%rsp), %eax
+        andl      $2147483647, %eax
+        cmpl      $1083179008, %eax
+        jae       .L_2TAG_PACKET_8.0.2
+        movsd     8(%rsp), %xmm0
+        addsd     ONE_val(%rip), %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_6.0.2:
+        movq      %xmm0, 16(%rsp)
+..B1.3:
+        movq      16(%rsp), %xmm0
+.L_2TAG_PACKET_13.0.2:
+..B1.5:
+        addq      $24, %rsp
+..___tag_value_exp.4:
+        ret       
+..___tag_value_exp.5:
+END(exp)
+# -- End  exp
+	.section .rodata, "a"
+	.align 16
+	.align 16
+cv:
+	.long	1697350398
+	.long	1079448903
+	.long	1697350398
+	.long	1079448903
+	.long	4277796864
+	.long	1065758274
+	.long	4277796864
+	.long	1065758274
+	.long	3164486458
+	.long	1025308570
+	.long	3164486458
+	.long	1025308570
+	.long	4294967294
+	.long	1071644671
+	.long	4294967294
+	.long	1071644671
+	.long	3811088480
+	.long	1062650204
+	.long	1432067621
+	.long	1067799893
+	.long	3230715663
+	.long	1065423125
+	.long	1431604129
+	.long	1069897045
+	.type	cv,@object
+	.size	cv,96
+	.align 16
+Shifter:
+	.long	0
+	.long	1127743488
+	.long	0
+	.long	1127743488
+	.type	Shifter,@object
+	.size	Shifter,16
+	.align 16
+mmask:
+	.long	4294967232
+	.long	0
+	.long	4294967232
+	.long	0
+	.type	mmask,@object
+	.size	mmask,16
+	.align 16
+bias:
+	.long	65472
+	.long	0
+	.long	65472
+	.long	0
+	.type	bias,@object
+	.size	bias,16
+	.align 16
+Tbl_addr:
+	.long	0
+	.long	0
+	.long	0
+	.long	0
+	.long	235107661
+	.long	1018002367
+	.long	1048019040
+	.long	11418
+	.long	896005651
+	.long	1015861842
+	.long	3541402996
+	.long	22960
+	.long	1642514529
+	.long	1012987726
+	.long	410360776
+	.long	34629
+	.long	1568897900
+	.long	1016568486
+	.long	1828292879
+	.long	46424
+	.long	1882168529
+	.long	1010744893
+	.long	852742562
+	.long	58348
+	.long	509852888
+	.long	1017336174
+	.long	3490863952
+	.long	70401
+	.long	653277307
+	.long	1017431380
+	.long	2930322911
+	.long	82586
+	.long	1649557430
+	.long	1017729363
+	.long	1014845818
+	.long	94904
+	.long	1058231231
+	.long	1015777676
+	.long	3949972341
+	.long	107355
+	.long	1044000607
+	.long	1016786167
+	.long	828946858
+	.long	119943
+	.long	1151779725
+	.long	1015705409
+	.long	2288159958
+	.long	132667
+	.long	3819481236
+	.long	1016499965
+	.long	1853186616
+	.long	145530
+	.long	2552227826
+	.long	1015039787
+	.long	1709341917
+	.long	158533
+	.long	1829350193
+	.long	1015216097
+	.long	4112506593
+	.long	171677
+	.long	1913391795
+	.long	1015756674
+	.long	2799960843
+	.long	184965
+	.long	1303423926
+	.long	1015238005
+	.long	171030293
+	.long	198398
+	.long	1574172746
+	.long	1016061241
+	.long	2992903935
+	.long	211976
+	.long	3424156969
+	.long	1017196428
+	.long	926591434
+	.long	225703
+	.long	1938513547
+	.long	1017631273
+	.long	887463926
+	.long	239579
+	.long	2804567149
+	.long	1015390024
+	.long	1276261410
+	.long	253606
+	.long	631083525
+	.long	1017690182
+	.long	569847337
+	.long	267786
+	.long	1623370770
+	.long	1011049453
+	.long	1617004845
+	.long	282120
+	.long	3667985273
+	.long	1013894369
+	.long	3049340112
+	.long	296610
+	.long	3145379760
+	.long	1014403278
+	.long	3577096743
+	.long	311258
+	.long	2603100681
+	.long	1017152460
+	.long	1990012070
+	.long	326066
+	.long	3249202951
+	.long	1017448880
+	.long	1453150081
+	.long	341035
+	.long	419288974
+	.long	1016280325
+	.long	917841882
+	.long	356167
+	.long	3793507337
+	.long	1016095713
+	.long	3712504873
+	.long	371463
+	.long	728023093
+	.long	1016345318
+	.long	363667784
+	.long	386927
+	.long	2582678538
+	.long	1017123460
+	.long	2956612996
+	.long	402558
+	.long	7592966
+	.long	1016721543
+	.long	2186617380
+	.long	418360
+	.long	228611441
+	.long	1016696141
+	.long	1719614412
+	.long	434334
+	.long	2261665670
+	.long	1017457593
+	.long	1013258798
+	.long	450482
+	.long	544148907
+	.long	1017323666
+	.long	3907805043
+	.long	466805
+	.long	2383914918
+	.long	1017143586
+	.long	1447192520
+	.long	483307
+	.long	1176412038
+	.long	1017267372
+	.long	1944781190
+	.long	499988
+	.long	2882956373
+	.long	1013312481
+	.long	919555682
+	.long	516851
+	.long	3154077648
+	.long	1016528543
+	.long	2571947538
+	.long	533897
+	.long	348651999
+	.long	1016405780
+	.long	2604962540
+	.long	551129
+	.long	3253791412
+	.long	1015920431
+	.long	1110089947
+	.long	568549
+	.long	1509121860
+	.long	1014756995
+	.long	2568320822
+	.long	586158
+	.long	2617649212
+	.long	1017340090
+	.long	2966275556
+	.long	603959
+	.long	553214634
+	.long	1016457425
+	.long	2682146383
+	.long	621954
+	.long	730975783
+	.long	1014083580
+	.long	2191782032
+	.long	640145
+	.long	1486499517
+	.long	1016818996
+	.long	2069751140
+	.long	658534
+	.long	2595788928
+	.long	1016407932
+	.long	2990417244
+	.long	677123
+	.long	1853053619
+	.long	1015310724
+	.long	1434058175
+	.long	695915
+	.long	2462790535
+	.long	1015814775
+	.long	2572866477
+	.long	714911
+	.long	3693944214
+	.long	1017259110
+	.long	3092190714
+	.long	734114
+	.long	2979333550
+	.long	1017188654
+	.long	4076559942
+	.long	753526
+	.long	174054861
+	.long	1014300631
+	.long	2420883922
+	.long	773150
+	.long	816778419
+	.long	1014197934
+	.long	3716502172
+	.long	792987
+	.long	3507050924
+	.long	1015341199
+	.long	777507147
+	.long	813041
+	.long	1821514088
+	.long	1013410604
+	.long	3706687593
+	.long	833312
+	.long	920623539
+	.long	1016295433
+	.long	1242007931
+	.long	853805
+	.long	2789017511
+	.long	1014276997
+	.long	3707479175
+	.long	874520
+	.long	3586233004
+	.long	1015962192
+	.long	64696965
+	.long	895462
+	.long	474650514
+	.long	1016642419
+	.long	863738718
+	.long	916631
+	.long	1614448851
+	.long	1014281732
+	.long	3884662774
+	.long	938030
+	.long	2450082086
+	.long	1016164135
+	.long	2728693977
+	.long	959663
+	.long	1101668360
+	.long	1015989180
+	.long	3999357479
+	.long	981531
+	.long	835814894
+	.long	1015702697
+	.long	1533953344
+	.long	1003638
+	.long	1301400989
+	.long	1014466875
+	.long	2174652632
+	.long	1025985
+	.type	Tbl_addr,@object
+	.size	Tbl_addr,1024
+	.align 16
+ALLONES:
+	.long	4294967295
+	.long	4294967295
+	.long	4294967295
+	.long	4294967295
+	.type	ALLONES,@object
+	.size	ALLONES,16
+	.align 16
+ebias:
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	1072693248
+	.type	ebias,@object
+	.size	ebias,16
+	.align 4
+XMAX:
+	.long	4294967295
+	.long	2146435071
+	.type	XMAX,@object
+	.size	XMAX,8
+	.align 4
+XMIN:
+	.long	0
+	.long	1048576
+	.type	XMIN,@object
+	.size	XMIN,8
+	.align 4
+INF:
+	.long	0
+	.long	2146435072
+	.type	INF,@object
+	.size	INF,8
+	.align 4
+ZERO:
+	.long	0
+	.long	0
+	.type	ZERO,@object
+	.size	ZERO,8
+	.align 4
+ONE_val:
+	.long	0
+	.long	1072693248
+	.type	ONE_val,@object
+	.size	ONE_val,8
+	.data
+	.section .note.GNU-stack, ""
+// -- Begin DWARF2 SEGMENT .eh_frame
+	.section .eh_frame,"a",@progbits
+.eh_frame_seg:
+	.align 1
+	.4byte 0x00000014
+	.8byte 0x00527a0100000000
+	.8byte 0x08070c1b01107801
+	.4byte 0x00000190
+	.4byte 0x0000001c
+	.4byte 0x0000001c
+	.4byte ..___tag_value_exp.1-.
+	.4byte ..___tag_value_exp.5-..___tag_value_exp.1
+	.2byte 0x0400
+	.4byte ..___tag_value_exp.3-..___tag_value_exp.1
+	.2byte 0x200e
+	.byte 0x04
+	.4byte ..___tag_value_exp.4-..___tag_value_exp.3
+	.2byte 0x080e
+	.byte 0x00
+# End
diff --git a/libm/x86_64/e_log.S b/libm/x86_64/e_log.S
new file mode 100644
index 0000000..40cb5e2
--- /dev/null
+++ b/libm/x86_64/e_log.S
@@ -0,0 +1,779 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+//    x=2^k * mx, mx in [1,2)
+//
+//    Get B~1/mx based on the output of rcpss instruction (B0)
+//    B = int((B0*2^7+0.5))/2^7
+//
+//    Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
+//
+//    Result:  k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6)  and
+//             p(r) is a degree 7 polynomial
+//             -log(B) read from data table (high, low parts)
+//             Result is formed from high and low parts
+//
+// Special cases:
+//  log(NaN) = quiet NaN, and raise invalid exception
+//  log(+INF) = that INF
+//  log(0) = -INF with divide-by-zero exception raised
+//  log(1) = +0
+//  log(x) = NaN with invalid exception raised if x < -0, including -INF
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  log
+ENTRY(log)
+# parameter 1: %xmm0
+..B1.1:
+..___tag_value_log.1:
+        subq      $24, %rsp
+..___tag_value_log.3:
+        movsd     %xmm0, (%rsp)
+..B1.2:
+        movq      $0x3ff0000000000000, %rax
+        movd      %rax, %xmm2
+        movq      $0x77f0000000000000, %rdx
+        movd      %rdx, %xmm3
+        movl      $32768, %ecx
+        movd      %rcx, %xmm4
+        movq      $0xffffe00000000000, %r8
+        movd      %r8, %xmm5
+        movq      %xmm0, %xmm1
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        movl      $16352, %ecx
+        psrlq     $27, %xmm0
+        lea       L_tbl(%rip), %r11
+        psrld     $2, %xmm0
+        rcpps     %xmm0, %xmm0
+        psllq     $12, %xmm1
+        pshufd    $228, %xmm5, %xmm6
+        psrlq     $12, %xmm1
+        subl      $16, %eax
+        cmpl      $32736, %eax
+        jae       .L_2TAG_PACKET_0.0.2
+.L_2TAG_PACKET_1.0.2:
+        paddd     %xmm4, %xmm0
+        orpd      %xmm3, %xmm1
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm1, %xmm5
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm1
+        mulpd     %xmm0, %xmm5
+        andl      $32752, %eax
+        subl      %ecx, %eax
+        cvtsi2sd  %eax, %xmm7
+        mulsd     %xmm0, %xmm1
+        movq      log2(%rip), %xmm6
+        movapd    coeff(%rip), %xmm3
+        subsd     %xmm2, %xmm5
+        andl      $16711680, %edx
+        shrl      $12, %edx
+        movapd    (%r11,%rdx), %xmm0
+        movapd    16+coeff(%rip), %xmm4
+        addsd     %xmm5, %xmm1
+        movapd    32+coeff(%rip), %xmm2
+        mulsd     %xmm7, %xmm6
+        movddup   %xmm1, %xmm5
+        mulsd     8+log2(%rip), %xmm7
+        mulsd     %xmm1, %xmm3
+        addsd     %xmm6, %xmm0
+        mulpd     %xmm5, %xmm4
+        mulpd     %xmm5, %xmm5
+        movddup   %xmm0, %xmm6
+        addsd     %xmm1, %xmm0
+        addpd     %xmm2, %xmm4
+        mulpd     %xmm5, %xmm3
+        subsd     %xmm0, %xmm6
+        mulsd     %xmm1, %xmm4
+        pshufd    $238, %xmm0, %xmm2
+        addsd     %xmm6, %xmm1
+        mulsd     %xmm5, %xmm5
+        addsd     %xmm2, %xmm7
+        addpd     %xmm3, %xmm4
+        addsd     %xmm7, %xmm1
+        mulpd     %xmm5, %xmm4
+        addsd     %xmm4, %xmm1
+        pshufd    $238, %xmm4, %xmm5
+        addsd     %xmm5, %xmm1
+        addsd     %xmm1, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_0.0.2:
+        movq      (%rsp), %xmm0
+        movq      (%rsp), %xmm1
+        addl      $16, %eax
+        cmpl      $32768, %eax
+        jae       .L_2TAG_PACKET_2.0.2
+        cmpl      $16, %eax
+        jb        .L_2TAG_PACKET_3.0.2
+.L_2TAG_PACKET_4.0.2:
+        addsd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_5.0.2:
+        ja        .L_2TAG_PACKET_4.0.2
+        cmpl      $0, %edx
+        ja        .L_2TAG_PACKET_4.0.2
+        jmp       .L_2TAG_PACKET_6.0.2
+.L_2TAG_PACKET_3.0.2:
+        xorpd     %xmm1, %xmm1
+        addsd     %xmm0, %xmm1
+        movd      %xmm1, %edx
+        psrlq     $32, %xmm1
+        movd      %xmm1, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_7.0.2
+        xorpd     %xmm1, %xmm1
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm1
+        mulsd     %xmm1, %xmm0
+        movq      %xmm0, %xmm1
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        psrlq     $27, %xmm0
+        movl      $18416, %ecx
+        psrld     $2, %xmm0
+        rcpps     %xmm0, %xmm0
+        psllq     $12, %xmm1
+        pshufd    $228, %xmm5, %xmm6
+        psrlq     $12, %xmm1
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_2.0.2:
+        movd      %xmm1, %edx
+        psrlq     $32, %xmm1
+        movd      %xmm1, %ecx
+        addl      %ecx, %ecx
+        cmpl      $-2097152, %ecx
+        jae       .L_2TAG_PACKET_5.0.2
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_7.0.2
+.L_2TAG_PACKET_6.0.2:
+        xorpd     %xmm1, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm1
+        mulsd     %xmm1, %xmm0
+        movl      $3, 16(%rsp)
+        jmp       .L_2TAG_PACKET_8.0.2
+.L_2TAG_PACKET_7.0.2:
+        xorpd     %xmm1, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $49136, %eax
+        pinsrw    $3, %eax, %xmm0
+        divsd     %xmm1, %xmm0
+        movl      $2, 16(%rsp)
+.L_2TAG_PACKET_8.0.2:
+        movq      %xmm0, 8(%rsp)
+..B1.3:
+        movq      8(%rsp), %xmm0
+.L_2TAG_PACKET_9.0.2:
+..B1.5:
+        addq      $24, %rsp
+..___tag_value_log.4:
+        ret       
+..___tag_value_log.5:
+END(log)
+# -- End  log
+	.section .rodata, "a"
+	.align 16
+	.align 16
+L_tbl:
+	.long	4277811200
+	.long	1072049730
+	.long	2479318832
+	.long	1026487127
+	.long	2854492160
+	.long	1072033410
+	.long	215631550
+	.long	1025638968
+	.long	1547061248
+	.long	1072017216
+	.long	2886781435
+	.long	1026423395
+	.long	649825280
+	.long	1072001146
+	.long	4281533405
+	.long	1024038923
+	.long	646346752
+	.long	1071985198
+	.long	1562735921
+	.long	1023790276
+	.long	2203734016
+	.long	1071969370
+	.long	1838397691
+	.long	3173936209
+	.long	1872169984
+	.long	1071953661
+	.long	3981202460
+	.long	1022325013
+	.long	669557760
+	.long	1071938069
+	.long	4182597802
+	.long	3173174122
+	.long	4076413952
+	.long	1071922591
+	.long	1209029111
+	.long	3170736207
+	.long	556125184
+	.long	1071907228
+	.long	821086028
+	.long	3173437049
+	.long	204914688
+	.long	1071891976
+	.long	2097025986
+	.long	3171071798
+	.long	387545088
+	.long	1071876834
+	.long	3142936996
+	.long	3173092218
+	.long	2912783360
+	.long	1071861800
+	.long	2502420140
+	.long	1024505919
+	.long	1144260608
+	.long	1071846874
+	.long	3315658140
+	.long	3173469843
+	.long	1471209472
+	.long	1071832053
+	.long	129621009
+	.long	3172443877
+	.long	1829683200
+	.long	1071817336
+	.long	3885467693
+	.long	1025535275
+	.long	288676864
+	.long	1071802722
+	.long	86139472
+	.long	3171639793
+	.long	3636378624
+	.long	1071788208
+	.long	1850238587
+	.long	1024654342
+	.long	1606817792
+	.long	1071773795
+	.long	3388899795
+	.long	3173675586
+	.long	1236164608
+	.long	1071759480
+	.long	3983599207
+	.long	1020046558
+	.long	1089616896
+	.long	1071745262
+	.long	4171974224
+	.long	1024773198
+	.long	4143093760
+	.long	1071731139
+	.long	2727587401
+	.long	3173965207
+	.long	600267776
+	.long	1071717112
+	.long	3147685042
+	.long	3173353031
+	.long	2249313280
+	.long	1071703177
+	.long	125835074
+	.long	1025255832
+	.long	3805303808
+	.long	1071689334
+	.long	2289991207
+	.long	1025460331
+	.long	87278592
+	.long	1071675583
+	.long	1106114045
+	.long	1025933602
+	.long	3195405312
+	.long	1071661920
+	.long	3885316576
+	.long	3171206239
+	.long	3853649920
+	.long	1071648346
+	.long	2977069852
+	.long	3171236771
+	.long	2944026624
+	.long	1071625048
+	.long	1008093493
+	.long	1023444474
+	.long	3993180160
+	.long	1071598247
+	.long	1862355595
+	.long	1024642533
+	.long	1454641152
+	.long	1071571617
+	.long	1514603089
+	.long	1026500596
+	.long	3286085632
+	.long	1071545154
+	.long	1400028424
+	.long	3173279056
+	.long	438773760
+	.long	1071518858
+	.long	120727864
+	.long	3172148914
+	.long	1212979200
+	.long	1071492725
+	.long	1625055594
+	.long	3172901933
+	.long	1189017600
+	.long	1071466754
+	.long	3920062376
+	.long	1025727407
+	.long	403064832
+	.long	1071440943
+	.long	1053271728
+	.long	3171391427
+	.long	3343210496
+	.long	1071415289
+	.long	3243395502
+	.long	3173627613
+	.long	1765777408
+	.long	1071389792
+	.long	2145968512
+	.long	1026354304
+	.long	461430784
+	.long	1071364449
+	.long	4094322285
+	.long	1026021467
+	.long	71706624
+	.long	1071339258
+	.long	763632021
+	.long	1024496933
+	.long	1380503552
+	.long	1071314217
+	.long	1383547992
+	.long	3173088453
+	.long	1015732224
+	.long	1071289325
+	.long	3198646877
+	.long	1025390322
+	.long	35977216
+	.long	1071264580
+	.long	2141026805
+	.long	1025754693
+	.long	3927306240
+	.long	1071239979
+	.long	282116272
+	.long	3173394334
+	.long	1125341184
+	.long	1071215523
+	.long	2768427504
+	.long	3172279059
+	.long	1666971648
+	.long	1071191208
+	.long	786837629
+	.long	3172427445
+	.long	2827694080
+	.long	1071167033
+	.long	3857122416
+	.long	3173014241
+	.long	2003683328
+	.long	1071142997
+	.long	859010954
+	.long	1026545007
+	.long	1004017664
+	.long	1071119098
+	.long	3356644970
+	.long	3173458064
+	.long	1753020416
+	.long	1071095334
+	.long	788338552
+	.long	1026157693
+	.long	1992718336
+	.long	1071071704
+	.long	1239179443
+	.long	1026394889
+	.long	3870234624
+	.long	1071048206
+	.long	2082614663
+	.long	1024926053
+	.long	1050437632
+	.long	1071024840
+	.long	660007840
+	.long	1025548499
+	.long	188395520
+	.long	1071001603
+	.long	3878792704
+	.long	3173889571
+	.long	3747176448
+	.long	1070978493
+	.long	144991708
+	.long	3171552042
+	.long	1405669376
+	.long	1070955511
+	.long	3999088879
+	.long	1025486317
+	.long	121151488
+	.long	1070932654
+	.long	2170865497
+	.long	1026473584
+	.long	2652319744
+	.long	1070909920
+	.long	453695652
+	.long	3173916809
+	.long	3262236672
+	.long	1070887309
+	.long	157800053
+	.long	3173984206
+	.long	601221120
+	.long	1070864820
+	.long	3968917661
+	.long	1023992886
+	.long	1999843328
+	.long	1070842450
+	.long	3053895004
+	.long	1024998228
+	.long	1992167424
+	.long	1070820199
+	.long	2968614856
+	.long	1024552653
+	.long	3788726272
+	.long	1070798065
+	.long	3542170808
+	.long	3173573242
+	.long	2094829568
+	.long	1070776048
+	.long	1246758132
+	.long	1026202874
+	.long	288675840
+	.long	1070754146
+	.long	3747328950
+	.long	1026331585
+	.long	1829681152
+	.long	1070732357
+	.long	3125197546
+	.long	1024100318
+	.long	1666869248
+	.long	1070710681
+	.long	1363656119
+	.long	1026336493
+	.long	3417110528
+	.long	1070689116
+	.long	4154791553
+	.long	1026267853
+	.long	2183653376
+	.long	1070667662
+	.long	1671819292
+	.long	3173785870
+	.long	1734434816
+	.long	1070646317
+	.long	373091049
+	.long	1025972363
+	.long	1615681536
+	.long	1070625080
+	.long	384650897
+	.long	1022926043
+	.long	1445382144
+	.long	1070603950
+	.long	344320330
+	.long	3172397196
+	.long	1823715328
+	.long	1070569756
+	.long	3389841200
+	.long	1025231852
+	.long	3839688704
+	.long	1070527917
+	.long	1706790417
+	.long	3167363349
+	.long	4293332992
+	.long	1070486286
+	.long	1614935088
+	.long	1019351591
+	.long	2966720512
+	.long	1070444861
+	.long	4145393717
+	.long	3173711658
+	.long	4066729984
+	.long	1070403639
+	.long	1974925028
+	.long	3171437182
+	.long	3337621504
+	.long	1070362619
+	.long	3314953170
+	.long	3169971314
+	.long	943448064
+	.long	1070321799
+	.long	1498682038
+	.long	3173862340
+	.long	1465634816
+	.long	1070281176
+	.long	1319952810
+	.long	3171693965
+	.long	1015734272
+	.long	1070240749
+	.long	1347821929
+	.long	3173544515
+	.long	118001664
+	.long	1070200516
+	.long	1751482746
+	.long	1026134093
+	.long	3707174912
+	.long	1070160474
+	.long	1486946159
+	.long	1023930920
+	.long	3946381312
+	.long	1070120623
+	.long	2867408081
+	.long	3171368276
+	.long	1699848192
+	.long	1070080961
+	.long	2590187139
+	.long	1025379803
+	.long	2235846656
+	.long	1070041485
+	.long	1888568069
+	.long	3172754960
+	.long	2339729408
+	.long	1070002194
+	.long	3852214753
+	.long	3173323149
+	.long	3196850176
+	.long	1069963086
+	.long	742141560
+	.long	1025101707
+	.long	1800683520
+	.long	1069924160
+	.long	3949500444
+	.long	3172102179
+	.long	3835801600
+	.long	1069885413
+	.long	3848895943
+	.long	1025913832
+	.long	2201202688
+	.long	1069846845
+	.long	1425913464
+	.long	1025868665
+	.long	2778279936
+	.long	1069808453
+	.long	2120889677
+	.long	3173831128
+	.long	2954203136
+	.long	1069770236
+	.long	592147081
+	.long	1019621288
+	.long	210141184
+	.long	1069732193
+	.long	3414275233
+	.long	1023647084
+	.long	709476352
+	.long	1069694321
+	.long	2413027164
+	.long	1024462115
+	.long	2116284416
+	.long	1069656619
+	.long	1144559924
+	.long	1026336654
+	.long	2183651328
+	.long	1069619086
+	.long	3459057650
+	.long	1025634168
+	.long	3047047168
+	.long	1069581720
+	.long	1879674924
+	.long	3173508573
+	.long	970711040
+	.long	1069541521
+	.long	1335954173
+	.long	3173332182
+	.long	2198478848
+	.long	1069467449
+	.long	2951103968
+	.long	3173892200
+	.long	1669611520
+	.long	1069393703
+	.long	531044147
+	.long	1025149248
+	.long	29114368
+	.long	1069320280
+	.long	3327831251
+	.long	1025918673
+	.long	2376949760
+	.long	1069247176
+	.long	737634533
+	.long	3172176000
+	.long	1085390848
+	.long	1069174390
+	.long	3108243400
+	.long	3171828406
+	.long	1566130176
+	.long	1069101918
+	.long	985483226
+	.long	1025708380
+	.long	792780800
+	.long	1069029758
+	.long	4184866295
+	.long	1024426204
+	.long	183156736
+	.long	1068957907
+	.long	2845699378
+	.long	1022107277
+	.long	1301782528
+	.long	1068886362
+	.long	1012735262
+	.long	3173804294
+	.long	1562411008
+	.long	1068815121
+	.long	2197086703
+	.long	3170187813
+	.long	2815549440
+	.long	1068744181
+	.long	2782613207
+	.long	1026345054
+	.long	2756124672
+	.long	1068673540
+	.long	2929486205
+	.long	3173037800
+	.long	3511050240
+	.long	1068603195
+	.long	1443733147
+	.long	3173331549
+	.long	3047047168
+	.long	1068533144
+	.long	1879674924
+	.long	3172459997
+	.long	3221667840
+	.long	1068427825
+	.long	1338588027
+	.long	3171815742
+	.long	3453861888
+	.long	1068288883
+	.long	1205348359
+	.long	3172624626
+	.long	3506110464
+	.long	1068150514
+	.long	893105198
+	.long	1025571866
+	.long	346013696
+	.long	1068012714
+	.long	3495569021
+	.long	3172563349
+	.long	4074029056
+	.long	1067875476
+	.long	3961106338
+	.long	3171065595
+	.long	3559784448
+	.long	1067738798
+	.long	1975385384
+	.long	3173783155
+	.long	797769728
+	.long	1067602675
+	.long	3760305787
+	.long	1026047642
+	.long	2313633792
+	.long	1067467101
+	.long	1559353171
+	.long	1023480256
+	.long	3960766464
+	.long	1067213778
+	.long	1067365107
+	.long	1025865926
+	.long	684261376
+	.long	1066944805
+	.long	844762164
+	.long	3173687482
+	.long	630718464
+	.long	1066676905
+	.long	2458269694
+	.long	1024033081
+	.long	1486061568
+	.long	1066410070
+	.long	115537874
+	.long	3173243995
+	.long	2743664640
+	.long	1065886792
+	.long	3665098304
+	.long	3173471607
+	.long	1971912704
+	.long	1065357333
+	.long	2577214440
+	.long	3171993451
+	.long	1498939392
+	.long	1064306693
+	.long	3409036923
+	.long	1025599151
+	.long	0
+	.long	0
+	.long	0
+	.long	2147483648
+	.type	L_tbl,@object
+	.size	L_tbl,2064
+	.align 16
+log2:
+	.long	4277811200
+	.long	1067855426
+	.long	2479318832
+	.long	1022292823
+	.type	log2,@object
+	.size	log2,16
+	.align 16
+coeff:
+	.long	2454267026
+	.long	1069697316
+	.long	0
+	.long	3218079744
+	.long	1030730101
+	.long	3217380702
+	.long	1431655765
+	.long	1070945621
+	.long	2576980378
+	.long	1070176665
+	.long	0
+	.long	3219128320
+	.type	coeff,@object
+	.size	coeff,48
+	.data
+	.section .note.GNU-stack, ""
+// -- Begin DWARF2 SEGMENT .eh_frame
+	.section .eh_frame,"a",@progbits
+.eh_frame_seg:
+	.align 1
+	.4byte 0x00000014
+	.8byte 0x00527a0100000000
+	.8byte 0x08070c1b01107801
+	.4byte 0x00000190
+	.4byte 0x0000001c
+	.4byte 0x0000001c
+	.4byte ..___tag_value_log.1-.
+	.4byte ..___tag_value_log.5-..___tag_value_log.1
+	.2byte 0x0400
+	.4byte ..___tag_value_log.3-..___tag_value_log.1
+	.2byte 0x200e
+	.byte 0x04
+	.4byte ..___tag_value_log.4-..___tag_value_log.3
+	.2byte 0x080e
+	.byte 0x00
+# End
diff --git a/libm/x86_64/e_pow.S b/libm/x86_64/e_pow.S
new file mode 100644
index 0000000..9ec3828
--- /dev/null
+++ b/libm/x86_64/e_pow.S
@@ -0,0 +1,4282 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    * this list of conditions and the following disclaimer in the documentation
+    * and/or other materials provided with the distribution.
+
+    * Neither the name of Intel Corporation nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************************************************/
+//                     ALGORITHM DESCRIPTION
+//                     ---------------------
+//
+//    Let x=2^k * mx, mx in [1,2)
+//
+//    log2(x) calculation:
+//
+//    Get B~1/mx based on the output of rcpps instruction (B0)
+//    B = int((B0*LH*2^9+0.5))/2^9
+//    LH is a short approximation for log2(e)
+//
+//    Reduced argument, scaled by LH:
+//                r=B*mx-LH (computed accurately in high and low parts)
+//
+//    log2(x) result:  k - log2(B) + p(r)
+//             p(r) is a degree 8 polynomial
+//             -log2(B) read from data table (high, low parts)
+//             log2(x) is formed from high and low parts
+//    For |x| in [1-1/32, 1+1/16), a slower but more accurate computation
+//    based om the same table design is performed.
+//
+//   Main path is taken if | floor(log2(|log2(|x|)|) + floor(log2|y|) | < 8,
+//   to filter out all potential OF/UF cases.
+//   exp2(y*log2(x)) is computed using an 8-bit index table and a degree 5
+//   polynomial
+//
+// Special cases:
+//  pow(-0,y) = -INF and raises the divide-by-zero exception for y an odd 
+//  integer < 0.
+//  pow(-0,y) = +INF and raises the divide-by-zero exception for y < 0 and 
+//  not an odd integer.
+//  pow(-0,y) = -0 for y an odd integer > 0.
+//  pow(-0,y) = +0 for y > 0 and not an odd integer.
+//  pow(-1,-INF) = 1.
+//  pow(+1,y) = 1 for any y, even a NaN.
+//  pow(x,-0) = 1 for any x, even a NaN.
+//  pow(x,y) = a NaN and raises the invalid exception for finite x < 0 and
+//  finite non-integer y.
+//  pow(x,-INF) = +INF for |x|<1.
+//  pow(x,-INF) = +0 for |x|>1.
+//  pow(x,+INF) = +0 for |x|<1.
+//  pow(x,+INF) = +INF for |x|>1.
+//  pow(-INF,y) = -0 for y an odd integer < 0.
+//  pow(-INF,y) = +0 for y < 0 and not an odd integer.
+//  pow(-INF,y) = -INF for y an odd integer > 0.
+//  pow(-INF,y) = +INF for y > 0 and not an odd integer.
+//  pow(+INF,y) = +0 for y <0.
+//  pow(+INF,y) = +INF for y >0.
+//
+/******************************************************************************/
+
+#include <private/bionic_asm.h>
+# -- Begin  pow
+ENTRY(pow)
+# parameter 1: %xmm0
+# parameter 2: %xmm1
+..B1.1:
+..___tag_value_pow.1:
+        subq      $40, %rsp
+..___tag_value_pow.3:
+        movsd     %xmm0, 8(%rsp)
+        movsd     %xmm1, 16(%rsp)
+..B1.2:
+        pextrw    $3, %xmm0, %eax
+        xorpd     %xmm2, %xmm2
+        movq      $0x3ff0000000000000, %r9
+        movd      %r9, %xmm2
+        movl      $1069088768, %r8d
+        movd      %r8, %xmm7
+        xorpd     %xmm1, %xmm1
+        movq      $0x77f0000000000000, %r10
+        movd      %r10, %xmm1
+        movq      %xmm0, %xmm3
+        movl      $32752, %edx
+        andl      %eax, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        orpd      %xmm2, %xmm0
+        movapd    HIGHSIGMASK(%rip), %xmm6
+        psrlq     $27, %xmm0
+        movq      LOG2_E(%rip), %xmm2
+        psrld     $2, %xmm0
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        rcpps     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        movl      $8192, %r11d
+        movd      %r11, %xmm4
+        psrlq     $12, %xmm3
+        subl      $16, %eax
+        cmpl      $32736, %eax
+        jae       .L_2TAG_PACKET_0.0.2
+        movq      $0, %r8
+.L_2TAG_PACKET_1.0.2:
+        mulss     %xmm7, %xmm0
+        movl      $-1, %edx
+        subl      $4, %ecx
+        shll      %cl, %edx
+        shlq      $32, %rdx
+        movd      %rdx, %xmm5
+        orpd      %xmm1, %xmm3
+        subl      $16351, %eax
+        cmpl      $1, %eax
+        jbe       .L_2TAG_PACKET_2.0.2
+        paddd     %xmm4, %xmm0
+        andpd     %xmm3, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+.L_2TAG_PACKET_3.0.2:
+        subsd     %xmm5, %xmm3
+        andpd     %xmm6, %xmm0
+        subl      $1, %eax
+        sarl      $4, %eax
+        cvtsi2sd  %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+.L_2TAG_PACKET_4.0.2:
+        mulsd     %xmm0, %xmm3
+        movapd    coeff(%rip), %xmm1
+        lea       L_tbl(%rip), %r11
+        subsd     %xmm2, %xmm5
+        movapd    16+coeff(%rip), %xmm4
+        movl      %eax, %ecx
+        sarl      $31, %eax
+        addl      %eax, %ecx
+        xorl      %ecx, %eax
+        addl      $1, %eax
+        bsr       %eax, %eax
+        unpcklpd  %xmm3, %xmm5
+        movapd    32+coeff(%rip), %xmm6
+        addsd     %xmm5, %xmm3
+        andl      $16760832, %edx
+        shrl      $10, %edx
+        addpd     -3648(%r11,%rdx), %xmm5
+        movapd    48+coeff(%rip), %xmm0
+        pshufd    $68, %xmm3, %xmm2
+        mulsd     %xmm3, %xmm3
+        mulpd     %xmm2, %xmm1
+        mulpd     %xmm2, %xmm4
+        addsd     %xmm7, %xmm5
+        mulsd     %xmm3, %xmm2
+        addpd     %xmm1, %xmm6
+        mulsd     %xmm3, %xmm3
+        addpd     %xmm4, %xmm0
+        movq      16(%rsp), %xmm1
+        movw      22(%rsp), %cx
+        pshufd    $238, %xmm5, %xmm7
+        movq      HIGHMASK_Y(%rip), %xmm4
+        mulpd     %xmm2, %xmm6
+        pshufd    $68, %xmm3, %xmm3
+        mulpd     %xmm2, %xmm0
+        shll      $4, %eax
+        subl      $15872, %eax
+        andl      $32752, %ecx
+        addl      %ecx, %eax
+        mulpd     %xmm6, %xmm3
+        cmpl      $624, %eax
+        jae       .L_2TAG_PACKET_5.0.2
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %edx
+        pinsrw    $3, %edx, %xmm6
+        movq      %xmm1, %xmm2
+        andpd     %xmm1, %xmm4
+        subsd     %xmm4, %xmm1
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm7, %xmm0
+        mulsd     %xmm5, %xmm1
+        movq      %xmm6, %xmm7
+        addsd     %xmm4, %xmm6
+        lea       T_exp(%rip), %r11
+        addpd     %xmm0, %xmm3
+        movd      %xmm6, %edx
+        subsd     %xmm7, %xmm6
+        pshufd    $238, %xmm3, %xmm0
+        subsd     %xmm6, %xmm4
+        addsd     %xmm3, %xmm0
+        movl      %edx, %ecx
+        andl      $255, %edx
+        addl      %edx, %edx
+        movapd    (%r11,%rdx,8), %xmm5
+        addsd     %xmm1, %xmm4
+        mulsd     %xmm0, %xmm2
+        movapd    e_coeff(%rip), %xmm7
+        movapd    16+e_coeff(%rip), %xmm3
+        shll      $12, %ecx
+        xorl      %r8d, %ecx
+        andl      $-1048576, %ecx
+        movd      %rcx, %xmm6
+        addsd     %xmm4, %xmm2
+        movq      $0x3fe62e42fefa39ef, %r9
+        movd      %r9, %xmm1
+        pshufd    $68, %xmm2, %xmm0
+        pshufd    $68, %xmm2, %xmm4
+        mulsd     %xmm2, %xmm1
+        pshufd    $17, %xmm6, %xmm6
+        mulpd     %xmm0, %xmm0
+        mulpd     %xmm4, %xmm7
+        paddd     %xmm6, %xmm5
+        mulsd     %xmm5, %xmm1
+        pshufd    $238, %xmm5, %xmm6
+        mulsd     %xmm0, %xmm0
+        addpd     %xmm7, %xmm3
+        addsd     %xmm6, %xmm1
+        mulpd     %xmm3, %xmm0
+        pshufd    $238, %xmm0, %xmm3
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        addsd     %xmm1, %xmm0
+        addsd     %xmm3, %xmm0
+        addsd     %xmm5, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_0.0.2:
+        addl      $16, %eax
+        movl      $32752, %edx
+        andl      %eax, %edx
+        cmpl      $32752, %edx
+        je        .L_2TAG_PACKET_6.0.2
+        testl     $32768, %eax
+        jne       .L_2TAG_PACKET_7.0.2
+.L_2TAG_PACKET_8.0.2:
+        movq      8(%rsp), %xmm0
+        movq      8(%rsp), %xmm3
+        movd      %xmm3, %edx
+        psrlq     $32, %xmm3
+        movd      %xmm3, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_9.0.2
+        xorpd     %xmm3, %xmm3
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm3
+        mulsd     %xmm3, %xmm0
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        movq      %xmm0, %xmm3
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        movl      $18416, %ecx
+        psrlq     $27, %xmm0
+        movq      LOG2_E(%rip), %xmm2
+        psrld     $2, %xmm0
+        rcpps     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        movapd    HIGHSIGMASK(%rip), %xmm6
+        psrlq     $12, %xmm3
+        mulss     %xmm7, %xmm0
+        movl      $-1024, %edx
+        movd      %edx, %xmm5
+        orpd      %xmm1, %xmm3
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm3, %xmm5
+        movl      $0, %r8d
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        andl      $32752, %eax
+        subl      $18416, %eax
+        sarl      $4, %eax
+        cvtsi2sd  %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        jmp       .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_10.0.2:
+        movq      8(%rsp), %xmm0
+        movq      8(%rsp), %xmm3
+        movd      %xmm3, %edx
+        psrlq     $32, %xmm3
+        movd      %xmm3, %ecx
+        orl       %ecx, %edx
+        cmpl      $0, %edx
+        je        .L_2TAG_PACKET_9.0.2
+        xorpd     %xmm3, %xmm3
+        movl      $18416, %eax
+        pinsrw    $3, %eax, %xmm3
+        mulsd     %xmm3, %xmm0
+        xorpd     %xmm2, %xmm2
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm2
+        movq      %xmm0, %xmm3
+        pextrw    $3, %xmm0, %eax
+        orpd      %xmm2, %xmm0
+        movl      $18416, %ecx
+        psrlq     $27, %xmm0
+        movq      LOG2_E(%rip), %xmm2
+        psrld     $2, %xmm0
+        rcpps     %xmm0, %xmm0
+        psllq     $12, %xmm3
+        movapd    HIGHSIGMASK(%rip), %xmm6
+        psrlq     $12, %xmm3
+        mulss     %xmm7, %xmm0
+        movl      $-1024, %edx
+        movd      %edx, %xmm5
+        orpd      %xmm1, %xmm3
+        paddd     %xmm4, %xmm0
+        psllq     $32, %xmm5
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        andpd     %xmm3, %xmm5
+        movl      $-2147483648, %r8d
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        andl      $32752, %eax
+        subl      $18416, %eax
+        sarl      $4, %eax
+        cvtsi2sd  %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        jmp       .L_2TAG_PACKET_4.0.2
+.L_2TAG_PACKET_5.0.2:
+        cmpl      $0, %eax
+        jl        .L_2TAG_PACKET_11.0.2
+        cmpl      $736, %eax
+        jae       .L_2TAG_PACKET_12.0.2
+        addsd     %xmm7, %xmm0
+        movq      HALFMASK(%rip), %xmm2
+        addpd     %xmm0, %xmm3
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %eax
+        pinsrw    $3, %eax, %xmm6
+        pshufd    $238, %xmm3, %xmm0
+        addsd     %xmm3, %xmm0
+        movq      %xmm5, %xmm3
+        addsd     %xmm0, %xmm5
+        movq      %xmm2, %xmm4
+        subsd     %xmm5, %xmm3
+        movq      %xmm5, %xmm7
+        andpd     %xmm2, %xmm5
+        movq      %xmm1, %xmm2
+        andpd     %xmm1, %xmm4
+        subsd     %xmm5, %xmm7
+        addsd     %xmm3, %xmm0
+        subsd     %xmm4, %xmm1
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm7, %xmm0
+        mulsd     %xmm0, %xmm2
+        movq      %xmm6, %xmm7
+        mulsd     %xmm5, %xmm1
+        addsd     %xmm4, %xmm6
+        movd      %xmm6, %eax
+        subsd     %xmm7, %xmm6
+        lea       T_exp(%rip), %r11
+        addsd     %xmm1, %xmm2
+        movapd    e_coeff(%rip), %xmm7
+        movapd    16+e_coeff(%rip), %xmm3
+        subsd     %xmm6, %xmm4
+        pextrw    $3, %xmm6, %edx
+        movl      %eax, %ecx
+        andl      $255, %eax
+        addl      %eax, %eax
+        movapd    (%r11,%rax,8), %xmm5
+        addsd     %xmm4, %xmm2
+        sarl      $8, %ecx
+        movl      %ecx, %eax
+        sarl      $1, %ecx
+        subl      %ecx, %eax
+        shll      $20, %ecx
+        xorl      %r8d, %ecx
+        movd      %ecx, %xmm6
+        movq      32+e_coeff(%rip), %xmm1
+        andl      $32767, %edx
+        cmpl      $16529, %edx
+        ja        .L_2TAG_PACKET_12.0.2
+        pshufd    $68, %xmm2, %xmm0
+        pshufd    $68, %xmm2, %xmm4
+        mulpd     %xmm0, %xmm0
+        mulpd     %xmm4, %xmm7
+        pshufd    $17, %xmm6, %xmm6
+        mulsd     %xmm2, %xmm1
+        mulsd     %xmm0, %xmm0
+        paddd     %xmm6, %xmm5
+        addpd     %xmm7, %xmm3
+        mulsd     %xmm5, %xmm1
+        pshufd    $238, %xmm5, %xmm6
+        mulpd     %xmm3, %xmm0
+        addsd     %xmm6, %xmm1
+        pshufd    $238, %xmm0, %xmm3
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        shll      $4, %eax
+        xorpd     %xmm4, %xmm4
+        addl      $16368, %eax
+        pinsrw    $3, %eax, %xmm4
+        addsd     %xmm1, %xmm0
+        addsd     %xmm3, %xmm0
+        movq      %xmm0, %xmm1
+        addsd     %xmm5, %xmm0
+        mulsd     %xmm4, %xmm0
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        je        .L_2TAG_PACKET_13.0.2
+        cmpl      $32752, %eax
+        je        .L_2TAG_PACKET_14.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_6.0.2:
+        movq      16(%rsp), %xmm1
+        movq      8(%rsp), %xmm0
+        movq      %xmm0, %xmm2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_15.0.2
+        movd      %xmm1, %eax
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_16.0.2
+        addsd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_16.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        movl      $29, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_18.0.2:
+        movq      16(%rsp), %xmm0
+        addpd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_15.0.2:
+        movd      %xmm1, %eax
+        movq      %xmm1, %xmm2
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_19.0.2
+        pextrw    $3, %xmm2, %eax
+        andl      $32752, %eax
+        cmpl      $32752, %eax
+        jne       .L_2TAG_PACKET_20.0.2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        jne       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_20.0.2:
+        pextrw    $3, %xmm0, %eax
+        testl     $32768, %eax
+        jne       .L_2TAG_PACKET_21.0.2
+        testl     $-2147483648, %ecx
+        jne       .L_2TAG_PACKET_22.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_23.0.2:
+        movq      16(%rsp), %xmm1
+        movd      %xmm1, %eax
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_24.0.2
+        testl     $2, %eax
+        jne       .L_2TAG_PACKET_25.0.2
+        jmp       .L_2TAG_PACKET_24.0.2
+.L_2TAG_PACKET_21.0.2:
+        shrl      $20, %ecx
+        andl      $2047, %ecx
+        cmpl      $1075, %ecx
+        ja        .L_2TAG_PACKET_24.0.2
+        je        .L_2TAG_PACKET_26.0.2
+        cmpl      $1074, %ecx
+        ja        .L_2TAG_PACKET_23.0.2
+        cmpl      $1023, %ecx
+        jb        .L_2TAG_PACKET_24.0.2
+        movq      16(%rsp), %xmm1
+        movl      $17208, %eax
+        xorpd     %xmm3, %xmm3
+        pinsrw    $3, %eax, %xmm3
+        movq      %xmm3, %xmm4
+        addsd     %xmm1, %xmm3
+        subsd     %xmm3, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        jne       .L_2TAG_PACKET_24.0.2
+        movd      %xmm3, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_24.0.2
+.L_2TAG_PACKET_25.0.2:
+        movq      16(%rsp), %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32768, %eax
+        jne       .L_2TAG_PACKET_27.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_27.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $32768, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_24.0.2:
+        movq      16(%rsp), %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32768, %eax
+        jne       .L_2TAG_PACKET_22.0.2
+        xorpd     %xmm0, %xmm0
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_26.0.2:
+        movq      16(%rsp), %xmm1
+        movd      %xmm1, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_24.0.2
+        jmp       .L_2TAG_PACKET_25.0.2
+.L_2TAG_PACKET_28.0.2:
+        movd      %xmm1, %eax
+        psrlq     $20, %xmm1
+        movd      %xmm1, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_29.0.2
+        movq      16(%rsp), %xmm0
+        addsd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_29.0.2:
+        movq      8(%rsp), %xmm0
+        pextrw    $3, %xmm0, %eax
+        cmpl      $49136, %eax
+        jne       .L_2TAG_PACKET_30.0.2
+        movd      %xmm0, %ecx
+        psrlq     $20, %xmm0
+        movd      %xmm0, %edx
+        orl       %edx, %ecx
+        jne       .L_2TAG_PACKET_30.0.2
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_30.0.2:
+        movq      16(%rsp), %xmm1
+        andl      $32752, %eax
+        subl      $16368, %eax
+        pextrw    $3, %xmm1, %edx
+        xorpd     %xmm0, %xmm0
+        xorl      %edx, %eax
+        andl      $32768, %eax
+        je        .L_2TAG_PACKET_31.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_31.0.2:
+        movl      $32752, %ecx
+        pinsrw    $3, %ecx, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_32.0.2:
+        movd      %xmm1, %eax
+        cmpl      $17184, %edx
+        ja        .L_2TAG_PACKET_33.0.2
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_34.0.2
+        testl     $2, %eax
+        je        .L_2TAG_PACKET_35.0.2
+        jmp       .L_2TAG_PACKET_36.0.2
+.L_2TAG_PACKET_33.0.2:
+        testl     $1, %eax
+        je        .L_2TAG_PACKET_35.0.2
+        jmp       .L_2TAG_PACKET_36.0.2
+.L_2TAG_PACKET_7.0.2:
+        movq      8(%rsp), %xmm2
+        movd      %xmm2, %eax
+        psrlq     $31, %xmm2
+        movd      %xmm2, %ecx
+        orl       %ecx, %eax
+        je        .L_2TAG_PACKET_9.0.2
+        movq      16(%rsp), %xmm1
+        pextrw    $3, %xmm1, %edx
+        movd      %xmm1, %eax
+        movq      %xmm1, %xmm2
+        psrlq     $32, %xmm2
+        movd      %xmm2, %ecx
+        addl      %ecx, %ecx
+        orl       %eax, %ecx
+        je        .L_2TAG_PACKET_37.0.2
+        andl      $32752, %edx
+        cmpl      $32752, %edx
+        je        .L_2TAG_PACKET_28.0.2
+        cmpl      $17200, %edx
+        ja        .L_2TAG_PACKET_35.0.2
+        cmpl      $17184, %edx
+        jae       .L_2TAG_PACKET_32.0.2
+        cmpl      $16368, %edx
+        jb        .L_2TAG_PACKET_34.0.2
+        movl      $17208, %eax
+        xorpd     %xmm2, %xmm2
+        pinsrw    $3, %eax, %xmm2
+        movq      %xmm2, %xmm4
+        addsd     %xmm1, %xmm2
+        subsd     %xmm2, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32767, %eax
+        jne       .L_2TAG_PACKET_34.0.2
+        movd      %xmm2, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_35.0.2
+.L_2TAG_PACKET_36.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm1
+        movq      LOG2_E(%rip), %xmm2
+        movq      8(%rsp), %xmm4
+        pextrw    $3, %xmm4, %eax
+        movl      $8192, %edx
+        movd      %edx, %xmm4
+        andl      $32767, %eax
+        subl      $16, %eax
+        jl        .L_2TAG_PACKET_10.0.2
+        movl      %eax, %edx
+        andl      $32752, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        movl      $-2147483648, %r8d
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_34.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $32752, %eax
+        pinsrw    $3, %eax, %xmm1
+        xorpd     %xmm0, %xmm0
+        mulsd     %xmm1, %xmm0
+        movl      $28, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_35.0.2:
+        xorpd     %xmm1, %xmm1
+        movl      $30704, %edx
+        pinsrw    $3, %edx, %xmm1
+        movq      LOG2_E(%rip), %xmm2
+        movq      8(%rsp), %xmm4
+        pextrw    $3, %xmm4, %eax
+        movl      $8192, %edx
+        movd      %edx, %xmm4
+        andl      $32767, %eax
+        subl      $16, %eax
+        jl        .L_2TAG_PACKET_8.0.2
+        movl      %eax, %edx
+        andl      $32752, %edx
+        subl      $16368, %edx
+        movl      %edx, %ecx
+        sarl      $31, %edx
+        addl      %edx, %ecx
+        xorl      %edx, %ecx
+        addl      $16, %ecx
+        bsr       %ecx, %ecx
+        movl      $0, %r8d
+        jmp       .L_2TAG_PACKET_1.0.2
+.L_2TAG_PACKET_19.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_22.0.2:
+        xorpd     %xmm0, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_11.0.2:
+        addl      $384, %eax
+        cmpl      $0, %eax
+        jl        .L_2TAG_PACKET_38.0.2
+        mulsd     %xmm1, %xmm5
+        addsd     %xmm7, %xmm0
+        shrl      $31, %r8d
+        addpd     %xmm0, %xmm3
+        pshufd    $238, %xmm3, %xmm0
+        addsd     %xmm0, %xmm3
+        lea       log2(%rip), %r11
+        movq      (%r11,%r8,8), %xmm4
+        mulsd     %xmm3, %xmm1
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        shll      $15, %r8d
+        orl       %r8d, %eax
+        pinsrw    $3, %eax, %xmm0
+        addsd     %xmm1, %xmm5
+        mulsd     %xmm4, %xmm5
+        addsd     %xmm5, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_38.0.2:
+.L_2TAG_PACKET_37.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_39.0.2:
+        xorpd     %xmm0, %xmm0
+        movl      $16368, %eax
+        pinsrw    $3, %eax, %xmm0
+        movl      $26, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_9.0.2:
+        movq      16(%rsp), %xmm1
+        movq      %xmm1, %xmm2
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        cmpl      $32752, %eax
+        jne       .L_2TAG_PACKET_40.0.2
+        movd      %xmm2, %eax
+        psrlq     $20, %xmm2
+        movd      %xmm2, %edx
+        orl       %edx, %eax
+        jne       .L_2TAG_PACKET_18.0.2
+.L_2TAG_PACKET_40.0.2:
+        movd      %xmm1, %eax
+        psrlq     $32, %xmm1
+        movd      %xmm1, %edx
+        movl      %edx, %ecx
+        addl      %edx, %edx
+        orl       %edx, %eax
+        je        .L_2TAG_PACKET_39.0.2
+        shrl      $21, %edx
+        cmpl      $1075, %edx
+        ja        .L_2TAG_PACKET_41.0.2
+        je        .L_2TAG_PACKET_42.0.2
+        cmpl      $1023, %edx
+        jb        .L_2TAG_PACKET_41.0.2
+        movq      16(%rsp), %xmm1
+        movl      $17208, %eax
+        xorpd     %xmm3, %xmm3
+        pinsrw    $3, %eax, %xmm3
+        movq      %xmm3, %xmm4
+        addsd     %xmm1, %xmm3
+        subsd     %xmm3, %xmm4
+        addsd     %xmm4, %xmm1
+        pextrw    $3, %xmm1, %eax
+        andl      $32752, %eax
+        jne       .L_2TAG_PACKET_41.0.2
+        movd      %xmm3, %eax
+        andl      $1, %eax
+        je        .L_2TAG_PACKET_41.0.2
+.L_2TAG_PACKET_43.0.2:
+        movq      8(%rsp), %xmm0
+        testl     $-2147483648, %ecx
+        jne       .L_2TAG_PACKET_44.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_42.0.2:
+        movq      16(%rsp), %xmm1
+        movd      %xmm1, %eax
+        testl     $1, %eax
+        jne       .L_2TAG_PACKET_43.0.2
+.L_2TAG_PACKET_41.0.2:
+        testl     $-2147483648, %ecx
+        je        .L_2TAG_PACKET_22.0.2
+        xorpd     %xmm0, %xmm0
+.L_2TAG_PACKET_44.0.2:
+        movl      $16368, %eax
+        xorpd     %xmm1, %xmm1
+        pinsrw    $3, %eax, %xmm1
+        divsd     %xmm0, %xmm1
+        movq      %xmm1, %xmm0
+        movl      $27, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_12.0.2:
+        movq      8(%rsp), %xmm2
+        movq      16(%rsp), %xmm6
+        pextrw    $3, %xmm2, %eax
+        pextrw    $3, %xmm6, %edx
+        movl      $32752, %ecx
+        andl      %edx, %ecx
+        cmpl      $32752, %ecx
+        je        .L_2TAG_PACKET_45.0.2
+        andl      $32752, %eax
+        subl      $16368, %eax
+        xorl      %eax, %edx
+        testl     $32768, %edx
+        jne       .L_2TAG_PACKET_46.0.2
+.L_2TAG_PACKET_47.0.2:
+        movl      $32736, %eax
+        pinsrw    $3, %eax, %xmm0
+        shrl      $16, %r8d
+        orl       %r8d, %eax
+        pinsrw    $3, %eax, %xmm1
+        mulsd     %xmm1, %xmm0
+.L_2TAG_PACKET_14.0.2:
+        movl      $24, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_46.0.2:
+        movl      $16, %eax
+        pinsrw    $3, %eax, %xmm0
+        mulsd     %xmm0, %xmm0
+        testl     $-2147483648, %r8d
+        je        .L_2TAG_PACKET_48.0.2
+        movq      $0x8000000000000000, %r9
+        movd      %r9, %xmm2
+        xorpd     %xmm2, %xmm0
+.L_2TAG_PACKET_48.0.2:
+        movl      $25, (%rsp)
+        jmp       .L_2TAG_PACKET_17.0.2
+.L_2TAG_PACKET_13.0.2:
+        pextrw    $3, %xmm5, %ecx
+        pextrw    $3, %xmm4, %edx
+        movl      $-1, %eax
+        andl      $32752, %ecx
+        subl      $16368, %ecx
+        andl      $32752, %edx
+        addl      %ecx, %edx
+        movl      $-31, %ecx
+        sarl      $4, %edx
+        subl      %edx, %ecx
+        jle       .L_2TAG_PACKET_49.0.2
+        cmpl      $20, %ecx
+        ja        .L_2TAG_PACKET_50.0.2
+        shll      %cl, %eax
+.L_2TAG_PACKET_49.0.2:
+        movd      %eax, %xmm0
+        psllq     $32, %xmm0
+        andpd     %xmm5, %xmm0
+        subsd     %xmm0, %xmm5
+        addsd     %xmm1, %xmm5
+        mulsd     %xmm4, %xmm0
+        mulsd     %xmm4, %xmm5
+        addsd     %xmm5, %xmm0
+.L_2TAG_PACKET_50.0.2:
+        jmp       .L_2TAG_PACKET_48.0.2
+.L_2TAG_PACKET_2.0.2:
+        movw      22(%rsp), %cx
+        movl      $-2147483648, %edx
+        movd      %rdx, %xmm1
+        xorpd     %xmm7, %xmm7
+        paddd     %xmm4, %xmm0
+        movd      %xmm0, %edx
+        psllq     $29, %xmm0
+        paddq     %xmm3, %xmm1
+        andpd     %xmm1, %xmm5
+        andw      $32752, %cx
+        cmpw      $16560, %cx
+        jb        .L_2TAG_PACKET_3.0.2
+        andpd     %xmm6, %xmm0
+        subsd     %xmm5, %xmm3
+        addl      $16351, %eax
+        shrl      $4, %eax
+        subl      $1022, %eax
+        cvtsi2sd  %eax, %xmm7
+        mulpd     %xmm0, %xmm5
+        lea       L_tbl(%rip), %r11
+        movq      coeff_h(%rip), %xmm4
+        mulsd     %xmm0, %xmm3
+        movq      coeff_h(%rip), %xmm6
+        subsd     %xmm2, %xmm5
+        movq      8+coeff_h(%rip), %xmm1
+        pshufd    $68, %xmm3, %xmm2
+        unpcklpd  %xmm3, %xmm5
+        addsd     %xmm5, %xmm3
+        movq      8+coeff_h(%rip), %xmm0
+        andl      $16760832, %edx
+        shrl      $10, %edx
+        addpd     -3648(%r11,%rdx), %xmm7
+        mulsd     %xmm5, %xmm4
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm2, %xmm6
+        mulsd     %xmm2, %xmm1
+        movq      %xmm5, %xmm2
+        mulsd     %xmm5, %xmm4
+        addsd     %xmm0, %xmm5
+        movq      %xmm7, %xmm0
+        addsd     %xmm3, %xmm2
+        addsd     %xmm5, %xmm7
+        mulsd     %xmm2, %xmm6
+        subsd     %xmm7, %xmm0
+        movq      %xmm7, %xmm2
+        addsd     %xmm4, %xmm7
+        addsd     %xmm5, %xmm0
+        subsd     %xmm7, %xmm2
+        addsd     %xmm2, %xmm4
+        pshufd    $238, %xmm5, %xmm2
+        movq      %xmm7, %xmm5
+        addsd     %xmm2, %xmm7
+        addsd     %xmm0, %xmm4
+        movapd    coeff(%rip), %xmm0
+        subsd     %xmm7, %xmm5
+        addsd     %xmm4, %xmm6
+        movq      %xmm7, %xmm4
+        addsd     %xmm2, %xmm5
+        addsd     %xmm1, %xmm7
+        movapd    64+coeff(%rip), %xmm2
+        subsd     %xmm7, %xmm4
+        addsd     %xmm5, %xmm6
+        addsd     %xmm1, %xmm4
+        pshufd    $238, %xmm7, %xmm5
+        movapd    %xmm7, %xmm1
+        addsd     %xmm5, %xmm7
+        subsd     %xmm7, %xmm1
+        addsd     %xmm5, %xmm1
+        movapd    80+coeff(%rip), %xmm5
+        pshufd    $68, %xmm3, %xmm3
+        addsd     %xmm4, %xmm6
+        addsd     %xmm1, %xmm6
+        movapd    32+coeff(%rip), %xmm1
+        mulpd     %xmm3, %xmm0
+        mulpd     %xmm3, %xmm2
+        pshufd    $68, %xmm3, %xmm4
+        mulpd     %xmm3, %xmm3
+        addpd     %xmm1, %xmm0
+        addpd     %xmm2, %xmm5
+        mulsd     %xmm3, %xmm4
+        movq      HIGHMASK_LOG_X(%rip), %xmm2
+        mulpd     %xmm3, %xmm3
+        movq      16(%rsp), %xmm1
+        movw      22(%rsp), %cx
+        mulpd     %xmm4, %xmm0
+        pextrw    $3, %xmm7, %eax
+        mulpd     %xmm4, %xmm5
+        mulpd     %xmm3, %xmm0
+        movq      8+HIGHMASK_Y(%rip), %xmm4
+        andpd     %xmm7, %xmm2
+        addsd     %xmm6, %xmm5
+        subsd     %xmm2, %xmm7
+        addpd     %xmm0, %xmm5
+        andl      $32752, %eax
+        subl      $16368, %eax
+        andl      $32752, %ecx
+        cmpl      $32752, %ecx
+        je        .L_2TAG_PACKET_45.0.2
+        addl      %eax, %ecx
+        cmpl      $16576, %ecx
+        jae       .L_2TAG_PACKET_51.0.2
+        pshufd    $238, %xmm5, %xmm0
+        andpd     %xmm1, %xmm4
+        movq      %xmm1, %xmm3
+        addsd     %xmm0, %xmm5
+        subsd     %xmm4, %xmm1
+        xorpd     %xmm6, %xmm6
+        movl      $17080, %edx
+        pinsrw    $3, %edx, %xmm6
+        addsd     %xmm5, %xmm7
+        mulsd     %xmm2, %xmm4
+        mulsd     %xmm2, %xmm1
+        movq      %xmm6, %xmm5
+        mulsd     %xmm7, %xmm3
+        addsd     %xmm4, %xmm6
+        addsd     %xmm3, %xmm1
+        movapd    e_coeff(%rip), %xmm7
+        movd      %xmm6, %edx
+        subsd     %xmm5, %xmm6
+        lea       T_exp(%rip), %r11
+        movapd    16+e_coeff(%rip), %xmm3
+        movq      32+e_coeff(%rip), %xmm2
+        subsd     %xmm6, %xmm4
+        movl      %edx, %ecx
+        andl      $255, %edx
+        addl      %edx, %edx
+        movapd    (%r11,%rdx,8), %xmm5
+        addsd     %xmm1, %xmm4
+        pextrw    $3, %xmm6, %edx
+        shrl      $8, %ecx
+        movl      %ecx, %eax
+        shrl      $1, %ecx
+        subl      %ecx, %eax
+        shll      $20, %ecx
+        movd      %ecx, %xmm6
+        pshufd    $68, %xmm4, %xmm0
+        pshufd    $68, %xmm4, %xmm1
+        mulpd     %xmm0, %xmm0
+        mulpd     %xmm1, %xmm7
+        pshufd    $17, %xmm6, %xmm6
+        mulsd     %xmm4, %xmm2
+        andl      $32767, %edx
+        cmpl      $16529, %edx
+        ja        .L_2TAG_PACKET_12.0.2
+        mulsd     %xmm0, %xmm0
+        paddd     %xmm6, %xmm5
+        addpd     %xmm7, %xmm3
+        mulsd     %xmm5, %xmm2
+        pshufd    $238, %xmm5, %xmm6
+        mulpd     %xmm3, %xmm0
+        addsd     %xmm6, %xmm2
+        pshufd    $238, %xmm0, %xmm3
+        addl      $1023, %eax
+        shll      $20, %eax
+        orl       %r8d, %eax
+        movd      %eax, %xmm4
+        mulsd     %xmm5, %xmm0
+        mulsd     %xmm5, %xmm3
+        addsd     %xmm2, %xmm0
+        psllq     $32, %xmm4
+        addsd     %xmm3, %xmm0
+        movq      %xmm0, %xmm1
+        addsd     %xmm5, %xmm0
+        mulsd     %xmm4, %xmm0
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        je        .L_2TAG_PACKET_13.0.2
+        cmpl      $32752, %eax
+        je        .L_2TAG_PACKET_14.0.2
+.L_2TAG_PACKET_52.0.2:
+        jmp       ..B1.5
+.L_2TAG_PACKET_45.0.2:
+        movq      8(%rsp), %xmm0
+        xorpd     %xmm2, %xmm2
+        movl      $49136, %eax
+        pinsrw    $3, %eax, %xmm2
+        addsd     %xmm0, %xmm2
+        pextrw    $3, %xmm2, %eax
+        cmpl      $0, %eax
+        jne       .L_2TAG_PACKET_53.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_53.0.2:
+        movq      16(%rsp), %xmm1
+        movd      %xmm1, %edx
+        movq      %xmm1, %xmm3
+        psrlq     $20, %xmm3
+        movd      %xmm3, %ecx
+        orl       %edx, %ecx
+        je        .L_2TAG_PACKET_54.0.2
+        addsd     %xmm1, %xmm1
+        movq      %xmm1, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_51.0.2:
+        pextrw    $3, %xmm1, %eax
+        pextrw    $3, %xmm2, %ecx
+        xorl      %ecx, %eax
+        testl     $32768, %eax
+        je        .L_2TAG_PACKET_47.0.2
+        jmp       .L_2TAG_PACKET_46.0.2
+.L_2TAG_PACKET_54.0.2:
+        pextrw    $3, %xmm0, %eax
+        andl      $32752, %eax
+        pextrw    $3, %xmm1, %edx
+        xorpd     %xmm0, %xmm0
+        subl      $16368, %eax
+        xorl      %edx, %eax
+        testl     $32768, %eax
+        je        .L_2TAG_PACKET_55.0.2
+        jmp       ..B1.5
+.L_2TAG_PACKET_55.0.2:
+        movl      $32752, %edx
+        pinsrw    $3, %edx, %xmm0
+        jmp       ..B1.5
+.L_2TAG_PACKET_17.0.2:
+        movq      %xmm0, 24(%rsp)
+..B1.3:
+        movq      24(%rsp), %xmm0
+.L_2TAG_PACKET_56.0.2:
+..B1.5:
+        addq      $40, %rsp
+..___tag_value_pow.4:
+        ret       
+..___tag_value_pow.5:
+END(pow)
+# -- End  pow
+	.section .rodata, "a"
+	.align 16
+	.align 16
+HIGHSIGMASK:
+	.long	0
+	.long	4294965248
+	.long	0
+	.long	4294965248
+	.type	HIGHSIGMASK,@object
+	.size	HIGHSIGMASK,16
+	.align 16
+LOG2_E:
+	.long	0
+	.long	1073160192
+	.long	370913857
+	.long	3210587105
+	.type	LOG2_E,@object
+	.size	LOG2_E,16
+	.align 16
+coeff:
+	.long	1841914130
+	.long	3213059448
+	.long	3995341938
+	.long	3214607105
+	.long	2677381210
+	.long	3216320731
+	.long	3011779882
+	.long	3218479542
+	.long	1367832035
+	.long	1066403058
+	.long	2894285243
+	.long	1067936923
+	.long	1215221452
+	.long	1069835102
+	.long	370913857
+	.long	3210587105
+	.long	2677381210
+	.long	3216320731
+	.long	4172642429
+	.long	1056068382
+	.long	1215221451
+	.long	1069835102
+	.long	1092638156
+	.long	3184925618
+	.type	coeff,@object
+	.size	coeff,96
+	.align 16
+L_tbl:
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	0
+	.long	536870912
+	.long	1072689162
+	.long	2523013013
+	.long	1046157398
+	.long	3758096384
+	.long	1072685081
+	.long	3851513758
+	.long	3190968952
+	.long	0
+	.long	1072681007
+	.long	2241466466
+	.long	1046044599
+	.long	3221225472
+	.long	1072676937
+	.long	2990928271
+	.long	3193084984
+	.long	3758096384
+	.long	1072672873
+	.long	2905112743
+	.long	3192918576
+	.long	1610612736
+	.long	1072668815
+	.long	3370591264
+	.long	1046051793
+	.long	2147483648
+	.long	1072664762
+	.long	3272361216
+	.long	3193793653
+	.long	3758096384
+	.long	1072660714
+	.long	46546755
+	.long	1043206936
+	.long	3221225472
+	.long	1072656672
+	.long	3017067724
+	.long	3192177962
+	.long	0
+	.long	1072652636
+	.long	3688436631
+	.long	3192814956
+	.long	2684354560
+	.long	1072648604
+	.long	1707461992
+	.long	3193056712
+	.long	2684354560
+	.long	1072644578
+	.long	1188114540
+	.long	3193603086
+	.long	3758096384
+	.long	1072640557
+	.long	3533180564
+	.long	1045459375
+	.long	2684354560
+	.long	1072636542
+	.long	2000337630
+	.long	3193475557
+	.long	2684354560
+	.long	1072632532
+	.long	3698062443
+	.long	3193752766
+	.long	3758096384
+	.long	1072628527
+	.long	3161606138
+	.long	3190532995
+	.long	2147483648
+	.long	1072624528
+	.long	3165265478
+	.long	3193158459
+	.long	1610612736
+	.long	1072620534
+	.long	1600940077
+	.long	3193226777
+	.long	2147483648
+	.long	1072616545
+	.long	1363272552
+	.long	3192614278
+	.long	3758096384
+	.long	1072612561
+	.long	3966209910
+	.long	3191249654
+	.long	2147483648
+	.long	1072608583
+	.long	1093672789
+	.long	3190637330
+	.long	1610612736
+	.long	1072604610
+	.long	1735239357
+	.long	3192753616
+	.long	1610612736
+	.long	1072600642
+	.long	1470665156
+	.long	1045559697
+	.long	2684354560
+	.long	1072596679
+	.long	3840624926
+	.long	1045928953
+	.long	536870912
+	.long	1072592722
+	.long	4259072556
+	.long	3191035622
+	.long	3221225472
+	.long	1072588769
+	.long	3613088753
+	.long	3192165681
+	.long	2147483648
+	.long	1072584822
+	.long	3175234446
+	.long	1039486948
+	.long	1610612736
+	.long	1072580880
+	.long	856576441
+	.long	1045702812
+	.long	2147483648
+	.long	1072576943
+	.long	2253498719
+	.long	3193285334
+	.long	2684354560
+	.long	1072573011
+	.long	1587070728
+	.long	3190801577
+	.long	3758096384
+	.long	1072569084
+	.long	159986317
+	.long	1042519436
+	.long	1073741824
+	.long	1072565163
+	.long	3999541949
+	.long	3192020440
+	.long	2684354560
+	.long	1072561246
+	.long	3281310262
+	.long	1045586786
+	.long	536870912
+	.long	1072557335
+	.long	3775179406
+	.long	1045226055
+	.long	3221225472
+	.long	1072553428
+	.long	643472356
+	.long	3193681786
+	.long	1073741824
+	.long	1072549527
+	.long	248169775
+	.long	1045068977
+	.long	3758096384
+	.long	1072545630
+	.long	307016632
+	.long	1042640932
+	.long	2147483648
+	.long	1072541739
+	.long	3872718526
+	.long	3189781486
+	.long	536870912
+	.long	1072537853
+	.long	969711630
+	.long	3191724732
+	.long	3221225472
+	.long	1072533971
+	.long	4018820394
+	.long	3193189264
+	.long	1073741824
+	.long	1072530095
+	.long	3102233092
+	.long	1045510224
+	.long	3758096384
+	.long	1072526223
+	.long	1029307912
+	.long	3193812776
+	.long	1073741824
+	.long	1072522357
+	.long	984083153
+	.long	1045987403
+	.long	3221225472
+	.long	1072518495
+	.long	4171455401
+	.long	3193084080
+	.long	0
+	.long	1072514639
+	.long	2592660757
+	.long	1046121691
+	.long	1073741824
+	.long	1072510787
+	.long	2964365712
+	.long	1046054453
+	.long	2147483648
+	.long	1072506940
+	.long	3792777877
+	.long	3193704729
+	.long	2147483648
+	.long	1072503098
+	.long	2948536104
+	.long	3192467100
+	.long	1610612736
+	.long	1072499261
+	.long	3836005619
+	.long	1041873166
+	.long	536870912
+	.long	1072495429
+	.long	3124543160
+	.long	1044409168
+	.long	3221225472
+	.long	1072491601
+	.long	286227933
+	.long	1041065990
+	.long	1073741824
+	.long	1072487779
+	.long	2111296776
+	.long	3193604419
+	.long	2147483648
+	.long	1072483961
+	.long	2606822001
+	.long	3192940394
+	.long	2147483648
+	.long	1072480148
+	.long	194696800
+	.long	1046026063
+	.long	1610612736
+	.long	1072476340
+	.long	8535452
+	.long	1046200178
+	.long	536870912
+	.long	1072472537
+	.long	950463625
+	.long	3192731897
+	.long	2147483648
+	.long	1072468738
+	.long	973831566
+	.long	1045683197
+	.long	3221225472
+	.long	1072464944
+	.long	3330435892
+	.long	3190277577
+	.long	3221225472
+	.long	1072461155
+	.long	208692097
+	.long	3193517651
+	.long	1610612736
+	.long	1072457371
+	.long	2113097415
+	.long	1044781749
+	.long	3758096384
+	.long	1072453591
+	.long	1088808936
+	.long	3193716142
+	.long	0
+	.long	1072449817
+	.long	1443002127
+	.long	3193250205
+	.long	3221225472
+	.long	1072446046
+	.long	3967357419
+	.long	1046109477
+	.long	1610612736
+	.long	1072442281
+	.long	3013517861
+	.long	3193159691
+	.long	2147483648
+	.long	1072438520
+	.long	2524586286
+	.long	1046121951
+	.long	1610612736
+	.long	1072434764
+	.long	1476892861
+	.long	1046434731
+	.long	0
+	.long	1072431013
+	.long	3089640950
+	.long	3192305780
+	.long	536870912
+	.long	1072427266
+	.long	3812255529
+	.long	1045730879
+	.long	0
+	.long	1072423524
+	.long	995354762
+	.long	3191528673
+	.long	1610612736
+	.long	1072419786
+	.long	3260567684
+	.long	1046273695
+	.long	2147483648
+	.long	1072416053
+	.long	2738210286
+	.long	3191471516
+	.long	536870912
+	.long	1072412325
+	.long	1931849805
+	.long	1044560405
+	.long	1610612736
+	.long	1072408601
+	.long	358896655
+	.long	1044029237
+	.long	1073741824
+	.long	1072404882
+	.long	2214589842
+	.long	3193202126
+	.long	2684354560
+	.long	1072401167
+	.long	3118097363
+	.long	3192592906
+	.long	2147483648
+	.long	1072397457
+	.long	1835998884
+	.long	1045788247
+	.long	0
+	.long	1072393752
+	.long	1585488319
+	.long	1045289910
+	.long	0
+	.long	1072390051
+	.long	480160949
+	.long	1046030455
+	.long	2684354560
+	.long	1072386354
+	.long	1832959667
+	.long	3193013644
+	.long	2684354560
+	.long	1072382662
+	.long	3611346555
+	.long	1044544210
+	.long	1073741824
+	.long	1072378975
+	.long	2749418734
+	.long	3193712580
+	.long	1073741824
+	.long	1072375292
+	.long	2390043472
+	.long	3191710658
+	.long	3221225472
+	.long	1072371613
+	.long	2828199902
+	.long	1042265217
+	.long	3221225472
+	.long	1072367939
+	.long	569209321
+	.long	3191230982
+	.long	536870912
+	.long	1072364270
+	.long	236159139
+	.long	1046240123
+	.long	536870912
+	.long	1072360605
+	.long	1010656270
+	.long	3193813968
+	.long	1610612736
+	.long	1072356944
+	.long	2409080597
+	.long	1044025029
+	.long	536870912
+	.long	1072353288
+	.long	598419513
+	.long	1043327370
+	.long	1073741824
+	.long	1072349636
+	.long	4105950479
+	.long	1045747958
+	.long	3758096384
+	.long	1072345988
+	.long	343243853
+	.long	3192420172
+	.long	3221225472
+	.long	1072342345
+	.long	2088439530
+	.long	1046172091
+	.long	536870912
+	.long	1072338707
+	.long	4117721107
+	.long	1043882496
+	.long	3758096384
+	.long	1072335072
+	.long	3192032958
+	.long	3192998645
+	.long	3758096384
+	.long	1072331442
+	.long	2366522518
+	.long	1045401957
+	.long	1610612736
+	.long	1072327817
+	.long	3685533141
+	.long	3193701947
+	.long	536870912
+	.long	1072324196
+	.long	1058658672
+	.long	3193572492
+	.long	536870912
+	.long	1072320579
+	.long	166346347
+	.long	1045456348
+	.long	2147483648
+	.long	1072316966
+	.long	2027889772
+	.long	1046349302
+	.long	1073741824
+	.long	1072313358
+	.long	1079497888
+	.long	1044585259
+	.long	1073741824
+	.long	1072309754
+	.long	2189851573
+	.long	1045132990
+	.long	2684354560
+	.long	1072306154
+	.long	2486629386
+	.long	3193613625
+	.long	536870912
+	.long	1072302559
+	.long	1263686579
+	.long	1044789259
+	.long	0
+	.long	1072298968
+	.long	2412061798
+	.long	3191369627
+	.long	536870912
+	.long	1072295381
+	.long	584315716
+	.long	3193144135
+	.long	1610612736
+	.long	1072291798
+	.long	449000738
+	.long	1046330451
+	.long	0
+	.long	1072288220
+	.long	3938320157
+	.long	1044446220
+	.long	3758096384
+	.long	1072284645
+	.long	2949844595
+	.long	3193462371
+	.long	3758096384
+	.long	1072281075
+	.long	2771329642
+	.long	3192121593
+	.long	536870912
+	.long	1072277510
+	.long	3971508621
+	.long	3193002806
+	.long	2147483648
+	.long	1072273948
+	.long	4071942301
+	.long	1044952619
+	.long	536870912
+	.long	1072270391
+	.long	2090502395
+	.long	1044660556
+	.long	0
+	.long	1072266838
+	.long	3657520961
+	.long	3193770938
+	.long	3758096384
+	.long	1072263288
+	.long	1608175110
+	.long	1045543239
+	.long	0
+	.long	1072259744
+	.long	2506924180
+	.long	1045530501
+	.long	1073741824
+	.long	1072256203
+	.long	18238493
+	.long	1046305623
+	.long	3221225472
+	.long	1072252666
+	.long	3862640487
+	.long	3192882407
+	.long	1073741824
+	.long	1072249134
+	.long	3850158761
+	.long	1043656099
+	.long	3758096384
+	.long	1072245605
+	.long	2356524356
+	.long	1045915296
+	.long	3221225472
+	.long	1072242081
+	.long	936497287
+	.long	3193842353
+	.long	2147483648
+	.long	1072238561
+	.long	2840845344
+	.long	1046454771
+	.long	2147483648
+	.long	1072235045
+	.long	3688100713
+	.long	1044895451
+	.long	2684354560
+	.long	1072231533
+	.long	479979913
+	.long	3193842442
+	.long	2684354560
+	.long	1072228025
+	.long	1016321898
+	.long	1046251032
+	.long	3758096384
+	.long	1072224521
+	.long	562232474
+	.long	3191974558
+	.long	536870912
+	.long	1072221022
+	.long	3870512029
+	.long	3193113881
+	.long	1610612736
+	.long	1072217526
+	.long	1239780547
+	.long	3191583604
+	.long	2684354560
+	.long	1072214034
+	.long	2815421327
+	.long	1045873682
+	.long	0
+	.long	1072210547
+	.long	2371009561
+	.long	1041508792
+	.long	1610612736
+	.long	1072207063
+	.long	1304636524
+	.long	3192414284
+	.long	3221225472
+	.long	1072203583
+	.long	210144854
+	.long	3193327333
+	.long	0
+	.long	1072200108
+	.long	1454303272
+	.long	1046360024
+	.long	1610612736
+	.long	1072196636
+	.long	2095757548
+	.long	1044984677
+	.long	3221225472
+	.long	1072193168
+	.long	2027215580
+	.long	3192880933
+	.long	0
+	.long	1072189705
+	.long	214794880
+	.long	1043457954
+	.long	1073741824
+	.long	1072186245
+	.long	884624917
+	.long	1043497079
+	.long	2147483648
+	.long	1072182789
+	.long	2792396634
+	.long	3193171685
+	.long	2684354560
+	.long	1072179337
+	.long	4128995250
+	.long	3192103434
+	.long	2684354560
+	.long	1072175889
+	.long	333866043
+	.long	1046372325
+	.long	3221225472
+	.long	1072172445
+	.long	2194445544
+	.long	3193958905
+	.long	2684354560
+	.long	1072169005
+	.long	2316082269
+	.long	3192041703
+	.long	1610612736
+	.long	1072165569
+	.long	581005057
+	.long	1046322848
+	.long	536870912
+	.long	1072162137
+	.long	3280786513
+	.long	1045457251
+	.long	3221225472
+	.long	1072158708
+	.long	2567093361
+	.long	1044710359
+	.long	1073741824
+	.long	1072155284
+	.long	3740443584
+	.long	1044224237
+	.long	2684354560
+	.long	1072151863
+	.long	3981028272
+	.long	1042596351
+	.long	3758096384
+	.long	1072148446
+	.long	3820011120
+	.long	3191915623
+	.long	0
+	.long	1072145034
+	.long	2946439484
+	.long	3193831276
+	.long	3758096384
+	.long	1072141624
+	.long	3075274422
+	.long	3190132432
+	.long	2684354560
+	.long	1072138219
+	.long	496052167
+	.long	1043619760
+	.long	1073741824
+	.long	1072134818
+	.long	271106589
+	.long	3192265149
+	.long	2684354560
+	.long	1072131420
+	.long	2091955684
+	.long	1044443554
+	.long	3758096384
+	.long	1072128026
+	.long	723240109
+	.long	3191007419
+	.long	3758096384
+	.long	1072124636
+	.long	1748629070
+	.long	1044510075
+	.long	3221225472
+	.long	1072121250
+	.long	3289522046
+	.long	3193095178
+	.long	1610612736
+	.long	1072117868
+	.long	3599052146
+	.long	3193720427
+	.long	3221225472
+	.long	1072114489
+	.long	2446758135
+	.long	3193436303
+	.long	3758096384
+	.long	1072111114
+	.long	1652171097
+	.long	3192137173
+	.long	3221225472
+	.long	1072107743
+	.long	1353007155
+	.long	1044523902
+	.long	1610612736
+	.long	1072104376
+	.long	990601105
+	.long	1046296663
+	.long	3758096384
+	.long	1072101012
+	.long	2228627618
+	.long	3193041040
+	.long	0
+	.long	1072097653
+	.long	812484756
+	.long	3191950723
+	.long	3758096384
+	.long	1072094296
+	.long	817833130
+	.long	3192279242
+	.long	2147483648
+	.long	1072090944
+	.long	3563228521
+	.long	3193810951
+	.long	3221225472
+	.long	1072087595
+	.long	2729108859
+	.long	3190936185
+	.long	3221225472
+	.long	1072084250
+	.long	2249121662
+	.long	3190639690
+	.long	2147483648
+	.long	1072080909
+	.long	4082471745
+	.long	3193929368
+	.long	3758096384
+	.long	1072077571
+	.long	2827323806
+	.long	3193708561
+	.long	3758096384
+	.long	1072074237
+	.long	735866167
+	.long	1042434690
+	.long	2684354560
+	.long	1072070907
+	.long	3240808889
+	.long	3191918422
+	.long	0
+	.long	1072067581
+	.long	466482777
+	.long	3186962221
+	.long	0
+	.long	1072064258
+	.long	1576076296
+	.long	1045849056
+	.long	3221225472
+	.long	1072060938
+	.long	2751923560
+	.long	3191910703
+	.long	0
+	.long	1072057623
+	.long	1908755527
+	.long	1046437515
+	.long	0
+	.long	1072054311
+	.long	3175841411
+	.long	1044572886
+	.long	2684354560
+	.long	1072051002
+	.long	1633258450
+	.long	3192670420
+	.long	3221225472
+	.long	1072047697
+	.long	1867746657
+	.long	1045726209
+	.long	2684354560
+	.long	1072044396
+	.long	338968864
+	.long	3193084662
+	.long	0
+	.long	1072041099
+	.long	1501742471
+	.long	3191742031
+	.long	0
+	.long	1072037805
+	.long	4266775786
+	.long	3192686970
+	.long	2147483648
+	.long	1072034514
+	.long	4249283553
+	.long	1045769728
+	.long	2684354560
+	.long	1072031227
+	.long	2758366873
+	.long	1046402161
+	.long	1610612736
+	.long	1072027944
+	.long	2161186990
+	.long	1044736865
+	.long	2684354560
+	.long	1072024664
+	.long	810300171
+	.long	1045748777
+	.long	2147483648
+	.long	1072021388
+	.long	183688927
+	.long	3191515581
+	.long	3758096384
+	.long	1072018115
+	.long	368874072
+	.long	3192363575
+	.long	3221225472
+	.long	1072014846
+	.long	2459092970
+	.long	1041794640
+	.long	536870912
+	.long	1072011581
+	.long	867488640
+	.long	1046310291
+	.long	536870912
+	.long	1072008319
+	.long	50140871
+	.long	1043327329
+	.long	2684354560
+	.long	1072005060
+	.long	1241902518
+	.long	3192739252
+	.long	2684354560
+	.long	1072001805
+	.long	1027881659
+	.long	3193858388
+	.long	0
+	.long	1071998554
+	.long	38457322
+	.long	1045489179
+	.long	0
+	.long	1071995306
+	.long	3432963337
+	.long	3190969347
+	.long	1610612736
+	.long	1071992061
+	.long	534931792
+	.long	1046302734
+	.long	1610612736
+	.long	1071988820
+	.long	1817895268
+	.long	3192551860
+	.long	3221225472
+	.long	1071985582
+	.long	357237383
+	.long	3191870833
+	.long	2684354560
+	.long	1071982348
+	.long	108262401
+	.long	3193365867
+	.long	3758096384
+	.long	1071979117
+	.long	1964729244
+	.long	1042502249
+	.long	2684354560
+	.long	1071975890
+	.long	2088446957
+	.long	1038010503
+	.long	3221225472
+	.long	1071972666
+	.long	2947239447
+	.long	1046377845
+	.long	1610612736
+	.long	1071969446
+	.long	774932072
+	.long	1046064854
+	.long	2147483648
+	.long	1071966229
+	.long	4080937590
+	.long	3193041284
+	.long	3758096384
+	.long	1071963015
+	.long	2208251454
+	.long	1045945089
+	.long	3221225472
+	.long	1071959805
+	.long	2850924475
+	.long	1045650959
+	.long	0
+	.long	1071956599
+	.long	714040997
+	.long	1046275153
+	.long	3221225472
+	.long	1071953395
+	.long	85533782
+	.long	3192816920
+	.long	3221225472
+	.long	1071950195
+	.long	1252511005
+	.long	1044805706
+	.long	1073741824
+	.long	1071946999
+	.long	2384659038
+	.long	3193391602
+	.long	0
+	.long	1071943806
+	.long	416481813
+	.long	1043730233
+	.long	536870912
+	.long	1071940616
+	.long	1675424499
+	.long	1046348030
+	.long	3221225472
+	.long	1071937429
+	.long	1175989513
+	.long	3193009113
+	.long	2684354560
+	.long	1071934246
+	.long	2400084650
+	.long	3192451713
+	.long	3758096384
+	.long	1071931066
+	.long	1467335692
+	.long	3193350868
+	.long	1610612736
+	.long	1071927890
+	.long	266493801
+	.long	1044954481
+	.long	1073741824
+	.long	1071924717
+	.long	3919093445
+	.long	1046023575
+	.long	2147483648
+	.long	1071921547
+	.long	3017408483
+	.long	1044880828
+	.long	536870912
+	.long	1071918381
+	.long	948849966
+	.long	3193892224
+	.long	3758096384
+	.long	1071915217
+	.long	1870232600
+	.long	1045777228
+	.long	536870912
+	.long	1071912058
+	.long	822381492
+	.long	3193639186
+	.long	2147483648
+	.long	1071908901
+	.long	788243705
+	.long	1044966343
+	.long	1073741824
+	.long	1071905748
+	.long	1344278809
+	.long	1044428545
+	.long	1073741824
+	.long	1071902598
+	.long	172864300
+	.long	1045765608
+	.long	2684354560
+	.long	1071899451
+	.long	211555467
+	.long	3192963574
+	.long	536870912
+	.long	1071896308
+	.long	3373438023
+	.long	1045643168
+	.long	0
+	.long	1071893168
+	.long	2867180960
+	.long	3189945998
+	.long	536870912
+	.long	1071890031
+	.long	36724362
+	.long	3193240584
+	.long	1610612736
+	.long	1071886897
+	.long	2140176984
+	.long	1045945349
+	.long	0
+	.long	1071883767
+	.long	436842360
+	.long	1040712587
+	.long	3758096384
+	.long	1071880639
+	.long	1225147329
+	.long	3193814594
+	.long	3758096384
+	.long	1071877515
+	.long	1586157348
+	.long	3191614322
+	.long	536870912
+	.long	1071874395
+	.long	3329332918
+	.long	1041699791
+	.long	2684354560
+	.long	1071871277
+	.long	1635968041
+	.long	3191783756
+	.long	1073741824
+	.long	1071868163
+	.long	2876158382
+	.long	1046097093
+	.long	1073741824
+	.long	1071865052
+	.long	4267556964
+	.long	3193723000
+	.long	1073741824
+	.long	1071861944
+	.long	195475940
+	.long	1045520795
+	.long	2147483648
+	.long	1071858839
+	.long	2239193514
+	.long	1046478675
+	.long	0
+	.long	1071855738
+	.long	4168275596
+	.long	1044926285
+	.long	2684354560
+	.long	1071852639
+	.long	142514114
+	.long	1045595182
+	.long	2147483648
+	.long	1071849544
+	.long	1943457984
+	.long	3192930015
+	.long	2147483648
+	.long	1071846452
+	.long	202659489
+	.long	3193926317
+	.long	2684354560
+	.long	1071843363
+	.long	2208408789
+	.long	3193857484
+	.long	3758096384
+	.long	1071840277
+	.long	2237297552
+	.long	3192939576
+	.long	1073741824
+	.long	1071837195
+	.long	2726920839
+	.long	1044193954
+	.long	3758096384
+	.long	1071834115
+	.long	2337732207
+	.long	3193611773
+	.long	2147483648
+	.long	1071831039
+	.long	1390088602
+	.long	1044000317
+	.long	1610612736
+	.long	1071827966
+	.long	3806188736
+	.long	3193463913
+	.long	1073741824
+	.long	1071824896
+	.long	1795276560
+	.long	1043671965
+	.long	1073741824
+	.long	1071821829
+	.long	2960792799
+	.long	1046240474
+	.long	2147483648
+	.long	1071818765
+	.long	3350591592
+	.long	3193333939
+	.long	3221225472
+	.long	1071815704
+	.long	408870754
+	.long	3193322854
+	.long	0
+	.long	1071812647
+	.long	4146717132
+	.long	1046063520
+	.long	2147483648
+	.long	1071809592
+	.long	1681114919
+	.long	3192114313
+	.long	0
+	.long	1071806541
+	.long	1098393137
+	.long	3190846732
+	.long	2684354560
+	.long	1071803492
+	.long	2437484983
+	.long	3193448718
+	.long	1073741824
+	.long	1071800447
+	.long	1036809185
+	.long	3192023501
+	.long	0
+	.long	1071797405
+	.long	659668848
+	.long	3193596312
+	.long	3221225472
+	.long	1071794365
+	.long	1112062459
+	.long	3192773376
+	.long	2147483648
+	.long	1071791329
+	.long	4082956335
+	.long	1045830513
+	.long	1610612736
+	.long	1071788296
+	.long	2387089965
+	.long	1045532601
+	.long	1610612736
+	.long	1071785266
+	.long	1522101980
+	.long	3193941957
+	.long	1073741824
+	.long	1071782239
+	.long	2157197585
+	.long	3188193305
+	.long	1073741824
+	.long	1071779215
+	.long	946810220
+	.long	3193223819
+	.long	1073741824
+	.long	1071776194
+	.long	4069942444
+	.long	3193878549
+	.long	536870912
+	.long	1071773176
+	.long	1693463440
+	.long	1046360588
+	.long	536870912
+	.long	1071770161
+	.long	1954543254
+	.long	1046409381
+	.long	1073741824
+	.long	1071767149
+	.long	1050471249
+	.long	3193933095
+	.long	536870912
+	.long	1071764140
+	.long	1256240478
+	.long	1046456865
+	.long	536870912
+	.long	1071761134
+	.long	676764254
+	.long	1046055503
+	.long	536870912
+	.long	1071758131
+	.long	1421032967
+	.long	1044779786
+	.long	536870912
+	.long	1071755131
+	.long	38735992
+	.long	3192766355
+	.long	0
+	.long	1071752134
+	.long	2960669690
+	.long	1044484680
+	.long	3758096384
+	.long	1071749139
+	.long	788707382
+	.long	1045299895
+	.long	3221225472
+	.long	1071746148
+	.long	685689300
+	.long	1040778831
+	.long	2147483648
+	.long	1071743160
+	.long	1170994182
+	.long	1046159174
+	.long	1073741824
+	.long	1071740175
+	.long	64591436
+	.long	1046153849
+	.long	0
+	.long	1071737193
+	.long	2338031659
+	.long	3189997702
+	.long	2684354560
+	.long	1071734213
+	.long	1941624568
+	.long	3186752676
+	.long	536870912
+	.long	1071731237
+	.long	1401255580
+	.long	1046383990
+	.long	2684354560
+	.long	1071728263
+	.long	376888427
+	.long	1045896456
+	.long	536870912
+	.long	1071725293
+	.long	2831424639
+	.long	3193539109
+	.long	1610612736
+	.long	1071722325
+	.long	3303123696
+	.long	1044599415
+	.long	2684354560
+	.long	1071719360
+	.long	1077295329
+	.long	3189877372
+	.long	3221225472
+	.long	1071716398
+	.long	1434061099
+	.long	3184529771
+	.long	3221225472
+	.long	1071713439
+	.long	2104991590
+	.long	1045062074
+	.long	3221225472
+	.long	1071710483
+	.long	722060869
+	.long	3193788526
+	.long	536870912
+	.long	1071704580
+	.long	3928796486
+	.long	1046129020
+	.long	536870912
+	.long	1071698688
+	.long	588844628
+	.long	1045492135
+	.long	2684354560
+	.long	1071692807
+	.long	326739366
+	.long	3193004445
+	.long	1610612736
+	.long	1071686938
+	.long	2456436042
+	.long	1046278169
+	.long	2684354560
+	.long	1071681080
+	.long	2831303512
+	.long	1043670046
+	.long	536870912
+	.long	1071675234
+	.long	607223418
+	.long	1045507322
+	.long	0
+	.long	1071669399
+	.long	4254921332
+	.long	3193290483
+	.long	0
+	.long	1071663575
+	.long	914994333
+	.long	3191263853
+	.long	1073741824
+	.long	1071657762
+	.long	4147050180
+	.long	3193228552
+	.long	2684354560
+	.long	1071651960
+	.long	594554157
+	.long	3193503935
+	.long	0
+	.long	1071646170
+	.long	1062846796
+	.long	1045944331
+	.long	1073741824
+	.long	1071636109
+	.long	2909238893
+	.long	3193436884
+	.long	1073741824
+	.long	1071624572
+	.long	1682918119
+	.long	1042211899
+	.long	1073741824
+	.long	1071613057
+	.long	2419209426
+	.long	1045437062
+	.long	1073741824
+	.long	1071601564
+	.long	2951341321
+	.long	3190193214
+	.long	0
+	.long	1071590093
+	.long	3084900875
+	.long	3192394907
+	.long	1073741824
+	.long	1071578643
+	.long	999567454
+	.long	1046433447
+	.long	2147483648
+	.long	1071567215
+	.long	1570101857
+	.long	3193291160
+	.long	0
+	.long	1071555809
+	.long	1080647881
+	.long	3185154585
+	.long	0
+	.long	1071544424
+	.long	3526309177
+	.long	1044843640
+	.long	2147483648
+	.long	1071533060
+	.long	2213463349
+	.long	3191738930
+	.long	1073741824
+	.long	1071521718
+	.long	1039925195
+	.long	3192618353
+	.long	1073741824
+	.long	1071510397
+	.long	2115757280
+	.long	3193671567
+	.long	1073741824
+	.long	1071499097
+	.long	1188751495
+	.long	3191145560
+	.long	2147483648
+	.long	1071487818
+	.long	3983461449
+	.long	3193897029
+	.long	2147483648
+	.long	1071476560
+	.long	782141500
+	.long	1042879962
+	.long	2147483648
+	.long	1071465323
+	.long	4038904626
+	.long	1045063881
+	.long	2147483648
+	.long	1071454107
+	.long	2613036921
+	.long	3193217642
+	.long	0
+	.long	1071442912
+	.long	2095723435
+	.long	1044629175
+	.long	1073741824
+	.long	1071431737
+	.long	3879795974
+	.long	1045767874
+	.long	1073741824
+	.long	1071420583
+	.long	2662198042
+	.long	3191434637
+	.long	3221225472
+	.long	1071409449
+	.long	4037605722
+	.long	3193703090
+	.long	2147483648
+	.long	1071398336
+	.long	1860331835
+	.long	1040814822
+	.long	3221225472
+	.long	1071387243
+	.long	1522972033
+	.long	3190305974
+	.long	1073741824
+	.long	1071376171
+	.long	2361534207
+	.long	1043699366
+	.long	0
+	.long	1071365119
+	.long	4180309179
+	.long	1044142099
+	.long	0
+	.long	1071354087
+	.long	1201038528
+	.long	3192968772
+	.long	0
+	.long	1071343075
+	.long	1342478171
+	.long	3193251215
+	.long	0
+	.long	1071332083
+	.long	3836883348
+	.long	3193472007
+	.long	3221225472
+	.long	1071321110
+	.long	3864874250
+	.long	1045593126
+	.long	2147483648
+	.long	1071310158
+	.long	2169494998
+	.long	1046045346
+	.long	1073741824
+	.long	1071299226
+	.long	3785165075
+	.long	3193319246
+	.long	2147483648
+	.long	1071288313
+	.long	1137692678
+	.long	3192716779
+	.long	1073741824
+	.long	1071277420
+	.long	1752107598
+	.long	1046366120
+	.long	3221225472
+	.long	1071266546
+	.long	1912656912
+	.long	1046352281
+	.long	3221225472
+	.long	1071255692
+	.long	2882676334
+	.long	1046406353
+	.long	1073741824
+	.long	1071244858
+	.long	963612460
+	.long	1045282811
+	.long	0
+	.long	1071234043
+	.long	3811255773
+	.long	1046231636
+	.long	1073741824
+	.long	1071223247
+	.long	1126055989
+	.long	3192224037
+	.long	2147483648
+	.long	1071212470
+	.long	2079145427
+	.long	1044432413
+	.long	0
+	.long	1071201713
+	.long	3611595621
+	.long	1043358745
+	.long	2147483648
+	.long	1071190974
+	.long	390522769
+	.long	1045888252
+	.long	1073741824
+	.long	1071180255
+	.long	4087939723
+	.long	3192930745
+	.long	3221225472
+	.long	1071169554
+	.long	1451494480
+	.long	3190219274
+	.long	1073741824
+	.long	1071158873
+	.long	427176194
+	.long	3193042022
+	.long	2147483648
+	.long	1071148210
+	.long	1882381948
+	.long	3192727946
+	.long	2147483648
+	.long	1071137566
+	.long	3736313771
+	.long	3192087019
+	.long	1073741824
+	.long	1071126941
+	.long	1560398816
+	.long	3193185715
+	.long	2147483648
+	.long	1071116334
+	.long	1021942441
+	.long	1041526696
+	.long	2147483648
+	.long	1071105746
+	.long	3517080249
+	.long	3193576041
+	.long	3221225472
+	.long	1071095176
+	.long	2248589878
+	.long	1044527624
+	.long	2147483648
+	.long	1071084625
+	.long	2412896695
+	.long	1046112867
+	.long	3221225472
+	.long	1071074092
+	.long	3834725738
+	.long	1044562378
+	.long	1073741824
+	.long	1071063578
+	.long	1150920407
+	.long	1043768986
+	.long	0
+	.long	1071053082
+	.long	1379393428
+	.long	3188690690
+	.long	0
+	.long	1071042604
+	.long	3058183278
+	.long	3193617655
+	.long	0
+	.long	1071032144
+	.long	421133665
+	.long	3193417186
+	.long	0
+	.long	1071021702
+	.long	2860161357
+	.long	3191816125
+	.long	0
+	.long	1071011278
+	.long	1742405964
+	.long	1043580240
+	.long	0
+	.long	1071000872
+	.long	2821215927
+	.long	3188984273
+	.long	3221225472
+	.long	1070990483
+	.long	510275597
+	.long	1045813401
+	.long	2147483648
+	.long	1070980113
+	.long	304266588
+	.long	3191193536
+	.long	3221225472
+	.long	1070969760
+	.long	1854784211
+	.long	1046302073
+	.long	0
+	.long	1070959426
+	.long	3773082854
+	.long	3193008899
+	.long	2147483648
+	.long	1070949108
+	.long	3003572392
+	.long	1046404879
+	.long	3221225472
+	.long	1070938808
+	.long	1702149204
+	.long	1046407257
+	.long	2147483648
+	.long	1070928526
+	.long	3935314439
+	.long	1046438280
+	.long	3221225472
+	.long	1070918261
+	.long	2677087609
+	.long	1045501749
+	.long	2147483648
+	.long	1070908014
+	.long	4190598039
+	.long	3193640515
+	.long	1073741824
+	.long	1070897784
+	.long	368874072
+	.long	1044879927
+	.long	2147483648
+	.long	1070887571
+	.long	3584052697
+	.long	3192024662
+	.long	3221225472
+	.long	1070877375
+	.long	3762307829
+	.long	1045886918
+	.long	1073741824
+	.long	1070867197
+	.long	495710920
+	.long	1046317072
+	.long	0
+	.long	1070857036
+	.long	2292768238
+	.long	3190887508
+	.long	3221225472
+	.long	1070846891
+	.long	1044078151
+	.long	3193772914
+	.long	1073741824
+	.long	1070836764
+	.long	3266010457
+	.long	1043443755
+	.long	3221225472
+	.long	1070826653
+	.long	3571665822
+	.long	1045547823
+	.long	1073741824
+	.long	1070816560
+	.long	393348347
+	.long	3190525143
+	.long	2147483648
+	.long	1070806483
+	.long	4241722498
+	.long	3192084193
+	.long	2147483648
+	.long	1070796423
+	.long	1693797068
+	.long	3192807972
+	.long	0
+	.long	1070786380
+	.long	2860086745
+	.long	1046331646
+	.long	2147483648
+	.long	1070776353
+	.long	1366141759
+	.long	3192979363
+	.long	1073741824
+	.long	1070766343
+	.long	737899283
+	.long	1045853346
+	.long	3221225472
+	.long	1070756349
+	.long	88734873
+	.long	1043881257
+	.long	3221225472
+	.long	1070746372
+	.long	1438003315
+	.long	3192917101
+	.long	0
+	.long	1070736412
+	.long	1066505530
+	.long	1043896695
+	.long	3221225472
+	.long	1070726467
+	.long	2706653041
+	.long	3191113643
+	.long	3221225472
+	.long	1070716539
+	.long	1321764476
+	.long	1039573724
+	.long	0
+	.long	1070706628
+	.long	1126753211
+	.long	1044502976
+	.long	2147483648
+	.long	1070696732
+	.long	773642884
+	.long	1044110727
+	.long	1073741824
+	.long	1070686853
+	.long	1263743406
+	.long	3193115278
+	.long	0
+	.long	1070676990
+	.long	3115237732
+	.long	3193089176
+	.long	3221225472
+	.long	1070667142
+	.long	3642626838
+	.long	3191146032
+	.long	2147483648
+	.long	1070657311
+	.long	2091696428
+	.long	1044337177
+	.long	1073741824
+	.long	1070647496
+	.long	3168958391
+	.long	1044197568
+	.long	0
+	.long	1070637697
+	.long	711148669
+	.long	3193181047
+	.long	2147483648
+	.long	1070627913
+	.long	4207182773
+	.long	3193402092
+	.long	3221225472
+	.long	1070618145
+	.long	918070640
+	.long	3192902845
+	.long	3221225472
+	.long	1070608393
+	.long	3135571447
+	.long	3192193928
+	.long	2147483648
+	.long	1070598657
+	.long	1043705517
+	.long	3193188604
+	.long	2147483648
+	.long	1070581777
+	.long	1886680492
+	.long	1043890286
+	.long	2147483648
+	.long	1070562367
+	.long	3373799420
+	.long	3191917802
+	.long	2147483648
+	.long	1070542988
+	.long	2919618025
+	.long	3192461752
+	.long	2147483648
+	.long	1070523640
+	.long	2926365158
+	.long	3193113492
+	.long	0
+	.long	1070504323
+	.long	519978638
+	.long	1045918846
+	.long	0
+	.long	1070485037
+	.long	3665353151
+	.long	3193546248
+	.long	0
+	.long	1070465781
+	.long	2327718958
+	.long	1045050797
+	.long	0
+	.long	1070446556
+	.long	345326861
+	.long	3188224716
+	.long	2147483648
+	.long	1070427361
+	.long	2263747488
+	.long	3192871328
+	.long	0
+	.long	1070408197
+	.long	3894192264
+	.long	1045693123
+	.long	0
+	.long	1070389063
+	.long	994321593
+	.long	1046347203
+	.long	2147483648
+	.long	1070369959
+	.long	3540366700
+	.long	1042296230
+	.long	0
+	.long	1070350886
+	.long	966420752
+	.long	3192400412
+	.long	2147483648
+	.long	1070331842
+	.long	1954511160
+	.long	3193467762
+	.long	2147483648
+	.long	1070312828
+	.long	1875003040
+	.long	1045485629
+	.long	0
+	.long	1070293845
+	.long	4003372005
+	.long	3193714109
+	.long	2147483648
+	.long	1070274890
+	.long	2216083644
+	.long	1045720399
+	.long	0
+	.long	1070255966
+	.long	1240985743
+	.long	1045879414
+	.long	0
+	.long	1070237071
+	.long	1573064162
+	.long	1046427916
+	.long	0
+	.long	1070218206
+	.long	2500166582
+	.long	3193848169
+	.long	2147483648
+	.long	1070199369
+	.long	862131539
+	.long	1045606065
+	.long	0
+	.long	1070180563
+	.long	3733427622
+	.long	3193545988
+	.long	0
+	.long	1070161785
+	.long	124515358
+	.long	1045504766
+	.long	2147483648
+	.long	1070143036
+	.long	689228007
+	.long	1044238436
+	.long	0
+	.long	1070124317
+	.long	976284835
+	.long	3189879978
+	.long	2147483648
+	.long	1070105626
+	.long	2997446224
+	.long	3193394244
+	.long	2147483648
+	.long	1070086964
+	.long	594985163
+	.long	3190453447
+	.long	2147483648
+	.long	1070068331
+	.long	3634411091
+	.long	3193012662
+	.long	0
+	.long	1070049727
+	.long	841316482
+	.long	3192551604
+	.long	0
+	.long	1070031151
+	.long	518949849
+	.long	3189505693
+	.long	2147483648
+	.long	1070012603
+	.long	207633604
+	.long	1043791305
+	.long	2147483648
+	.long	1069994084
+	.long	925415631
+	.long	3189658670
+	.long	2147483648
+	.long	1069975593
+	.long	3348775015
+	.long	1046231055
+	.long	0
+	.long	1069957131
+	.long	4137593961
+	.long	1045760644
+	.long	2147483648
+	.long	1069938696
+	.long	3081207972
+	.long	1046319652
+	.long	2147483648
+	.long	1069920290
+	.long	2912811806
+	.long	3193250863
+	.long	0
+	.long	1069901912
+	.long	1704663230
+	.long	3192651171
+	.long	2147483648
+	.long	1069883561
+	.long	1726887473
+	.long	3193427817
+	.long	2147483648
+	.long	1069865238
+	.long	516302873
+	.long	1042556919
+	.long	2147483648
+	.long	1069846943
+	.long	3737277289
+	.long	3192083505
+	.long	0
+	.long	1069828676
+	.long	2829909067
+	.long	3191628520
+	.long	0
+	.long	1069810436
+	.long	3474800299
+	.long	3187384991
+	.long	2147483648
+	.long	1069792223
+	.long	2041291754
+	.long	3186735048
+	.long	2147483648
+	.long	1069774038
+	.long	3100739290
+	.long	3192991951
+	.long	2147483648
+	.long	1069755880
+	.long	2641686866
+	.long	1042449846
+	.long	0
+	.long	1069737750
+	.long	1353612457
+	.long	3192928544
+	.long	2147483648
+	.long	1069719646
+	.long	1823398190
+	.long	3193125156
+	.long	0
+	.long	1069701570
+	.long	2629108558
+	.long	3192983089
+	.long	2147483648
+	.long	1069683520
+	.long	314889080
+	.long	3193178947
+	.long	2147483648
+	.long	1069665497
+	.long	3426846470
+	.long	1046055034
+	.long	0
+	.long	1069647502
+	.long	2451521798
+	.long	3193081447
+	.long	2147483648
+	.long	1069629532
+	.long	963200030
+	.long	1046315089
+	.long	0
+	.long	1069611590
+	.long	3644976987
+	.long	1046450297
+	.long	2147483648
+	.long	1069593674
+	.long	1514045874
+	.long	3193337489
+	.long	0
+	.long	1069575785
+	.long	2640752615
+	.long	3192734715
+	.long	0
+	.long	1069557922
+	.long	177381730
+	.long	3193107348
+	.long	0
+	.long	1069532650
+	.long	546871269
+	.long	1045601847
+	.long	0
+	.long	1069497029
+	.long	2220408187
+	.long	1045964849
+	.long	0
+	.long	1069461461
+	.long	3101209784
+	.long	3192417098
+	.long	0
+	.long	1069425944
+	.long	3768825782
+	.long	1046196178
+	.long	0
+	.long	1069390480
+	.long	737308942
+	.long	1043872555
+	.long	0
+	.long	1069355068
+	.long	1944808119
+	.long	3193362317
+	.long	0
+	.long	1069319707
+	.long	852406261
+	.long	3191004250
+	.long	0
+	.long	1069284398
+	.long	3202370743
+	.long	3192549796
+	.long	0
+	.long	1069249140
+	.long	900633975
+	.long	1043862575
+	.long	0
+	.long	1069213934
+	.long	3417168564
+	.long	3193213168
+	.long	0
+	.long	1069178778
+	.long	2513309972
+	.long	1046051953
+	.long	0
+	.long	1069143674
+	.long	1836846968
+	.long	1044036653
+	.long	0
+	.long	1069108621
+	.long	675391362
+	.long	3193334972
+	.long	0
+	.long	1069073618
+	.long	1859398086
+	.long	3191668729
+	.long	0
+	.long	1069038666
+	.long	3835994043
+	.long	3193252196
+	.long	0
+	.long	1069003764
+	.long	563337246
+	.long	3192060530
+	.long	0
+	.long	1068968912
+	.long	3715154210
+	.long	1045592716
+	.long	0
+	.long	1068934111
+	.long	51415636
+	.long	3192193939
+	.long	0
+	.long	1068899359
+	.long	822049108
+	.long	1045846080
+	.long	0
+	.long	1068864658
+	.long	3739043340
+	.long	3193184949
+	.long	0
+	.long	1068830006
+	.long	2500828997
+	.long	3193115638
+	.long	0
+	.long	1068795403
+	.long	1479335089
+	.long	1045458233
+	.long	0
+	.long	1068760850
+	.long	1914098598
+	.long	1045079833
+	.long	0
+	.long	1068726346
+	.long	1470374909
+	.long	1046125471
+	.long	0
+	.long	1068691892
+	.long	2048101185
+	.long	3192960024
+	.long	0
+	.long	1068657486
+	.long	801101802
+	.long	1042523454
+	.long	0
+	.long	1068623129
+	.long	412171467
+	.long	1044799425
+	.long	0
+	.long	1068588821
+	.long	2124566049
+	.long	1040459843
+	.long	0
+	.long	1068554561
+	.long	2087558263
+	.long	1046083102
+	.long	0
+	.long	1068520350
+	.long	290389316
+	.long	1045220023
+	.long	0
+	.long	1068473430
+	.long	393737815
+	.long	1045770085
+	.long	0
+	.long	1068405202
+	.long	3273111658
+	.long	3193594336
+	.long	0
+	.long	1068337068
+	.long	3076935419
+	.long	3191993934
+	.long	0
+	.long	1068269030
+	.long	1564279721
+	.long	1040713632
+	.long	0
+	.long	1068201088
+	.long	1950103787
+	.long	3191285473
+	.long	0
+	.long	1068133240
+	.long	111301617
+	.long	1046140470
+	.long	0
+	.long	1068065488
+	.long	2740933659
+	.long	1046091898
+	.long	0
+	.long	1067997832
+	.long	1267131462
+	.long	3192947024
+	.long	0
+	.long	1067930268
+	.long	629787343
+	.long	1045599114
+	.long	0
+	.long	1067862800
+	.long	2943029746
+	.long	3191100621
+	.long	0
+	.long	1067795426
+	.long	2538631151
+	.long	3193953989
+	.long	0
+	.long	1067728144
+	.long	3881795033
+	.long	3191377363
+	.long	0
+	.long	1067660956
+	.long	2752747058
+	.long	3186250103
+	.long	0
+	.long	1067593862
+	.long	892170014
+	.long	3193330390
+	.long	0
+	.long	1067526860
+	.long	2000985783
+	.long	3192968647
+	.long	0
+	.long	1067459950
+	.long	1954077304
+	.long	1044399908
+	.long	0
+	.long	1067335900
+	.long	4120702847
+	.long	3193150730
+	.long	0
+	.long	1067202448
+	.long	353489980
+	.long	1045676744
+	.long	0
+	.long	1067069184
+	.long	2609643324
+	.long	3192108001
+	.long	0
+	.long	1066936100
+	.long	2904433317
+	.long	1044836541
+	.long	0
+	.long	1066803200
+	.long	319656790
+	.long	1044863904
+	.long	0
+	.long	1066670484
+	.long	2407987331
+	.long	3192995083
+	.long	0
+	.long	1066537948
+	.long	2437746120
+	.long	3193127733
+	.long	0
+	.long	1066405592
+	.long	762570215
+	.long	3189946997
+	.long	0
+	.long	1066145040
+	.long	3317159694
+	.long	1046060125
+	.long	0
+	.long	1065881056
+	.long	2317845886
+	.long	3191679176
+	.long	0
+	.long	1065617424
+	.long	3665195816
+	.long	1045633853
+	.long	0
+	.long	1065354160
+	.long	2008730355
+	.long	3193898211
+	.long	0
+	.long	1064829264
+	.long	3746236192
+	.long	1046121471
+	.long	0
+	.long	1064303680
+	.long	885296753
+	.long	3191852441
+	.long	0
+	.long	1063253696
+	.long	449976495
+	.long	3192682663
+	.long	0
+	.long	0
+	.long	0
+	.long	2147483648
+	.type	L_tbl,@object
+	.size	L_tbl,8208
+	.space 496, 0x00 	# pad
+	.align 16
+HIGHMASK_Y:
+	.long	0
+	.long	4294967288
+	.long	0
+	.long	4294967295
+	.type	HIGHMASK_Y,@object
+	.size	HIGHMASK_Y,16
+	.align 16
+T_exp:
+	.long	0
+	.long	1072693248
+	.long	0
+	.long	997195776
+	.long	4200250559
+	.long	1072696090
+	.long	2808127345
+	.long	3162830514
+	.long	2851812149
+	.long	1072698941
+	.long	2595802551
+	.long	1016815913
+	.long	339411585
+	.long	1072701800
+	.long	264588982
+	.long	3162685233
+	.long	1048019041
+	.long	1072704666
+	.long	1398474845
+	.long	3161559171
+	.long	772914124
+	.long	1072707540
+	.long	4004372762
+	.long	1013278737
+	.long	3899555717
+	.long	1072710421
+	.long	427280750
+	.long	3163595548
+	.long	1928746161
+	.long	1072713311
+	.long	983617676
+	.long	1015333753
+	.long	3541402996
+	.long	1072716208
+	.long	2759177317
+	.long	1015903202
+	.long	238821257
+	.long	1072719114
+	.long	1469694871
+	.long	3163933563
+	.long	702412510
+	.long	1072722027
+	.long	3803266087
+	.long	3163328991
+	.long	728934454
+	.long	1072724948
+	.long	1413842688
+	.long	1015227188
+	.long	410360776
+	.long	1072727877
+	.long	1269990655
+	.long	1013024446
+	.long	4133881824
+	.long	1072730813
+	.long	2148155345
+	.long	3163979875
+	.long	3402036099
+	.long	1072733758
+	.long	405889334
+	.long	1016154232
+	.long	2602514713
+	.long	1072736711
+	.long	2268929336
+	.long	1015402860
+	.long	1828292879
+	.long	1072739672
+	.long	1255956747
+	.long	1016636974
+	.long	1172597893
+	.long	1072742641
+	.long	114433263
+	.long	1016396169
+	.long	728909815
+	.long	1072745618
+	.long	383930225
+	.long	1016078044
+	.long	590962156
+	.long	1072748603
+	.long	3829346666
+	.long	3164324173
+	.long	852742562
+	.long	1072751596
+	.long	667253586
+	.long	1010842135
+	.long	1608493509
+	.long	1072754597
+	.long	3159622171
+	.long	3163856313
+	.long	2952712987
+	.long	1072757606
+	.long	3293494651
+	.long	3161168877
+	.long	685187902
+	.long	1072760624
+	.long	378731989
+	.long	1015891691
+	.long	3490863953
+	.long	1072763649
+	.long	960797498
+	.long	3163997456
+	.long	2875075254
+	.long	1072766683
+	.long	4144233330
+	.long	3164382292
+	.long	3228316108
+	.long	1072769725
+	.long	3010241991
+	.long	3159471380
+	.long	351405227
+	.long	1072772776
+	.long	3125337328
+	.long	3160871055
+	.long	2930322912
+	.long	1072775834
+	.long	2599499422
+	.long	3163762623
+	.long	2471440686
+	.long	1072778901
+	.long	968836267
+	.long	3163263464
+	.long	3366293073
+	.long	1072781976
+	.long	3119426314
+	.long	1015169130
+	.long	1416741826
+	.long	1072785060
+	.long	2196380210
+	.long	1012462139
+	.long	1014845819
+	.long	1072788152
+	.long	3117910646
+	.long	3162607681
+	.long	2257959872
+	.long	1072791252
+	.long	3802946148
+	.long	1014013503
+	.long	948735466
+	.long	1072794361
+	.long	3516338028
+	.long	3163623459
+	.long	1480023343
+	.long	1072797478
+	.long	2247196168
+	.long	1016376029
+	.long	3949972341
+	.long	1072800603
+	.long	2068408548
+	.long	1015962444
+	.long	4162030108
+	.long	1072803737
+	.long	2763428480
+	.long	1016577925
+	.long	2214878420
+	.long	1072806880
+	.long	892270087
+	.long	3164164998
+	.long	2502433899
+	.long	1072810031
+	.long	2148595913
+	.long	1016072567
+	.long	828946858
+	.long	1072813191
+	.long	10642492
+	.long	1016988014
+	.long	1588871207
+	.long	1072816359
+	.long	143439582
+	.long	3164011992
+	.long	586995997
+	.long	1072819536
+	.long	41662348
+	.long	3163676568
+	.long	2218315341
+	.long	1072822721
+	.long	2694295388
+	.long	3164337444
+	.long	2288159958
+	.long	1072825915
+	.long	2169144469
+	.long	1015924597
+	.long	897099801
+	.long	1072829118
+	.long	754756297
+	.long	1016289581
+	.long	2440944790
+	.long	1072832329
+	.long	2492769774
+	.long	1015196030
+	.long	2725843665
+	.long	1072835549
+	.long	1433917087
+	.long	1015887099
+	.long	1853186616
+	.long	1072838778
+	.long	3066496371
+	.long	1016705150
+	.long	4219606026
+	.long	1072842015
+	.long	2434574742
+	.long	1015730124
+	.long	1337108031
+	.long	1072845262
+	.long	3203724452
+	.long	1015726421
+	.long	1897844341
+	.long	1072848517
+	.long	1254300460
+	.long	1016324514
+	.long	1709341917
+	.long	1072851781
+	.long	2571168217
+	.long	1015201075
+	.long	874372905
+	.long	1072855054
+	.long	100263788
+	.long	1016989308
+	.long	3790955393
+	.long	1072858335
+	.long	2352942462
+	.long	3164228666
+	.long	1972484976
+	.long	1072861626
+	.long	675290301
+	.long	3162688626
+	.long	4112506593
+	.long	1072864925
+	.long	2947355221
+	.long	1015419624
+	.long	1724976915
+	.long	1072868234
+	.long	420909223
+	.long	3164165955
+	.long	3504003472
+	.long	1072871551
+	.long	3594001060
+	.long	3158379228
+	.long	964107055
+	.long	1072874878
+	.long	2800439588
+	.long	3163881797
+	.long	2799960843
+	.long	1072878213
+	.long	1423655381
+	.long	1016070727
+	.long	526652809
+	.long	1072881558
+	.long	4223459736
+	.long	1016927951
+	.long	2839424854
+	.long	1072884911
+	.long	1171596163
+	.long	1014090255
+	.long	1253935211
+	.long	1072888274
+	.long	1395382931
+	.long	3160751189
+	.long	171030293
+	.long	1072891646
+	.long	3526460132
+	.long	1015477354
+	.long	3991843581
+	.long	1072895026
+	.long	4092853457
+	.long	1015634339
+	.long	4232894513
+	.long	1072898416
+	.long	2383938684
+	.long	1015717095
+	.long	1000925746
+	.long	1072901816
+	.long	1018491672
+	.long	3164358120
+	.long	2992903935
+	.long	1072905224
+	.long	2218154406
+	.long	1016276769
+	.long	1726216749
+	.long	1072908642
+	.long	2466808228
+	.long	3162724981
+	.long	1603444721
+	.long	1072912069
+	.long	1548633640
+	.long	3163249902
+	.long	2732492859
+	.long	1072915505
+	.long	2691479646
+	.long	3163304260
+	.long	926591435
+	.long	1072918951
+	.long	3208833762
+	.long	3163962090
+	.long	589198666
+	.long	1072922406
+	.long	2664346172
+	.long	3164206538
+	.long	1829099622
+	.long	1072925870
+	.long	1016661181
+	.long	3164509581
+	.long	460407023
+	.long	1072929344
+	.long	4237175092
+	.long	3164187045
+	.long	887463927
+	.long	1072932827
+	.long	3596744163
+	.long	3161842742
+	.long	3219942644
+	.long	1072936319
+	.long	3798990616
+	.long	1016417382
+	.long	3272845541
+	.long	1072939821
+	.long	928852419
+	.long	3164536824
+	.long	1156440435
+	.long	1072943333
+	.long	2351451249
+	.long	1015015632
+	.long	1276261410
+	.long	1072946854
+	.long	300981948
+	.long	1015732745
+	.long	3743175029
+	.long	1072950384
+	.long	2072812490
+	.long	3163223651
+	.long	78413852
+	.long	1072953925
+	.long	4183226867
+	.long	3164065827
+	.long	3278348324
+	.long	1072957474
+	.long	3069497416
+	.long	1015799288
+	.long	569847338
+	.long	1072961034
+	.long	472945272
+	.long	3160339305
+	.long	654919306
+	.long	1072964603
+	.long	3232961757
+	.long	3164096045
+	.long	3645941911
+	.long	1072968181
+	.long	3814685081
+	.long	3162621917
+	.long	1065662932
+	.long	1072971770
+	.long	2533670915
+	.long	1015578814
+	.long	1617004845
+	.long	1072975368
+	.long	82804944
+	.long	1011391354
+	.long	1118294578
+	.long	1072978976
+	.long	2197495694
+	.long	3160957977
+	.long	3978100823
+	.long	1072982593
+	.long	3513027190
+	.long	1016894539
+	.long	1720398391
+	.long	1072986221
+	.long	3980678963
+	.long	3164348656
+	.long	3049340112
+	.long	1072989858
+	.long	3062915824
+	.long	1014219171
+	.long	3784486610
+	.long	1072993505
+	.long	1581883040
+	.long	3162747529
+	.long	4040676318
+	.long	1072997162
+	.long	4090609238
+	.long	1016712034
+	.long	3933059031
+	.long	1073000829
+	.long	2133366768
+	.long	3162580408
+	.long	3577096743
+	.long	1073004506
+	.long	2951496418
+	.long	1014842263
+	.long	3088564500
+	.long	1073008193
+	.long	1762311517
+	.long	1016094249
+	.long	2583551245
+	.long	1073011890
+	.long	3161094195
+	.long	1016655067
+	.long	2178460671
+	.long	1073015597
+	.long	777878098
+	.long	3163891069
+	.long	1990012071
+	.long	1073019314
+	.long	3529070563
+	.long	3163861769
+	.long	2135241198
+	.long	1073023041
+	.long	1236747871
+	.long	1014637723
+	.long	2731501122
+	.long	1073026778
+	.long	1774031855
+	.long	3163518597
+	.long	3896463087
+	.long	1073030525
+	.long	1139797873
+	.long	3162282381
+	.long	1453150082
+	.long	1073034283
+	.long	498154669
+	.long	3162536638
+	.long	4109806887
+	.long	1073038050
+	.long	422403966
+	.long	1015517805
+	.long	3395129871
+	.long	1073041828
+	.long	4025345435
+	.long	3163383964
+	.long	3723038930
+	.long	1073045616
+	.long	378465264
+	.long	3163618158
+	.long	917841882
+	.long	1073049415
+	.long	18715565
+	.long	1016707884
+	.long	3689071823
+	.long	1073053223
+	.long	2321004996
+	.long	3163601292
+	.long	3566716925
+	.long	1073057042
+	.long	1536826856
+	.long	1015191009
+	.long	671025100
+	.long	1073060872
+	.long	3832014351
+	.long	3164070606
+	.long	3712504873
+	.long	1073064711
+	.long	88491949
+	.long	1016476236
+	.long	4222122499
+	.long	1073068561
+	.long	1277378074
+	.long	3164305313
+	.long	2321106615
+	.long	1073072422
+	.long	2171176610
+	.long	1010584347
+	.long	2425981843
+	.long	1073076293
+	.long	2830390851
+	.long	3164395175
+	.long	363667784
+	.long	1073080175
+	.long	813753950
+	.long	1016833785
+	.long	551349105
+	.long	1073084067
+	.long	3821916050
+	.long	3163155165
+	.long	3111574537
+	.long	1073087969
+	.long	2606161479
+	.long	3163808322
+	.long	3872257780
+	.long	1073091882
+	.long	1253592103
+	.long	1017006910
+	.long	2956612997
+	.long	1073095806
+	.long	2118169751
+	.long	3163784129
+	.long	488188413
+	.long	1073099741
+	.long	3199821029
+	.long	1016612624
+	.long	885834528
+	.long	1073103686
+	.long	1973258547
+	.long	3163310140
+	.long	4273770423
+	.long	1073107641
+	.long	3383180809
+	.long	3164267477
+	.long	2186617381
+	.long	1073111608
+	.long	2270764084
+	.long	3164321289
+	.long	3339203574
+	.long	1073115585
+	.long	1483497780
+	.long	3163457330
+	.long	3561793907
+	.long	1073119573
+	.long	1157054053
+	.long	1012938926
+	.long	2979960120
+	.long	1073123572
+	.long	2599109725
+	.long	1015547069
+	.long	1719614413
+	.long	1073127582
+	.long	330458198
+	.long	3164331316
+	.long	4201977662
+	.long	1073131602
+	.long	748330254
+	.long	1014642933
+	.long	1963711167
+	.long	1073135634
+	.long	1744767757
+	.long	3161622870
+	.long	3721688645
+	.long	1073139676
+	.long	3069276937
+	.long	1016887977
+	.long	1013258799
+	.long	1073143730
+	.long	1748797611
+	.long	3161177658
+	.long	2555984613
+	.long	1073147794
+	.long	2652555442
+	.long	3163601268
+	.long	4182873220
+	.long	1073151869
+	.long	629542646
+	.long	3163044879
+	.long	1727278727
+	.long	1073155956
+	.long	3562710623
+	.long	1012520516
+	.long	3907805044
+	.long	1073160053
+	.long	2257091225
+	.long	3162598983
+	.long	2263535754
+	.long	1073164162
+	.long	752233586
+	.long	3163687584
+	.long	1218806132
+	.long	1073168282
+	.long	1818613052
+	.long	3163597017
+	.long	903334909
+	.long	1073172413
+	.long	1636462108
+	.long	1016088573
+	.long	1447192521
+	.long	1073176555
+	.long	1462857171
+	.long	3163563097
+	.long	2980802057
+	.long	1073180708
+	.long	378619896
+	.long	1016821879
+	.long	1339972927
+	.long	1073184873
+	.long	167908909
+	.long	1016620728
+	.long	950803702
+	.long	1073189049
+	.long	1655364926
+	.long	1016285608
+	.long	1944781191
+	.long	1073193236
+	.long	3993278767
+	.long	3162772855
+	.long	158781403
+	.long	1073197435
+	.long	2221464712
+	.long	3164335029
+	.long	19972402
+	.long	1073201645
+	.long	3507899862
+	.long	1017057868
+	.long	1660913392
+	.long	1073205866
+	.long	4218599604
+	.long	1016184283
+	.long	919555682
+	.long	1073210099
+	.long	3121969534
+	.long	1013996802
+	.long	2224145553
+	.long	1073214343
+	.long	3482522030
+	.long	3162537745
+	.long	1413356050
+	.long	1073218599
+	.long	1651349291
+	.long	3163716742
+	.long	2916157145
+	.long	1073222866
+	.long	219487565
+	.long	1016357943
+	.long	2571947539
+	.long	1073227145
+	.long	3558159064
+	.long	3164425245
+	.long	515457527
+	.long	1073231436
+	.long	836709333
+	.long	1016699802
+	.long	1176749997
+	.long	1073235738
+	.long	2738998779
+	.long	3163084420
+	.long	396319521
+	.long	1073240052
+	.long	4172420816
+	.long	3160123208
+	.long	2604962541
+	.long	1073244377
+	.long	2614425274
+	.long	3164587768
+	.long	3643909174
+	.long	1073248714
+	.long	3537586109
+	.long	1015403223
+	.long	3649726105
+	.long	1073253063
+	.long	4085036346
+	.long	1016698050
+	.long	2759350287
+	.long	1073257424
+	.long	1148526634
+	.long	1016943509
+	.long	1110089947
+	.long	1073261797
+	.long	1451641639
+	.long	1016523249
+	.long	3134592888
+	.long	1073266181
+	.long	4232266862
+	.long	1017039710
+	.long	380978316
+	.long	1073270578
+	.long	854188970
+	.long	3161511262
+	.long	1577608921
+	.long	1073274986
+	.long	1875489510
+	.long	3164016970
+	.long	2568320822
+	.long	1073279406
+	.long	2732824428
+	.long	1015401491
+	.long	3492293770
+	.long	1073283838
+	.long	2248032210
+	.long	1016435402
+	.long	194117574
+	.long	1073288283
+	.long	777528612
+	.long	3164460665
+	.long	1403662306
+	.long	1073292739
+	.long	2788809599
+	.long	3162719583
+	.long	2966275557
+	.long	1073297207
+	.long	2176155324
+	.long	3160891335
+	.long	727685349
+	.long	1073301688
+	.long	2038246809
+	.long	3163407318
+	.long	3418903055
+	.long	1073306180
+	.long	2527457337
+	.long	3161869180
+	.long	2591453363
+	.long	1073310685
+	.long	2132396182
+	.long	3160122774
+	.long	2682146384
+	.long	1073315202
+	.long	2082178513
+	.long	3164411995
+	.long	3833209506
+	.long	1073319731
+	.long	2722920684
+	.long	1014803418
+	.long	1892288442
+	.long	1073324273
+	.long	2446255666
+	.long	3163648957
+	.long	1297350157
+	.long	1073328827
+	.long	1308022040
+	.long	3164461134
+	.long	2191782032
+	.long	1073333393
+	.long	2960257726
+	.long	1014791238
+	.long	424392917
+	.long	1073337972
+	.long	2749202995
+	.long	3163887294
+	.long	434316067
+	.long	1073342563
+	.long	2028358766
+	.long	1014506698
+	.long	2366108318
+	.long	1073347166
+	.long	2867985102
+	.long	3162810830
+	.long	2069751141
+	.long	1073351782
+	.long	1562170675
+	.long	3163773257
+	.long	3985553595
+	.long	1073356410
+	.long	4002146062
+	.long	1016882712
+	.long	3964284211
+	.long	1073361051
+	.long	2111583915
+	.long	1016475740
+	.long	2152073944
+	.long	1073365705
+	.long	1486860576
+	.long	3164252032
+	.long	2990417245
+	.long	1073370371
+	.long	3683467745
+	.long	3164417902
+	.long	2331271250
+	.long	1073375050
+	.long	812057446
+	.long	1013256022
+	.long	321958744
+	.long	1073379742
+	.long	3401933767
+	.long	1016843134
+	.long	1405169241
+	.long	1073384446
+	.long	2998539689
+	.long	3163879527
+	.long	1434058175
+	.long	1073389163
+	.long	251133233
+	.long	1016134345
+	.long	557149882
+	.long	1073393893
+	.long	3672720709
+	.long	1015585841
+	.long	3218338682
+	.long	1073398635
+	.long	3404164304
+	.long	3163525684
+	.long	977020788
+	.long	1073403391
+	.long	3065100517
+	.long	1016590139
+	.long	2572866477
+	.long	1073408159
+	.long	878562433
+	.long	1016570317
+	.long	3861050111
+	.long	1073412940
+	.long	254893773
+	.long	3163861756
+	.long	697153126
+	.long	1073417735
+	.long	1283515429
+	.long	3164331765
+	.long	1822067026
+	.long	1073422542
+	.long	1241994956
+	.long	1016388866
+	.long	3092190715
+	.long	1073427362
+	.long	814012168
+	.long	3160571998
+	.long	364333489
+	.long	1073432196
+	.long	3923737744
+	.long	3162469949
+	.long	2380618042
+	.long	1073437042
+	.long	3149557219
+	.long	3164369375
+	.long	703710506
+	.long	1073441902
+	.long	1384660846
+	.long	1016244467
+	.long	4076559943
+	.long	1073446774
+	.long	2119478331
+	.long	3161806927
+	.long	4062661092
+	.long	1073451660
+	.long	1422616006
+	.long	3164303894
+	.long	815859274
+	.long	1073456560
+	.long	240396590
+	.long	3164536019
+	.long	3080351519
+	.long	1073461472
+	.long	3379126789
+	.long	3158266577
+	.long	2420883922
+	.long	1073466398
+	.long	2049810052
+	.long	1015168464
+	.long	3287523847
+	.long	1073471337
+	.long	1625971539
+	.long	3158058531
+	.long	1540824585
+	.long	1073476290
+	.long	1064017011
+	.long	3164536266
+	.long	1631695677
+	.long	1073481256
+	.long	2717633076
+	.long	3163392602
+	.long	3716502172
+	.long	1073486235
+	.long	2303740125
+	.long	1015091301
+	.long	3657065772
+	.long	1073491228
+	.long	399025623
+	.long	3164005654
+	.long	1610600570
+	.long	1073496235
+	.long	3766732298
+	.long	1016808759
+	.long	2029714210
+	.long	1073501255
+	.long	613660079
+	.long	1016147719
+	.long	777507147
+	.long	1073506289
+	.long	4282924205
+	.long	1016236109
+	.long	2307442995
+	.long	1073511336
+	.long	3190117721
+	.long	3163453115
+	.long	2483480501
+	.long	1073516397
+	.long	1216371780
+	.long	1014082748
+	.long	1464976603
+	.long	1073521472
+	.long	3507292405
+	.long	3163026110
+	.long	3706687593
+	.long	1073526560
+	.long	3521726939
+	.long	1014301643
+	.long	778901109
+	.long	1073531663
+	.long	2248183954
+	.long	3162317327
+	.long	1432208378
+	.long	1073536779
+	.long	1401068914
+	.long	3163412539
+	.long	1532734324
+	.long	1073541909
+	.long	3094216535
+	.long	3164211433
+	.long	1242007932
+	.long	1073547053
+	.long	1132034716
+	.long	3164388407
+	.long	721996136
+	.long	1073552211
+	.long	563754734
+	.long	1016419894
+	.long	135105010
+	.long	1073557383
+	.long	1906148728
+	.long	3164424315
+	.long	3939148246
+	.long	1073562568
+	.long	3210352148
+	.long	1016322899
+	.long	3707479175
+	.long	1073567768
+	.long	3613079303
+	.long	1015213314
+	.long	3898795731
+	.long	1073572982
+	.long	1249994144
+	.long	1012918394
+	.long	382305176
+	.long	1073578211
+	.long	2347622376
+	.long	3163627201
+	.long	1912561781
+	.long	1073583453
+	.long	3147495102
+	.long	1016726829
+	.long	64696965
+	.long	1073588710
+	.long	1768797490
+	.long	1016865536
+	.long	3594158869
+	.long	1073593980
+	.long	2456521700
+	.long	3164305137
+	.long	4076975200
+	.long	1073599265
+	.long	2029000899
+	.long	1016257111
+	.long	1679558232
+	.long	1073604565
+	.long	2390342287
+	.long	3164382546
+	.long	863738719
+	.long	1073609879
+	.long	1326992220
+	.long	3163661773
+	.long	1796832535
+	.long	1073615207
+	.long	3176955716
+	.long	3161634089
+	.long	351641897
+	.long	1073620550
+	.long	2172261526
+	.long	3164059175
+	.long	991358482
+	.long	1073625907
+	.long	838715019
+	.long	3164206244
+	.long	3884662774
+	.long	1073631278
+	.long	2158611599
+	.long	1015258761
+	.long	610758006
+	.long	1073636665
+	.long	1965209397
+	.long	3162914808
+	.long	4224142467
+	.long	1073642065
+	.long	3389820386
+	.long	1016255778
+	.long	2009970496
+	.long	1073647481
+	.long	2159039665
+	.long	3163621524
+	.long	2728693978
+	.long	1073652911
+	.long	396109971
+	.long	3164511267
+	.long	2256325230
+	.long	1073658356
+	.long	580117746
+	.long	1016365871
+	.long	764307441
+	.long	1073663816
+	.long	3021057420
+	.long	3164378099
+	.long	2719515920
+	.long	1073669290
+	.long	2760332941
+	.long	1016186509
+	.long	3999357479
+	.long	1073674779
+	.long	2258941616
+	.long	1016973300
+	.long	481706282
+	.long	1073680284
+	.long	1696079173
+	.long	3163759104
+	.long	929806999
+	.long	1073685803
+	.long	3205336643
+	.long	1016308133
+	.long	1222472308
+	.long	1073691337
+	.long	1054357470
+	.long	3162069594
+	.long	1533953344
+	.long	1073696886
+	.long	769171851
+	.long	1016714209
+	.long	2038973688
+	.long	1073702450
+	.long	892941374
+	.long	1017095035
+	.long	2912730644
+	.long	1073708029
+	.long	3490067722
+	.long	3164453650
+	.long	35929225
+	.long	1073713624
+	.long	2809788041
+	.long	3160485544
+	.long	2174652632
+	.long	1073719233
+	.long	4087714590
+	.long	1015498835
+	.long	915592468
+	.long	1073724858
+	.long	352947894
+	.long	3162072947
+	.long	730821105
+	.long	1073730498
+	.long	2523232743
+	.long	1013115764
+	.long	1797923801
+	.long	1073736153
+	.long	1950547427
+	.long	1014277635
+	.type	T_exp,@object
+	.size	T_exp,4096
+	.space 512, 0x00 	# pad
+	.align 16
+e_coeff:
+	.long	3884607281
+	.long	1062590591
+	.long	3607404736
+	.long	1068264200
+	.long	1874480759
+	.long	1065595563
+	.long	4286760335
+	.long	1070514109
+	.long	4277811695
+	.long	1072049730
+	.long	0
+	.long	0
+	.type	e_coeff,@object
+	.size	e_coeff,48
+	.align 16
+coeff_h:
+	.long	0
+	.long	3218479616
+	.long	0
+	.long	3210587105
+	.type	coeff_h,@object
+	.size	coeff_h,16
+	.align 16
+HIGHMASK_LOG_X:
+	.long	4160749568
+	.long	4294967295
+	.long	0
+	.long	4294965248
+	.type	HIGHMASK_LOG_X,@object
+	.size	HIGHMASK_LOG_X,16
+	.align 8
+HALFMASK:
+	.long	4160749568
+	.long	4294967295
+	.long	4160749568
+	.long	4294967295
+	.type	HALFMASK,@object
+	.size	HALFMASK,16
+	.align 8
+log2:
+	.long	4277811695
+	.long	1072049730
+	.long	4277811695
+	.long	3219533378
+	.type	log2,@object
+	.size	log2,16
+	.data
+	.section .note.GNU-stack, ""
+// -- Begin DWARF2 SEGMENT .eh_frame
+	.section .eh_frame,"a",@progbits
+.eh_frame_seg:
+	.align 1
+	.4byte 0x00000014
+	.8byte 0x00527a0100000000
+	.8byte 0x08070c1b01107801
+	.4byte 0x00000190
+	.4byte 0x0000001c
+	.4byte 0x0000001c
+	.4byte ..___tag_value_pow.1-.
+	.4byte ..___tag_value_pow.5-..___tag_value_pow.1
+	.2byte 0x0400
+	.4byte ..___tag_value_pow.3-..___tag_value_pow.1
+	.2byte 0x300e
+	.byte 0x04
+	.4byte ..___tag_value_pow.4-..___tag_value_pow.3
+	.2byte 0x080e
+	.byte 0x00
+# End
diff --git a/linker/Android.bp b/linker/Android.bp
index 1800bdb..728dec5 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -1,6 +1,21 @@
-// ========================================================
-// linker_wrapper - Linux Bionic (on the host)
-// ========================================================
+cc_library_static {
+    name: "liblinker_malloc",
+    defaults: ["linux_bionic_supported"],
+    recovery_available: true,
+
+    srcs: [
+        "linker_memory.cpp",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    // We need to access Bionic private headers in the linker.
+    include_dirs: ["bionic/libc"],
+
+    static_libs: ["libasync_safe", "libbase"],
+}
 
 // This is used for bionic on (host) Linux to bootstrap our linker embedded into
 // a binary.
@@ -50,103 +65,6 @@
     include_dirs: ["bionic/libc"],
 }
 
-// ========================================================
-// linker default configuration
-// ========================================================
-
-// Configuration for the linker binary and any of its static libraries.
-cc_defaults {
-    name: "linker_defaults",
-    arch: {
-        arm: {
-            cflags: ["-D__work_around_b_24465209__"],
-        },
-        x86: {
-            cflags: ["-D__work_around_b_24465209__"],
-        },
-    },
-
-    cflags: [
-        "-fno-stack-protector",
-        "-Wstrict-overflow=5",
-        "-fvisibility=hidden",
-        "-Wall",
-        "-Wextra",
-        "-Wunused",
-        "-Werror",
-    ],
-
-    // TODO: split out the asflags.
-    asflags: [
-        "-fno-stack-protector",
-        "-Wstrict-overflow=5",
-        "-fvisibility=hidden",
-        "-Wall",
-        "-Wextra",
-        "-Wunused",
-        "-Werror",
-    ],
-
-    product_variables: {
-        debuggable: {
-            cppflags: ["-DUSE_LD_CONFIG_FILE"],
-        },
-    },
-
-    cppflags: ["-Wold-style-cast"],
-
-    static_libs: [
-        "libziparchive",
-        "libbase",
-        "libz",
-
-        "libasync_safe",
-
-        "liblog",
-    ],
-
-    // We need to access Bionic private headers in the linker.
-    include_dirs: ["bionic/libc"],
-}
-
-// ========================================================
-// linker components
-// ========================================================
-
-// Enable a module on all targets the linker runs on (ordinary Android targets, Linux Bionic, and
-// native bridge implementations).
-cc_defaults {
-    name: "linker_all_targets",
-    defaults: ["linux_bionic_supported"],
-    recovery_available: true,
-    native_bridge_supported: true,
-}
-
-cc_library_static {
-    name: "liblinker_main",
-    defaults: ["linker_defaults", "linker_all_targets"],
-    srcs: ["linker_main.cpp"],
-
-    // Ensure that the compiler won't insert string function calls before ifuncs are resolved.
-    cflags: ["-ffreestanding"],
-}
-
-cc_library_static {
-    name: "liblinker_malloc",
-    defaults: ["linker_defaults", "linker_all_targets"],
-    srcs: ["linker_memory.cpp"],
-}
-
-cc_library_static {
-    name: "liblinker_debuggerd_stub",
-    defaults: ["linker_defaults", "linker_all_targets"],
-    srcs: ["linker_debuggerd_stub.cpp"],
-}
-
-// ========================================================
-// template for the linker binary
-// ========================================================
-
 filegroup {
     name: "linker_sources",
     srcs: [
@@ -160,6 +78,7 @@
         "linker_globals.cpp",
         "linker_libc_support.c",
         "linker_libcxx_support.cpp",
+        "linker_main.cpp",
         "linker_namespaces.cpp",
         "linker_logger.cpp",
         "linker_mapped_file_fragment.cpp",
@@ -176,6 +95,7 @@
     name: "linker_sources_arm",
     srcs: [
         "arch/arm/begin.S",
+        "linker_exidx_static.c",
     ],
 }
 
@@ -217,50 +137,30 @@
     ],
 }
 
-cc_defaults {
-    name: "linker_version_script_overlay",
-    arch: {
-        arm:    { version_script: "linker.arm.map"      },
-        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"  },
-    },
+filegroup {
+    name: "linker_version_script",
+    srcs: ["linker.generic.map"],
 }
 
-// A template for the linker binary. May be inherited by native bridge implementations.
+filegroup {
+    name: "linker_version_script_arm",
+    srcs: ["linker.arm.map"],
+}
+
 cc_defaults {
-    name: "linker_bin_template",
-    defaults: ["linker_defaults"],
-
-    srcs: [":linker_sources"],
-
+    name: "linker_defaults",
     arch: {
         arm: {
-            srcs: [":linker_sources_arm"],
-            static_libs: ["libunwind_llvm"],
-        },
-        arm64: {
-            srcs: [":linker_sources_arm64"],
+            cflags: ["-D__work_around_b_24465209__"],
         },
         x86: {
-            srcs: [":linker_sources_x86"],
-        },
-        x86_64: {
-            srcs: [":linker_sources_x86_64"],
-        },
-        mips: {
-            srcs: [":linker_sources_mips"],
-        },
-        mips64: {
-            srcs: [":linker_sources_mips64"],
+            cflags: ["-D__work_around_b_24465209__"],
         },
     },
 
-    // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
-    // static_executable. This dynamic linker is actually a shared object linked with static
-    // libraries.
+    // -shared is used to overwrite the -Bstatic and -static
+    // flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
+    // This dynamic linker is actually a shared object linked with static libraries.
     ldflags: [
         "-shared",
         "-Wl,-Bsymbolic",
@@ -268,6 +168,40 @@
         "-Wl,-soname,ld-android.so",
     ],
 
+    cflags: [
+        "-fno-stack-protector",
+        "-Wstrict-overflow=5",
+        "-fvisibility=hidden",
+        "-Wall",
+        "-Wextra",
+        "-Wunused",
+        "-Werror",
+
+        // Define _USING_LIBCXX so <stdatomic.h> defers to the <atomic> header. When a Soong module
+        // uses the platform libc++, Soong automatically passes this macro, but the dynamic linker
+        // links against libc++ manually.
+        "-D_USING_LIBCXX",
+    ],
+
+    // TODO: split out the asflags.
+    asflags: [
+        "-fno-stack-protector",
+        "-Wstrict-overflow=5",
+        "-fvisibility=hidden",
+        "-Wall",
+        "-Wextra",
+        "-Wunused",
+        "-Werror",
+    ],
+
+    product_variables: {
+        debuggable: {
+            cppflags: ["-DUSE_LD_CONFIG_FILE"],
+        },
+    },
+
+    cppflags: ["-Wold-style-cast"],
+
     // we are going to link libc++_static manually because
     // when stl is not set to "none" build system adds libdl
     // to the list of static libraries which needs to be
@@ -293,47 +227,63 @@
     sanitize: {
         hwaddress: false,
     },
-
-    static_libs: [
-        "liblinker_main",
-        "liblinker_malloc",
-
-        "libc++_static",
-        "libc_nomalloc",
-        "libc_dynamic_dispatch",
-        "libm",
-    ],
-
-    // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
-    // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
-    // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
-    // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
-    // non-relative dynamic relocation in the linker binary, which complicates linker startup.
-    //
-    // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
-    // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
-    // linker stops linking against libgcc.a's arm32 unwinder.
-    whole_static_libs: ["libc_unwind_static"],
-
-    system_shared_libs: [],
-
-    // Opt out of native_coverage when opting out of system_shared_libs
-    native_coverage: false,
 }
 
-// ========================================================
-// linker[_asan][64] binary
-// ========================================================
-
 cc_binary {
-    name: "linker",
-    defaults: [
-        "linker_bin_template",
-        "linux_bionic_supported",
-        "linker_version_script_overlay",
+    defaults: ["linux_bionic_supported", "linker_defaults"],
+    srcs: [ ":linker_sources" ],
+
+    arch: {
+        arm: {
+            srcs: [ ":linker_sources_arm" ],
+            version_script: ":linker_version_script_arm",
+        },
+        arm64: {
+            srcs: [":linker_sources_arm64"],
+            version_script: ":linker_version_script",
+        },
+        x86: {
+            srcs: [":linker_sources_x86"],
+            version_script: ":linker_version_script",
+        },
+        x86_64: {
+            srcs: [":linker_sources_x86_64"],
+            version_script: ":linker_version_script",
+        },
+        mips: {
+            srcs: [":linker_sources_mips"],
+            version_script: ":linker_version_script",
+        },
+        mips64: {
+            srcs: [":linker_sources_mips64"],
+            version_script: ":linker_version_script",
+        },
+    },
+
+    // We need to access Bionic private headers in the linker.
+    include_dirs: ["bionic/libc"],
+
+    static_libs: [
+        "libc_nomalloc",
+        "libm",
+        "libziparchive",
+        "libutils",
+        "libbase",
+        "libz",
+
+        "libasync_safe",
+
+        "liblog",
+        "libc++_static",
+
+        // Important: The liblinker_malloc should be the last library in the list
+        // to overwrite any other malloc implementations by other static libraries.
+        "liblinker_malloc",
     ],
 
+    name: "linker",
     symlinks: ["linker_asan"],
+    recovery_available: true,
     multilib: {
         lib32: {
             cflags: ["-DLIB_PATH=\"lib\""],
@@ -343,41 +293,18 @@
             suffix: "64",
         },
     },
+    system_shared_libs: [],
 
-    compile_multilib: "both",
-    xom: false,
-
-    recovery_available: true,
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
+    // Opt out of native_coverage when opting out of system_shared_libs
+    native_coverage: false,
 
     target: {
         android: {
-            srcs: [
-                "linker_debuggerd_android.cpp",
-            ],
-            static_libs: [
-                "libc++demangle",
-                "libdebuggerd_handler_fallback",
-            ],
+            static_libs: ["libdebuggerd_handler_fallback"],
         },
-        linux_bionic: {
-            static_libs: [
-                "liblinker_debuggerd_stub",
-            ],
-        }
     },
-}
-
-// ========================================================
-// assorted modules
-// ========================================================
-
-sh_binary {
-    name: "ldd",
-    src: "ldd",
+    compile_multilib: "both",
+    xom: false,
 }
 
 cc_library {
@@ -401,11 +328,25 @@
 
     // for x86, exclude libgcc_eh.a for the same reasons as above
     arch: {
+        arm: {
+            version_script: "linker.arm.map",
+        },
+        arm64: {
+            version_script: "linker.generic.map",
+        },
         x86: {
             ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
+            version_script: "linker.generic.map",
         },
         x86_64: {
             ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
+            version_script: "linker.generic.map",
+        },
+        mips: {
+            version_script: "linker.generic.map",
+        },
+        mips64: {
+            version_script: "linker.generic.map",
         },
     },
 
@@ -419,9 +360,8 @@
     stl: "none",
 
     name: "ld-android",
-    defaults: ["linux_bionic_supported", "linker_version_script_overlay"],
+    defaults: ["linux_bionic_supported"],
     recovery_available: true,
-    native_bridge_supported: true,
 
     nocrt: true,
     system_shared_libs: [],
@@ -432,11 +372,6 @@
     sanitize: {
         never: true,
     },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
 }
 
 cc_test {
diff --git a/linker/MODULE_LICENSE_APACHE2 b/linker/MODULE_LICENSE_BSD
similarity index 100%
rename from linker/MODULE_LICENSE_APACHE2
rename to linker/MODULE_LICENSE_BSD
diff --git a/linker/NOTICE b/linker/NOTICE
deleted file mode 100644
index d645695..0000000
--- a/linker/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/linker/arch/arm64/tlsdesc_resolver.S b/linker/arch/arm64/tlsdesc_resolver.S
index 96eff8e..ef46839 100644
--- a/linker/arch/arm64/tlsdesc_resolver.S
+++ b/linker/arch/arm64/tlsdesc_resolver.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <platform/bionic/tls_defines.h>
 #include <private/bionic_asm.h>
+#include <private/bionic_asm_tls.h>
 
 .globl __tls_get_addr
 
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 228e30a..5a47272 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -31,7 +31,6 @@
 #include "linker_globals.h"
 #include "linker_dlwarning.h"
 
-#include <link.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -194,6 +193,11 @@
   return do_dl_iterate_phdr(cb, data);
 }
 
+// This function is needed by libgcc.a
+int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) {
+  return __loader_dl_iterate_phdr(cb, data);
+}
+
 #if defined(__arm__)
 _Unwind_Ptr __loader_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
@@ -304,11 +308,11 @@
 static soinfo* __libdl_info = nullptr;
 
 // This is used by the dynamic linker. Every process gets these symbols for free.
-soinfo* get_libdl_info(const soinfo& linker_si) {
+soinfo* get_libdl_info(const char* linker_path, const soinfo& linker_si) {
   CHECK((linker_si.flags_ & FLAG_GNU_HASH) != 0);
 
   if (__libdl_info == nullptr) {
-    __libdl_info = new (__libdl_info_buf) soinfo(&g_default_namespace, nullptr, nullptr, 0, 0);
+    __libdl_info = new (__libdl_info_buf) soinfo(&g_default_namespace, linker_path, nullptr, 0, 0);
     __libdl_info->flags_ |= (FLAG_LINKED | FLAG_GNU_HASH);
     __libdl_info->strtab_ = linker_si.strtab_;
     __libdl_info->symtab_ = linker_si.symtab_;
diff --git a/linker/ld.config.format.md b/linker/ld.config.format.md
index f9fbcde..faf5cc8 100644
--- a/linker/ld.config.format.md
+++ b/linker/ld.config.format.md
@@ -25,7 +25,7 @@
 ## Example
 
 ```
-# The following line maps section to a dir. Binaries ran from this location will use namespaces
+# The following line maps section to a dir. Binraies ran from this location will use namespaces
 # configuration specified in [example_section] below
 dir.example_section=/system/bin/example
 
@@ -38,7 +38,7 @@
 # default value is false
 enable.target.sdk.version = true
 
-# This property can be used to declare additional namespaces. Note that there is always the default
+# This property can be used to declare additional namespaces.Note that there is always the default
 # namespace. The default namespace is the namespace for the main executable. This list is
 # comma-separated.
 additional.namespaces = ns1
@@ -65,7 +65,7 @@
 # This declares linked namespaces - comma separated list.
 namespace.default.links = ns1
 
-# For every link define list of shared libraries. This is list of the libraries accessible from
+# For every link define list of shared libraries. This is list of the libraries accessilbe from
 # default namespace but loaded in the linked namespace.
 namespace.default.link.ns1.shared_libs = libexternal.so:libother.so
 
diff --git a/linker/ldd b/linker/ldd
deleted file mode 100644
index 6bc49b4..0000000
--- a/linker/ldd
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/system/bin/sh
-
-# Rather than have ldd and ldd64, this script does the right thing depending
-# on the argument.
-
-function error() {
-  echo "$1"
-  exit 1
-}
-
-[ $# -eq 1 ] || error "usage: ldd FILE"
-
-what=$(file -L "$1")
-case "$what" in
-  *32-bit*)
-    linker --list "$1"
-    ;;
-  *64-bit*)
-    linker64 --list "$1"
-    ;;
-  *)
-    error "$what"
-    ;;
-esac
diff --git a/linker/linker.cpp b/linker/linker.cpp
index e09b2a4..324f3ef 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -46,8 +46,8 @@
 
 #include <android-base/properties.h>
 #include <android-base/scopeguard.h>
+
 #include <async_safe/log.h>
-#include <bionic/pthread_internal.h>
 
 // Private C library headers.
 
@@ -68,7 +68,6 @@
 #include "linker_tls.h"
 #include "linker_utils.h"
 
-#include "private/bionic_call_ifunc_resolver.h"
 #include "private/bionic_globals.h"
 #include "android-base/macros.h"
 #include "android-base/strings.h"
@@ -77,7 +76,6 @@
 
 static std::unordered_map<void*, size_t> g_dso_handle_counters;
 
-static bool g_anonymous_namespace_set = false;
 static android_namespace_t* g_anonymous_namespace = &g_default_namespace;
 static std::unordered_map<std::string, android_namespace_t*> g_exported_namespaces;
 
@@ -87,16 +85,11 @@
 static LinkerTypeAllocator<android_namespace_t> g_namespace_allocator;
 static LinkerTypeAllocator<LinkedListEntry<android_namespace_t>> g_namespace_list_allocator;
 
-static uint64_t g_module_load_counter = 0;
-static uint64_t g_module_unload_counter = 0;
-
 static const char* const kLdConfigArchFilePath = "/system/etc/ld.config." ABI_STRING ".txt";
 
 static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
 static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
 
-static const char* const kLdGeneratedConfigFilePath = "/dev/linkerconfig/ld.config.txt";
-
 #if defined(__LP64__)
 static const char* const kSystemLibDir        = "/system/lib64";
 static const char* const kOdmLibDir           = "/odm/lib64";
@@ -104,7 +97,7 @@
 static const char* const kAsanSystemLibDir    = "/data/asan/system/lib64";
 static const char* const kAsanOdmLibDir       = "/data/asan/odm/lib64";
 static const char* const kAsanVendorLibDir    = "/data/asan/vendor/lib64";
-static const char* const kArtApexLibDir       = "/apex/com.android.art/lib64";
+static const char* const kRuntimeApexLibDir   = "/apex/com.android.runtime/lib64";
 #else
 static const char* const kSystemLibDir        = "/system/lib";
 static const char* const kOdmLibDir           = "/odm/lib";
@@ -112,7 +105,7 @@
 static const char* const kAsanSystemLibDir    = "/data/asan/system/lib";
 static const char* const kAsanOdmLibDir       = "/data/asan/odm/lib";
 static const char* const kAsanVendorLibDir    = "/data/asan/vendor/lib";
-static const char* const kArtApexLibDir       = "/apex/com.android.art/lib";
+static const char* const kRuntimeApexLibDir   = "/apex/com.android.runtime/lib";
 #endif
 
 static const char* const kAsanLibDirPrefix = "/data/asan";
@@ -205,6 +198,7 @@
     "libsqlite.so",
     "libui.so",
     "libutils.so",
+    "libvorbisidec.so",
     nullptr
   };
 
@@ -245,7 +239,7 @@
  * return true if translation is needed
  */
 static bool translateSystemPathToApexPath(const char* name, std::string* out_name_to_apex) {
-  static const char* const kSystemToArtApexLibs[] = {
+  static const char* const kSystemToRuntimeApexLibs[] = {
     "libicuuc.so",
     "libicui18n.so",
   };
@@ -263,9 +257,9 @@
 
   const char* base_name = basename(name);
 
-  for (const char* soname : kSystemToArtApexLibs) {
+  for (const char* soname : kSystemToRuntimeApexLibs) {
     if (strcmp(base_name, soname) == 0) {
-      *out_name_to_apex = std::string(kArtApexLibDir) + "/" + base_name;
+      *out_name_to_apex = std::string(kRuntimeApexLibDir) + "/" + base_name;
       return true;
     }
   }
@@ -276,6 +270,8 @@
 
 static std::vector<std::string> g_ld_preload_names;
 
+static bool g_anonymous_namespace_initialized;
+
 #if STATS
 struct linker_stats_t {
   int count[kRelocMax];
@@ -286,21 +282,15 @@
 void count_relocation(RelocationKind kind) {
   ++linker_stats.count[kind];
 }
-
-void print_linker_stats() {
-  PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol (%d cached)",
-         g_argv[0],
-         linker_stats.count[kRelocAbsolute],
-         linker_stats.count[kRelocRelative],
-         linker_stats.count[kRelocCopy],
-         linker_stats.count[kRelocSymbol],
-         linker_stats.count[kRelocSymbolCached]);
-}
 #else
 void count_relocation(RelocationKind) {
 }
 #endif
 
+#if COUNT_PAGES
+uint32_t bitmask[4096];
+#endif
+
 static void notify_gdb_of_load(soinfo* info) {
   if (info->is_linker() || info->is_main_executable()) {
     // gdb already knows about the linker and the main executable.
@@ -403,44 +393,19 @@
 }
 
 static bool realpath_fd(int fd, std::string* realpath) {
-  // proc_self_fd needs to be large enough to hold "/proc/self/fd/" plus an
-  // integer, plus the NULL terminator.
-  char proc_self_fd[32];
-  // We want to statically allocate this large buffer so that we don't grow
-  // the stack by too much.
-  static char buf[PATH_MAX];
-
-  async_safe_format_buffer(proc_self_fd, sizeof(proc_self_fd), "/proc/self/fd/%d", fd);
-  auto length = readlink(proc_self_fd, buf, sizeof(buf));
-  if (length == -1) {
+  std::vector<char> buf(PATH_MAX), proc_self_fd(PATH_MAX);
+  async_safe_format_buffer(&proc_self_fd[0], proc_self_fd.size(), "/proc/self/fd/%d", fd);
+  if (readlink(&proc_self_fd[0], &buf[0], buf.size()) == -1) {
     if (!is_first_stage_init()) {
-      PRINT("readlink(\"%s\") failed: %s [fd=%d]", proc_self_fd, strerror(errno), fd);
+      PRINT("readlink(\"%s\") failed: %s [fd=%d]", &proc_self_fd[0], strerror(errno), fd);
     }
     return false;
   }
 
-  realpath->assign(buf, length);
+  *realpath = &buf[0];
   return true;
 }
 
-// Returns the address of the current thread's copy of a TLS module. If the current thread doesn't
-// have a copy yet, allocate one on-demand if should_alloc is true, and return nullptr otherwise.
-static inline void* get_tls_block_for_this_thread(const soinfo_tls* si_tls, bool should_alloc) {
-  const TlsModule& tls_mod = get_tls_module(si_tls->module_id);
-  if (tls_mod.static_offset != SIZE_MAX) {
-    const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
-    char* static_tls = reinterpret_cast<char*>(__get_bionic_tcb()) - layout.offset_bionic_tcb();
-    return static_tls + tls_mod.static_offset;
-  } else if (should_alloc) {
-    const TlsIndex ti { si_tls->module_id, 0 };
-    return TLS_GET_ADDR(&ti);
-  } else {
-    TlsDtv* dtv = __get_tcb_dtv(__get_bionic_tcb());
-    if (dtv->generation < tls_mod.first_generation) return nullptr;
-    return dtv->modules[__tls_module_id_to_idx(si_tls->module_id)];
-  }
-}
-
 #if defined(__arm__)
 
 // For a given PC, find the .so that it belongs to.
@@ -470,16 +435,6 @@
     dl_info.dlpi_name = si->link_map_head.l_name;
     dl_info.dlpi_phdr = si->phdr;
     dl_info.dlpi_phnum = si->phnum;
-    dl_info.dlpi_adds = g_module_load_counter;
-    dl_info.dlpi_subs = g_module_unload_counter;
-    if (soinfo_tls* tls_module = si->get_tls()) {
-      dl_info.dlpi_tls_modid = tls_module->module_id;
-      dl_info.dlpi_tls_data = get_tls_block_for_this_thread(tls_module, /*should_alloc=*/false);
-    } else {
-      dl_info.dlpi_tls_modid = 0;
-      dl_info.dlpi_tls_data = nullptr;
-    }
-
     rv = cb(&dl_info, sizeof(dl_phdr_info), data);
     if (rv != 0) {
       break;
@@ -979,9 +934,7 @@
 }
 
 soinfo* find_containing_library(const void* p) {
-  // Addresses within a library may be tagged if they point to globals. Untag
-  // them so that the bounds check succeeds.
-  ElfW(Addr) address = reinterpret_cast<ElfW(Addr)>(untag_address(p));
+  ElfW(Addr) address = reinterpret_cast<ElfW(Addr)>(p);
   for (soinfo* si = solist_get_head(); si != nullptr; si = si->next) {
     if (address < si->base || address - si->base >= si->size) {
       continue;
@@ -1086,7 +1039,7 @@
 
   ZipEntry entry;
 
-  if (FindEntry(handle, file_path, &entry) != 0) {
+  if (FindEntry(handle, ZipString(file_path), &entry) != 0) {
     // Entry was not found.
     close(fd);
     return -1;
@@ -1262,14 +1215,12 @@
                                          off64_t file_offset,
                                          bool search_linked_namespaces,
                                          soinfo** candidate) {
-  if (file_stat.st_dev == 0 || file_stat.st_ino == 0) {
-    *candidate = nullptr;
-    return false;
-  }
 
   auto predicate = [&](soinfo* si) {
-    return si->get_st_ino() == file_stat.st_ino &&
+    return si->get_st_dev() != 0 &&
+           si->get_st_ino() != 0 &&
            si->get_st_dev() == file_stat.st_dev &&
+           si->get_st_ino() == file_stat.st_ino &&
            si->get_file_offset() == file_offset;
   };
 
@@ -1321,26 +1272,25 @@
   const char* name = task->get_name();
   const android_dlextinfo* extinfo = task->get_extinfo();
 
-  LD_LOG(kLogDlopen,
-         "load_library(ns=%s, task=%s, flags=0x%x, realpath=%s, search_linked_namespaces=%d)",
-         ns->get_name(), name, rtld_flags, realpath.c_str(), search_linked_namespaces);
+  LD_LOG(kLogDlopen, "load_library(ns=%s, task=%s, flags=0x%x, realpath=%s)", ns->get_name(), name,
+         rtld_flags, realpath.c_str());
 
   if ((file_offset % PAGE_SIZE) != 0) {
-    DL_OPEN_ERR("file offset for the library \"%s\" is not page-aligned: %" PRId64, name, file_offset);
+    DL_ERR("file offset for the library \"%s\" is not page-aligned: %" PRId64, name, file_offset);
     return false;
   }
   if (file_offset < 0) {
-    DL_OPEN_ERR("file offset for the library \"%s\" is negative: %" PRId64, name, file_offset);
+    DL_ERR("file offset for the library \"%s\" is negative: %" PRId64, name, file_offset);
     return false;
   }
 
   struct stat file_stat;
   if (TEMP_FAILURE_RETRY(fstat(task->get_fd(), &file_stat)) != 0) {
-    DL_OPEN_ERR("unable to stat file for the library \"%s\": %s", name, strerror(errno));
+    DL_ERR("unable to stat file for the library \"%s\": %s", name, strerror(errno));
     return false;
   }
   if (file_offset >= file_stat.st_size) {
-    DL_OPEN_ERR("file offset for the library \"%s\" >= file size: %" PRId64 " >= %" PRId64,
+    DL_ERR("file offset for the library \"%s\" >= file size: %" PRId64 " >= %" PRId64,
         name, file_offset, file_stat.st_size);
     return false;
   }
@@ -1360,13 +1310,13 @@
   }
 
   if ((rtld_flags & RTLD_NOLOAD) != 0) {
-    DL_OPEN_ERR("library \"%s\" wasn't loaded and RTLD_NOLOAD prevented it", name);
+    DL_ERR("library \"%s\" wasn't loaded and RTLD_NOLOAD prevented it", name);
     return false;
   }
 
   struct statfs fs_stat;
   if (TEMP_FAILURE_RETRY(fstatfs(task->get_fd(), &fs_stat)) != 0) {
-    DL_OPEN_ERR("unable to fstatfs file for the library \"%s\": %s", name, strerror(errno));
+    DL_ERR("unable to fstatfs file for the library \"%s\": %s", name, strerror(errno));
     return false;
   }
 
@@ -1397,7 +1347,7 @@
                                           "(unknown)" :
                                           task->get_needed_by()->get_realpath();
 
-      DL_OPEN_ERR("library \"%s\" needed or dlopened by \"%s\" is not accessible for the namespace \"%s\"",
+      DL_ERR("library \"%s\" needed or dlopened by \"%s\" is not accessible for the namespace \"%s\"",
              name, needed_or_dlopened_by, ns->get_name());
 
       // do not print this if a library is in the list of shared libraries for linked namespaces
@@ -1495,24 +1445,10 @@
     return load_library(ns, task, load_tasks, rtld_flags, realpath, search_linked_namespaces);
   }
 
-  LD_LOG(kLogDlopen,
-         "load_library(ns=%s, task=%s, flags=0x%x, search_linked_namespaces=%d): calling "
-         "open_library with realpath=%s",
-         ns->get_name(), name, rtld_flags, search_linked_namespaces, realpath.c_str());
-
   // Open the file.
   int fd = open_library(ns, zip_archive_cache, name, needed_by, &file_offset, &realpath);
   if (fd == -1) {
-    if (task->is_dt_needed()) {
-      if (needed_by->is_main_executable()) {
-        DL_OPEN_ERR("library \"%s\" not found: needed by main executable", name);
-      } else {
-        DL_OPEN_ERR("library \"%s\" not found: needed by %s in namespace %s", name,
-                    needed_by->get_realpath(), task->get_start_from()->get_name());
-      }
-    } else {
-      DL_OPEN_ERR("library \"%s\" not found", name);
-    }
+    DL_ERR("library \"%s\" not found", name);
     return false;
   }
 
@@ -1946,9 +1882,6 @@
           // flag is set.
           link_extinfo = extinfo;
         }
-        if (__libc_shared_globals()->load_hook) {
-          __libc_shared_globals()->load_hook(si->load_bias, si->phdr, si->phnum);
-        }
         if (!si->link_image(global_group, local_group, link_extinfo, &relro_fd_offset) ||
             !get_cfi_shadow()->AfterLoad(si, solist_get_head())) {
           return false;
@@ -2085,12 +2018,8 @@
            "... dlclose: unloading \"%s\"@%p ...",
            si->get_realpath(),
            si);
-    ++g_module_unload_counter;
     notify_gdb_of_unload(si);
     unregister_soinfo_tls(si);
-    if (__libc_shared_globals()->unload_hook) {
-      __libc_shared_globals()->unload_hook(si->load_bias, si->phdr, si->phnum);
-    }
     get_cfi_shadow()->BeforeUnload(si);
     soinfo_free(si);
   }
@@ -2278,26 +2207,26 @@
       [&]() { LD_LOG(kLogDlopen, "... dlopen failed: %s", linker_get_error_buffer()); });
 
   if ((flags & ~(RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_GLOBAL|RTLD_NODELETE|RTLD_NOLOAD)) != 0) {
-    DL_OPEN_ERR("invalid flags to dlopen: %x", flags);
+    DL_ERR("invalid flags to dlopen: %x", flags);
     return nullptr;
   }
 
   if (extinfo != nullptr) {
     if ((extinfo->flags & ~(ANDROID_DLEXT_VALID_FLAG_BITS)) != 0) {
-      DL_OPEN_ERR("invalid extended flags to android_dlopen_ext: 0x%" PRIx64, extinfo->flags);
+      DL_ERR("invalid extended flags to android_dlopen_ext: 0x%" PRIx64, extinfo->flags);
       return nullptr;
     }
 
     if ((extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD) == 0 &&
         (extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET) != 0) {
-      DL_OPEN_ERR("invalid extended flag combination (ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET without "
+      DL_ERR("invalid extended flag combination (ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET without "
           "ANDROID_DLEXT_USE_LIBRARY_FD): 0x%" PRIx64, extinfo->flags);
       return nullptr;
     }
 
     if ((extinfo->flags & ANDROID_DLEXT_USE_NAMESPACE) != 0) {
       if (extinfo->library_namespace == nullptr) {
-        DL_OPEN_ERR("ANDROID_DLEXT_USE_NAMESPACE is set but extinfo->library_namespace is null");
+        DL_ERR("ANDROID_DLEXT_USE_NAMESPACE is set but extinfo->library_namespace is null");
         return nullptr;
       }
       ns = extinfo->library_namespace;
@@ -2414,7 +2343,7 @@
   ScopedTrace trace("dlsym");
 #if !defined(__LP64__)
   if (handle == nullptr) {
-    DL_SYM_ERR("dlsym failed: library handle is null");
+    DL_ERR("dlsym failed: library handle is null");
     return false;
   }
 #endif
@@ -2442,7 +2371,7 @@
       [&]() { LD_LOG(kLogDlsym, "... dlsym failed: %s", linker_get_error_buffer()); });
 
   if (sym_name == nullptr) {
-    DL_SYM_ERR("dlsym failed: symbol name is null");
+    DL_ERR("dlsym failed: symbol name is null");
     return false;
   }
 
@@ -2459,7 +2388,7 @@
     sym = dlsym_linear_lookup(ns, sym_name, vi, &found, caller, handle);
   } else {
     if (si == nullptr) {
-      DL_SYM_ERR("dlsym failed: invalid handle: %p", handle);
+      DL_ERR("dlsym failed: invalid handle: %p", handle);
       return false;
     }
     sym = dlsym_handle_lookup(si, &found, sym_name, vi);
@@ -2472,15 +2401,18 @@
     if ((bind == STB_GLOBAL || bind == STB_WEAK) && sym->st_shndx != 0) {
       if (type == STT_TLS) {
         // For a TLS symbol, dlsym returns the address of the current thread's
-        // copy of the symbol.
-        const soinfo_tls* tls_module = found->get_tls();
+        // copy of the symbol. This function may allocate a DTV and/or storage
+        // for the source TLS module. (Allocating a DTV isn't necessary if the
+        // symbol is part of static TLS, but it's simpler to reuse
+        // __tls_get_addr.)
+        soinfo_tls* tls_module = found->get_tls();
         if (tls_module == nullptr) {
-          DL_SYM_ERR("TLS symbol \"%s\" in solib \"%s\" with no TLS segment",
-                     sym_name, found->get_realpath());
+          DL_ERR("TLS symbol \"%s\" in solib \"%s\" with no TLS segment",
+                 sym_name, found->get_realpath());
           return false;
         }
-        void* tls_block = get_tls_block_for_this_thread(tls_module, /*should_alloc=*/true);
-        *symbol = static_cast<char*>(tls_block) + sym->st_value;
+        const TlsIndex ti { tls_module->module_id, sym->st_value };
+        *symbol = TLS_GET_ADDR(&ti);
       } else {
         *symbol = reinterpret_cast<void*>(found->resolve_symbol_address(sym));
       }
@@ -2491,11 +2423,11 @@
       return true;
     }
 
-    DL_SYM_ERR("symbol \"%s\" found but not global", symbol_display_name(sym_name, sym_ver).c_str());
+    DL_ERR("symbol \"%s\" found but not global", symbol_display_name(sym_name, sym_ver).c_str());
     return false;
   }
 
-  DL_SYM_ERR("undefined symbol: %s", symbol_display_name(sym_name, sym_ver).c_str());
+  DL_ERR("undefined symbol: %s", symbol_display_name(sym_name, sym_ver).c_str());
   return false;
 }
 
@@ -2504,7 +2436,7 @@
   ProtectedDataGuard guard;
   soinfo* si = soinfo_from_handle(handle);
   if (si == nullptr) {
-    DL_OPEN_ERR("invalid handle: %p", handle);
+    DL_ERR("invalid handle: %p", handle);
     return -1;
   }
 
@@ -2520,28 +2452,13 @@
   return 0;
 }
 
-// Make ns as the anonymous namespace that is a namespace used when
-// we fail to determine the caller address (e.g., call from mono-jited code)
-// Since there can be multiple anonymous namespace in a process, subsequent
-// call to this function causes an error.
-static bool set_anonymous_namespace(android_namespace_t* ns) {
-  if (!g_anonymous_namespace_set && ns != nullptr) {
-    CHECK(ns->is_also_used_as_anonymous());
-    g_anonymous_namespace = ns;
-    g_anonymous_namespace_set = true;
-    return true;
-  }
-  return false;
-}
-
-// TODO(b/130388701) remove this. Currently, this is used only for testing
-// where we don't have classloader namespace.
 bool init_anonymous_namespace(const char* shared_lib_sonames, const char* library_search_path) {
-  ProtectedDataGuard guard;
+  if (g_anonymous_namespace_initialized) {
+    DL_ERR("anonymous namespace has already been initialized.");
+    return false;
+  }
 
-  // Test-only feature: we need to change the anonymous namespace multiple times
-  // while the test is running.
-  g_anonymous_namespace_set = false;
+  ProtectedDataGuard guard;
 
   // create anonymous namespace
   // When the caller is nullptr - create_namespace will take global group
@@ -2552,18 +2469,21 @@
                        "(anonymous)",
                        nullptr,
                        library_search_path,
-                       ANDROID_NAMESPACE_TYPE_ISOLATED |
-                       ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS,
+                       ANDROID_NAMESPACE_TYPE_ISOLATED,
                        nullptr,
                        &g_default_namespace);
 
-  CHECK(anon_ns != nullptr);
-
-  if (!link_namespaces(anon_ns, &g_default_namespace, shared_lib_sonames)) {
-    // TODO: delete anon_ns
+  if (anon_ns == nullptr) {
     return false;
   }
 
+  if (!link_namespaces(anon_ns, &g_default_namespace, shared_lib_sonames)) {
+    return false;
+  }
+
+  g_anonymous_namespace = anon_ns;
+  g_anonymous_namespace_initialized = true;
+
   return true;
 }
 
@@ -2603,7 +2523,6 @@
   ns->set_name(name);
   ns->set_isolated((type & ANDROID_NAMESPACE_TYPE_ISOLATED) != 0);
   ns->set_greylist_enabled((type & ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED) != 0);
-  ns->set_also_used_as_anonymous((type & ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS) != 0);
 
   if ((type & ANDROID_NAMESPACE_TYPE_SHARED) != 0) {
     // append parent namespace paths.
@@ -2635,16 +2554,6 @@
   ns->set_default_library_paths(std::move(default_library_paths));
   ns->set_permitted_paths(std::move(permitted_paths));
 
-  if (ns->is_also_used_as_anonymous() && !set_anonymous_namespace(ns)) {
-    DL_ERR("failed to set namespace: [name=\"%s\", ld_library_path=\"%s\", default_library_paths=\"%s\""
-           " permitted_paths=\"%s\"] as the anonymous namespace",
-           ns->get_name(),
-           android::base::Join(ns->get_ld_library_paths(), ':').c_str(),
-           android::base::Join(ns->get_default_library_paths(), ':').c_str(),
-           android::base::Join(ns->get_permitted_paths(), ':').c_str());
-    return nullptr;
-  }
-
   return ns;
 }
 
@@ -2694,11 +2603,11 @@
 }
 
 ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) {
-  if (g_is_ldd) return 0;
-
-  ElfW(Addr) ifunc_addr = __bionic_call_ifunc_resolver(resolver_addr);
+  typedef ElfW(Addr) (*ifunc_resolver_t)(void);
+  ifunc_resolver_t ifunc_resolver = reinterpret_cast<ifunc_resolver_t>(resolver_addr);
+  ElfW(Addr) ifunc_addr = ifunc_resolver();
   TRACE_TYPE(RELO, "Called ifunc_resolver@%p. The result is %p",
-      reinterpret_cast<void *>(resolver_addr), reinterpret_cast<void*>(ifunc_addr));
+      ifunc_resolver, reinterpret_cast<void*>(ifunc_addr));
 
   return ifunc_addr;
 }
@@ -2935,11 +2844,8 @@
 }
 #else
 static ElfW(Addr) get_addend(ElfW(Rel)* rel, ElfW(Addr) reloc_addr) {
-  // The i386 psABI specifies that R_386_GLOB_DAT doesn't have an addend. The ARM ELF ABI document
-  // (IHI0044F) specifies that R_ARM_GLOB_DAT has an addend, but Bionic isn't adding it.
   if (ELFW(R_TYPE)(rel->r_info) == R_GENERIC_RELATIVE ||
       ELFW(R_TYPE)(rel->r_info) == R_GENERIC_IRELATIVE ||
-      ELFW(R_TYPE)(rel->r_info) == R_GENERIC_ABSOLUTE ||
       ELFW(R_TYPE)(rel->r_info) == R_GENERIC_TLS_DTPREL ||
       ELFW(R_TYPE)(rel->r_info) == R_GENERIC_TLS_TPREL) {
     return *reinterpret_cast<ElfW(Addr)*>(reloc_addr);
@@ -2966,17 +2872,6 @@
   const size_t tls_tp_base = __libc_shared_globals()->static_tls_layout.offset_thread_pointer();
   std::vector<std::pair<TlsDescriptor*, size_t>> deferred_tlsdesc_relocs;
 
-  struct {
-    // Cache key
-    ElfW(Word) sym;
-
-    // Cache value
-    const ElfW(Sym)* s;
-    soinfo* lsi;
-  } symbol_lookup_cache;
-
-  symbol_lookup_cache.sym = 0;
-
   for (size_t idx = 0; rel_iterator.has_next(); ++idx) {
     const auto rel = rel_iterator.next();
     if (rel == nullptr) {
@@ -3020,25 +2915,14 @@
       return false;
     } else {
       sym_name = get_string(symtab_[sym].st_name);
+      const version_info* vi = nullptr;
 
-      if (sym == symbol_lookup_cache.sym) {
-        s = symbol_lookup_cache.s;
-        lsi = symbol_lookup_cache.lsi;
-        count_relocation(kRelocSymbolCached);
-      } else {
-        const version_info* vi = nullptr;
+      if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
+        return false;
+      }
 
-        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;
-        }
-
-        symbol_lookup_cache.sym = sym;
-        symbol_lookup_cache.s = s;
-        symbol_lookup_cache.lsi = lsi;
+      if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
+        return false;
       }
 
       if (s == nullptr) {
@@ -3063,7 +2947,6 @@
 
         switch (type) {
           case R_GENERIC_JUMP_SLOT:
-          case R_GENERIC_ABSOLUTE:
           case R_GENERIC_GLOB_DAT:
           case R_GENERIC_RELATIVE:
           case R_GENERIC_IRELATIVE:
@@ -3071,8 +2954,17 @@
           case R_GENERIC_TLS_DTPREL:
           case R_GENERIC_TLS_TPREL:
           case R_GENERIC_TLSDESC:
-#if defined(__x86_64__)
+#if defined(__aarch64__)
+          case R_AARCH64_ABS64:
+          case R_AARCH64_ABS32:
+          case R_AARCH64_ABS16:
+#elif defined(__x86_64__)
           case R_X86_64_32:
+          case R_X86_64_64:
+#elif defined(__arm__)
+          case R_ARM_ABS32:
+#elif defined(__i386__)
+          case R_386_32:
 #endif
             /*
              * The sym_addr was initialized to be zero above, or the relocation
@@ -3145,22 +3037,24 @@
     switch (type) {
       case R_GENERIC_JUMP_SLOT:
         count_relocation(kRelocAbsolute);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO JMP_SLOT %16p <- %16p %s\n",
                    reinterpret_cast<void*>(reloc),
                    reinterpret_cast<void*>(sym_addr + addend), sym_name);
 
         *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
         break;
-      case R_GENERIC_ABSOLUTE:
       case R_GENERIC_GLOB_DAT:
         count_relocation(kRelocAbsolute);
-        TRACE_TYPE(RELO, "RELO ABSOLUTE/GLOB_DAT %16p <- %16p %s\n",
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO GLOB_DAT %16p <- %16p %s\n",
                    reinterpret_cast<void*>(reloc),
                    reinterpret_cast<void*>(sym_addr + addend), sym_name);
         *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
         break;
       case R_GENERIC_RELATIVE:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO RELATIVE %16p <- %16p\n",
                    reinterpret_cast<void*>(reloc),
                    reinterpret_cast<void*>(load_bias + addend));
@@ -3168,13 +3062,11 @@
         break;
       case R_GENERIC_IRELATIVE:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO IRELATIVE %16p <- %16p\n",
                     reinterpret_cast<void*>(reloc),
                     reinterpret_cast<void*>(load_bias + addend));
-        // In the linker, ifuncs are called as soon as possible so that string functions work.
-        // We must not call them again. (e.g. On arm32, resolving an ifunc changes the meaning of
-        // the addend from a resolver function to the implementation.)
-        if (!is_linker()) {
+        {
 #if !defined(__LP64__)
           // When relocating dso with text_relocation .text segment is
           // not executable. We need to restore elf flags for this
@@ -3201,19 +3093,9 @@
           *reinterpret_cast<ElfW(Addr)*>(reloc) = ifunc_addr;
         }
         break;
-      case R_GENERIC_COPY:
-        // Copy relocations allow read-only data or code in a non-PIE executable to access a
-        // variable from a DSO. The executable reserves extra space in its .bss section, and the
-        // linker copies the variable into the extra space. The executable then exports its copy
-        // to interpose the copy in the DSO.
-        //
-        // Bionic only supports PIE executables, so copy relocations aren't supported. The ARM and
-        // AArch64 ABI documents only allow them for ET_EXEC (non-PIE) objects. See IHI0056B and
-        // IHI0044F.
-        DL_ERR("%s COPY relocations are not supported", get_realpath());
-        return false;
       case R_GENERIC_TLS_TPREL:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         {
           ElfW(Addr) tpoff = 0;
           if (lsi == nullptr) {
@@ -3237,8 +3119,13 @@
           *reinterpret_cast<ElfW(Addr)*>(reloc) = tpoff;
         }
         break;
+
+#if !defined(__aarch64__)
+      // Omit support for DTPMOD/DTPREL on arm64, at least until
+      // http://b/123385182 is fixed. arm64 uses TLSDESC instead.
       case R_GENERIC_TLS_DTPMOD:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         {
           size_t module_id = 0;
           if (lsi == nullptr) {
@@ -3254,17 +3141,20 @@
         break;
       case R_GENERIC_TLS_DTPREL:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO TLS_DTPREL %16p <- %16p %s\n",
                    reinterpret_cast<void*>(reloc),
                    reinterpret_cast<void*>(sym_addr + addend), sym_name);
         *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
         break;
+#endif  // !defined(__aarch64__)
 
 #if defined(__aarch64__)
       // Bionic currently only implements TLSDESC for arm64. This implementation should work with
       // other architectures, as long as the resolver functions are implemented.
       case R_GENERIC_TLSDESC:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         {
           TlsDescriptor* desc = reinterpret_cast<TlsDescriptor*>(reloc);
           if (lsi == nullptr) {
@@ -3302,23 +3192,165 @@
         break;
 #endif  // defined(__aarch64__)
 
-#if defined(__x86_64__)
-      case R_X86_64_32:
+#if defined(__aarch64__)
+      case R_AARCH64_ABS64:
         count_relocation(kRelocAbsolute);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO ABS64 %16llx <- %16llx %s\n",
+                   reloc, sym_addr + addend, sym_name);
+        *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
+        break;
+      case R_AARCH64_ABS32:
+        count_relocation(kRelocAbsolute);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO ABS32 %16llx <- %16llx %s\n",
+                   reloc, sym_addr + addend, sym_name);
+        {
+          const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT32_MIN);
+          const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT32_MAX);
+          if ((min_value <= (sym_addr + addend)) &&
+              ((sym_addr + addend) <= max_value)) {
+            *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
+          } else {
+            DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
+                   sym_addr + addend, min_value, max_value);
+            return false;
+          }
+        }
+        break;
+      case R_AARCH64_ABS16:
+        count_relocation(kRelocAbsolute);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO ABS16 %16llx <- %16llx %s\n",
+                   reloc, sym_addr + addend, sym_name);
+        {
+          const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT16_MIN);
+          const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT16_MAX);
+          if ((min_value <= (sym_addr + addend)) &&
+              ((sym_addr + addend) <= max_value)) {
+            *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
+          } else {
+            DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
+                   sym_addr + addend, min_value, max_value);
+            return false;
+          }
+        }
+        break;
+      case R_AARCH64_PREL64:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO REL64 %16llx <- %16llx - %16llx %s\n",
+                   reloc, sym_addr + addend, rel->r_offset, sym_name);
+        *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
+        break;
+      case R_AARCH64_PREL32:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO REL32 %16llx <- %16llx - %16llx %s\n",
+                   reloc, sym_addr + addend, rel->r_offset, sym_name);
+        {
+          const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT32_MIN);
+          const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT32_MAX);
+          if ((min_value <= (sym_addr + addend - rel->r_offset)) &&
+              ((sym_addr + addend - rel->r_offset) <= max_value)) {
+            *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
+          } else {
+            DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
+                   sym_addr + addend - rel->r_offset, min_value, max_value);
+            return false;
+          }
+        }
+        break;
+      case R_AARCH64_PREL16:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO REL16 %16llx <- %16llx - %16llx %s\n",
+                   reloc, sym_addr + addend, rel->r_offset, sym_name);
+        {
+          const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT16_MIN);
+          const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT16_MAX);
+          if ((min_value <= (sym_addr + addend - rel->r_offset)) &&
+              ((sym_addr + addend - rel->r_offset) <= max_value)) {
+            *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
+          } else {
+            DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
+                   sym_addr + addend - rel->r_offset, min_value, max_value);
+            return false;
+          }
+        }
+        break;
+
+      case R_AARCH64_COPY:
+        /*
+         * ET_EXEC is not supported so this should not happen.
+         *
+         * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf
+         *
+         * Section 4.6.11 "Dynamic relocations"
+         * R_AARCH64_COPY may only appear in executable objects where e_type is
+         * set to ET_EXEC.
+         */
+        DL_ERR("%s R_AARCH64_COPY relocations are not supported", get_realpath());
+        return false;
+#elif defined(__x86_64__)
+      case R_X86_64_32:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO R_X86_64_32 %08zx <- +%08zx %s", static_cast<size_t>(reloc),
                    static_cast<size_t>(sym_addr), sym_name);
         *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend;
         break;
+      case R_X86_64_64:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO R_X86_64_64 %08zx <- +%08zx %s", static_cast<size_t>(reloc),
+                   static_cast<size_t>(sym_addr), sym_name);
+        *reinterpret_cast<Elf64_Addr*>(reloc) = sym_addr + addend;
+        break;
       case R_X86_64_PC32:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO R_X86_64_PC32 %08zx <- +%08zx (%08zx - %08zx) %s",
                    static_cast<size_t>(reloc), static_cast<size_t>(sym_addr - reloc),
                    static_cast<size_t>(sym_addr), static_cast<size_t>(reloc), sym_name);
         *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend - reloc;
         break;
+#elif defined(__arm__)
+      case R_ARM_ABS32:
+        count_relocation(kRelocAbsolute);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO ABS %08x <- %08x %s", reloc, sym_addr, sym_name);
+        *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
+        break;
+      case R_ARM_REL32:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO REL32 %08x <- %08x - %08x %s",
+                   reloc, sym_addr, rel->r_offset, sym_name);
+        *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr - rel->r_offset;
+        break;
+      case R_ARM_COPY:
+        /*
+         * ET_EXEC is not supported so this should not happen.
+         *
+         * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044d/IHI0044D_aaelf.pdf
+         *
+         * Section 4.6.1.10 "Dynamic relocations"
+         * R_ARM_COPY may only appear in executable objects where e_type is
+         * set to ET_EXEC.
+         */
+        DL_ERR("%s R_ARM_COPY relocations are not supported", get_realpath());
+        return false;
 #elif defined(__i386__)
+      case R_386_32:
+        count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
+        TRACE_TYPE(RELO, "RELO R_386_32 %08x <- +%08x %s", reloc, sym_addr, sym_name);
+        *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
+        break;
       case R_386_PC32:
         count_relocation(kRelocRelative);
+        MARK(rel->r_offset);
         TRACE_TYPE(RELO, "RELO R_386_PC32 %08x <- +%08x (%08x - %08x) %s",
                    reloc, (sym_addr - reloc), sym_addr, reloc, sym_name);
         *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr - reloc);
@@ -3851,11 +3883,6 @@
     return true;
   }
 
-  if (g_is_ldd && !is_main_executable()) {
-    async_safe_format_fd(STDOUT_FILENO, "\t%s => %s (%p)\n", get_soname(),
-                         get_realpath(), reinterpret_cast<void*>(base));
-  }
-
   local_group_root_ = local_group.front();
   if (local_group_root_ == nullptr) {
     local_group_root_ = this;
@@ -4004,7 +4031,6 @@
     }
   }
 
-  ++g_module_load_counter;
   notify_gdb_of_load(this);
   set_image_linked();
   return true;
@@ -4040,10 +4066,10 @@
   return namespaces;
 }
 
-// return /apex/<name>/etc/ld.config.txt from /apex/<name>/bin/*
+// return /apex/<name>/etc/ld.config.txt from /apex/<name>/bin/<exec>
 static std::string get_ld_config_file_apex_path(const char* executable_path) {
   std::vector<std::string> paths = android::base::Split(executable_path, "/");
-  if (paths.size() >= 5 && paths[1] == "apex" && paths[3] == "bin") {
+  if (paths.size() == 5 && paths[1] == "apex" && paths[3] == "bin") {
     return std::string("/apex/") + paths[2] + "/etc/ld.config.txt";
   }
   return "";
@@ -4054,19 +4080,6 @@
     return kLdConfigVndkLiteFilePath;
   }
 
-  // Use generated linker config if flag is set
-  // TODO(b/138920271) Do not check property once it is confirmed as stable
-  // TODO(b/139638519) This file should also cover legacy or vndk-lite config
-  if (android::base::GetProperty("ro.vndk.version", "") != "" &&
-      android::base::GetBoolProperty("sys.linker.use_generated_config", true)) {
-    if (file_exists(kLdGeneratedConfigFilePath)) {
-      return kLdGeneratedConfigFilePath;
-    } else {
-      DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
-              kLdGeneratedConfigFilePath);
-    }
-  }
-
   std::string ld_config_file_vndk = kLdConfigFilePath;
   size_t insert_pos = ld_config_file_vndk.find_last_of('.');
   if (insert_pos == std::string::npos) {
diff --git a/linker/linker.h b/linker/linker.h
index 89390b3..4c89ceb 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -94,15 +94,12 @@
   kRelocRelative,
   kRelocCopy,
   kRelocSymbol,
-  kRelocSymbolCached,
   kRelocMax
 };
 
 void count_relocation(RelocationKind kind);
 
-void print_linker_stats();
-
-soinfo* get_libdl_info(const soinfo& linker_si);
+soinfo* get_libdl_info(const char* linker_path, const soinfo& linker_si);
 
 soinfo* find_containing_library(const void* p);
 
@@ -165,13 +162,6 @@
    */
   ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED = 0x08000000,
 
-  /* This flag instructs linker to use this namespace as the anonymous
-   * namespace. There can be only one anonymous namespace in a process. If there
-   * already an anonymous namespace in the process, using this flag when
-   * creating a new namespace causes an error
-   */
-  ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS = 0x10000000,
-
   ANDROID_NAMESPACE_TYPE_SHARED_ISOLATED = ANDROID_NAMESPACE_TYPE_SHARED |
                                            ANDROID_NAMESPACE_TYPE_ISOLATED,
 };
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 85ea8d1..7741904 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -408,10 +408,8 @@
       params.push_back({ "SDK_VER", buf });
     }
 
-    static std::string vndk_ver = Config::get_vndk_version_string('-');
-    params.push_back({ "VNDK_VER", vndk_ver });
-    static std::string vndk_apex_ver = Config::get_vndk_version_string('v');
-    params.push_back({ "VNDK_APEX_VER", vndk_apex_ver });
+    static std::string vndk = Config::get_vndk_version_string('-');
+    params.push_back({ "VNDK_VER", vndk });
 
     for (auto& path : paths) {
       format_string(&path, params);
@@ -419,22 +417,9 @@
 
     if (resolve) {
       std::vector<std::string> resolved_paths;
-      for (const auto& path : paths) {
-        if (path.empty()) {
-          continue;
-        }
-        // this is single threaded. no need to lock
-        auto cached = resolved_paths_.find(path);
-        if (cached == resolved_paths_.end()) {
-          resolved_paths_[path] = resolve_path(path);
-          cached = resolved_paths_.find(path);
-        }
-        CHECK(cached != resolved_paths_.end());
-        if (cached->second.empty()) {
-          continue;
-        }
-        resolved_paths.push_back(cached->second);
-      }
+
+      // do not remove paths that do not exist
+      resolve_paths(paths, &resolved_paths);
 
       return resolved_paths;
     } else {
@@ -457,7 +442,6 @@
     return it;
   }
   std::unordered_map<std::string, PropertyValue> properties_;
-  std::unordered_map<std::string, std::string> resolved_paths_;
   int target_sdk_version_;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(Properties);
diff --git a/linker/linker_debug.h b/linker/linker_debug.h
index 6031850..7a1cb3c 100644
--- a/linker/linker_debug.h
+++ b/linker/linker_debug.h
@@ -44,6 +44,7 @@
 #define DO_TRACE_IFUNC       1
 #define TIMING               0
 #define STATS                0
+#define COUNT_PAGES          0
 
 /*********************************************************************
  * You shouldn't need to modify anything below unless you are adding
@@ -82,3 +83,22 @@
 #endif /* TRACE_DEBUG */
 
 #define TRACE_TYPE(t, x...)   do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
+
+#if COUNT_PAGES
+extern uint32_t bitmask[];
+#if defined(__LP64__)
+#define MARK(offset) \
+    do { \
+      if ((((offset) >> 12) >> 5) < 4096) \
+          bitmask[((offset) >> 12) >> 5] |= (1 << (((offset) >> 12) & 31)); \
+    } while (0)
+#else
+#define MARK(offset) \
+    do { \
+      bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
+    } while (0)
+#endif
+#else
+#define MARK(x) do {} while (0)
+
+#endif
diff --git a/linker/linker_debuggerd.h b/linker/linker_debuggerd.h
deleted file mode 100644
index d701879..0000000
--- a/linker/linker_debuggerd.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-void linker_debuggerd_init();
diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp
deleted file mode 100644
index b8c82f9..0000000
--- a/linker/linker_debuggerd_android.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2019 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 "linker_debuggerd.h"
-
-#include "debuggerd/handler.h"
-#include "private/bionic_globals.h"
-
-#include "linker_gdb_support.h"
-
-void linker_debuggerd_init() {
-  debuggerd_callbacks_t callbacks = {
-    .get_abort_message = []() {
-      return __libc_shared_globals()->abort_msg;
-    },
-    .post_dump = &notify_gdb_of_libraries,
-  };
-  debuggerd_init(&callbacks);
-}
diff --git a/linker/linker_debuggerd_stub.cpp b/linker/linker_debuggerd_stub.cpp
deleted file mode 100644
index 631e6e4..0000000
--- a/linker/linker_debuggerd_stub.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 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 "linker_debuggerd.h"
-
-void linker_debuggerd_init() {
-}
diff --git a/linker/linker_exidx_static.c b/linker/linker_exidx_static.c
new file mode 100644
index 0000000..b38ef17
--- /dev/null
+++ b/linker/linker_exidx_static.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <link.h>
+
+/* Find the .ARM.exidx section (which in the case of a static executable
+ * can be identified through its start and end symbols), and return its
+ * beginning and numbe of entries to the caller.  Note that for static
+ * executables we do not need to use the value of the PC to find the
+ * EXIDX section.
+ */
+
+extern unsigned __exidx_end;
+extern unsigned __exidx_start;
+
+_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
+                                    int* pcount)
+{
+  *pcount = (__exidx_end-__exidx_start)/8;
+  return __exidx_start;
+}
diff --git a/linker/linker_globals.h b/linker/linker_globals.h
index 83cedca..32aa09d 100644
--- a/linker/linker_globals.h
+++ b/linker/linker_globals.h
@@ -53,20 +53,8 @@
 
 #define DL_ERR_AND_LOG(fmt, x...) \
   do { \
-    DL_ERR(fmt, ##x); \
-    PRINT(fmt, ##x); \
-  } while (false)
-
-#define DL_OPEN_ERR(fmt, x...) \
-  do { \
-    DL_ERR(fmt, ##x); \
-    LD_LOG(kLogDlopen, fmt, ##x); \
-  } while (false)
-
-#define DL_SYM_ERR(fmt, x...) \
-  do { \
-    DL_ERR(fmt, ##x); \
-    LD_LOG(kLogDlsym, fmt, ##x); \
+    DL_ERR(fmt, x); \
+    PRINT(fmt, x); \
   } while (false)
 
 constexpr ElfW(Versym) kVersymNotNeeded = 0;
@@ -99,5 +87,3 @@
  private:
   std::string saved_error_msg_;
 };
-
-__LIBC_HIDDEN__ extern bool g_is_ldd;
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 8ba947f..6c762a9 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -32,7 +32,6 @@
 #include <sys/auxv.h>
 
 #include "linker_debug.h"
-#include "linker_debuggerd.h"
 #include "linker_cfi.h"
 #include "linker_gdb_support.h"
 #include "linker_globals.h"
@@ -40,8 +39,6 @@
 #include "linker_tls.h"
 #include "linker_utils.h"
 
-#include "private/bionic_auxv.h"
-#include "private/bionic_call_ifunc_resolver.h"
 #include "private/bionic_globals.h"
 #include "private/bionic_tls.h"
 #include "private/KernelArgumentBlock.h"
@@ -49,6 +46,9 @@
 #include "android-base/unique_fd.h"
 #include "android-base/strings.h"
 #include "android-base/stringprintf.h"
+#ifdef __ANDROID__
+#include "debuggerd/handler.h"
+#endif
 
 #include <async_safe/log.h>
 #include <bionic/libc_init_common.h>
@@ -63,8 +63,6 @@
 static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count,
                                    ElfW(Addr)* base, ElfW(Addr)* load_bias);
 
-static void set_bss_vma_name(soinfo* si);
-
 // These should be preserved static to avoid emitting
 // RELATIVE relocations for the part of the code running
 // before linker links itself.
@@ -119,7 +117,6 @@
   return vdso;
 }
 
-bool g_is_ldd;
 int g_ld_debug_verbosity;
 
 static std::vector<std::string> g_ld_preload_names;
@@ -178,12 +175,11 @@
 }
 
 // Initializes an soinfo's link_map_head field using other fields from the
-// soinfo (phdr, phnum, load_bias). The soinfo's realpath must not change after
-// this function is called.
-static void init_link_map_head(soinfo& info) {
+// soinfo (phdr, phnum, load_bias).
+static void init_link_map_head(soinfo& info, const char* linker_path) {
   auto& map = info.link_map_head;
   map.l_addr = info.load_bias;
-  map.l_name = const_cast<char*>(info.get_realpath());
+  map.l_name = const_cast<char*>(linker_path);
   phdr_table_get_dynamic_section(info.phdr, info.phnum, info.load_bias, &map.l_ld, nullptr);
 }
 
@@ -235,9 +231,9 @@
 }
 
 #if defined(__LP64__)
-static char kFallbackLinkerPath[] = "/system/bin/linker64";
+static char kLinkerPath[] = "/system/bin/linker64";
 #else
-static char kFallbackLinkerPath[] = "/system/bin/linker";
+static char kLinkerPath[] = "/system/bin/linker";
 #endif
 
 __printflike(1, 2)
@@ -311,7 +307,15 @@
   __system_properties_init(); // may use 'environ'
 
   // Register the debuggerd signal handler.
-  linker_debuggerd_init();
+#ifdef __ANDROID__
+  debuggerd_callbacks_t callbacks = {
+    .get_abort_message = []() {
+      return __libc_shared_globals()->abort_msg;
+    },
+    .post_dump = &notify_gdb_of_libraries,
+  };
+  debuggerd_init(&callbacks);
+#endif
 
   g_linker_logger.ResetState();
 
@@ -345,11 +349,15 @@
   const ExecutableInfo exe_info = exe_to_load ? load_executable(exe_to_load) :
                                                 get_executable_info();
 
-  INFO("[ Linking executable \"%s\" ]", exe_info.path.c_str());
+  // Assign to a static variable for the sake of the debug map, which needs
+  // a C-style string to last until the program exits.
+  static std::string exe_path = exe_info.path;
+
+  INFO("[ Linking executable \"%s\" ]", exe_path.c_str());
 
   // Initialize the main exe's soinfo.
   soinfo* si = soinfo_alloc(&g_default_namespace,
-                            exe_info.path.c_str(), &exe_info.file_stat,
+                            exe_path.c_str(), &exe_info.file_stat,
                             0, RTLD_GLOBAL);
   somain = si;
   si->phdr = exe_info.phdr;
@@ -358,27 +366,7 @@
   si->size = phdr_table_get_load_size(si->phdr, si->phnum);
   si->dynamic = nullptr;
   si->set_main_executable();
-  init_link_map_head(*si);
-
-  set_bss_vma_name(si);
-
-  // Use the executable's PT_INTERP string as the solinker filename in the
-  // dynamic linker's module list. gdb reads both PT_INTERP and the module list,
-  // and if the paths for the linker are different, gdb will report that the
-  // PT_INTERP linker path was unloaded once the module list is initialized.
-  // There are three situations to handle:
-  //  - the APEX linker (/system/bin/linker[64] -> /apex/.../linker[64])
-  //  - the ASAN linker (/system/bin/linker_asan[64] -> /apex/.../linker[64])
-  //  - the bootstrap linker (/system/bin/bootstrap/linker[64])
-  const char *interp = phdr_table_get_interpreter_name(somain->phdr, somain->phnum,
-                                                       somain->load_bias);
-  if (interp == nullptr) {
-    // This case can happen if the linker attempts to execute itself
-    // (e.g. "linker64 /system/bin/linker64").
-    interp = kFallbackLinkerPath;
-  }
-  solinker->set_realpath(interp);
-  init_link_map_head(*solinker);
+  init_link_map_head(*si, exe_path.c_str());
 
   // Register the main executable and the linker upfront to have
   // gdb aware of them before loading the rest of the dependency
@@ -409,14 +397,14 @@
                          "\"%s\": error: Android 5.0 and later only support "
                          "position-independent executables (-fPIE).\n",
                          g_argv[0]);
-    _exit(EXIT_FAILURE);
+    exit(EXIT_FAILURE);
   }
 
   // Use LD_LIBRARY_PATH and LD_PRELOAD (but only if we aren't setuid/setgid).
   parse_LD_LIBRARY_PATH(ldpath_env);
   parse_LD_PRELOAD(ldpreload_env);
 
-  std::vector<android_namespace_t*> namespaces = init_default_namespaces(exe_info.path.c_str());
+  std::vector<android_namespace_t*> namespaces = init_default_namespaces(exe_path.c_str());
 
   if (!si->prelink_image()) __linker_cannot_link(g_argv[0]);
 
@@ -479,16 +467,42 @@
 
 #if TIMING
   gettimeofday(&t1, nullptr);
-  PRINT("LINKER TIME: %s: %d microseconds", g_argv[0],
-        static_cast<int>(((static_cast<long long>(t1.tv_sec) * 1000000LL) +
-                          static_cast<long long>(t1.tv_usec)) -
-                         ((static_cast<long long>(t0.tv_sec) * 1000000LL) +
-                          static_cast<long long>(t0.tv_usec))));
+  PRINT("LINKER TIME: %s: %d microseconds", g_argv[0], (int) (
+           (((long long)t1.tv_sec * 1000000LL) + (long long)t1.tv_usec) -
+           (((long long)t0.tv_sec * 1000000LL) + (long long)t0.tv_usec)));
 #endif
 #if STATS
-  print_linker_stats();
+  PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol", g_argv[0],
+         linker_stats.count[kRelocAbsolute],
+         linker_stats.count[kRelocRelative],
+         linker_stats.count[kRelocCopy],
+         linker_stats.count[kRelocSymbol]);
 #endif
-#if TIMING || STATS
+#if COUNT_PAGES
+  {
+    unsigned n;
+    unsigned i;
+    unsigned count = 0;
+    for (n = 0; n < 4096; n++) {
+      if (bitmask[n]) {
+        unsigned x = bitmask[n];
+#if defined(__LP64__)
+        for (i = 0; i < 32; i++) {
+#else
+        for (i = 0; i < 8; i++) {
+#endif
+          if (x & 1) {
+            count++;
+          }
+          x >>= 1;
+        }
+      }
+    }
+    PRINT("PAGES MODIFIED: %s: %d (%dKB)", g_argv[0], count, count * 4);
+  }
+#endif
+
+#if TIMING || STATS || COUNT_PAGES
   fflush(stdout);
 #endif
 
@@ -542,64 +556,6 @@
   async_safe_fatal("Could not find a PHDR: broken executable?");
 }
 
-/*
- * Set anonymous VMA name for .bss section.  For DSOs loaded by the linker, this
- * is done by ElfReader.  This function is here for DSOs loaded by the kernel,
- * namely the linker itself and the main executable.
- */
-static void set_bss_vma_name(soinfo* si) {
-  for (size_t i = 0; i < si->phnum; ++i) {
-    auto phdr = &si->phdr[i];
-
-    if (phdr->p_type != PT_LOAD) {
-      continue;
-    }
-
-    ElfW(Addr) seg_start = phdr->p_vaddr + si->load_bias;
-    ElfW(Addr) seg_page_end = PAGE_END(seg_start + phdr->p_memsz);
-    ElfW(Addr) seg_file_end = PAGE_END(seg_start + phdr->p_filesz);
-
-    if (seg_page_end > seg_file_end) {
-      prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME,
-            reinterpret_cast<void*>(seg_file_end), seg_page_end - seg_file_end,
-            ".bss");
-    }
-  }
-}
-
-// TODO: There is a similar ifunc resolver calling loop in libc_init_static.cpp, but that version
-// uses weak symbols, which don't work in the linker prior to its relocation. This version also
-// supports a load bias. When we stop supporting the gold linker in the NDK, then maybe we can use
-// non-weak definitions and merge the two loops.
-#if defined(USE_RELA)
-extern __LIBC_HIDDEN__ ElfW(Rela) __rela_iplt_start[], __rela_iplt_end[];
-
-static void call_ifunc_resolvers(ElfW(Addr) load_bias) {
-  for (ElfW(Rela) *r = __rela_iplt_start; r != __rela_iplt_end; ++r) {
-    ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset + load_bias);
-    ElfW(Addr) resolver = r->r_addend + load_bias;
-    *offset = __bionic_call_ifunc_resolver(resolver);
-  }
-}
-#else
-extern __LIBC_HIDDEN__ ElfW(Rel) __rel_iplt_start[], __rel_iplt_end[];
-
-static void call_ifunc_resolvers(ElfW(Addr) load_bias) {
-  for (ElfW(Rel) *r = __rel_iplt_start; r != __rel_iplt_end; ++r) {
-    ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset + load_bias);
-    ElfW(Addr) resolver = *offset + load_bias;
-    *offset = __bionic_call_ifunc_resolver(resolver);
-  }
-}
-#endif
-
-// Usable before ifunc resolvers have been called. This function is compiled with -ffreestanding.
-static void linker_memclr(void* dst, size_t cnt) {
-  for (size_t i = 0; i < cnt; ++i) {
-    reinterpret_cast<char*>(dst)[i] = '\0';
-  }
-}
-
 // Detect an attempt to run the linker on itself. e.g.:
 //   /system/bin/linker64 /system/bin/linker64
 // Use priority-1 to run this constructor before other constructors.
@@ -633,8 +589,7 @@
 extern "C" ElfW(Addr) __linker_init(void* raw_args) {
   // Initialize TLS early so system calls and errno work.
   KernelArgumentBlock args(raw_args);
-  bionic_tcb temp_tcb __attribute__((uninitialized));
-  linker_memclr(&temp_tcb, sizeof(temp_tcb));
+  bionic_tcb temp_tcb = {};
   __libc_init_main_thread_early(args, &temp_tcb);
 
   // When the linker is run by itself (rather than as an interpreter for
@@ -652,15 +607,11 @@
   ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
   ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_addr + elf_hdr->e_phoff);
 
-  // string.h functions must not be used prior to calling the linker's ifunc resolvers.
-  const ElfW(Addr) load_bias = get_elf_exec_load_bias(elf_hdr);
-  call_ifunc_resolvers(load_bias);
-
   soinfo tmp_linker_so(nullptr, nullptr, nullptr, 0, 0);
 
   tmp_linker_so.base = linker_addr;
   tmp_linker_so.size = phdr_table_get_load_size(phdr, elf_hdr->e_phnum);
-  tmp_linker_so.load_bias = load_bias;
+  tmp_linker_so.load_bias = get_elf_exec_load_bias(elf_hdr);
   tmp_linker_so.dynamic = nullptr;
   tmp_linker_so.phdr = phdr;
   tmp_linker_so.phnum = elf_hdr->e_phnum;
@@ -695,9 +646,6 @@
   // couldn't make system calls on x86 at that point, but we can now...
   if (!tmp_linker_so.protect_relro()) __linker_cannot_link(args.argv[0]);
 
-  // And we can set VMA name for the bss section now
-  set_bss_vma_name(&tmp_linker_so);
-
   // Initialize the linker's static libc's globals
   __libc_init_globals();
 
@@ -710,29 +658,22 @@
   // linker's _start.
   const char* exe_to_load = nullptr;
   if (getauxval(AT_ENTRY) == reinterpret_cast<uintptr_t>(&_start)) {
-    if (args.argc == 3 && !strcmp(args.argv[1], "--list")) {
-      // We're being asked to behave like ldd(1).
-      g_is_ldd = true;
-      exe_to_load = args.argv[2];
-    } else if (args.argc <= 1 || !strcmp(args.argv[1], "--help")) {
+    if (args.argc <= 1 || !strcmp(args.argv[1], "--help")) {
       async_safe_format_fd(STDOUT_FILENO,
-         "Usage: %s [--list] PROGRAM [ARGS-FOR-PROGRAM...]\n"
-         "       %s [--list] path.zip!/PROGRAM [ARGS-FOR-PROGRAM...]\n"
+         "Usage: %s program [arguments...]\n"
+         "       %s path.zip!/program [arguments...]\n"
          "\n"
          "A helper program for linking dynamic executables. Typically, the kernel loads\n"
          "this program because it's the PT_INTERP of a dynamic executable.\n"
          "\n"
          "This program can also be run directly to load and run a dynamic executable. The\n"
          "executable can be inside a zip file if it's stored uncompressed and at a\n"
-         "page-aligned offset.\n"
-         "\n"
-         "The --list option gives behavior equivalent to ldd(1) on other systems.\n",
+         "page-aligned offset.\n",
          args.argv[0], args.argv[0]);
-      _exit(EXIT_SUCCESS);
-    } else {
-      exe_to_load = args.argv[1];
-      __libc_shared_globals()->initial_linker_arg_count = 1;
+      exit(0);
     }
+    exe_to_load = args.argv[1];
+    __libc_shared_globals()->initial_linker_arg_count = 1;
   }
 
   // store argc/argv/envp to use them for calling constructors
@@ -744,13 +685,12 @@
   // Initialize static variables. Note that in order to
   // get correct libdl_info we need to call constructors
   // before get_libdl_info().
-  sonext = solist = solinker = get_libdl_info(tmp_linker_so);
+  sonext = solist = solinker = get_libdl_info(kLinkerPath, tmp_linker_so);
   g_default_namespace.add_soinfo(solinker);
+  init_link_map_head(*solinker, kLinkerPath);
 
   ElfW(Addr) start_address = linker_main(args, exe_to_load);
 
-  if (g_is_ldd) _exit(EXIT_SUCCESS);
-
   INFO("[ Jumping to _start (%p)... ]", reinterpret_cast<void*>(start_address));
 
   // Return the address that the calling assembly stub should jump to.
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index 9561bb4..f4428eb 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -72,12 +72,9 @@
 
 struct android_namespace_t {
  public:
-  android_namespace_t() :
-    is_isolated_(false),
-    is_greylist_enabled_(false),
-    is_also_used_as_anonymous_(false) {}
+  android_namespace_t() : name_(nullptr), is_isolated_(false), is_greylist_enabled_(false) {}
 
-  const char* get_name() const { return name_.c_str(); }
+  const char* get_name() const { return name_; }
   void set_name(const char* name) { name_ = name; }
 
   bool is_isolated() const { return is_isolated_; }
@@ -86,9 +83,6 @@
   bool is_greylist_enabled() const { return is_greylist_enabled_; }
   void set_greylist_enabled(bool enabled) { is_greylist_enabled_ = enabled; }
 
-  bool is_also_used_as_anonymous() const { return is_also_used_as_anonymous_; }
-  void set_also_used_as_anonymous(bool yes) { is_also_used_as_anonymous_ = yes; }
-
   const std::vector<std::string>& get_ld_library_paths() const {
     return ld_library_paths_;
   }
@@ -167,10 +161,9 @@
   soinfo_list_t get_shared_group();
 
  private:
-  std::string name_;
+  const char* name_;
   bool is_isolated_;
   bool is_greylist_enabled_;
-  bool is_also_used_as_anonymous_;
   std::vector<std::string> ld_library_paths_;
   std::vector<std::string> default_library_paths_;
   std::vector<std::string> permitted_paths_;
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
index 93d899e..68191f9 100644
--- a/linker/linker_relocs.h
+++ b/linker/linker_relocs.h
@@ -35,26 +35,20 @@
 #if defined (__aarch64__)
 
 #define R_GENERIC_JUMP_SLOT     R_AARCH64_JUMP_SLOT
-// R_AARCH64_ABS64 is classified as a static relocation but it is common in DSOs.
-#define R_GENERIC_ABSOLUTE      R_AARCH64_ABS64
 #define R_GENERIC_GLOB_DAT      R_AARCH64_GLOB_DAT
 #define R_GENERIC_RELATIVE      R_AARCH64_RELATIVE
 #define R_GENERIC_IRELATIVE     R_AARCH64_IRELATIVE
-#define R_GENERIC_COPY          R_AARCH64_COPY
-#define R_GENERIC_TLS_DTPMOD    R_AARCH64_TLS_DTPMOD
-#define R_GENERIC_TLS_DTPREL    R_AARCH64_TLS_DTPREL
-#define R_GENERIC_TLS_TPREL     R_AARCH64_TLS_TPREL
+#define R_GENERIC_TLS_DTPMOD    R_AARCH64_TLS_DTPMOD64
+#define R_GENERIC_TLS_DTPREL    R_AARCH64_TLS_DTPREL64
+#define R_GENERIC_TLS_TPREL     R_AARCH64_TLS_TPREL64
 #define R_GENERIC_TLSDESC       R_AARCH64_TLSDESC
 
 #elif defined (__arm__)
 
 #define R_GENERIC_JUMP_SLOT     R_ARM_JUMP_SLOT
-// R_ARM_ABS32 is classified as a static relocation but it is common in DSOs.
-#define R_GENERIC_ABSOLUTE      R_ARM_ABS32
 #define R_GENERIC_GLOB_DAT      R_ARM_GLOB_DAT
 #define R_GENERIC_RELATIVE      R_ARM_RELATIVE
 #define R_GENERIC_IRELATIVE     R_ARM_IRELATIVE
-#define R_GENERIC_COPY          R_ARM_COPY
 #define R_GENERIC_TLS_DTPMOD    R_ARM_TLS_DTPMOD32
 #define R_GENERIC_TLS_DTPREL    R_ARM_TLS_DTPOFF32
 #define R_GENERIC_TLS_TPREL     R_ARM_TLS_TPOFF32
@@ -63,11 +57,9 @@
 #elif defined (__i386__)
 
 #define R_GENERIC_JUMP_SLOT     R_386_JMP_SLOT
-#define R_GENERIC_ABSOLUTE      R_386_32
 #define R_GENERIC_GLOB_DAT      R_386_GLOB_DAT
 #define R_GENERIC_RELATIVE      R_386_RELATIVE
 #define R_GENERIC_IRELATIVE     R_386_IRELATIVE
-#define R_GENERIC_COPY          R_386_COPY
 #define R_GENERIC_TLS_DTPMOD    R_386_TLS_DTPMOD32
 #define R_GENERIC_TLS_DTPREL    R_386_TLS_DTPOFF32
 #define R_GENERIC_TLS_TPREL     R_386_TLS_TPOFF
@@ -76,11 +68,9 @@
 #elif defined (__x86_64__)
 
 #define R_GENERIC_JUMP_SLOT     R_X86_64_JUMP_SLOT
-#define R_GENERIC_ABSOLUTE      R_X86_64_64
 #define R_GENERIC_GLOB_DAT      R_X86_64_GLOB_DAT
 #define R_GENERIC_RELATIVE      R_X86_64_RELATIVE
 #define R_GENERIC_IRELATIVE     R_X86_64_IRELATIVE
-#define R_GENERIC_COPY          R_X86_64_COPY
 #define R_GENERIC_TLS_DTPMOD    R_X86_64_DTPMOD64
 #define R_GENERIC_TLS_DTPREL    R_X86_64_DTPOFF64
 #define R_GENERIC_TLS_TPREL     R_X86_64_TPOFF64
diff --git a/linker/linker_sdk_versions.cpp b/linker/linker_sdk_versions.cpp
index 29c0f4a..b06f3e6 100644
--- a/linker/linker_sdk_versions.cpp
+++ b/linker/linker_sdk_versions.cpp
@@ -26,12 +26,9 @@
  * SUCH DAMAGE.
  */
 
-#include <atomic>
-
-#include <android/api-level.h>
-#include <android/fdsan.h>
-
 #include "linker.h"
+#include <android/api-level.h>
+#include <atomic>
 
 static std::atomic<int> g_target_sdk_version(__ANDROID_API__);
 
@@ -41,10 +38,6 @@
     target = __ANDROID_API__;
   }
   g_target_sdk_version = target;
-
-  if (target < 30) {
-    android_fdsan_set_error_level_from_property(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE);
-  }
 }
 
 int get_application_target_sdk_version() {
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index 14293d9..31ee74c 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -391,15 +391,13 @@
 }
 
 void soinfo::call_pre_init_constructors() {
-  if (g_is_ldd) return;
-
   // DT_PREINIT_ARRAY functions are called before any other constructors for executables,
   // but ignored in a shared library.
   call_array("DT_PREINIT_ARRAY", preinit_array_, preinit_array_count_, false, get_realpath());
 }
 
 void soinfo::call_constructors() {
-  if (constructors_called || g_is_ldd) {
+  if (constructors_called) {
     return;
   }
 
@@ -550,16 +548,6 @@
   rtld_flags_ |= RTLD_NODELETE;
 }
 
-void soinfo::set_realpath(const char* path) {
-#if defined(__work_around_b_24465209__)
-  if (has_min_version(2)) {
-    realpath_ = path;
-  }
-#else
-  realpath_ = path;
-#endif
-}
-
 const char* soinfo::get_realpath() const {
 #if defined(__work_around_b_24465209__)
   if (has_min_version(2)) {
@@ -651,6 +639,10 @@
   return secondary_namespaces_;
 }
 
+soinfo_tls* soinfo::get_tls() const {
+  return has_min_version(5) ? tls_.get() : nullptr;
+}
+
 ElfW(Addr) soinfo::resolve_symbol_address(const ElfW(Sym)* s) const {
   if (ELF_ST_TYPE(s->st_info) == STT_GNU_IFUNC) {
     return call_ifunc_resolver(s->st_value + load_bias);
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index dd3817c..80c51af 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -278,7 +278,6 @@
 
   void set_soname(const char* soname);
   const char* get_soname() const;
-  void set_realpath(const char* path);
   const char* get_realpath() const;
   const ElfW(Versym)* get_versym(size_t n) const;
   ElfW(Addr) get_verneed_ptr() const;
@@ -294,9 +293,7 @@
   void add_secondary_namespace(android_namespace_t* secondary_ns);
   android_namespace_list_t& get_secondary_namespaces();
 
-  soinfo_tls* get_tls() const {
-    return has_min_version(5) ? tls_.get() : nullptr;
-  }
+  soinfo_tls* get_tls() const;
 
   void set_mapped_by_caller(bool reserved_map);
   bool is_mapped_by_caller() const;
@@ -375,7 +372,7 @@
   android_namespace_list_t secondary_namespaces_;
   uintptr_t handle_;
 
-  friend soinfo* get_libdl_info(const soinfo& linker_si);
+  friend soinfo* get_libdl_info(const char* linker_path, const soinfo& linker_si);
 
   // version >= 4
   ElfW(Relr)* relr_;
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index 29110ed..e926671 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -204,54 +204,47 @@
     if (path.empty()) {
       continue;
     }
-    std::string resolved = resolve_path(path);
-    if (!resolved.empty()) {
-      resolved_paths->push_back(std::move(resolved));
-    }
-  }
-}
 
-std::string resolve_path(const std::string& path) {
-  char resolved_path[PATH_MAX];
-  const char* original_path = path.c_str();
-  if (realpath(original_path, resolved_path) != nullptr) {
-    struct stat s;
-    if (stat(resolved_path, &s) == -1) {
-      DL_WARN("Warning: cannot stat file \"%s\": %s (ignoring)", resolved_path, strerror(errno));
-      return "";
-    }
-    if (!S_ISDIR(s.st_mode)) {
-      DL_WARN("Warning: \"%s\" is not a directory (ignoring)", resolved_path);
-      return "";
-    }
-    return resolved_path;
-  } else {
-    std::string normalized_path;
-    if (!normalize_path(original_path, &normalized_path)) {
-      DL_WARN("Warning: unable to normalize \"%s\" (ignoring)", original_path);
-      return "";
-    }
-
-    std::string zip_path;
-    std::string entry_path;
-    if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) {
-      if (realpath(zip_path.c_str(), resolved_path) == nullptr) {
-        DL_WARN("Warning: unable to resolve \"%s\": %s (ignoring)",
-                zip_path.c_str(), strerror(errno));
-        return "";
-      }
-
-      return std::string(resolved_path) + kZipFileSeparator + entry_path;
-    } else {
+    char resolved_path[PATH_MAX];
+    const char* original_path = path.c_str();
+    if (realpath(original_path, resolved_path) != nullptr) {
       struct stat s;
-      if (stat(normalized_path.c_str(), &s) == 0 && S_ISDIR(s.st_mode)) {
-        // Path is not a zip path, but an existing directory. Then add it
-        // although we failed to resolve it. b/119656753
-        return normalized_path;
+      if (stat(resolved_path, &s) == -1) {
+        DL_WARN("Warning: cannot stat file \"%s\": %s (ignoring)", resolved_path, strerror(errno));
+        continue;
+      }
+      if (!S_ISDIR(s.st_mode)) {
+        DL_WARN("Warning: \"%s\" is not a directory (ignoring)", resolved_path);
+        continue;
+      }
+      resolved_paths->push_back(resolved_path);
+    } else {
+      std::string normalized_path;
+      if (!normalize_path(original_path, &normalized_path)) {
+        DL_WARN("Warning: unable to normalize \"%s\" (ignoring)", original_path);
+        continue;
+      }
+
+      std::string zip_path;
+      std::string entry_path;
+      if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) {
+        if (realpath(zip_path.c_str(), resolved_path) == nullptr) {
+          DL_WARN("Warning: unable to resolve \"%s\": %s (ignoring)",
+                  zip_path.c_str(), strerror(errno));
+          continue;
+        }
+
+        resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path);
+      } else {
+        struct stat s;
+        if (stat(normalized_path.c_str(), &s) == 0 && S_ISDIR(s.st_mode)) {
+          // Path is not a zip path, but an existing directory. Then add it
+          // although we failed to resolve it. b/119656753
+          resolved_paths->push_back(normalized_path);
+        }
       }
     }
   }
-  return "";
 }
 
 bool is_first_stage_init() {
diff --git a/linker/linker_utils.h b/linker/linker_utils.h
index 5073b10..34a597b 100644
--- a/linker/linker_utils.h
+++ b/linker/linker_utils.h
@@ -47,9 +47,6 @@
 //    normalizes entry name by calling normalize_path function.
 void resolve_paths(std::vector<std::string>& paths,
                    std::vector<std::string>* resolved_paths);
-// Resolve a single path. Return empty string when the path is invalid or can't
-// be resolved.
-std::string resolve_path(const std::string& path);
 
 void split_path(const char* path, const char* delimiters, std::vector<std::string>* paths);
 
diff --git a/tests/Android.bp b/tests/Android.bp
index 1755053..3d5feb2 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -190,7 +190,6 @@
         "system_properties_test2.cpp",
         "termios_test.cpp",
         "tgmath_test.c",
-        "threads_test.cpp",
         "time_test.cpp",
         "uchar_test.cpp",
         "unistd_nofortify_test.cpp",
@@ -241,15 +240,6 @@
     cflags: [
         "-fno-emulated-tls",
     ],
-    // With fuzzer builds, compiler instrumentation generates a reference to the
-    // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
-    // library as an emutls symbol. The -fno-emulated-tls flag above configures
-    // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
-    // symbol instead, which isn't defined. Disable the fuzzer for this test
-    // until the platform is switched to ELF TLS.
-    sanitize: {
-        fuzzer: false,
-    },
 }
 
 cc_test_library {
@@ -271,15 +261,6 @@
     cflags: [
         "-fno-emulated-tls",
     ],
-    // With fuzzer builds, compiler instrumentation generates a reference to the
-    // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
-    // library as an emutls symbol. The -fno-emulated-tls flag above configures
-    // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
-    // symbol instead, which isn't defined. Disable the fuzzer for this test
-    // until the platform is switched to ELF TLS.
-    sanitize: {
-        fuzzer: false,
-    },
 }
 
 // -----------------------------------------------------------------------------
@@ -287,19 +268,6 @@
 // -----------------------------------------------------------------------------
 
 cc_defaults {
-    name: "bionic_clang_fortify_tests_w_flags",
-    cflags: [
-        "-Wno-builtin-memcpy-chk-size",
-        "-Wno-format-security",
-        "-Wno-format-zero-length",
-        "-Wno-fortify-source",
-        "-Wno-memset-transposed-args",
-        "-Wno-strlcpy-strlcat-size",
-        "-Wno-strncat-size",
-    ],
-}
-
-cc_defaults {
     name: "bionic_fortify_tests_defaults",
     cflags: [
         "-U_FORTIFY_SOURCE",
@@ -318,9 +286,6 @@
 // unused.
 cc_test_library {
     name: "fortify_disabled_for_asan",
-    defaults: [
-        "bionic_clang_fortify_tests_w_flags",
-    ],
     cflags: [
         "-Werror",
         "-D_FORTIFY_SOURCE=2",
@@ -331,7 +296,7 @@
     ],
     // Ignore that we don't have ASAN symbols linked in.
     allow_undefined_symbols: true,
-    srcs: ["clang_fortify_tests.cpp"],
+    srcs: ["fortify_filecheck_diagnostics_test.cpp"],
 }
 
 // Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
@@ -340,15 +305,12 @@
 // enabled. The library that results from building this is meant to be unused.
 cc_test_library {
     name: "fortify_disabled_for_tidy",
-    defaults: [
-        "bionic_clang_fortify_tests_w_flags",
-    ],
     cflags: [
         "-Werror",
         "-D_FORTIFY_SOURCE=2",
         "-D__clang_analyzer__",
     ],
-    srcs: ["clang_fortify_tests.cpp"],
+    srcs: ["fortify_filecheck_diagnostics_test.cpp"],
 }
 
 cc_test_library {
@@ -381,53 +343,6 @@
     },
 }
 
-cc_defaults {
-    name: "bionic_new_fortify_tests_defaults",
-    defaults: [
-        "bionic_clang_fortify_tests_w_flags",
-    ],
-    cflags: [
-        "-U_FORTIFY_SOURCE",
-    ],
-    srcs: ["clang_fortify_tests.cpp"],
-    target: {
-        host: {
-            clang_cflags: ["-D__clang__"],
-        },
-    },
-}
-
-cc_test_library {
-    name: "libfortify1-new-tests-clang",
-    defaults: [
-        "bionic_new_fortify_tests_defaults",
-        "bionic_tests_defaults",
-    ],
-    cflags: [
-        "-D_FORTIFY_SOURCE=1",
-        "-DTEST_NAME=Fortify1_clang_new",
-    ],
-    shared: {
-        enabled: false,
-    },
-}
-
-cc_test_library {
-    name: "libfortify2-new-tests-clang",
-    defaults: [
-        "bionic_new_fortify_tests_defaults",
-        "bionic_tests_defaults",
-    ],
-    cflags: [
-        "-D_FORTIFY_SOURCE=2",
-        "-DTEST_NAME=Fortify2_clang_new",
-    ],
-    shared: {
-        enabled: false,
-    },
-}
-
-
 // -----------------------------------------------------------------------------
 // Library of all tests (excluding the dynamic linker tests).
 // -----------------------------------------------------------------------------
@@ -438,9 +353,7 @@
         "libBionicStandardTests",
         "libBionicElfTlsTests",
         "libfortify1-tests-clang",
-        "libfortify1-new-tests-clang",
         "libfortify2-tests-clang",
-        "libfortify2-new-tests-clang",
     ],
     shared: {
         enabled: false,
@@ -561,6 +474,7 @@
         android: {
             shared_libs: [
                 "ld-android",
+                "libandroidicu",
                 "libdl",
                 "libdl_android",
                 "libdl_preempt_test_1",
@@ -751,33 +665,6 @@
     ],
 }
 
-cc_test {
-    name: "bionic-stress-tests",
-    defaults: [
-        "bionic_tests_defaults",
-    ],
-
-    // For now, these tests run forever, so do not use the isolation framework.
-    isolated: false,
-
-    srcs: [
-        "malloc_stress_test.cpp",
-    ],
-
-    shared_libs: [
-        "libbase",
-    ],
-
-    target: {
-        android: {
-            static_libs: [
-                "libmeminfo",
-                "libprocinfo",
-            ],
-        },
-    },
-}
-
 // -----------------------------------------------------------------------------
 // Tests for the device linked against bionic's static library. Run with:
 //   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
diff --git a/tests/Android.mk b/tests/Android.mk
index b5571e3..fc7b940 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -59,11 +59,26 @@
 # Compile time tests.
 # -----------------------------------------------------------------------------
 
-FORTIFY_LEVEL := 1
-include $(LOCAL_PATH)/make_fortify_compile_test.mk
+# Some of these are intentionally using = instead of := since we need access to
+# some variables not initialtized until we're in the build system.
 
-FORTIFY_LEVEL := 2
-include $(LOCAL_PATH)/make_fortify_compile_test.mk
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := \
+    $(LOCAL_PATH)/Android.mk \
+    $(LOCAL_PATH)/file-check-cxx \
+    | $(HOST_OUT_EXECUTABLES)/FileCheck$(HOST_EXECUTABLE_SUFFIX) \
+
+LOCAL_CXX := $(LOCAL_PATH)/file-check-cxx \
+    $(HOST_OUT_EXECUTABLES)/FileCheck \
+    $(LLVM_PREBUILTS_PATH)/clang++ \
+    CLANG \
+
+LOCAL_CLANG := true
+LOCAL_MODULE := bionic-compile-time-tests-clang++
+LOCAL_CPPFLAGS := -Wall -Werror
+LOCAL_CPPFLAGS += -fno-color-diagnostics -ferror-limit=10000
+LOCAL_SRC_FILES := fortify_filecheck_diagnostics_test.cpp
+include $(BUILD_STATIC_LIBRARY)
 
 endif # linux-x86
 
diff --git a/tests/__aeabi_read_tp_test.cpp b/tests/__aeabi_read_tp_test.cpp
index f318c0f..7209a75 100644
--- a/tests/__aeabi_read_tp_test.cpp
+++ b/tests/__aeabi_read_tp_test.cpp
@@ -28,7 +28,7 @@
 
 #include <gtest/gtest.h>
 
-#include "platform/bionic/tls.h"
+#include "private/__get_tls.h"
 
 #if defined(__arm__)
 extern "C" void* __aeabi_read_tp();
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
deleted file mode 100644
index 018880f..0000000
--- a/tests/clang_fortify_tests.cpp
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __clang__
-#error "Non-clang isn't supported"
-#endif
-
-// Clang compile-time and run-time tests for Bionic's FORTIFY.
-//
-// This file is compiled in two configurations ways to give us a sane set of tests for clang's
-// FORTIFY implementation.
-//
-// One configuration uses clang's diagnostic consumer
-// (https://clang.llvm.org/doxygen/classclang_1_1VerifyDiagnosticConsumer.html#details)
-// to check diagnostics (e.g. the expected-* comments everywhere).
-//
-// Please note that this test does things like leaking memory. That's WAI.
-
-// Silence all "from 'diagnose_if'" `note`s from anywhere, including headers; they're uninteresting
-// for this test case, and their line numbers may change over time.
-// expected-note@* 0+{{from 'diagnose_if'}}
-//
-// Similarly, there are a few overload tricks we have to emit errors. Ignore any notes from those.
-// expected-note@* 0+{{candidate function}}
-//
-// And finally, all explicitly-unavailable-here complaints from headers are
-// uninteresting
-// expected-note@* 0+{{has been explicitly marked unavailable here}}
-
-// Note that some of these diags come from clang itself, while others come from
-// `diagnose_if`s sprinkled throughout Bionic.
-
-#ifndef _FORTIFY_SOURCE
-#error "_FORTIFY_SOURCE must be defined"
-#endif
-
-#include <sys/cdefs.h>
-
-// This is a test specifically of bionic's FORTIFY machinery. Other stdlibs need not apply.
-#ifndef __BIONIC__
-// expected-no-diagnostics
-#else
-
-// As alluded to above, we're going to be doing some obviously very broken things in this file.
-// FORTIFY helpfully flags a lot of it at compile-time, but we want it to *actually* crash, too. So
-// let's wipe out any build-time errors.
-#ifndef COMPILATION_TESTS
-#undef __clang_error_if
-#define __clang_error_if(...)
-#undef __clang_warning_if
-#define __clang_warning_if(...)
-#pragma clang diagnostic ignored "-Wfortify-source"
-
-// SOMETIMES_CONST allows clang to emit eager diagnostics when we're doing compilation tests, but
-// blocks them otherwise. This is needed for diagnostics emitted with __enable_if.
-#define SOMETIMES_CONST volatile
-#else
-#define SOMETIMES_CONST const
-#endif
-
-#include <err.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <wchar.h>
-
-#ifndef COMPILATION_TESTS
-#include <gtest/gtest.h>
-#include "BionicDeathTest.h"
-
-#define CONCAT2(x, y) x##y
-#define CONCAT(x, y) CONCAT2(x, y)
-#define FORTIFY_TEST_NAME CONCAT(clang_fortify_test_, _FORTIFY_SOURCE)
-
-namespace {
-struct FORTIFY_TEST_NAME : BionicDeathTest {
- protected:
-  void SetUp() override {
-    stdin_saved = dup(STDIN_FILENO);
-    if (stdin_saved < 0) err(1, "failed to dup stdin");
-
-    int devnull = open("/dev/null", O_RDONLY);
-    if (devnull < 0) err(1, "failed to open /dev/null");
-
-    if (!dup2(devnull, STDIN_FILENO)) err(1, "failed to overwrite stdin");
-    static_cast<void>(close(devnull));
-
-    BionicDeathTest::SetUp();
-  }
-
-  void TearDown() override {
-    if (stdin_saved == -1) return;
-    if (!dup2(stdin_saved, STDIN_FILENO)) warn("failed to restore stdin");
-
-    static_cast<void>(close(stdin_saved));
-
-    BionicDeathTest::TearDown();
-  }
-
- private:
-  int stdin_saved = -1;
-};
-}  // namespace
-
-template <typename Fn>
-__attribute__((noreturn)) static void ExitAfter(Fn&& f) {
-  f();
-  // No need to tear things down; our parent process should handle that.
-  _exit(0);
-}
-
-// In any case (including failing tests), we always want to die after this.
-#define DIE_WITH(expr, cond, regex) EXPECT_EXIT(ExitAfter([&] { (expr); }), cond, regex)
-
-// EXPECT_NO_DEATH forks so that the test remains alive on a bug, and so that the environment
-// doesn't get modified on no bug. (Environment modification is especially tricky to deal with given
-// the *_STRUCT variants below.)
-#define EXPECT_NO_DEATH(expr) DIE_WITH(expr, testing::ExitedWithCode(0), "")
-#define EXPECT_FORTIFY_DEATH(expr) DIE_WITH(expr, testing::KilledBySignal(SIGABRT), "FORTIFY")
-// Expecting death, but only if we're doing a "strict" struct-checking mode.
-#if _FORTIFY_SOURCE > 1
-#define EXPECT_FORTIFY_DEATH_STRUCT EXPECT_FORTIFY_DEATH
-#else
-#define EXPECT_FORTIFY_DEATH_STRUCT EXPECT_NO_DEATH
-#endif
-
-#define FORTIFY_TEST(test_name) TEST(FORTIFY_TEST_NAME, test_name)
-
-#else  // defined(COMPILATION_TESTS)
-
-#define EXPECT_NO_DEATH(expr) expr
-#define EXPECT_FORTIFY_DEATH(expr) expr
-#define EXPECT_FORTIFY_DEATH_STRUCT EXPECT_FORTIFY_DEATH
-#define FORTIFY_TEST(test_name) void test_name()
-#endif
-
-const static int kBogusFD = -1;
-
-FORTIFY_TEST(string) {
-  char small_buffer[8] = {};
-
-  {
-    char large_buffer[sizeof(small_buffer) + 1] = {};
-    // expected-error@+1{{will always overflow}}
-    EXPECT_FORTIFY_DEATH(memcpy(small_buffer, large_buffer, sizeof(large_buffer)));
-    // expected-error@+1{{will always overflow}}
-    EXPECT_FORTIFY_DEATH(memmove(small_buffer, large_buffer, sizeof(large_buffer)));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(mempcpy(small_buffer, large_buffer, sizeof(large_buffer)));
-    // expected-error@+1{{will always overflow}}
-    EXPECT_FORTIFY_DEATH(memset(small_buffer, 0, sizeof(large_buffer)));
-    // expected-warning@+1{{arguments got flipped?}}
-    EXPECT_NO_DEATH(memset(small_buffer, sizeof(small_buffer), 0));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(bcopy(large_buffer, small_buffer, sizeof(large_buffer)));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(bzero(small_buffer, sizeof(large_buffer)));
-  }
-
-  {
-    const char large_string[] = "Hello!!!";
-    static_assert(sizeof(large_string) > sizeof(small_buffer), "");
-
-    // expected-error@+1{{string bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(strcpy(small_buffer, large_string));
-    // expected-error@+1{{string bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(stpcpy(small_buffer, large_string));
-    // expected-error@+1{{size argument is too large}}
-    EXPECT_FORTIFY_DEATH(strncpy(small_buffer, large_string, sizeof(large_string)));
-    // expected-error@+1{{size argument is too large}}
-    EXPECT_FORTIFY_DEATH(stpncpy(small_buffer, large_string, sizeof(large_string)));
-    // expected-error@+1{{string bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(strcat(small_buffer, large_string));
-    // expected-error@+1{{size argument is too large}}
-    EXPECT_FORTIFY_DEATH(strncat(small_buffer, large_string, sizeof(large_string)));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(strlcpy(small_buffer, large_string, sizeof(large_string)));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(strlcat(small_buffer, large_string, sizeof(large_string)));
-  }
-
-  {
-    struct {
-      char tiny_buffer[4];
-      char tiny_buffer2[4];
-    } split = {};
-
-    EXPECT_NO_DEATH(memcpy(split.tiny_buffer, &split, sizeof(split)));
-    EXPECT_NO_DEATH(memcpy(split.tiny_buffer, &split, sizeof(split)));
-    EXPECT_NO_DEATH(memmove(split.tiny_buffer, &split, sizeof(split)));
-    EXPECT_NO_DEATH(mempcpy(split.tiny_buffer, &split, sizeof(split)));
-    EXPECT_NO_DEATH(memset(split.tiny_buffer, 0, sizeof(split)));
-
-    EXPECT_NO_DEATH(bcopy(&split, split.tiny_buffer, sizeof(split)));
-    EXPECT_NO_DEATH(bzero(split.tiny_buffer, sizeof(split)));
-
-    const char small_string[] = "Hi!!";
-    static_assert(sizeof(small_string) > sizeof(split.tiny_buffer), "");
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{string bigger than buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strcpy(split.tiny_buffer, small_string));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{string bigger than buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(stpcpy(split.tiny_buffer, small_string));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{size argument is too large}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strncpy(split.tiny_buffer, small_string, sizeof(small_string)));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{size argument is too large}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(stpncpy(split.tiny_buffer, small_string, sizeof(small_string)));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{string bigger than buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strcat(split.tiny_buffer, small_string));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{size argument is too large}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strncat(split.tiny_buffer, small_string, sizeof(small_string)));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{size bigger than buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strlcat(split.tiny_buffer, small_string, sizeof(small_string)));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{size bigger than buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(strlcpy(split.tiny_buffer, small_string, sizeof(small_string)));
-  }
-}
-
-FORTIFY_TEST(fcntl) {
-  const char target[] = "/dev/null";
-  int dirfd = 0;
-
-  // These all emit hard errors without diagnose_if, so running them is a bit
-  // more involved.
-#ifdef COMPILATION_TESTS
-  // expected-error@+1{{too many arguments}}
-  open("/", 0, 0, 0);
-  // expected-error@+1{{too many arguments}}
-  open64("/", 0, 0, 0);
-  // expected-error@+1{{too many arguments}}
-  openat(0, "/", 0, 0, 0);
-  // expected-error@+1{{too many arguments}}
-  openat64(0, "/", 0, 0, 0);
-#endif
-
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(open(target, O_CREAT));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(open(target, O_TMPFILE));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(open64(target, O_CREAT));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(open64(target, O_TMPFILE));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(openat(dirfd, target, O_CREAT));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(openat(dirfd, target, O_TMPFILE));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(openat64(dirfd, target, O_CREAT));
-  // expected-error@+1{{missing mode}}
-  EXPECT_FORTIFY_DEATH(openat64(dirfd, target, O_TMPFILE));
-
-  // expected-warning@+1{{superfluous mode bits}}
-  EXPECT_NO_DEATH(open(target, O_RDONLY, 0777));
-  // expected-warning@+1{{superfluous mode bits}}
-  EXPECT_NO_DEATH(open64(target, O_RDONLY, 0777));
-  // expected-warning@+1{{superfluous mode bits}}
-  EXPECT_NO_DEATH(openat(dirfd, target, O_RDONLY, 0777));
-  // expected-warning@+1{{superfluous mode bits}}
-  EXPECT_NO_DEATH(openat64(dirfd, target, O_RDONLY, 0777));
-}
-
-// Since these emit hard errors, it's sort of hard to run them...
-#ifdef COMPILATION_TESTS
-namespace compilation_tests {
-template <typename T>
-static T declval() {
-  __builtin_unreachable();
-}
-
-static void testFormatStrings() {
-  const auto unsigned_value = declval<unsigned long long>();
-  const auto* unknown_string = declval<const char*>();
-  const auto va = *declval<va_list*>();
-
-  {
-    auto some_fd = declval<int>();
-    // expected-warning@+1{{format specifies type 'int'}}
-    dprintf(some_fd, "%d", unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    dprintf(some_fd, unknown_string, unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    vdprintf(1, unknown_string, va);
-  }
-
-  {
-    auto* retval = declval<char*>();
-#if 0
-    // expected-error@+2{{ignoring return value}}
-#endif
-    // expected-warning@+1{{format specifies type 'int'}}
-    asprintf(&retval, "%d", unsigned_value);
-#if 0
-    // expected-error@+2{{ignoring return value}}
-#endif
-    // expected-warning@+1{{format string is not a string literal}}
-    asprintf(&retval, unknown_string, unsigned_value);
-#if 0
-    // expected-error@+2{{ignoring return value}}
-#endif
-    // expected-warning@+1{{format string is not a string literal}}
-    vasprintf(&retval, unknown_string, va);
-  }
-
-  // expected-warning@+1{{format specifies type 'int'}}
-  syslog(0, "%d", unsigned_value);
-  // expected-warning@+1{{format string is not a string literal}}
-  syslog(0, unknown_string, unsigned_value);
-  // expected-warning@+1{{format string is not a string literal}}
-  vsyslog(0, unknown_string, va);
-
-  {
-    auto* file = declval<FILE*>();
-    // expected-warning@+1{{format specifies type 'int'}}
-    fprintf(file, "%d", unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    fprintf(file, unknown_string, unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    vfprintf(file, unknown_string, va);
-  }
-
-  // expected-warning@+1{{format specifies type 'int'}}
-  printf("%d", unsigned_value);
-  // expected-warning@+1{{format string is not a string literal}}
-  printf(unknown_string, unsigned_value);
-  // expected-warning@+1{{format string is not a string literal}}
-  vprintf(unknown_string, va);
-
-  {
-    char buf[128];
-    // expected-warning@+1{{format specifies type 'int'}}
-    sprintf(buf, "%d", unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    sprintf(buf, unknown_string, unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    sprintf(buf, unknown_string, va);
-
-    // expected-warning@+1{{format specifies type 'int'}}
-    snprintf(buf, sizeof(buf), "%d", unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    snprintf(buf, sizeof(buf), unknown_string, unsigned_value);
-    // expected-warning@+1{{format string is not a string literal}}
-    vsnprintf(buf, sizeof(buf), unknown_string, va);
-  }
-
-  // FIXME: below are general format string cases where clang should probably try to warn.
-  {
-    char buf[4];
-    sprintf(buf, "%s", "1234");
-    sprintf(buf, "1%s4", "23");
-    sprintf(buf, "%d", 1234);
-
-    // Similar thoughts for strncpy, etc.
-  }
-}
-
-static void testStdlib() {
-  char path_buffer[PATH_MAX - 1];
-  // expected-warning@+2{{ignoring return value of function}}
-  // expected-error@+1{{must be NULL or a pointer to a buffer with >= PATH_MAX bytes}}
-  realpath("/", path_buffer);
-  // expected-warning@+1{{ignoring return value of function}}
-  realpath("/", nullptr);
-
-  // expected-warning@+2{{ignoring return value of function}}
-  // expected-error@+1{{flipped arguments?}}
-  realpath(nullptr, path_buffer);
-
-  // expected-warning@+2{{ignoring return value of function}}
-  // expected-error@+1{{flipped arguments?}}
-  realpath(nullptr, nullptr);
-}
-}  // namespace compilation_tests
-#endif
-
-FORTIFY_TEST(poll) {
-  int pipe_fds[2];
-  if (pipe(pipe_fds)) err(1, "pipe failed");
-
-  // after this, pipe_fds[0] should always report RDHUP
-  if (close(pipe_fds[1])) err(1, "close failed");
-
-  struct pollfd poll_fd = { pipe_fds[0], POLLRDHUP, 0 };
-  {
-    struct pollfd few_fds[] = { poll_fd, poll_fd };
-    // expected-error@+1{{fd_count is larger than the given buffer}}
-    EXPECT_FORTIFY_DEATH(poll(few_fds, 3, 0));
-    // expected-error@+1{{fd_count is larger than the given buffer}}
-    EXPECT_FORTIFY_DEATH(ppoll(few_fds, 3, 0, 0));
-    // expected-error@+1{{fd_count is larger than the given buffer}}
-    EXPECT_FORTIFY_DEATH(ppoll64(few_fds, 3, 0, nullptr));
-  }
-
-  {
-    struct {
-      struct pollfd few[2];
-      struct pollfd extra[1];
-    } fds = { { poll_fd, poll_fd }, { poll_fd } };
-    static_assert(sizeof(fds) >= sizeof(struct pollfd) * 3, "");
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{fd_count is larger than the given buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(poll(fds.few, 3, 0));
-
-    struct timespec timeout = {};
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{fd_count is larger than the given buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(ppoll(fds.few, 3, &timeout, 0));
-
-#if _FORTIFY_SOURCE > 1
-    // expected-error@+2{{fd_count is larger than the given buffer}}
-#endif
-    EXPECT_FORTIFY_DEATH_STRUCT(ppoll64(fds.few, 3, 0, nullptr));
-  }
-}
-
-FORTIFY_TEST(socket) {
-  {
-    char small_buffer[8];
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(recv(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(recvfrom(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0, 0, 0));
-
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(send(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-    // expected-error@+1{{size bigger than buffer}}
-    EXPECT_FORTIFY_DEATH(sendto(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0, 0, 0));
-  }
-
-  {
-    struct {
-      char tiny_buffer[4];
-      char tiny_buffer2;
-    } split = {};
-
-    EXPECT_NO_DEATH(recv(kBogusFD, split.tiny_buffer, sizeof(split), 0));
-    EXPECT_NO_DEATH(recvfrom(kBogusFD, split.tiny_buffer, sizeof(split), 0, 0, 0));
-  }
-}
-
-FORTIFY_TEST(sys_stat) {
-  // expected-error@+1{{'umask' called with invalid mode}}
-  EXPECT_FORTIFY_DEATH(umask(01777));
-}
-
-FORTIFY_TEST(stdio) {
-  char small_buffer[8] = {};
-  {
-    // expected-error@+1{{size argument is too large}}
-    EXPECT_FORTIFY_DEATH(snprintf(small_buffer, sizeof(small_buffer) + 1, ""));
-
-    va_list va;
-    // expected-error@+2{{size argument is too large}}
-    // expected-warning@+1{{format string is empty}}
-    EXPECT_FORTIFY_DEATH(vsnprintf(small_buffer, sizeof(small_buffer) + 1, "", va));
-
-    const char *SOMETIMES_CONST format_string = "aaaaaaaaa";
-
-    // expected-error@+1{{format string will always overflow}}
-    EXPECT_FORTIFY_DEATH(sprintf(small_buffer, format_string));
-  }
-
-  // expected-error@+1{{size should not be negative}}
-  EXPECT_FORTIFY_DEATH(fgets(small_buffer, -1, stdin));
-  // expected-error@+1{{size is larger than the destination buffer}}
-  EXPECT_FORTIFY_DEATH(fgets(small_buffer, sizeof(small_buffer) + 1, stdin));
-
-  // expected-error@+1{{size * count overflows}}
-  EXPECT_NO_DEATH(fread(small_buffer, 2, (size_t)-1, stdin));
-  // expected-error@+1{{size * count is too large for the given buffer}}
-  EXPECT_FORTIFY_DEATH(fread(small_buffer, 1, sizeof(small_buffer) + 1, stdin));
-
-  // expected-error@+1{{size * count overflows}}
-  EXPECT_NO_DEATH(fwrite(small_buffer, 2, (size_t)-1, stdout));
-  // expected-error@+1{{size * count is too large for the given buffer}}
-  EXPECT_FORTIFY_DEATH(fwrite(small_buffer, 1, sizeof(small_buffer) + 1, stdout));
-}
-
-FORTIFY_TEST(unistd) {
-  char small_buffer[8];
-
-  // Return value warnings are (sort of) a part of FORTIFY, so we don't ignore them.
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(read(kBogusFD, small_buffer, sizeof(small_buffer) + 1));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(pread(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(pread64(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(write(kBogusFD, small_buffer, sizeof(small_buffer) + 1));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(pwrite(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(pwrite64(kBogusFD, small_buffer, sizeof(small_buffer) + 1, 0));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(readlink("/", small_buffer, sizeof(small_buffer) + 1));
-#if 0
-  // expected-error@+2{{ignoring return value of function}}
-#endif
-  // expected-error@+1{{bytes overflows the given object}}
-  EXPECT_FORTIFY_DEATH(getcwd(small_buffer, sizeof(small_buffer) + 1));
-
-  // getcwd allocates and returns a buffer if you pass null to getcwd
-  EXPECT_NO_DEATH(getcwd(nullptr, 0));
-  EXPECT_NO_DEATH(getcwd(nullptr, 4096));
-
-  struct {
-    char tiny_buffer[4];
-    char tiny_buffer2[4];
-  } split;
-
-  EXPECT_NO_DEATH(read(kBogusFD, split.tiny_buffer, sizeof(split)));
-  EXPECT_NO_DEATH(pread(kBogusFD, split.tiny_buffer, sizeof(split), 0));
-  EXPECT_NO_DEATH(pread64(kBogusFD, split.tiny_buffer, sizeof(split), 0));
-  EXPECT_NO_DEATH(write(kBogusFD, split.tiny_buffer, sizeof(split)));
-  EXPECT_NO_DEATH(pwrite(kBogusFD, split.tiny_buffer, sizeof(split), 0));
-  EXPECT_NO_DEATH(pwrite64(kBogusFD, split.tiny_buffer, sizeof(split), 0));
-
-#if _FORTIFY_SOURCE > 1
-  // expected-error@+2{{bytes overflows the given object}}
-#endif
-  EXPECT_FORTIFY_DEATH_STRUCT(readlink("/", split.tiny_buffer, sizeof(split)));
-#if _FORTIFY_SOURCE > 1
-  // expected-error@+2{{bytes overflows the given object}}
-#endif
-  EXPECT_FORTIFY_DEATH_STRUCT(getcwd(split.tiny_buffer, sizeof(split)));
-
-  {
-    char* volatile unknown = small_buffer;
-    const size_t count = static_cast<size_t>(SSIZE_MAX) + 1;
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(read(kBogusFD, unknown, count));
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(pread(kBogusFD, unknown, count, 0));
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(pread64(kBogusFD, unknown, count, 0));
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(write(kBogusFD, unknown, count));
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(pwrite(kBogusFD, unknown, count, 0));
-    // expected-error@+1{{'count' must be <= SSIZE_MAX}}
-    EXPECT_FORTIFY_DEATH(pwrite64(kBogusFD, unknown, count, 0));
-  }
-}
-
-#endif  // defined(__BIONIC__)
diff --git a/tests/ctype_test.cpp b/tests/ctype_test.cpp
index 826d39a..c12518b 100644
--- a/tests/ctype_test.cpp
+++ b/tests/ctype_test.cpp
@@ -18,278 +18,183 @@
 
 #include <ctype.h>
 
-// We test from -1 (EOF) to 0xff, because that's the range for which behavior
-// is actually defined. (It's explicitly undefined below or above that.) Most
-// of our routines are no longer table-based and behave correctly for the
-// entire int range, but that's not true of other C libraries that we might
-// want to compare against, nor of our isalnum(3) and ispunt(3).
-static constexpr int kMin = -1;
-static constexpr int kMax = 256;
-
 TEST(ctype, isalnum) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '0' && i <= '9') ||
-        (i >= 'A' && i <= 'Z') ||
-        (i >= 'a' && i <= 'z')) {
-      EXPECT_TRUE(isalnum(i)) << i;
-    } else {
-      EXPECT_FALSE(isalnum(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isalnum('1'));
+  EXPECT_TRUE(isalnum('a'));
+  EXPECT_TRUE(isalnum('A'));
+  EXPECT_FALSE(isalnum('!'));
+  EXPECT_FALSE(isalnum(' '));
 }
 
 TEST(ctype, isalnum_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '0' && i <= '9') ||
-        (i >= 'A' && i <= 'Z') ||
-        (i >= 'a' && i <= 'z')) {
-      EXPECT_TRUE(isalnum_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isalnum_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isalnum_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isalnum_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isalnum_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isalnum_l('!', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isalnum_l(' ', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isalpha) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= 'A' && i <= 'Z') ||
-        (i >= 'a' && i <= 'z')) {
-      EXPECT_TRUE(isalpha(i)) << i;
-    } else {
-      EXPECT_FALSE(isalpha(i)) << i;
-    }
-  }
+  EXPECT_FALSE(isalpha('1'));
+  EXPECT_TRUE(isalpha('a'));
+  EXPECT_TRUE(isalpha('A'));
+  EXPECT_FALSE(isalpha('!'));
+  EXPECT_FALSE(isalpha(' '));
 }
 
 TEST(ctype, isalpha_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= 'A' && i <= 'Z') ||
-        (i >= 'a' && i <= 'z')) {
-      EXPECT_TRUE(isalpha_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isalpha_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_FALSE(isalpha_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isalpha_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isalpha_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isalpha_l('!', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isalpha_l(' ', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isascii) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= 0 && i <= 0x7f) {
-      EXPECT_TRUE(isascii(i)) << i;
-    } else {
-      EXPECT_FALSE(isascii(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isascii('\x7f'));
+  EXPECT_FALSE(isascii('\x80'));
 }
 
 TEST(ctype, isblank) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i == '\t' || i == ' ') {
-      EXPECT_TRUE(isblank(i)) << i;
-    } else {
-      EXPECT_FALSE(isblank(i)) << i;
-    }
-  }
+  EXPECT_FALSE(isblank('1'));
+  EXPECT_TRUE(isblank(' '));
+  EXPECT_TRUE(isblank('\t'));
 }
 
 TEST(ctype, isblank_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i == '\t' || i == ' ') {
-      EXPECT_TRUE(isblank_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isblank_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_FALSE(isblank_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isblank_l(' ', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isblank_l('\t', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, iscntrl) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= 0 && i < ' ') || i == 0x7f) {
-      EXPECT_TRUE(iscntrl(i)) << i;
-    } else {
-      EXPECT_FALSE(iscntrl(i)) << i;
-    }
-  }
+  EXPECT_FALSE(iscntrl('1'));
+  EXPECT_TRUE(iscntrl('\b'));
 }
 
 TEST(ctype, iscntrl_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= 0 && i < ' ') || i == 0x7f) {
-      EXPECT_TRUE(iscntrl_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(iscntrl_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_FALSE(iscntrl_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(iscntrl_l('\b', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isdigit) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= '0' && i <= '9') {
-      EXPECT_TRUE(isdigit(i)) << i;
-    } else {
-      EXPECT_FALSE(isdigit(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isdigit('1'));
+  EXPECT_FALSE(isdigit('a'));
+  EXPECT_FALSE(isdigit('x'));
 }
 
 TEST(ctype, isdigit_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= '0' && i <= '9') {
-      EXPECT_TRUE(isdigit_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isdigit_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isdigit_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isdigit_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isdigit_l('x', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isgraph) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= '!' && i <= '~') {
-      EXPECT_TRUE(isgraph(i)) << i;
-    } else {
-      EXPECT_FALSE(isgraph(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isgraph('a'));
+  EXPECT_TRUE(isgraph('A'));
+  EXPECT_TRUE(isgraph('1'));
+  EXPECT_TRUE(isgraph('!'));
+  EXPECT_FALSE(isgraph(' '));
 }
 
 TEST(ctype, isgraph_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= '!' && i <= '~') {
-      EXPECT_TRUE(isgraph_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isgraph_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isgraph_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isgraph_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isgraph_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isgraph_l('!', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isgraph_l(' ', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, islower) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= 'a' && i <= 'z') {
-      EXPECT_TRUE(islower(i)) << i;
-    } else {
-      EXPECT_FALSE(islower(i)) << i;
-    }
-  }
+  EXPECT_TRUE(islower('a'));
+  EXPECT_FALSE(islower('A'));
+  EXPECT_FALSE(islower('!'));
 }
 
 TEST(ctype, islower_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= 'a' && i <= 'z') {
-      EXPECT_TRUE(islower_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(islower_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(islower_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(islower_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(islower_l('!', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isprint) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= ' ' && i <= '~') {
-      EXPECT_TRUE(isprint(i)) << i;
-    } else {
-      EXPECT_FALSE(isprint(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isprint('a'));
+  EXPECT_TRUE(isprint(' '));
+  EXPECT_FALSE(isprint('\b'));
 }
 
 TEST(ctype, isprint_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= ' ' && i <= '~') {
-      EXPECT_TRUE(isprint_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isprint_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isprint_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isprint_l(' ', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isprint_l('\b', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, ispunct) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '!' && i <= '/') ||
-        (i >= ':' && i <= '@') ||
-        (i >= '[' && i <= '`') ||
-        (i >= '{' && i <= '~')) {
-      EXPECT_TRUE(ispunct(i)) << i;
-    } else {
-      EXPECT_FALSE(ispunct(i)) << i;
-    }
-  }
+  EXPECT_TRUE(ispunct('!'));
+  EXPECT_FALSE(ispunct('a'));
+  EXPECT_FALSE(ispunct(' '));
+  EXPECT_FALSE(ispunct('\b'));
 }
 
 TEST(ctype, ispunct_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '!' && i <= '/') ||
-        (i >= ':' && i <= '@') ||
-        (i >= '[' && i <= '`') ||
-        (i >= '{' && i <= '~')) {
-      EXPECT_TRUE(ispunct_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(ispunct_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(ispunct_l('!', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(ispunct_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(ispunct_l(' ', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(ispunct_l('\b', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isspace) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '\t' && i <= '\r') || i == ' ') {
-      EXPECT_TRUE(isspace(i)) << i;
-    } else {
-      EXPECT_FALSE(isspace(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isspace(' '));
+  EXPECT_TRUE(isspace('\f'));
+  EXPECT_TRUE(isspace('\n'));
+  EXPECT_TRUE(isspace('\r'));
+  EXPECT_TRUE(isspace('\t'));
+  EXPECT_TRUE(isspace('\v'));
+  EXPECT_FALSE(isspace('a'));
+  EXPECT_FALSE(isspace('!'));
 }
 
 TEST(ctype, isspace_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '\t' && i <= '\r') || i == ' ') {
-      EXPECT_TRUE(isspace_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isspace_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isspace_l(' ', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isspace_l('\f', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isspace_l('\n', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isspace_l('\r', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isspace_l('\t', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isspace_l('\v', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isspace_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isspace_l('!', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isupper) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= 'A' && i <= 'Z') {
-      EXPECT_TRUE(isupper(i)) << i;
-    } else {
-      EXPECT_FALSE(isupper(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isupper('A'));
+  EXPECT_FALSE(isupper('a'));
+  EXPECT_FALSE(isupper('!'));
 }
 
 TEST(ctype, isupper_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if (i >= 'A' && i <= 'Z') {
-      EXPECT_TRUE(isupper_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isupper_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isupper_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isupper_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isupper_l('!', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, isxdigit) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '0' && i <= '9') ||
-        (i >= 'A' && i <= 'F') ||
-        (i >= 'a' && i <= 'f')) {
-      EXPECT_TRUE(isxdigit(i)) << i;
-    } else {
-      EXPECT_FALSE(isxdigit(i)) << i;
-    }
-  }
+  EXPECT_TRUE(isxdigit('0'));
+  EXPECT_FALSE(isxdigit('x'));
+  EXPECT_TRUE(isxdigit('1'));
+  EXPECT_TRUE(isxdigit('a'));
+  EXPECT_TRUE(isxdigit('A'));
+  EXPECT_FALSE(isxdigit('g'));
+  EXPECT_FALSE(isxdigit(' '));
 }
 
 TEST(ctype, isxdigit_l) {
-  for (int i = kMin; i < kMax; ++i) {
-    if ((i >= '0' && i <= '9') ||
-        (i >= 'A' && i <= 'F') ||
-        (i >= 'a' && i <= 'f')) {
-      EXPECT_TRUE(isxdigit_l(i, LC_GLOBAL_LOCALE)) << i;
-    } else {
-      EXPECT_FALSE(isxdigit_l(i, LC_GLOBAL_LOCALE)) << i;
-    }
-  }
+  EXPECT_TRUE(isxdigit_l('0', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isxdigit_l('x', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isxdigit_l('1', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isxdigit_l('a', LC_GLOBAL_LOCALE));
+  EXPECT_TRUE(isxdigit_l('A', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isxdigit_l('g', LC_GLOBAL_LOCALE));
+  EXPECT_FALSE(isxdigit_l(' ', LC_GLOBAL_LOCALE));
 }
 
 TEST(ctype, toascii) {
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index b69da97..9e46394 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -204,10 +204,7 @@
 // The two libs are in ns2/ subdir.
 TEST(dl, exec_without_ld_config_file) {
 #if defined(__BIONIC__)
-  std::string error_message =
-      "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" "
-      "not found: needed by main executable\n";
+  std::string error_message = "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() + "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" not found\n";
   std::string helper = GetTestlibRoot() +
       "/ld_config_test_helper/ld_config_test_helper";
   chmod(helper.c_str(), 0755);
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 7e772b8..eed84a4 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -28,9 +28,10 @@
 #include <android/dlext.h>
 #include <android-base/file.h>
 #include <android-base/strings.h>
-#include <android-base/test_utils.h>
 
+#include <linux/memfd.h>
 #include <sys/mman.h>
+#include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/vfs.h>
 #include <sys/wait.h>
@@ -133,7 +134,10 @@
   ZipArchiveHandle handle;
   ASSERT_EQ(0, OpenArchive(lib_path.c_str(), &handle));
   ZipEntry zip_entry;
-  ASSERT_EQ(0, FindEntry(handle, kLibZipSimpleZip, &zip_entry));
+  ZipString zip_name;
+  zip_name.name = reinterpret_cast<const uint8_t*>(kLibZipSimpleZip);
+  zip_name.name_length = strlen(kLibZipSimpleZip);
+  ASSERT_EQ(0, FindEntry(handle, zip_name, &zip_entry));
   extinfo.library_fd_offset = zip_entry.offset;
   CloseArchive(handle);
 
@@ -362,10 +366,8 @@
 
   uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle_, "dlopen_testlib_taxicab_number"));
   ASSERT_DL_NOTNULL(taxicab_number);
-  // Untag the pointer so that it can be compared with start, which will be untagged.
-  void* addr = reinterpret_cast<void*>(untag_address(taxicab_number));
-  EXPECT_GE(addr, start);
-  EXPECT_LT(addr, reinterpret_cast<char*>(start) + kLibSize);
+  EXPECT_GE(reinterpret_cast<void*>(taxicab_number), start);
+  EXPECT_LT(reinterpret_cast<void*>(taxicab_number), reinterpret_cast<char*>(start) + kLibSize);
   EXPECT_EQ(1729U, *taxicab_number);
 }
 
@@ -601,7 +603,7 @@
 void GetPss(bool shared_relro, const char* lib, const char* relro_file, pid_t pid,
             size_t* total_pss) {
   android::meminfo::ProcMemInfo proc_mem(pid);
-  const std::vector<android::meminfo::Vma>& maps = proc_mem.MapsWithoutUsageStats();
+  const std::vector<android::meminfo::Vma>& maps = proc_mem.Maps();
   ASSERT_GT(maps.size(), 0UL);
 
   // Calculate total PSS of the library.
@@ -613,9 +615,7 @@
           saw_relro_file = true;
       }
 
-      android::meminfo::Vma update_vma(vma);
-      ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma));
-      *total_pss += update_vma.usage.pss;
+      *total_pss += vma.usage.pss;
     }
   }
 
@@ -945,7 +945,7 @@
   const std::string lib_path = GetTestlibRoot() + "/libtest_simple.so";
 
   // create memfd
-  int memfd = memfd_create("foobar", MFD_CLOEXEC);
+  int memfd = syscall(__NR_memfd_create, "foobar", MFD_CLOEXEC);
   if (memfd == -1 && errno == ENOSYS) {
     return;
   }
@@ -1375,10 +1375,7 @@
 
   void* handle2 = android_dlopen_ext(root_lib, RTLD_NOW, &extinfo);
   ASSERT_TRUE(handle2 == nullptr);
-  const char* error = dlerror();
-  ASSERT_MATCH(error,
-               R"(dlopen failed: library "libnstest_private_external.so" not found: needed by )"
-               R"(\S+libnstest_root_not_isolated.so in namespace private_isolated1)");
+  ASSERT_STREQ("dlopen failed: library \"libnstest_private_external.so\" not found", dlerror());
 
   // Check dlopen by absolute path
   handle2 = android_dlopen_ext(lib_private_external_path.c_str(), RTLD_NOW, &extinfo);
@@ -1506,9 +1503,7 @@
 
   void* handle2 = android_dlopen_ext(root_lib, RTLD_NOW, &extinfo);
   ASSERT_TRUE(handle2 == nullptr);
-  ASSERT_MATCH(dlerror(),
-               R"(dlopen failed: library "libnstest_private_external.so" not found: needed by )"
-               R"(\S+libnstest_root_not_isolated.so in namespace private_isolated_shared)");
+  ASSERT_STREQ("dlopen failed: library \"libnstest_private_external.so\" not found", dlerror());
 
   // Check dlopen by absolute path
   handle2 = android_dlopen_ext(lib_private_external_path.c_str(), RTLD_NOW, &extinfo);
@@ -1768,10 +1763,7 @@
 
   handle1 = android_dlopen_ext(root_lib, RTLD_NOW, &extinfo);
   ASSERT_TRUE(handle1 == nullptr);
-  ASSERT_MATCH(
-      dlerror(),
-      R"(dlopen failed: library "libnstest_public.so" not found: needed by \S+libnstest_root.so)"
-      R"( in namespace isolated2)");
+  ASSERT_STREQ("dlopen failed: library \"libnstest_public.so\" not found", dlerror());
 }
 
 TEST(dlext, ns_inaccessible_error_message) {
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index d815dba..7ff553d 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -982,16 +982,16 @@
 }
 
 #if defined (__aarch64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/arm64/"
+#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/arm64/"
 #elif defined (__arm__)
 #define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/arm/"
 #elif defined (__i386__)
 #define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/x86/"
 #elif defined (__x86_64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/x86_64/"
+#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/x86_64/"
 #elif defined (__mips__)
 #if defined(__LP64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/mips64/"
+#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/mips64/"
 #else
 #define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/mips/"
 #endif
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index f31497a..6d88880 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -28,12 +28,11 @@
 
 #include <dlfcn.h>
 #include <gtest/gtest.h>
-#include <link.h>
 
 #include <thread>
 
 #include "gtest_globals.h"
-#include "platform/bionic/tls.h"
+#include "private/__get_tls.h"
 #include "utils.h"
 
 #if defined(__BIONIC__)
@@ -336,58 +335,3 @@
   ASSERT_STREQ(nullptr, info.dli_sname);
   ASSERT_EQ(nullptr, info.dli_saddr);
 }
-
-TEST(elftls_dl, dl_iterate_phdr) {
-  void* lib = dlopen("libtest_elftls_dynamic.so", RTLD_LOCAL | RTLD_NOW);
-
-  auto get_var_addr = reinterpret_cast<void*(*)()>(dlsym(lib, "get_large_tls_var_addr"));
-  ASSERT_NE(nullptr, get_var_addr);
-
-  struct TlsInfo {
-    bool found;
-    size_t modid;
-    void* data;
-    size_t memsz;
-  };
-
-  auto get_tls_info = []() {
-    auto callback = [](dl_phdr_info* info, size_t, void* data) {
-      TlsInfo& tls_info = *static_cast<TlsInfo*>(data);
-
-      // This test is also run with glibc, where dlpi_name may have relative path components, so
-      // examine just the basename when searching for the library.
-      if (strcmp(basename(info->dlpi_name), "libtest_elftls_dynamic.so") != 0) return 0;
-
-      tls_info.found = true;
-      tls_info.modid = info->dlpi_tls_modid;
-      tls_info.data = info->dlpi_tls_data;
-      for (ElfW(Half) i = 0; i < info->dlpi_phnum; ++i) {
-        if (info->dlpi_phdr[i].p_type == PT_TLS) {
-          tls_info.memsz = info->dlpi_phdr[i].p_memsz;
-        }
-      }
-      EXPECT_NE(static_cast<size_t>(0), tls_info.memsz);
-      return 1;
-    };
-
-    TlsInfo result {};
-    dl_iterate_phdr(callback, &result);
-    return result;
-  };
-
-  // The executable has a TLS segment, so it will use module ID #1, and the DSO's ID will be larger
-  // than 1. Initially, the data field is nullptr, because this thread's instance hasn't been
-  // allocated yet.
-  TlsInfo tls_info = get_tls_info();
-  ASSERT_TRUE(tls_info.found);
-  ASSERT_GT(tls_info.modid, static_cast<size_t>(1));
-  ASSERT_EQ(nullptr, tls_info.data);
-
-  void* var_addr = get_var_addr();
-
-  // Verify that dl_iterate_phdr returns a range of memory covering the allocated TLS variable.
-  tls_info = get_tls_info();
-  ASSERT_TRUE(tls_info.found);
-  ASSERT_GE(var_addr, tls_info.data);
-  ASSERT_LT(var_addr, static_cast<char*>(tls_info.data) + tls_info.memsz);
-}
diff --git a/tests/eventfd_test.cpp b/tests/eventfd_test.cpp
index 3c303c2..68d9192 100644
--- a/tests/eventfd_test.cpp
+++ b/tests/eventfd_test.cpp
@@ -21,16 +21,14 @@
 
 #include <sys/eventfd.h>
 
-#include "utils.h"
-
 TEST(eventfd, smoke) {
-  constexpr unsigned int kInitialValue = 2;
-  int fd = eventfd(kInitialValue, EFD_NONBLOCK);
-  ASSERT_NE(-1, fd);
+  unsigned int initial_value = 2;
+  int fd = eventfd(initial_value, O_NONBLOCK);
+  ASSERT_NE(fd, -1);
 
   eventfd_t value = 123;
   ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(kInitialValue, value);
+  ASSERT_EQ(initial_value, value);
 
   // Reading clears the counter.
   ASSERT_EQ(-1, eventfd_read(fd, &value));
@@ -46,49 +44,3 @@
 
   close(fd);
 }
-
-TEST(eventfd, cloexec) {
-  constexpr unsigned int kInitialValue = 2;
-  int fd = eventfd(kInitialValue, EFD_CLOEXEC);
-  ASSERT_NE(-1, fd);
-  AssertCloseOnExec(fd, true);
-
-  eventfd_t value = 123;
-  ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(kInitialValue, value);
-
-  close(fd);
-
-  fd = eventfd(kInitialValue, EFD_NONBLOCK | EFD_CLOEXEC);
-  ASSERT_NE(-1, fd);
-  AssertCloseOnExec(fd, true);
-
-  value = 123;
-  ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(kInitialValue, value);
-
-  close(fd);
-}
-
-TEST(eventfd, semaphore) {
-  int fd = eventfd(3, EFD_NONBLOCK | EFD_SEMAPHORE);
-  ASSERT_NE(-1, fd);
-
-  eventfd_t value = 123;
-  ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(1U, value);
-
-  value = 123;
-  ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(1U, value);
-
-  value = 123;
-  ASSERT_EQ(0, eventfd_read(fd, &value));
-  ASSERT_EQ(1U, value);
-
-  // The counter is cleared after the initial value decrements to 0.
-  ASSERT_EQ(-1, eventfd_read(fd, &value));
-  ASSERT_EQ(EAGAIN, errno);
-
-  close(fd);
-}
diff --git a/tests/file-check-cxx b/tests/file-check-cxx
new file mode 100755
index 0000000..d3bc5f7
--- /dev/null
+++ b/tests/file-check-cxx
@@ -0,0 +1,13 @@
+#!/bin/bash
+FILECHECK=$1
+CXX=$2
+PREFIX=$3
+shift 3
+SOURCE=$(echo "$@" | grep -oP '\S+\.cpp\b')
+OBJ=$(echo "$@" | grep -oP '\S+\.o\b')
+$CXX "$@" -Wno-error 2>&1 | $FILECHECK -check-prefix=$PREFIX $SOURCE
+if [ "$?" -eq 0 ]; then
+  touch $OBJ
+else
+  exit 1
+fi
diff --git a/tests/fortify_filecheck_diagnostics_test.cpp b/tests/fortify_filecheck_diagnostics_test.cpp
new file mode 100644
index 0000000..e79a9a6
--- /dev/null
+++ b/tests/fortify_filecheck_diagnostics_test.cpp
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * If this test fails, you can see the compiler's output by erasing a few args from the failing
+ * command. Specifically, delete everything before the path/to/the/compiler, then delete the first
+ * arg after the path/to/the/compiler. For example, given the following command:
+ *
+ * bionic/tests/file-check-cxx out/host/linux-x86/bin/FileCheck \
+ * prebuilts/clang/host/linux-x86/clang-4053586/bin/clang++ CLANG    -I bionic/tests -I ...
+ *
+ * If you delete everything before clang++ and delete "CLANG", then you'll end up with:
+ *
+ * prebuilts/clang/host/linux-x86/clang-4053586/bin/clang++ -I bionic/tests -I ...
+ *
+ * Which is the command that FileCheck executes.
+ */
+
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 2
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <poll.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+
+void test_sprintf() {
+  char buf[4];
+
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: call to unavailable function 'sprintf': format string will always overflow destination buffer
+  sprintf(buf, "foobar");  // NOLINT(runtime/printf)
+
+  // TODO: clang should emit a warning, but doesn't
+  sprintf(buf, "%s", "foobar");  // NOLINT(runtime/printf)
+}
+
+void test_snprintf() {
+  char buf[4];
+
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: call to unavailable function 'snprintf': format string will always overflow destination buffer
+  snprintf(buf, 5, "foobar");  // NOLINT(runtime/printf)
+
+  // TODO: clang should emit a warning, but doesn't
+  snprintf(buf, 5, "%s", "foobar");  // NOLINT(runtime/printf)
+
+  // TODO: clang should emit a warning, but doesn't
+  snprintf(buf, 5, " %s ", "foobar");  // NOLINT(runtime/printf)
+
+  // TODO: clang should emit a warning, but doesn't
+  snprintf(buf, 5, "%d", 100000);  // NOLINT(runtime/printf)
+}
+
+void test_memcpy() {
+  char buf[4];
+
+  // CLANG: error: 'memcpy' called with size bigger than buffer
+  memcpy(buf, "foobar", sizeof("foobar") + 100);
+}
+
+void test_memmove() {
+  char buf[4];
+
+  // CLANG: error: 'memmove' called with size bigger than buffer
+  memmove(buf, "foobar", sizeof("foobar"));
+}
+
+void test_memset() {
+  char buf[4];
+
+  // CLANG: error: 'memset' called with size bigger than buffer
+  memset(buf, 0, 6);
+}
+
+void test_strcpy() {
+  char buf[4];
+
+  // CLANG: error: 'strcpy' called with string bigger than buffer
+  strcpy(buf, "foobar");  // NOLINT(runtime/printf)
+
+  // CLANG: error: 'strcpy' called with string bigger than buffer
+  strcpy(buf, "quux");
+}
+
+void test_stpcpy() {
+  char buf[4];
+
+  // CLANG: error: 'stpcpy' called with string bigger than buffer
+  stpcpy(buf, "foobar");
+
+  // CLANG: error: 'stpcpy' called with string bigger than buffer
+  stpcpy(buf, "quux");
+}
+
+void test_strncpy() {
+  char buf[4];
+
+  // TODO: clang should emit a warning, but doesn't
+  strncpy(buf, "foobar", sizeof("foobar"));
+}
+
+void test_strcat() {
+  char buf[4] = "";
+
+  // TODO: clang should emit a warning, but doesn't
+  strcat(buf, "foobar");  // NOLINT(runtime/printf)
+}
+
+void test_strncat() {
+  char buf[4] = "";
+
+  // TODO: clang should emit a warning, but doesn't
+  strncat(buf, "foobar", sizeof("foobar"));
+}
+
+void test_vsprintf(const char* fmt, ...) {
+  va_list va;
+  char buf[4];
+  va_start(va, fmt);
+
+  // clang should emit a warning, but doesn't
+  vsprintf(buf, "foobar", va);
+  va_end(va);
+}
+
+void test_vsnprintf(const char* fmt, ...) {
+  va_list va;
+  char buf[4];
+  va_start(va, fmt);
+
+  // clang should emit a warning, but doesn't
+  vsnprintf(buf, 5, "foobar", va);  // NOLINT(runtime/printf)
+
+  va_end(va);
+}
+
+void test_fgets() {
+  char buf[4];
+
+  // CLANG: error: in call to 'fgets', size should not be negative
+  fgets(buf, -1, stdin);
+
+  // CLANG: error: in call to 'fgets', size is larger than the destination buffer
+  fgets(buf, 6, stdin);
+}
+
+void test_recvfrom() {
+  char buf[4];
+  sockaddr_in addr;
+
+  // CLANG: error: 'recvfrom' called with size bigger than buffer
+  recvfrom(0, buf, 6, 0, reinterpret_cast<sockaddr*>(&addr), nullptr);
+}
+
+void test_recv() {
+  char buf[4] = {0};
+
+  // CLANG: error: 'recv' called with size bigger than buffer
+  recv(0, buf, 6, 0);
+}
+
+void test_umask() {
+  // CLANG: error: 'umask' called with invalid mode
+  umask(01777);
+}
+
+void test_read() {
+  char buf[4];
+  // CLANG: error: in call to 'read', 'count' bytes overflows the given object
+  read(0, buf, 6);
+}
+
+void test_open() {
+  // CLANG: error: 'open' called with O_CREAT or O_TMPFILE, but missing mode
+  open("/dev/null", O_CREAT);
+
+  // CLANG: error: 'open' called with O_CREAT or O_TMPFILE, but missing mode
+  open("/dev/null", O_TMPFILE);
+
+  // CLANG: error: call to unavailable function 'open': too many arguments
+  open("/dev/null", O_CREAT, 0, 0);
+
+  // CLANG: error: call to unavailable function 'open': too many arguments
+  open("/dev/null", O_TMPFILE, 0, 0);
+
+  // CLANG: warning: 'open' has superfluous mode bits; missing O_CREAT?
+  open("/dev/null", O_RDONLY, 0644);
+
+  // CLANG: warning: 'open' has superfluous mode bits; missing O_CREAT?
+  open("/dev/null", O_DIRECTORY, 0644);
+}
+
+void test_poll() {
+  pollfd fds[1];
+  // CLANG: error: in call to 'poll', fd_count is larger than the given buffer
+  poll(fds, 2, 0);
+}
+
+void test_ppoll() {
+  pollfd fds[1];
+  timespec timeout;
+  // CLANG: error: in call to 'ppoll', fd_count is larger than the given buffer
+  ppoll(fds, 2, &timeout, nullptr);
+}
+
+void test_ppoll64() {
+  pollfd fds[1];
+  timespec timeout;
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: in call to 'ppoll64', fd_count is larger than the given buffer
+  ppoll64(fds, 2, &timeout, nullptr);
+}
+
+void test_fread_overflow() {
+  char buf[4];
+  // CLANG: error: in call to 'fread', size * count overflows
+  fread(buf, 2, (size_t)-1, stdin);
+}
+
+void test_fread_too_big() {
+  char buf[4];
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: in call to 'fread', size * count is too large for the given buffer
+  fread(buf, 1, 5, stdin);
+}
+
+void test_fwrite_overflow() {
+  char buf[4] = {0};
+  // CLANG: error: in call to 'fwrite', size * count overflows
+  fwrite(buf, 2, (size_t)-1, stdout);
+}
+
+void test_fwrite_too_big() {
+  char buf[4] = {0};
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: in call to 'fwrite', size * count is too large for the given buffer
+  fwrite(buf, 1, 5, stdout);
+}
+
+void test_getcwd() {
+  char buf[4];
+  // CLANG: error: in call to 'getcwd', 'size' bytes overflows the given object
+  getcwd(buf, 5);
+}
+
+void test_pwrite64_size() {
+  char buf[4] = {0};
+  // CLANG: error: in call to 'pwrite64', 'count' bytes overflows the given object
+  pwrite64(STDOUT_FILENO, buf, 5, 0);
+}
+
+void test_pwrite64_too_big_malloc() {
+  void *buf = calloc(atoi("5"), 1);
+  // clang should emit a warning, but probably never will.
+  pwrite64(STDOUT_FILENO, buf, SIZE_MAX, 0);
+}
+
+void test_pwrite64_too_big() {
+  char buf[4] = {0};
+  // CLANG: error: in call to 'pwrite64', 'count' must be <= SSIZE_MAX
+  pwrite64(STDOUT_FILENO, buf, SIZE_MAX, 0);
+}
+
+void test_write_size() {
+  char buf[4] = {0};
+  // CLANG: error: in call to 'write', 'count' bytes overflows the given object
+  write(STDOUT_FILENO, buf, 5);
+}
+
+void test_memset_args_flipped() {
+  char from[4] = {0};
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: 'memset' will set 0 bytes; maybe the arguments got flipped?
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmemset-transposed-args"
+  memset(from, sizeof(from), 0);
+#pragma clang diagnostic pop
+}
+
+void test_sendto() {
+  char buf[4] = {0};
+  sockaddr_in addr;
+
+  // CLANG: error: 'sendto' called with size bigger than buffer
+  sendto(0, buf, 6, 0, reinterpret_cast<sockaddr*>(&addr), sizeof(sockaddr_in));
+}
+
+void test_send() {
+  char buf[4] = {0};
+
+  // CLANG: error: 'send' called with size bigger than buffer
+  send(0, buf, 6, 0);
+}
+
+void test_realpath() {
+  char buf[4] = {0};
+  // NOLINTNEXTLINE(whitespace/line_length)
+  // CLANG: error: 'realpath' output parameter must be NULL or a pointer to a buffer with >= PATH_MAX bytes
+  realpath(".", buf);
+
+  // This is fine.
+  realpath(".", nullptr);
+
+  char bigbuf[PATH_MAX];
+  // CLANG: error: 'realpath': NULL path is never correct; flipped arguments?
+  realpath(nullptr, bigbuf);
+}
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 9a4b781..489b701 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -926,24 +926,6 @@
   ASSERT_EQ('\0', buf[9]);
 }
 
-TEST(TEST_NAME, mempcpy_chk) {
-  const char input_str[] = "abcdefg";
-  size_t input_str_size = strlen(input_str) + 1;
-
-  char buf1[10] = {};
-  char buf2[10] = {};
-
-  __builtin_mempcpy(buf1, input_str, input_str_size);
-  __builtin___mempcpy_chk(buf2, input_str, input_str_size, __bos0(buf2));
-
-  ASSERT_EQ(memcmp(buf1, buf2, sizeof(buf2)), 0);
-
-  void *builtin_ptr = __builtin_mempcpy(buf1, input_str, input_str_size);
-  void *fortify_ptr = __builtin___mempcpy_chk(buf1, input_str, input_str_size, __bos0(buf2));
-
-  ASSERT_EQ(builtin_ptr, fortify_ptr);
-}
-
 extern "C" char* __stpcpy_chk(char*, const char*, size_t);
 
 TEST(TEST_NAME, stpcpy_chk_max_int_size) {
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index 6b49e29..b46839b 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -46,8 +46,6 @@
 using android::base::Split;
 using android::base::StartsWith;
 
-using namespace std::literals;
-
 enum uid_type_t {
   TYPE_APP,
   TYPE_SYSTEM,
@@ -75,7 +73,11 @@
     EXPECT_STREQ("/", pwd->pw_dir);
   }
 
-  EXPECT_STREQ("/bin/sh", pwd->pw_shell);
+  if (uid_type == TYPE_VENDOR) {
+    EXPECT_STREQ("/vendor/bin/sh", pwd->pw_shell);
+  } else {
+    EXPECT_STREQ("/system/bin/sh", pwd->pw_shell);
+  }
 }
 
 static void check_getpwuid(const char* username, uid_t uid, uid_type_t uid_type,
@@ -128,41 +130,12 @@
 
 static void check_get_passwd(const char* username, uid_t uid, uid_type_t uid_type,
                              bool check_username = true) {
-  SCOPED_TRACE("username '"s + username + "'");
   check_getpwuid(username, uid, uid_type, check_username);
   check_getpwnam(username, uid, uid_type, check_username);
   check_getpwuid_r(username, uid, uid_type, check_username);
   check_getpwnam_r(username, uid, uid_type, check_username);
 }
 
-static void expect_no_passwd_id(uid_t uid) {
-  SCOPED_TRACE("uid '" + std::to_string(uid) + "'");
-  errno = 0;
-  passwd* passwd = nullptr;
-  passwd = getpwuid(uid);
-  EXPECT_EQ(nullptr, passwd) << "name = '" << passwd->pw_name << "'";
-  EXPECT_EQ(ENOENT, errno);
-
-  struct passwd passwd_storage;
-  char buf[512];
-  EXPECT_EQ(ENOENT, getpwuid_r(uid, &passwd_storage, buf, sizeof(buf), &passwd));
-  EXPECT_EQ(nullptr, passwd) << "name = '" << passwd->pw_name << "'";
-}
-
-static void expect_no_passwd_name(const char* username) {
-  SCOPED_TRACE("username '"s + username + "'");
-  errno = 0;
-  passwd* passwd = nullptr;
-  passwd = getpwnam(username);
-  EXPECT_EQ(nullptr, passwd) << "name = '" << passwd->pw_name << "'";
-  EXPECT_EQ(ENOENT, errno);
-
-  struct passwd passwd_storage;
-  char buf[512];
-  EXPECT_EQ(ENOENT, getpwnam_r(username, &passwd_storage, buf, sizeof(buf), &passwd));
-  EXPECT_EQ(nullptr, passwd) << "name = '" << passwd->pw_name << "'";
-}
-
 #else // !defined(__BIONIC__)
 
 static void check_get_passwd(const char* /* username */, uid_t /* uid */, uid_type_t /* uid_type */,
@@ -174,211 +147,79 @@
   GTEST_SKIP() << "bionic-only test";
 }
 
-static void expect_no_passwd_id(uid_t /* uid */) {
-  GTEST_SKIP() << "bionic-only test";
-}
-
-static void expect_no_passwd_name(const char* /* username */) {
-  GTEST_SKIP() << "bionic-only test";
-}
-
 #endif
 
-TEST(pwd, getpwnam_platform_ids) {
+TEST(pwd, getpwnam_system_id_root) {
   check_get_passwd("root", 0, TYPE_SYSTEM);
-  check_get_passwd("daemon", 1, TYPE_SYSTEM);
-  check_get_passwd("bin", 2, TYPE_SYSTEM);
-
-  check_get_passwd("system", 1000, TYPE_SYSTEM);
-  check_get_passwd("radio", 1001, TYPE_SYSTEM);
-
-  check_get_passwd("shell", 2000, TYPE_SYSTEM);
-
-  check_get_passwd("nobody", 9999, TYPE_SYSTEM);
 }
 
-TEST(pwd, getpwnam_oem_ids) {
-  check_get_passwd("oem_2900", 2900, TYPE_VENDOR, false);
-  check_get_passwd("oem_2945", 2945, TYPE_VENDOR, false);
-  check_get_passwd("oem_2999", 2999, TYPE_VENDOR, false);
+TEST(pwd, getpwnam_system_id_system) {
+  check_get_passwd("system", 1000, TYPE_SYSTEM);
+}
+
+TEST(pwd, getpwnam_app_id_radio) {
+  check_get_passwd("radio", 1001, TYPE_SYSTEM);
+}
+
+TEST(pwd, getpwnam_oem_id_5000) {
   check_get_passwd("oem_5000", 5000, TYPE_VENDOR, false);
-  check_get_passwd("oem_5454", 5454, TYPE_VENDOR, false);
+}
+
+TEST(pwd, getpwnam_oem_id_5999) {
   check_get_passwd("oem_5999", 5999, TYPE_VENDOR, false);
 }
 
-TEST(pwd, getpwnam_non_exist) {
-  expect_no_passwd_id(999);   // End of the system reserved range, unallocated.
-  expect_no_passwd_id(1999);  // End of the system reserved range, unallocated.
-  expect_no_passwd_id(2899);  // End of the system reserved range, unallocated.
-
-  // These ranges are for GIDs only.
-  expect_no_passwd_id(20000);
-  expect_no_passwd_id(30000);
-  expect_no_passwd_id(40000);
-  expect_no_passwd_id(50000);
-
-  // These should not be parsed as users, only as groups.
-  expect_no_passwd_name("u0_a9999_cache");
-  expect_no_passwd_name("u0_a9999_ext");
-  expect_no_passwd_name("u0_a9999_ext_cache");
-  expect_no_passwd_name("all_a9999");
+TEST(pwd, getpwnam_oem_id_2900) {
+  check_get_passwd("oem_2900", 2900, TYPE_VENDOR, false);
 }
 
-TEST(pwd, getpwnam_u0_app_ids) {
+TEST(pwd, getpwnam_oem_id_2999) {
+  check_get_passwd("oem_2999", 2999, TYPE_VENDOR, false);
+}
+
+TEST(pwd, getpwnam_app_id_nobody) {
+  check_get_passwd("nobody", 9999, TYPE_SYSTEM);
+}
+
+TEST(pwd, getpwnam_app_id_u0_a0) {
   check_get_passwd("u0_a0", 10000, TYPE_APP);
+}
+
+TEST(pwd, getpwnam_app_id_u0_a1234) {
   check_get_passwd("u0_a1234", 11234, TYPE_APP);
-  check_get_passwd("u0_a9999", 19999, TYPE_APP);
+}
 
+// Test the difference between uid and shared gid.
+TEST(pwd, getpwnam_app_id_u0_a49999) {
+  check_get_passwd("u0_a49999", 59999, TYPE_APP);
+}
+
+TEST(pwd, getpwnam_app_id_u0_i1) {
   check_get_passwd("u0_i1", 90001, TYPE_APP);
-  check_get_passwd("u0_i4545", 94545, TYPE_APP);
-  check_get_passwd("u0_i9999", 99999, TYPE_APP);
 }
 
-TEST(pwd, getpwnam_app_id_u1_ids) {
-  check_get_passwd("u1_system", 101000, TYPE_SYSTEM);
+TEST(pwd, getpwnam_app_id_u1_root) {
+  check_get_passwd("u1_root", 100000, TYPE_SYSTEM);
+}
+
+TEST(pwd, getpwnam_app_id_u1_radio) {
   check_get_passwd("u1_radio", 101001, TYPE_SYSTEM);
+}
 
+TEST(pwd, getpwnam_app_id_u1_a0) {
   check_get_passwd("u1_a0", 110000, TYPE_APP);
-  check_get_passwd("u1_a1234", 111234, TYPE_APP);
-  check_get_passwd("u1_a9999", 119999, TYPE_APP);
-
-  check_get_passwd("u1_i1", 190001, TYPE_APP);
-  check_get_passwd("u1_i4545", 194545, TYPE_APP);
-  check_get_passwd("u1_i9999", 199999, TYPE_APP);
 }
 
-TEST(pwd, getpwnam_app_id_u31_ids) {
-  check_get_passwd("u31_system", 3101000, TYPE_SYSTEM);
-  check_get_passwd("u31_radio", 3101001, TYPE_SYSTEM);
-
-  check_get_passwd("u31_a0", 3110000, TYPE_APP);
-  check_get_passwd("u31_a1234", 3111234, TYPE_APP);
-  check_get_passwd("u31_a9999", 3119999, TYPE_APP);
-
-  check_get_passwd("u31_i1", 3190001, TYPE_APP);
-  check_get_passwd("u31_i4545", 3194545, TYPE_APP);
-  check_get_passwd("u31_i9999", 3199999, TYPE_APP);
+TEST(pwd, getpwnam_app_id_u1_a40000) {
+  check_get_passwd("u1_a40000", 150000, TYPE_APP);
 }
 
-TEST(pwd, getpwnam_app_id_not_allowed_platform) {
-  expect_no_passwd_name("u1_root");
-  expect_no_passwd_name("u1_debuggerd");
-
-  expect_no_passwd_name("u31_root");
-  expect_no_passwd_name("u31_debuggerd");
+TEST(pwd, getpwnam_app_id_u1_i0) {
+  check_get_passwd("u1_i0", 190000, TYPE_APP);
 }
-
-TEST(pwd, getpwuid_app_id_u1_non_exist) {
-  expect_no_passwd_id(100000);  // There is no 'root' for secondary users.
-  expect_no_passwd_id(101999);  // End of the system reserved range, unallocated.
-  expect_no_passwd_id(102900);  // The OEM ranges were never allocated to secondary users.
-  expect_no_passwd_id(105000);  // The OEM ranges were never allocated to secondary users.
-
-  // These ranges are for GIDs only.
-  expect_no_passwd_id(120000);
-  expect_no_passwd_id(130000);
-  expect_no_passwd_id(140000);
-  expect_no_passwd_id(150000);
-}
-
-TEST(pwd, getpwuid_app_id_u31_non_exist) {
-  expect_no_passwd_id(3100000);  // There is no 'root' for secondary users.
-  expect_no_passwd_id(3101999);  // End of the system reserved range, unallocated.
-  expect_no_passwd_id(3102900);  // The OEM ranges were never allocated to secondary users.
-  expect_no_passwd_id(3105000);  // The OEM ranges were never allocated to secondary users.
-
-  // These ranges are for GIDs only.
-  expect_no_passwd_id(3120000);
-  expect_no_passwd_id(3130000);
-  expect_no_passwd_id(3140000);
-  expect_no_passwd_id(3150000);
-}
-
-TEST(pwd, getpwnam_r_alignment) {
-#if defined(__BIONIC__)
-  passwd pwd_storage;
-  alignas(16) char buf[512];
-  passwd* pwd;
-  int result = getpwnam_r("root", &pwd_storage, buf + 1, sizeof(buf) - 1, &pwd);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd, "root", 0, TYPE_SYSTEM, true);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(pwd, getpwuid_r_alignment) {
-#if defined(__BIONIC__)
-  passwd pwd_storage;
-  alignas(16) char buf[512];
-  passwd* pwd;
-  int result = getpwuid_r(0, &pwd_storage, buf + 1, sizeof(buf) - 1, &pwd);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd, "root", 0, TYPE_SYSTEM, true);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(pwd, getpwnam_r_reentrancy) {
-#if defined(__BIONIC__)
-  passwd pwd_storage[2];
-  char buf[2][512];
-  passwd* pwd[3];
-  int result = getpwnam_r("root", &pwd_storage[0], buf[0], sizeof(buf[0]), &pwd[0]);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd[0], "root", 0, TYPE_SYSTEM, true);
-  pwd[1] = getpwnam("system");
-  ASSERT_NE(nullptr, pwd[1]);
-  check_passwd(pwd[1], "system", 1000, TYPE_SYSTEM, true);
-  result = getpwnam_r("radio", &pwd_storage[1], buf[1], sizeof(buf[1]), &pwd[2]);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd[2], "radio", 1001, TYPE_SYSTEM, true);
-  check_passwd(pwd[0], "root", 0, TYPE_SYSTEM, true);
-  check_passwd(pwd[1], "system", 1000, TYPE_SYSTEM, true);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(pwd, getpwuid_r_reentrancy) {
-#if defined(__BIONIC__)
-  passwd pwd_storage[2];
-  char buf[2][512];
-  passwd* pwd[3];
-  int result = getpwuid_r(0, &pwd_storage[0], buf[0], sizeof(buf[0]), &pwd[0]);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd[0], "root", 0, TYPE_SYSTEM, true);
-  pwd[1] = getpwuid(1000);
-  ASSERT_NE(nullptr, pwd[1]);
-  check_passwd(pwd[1], "system", 1000, TYPE_SYSTEM, true);
-  result = getpwuid_r(1001, &pwd_storage[1], buf[1], sizeof(buf[1]), &pwd[2]);
-  ASSERT_EQ(0, result);
-  check_passwd(pwd[2], "radio", 1001, TYPE_SYSTEM, true);
-  check_passwd(pwd[0], "root", 0, TYPE_SYSTEM, true);
-  check_passwd(pwd[1], "system", 1000, TYPE_SYSTEM, true);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(pwd, getpwnam_r_large_enough_suggested_buffer_size) {
-#if defined(__BIONIC__)
-  long size = sysconf(_SC_GETPW_R_SIZE_MAX);
-  ASSERT_GT(size, 0);
-  char buf[size];
-  passwd pwd_storage;
-  passwd* pwd;
-  ASSERT_EQ(0, getpwnam_r("root", &pwd_storage, buf, size, &pwd));
-  check_passwd(pwd, "root", 0, TYPE_SYSTEM, true);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
 #if defined(__BIONIC__)
 template <typename T>
-static void expect_ids(T ids, bool is_group) {
+static void expect_ids(const T& ids) {
   std::set<typename T::key_type> expected_ids;
   // Ensure that all android_ids are iterated through.
   for (size_t n = 0; n < android_id_count; ++n) {
@@ -397,12 +238,10 @@
   expect_range(AID_OEM_RESERVED_START, AID_OEM_RESERVED_END);
   expect_range(AID_OEM_RESERVED_2_START, AID_OEM_RESERVED_2_END);
   expect_range(AID_APP_START, AID_APP_END);
-  if (is_group) {
-    expect_range(AID_CACHE_GID_START, AID_CACHE_GID_END);
-    expect_range(AID_EXT_GID_START, AID_EXT_GID_END);
-    expect_range(AID_EXT_CACHE_GID_START, AID_EXT_CACHE_GID_END);
-    expect_range(AID_SHARED_GID_START, AID_SHARED_GID_END);
-  }
+  expect_range(AID_CACHE_GID_START, AID_CACHE_GID_END);
+  expect_range(AID_EXT_GID_START, AID_EXT_GID_END);
+  expect_range(AID_EXT_CACHE_GID_START, AID_EXT_CACHE_GID_END);
+  expect_range(AID_SHARED_GID_START, AID_SHARED_GID_END);
   expect_range(AID_ISOLATED_START, AID_ISOLATED_END);
 
   // TODO(73062966): We still don't have a good way to create vendor AIDs in the system or other
@@ -411,14 +250,6 @@
     return;
   }
 
-  auto allow_range = [&ids](uid_t start, uid_t end) {
-    for (size_t n = start; n <= end; ++n) {
-      ids.erase(n);
-    }
-  };
-
-  allow_range(AID_SYSTEM_RESERVED_START, AID_SYSTEM_EXT_RESERVED_END);
-
   // Ensure that no other ids were returned.
   auto return_differences = [&ids, &expected_ids] {
     std::vector<typename T::key_type> missing_from_ids;
@@ -474,7 +305,7 @@
   }
   endpwent();
 
-  expect_ids(uids, false);
+  expect_ids(uids);
 #else
   GTEST_SKIP() << "bionic-only test";
 #endif
@@ -539,41 +370,12 @@
 }
 
 static void check_get_group(const char* group_name, gid_t gid, bool check_groupname = true) {
-  SCOPED_TRACE("groupname '"s + group_name + "'");
   check_getgrgid(group_name, gid, check_groupname);
   check_getgrnam(group_name, gid, check_groupname);
   check_getgrgid_r(group_name, gid, check_groupname);
   check_getgrnam_r(group_name, gid, check_groupname);
 }
 
-static void expect_no_group_id(gid_t gid) {
-  SCOPED_TRACE("gid '" + std::to_string(gid) + "'");
-  errno = 0;
-  group* group = nullptr;
-  group = getgrgid(gid);
-  EXPECT_EQ(nullptr, group) << "name = '" << group->gr_name << "'";
-  EXPECT_EQ(ENOENT, errno);
-
-  struct group group_storage;
-  char buf[512];
-  EXPECT_EQ(ENOENT, getgrgid_r(gid, &group_storage, buf, sizeof(buf), &group));
-  EXPECT_EQ(nullptr, group) << "name = '" << group->gr_name << "'";
-}
-
-static void expect_no_group_name(const char* groupname) {
-  SCOPED_TRACE("groupname '"s + groupname + "'");
-  errno = 0;
-  group* group = nullptr;
-  group = getgrnam(groupname);
-  EXPECT_EQ(nullptr, group) << "name = '" << group->gr_name << "'";
-  EXPECT_EQ(ENOENT, errno);
-
-  struct group group_storage;
-  char buf[512];
-  EXPECT_EQ(ENOENT, getgrnam_r(groupname, &group_storage, buf, sizeof(buf), &group));
-  EXPECT_EQ(nullptr, group) << "name = '" << group->gr_name << "'";
-}
-
 #else // !defined(__BIONIC__)
 
 static void check_get_group(const char*, gid_t, bool) {
@@ -584,170 +386,95 @@
   GTEST_SKIP() << "bionic-only test";
 }
 
-static void expect_no_group_id(gid_t /* gid */) {
-  GTEST_SKIP() << "bionic-only test";
-}
-
-static void expect_no_group_name(const char* /* groupname */) {
-  GTEST_SKIP() << "bionic-only test";
-}
-
 #endif
 
-TEST(grp, getgrnam_platform_ids) {
+TEST(grp, getgrnam_system_id_root) {
   check_get_group("root", 0);
-  check_get_group("daemon", 1);
-  check_get_group("bin", 2);
-
-  check_get_group("system", 1000);
-  check_get_group("radio", 1001);
-
-  check_get_group("shell", 2000);
-
-  check_get_group("nobody", 9999);
 }
 
-TEST(grp, getgrnam_oem_ids) {
-  check_get_group("oem_2900", 2900, false);
-  check_get_group("oem_2945", 2945, false);
-  check_get_group("oem_2999", 2999, false);
+TEST(grp, getgrnam_system_id_system) {
+  check_get_group("system", 1000);
+}
+
+TEST(grp, getgrnam_app_id_radio) {
+  check_get_group("radio", 1001);
+}
+
+TEST(grp, getgrnam_oem_id_5000) {
   check_get_group("oem_5000", 5000, false);
-  check_get_group("oem_5454", 5454, false);
+}
+
+TEST(grp, getgrnam_oem_id_5999) {
   check_get_group("oem_5999", 5999, false);
 }
 
-TEST(grp, getgrnam_non_exist) {
-  expect_no_passwd_id(999);   // End of the system reserved range, unallocated.
-  expect_no_passwd_id(1999);  // End of the system reserved range, unallocated.
-  expect_no_passwd_id(2899);  // End of the system reserved range, unallocated.
+TEST(grp, getgrnam_oem_id_2900) {
+  check_get_group("oem_2900", 2900, false);
 }
 
-TEST(grp, getgrnam_u0_app_ids) {
+TEST(grp, getgrnam_oem_id_2999) {
+  check_get_group("oem_2999", 2999, false);
+}
+
+TEST(grp, getgrnam_app_id_nobody) {
+  check_get_group("nobody", 9999);
+}
+
+TEST(grp, getgrnam_app_id_u0_a0) {
   check_get_group("u0_a0", 10000);
+}
+
+TEST(grp, getgrnam_app_id_u0_a1234) {
   check_get_group("u0_a1234", 11234);
+}
+
+TEST(grp, getgrnam_app_id_u0_a9999) {
   check_get_group("u0_a9999", 19999);
+}
 
+TEST(getgrnam, app_id_u0_a0_cache) {
   check_get_group("u0_a0_cache", 20000);
+}
+
+TEST(getgrnam, app_id_u0_a1234_cache) {
   check_get_group("u0_a1234_cache", 21234);
+}
+
+TEST(getgrnam, app_id_u0_a9999_cache) {
   check_get_group("u0_a9999_cache", 29999);
+}
 
-  check_get_group("u0_a0_ext", 30000);
-  check_get_group("u0_a4545_ext", 34545);
-  check_get_group("u0_a9999_ext", 39999);
+TEST(getgrnam, app_id_u10_a1234_cache) {
+  check_get_group("u10_a1234_cache", 1021234);
+}
 
-  check_get_group("u0_a0_ext_cache", 40000);
-  check_get_group("u0_a4545_ext_cache", 44545);
-  check_get_group("u0_a9999_ext_cache", 49999);
-
-  check_get_group("all_a0", 50000);
-  check_get_group("all_a4545", 54545);
+// Test the difference between uid and shared gid.
+TEST(grp, getgrnam_app_id_all_a9999) {
   check_get_group("all_a9999", 59999);
+}
 
+TEST(grp, getgrnam_app_id_u0_i1) {
   check_get_group("u0_i1", 90001);
 }
 
-TEST(grp, getgrnam_u1_app_ids) {
-  check_get_group("u1_system", 101000);
+TEST(grp, getgrnam_app_id_u1_root) {
+  check_get_group("u1_root", 100000);
+}
+
+TEST(grp, getgrnam_app_id_u1_radio) {
   check_get_group("u1_radio", 101001);
+}
 
+TEST(grp, getgrnam_app_id_u1_a0) {
   check_get_group("u1_a0", 110000);
-  check_get_group("u1_a1234", 111234);
-  check_get_group("u1_a9999", 119999);
-
-  check_get_group("u1_a0_cache", 120000);
-  check_get_group("u1_a1234_cache", 121234);
-  check_get_group("u1_a9999_cache", 129999);
-
-  check_get_group("u1_a0_ext", 130000);
-  check_get_group("u1_a4545_ext", 134545);
-  check_get_group("u1_a9999_ext", 139999);
-
-  check_get_group("u1_a0_ext_cache", 140000);
-  check_get_group("u1_a4545_ext_cache", 144545);
-  check_get_group("u1_a9999_ext_cache", 149999);
-
-  check_get_group("u1_i1", 190001);
 }
 
-TEST(grp, getgrnam_u31_app_ids) {
-  check_get_group("u31_system", 3101000);
-  check_get_group("u31_radio", 3101001);
-
-  check_get_group("u31_a0", 3110000);
-  check_get_group("u31_a1234", 3111234);
-  check_get_group("u31_a9999", 3119999);
-
-  check_get_group("u31_a0_cache", 3120000);
-  check_get_group("u31_a1234_cache", 3121234);
-  check_get_group("u31_a9999_cache", 3129999);
-
-  check_get_group("u31_a0_cache", 3120000);
-  check_get_group("u31_a1234_cache", 3121234);
-  check_get_group("u31_a9999_cache", 3129999);
-
-  check_get_group("u31_a0_ext", 3130000);
-  check_get_group("u31_a4545_ext", 3134545);
-  check_get_group("u31_a9999_ext", 3139999);
-
-  check_get_group("u31_a0_ext_cache", 3140000);
-  check_get_group("u31_a4545_ext_cache", 3144545);
-  check_get_group("u31_a9999_ext_cache", 3149999);
-
-  check_get_group("u31_i1", 3190001);
+TEST(grp, getgrnam_app_id_u1_a40000) {
+  check_get_group("u1_a40000", 150000);
 }
 
-TEST(grp, getpgram_app_id_not_allowed_platform) {
-  expect_no_group_name("u1_root");
-  expect_no_group_name("u1_debuggerd");
-
-  expect_no_group_name("u31_root");
-  expect_no_group_name("u31_debuggerd");
-}
-
-TEST(grp, getgrgid_app_id_u1_non_exist) {
-  expect_no_group_id(100000);  // There is no 'root' for secondary users.
-  expect_no_group_id(101999);  // End of the system reserved range, unallocated.
-  expect_no_group_id(102900);  // The OEM ranges were never allocated to secondary users.
-  expect_no_group_id(105000);  // The OEM ranges were never allocated to secondary users.
-
-  // The shared range is shared among users, and therefore doesn't exist for secondary users.
-  expect_no_group_id(150000);
-}
-
-TEST(grp, getgrgid_app_id_u31_non_exist) {
-  expect_no_group_id(3100000);  // There is no 'root' for secondary users.
-  expect_no_group_id(3101999);  // End of the system reserved range, unallocated.
-  expect_no_group_id(3102900);  // The OEM ranges were never allocated to secondary users.
-  expect_no_group_id(3105000);  // The OEM ranges were never allocated to secondary users.
-
-  // The shared range is shared among users, and therefore doesn't exist for secondary users.
-  expect_no_group_id(3150000);
-}
-
-TEST(grp, getgrnam_r_alignment) {
-#if defined(__BIONIC__)
-  group grp_storage;
-  alignas(16) char buf[512];
-  group* grp;
-  int result = getgrnam_r("root", &grp_storage, buf + 1, sizeof(buf) - 1, &grp);
-  ASSERT_EQ(0, result);
-  check_group(grp, "root", 0);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(grp, getgrgid_r_alignment) {
-#if defined(__BIONIC__)
-  group grp_storage;
-  alignas(16) char buf[512];
-  group* grp;
-  int result = getgrgid_r(0, &grp_storage, buf + 1, sizeof(buf) - 1, &grp);
-  ASSERT_EQ(0, result);
-  check_group(grp, "root", 0);
-#else
-  GTEST_SKIP() << "bionic-only test";
-#endif
+TEST(grp, getgrnam_app_id_u1_i0) {
+  check_get_group("u1_i0", 190000);
 }
 
 TEST(grp, getgrnam_r_reentrancy) {
@@ -824,7 +551,7 @@
   }
   endgrent();
 
-  expect_ids(gids, true);
+  expect_ids(gids);
 #else
   GTEST_SKIP() << "bionic-only test";
 #endif
diff --git a/tests/headers/posix/threads_h.c b/tests/headers/posix/threads_h.c
deleted file mode 100644
index c9329f4..0000000
--- a/tests/headers/posix/threads_h.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2019 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 __has_include(<threads.h>)
-
-#include <threads.h>
-
-#include "header_checks.h"
-
-thread_local int t;
-
-static void threads_h() {
-  MACRO(ONCE_FLAG_INIT);
-  MACRO(TSS_DTOR_ITERATIONS);
-
-  TYPE(cnd_t);
-  TYPE(thrd_t);
-  TYPE(tss_t);
-  TYPE(mtx_t);
-
-  TYPE(tss_dtor_t);
-  TYPE(thrd_start_t);
-
-  TYPE(once_flag);
-
-  int enumeration_constants = mtx_plain | mtx_recursive | mtx_timed |
-      thrd_timedout | thrd_success | thrd_busy | thrd_error | thrd_nomem;
-
-  FUNCTION(call_once, void (*f)(once_flag*, void (*)(void)));
-
-  FUNCTION(cnd_broadcast, int (*f)(cnd_t*));
-  FUNCTION(cnd_destroy, void (*f)(cnd_t*));
-  FUNCTION(cnd_init, int (*f)(cnd_t*));
-  FUNCTION(cnd_signal, int (*f)(cnd_t*));
-  FUNCTION(cnd_timedwait, int (*f)(cnd_t*, mtx_t*, const struct timespec*));
-  FUNCTION(cnd_wait, int (*f)(cnd_t*, mtx_t*));
-
-  FUNCTION(mtx_destroy, void (*f)(mtx_t*));
-  FUNCTION(mtx_init, int (*f)(mtx_t*, int));
-  FUNCTION(mtx_lock, int (*f)(mtx_t*));
-  FUNCTION(mtx_timedlock, int (*f)(mtx_t*, const struct timespec*));
-  FUNCTION(mtx_trylock, int (*f)(mtx_t*));
-  FUNCTION(mtx_unlock, int (*f)(mtx_t*));
-
-  FUNCTION(thrd_create, int (*f)(thrd_t*, thrd_start_t, void*));
-  FUNCTION(thrd_current, thrd_t (*f)(void));
-  FUNCTION(thrd_detach, int (*f)(thrd_t));
-  FUNCTION(thrd_equal, int (*f)(thrd_t, thrd_t));
-  FUNCTION(thrd_exit, void (*f)(int));
-  FUNCTION(thrd_join, int (*f)(thrd_t, int*));
-  FUNCTION(thrd_sleep, int (*f)(const struct timespec*, struct timespec*));
-  FUNCTION(thrd_yield, void (*f)(void));
-
-  FUNCTION(tss_create, int (*f)(tss_t*, tss_dtor_t));
-  FUNCTION(tss_delete, void (*f)(tss_t));
-  FUNCTION(tss_get, void* (*f)(tss_t));
-  FUNCTION(tss_set, int (*f)(tss_t, void*));
-}
-
-#define DO_NOT_INCLUDE_TIME_H
-#include "time_h.c"
-
-#endif
diff --git a/tests/ifunc_test.cpp b/tests/ifunc_test.cpp
index e69271f..7ab5899 100644
--- a/tests/ifunc_test.cpp
+++ b/tests/ifunc_test.cpp
@@ -16,19 +16,12 @@
 
 #include <gtest/gtest.h>
 
-#include <sys/auxv.h>
-#if defined(__BIONIC__)
-#include <sys/ifunc.h>
-#endif
-
-typedef int (*fn_ptr_t)();
-
 int ret42() {
   return 42;
 }
 
-extern "C" fn_ptr_t resolver() {
-  return ret42;
+extern "C" void* resolver() {
+  return (void*)ret42;
 }
 
 int ifunc() __attribute__((ifunc("resolver")));
@@ -36,51 +29,3 @@
 TEST(ifunc, function) {
   ASSERT_EQ(42, ifunc());
 }
-
-#if defined(__BIONIC__)
-
-#if defined(__aarch64__)
-
-static uint64_t g_hwcap;
-static __ifunc_arg_t g_arg;
-
-extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg) {
-  g_hwcap = hwcap;
-  g_arg = *arg;
-  return ret42;
-}
-
-#elif defined(__arm__)
-
-static unsigned long g_hwcap;
-
-extern "C" fn_ptr_t hwcap_resolver(unsigned long hwcap) {
-  g_hwcap = hwcap;
-  return ret42;
-}
-
-#else
-
-extern "C" fn_ptr_t hwcap_resolver() {
-  return ret42;
-}
-
-#endif
-
-int hwcap() __attribute__((ifunc("hwcap_resolver")));
-
-TEST(ifunc, hwcap) {
-  ASSERT_EQ(42, hwcap());
-
-#if defined(__aarch64__)
-  EXPECT_EQ(getauxval(AT_HWCAP) | _IFUNC_ARG_HWCAP, g_hwcap);
-
-  EXPECT_EQ(sizeof(__ifunc_arg_t), g_arg._size);
-  EXPECT_EQ(getauxval(AT_HWCAP), g_arg._hwcap);
-  EXPECT_EQ(getauxval(AT_HWCAP2), g_arg._hwcap2);
-#elif defined(__arm__)
-  EXPECT_EQ(getauxval(AT_HWCAP), g_hwcap);
-#endif
-}
-
-#endif  // defined(__BIONIC__)
diff --git a/tests/leak_test.cpp b/tests/leak_test.cpp
index e0a3d57..1fa9e56 100644
--- a/tests/leak_test.cpp
+++ b/tests/leak_test.cpp
@@ -17,7 +17,6 @@
 #include <err.h>
 #include <inttypes.h>
 #include <pthread.h>
-#include <sched.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
@@ -31,28 +30,26 @@
 #include <vector>
 
 #include <android-base/macros.h>
-#include <android-base/threads.h>
 
 #include "utils.h"
 
 using namespace std::chrono_literals;
 
-static void WaitUntilAllThreadsExited(pid_t* tids, size_t tid_count) {
+static void WaitUntilAllExited(pid_t* pids, size_t pid_count) {
   // Wait until all children have exited.
   bool alive = true;
   while (alive) {
     alive = false;
-    for (size_t i = 0; i < tid_count; ++i) {
-      if (tids[i] != 0) {
-        if (tgkill(getpid(), tids[i], 0) == 0) {
+    for (size_t i = 0; i < pid_count; ++i) {
+      if (pids[i] != 0) {
+        if (kill(pids[i], 0) == 0) {
           alive = true;
         } else {
           EXPECT_EQ(errno, ESRCH);
-          tids[i] = 0;  // Skip in next loop.
+          pids[i] = 0;  // Skip in next loop.
         }
       }
     }
-    sched_yield();
   }
 }
 
@@ -128,19 +125,16 @@
 TEST(pthread_leak, detach) {
   LeakChecker lc;
 
-  // Ancient devices with only 2 cores need a lower limit.
-  // http://b/129924384 and https://issuetracker.google.com/142210680.
-  const int thread_count = (sysconf(_SC_NPROCESSORS_CONF) > 2) ? 100 : 50;
-
-  for (size_t pass = 0; pass < 1; ++pass) {
-    struct thread_data { pthread_barrier_t* barrier; pid_t* tid; } threads[thread_count];
+  for (size_t pass = 0; pass < 2; ++pass) {
+    constexpr int kThreadCount = 100;
+    struct thread_data { pthread_barrier_t* barrier; pid_t* tid; } threads[kThreadCount] = {};
 
     pthread_barrier_t barrier;
-    ASSERT_EQ(pthread_barrier_init(&barrier, nullptr, thread_count + 1), 0);
+    ASSERT_EQ(pthread_barrier_init(&barrier, nullptr, kThreadCount + 1), 0);
 
     // Start child threads.
-    pid_t tids[thread_count];
-    for (int i = 0; i < thread_count; ++i) {
+    pid_t tids[kThreadCount];
+    for (int i = 0; i < kThreadCount; ++i) {
       threads[i] = {&barrier, &tids[i]};
       const auto thread_function = +[](void* ptr) -> void* {
         thread_data* data = static_cast<thread_data*>(ptr);
@@ -156,7 +150,7 @@
     pthread_barrier_wait(&barrier);
     ASSERT_EQ(pthread_barrier_destroy(&barrier), 0);
 
-    WaitUntilAllThreadsExited(tids, thread_count);
+    WaitUntilAllExited(tids, arraysize(tids));
 
     // A native bridge implementation might need a warm up pass to reach a steady state.
     // http://b/37920774.
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index 98d4f25..422cd75 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -29,7 +29,7 @@
     gtest: false,
     sanitize: {
         address: false,
-        fuzzer: false,
+        coverage: false,
     },
     stl: "libc++_static",
     target: {
diff --git a/tests/libs/bionic_tests_zipalign.cpp b/tests/libs/bionic_tests_zipalign.cpp
index adb731f..56183ba 100644
--- a/tests/libs/bionic_tests_zipalign.cpp
+++ b/tests/libs/bionic_tests_zipalign.cpp
@@ -37,20 +37,21 @@
   fprintf(stderr, "    The output zip file that will be created from the input file.\n");
 }
 
-using ZipData = std::pair<std::unique_ptr<ZipEntry>, std::string>;
+using ZipData = std::pair<std::unique_ptr<ZipEntry>, std::unique_ptr<ZipString>>;
 
 static bool GetEntries(ZipArchiveHandle handle, std::vector<ZipData>* entries) {
   void* cookie;
-  int32_t return_value = StartIteration(handle, &cookie);
+  int32_t return_value = StartIteration(handle, &cookie, nullptr, nullptr);
   if (return_value != 0) {
     fprintf(stderr, "Unable to iterate over entries: %s\n", ErrorCodeString(return_value));
     return false;
   }
 
   ZipEntry entry;
-  std::string name;
+  ZipString name;
   while ((return_value = Next(cookie, &entry, &name)) == 0) {
-    entries->emplace_back(std::make_pair(std::make_unique<ZipEntry>(entry), name));
+    entries->emplace_back(std::make_pair(std::make_unique<ZipEntry>(entry),
+                                         std::make_unique<ZipString>(name)));
   }
   if (return_value != -1) {
     fprintf(stderr, "Error while iterating over zip entries: %s\n", ErrorCodeString(return_value));
@@ -77,12 +78,13 @@
   int32_t error;
   for (auto& entry : entries) {
     ZipEntry* zip_entry = entry.first.get();
-    std::string& zip_name = entry.second;
+    ZipString* zip_str = entry.second.get();
 
     size_t flags = 0;
     if ((zip_entry->method & kCompressDeflated) != 0) {
       flags |= ZipWriter::kCompress;
     }
+    std::string zip_name(reinterpret_cast<const char*>(zip_str->name), zip_str->name_length);
     error = writer.StartAlignedEntry(zip_name.c_str(), flags, alignment);
     if (error != 0) {
       fprintf(stderr, "StartAlignedEntry failed: %s\n", ZipWriter::ErrorCodeString(error));
diff --git a/tests/libs/segment_gap_outer.lds b/tests/libs/segment_gap_outer.lds
index 0f175af..f326aab 100644
--- a/tests/libs/segment_gap_outer.lds
+++ b/tests/libs/segment_gap_outer.lds
@@ -1,14 +1,15 @@
 SECTIONS {
-  # This starts off fairly normal: rodata, text, dynamic, data, bss with
+  # This starts off fairly normal: rodata, text, data, relro, bss with
   # appropriate alignment between them.
   . = SIZEOF_HEADERS;
   .rodata : {}
   . = ALIGN(0x1000);
   .text : {}
   . = ALIGN(0x1000);
-  .dynamic : {}
-  . = ALIGN(0x1000);
   .data : {}
+  . = ALIGN(0x1000);
+  .data.rel.ro : {}
+  . = ALIGN(0x1000);
   .bss : {}
 
   # Now create the gap. We need a text segment first to prevent the linker from
@@ -21,6 +22,6 @@
   # Place end_of_gap at the end of the gap.
   . = 0x1000000;
   .bss.end_of_gap : {
-    *(.bss.*end_of_gap*);
+    *(.bss.end_of_gap);
   }
 }
diff --git a/tests/link_test.cpp b/tests/link_test.cpp
index 75bb4d6..cf5fc0b 100644
--- a/tests/link_test.cpp
+++ b/tests/link_test.cpp
@@ -28,7 +28,6 @@
 
 #include <gtest/gtest.h>
 
-#include <dlfcn.h>
 #include <link.h>
 #if __has_include(<sys/auxv.h>)
 #include <sys/auxv.h>
@@ -81,52 +80,6 @@
   ASSERT_EQ(0, dl_iterate_phdr(Functor::Callback, &f));
 }
 
-// Verify that the module load/unload counters from dl_iterate_phdr are incremented.
-TEST(link, dl_iterate_phdr_counters) {
-  struct Counters {
-    bool inited = false;
-    uint64_t adds = 0;
-    uint64_t subs = 0;
-  };
-
-  auto get_adds_subs = []() {
-    auto callback = [](dl_phdr_info* info, size_t size, void* data) {
-      Counters& counters = *static_cast<Counters*>(data);
-      EXPECT_GE(size, sizeof(dl_phdr_info));
-      if (!counters.inited) {
-        counters.inited = true;
-        counters.adds = info->dlpi_adds;
-        counters.subs = info->dlpi_subs;
-      } else {
-        // The counters have the same value for each module.
-        EXPECT_EQ(counters.adds, info->dlpi_adds);
-        EXPECT_EQ(counters.subs, info->dlpi_subs);
-      }
-      return 0;
-    };
-
-    Counters counters {};
-    EXPECT_EQ(0, dl_iterate_phdr(callback, &counters));
-    EXPECT_TRUE(counters.inited);
-    return counters;
-  };
-
-  // dlopen increments the 'adds' counter.
-  const auto before_dlopen = get_adds_subs();
-  void* const handle = dlopen("libtest_empty.so", RTLD_NOW);
-  ASSERT_NE(nullptr, handle);
-  const auto after_dlopen = get_adds_subs();
-  ASSERT_LT(before_dlopen.adds, after_dlopen.adds);
-  ASSERT_EQ(before_dlopen.subs, after_dlopen.subs);
-
-  // dlclose increments the 'subs' counter.
-  const auto before_dlclose = after_dlopen;
-  dlclose(handle);
-  const auto after_dlclose = get_adds_subs();
-  ASSERT_EQ(before_dlclose.adds, after_dlclose.adds);
-  ASSERT_LT(before_dlclose.subs, after_dlclose.subs);
-}
-
 struct ProgHdr {
   const ElfW(Phdr)* table;
   size_t size;
diff --git a/tests/make_fortify_compile_test.mk b/tests/make_fortify_compile_test.mk
deleted file mode 100644
index 8270f29..0000000
--- a/tests/make_fortify_compile_test.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-include $(CLEAR_VARS)
-
-LOCAL_ADDITIONAL_DEPENDENCIES := \
-    $(LOCAL_PATH)/Android.mk \
-    $(LOCAL_PATH)/touch-obj-on-success
-
-LOCAL_CXX := $(LOCAL_PATH)/touch-obj-on-success \
-    $(LLVM_PREBUILTS_PATH)/clang++ \
-
-LOCAL_CLANG := true
-LOCAL_MODULE := bionic-compile-time-tests$(FORTIFY_LEVEL)-clang++
-LOCAL_CPPFLAGS := -Wall -Wno-error
-LOCAL_CPPFLAGS += -fno-color-diagnostics -ferror-limit=10000 -Xclang -verify
-LOCAL_CPPFLAGS += -DCOMPILATION_TESTS=1 -Wformat-nonliteral
-LOCAL_CPPFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=$(FORTIFY_LEVEL)
-LOCAL_SRC_FILES := clang_fortify_tests.cpp
-
-include $(BUILD_STATIC_LIBRARY)
-
-FORTIFY_LEVEL :=
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 6a82eb6..9d4fe04 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -14,19 +14,16 @@
  * limitations under the License.
  */
 
+#include <stdint.h>
+#include <stdlib.h>
+#include <time.h>
+
 #include <gtest/gtest.h>
 
 #if defined(__BIONIC__)
 
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-
 #include <vector>
 
-#include <async_safe/log.h>
 #include <procinfo/process_map.h>
 
 #include "utils.h"
@@ -94,23 +91,16 @@
 static void VerifyPtrs(TestDataType* test_data) {
   test_data->total_allocated_bytes = 0;
 
-  // Find all of the maps that are from the native allocator.
-  auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
-    if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0) {
-      malloc_iterate(start, end - start, SavePointers, test_data);
-    }
-  };
-
-  std::vector<char> buffer(64 * 1024);
-
-  // Avoid doing allocations so that the maps don't change while looking
-  // for the pointers.
-  malloc_disable();
-  bool parsed = android::procinfo::ReadMapFileAsyncSafe("/proc/self/maps", buffer.data(),
-                                                        buffer.size(), callback);
-  malloc_enable();
-
-  ASSERT_TRUE(parsed) << "Failed to parse /proc/self/maps";
+  // Find all of the maps that are [anon:libc_malloc].
+  ASSERT_TRUE(android::procinfo::ReadMapFile(
+      "/proc/self/maps",
+      [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+        if (std::string(name) == "[anon:libc_malloc]") {
+          malloc_disable();
+          malloc_iterate(start, end - start, SavePointers, test_data);
+          malloc_enable();
+        }
+      }));
 
   for (size_t i = 0; i < test_data->allocs.size(); i++) {
     EXPECT_EQ(1UL, test_data->allocs[i].count) << "Failed on size " << test_data->allocs[i].size;
@@ -190,42 +180,16 @@
   SKIP_WITH_HWASAN;
   TestDataType test_data = {};
 
-  // Only attempt to get memory data for maps that are not from the native allocator.
-  auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
-    if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0) {
-      size_t total = test_data.total_allocated_bytes;
-      malloc_iterate(start, end - start, SavePointers, &test_data);
-      total = test_data.total_allocated_bytes - total;
-      if (total > 0) {
-        char buffer[256];
-        int len = 0;
-        if (name[0] != '\0') {
-          len = async_safe_format_buffer(buffer, sizeof(buffer), "Failed on map %s: %zu\n", name,
-                                         total);
-        } else {
-          len = async_safe_format_buffer(buffer, sizeof(buffer),
-                                         "Failed on map anon:<%" PRIx64 "-%" PRIx64 ">: %zu\n",
-                                         start, end, total);
+  // Find all of the maps that are not [anon:libc_malloc].
+  ASSERT_TRUE(android::procinfo::ReadMapFile(
+      "/proc/self/maps",
+      [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+        if (std::string(name) != "[anon:libc_malloc]") {
+          malloc_disable();
+          malloc_iterate(start, end - start, SavePointers, &test_data);
+          malloc_enable();
         }
-        if (len > 0) {
-          write(STDOUT_FILENO, buffer, len);
-        }
-      }
-    }
-  };
-
-  std::vector<char> buffer(64 * 1024);
-
-  // Need to make sure that there are no allocations while reading the
-  // maps. Otherwise, it might create a new map during this check and
-  // incorrectly think a map is empty while it actually includes real
-  // allocations.
-  malloc_disable();
-  bool parsed = android::procinfo::ReadMapFileAsyncSafe("/proc/self/maps", buffer.data(),
-                                                        buffer.size(), callback);
-  malloc_enable();
-
-  ASSERT_TRUE(parsed) << "Failed to parse /proc/self/maps";
+      }));
 
   ASSERT_EQ(0UL, test_data.total_allocated_bytes);
 #else
diff --git a/tests/malloc_stress_test.cpp b/tests/malloc_stress_test.cpp
deleted file mode 100644
index 6c5cc06..0000000
--- a/tests/malloc_stress_test.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-
-#include <inttypes.h>
-#include <malloc.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <thread>
-#include <vector>
-
-#include <android-base/strings.h>
-#if defined(__BIONIC__)
-#include <meminfo/procmeminfo.h>
-#include <procinfo/process_map.h>
-#endif
-
-TEST(malloc_stress, multiple_threads_forever) {
-  constexpr size_t kMaxThreads = 256;
-  constexpr size_t kAllocSize = 4096;
-#if defined(__BIONIC__)
-  uint64_t rss_min = UINT64_MAX;
-  uint64_t rss_max = 0;
-  uint64_t vss_min = UINT64_MAX;
-  uint64_t vss_max = 0;
-  ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
-#endif
-  uint64_t mallinfo_min = UINT64_MAX;
-  uint64_t mallinfo_max = 0;
-  for (size_t i = 0; ; i++) {
-    printf("Pass %zu\n", i);
-
-    std::vector<std::thread*> threads;
-    for (size_t i = 0; i < kMaxThreads; i++) {
-      threads.push_back(new std::thread([]() {
-        void* buf = malloc(4096);
-        if (buf == nullptr) {
-          printf("Failed to allocate memory\n");
-          _exit(1);
-        }
-        memset(buf, 0, kAllocSize);
-        sleep(1);
-        free(buf);
-      }));
-    }
-
-    for (auto thread : threads) {
-      thread->join();
-      delete thread;
-    }
-    threads.clear();
-
-#if defined(__BIONIC__)
-    android::meminfo::ProcMemInfo proc_mem(getpid());
-    const std::vector<android::meminfo::Vma>& maps = proc_mem.MapsWithoutUsageStats();
-    uint64_t rss_bytes = 0;
-    uint64_t vss_bytes = 0;
-    for (auto& vma : maps) {
-      if (vma.name == "[anon:libc_malloc]" || android::base::StartsWith(vma.name, "[anon:scudo:")) {
-        android::meminfo::Vma update_vma(vma);
-        ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma));
-        rss_bytes += update_vma.usage.rss;
-        vss_bytes += update_vma.usage.vss;
-      }
-    }
-    if (rss_bytes < rss_min) {
-      rss_min = rss_bytes;
-    }
-    if (rss_bytes > rss_max) {
-      rss_max = rss_bytes;
-    }
-    if (vss_bytes < vss_min) {
-      vss_min = vss_bytes;
-    }
-    if (vss_bytes > vss_max) {
-      vss_max = vss_bytes;
-    }
-    printf("RSS %" PRIu64 " %0.2fMB\n", rss_bytes, rss_bytes / (1024.0 * 1024.0));
-    printf("  Min %" PRIu64 " %0.2fMB\n", rss_min, rss_min / (1024.0 * 1024.0));
-    printf("  Max %" PRIu64 " %0.2fMB\n", rss_max, rss_max / (1024.0 * 1024.0));
-    printf("VSS %" PRIu64 " %0.2f MB\n", vss_bytes, vss_bytes / (1024.0 * 1024.0));
-    printf("  Min %" PRIu64 " %0.2fMB\n", vss_min, vss_min / (1024.0 * 1024.0));
-    printf("  Max %" PRIu64 " %0.2fMB\n", vss_max, vss_max / (1024.0 * 1024.0));
-#endif
-
-    size_t mallinfo_bytes = mallinfo().uordblks;
-    if (mallinfo_bytes < mallinfo_min) {
-      mallinfo_min = mallinfo_bytes;
-    }
-    if (mallinfo_bytes > mallinfo_max) {
-      mallinfo_max = mallinfo_bytes;
-    }
-    printf("Allocated memory %zu %0.2fMB\n", mallinfo_bytes, mallinfo_bytes / (1024.0 * 1024.0));
-    printf("  Min %" PRIu64 " %0.2fMB\n", mallinfo_min, mallinfo_min / (1024.0 * 1024.0));
-    printf("  Max %" PRIu64 " %0.2fMB\n", mallinfo_max, mallinfo_max / (1024.0 * 1024.0));
-  }
-}
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index ebbd247..983592f 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -33,8 +33,8 @@
 
 #include <android-base/file.h>
 
-#include "platform/bionic/malloc.h"
 #include "private/bionic_config.h"
+#include "private/bionic_malloc.h"
 #include "utils.h"
 
 #if defined(__BIONIC__)
@@ -312,72 +312,50 @@
 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
 extern "C" void* pvalloc(size_t);
 extern "C" void* valloc(size_t);
-#endif
 
 TEST(malloc, pvalloc_std) {
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   size_t pagesize = sysconf(_SC_PAGESIZE);
   void* ptr = pvalloc(100);
   ASSERT_TRUE(ptr != nullptr);
   ASSERT_TRUE((reinterpret_cast<uintptr_t>(ptr) & (pagesize-1)) == 0);
   ASSERT_LE(pagesize, malloc_usable_size(ptr));
   free(ptr);
-#else
-  GTEST_SKIP() << "pvalloc not supported.";
-#endif
 }
 
 TEST(malloc, pvalloc_overflow) {
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   ASSERT_EQ(nullptr, pvalloc(SIZE_MAX));
-#else
-  GTEST_SKIP() << "pvalloc not supported.";
-#endif
 }
 
 TEST(malloc, valloc_std) {
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   size_t pagesize = sysconf(_SC_PAGESIZE);
-  void* ptr = valloc(100);
+  void* ptr = pvalloc(100);
   ASSERT_TRUE(ptr != nullptr);
   ASSERT_TRUE((reinterpret_cast<uintptr_t>(ptr) & (pagesize-1)) == 0);
   free(ptr);
-#else
-  GTEST_SKIP() << "valloc not supported.";
-#endif
 }
 
 TEST(malloc, valloc_overflow) {
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   ASSERT_EQ(nullptr, valloc(SIZE_MAX));
-#else
-  GTEST_SKIP() << "valloc not supported.";
-#endif
 }
+#endif
 
 TEST(malloc, malloc_info) {
 #ifdef __BIONIC__
   SKIP_WITH_HWASAN; // hwasan does not implement malloc_info
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  FILE* fp = fdopen(tf.fd, "w+");
-  tf.release();
-  ASSERT_TRUE(fp != nullptr);
-  ASSERT_EQ(0, malloc_info(0, fp));
-  ASSERT_EQ(0, fclose(fp));
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
+  char* buf;
+  size_t bufsize;
+  FILE* memstream = open_memstream(&buf, &bufsize);
+  ASSERT_NE(nullptr, memstream);
+  ASSERT_EQ(0, malloc_info(0, memstream));
+  ASSERT_EQ(0, fclose(memstream));
 
   tinyxml2::XMLDocument doc;
-  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(contents.c_str()));
+  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(buf));
 
   auto root = doc.FirstChildElement();
   ASSERT_NE(nullptr, root);
   ASSERT_STREQ("malloc", root->Name());
-  std::string version(root->Attribute("version"));
-  if (version == "jemalloc-1") {
+  if (std::string(root->Attribute("version")) == "jemalloc-1") {
     // Verify jemalloc version of this data.
     ASSERT_STREQ("jemalloc-1", root->Attribute("version"));
 
@@ -410,9 +388,9 @@
       }
     }
   } else {
-    // Do not verify output for scudo or debug malloc.
-    ASSERT_TRUE(version == "scudo-1" || version == "debug-malloc-1")
-        << "Unknown version: " << version;
+    // Only verify that this is debug-malloc-1, the malloc debug unit tests
+    // verify the output.
+    ASSERT_STREQ("debug-malloc-1", root->Attribute("version"));
   }
 #endif
 }
@@ -421,28 +399,23 @@
 #ifdef __BIONIC__
   SKIP_WITH_HWASAN; // hwasan does not implement malloc_info
 
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  FILE* fp = fdopen(tf.fd, "w+");
-  tf.release();
-  ASSERT_TRUE(fp != nullptr);
+  char* buf;
+  size_t bufsize;
+  FILE* memstream = open_memstream(&buf, &bufsize);
+  ASSERT_NE(nullptr, memstream);
   size_t mallinfo_before_allocated_bytes = mallinfo().uordblks;
-  ASSERT_EQ(0, malloc_info(0, fp));
+  ASSERT_EQ(0, malloc_info(0, memstream));
   size_t mallinfo_after_allocated_bytes = mallinfo().uordblks;
-  ASSERT_EQ(0, fclose(fp));
-
-  std::string contents;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
+  ASSERT_EQ(0, fclose(memstream));
 
   tinyxml2::XMLDocument doc;
-  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(contents.c_str()));
+  ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(buf));
 
   size_t total_allocated_bytes = 0;
   auto root = doc.FirstChildElement();
   ASSERT_NE(nullptr, root);
   ASSERT_STREQ("malloc", root->Name());
-  std::string version(root->Attribute("version"));
-  if (version == "jemalloc-1") {
+  if (std::string(root->Attribute("version")) == "jemalloc-1") {
     // Verify jemalloc version of this data.
     ASSERT_STREQ("jemalloc-1", root->Attribute("version"));
 
@@ -469,9 +442,9 @@
     EXPECT_LE(mallinfo_before_allocated_bytes, total_allocated_bytes);
     EXPECT_GE(mallinfo_after_allocated_bytes, total_allocated_bytes);
   } else {
-    // Do not verify output for scudo or debug malloc.
-    ASSERT_TRUE(version == "scudo-1" || version == "debug-malloc-1")
-        << "Unknown version: " << version;
+    // Only verify that this is debug-malloc-1, the malloc debug unit tests
+    // verify the output.
+    ASSERT_STREQ("debug-malloc-1", root->Attribute("version"));
   }
 #endif
 }
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index d825738..0bf8e29 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -990,25 +990,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_rwlock_reader_wakeup_writer_clockwait) {
-#if defined(__BIONIC__)
-  timespec ts;
-  ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts));
-  ts.tv_sec += 1;
-  test_pthread_rwlock_reader_wakeup_writer([&](pthread_rwlock_t* lock) {
-    return pthread_rwlock_clockwrlock(lock, CLOCK_MONOTONIC, &ts);
-  });
-
-  ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts));
-  ts.tv_sec += 1;
-  test_pthread_rwlock_reader_wakeup_writer([&](pthread_rwlock_t* lock) {
-    return pthread_rwlock_clockwrlock(lock, CLOCK_REALTIME, &ts);
-  });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockwrlock not available";
-#endif  // __BIONIC__
-}
-
 static void test_pthread_rwlock_writer_wakeup_reader(std::function<int (pthread_rwlock_t*)> lock_function) {
   RwlockWakeupHelperArg wakeup_arg;
   ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, nullptr));
@@ -1057,25 +1038,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_rwlock_writer_wakeup_reader_clockwait) {
-#if defined(__BIONIC__)
-  timespec ts;
-  ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts));
-  ts.tv_sec += 1;
-  test_pthread_rwlock_writer_wakeup_reader([&](pthread_rwlock_t* lock) {
-    return pthread_rwlock_clockrdlock(lock, CLOCK_MONOTONIC, &ts);
-  });
-
-  ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts));
-  ts.tv_sec += 1;
-  test_pthread_rwlock_writer_wakeup_reader([&](pthread_rwlock_t* lock) {
-    return pthread_rwlock_clockrdlock(lock, CLOCK_REALTIME, &ts);
-  });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockrdlock not available";
-#endif  // __BIONIC__
-}
-
 static void pthread_rwlock_wakeup_timeout_helper(RwlockWakeupHelperArg* arg) {
   arg->tid = gettid();
   ASSERT_EQ(RwlockWakeupHelperArg::LOCK_INITIALIZED, arg->progress);
@@ -1136,38 +1098,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_rwlock_clockrdlock_monotonic_timeout) {
-#if defined(__BIONIC__)
-  pthread_rwlock_timedrdlock_timeout_helper(
-      CLOCK_MONOTONIC, [](pthread_rwlock_t* __rwlock, const timespec* __timeout) {
-        return pthread_rwlock_clockrdlock(__rwlock, CLOCK_MONOTONIC, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockrdlock not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_rwlock_clockrdlock_realtime_timeout) {
-#if defined(__BIONIC__)
-  pthread_rwlock_timedrdlock_timeout_helper(
-      CLOCK_REALTIME, [](pthread_rwlock_t* __rwlock, const timespec* __timeout) {
-        return pthread_rwlock_clockrdlock(__rwlock, CLOCK_REALTIME, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockrdlock not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_rwlock_clockrdlock_invalid) {
-#if defined(__BIONIC__)
-  pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
-  timespec ts;
-  EXPECT_EQ(EINVAL, pthread_rwlock_clockrdlock(&lock, CLOCK_PROCESS_CPUTIME_ID, &ts));
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockrdlock not available";
-#endif  // __BIONIC__
-}
-
 static void pthread_rwlock_timedwrlock_timeout_helper(
     clockid_t clock, int (*lock_function)(pthread_rwlock_t* __rwlock, const timespec* __timeout)) {
   RwlockWakeupHelperArg wakeup_arg;
@@ -1204,38 +1134,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_rwlock_clockwrlock_monotonic_timeout) {
-#if defined(__BIONIC__)
-  pthread_rwlock_timedwrlock_timeout_helper(
-      CLOCK_MONOTONIC, [](pthread_rwlock_t* __rwlock, const timespec* __timeout) {
-        return pthread_rwlock_clockwrlock(__rwlock, CLOCK_MONOTONIC, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockwrlock not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_rwlock_clockwrlock_realtime_timeout) {
-#if defined(__BIONIC__)
-  pthread_rwlock_timedwrlock_timeout_helper(
-      CLOCK_REALTIME, [](pthread_rwlock_t* __rwlock, const timespec* __timeout) {
-        return pthread_rwlock_clockwrlock(__rwlock, CLOCK_REALTIME, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockwrlock not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_rwlock_clockwrlock_invalid) {
-#if defined(__BIONIC__)
-  pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
-  timespec ts;
-  EXPECT_EQ(EINVAL, pthread_rwlock_clockwrlock(&lock, CLOCK_PROCESS_CPUTIME_ID, &ts));
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_rwlock_clockrwlock not available";
-#endif  // __BIONIC__
-}
-
 class RwlockKindTestHelper {
  private:
   struct ThreadArg {
@@ -1494,43 +1392,16 @@
     ASSERT_EQ(0, pthread_condattr_destroy(&attr));
   }
 
-  void StartWaitingThread(
-      std::function<int(pthread_cond_t* cond, pthread_mutex_t* mutex)> wait_function) {
+  void StartWaitingThread(std::function<int (pthread_cond_t* cond, pthread_mutex_t* mutex)> wait_function) {
     progress = INITIALIZED;
     this->wait_function = wait_function;
-    ASSERT_EQ(0, pthread_create(&thread, nullptr, reinterpret_cast<void* (*)(void*)>(WaitThreadFn),
-                                this));
+    ASSERT_EQ(0, pthread_create(&thread, nullptr, reinterpret_cast<void* (*)(void*)>(WaitThreadFn), this));
     while (progress != WAITING) {
       usleep(5000);
     }
     usleep(5000);
   }
 
-  void RunTimedTest(
-      clockid_t clock,
-      std::function<int(pthread_cond_t* cond, pthread_mutex_t* mutex, const timespec* timeout)>
-          wait_function) {
-    timespec ts;
-    ASSERT_EQ(0, clock_gettime(clock, &ts));
-    ts.tv_sec += 1;
-
-    StartWaitingThread([&wait_function, &ts](pthread_cond_t* cond, pthread_mutex_t* mutex) {
-      return wait_function(cond, mutex, &ts);
-    });
-
-    progress = SIGNALED;
-    ASSERT_EQ(0, pthread_cond_signal(&cond));
-  }
-
-  void RunTimedTest(clockid_t clock, std::function<int(pthread_cond_t* cond, pthread_mutex_t* mutex,
-                                                       clockid_t clock, const timespec* timeout)>
-                                         wait_function) {
-    RunTimedTest(clock, [clock, &wait_function](pthread_cond_t* cond, pthread_mutex_t* mutex,
-                                                const timespec* timeout) {
-      return wait_function(cond, mutex, clock, timeout);
-    });
-  }
-
   void TearDown() override {
     ASSERT_EQ(0, pthread_join(thread, nullptr));
     ASSERT_EQ(FINISHED, progress);
@@ -1571,80 +1442,52 @@
 
 TEST_F(pthread_CondWakeupTest, signal_timedwait_CLOCK_REALTIME) {
   InitCond(CLOCK_REALTIME);
-  RunTimedTest(CLOCK_REALTIME, pthread_cond_timedwait);
+  timespec ts;
+  ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts));
+  ts.tv_sec += 1;
+  StartWaitingThread([&](pthread_cond_t* cond, pthread_mutex_t* mutex) {
+    return pthread_cond_timedwait(cond, mutex, &ts);
+  });
+  progress = SIGNALED;
+  ASSERT_EQ(0, pthread_cond_signal(&cond));
 }
 
 TEST_F(pthread_CondWakeupTest, signal_timedwait_CLOCK_MONOTONIC) {
   InitCond(CLOCK_MONOTONIC);
-  RunTimedTest(CLOCK_MONOTONIC, pthread_cond_timedwait);
+  timespec ts;
+  ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts));
+  ts.tv_sec += 1;
+  StartWaitingThread([&](pthread_cond_t* cond, pthread_mutex_t* mutex) {
+    return pthread_cond_timedwait(cond, mutex, &ts);
+  });
+  progress = SIGNALED;
+  ASSERT_EQ(0, pthread_cond_signal(&cond));
 }
 
 TEST_F(pthread_CondWakeupTest, signal_timedwait_CLOCK_MONOTONIC_np) {
 #if defined(__BIONIC__)
   InitCond(CLOCK_REALTIME);
-  RunTimedTest(CLOCK_MONOTONIC, pthread_cond_timedwait_monotonic_np);
+  timespec ts;
+  ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts));
+  ts.tv_sec += 1;
+  StartWaitingThread([&](pthread_cond_t* cond, pthread_mutex_t* mutex) {
+    return pthread_cond_timedwait_monotonic_np(cond, mutex, &ts);
+  });
+  progress = SIGNALED;
+  ASSERT_EQ(0, pthread_cond_signal(&cond));
 #else   // __BIONIC__
   GTEST_SKIP() << "pthread_cond_timedwait_monotonic_np not available";
 #endif  // __BIONIC__
 }
 
-TEST_F(pthread_CondWakeupTest, signal_clockwait_monotonic_monotonic) {
-#if defined(__BIONIC__)
-  InitCond(CLOCK_MONOTONIC);
-  RunTimedTest(CLOCK_MONOTONIC, pthread_cond_clockwait);
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
-TEST_F(pthread_CondWakeupTest, signal_clockwait_monotonic_realtime) {
-#if defined(__BIONIC__)
-  InitCond(CLOCK_MONOTONIC);
-  RunTimedTest(CLOCK_REALTIME, pthread_cond_clockwait);
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
-TEST_F(pthread_CondWakeupTest, signal_clockwait_realtime_monotonic) {
-#if defined(__BIONIC__)
-  InitCond(CLOCK_REALTIME);
-  RunTimedTest(CLOCK_MONOTONIC, pthread_cond_clockwait);
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
-TEST_F(pthread_CondWakeupTest, signal_clockwait_realtime_realtime) {
-#if defined(__BIONIC__)
-  InitCond(CLOCK_REALTIME);
-  RunTimedTest(CLOCK_REALTIME, pthread_cond_clockwait);
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
-static void pthread_cond_timedwait_timeout_helper(bool init_monotonic, clockid_t clock,
+static void pthread_cond_timedwait_timeout_helper(clockid_t clock,
                                                   int (*wait_function)(pthread_cond_t* __cond,
                                                                        pthread_mutex_t* __mutex,
                                                                        const timespec* __timeout)) {
   pthread_mutex_t mutex;
   ASSERT_EQ(0, pthread_mutex_init(&mutex, nullptr));
   pthread_cond_t cond;
-
-  if (init_monotonic) {
-    pthread_condattr_t attr;
-    pthread_condattr_init(&attr);
-
-    ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC));
-    clockid_t clock;
-    ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock));
-    ASSERT_EQ(CLOCK_MONOTONIC, clock);
-
-    ASSERT_EQ(0, pthread_cond_init(&cond, &attr));
-  } else {
-    ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));
-  }
+  ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));
   ASSERT_EQ(0, pthread_mutex_lock(&mutex));
 
   timespec ts;
@@ -1661,57 +1504,17 @@
 }
 
 TEST(pthread, pthread_cond_timedwait_timeout) {
-  pthread_cond_timedwait_timeout_helper(false, CLOCK_REALTIME, pthread_cond_timedwait);
+  pthread_cond_timedwait_timeout_helper(CLOCK_REALTIME, pthread_cond_timedwait);
 }
 
 TEST(pthread, pthread_cond_timedwait_monotonic_np_timeout) {
 #if defined(__BIONIC__)
-  pthread_cond_timedwait_timeout_helper(false, CLOCK_MONOTONIC, pthread_cond_timedwait_monotonic_np);
-  pthread_cond_timedwait_timeout_helper(true, CLOCK_MONOTONIC, pthread_cond_timedwait_monotonic_np);
+  pthread_cond_timedwait_timeout_helper(CLOCK_MONOTONIC, pthread_cond_timedwait_monotonic_np);
 #else   // __BIONIC__
   GTEST_SKIP() << "pthread_cond_timedwait_monotonic_np not available";
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_cond_clockwait_timeout) {
-#if defined(__BIONIC__)
-  pthread_cond_timedwait_timeout_helper(
-      false, CLOCK_MONOTONIC,
-      [](pthread_cond_t* __cond, pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_cond_clockwait(__cond, __mutex, CLOCK_MONOTONIC, __timeout);
-      });
-  pthread_cond_timedwait_timeout_helper(
-      true, CLOCK_MONOTONIC,
-      [](pthread_cond_t* __cond, pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_cond_clockwait(__cond, __mutex, CLOCK_MONOTONIC, __timeout);
-      });
-  pthread_cond_timedwait_timeout_helper(
-      false, CLOCK_REALTIME,
-      [](pthread_cond_t* __cond, pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_cond_clockwait(__cond, __mutex, CLOCK_REALTIME, __timeout);
-      });
-  pthread_cond_timedwait_timeout_helper(
-      true, CLOCK_REALTIME,
-      [](pthread_cond_t* __cond, pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_cond_clockwait(__cond, __mutex, CLOCK_REALTIME, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_cond_clockwait_invalid) {
-#if defined(__BIONIC__)
-  pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-  pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-  timespec ts;
-  EXPECT_EQ(EINVAL, pthread_cond_clockwait(&cond, &mutex, CLOCK_PROCESS_CPUTIME_ID, &ts));
-
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_cond_clockwait not available";
-#endif  // __BIONIC__
-}
-
 TEST(pthread, pthread_attr_getstack__main_thread) {
   // This test is only meaningful for the main thread, so make sure we're running on it!
   ASSERT_EQ(getpid(), syscall(__NR_gettid));
@@ -2377,21 +2180,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_mutex_clocklock) {
-#if defined(__BIONIC__)
-  pthread_mutex_timedlock_helper(
-      CLOCK_MONOTONIC, [](pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_mutex_clocklock(__mutex, CLOCK_MONOTONIC, __timeout);
-      });
-  pthread_mutex_timedlock_helper(
-      CLOCK_REALTIME, [](pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_mutex_clocklock(__mutex, CLOCK_REALTIME, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_mutex_clocklock not available";
-#endif  // __BIONIC__
-}
-
 static void pthread_mutex_timedlock_pi_helper(clockid_t clock,
                                               int (*lock_function)(pthread_mutex_t* __mutex,
                                                                    const timespec* __timeout)) {
@@ -2443,31 +2231,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(pthread, pthread_mutex_clocklock_pi) {
-#if defined(__BIONIC__)
-  pthread_mutex_timedlock_pi_helper(
-      CLOCK_MONOTONIC, [](pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_mutex_clocklock(__mutex, CLOCK_MONOTONIC, __timeout);
-      });
-  pthread_mutex_timedlock_pi_helper(
-      CLOCK_REALTIME, [](pthread_mutex_t* __mutex, const timespec* __timeout) {
-        return pthread_mutex_clocklock(__mutex, CLOCK_REALTIME, __timeout);
-      });
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_mutex_clocklock not available";
-#endif  // __BIONIC__
-}
-
-TEST(pthread, pthread_mutex_clocklock_invalid) {
-#if defined(__BIONIC__)
-  pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-  timespec ts;
-  EXPECT_EQ(EINVAL, pthread_mutex_clocklock(&mutex, CLOCK_PROCESS_CPUTIME_ID, &ts));
-#else   // __BIONIC__
-  GTEST_SKIP() << "pthread_mutex_clocklock not available";
-#endif  // __BIONIC__
-}
-
 TEST(pthread, pthread_mutex_using_destroyed_mutex) {
 #if defined(__BIONIC__)
   pthread_mutex_t m;
@@ -2484,13 +2247,6 @@
               "pthread_mutex_timedlock called on a destroyed mutex");
   ASSERT_EXIT(pthread_mutex_timedlock_monotonic_np(&m, &ts), ::testing::KilledBySignal(SIGABRT),
               "pthread_mutex_timedlock_monotonic_np called on a destroyed mutex");
-  ASSERT_EXIT(pthread_mutex_clocklock(&m, CLOCK_MONOTONIC, &ts), ::testing::KilledBySignal(SIGABRT),
-              "pthread_mutex_clocklock called on a destroyed mutex");
-  ASSERT_EXIT(pthread_mutex_clocklock(&m, CLOCK_REALTIME, &ts), ::testing::KilledBySignal(SIGABRT),
-              "pthread_mutex_clocklock called on a destroyed mutex");
-  ASSERT_EXIT(pthread_mutex_clocklock(&m, CLOCK_PROCESS_CPUTIME_ID, &ts),
-              ::testing::KilledBySignal(SIGABRT),
-              "pthread_mutex_clocklock called on a destroyed mutex");
   ASSERT_EXIT(pthread_mutex_destroy(&m), ::testing::KilledBySignal(SIGABRT),
               "pthread_mutex_destroy called on a destroyed mutex");
 #else
diff --git a/tests/run-on-host.sh b/tests/run-on-host.sh
index fe2c25a..c8a30f5 100755
--- a/tests/run-on-host.sh
+++ b/tests/run-on-host.sh
@@ -20,7 +20,6 @@
 if [ ${HOST_OS}-${HOST_ARCH} = linux-x86 -o ${HOST_OS}-${HOST_ARCH} = linux-x86_64 ]; then
 
   prepare $1 bionic-unit-tests
-  shift
 
   if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
     (
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index 5a23b96..7addf6d 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -145,19 +145,6 @@
 #endif  // __BIONIC__
 }
 
-TEST(semaphore, sem_clockwait) {
-#if defined(__BIONIC__)
-  sem_timedwait_helper(CLOCK_MONOTONIC, [](sem_t* __sem, const timespec* __ts) {
-    return sem_clockwait(__sem, CLOCK_MONOTONIC, __ts);
-  });
-  sem_timedwait_helper(CLOCK_REALTIME, [](sem_t* __sem, const timespec* __ts) {
-    return sem_clockwait(__sem, CLOCK_REALTIME, __ts);
-  });
-#else   // __BIONIC__
-  GTEST_SKIP() << "sem_clockwait is only supported on bionic";
-#endif  // __BIONIC__
-}
-
 TEST(semaphore_DeathTest, sem_timedwait_null_timeout) {
   sem_t s;
   ASSERT_EQ(0, sem_init(&s, 0, 0));
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 6db7751..1ae174a 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -20,7 +20,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <chrono>
 #include <thread>
 
 #include <android-base/macros.h>
@@ -28,8 +27,6 @@
 
 #include "SignalUtils.h"
 
-using namespace std::chrono_literals;
-
 static int SIGNAL_MIN() {
   return 1; // Signals start at 1 (SIGHUP), not 0.
 }
@@ -756,6 +753,12 @@
   ASSERT_EQ(0, errno);
 }
 
+static int64_t NanoTime() {
+  timespec t;
+  clock_gettime(CLOCK_MONOTONIC, &t);
+  return static_cast<int64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;
+}
+
 TEST(signal, sigtimedwait_timeout) {
   // Block SIGALRM.
   sigset_t just_SIGALRM;
@@ -765,14 +768,13 @@
   ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, &original_set));
 
   // Wait timeout.
-  auto t0 = std::chrono::steady_clock::now();
+  int64_t start_time = NanoTime();
   siginfo_t info;
   timespec timeout = { .tv_sec = 0, .tv_nsec = 1000000 };
   errno = 0;
   ASSERT_EQ(-1, sigtimedwait(&just_SIGALRM, &info, &timeout));
   ASSERT_EQ(EAGAIN, errno);
-  auto t1 = std::chrono::steady_clock::now();
-  ASSERT_GE(t1-t0, 1000000ns);
+  ASSERT_GE(NanoTime() - start_time, 1000000);
 
   ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &original_set, nullptr));
 }
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 9911d64..d122d2f 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -15,11 +15,9 @@
  */
 
 #include <gtest/gtest.h>
-
-// The real <stdatomic.h> checks for the availability of C++'s atomics and uses them if present. Since
-// we want to test the libc versions, we instead include <bits/stdatomic.h> where they're actually defined.
-#include <bits/stdatomic.h>
-
+// Fool stdatomic.h into not using <atomic>.
+#undef _USING_LIBCXX
+#include <stdatomic.h>
 #include <pthread.h>
 #include <stdint.h>
 
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index a0cda1b..c237d6d 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -33,18 +33,10 @@
 #include <vector>
 
 #include <android-base/file.h>
-#include <android-base/unique_fd.h>
 
 #include "BionicDeathTest.h"
 #include "utils.h"
 
-// This #include is actually a test too. We have to duplicate the
-// definitions of the RENAME_ constants because <linux/fs.h> also contains
-// pollution such as BLOCK_SIZE which conflicts with lots of user code.
-// Important to check that we have matching definitions.
-// There's no _MAX to test that we have all the constants, sadly.
-#include <linux/fs.h>
-
 #if defined(NOFORTIFY)
 #define STDIO_TEST stdio_nofortify
 #define STDIO_DEATHTEST stdio_nofortify_DeathTest
@@ -2607,87 +2599,3 @@
   funlockfile(fp1);
   fclose(fp1);
 }
-
-TEST(STDIO_TEST, SEEK_macros) {
-  ASSERT_EQ(0, SEEK_SET);
-  ASSERT_EQ(1, SEEK_CUR);
-  ASSERT_EQ(2, SEEK_END);
-  ASSERT_EQ(3, SEEK_DATA);
-  ASSERT_EQ(4, SEEK_HOLE);
-  // So we'll notice if Linux grows another constant in <linux/fs.h>...
-  ASSERT_EQ(SEEK_MAX, SEEK_HOLE);
-}
-
-TEST(STDIO_TEST, rename) {
-  TemporaryDir td;
-  std::string old_path = td.path + "/old"s;
-  std::string new_path = td.path + "/new"s;
-
-  // Create the file, check it exists.
-  ASSERT_EQ(0, close(creat(old_path.c_str(), 0666)));
-  struct stat sb;
-  ASSERT_EQ(0, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(-1, stat(new_path.c_str(), &sb));
-
-  // Rename and check it moved.
-  ASSERT_EQ(0, rename(old_path.c_str(), new_path.c_str()));
-  ASSERT_EQ(-1, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(0, stat(new_path.c_str(), &sb));
-}
-
-TEST(STDIO_TEST, renameat) {
-  TemporaryDir td;
-  android::base::unique_fd dirfd{open(td.path, O_PATH)};
-  std::string old_path = td.path + "/old"s;
-  std::string new_path = td.path + "/new"s;
-
-  // Create the file, check it exists.
-  ASSERT_EQ(0, close(creat(old_path.c_str(), 0666)));
-  struct stat sb;
-  ASSERT_EQ(0, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(-1, stat(new_path.c_str(), &sb));
-
-  // Rename and check it moved.
-  ASSERT_EQ(0, renameat(dirfd, "old", dirfd, "new"));
-  ASSERT_EQ(-1, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(0, stat(new_path.c_str(), &sb));
-}
-
-TEST(STDIO_TEST, renameat2) {
-#if defined(__GLIBC__)
-  GTEST_SKIP() << "glibc doesn't have renameat2 until 2.28";
-#else
-  TemporaryDir td;
-  android::base::unique_fd dirfd{open(td.path, O_PATH)};
-  std::string old_path = td.path + "/old"s;
-  std::string new_path = td.path + "/new"s;
-
-  // Create the file, check it exists.
-  ASSERT_EQ(0, close(creat(old_path.c_str(), 0666)));
-  struct stat sb;
-  ASSERT_EQ(0, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(-1, stat(new_path.c_str(), &sb));
-
-  // Rename and check it moved.
-  ASSERT_EQ(0, renameat2(dirfd, "old", dirfd, "new", 0));
-  ASSERT_EQ(-1, stat(old_path.c_str(), &sb));
-  ASSERT_EQ(0, stat(new_path.c_str(), &sb));
-
-  // After this, both "old" and "new" exist.
-  ASSERT_EQ(0, close(creat(old_path.c_str(), 0666)));
-
-  // Rename and check it moved.
-  ASSERT_EQ(-1, renameat2(dirfd, "old", dirfd, "new", RENAME_NOREPLACE));
-  ASSERT_EQ(EEXIST, errno);
-#endif
-}
-
-TEST(STDIO_TEST, renameat2_flags) {
-#if defined(__GLIBC__)
-  GTEST_SKIP() << "glibc doesn't have renameat2 until 2.28";
-#else
- ASSERT_NE(0, RENAME_EXCHANGE);
- ASSERT_NE(0, RENAME_NOREPLACE);
- ASSERT_NE(0, RENAME_WHITEOUT);
-#endif
-}
diff --git a/tests/sys_mman_test.cpp b/tests/sys_mman_test.cpp
index e403ea5..0b98198 100644
--- a/tests/sys_mman_test.cpp
+++ b/tests/sys_mman_test.cpp
@@ -230,10 +230,7 @@
 TEST(sys_mman, mremap_PTRDIFF_MAX) {
   void* map = mmap(nullptr, PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   ASSERT_NE(MAP_FAILED, map);
-
   ASSERT_EQ(MAP_FAILED, mremap(map, PAGE_SIZE, kHuge, MREMAP_MAYMOVE));
-
-  ASSERT_EQ(0, munmap(map, PAGE_SIZE));
 }
 
 TEST(sys_mman, mmap_bug_27265969) {
@@ -242,61 +239,3 @@
   // Some kernels had bugs that would cause segfaults here...
   __builtin___clear_cache(base, base + (PAGE_SIZE * 2));
 }
-
-TEST(sys_mman, mlock) {
-  void* map = mmap(nullptr, PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  ASSERT_NE(MAP_FAILED, map);
-
-  // Not really anything we can assert about this.
-  mlock(map, PAGE_SIZE);
-
-  ASSERT_EQ(0, munmap(map, PAGE_SIZE));
-}
-
-TEST(sys_mman, mlock2) {
-#if defined(__GLIBC__)
-  GTEST_SKIP() << "needs glibc 2.27";
-#else
-  void* map = mmap(nullptr, PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  ASSERT_NE(MAP_FAILED, map);
-
-  // Not really anything we can assert about this.
-  mlock2(map, PAGE_SIZE, MLOCK_ONFAULT);
-
-  ASSERT_EQ(0, munmap(map, PAGE_SIZE));
-#endif
-}
-
-TEST(sys_mman, memfd_create) {
-#if defined(__GLIBC__)
-  GTEST_SKIP() << "needs glibc 2.27";
-#else
-  // Is the MFD_CLOEXEC flag obeyed?
-  errno = 0;
-  int fd = memfd_create("doesn't matter", 0);
-  if (fd == -1) {
-    ASSERT_EQ(ENOSYS, errno);
-    GTEST_SKIP() << "no memfd_create available";
-  }
-  int f = fcntl(fd, F_GETFD);
-  ASSERT_NE(-1, f);
-  ASSERT_FALSE(f & FD_CLOEXEC);
-  close(fd);
-
-  errno = 0;
-  fd = memfd_create("doesn't matter", MFD_CLOEXEC);
-  f = fcntl(fd, F_GETFD);
-  ASSERT_NE(-1, f);
-  ASSERT_TRUE(f & FD_CLOEXEC);
-
-  // Can we read and write?
-  std::string expected("hello, world!");
-  ASSERT_TRUE(android::base::WriteStringToFd(expected, fd));
-  ASSERT_EQ(0, lseek(fd, 0, SEEK_SET));
-  std::string actual;
-  ASSERT_TRUE(android::base::ReadFdToString(fd, &actual));
-  ASSERT_EQ(expected, actual);
-
-  close(fd);
-#endif
-}
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index 15e9a24..90539fe 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -176,9 +176,6 @@
   ASSERT_EQ(SIGSTOP, WSTOPSIG(status)) << "Status was: " << status;
 
   check_hw_feature_supported(child, HwFeature::Watchpoint);
-  if (::testing::Test::IsSkipped()) {
-    return;
-  }
 
   set_watchpoint(child, uintptr_t(untag_address(&data)) + offset, size);
 
@@ -227,10 +224,6 @@
     if (!CPU_ISSET(cpu, &available_cpus)) continue;
 
     run_watchpoint_stress<uint8_t>(cpu);
-    if (::testing::Test::IsSkipped()) {
-      // Only check first case, since all others would skip for same reason.
-      return;
-    }
     run_watchpoint_stress<uint16_t>(cpu);
     run_watchpoint_stress<uint32_t>(cpu);
 #if defined(__LP64__)
@@ -350,9 +343,6 @@
   ASSERT_EQ(SIGSTOP, WSTOPSIG(status)) << "Status was: " << status;
 
   check_hw_feature_supported(child, HwFeature::Breakpoint);
-  if (::testing::Test::IsSkipped()) {
-    return;
-  }
 
   set_breakpoint(child);
 
diff --git a/tests/system_properties_test2.cpp b/tests/system_properties_test2.cpp
index 0953bde..c061faa 100644
--- a/tests/system_properties_test2.cpp
+++ b/tests/system_properties_test2.cpp
@@ -14,23 +14,21 @@
  * limitations under the License.
  */
 
+#include <gtest/gtest.h>
+
 #include <errno.h>
 #include <sys/wait.h>
 #include <unistd.h>
-
-#include <chrono>
 #include <sstream>
 #include <string>
 
-#include <gtest/gtest.h>
-
-#include "utils.h"
-
 #if defined(__BIONIC__)
 #include <sys/system_properties.h>
-int64_t NanoTime() {
-  auto t = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now());
-  return t.time_since_epoch().count();
+
+static uint64_t NanoTime() {
+  timespec now;
+  clock_gettime(CLOCK_MONOTONIC, &now);
+  return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_nsec;
 }
 #endif
 
@@ -130,29 +128,6 @@
 #endif // __BIONIC__
 }
 
-TEST(properties, no_fd_leaks) {
-#if defined(__BIONIC__)
-  FdLeakChecker leak_checker;
-  std::stringstream ss;
-  ss << "debug.test." << getpid() << "." << NanoTime() << ".";
-  const std::string property_prefix = ss.str();
-  const std::string property_name = property_prefix + "property1";
-
-  for (size_t i = 0; i < 100; ++i) {
-    char propvalue[PROP_VALUE_MAX];
-    ASSERT_EQ(0, __system_property_set(property_name.c_str(), "value1"));
-    ASSERT_EQ(6, __system_property_get(property_name.c_str(), propvalue));
-    ASSERT_STREQ("value1", propvalue);
-
-    ASSERT_EQ(0, __system_property_set(property_name.c_str(), "value2"));
-    ASSERT_EQ(6, __system_property_get(property_name.c_str(), propvalue));
-    ASSERT_STREQ("value2", propvalue);
-  }
-#else   // __BIONIC__
-  GTEST_SKIP() << "bionic-only test";
-#endif  // __BIONIC__
-}
-
 TEST(properties, empty_value) {
 #if defined(__BIONIC__)
     char propvalue[PROP_VALUE_MAX];
@@ -161,13 +136,13 @@
     ss << "debug.test." << getpid() << "." << NanoTime() << "." << "property_empty";
     const std::string property_name = ss.str();
 
-    for (size_t i = 0; i < 1000; ++i) {
+    for (size_t i=0; i<1000; ++i) {
       ASSERT_EQ(0, __system_property_set(property_name.c_str(), ""));
       ASSERT_EQ(0, __system_property_get(property_name.c_str(), propvalue));
       ASSERT_STREQ("", propvalue);
     }
 
-#else  // __BIONIC__
-  GTEST_SKIP() << "bionic-only test";
+#else // __BIONIC__
+    GTEST_SKIP() << "bionic-only test";
 #endif // __BIONIC__
 }
diff --git a/tests/threads_test.cpp b/tests/threads_test.cpp
deleted file mode 100644
index 5fafff3..0000000
--- a/tests/threads_test.cpp
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Copyright (C) 2019 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 <gtest/gtest.h>
-
-#if __has_include(<threads.h>)
-
-#define HAVE_THREADS_H
-#include <threads.h>
-
-static int g_call_once_call_count;
-
-static void increment_call_count() {
-  ++g_call_once_call_count;
-}
-
-static int g_dtor_call_count;
-
-static void tss_dtor(void* ptr) {
-  ++g_dtor_call_count;
-  free(ptr);
-}
-
-static int return_arg(void* arg) {
-  return static_cast<int>(reinterpret_cast<uintptr_t>(arg));
-}
-
-static int exit_arg(void* arg) {
-  thrd_exit(static_cast<int>(reinterpret_cast<uintptr_t>(arg)));
-}
-
-#endif
-
-#include <time.h>
-
-#include <thread>
-
-#include "BionicDeathTest.h"
-#include "SignalUtils.h"
-
-TEST(threads, call_once) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  once_flag flag = ONCE_FLAG_INIT;
-  call_once(&flag, increment_call_count);
-  call_once(&flag, increment_call_count);
-  std::thread([&flag] {
-    call_once(&flag, increment_call_count);
-  }).join();
-  ASSERT_EQ(1, g_call_once_call_count);
-#endif
-}
-
-TEST(threads, cnd_broadcast__cnd_wait) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-
-  cnd_t c;
-  ASSERT_EQ(thrd_success, cnd_init(&c));
-
-  std::atomic_int i = 0;
-
-  auto waiter = [&c, &i, &m] {
-    ASSERT_EQ(thrd_success, mtx_lock(&m));
-    while (i != 1) ASSERT_EQ(thrd_success, cnd_wait(&c, &m));
-    ASSERT_EQ(thrd_success, mtx_unlock(&m));
-  };
-  std::thread t1(waiter);
-  std::thread t2(waiter);
-  std::thread t3(waiter);
-
-  ASSERT_EQ(thrd_success, mtx_lock(&m));
-  i = 1;
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-
-  ASSERT_EQ(thrd_success, cnd_broadcast(&c));
-
-  t1.join();
-  t2.join();
-  t3.join();
-
-  mtx_destroy(&m);
-  cnd_destroy(&c);
-#endif
-}
-
-TEST(threads, cnd_init__cnd_destroy) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  cnd_t c;
-  ASSERT_EQ(thrd_success, cnd_init(&c));
-  cnd_destroy(&c);
-#endif
-}
-
-TEST(threads, cnd_signal__cnd_wait) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-  cnd_t c;
-  ASSERT_EQ(thrd_success, cnd_init(&c));
-
-  std::atomic_int count = 0;
-  auto waiter = [&c, &m, &count] {
-    ASSERT_EQ(thrd_success, mtx_lock(&m));
-    ASSERT_EQ(thrd_success, cnd_wait(&c, &m));
-    ASSERT_EQ(thrd_success, mtx_unlock(&m));
-    ++count;
-  };
-  std::thread t1(waiter);
-  std::thread t2(waiter);
-  std::thread t3(waiter);
-
-  // This is inherently racy, but attempts to distinguish between cnd_signal and
-  // cnd_broadcast.
-  usleep(100000);
-  ASSERT_EQ(thrd_success, cnd_signal(&c));
-  while (count == 0) {
-  }
-  usleep(100000);
-  ASSERT_EQ(1, count);
-
-  ASSERT_EQ(thrd_success, cnd_signal(&c));
-  while (count == 1) {
-  }
-  usleep(100000);
-  ASSERT_EQ(2, count);
-
-  ASSERT_EQ(thrd_success, cnd_signal(&c));
-  while (count == 2) {
-  }
-  usleep(100000);
-  ASSERT_EQ(3, count);
-
-  t1.join();
-  t2.join();
-  t3.join();
-
-  mtx_destroy(&m);
-  cnd_destroy(&c);
-#endif
-}
-
-TEST(threads, cnd_timedwait_timedout) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_timed));
-  ASSERT_EQ(thrd_success, mtx_lock(&m));
-
-  cnd_t c;
-  ASSERT_EQ(thrd_success, cnd_init(&c));
-
-  timespec ts = {};
-  ASSERT_EQ(thrd_timedout, cnd_timedwait(&c, &m, &ts));
-#endif
-}
-
-TEST(threads, cnd_timedwait) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_timed));
-
-  cnd_t c;
-  ASSERT_EQ(thrd_success, cnd_init(&c));
-
-  std::atomic_bool done = false;
-  std::thread t([&c, &m, &done] {
-    ASSERT_EQ(thrd_success, mtx_lock(&m));
-
-    // cnd_timewait's time is *absolute*.
-    timespec ts;
-    ASSERT_EQ(TIME_UTC, timespec_get(&ts, TIME_UTC));
-    ts.tv_sec += 666;
-
-    ASSERT_EQ(thrd_success, cnd_timedwait(&c, &m, &ts));
-    done = true;
-    ASSERT_EQ(thrd_success, mtx_unlock(&m));
-  });
-
-  while (!done) ASSERT_EQ(thrd_success, cnd_signal(&c));
-
-  t.join();
-#endif
-}
-
-TEST(threads, mtx_init) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_timed));
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain | mtx_recursive));
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_timed | mtx_recursive));
-  ASSERT_EQ(thrd_error, mtx_init(&m, 123));
-  ASSERT_EQ(thrd_error, mtx_init(&m, mtx_recursive));
-#endif
-}
-
-TEST(threads, mtx_destroy) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-  mtx_destroy(&m);
-#endif
-}
-
-TEST(threads, mtx_lock_plain) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-
-  ASSERT_EQ(thrd_success, mtx_lock(&m));
-  ASSERT_EQ(thrd_busy, mtx_trylock(&m));
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-
-  mtx_destroy(&m);
-#endif
-}
-
-TEST(threads, mtx_lock_recursive) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain | mtx_recursive));
-
-  ASSERT_EQ(thrd_success, mtx_lock(&m));
-  ASSERT_EQ(thrd_success, mtx_trylock(&m));
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-
-  mtx_destroy(&m);
-#endif
-}
-
-TEST(threads, mtx_timedlock) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_timed));
-
-  timespec ts = {};
-  ASSERT_EQ(thrd_success, mtx_timedlock(&m, &ts));
-
-  std::thread([&m] {
-    timespec ts = { .tv_nsec = 500000 };
-    ASSERT_EQ(thrd_timedout, mtx_timedlock(&m, &ts));
-  }).join();
-
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-  mtx_destroy(&m);
-#endif
-}
-
-
-TEST(threads, mtx_unlock) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  mtx_t m;
-  ASSERT_EQ(thrd_success, mtx_init(&m, mtx_plain));
-  ASSERT_EQ(thrd_success, mtx_lock(&m));
-  std::thread([&m] {
-    ASSERT_EQ(thrd_busy, mtx_trylock(&m));
-  }).join();
-  ASSERT_EQ(thrd_success, mtx_unlock(&m));
-  std::thread([&m] {
-    ASSERT_EQ(thrd_success, mtx_trylock(&m));
-  }).join();
-#endif
-}
-
-TEST(threads, thrd_current__thrd_equal) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  thrd_t t1 = thrd_current();
-  // (As a side-effect, this demonstrates interoperability with std::thread.)
-  std::thread([&t1] {
-    thrd_t t2 = thrd_current();
-    ASSERT_FALSE(thrd_equal(t1, t2));
-    thrd_t t2_2 = thrd_current();
-    ASSERT_TRUE(thrd_equal(t2, t2_2));
-  }).join();
-  thrd_t t1_2 = thrd_current();
-  ASSERT_TRUE(thrd_equal(t1, t1_2));
-#endif
-}
-
-TEST(threads, thrd_create__thrd_detach) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  thrd_t t;
-  ASSERT_EQ(thrd_success, thrd_create(&t, exit_arg, reinterpret_cast<void*>(1)));
-  ASSERT_EQ(thrd_success, thrd_detach(t));
-#endif
-}
-
-TEST(threads, thrd_create__thrd_exit) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  // Similar to the thrd_join test, but with a function that calls thrd_exit
-  // instead.
-  thrd_t t;
-  int result;
-  ASSERT_EQ(thrd_success, thrd_create(&t, exit_arg, reinterpret_cast<void*>(1)));
-  ASSERT_EQ(thrd_success, thrd_join(t, &result));
-  ASSERT_EQ(1, result);
-
-  ASSERT_EQ(thrd_success, thrd_create(&t, exit_arg, reinterpret_cast<void*>(2)));
-  ASSERT_EQ(thrd_success, thrd_join(t, &result));
-  ASSERT_EQ(2, result);
-
-  // The `result` argument can be null if you don't care...
-  ASSERT_EQ(thrd_success, thrd_create(&t, exit_arg, reinterpret_cast<void*>(3)));
-  ASSERT_EQ(thrd_success, thrd_join(t, nullptr));
-#endif
-}
-
-class threads_DeathTest : public BionicDeathTest {};
-
-TEST(threads_DeathTest, thrd_exit_main_thread) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  // "The program terminates normally after the last thread has been terminated.
-  // The behavior is as if the program called the exit function with the status
-  // EXIT_SUCCESS at thread termination time." (ISO/IEC 9899:2018)
-  ASSERT_EXIT(thrd_exit(12), ::testing::ExitedWithCode(EXIT_SUCCESS), "");
-#endif
-}
-
-TEST(threads, thrd_create__thrd_join) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  // Similar to the thrd_exit test, but with a function that calls return
-  // instead.
-  thrd_t t;
-  int result;
-  ASSERT_EQ(thrd_success, thrd_create(&t, return_arg, reinterpret_cast<void*>(1)));
-  ASSERT_EQ(thrd_success, thrd_join(t, &result));
-  ASSERT_EQ(1, result);
-
-  ASSERT_EQ(thrd_success, thrd_create(&t, return_arg, reinterpret_cast<void*>(2)));
-  ASSERT_EQ(thrd_success, thrd_join(t, &result));
-  ASSERT_EQ(2, result);
-
-  // The `result` argument can be null if you don't care...
-  ASSERT_EQ(thrd_success, thrd_create(&t, return_arg, reinterpret_cast<void*>(3)));
-  ASSERT_EQ(thrd_success, thrd_join(t, nullptr));
-#endif
-}
-
-TEST(threads, thrd_sleep_signal) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  ScopedSignalHandler ssh{SIGALRM, [](int) {}};
-  std::thread t([] {
-    timespec long_time = { .tv_sec = 666 };
-    timespec remaining = {};
-    ASSERT_EQ(-1, thrd_sleep(&long_time, &remaining));
-    uint64_t t = remaining.tv_sec * 1000000000 + remaining.tv_nsec;
-    ASSERT_LE(t, 666ULL * 1000000000);
-  });
-  usleep(100000); // 0.1s
-  pthread_kill(t.native_handle(), SIGALRM);
-  t.join();
-#endif
-}
-
-TEST(threads, thrd_sleep_signal_nullptr) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  ScopedSignalHandler ssh{SIGALRM, [](int) {}};
-  std::thread t([] {
-    timespec long_time = { .tv_sec = 666 };
-    ASSERT_EQ(-1, thrd_sleep(&long_time, nullptr));
-  });
-  usleep(100000); // 0.1s
-  pthread_kill(t.native_handle(), SIGALRM);
-  t.join();
-#endif
-}
-
-TEST(threads, thrd_sleep_error) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  timespec invalid = { .tv_sec = -1 };
-  ASSERT_EQ(-2, thrd_sleep(&invalid, nullptr));
-#endif
-}
-
-TEST(threads, thrd_yield) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  thrd_yield();
-#endif
-}
-
-TEST(threads, TSS_DTOR_ITERATIONS_macro) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  ASSERT_EQ(PTHREAD_DESTRUCTOR_ITERATIONS, TSS_DTOR_ITERATIONS);
-#endif
-}
-
-TEST(threads, tss_create) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  tss_t key;
-  ASSERT_EQ(thrd_success, tss_create(&key, nullptr));
-  tss_delete(key);
-#endif
-}
-
-TEST(threads, tss_create_dtor) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  tss_dtor_t dtor = tss_dtor;
-  tss_t key;
-  ASSERT_EQ(thrd_success, tss_create(&key, dtor));
-
-  ASSERT_EQ(thrd_success, tss_set(key, strdup("hello")));
-  std::thread([&key] {
-    ASSERT_EQ(thrd_success, tss_set(key, strdup("world")));
-  }).join();
-  // Thread exit calls the destructor...
-  ASSERT_EQ(1, g_dtor_call_count);
-
-  // "[A call to tss_set] will not invoke the destructor associated with the
-  // key on the value being replaced" (ISO/IEC 9899:2018).
-  g_dtor_call_count = 0;
-  ASSERT_EQ(thrd_success, tss_set(key, strdup("hello")));
-  ASSERT_EQ(0, g_dtor_call_count);
-
-  // "Calling tss_delete will not result in the invocation of any
-  // destructors" (ISO/IEC 9899:2018).
-  // The destructor for "hello" won't be called until *this* thread exits.
-  g_dtor_call_count = 0;
-  tss_delete(key);
-  ASSERT_EQ(0, g_dtor_call_count);
-#endif
-}
-
-TEST(threads, tss_get__tss_set) {
-#if !defined(HAVE_THREADS_H)
-  GTEST_SKIP() << "<threads.h> unavailable";
-#else
-  tss_t key;
-  ASSERT_EQ(thrd_success, tss_create(&key, nullptr));
-
-  ASSERT_EQ(thrd_success, tss_set(key, const_cast<char*>("hello")));
-  ASSERT_STREQ("hello", reinterpret_cast<char*>(tss_get(key)));
-  std::thread([&key] {
-      ASSERT_EQ(nullptr, tss_get(key));
-      ASSERT_EQ(thrd_success, tss_set(key, const_cast<char*>("world")));
-      ASSERT_STREQ("world", reinterpret_cast<char*>(tss_get(key)));
-  }).join();
-  ASSERT_STREQ("hello", reinterpret_cast<char*>(tss_get(key)));
-
-  tss_delete(key);
-#endif
-}
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 378b4ac..c890358 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -24,17 +24,13 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-
 #include <atomic>
-#include <chrono>
 
 #include "SignalUtils.h"
 #include "utils.h"
 
 #include "private/bionic_constants.h"
 
-using namespace std::chrono_literals;
-
 TEST(time, time) {
   // Acquire time
   time_t p1, t1 = time(&p1);
@@ -752,11 +748,11 @@
 }
 
 TEST(time, clock) {
-  // clock(3) is hard to test, but a 1s sleep should cost less than 5ms.
+  // clock(3) is hard to test, but a 1s sleep should cost less than 1ms.
   clock_t t0 = clock();
   sleep(1);
   clock_t t1 = clock();
-  ASSERT_LT(t1 - t0, 5 * (CLOCKS_PER_SEC / 1000));
+  ASSERT_LT(t1 - t0, CLOCKS_PER_SEC / 1000);
 }
 
 static pid_t GetInvalidPid() {
@@ -801,7 +797,7 @@
   ASSERT_EQ(EINVAL, errno);
 }
 
-TEST(time, clock_nanosleep_EINVAL) {
+TEST(time, clock_nanosleep) {
   timespec in;
   timespec out;
   ASSERT_EQ(EINVAL, clock_nanosleep(-1, 0, &in, &out));
@@ -814,29 +810,6 @@
   ASSERT_EQ(EINVAL, clock_nanosleep(CLOCK_THREAD_CPUTIME_ID, 0, &in, nullptr));
 }
 
-TEST(time, clock_nanosleep) {
-  auto t0 = std::chrono::steady_clock::now();
-  const timespec ts = {.tv_nsec = 5000000};
-  ASSERT_EQ(0, clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, nullptr));
-  auto t1 = std::chrono::steady_clock::now();
-  ASSERT_GE(t1-t0, 5000000ns);
-}
-
-TEST(time, nanosleep) {
-  auto t0 = std::chrono::steady_clock::now();
-  const timespec ts = {.tv_nsec = 5000000};
-  ASSERT_EQ(0, nanosleep(&ts, nullptr));
-  auto t1 = std::chrono::steady_clock::now();
-  ASSERT_GE(t1-t0, 5000000ns);
-}
-
-TEST(time, nanosleep_EINVAL) {
-  timespec ts = {.tv_sec = -1};
-  errno = 0;
-  ASSERT_EQ(-1, nanosleep(&ts, nullptr));
-  ASSERT_EQ(EINVAL, errno);
-}
-
 TEST(time, bug_31938693) {
   // User-visible symptoms in N:
   // http://b/31938693
diff --git a/tests/touch-obj-on-success b/tests/touch-obj-on-success
deleted file mode 100755
index d8a71ba..0000000
--- a/tests/touch-obj-on-success
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash -eu
-#
-# Runs the given C/C++ compile-ish command. On success, scrapes an object file
-# from that command line and touches it.
-
-"$@"
-for arg in "$@"; do
-  if [[ "$arg" == *.o ]]; then
-    touch "$arg"
-  fi
-done
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 99d92e6..10c1710 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -33,8 +33,6 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include <chrono>
-
 #include <android-base/file.h>
 #include <android-base/strings.h>
 
@@ -48,8 +46,6 @@
 #define UNISTD_DEATHTEST unistd_DeathTest
 #endif
 
-using namespace std::chrono_literals;
-
 static void* get_brk() {
   return sbrk(0);
 }
@@ -1520,17 +1516,3 @@
   swab("hello", buf, -1);
   ASSERT_EQ('x', buf[0]);
 }
-
-TEST(UNISTD_TEST, usleep) {
-  auto t0 = std::chrono::steady_clock::now();
-  ASSERT_EQ(0, usleep(5000));
-  auto t1 = std::chrono::steady_clock::now();
-  ASSERT_GE(t1-t0, 5000us);
-}
-
-TEST(UNISTD_TEST, sleep) {
-  auto t0 = std::chrono::steady_clock::now();
-  ASSERT_EQ(0U, sleep(1));
-  auto t1 = std::chrono::steady_clock::now();
-  ASSERT_GE(t1-t0, 1s);
-}
diff --git a/tests/utils.h b/tests/utils.h
index cfc68c9..fe41019 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#pragma once
+#ifndef __TEST_UTILS_H
+#define __TEST_UTILS_H
 
-#include <dirent.h>
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <inttypes.h>
@@ -255,28 +255,4 @@
 };
 #endif
 
-class FdLeakChecker {
- public:
-  FdLeakChecker() {
-  }
-
-  ~FdLeakChecker() {
-    size_t end_count = CountOpenFds();
-    EXPECT_EQ(start_count_, end_count);
-  }
-
- private:
-  static size_t CountOpenFds() {
-    auto fd_dir = std::unique_ptr<DIR, decltype(&closedir)>{ opendir("/proc/self/fd"), closedir };
-    size_t count = 0;
-    dirent* de = nullptr;
-    while ((de = readdir(fd_dir.get())) != nullptr) {
-      if (de->d_type == DT_LNK) {
-        ++count;
-      }
-    }
-    return count;
-  }
-
-  size_t start_count_ = CountOpenFds();
-};
+#endif
diff --git a/tools/bionicbb/.gitignore b/tools/bionicbb/.gitignore
new file mode 100644
index 0000000..d0ff064
--- /dev/null
+++ b/tools/bionicbb/.gitignore
@@ -0,0 +1,58 @@
+config.py
+*.json
+oauth.storage
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
diff --git a/tools/bionicbb/README.md b/tools/bionicbb/README.md
new file mode 100644
index 0000000..a285984
--- /dev/null
+++ b/tools/bionicbb/README.md
@@ -0,0 +1,89 @@
+bionicbb
+========
+
+The bionic buildbot contains two services: a gmail polling service, and a web
+service that interacts with gerrit.
+
+Dependencies
+------------
+
+ * Python 2.7
+ * [Advanced Python Scheduler](https://apscheduler.readthedocs.org/en/latest/)
+ * [Flask](http://flask.pocoo.org/)
+ * [Google API Client Library](https://developers.google.com/api-client-library/python/start/installation)
+ * [jenkinsapi](https://pypi.python.org/pypi/jenkinsapi)
+ * [Requests](http://docs.python-requests.org/en/latest/)
+
+Setup
+-----
+
+Create a `config.py` in the same directory as the sources. The structure of the
+configuration file is as follows:
+
+```python
+client_secret_file = 'CLIENT_SECRET_FILE.json'
+build_listener_url = 'BUILD_LISTENER_URL'
+jenkins_url = 'JENKINS_URL'
+jenkins_credentials = {
+    'username': 'JENKINS_USERNAME',
+    'password': 'JENKINS_PASSWORD',
+}
+```
+
+The client secret file comes from the Gmail API page of the [Google Developers
+Console](https://console.developers.google.com/). The Jenkins credentials are
+for a Jenkins account that has the appropriate permissions to launch the jobs
+the buildbot will use.
+
+You will also need to add the HTTP password for the buildbot's Gerrit account to
+`~/.netrc`. The HTTP password can be obtained from the [Gerrit HTTP password
+settings](https://android-review.googlesource.com/#/settings/http-password).
+
+To launch the services:
+
+```bash
+$ python build_listener.py >build.log 2>&1 &
+$ python gmail_listener.py >mail.log 2>&1 &
+```
+
+The mail listener will direct your browser to an authentication page for the
+Gmail API.
+
+gmail\_listener.py
+------------------
+
+Bionicbb polls a gmail account to find changes that need to be built. The gmail
+account needs to have a gerrit account set up with project watches on anything
+it finds interesting. This is a rather ugly hack, but it seems to be the
+simplest option available.
+
+Gerrit does offer a streaming notification service that would be _far_ better,
+but it is only available over an SSH conection to gerrit, and the AOSP gerrit
+does not support this connection.
+
+Another option would be polling gerrit itself, but we'd have to process each
+change every time to see if it should be built, whereas project watches allow us
+to treat these as semi-push notifications (we still have to poll gmail).
+
+One drawback to this approach is that it's a hassle to set up the project
+watches for a large number of projects. Since bionicbb is only interested in a
+small subset of projects, this is a non-issue.
+
+If the buildbot has applied Verified-1 to a patchset, the user may add their own
+Verified+1 to the change and the buildbot will remove its rejection the next
+time the services polls (by default, every five minutes).
+
+The service will also listen for the following commands:
+
+ * `bionicbb:clean`: Something is very broken and the buildbot's output
+   directory needs to be nuked.
+ * `bionicbb:retry`: Something went wrong and the buildbot should retry the
+   build.
+
+build\_listener.py
+------------------
+
+The build listener service responds to HTTP POST events sent from Jenkins and
+updates CLs accordingly. The only other API endpoint is `/drop-rejection`, which
+will remove a Verified-1 from a previously rejected patchset. The actually
+invocation of this is handled by the gmail listener.
diff --git a/tools/bionicbb/bionicbb.py b/tools/bionicbb/bionicbb.py
new file mode 100644
index 0000000..a786b27
--- /dev/null
+++ b/tools/bionicbb/bionicbb.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python2
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import json
+import logging
+import os
+
+from apscheduler.schedulers.background import BackgroundScheduler
+from flask import Flask, request
+import requests
+
+import gerrit
+import tasks
+
+app = Flask(__name__)
+
+
+def gerrit_url(endpoint):
+    gerrit_base_url = 'https://android-review.googlesource.com'
+    return gerrit_base_url + endpoint
+
+
+@app.route('/', methods=['POST'])
+def handle_build_message():
+    result = json.loads(request.data)
+
+    name = result['name']
+    number = result['build']['number']
+    status = result['build']['status']
+    go_url = 'http://go/bionicbb/' + result['build']['url']
+    full_url = result['build']['full_url']
+    params = result['build']['parameters']
+    change_id = params['CHANGE_ID']
+    ref = params['REF']
+    patch_set = ref.split('/')[-1]
+
+    logging.debug('%s #%s %s: %s', name, number, status, full_url)
+
+    # bionic-lint is always broken, so we don't want to reject changes for
+    # those failures until we clean things up.
+    if name == 'bionic-presubmit':
+        message_lines = ['{} #{} checkbuild {}: {}'.format(
+            name, number, status, go_url)]
+        if status == 'FAILURE':
+            message_lines += ['If you believe this Verified-1 was in error, '
+                              '+1 the change and bionicbb will remove the -1 '
+                              'shortly.']
+
+        request_data = {
+            'message': '\n'.join(message_lines)
+        }
+
+        label = 'Verified'
+        if status == 'FAILURE':
+            request_data['labels'] = {label: -1}
+        elif status == 'SUCCESS':
+            request_data['labels'] = {label: +1}
+
+        url = gerrit_url('/a/changes/{}/revisions/{}/review'.format(change_id,
+                                                                    patch_set))
+
+        headers = {'Content-Type': 'application/json;charset=UTF-8'}
+        logging.debug('POST %s: %s', url, request_data)
+        requests.post(url, headers=headers, json=request_data)
+    elif name == 'clean-bionic-presubmit':
+        request_data = {'message': 'out/ directory removed'}
+        url = gerrit_url('/a/changes/{}/revisions/{}/review'.format(change_id,
+                                                                    patch_set))
+        headers = {'Content-Type': 'application/json;charset=UTF-8'}
+        logging.debug('POST %s: %s', url, request_data)
+        requests.post(url, headers=headers, json=request_data)
+    elif name == 'bionic-lint':
+        logging.warning('Result for bionic-lint ignored')
+    else:
+        logging.error('Unknown project: %s', name)
+    return ''
+
+
+@app.route('/drop-rejection', methods=['POST'])
+def drop_rejection():
+    revision_info = json.loads(request.data)
+
+    change_id = revision_info['changeid']
+    patch_set = revision_info['patchset']
+
+    bb_email = 'bionicbb@android.com'
+    labels = gerrit.get_labels(change_id, patch_set)
+    if bb_email in labels['Verified']:
+        bb_review = labels['Verified'][bb_email]
+    else:
+        bb_review = 0
+
+    if bb_review >= 0:
+        logging.info('No rejection to drop: %s %s', change_id, patch_set)
+        return ''
+
+    logging.info('Dropping rejection: %s %s', change_id, patch_set)
+
+    request_data = {'labels': {'Verified': 0}}
+    url = gerrit_url('/a/changes/{}/revisions/{}/review'.format(change_id,
+                                                                patch_set))
+    headers = {'Content-Type': 'application/json;charset=UTF-8'}
+    logging.debug('POST %s: %s', url, request_data)
+    requests.post(url, headers=headers, json=request_data)
+    return ''
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    logger = logging.getLogger()
+    fh = logging.FileHandler('bionicbb.log')
+    fh.setLevel(logging.INFO)
+    logger.addHandler(fh)
+
+    # Prevent the job from being rescheduled by the reloader.
+    if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
+        scheduler = BackgroundScheduler()
+        scheduler.start()
+        scheduler.add_job(tasks.get_and_process_jobs, 'interval', minutes=5)
+
+    app.run(host='0.0.0.0', debug=True)
diff --git a/tools/bionicbb/gerrit.py b/tools/bionicbb/gerrit.py
new file mode 100644
index 0000000..9c62c6a
--- /dev/null
+++ b/tools/bionicbb/gerrit.py
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import json
+import requests
+
+
+class GerritError(RuntimeError):
+    def __init__(self, code, url):
+        self.code = code
+        self.url = url
+        super(GerritError, self).__init__('Error {}: {}'.format(code, url))
+
+
+def get_commit(change_id, revision):
+    return json.loads(
+        call('/changes/{}/revisions/{}/commit'.format(change_id, revision)))
+
+
+def get_files_for_revision(change_id, revision):
+    return json.loads(
+        call('/changes/{}/revisions/{}/files'.format(
+            change_id, revision))).keys()
+
+
+def call(endpoint, method='GET'):
+    if method != 'GET':
+        raise NotImplementedError('Currently only HTTP GET is supported.')
+    gerrit_url = 'https://android-review.googlesource.com'
+    url = gerrit_url + endpoint
+    response = requests.get(url)
+    if response.status_code != 200:
+        raise GerritError(response.status_code, url)
+    return response.text[5:]
+
+
+def ref_for_change(change_id):
+    endpoint = '/changes/{}/detail?o=CURRENT_REVISION'.format(change_id)
+    change = json.loads(call(endpoint))
+    commit = change['current_revision']
+    return change['revisions'][commit]['fetch']['http']['ref']
+
+
+def get_labels(change_id, patch_set):
+    """Returns labels attached to a revision.
+
+    Returned data is in the following format:
+    {
+        'Code-Review': {
+            <email>: <value>,
+            ...
+        },
+        'Verified': {
+            <email>: <value>,
+            ...
+        }
+    }
+    """
+    details = json.loads(call('/changes/{}/revisions/{}/review'.format(
+        change_id, patch_set)))
+    labels = {'Code-Review': {}, 'Verified': {}}
+    for review in details['labels']['Code-Review']['all']:
+        if 'value' in review and 'email' in review:
+            labels['Code-Review'][review['email']] = int(review['value'])
+    for review in details['labels']['Verified']['all']:
+        if 'value' in review and 'email' in review:
+            labels['Verified'][review['email']] = int(review['value'])
+    return labels
diff --git a/tools/bionicbb/gmail.py b/tools/bionicbb/gmail.py
new file mode 100644
index 0000000..f088ad6
--- /dev/null
+++ b/tools/bionicbb/gmail.py
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import base64
+import httplib2
+
+import config
+
+
+def get_body(msg):
+    if 'attachmentId' in msg['payload']['body']:
+        raise NotImplementedError('Handling of messages contained in '
+                                  'attachments not yet implemented.')
+    b64_body = msg['payload']['body']['data']
+    return base64.urlsafe_b64decode(b64_body.encode('ASCII'))
+
+
+def build_service():
+    from apiclient.discovery import build
+    from oauth2client.client import flow_from_clientsecrets
+    from oauth2client.file import Storage
+    from oauth2client.tools import run
+
+    OAUTH_SCOPE = 'https://www.googleapis.com/auth/gmail.modify'
+    STORAGE = Storage('oauth.storage')
+
+    # Start the OAuth flow to retrieve credentials
+    flow = flow_from_clientsecrets(config.client_secret_file,
+                                   scope=OAUTH_SCOPE)
+    http = httplib2.Http()
+
+    # Try to retrieve credentials from storage or run the flow to generate them
+    credentials = STORAGE.get()
+    if credentials is None or credentials.invalid:
+        credentials = run(flow, STORAGE, http=http)
+
+    http = credentials.authorize(http)
+    return build('gmail', 'v1', http=http)
+
+
+def get_gerrit_label(labels):
+    for label in labels:
+        if label['name'] == 'gerrit':
+            return label['id']
+    return None
+
+
+def get_all_messages(service, label):
+    msgs = []
+    response = service.users().messages().list(
+        userId='me', labelIds=label).execute()
+    if 'messages' in response:
+        msgs.extend(response['messages'])
+    while 'nextPageToken' in response:
+        page_token = response['nextPageToken']
+        response = service.users().messages().list(
+            userId='me', pageToken=page_token).execute()
+        msgs.extend(response['messages'])
+    return msgs
diff --git a/tools/bionicbb/presubmit.py b/tools/bionicbb/presubmit.py
new file mode 100644
index 0000000..3e6ebfa
--- /dev/null
+++ b/tools/bionicbb/presubmit.py
@@ -0,0 +1,205 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from __future__ import absolute_import
+
+import json
+import logging
+import os.path
+import re
+import requests
+
+import jenkinsapi
+
+import gerrit
+
+import config
+
+
+def is_untrusted_committer(change_id, patch_set):
+    # TODO(danalbert): Needs to be based on the account that made the comment.
+    commit = gerrit.get_commit(change_id, patch_set)
+    committer = commit['committer']['email']
+    return not committer.endswith('@google.com')
+
+
+def contains_cleanspec(change_id, patch_set):
+    files = gerrit.get_files_for_revision(change_id, patch_set)
+    return 'CleanSpec.mk' in [os.path.basename(f) for f in files]
+
+
+def contains_bionicbb(change_id, patch_set):
+    files = gerrit.get_files_for_revision(change_id, patch_set)
+    return any('tools/bionicbb' in f for f in files)
+
+
+def should_skip_build(info):
+    if info['MessageType'] not in ('newchange', 'newpatchset', 'comment'):
+        raise ValueError('should_skip_build() is only valid for new '
+                         'changes, patch sets, and commits.')
+
+    change_id = info['Change-Id']
+    patch_set = info['PatchSet']
+
+    checks = [
+        is_untrusted_committer,
+        contains_cleanspec,
+        contains_bionicbb,
+    ]
+    for check in checks:
+        if check(change_id, patch_set):
+            return True
+    return False
+
+
+def clean_project(dry_run):
+    username = config.jenkins_credentials['username']
+    password = config.jenkins_credentials['password']
+    jenkins_url = config.jenkins_url
+    jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
+
+    build = 'clean-bionic-presubmit'
+    if build in jenkins:
+        if not dry_run:
+            _ = jenkins[build].invoke()
+            # https://issues.jenkins-ci.org/browse/JENKINS-27256
+            # url = job.get_build().baseurl
+            url = 'URL UNAVAILABLE'
+        else:
+            url = 'DRY_RUN_URL'
+        logging.info('Cleaning: %s %s', build, url)
+    else:
+        logging.error('Failed to clean: could not find project %s', build)
+    return True
+
+
+def build_project(gerrit_info, dry_run, lunch_target=None):
+    project_to_jenkins_map = {
+        'platform/bionic': 'bionic-presubmit',
+        'platform/build': 'bionic-presubmit',
+        'platform/external/jemalloc': 'bionic-presubmit',
+        'platform/external/libcxx': 'bionic-presubmit',
+        'platform/external/libcxxabi': 'bionic-presubmit',
+        'platform/external/compiler-rt': 'bionic-presubmit',
+    }
+
+    username = config.jenkins_credentials['username']
+    password = config.jenkins_credentials['password']
+    jenkins_url = config.jenkins_url
+    jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
+
+    project = gerrit_info['Project']
+    change_id = gerrit_info['Change-Id']
+    if project in project_to_jenkins_map:
+        build = project_to_jenkins_map[project]
+    else:
+        build = 'bionic-presubmit'
+
+    if build in jenkins:
+        project_path = '/'.join(project.split('/')[1:])
+        if not project_path:
+            raise RuntimeError('bogus project: {}'.format(project))
+        if project_path.startswith('platform/'):
+            raise RuntimeError('Bad project mapping: {} => {}'.format(
+                project, project_path))
+        ref = gerrit.ref_for_change(change_id)
+        params = {
+            'REF': ref,
+            'CHANGE_ID': change_id,
+            'PROJECT': project_path
+        }
+        if lunch_target is not None:
+            params['LUNCH_TARGET'] = lunch_target
+        if not dry_run:
+            _ = jenkins[build].invoke(build_params=params)
+            # https://issues.jenkins-ci.org/browse/JENKINS-27256
+            # url = job.get_build().baseurl
+            url = 'URL UNAVAILABLE'
+        else:
+            url = 'DRY_RUN_URL'
+        logging.info('Building: %s => %s %s %s', project, build, url,
+                     change_id)
+    else:
+        logging.error('Unknown build: %s => %s %s', project, build, change_id)
+    return True
+
+
+def handle_change(gerrit_info, _, dry_run):
+    if should_skip_build(gerrit_info):
+        return True
+    return build_project(gerrit_info, dry_run)
+
+
+def drop_rejection(gerrit_info, dry_run):
+    request_data = {
+        'changeid': gerrit_info['Change-Id'],
+        'patchset': gerrit_info['PatchSet']
+    }
+    url = '{}/{}'.format(config.build_listener_url, 'drop-rejection')
+    headers = {'Content-Type': 'application/json;charset=UTF-8'}
+    if not dry_run:
+        try:
+            requests.post(url, headers=headers, data=json.dumps(request_data))
+        except requests.exceptions.ConnectionError as ex:
+            logging.error('Failed to drop rejection: %s', ex)
+            return False
+    logging.info('Dropped rejection: %s', gerrit_info['Change-Id'])
+    return True
+
+
+def handle_comment(gerrit_info, body, dry_run):
+    if 'Verified+1' in body:
+        drop_rejection(gerrit_info, dry_run)
+
+    if should_skip_build(gerrit_info):
+        return True
+
+    command_map = {
+        'clean': lambda: clean_project(dry_run),
+        'retry': lambda: build_project(gerrit_info, dry_run),
+
+        'arm': lambda: build_project(gerrit_info, dry_run,
+                                     lunch_target='aosp_arm-eng'),
+        'aarch64': lambda: build_project(gerrit_info, dry_run,
+                                         lunch_target='aosp_arm64-eng'),
+        'mips': lambda: build_project(gerrit_info, dry_run,
+                                      lunch_target='aosp_mips-eng'),
+        'mips64': lambda: build_project(gerrit_info, dry_run,
+                                        lunch_target='aosp_mips64-eng'),
+        'x86': lambda: build_project(gerrit_info, dry_run,
+                                     lunch_target='aosp_x86-eng'),
+        'x86_64': lambda: build_project(gerrit_info, dry_run,
+                                        lunch_target='aosp_x86_64-eng'),
+    }
+
+    def handle_unknown_command():
+        pass    # TODO(danalbert): should complain to the commenter.
+
+    commands = [match.group(1).strip() for match in
+                re.finditer(r'^bionicbb:\s*(.+)$', body, flags=re.MULTILINE)]
+
+    for command in commands:
+        if command in command_map:
+            command_map[command]()
+        else:
+            handle_unknown_command()
+
+    return True
+
+
+def skip_handler(gerrit_info, _, __):
+    logging.info('Skipping %s: %s', gerrit_info['MessageType'],
+                 gerrit_info['Change-Id'])
+    return True
diff --git a/tools/bionicbb/tasks.py b/tools/bionicbb/tasks.py
new file mode 100644
index 0000000..4c39a98
--- /dev/null
+++ b/tools/bionicbb/tasks.py
@@ -0,0 +1,108 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import httplib
+import httplib2
+import logging
+import re
+import socket
+
+import apiclient.errors
+
+import gerrit
+import gmail
+import presubmit
+
+
+def get_gerrit_info(body):
+    info = {}
+    gerrit_pattern = r'^Gerrit-(\S+): (.+)$'
+    for match in re.finditer(gerrit_pattern, body, flags=re.MULTILINE):
+        info[match.group(1)] = match.group(2).strip()
+    return info
+
+
+def process_message(msg, dry_run):
+    try:
+        body = gmail.get_body(msg)
+        gerrit_info = get_gerrit_info(body)
+        if not gerrit_info:
+            logging.fatal('No Gerrit info found: %s', msg.subject)
+        msg_type = gerrit_info['MessageType']
+        handlers = {
+            'comment': presubmit.handle_comment,
+            'newchange': presubmit.handle_change,
+            'newpatchset': presubmit.handle_change,
+
+            'abandon': presubmit.skip_handler,
+            'merge-failed': presubmit.skip_handler,
+            'merged': presubmit.skip_handler,
+            'restore': presubmit.skip_handler,
+            'revert': presubmit.skip_handler,
+        }
+
+        message_type = gerrit_info['MessageType']
+        if message_type in handlers:
+            return handlers[message_type](gerrit_info, body, dry_run)
+        else:
+            logging.warning('MessageType %s unhandled.', msg_type)
+        return False
+    except NotImplementedError as ex:
+        logging.error("%s", ex)
+        return False
+    except gerrit.GerritError as ex:
+        change_id = gerrit_info['Change-Id']
+        logging.error('Gerrit error (%d): %s %s', ex.code, change_id, ex.url)
+        return ex.code == 404
+
+
+def get_and_process_jobs():
+    dry_run = False
+
+    gmail_service = gmail.build_service()
+    msg_service = gmail_service.users().messages()
+
+    # We run in a loop because some of the exceptions thrown here mean we just
+    # need to retry. For errors where we should back off (typically any gmail
+    # API exceptions), process_changes catches the error and returns normally.
+    while True:
+        try:
+            process_changes(gmail_service, msg_service, dry_run)
+            return
+        except httplib.BadStatusLine:
+            pass
+        except httplib2.ServerNotFoundError:
+            pass
+        except socket.error:
+            pass
+
+
+def process_changes(gmail_service, msg_service, dry_run):
+    try:
+        labels = gmail_service.users().labels().list(userId='me').execute()
+        if not labels['labels']:
+            logging.error('Could not retrieve Gmail labels')
+            return
+        label_id = gmail.get_gerrit_label(labels['labels'])
+        if not label_id:
+            logging.error('Could not find gerrit label')
+            return
+
+        for msg in gmail.get_all_messages(gmail_service, label_id):
+            msg = msg_service.get(userId='me', id=msg['id']).execute()
+            if process_message(msg, dry_run) and not dry_run:
+                msg_service.trash(userId='me', id=msg['id']).execute()
+    except apiclient.errors.HttpError as ex:
+        logging.error('API Client HTTP error: %s', ex)
diff --git a/tools/bionicbb/test_tasks.py b/tools/bionicbb/test_tasks.py
new file mode 100644
index 0000000..b36cbad
--- /dev/null
+++ b/tools/bionicbb/test_tasks.py
@@ -0,0 +1,94 @@
+import mock
+import unittest
+
+import presubmit
+
+
+class TestShouldSkipBuild(unittest.TestCase):
+    @mock.patch('presubmit.contains_bionicbb')
+    @mock.patch('presubmit.contains_cleanspec')
+    @mock.patch('gerrit.get_commit')
+    def test_accepts_googlers(self, mock_commit, *other_checks):
+        mock_commit.return_value = {
+            'committer': {'email': 'googler@google.com'}
+        }
+
+        for other_check in other_checks:
+            other_check.return_value = False
+
+        for message_type in ('newchange', 'newpatchset', 'comment'):
+            self.assertFalse(presubmit.should_skip_build({
+                'MessageType': message_type,
+                'Change-Id': '',
+                'PatchSet': '',
+            }))
+
+    @mock.patch('presubmit.contains_bionicbb')
+    @mock.patch('presubmit.contains_cleanspec')
+    @mock.patch('gerrit.get_commit')
+    def test_rejects_googlish_domains(self, mock_commit, *other_checks):
+        mock_commit.return_value = {
+            'committer': {'email': 'fakegoogler@google.com.fake.com'}
+        }
+
+        for other_check in other_checks:
+            other_check.return_value = False
+
+        for message_type in ('newchange', 'newpatchset', 'comment'):
+            self.assertTrue(presubmit.should_skip_build({
+                'MessageType': message_type,
+                'Change-Id': '',
+                'PatchSet': '',
+            }))
+
+    @mock.patch('presubmit.contains_bionicbb')
+    @mock.patch('presubmit.contains_cleanspec')
+    @mock.patch('gerrit.get_commit')
+    def test_rejects_non_googlers(self, mock_commit, *other_checks):
+        mock_commit.return_value = {
+            'committer': {'email': 'johndoe@example.com'}
+        }
+
+        for other_check in other_checks:
+            other_check.return_value = False
+
+        for message_type in ('newchange', 'newpatchset', 'comment'):
+            self.assertTrue(presubmit.should_skip_build({
+                'MessageType': message_type,
+                'Change-Id': '',
+                'PatchSet': '',
+            }))
+
+    @mock.patch('presubmit.contains_bionicbb')
+    @mock.patch('presubmit.is_untrusted_committer')
+    @mock.patch('gerrit.get_files_for_revision')
+    def test_skips_cleanspecs(self, mock_files, *other_checks):
+        mock_files.return_value = ['foo/CleanSpec.mk']
+        for other_check in other_checks:
+            other_check.return_value = False
+
+        for message_type in ('newchange', 'newpatchset', 'comment'):
+            self.assertTrue(presubmit.should_skip_build({
+                'MessageType': message_type,
+                'Change-Id': '',
+                'PatchSet': '',
+            }))
+
+    @mock.patch('presubmit.contains_cleanspec')
+    @mock.patch('presubmit.is_untrusted_committer')
+    @mock.patch('gerrit.get_files_for_revision')
+    def test_skips_bionicbb(self, mock_files, *other_checks):
+        mock_files.return_value = ['tools/bionicbb/common.sh']
+        for other_check in other_checks:
+            other_check.return_value = False
+
+        for message_type in ('newchange', 'newpatchset', 'comment'):
+            self.assertTrue(presubmit.should_skip_build({
+                'MessageType': message_type,
+                'Change-Id': '',
+                'PatchSet': '',
+            }))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/tools/update_notice.sh b/tools/update_notice.sh
index a309bc2..0b8a106 100755
--- a/tools/update_notice.sh
+++ b/tools/update_notice.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 cd $DIR/..
-./libc/tools/generate-NOTICE.py libc libm > libc/NOTICE
+./libc/tools/generate-NOTICE.py libc libdl libm linker libstdc++ > libc/NOTICE
 
 git diff --exit-code HEAD libc/NOTICE
 exit $?
diff --git a/tools/update_seccomp.sh b/tools/update_seccomp.sh
new file mode 100755
index 0000000..b9e53aa
--- /dev/null
+++ b/tools/update_seccomp.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR/..
+./libc/tools/genseccomp.py
+
+git diff --exit-code HEAD libc/seccomp/
+exit $?
diff --git a/tools/update_syscalls.sh b/tools/update_syscalls.sh
new file mode 100755
index 0000000..5e7eb0a
--- /dev/null
+++ b/tools/update_syscalls.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR/..
+./libc/tools/gensyscalls.py
+
+git diff --exit-code HEAD libc/arch-*/syscalls/
+exit $?
diff --git a/tools/update_version_scripts.sh b/tools/update_version_scripts.sh
new file mode 100755
index 0000000..2c3a5b4
--- /dev/null
+++ b/tools/update_version_scripts.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR/..
+./libc/tools/genversion-scripts.py
+
+git diff --exit-code HEAD libc/*.map libdl/*.map libm/*.map linker/*.map
+exit $?
diff --git a/tools/versioner/src/Arch.h b/tools/versioner/src/Arch.h
index e4bbcc4..16fa265 100644
--- a/tools/versioner/src/Arch.h
+++ b/tools/versioner/src/Arch.h
@@ -138,9 +138,7 @@
   { Arch::x86_64, "x86_64-linux-android" },
 };
 
-static const std::set<int> default_levels = {
-  14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30,
-};
+static const std::set<int> default_levels = { 14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29 };
 
 static const ArchMap<int> arch_min_api = {
   { Arch::arm, 9 },
@@ -167,5 +165,4 @@
   {"O-MR1", 27},
   {"P", 28},
   {"Q", 29},
-  {"R", 30},
 };
diff --git a/tools/versioner/src/Driver.cpp b/tools/versioner/src/Driver.cpp
index bad63ad..3927480 100644
--- a/tools/versioner/src/Driver.cpp
+++ b/tools/versioner/src/Driver.cpp
@@ -126,7 +126,14 @@
 
   cmd.push_back("-DANDROID");
   cmd.push_back("-D__ANDROID_API__="s + std::to_string(type.api_level));
+  // FIXME: Re-enable FORTIFY properly once our clang in external/ is new enough
+  // to support diagnose_if without giving us syntax errors.
+#if 0
   cmd.push_back("-D_FORTIFY_SOURCE=2");
+#else
+  cmd.push_back("-D_FORTIFY_SOURCE=0");
+  cmd.push_back("-D__BIONIC_DECLARE_FORTIFY_HELPERS");
+#endif
   cmd.push_back("-D_GNU_SOURCE");
   cmd.push_back("-D_FILE_OFFSET_BITS="s + std::to_string(type.file_offset_bits));
 
@@ -251,7 +258,7 @@
 
   Compiler.setInvocation(std::move(invocation));
   Compiler.setDiagnostics(diags.get());
-  Compiler.createFileManager(vfs);
+  Compiler.setVirtualFileSystem(vfs);
 
   VersionerASTAction versioner_action(header_database, type);
   if (!Compiler.ExecuteAction(versioner_action)) {
diff --git a/tools/versioner/src/SymbolFileParser.cpp b/tools/versioner/src/SymbolFileParser.cpp
index 1b4adae..c312b48 100644
--- a/tools/versioner/src/SymbolFileParser.cpp
+++ b/tools/versioner/src/SymbolFileParser.cpp
@@ -266,23 +266,19 @@
     if (!api_level.empty()) {
       // If an api-level tag is specified, it must be an exact match (mainly
       // for versioner unit tests).
-      return compilation_type.api_level == parseApiLevelValue(api_level);
+      return compilation_type.api_level == decodeApiLevelValue(api_level);
     }
 
-    return compilation_type.api_level >= parseApiLevelValue(intro);
+    return compilation_type.api_level >= decodeApiLevelValue(intro);
   }
 
-  // Parse the integer API level from api-level or introduced tags.
-  int parseApiLevelValue(const std::string& tag) const {
+  // Extract and decode the integer API level from api-level or introduced tags.
+  static int decodeApiLevelValue(const std::string& tag) {
     std::string api_level = tag.substr(tag.find('=') + 1);
     auto it = api_codename_map.find(api_level);
     if (it != api_codename_map.end()) {
       return it->second;
     }
-    if (api_level.find_first_not_of("0123456789") != std::string::npos) {
-      errx(1, "%s:%zu: error: unknown API level codename specified: \"%s\"",
-           file_path.c_str(), curr_line_num, tag.c_str());
-    }
     return std::stoi(api_level);
   }